Package org.databene.jdbacl.model

Examples of org.databene.jdbacl.model.DBTable


  }
 
  @Test
  public void testPKDeleted() {
    // given a table from which a primary key was deleted
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBPrimaryKeyConstraint(table1, "pk1", false, "col1");
    DBTable table2 = createTableWithColumns("tbl", 2);
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be a ConstraintDeletion
    System.out.println(schemaChange);
View Full Code Here


  }
 
  @Test
  public void testPKOnDifferentColumn() {
    // given a table of which a PK was reassigned to another column
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBPrimaryKeyConstraint(table1, "pk1", false, "col1");
    DBTable table2 = createTableWithColumns("tbl", 2);
    new DBPrimaryKeyConstraint(table2, "pk1", false, "col2");
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be a ConstraintDeletion and a PrimaryKeyCreation
View Full Code Here

  }
 
  @Test
  public void testUKCreated() {
    // given a table to which a unique key was added
    DBTable table1 = createTableWithColumns("tbl", 2);
    DBTable table2 = createTableWithColumns("tbl", 2);
    new DBUniqueConstraint(table2, "uk1", false, "col1");
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be a unique key creation
View Full Code Here

  }
 
  @Test
  public void testUKDeleted() {
    // given a table from which a unique key was deleted
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBUniqueConstraint(table1, "uk1", false, "col1");
    DBTable table2 = createTableWithColumns("tbl", 2);
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be a constraint deletion
    System.out.println(schemaChange);
View Full Code Here

  }
 
  @Test
  public void testUKOnDifferentColumn() {
    // given a table of which a unique key was reassigned to another column
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBUniqueConstraint(table1, "uk1", false, "col1");
    DBTable table2 = createTableWithColumns("tbl", 2);
    new DBUniqueConstraint(table2, "uk1", false, "col2");
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be a ConstraintDeletion and a UniqueConstraintCreation
View Full Code Here

  }
 
  @Test
  public void testFKCreated() {
    // given a table to which a foreign key was added
    DBTable target = createTableWithColumns("target", 2);
    DBTable table1 = createTableWithColumns("tbl", 2);
    DBTable table2 = createTableWithColumns("tbl", 2);
    new DBForeignKeyConstraint("fk1", false, table2, new String[] { "col1" }, target, new String[] { "col1" });
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be a foreign key creation
View Full Code Here

  }
 
  @Test
  public void testFKDeleted() {
    // given a table from which a foreign key constraint was removed
    DBTable target = createTableWithColumns("target", 2);
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBForeignKeyConstraint("fk1", false, table1, new String[] { "col1" }, target, new String[] { "col1" });
    DBTable table2 = createTableWithColumns("tbl", 2);
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be a foreign key deletion
    System.out.println(schemaChange);
View Full Code Here

  }

  @Test
  public void testFKOnDifferentColumn() {
    // given a table from which a foreign key constraint was removed
    DBTable target = createTableWithColumns("target", 2);
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBForeignKeyConstraint("fk1", false, table1, new String[] { "col1" }, target, new String[] { "col1" });
    DBTable table2 = createTableWithColumns("tbl", 2);
    new DBForeignKeyConstraint("fk1", false, table2, new String[] { "col2" }, target, new String[] { "col2" });
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be a foreign key creation
View Full Code Here

  }
 
  @Test
  public void testCheckCreated() {
    // given a table to which a check constraint was added
    DBTable table1 = createTableWithColumns("tbl", 2);
    DBTable table2 = createTableWithColumns("tbl", 2);
    new DBCheckConstraint("check1", false, table2, "col1 > 0");
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be a foreign key creation
View Full Code Here

  }
 
  @Test
  public void testCheckDeleted() {
    // given a table to which a check constraint was added
    DBTable table1 = createTableWithColumns("tbl", 2);
    new DBCheckConstraint("check1", false, table1, "col1 > 0");
    DBTable table2 = createTableWithColumns("tbl", 2);
    SchemaChange schemaChange = new SchemaChange(config);
    // when comparing the tables
    new TableComparator(config).compareObjects(table1, table2, schemaChange);
    // then the result must be a foreign key creation
    System.out.println(schemaChange);
View Full Code Here

TOP

Related Classes of org.databene.jdbacl.model.DBTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.