Search in sources :

Example 1 with CreateTableToDb

use of org.apache.cayenne.dbsync.merge.token.db.CreateTableToDb in project cayenne by apache.

the class DefaultDbImportActionTest method testMergeTokensSorting.

@Test
public void testMergeTokensSorting() {
    LinkedList<MergerToken> tokens = new LinkedList<MergerToken>();
    tokens.add(new AddColumnToModel(null, null));
    tokens.add(new AddRelationshipToModel(null, null));
    tokens.add(new CreateTableToDb(null));
    tokens.add(new CreateTableToModel(null));
    assertEquals(asList("CreateTableToDb", "CreateTableToModel", "AddColumnToModel", "AddRelationshipToModel"), toClasses(DefaultDbImportAction.sort(tokens)));
}
Also used : CreateTableToDb(org.apache.cayenne.dbsync.merge.token.db.CreateTableToDb) CreateTableToModel(org.apache.cayenne.dbsync.merge.token.model.CreateTableToModel) AddRelationshipToModel(org.apache.cayenne.dbsync.merge.token.model.AddRelationshipToModel) MergerToken(org.apache.cayenne.dbsync.merge.token.MergerToken) AddColumnToModel(org.apache.cayenne.dbsync.merge.token.model.AddColumnToModel) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Example 2 with CreateTableToDb

use of org.apache.cayenne.dbsync.merge.token.db.CreateTableToDb in project cayenne by apache.

the class TokenSortTest method testToDbTokensCompare.

@Test
public void testToDbTokensCompare() throws Exception {
    List<MergerToken> tokens = Arrays.<MergerToken>asList(new DropColumnToDb(null, null), new DropRelationshipToDb(null, null), new DropTableToDb(null), new AddColumnToModel(null, null), new AddRelationshipToDb(null, null), new AddColumnToDb(null, null), new CreateTableToDb(null));
    Collections.sort(tokens);
    List<String> actual = toClassesNames(tokens);
    List<String> expected = Arrays.asList("DropRelationshipToDb", "DropColumnToDb", "DropTableToDb", "CreateTableToDb", "AddColumnToDb", "AddColumnToModel", "AddRelationshipToDb");
    assertEquals(expected, actual);
}
Also used : AddColumnToDb(org.apache.cayenne.dbsync.merge.token.db.AddColumnToDb) CreateTableToDb(org.apache.cayenne.dbsync.merge.token.db.CreateTableToDb) DropColumnToDb(org.apache.cayenne.dbsync.merge.token.db.DropColumnToDb) AddRelationshipToDb(org.apache.cayenne.dbsync.merge.token.db.AddRelationshipToDb) DropTableToDb(org.apache.cayenne.dbsync.merge.token.db.DropTableToDb) DropRelationshipToDb(org.apache.cayenne.dbsync.merge.token.db.DropRelationshipToDb) AddColumnToModel(org.apache.cayenne.dbsync.merge.token.model.AddColumnToModel) Test(org.junit.Test)

Aggregations

CreateTableToDb (org.apache.cayenne.dbsync.merge.token.db.CreateTableToDb)2 AddColumnToModel (org.apache.cayenne.dbsync.merge.token.model.AddColumnToModel)2 Test (org.junit.Test)2 LinkedList (java.util.LinkedList)1 MergerToken (org.apache.cayenne.dbsync.merge.token.MergerToken)1 AddColumnToDb (org.apache.cayenne.dbsync.merge.token.db.AddColumnToDb)1 AddRelationshipToDb (org.apache.cayenne.dbsync.merge.token.db.AddRelationshipToDb)1 DropColumnToDb (org.apache.cayenne.dbsync.merge.token.db.DropColumnToDb)1 DropRelationshipToDb (org.apache.cayenne.dbsync.merge.token.db.DropRelationshipToDb)1 DropTableToDb (org.apache.cayenne.dbsync.merge.token.db.DropTableToDb)1 AddRelationshipToModel (org.apache.cayenne.dbsync.merge.token.model.AddRelationshipToModel)1 CreateTableToModel (org.apache.cayenne.dbsync.merge.token.model.CreateTableToModel)1