Java Code Examples for org.dbunit.IDatabaseTester#onSetup()

The following examples show how to use org.dbunit.IDatabaseTester#onSetup() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSQLTest.java    From sharding-jdbc-1.5.1 with Apache License 2.0 5 votes vote down vote up
@Before
public final void importDataSet() throws Exception {
    for (DatabaseType databaseType : CURRENT_TEST_MODE.databaseTypes()) {
        DataBaseEnvironment dbEnv = new DataBaseEnvironment(databaseType);
        for (String each : getDataSetFiles()) {
            InputStream is = AbstractSQLTest.class.getClassLoader().getResourceAsStream(each);
            IDataSet dataSet = new FlatXmlDataSetBuilder().build(new InputStreamReader(is));
            IDatabaseTester databaseTester = new ShardingJdbcDatabaseTester(dbEnv.getDriverClassName(), dbEnv.getURL(getDatabaseName(each)),
                    dbEnv.getUsername(), dbEnv.getPassword(), dbEnv.getSchema(getDatabaseName(each)));
            databaseTester.setSetUpOperation(DatabaseOperation.CLEAN_INSERT);
            databaseTester.setDataSet(dataSet);
            databaseTester.onSetup();
        }
    }
}
 
Example 2
Source File: JdbcTest.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
private static void cleanlyInsert(IDataSet dataSet) throws Exception {
	IDatabaseTester databaseTester = new JdbcDatabaseTester(JDBC_DRIVER, JDBC_URL, USER,
		PASSWORD);
	databaseTester.setSetUpOperation(DatabaseOperation.CLEAN_INSERT);
	databaseTester.setDataSet(dataSet);
	ConnectionConfigurator operationListener = new ConnectionConfigurator()
		.setDataTypeFactory(new H2DataTypeFactory());
	databaseTester.setOperationListener(operationListener);
	databaseTester.onSetup();
}
 
Example 3
Source File: H2DatabaseTestCase.java    From Zebra with Apache License 2.0 5 votes vote down vote up
protected void cleanlyInsert(String driver, String jdbcUrl, String user, String password, IDataSet dataSet)
		throws Exception {
	IDatabaseTester databaseTester = new JdbcDatabaseTester(driver, jdbcUrl, user, password);
	databaseTester.setSetUpOperation(DatabaseOperation.CLEAN_INSERT);
	databaseTester.setDataSet(dataSet);
	databaseTester.onSetup();
}