1 Reply Latest reply on Nov 11, 2016 1:52 AM by Horia Chiorean

    Locking a node within a transaction

    Rustam Usmanov Apprentice

      Revisiting [MODE-2623] NodeNotFoundInParentException is thrown when unlocking a node within a transaction and assuming an "immediate write semantics" as regards locking I'm unable to assure that node is locked:

      @Test
      public void shouldLockNode() throws Exception {
           Node node = session.getRootNode().addNode("test");
           node.addMixin("mix:lockable");
           session.save();
      
           startTransaction();
           JcrLockManager lockManager = session.getWorkspace().getLockManager();
           Lock lock = lockManager.lock(node.getPath(), false, false, Long.MAX_VALUE, null);
           assertTrue(node.isLocked());
           commitTransaction();
      }
      

       

      Something wrong with this flow? Or it is another bug?