use of org.dbunit.database.IDatabaseConnection in project maven-plugins by apache.
the class Mjavadoc180Test method testMJAVADOC180.
/**
* This is some test javadoc. This test method has a phony dependency on DB Unit.
*/
public void testMJAVADOC180() {
IDatabaseConnection phony = null;
final HelloWorld hw = new HelloWorld();
assertTrue("Hello World".equals(hw.hello("Hello World")));
}
use of org.dbunit.database.IDatabaseConnection in project ORCID-Source by ORCID.
the class DBUnitTest method initDBUnitData.
public static void initDBUnitData(List<String> flatXMLDataFiles) throws Exception {
IDatabaseConnection connection = getDBConnection();
cleanClientSourcedProfiles(connection);
cleanAll(connection);
for (String flatXMLDataFile : flatXMLDataFiles) {
DatabaseOperation.INSERT.execute(connection, getDataSet(flatXMLDataFile));
}
connection.close();
}
use of org.dbunit.database.IDatabaseConnection in project ORCID-Source by ORCID.
the class DBUnitTest method removeDBUnitData.
public static void removeDBUnitData(List<String> flatXMLDataFiles) throws Exception {
IDatabaseConnection connection = getDBConnection();
cleanClientSourcedProfiles(connection);
cleanAll(connection);
connection.close();
}
use of org.dbunit.database.IDatabaseConnection in project head by mifos.
the class DbUnitUtilities method getDataSetForTables.
/**
* Returns a DbUnit DataSet for several tables.
* @param driverManagerDataSource TODO
* @param tableNames
* @return IDataSet
* @throws Exception
*/
// one of the dependent methods throws Exception
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public IDataSet getDataSetForTables(DriverManagerDataSource driverManagerDataSource, String[] tableNames) throws Exception {
Connection jdbcConnection = null;
IDataSet databaseDataSet = null;
try {
jdbcConnection = DataSourceUtils.getConnection(driverManagerDataSource);
IDatabaseTester databaseTester = new DataSourceDatabaseTester(driverManagerDataSource);
IDatabaseConnection databaseConnection = databaseTester.getConnection();
databaseDataSet = databaseConnection.createDataSet(tableNames);
} finally {
jdbcConnection.close();
DataSourceUtils.releaseConnection(jdbcConnection, driverManagerDataSource);
}
return databaseDataSet;
}
use of org.dbunit.database.IDatabaseConnection in project head by mifos.
the class DatabaseTestUtils method cleanAndInsertDataSet.
private void cleanAndInsertDataSet(DriverManagerDataSource dataSource, IDataSet dataSet) throws DatabaseUnitException, SQLException {
Connection jdbcConnection = null;
ReplacementDataSet replacementDataSet = getDataSetWithNullsReplaced(dataSet);
try {
jdbcConnection = DataSourceUtils.getConnection(dataSource);
IDatabaseConnection databaseConnection = new DatabaseConnection(jdbcConnection);
databaseConnection.getConfig().setProperty(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES, Boolean.TRUE);
DatabaseOperation.CLEAN_INSERT.execute(databaseConnection, replacementDataSet);
} finally {
if (null != jdbcConnection) {
jdbcConnection.close();
}
DataSourceUtils.releaseConnection(jdbcConnection, dataSource);
}
}
Aggregations