You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Vikas Saurabh (JIRA)" <ji...@apache.org> on 2016/11/08 15:12:58 UTC

[jira] [Updated] (OAK-5086) Some tests in NodeStoreDiffTests fail when oak.disableJournalDiff is set to true

     [ https://issues.apache.org/jira/browse/OAK-5086?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vikas Saurabh updated OAK-5086:
-------------------------------
    Description: 
This is basically a follow up of OAK-4403 when journal is disabled (this [comment|https://issues.apache.org/jira/browse/OAK-4403?focusedCommentId=15647349&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15647349]). Initially, I thought only {{diffWithPersistentBranch}} would fail but it seems that {{testDiff}} also fails.

Here's a patch to run {{NodeStoreDiffTest}} as parametrized test for {{oak.disableJournalDiff=true}} and not defined:
{code}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java
index 7c3c2bf..92a19f6 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java
@@ -20,7 +20,9 @@
 package org.apache.jackrabbit.oak.plugins.document;

 import java.io.IOException;
+import java.util.Arrays;
 import java.util.List;
+import java.util.Properties;
 import java.util.Set;

 import javax.annotation.Nonnull;
@@ -41,9 +43,12 @@ import org.apache.jackrabbit.oak.spi.commit.EditorHook;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

@@ -53,6 +58,7 @@ import static org.hamcrest.CoreMatchers.not;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThat;

+@RunWith(Parameterized.class)
 public class NodeStoreDiffTest {

     private static final Logger LOG = LoggerFactory.getLogger(NodeStoreDiffTest.class);
@@ -60,9 +66,20 @@ public class NodeStoreDiffTest {
     @Rule
     public DocumentMKBuilderProvider builderProvider = new DocumentMKBuilderProvider();

+    @Parameterized.Parameters
+    public static java.util.Collection<String> disableJournalDiff() {
+        return Arrays.asList(null, "true");
+    }
+
     private DocumentNodeStore ns;
     private final TestDocumentStore tds = new TestDocumentStore();

+    public NodeStoreDiffTest(String disableJournalDiff) {
+        if (disableJournalDiff != null) {
+            System.setProperty("oak.disableJournalDiff", disableJournalDiff);
+        }
+    }
+
     @Before
     public void setUp() throws IOException {
         ns = builderProvider.newBuilder()
@@ -73,6 +90,11 @@ public class NodeStoreDiffTest {
                 .getNodeStore();
     }

+    @After
+    public void cleanup() {
+        System.setProperties(null);
+    }
+
     @Test
     public void diffWithConflict() throws Exception{
         //Last rev on /var would be 1-0-1
{code}

  was:
This is basically a follow up of OAK-4403 when journal is disabled (this [comment|https://issues.apache.org/jira/browse/OAK-4403?focusedCommentId=15647349&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15647349]). Initially, I thought only {{diffWithPersistentBranch}} would fail but it seems that {{testDiff}} also fails.

Here's a patch to run {{NodeStoreDiffTest}} as parametrized test for {{oak.disableJournalDiff=true}} and not defined:
{code}
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java
index 7c3c2bf..7a9ab7b 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java
@@ -20,7 +20,9 @@
 package org.apache.jackrabbit.oak.plugins.document;

 import java.io.IOException;
+import java.util.Arrays;
 import java.util.List;
+import java.util.Properties;
 import java.util.Set;

 import javax.annotation.Nonnull;
@@ -41,9 +43,12 @@ import org.apache.jackrabbit.oak.spi.commit.EditorHook;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

@@ -53,6 +58,7 @@ import static org.hamcrest.CoreMatchers.not;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThat;

+@RunWith(Parameterized.class)
 public class NodeStoreDiffTest {

     private static final Logger LOG = LoggerFactory.getLogger(NodeStoreDiffTest.class);
@@ -60,9 +66,23 @@ public class NodeStoreDiffTest {
     @Rule
     public DocumentMKBuilderProvider builderProvider = new DocumentMKBuilderProvider();

+    @Parameterized.Parameters
+    public static java.util.Collection<String> disableJournalDiff() {
+        return Arrays.asList(null, "true");
+    }
+
     private DocumentNodeStore ns;
     private final TestDocumentStore tds = new TestDocumentStore();

+    private Properties initialSystemProperties = null;
+
+    public NodeStoreDiffTest(String disableJournalDiff) {
+        if (disableJournalDiff != null) {
+            initialSystemProperties = System.getProperties();
+            System.setProperty("oak.disableJournalDiff", disableJournalDiff);
+        }
+    }
+
     @Before
     public void setUp() throws IOException {
         ns = builderProvider.newBuilder()
@@ -73,6 +93,11 @@ public class NodeStoreDiffTest {
                 .getNodeStore();
     }

+    @After
+    public void cleanup() {
+        System.setProperties(initialSystemProperties);
+    }
+
     @Test
     public void diffWithConflict() throws Exception{
         //Last rev on /var would be 1-0-1
{code}


> Some tests in NodeStoreDiffTests fail when oak.disableJournalDiff is set to true
> --------------------------------------------------------------------------------
>
>                 Key: OAK-5086
>                 URL: https://issues.apache.org/jira/browse/OAK-5086
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: documentmk
>            Reporter: Vikas Saurabh
>            Priority: Minor
>
> This is basically a follow up of OAK-4403 when journal is disabled (this [comment|https://issues.apache.org/jira/browse/OAK-4403?focusedCommentId=15647349&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15647349]). Initially, I thought only {{diffWithPersistentBranch}} would fail but it seems that {{testDiff}} also fails.
> Here's a patch to run {{NodeStoreDiffTest}} as parametrized test for {{oak.disableJournalDiff=true}} and not defined:
> {code}
> diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java
> index 7c3c2bf..92a19f6 100644
> --- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java
> +++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/NodeStoreDiffTest.java
> @@ -20,7 +20,9 @@
>  package org.apache.jackrabbit.oak.plugins.document;
>  import java.io.IOException;
> +import java.util.Arrays;
>  import java.util.List;
> +import java.util.Properties;
>  import java.util.Set;
>  import javax.annotation.Nonnull;
> @@ -41,9 +43,12 @@ import org.apache.jackrabbit.oak.spi.commit.EditorHook;
>  import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
>  import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
>  import org.apache.jackrabbit.oak.spi.state.NodeState;
> +import org.junit.After;
>  import org.junit.Before;
>  import org.junit.Rule;
>  import org.junit.Test;
> +import org.junit.runner.RunWith;
> +import org.junit.runners.Parameterized;
>  import org.slf4j.Logger;
>  import org.slf4j.LoggerFactory;
> @@ -53,6 +58,7 @@ import static org.hamcrest.CoreMatchers.not;
>  import static org.junit.Assert.assertFalse;
>  import static org.junit.Assert.assertThat;
> +@RunWith(Parameterized.class)
>  public class NodeStoreDiffTest {
>      private static final Logger LOG = LoggerFactory.getLogger(NodeStoreDiffTest.class);
> @@ -60,9 +66,20 @@ public class NodeStoreDiffTest {
>      @Rule
>      public DocumentMKBuilderProvider builderProvider = new DocumentMKBuilderProvider();
> +    @Parameterized.Parameters
> +    public static java.util.Collection<String> disableJournalDiff() {
> +        return Arrays.asList(null, "true");
> +    }
> +
>      private DocumentNodeStore ns;
>      private final TestDocumentStore tds = new TestDocumentStore();
> +    public NodeStoreDiffTest(String disableJournalDiff) {
> +        if (disableJournalDiff != null) {
> +            System.setProperty("oak.disableJournalDiff", disableJournalDiff);
> +        }
> +    }
> +
>      @Before
>      public void setUp() throws IOException {
>          ns = builderProvider.newBuilder()
> @@ -73,6 +90,11 @@ public class NodeStoreDiffTest {
>                  .getNodeStore();
>      }
> +    @After
> +    public void cleanup() {
> +        System.setProperties(null);
> +    }
> +
>      @Test
>      public void diffWithConflict() throws Exception{
>          //Last rev on /var would be 1-0-1
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)