use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class AuthorizableImplTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
if (superuser instanceof SessionImpl) {
NameResolver resolver = (SessionImpl) superuser;
protectedUserProps.add(resolver.getJCRName(UserConstants.P_PASSWORD));
protectedUserProps.add(resolver.getJCRName(UserConstants.P_IMPERSONATORS));
protectedUserProps.add(resolver.getJCRName(UserConstants.P_PRINCIPAL_NAME));
protectedUserProps.add(resolver.getJCRName(UserConstants.P_DISABLED));
protectedGroupProps.add(resolver.getJCRName(UserConstants.P_MEMBERS));
protectedGroupProps.add(resolver.getJCRName(UserConstants.P_PRINCIPAL_NAME));
} else {
throw new NotExecutableException();
}
}
use of org.apache.jackrabbit.test.NotExecutableException in project jackrabbit by apache.
the class PropertyReadMethodsTest method testGetValues.
/**
* Tests failure of Property.getValues() method for a single value
* property.
*/
public void testGetValues() throws RepositoryException, NotExecutableException {
Property singleProp = PropertyUtil.searchSingleValuedProperty(testRootNode);
if (singleProp == null) {
throw new NotExecutableException("No single valued property found.");
}
try {
singleProp.getValues();
fail("Property.getValues() called on a single property " + "should throw a ValueFormatException.");
} catch (ValueFormatException vfe) {
// ok
}
}
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));
}
Aggregations