use of javax.jcr.PathNotFoundException in project jackrabbit by apache.
the class MoveTest method testAccessMovedNodeByOldPath.
/**
* Test if a moved node is not accessible by its old path any more
*/
public void testAccessMovedNodeByOldPath() throws RepositoryException, NotExecutableException {
NodeIterator it = srcParentNode.getNodes(moveNode.getName());
int cnt = 0;
while (it.hasNext()) {
it.nextNode();
cnt++;
}
if (cnt > 1) {
throw new NotExecutableException("Move source parent has multiple child nodes with name " + moveNode.getName());
}
String oldPath = moveNode.getPath();
//move the node
doMove(oldPath, destinationPath);
try {
superuser.getItem(oldPath);
fail("A moved node must not be accessible by its old path any more.");
} catch (PathNotFoundException e) {
// ok.
}
}
use of javax.jcr.PathNotFoundException in project jackrabbit by apache.
the class MoveTest method testAccessMovedNodeByOldPath2.
/**
* Same as {@link #testAccessMovedNodeByOldPath()} but calls save() prior to
* the test.
*/
public void testAccessMovedNodeByOldPath2() throws RepositoryException, NotExecutableException {
NodeIterator it = srcParentNode.getNodes(moveNode.getName());
int cnt = 0;
while (it.hasNext()) {
it.nextNode();
cnt++;
}
if (cnt > 1) {
throw new NotExecutableException("Move source parent has multiple child nodes with name " + moveNode.getName());
}
String oldPath = moveNode.getPath();
//move the node
doMove(oldPath, destinationPath);
superuser.save();
try {
superuser.getItem(oldPath);
fail("A moved node must not be accessible by its old path any more.");
} catch (PathNotFoundException e) {
// ok.
}
}
use of javax.jcr.PathNotFoundException in project jackrabbit by apache.
the class RemoveSNSTest method testRemoveFirstSibling3.
/**
* 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.");
}
}
use of javax.jcr.PathNotFoundException in project jackrabbit by apache.
the class RemoveSNSTest method testRemoveFirstSibling.
/**
* 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.");
}
}
use of javax.jcr.PathNotFoundException in project jackrabbit by apache.
the class RemoveSNSTest method testRemoveFirstSibling2.
/**
* 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.");
}
}
Aggregations