assertEquals("A",
fk.getForeignTableName());
assertEquals(1,
fk.getReferenceCount());
Reference ref = fk.getFirstReference();
assertEquals(table.getColumn(1),
ref.getLocalColumn());
assertEquals("parentId",
ref.getLocalColumnName());
assertEquals(table.getColumn(0),
ref.getForeignColumn());
assertEquals("id",
ref.getForeignColumnName());
Index index = table.getIndex(0);
assertNull(index.getName());
assertTrue(index.isUnique());
assertEquals(1,
index.getColumnCount());
IndexColumn indexColumn = index.getColumn(0);
assertEquals("name",
indexColumn.getName());
assertNull(indexColumn.getSize());
// table B
table = model.getTable(1);
assertEquals("B",
table.getName());
assertEquals("Table B",
table.getDescription());
assertEquals(0, table.getAutoIncrementColumns().length);
assertEquals(3,
table.getColumnCount());
assertEquals(2,
table.getForeignKeyCount());
assertEquals(1,
table.getIndexCount());
column = table.getColumn(0);
assertEquals("id",
column.getName());
assertEquals("TIMESTAMP",
column.getType());
assertEquals(Types.TIMESTAMP,
column.getTypeCode());
assertNull(column.getSize());
assertEquals(0,
column.getSizeAsInt());
assertTrue(column.isPrimaryKey());
assertTrue(column.isRequired());
assertFalse(column.isAutoIncrement());
assertNull(column.getDefaultValue());
assertEquals("The primary key of table B",
column.getDescription());
column = table.getColumn(1);
assertEquals("aid",
column.getName());
assertEquals("INTEGER",
column.getType());
assertEquals(Types.INTEGER,
column.getTypeCode());
assertNull(column.getSize());
assertEquals(0,
column.getSizeAsInt());
assertFalse(column.isPrimaryKey());
assertFalse(column.isRequired());
assertFalse(column.isAutoIncrement());
assertNull(column.getDefaultValue());
assertEquals("The field for the foreign key towards A",
column.getDescription());
column = table.getColumn(2);
assertEquals("cid",
column.getName());
assertEquals("CHAR",
column.getType());
assertEquals(Types.CHAR,
column.getTypeCode());
assertEquals("32",
column.getSize());
assertEquals(32,
column.getSizeAsInt());
assertFalse(column.isPrimaryKey());
assertFalse(column.isRequired());
assertFalse(column.isAutoIncrement());
assertNull(column.getDefaultValue());
assertEquals("The field for the foreign key towards C",
column.getDescription());
fk = table.getForeignKey(0);
assertNull(fk.getName());
assertEquals(model.getTable(0),
fk.getForeignTable());
assertEquals("A",
fk.getForeignTableName());
assertEquals(1,
fk.getReferenceCount());
ref = fk.getFirstReference();
assertEquals(table.getColumn(1),
ref.getLocalColumn());
assertEquals("aid",
ref.getLocalColumnName());
assertEquals(model.getTable(0).getColumn(0),
ref.getForeignColumn());
assertEquals("id",
ref.getForeignColumnName());
fk = table.getForeignKey(1);
assertNull(fk.getName());
assertEquals(model.getTable(2),
fk.getForeignTable());
assertEquals("C",
fk.getForeignTableName());
assertEquals(1,
fk.getReferenceCount());
ref = fk.getFirstReference();
assertEquals(table.getColumn(2),
ref.getLocalColumn());
assertEquals("cid",
ref.getLocalColumnName());
assertEquals(model.getTable(2).getColumn(0),
ref.getForeignColumn());
assertEquals("id",
ref.getForeignColumnName());
index = table.getIndex(0);
assertNull(index.getName());
assertFalse(index.isUnique());