use of io.shardingjdbc.core.common.env.DatabaseEnvironment in project sharding-jdbc by shardingjdbc.
the class AbstractSQLAssertTest method importAllDataSet.
protected static void importAllDataSet(final List<String> dataSetFiles) throws Exception {
for (DatabaseType databaseType : getDatabaseTypes()) {
DatabaseEnvironment dbEnv = new DatabaseEnvironment(databaseType);
for (String each : dataSetFiles) {
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 io.shardingjdbc.core.common.env.DatabaseEnvironment 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();
}
}
}
}
Aggregations