jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r999299 - in /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/lock: DefaultISMLockingTest.java TestAll.java
Date Tue, 21 Sep 2010 10:12:43 GMT
Author: thomasm
Date: Tue Sep 21 10:12:43 2010
New Revision: 999299

URL: http://svn.apache.org/viewvc?rev=999299&view=rev
Log:
JCR-2753 Deadlock in DefaultISMLocking - added test case

Added:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/lock/DefaultISMLockingTest.java
Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/lock/TestAll.java

Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/lock/DefaultISMLockingTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/lock/DefaultISMLockingTest.java?rev=999299&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/lock/DefaultISMLockingTest.java
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/lock/DefaultISMLockingTest.java
Tue Sep 21 10:12:43 2010
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.lock;
+
+import org.apache.jackrabbit.core.state.DefaultISMLocking;
+import org.apache.jackrabbit.core.state.ISMLocking;
+import org.apache.jackrabbit.core.state.ISMLocking.ReadLock;
+import org.apache.jackrabbit.test.JUnitTest;
+
+/**
+ * Tests the DefaultISMLocking class.
+ */
+public class DefaultISMLockingTest extends JUnitTest {
+
+    public void test() throws InterruptedException {
+        final ISMLocking lock = new DefaultISMLocking();
+        ReadLock r1 = lock.acquireReadLock(null);
+        final InterruptedException[] ex = new InterruptedException[1];
+        Thread thread = new Thread() {
+            public void run() {
+                try {
+                    lock.acquireWriteLock(null).release();
+                } catch (InterruptedException e) {
+                    ex[0] = e;
+                }
+            }
+        };
+        thread.start();
+        Thread.sleep(100);
+        lock.acquireReadLock(null).release();
+        r1.release();
+        thread.join();
+        if (ex[0] != null) {
+            throw ex[0];
+        }
+    }
+
+}

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/lock/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/lock/TestAll.java?rev=999299&r1=999298&r2=999299&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/lock/TestAll.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/lock/TestAll.java
Tue Sep 21 10:12:43 2010
@@ -35,6 +35,7 @@ public class TestAll extends TestCase {
     public static Test suite() {
         TestSuite suite = new TestSuite("org.apache.jackrabbit.core.lock tests");
 
+        suite.addTestSuite(DefaultISMLockingTest.class);
         suite.addTestSuite(ExtendedLockingTest.class);
 
         return suite;



Mime
View raw message