use of org.apache.jackrabbit.core.cluster.SimpleEventListener.UpdateEvent in project jackrabbit by apache.
the class UpdateEventFactory method createUpdateOperationWithNullUserId.
/**
* Create an update operation.
*
* @return update operation
*/
public UpdateEvent createUpdateOperationWithNullUserId() {
NodeState n1 = createNodeState();
NodeState n2 = createNodeState();
NodeState n3 = createNodeState();
PropertyState p1 = createPropertyState(n1.getNodeId(), "{}a");
PropertyState p2 = createPropertyState(n2.getNodeId(), "{}b");
ChangeLog changes = new ChangeLog();
changes.added(n1);
changes.added(p1);
changes.deleted(p2);
changes.modified(n2);
changes.deleted(n3);
Session s = new ClusterSession(null);
List events = new ArrayList();
events.add(createEventState(n1, Event.NODE_ADDED, "{}n1", s));
events.add(createEventState(p1, n1, Event.PROPERTY_ADDED, s));
events.add(createEventState(p2, n2, Event.PROPERTY_REMOVED, s));
events.add(createEventState(n3, Event.NODE_REMOVED, "{}n3", s));
return new UpdateEvent(changes, events, System.currentTimeMillis(), "user-data");
}
use of org.apache.jackrabbit.core.cluster.SimpleEventListener.UpdateEvent in project jackrabbit by apache.
the class ClusterRecordTest method testUpdateOperation.
/**
* Test producing and consuming an update.
* @throws Exception
*/
public void testUpdateOperation() throws Exception {
UpdateEvent update = factory.createUpdateOperation();
UpdateEventChannel channel = master.createUpdateChannel(DEFAULT_WORKSPACE);
channel.updateCreated(update);
channel.updatePrepared(update);
channel.updateCommitted(update, null);
SimpleEventListener listener = new SimpleEventListener();
slave.createUpdateChannel(DEFAULT_WORKSPACE).setListener(listener);
slave.sync();
assertEquals(1, listener.getClusterEvents().size());
assertEquals(listener.getClusterEvents().get(0), update);
}
use of org.apache.jackrabbit.core.cluster.SimpleEventListener.UpdateEvent in project jackrabbit by apache.
the class UpdateEventFactory method createUpdateOperation.
/**
* Create an update operation.
*
* @return update operation
*/
public UpdateEvent createUpdateOperation() {
NodeState n1 = createNodeState();
NodeState n2 = createNodeState();
NodeState n3 = createNodeState();
PropertyState p1 = createPropertyState(n1.getNodeId(), "{}a");
PropertyState p2 = createPropertyState(n2.getNodeId(), "{}b");
ChangeLog changes = new ChangeLog();
changes.added(n1);
changes.added(p1);
changes.deleted(p2);
changes.modified(n2);
changes.deleted(n3);
List events = new ArrayList();
events.add(createEventState(n1, Event.NODE_ADDED, "{}n1", session));
events.add(createEventState(p1, n1, Event.PROPERTY_ADDED, session));
events.add(createEventState(p2, n2, Event.PROPERTY_REMOVED, session));
events.add(createEventState(n3, Event.NODE_REMOVED, "{}n3", session));
return new UpdateEvent(changes, events, System.currentTimeMillis(), "user-data");
}
use of org.apache.jackrabbit.core.cluster.SimpleEventListener.UpdateEvent in project jackrabbit by apache.
the class ClusterRecordTest method testUpdateOperationWithNullUserId.
/**
* Test producing and consuming an update with a null userId
*/
public void testUpdateOperationWithNullUserId() throws Exception {
UpdateEvent update = factory.createUpdateOperationWithNullUserId();
UpdateEventChannel channel = master.createUpdateChannel(DEFAULT_WORKSPACE);
channel.updateCreated(update);
channel.updatePrepared(update);
channel.updateCommitted(update, null);
SimpleEventListener listener = new SimpleEventListener();
slave.createUpdateChannel(DEFAULT_WORKSPACE).setListener(listener);
slave.sync();
assertEquals(1, listener.getClusterEvents().size());
assertEquals(listener.getClusterEvents().get(0), update);
}
Aggregations