use of org.dbunit.dataset.ITableIterator in project sharding-jdbc by shardingjdbc.
the class SQLAssertHelper method assertResult.
public void assertResult(final Connection connection, final File file) throws MalformedURLException, SQLException, DatabaseUnitException {
if (sql.contains("TEMP")) {
return;
}
ITableIterator expectedTableIterator = new FlatXmlDataSetBuilder().build(file).iterator();
try (Connection conn = connection) {
while (expectedTableIterator.next()) {
ITable expectedTable = expectedTableIterator.getTable();
String actualTableName = expectedTable.getTableMetaData().getTableName();
String verifySql = "SELECT * FROM " + actualTableName + " WHERE status = '" + getStatus(file) + "'" + getOrderByCondition(actualTableName);
ITable actualTable = DBUnitUtil.getConnection(new DatabaseEnvironment(DatabaseType.valueFrom(conn.getMetaData().getDatabaseProductName())), conn).createQueryTable(actualTableName, verifySql);
Assertion.assertEquals(expectedTable, actualTable);
}
}
}
Aggregations