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/11/11 14:28:50 UTC
[jackrabbit-oak] branch 1.6 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.6
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
The following commit(s) were added to refs/heads/1.6 by this push:
new 46424a5 OAK-8974: VersionGarbageCollectorIT should use fixtures from AbstractDocumentStoreTest
new 40e7b4a Merge pull request #412 from mreutegg/OAK-8974-1.6
46424a5 is described below
commit 46424a5230737cddcefd7b6d038b0a3369766126
Author: Marcel Reutegger <ma...@gmail.com>
AuthorDate: Tue Nov 9 16:14:52 2021 +0100
OAK-8974: VersionGarbageCollectorIT should use fixtures from AbstractDocumentStoreTest
Backport to 1.6 branch
---
.../oak/plugins/document/DocumentStoreFixture.java | 4 +++
.../document/VersionGarbageCollectorIT.java | 30 ++++++++--------------
2 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentStoreFixture.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentStoreFixture.java
index 28c3eb0..74fc319 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentStoreFixture.java
+++ b/oak-core/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-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
index 732c65d..2d07389 100644
--- a/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
+++ b/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
@@ -34,10 +34,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;
@@ -63,6 +59,8 @@ import com.google.common.collect.Sets;
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;
@@ -94,21 +92,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
@@ -117,6 +101,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));
+ }
store = new DocumentMK.Builder()
.clock(clock)
.setLeaseCheck(false)
@@ -128,7 +116,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);