XMLCatalogSchemaManager { public boolean isInitialized(Connection conn) throws CatalogException { if (!isLoaded()) { throw new CatalogException("Database schema files are not loaded."); } boolean result = true; for (DatabaseObject object: catalogStore.getSchema().getObjects()) { try { if (DatabaseObjectType.INDEX == object.getType()) { result &= checkExistence(conn, object.getType(), object.getDependsOn(), object.getName()); } else { result &= checkExistence(conn, object.getType(), object.getName()); } } catch (SQLException e) { throw new CatalogException(e.getMessage(), e); } if (!result) { break; } } return result; } XMLCatalogSchemaManager(String schemaPath); void dropBaseSchema(Connection conn); void createBaseSchema(Connection conn); void upgradeBaseSchema(Connection conn, int currentVersion); boolean isInitialized(Connection conn); boolean isLoaded();  }
@Test public void testIsInitialized() throws Exception { XMLCatalogSchemaManager manager; Statement stmt; manager = new XMLCatalogSchemaManager("schemas/derbytest/querytest"); assertThat(manager.isLoaded(), is(true)); stmt = conn.createStatement(); stmt.executeUpdate("CREATE SCHEMA " + manager.getCatalogStore().getSchema().getSchemaName()); stmt.executeUpdate("SET CURRENT SCHEMA " + manager.getCatalogStore().getSchema().getSchemaName()); stmt.executeUpdate("CREATE TABLE TESTTABLE1 (COL1 INT, COL2 VARCHAR(10))"); assertThat(manager.isInitialized(conn), is(false)); stmt.addBatch("CREATE TABLE TESTTABLE2 (COL1 INT, COL2 VARCHAR(10))"); stmt.addBatch("CREATE INDEX TESTINDEX1 ON TESTTABLE1 (COL1)"); stmt.addBatch("CREATE TRIGGER TESTTRIGGER1 " + " AFTER INSERT ON TESTTABLE1 " + " REFERENCING NEW AS NEWROW " + " FOR EACH ROW " + " INSERT INTO TESTTABLE2 " + " (COL1, COL2) " + " VALUES " + " (NEWROW.COL1, NEWROW.COL2)"); stmt.addBatch("CREATE SEQUENCE TESTSEQ AS INT"); stmt.addBatch("CREATE VIEW TESTVIEW (TESTTEXT) AS VALUES 'Text1', 'Text2'"); stmt.executeBatch(); assertThat(manager.isInitialized(conn), is(true)); }