Search in sources :

Example 6 with NotExecutableException

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();
    }
}
Also used : NotExecutableException(org.apache.jackrabbit.test.NotExecutableException) SessionImpl(org.apache.jackrabbit.core.SessionImpl) NameResolver(org.apache.jackrabbit.spi.commons.conversion.NameResolver)

Example 7 with 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
    }
}
Also used : NotExecutableException(org.apache.jackrabbit.test.NotExecutableException) ValueFormatException(javax.jcr.ValueFormatException) Property(javax.jcr.Property)

Example 8 with NotExecutableException

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]);
}
Also used : NotExecutableException(org.apache.jackrabbit.test.NotExecutableException) Value(javax.jcr.Value) Property(javax.jcr.Property)

Example 9 with NotExecutableException

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");
    }
}
Also used : NotExecutableException(org.apache.jackrabbit.test.NotExecutableException) Node(javax.jcr.Node)

Example 10 with NotExecutableException

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));
}
Also used : NotExecutableException(org.apache.jackrabbit.test.NotExecutableException) Node(javax.jcr.Node)

Aggregations

NotExecutableException (org.apache.jackrabbit.test.NotExecutableException)381 Node (javax.jcr.Node)149 NodeType (javax.jcr.nodetype.NodeType)84 Value (javax.jcr.Value)81 RepositoryException (javax.jcr.RepositoryException)64 PropertyDefinition (javax.jcr.nodetype.PropertyDefinition)61 Session (javax.jcr.Session)59 Property (javax.jcr.Property)47 NodeDefinition (javax.jcr.nodetype.NodeDefinition)29 ConstraintViolationException (javax.jcr.nodetype.ConstraintViolationException)28 JackrabbitSession (org.apache.jackrabbit.api.JackrabbitSession)25 Authorizable (org.apache.jackrabbit.api.security.user.Authorizable)23 AccessControlPolicyIterator (javax.jcr.security.AccessControlPolicyIterator)22 Test (org.junit.Test)22 AccessControlPolicy (javax.jcr.security.AccessControlPolicy)21 User (org.apache.jackrabbit.api.security.user.User)19 Principal (java.security.Principal)18 NodeIterator (javax.jcr.NodeIterator)18 UserManager (org.apache.jackrabbit.api.security.user.UserManager)17 ItemExistsException (javax.jcr.ItemExistsException)16