jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1564234 - in /jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr: ./ cluster/ random/ security/authorization/ security/privilege/ security/user/ version/
Date Tue, 04 Feb 2014 09:25:34 GMT
Author: mreutegg
Date: Tue Feb  4 09:25:33 2014
New Revision: 1564234

URL: http://svn.apache.org/r1564234
Log:
OAK-1382: Tests in oak-core and oak-jcr may run out of memory

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ConcurrentAddNodesClusterIT.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/cluster/AbstractClusterTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/cluster/ManyChildrenTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/random/AbstractRandomizedTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/ImportIgnoreTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeRegistrationTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/HiddenNodeTest.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java?rev=1564234&r1=1564233&r2=1564234&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
Tue Feb  4 09:25:33 2014
@@ -113,4 +113,11 @@ public abstract class AbstractRepository
         return new SimpleCredentials("admin", "admin".toCharArray());
     }
 
+    public static <R extends Repository> R dispose(R repository) {
+        if (repository instanceof JackrabbitRepository) {
+            ((JackrabbitRepository) repository).shutdown();
+        }
+        return null;
+    }
+
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ConcurrentAddNodesClusterIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ConcurrentAddNodesClusterIT.java?rev=1564234&r1=1564233&r2=1564234&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ConcurrentAddNodesClusterIT.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ConcurrentAddNodesClusterIT.java
Tue Feb  4 09:25:33 2014
@@ -44,6 +44,7 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import static org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest.dispose;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
@@ -58,6 +59,7 @@ public class ConcurrentAddNodesClusterIT
     private static final String PROP_NAME = "testcount";
     private static final ScheduledExecutorService EXECUTOR = Executors.newSingleThreadScheduledExecutor();
 
+    private List<Repository> repos = new ArrayList<Repository>();
     private List<DocumentMK> mks = new ArrayList<DocumentMK>();
     private List<Thread> workers = new ArrayList<Thread>();
 
@@ -74,6 +76,9 @@ public class ConcurrentAddNodesClusterIT
 
     @After
     public void after() throws Exception {
+        for (Repository repo : repos) {
+            dispose(repo);
+        }
         for (DocumentMK mk : mks) {
             mk.dispose();
         }
@@ -93,6 +98,7 @@ public class ConcurrentAddNodesClusterIT
         for (int i = 0; i < mks.size(); i++) {
             DocumentMK mk = mks.get(i);
             Repository repo = new Jcr(mk).createRepository();
+            repos.add(repo);
             workers.add(new Thread(new Worker(repo, exceptions), "Worker-" + (i + 1)));
         }
         for (Thread t : workers) {
@@ -119,7 +125,9 @@ public class ConcurrentAddNodesClusterIT
         final DocumentMK mk1 = mks.get(0);
         final DocumentMK mk2 = mks.get(1);
         Repository r1 = new Jcr(mk1).createRepository();
+        repos.add(r1);
         Repository r2 = new Jcr(mk2).createRepository();
+        repos.add(r2);
 
         Session s1 = r1.login(new SimpleCredentials("admin", "admin".toCharArray()));
         Session s2 = r2.login(new SimpleCredentials("admin", "admin".toCharArray()));
@@ -152,8 +160,11 @@ public class ConcurrentAddNodesClusterIT
         final DocumentMK mk2 = mks.get(1);
         final DocumentMK mk3 = mks.get(2);
         Repository r1 = new Jcr(mk1).createRepository();
+        repos.add(r1);
         Repository r2 = new Jcr(mk2).createRepository();
+        repos.add(r2);
         Repository r3 = new Jcr(mk3).createRepository();
+        repos.add(r3);
 
         Session s1 = r1.login(new SimpleCredentials("admin", "admin".toCharArray()));
         Session s2 = r2.login(new SimpleCredentials("admin", "admin".toCharArray()));
@@ -223,7 +234,9 @@ public class ConcurrentAddNodesClusterIT
         final DocumentMK mk1 = mks.get(0);
         final DocumentMK mk2 = mks.get(1);
         Repository r1 = new Jcr(mk1).createRepository();
+        repos.add(r1);
         Repository r2 = new Jcr(mk2).createRepository();
+        repos.add(r2);
 
         Session s1 = r1.login(new SimpleCredentials("admin", "admin".toCharArray()));
         Session s2 = r2.login(new SimpleCredentials("admin", "admin".toCharArray()));

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/cluster/AbstractClusterTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/cluster/AbstractClusterTest.java?rev=1564234&r1=1564233&r2=1564234&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/cluster/AbstractClusterTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/cluster/AbstractClusterTest.java
Tue Feb  4 09:25:33 2014
@@ -31,6 +31,8 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.junit.After;
 import org.junit.Before;
 
+import static org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest.dispose;
+
 /**
  * A base class for DocumentMK cluster tests.
  */
@@ -55,7 +57,8 @@ public class AbstractClusterTest {
             s2.logout();
             s2 = null;
         }
-        r1 = r2 = null;
+        r1 = dispose(r1);
+        r2 = dispose(r2);
         if (ns1 != null) {
             fixture.dispose(ns1);
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/cluster/ManyChildrenTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/cluster/ManyChildrenTest.java?rev=1564234&r1=1564233&r2=1564234&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/cluster/ManyChildrenTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/cluster/ManyChildrenTest.java
Tue Feb  4 09:25:33 2014
@@ -30,6 +30,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest.dispose;
 import static org.junit.Assert.assertEquals;
 
 /**
@@ -41,6 +42,7 @@ public class ManyChildrenTest {
 //    NodeStoreFixture fixture = NodeStoreFixture.MONGO_MK;
 //    NodeStoreFixture fixture = NodeStoreFixture.SEGMENT_MK;
     
+    Repository repository;
     Session session;
     NodeStore nodeStore;
     
@@ -52,8 +54,8 @@ public class ManyChildrenTest {
         nodeStore = fixture.createNodeStore();
         
         if (nodeStore != null) {
-            Repository rep  = new Jcr(nodeStore).createRepository();
-            session = rep.login(new SimpleCredentials("admin", "admin".toCharArray()));
+            repository = new Jcr(nodeStore).createRepository();
+            session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
         }
     }
     
@@ -61,6 +63,7 @@ public class ManyChildrenTest {
     public void logout() {
         if (session != null) {
             session.logout();
+            repository = dispose(repository);
             fixture.dispose(nodeStore);
         }
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/random/AbstractRandomizedTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/random/AbstractRandomizedTest.java?rev=1564234&r1=1564233&r2=1564234&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/random/AbstractRandomizedTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/random/AbstractRandomizedTest.java
Tue Feb  4 09:25:33 2014
@@ -37,6 +37,8 @@ import org.apache.jackrabbit.oak.jcr.Jcr
 import org.junit.After;
 import org.junit.Before;
 
+import static org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest.dispose;
+
 
 /**
  * Base class for randomized tests.
@@ -86,8 +88,8 @@ public abstract class AbstractRandomized
             }
         }
 
-        jackrabbitRepository = null;
-        oakRepository = null;
+        jackrabbitRepository = dispose(jackrabbitRepository);
+        oakRepository = dispose(oakRepository);
     }
 
     protected Principal getTestPrincipal(@Nonnull JackrabbitSession session) throws RepositoryException
{

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/ImportIgnoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/ImportIgnoreTest.java?rev=1564234&r1=1564233&r2=1564234&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/ImportIgnoreTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/ImportIgnoreTest.java
Tue Feb  4 09:25:33 2014
@@ -44,6 +44,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest.dispose;
 import static org.junit.Assert.assertEquals;
 
 public class ImportIgnoreTest {
@@ -100,7 +101,7 @@ public class ImportIgnoreTest {
             adminSession.refresh(false);
             adminSession.logout();
         }
-        repo = null;
+        repo = dispose(repo);
     }
 
     protected String getImportBehavior() {

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java?rev=1564234&r1=1564233&r2=1564234&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java
Tue Feb  4 09:25:33 2014
@@ -33,6 +33,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest.dispose;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
@@ -58,7 +59,7 @@ public class VersionTest {
         for (Session s : sessions) {
             s.logout();
         }
-        repository = null;
+        repository = dispose(repository);
         sessions = null;
     }
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeRegistrationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeRegistrationTest.java?rev=1564234&r1=1564233&r2=1564234&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeRegistrationTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeRegistrationTest.java
Tue Feb  4 09:25:33 2014
@@ -42,6 +42,8 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest.dispose;
+
 /**
  * Test privilege registration.
  */
@@ -74,7 +76,7 @@ public class PrivilegeRegistrationTest e
             super.tearDown();
         } finally {
             session.logout();
-            repository = null;
+            repository = dispose(repository);
             privilegeManager = null;
         }
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java?rev=1564234&r1=1564233&r2=1564234&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java
Tue Feb  4 09:25:33 2014
@@ -52,6 +52,7 @@ import org.junit.Test;
 
 import com.google.common.collect.ImmutableMap;
 
+import static org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest.dispose;
 import static org.junit.Assert.assertFalse;
 
 /**
@@ -137,7 +138,7 @@ public abstract class AbstractImportTest
         } finally {
             if (getImportBehavior() != null) {
                 adminSession.logout();
-                repo = null;
+                repo = dispose(repo);
             }
         }
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/HiddenNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/HiddenNodeTest.java?rev=1564234&r1=1564233&r2=1564234&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/HiddenNodeTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/HiddenNodeTest.java
Tue Feb  4 09:25:33 2014
@@ -35,6 +35,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest.dispose;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
@@ -62,6 +63,7 @@ public class HiddenNodeTest {
             session.logout();
             session = null;
         }
+        repo = dispose(repo);
     }
 
     @Test



Mime
View raw message