use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class PropertyReadMethodsTest method testGetValueCopyStoredValues.
/**
* Tests if <code>Property.getValues()</code> returns an array that is a copy
* of the stored values, so changes to it are not reflected in internal storage.
*/
public void testGetValueCopyStoredValues() throws NotExecutableException, RepositoryException {
Property prop = PropertyUtil.searchMultivalProp(testRootNode);
if (prop == null) {
throw new NotExecutableException("No multivalued property found.");
}
// acquire the values of the property and change the zeroth value
Value[] values = prop.getValues();
if (values.length == 0) {
throw new NotExecutableException("No testable property found.");
}
values[0] = null;
// re-acquire the values and check if nulled value still exists
Value[] values2 = prop.getValues();
assertNotNull("Changes on the array returned by Property.getValues() must " + "not be reflected in the internal storage.", values2[0]);
}
use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class ReferenceableRootNodesTest method testReferenceableRootNode.
/**
* A repository implementation may make its workspace root nodes
* mix:referenceable. If so, then the root node of all workspaces must be
* referenceable, and all must have the same UUID.
*/
public void testReferenceableRootNode() throws RepositoryException, NotExecutableException {
// compare UUID of default workspace and a second workspace
Node rootNode = session.getRootNode();
if (rootNode.isNodeType(mixReferenceable)) {
// check if root node in second workspace is referenceable too
Node rootNodeW2 = sessionW2.getRootNode();
if (!rootNodeW2.isNodeType(mixReferenceable)) {
fail("Root node in second workspace is not referenceable.");
}
// check if all root nodes have the same UUID
assertEquals("Referenceable root nodes of different workspaces must have same UUID.", rootNode.getUUID(), rootNodeW2.getUUID());
} else {
throw new NotExecutableException("Root node is not referenceable");
}
}
use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class SessionReadMethodsTest method testGetNodeByUUID.
/**
* Tests session.getNodeByUUID() using a valid uuid of a referenceable node
*/
public void testGetNodeByUUID() throws RepositoryException, NotExecutableException {
Node referenced = findReferenceable(testRootNode);
if (referenced == null) {
throw new NotExecutableException("Workspace does not contain a referenceable node.");
}
String uuid = referenced.getProperty(jcrUUID).getString();
Node node = session.getNodeByUUID(uuid);
assertTrue("Node retrieved with session.getNodeByUUID is not the same " + "as the node having the given uuid.", referenced.isSame(node));
}
use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class HoldTest method testPropertyPath.
public void testPropertyPath() throws RepositoryException, NotExecutableException {
String propPath = null;
for (PropertyIterator it = testRootNode.getProperties(); it.hasNext(); ) {
String path = it.nextProperty().getPath();
if (!superuser.nodeExists(path)) {
propPath = path;
break;
}
}
if (propPath == null) {
throw new NotExecutableException();
}
try {
retentionMgr.getHolds(propPath);
fail("Accessing holds from non-existing node must throw PathNotFoundException.");
} catch (PathNotFoundException e) {
// success
}
try {
retentionMgr.addHold(propPath, getHoldName(), true);
fail("Adding a hold for a non-existing node must throw PathNotFoundException.");
} catch (PathNotFoundException e) {
// success
}
try {
Hold h = retentionMgr.addHold(testNodePath, getHoldName(), true);
retentionMgr.removeHold(propPath, h);
fail("Removing a hold at a non-existing node must throw PathNotFoundException.");
} catch (PathNotFoundException e) {
// success
}
}
use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class RestoreTest method testRestoreWithUUIDConflictJcr2_2.
/**
* Tests if restoring the <code>Version</code> of an existing node throws an
* <code>ItemExistsException</code> if removeExisting is set to FALSE.
*/
public void testRestoreWithUUIDConflictJcr2_2() throws RepositoryException, NotExecutableException {
try {
Node naa = createVersionableNode(versionableNode, nodeName4, versionableNodeType);
// Verify that nodes used for the test have proper opv behaviour
NodeDefinition nd = naa.getDefinition();
if (nd.getOnParentVersion() != OnParentVersionAction.COPY && nd.getOnParentVersion() != OnParentVersionAction.VERSION) {
throw new NotExecutableException("Child nodes must have OPV COPY or VERSION in order to be able to test Node.restore with uuid conflict.");
}
Version v = versionManager.checkin(versionableNode.getPath());
versionManager.checkout(versionableNode.getPath());
superuser.move(naa.getPath(), versionableNode2.getPath() + "/" + naa.getName());
superuser.save();
versionManager.restore(v, false);
fail("Node.restore( Version, boolean ): An ItemExistsException must be thrown if the node to be restored already exsits and removeExisting was set to false.");
} catch (ItemExistsException e) {
// success
}
}
Aggregations