JcrLockManager implements LockManager { @Override public Lock lock( String absPath, boolean isDeep, boolean isSessionScoped, long timeoutHint, String ownerInfo ) throws LockException, PathNotFoundException, AccessDeniedException, InvalidItemStateException, RepositoryException { AbstractJcrNode node = session.node(session.absolutePathFor(absPath)); return lock(node, isDeep, isSessionScoped, timeoutHint, ownerInfo); } JcrLockManager( JcrSession session,
                    RepositoryLockManager lockManager ); @Override void addLockToken( String lockToken ); @Override void removeLockToken( String lockToken ); @Override String[] getLockTokens(); @Override boolean isLocked( String absPath ); boolean isLocked( AbstractJcrNode node ); @Override Lock getLock( String absPath ); Lock getLock( AbstractJcrNode node ); Lock getLockIfExists( AbstractJcrNode node ); @Override boolean holdsLock( String absPath ); boolean holdsLock( AbstractJcrNode node ); @Override Lock lock( String absPath,
                      boolean isDeep,
                      boolean isSessionScoped,
                      long timeoutHint,
                      String ownerInfo ); Lock lock( AbstractJcrNode node,
                      boolean isDeep,
                      boolean isSessionScoped,
                      long timeoutHint,
                      String ownerInfo ); @Override void unlock( String absPath ); void unlock( AbstractJcrNode node );  }
@Test @FixFor( "MODE-2047" ) public void shouldNotAllowLockOnTransientNode() throws Exception { AbstractJcrNode testNode = session.getRootNode().addNode("test"); testNode.addMixin("mix:lockable"); JcrLockManager lockManager = session.lockManager(); try { lockManager.lock(testNode, true, false, Long.MAX_VALUE, null); fail("Transient nodes should not be locked"); } catch (InvalidItemStateException e) { } }
@Test @FixFor( "MODE-2424" ) public void shouldAllowAddingMixinOnLockedNodeForLockOwner() throws Exception { final AbstractJcrNode testNode = session.getRootNode().addNode("test"); final String path = testNode.getPath(); testNode.addMixin("mix:lockable"); session.save(); session.getWorkspace().getLockManager().lock(path, false, true, Long.MAX_VALUE, session.getUserID()); testNode.addMixin("mix:created"); session.save(); }