jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r157928 - in incubator/jackrabbit/trunk/src: java/org/apache/jackrabbit/core/lock/LockManagerImpl.java test/org/apache/jackrabbit/test/api/lock/LockTest.java
Date Thu, 17 Mar 2005 09:41:18 GMT
Author: tripod
Date: Thu Mar 17 01:41:15 2005
New Revision: 157928

URL: http://svn.apache.org/viewcvs?view=rev&rev=157928
Log:
[JCR-68] - Lock.getNode() does not return lock holder

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/lock/LockTest.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java?view=diff&r1=157927&r2=157928
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
Thu Mar 17 01:41:15 2005
@@ -16,7 +16,15 @@
  */
 package org.apache.jackrabbit.core.lock;
 
-import org.apache.jackrabbit.core.*;
+import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.NamespaceResolver;
+import org.apache.jackrabbit.core.WorkspaceImpl;
+import org.apache.jackrabbit.core.NodeImpl;
+import org.apache.jackrabbit.core.Path;
+import org.apache.jackrabbit.core.Constants;
+import org.apache.jackrabbit.core.InternalValue;
+import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.MalformedPathException;
 import org.apache.jackrabbit.core.observation.SynchronousEventListener;
 import org.apache.jackrabbit.core.observation.EventImpl;
 import org.apache.log4j.Logger;
@@ -26,12 +34,19 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.PathNotFoundException;
+import javax.jcr.Node;
 import javax.jcr.observation.Event;
 import javax.jcr.observation.EventIterator;
 import java.util.Map;
 import java.util.HashMap;
 import java.util.ArrayList;
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+
 
 /**
  * Provides the functionality needed for locking and unlocking nodes.
@@ -308,7 +323,10 @@
             throw new LockException("Node not locked: " + node.safeGetJCRPath());
         }
         if (child.hasPath(path) || info.deep) {
-            return new LockImpl(info, node);
+            SessionImpl session = (SessionImpl) node.getSession();
+            Node lockHolder = (Node) session.getItemManager().getItem(
+                    new NodeId(info.getUUID()));
+            return new LockImpl(info, lockHolder);
         } else {
             throw new LockException("Node not locked: " + node.safeGetJCRPath());
         }

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/lock/LockTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/lock/LockTest.java?view=diff&r1=157927&r2=157928
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/lock/LockTest.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/lock/LockTest.java
Thu Mar 17 01:41:15 2005
@@ -419,6 +419,29 @@
     }
 
     /**
+     * Test getLock
+     */
+    public void testGetLock() throws Exception {
+        // create new nodes
+        Node n1 = testRootNode.addNode(nodeName1, testNodeType);
+        n1.addMixin(mixReferenceable);
+        n1.addMixin(mixLockable);
+        Node n2 = n1.addNode(nodeName2, testNodeType);
+        n2.addMixin(mixReferenceable);
+        n2.addMixin(mixLockable);
+        testRootNode.save();
+
+        // deep lock parent node
+        n1.lock(true, true);
+
+        // get lock on child node
+        Lock lock = n2.getLock();
+
+        // lock holding node must be parent
+        assertTrue("lock holding node must be parent", lock.getNode().equals(n1));
+    }
+
+    /**
      * Return a flag indicating whether the indicated session contains
      * a specific lock token
      */



Mime
View raw message