use of org.dbunit.dataset.IDataSet in project api-core by ca-cwds.
the class ClientDaoTest method testUpdate.
@Test
public void testUpdate() throws Exception {
cleanAllAndInsert("/dbunit/Client/update/Client_before_update.xml");
executeInTransaction(sessionFactory, (sessionFactory) -> {
NameType nameType = nameTypeDao.find((short) 1314);
assertNotNull(nameType);
assertEquals("Maiden", nameType.getShortDescription().trim());
assertTrue(nameType.getSystemId().equals((short) 1314));
Client c = dao.find("AaiU7IW0Rt");
assertEquals(0, c.getBirthStateCode());
// NAME_TPC
c.setNameType(nameType);
dao.update(c);
});
IDataSet expectedDataSet = readXmlDataSet("/dbunit/Client/update/Client_after_update.xml");
ITable expectedTable = expectedDataSet.getTable("CLIENT_T");
IDataSet actualDataSet = dbUnitConnection.createDataSet(new String[] { "CLIENT_T" });
ITable actualTable = actualDataSet.getTable("CLIENT_T");
assertTableEquals(expectedTable, actualTable);
}
use of org.dbunit.dataset.IDataSet in project nextprot-api by calipho-sib.
the class GenerateDTDForUserSchema method generateUserDTD.
@Test
public void generateUserDTD() throws Exception {
IDatabaseConnection connection = new DatabaseConnection(dsLocator.getUserDataSource().getConnection());
// write DTD file
IDataSet dataSet = connection.createDataSet();
Writer out = new OutputStreamWriter(new FileOutputStream("user.dtd"));
FlatDtdWriter datasetWriter = new FlatDtdWriter(out);
datasetWriter.setContentModel(FlatDtdWriter.CHOICE);
// You could also use the sequence model which is the default
// datasetWriter.setContentModel(FlatDtdWriter.SEQUENCE);
datasetWriter.write(dataSet);
// delete file after the test
new File(dtdFile).delete();
}
use of org.dbunit.dataset.IDataSet in project SSM by Intel-bigdata.
the class TestTableAggregator method testAggregate.
@Test
public void testAggregate() throws Exception {
createTables(databaseTester.getConnection());
IDataSet dataSet = new XmlDataSet(getClass().getClassLoader().getResourceAsStream("accessCountTable.xml"));
databaseTester.setDataSet(dataSet);
databaseTester.onSetup();
MetaStore metaStore = new MetaStore(druidPool);
prepareFiles(metaStore);
AccessCountTable result = new AccessCountTable("actual", 0L, 0L, false);
AccessCountTable table1 = new AccessCountTable("table1", 0L, 0L, false);
AccessCountTable table2 = new AccessCountTable("table2", 0L, 0L, false);
AccessCountTable table3 = new AccessCountTable("table3", 0L, 0L, false);
metaStore.aggregateTables(result, Lists.newArrayList(table1, table2, table3));
ITable actual = databaseTester.getConnection().createTable(result.getTableName());
ITable expect = databaseTester.getDataSet().getTable("expect");
Assertion.assertEquals(expect, actual);
}
use of org.dbunit.dataset.IDataSet in project head by mifos.
the class CollectionSheetEntryTest method verifyCollectionSheetData.
// one of the dependent methods throws Exception
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
private void verifyCollectionSheetData(String filename) throws Exception {
IDataSet expectedDataSet = dbUnitUtilities.getDataSetFromDataSetDirectoryFile(filename);
IDataSet databaseDataSet = dbUnitUtilities.getDataSetForTables(dataSource, new String[] { ACCOUNT_TRXN, LOAN_TRXN_DETAIL, ACCOUNT_PAYMENT, LOAN_SUMMARY, LOAN_SCHEDULE, LOAN_ACTIVITY_DETAILS, ACCOUNT_STATUS_CHANGE_HISTORY, FINANCIAL_TRXN, CUSTOMER_ACCOUNT_ACTIVITY, CUSTOMER_ATTENDANCE });
verifyTablesWithoutSorting(expectedDataSet, databaseDataSet);
verifyTransactionsAfterSortingTables(expectedDataSet, databaseDataSet);
}
use of org.dbunit.dataset.IDataSet in project head by mifos.
the class DatasetVersionTest method verifyDatabaseVersion.
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
private void verifyDatabaseVersion(String acceptanceDataSetFile) throws Exception {
String[] tablesToValidate = { "APPLIED_UPGRADES" };
IDataSet acceptanceDataSet = dbUnitUtilities.getDataSetFromDataSetDirectoryFile(acceptanceDataSetFile);
IDataSet databaseDataSet = dbUnitUtilities.getDataSetForTables(dataSource, tablesToValidate);
//compare acceptance data set version to db version on running application
dbUnitUtilities.verifyTables(tablesToValidate, acceptanceDataSet, databaseDataSet);
}
Aggregations