hypersonicMgr.useCleanupWith(new Executor() {
public void execute() throws Exception {
InternalJDBCRepository repository = createRepository(
hypersonicMgr.getSource(), null, "#dp");
JDBCRepositoryConnection connection =
(JDBCRepositoryConnection) repository.connect();
JDBCDeviceRepositoryAccessor accessor =
new JDBCDeviceRepositoryAccessor(repository, location);
Connection conn = connection.getConnection();
createTables(conn);
DefaultPolicyDescriptor descriptor =
new DefaultPolicyDescriptor();
descriptor.setCategory("category");
DefaultStructurePolicyType type =
new DefaultStructurePolicyType();
type.addFieldType("f1", new DefaultBooleanPolicyType());
type.addFieldType("f2", new DefaultRangePolicyType(2, 99));
type.complete();
descriptor.setPolicyType(type);
accessor.addPolicyDescriptor(connection, "structure", descriptor);
// Check the database contents
checkCategoryRow(conn, null, 0, "category");
checkPolicyTypeRow(conn, null, "structure", 0, 0);
checkTypesRow(conn, "TYPE_INSTANCE_ID=0", 0, 7);
// structure row and dependent boolean type
checkTypesStructureRow(conn, "FIELDNAME='f1'", 0, "f1", 1);
checkTypesRow(conn, "TYPE_INSTANCE_ID=1", 1, 0);
// structure row and dependent range type
checkTypesStructureRow(conn, "FIELDNAME='f2'", 0, "f2", 2);
checkTypesRow(conn, "TYPE_INSTANCE_ID=2", 2, 3);
checkTypesRangeRow(conn, null, 2, 2, 99);
connection.disconnect();
repository.terminate();
}
});
}