use of org.dbunit.dataset.xml.FlatXmlDataSetBuilder in project sharding-jdbc by shardingjdbc.
the class AbstractSQLTest method importDataSet.
protected final void importDataSet() throws Exception {
for (DatabaseType databaseType : getDatabaseTypes()) {
if (databaseType == getCurrentDatabaseType() || null == getCurrentDatabaseType()) {
DatabaseEnvironment dbEnv = new DatabaseEnvironment(databaseType);
for (String each : getInitDataSetFiles()) {
InputStream is = AbstractSQLTest.class.getClassLoader().getResourceAsStream(each);
IDataSet dataSet = new FlatXmlDataSetBuilder().build(new InputStreamReader(is));
IDatabaseTester databaseTester = new ShardingJdbcDatabaseTester(dbEnv.getDriverClassName(), dbEnv.getURL(getDatabaseName(each)), dbEnv.getUsername(), dbEnv.getPassword(), dbEnv.getSchema(getDatabaseName(each)));
databaseTester.setSetUpOperation(DatabaseOperation.CLEAN_INSERT);
databaseTester.setDataSet(dataSet);
databaseTester.onSetup();
}
}
}
}
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
* @return
* @throws java.lang.Exception
*/
@Override
protected IDataSet getDataSet() throws Exception {
FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
builder.setColumnSensing(true);
ReplacementDataSet dataSet = new ReplacementDataSet(builder.build(new FileInputStream(getDataSetFilename())));
dataSet.addReplacementObject("[NULL]", null);
return dataSet;
}
Aggregations