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 2021/10/26 11:12:22 UTC

[jackrabbit-oak] branch 1.8 updated: OAK-8974: VersionGarbageCollectorIT should use fixtures from AbstractDocumentStoreTest

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

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


The following commit(s) were added to refs/heads/1.8 by this push:
     new 210b50d  OAK-8974: VersionGarbageCollectorIT should use fixtures from AbstractDocumentStoreTest
     new 6f4dca7  Merge pull request #401 from mreutegg/OAK-8974-1.8
210b50d is described below

commit 210b50db6d5f15fe1ab3396a5a5ae6803916b7e1
Author: Julian Reschke <re...@apache.org>
AuthorDate: Fri Mar 27 15:21:30 2020 +0000

    OAK-8974: VersionGarbageCollectorIT should use fixtures from AbstractDocumentStoreTest
    
    git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1875782 13f79535-47bb-0310-9956-ffa450edef68
---
 .../oak/plugins/document/DocumentStoreFixture.java |  4 +++
 .../document/VersionGarbageCollectorIT.java        | 30 ++++++++--------------
 2 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentStoreFixture.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentStoreFixture.java
index 28c3eb0..74fc319 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentStoreFixture.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentStoreFixture.java
@@ -199,6 +199,10 @@ public abstract class DocumentStoreFixture {
                 }
             }
         }
+
+        public void setRDBOptions(RDBOptions options) {
+            this.options = options;
+        }
     }
 
     public static class MongoFixture extends DocumentStoreFixture {
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
index 9f0146b..07a22aa 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
@@ -37,10 +37,6 @@ import static com.google.common.collect.Iterables.filter;
 import static com.google.common.collect.Iterables.size;
 import static java.util.concurrent.TimeUnit.HOURS;
 import static java.util.concurrent.TimeUnit.MINUTES;
-import static org.apache.jackrabbit.oak.commons.FixturesHelper.Fixture.DOCUMENT_MEM;
-import static org.apache.jackrabbit.oak.commons.FixturesHelper.Fixture.DOCUMENT_NS;
-import static org.apache.jackrabbit.oak.commons.FixturesHelper.Fixture.DOCUMENT_RDB;
-import static org.apache.jackrabbit.oak.commons.FixturesHelper.getFixtures;
 import static org.apache.jackrabbit.oak.plugins.document.Collection.NODES;
 import static org.apache.jackrabbit.oak.plugins.document.NodeDocument.NUM_REVS_THRESHOLD;
 import static org.apache.jackrabbit.oak.plugins.document.NodeDocument.PREV_SPLIT_FACTOR;
@@ -68,6 +64,8 @@ import com.google.common.util.concurrent.Atomics;
 
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.plugins.document.DocumentStoreFixture.RDBFixture;
+import org.apache.jackrabbit.oak.plugins.document.rdb.RDBOptions;
 import org.apache.jackrabbit.oak.plugins.document.util.Utils;
 import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
@@ -102,21 +100,7 @@ public class VersionGarbageCollectorIT {
 
     @Parameterized.Parameters(name="{0}")
     public static Collection<Object[]> fixtures() throws IOException {
-        List<Object[]> fixtures = Lists.newArrayList();
-        DocumentStoreFixture mongo = new DocumentStoreFixture.MongoFixture();
-        if (getFixtures().contains(DOCUMENT_NS) && mongo.isAvailable()) {
-            fixtures.add(new Object[] { mongo });
-        }
-
-        DocumentStoreFixture rdb = new DocumentStoreFixture.RDBFixture();
-        if (getFixtures().contains(DOCUMENT_RDB) && rdb.isAvailable()) {
-            fixtures.add(new Object[] { rdb });
-        }
-        if (fixtures.isEmpty() || getFixtures().contains(DOCUMENT_MEM)) {
-            fixtures.add(new Object[] { new DocumentStoreFixture.MemoryFixture() });
-        }
-
-        return fixtures;
+        return AbstractDocumentStoreTest.fixtures();
     }
 
     @Before
@@ -125,6 +109,10 @@ public class VersionGarbageCollectorIT {
         clock = new Clock.Virtual();
         clock.waitUntil(System.currentTimeMillis());
         Revision.setClock(clock);
+        if (fixture instanceof RDBFixture) {
+            ((RDBFixture) fixture).setRDBOptions(
+                    new RDBOptions().tablePrefix("T" + Long.toHexString(System.currentTimeMillis())).dropTablesOnClose(true));
+        }
         documentMKBuilder = new DocumentMK.Builder().clock(clock).setLeaseCheck(false)
                 .setDocumentStore(fixture.createDocumentStore()).setAsyncDelay(0);
         store = documentMKBuilder.getNodeStore();
@@ -133,7 +121,9 @@ public class VersionGarbageCollectorIT {
 
     @After
     public void tearDown() throws Exception {
-        store.dispose();
+        if (store != null) {
+            store.dispose();
+        }
         Revision.resetClockToDefault();
         execService.shutdown();
         execService.awaitTermination(1, MINUTES);