boolean useSns,
boolean print ) throws Exception {
Node node = session.getRootNode().addNode("testArea");
session.save();
Stopwatch sw = new Stopwatch();
if (print) System.out.print("Iterating ");
int numNodesEach = 0;
for (int i = 0; i != samples; ++i) {
System.out.print(".");
sw.start();
numNodesEach = createSubgraph(session, node, depth, numberOfChildrenPerNode, numberOfPropertiesPerNode, useSns, 1);
sw.stop();
session.save();
}
// session.getRootNode().getNode("testArea").remove();
// session.save();
// assertThat(session.getRootNode().getNodes().getSize(), is(1L)); // only '/jcr:system'
if (print) {
System.out.println();
System.out.println("Create subgraphs with " + numNodesEach + " nodes each: " + sw.getSimpleStatistics());
}
// Now try getting a node at one level down ...
String name = "childNode";
int index = numberOfChildrenPerNode / 2;
String path = useSns ? (name + "[" + index + "]") : (name + index);
sw.reset();
sw.start();
Node randomNode = node.getNode(path);
sw.stop();
assertThat(randomNode, is(notNullValue()));
if (print) {
System.out.println("Find " + randomNode.getPath() + ": " + sw.getTotalDuration());
}
}