Search in sources :

Example 16 with LockManager

use of javax.jcr.lock.LockManager in project jackrabbit-oak by apache.

the class VersionManagementTest method testCheckInCheckoutLocked.

@Test
public void testCheckInCheckoutLocked() throws Exception {
    LockManager lockManager = superuser.getWorkspace().getLockManager();
    VersionManager versionManager = superuser.getWorkspace().getVersionManager();
    // create a versionable and lockable node
    Node n = createVersionableNode(superuser.getNode(path));
    n.addMixin(mixLockable);
    superuser.save();
    String nodePath = n.getPath();
    // lock
    lockManager.lock(nodePath, true, false, 0, superuser.getUserID());
    // create version
    versionManager.checkin(nodePath);
    versionManager.checkout(nodePath);
}
Also used : LockManager(javax.jcr.lock.LockManager) Node(javax.jcr.Node) VersionManager(javax.jcr.version.VersionManager) Test(org.junit.Test)

Aggregations

LockManager (javax.jcr.lock.LockManager)16 Session (javax.jcr.Session)7 Lock (javax.jcr.lock.Lock)7 LockException (javax.jcr.lock.LockException)6 Node (javax.jcr.Node)4 RepositoryException (javax.jcr.RepositoryException)1 VersionManager (javax.jcr.version.VersionManager)1 RemoteLockManager (org.apache.jackrabbit.rmi.remote.RemoteLockManager)1 Test (org.junit.Test)1