protected void addMixinRecursively( String path, String... nodeTypes ) throws RepositoryException { Node node = session().getRootNode().getNode(relativePath(path)); addMixin(node, true, nodeTypes); }
protected void assertChildrenInclude( Node parentNode, String... minimalChildNamesWithSns ) throws RepositoryException { assertChildrenInclude(null, parentNode, minimalChildNamesWithSns); }
private static int createChildren( Node parent, int numProperties, int width, int depth ) throws Exception { if (depth < 1) { return 0; } int count = width; for (int i = 0; i < width; i++) { Node newNode = parent.addNode(getRandomString(9), "nt:unstructured"); for (int j = 0; j < numProperties; j++) { newNode.setProperty(getRandomString(8), getRandomString(16)); } count += createChildren(newNode, numProperties, width, depth - 1); } return count; }
protected Node assertNode( String path ) throws RepositoryException { if (print && !session().getRootNode().hasNode(path)) { // We won't find the node, so print out the information ... Node parent = session().getRootNode(); for (Segment segment : path(path)) { if (!parent.hasNode(asString(segment))) { System.out.println("Unable to find '" + path + "'; lowest node is '" + parent.getPath() + "'"); break; } parent = parent.getNode(asString(segment)); } } Node node = session().getNode(path); assertThat(node, is(notNullValue())); // Verify that the path can be found via navigating ... if (path.trim().length() == 0) { // This is the root path, so of course it exists ... assertThat(session().getRootNode(), is(notNullValue())); } else { } return node; }
String description ) throws Exception { long totalNumber = calculateTotalNumberOfNodesInTree(numberOfChildrenPerNode, depth, false); if (initialPath == null) initialPath = ""; if (description == null) { totalNumberCreated += createChildren(parentNode, numberOfPropertiesPerNode, numberOfChildrenPerNode, depth); stopwatch.stop(); if (output != null) { output.println(" " + getTotalAndAverageDuration(stopwatch, totalNumberCreated));
String description ) throws Exception { long totalNumber = calculateTotalNumberOfNodesInTree(numberOfChildrenPerNode, depth, false); if (initialPath == null) initialPath = ""; if (description == null) { totalNumberTraversed += traverseChildren(parentNode); stopwatch.stop(); if (output != null) { output.println(" " + getTotalAndAverageDuration(stopwatch, totalNumberTraversed));
protected Node addMixin( Node node, boolean recursive, String... nodeTypes ) throws RepositoryException { assertThat(node, is(notNullValue())); for (String nodeType : nodeTypes) { if (!hasMixin(node, nodeType)) { node.addMixin(nodeType); } } if (recursive) { NodeIterator children = node.getNodes(); while (children.hasNext()) { addMixin(children.nextNode(), true, nodeTypes); } } return node; }
@Before @Override public void beforeEach() throws Exception { super.beforeEach(); // create a new session for each test ... session = repository.login(); }
protected Node assertNode( String path, String primaryType ) throws RepositoryException { Node node = assertNode(path); assertEquals(primaryType, node.getPrimaryNodeType().getName()); return node; }
@Override @Before public void beforeEach() throws Exception { super.beforeEach(); if (startRepositoryAutomatically()) { startRepository(); } tools = new JcrTools(); }
protected Node addMixin( String path, String... nodeTypes ) throws RepositoryException { Node node = session().getRootNode().getNode(relativePath(path)); return addMixin(node, false, nodeTypes); }