Search in sources :

Example 1 with DbEntityBuilder

use of org.apache.cayenne.dbsync.merge.builders.DbEntityBuilder in project cayenne by apache.

the class DataMapMergerTest method testAddTable.

@Test
public void testAddTable() throws Exception {
    DbEntityBuilder dbEntity = dbEntity("table1").attributes(dbAttr("attr01").typeInt());
    DataMap existing = dataMap().with(dbEntity).build();
    DataMap db = dataMap().build();
    List<MergerToken> tokens = dbMerger().createMergeTokens(existing, db);
    assertEquals(1, tokens.size());
    assertEquals(factory().createCreateTableToDb(dbEntity.build()).getTokenValue(), tokens.get(0).getTokenValue());
}
Also used : DbEntityBuilder(org.apache.cayenne.dbsync.merge.builders.DbEntityBuilder) MergerToken(org.apache.cayenne.dbsync.merge.token.MergerToken) DataMap(org.apache.cayenne.map.DataMap) Test(org.junit.Test)

Aggregations

DbEntityBuilder (org.apache.cayenne.dbsync.merge.builders.DbEntityBuilder)1 MergerToken (org.apache.cayenne.dbsync.merge.token.MergerToken)1 DataMap (org.apache.cayenne.map.DataMap)1 Test (org.junit.Test)1