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 re...@apache.org on 2024/07/25 08:45:41 UTC

(jackrabbit-oak) branch trunk updated: OAK-10803: fix NPE when Mongo is unavailable, remove '*' imports (#1601)

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

reschke 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 ee86649536 OAK-10803: fix NPE when Mongo is unavailable, remove '*' imports (#1601)
ee86649536 is described below

commit ee8664953638b2140b134acf5bb9c327e27f9e42
Author: Julian Reschke <re...@apache.org>
AuthorDate: Thu Jul 25 10:45:36 2024 +0200

    OAK-10803: fix NPE when Mongo is unavailable, remove '*' imports (#1601)
---
 .../document/DocumentPropertyStateTest.java        | 45 ++++++++++++----------
 1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentPropertyStateTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentPropertyStateTest.java
index a9c4ef67bc..02c0dda73e 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentPropertyStateTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentPropertyStateTest.java
@@ -16,6 +16,19 @@
  */
 package org.apache.jackrabbit.oak.plugins.document;
 
+import static org.apache.jackrabbit.guava.common.collect.Lists.newArrayList;
+import static org.apache.jackrabbit.guava.common.collect.Sets.newHashSet;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assume.assumeTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -24,7 +37,6 @@ import java.util.List;
 import java.util.Objects;
 import java.util.Set;
 
-import com.mongodb.ReadPreference;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.apache.jackrabbit.oak.api.Blob;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
@@ -36,20 +48,12 @@ import org.apache.jackrabbit.oak.plugins.document.mongo.MongoTestUtils;
 import org.apache.jackrabbit.oak.spi.blob.BlobStore;
 import org.apache.jackrabbit.oak.spi.blob.MemoryBlobStore;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
-import org.junit.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
 
-import static org.apache.jackrabbit.guava.common.collect.Lists.newArrayList;
-import static org.apache.jackrabbit.guava.common.collect.Sets.newHashSet;
-import static org.apache.jackrabbit.oak.plugins.document.DocumentStoreFixture.*;
-import static org.junit.Assert.assertNotEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.times;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import com.mongodb.ReadPreference;
 
 public class DocumentPropertyStateTest {
 
@@ -249,38 +253,39 @@ public class DocumentPropertyStateTest {
 
     @Test
     public void testBrokenSurrogateWithoutCompressionForMongo() throws CommitFailedException {
-        getBrokenSurrogateAndInitializeDifferentStores(MONGO, false);
+        getBrokenSurrogateAndInitializeDifferentStores(DocumentStoreFixture.MONGO, false);
     }
 
     @Test
     public void testBrokenSurrogateWithoutCompressionForRDB() throws CommitFailedException {
-        getBrokenSurrogateAndInitializeDifferentStores(RDB_H2, false);
+        getBrokenSurrogateAndInitializeDifferentStores(DocumentStoreFixture.RDB_H2, false);
     }
 
     @Test
     public void testBrokenSurrogateWithoutCompressionForInMemory() throws CommitFailedException {
-        getBrokenSurrogateAndInitializeDifferentStores(MEMORY, false);
+        getBrokenSurrogateAndInitializeDifferentStores(DocumentStoreFixture.MEMORY, false);
     }
 
     @Test
     public void testBrokenSurrogateWithCompressionForMongo() throws CommitFailedException {
         DocumentPropertyState.setCompressionThreshold(1);
-        getBrokenSurrogateAndInitializeDifferentStores(MONGO, true);
+        getBrokenSurrogateAndInitializeDifferentStores(DocumentStoreFixture.MONGO, true);
     }
 
     @Test
     public void testBrokenSurrogateWithCompressionForRDB() throws CommitFailedException {
         DocumentPropertyState.setCompressionThreshold(1);
-        getBrokenSurrogateAndInitializeDifferentStores(RDB_H2, true);
+        getBrokenSurrogateAndInitializeDifferentStores(DocumentStoreFixture.RDB_H2, true);
     }
 
     @Test
     public void testBrokenSurrogateWithCompressionForInMemory() throws CommitFailedException {
         DocumentPropertyState.setCompressionThreshold(1);
-        getBrokenSurrogateAndInitializeDifferentStores(MEMORY, true);
+        getBrokenSurrogateAndInitializeDifferentStores(DocumentStoreFixture.MEMORY, true);
     }
 
     private void getBrokenSurrogateAndInitializeDifferentStores(DocumentStoreFixture fixture, boolean compressionEnabled) throws CommitFailedException {
+        assumeTrue(fixture.isAvailable());
         String test = "brokensurrogate:dfsa\ud800";
         DocumentStore store = null;
         DocumentNodeStore nodeStore = null;