jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1303000 - in /jackrabbit/oak/trunk/oak-mk/src: main/java/org/apache/jackrabbit/mk/core/Repository.java main/java/org/apache/jackrabbit/mk/store/DefaultRevisionStore.java test/java/org/apache/jackrabbit/mk/store/CopyingGCTest.java
Date Tue, 20 Mar 2012 17:03:20 GMT
Author: jukka
Date: Tue Mar 20 17:03:20 2012
New Revision: 1303000

URL: http://svn.apache.org/viewvc?rev=1303000&view=rev
Log:
OAK-31: In-memory MicroKernel for testing

Make it easier to plug in a custom Persistence instance

Modified:
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/Repository.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/DefaultRevisionStore.java
    jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/CopyingGCTest.java

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/Repository.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/Repository.java?rev=1303000&r1=1302999&r2=1303000&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/Repository.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/Repository.java
Tue Mar 20 17:03:20 2012
@@ -23,6 +23,7 @@ import org.apache.jackrabbit.mk.model.Co
 import org.apache.jackrabbit.mk.model.Id;
 import org.apache.jackrabbit.mk.model.NodeState;
 import org.apache.jackrabbit.mk.model.StoredCommit;
+import org.apache.jackrabbit.mk.persistence.H2Persistence;
 import org.apache.jackrabbit.mk.store.DefaultRevisionStore;
 import org.apache.jackrabbit.mk.store.NotFoundException;
 import org.apache.jackrabbit.mk.store.RevisionStore;
@@ -51,7 +52,7 @@ public class Repository {
     public Repository(RevisionStore rs) {
         this.homeDir = null;
         this.rs = rs;
-        
+
         initialized = true;
     }
     
@@ -59,8 +60,10 @@ public class Repository {
         if (initialized) {
             return;
         }
+
         DefaultRevisionStore rs = new DefaultRevisionStore();
-        rs.initialize(new File(homeDir));
+        rs.initialize(new File(homeDir), new H2Persistence());
+
         this.rs = rs;
 
         initialized = true;

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/DefaultRevisionStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/DefaultRevisionStore.java?rev=1303000&r1=1302999&r2=1303000&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/DefaultRevisionStore.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/store/DefaultRevisionStore.java
Tue Mar 20 17:03:20 2012
@@ -25,7 +25,6 @@ import org.apache.jackrabbit.mk.model.Mu
 import org.apache.jackrabbit.mk.model.NodeState;
 import org.apache.jackrabbit.mk.model.StoredCommit;
 import org.apache.jackrabbit.mk.model.StoredNode;
-import org.apache.jackrabbit.mk.persistence.H2Persistence;
 import org.apache.jackrabbit.mk.persistence.Persistence;
 import org.apache.jackrabbit.mk.util.SimpleLRUCache;
 
@@ -56,7 +55,7 @@ public class DefaultRevisionStore implem
 
     private Map<Id, Object> cache;
 
-    public void initialize(File homeDir) throws Exception {
+    public void initialize(File homeDir, Persistence persistence) throws Exception {
         if (initialized) {
             throw new IllegalStateException("already initialized");
         }
@@ -64,11 +63,7 @@ public class DefaultRevisionStore implem
 
         cache = Collections.synchronizedMap(SimpleLRUCache.<Id, Object>newInstance(determineInitialCacheSize()));
 
-        pm = new H2Persistence();
-        //pm = new InMemPersistence();
-        //pm = new MongoPersistence();
-        //pm = new BDbPersistence();
-        //pm = new FSPersistence();
+        pm = persistence;
         pm.initialize(homeDir);
         
         if (pm instanceof BlobStore) {

Modified: jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/CopyingGCTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/CopyingGCTest.java?rev=1303000&r1=1302999&r2=1303000&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/CopyingGCTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/CopyingGCTest.java
Tue Mar 20 17:03:20 2012
@@ -28,6 +28,7 @@ import org.apache.jackrabbit.mk.core.Rep
 import org.apache.jackrabbit.mk.fs.FileUtils;
 import org.apache.jackrabbit.mk.json.fast.Jsop;
 import org.apache.jackrabbit.mk.json.fast.JsopArray;
+import org.apache.jackrabbit.mk.persistence.InMemPersistence;
 import org.apache.jackrabbit.mk.util.IOUtils;
 import org.junit.After;
 import org.junit.Before;
@@ -61,10 +62,10 @@ public class CopyingGCTest {
     @Test
     public void concurrentGC() throws Exception {
         rsFrom = new DefaultRevisionStore();
-        rsFrom.initialize(new File("target/mk1"));
+        rsFrom.initialize(new File("target/mk1"), new InMemPersistence());
 
         rsTo = new DefaultRevisionStore(); 
-        rsTo.initialize(new File("target/mk2"));
+        rsTo.initialize(new File("target/mk2"), new InMemPersistence());
 
         final CopyingGC gc = new CopyingGC(rsFrom, rsTo);
         
@@ -100,10 +101,10 @@ public class CopyingGCTest {
         String[] revs = new String[5];
         
         rsFrom = new DefaultRevisionStore();
-        rsFrom.initialize(new File("target/mk1"));
+        rsFrom.initialize(new File("target/mk1"), new InMemPersistence());
 
         rsTo = new DefaultRevisionStore(); 
-        rsTo.initialize(new File("target/mk2"));
+        rsTo.initialize(new File("target/mk2"), new InMemPersistence());
 
         CopyingGC gc = new CopyingGC(rsFrom, rsTo);
         



Mime
View raw message