jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1516156 - in /jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr: OakMongoMKRepositoryStub.java OakSegmentMKRepositoryStub.java tck/TCKBase.java
Date Wed, 21 Aug 2013 13:24:08 GMT
Author: mreutegg
Date: Wed Aug 21 13:24:08 2013
New Revision: 1516156

URL: http://svn.apache.org/r1516156
Log:
OAK-968: TCK tests run OOM when MongoDB is available

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakSegmentMKRepositoryStub.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/tck/TCKBase.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java?rev=1516156&r1=1516155&r2=1516156&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java
Wed Aug 21 13:24:08 2013
@@ -71,6 +71,7 @@ public class OakMongoMKRepositoryStub ex
         try {
             this.connection = new MongoConnection(HOST, PORT, DB);
             MongoMK m = new MongoMK.Builder().setClusterId(1).
+                    memoryCacheSize(64 * 1024 * 1024).
                     setMongoDB(connection.getDB()).open();
             Jcr jcr = new Jcr(m);
             this.repository = jcr.createRepository();

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakSegmentMKRepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakSegmentMKRepositoryStub.java?rev=1516156&r1=1516155&r2=1516156&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakSegmentMKRepositoryStub.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakSegmentMKRepositoryStub.java
Wed Aug 21 13:24:08 2013
@@ -67,7 +67,7 @@ public class OakSegmentMKRepositoryStub 
         try {
             this.connection = new Mongo(HOST, PORT);
             Jcr jcr = new Jcr(new Oak(new SegmentNodeStore(
-                    new MongoStore(connection.getDB(DB), 100 * 1024 * 1024))));
+                    new MongoStore(connection.getDB(DB), 4 * 1024 * 1024))));
             this.repository = jcr.createRepository();
 
             session = getRepository().login(superuser);

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/tck/TCKBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/tck/TCKBase.java?rev=1516156&r1=1516155&r2=1516156&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/tck/TCKBase.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/tck/TCKBase.java
Wed Aug 21 13:24:08 2013
@@ -18,7 +18,9 @@ package org.apache.jackrabbit.oak.jcr.tc
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 
 import org.apache.jackrabbit.oak.jcr.OakMongoMKRepositoryStub;
@@ -62,9 +64,11 @@ public abstract class TCKBase extends Te
      */
     public static class Setup extends TestCase {
 
+        private static Map<String, RepositoryHelper> HELPERS = new HashMap<String,
RepositoryHelper>();
+
         private final String stubClass;
 
-        private List<RepositoryHelper> helpers = new ArrayList<RepositoryHelper>();
+        private List<RepositoryHelper> previous = new ArrayList<RepositoryHelper>();
 
         public static void wrap(TCKBase test, String stubClass) {
             Setup setup = new Setup(stubClass);
@@ -82,16 +86,25 @@ public abstract class TCKBase extends Te
             // replace the existing helper with our parametrized version
             RepositoryHelperPool helperPool = RepositoryHelperPoolImpl.getInstance();
             // drain helpers
-            helpers.addAll(Arrays.asList(helperPool.borrowHelpers()));
+            previous.addAll(Arrays.asList(helperPool.borrowHelpers()));
             // replace with our own stub
-            Properties props = new Properties();
-            props.load(getClass().getClassLoader().getResourceAsStream(RepositoryStub.STUB_IMPL_PROPS));
-            props.put(RepositoryStub.PROP_STUB_IMPL_CLASS, stubClass);
-            helperPool.returnHelper(new RepositoryHelper(props));
+            helperPool.returnHelper(getRepositoryHelper());
+        }
+
+        private RepositoryHelper getRepositoryHelper() throws Exception {
+            RepositoryHelper helper = HELPERS.get(stubClass);
+            if (helper == null) {
+                Properties props = new Properties();
+                props.load(getClass().getClassLoader().getResourceAsStream(RepositoryStub.STUB_IMPL_PROPS));
+                props.put(RepositoryStub.PROP_STUB_IMPL_CLASS, stubClass);
+                helper = new RepositoryHelper(props);
+                HELPERS.put(stubClass, helper);
+            }
+            return helper;
         }
 
         TestCase getTearDown() {
-            return new TearDown(helpers);
+            return new TearDown(previous);
         }
     }
 



Mime
View raw message