コード例 #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
 private boolean indexColumnsEqual(
     IndexDescription xmlIndexDescription, IndexDescription databaseIndexDescription) {
   boolean columnsOK =
       xmlIndexDescription.getColumnSize() == databaseIndexDescription.getColumnSize();
   if (columnsOK) {
     for (int i = 0; i < xmlIndexDescription.getColumnSize(); i++) {
       String xmlColumn = xmlIndexDescription.getColumn(i);
       String dbColumn = databaseIndexDescription.getColumn(i);
       if (xmlColumn.equalsIgnoreCase(dbColumn)) {
         assertTrue(
             "Table: "
                 + xmlIndexDescription.getTableName()
                 + "... Wrong Orderdirection! Column:"
                 + xmlIndexDescription.getColumn(i)
                 + " expected OrderDirection: "
                 + xmlIndexDescription.getOrderDirection(i)
                 + " databaseOrderDirection: "
                 + databaseIndexDescription.getOrderDirection(i),
             xmlIndexDescription.getOrderDirection(i)
                 == databaseIndexDescription.getOrderDirection(i));
       } else {
         columnsOK = false;
       }
     }
   }
   return columnsOK;
 }