Package javax.jcr.lock

Examples of javax.jcr.lock.Lock.refresh()


                    for (i = 0; i < NUM_OPERATIONS / CONCURRENCY; i++) {
                        Lock lock = n.lock(false, true);

                        final UserTransaction utx = new UserTransactionImpl(test.getSession());
                        utx.begin();
                        lock.refresh();
                        utx.commit();

                        n.unlock();
                    }
                } catch (Exception e) {
View Full Code Here


        Node n2 = getTestNode().getNode(nodeName1);

        // all lock operations must succeed
        Lock l = n2.lock(true, true);
        l.refresh();
        n2.unlock();
    }

    public void testLock3() throws RepositoryException, NotExecutableException {
        Node n = createLockableNode(testRootNode);
View Full Code Here

        // withdraw lock-mgmt -> must not be able to refresh the lock or
        // unlock the node
        modifyPrivileges(trn.getPath(), Privilege.JCR_LOCK_MANAGEMENT, false);

        try {
            l.refresh();
            fail("TestUser doesn't have permission to refresh the lock.");
        } catch (AccessDeniedException e) {
            // success
        }
        try {
View Full Code Here

        Node n2 = getTestNode().getNode(nodeName1);

        // all lock operations must succeed
        Lock l = n2.lock(true, true);
        l.refresh();
        n2.unlock();
    }

    public void testLock3() throws RepositoryException, NotExecutableException {
        Node n = createLockableNode(testRootNode);
View Full Code Here

        // withdraw lock-mgmt -> must not be able to refresh the lock or
        // unlock the node
        modifyPrivileges(trn.getPath(), Privilege.JCR_LOCK_MANAGEMENT, false);

        try {
            l.refresh();
            fail("TestUser doesn't have permission to refresh the lock.");
        } catch (AccessDeniedException e) {
            // success
        }
        try {
View Full Code Here

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

        // refresh
        try {
            lock.refresh();
            fail("Refresh on a lock that is not alive must fail");
        } catch (LockException e) {
            // success
        }
    }
View Full Code Here

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

        // assert: refresh must succeed
        lock.refresh();

        // unlock node
        n.unlock();

        // assert: lock must not be alive
View Full Code Here

        }

        if (Type.WRITE.equals(lock.getType())) {
            try {
                Lock jcrLock = ((Node) item).getLock();
                jcrLock.refresh();
                return new JcrActiveLock(jcrLock, EXCLUSIVE_SESSION.equals(lock.getScope()));
            } catch (RepositoryException e) {
                /*
                  NOTE: LockException is only thrown by Lock.refresh()
                        the lock exception thrown by Node.getLock() was circumvented
View Full Code Here

        }

        if (Type.WRITE.equals(lock.getType())) {
            try {
                Lock jcrLock = ((Node) item).getLock();
                jcrLock.refresh();
                return new JcrActiveLock(jcrLock);
            } catch (RepositoryException e) {
                /*
                  NOTE: LockException is only thrown by Lock.refresh()
                        the lock exception thrown by Node.getLock() was circumvented
View Full Code Here

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

        // assert: refresh must succeed
        lock.refresh();

        // unlock node
        n.unlock();

        // assert: lock must not be alive
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.