Package javax.jcr

Examples of javax.jcr.Node.unlock()


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

        // unlock
        n.unlock();

        Node n2 = (Node) otherSuperuser.getItem(n.getPath());
        assertTrue(n2.isLocked());
        assertTrue(n2.hasProperty(jcrLockOwner));
        assertTrue(n2.hasProperty(jcrlockIsDeep));
View Full Code Here


            otherSession.logout();

            assertTrue("After logout a open-scoped node must still be locked.", lock2.isLive());
            assertTrue("After logout a open-scoped node must still be locked.", n2.isLocked());
        } finally {
            n2.unlock();
        }
    }

    /**
     * Test if the lock token has been automatically added to the set of lock
View Full Code Here

            superuser.removeLockToken(lockToken);
            otherSession.addLockToken(lockToken);

            // otherSession is now lockHolder -> unlock must succeed.
            Node n2 = (Node) otherSession.getItem(lockedNode.getPath());
            n2.unlock();
        } catch (RepositoryException e) {
            // only in case of failure:
            // move lock token back in order to have lock removed properly
            // if test succeeds, moving back tokens is not necessary.
            otherSession.removeLockToken(lockToken);
View Full Code Here

            superuser.removeLockToken(lockToken);
            otherSession.addLockToken(lockToken);

            // otherSession is now lockHolder -> unlock must succeed.
            Node n2 = (Node) otherSession.getItem(lockedNode.getPath());
            n2.unlock();

            assertFalse("Lock has been release by another session.", lockedNode.holdsLock());

            assertFalse("Lock has been release by another session.", lock.isLive());
            assertFalse("Lock has been release by another session.", lock.getNode().isLocked());
View Full Code Here

            fail("Query.storeAsNode() must throw LockException, parent node is locked.");
        } catch (LockException e) {
            // expected behaviour
        } finally {
            readWrite.logout();
            lockable.unlock();
        }
    }

    /**
     * Tests if the a {@link javax.jcr.RepositoryException} is thrown when
View Full Code Here

        String lockOwnerPath = testRoot + "/" + nodeName1 + "/" + jcrLockOwner;
        assertTrue("No event created for jcr:lockOwner", paths.contains(lockOwnerPath));
        String lockIsDeepPath = testRoot + "/" + nodeName1 + "/" + jcrlockIsDeep;
        assertTrue("No event created for jcr:lockIsDeep", paths.contains(lockIsDeepPath));

        lockable.unlock();
    }

    /**
     * Tests if unlocking a node triggers property removed events for the
     * properties jcr:lockOwner and jcr:lockIsDeep.
View Full Code Here

        // lock the node
        lockable.lock(false, true);

        EventResult result = new EventResult(log);
        addEventListener(result, Event.PROPERTY_REMOVED);
        lockable.unlock();
        removeEventListener(result);

        Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
        assertEquals("Wrong number of events.", 2, events.length);
        for (int i = 0; i < events.length; i++) {
View Full Code Here

        testNode.lock(false, true);
        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

            workspaceW2.clone(workspace.getName(), node1.getPath(), dstAbsPath, true);
            fail("LockException was expected.");
        } catch (LockException e) {
            // successful
        } finally {
            lockTarget.unlock();
        }
    }
}
View Full Code Here

                    "in property " + jcrLockOwner + " of the lock holding " +
                    "node",
                    n1.getProperty(jcrLockOwner).getString(),
                    lock.getLockOwner());
        }
        n1.unlock();
    }

    /**
     * Test if getLockOwner() returns the same value as returned by
     * Session.getUserId at the time that the lock was placed
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.