jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1796980 - in /jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test: RepositoryStub.java api/lock/LockManagerTest.java
Date Wed, 31 May 2017 06:09:25 GMT
Author: reschke
Date: Wed May 31 06:09:25 2017
New Revision: 1796980

URL: http://svn.apache.org/viewvc?rev=1796980&view=rev
Log:
JCR-3901: TCK LockManagerTest does not allow new JCR 2.0 functionality for lock token transfers

Introduce nex TCK config property, defaulting to the previous behavior, allowing to configure
tests to check that open scoped lock tokens can be shared.

Modified:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/RepositoryStub.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockManagerTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/RepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/RepositoryStub.java?rev=1796980&r1=1796979&r2=1796980&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/RepositoryStub.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/RepositoryStub.java
Wed May 31 06:09:25 2017
@@ -115,6 +115,14 @@ public abstract class RepositoryStub {
     public static final String PROP_LOCK_OWNER = "lock.owner";
 
     /**
+     * Determines whether the repository implementation allows open scoped locks
+     * to be owned by multiple sessions (see JCR 2.0 Section 17.3).
+     * 
+     * @since JCR 2.0
+     */
+    public static final String PROP_OPEN_SCOPED_LOCK_MULTIPLE = "open.scoped.lock.multiple";
+
+    /**
      * @since JCR 2.0
      */
     public static final String PROP_HOLD_NAME = "holdname";

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockManagerTest.java?rev=1796980&r1=1796979&r2=1796980&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockManagerTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockManagerTest.java
Wed May 31 06:09:25 2017
@@ -30,6 +30,7 @@ import javax.jcr.lock.LockManager;
 
 import org.apache.jackrabbit.test.AbstractJCRTest;
 import org.apache.jackrabbit.test.NotExecutableException;
+import org.apache.jackrabbit.test.RepositoryStub;
 
 /** <code>LockManagerTest</code>... */
 public class LockManagerTest extends AbstractJCRTest {
@@ -38,6 +39,8 @@ public class LockManagerTest extends Abs
     protected Node testNode;
     protected String testPath;
 
+    protected boolean openScopedLockMultiple;
+
     protected void setUp() throws Exception {
         super.setUp();
 
@@ -45,10 +48,12 @@ public class LockManagerTest extends Abs
         if (Boolean.FALSE.toString().equals(superuser.getRepository().getDescriptor(Repository.OPTION_LOCKING_SUPPORTED)))
{
             throw new NotExecutableException();
         }
-        
+
         testNode = testRootNode.addNode(nodeName1, testNodeType);
         testRootNode.getSession().save();
         testPath = testNode.getPath();
+        openScopedLockMultiple = Boolean.TRUE.toString()
+                .equals(getProperty(RepositoryStub.PROP_OPEN_SCOPED_LOCK_MULTIPLE, Boolean.FALSE.toString()));
 
         lockMgr = getLockManager(superuser);
     }
@@ -183,8 +188,6 @@ public class LockManagerTest extends Abs
 
     public void testAddLockTokenToAnotherSession() throws RepositoryException,
             NotExecutableException {
-        // TODO: for 283 add config option for simultaneous tokens....
-        
         assertLockable(testNode);
 
         boolean sessionScoped = false;
@@ -198,9 +201,15 @@ public class LockManagerTest extends Abs
 
             try {
                 otherLockMgr.addLockToken(ltoken);
-                fail("Adding token to another session must fail.");
+                if (!openScopedLockMultiple) {
+                    fail("Adding token to another session must fail (see config property
"
+                            + RepositoryStub.PROP_OPEN_SCOPED_LOCK_MULTIPLE + ".");
+                }
             } catch (LockException e) {
-                // success
+                if (openScopedLockMultiple) {
+                    fail("Adding token to another session must not fail (see config property
"
+                            + RepositoryStub.PROP_OPEN_SCOPED_LOCK_MULTIPLE + ".");
+                }
             }
         } finally {
             other.logout();
@@ -338,8 +347,6 @@ public class LockManagerTest extends Abs
     }
 
     public void testLockTransfer2() throws Exception {
-        // TODO: for 283 add config option for simultaneous tokens....
-
         assertLockable(testNode);
 
         boolean sessionScoped = false;
@@ -353,9 +360,15 @@ public class LockManagerTest extends Abs
             otherLockMgr.addLockToken(ltoken);
 
             lockMgr.addLockToken(ltoken);
-            fail("Adding the token to another session must fail.");
+            if (!openScopedLockMultiple) {
+                fail("Adding token to another session must fail (see config property "
+                        + RepositoryStub.PROP_OPEN_SCOPED_LOCK_MULTIPLE + ".");
+            }
         } catch (LockException e) {
-            // success
+            if (openScopedLockMultiple) {
+                fail("Adding token to another session must not fail (see config property
"
+                        + RepositoryStub.PROP_OPEN_SCOPED_LOCK_MULTIPLE + ".");
+            }
         } finally {
             otherLockMgr.removeLockToken(ltoken);
             lockMgr.addLockToken(ltoken);



Mime
View raw message