use of org.neo4j.graphdb.Traverser in project graphdb by neo4j-attic.
the class TestTraversal method testBruteDepthTraversal.
// Traverses the full test "ise-tree-like" population depth first
// and verifies that it is returned in correct order
@Test
public void testBruteDepthTraversal() throws Exception {
Node root = this.buildIseTreePopulation();
RelationshipType[] traversableRels = new RelationshipType[] { MyRelTypes.TEST, MyRelTypes.TEST_TRAVERSAL };
Traverser traverser = root.traverse(DEPTH_FIRST, StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL, traversableRels[0], Direction.BOTH, traversableRels[1], Direction.BOTH);
try {
this.assertNodes(traverser, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14");
assertTrue("Too many nodes returned from traversal", traverser.iterator().hasNext() == false);
} catch (java.util.NoSuchElementException nsee) {
fail("Too few nodes returned from traversal");
} finally {
this.deleteNodeTreeRecursively(root, 0);
}
}
Aggregations