Search in sources :

Example 6 with TreeManager

use of org.apache.jackrabbit.commons.flat.TreeManager in project jackrabbit by apache.

the class ItemSequenceTest method testSingletonNodeSequence.

public void testSingletonNodeSequence() throws RepositoryException {
    Comparator<String> order = Rank.<String>comparableComparator();
    TreeManager treeManager = new BTreeManager(testNode, 5, 10, order, true);
    NodeSequence nodes = ItemSequence.createNodeSequence(treeManager, errorHandler);
    nodes.addNode("key", NodeType.NT_UNSTRUCTURED);
    assertTrue(nodes.hasItem("key"));
    Iterator<Node> nodeIt = nodes.iterator();
    assertTrue(nodeIt.hasNext());
    assertEquals("key", nodeIt.next().getName());
    assertFalse(nodeIt.hasNext());
    checkTreeProperty(testNode, 5, 10, order);
    checkOrder(nodes, order);
    nodes.removeNode("key");
    assertEmpty(nodes);
}
Also used : NodeSequence(org.apache.jackrabbit.commons.flat.NodeSequence) Node(javax.jcr.Node) TreeManager(org.apache.jackrabbit.commons.flat.TreeManager) BTreeManager(org.apache.jackrabbit.commons.flat.BTreeManager) BTreeManager(org.apache.jackrabbit.commons.flat.BTreeManager)

Example 7 with TreeManager

use of org.apache.jackrabbit.commons.flat.TreeManager in project jackrabbit by apache.

the class ItemSequenceTest method testEmptyPropertySequence.

public void testEmptyPropertySequence() throws RepositoryException {
    Comparator<String> order = Rank.<String>comparableComparator();
    TreeManager treeManager = new BTreeManager(testNode, 2, 4, order, true);
    PropertySequence properties = ItemSequence.createPropertySequence(treeManager, errorHandler);
    Iterator<Property> propertyIt = properties.iterator();
    assertFalse(propertyIt.hasNext());
    assertEmpty(properties);
}
Also used : PropertySequence(org.apache.jackrabbit.commons.flat.PropertySequence) TreeManager(org.apache.jackrabbit.commons.flat.TreeManager) BTreeManager(org.apache.jackrabbit.commons.flat.BTreeManager) Property(javax.jcr.Property) BTreeManager(org.apache.jackrabbit.commons.flat.BTreeManager)

Aggregations

BTreeManager (org.apache.jackrabbit.commons.flat.BTreeManager)7 TreeManager (org.apache.jackrabbit.commons.flat.TreeManager)7 NodeSequence (org.apache.jackrabbit.commons.flat.NodeSequence)3 PropertySequence (org.apache.jackrabbit.commons.flat.PropertySequence)3 Node (javax.jcr.Node)2 Property (javax.jcr.Property)2 ValueFactory (javax.jcr.ValueFactory)2