use of org.dbunit.dataset.FilteredDataSet in project head by mifos.
the class MifosIntegrationTestCase method dbVerificationTearDown.
private void dbVerificationTearDown() throws Exception, FileNotFoundException, MalformedURLException {
if (verifyDatabaseState) {
Connection connection = StaticHibernateUtil.getSessionTL().connection();
connection.setAutoCommit(false);
DatabaseConnection dbUnitConnection = new DatabaseConnection(connection);
IDataSet upgradeDataDump = new FilteredDataSet(excludeTables, dbUnitConnection.createDataSet());
String tmpDir = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator");
FlatXmlDataSet.write(upgradeDataDump, new FileOutputStream(tmpDir + "upgradeDataDump.xml"));
FlatXmlDataSetBuilder fxmlBuilder = new FlatXmlDataSetBuilder();
upgradeDataDump = fxmlBuilder.build(new File(tmpDir + "upgradeDataDump.xml"));
Assertion.assertEquals(latestDataDump, upgradeDataDump);
}
}
use of org.dbunit.dataset.FilteredDataSet in project head by mifos.
the class MifosIntegrationTestCase method dbVerificationSetUp.
private void dbVerificationSetUp() throws Exception {
if (verifyDatabaseState) {
excludeTables.excludeTable("BATCH_JOB_EXECUTION");
Connection connection = StaticHibernateUtil.getSessionTL().connection();
connection.setAutoCommit(false);
DatabaseConnection dbUnitConnection = new DatabaseConnection(connection);
latestDataDump = new FilteredDataSet(excludeTables, dbUnitConnection.createDataSet());
String tmpDir = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator");
FlatXmlDataSet.write(latestDataDump, new FileOutputStream(tmpDir + "latestDataDump.xml"));
FlatXmlDataSetBuilder fxmlBuilder = new FlatXmlDataSetBuilder();
latestDataDump = fxmlBuilder.build(new File(tmpDir + "latestDataDump.xml"));
}
}
use of org.dbunit.dataset.FilteredDataSet in project cia by Hack23.
the class DataSetConnectionFactory method getDataSet.
/**
* Gets the data set.
*
* @param connection
* the connection
* @return the data set
* @throws DatasetFactoryException
* the dataset factory exception
*/
public IDataSet getDataSet(final Connection connection) throws DatasetFactoryException {
DatabaseConnection databaseConnection;
try {
databaseConnection = new DatabaseConnection(connection);
final ITableFilter filter = new DatabaseSequenceFilter(databaseConnection);
return new FilteredDataSet(filter, databaseConnection.createDataSet());
} catch (DatabaseUnitException | SQLException e) {
throw new DatasetFactoryException(e);
}
}
Aggregations