You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by mr...@apache.org on 2022/08/04 07:02:45 UTC

[jackrabbit-oak] branch trunk updated: OAK-9873: Prefetch node states: composite node store support

This is an automated email from the ASF dual-hosted git repository.

mreutegg pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 9db1d37412 OAK-9873: Prefetch node states: composite node store support
     new 34f6b27228 Merge pull request #647 from mreutegg/OAK-9873
9db1d37412 is described below

commit 9db1d37412aacb94b85d61fdc6eed0244186937f
Author: Marcel Reutegger <ma...@gmail.com>
AuthorDate: Tue Aug 2 18:54:16 2022 +0200

    OAK-9873: Prefetch node states: composite node store support
---
 oak-store-composite/pom.xml                        |  5 +++++
 .../oak/composite/CompositionContextTest.java      | 24 ++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/oak-store-composite/pom.xml b/oak-store-composite/pom.xml
index 9714f5282d..974e6248a7 100644
--- a/oak-store-composite/pom.xml
+++ b/oak-store-composite/pom.xml
@@ -160,6 +160,11 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>jul-to-slf4j</artifactId>
diff --git a/oak-store-composite/src/test/java/org/apache/jackrabbit/oak/composite/CompositionContextTest.java b/oak-store-composite/src/test/java/org/apache/jackrabbit/oak/composite/CompositionContextTest.java
index 763f290b85..0cc76c93bb 100644
--- a/oak-store-composite/src/test/java/org/apache/jackrabbit/oak/composite/CompositionContextTest.java
+++ b/oak-store-composite/src/test/java/org/apache/jackrabbit/oak/composite/CompositionContextTest.java
@@ -16,8 +16,12 @@
  */
 package org.apache.jackrabbit.oak.composite;
 
+import org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState;
 import org.apache.jackrabbit.oak.spi.mount.MountInfoProvider;
 import org.apache.jackrabbit.oak.spi.mount.Mounts;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+import org.apache.jackrabbit.oak.spi.state.PrefetchNodeStore;
 import org.junit.Test;
 
 import java.util.Arrays;
@@ -25,6 +29,11 @@ import java.util.Collections;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.same;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
 
 public class CompositionContextTest {
 
@@ -62,4 +71,19 @@ public class CompositionContextTest {
         assertFalse(ctx.shouldBeComposite("/jcr:system/rep:versionStorage"));
     }
 
+    @Test
+    public void prefetch() {
+        MountInfoProvider mip = Mounts.newBuilder()
+                .mount("libs","/libs")
+                .build();
+        MyStore ns = spy(MyStore.class);
+        CompositionContext ctx = new CompositionContext(mip, ns, Collections.emptyList(), CompositeNodeStoreMonitor.EMPTY_INSTANCE, CompositeNodeStoreMonitor.EMPTY_INSTANCE);
+        NodeState root = EmptyNodeState.EMPTY_NODE;
+        ctx.prefetch(Collections.singletonList("/foo"), ctx.createRootNodeState(root));
+        verify(ns, times(1)).prefetch(any(), same(root));
+    }
+
+    interface MyStore extends NodeStore, PrefetchNodeStore {
+    }
+
 }