use of org.apache.cayenne.unit.di.DataChannelSyncStats in project cayenne by apache.
the class CayenneContextGraphDiffCompressorIT method testMultipleSimpleProperties.
@Test
public void testMultipleSimpleProperties() {
ClientMtTable1 o1 = context.newObject(ClientMtTable1.class);
o1.setGlobalAttribute1("v1");
o1.setGlobalAttribute1("v2");
DataChannelSyncStats stats = clientServerInterceptor.runWithSyncStatsCollection(new UnitTestClosure() {
public void execute() {
context.commitChanges();
}
});
assertEquals(1, stats.nodePropertiesChanged);
assertEquals(1, stats.nodesCreated);
}
use of org.apache.cayenne.unit.di.DataChannelSyncStats in project cayenne by apache.
the class CayenneContextGraphDiffCompressorIT method testComplimentaryArcs.
@Test
public void testComplimentaryArcs() {
ClientMtTable1 o1 = context.newObject(ClientMtTable1.class);
ClientMtTable2 o2 = context.newObject(ClientMtTable2.class);
o2.setTable1(o1);
o2.setTable1(null);
DataChannelSyncStats stats = clientServerInterceptor.runWithSyncStatsCollection(new UnitTestClosure() {
public void execute() {
context.commitChanges();
}
});
assertEquals(0, stats.nodePropertiesChanged);
assertEquals(2, stats.nodesCreated);
assertEquals(0, stats.arcsCreated);
assertEquals(0, stats.arcsDeleted);
}
use of org.apache.cayenne.unit.di.DataChannelSyncStats in project cayenne by apache.
the class ClientServerDataChannelInterceptor method runWithSyncStatsCollection.
public DataChannelSyncStats runWithSyncStatsCollection(UnitTestClosure closure) {
ClientServerDataChannelDecorator channel = getChannelDecorator();
DataChannelSyncStats stats = new DataChannelSyncStats();
channel.setSyncStatsCounter(stats);
try {
closure.execute();
} finally {
channel.setSyncStatsCounter(null);
}
return stats;
}
use of org.apache.cayenne.unit.di.DataChannelSyncStats in project cayenne by apache.
the class CayenneContextGraphDiffCompressorIT method testDelete.
@Test
public void testDelete() {
ClientMtTable1 o1 = context.newObject(ClientMtTable1.class);
o1.setGlobalAttribute1("v1");
context.deleteObjects(o1);
DataChannelSyncStats stats = clientServerInterceptor.runWithSyncStatsCollection(new UnitTestClosure() {
public void execute() {
context.commitChanges();
}
});
assertEquals(0, stats.nodePropertiesChanged);
assertEquals(0, stats.nodesCreated);
assertEquals(0, stats.nodesRemoved);
}
Aggregations