Search in sources :

Example 86 with MemoryNodeStore

use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore in project jackrabbit-oak by apache.

the class AccessControlValidatorTest method hiddenNodeChanged.

@Test
public void hiddenNodeChanged() 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();
    NodeBuilder test = root.builder().child("test");
    NodeBuilder hidden = test.child(":hidden");
    hidden.child("added");
    Validator validator = provider.getRootValidator(root, builder.getNodeState(), CommitInfo.EMPTY);
    Validator childValidator = validator.childNodeChanged("test", root.getChildNode("test"), test.getNodeState());
    assertNotNull(childValidator);
    Validator hiddenValidator = childValidator.childNodeChanged(":hidden", root.getChildNode("test").getChildNode(":hidden"), hidden.getNodeState());
    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 87 with MemoryNodeStore

use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore in project jackrabbit-oak by apache.

the class AccessControlValidatorTest method hiddenNodeAdded.

@Test
public void hiddenNodeAdded() throws CommitFailedException {
    AccessControlValidatorProvider provider = new AccessControlValidatorProvider(getSecurityProvider());
    MemoryNodeStore store = new MemoryNodeStore();
    NodeState root = store.getRoot();
    NodeBuilder builder = root.builder();
    NodeBuilder test = builder.child("test");
    NodeBuilder hidden = test.child(":hidden");
    Validator validator = provider.getRootValidator(root, builder.getNodeState(), CommitInfo.EMPTY);
    Validator childValidator = validator.childNodeAdded("test", test.getNodeState());
    assertNotNull(childValidator);
    Validator hiddenValidator = childValidator.childNodeAdded(":hidden", hidden.getNodeState());
    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 88 with MemoryNodeStore

use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore 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 89 with MemoryNodeStore

use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore 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)

Example 90 with MemoryNodeStore

use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore in project jackrabbit-oak by apache.

the class CompositeNodeStoreBuilderTest method mismatchBetweenMountNameAndStoreName.

@Test(expected = NullPointerException.class)
public void mismatchBetweenMountNameAndStoreName() {
    MountInfoProvider mip = Mounts.newBuilder().mount("temp", "/tmp").build();
    new CompositeNodeStore.Builder(mip, new MemoryNodeStore()).addMount("not-temp", new MemoryNodeStore()).build();
}
Also used : MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) Test(org.junit.Test)

Aggregations

MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)92 Test (org.junit.Test)66 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)58 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)37 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)35 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)33 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)19 ProxyNodeStore (org.apache.jackrabbit.oak.spi.state.ProxyNodeStore)14 MountInfoProvider (org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)13 Oak (org.apache.jackrabbit.oak.Oak)9 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)7 AsyncIndexStats (org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate.AsyncIndexStats)7 EditorHook (org.apache.jackrabbit.oak.spi.commit.EditorHook)7 OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)7 AbstractSecurityTest (org.apache.jackrabbit.oak.AbstractSecurityTest)6 InitialContent (org.apache.jackrabbit.oak.InitialContent)6 PropertyIndexLookup (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexLookup)6 Validator (org.apache.jackrabbit.oak.spi.commit.Validator)6 ApplyDiff (org.apache.jackrabbit.oak.spi.state.ApplyDiff)6 Semaphore (java.util.concurrent.Semaphore)5