Java Code Examples for org.dbunit.JdbcDatabaseTester

The following examples show how to use org.dbunit.JdbcDatabaseTester. These examples are extracted from open source projects. 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 Project: metanome-algorithms   Source File: JdbcTest.java    License: 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 Project: Zebra   Source File: H2DatabaseTestCase.java    License: 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 Project: development   Source File: AppControllerDBTester.java    License: 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 Project: yes-cart   Source File: BasePaymentModuleDBTestCase.java    License: 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 Project: yes-cart   Source File: AbstractTestDAO.java    License: 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 Project: tutorials   Source File: OldSchoolDbUnitTest.java    License: 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;
}