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 da...@apache.org on 2024/09/28 10:01:46 UTC

(jackrabbit-oak) 01/01: OAK-11113 : performed cleanup after running CompressedDocumentPropertyStateTest

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

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

commit 308f56be94c1064b52768fbaa3946354d9362ea8
Author: Rishabh Kumar <di...@adobe.com>
AuthorDate: Sat Sep 28 15:31:29 2024 +0530

    OAK-11113 : performed cleanup after running CompressedDocumentPropertyStateTest
---
 .../CompressedDocumentPropertyStateTest.java       | 24 ++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CompressedDocumentPropertyStateTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CompressedDocumentPropertyStateTest.java
index 64fca70302..f3faf3d4a3 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CompressedDocumentPropertyStateTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CompressedDocumentPropertyStateTest.java
@@ -16,7 +16,8 @@
  */
 package org.apache.jackrabbit.oak.plugins.document;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assume.assumeTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
@@ -39,6 +40,7 @@ import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.commons.Compression;
 import org.apache.jackrabbit.oak.plugins.document.mongo.MongoDocumentStore;
 import org.apache.jackrabbit.oak.plugins.document.mongo.MongoTestUtils;
+import org.apache.jackrabbit.oak.plugins.document.rdb.RDBOptions;
 import org.apache.jackrabbit.oak.spi.blob.BlobStore;
 import org.apache.jackrabbit.oak.spi.blob.MemoryBlobStore;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
@@ -181,45 +183,50 @@ public class CompressedDocumentPropertyStateTest {
     }
 
     @Test
-    public void testBrokenSurrogateWithoutCompressionForMongo() throws CommitFailedException {
+    public void testBrokenSurrogateWithoutCompressionForMongo() throws Exception {
         getBrokenSurrogateAndInitializeDifferentStores(DocumentStoreFixture.MONGO, false);
     }
 
     @Test
-    public void testBrokenSurrogateWithoutCompressionForRDB() throws CommitFailedException {
+    public void testBrokenSurrogateWithoutCompressionForRDB() throws Exception {
         getBrokenSurrogateAndInitializeDifferentStores(DocumentStoreFixture.RDB_H2, false);
     }
 
     @Test
-    public void testBrokenSurrogateWithoutCompressionForInMemory() throws CommitFailedException {
+    public void testBrokenSurrogateWithoutCompressionForInMemory() throws Exception {
         getBrokenSurrogateAndInitializeDifferentStores(DocumentStoreFixture.MEMORY, false);
     }
 
     @Test
-    public void testBrokenSurrogateWithCompressionForMongo() throws CommitFailedException {
+    public void testBrokenSurrogateWithCompressionForMongo() throws Exception {
         CompressedDocumentPropertyState.setCompressionThreshold(1);
         getBrokenSurrogateAndInitializeDifferentStores(DocumentStoreFixture.MONGO, true);
     }
 
     @Test
-    public void testBrokenSurrogateWithCompressionForRDB() throws CommitFailedException {
+    public void testBrokenSurrogateWithCompressionForRDB() throws Exception {
         CompressedDocumentPropertyState.setCompressionThreshold(1);
         getBrokenSurrogateAndInitializeDifferentStores(DocumentStoreFixture.RDB_H2, true);
     }
 
     @Test
-    public void testBrokenSurrogateWithCompressionForInMemory() throws CommitFailedException {
+    public void testBrokenSurrogateWithCompressionForInMemory() throws Exception {
         CompressedDocumentPropertyState.setCompressionThreshold(1);
         getBrokenSurrogateAndInitializeDifferentStores(DocumentStoreFixture.MEMORY, true);
     }
 
-    private void getBrokenSurrogateAndInitializeDifferentStores(DocumentStoreFixture fixture, boolean compressionEnabled) throws CommitFailedException {
+    private void getBrokenSurrogateAndInitializeDifferentStores(DocumentStoreFixture fixture, boolean compressionEnabled) throws Exception {
         assumeTrue(fixture.isAvailable());
         String test = "brokensurrogate:dfsa\ud800";
         DocumentStore store = null;
         DocumentNodeStore nodeStore = null;
+        final String rdbTablePrefix = "T" + Long.toHexString(System.currentTimeMillis());
 
         try {
+            if (fixture instanceof DocumentStoreFixture.RDBFixture) {
+                ((DocumentStoreFixture.RDBFixture) fixture).setRDBOptions(
+                        new RDBOptions().tablePrefix(rdbTablePrefix).dropTablesOnClose(true));
+            }
             store = fixture.createDocumentStore();
 
             if (store instanceof MongoDocumentStore) {
@@ -238,6 +245,7 @@ public class CompressedDocumentPropertyStateTest {
             if (nodeStore != null) {
                 nodeStore.dispose();
             }
+            fixture.dispose();
         }
 
     }