if (databaseTester == null) {
throw new IllegalStateException(
"databaseTester is null; must configure or set it first");
}
IDatabaseConnection connection = databaseTester.getConnection();
try {
int count = tableDefs.length;
LOG.info("verifyData: about to verify {} tables={}", new Integer(
count), tableDefs);
if (count == 0) {
LOG.warn("No tables to verify;"
+ " no VerifyTableDefinitions specified");
}
for (int i = 0; i < count; i++) {
VerifyTableDefinition td = tableDefs[i];
String[] excludeColumns = td.getColumnExclusionFilters();
String[] includeColumns = td.getColumnInclusionFilters();
String tableName = td.getTableName();
LOG.info("Verifying table '{}'", tableName);
LOG.debug(" Loading its rows from expected dataset");
ITable expectedTable = null;
try {
expectedTable = expectedDs.getTable(tableName);
} catch (DataSetException e) {
final String msg =
"Problem obtaining table '" + tableName
+ "' from expected dataset";
LOG.error(msg, e);
throw new DataSetException(msg, e);
}
LOG.debug(" Loading its rows from actual table");
ITable actualTable = null;
try {
actualTable = connection.createTable(tableName);
} catch (DataSetException e) {
final String msg =
"Problem obtaining table '" + tableName
+ "' from actual dataset";
LOG.error(msg, e);
throw new DataSetException(msg, e);
}
verifyData(expectedTable, actualTable, excludeColumns,
includeColumns);
}
} finally {
LOG.debug("verifyData: Verification done, closing connection");
connection.close();
}
}