Search in sources :

Example 26 with UnsupportedRepositoryOperationException

use of javax.jcr.UnsupportedRepositoryOperationException in project jackrabbit by apache.

the class CheckinTest method testCheckinNonVersionableNodeJcr2.

/**
     * Test calling VersionManager.checkin(P) with the path P resolving to
     * a non-versionable node.
     *
     * @throws RepositoryException
     */
public void testCheckinNonVersionableNodeJcr2() throws RepositoryException {
    try {
        VersionManager versionManager = nonVersionableNode.getSession().getWorkspace().getVersionManager();
        String path = nonVersionableNode.getPath();
        versionManager.checkin(path);
        fail("VersionManager.checkin(P) must throw UnsupportedRepositoryOperationException if the path P resolves to a non-versionable node.");
    } catch (UnsupportedRepositoryOperationException e) {
    //success
    }
}
Also used : UnsupportedRepositoryOperationException(javax.jcr.UnsupportedRepositoryOperationException) VersionManager(javax.jcr.version.VersionManager)

Example 27 with UnsupportedRepositoryOperationException

use of javax.jcr.UnsupportedRepositoryOperationException in project jackrabbit by apache.

the class CheckoutTest method testCheckoutNonVersionableNodeJcr2.

/**
     * Test calling VersionManager.checkout(P) with P denoting the absolute
     * path of a non-versionable node.
     */
public void testCheckoutNonVersionableNodeJcr2() throws RepositoryException {
    VersionManager versionManager = nonVersionableNode.getSession().getWorkspace().getVersionManager();
    String path = nonVersionableNode.getPath();
    try {
        versionManager.checkout(path);
        fail("VersionManager.checkout(P) with P denoting the absolute path of a non-versionable node must throw UnsupportedRepositoryOperationException");
    } catch (UnsupportedRepositoryOperationException e) {
    //success
    }
}
Also used : UnsupportedRepositoryOperationException(javax.jcr.UnsupportedRepositoryOperationException) VersionManager(javax.jcr.version.VersionManager)

Example 28 with UnsupportedRepositoryOperationException

use of javax.jcr.UnsupportedRepositoryOperationException in project jackrabbit by apache.

the class ReplaceNodeTest method testAddReplacementAfterMove.

public void testAddReplacementAfterMove() throws RepositoryException {
    // transiently move the 'removeNode'
    superuser.move(removeNode.getPath(), testRootNode.getPath() + "/" + nodeName4);
    // add node that replaces the moved node
    Node n = testRootNode.addNode(nodeName1, testNodeType);
    // ... and a child node.
    n.addNode(nodeName2, testNodeType);
    testRootNode.save();
    try {
        // if (for impl reasons) 'n' is referenceable -> it must have a
        // different uuid.
        assertFalse(uuid.equals(n.getUUID()));
    } catch (UnsupportedRepositoryOperationException e) {
    // n has not been made referenceable before -> OK.
    }
}
Also used : UnsupportedRepositoryOperationException(javax.jcr.UnsupportedRepositoryOperationException) Node(javax.jcr.Node)

Example 29 with UnsupportedRepositoryOperationException

use of javax.jcr.UnsupportedRepositoryOperationException in project jackrabbit by apache.

the class ReplaceNodeTest method testAddReplacementAfterRemove.

public void testAddReplacementAfterRemove() throws RepositoryException {
    // transient removal of the 'removeNode'
    removeNode.remove();
    // add node that replaces the transiently removed node
    Node n = testRootNode.addNode(nodeName2, testNodeType);
    // ... and a child node.
    n.addNode(nodeName3, testNodeType);
    testRootNode.save();
    try {
        // if (for impl reasons) 'n' is referenceable -> it must have a
        // different uuid.
        assertFalse(uuid.equals(n.getUUID()));
    } catch (UnsupportedRepositoryOperationException e) {
    // n has not been made referenceable before -> OK.
    }
}
Also used : UnsupportedRepositoryOperationException(javax.jcr.UnsupportedRepositoryOperationException) Node(javax.jcr.Node)

Example 30 with UnsupportedRepositoryOperationException

use of javax.jcr.UnsupportedRepositoryOperationException in project jackrabbit-oak by apache.

the class WorkspaceImpl method clone.

@Override
public void clone(String srcWorkspace, String srcAbsPath, String destAbsPath, boolean removeExisting) throws RepositoryException {
    final String srcOakPath = getOakPathOrThrowNotFound(srcAbsPath);
    final String destOakPath = getOakPathOrThrowNotFound(destAbsPath);
    sessionDelegate.performVoid(new SessionOperation<Void>("clone", true) {

        @Override
        public void checkPreconditions() throws RepositoryException {
            super.checkPreconditions();
            ensureIsAlive();
        }

        @Override
        public void performVoid() throws RepositoryException {
            sessionDelegate.checkProtectedNode(getParentPath(srcOakPath));
            sessionDelegate.checkProtectedNode(getParentPath(destOakPath));
            throw new UnsupportedRepositoryOperationException("Not implemented.");
        }
    });
}
Also used : UnsupportedRepositoryOperationException(javax.jcr.UnsupportedRepositoryOperationException) RepositoryException(javax.jcr.RepositoryException)

Aggregations

UnsupportedRepositoryOperationException (javax.jcr.UnsupportedRepositoryOperationException)57 RepositoryException (javax.jcr.RepositoryException)17 Node (javax.jcr.Node)14 NotExecutableException (org.apache.jackrabbit.test.NotExecutableException)12 NodeId (org.apache.jackrabbit.core.id.NodeId)8 ArrayList (java.util.ArrayList)7 Workspace (javax.jcr.Workspace)5 ConstraintViolationException (javax.jcr.nodetype.ConstraintViolationException)5 Session (javax.jcr.Session)4 VersionManager (javax.jcr.version.VersionManager)4 NodeState (org.apache.jackrabbit.core.state.NodeState)4 Name (org.apache.jackrabbit.spi.Name)4 Path (org.apache.jackrabbit.spi.Path)4 IOException (java.io.IOException)3 ItemExistsException (javax.jcr.ItemExistsException)3 ItemNotFoundException (javax.jcr.ItemNotFoundException)3 NodeType (javax.jcr.nodetype.NodeType)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 AccessDeniedException (javax.jcr.AccessDeniedException)2