public boolean isSame(Item item) throws RepositoryException { return this.item.isSame(item); }
/** {@inheritDoc} */ public boolean isSame(Item otherItem) throws RepositoryException { return item.isSame(unwrap(otherItem)); }
@Override public boolean isSame(Item otherItem) throws RepositoryException { return delegate.isSame(unwrap(otherItem)); }
/** * Tests session.getItem() with the testRootNode and assures that the * returned node represents the same node in the repository as * testRootNode. */ public void testGetItem() throws RepositoryException { Item item = session.getItem(testRoot); assertTrue("Session.getItem doesn't return the correct item.", item.isSame(testRootNode)); }
public Boolean execute() throws Exception { return getDelegate().isSame(unwrap(otherItem)); } });
public void testGetItem() throws RepositoryException { Item item = superuser.getItem("[" + identifier + "]"); assertTrue(item.isSame(testRootNode)); }
public boolean isSame(Item otherItem) throws RepositoryException { return getDelegate().isSame(unwrap(otherItem)); }
/** * Tests if <code>VersionHistory.getParent()</code> returns the right parent * Node */ public void testGetParent() throws Exception { assertTrue("VersionHistory.getParent() does not return the right parent-node", version.getAncestor(version.getDepth() - 2).isSame(vHistory.getParent())); }
public void testMovedReferenceableNode() throws RepositoryException, NotExecutableException { Node refNode2 = (Node) testSession.getItem(refNode.getPath()); superuser.move(refNode.getPath(), destParentNode.getPath() + "/" + nodeName2); superuser.save(); try { // modify some prop of the moved node with session 2 refNode2.setProperty(propertyName1, "test"); testSession.save(); // node has been automatically moved to new place // -> check if the parent is correct. assertTrue(testSession.getItem(destParentNode.getPath()).isSame(refNode.getParent())); } catch (InvalidItemStateException e) { // no automatic move of the externally moved node. ok. log.debug(e.getMessage()); } }
public void testReorder3() throws RepositoryException { String pathBefore = child3.getPath(); testRootNode.orderBefore(getRelPath(child3), getRelPath(child1)); testRootNode.save(); Item itemIndex3 = testRootNode.getSession().getItem(pathBefore); assertTrue(itemIndex3.isSame(child2)); Item item3 = testRootNode.getSession().getItem(child3.getPath()); assertTrue(item3.isSame(child3)); } }
public void testTreeAncestors() throws RepositoryException { int degree = destParentNode.getDepth(); Item ancestor = childNode.getAncestor(degree); assertTrue("Moving a node must move all child items as well.", ancestor.isSame(destParentNode)); ancestor = childProperty.getAncestor(degree); assertTrue("Moving a node must move all child items as well.", ancestor.isSame(destParentNode)); ancestor = grandChildNode.getAncestor(degree); assertTrue("Moving a node must move all child items as well.", ancestor.isSame(destParentNode)); }
public void testTreeAncestors() throws RepositoryException { int degree = destParentNode.getDepth(); Item ancestor = childNode.getAncestor(degree); assertTrue("Moving a node must move all child items as well.", ancestor.isSame(destParentNode)); ancestor = childProperty.getAncestor(degree); assertTrue("Moving a node must move all child items as well.", ancestor.isSame(destParentNode)); ancestor = grandChildNode.getAncestor(degree); assertTrue("Moving a node must move all child items as well.", ancestor.isSame(destParentNode)); }
/** * Transiently removes the first SNS-node using {@link javax.jcr.Node#remove()} * and test, whether the remaining sibling 'replaces' the removed node and * is the same as the node added as second sibling. */ public void testRemoveFirstSibling() throws RepositoryException { firstSiblingNode.remove(); // check if the node has been properly removed try { Node secondSibling = testRootNode.getNode(nodeName1); // implementation specific: assertTrue("", removeItem.isSame(secondSibling)); } catch (PathNotFoundException e) { fail("Second sibling must still be available."); } }
public void testRefreshMovedTree() throws RepositoryException { testRootNode.refresh(true); String msg = "Refresh must not revert a moved tree."; assertFalse(msg, superuser.itemExists(srcPath + "/" + nodeName2 + "/" + nodeName3)); int degree = destParentNode.getDepth(); List<Item> l = new ArrayList<Item>(); l.add(childNode); l.add(childProperty); l.add(grandChildNode); for (Iterator<Item> it = l.iterator(); it.hasNext();) { Item item = it.next(); assertTrue(msg, item.isNew()); assertTrue(msg, childNode.getAncestor(degree).isSame(destParentNode)); } } }
/** * Test if a moved node is 'replaced' by its SNS. */ public void testAccessMovedNodeByOldPath() throws RepositoryException, NotExecutableException { String oldPath = moveNode.getPath(); //move the node doMove(oldPath, destinationPath); try { Item item = superuser.getItem(oldPath); // Implementation specific: assertTrue("A moved SNS node must be 'replaced' but is successor sibling.", item.isSame(sourceSibling)); } catch (PathNotFoundException e) { fail("A moved SNS node must be 'replaced' but is successor sibling."); } }
public void testIsSameNode4() throws RepositoryException { Node n = testRootNode.addNode(nodeName1, testNodeType); Property p = n.setProperty(propertyName1, "anyvalue"); testRootNode.save(); // transiently move the node. String srcPath = n.getPath(); String destPath = testRootNode.getPath() + "/" + nodeName2; testRootNode.getSession().move(srcPath, destPath); Session otherSession = getHelper().getReadOnlySession(); try { Node otherNode = (Node) otherSession.getItem(srcPath); assertTrue(n.isSame(otherNode)); assertTrue(superuser.getItem(destPath).isSame(otherNode)); } finally { otherSession.logout(); } }
/** * Same as {@link #testRemoveNode()}, but calls save() (persisting the removal) * before executing the test. */ public void testRemoveFirstSibling2() throws RepositoryException, NotExecutableException { firstSiblingNode.remove(); testRootNode.save(); // check if the node has been properly removed try { Node secondSibling = testRootNode.getNode(nodeName1); // implementation specific: assertTrue("", removeItem.isSame(secondSibling)); } catch (PathNotFoundException e) { fail("Second sibling must still be available."); } }
public void testAncestorAfterRevert() throws RepositoryException { superuser.refresh(false); Item ancestor = grandChildNode.getAncestor(srcParentNode.getDepth()); assertTrue("Reverting a move-operation must move the tree back.", ancestor.isSame(srcParentNode)); }
/** * Transiently removes a persisted item using {@link javax.jcr.Item#remove()} * and test, whether the successor sibling is returned when retrieving the * item with the path of the removed node. */ public void testRemoveFirstSibling3() throws RepositoryException { firstSiblingNode.remove(); // check if the node has been properly removed try { Item secondSibling = superuser.getItem(firstSiblingPath); // implementation specific: assertTrue("", removeItem.isSame(secondSibling)); } catch (PathNotFoundException e) { fail("Removing a SNS Node -> successor must be accessible from the session by removed path."); } }
/** * Same as {@link #testRemoveFirstSibling3()} but calls save() before * executing the test. */ public void testRemoveFirstSibling4() throws RepositoryException { firstSiblingNode.remove(); testRootNode.save(); // check if the node has been properly removed try { Item secondSibling = superuser.getItem(firstSiblingPath); // implementation specific: assertTrue("", removeItem.isSame(secondSibling)); } catch (PathNotFoundException e) { fail("Removing a SNS Node -> successor must be accessible from the session by removed path."); } } }