Search in sources :

Example 81 with MemoryNodeStore

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

the class SimpleNodeAggregatorTest method testStarName.

@Test
public void testStarName() {
    NodeState root = new MemoryNodeStore().getRoot();
    NodeBuilder builder = root.builder();
    NodeBuilder file = builder.child("file");
    file.setProperty(JCR_PRIMARYTYPE, NT_FILE);
    file.child(JCR_CONTENT);
    SimpleNodeAggregator agg = new SimpleNodeAggregator().newRuleWithName(NT_FILE, newArrayList(INCLUDE_ALL));
    String path = "/file/jcr:content";
    List<String> actual = newArrayList(agg.getParents(builder.getNodeState(), path));
    assertEquals(newArrayList("/file"), actual);
}
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) Test(org.junit.Test)

Example 82 with MemoryNodeStore

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

the class SimpleNodeAggregatorTest method testCascadingNodeName.

@Test
public void testCascadingNodeName() {
    NodeState root = new MemoryNodeStore().getRoot();
    NodeBuilder builder = root.builder();
    NodeBuilder folder = builder.child("folder");
    folder.setProperty(JCR_PRIMARYTYPE, NT_FOLDER);
    NodeBuilder file = folder.child("file");
    file.setProperty(JCR_PRIMARYTYPE, NT_FILE);
    file.child(JCR_CONTENT);
    SimpleNodeAggregator agg = new SimpleNodeAggregator().newRuleWithName(NT_FOLDER, newArrayList("file")).newRuleWithName(NT_FILE, newArrayList(JCR_CONTENT));
    String path = "/folder/file/jcr:content";
    List<String> actual = newArrayList(agg.getParents(builder.getNodeState(), path));
    assertEquals(newArrayList("/folder/file", "/folder"), actual);
}
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) Test(org.junit.Test)

Example 83 with MemoryNodeStore

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

the class SimpleNodeAggregatorTest method testCascadingStarName.

@Test
public void testCascadingStarName() {
    NodeState root = new MemoryNodeStore().getRoot();
    NodeBuilder builder = root.builder();
    NodeBuilder folder = builder.child("folder");
    folder.setProperty(JCR_PRIMARYTYPE, NT_FOLDER);
    NodeBuilder file = folder.child("file");
    file.setProperty(JCR_PRIMARYTYPE, NT_FILE);
    file.child(JCR_CONTENT);
    SimpleNodeAggregator agg = new SimpleNodeAggregator().newRuleWithName(NT_FOLDER, newArrayList("file")).newRuleWithName(NT_FILE, newArrayList(INCLUDE_ALL));
    String path = "/folder/file/jcr:content";
    List<String> actual = newArrayList(agg.getParents(builder.getNodeState(), path));
    assertEquals(newArrayList("/folder/file", "/folder"), actual);
}
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) Test(org.junit.Test)

Example 84 with MemoryNodeStore

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

the class SimpleNodeAggregatorTest method testNodeName.

@Test
public void testNodeName() {
    NodeState root = new MemoryNodeStore().getRoot();
    NodeBuilder builder = root.builder();
    NodeBuilder file = builder.child("file");
    file.setProperty(JCR_PRIMARYTYPE, NT_FILE);
    file.child(JCR_CONTENT);
    SimpleNodeAggregator agg = new SimpleNodeAggregator().newRuleWithName(NT_FILE, newArrayList(JCR_CONTENT));
    String path = "/file/jcr:content";
    List<String> actual = newArrayList(agg.getParents(builder.getNodeState(), path));
    assertEquals(newArrayList("/file"), actual);
}
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) Test(org.junit.Test)

Example 85 with MemoryNodeStore

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

the class SimpleNodeAggregatorTest method testNodeNameWrongParentType.

@Test
public void testNodeNameWrongParentType() {
    NodeState root = new MemoryNodeStore().getRoot();
    NodeBuilder builder = root.builder();
    NodeBuilder file = builder.child("file");
    file.setProperty(JCR_PRIMARYTYPE, NT_FILE + "_");
    file.child(JCR_CONTENT);
    SimpleNodeAggregator agg = new SimpleNodeAggregator().newRuleWithName(NT_FILE, newArrayList(JCR_CONTENT));
    String path = "/file/jcr:content";
    List<String> actual = newArrayList(agg.getParents(builder.getNodeState(), path));
    assertTrue(actual.isEmpty());
}
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) 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