private void checkOtherTable(Schema schema, Table otherTable) { assertNotNull("Couldn't find table export_test_other", otherTable); assertSame("Incorrect parent or no parent set", schema, otherTable.getParent()); Iterator<Column> colIt = otherTable.getColumns().iterator(); Column col = colIt.next(); assertSame("Incorrect parent or no parent set", otherTable, col.getParent()); assertEquals("id", col.getName()); assertEquals("bigint", col.getType()); assertEquals(false, col.isNullable()); assertEquals(1, col.getOrder()); assertEquals(false, col.isAutoIncrement()); col = colIt.next(); assertSame("Incorrect parent or no parent set", otherTable, col.getParent()); assertEquals("version", col.getName()); assertEquals("bigint", col.getType()); assertEquals(false, col.isNullable()); assertEquals(2, col.getOrder()); col = colIt.next(); assertSame("Incorrect parent or no parent set", otherTable, col.getParent()); assertEquals("ex_id", col.getName()); assertEquals("bigint", col.getType()); assertEquals(false, col.isNullable()); assertEquals(3, col.getOrder()); col = colIt.next(); assertSame("Incorrect parent or no parent set", otherTable, col.getParent()); assertSame("Incorrect parent or no parent set", otherTable, col.getParent()); assertEquals("local_name", col.getName()); assertEquals("varchar(200)", col.getType()); assertEquals(false, col.isNullable()); assertEquals(4, col.getOrder()); assertEquals(2, otherTable.getIndexes().size()); Iterator<Index> indexIt = otherTable.getIndexes().iterator(); Index index = indexIt.next(); assertSame("Incorrect parent or no parent set", otherTable, index.getParent()); assertEquals("export_test_idx_other_1", index.getName()); assertEquals(true, index.isUnique()); assertEquals(2, index.getColumnNames().size()); assertEquals("ex_id", index.getColumnNames().get(0)); assertEquals("local_name", index.getColumnNames().get(1)); index = indexIt.next(); assertSame("Incorrect parent or no parent set", otherTable, index.getParent()); assertEquals("export_test_idx_other_2", index.getName()); assertEquals(1, index.getColumnNames().size()); assertEquals("ex_id", index.getColumnNames().get(0)); PrimaryKey pk = otherTable.getPrimaryKey(); assertSame("Incorrect parent or no parent set", otherTable, pk.getParent()); assertEquals("id", pk.getColumnNames().get(0)); assertEquals(1, pk.getColumnOrders().get(0).intValue()); assertEquals(1, otherTable.getForeignKeys().size()); ForeignKey fk = otherTable.getForeignKeys().get(0); assertSame("Incorrect parent or no parent set", otherTable, fk.getParent()); assertEquals("export_test_fk_example", fk.getName()); assertEquals("ex_id", fk.getLocalColumn()); assertEquals("export_test_example", fk.getTargetTable()); assertEquals("id", fk.getTargetColumn()); }
private void checkExampleTable(Schema schema, Table exampleTable) { assertNotNull("Couldn't find export_test_example", exampleTable); assertSame("Incorrect parent or no parent set", schema, exampleTable.getParent()); assertEquals("export_test_example", exampleTable.getName()); Iterator<Column> colIt = exampleTable.getColumns().iterator(); Column col = colIt.next(); assertSame("Incorrect parent or no parent set", exampleTable, col.getParent()); assertEquals("id", col.getName()); assertEquals("bigint", col.getType()); assertEquals(false, col.isNullable()); assertEquals(1, col.getOrder()); assertEquals(true, col.isAutoIncrement()); col = colIt.next(); assertSame("Incorrect parent or no parent set", exampleTable, col.getParent()); assertEquals("description", col.getName()); assertEquals("text", col.getType()); assertEquals(true, col.isNullable()); assertEquals(2, col.getOrder()); col = colIt.next(); assertSame("Incorrect parent or no parent set", exampleTable, col.getParent()); assertEquals("fixes_from_schema", col.getName()); assertEquals("int", col.getType()); assertEquals(true, col.isNullable()); assertEquals(3, col.getOrder()); col = colIt.next(); assertSame("Incorrect parent or no parent set", exampleTable, col.getParent()); assertEquals("fixes_to_schema", col.getName()); assertEquals("int", col.getType()); assertEquals(true, col.isNullable()); assertEquals(4, col.getOrder()); col = colIt.next(); assertSame("Incorrect parent or no parent set", exampleTable, col.getParent()); assertEquals("applied_to_schema", col.getName()); assertEquals("int", col.getType()); assertEquals(true, col.isNullable()); assertEquals(5, col.getOrder()); col = colIt.next(); assertSame("Incorrect parent or no parent set", exampleTable, col.getParent()); assertEquals("target_schema", col.getName()); assertEquals("int", col.getType()); assertEquals(true, col.isNullable()); assertEquals(6, col.getOrder()); col = colIt.next(); assertSame("Incorrect parent or no parent set", exampleTable, col.getParent()); assertEquals("applied_on_date", col.getName()); assertEquals("datetime", col.getType()); assertEquals(true, col.isNullable()); assertEquals(7, col.getOrder()); col = colIt.next(); assertSame("Incorrect parent or no parent set", exampleTable, col.getParent()); assertEquals("applied_to_server", col.getName()); assertEquals("varchar(64)", col.getType()); assertEquals(true, col.isNullable()); assertEquals(8, col.getOrder()); col = colIt.next(); assertSame("Incorrect parent or no parent set", exampleTable, col.getParent()); assertEquals("was_executed", col.getName()); assertEquals("bit", col.getType()); assertEquals(true, col.isNullable()); assertEquals(9, col.getOrder()); col = colIt.next(); assertSame("Incorrect parent or no parent set", exampleTable, col.getParent()); assertEquals("succeeded", col.getName()); assertEquals("bit", col.getType()); assertEquals(true, col.isNullable()); assertEquals(10, col.getOrder()); col = colIt.next(); assertSame("Incorrect parent or no parent set", exampleTable, col.getParent()); assertEquals("report", col.getName()); assertEquals("text", col.getType()); assertEquals(true, col.isNullable()); assertEquals(11, col.getOrder()); PrimaryKey pk = exampleTable.getPrimaryKey(); assertSame("Incorrect parent or no parent set", exampleTable, pk.getParent()); assertEquals("id", pk.getColumnNames().get(0)); assertEquals(1, pk.getColumnOrders().get(0).intValue()); }