use of org.apache.cayenne.testdo.lifecycles.ClientLifecycles in project cayenne by apache.
the class RemoteCallbacksIT method testDefault.
@Test
public void testDefault() throws InterruptedException {
ObjectContext context = createROPContext();
context.getEntityResolver().getCallbackRegistry().addListener(ClientLifecycles.class, this);
assertAll(0, 0, 0, 0, 0, 0, 0, 0);
ClientLifecycles l1 = context.newObject(ClientLifecycles.class);
assertAll(1, 0, 0, 0, 0, 0, 0, 0);
l1.setName("x");
assertAll(1, 0, 0, 0, 0, 0, 0, 0);
context.commitChanges();
// until commit
Thread.sleep(5);
assertAll(1, 0, 1, 1, 0, 0, 0, 0);
l1.setName("x2");
assertAll(1, 0, 1, 1, 0, 0, 0, 0);
context.commitChanges();
// until commit
Thread.sleep(5);
assertAll(1, 0, 1, 1, 1, 1, 0, 0);
context.deleteObjects(l1);
assertAll(1, 0, 1, 1, 1, 1, 1, 0);
context.commitChanges();
// until commit
Thread.sleep(5);
assertAll(1, 0, 1, 1, 1, 1, 1, 1);
}
Aggregations