Author: reschke
Date: Wed May 29 19:02:04 2019
New Revision: 1860368
URL: http://svn.apache.org/viewvc?rev=1860368&view=rev
Log:
OAK-8371: Stop using deprecated DocumentMK.Builder in RDB tests (ported to 1.10)
Modified:
jackrabbit/oak/branches/1.10/ (props changed)
jackrabbit/oak/branches/1.10/oak-it/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreTest.java
jackrabbit/oak/branches/1.10/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakDocumentRDBRepositoryStub.java
jackrabbit/oak/branches/1.10/oak-store-document/src/test/java/org/apache/jackrabbit/oak/fixture/DocumentRdbFixture.java
jackrabbit/oak/branches/1.10/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractRDBConnectionTest.java
jackrabbit/oak/branches/1.10/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
Propchange: jackrabbit/oak/branches/1.10/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May 29 19:02:04 2019
@@ -1,3 +1,3 @@
/jackrabbit/oak/branches/1.0:1665962
-/jackrabbit/oak/trunk:1850874,1850882,1851236,1851253,1851451,1851533-1851535,1851619,1852052,1852084,1852120,1852135,1852451,1852492-1852493,1852528,1852582,1852584,1852601,1852920,1853083,1853141,1853229,1853393,1853429,1853433,1853441,1853866,1853868,1853870,1853893,1853969,1853997,1854034,1854044,1854055,1854058,1854113,1854373,1854377,1854380,1854385,1854401,1854403,1854455,1854461-1854462,1854466,1854468,1854515,1854533,1854539,1854701,1854773-1854774,1854827,1854848,1854859,1854930,1854990-1854991,1855032,1855221,1855477-1855478,1855776,1855993,1856049,1856056,1856538,1856545,1857000,1857010,1857104,1857159,1857212,1857221,1857238,1857247,1857253,1857294,1857314,1857577,1857589,1857592,1857635,1857638,1857640,1857687,1857936,1858032,1858053,1858123,1858139,1858571,1858578,1858810,1858926,1858931,1859231,1859292,1859294,1859619,1859716,1859776,1859780,1859843,1859854,1859881,1860202,1860278,1860328
+/jackrabbit/oak/trunk:1850874,1850882,1851236,1851253,1851451,1851533-1851535,1851619,1852052,1852084,1852120,1852135,1852451,1852492-1852493,1852528,1852582,1852584,1852601,1852920,1853083,1853141,1853229,1853393,1853429,1853433,1853441,1853866,1853868,1853870,1853893,1853969,1853997,1854034,1854044,1854055,1854058,1854113,1854373,1854377,1854380,1854385,1854401,1854403,1854455,1854461-1854462,1854466,1854468,1854515,1854533,1854539,1854701,1854773-1854774,1854827,1854848,1854859,1854930,1854990-1854991,1855032,1855221,1855477-1855478,1855776,1855993,1856049,1856056,1856538,1856545,1857000,1857010,1857104,1857159,1857212,1857221,1857238,1857247,1857253,1857294,1857314,1857577,1857589,1857592,1857635,1857638,1857640,1857687,1857936,1858032,1858053,1858123,1858139,1858571,1858578,1858810,1858926,1858931,1859231,1859292,1859294,1859619,1859716,1859776,1859780,1859843,1859854,1859881,1860202,1860278,1860328,1860355
/jackrabbit/trunk:1345480
Modified:
jackrabbit/oak/branches/1.10/oak-it/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreTest.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.10/oak-it/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreTest.java?rev=1860368&r1=1860367&r2=1860368&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.10/oak-it/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreTest.java
(original)
+++
jackrabbit/oak/branches/1.10/oak-it/src/test/java/org/apache/jackrabbit/oak/composite/CompositeNodeStoreTest.java
Wed May 29 19:02:04 2019
@@ -55,11 +55,10 @@ import org.apache.commons.io.FileUtils;
import org.apache.jackrabbit.oak.api.Blob;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.Type;
-import org.apache.jackrabbit.oak.plugins.document.DocumentMK;
import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore;
import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBuilder;
-import org.apache.jackrabbit.oak.plugins.document.LeaseCheckMode;
import org.apache.jackrabbit.oak.plugins.document.rdb.RDBDataSourceFactory;
+import
org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentNodeStoreBuilder;
import org.apache.jackrabbit.oak.plugins.document.rdb.RDBOptions;
import org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider;
import
org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider;
@@ -804,7 +803,7 @@ public class CompositeNodeStoreTest {
}
ds = RDBDataSourceFactory.forJdbcUrl(jdbcUrl, "sa",
"");
- instance = new DocumentMK.Builder()
+ instance = new RDBDocumentNodeStoreBuilder()
.setRDBConnection(ds, options).build();
instance.setMaxBackOffMillis(0);
Modified:
jackrabbit/oak/branches/1.10/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakDocumentRDBRepositoryStub.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.10/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakDocumentRDBRepositoryStub.java?rev=1860368&r1=1860367&r2=1860368&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.10/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakDocumentRDBRepositoryStub.java
(original)
+++
jackrabbit/oak/branches/1.10/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakDocumentRDBRepositoryStub.java
Wed May 29 19:02:04 2019
@@ -25,9 +25,9 @@ import java.util.Properties;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
-import org.apache.jackrabbit.oak.plugins.document.DocumentMK;
import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore;
import org.apache.jackrabbit.oak.plugins.document.rdb.RDBDataSourceFactory;
+import
org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentNodeStoreBuilder;
import org.apache.jackrabbit.oak.plugins.document.rdb.RDBOptions;
/**
@@ -61,11 +61,11 @@ public class OakDocumentRDBRepositoryStu
try {
String prefix = "T" + Long.toHexString(System.currentTimeMillis());
RDBOptions options = new
RDBOptions().tablePrefix(prefix).dropTablesOnClose(true);
- m = new DocumentMK.Builder().
+ m = new RDBDocumentNodeStoreBuilder().
memoryCacheSize(64 * 1024 * 1024).
setPersistentCache("target/persistentCache,time").
setRDBConnection(RDBDataSourceFactory.forJdbcUrl(jdbcUrl,
USERNAME, PASSWD), options).
- getNodeStore();
+ build();
Jcr jcr = new Jcr(m);
preCreateRepository(jcr);
this.repository = jcr.createRepository();
Modified:
jackrabbit/oak/branches/1.10/oak-store-document/src/test/java/org/apache/jackrabbit/oak/fixture/DocumentRdbFixture.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.10/oak-store-document/src/test/java/org/apache/jackrabbit/oak/fixture/DocumentRdbFixture.java?rev=1860368&r1=1860367&r2=1860368&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.10/oak-store-document/src/test/java/org/apache/jackrabbit/oak/fixture/DocumentRdbFixture.java
(original)
+++
jackrabbit/oak/branches/1.10/oak-store-document/src/test/java/org/apache/jackrabbit/oak/fixture/DocumentRdbFixture.java
Wed May 29 19:02:04 2019
@@ -28,9 +28,9 @@ import java.util.concurrent.ConcurrentHa
import javax.sql.DataSource;
import org.apache.commons.lang.StringUtils;
-import org.apache.jackrabbit.oak.plugins.document.DocumentMK;
import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore;
import org.apache.jackrabbit.oak.plugins.document.rdb.RDBDataSourceFactory;
+import
org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentNodeStoreBuilder;
import org.apache.jackrabbit.oak.plugins.document.rdb.RDBOptions;
import org.apache.jackrabbit.oak.spi.state.NodeStore;
@@ -55,8 +55,8 @@ public class DocumentRdbFixture extends
this.jdbcUrl = pUrl.replace("{fname}", fname);
DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcUrl, pUser,
pPasswd);
- NodeStore result = new
DocumentMK.Builder().setPersistentCache("target/persistentCache,time")
- .setRDBConnection(ds, options).getNodeStore();
+ NodeStore result = new
RDBDocumentNodeStoreBuilder().setPersistentCache("target/persistentCache,time")
+ .setRDBConnection(ds, options).build();
this.dataSources.put(result, ds);
return result;
}
Modified:
jackrabbit/oak/branches/1.10/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractRDBConnectionTest.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.10/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractRDBConnectionTest.java?rev=1860368&r1=1860367&r2=1860368&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.10/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractRDBConnectionTest.java
(original)
+++
jackrabbit/oak/branches/1.10/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractRDBConnectionTest.java
Wed May 29 19:02:04 2019
@@ -22,6 +22,7 @@ import java.io.File;
import javax.sql.DataSource;
import org.apache.jackrabbit.oak.plugins.document.rdb.RDBDataSourceFactory;
+import
org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentNodeStoreBuilder;
import org.apache.jackrabbit.oak.plugins.document.rdb.RDBOptions;
import org.apache.jackrabbit.oak.stats.Clock;
import org.junit.After;
@@ -52,13 +53,13 @@ public class AbstractRDBConnectionTest e
public void setUpConnection() throws Exception {
dataSource = RDBDataSourceFactory.forJdbcUrl(URL, USERNAME, PASSWD);
Revision.setClock(getTestClock());
- mk = newBuilder(dataSource).open();
+ mk = new DocumentMK(newBuilder(dataSource).build());
}
- protected DocumentMK.Builder newBuilder(DataSource db) throws Exception {
+ protected RDBDocumentNodeStoreBuilder newBuilder(DataSource db) throws
Exception {
String prefix = "T" + Long.toHexString(System.currentTimeMillis());
RDBOptions opt = new
RDBOptions().tablePrefix(prefix).dropTablesOnClose(true);
- return new
DocumentMK.Builder().clock(getTestClock()).setRDBConnection(dataSource, opt);
+ return new
RDBDocumentNodeStoreBuilder().clock(getTestClock()).setRDBConnection(dataSource,
opt);
}
protected Clock getTestClock() throws InterruptedException {
Modified:
jackrabbit/oak/branches/1.10/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.10/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java?rev=1860368&r1=1860367&r2=1860368&view=diff
==============================================================================
---
jackrabbit/oak/branches/1.10/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
(original)
+++
jackrabbit/oak/branches/1.10/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
Wed May 29 19:02:04 2019
@@ -16,17 +16,12 @@
*/
package org.apache.jackrabbit.oak.plugins.document;
-import static com.google.common.base.Suppliers.ofInstance;
import static org.apache.jackrabbit.oak.commons.PathUtils.concat;
import java.io.InputStream;
import java.util.List;
import java.util.Set;
-import javax.sql.DataSource;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.commons.PathUtils;
import org.apache.jackrabbit.oak.commons.json.JsopReader;
@@ -34,21 +29,17 @@ import org.apache.jackrabbit.oak.commons
import org.apache.jackrabbit.oak.commons.json.JsopTokenizer;
import org.apache.jackrabbit.oak.commons.json.JsopWriter;
import org.apache.jackrabbit.oak.json.JsopDiff;
-import org.apache.jackrabbit.oak.plugins.blob.ReferencedBlob;
import org.apache.jackrabbit.oak.plugins.document.DocumentNodeState.Children;
import
org.apache.jackrabbit.oak.plugins.document.mongo.MongoDocumentNodeStoreBuilderBase;
-import org.apache.jackrabbit.oak.plugins.document.rdb.RDBBlobReferenceIterator;
-import org.apache.jackrabbit.oak.plugins.document.rdb.RDBBlobStore;
-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.spi.blob.GarbageCollectableBlobStore;
import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
/**
* A JSON-based wrapper around the NodeStore implementation that stores the
* data in a {@link DocumentStore}. It is used for testing purpose only.
@@ -82,6 +73,11 @@ public class DocumentMK {
this.store = nodeStore.getDocumentStore();
}
+ DocumentMK(DocumentNodeStore documentNodeStore) {
+ this.nodeStore = documentNodeStore;
+ this.store = nodeStore.getDocumentStore();
+ }
+
public void dispose() {
nodeStore.dispose();
}
@@ -476,47 +472,6 @@ public class DocumentMK {
public Builder() {
}
- /**
- * Sets a {@link DataSource} to use for the RDB document and blob
- * stores.
- *
- * @return this
- */
- public Builder setRDBConnection(DataSource ds) {
- setRDBConnection(ds, new RDBOptions());
- return this;
- }
-
- /**
- * Sets a {@link DataSource} to use for the RDB document and blob
- * stores, including {@link RDBOptions}.
- *
- * @return this
- */
- public Builder setRDBConnection(DataSource ds, RDBOptions options) {
- this.documentStoreSupplier = ofInstance(new RDBDocumentStore(ds,
this, options));
- if(blobStore == null) {
- GarbageCollectableBlobStore s = new RDBBlobStore(ds, options);
- setGCBlobStore(s);
- }
- return this;
- }
-
- /**
- * Sets a {@link DataSource}s to use for the RDB document and blob
- * stores.
- *
- * @return this
- */
- public Builder setRDBConnection(DataSource documentStoreDataSource,
DataSource blobStoreDataSource) {
- this.documentStoreSupplier = ofInstance(new
RDBDocumentStore(documentStoreDataSource, this));
- if(blobStore == null) {
- GarbageCollectableBlobStore s = new
RDBBlobStore(blobStoreDataSource);
- setGCBlobStore(s);
- }
- return this;
- }
-
public DocumentNodeStore getNodeStore() {
if (nodeStore == null) {
nodeStore = build();
@@ -524,24 +479,6 @@ public class DocumentMK {
return nodeStore;
}
- public VersionGCSupport createVersionGCSupport() {
- DocumentStore store = getDocumentStore();
- if (store instanceof RDBDocumentStore) {
- return new RDBVersionGCSupport((RDBDocumentStore) store);
- } else {
- return super.createVersionGCSupport();
- }
- }
-
- public Iterable<ReferencedBlob>
createReferencedBlobs(DocumentNodeStore ns) {
- final DocumentStore store = getDocumentStore();
- if (store instanceof RDBDocumentStore) {
- return () -> new RDBBlobReferenceIterator(ns,
(RDBDocumentStore) store);
- } else {
- return super.createReferencedBlobs(ns);
- }
- }
-
/**
* Open the DocumentMK instance using the configured options.
*