org.dbunit.JdbcDatabaseTester Java Examples

The following examples show how to use org.dbunit.JdbcDatabaseTester. 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: 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 #2
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();
}
 
Example #3
Source File: AppControllerDBTester.java    From development with Apache License 2.0 5 votes vote down vote up
public AppControllerDBTester() throws Exception {

        loadPropertiesFile();
        DB_CONNECTION_URL = String.format(DB_CONNECTION_URL,
                getPropertie(DB_TYPE), getPropertie(DB_HOST),
                getPropertie(DB_PORT), getPropertie(DB_NAME));
        databaseTester = new JdbcDatabaseTester(getPropertie(DB_DRIVER),
                DB_CONNECTION_URL, getPropertie(DB_USERNAME),
                getPropertie(DB_PASSWORD));
    }
 
Example #4
Source File: BasePaymentModuleDBTestCase.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
protected AbstractDatabaseTester createDatabaseTester() throws Exception {
    AbstractDatabaseTester dbTester = new JdbcDatabaseTester("org.hsqldb.jdbcDriver", "jdbc:hsqldb:mem:testyespaydb", "sa", "");
    dbTester.setSetUpOperation(DatabaseOperation.REFRESH);
    dbTester.setTearDownOperation(DatabaseOperation.NONE);
    dbTester.setDataSet(createDataSet());
    return dbTester;
}
 
Example #5
Source File: AbstractTestDAO.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * Hook for tests, return null if database tester is not needed.
 *
 * @return null or tester.
 */
protected AbstractDatabaseTester createDatabaseTester() throws Exception {
    AbstractDatabaseTester dbTester = new JdbcDatabaseTester("org.hsqldb.jdbcDriver", "jdbc:hsqldb:mem:" + getDatabaseName(), "sa", "");
    dbTester.setSetUpOperation(DatabaseOperation.REFRESH);
    dbTester.setTearDownOperation(DatabaseOperation.NONE);
    dbTester.setDataSet(createDataSet());
    return dbTester;
}
 
Example #6
Source File: OldSchoolDbUnitTest.java    From tutorials with MIT License 5 votes vote down vote up
private static IDatabaseTester initDatabaseTester() throws Exception {
    JdbcDatabaseTester tester = new JdbcDatabaseTester(JDBC_DRIVER, JDBC_URL, USER, PASSWORD);
    tester.setDataSet(initDataSet());
    tester.setSetUpOperation(DatabaseOperation.REFRESH);
    tester.setTearDownOperation(DatabaseOperation.DELETE_ALL);
    return tester;
}