コード例 #1
0
 /**
  * @param databaseTableDescription - table for columns actually in the database
  * @param configColumns - column names of configurated columns
  */
 private void checkUnknownColumns(
     TableDescription databaseTableDescription, String[] configColumns) {
   Collection<String> c = getUnmappedColumns(databaseTableDescription.getTableName());
   String[] unmappedColumns = c.toArray(new String[0]);
   // check that unmapped columns exist in database
   for (String unmapped : c) {
     assertTrue(
         "Column: "
             + databaseTableDescription.getTableName()
             + "."
             + unmapped
             + " [declared as unknown, but] not in database",
         databaseTableDescription.getColumn(unmapped) != null);
   }
   String[] dbColumns = databaseTableDescription.getColumnNames();
   for (String theDbColumn : dbColumns) {
     if (!containsIgnoreCase(unmappedColumns, theDbColumn)) {
       assertTrue(
           "Table "
               + databaseTableDescription.getTableName()
               + " contains unknown column: '"
               + theDbColumn
               + "'",
           containsIgnoreCase(configColumns, theDbColumn));
     }
   }
 }
コード例 #2
0
 public void assertCatalogsComplete(
     CatalogDescription schemaConfig, CatalogDescription databaseConfig) {
   myFoundErrors.clear();
   String[] tables = schemaConfig.getTableNames();
   for (String theTable : tables) {
     TableDescription xmlTableDescription = schemaConfig.getTable(theTable);
     TableDescription databaseTableDescription =
         databaseConfig.getTable(xmlTableDescription.getTableName().toUpperCase());
     if (databaseTableDescription != null) {
       log("Checking " + databaseTableDescription.getTableName() + "...");
       compareSingleIndexDescription(
           xmlTableDescription.getPrimaryKey(), databaseTableDescription.getPrimaryKey());
       compareColumnDescription(xmlTableDescription, databaseTableDescription);
       compareIndexDescription(xmlTableDescription, databaseTableDescription);
       compareForeignKeyDescription(xmlTableDescription, databaseTableDescription);
       checkUnknownColumns(databaseTableDescription, xmlTableDescription.getColumnNames());
     } else {
       assertTrue(
           "Table: " + xmlTableDescription.getTableName() + "... not found in databaseCatalog!",
           false);
     }
   }
   // TODO RSt - views checking not yet implemented
   // todo [RSt] sequences not yet implemented  -> requires DDLScriptSqlMetaFactory
   // todo [RSt] function based indices not yet implemented  -> requires DDLScriptSqlMetaFactory
   // todo [RSt] missing indexes/foreignkeys in schemaConfig not detected -> requires
   // DDLScriptSqlMetaFactory
   throwAssertions();
 }