diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentStoreTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentStoreTest.java index aae76080c7b..d2399faffca 100644 --- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentStoreTest.java +++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentStoreTest.java @@ -38,10 +38,10 @@ public abstract class AbstractDocumentStoreTest { protected DocumentStore ds; protected DocumentStoreFixture dsf; protected DataSource rdbDataSource; - protected List removeMe = new ArrayList<>(); - protected List removeMeSettings = new ArrayList<>(); - protected List removeMeJournal = new ArrayList<>(); - protected List removeMeClusterNodes = new ArrayList<>(); + protected List removeMe = new ArrayList(); + protected List removeMeSettings = new ArrayList(); + protected List removeMeJournal = new ArrayList(); + protected List removeMeClusterNodes = new ArrayList(); static final Logger LOG = LoggerFactory.getLogger(AbstractDocumentStoreTest.class); @@ -59,7 +59,7 @@ public DocumentMK.Builder getBuilder() { } @Before - public void startUp() { + public void startUp() throws Exception{ logNodesPresent(true); } @@ -82,7 +82,7 @@ protected static Collection fixtures(boolean multi) { Collection result = new ArrayList<>(); Collection names = new ArrayList<>(); - DocumentStoreFixture[] candidates = new DocumentStoreFixture[] { DocumentStoreFixture.MEMORY, DocumentStoreFixture.MONGO, + DocumentStoreFixture candidates[] = new DocumentStoreFixture[] { DocumentStoreFixture.MEMORY, DocumentStoreFixture.MONGO, DocumentStoreFixture.RDB_H2, DocumentStoreFixture.RDB_DERBY, DocumentStoreFixture.RDB_PG, DocumentStoreFixture.RDB_DB2, DocumentStoreFixture.RDB_MYSQL, DocumentStoreFixture.RDB_ORACLE, DocumentStoreFixture.RDB_MSSQL }; 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 d89d8210662..73feee9a66e 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 @@ -40,11 +40,11 @@ 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.util.Utils; import org.apache.jackrabbit.oak.spi.blob.BlobStore; import org.apache.jackrabbit.oak.spi.blob.MemoryBlobStore; import org.apache.jackrabbit.oak.spi.state.NodeBuilder; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -68,24 +68,13 @@ public InputStream getInputStream(String blobId) } }; - private DocumentNodeStore ns; - public CompressedDocumentPropertyStateTest(DocumentStoreFixture dsf) { super(dsf); } - @Before - public void before() { - ns = builderProvider.newBuilder().setBlobStore(bs).getNodeStore(); - } - @After public void tearDown() { - try { - ns.dispose(); - } finally { - CompressedDocumentPropertyState.setCompressionThreshold(DISABLED_COMPRESSION); - } + CompressedDocumentPropertyState.setCompressionThreshold(DISABLED_COMPRESSION); } @Test(expected = IllegalArgumentException.class) @@ -208,24 +197,24 @@ private void getBrokenSurrogateAndInitializeDifferentStores(boolean compressionE // test using a virtual clock MongoTestUtils.setReadPreference(ds, ReadPreference.primary()); } - nodeStore = new DocumentMK.Builder().setDocumentStore(ds).getNodeStore(); + nodeStore = builderProvider.newBuilder().setDocumentStore(ds).getNodeStore(); createPropAndCheckValue(nodeStore, test, compressionEnabled); } private void createPropAndCheckValue(DocumentNodeStore nodeStore, String test, boolean compressionEnabled) throws CommitFailedException { NodeBuilder builder = nodeStore.getRoot().builder(); - String testNodeName1 = "cdpst1"; + final String testNodeName = "cdpst"; if (compressionEnabled) { CompressedDocumentPropertyState.setCompressionThreshold(1); } - builder.child(testNodeName1).setProperty("p", test, Type.STRING); + builder.child(testNodeName).setProperty("p", test, Type.STRING); TestUtils.merge(nodeStore, builder); - PropertyState p = nodeStore.getRoot().getChildNode(testNodeName1).getProperty("p"); + PropertyState p = nodeStore.getRoot().getChildNode(testNodeName).getProperty("p"); assertEquals(Objects.requireNonNull(p).getValue(Type.STRING), test); - removeMe.add("0:/"); - removeMe.add("1:/" + testNodeName1); + removeMe.add(Utils.getIdFromPath("/")); + removeMe.add(Utils.getIdFromPath("/" + testNodeName)); }