コード例 #1
0
 protected void compareSingleIndexDescription(
     IndexDescription xmlIndexDescription, IndexDescription databaseIndexDescription) {
   if (xmlIndexDescription == null && databaseIndexDescription == null) return;
   if (xmlIndexDescription == null) {
     assertTrue(
         "Table: "
             + databaseIndexDescription.getTableName()
             + "... IndexName not expected! "
             + databaseIndexDescription.getIndexName()
             + " databaseIndexName: "
             + databaseIndexDescription.getIndexName(),
         false);
     return;
   }
   if (databaseIndexDescription == null) {
     assertTrue(
         "Table: "
             + xmlIndexDescription.getTableName()
             + "...DatabaseIndexName not found!! Expected IndexName: "
             + xmlIndexDescription.getIndexName(),
         false);
     return;
   }
   if (xmlIndexDescription.isFunctionBased() || databaseIndexDescription.isFunctionBased()) {
     log("function based not yet supported"); // todo [RSt] nyi
     return;
   }
   if (xmlIndexDescription.getIndexName() == null
       || xmlIndexDescription
           .getIndexName()
           .equalsIgnoreCase(databaseIndexDescription.getIndexName())) {
     boolean columnsOK = indexColumnsEqual(xmlIndexDescription, databaseIndexDescription);
     if (!columnsOK) {
       assertTrue(
           "Table: "
               + xmlIndexDescription.getTableName()
               + ", index: "
               + xmlIndexDescription.getIndexName()
               + "... Columns differ! expected: "
               + xmlIndexDescription.getColumns()
               + " but was "
               + databaseIndexDescription.getColumns(),
           false);
     }
   } else {
     assertTrue(
         "Table: "
             + xmlIndexDescription.getTableName()
             + "... Wrong Indexname! Expected IndexName: "
             + xmlIndexDescription.getIndexName()
             + " databaseIndexName: "
             + databaseIndexDescription.getIndexName(),
         false);
   }
 }
コード例 #2
0
 protected void compareIndexDescription(
     TableDescription xmlTableDescription, TableDescription databaseTableDescription) {
   for (int i = 0; i < xmlTableDescription.getIndexSize(); i++) {
     IndexDescription xmlIndexDescription = xmlTableDescription.getIndex(i);
     IndexDescription databaseIndexDescription = null;
     if (xmlIndexDescription.getIndexName() != null) {
       databaseIndexDescription =
           databaseTableDescription.getIndex(xmlIndexDescription.getIndexName());
     } else {
       for (IndexDescription each : databaseTableDescription.getIndices()) {
         if (indexColumnsEqual(xmlIndexDescription, each)) {
           databaseIndexDescription = each;
           break;
         }
       }
       if (databaseIndexDescription == null)
         databaseIndexDescription = databaseTableDescription.getPrimaryKey();
     }
     compareSingleIndexDescription(xmlIndexDescription, databaseIndexDescription);
   }
 }