Search in sources :

Example 11 with ForeignKey

use of org.alfresco.util.schemacomp.model.ForeignKey in project alfresco-repository by Alfresco.

the class DbObjectXMLTransformerTest method transformForeignKey.

@Test
public void transformForeignKey() throws IOException {
    ForeignKey fk = new ForeignKey(null, "fk_for_some_table", "local_column", "target_table", "target_column");
    transformer.output(fk);
    BufferedReader reader = new BufferedReader(new StringReader(writer.toString()));
    dumpOutput();
    assertHasPreamble(reader);
    assertEquals("<foreignkey name=\"fk_for_some_table\">", reader.readLine());
    assertEquals("  <localcolumn>local_column</localcolumn>", reader.readLine());
    assertEquals("  <targettable>target_table</targettable>", reader.readLine());
    assertEquals("  <targetcolumn>target_column</targetcolumn>", reader.readLine());
    assertEquals("</foreignkey>", reader.readLine());
}
Also used : BufferedReader(java.io.BufferedReader) StringReader(java.io.StringReader) ForeignKey(org.alfresco.util.schemacomp.model.ForeignKey) Test(org.junit.Test)

Aggregations

ForeignKey (org.alfresco.util.schemacomp.model.ForeignKey)11 Column (org.alfresco.util.schemacomp.model.Column)10 Index (org.alfresco.util.schemacomp.model.Index)10 PrimaryKey (org.alfresco.util.schemacomp.model.PrimaryKey)9 Table (org.alfresco.util.schemacomp.model.Table)7 BufferedReader (java.io.BufferedReader)5 StringReader (java.io.StringReader)5 Sequence (org.alfresco.util.schemacomp.model.Sequence)5 DbValidator (org.alfresco.util.schemacomp.validator.DbValidator)5 Test (org.junit.Test)5 Schema (org.alfresco.util.schemacomp.model.Schema)3 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 DbObject (org.alfresco.util.schemacomp.model.DbObject)1 NameValidator (org.alfresco.util.schemacomp.validator.NameValidator)1