jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1102262 - in /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data: DBDataStoreTest.java DataStoreTest.java GCThread.java GarbageCollectorTest.java
Date Thu, 12 May 2011 12:33:23 GMT
Author: thomasm
Date: Thu May 12 12:33:23 2011
New Revision: 1102262

URL: http://svn.apache.org/viewvc?rev=1102262&view=rev
Log:
JCR-2026 DbDataStore: garbage collection deadlock (cleaning up old tests)

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DBDataStoreTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DataStoreTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCThread.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DBDataStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DBDataStoreTest.java?rev=1102262&r1=1102261&r2=1102262&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DBDataStoreTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DBDataStoreTest.java
Thu May 12 12:33:23 2011
@@ -16,15 +16,12 @@
  */
 package org.apache.jackrabbit.core.data;
 
-import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.InputStream;
 import java.util.Random;
-
 import org.apache.commons.io.FileUtils;
 import org.apache.jackrabbit.core.data.db.DbDataStore;
-import org.apache.jackrabbit.core.data.db.DbInputStream;
 import org.apache.jackrabbit.core.util.db.ConnectionFactory;
 import org.apache.jackrabbit.test.JUnitTest;
 
@@ -61,6 +58,7 @@ public class DBDataStoreTest extends JUn
         try {
             store.close();
         } catch (DataStoreException expected) {
+            // ignore
         }
     }
 
@@ -90,8 +88,6 @@ public class DBDataStoreTest extends JUn
         InputStream in = record.getStream();
         try {
             // test whether mark and reset works
-            assertTrue(in instanceof DbInputStream);
-            in = new BufferedInputStream(in);
             assertTrue(in.markSupported());
             in.mark(data.length);
             while (-1 != in.read()) {
@@ -189,4 +185,5 @@ public class DBDataStoreTest extends JUn
             streams[i].close();
         }
     }
+
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DataStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DataStoreTest.java?rev=1102262&r1=1102261&r2=1102262&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DataStoreTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DataStoreTest.java
Thu May 12 12:33:23 2011
@@ -37,34 +37,34 @@ import java.util.Random;
  * with single threaded and multi-threaded tests.
  */
 public class DataStoreTest extends JUnitTest {
-    
+
     private static final boolean TEST_DATABASE = false;
     private File testDir = new File(System.getProperty("java.io.tmpdir"), "dataStore");
-    
+
     public void setUp() {
         testDir.mkdirs();
     }
-    
+
     public void tearDown() throws IOException {
         FileUtils.deleteDirectory(testDir);
     }
-    
+
     public void test() throws Exception {
         try {
-            
+
             if (TEST_DATABASE) {
                 DbDataStore dds = new DbDataStore();
                 String dbPath = (testDir + "/db").replace('\\', '/');
-                
+
                 // 3 sec
                 String url = "jdbc:h2:mem:" + dbPath + "/db";
-                
+
                 // 4 sec
                 // String url = "jdbc:h2:" + dbPath + "/db";
-                
+
                 // 26 sec
                 // String url = "jdbc:derby:" + dbPath + "/db";
-                
+
                 new File(dbPath).mkdirs();
                 dds.setUrl(url + ";create=true");
                 dds.setUser("sa");
@@ -75,7 +75,7 @@ public class DataStoreTest extends JUnit
                 doTestMultiThreaded(dds, 4);
                 dds.close();
                 shutdownDatabase(url);
-                
+
                 FileUtils.deleteDirectory(testDir);
                 new File(dbPath).mkdirs();
                 dds = new DbDataStore();
@@ -95,13 +95,13 @@ public class DataStoreTest extends JUnit
             doTest(fds, 0);
             // doTestMultiThreaded(fds, 4);
             fds.close();
-            
+
         } catch (Throwable t) {
             t.printStackTrace();
             throw new Error(t);
         }
     }
-    
+
     private void shutdownDatabase(String url) {
         if (url.startsWith("jdbc:derby:") || url.startsWith("jdbc:hsqldb:")) {
             try {
@@ -111,7 +111,7 @@ public class DataStoreTest extends JUnit
             }
         }
     }
-    
+
     private void doTestMultiThreaded(final DataStore ds, int threadCount) throws Exception
{
         final Exception[] exception = new Exception[1];
         Thread[] threads = new Thread[threadCount];
@@ -136,8 +136,8 @@ public class DataStoreTest extends JUnit
             throw exception[0];
         }
     }
-    
-    private void doTest(DataStore ds, int offset) throws Exception {
+
+    void doTest(DataStore ds, int offset) throws Exception {
         ArrayList<DataRecord> list = new ArrayList<DataRecord>();
         HashMap<DataRecord, Integer> map = new HashMap<DataRecord, Integer>();
         for (int i = 0; i < 100; i++) {
@@ -163,7 +163,7 @@ public class DataStoreTest extends JUnit
             in.close();
         }
     }
-    
+
     InputStream readInputStreamRandomly(InputStream in, Random random) throws IOException
{
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         byte[] buffer = new byte[8000];
@@ -195,7 +195,7 @@ public class DataStoreTest extends JUnit
         in.close();
         return new ByteArrayInputStream(out.toByteArray());
     }
-    
+
     void assertEquals(InputStream a, InputStream b) throws IOException {
         while (true) {
             int ai = a.read();

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCThread.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCThread.java?rev=1102262&r1=1102261&r2=1102262&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCThread.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GCThread.java
Thu May 12 12:33:23 2011
@@ -96,13 +96,8 @@ public class GCThread implements Runnabl
         }
     }
 
-    public void afterScanning(Node n) throws RepositoryException {
-    }
-
     public void beforeScanning(Node n) throws RepositoryException {
-    }
-
-    public void done() {
+        // nothing to do
     }
 
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java?rev=1102262&r1=1102261&r2=1102262&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java
Thu May 12 12:33:23 2011
@@ -258,9 +258,6 @@ public class GarbageCollectorTest extend
         }
     }
 
-    public void done() {
-    }
-
     private void deleteMyNodes() throws RepositoryException {
         Node root = testRootNode;
         while (root.hasNode("testroot")) {



Mime
View raw message