use of org.dbunit.dataset.xml.FlatXmlDataSetBuilder in project Asqatasun by Asqatasun.
the class AbstractRuleImplementationTestCase method getDataSet.
/**
* Charge le jeu de données à partir d'un fichier XML d'import
* @return
* @throws java.lang.Exception
*/
@Override
protected IDataSet getDataSet() throws Exception {
if (dataset != null) {
return dataset;
}
if (!getInputDataFileName().isEmpty()) {
FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
builder.setColumnSensing(true);
dataset = builder.build(new File(getInputDataFileName()));
return dataset;
} else {
return null;
}
}
use of org.dbunit.dataset.xml.FlatXmlDataSetBuilder in project sharding-jdbc by dangdangdotcom.
the class AbstractDBUnitTest method assertDataSet.
protected void assertDataSet(final String expectedDataSetFile, final Connection connection, final String actualTableName, final String sql) throws SQLException, DatabaseUnitException {
try (Connection conn = connection) {
ITable actualTable = getConnection(conn).createQueryTable(actualTableName, sql);
IDataSet expectedDataSet = new FlatXmlDataSetBuilder().build(new InputStreamReader(AbstractDBUnitTest.class.getClassLoader().getResourceAsStream(expectedDataSetFile)));
assertEquals(expectedDataSet.getTable(actualTableName), actualTable);
}
}
use of org.dbunit.dataset.xml.FlatXmlDataSetBuilder in project sharding-jdbc by dangdangdotcom.
the class AbstractDBUnitTest method assertDataSet.
protected void assertDataSet(final String expectedDataSetFile, final Connection connection, final String actualTableName, final String sql, final Object... params) throws SQLException, DatabaseUnitException {
try (Connection conn = connection;
PreparedStatement ps = conn.prepareStatement(sql)) {
int i = 1;
for (Object each : params) {
ps.setObject(i++, each);
}
ITable actualTable = getConnection(connection).createTable(actualTableName, ps);
IDataSet expectedDataSet = new FlatXmlDataSetBuilder().build(new InputStreamReader(AbstractDBUnitTest.class.getClassLoader().getResourceAsStream(expectedDataSetFile)));
assertEquals(expectedDataSet.getTable(actualTableName), actualTable);
}
}
use of org.dbunit.dataset.xml.FlatXmlDataSetBuilder in project head by mifos.
the class DbUnitUtilities method getDataSetFromFile.
public IDataSet getDataSetFromFile(String filename) throws IOException, DataSetException {
File file = new File(filename);
FlatXmlDataSetBuilder fb = new FlatXmlDataSetBuilder();
fb.setColumnSensing(true);
fb.setDtdMetadata(false);
return fb.build(file);
}
use of org.dbunit.dataset.xml.FlatXmlDataSetBuilder in project Asqatasun by Asqatasun.
the class AbstractDaoTestCase method getDataSet.
/**
* Charge le jeu de données à partir d'un fichier XML d'import
*/
@Override
protected IDataSet getDataSet() throws Exception {
FlatXmlDataSetBuilder flatXmlDataSetBuilder = new FlatXmlDataSetBuilder();
FlatXmlDataSet loadedDataSet = flatXmlDataSetBuilder.build(new FileInputStream(getInputDataFileName()));
return loadedDataSet;
}
Aggregations