use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class ReorderTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
if (!testRootNode.getPrimaryNodeType().hasOrderableChildNodes()) {
throw new NotExecutableException("Test node does not have orderable children.");
}
NodeIterator it = testRootNode.getNodes();
if (it.hasNext()) {
throw new NotExecutableException("Test node already contains child nodes");
}
createOrderableChildren();
}
use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class SingleValuedPropertyTest method testGetLengthsFromSingleValued.
/**
* Tests if Property.getLengths() fails for single value property.
*/
public void testGetLengthsFromSingleValued() throws RepositoryException, NotExecutableException {
Property singleProp = PropertyUtil.searchSingleValuedProperty(testRootNode);
if (singleProp == null) {
throw new NotExecutableException("No single valued property found.");
}
try {
singleProp.getLengths();
fail("Property.getLengths() called on a single value property must fail (ValueFormatException).");
} catch (ValueFormatException vfe) {
// ok
}
}
use of org.apache.jackrabbit.test.NotExecutableException 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 org.apache.jackrabbit.test.NotExecutableException 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 org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class MoveTest method testMovePropertyExists.
/**
* Tries to move a node using <code>{@link javax.jcr.Session#move(String src, String dest)}
* </code> to a location where a property already exists with same name.
* <br/>
* With JCR 1.0 this should throw an <code>{@link javax.jcr.ItemExistsException}</code>.
* With JCR 2.0 the support for same-named property and node is optional and
* the expected behaviour depends on the
* {@link Repository#OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED} descriptor.
*/
public void testMovePropertyExists() throws RepositoryException, NotExecutableException {
// try to create a property with the name of the node to be moved
// to the destination parent
Property destProperty;
try {
destProperty = destParentNode.setProperty(nodeName2, "anyString");
} catch (RepositoryException e) {
throw new NotExecutableException("Cannot create property with name '" + nodeName2 + "' and value 'anyString' at move destination.");
}
// TODO: fix 2.0 behaviour according to the OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED descriptor
if ("1.0".equals(getHelper().getRepository().getDescriptor(Repository.SPEC_VERSION_DESC))) {
try {
// move the node
doMove(moveNode.getPath(), destProperty.getPath());
fail("Moving a node to a location where a property exists must throw ItemExistsException");
} catch (ItemExistsException e) {
// ok, works as expected
}
} else {
// move the node: same name property and node must be supported
// see Issue 725
doMove(moveNode.getPath(), destProperty.getPath());
}
}
Aggregations