use of org.apache.jackrabbit.oak.spi.state.NodeState in project jackrabbit-oak by apache.
the class NodeTypePredicateTest method singleNodeTypeMatch.
@Test
public void singleNodeTypeMatch() {
NodeState node = createNodeOfType(NT_BASE);
TypePredicate p = new TypePredicate(node, new String[] { NT_BASE });
assertTrue(p.apply(node));
}
use of org.apache.jackrabbit.oak.spi.state.NodeState in project jackrabbit-oak by apache.
the class GlobbingPathFilterTest method matchAtStart.
/**
* **/a/b/c should match a/b/c
*/
@Test
public void matchAtStart() {
EventFilter rootFilter = new GlobbingPathFilter("**/a/b/c");
NodeState a = tree.getChild("a").getNodeState();
assertFalse(rootFilter.includeAdd("a", a));
EventFilter aFilter = rootFilter.create("a", a, a);
assertNotNull(aFilter);
NodeState b = a.getChildNode("b");
assertFalse(aFilter.includeAdd("b", b));
EventFilter bFilter = aFilter.create("b", b, b);
assertNotNull(bFilter);
NodeState c = b.getChildNode("c");
assertTrue(bFilter.includeAdd("c", b));
assertFalse(bFilter.includeAdd("x", b));
}
use of org.apache.jackrabbit.oak.spi.state.NodeState in project jackrabbit-oak by apache.
the class GlobbingPathFilterTest method emptyMatchesNothing.
/**
* An empty path pattern should match no path
*/
@Test
public void emptyMatchesNothing() {
EventFilter rootFilter = new GlobbingPathFilter("");
NodeState a = tree.getChild("a").getNodeState();
assertFalse(rootFilter.includeAdd("a", a));
assertNull(rootFilter.create("a", a, a));
}
use of org.apache.jackrabbit.oak.spi.state.NodeState in project jackrabbit-oak by apache.
the class CompositeTreePermissionTest method testMultipleToSingle.
@Test
public void testMultipleToSingle() {
TreePermission rootTp = createRootTreePermission(fullScopeProvider, new NoScopeProvider(root), new NoScopeProvider(root));
assertCompositeTreePermission(true, rootTp);
NodeState childState = rootTree.getChild("test").getNodeState();
TreePermission testTp = rootTp.getChildPermission("test", childState);
TreePermission expected = fullScopeProvider.getTreePermission(rootTree, TreePermission.EMPTY).getChildPermission("test", childState);
assertEquals(expected.getClass(), testTp.getClass());
}
use of org.apache.jackrabbit.oak.spi.state.NodeState in project jackrabbit-oak by apache.
the class CompositeProviderNoScopeTest method testTreePermissionGetChild.
@Override
@Test
public void testTreePermissionGetChild() throws Exception {
List<String> childNames = ImmutableList.of("test", "a", "b", "c", "nonexisting");
Tree rootTree = readOnlyRoot.getTree(ROOT_PATH);
NodeState ns = ((ImmutableTree) rootTree).getNodeState();
TreePermission tp = createPermissionProvider().getTreePermission(rootTree, TreePermission.EMPTY);
assertCompositeTreePermission(tp);
for (String cName : childNames) {
ns = ns.getChildNode(cName);
tp = tp.getChildPermission(cName, ns);
assertCompositeTreePermission(false, tp);
}
}
Aggregations