Package javax.jcr

Examples of javax.jcr.Node.lock()


        Node n = testRootNode.addNode(nodeName1, testNodeType);
        n.addMixin(mixLockable);
        testRootNode.save();

        // lock node and get lock token
        Lock lock = n.lock(false, true);

        // assert: lock must be alive
        assertTrue("lock must be alive", lock.isLive());

        // assert: refresh must succeed
View Full Code Here


        Node n = testRootNode.addNode(nodeName1, testNodeType);
        n.addMixin(mixLockable);
        testRootNode.save();

        // lock node and get lock token
        Lock lock = n.lock(false, true);

        // assert: lock must be alive
        assertTrue("lock must be alive", lock.isLive());

        // unlock node
View Full Code Here

            lockTarget.addMixin(mixLockable);
            lockTarget.getParent().save();
        }

        // lock dst parent node using other session
        lockTarget.lock(true, true);

        try {
            workspaceW2.copy(workspace.getName(), node1.getPath(), dstAbsPath);
            fail("LockException was expected.");
        } catch (LockException e) {
View Full Code Here

        // access node through another session to lock it
        Session session2 = helper.getSuperuserSession();
        try {
            Node node2 = session2.getRootNode().getNode(pathRelToRoot);
            node2.lock(true, true);

            // test fails if a LockException is thrown when removing the node
            // (remove must be possible since the parent is not locked)
            node.remove();
        } finally {
View Full Code Here

        String pathRelToRoot = node.getPath().substring(1);
        // access node through another session to lock it
        Session session2 = helper.getSuperuserSession();
        try {
            Node node2 = session2.getRootNode().getNode(pathRelToRoot);
            node2.lock(true, true);

            try {
                subNode.remove();
                fail("Node.remove() must throw a LockException if the parent " +
                        "of the node is locked");
View Full Code Here

        if (repository.getDescriptor(Repository.OPTION_LOCKING_SUPPORTED) != null) {
            //A LockException is thrown if a lock prevents the addition of the subtree.
            Node lNode = testRootNode.addNode(nodeName1);
            lNode.addMixin(mixLockable);
            testRootNode.save();
            Lock lock = lNode.lock(true, true);
            session.removeLockToken(lock.getLockToken());   //remove the token, so the lock is for me, too
            FileInputStream in = new FileInputStream(file);
            try {
                doImport(lNode.getPath(), in, useWorkspace, useHandler);
            } catch (LockException e) {
View Full Code Here

        n.addMixin(mixLockable);
        n.addMixin(mixReferenceable);
        testRootNode.save();

        // lock this new node
        n.lock(false, true);

        // commit
        utx.commit();
    }
View Full Code Here

        assertFalse("Node not locked", n.isLocked());

        // get user transaction object, start and lock node
        UserTransaction utx = new UserTransactionImpl(superuser);
        utx.begin();
        n.lock(false, true);

        // verify node is locked
        assertTrue("Node locked", n.isLocked());

        // unlock node
View Full Code Here

        testRootNode.save();

        // get user transaction object, start and lock node
        UserTransaction utx = new UserTransactionImpl(superuser);
        utx.begin();
        Lock lock = n.lock(false, true);

        // verify lock is live
        assertTrue("Lock live", lock.isLive());

        // rollback
View Full Code Here

        Node n = testRootNode.addNode(nodeName1);
        n.addMixin(mixLockable);
        n.addMixin(mixReferenceable);
        testRootNode.save();

        Lock lock = n.lock(false, true);

        // get user transaction object, start
        UserTransaction utx = new UserTransactionImpl(superuser);
        utx.begin();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.