use of org.apache.jackrabbit.oak.plugins.document.AbstractDocumentNodeState in project jackrabbit-oak by apache.
the class DelegatingDocumentNodeStateTest method metaPropertiesFilteredOut.
@Test
public void metaPropertiesFilteredOut() throws Exception {
setMetaProps(builder);
builder.setProperty("foo", "bar");
AbstractDocumentNodeState state = DelegatingDocumentNodeState.wrap(builder.getNodeState(), NodeStateDiffer.DEFAULT_DIFFER);
assertEquals(1, Iterables.size(state.getProperties()));
assertEquals(1, state.getPropertyCount());
}
use of org.apache.jackrabbit.oak.plugins.document.AbstractDocumentNodeState in project jackrabbit-oak by apache.
the class DelegatingDocumentNodeStateTest method childNodeDecorated.
@Test
public void childNodeDecorated() throws Exception {
setMetaProps(builder);
setMetaProps(builder.child("a"));
setMetaProps(builder.child("b"));
AbstractDocumentNodeState state = DelegatingDocumentNodeState.wrap(builder.getNodeState(), NodeStateDiffer.DEFAULT_DIFFER);
assertTrue(state.getChildNode("a") instanceof AbstractDocumentNodeState);
assertTrue(state.getChildNode("b") instanceof AbstractDocumentNodeState);
assertFalse(state.hasChildNode("c"));
assertFalse(state.getChildNode("c").exists());
assertFalse(state.hasNoChildren());
for (ChildNodeEntry cne : state.getChildNodeEntries()) {
assertTrue(cne.getNodeState() instanceof AbstractDocumentNodeState);
}
assertEquals(2, state.getChildNodeCount(100));
}
use of org.apache.jackrabbit.oak.plugins.document.AbstractDocumentNodeState in project jackrabbit-oak by apache.
the class SecondaryStoreCacheTest method readWithSecondaryLagging.
@Test
public void readWithSecondaryLagging() throws Exception {
PathFilter pathFilter = new PathFilter(of("/a"), empty);
SecondaryStoreCache cache = createBuilder(pathFilter).buildCache();
SecondaryStoreObserver observer = createBuilder(pathFilter).buildObserver(cache);
NodeBuilder nb = primary.getRoot().builder();
create(nb, "/a/b", "/a/c");
AbstractDocumentNodeState r0 = merge(nb);
AbstractDocumentNodeState a_c_0 = documentState(primary.getRoot(), "/a/c");
observer.contentChanged(r0, CommitInfo.EMPTY);
AbstractDocumentNodeState result = cache.getDocumentNodeState("/a/c", r0.getRootRevision(), a_c_0.getLastRevision());
assertTrue(EqualsDiff.equals(a_c_0, result));
//Make change in some other part of tree i.e. /a/c is unmodified
nb = primary.getRoot().builder();
create(nb, "/a/e");
AbstractDocumentNodeState r1 = merge(nb);
//Change is yet not pushed to secondary i.e. observer not invoked
//but lookup with latest root should still work fine if lastRev matches
result = cache.getDocumentNodeState("/a/c", r1.getRootRevision(), a_c_0.getLastRevision());
assertTrue(EqualsDiff.equals(a_c_0, result));
//Change which is not pushed would though not be visible
AbstractDocumentNodeState a_e_1 = documentState(primary.getRoot(), "/a/e");
result = cache.getDocumentNodeState("/a/e", r1.getRootRevision(), a_e_1.getLastRevision());
assertNull(result);
}
Aggregations