private void compareForeignKey( String tableName, ForeignKeyDescription xmlFk, ForeignKeyDescription dbFk) { assertTrue( "Table: " + tableName + "... Wrong ConstraintName! Expected ConstraintName: " + xmlFk.getConstraintName() + " databaseConstraintName: " + dbFk.getConstraintName(), xmlFk.getConstraintName().equalsIgnoreCase(dbFk.getConstraintName())); assertTrue( "Table: " + tableName + ", ConstraintName: " + xmlFk.getConstraintName() + "... Wrong ReferencedTable! Expected RefTable: " + xmlFk.getRefTableName() + " databaseRefTable: " + dbFk.getRefTableName(), xmlFk.getRefTableName().equalsIgnoreCase(dbFk.getRefTableName())); for (int j = 0; j < xmlFk.getColumnSize(); j++) { String xmlColumn = xmlFk.getColumn(j); String xmlRefColumn = xmlFk.getRefColumn(j); assertTrue( "Table: " + tableName + ", ConstraintName: " + xmlFk.getConstraintName() + "... Column not found! Expected Column: " + xmlColumn, dbFk.getColumn(xmlColumn) != -1); if (xmlRefColumn != null) { assertTrue( "Table: " + tableName + ", ConstraintName: " + xmlFk.getConstraintName() + "... ReferencedColumn not found! Expected Column: " + xmlRefColumn, dbFk.getRefColumn(xmlRefColumn) != -1); } } assertTrue( "Table: " + tableName + ", ConstraintName: " + dbFk.getConstraintName() + "... is defined on " + dbFk.getColumnSize() + " columns, but expected " + xmlFk.getColumnSize(), xmlFk.getColumnSize() == dbFk.getColumnSize()); assertTrue( "Table: " + tableName + ", ConstraintName: " + dbFk.getConstraintName() + "... is referencing " + dbFk.getRefColumns().size() + " columns, but expected " + xmlFk.getRefColumns().size(), xmlFk.getRefColumns().size() == dbFk.getRefColumns().size()); if (!StringUtils.equalsIgnoreCase(dbFk.getOnDeleteRule(), xmlFk.getOnDeleteRule())) { log( "Table: " + tableName + ", ConstraintName: " + dbFk.getConstraintName() + "... Different onDelete rules (found " + dbFk.getOnDeleteRule() + ", expected " + xmlFk.getOnDeleteRule() + ")"); } }