Package javax.jcr

Examples of javax.jcr.Node.holdsLock()


        Node ln2 = (Node) otherSession.getItem(lockedNode.getPath());

        lockedNode.unlock();

        assertFalse("Node is not locked any more", ln2.isLocked());
        assertFalse("Node is not locked any more", ln2.holdsLock());
        try {
            ln2.getLock();
            fail("Node is not locked any more");
        } catch (LockException e) {
            // OK
View Full Code Here


        // unlock parent node
        n1.unlock();

        // child node must still hold lock
        assertTrue("child node must still hold lock", n2.holdsLock());
    }

    /**
     * Test parent/child lock
     */
 
View Full Code Here

        testNode.save();
        testNode.checkin();

        // do the unlock
        testNode.unlock();
        assertFalse("Could not unlock a locked, checked-in node", testNode.holdsLock());
    }

    /**
     * Tests if locks are maintained when child nodes are reordered
     */
 
View Full Code Here

        Node ln2 = (Node) otherSession.getItem(lockedNode.getPath());

        lockedNode.unlock();

        assertFalse("Node is not locked any more", ln2.isLocked());
        assertFalse("Node is not locked any more", ln2.holdsLock());
        try {
            ln2.getLock();
            fail("Node is not locked any more");
        } catch (LockException e) {
            // OK
View Full Code Here

        // remove lock implicit by logout lock-holding session
        otherSession.logout();

        assertFalse(n2.isLocked());
        assertFalse(n2.holdsLock());
        try {
            n2.getLock();
            fail("Upon logout of the session a session-scoped lock must be gone.");
        } catch (LockException e) {
            // ok
View Full Code Here

     * A locked node must also be locked if accessed by some other session.
     */
    public void testLockVisibility() throws RepositoryException {
        Node ln2 = (Node) otherSession.getItem(lockedNode.getPath());
        assertTrue("Locked node must also be locked for another session", ln2.isLocked());
        assertTrue("Locked node must also be locked for another session", ln2.holdsLock());
    }

    /**
     * If a locked nodes is unlocked again, any Lock instance retrieved by
     * another session must change the lock-status. Similarly, the previously
View Full Code Here

        Node ln2 = (Node) otherSession.getItem(lockedNode.getPath());

        lockedNode.unlock();

        assertFalse("Node is not locked any more", ln2.isLocked());
        assertFalse("Node is not locked any more", ln2.holdsLock());
        try {
            ln2.getLock();
            fail("Node is not locked any more");
        } catch (LockException e) {
            // OK
View Full Code Here

        // unlock parent node
        n1.unlock();

        // child node must still hold lock
        assertTrue("child node must still hold lock", n2.holdsLock());
    }

    /**
     * Test parent/child lock
     */
 
View Full Code Here

        testNode.save();
        testNode.checkin();

        // do the unlock
        testNode.unlock();
        assertFalse("Could not unlock a locked, checked-in node", testNode.holdsLock());
    }

    /**
     * Tests if locks are maintained when child nodes are reordered
     */
 
View Full Code Here

    public void testLockVisibility() throws RepositoryException {
        Session otherSession = getHelper().getReadWriteSession();
        try {
            Node ln = (Node) otherSession.getItem(lockedNode.getPath());
            assertTrue("Locked node must also be locked for another session", ln.isLocked());
            assertTrue("Locked node must also be locked for another session", ln.holdsLock());
            assertTrue("Locked node must also be locked for another session", getLockManager(otherSession).holdsLock(ln.getPath()));
        } finally {
            otherSession.logout();
        }
    }
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.