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

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

            try {
                node.addMixin(mixinName);
                fail("Node.addMixin(String mixinName) must throw a LockException " +
                        "if the node is locked.");
View Full Code Here

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

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

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

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

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

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

        testNode.addMixin(mixVersionable);
        testNode.addMixin(mixLockable);
        testRootNode.save();

        // lock and check-in
        testNode.lock(false, true);
        testNode.save();
        testNode.checkin();

        // do the unlock
        testNode.unlock();
View Full Code Here

        testNode = testRootNode.addNode(nodeName1);
        testNode.addMixin(mixLockable);
        testRootNode.save();

        // lock last node (3)
        testNode.lock(false, true);

        // assert: last node locked
        assertTrue("Third child node locked",
                testRootNode.getNode(nodeName1 + "[3]").isLocked());
View Full Code Here

        Node testNode2 = testNode1.addNode(nodeName2);
        testNode2.addMixin(mixLockable);
        testRootNode.save();

        // lock child node
        testNode2.lock(false, true);

        // assert: child node locked
        assertTrue("Child node locked", testNode2.isLocked());

        // move child node up
View Full Code Here

        n2.addMixin("mix:lockable");
        session.save();

        // lock both nodes
        n1.lock(true, true);
        n2.lock(true, true);

        // assert: both nodes are locked
        assertTrue("First node locked: ", n1.isLocked());
        assertTrue("Second node locked: ", n2.isLocked());
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);

            assertFalse("Node.canAddMixin(String mixinName) must return false " +
                    "if the node is locked.",
                    node.canAddMixin(mixinName));
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.