Search in sources :

Example 26 with NodeState

use of org.apache.jackrabbit.oak.spi.state.NodeState in project jackrabbit-oak by apache.

the class NodeTypePredicateTest method emptyNodeTypeList.

@Test
public void emptyNodeTypeList() {
    NodeState node = createNodeOfType(NT_BASE);
    TypePredicate p = new TypePredicate(node, new String[] {});
    assertFalse(p.apply(node));
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) TypePredicate(org.apache.jackrabbit.oak.plugins.nodetype.TypePredicate) Test(org.junit.Test)

Example 27 with NodeState

use of org.apache.jackrabbit.oak.spi.state.NodeState in project jackrabbit-oak by apache.

the class NodeTypePredicateTest method singleNodeTypeMiss.

@Test
public void singleNodeTypeMiss() {
    NodeState node = createNodeOfType(NT_BASE);
    TypePredicate p = new TypePredicate(node, new String[] { NT_FILE });
    assertFalse(p.apply(node));
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) TypePredicate(org.apache.jackrabbit.oak.plugins.nodetype.TypePredicate) Test(org.junit.Test)

Example 28 with NodeState

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));
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) TypePredicate(org.apache.jackrabbit.oak.plugins.nodetype.TypePredicate) Test(org.junit.Test)

Example 29 with NodeState

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());
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) TreePermission(org.apache.jackrabbit.oak.spi.security.authorization.permission.TreePermission) AbstractSecurityTest(org.apache.jackrabbit.oak.AbstractSecurityTest) Test(org.junit.Test)

Example 30 with NodeState

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);
    }
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) Tree(org.apache.jackrabbit.oak.api.Tree) ImmutableTree(org.apache.jackrabbit.oak.plugins.tree.impl.ImmutableTree) ImmutableTree(org.apache.jackrabbit.oak.plugins.tree.impl.ImmutableTree) TreePermission(org.apache.jackrabbit.oak.spi.security.authorization.permission.TreePermission) Test(org.junit.Test)

Aggregations

NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)779 Test (org.junit.Test)498 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)335 EmptyNodeState (org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState)94 ChildNodeEntry (org.apache.jackrabbit.oak.spi.state.ChildNodeEntry)61 PropertyState (org.apache.jackrabbit.oak.api.PropertyState)60 FilterImpl (org.apache.jackrabbit.oak.query.index.FilterImpl)54 CommitFailedException (org.apache.jackrabbit.oak.api.CommitFailedException)48 EditorHook (org.apache.jackrabbit.oak.spi.commit.EditorHook)46 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)41 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)36 AbstractNodeState (org.apache.jackrabbit.oak.spi.state.AbstractNodeState)33 Nonnull (javax.annotation.Nonnull)32 Tree (org.apache.jackrabbit.oak.api.Tree)29 ArrayList (java.util.ArrayList)25 NodeStateTestUtils.getNodeState (org.apache.jackrabbit.oak.plugins.migration.NodeStateTestUtils.getNodeState)23 NodeStateTestUtils.getNodeState (org.apache.jackrabbit.oak.upgrade.util.NodeStateTestUtils.getNodeState)23 DocumentNodeState (org.apache.jackrabbit.oak.plugins.document.DocumentNodeState)22 MemoryDocumentStore (org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore)22 CommitInfo (org.apache.jackrabbit.oak.spi.commit.CommitInfo)17