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/10/08 14:02:58 UTC
(jackrabbit-oak) branch OAK-11174 created (now 3f687478d3)
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a change to branch OAK-11174
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
at 3f687478d3 OAK-11174: VersionGCSupportTest should use standard fixtures
This branch includes the following new commits:
new 3f687478d3 OAK-11174: VersionGCSupportTest should use standard fixtures
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(jackrabbit-oak) 01/01: OAK-11174: VersionGCSupportTest should use standard fixtures
Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a commit to branch OAK-11174
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 3f687478d309a9711cc1ba59d29ce776dfbe8cbc
Author: Julian Reschke <re...@apache.org>
AuthorDate: Tue Oct 8 15:02:39 2024 +0100
OAK-11174: VersionGCSupportTest should use standard fixtures
---
.../oak/plugins/document/VersionGCSupportTest.java | 52 +++++-----------------
1 file changed, 12 insertions(+), 40 deletions(-)
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupportTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupportTest.java
index c909042b58..53caca51b8 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupportTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupportTest.java
@@ -26,15 +26,12 @@ import java.util.stream.StreamSupport;
import com.mongodb.ReadPreference;
-import org.apache.jackrabbit.oak.plugins.document.DocumentStoreFixture.RDBFixture;
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.mongo.MongoVersionGCSupport;
import org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore;
-import org.apache.jackrabbit.oak.plugins.document.rdb.RDBOptions;
import org.apache.jackrabbit.oak.plugins.document.rdb.RDBVersionGCSupport;
import org.apache.jackrabbit.oak.plugins.document.util.Utils;
-import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -47,9 +44,6 @@ import static java.util.concurrent.TimeUnit.SECONDS;
import static org.apache.jackrabbit.guava.common.collect.Comparators.isInOrder;
import static org.apache.jackrabbit.oak.plugins.document.Collection.NODES;
import static org.apache.jackrabbit.oak.plugins.document.Document.ID;
-import static org.apache.jackrabbit.oak.plugins.document.DocumentStoreFixture.MEMORY;
-import static org.apache.jackrabbit.oak.plugins.document.DocumentStoreFixture.MONGO;
-import static org.apache.jackrabbit.oak.plugins.document.DocumentStoreFixture.RDB_H2;
import static org.apache.jackrabbit.oak.plugins.document.NodeDocument.MIN_ID_VALUE;
import static org.apache.jackrabbit.oak.plugins.document.NodeDocument.MODIFIED_IN_SECS;
import static org.apache.jackrabbit.oak.plugins.document.NodeDocument.NULL;
@@ -61,47 +55,31 @@ import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
@RunWith(Parameterized.class)
-public class VersionGCSupportTest {
+public class VersionGCSupportTest extends AbstractDocumentStoreTest {
private static final Set<String> EMPTY_STRING_SET = Collections.emptySet();
- private final String rdbTablePrefix = "T" + Long.toHexString(System.currentTimeMillis());
-
private final DocumentStoreFixture fixture;
private final DocumentStore store;
private final VersionGCSupport gcSupport;
- private final List<String> ids = new ArrayList<>();
+ private final List<String> ids;
- @Parameterized.Parameters(name="{0}")
- public static java.util.Collection<DocumentStoreFixture> fixtures() {
- List<DocumentStoreFixture> fixtures = new ArrayList<>();
- if (RDB_H2.isAvailable()) {
- fixtures.add(RDB_H2);
- }
- if (MONGO.isAvailable()) {
- fixtures.add(MONGO);
- }
- if (MEMORY.isAvailable()) {
- fixtures.add(MEMORY);
- }
- return fixtures;
- }
+ public VersionGCSupportTest(DocumentStoreFixture dsf) {
+ super(dsf);
+
+ this.fixture = super.dsf;
+ this.store = super.ds;
+ this.ids = super.removeMe;
- public VersionGCSupportTest(DocumentStoreFixture fixture) {
- this.fixture = fixture;
- if (fixture instanceof RDBFixture) {
- ((RDBFixture) fixture).setRDBOptions(
- new RDBOptions().tablePrefix(rdbTablePrefix).dropTablesOnClose(true));
- }
- this.store = fixture.createDocumentStore();
if (this.store instanceof MongoDocumentStore) {
// Enforce primary read preference, otherwise tests may fail on a
// replica set with a read preference configured to secondary.
- // Revision GC usually runs with a modified range way in the past,
- // which means changes made it to the secondary, but not in this
- // test using a virtual clock
+ // Revision GC usually runs with a modified range way in the
+ // past, which means changes made it to the secondary, but not in
+ // this using a virtual clock
MongoTestUtils.setReadPreference(store, ReadPreference.primary());
}
+
if (this.store instanceof MongoDocumentStore) {
this.gcSupport = new MongoVersionGCSupport((MongoDocumentStore) store);
} else if (this.store instanceof RDBDocumentStore) {
@@ -111,12 +89,6 @@ public class VersionGCSupportTest {
}
}
- @After
- public void after() throws Exception {
- store.remove(Collection.NODES, ids);
- fixture.dispose();
- }
-
@Test
public void getPossiblyDeletedDocs() {
long offset = SECONDS.toMillis(42);