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());
assertEquals(2,
index.getColumnCount());
indexColumn = index.getColumn(0);
assertEquals("aid",
indexColumn.getName());
assertNull(indexColumn.getSize());
indexColumn = index.getColumn(1);
assertEquals("cid",
indexColumn.getName());
assertNull(indexColumn.getSize());
// table C
table = model.getTable(2);
assertEquals("C",
table.getName());
assertEquals("Table C",
table.getDescription());
assertEquals(0, table.getAutoIncrementColumns().length);
assertEquals(2,
table.getColumnCount());
assertEquals(0,
table.getForeignKeyCount());
assertEquals(1,
table.getIndexCount());
column = table.getColumn(0);
assertEquals("id",
column.getName());
assertEquals("CHAR",
column.getType());
assertEquals(Types.CHAR,
column.getTypeCode());
assertEquals("32",
column.getSize());
assertEquals(32,
column.getSizeAsInt());
assertTrue(column.isPrimaryKey());
assertTrue(column.isRequired());
assertFalse(column.isAutoIncrement());
assertNull(column.getDefaultValue());
assertEquals("The primary key of table C",
column.getDescription());
column = table.getColumn(1);
assertEquals("text",
column.getName());
assertEquals("LONGVARCHAR",
column.getType());
assertEquals(Types.LONGVARCHAR,
column.getTypeCode());
assertNull(column.getSize());
assertEquals(0,
column.getSizeAsInt());
assertFalse(column.isPrimaryKey());
assertFalse(column.isRequired());
assertFalse(column.isAutoIncrement());
assertNull(column.getDefaultValue());
assertEquals("The text",
column.getDescription());
index = table.getIndex(0);
assertEquals("byText",
index.getName());
assertFalse(index.isUnique());
assertEquals(1,
index.getColumnCount());
indexColumn = index.getColumn(0);
assertEquals("text",
indexColumn.getName());
assertNull(indexColumn.getSize());
assertEquals(
"<?xml version=\"1.0\"?>\n<!DOCTYPE database SYSTEM \"" + LocalEntityResolver.DTD_PREFIX + "\">\n" +
" <database name=\"test\">\n" +
" <table name=\"A\" description=\"Table A\">\n" +