Skip to content

Commit

Permalink
Update ParameterizedSuite to work with Junit 4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Jan 13, 2010
1 parent 276071c commit 837b5c1
Show file tree
Hide file tree
Showing 32 changed files with 110 additions and 238 deletions.
10 changes: 2 additions & 8 deletions symmetric/pom.xml
Expand Up @@ -445,7 +445,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -497,14 +497,8 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>2.5.6</version>
<version>${springframework.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
Expand Down
Expand Up @@ -11,10 +11,6 @@ public class ParameterFilterTest extends AbstractDatabaseTest {
public ParameterFilterTest() throws Exception {
}

public ParameterFilterTest(String db) {
super(db);
}

@Test
public void testParameterFilter() {
IParameterService service = find(Constants.PARAMETER_SERVICE);
Expand Down
Expand Up @@ -73,10 +73,6 @@ public DataExtractorTest() throws Exception {
super();
}

public DataExtractorTest(String dbName) {
super(dbName);
}

@Before
public void setUp() {
dataExtractor = (IDataExtractor) find(Constants.DATA_EXTRACTOR);
Expand Down
Expand Up @@ -45,10 +45,6 @@ public XmlPublisherFilterTest() throws Exception {
super();
}

public XmlPublisherFilterTest(String dbName) {
super(dbName);
}

@Before
public void setUp() {
ctx = new DataLoaderContext();
Expand Down
Expand Up @@ -69,10 +69,6 @@ public AbstractDataLoaderTest() throws Exception {
super();
}

public AbstractDataLoaderTest(String dbType) {
super(dbType);
}

protected MockTransportManager getTransportManager() {
if (transportManager == null) {
transportManager = new MockTransportManager();
Expand Down
Expand Up @@ -44,10 +44,6 @@ public AdditiveDataLoaderFilterTest() throws Exception {
super();
}

public AdditiveDataLoaderFilterTest(String dbName) {
super(dbName);
}

@Before
public void setUp() {

Expand Down
Expand Up @@ -53,10 +53,6 @@ public class DataLoaderTest extends AbstractDataLoaderTest {
public DataLoaderTest() throws Exception {
}

public DataLoaderTest(String db) {
super(db);
}

@Test
public void testInsertExisting() throws Exception {
String[] values = { getNextId(), "string2", "string not null2", "char2", "char not null2",
Expand Down
Expand Up @@ -51,10 +51,6 @@ public AcknowledgeServiceTest() throws Exception {
super();
}

public AcknowledgeServiceTest(String dbName) {
super(dbName);
}

@Before
public void setUp() {
ackService = (IAcknowledgeService) find(Constants.ACKNOWLEDGE_SERVICE);
Expand Down
Expand Up @@ -32,10 +32,6 @@ public ClusterServiceTest() throws Exception {
super();
}

public ClusterServiceTest(String dbName) {
super(dbName);
}

@Test
public void testLock() throws Exception {
final IClusterService service = (IClusterService) find(Constants.CLUSTER_SERVICE);
Expand Down
Expand Up @@ -42,10 +42,6 @@ public ConfigurationServiceTest() throws Exception {
super();
}

public ConfigurationServiceTest(String dbName) {
super(dbName);
}

@Before
public void setUp() {
configurationService = (IConfigurationService) find(Constants.CONFIG_SERVICE);
Expand Down
Expand Up @@ -52,10 +52,6 @@ public DataExtractorServiceTest() throws Exception {
super();
}

public DataExtractorServiceTest(String dbName) {
super(dbName);
}

@Before
public void setUp() {
dataExtractorService = (IDataExtractorService) find(Constants.DATAEXTRACTOR_SERVICE);
Expand Down
Expand Up @@ -51,10 +51,6 @@ public DataLoaderServiceTest() throws Exception {
super();
}

public DataLoaderServiceTest(String dbType) {
super(dbType);
}

protected Level setLoggingLevelForTest(Level level) {
Level old = Logger.getLogger(DataLoaderService.class).getLevel();
Logger.getLogger(DataLoaderService.class).setLevel(level);
Expand Down
Expand Up @@ -17,10 +17,6 @@ public DataServiceTest() throws Exception {
super();
}

public DataServiceTest(String dbType) {
super(dbType);
}

@Test
public void testGetHeartbeatListeners() throws Exception {
DataService ds = new DataService();
Expand Down
Expand Up @@ -46,10 +46,6 @@ public NodeServiceTest() throws Exception {
super();
}

public NodeServiceTest(String dbName) {
super(dbName);
}

@Before
public void setUp() {
nodeService = (INodeService) find(Constants.NODE_SERVICE);
Expand Down
Expand Up @@ -59,11 +59,7 @@ public class OutgoingBatchServiceTest extends AbstractDatabaseTest {
public OutgoingBatchServiceTest() throws Exception {
super();
}

public OutgoingBatchServiceTest(String dbName) {
super(dbName);
}


@Before
public void setUp() {
batchService = (IOutgoingBatchService) find(Constants.OUTGOING_BATCH_SERVICE);
Expand Down
Expand Up @@ -12,10 +12,6 @@ public ParameterServiceTest() throws Exception {
super();
}

public ParameterServiceTest(String dbName) {
super(dbName);
}

@Test
public void testParameterGetFromDefaults() {
Assert.assertEquals("Unexpected default table prefix found.", getParameterService().getString(
Expand Down
Expand Up @@ -38,11 +38,7 @@ public class PurgeServiceTest extends AbstractDatabaseTest {
public PurgeServiceTest() throws Exception {
super();
}

public PurgeServiceTest(String dbName) {
super(dbName);
}


@Test
public void testThatPurgeExecutes() {
IPurgeService service = find(Constants.PURGE_SERVICE);
Expand Down
Expand Up @@ -48,10 +48,6 @@ public RegistrationServiceTest() throws Exception {
super();
}

public RegistrationServiceTest(String dbName) {
super(dbName);
}

@Before
public void setUp() {
nodeService = find(Constants.NODE_SERVICE);
Expand Down
Expand Up @@ -29,10 +29,6 @@ public class RouterServiceTest extends AbstractDatabaseTest {
final static Node NODE_GROUP_NODE_2 = new Node("00002",TestConstants.TEST_CLIENT_NODE_GROUP);
final static Node NODE_GROUP_NODE_3 = new Node("00003",TestConstants.TEST_CLIENT_NODE_GROUP);

public RouterServiceTest(String dbName) {
super(dbName);
}

public RouterServiceTest() throws Exception {
}

Expand Down
Expand Up @@ -27,10 +27,6 @@ public StatisticServiceTest() throws Exception {
super();
}

public StatisticServiceTest(String dbName) {
super(dbName);
}

@Before
public void setUp() {
statisticService = AppUtils.find(Constants.STATISTIC_SERVICE, getSymmetricEngine());
Expand Down
Expand Up @@ -89,10 +89,6 @@ public TriggerRouterServiceTest() throws Exception {
super();
}

public TriggerRouterServiceTest(String dbName) {
super(dbName);
}

@Test
public void testSchemaSync() throws Exception {
ITriggerRouterService service = getTriggerRouterService();
Expand Down
Expand Up @@ -47,16 +47,16 @@ public class AbstractDatabaseTest {

private String database = TestSetupUtil.getRootDbTypes(DatabaseTestSuite.DEFAULT_TEST_PREFIX)[0];

static boolean standalone = false;

public AbstractDatabaseTest(String dbName) {
this.database = dbName;
static boolean standalone = true;
public void init(String database) {
this.database = database;
}

public AbstractDatabaseTest() throws Exception {
if (!standalone) {
if (standalone) {
logger.info("Running test in standalone mode against " + database);
standalone = true;
standalone = false;
TestSetupUtil.setup(DatabaseTestSuite.DEFAULT_TEST_PREFIX, TestConstants.TEST_CONTINUOUS_SETUP_SCRIPT,
null, database);
}
Expand Down
Expand Up @@ -39,21 +39,20 @@ public class AbstractIntegrationTest {
protected String root;
protected JdbcTemplate rootJdbcTemplate;
protected JdbcTemplate clientJdbcTemplate;
protected static boolean standalone = false;
protected static boolean standalone = true;

public AbstractIntegrationTest(String client, String root) {
public void init(String client, String root) {
this.client = client;
this.root = root;
}

public AbstractIntegrationTest() throws Exception {
if (!standalone) {
if (standalone) {
String[] databases = TestSetupUtil.lookupDatabasePairs(DatabaseTestSuite.DEFAULT_TEST_PREFIX).iterator()
.next();
logger.info("Running test in standalone mode with databases " + databases[0] + " and " + databases[1]);
this.root = databases[1];
this.client = databases[0];
standalone = true;
init(databases[0],databases[1]);
standalone = false;
TestSetupUtil.setup(DatabaseTestSuite.DEFAULT_TEST_PREFIX, TestConstants.TEST_ROOT_DOMAIN_SETUP_SCRIPT,
databases[0], databases[1]);
}
Expand Down
Expand Up @@ -29,15 +29,18 @@ public class CleanupTest {
String client;
String root;

public CleanupTest(String client, String root) throws Exception {
public CleanupTest() throws Exception {
}

public void init(String client, String root) {
this.client = client;
this.root = root;
}

public CleanupTest(String client) throws Exception {
this.client = null;
}

public void init(String database) {
this.root = database;
}

@Test
public void cleanup() throws Exception {
TestSetupUtil.cleanup();
Expand Down
Expand Up @@ -28,10 +28,6 @@

public class CrossCatalogSyncTest extends AbstractDatabaseTest {

public CrossCatalogSyncTest(String db) {
super(db);
}

public CrossCatalogSyncTest() throws Exception {
super();
}
Expand Down
Expand Up @@ -53,22 +53,28 @@
OutgoingBatchServiceTest.class, ParameterServiceTest.class, PurgeServiceTest.class,
RegistrationServiceTest.class, StatisticServiceTest.class, XmlPublisherFilterTest.class,
AdditiveDataLoaderFilterTest.class, DataServiceTest.class, CleanupTest.class })
public class DatabaseTestSuite extends AbstractDatabaseTest {
public class DatabaseTestSuite {

String database;

public static final String DEFAULT_TEST_PREFIX = "test";

public DatabaseTestSuite() throws Exception {
}

public void init(String database) {
this.database = database;
}

@Parameters
public static Collection<String[]> lookupDatabases() {
return TestSetupUtil.lookupDatabases(DEFAULT_TEST_PREFIX);
}

public DatabaseTestSuite(String dbName) {
super(dbName);
}

@Test
public void setup() throws Exception {
TestSetupUtil.setup(DEFAULT_TEST_PREFIX, TestConstants.TEST_CONTINUOUS_SETUP_SCRIPT, null, getDatabase());
AbstractDatabaseTest.standalone = false;
TestSetupUtil.setup(DEFAULT_TEST_PREFIX, TestConstants.TEST_CONTINUOUS_SETUP_SCRIPT, null, database);
}

}
Expand Up @@ -32,10 +32,6 @@ public class FunkyDataTypesTest extends AbstractDatabaseTest {
static final Log logger = LogFactory.getLog(FunkyDataTypesTest.class);
static final String TABLE_NAME = "TEST_ORACLE_DATES";

public FunkyDataTypesTest(String dbName) {
super(dbName);
}

public FunkyDataTypesTest() throws Exception {
super();
}
Expand Down
Expand Up @@ -39,14 +39,15 @@ public static Collection<String[]> lookupClientServerDatabases() {

String root;
String client;

public IntegrationTestSuite(String client, String root) {
public void init(String client, String root) {
this.client = client;
this.root = root;
}

@Test
public void setup() throws Exception {
AbstractIntegrationTest.standalone = false;
TestSetupUtil.setup(TEST_PREFIX, TestConstants.TEST_ROOT_DOMAIN_SETUP_SCRIPT, client, root);
}

Expand Down

0 comments on commit 837b5c1

Please sign in to comment.