Search in sources :

Example 6 with Validator

use of org.apache.jackrabbit.oak.spi.commit.Validator in project jackrabbit-oak by apache.

the class AccessControlValidatorTest method hiddenNodeDeleted.

@Test
public void hiddenNodeDeleted() throws CommitFailedException {
    AccessControlValidatorProvider provider = new AccessControlValidatorProvider(getSecurityProvider());
    MemoryNodeStore store = new MemoryNodeStore();
    NodeBuilder builder = store.getRoot().builder();
    builder.child("test").child(":hidden");
    NodeState root = builder.getNodeState();
    builder = root.builder();
    NodeBuilder test = builder.child("test");
    test.child(":hidden").remove();
    Validator validator = provider.getRootValidator(root, builder.getNodeState(), CommitInfo.EMPTY);
    Validator childValidator = validator.childNodeChanged("test", root.getChildNode("test"), test.getNodeState());
    assertNotNull(childValidator);
    Validator hiddenValidator = childValidator.childNodeDeleted(":hidden", root.getChildNode("test").getChildNode(":hidden"));
    assertNull(hiddenValidator);
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Validator(org.apache.jackrabbit.oak.spi.commit.Validator) AbstractSecurityTest(org.apache.jackrabbit.oak.AbstractSecurityTest) Test(org.junit.Test)

Example 7 with Validator

use of org.apache.jackrabbit.oak.spi.commit.Validator in project jackrabbit-oak by apache.

the class UserValidatorTest method hiddenNodeDeleted.

@Test
public void hiddenNodeDeleted() throws CommitFailedException {
    UserValidatorProvider provider = new UserValidatorProvider(getConfig());
    MemoryNodeStore store = new MemoryNodeStore();
    NodeBuilder builder = store.getRoot().builder();
    builder.child("test").child(":hidden");
    NodeState root = builder.getNodeState();
    builder = root.builder();
    NodeBuilder test = builder.child("test");
    test.child(":hidden").remove();
    Validator validator = provider.getRootValidator(root, builder.getNodeState(), CommitInfo.EMPTY);
    Validator childValidator = validator.childNodeChanged("test", root.getChildNode("test"), test.getNodeState());
    assertNotNull(childValidator);
    Validator hiddenValidator = childValidator.childNodeDeleted(":hidden", root.getChildNode("test").getChildNode(":hidden"));
    assertNull(hiddenValidator);
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Validator(org.apache.jackrabbit.oak.spi.commit.Validator) AbstractSecurityTest(org.apache.jackrabbit.oak.AbstractSecurityTest) Test(org.junit.Test)

Aggregations

Validator (org.apache.jackrabbit.oak.spi.commit.Validator)7 AbstractSecurityTest (org.apache.jackrabbit.oak.AbstractSecurityTest)6 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)6 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)6 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)6 Test (org.junit.Test)6 ImmutableTree (org.apache.jackrabbit.oak.plugins.tree.impl.ImmutableTree)1 VisibleValidator (org.apache.jackrabbit.oak.spi.commit.VisibleValidator)1 TreePermission (org.apache.jackrabbit.oak.spi.security.authorization.permission.TreePermission)1