Permalink
Browse files

migrated parameterized testng test to junit4

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
  • Loading branch information...
1 parent c0fec2d commit c4bef96204c8c45df2915d4e0850fcfaf26ba552 @ifedorenko ifedorenko committed Jan 6, 2013
View
30 ...st/java/org/sonatype/nexus/integrationtests/nexus4066/Nexus4066TaskMutualExclusionIT.java
@@ -16,12 +16,16 @@
import static org.hamcrest.Matchers.equalTo;
import static org.sonatype.nexus.test.utils.TaskScheduleUtil.newProperty;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
import org.sonatype.nexus.integrationtests.AbstractNexusIntegrationTest;
import org.sonatype.nexus.rest.model.ScheduledServiceListResource;
import org.sonatype.nexus.test.utils.TaskScheduleUtil;
@@ -33,18 +37,19 @@
* Check for tasks mutual exclusion (like two reindex tasks for same repository will run serialized, one will "win" and
* run, one will "loose" and wait for winner to finish).
*/
+@RunWith( Parameterized.class )
public class Nexus4066TaskMutualExclusionIT
extends AbstractNexusIntegrationTest
{
/*
* When last argument is false mean task should run in parallel. When it is true task should run serialized.
*/
- @DataProvider( name = "data", parallel = false )
- public Object[][] createData()
+ @Parameters
+ public static List<Object[]> createData()
{
// GofG == group of groups
- return new Object[][] {//
+ return Arrays.asList(new Object[][] {//
{ "repo", "group", true },//
{ "repo", "repo2", false },//
{ "repo", "group2", false },//
@@ -60,9 +65,22 @@
{ "group2", "GofG2", true },//
{ "repo", "GofG2", false },//
{ "group", "GofG2", false },//
- };
+ });
}
+ private final String repo1;
+
+ private final String repo2;
+
+ private final boolean shouldWait;
+
+ public Nexus4066TaskMutualExclusionIT( String repo1, String repo2, boolean shouldWait )
+ {
+ this.repo1 = repo1;
+ this.repo2 = repo2;
+ this.shouldWait = shouldWait;
+ }
+
private List<ScheduledServiceListResource> tasks;
@Before
@@ -89,8 +107,8 @@ public void killTasks()
TaskScheduleUtil.deleteAllTasks();
}
- @Test( dataProvider = "data" )
- public void run( String repo1, String repo2, boolean shouldWait )
+ @Test
+ public void run()
throws Exception
{

0 comments on commit c4bef96

Please sign in to comment.