Author: mreutegg
Date: Thu Jan 18 14:25:55 2018
New Revision: 1821500

URL: http://svn.apache.org/viewvc?rev=1821500&view=rev
Log:
OAK-7179: Derive CountingTieredDiffCache from MemoryDiffCache

Added:
    
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CountingDiffCache.java
      - copied, changed from r1821499, 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CountingTieredDiffCache.java
Removed:
    
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CountingTieredDiffCache.java
Modified:
    
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java
    
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractJournalTest.java
    
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreIT.java
    
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalTest.java

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java?rev=1821500&r1=1821499&r2=1821500&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java
 Thu Jan 18 14:25:55 2018
@@ -273,11 +273,6 @@ public class DocumentNodeStoreBuilder<T
         return diffCache;
     }
 
-    public T setDiffCache(DiffCache diffCache) {
-        this.diffCache = diffCache;
-        return thisBuilder();
-    }
-
     /**
      * Set the blob store to use. By default an in-memory store is used.
      *

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractJournalTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractJournalTest.java?rev=1821500&r1=1821499&r2=1821500&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractJournalTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractJournalTest.java
 Thu Jan 18 14:25:55 2018
@@ -192,7 +192,7 @@ public abstract class AbstractJournalTes
 
     protected final class TestBuilder extends DocumentMK.Builder {
         CountingDocumentStore actualStore;
-        CountingTieredDiffCache actualDiffCache;
+        CountingDiffCache actualDiffCache;
 
         @Override
         public DocumentStore getDocumentStore() {
@@ -205,7 +205,7 @@ public abstract class AbstractJournalTes
         @Override
         public DiffCache getDiffCache() {
             if (actualDiffCache==null) {
-                actualDiffCache = new CountingTieredDiffCache(this);
+                actualDiffCache = new CountingDiffCache(this);
             }
             return actualDiffCache;
         }

Copied: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CountingDiffCache.java
 (from r1821499, 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CountingTieredDiffCache.java)
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CountingDiffCache.java?p2=jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CountingDiffCache.java&p1=jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CountingTieredDiffCache.java&r1=1821499&r2=1821500&rev=1821500&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CountingTieredDiffCache.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CountingDiffCache.java
 Thu Jan 18 14:25:55 2018
@@ -19,7 +19,7 @@ package org.apache.jackrabbit.oak.plugin
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-public class CountingTieredDiffCache extends TieredDiffCache {
+public class CountingDiffCache extends MemoryDiffCache {
 
     class CountingLoader implements Loader {
 
@@ -39,7 +39,7 @@ public class CountingTieredDiffCache ext
 
     private int loadCount;
 
-    public CountingTieredDiffCache(DocumentMK.Builder builder) {
+    public CountingDiffCache(DocumentMK.Builder builder) {
         super(builder);
     }
 

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreIT.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreIT.java?rev=1821500&r1=1821499&r2=1821500&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreIT.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreIT.java
 Thu Jan 18 14:25:55 2018
@@ -57,13 +57,12 @@ public class DocumentNodeStoreIT extends
                 // do not dispose yet
             }
         };
-        DocumentNodeStore ns1 = new DocumentMK.Builder()
+        // use a builder with a no-op diff cache to simulate a
+        // cache miss when the diff is made later in the test
+        DocumentNodeStore ns1 = new TestBuilder()
                 .setDocumentStore(docStore).setClusterId(1)
                 .setAsyncDelay(0).clock(clock)
-                        // use a no-op diff cache to simulate a cache miss
-                        // when the diff is made later in the test
-                .setDiffCache(AmnesiaDiffCache.INSTANCE)
-                .getNodeStore();
+                .build();
         NodeBuilder builder1 = ns1.getRoot().builder();
         builder1.child("node");
         removeMe.add(getIdFromPath("/node"));
@@ -115,4 +114,12 @@ public class DocumentNodeStoreIT extends
         ns1.dispose();
         ns2.dispose();
     }
+
+    private class TestBuilder extends DocumentNodeStoreBuilder<TestBuilder> {
+
+        @Override
+        public DiffCache getDiffCache() {
+            return AmnesiaDiffCache.INSTANCE;
+        }
+    }
 }

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalTest.java?rev=1821500&r1=1821499&r2=1821500&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalTest.java
 Thu Jan 18 14:25:55 2018
@@ -220,12 +220,12 @@ public class JournalTest extends Abstrac
         DocumentMK mk1 = createMK(1, 0);
         DocumentNodeStore ns1 = mk1.getNodeStore();
         CountingDocumentStore countingDocStore1 = builder.actualStore;
-        CountingTieredDiffCache countingDiffCache1 = builder.actualDiffCache;
+        CountingDiffCache countingDiffCache1 = builder.actualDiffCache;
 
         DocumentMK mk2 = createMK(2, 0);
         DocumentNodeStore ns2 = mk2.getNodeStore();
         CountingDocumentStore countingDocStore2 = builder.actualStore;
-        CountingTieredDiffCache countingDiffCache2 = builder.actualDiffCache;
+        CountingDiffCache countingDiffCache2 = builder.actualDiffCache;
 
         final DiffingObserver observer = new DiffingObserver(false);
         ns1.addObserver(observer);


Reply via email to