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 fr...@apache.org on 2016/10/19 16:48:25 UTC

svn commit: r1765680 - in /jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment: standby/ test/

Author: frm
Date: Wed Oct 19 16:48:24 2016
New Revision: 1765680

URL: http://svn.apache.org/viewvc?rev=1765680&view=rev
Log:
OAK-4958 - Simplify the setup of cold standby test scenarios

Added:
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/test/
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/test/TemporaryBlobStore.java   (with props)
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/test/TemporaryFileStore.java   (with props)
Modified:
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/BrokenNetworkTest.java
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/DataStoreTestBase.java
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/ExternalPrivateStoreIT.java
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/ExternalSharedStoreIT.java
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/FailoverIPRangeTest.java
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/FailoverMultipleClientsTestIT.java
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/FailoverSslTestIT.java
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/MBeanTest.java
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/RecoverTestIT.java
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/StandbyTest.java
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/StandbyTestIT.java
    jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/TestBase.java

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/BrokenNetworkTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/BrokenNetworkTest.java?rev=1765680&r1=1765679&r2=1765680&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/BrokenNetworkTest.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/BrokenNetworkTest.java Wed Oct 19 16:48:24 2016
@@ -23,25 +23,34 @@ import static org.apache.jackrabbit.oak.
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 
+import java.io.File;
+
 import org.apache.jackrabbit.oak.segment.SegmentNodeStoreBuilders;
+import org.apache.jackrabbit.oak.segment.file.FileStore;
 import org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync;
 import org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync;
+import org.apache.jackrabbit.oak.segment.test.TemporaryFileStore;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TemporaryFolder;
 
 public class BrokenNetworkTest extends TestBase {
 
-    @Before
-    public void setUp() throws Exception {
-        setUpServerAndTwoClients();
-    }
+    private TemporaryFolder folder = new TemporaryFolder(new File("target"));
 
-    @After
-    public void after() {
-        closeServerAndTwoClients();
-    }
+    private TemporaryFileStore serverFileStore = new TemporaryFileStore(folder);
+
+    private TemporaryFileStore clientFileStore1 = new TemporaryFileStore(folder);
+
+    private TemporaryFileStore clientFileStore2 = new TemporaryFileStore(folder);
+
+    @Rule
+    public RuleChain chain = RuleChain.outerRule(folder)
+            .around(serverFileStore)
+            .around(clientFileStore1)
+            .around(clientFileStore2);
 
     @Test
     public void testProxy() throws Exception {
@@ -114,14 +123,18 @@ public class BrokenNetworkTest extends T
     }
 
     private void useProxy(boolean ssl, int skipPosition, int skipBytes, int flipPosition, boolean intermediateChange) throws Exception {
+        FileStore storeS = serverFileStore.fileStore();
+        FileStore storeC = clientFileStore1.fileStore();
+        FileStore storeC2 = clientFileStore2.fileStore();
+
         NodeStore store = SegmentNodeStoreBuilders.builder(storeS).build();
         addTestContent(store, "server");
         storeS.flush();  // this speeds up the test a little bit...
 
         try (
-                NetworkErrorProxy p = new NetworkErrorProxy(proxyPort, LOCALHOST, port);
-                StandbyServerSync serverSync = new StandbyServerSync(port, storeS, ssl);
-                StandbyClientSync clientSync = newStandbyClientSync(storeC, proxyPort, ssl);
+                NetworkErrorProxy p = new NetworkErrorProxy(getProxyPort(), getServerHost(), getServerPort());
+                StandbyServerSync serverSync = new StandbyServerSync(getServerPort(), storeS, ssl);
+                StandbyClientSync clientSync = newStandbyClientSync(storeC, getProxyPort(), ssl);
         ) {
             p.skipBytes(skipPosition, skipBytes);
             p.flipByte(flipPosition);

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/DataStoreTestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/DataStoreTestBase.java?rev=1765680&r1=1765679&r2=1765680&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/DataStoreTestBase.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/DataStoreTestBase.java Wed Oct 19 16:48:24 2016
@@ -48,23 +48,15 @@ import org.apache.jackrabbit.oak.spi.com
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 
-public class DataStoreTestBase extends TestBase {
+public abstract class DataStoreTestBase extends TestBase {
 
-    protected boolean storesCanBeEqual = false;
+    abstract FileStore getPrimary();
 
-    @Before
-    public void setUp() throws Exception {
-        setUpServerAndClient();
-    }
+    abstract FileStore getSecondary();
 
-    @After
-    public void after() {
-        closeServerAndClient();
-    }
+    abstract boolean storesShouldBeEqual();
 
     protected FileStore setupFileDataStore(File d, String path, ScheduledExecutorService executor) throws Exception {
         FileDataStore fds = new FileDataStore();
@@ -106,7 +98,7 @@ public class DataStoreTestBase extends T
         FileStore secondary = getSecondary();
 
         NodeStore store = SegmentNodeStoreBuilders.builder(primary).build();
-        final StandbyServerSync serverSync = new StandbyServerSync(port, primary);
+        final StandbyServerSync serverSync = new StandbyServerSync(getServerPort(), primary);
         serverSync.start();
         byte[] data = addTestContent(store, "server", blobSize);
         primary.flush();
@@ -176,23 +168,23 @@ public class DataStoreTestBase extends T
         FileStore primary = getPrimary();
         FileStore secondary = getSecondary();
 
-        NetworkErrorProxy p = new NetworkErrorProxy(proxyPort, LOCALHOST, port);
+        NetworkErrorProxy p = new NetworkErrorProxy(getProxyPort(), getServerHost(), getServerPort());
         p.skipBytes(skipPosition, skipBytes);
         p.flipByte(flipPosition);
         p.run();
 
         NodeStore store = SegmentNodeStoreBuilders.builder(primary).build();
-        final StandbyServerSync serverSync = new StandbyServerSync(port, primary);
+        final StandbyServerSync serverSync = new StandbyServerSync(getServerPort(), primary);
         serverSync.start();
         byte[] data = addTestContent(store, "server", blobSize);
         primary.flush();
 
-        StandbyClientSync clientSync = newStandbyClientSync(secondary, proxyPort);
+        StandbyClientSync clientSync = newStandbyClientSync(secondary, getProxyPort());
         clientSync.run();
 
         try {
             if (skipBytes > 0 || flipPosition >= 0) {
-                if (!this.storesCanBeEqual) {
+                if (!storesShouldBeEqual()) {
                     assertFalse("stores are not expected to be equal", primary.getHead().equals(secondary.getHead()));
                 }
                 p.reset();

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/ExternalPrivateStoreIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/ExternalPrivateStoreIT.java?rev=1765680&r1=1765679&r2=1765680&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/ExternalPrivateStoreIT.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/ExternalPrivateStoreIT.java Wed Oct 19 16:48:24 2016
@@ -19,20 +19,46 @@
 package org.apache.jackrabbit.oak.segment.standby;
 
 import java.io.File;
-import java.util.concurrent.ScheduledExecutorService;
 
 import org.apache.jackrabbit.oak.segment.file.FileStore;
+import org.apache.jackrabbit.oak.segment.test.TemporaryBlobStore;
+import org.apache.jackrabbit.oak.segment.test.TemporaryFileStore;
+import org.junit.Rule;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TemporaryFolder;
 
 public class ExternalPrivateStoreIT extends DataStoreTestBase {
 
+    private TemporaryFolder folder = new TemporaryFolder(new File("target"));
+
+    private TemporaryBlobStore serverBlobStore = new TemporaryBlobStore(folder);
+
+    private TemporaryFileStore serverFileStore = new TemporaryFileStore(folder, serverBlobStore);
+
+    private TemporaryBlobStore clientBlobStore = new TemporaryBlobStore(folder);
+
+    private TemporaryFileStore clientFileStore = new TemporaryFileStore(folder, clientBlobStore);
+
+    @Rule
+    public RuleChain chain = RuleChain.outerRule(folder)
+            .around(serverBlobStore)
+            .around(serverFileStore)
+            .around(clientBlobStore)
+            .around(clientFileStore);
+
+    @Override
+    FileStore getPrimary() {
+        return serverFileStore.fileStore();
+    }
+
     @Override
-    protected FileStore setupPrimary(File d, ScheduledExecutorService primaryExecutor) throws Exception {
-        return setupFileDataStore(d, folder.newFolder("data-store-primary").getAbsolutePath(), primaryExecutor);
+    FileStore getSecondary() {
+        return clientFileStore.fileStore();
     }
 
     @Override
-    protected FileStore setupSecondary(File d, ScheduledExecutorService secondaryExecutor) throws Exception {
-        return setupFileDataStore(d, folder.newFolder("data-store-secondary").getAbsolutePath(), secondaryExecutor);
+    boolean storesShouldBeEqual() {
+        return false;
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/ExternalSharedStoreIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/ExternalSharedStoreIT.java?rev=1765680&r1=1765679&r2=1765680&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/ExternalSharedStoreIT.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/ExternalSharedStoreIT.java Wed Oct 19 16:48:24 2016
@@ -19,28 +19,43 @@
 package org.apache.jackrabbit.oak.segment.standby;
 
 import java.io.File;
-import java.util.concurrent.ScheduledExecutorService;
 
 import org.apache.jackrabbit.oak.segment.file.FileStore;
+import org.apache.jackrabbit.oak.segment.test.TemporaryBlobStore;
+import org.apache.jackrabbit.oak.segment.test.TemporaryFileStore;
+import org.junit.Rule;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TemporaryFolder;
 
 public class ExternalSharedStoreIT extends DataStoreTestBase {
 
-    public ExternalSharedStoreIT() {
-        this.storesCanBeEqual = true;
-    }
+    private TemporaryFolder folder = new TemporaryFolder(new File("target"));
+
+    private TemporaryBlobStore commonBlobStore = new TemporaryBlobStore(folder);
+
+    private TemporaryFileStore serverFileStore = new TemporaryFileStore(folder, commonBlobStore);
 
-    private String getCommonDataStorePath() {
-        return new File(folder.getRoot(), "data-store-common").getAbsolutePath();
+    private TemporaryFileStore clientFileStore = new TemporaryFileStore(folder, commonBlobStore);
+
+    @Rule
+    public RuleChain chain = RuleChain.outerRule(folder)
+            .around(commonBlobStore)
+            .around(serverFileStore)
+            .around(clientFileStore);
+
+    @Override
+    FileStore getPrimary() {
+        return serverFileStore.fileStore();
     }
 
     @Override
-    protected FileStore setupPrimary(File d, ScheduledExecutorService primaryExecutor) throws Exception {
-        return setupFileDataStore(d, getCommonDataStorePath(), primaryExecutor);
+    FileStore getSecondary() {
+        return clientFileStore.fileStore();
     }
 
     @Override
-    protected FileStore setupSecondary(File d, ScheduledExecutorService secondaryExecutor) throws Exception {
-        return setupFileDataStore(d, getCommonDataStorePath(), secondaryExecutor);
+    boolean storesShouldBeEqual() {
+        return true;
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/FailoverIPRangeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/FailoverIPRangeTest.java?rev=1765680&r1=1765679&r2=1765680&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/FailoverIPRangeTest.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/FailoverIPRangeTest.java Wed Oct 19 16:48:24 2016
@@ -23,25 +23,31 @@ import static org.apache.jackrabbit.oak.
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 
+import java.io.File;
+
 import org.apache.jackrabbit.oak.segment.SegmentNodeStoreBuilders;
+import org.apache.jackrabbit.oak.segment.file.FileStore;
 import org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync;
 import org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync;
+import org.apache.jackrabbit.oak.segment.test.TemporaryFileStore;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TemporaryFolder;
 
 public class FailoverIPRangeTest extends TestBase {
 
-    @Before
-    public void setUp() throws Exception {
-        setUpServerAndClient();
-    }
+    private TemporaryFolder folder = new TemporaryFolder(new File("target"));
 
-    @After
-    public void after() {
-        closeServerAndClient();
-    }
+    private TemporaryFileStore serverFileStore = new TemporaryFileStore(folder);
+
+    private TemporaryFileStore clientFileStore = new TemporaryFileStore(folder);
+
+    @Rule
+    public RuleChain chain = RuleChain.outerRule(folder)
+            .around(serverFileStore)
+            .around(clientFileStore);
 
     @Test
     public void testFailoverAllClients() throws Exception {
@@ -140,13 +146,16 @@ public class FailoverIPRangeTest extends
     }
 
     private void createTestWithConfig(String host, String[] ipRanges, boolean expectedToWork) throws Exception {
+        FileStore storeS = serverFileStore.fileStore();
+        FileStore storeC = clientFileStore.fileStore();
+
         NodeStore store = SegmentNodeStoreBuilders.builder(storeS).build();
-        final StandbyServerSync serverSync = new StandbyServerSync(port, storeS, ipRanges);
+        final StandbyServerSync serverSync = new StandbyServerSync(getServerPort(), storeS, ipRanges);
         serverSync.start();
         addTestContent(store, "server");
         storeS.flush();  // this speeds up the test a little bit...
 
-        StandbyClientSync clientSync = new StandbyClientSync(host, port, storeC, false, timeout, false);
+        StandbyClientSync clientSync = new StandbyClientSync(host, getServerPort(), storeC, false, getClientTimeout(), false);
         clientSync.run();
 
         try {

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/FailoverMultipleClientsTestIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/FailoverMultipleClientsTestIT.java?rev=1765680&r1=1765679&r2=1765680&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/FailoverMultipleClientsTestIT.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/FailoverMultipleClientsTestIT.java Wed Oct 19 16:48:24 2016
@@ -21,31 +21,44 @@ package org.apache.jackrabbit.oak.segmen
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 
+import java.io.File;
+
 import org.apache.jackrabbit.oak.segment.SegmentNodeStoreBuilders;
 import org.apache.jackrabbit.oak.segment.SegmentTestUtils;
+import org.apache.jackrabbit.oak.segment.file.FileStore;
 import org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync;
 import org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync;
+import org.apache.jackrabbit.oak.segment.test.TemporaryFileStore;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TemporaryFolder;
 
 public class FailoverMultipleClientsTestIT extends TestBase {
 
-    @Before
-    public void setUp() throws Exception {
-        setUpServerAndTwoClients();
-    }
-
-    @After
-    public void after() {
-        closeServerAndTwoClients();
-    }
+    private TemporaryFolder folder = new TemporaryFolder(new File("target"));
+
+    private TemporaryFileStore serverFileStore = new TemporaryFileStore(folder);
+
+    private TemporaryFileStore clientFileStore1 = new TemporaryFileStore(folder);
+
+    private TemporaryFileStore clientFileStore2 = new TemporaryFileStore(folder);
+
+    @Rule
+    public RuleChain chain = RuleChain.outerRule(folder)
+            .around(serverFileStore)
+            .around(clientFileStore1)
+            .around(clientFileStore2);
 
     @Test
     public void testMultipleClients() throws Exception {
+        FileStore storeS = serverFileStore.fileStore();
+        FileStore storeC = clientFileStore1.fileStore();
+        FileStore storeC2 = clientFileStore2.fileStore();
+
         NodeStore store = SegmentNodeStoreBuilders.builder(storeS).build();
-        final StandbyServerSync serverSync = new StandbyServerSync(port, storeS);
+        final StandbyServerSync serverSync = new StandbyServerSync(getServerPort(), storeS);
         serverSync.start();
         SegmentTestUtils.addTestContent(store, "server");
         storeS.flush();  // this speeds up the test a little bit...

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/FailoverSslTestIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/FailoverSslTestIT.java?rev=1765680&r1=1765679&r2=1765680&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/FailoverSslTestIT.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/FailoverSslTestIT.java Wed Oct 19 16:48:24 2016
@@ -23,36 +23,43 @@ import static org.apache.jackrabbit.oak.
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 
+import java.io.File;
+
 import org.apache.jackrabbit.oak.segment.SegmentNodeStoreBuilders;
+import org.apache.jackrabbit.oak.segment.file.FileStore;
 import org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync;
 import org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync;
+import org.apache.jackrabbit.oak.segment.test.TemporaryFileStore;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TemporaryFolder;
 
 public class FailoverSslTestIT extends TestBase {
 
-    @Before
-    public void setUp() throws Exception {
-        setUpServerAndClient();
-    }
+    private TemporaryFolder folder = new TemporaryFolder(new File("target"));
 
-    @After
-    public void after() {
-        closeServerAndClient();
-    }
+    private TemporaryFileStore serverFileStore = new TemporaryFileStore(folder);
+
+    private TemporaryFileStore clientFileStore = new TemporaryFileStore(folder);
+
+    @Rule
+    public RuleChain chain = RuleChain.outerRule(folder)
+            .around(serverFileStore)
+            .around(clientFileStore);
 
     @Test
     public void testFailoverSecure() throws Exception {
-
+        FileStore storeS = serverFileStore.fileStore();
+        FileStore storeC = clientFileStore.fileStore();
         NodeStore store = SegmentNodeStoreBuilders.builder(storeS).build();
-        final StandbyServerSync serverSync = new StandbyServerSync(port, storeS, true);
+        final StandbyServerSync serverSync = new StandbyServerSync(getServerPort(), storeS, true);
         serverSync.start();
         addTestContent(store, "server");
         storeS.flush();  // this speeds up the test a little bit...
 
-        StandbyClientSync clientSync = newStandbyClientSync(storeC, port, true);
+        StandbyClientSync clientSync = newStandbyClientSync(storeC, getServerPort(), true);
         clientSync.run();
 
         try {
@@ -65,9 +72,10 @@ public class FailoverSslTestIT extends T
 
     @Test
     public void testFailoverSecureServerPlainClient() throws Exception {
-
+        FileStore storeS = serverFileStore.fileStore();
+        FileStore storeC = clientFileStore.fileStore();
         NodeStore store = SegmentNodeStoreBuilders.builder(storeS).build();
-        final StandbyServerSync serverSync = new StandbyServerSync(port, storeS, true);
+        final StandbyServerSync serverSync = new StandbyServerSync(getServerPort(), storeS, true);
         serverSync.start();
         addTestContent(store, "server");
         storeS.flush();  // this speeds up the test a little bit...
@@ -85,14 +93,15 @@ public class FailoverSslTestIT extends T
 
     @Test
     public void testFailoverPlainServerSecureClient() throws Exception {
-
+        FileStore storeS = serverFileStore.fileStore();
+        FileStore storeC = clientFileStore.fileStore();
         NodeStore store = SegmentNodeStoreBuilders.builder(storeS).build();
-        final StandbyServerSync serverSync = new StandbyServerSync(port, storeS);
+        final StandbyServerSync serverSync = new StandbyServerSync(getServerPort(), storeS);
         serverSync.start();
         addTestContent(store, "server");
         storeS.flush();  // this speeds up the test a little bit...
 
-        StandbyClientSync clientSync = newStandbyClientSync(storeC, port, true);
+        StandbyClientSync clientSync = newStandbyClientSync(storeC, getServerPort(), true);
         clientSync.run();
 
         try {

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/MBeanTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/MBeanTest.java?rev=1765680&r1=1765679&r2=1765680&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/MBeanTest.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/MBeanTest.java Wed Oct 19 16:48:24 2016
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.io.File;
 import java.lang.management.ManagementFactory;
 import java.util.Set;
 
@@ -33,25 +34,22 @@ import javax.management.ObjectName;
 import org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync;
 import org.apache.jackrabbit.oak.segment.standby.jmx.StandbyStatusMBean;
 import org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync;
-import org.junit.After;
-import org.junit.Before;
+import org.apache.jackrabbit.oak.segment.test.TemporaryFileStore;
+import org.junit.Ignore;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 public class MBeanTest extends TestBase {
 
-    @Before
-    public void setUp() throws Exception {
-        setUpServerAndClient();
-    }
+    private TemporaryFolder folder = new TemporaryFolder(new File("target"));
 
-    @After
-    public void after() {
-        closeServerAndClient();
-    }
+    private TemporaryFileStore serverFileStore = new TemporaryFileStore(folder);
+
+    private TemporaryFileStore clientFileStore = new TemporaryFileStore(folder);
 
     @Test
     public void testServerEmptyConfig() throws Exception {
-        final StandbyServerSync serverSync = new StandbyServerSync(TestBase.port, this.storeS);
+        final StandbyServerSync serverSync = new StandbyServerSync(TestBase.getServerPort(), serverFileStore.fileStore());
         serverSync.start();
 
         final MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer();
@@ -86,7 +84,7 @@ public class MBeanTest extends TestBase
 
     @Test
     public void testClientEmptyConfigNoServer() throws Exception {
-        final StandbyClientSync clientSync = newStandbyClientSync(storeC);
+        final StandbyClientSync clientSync = newStandbyClientSync(clientFileStore.fileStore());
         clientSync.start();
         clientSync.run();
 
@@ -124,7 +122,7 @@ public class MBeanTest extends TestBase
     @Test
     public void testClientNoServer() throws Exception {
         System.setProperty(StandbyClientSync.CLIENT_ID_PROPERTY_NAME, "Foo");
-        final StandbyClientSync clientSync = newStandbyClientSync(storeC);
+        final StandbyClientSync clientSync = newStandbyClientSync(clientFileStore.fileStore());
         clientSync.start();
         clientSync.run();
 
@@ -147,12 +145,13 @@ public class MBeanTest extends TestBase
     }
 
     @Test
+    @Ignore("OAK-4958")
     public void testClientAndServerEmptyConfig() throws Exception {
-        final StandbyServerSync serverSync = new StandbyServerSync(port, this.storeS);
+        final StandbyServerSync serverSync = new StandbyServerSync(getServerPort(), serverFileStore.fileStore());
         serverSync.start();
 
         System.setProperty(StandbyClientSync.CLIENT_ID_PROPERTY_NAME, "Bar");
-        final StandbyClientSync clientSync = newStandbyClientSync(storeC);
+        final StandbyClientSync clientSync = newStandbyClientSync(clientFileStore.fileStore());
         clientSync.start();
         clientSync.run();
 

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/RecoverTestIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/RecoverTestIT.java?rev=1765680&r1=1765679&r2=1765680&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/RecoverTestIT.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/RecoverTestIT.java Wed Oct 19 16:48:24 2016
@@ -23,33 +23,41 @@ import static org.apache.jackrabbit.oak.
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 
+import java.io.File;
+
 import org.apache.jackrabbit.oak.segment.SegmentNodeStoreBuilders;
+import org.apache.jackrabbit.oak.segment.file.FileStore;
 import org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync;
 import org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync;
+import org.apache.jackrabbit.oak.segment.test.TemporaryFileStore;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TemporaryFolder;
 
 public class RecoverTestIT extends TestBase {
 
-    @Before
-    public void setUp() throws Exception {
-        setUpServerAndClient();
-    }
-
-    @After
-    public void after() {
-        closeServerAndClient();
-    }
+    private TemporaryFolder folder = new TemporaryFolder(new File("target"));
+
+    private TemporaryFileStore serverFileStore = new TemporaryFileStore(folder);
+
+    private TemporaryFileStore clientFileStore = new TemporaryFileStore(folder);
+
+    @Rule
+    public RuleChain chain = RuleChain.outerRule(folder)
+            .around(serverFileStore)
+            .around(clientFileStore);
 
     @Test
     public void testLocalChanges() throws Exception {
+        FileStore storeS = serverFileStore.fileStore();
+        FileStore storeC = clientFileStore.fileStore();
 
         NodeStore store = SegmentNodeStoreBuilders.builder(storeC).build();
         addTestContent(store, "client");
 
-        final StandbyServerSync serverSync = new StandbyServerSync(port, storeS);
+        final StandbyServerSync serverSync = new StandbyServerSync(getServerPort(), storeS);
         serverSync.start();
         store = SegmentNodeStoreBuilders.builder(storeS).build();
         addTestContent(store, "server");

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/StandbyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/StandbyTest.java?rev=1765680&r1=1765679&r2=1765680&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/StandbyTest.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/StandbyTest.java Wed Oct 19 16:48:24 2016
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertTrue;
 
 import java.io.ByteArrayInputStream;
+import java.io.File;
 import java.io.IOException;
 import java.util.Random;
 
@@ -37,35 +38,38 @@ import org.apache.jackrabbit.oak.segment
 import org.apache.jackrabbit.oak.segment.file.FileStore;
 import org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync;
 import org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync;
+import org.apache.jackrabbit.oak.segment.test.TemporaryFileStore;
 import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TemporaryFolder;
 
 public class StandbyTest extends TestBase {
 
-    @Before
-    public void setUp() throws Exception {
-        setUpServerAndClient();
-    }
-
-    @After
-    public void after() {
-        closeServerAndClient();
-    }
+    private TemporaryFolder folder = new TemporaryFolder(new File("target"));
+
+    private TemporaryFileStore serverFileStore = new TemporaryFileStore(folder);
+
+    private TemporaryFileStore clientFileStore = new TemporaryFileStore(folder);
+
+    @Rule
+    public RuleChain chain = RuleChain.outerRule(folder)
+            .around(serverFileStore)
+            .around(clientFileStore);
 
     @Test
     public void testSync() throws Exception {
         final int mb = 1 * 1024 * 1024;
         final int blobSize = 5 * mb;
-        FileStore primary = getPrimary();
-        FileStore secondary = getSecondary();
+        FileStore primary = serverFileStore.fileStore();
+        FileStore secondary = clientFileStore.fileStore();
 
         NodeStore store = SegmentNodeStoreBuilders.builder(primary).build();
-        final StandbyServerSync serverSync = new StandbyServerSync(port, primary);
+        final StandbyServerSync serverSync = new StandbyServerSync(getServerPort(), primary);
         serverSync.start();
         byte[] data = addTestContent(store, "server", blobSize, 150);
         primary.flush();

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/StandbyTestIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/StandbyTestIT.java?rev=1765680&r1=1765679&r2=1765680&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/StandbyTestIT.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/StandbyTestIT.java Wed Oct 19 16:48:24 2016
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertTrue;
 
 import java.io.ByteArrayInputStream;
+import java.io.File;
 import java.io.IOException;
 import java.util.Random;
 
@@ -37,25 +38,28 @@ import org.apache.jackrabbit.oak.segment
 import org.apache.jackrabbit.oak.segment.file.FileStore;
 import org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync;
 import org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync;
+import org.apache.jackrabbit.oak.segment.test.TemporaryFileStore;
 import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TemporaryFolder;
 
 public class StandbyTestIT extends TestBase {
 
-    @Before
-    public void setUp() throws Exception {
-        setUpServerAndClient();
-    }
+    private TemporaryFolder folder = new TemporaryFolder(new File("target"));
 
-    @After
-    public void after() {
-        closeServerAndClient();
-    }
+    private TemporaryFileStore serverFileStore = new TemporaryFileStore(folder);
+
+    private TemporaryFileStore clientFileStore = new TemporaryFileStore(folder);
+
+    @Rule
+    public RuleChain chain = RuleChain.outerRule(folder)
+            .around(serverFileStore)
+            .around(clientFileStore);
 
     private static byte[] addTestContent(NodeStore store, String child, int size, int dataNodes)
             throws CommitFailedException, IOException {
@@ -87,11 +91,11 @@ public class StandbyTestIT extends TestB
         final int blobSize = 25 * 1024;
         final int dataNodes = 5000;
 
-        FileStore primary = getPrimary();
-        FileStore secondary = getSecondary();
+        FileStore primary = serverFileStore.fileStore();
+        FileStore secondary = clientFileStore.fileStore();
 
         NodeStore store = SegmentNodeStoreBuilders.builder(primary).build();
-        final StandbyServerSync serverSync = new StandbyServerSync(port, primary);
+        final StandbyServerSync serverSync = new StandbyServerSync(getServerPort(), primary);
         serverSync.start();
         byte[] data = addTestContent(store, "server", blobSize, dataNodes);
         primary.flush();

Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/TestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/TestBase.java?rev=1765680&r1=1765679&r2=1765680&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/TestBase.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/standby/TestBase.java Wed Oct 19 16:48:24 2016
@@ -19,138 +19,49 @@
 
 package org.apache.jackrabbit.oak.segment.standby;
 
-import static org.apache.jackrabbit.oak.segment.file.FileStoreBuilder.fileStoreBuilder;
 import static org.junit.Assume.assumeTrue;
 
-import java.io.File;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-
 import org.apache.commons.lang3.SystemUtils;
 import org.apache.jackrabbit.oak.commons.CIHelper;
-import org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser;
 import org.apache.jackrabbit.oak.segment.file.FileStore;
 import org.apache.jackrabbit.oak.segment.standby.client.StandbyClientSync;
-import org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider;
 import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
 
 public class TestBase {
 
-    static final int port = Integer.getInteger("standby.server.port",
-            52800);
-
-    static final int proxyPort = Integer.getInteger(
-            "standby.proxy.port", 51913);
-
-    final static String LOCALHOST = "127.0.0.1";
-
-    static final int timeout = Integer.getInteger("standby.test.timeout", 500);
+    private static final int port = Integer.getInteger("standby.server.port", 52800);
 
-    @Rule
-    public TemporaryFolder folder = new TemporaryFolder(new File("target"));
+    private static final int proxyPort = Integer.getInteger("standby.proxy.port", 51913);
 
-    FileStore storeS;
-    ScheduledExecutorService executorS;
+    private static final int timeout = Integer.getInteger("standby.test.timeout", 500);
 
-    FileStore storeC;
-    ScheduledExecutorService executorC;
-
-    FileStore storeC2;
-    ScheduledExecutorService executorC2;
-
-    /*
-     Java 6 on Windows doesn't support dual IP stacks, so we will skip our IPv6
-     tests.
-    */
-    protected final boolean noDualStackSupport = SystemUtils.IS_OS_WINDOWS && SystemUtils.IS_JAVA_1_6;
+    // Java 6 on Windows doesn't support dual IP stacks, so we will skip our
+    // IPv6 tests.
+    final boolean noDualStackSupport = SystemUtils.IS_OS_WINDOWS && SystemUtils.IS_JAVA_1_6;
 
     @BeforeClass
     public static void assumptions() {
         assumeTrue(!CIHelper.travis());
     }
 
-    public void setUpServerAndClient() throws Exception {
-        executorS = Executors.newSingleThreadScheduledExecutor();
-        storeS = setupPrimary(folder.newFolder("server"), executorS);
-
-        // client
-        executorC = Executors.newSingleThreadScheduledExecutor();
-        storeC = setupSecondary(folder.newFolder("client-1"), executorC);
-    }
-
-    private static FileStore newFileStore(File directory, ScheduledExecutorService executor) throws Exception {
-        return fileStoreBuilder(directory)
-                .withMaxFileSize(1)
-                .withMemoryMapping(false)
-                .withNodeDeduplicationCacheSize(1)
-                .withSegmentCacheSize(0)
-                .withStringCacheSize(0)
-                .withTemplateCacheSize(0)
-                .withStatisticsProvider(new DefaultStatisticsProvider(executor))
-                .build();
-    }
-
-    protected FileStore setupPrimary(File directory, ScheduledExecutorService executor) throws Exception {
-        return newFileStore(directory, executor);
-    }
-
-    protected FileStore getPrimary() {
-        return storeS;
+    public static int getServerPort() {
+        return port;
     }
 
-    protected FileStore setupSecondary(File directory, ScheduledExecutorService executor) throws Exception {
-        return newFileStore(directory, executor);
+    public static int getProxyPort() {
+        return proxyPort;
     }
 
-    protected FileStore getSecondary() {
-        return storeC;
+    public static String getServerHost() {
+        return "127.0.0.1";
     }
 
-    public void setUpServerAndTwoClients() throws Exception {
-        setUpServerAndClient();
-
-        executorC2 = Executors.newSingleThreadScheduledExecutor();
-        storeC2 = newFileStore(folder.newFolder("client-2"), executorC2);
-    }
-
-    public void closeServerAndClient() {
-        if (storeS != null) {
-            storeS.close();
-        }
-
-        if (storeC != null) {
-            storeC.close();
-        }
-
-        if (executorS != null) {
-            new ExecutorCloser(executorS).close();
-        }
-
-        if (executorC != null) {
-            new ExecutorCloser(executorC).close();
-        }
-    }
-
-    public void closeServerAndTwoClients() {
-        closeServerAndClient();
-
-        if (storeC2 != null) {
-            storeC2.close();
-        }
-
-        if (executorC2 != null) {
-            new ExecutorCloser(executorC2).close();
-        }
-    }
-
-    public static int getTestTimeout() {
+    public static int getClientTimeout() {
         return timeout;
     }
 
     public StandbyClientSync newStandbyClientSync(FileStore store) throws Exception {
-        return newStandbyClientSync(store, port, false);
+        return newStandbyClientSync(store, getServerPort(), false);
     }
 
     public StandbyClientSync newStandbyClientSync(FileStore store, int port) throws Exception {
@@ -158,7 +69,7 @@ public class TestBase {
     }
 
     public StandbyClientSync newStandbyClientSync(FileStore store, int port, boolean secure) throws Exception {
-        return new StandbyClientSync(LOCALHOST, port, store, secure, timeout, false);
+        return new StandbyClientSync(getServerHost(), port, store, secure, getClientTimeout(), false);
     }
 
 }

Added: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/test/TemporaryBlobStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/test/TemporaryBlobStore.java?rev=1765680&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/test/TemporaryBlobStore.java (added)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/test/TemporaryBlobStore.java Wed Oct 19 16:48:24 2016
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.oak.segment.test;
+
+import org.apache.jackrabbit.core.data.DataStoreException;
+import org.apache.jackrabbit.core.data.FileDataStore;
+import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
+import org.apache.jackrabbit.oak.spi.blob.BlobStore;
+import org.junit.rules.ExternalResource;
+import org.junit.rules.TemporaryFolder;
+
+public class TemporaryBlobStore extends ExternalResource {
+
+    private final TemporaryFolder folder;
+
+    private DataStoreBlobStore store;
+
+    public TemporaryBlobStore(TemporaryFolder folder) {
+        this.folder = folder;
+    }
+
+    @Override
+    protected void before() throws Throwable {
+        FileDataStore fds = new FileDataStore();
+        fds.setMinRecordLength(4092);
+        fds.init(folder.newFolder().getAbsolutePath());
+        store = new DataStoreBlobStore(fds);
+    }
+
+    @Override
+    protected void after() {
+        try {
+            store.close();
+        } catch (DataStoreException e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    public BlobStore blobStore() {
+        return store;
+    }
+
+}

Propchange: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/test/TemporaryBlobStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/test/TemporaryFileStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/test/TemporaryFileStore.java?rev=1765680&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/test/TemporaryFileStore.java (added)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/test/TemporaryFileStore.java Wed Oct 19 16:48:24 2016
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.oak.segment.test;
+
+import static org.apache.jackrabbit.oak.segment.file.FileStoreBuilder.fileStoreBuilder;
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+
+import org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser;
+import org.apache.jackrabbit.oak.segment.file.FileStore;
+import org.apache.jackrabbit.oak.segment.file.FileStoreBuilder;
+import org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider;
+import org.junit.rules.ExternalResource;
+import org.junit.rules.TemporaryFolder;
+
+public class TemporaryFileStore extends ExternalResource {
+
+    private final TemporaryFolder folder;
+
+    private final TemporaryBlobStore blobStore;
+
+    private ScheduledExecutorService executor;
+
+    private FileStore store;
+
+    public TemporaryFileStore(TemporaryFolder folder) {
+        this.folder = folder;
+        this.blobStore = null;
+    }
+
+    public TemporaryFileStore(TemporaryFolder folder, TemporaryBlobStore blobStore) {
+        this.folder = folder;
+        this.blobStore = blobStore;
+    }
+
+    @Override
+    protected void before() throws Throwable {
+        executor = Executors.newSingleThreadScheduledExecutor();
+        FileStoreBuilder builder = fileStoreBuilder(folder.newFolder())
+                .withMaxFileSize(1)
+                .withMemoryMapping(false)
+                .withNodeDeduplicationCacheSize(1)
+                .withSegmentCacheSize(0)
+                .withStringCacheSize(0)
+                .withTemplateCacheSize(0)
+                .withStatisticsProvider(new DefaultStatisticsProvider(executor));
+        if (blobStore != null) {
+            builder.withBlobStore(blobStore.blobStore());
+        }
+        store = builder.build();
+    }
+
+    @Override
+    protected void after() {
+        try {
+            store.close();
+        } finally {
+            new ExecutorCloser(executor).close();
+        }
+    }
+
+    public FileStore fileStore() {
+        return store;
+    }
+
+}

Propchange: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/test/TemporaryFileStore.java
------------------------------------------------------------------------------
    svn:eol-style = native