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);
}
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);
}
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);
}
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);
}
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());
}
Aggregations