use of org.apache.jackrabbit.oak.spi.state.DefaultNodeStateDiff in project jackrabbit-oak by apache.
the class DocumentNodeStoreTest method dispatch.
// OAK-2695
@Test
public void dispatch() throws Exception {
DocumentNodeStore ns = builderProvider.newBuilder().getNodeStore();
RevisionVector from = ns.getHeadRevision();
NodeBuilder builder = ns.getRoot().builder();
builder.child("test");
merge(ns, builder);
RevisionVector to = ns.getHeadRevision();
DiffCache.Entry entry = ns.getDiffCache().newEntry(from, to, true);
entry.append("/", "-\"foo\"");
entry.done();
ns.compare(ns.getRoot(), ns.getRoot(from), new DefaultNodeStateDiff() {
@Override
public boolean childNodeDeleted(String name, NodeState before) {
assertNotNull(before);
return true;
}
});
}
use of org.apache.jackrabbit.oak.spi.state.DefaultNodeStateDiff in project jackrabbit-oak by apache.
the class LastRevRecoveryRandomizedIT method compareAndTraverse.
private void compareAndTraverse(NodeState state, final String path, Map<String, NodeState> states) {
NodeState expected = states.remove(path);
if (expected == null) {
fail("unexpected node at " + path + " (seed=" + SEED + ")");
return;
}
comparePropertiesAgainstBaseState(state, expected, new DefaultNodeStateDiff() {
@Override
public boolean propertyAdded(PropertyState after) {
fail("unexpected property: " + path + "/" + after + " (seed=" + SEED + ")");
return super.propertyAdded(after);
}
@Override
public boolean propertyChanged(PropertyState before, PropertyState after) {
assertEquals("property mismatch on node " + path + " (seed=" + SEED + ")", before, after);
return super.propertyChanged(before, after);
}
@Override
public boolean propertyDeleted(PropertyState before) {
fail("missing property: " + path + "/" + before + " (seed=" + SEED + ")");
return super.propertyDeleted(before);
}
});
for (ChildNodeEntry entry : state.getChildNodeEntries()) {
String p = PathUtils.concat(path, entry.getName());
compareAndTraverse(entry.getNodeState(), p, states);
}
}
Aggregations