try {
report.setDatabasePassword(DB_PASSWORD);
report.read(EXAMPLE_REPORT);
Database db = (Database)report.getDataSource();
SQLQuery query = (SQLQuery)db.getQuery();
assertEquals("{jobs.ID} < 100", query.getWhereClause());
assertNotNull(db.findColumn("ALL_CAPS.COL1"));
assertNotNull(db.findColumn("jobs.fk_office_id"));
assertNotNull(db.findColumn("office.email"));
assertNotNull(db.findColumn("aggregate_test.value"));
// We should only have two tables in the query.
query.findSelectablesUsed();
assertEquals(2, query.getNumTables());
db.reset(DRIVER_CLASS_NAME, CONNECTION_INFO, DB_NAME, DB_USER,
DB_PASSWORD);
// The query doesn't have to be the same object, but it's where
// clause (and all other information) should darned well be the same.
assertEquals("{jobs.ID} < 100", query.getWhereClause());
assertNotNull(db.findColumn("public.ALL_CAPS.COL1"));
assertNotNull(db.findColumn("public.jobs.fk_office_id"));
assertNotNull(db.findColumn("public.office.email"));
assertNotNull(db.findColumn("public.aggregate_test.value"));
// Make sure we still have two tables in the query.
query.findSelectablesUsed();
assertEquals(2, query.getNumTables());
}
catch (Exception e) {
fail(e.toString());
}
}