use of org.apache.jackrabbit.oak.plugins.tree.impl.ImmutableTree in project jackrabbit-oak by apache.
the class AbstractCompositeProviderTest method testTreePermissionGetChild.
@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);
for (String cName : childNames) {
ns = ns.getChildNode(cName);
tp = tp.getChildPermission(cName, ns);
assertCompositeTreePermission(tp);
}
}
use of org.apache.jackrabbit.oak.plugins.tree.impl.ImmutableTree in project jackrabbit-oak by apache.
the class CompositeProviderCoverageTest method testTreePermissionGetChild.
@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);
for (String cName : childNames) {
ns = ns.getChildNode(cName);
tp = tp.getChildPermission(cName, ns);
assertTrue(tp instanceof LimitedTreePermission);
}
}
use of org.apache.jackrabbit.oak.plugins.tree.impl.ImmutableTree in project jackrabbit-oak by apache.
the class VersionTreePermissionTest method testGetChild.
@Test
public void testGetChild() throws Exception {
Tree versionHistory = checkNotNull(vMgr.getVersionHistory(testTree));
ImmutableTree t = (ImmutableTree) RootFactory.createReadOnlyRoot(root).getTree("/");
TreePermission tp = pp.getTreePermission(t, TreePermission.EMPTY);
for (String name : PathUtils.elements(versionHistory.getPath())) {
t = t.getChild(name);
tp = tp.getChildPermission(name, t.getNodeState());
}
String expectedPath = "/test";
assertVersionPermission(tp, "/test", true);
NodeState ns = t.getChild("1.0").getNodeState();
tp = tp.getChildPermission("1.0", ns);
assertVersionPermission(tp, "/test", true);
ns = ns.getChildNode(JCR_FROZENNODE);
tp = tp.getChildPermission(JCR_FROZENNODE, ns);
assertVersionPermission(tp, "/test", true);
for (String name : new String[] { "a", "b", "c" }) {
ns = ns.getChildNode(name);
expectedPath = PathUtils.concat(expectedPath, name);
tp = tp.getChildPermission(name, ns);
assertVersionPermission(tp, expectedPath, true);
}
}
Aggregations