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 ba...@apache.org on 2014/12/19 12:50:29 UTC

svn commit: r1646684 - in /jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby: DataStoreTestBase.java ExternalPrivateStoreIT.java ExternalSharedStoreIT.java MBeanTest.java

Author: baedke
Date: Fri Dec 19 11:50:29 2014
New Revision: 1646684

URL: http://svn.apache.org/r1646684
Log:
OAK-2372: TARMK Cold Standby improve test cases for FSDS mirroring

Added:
    jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/DataStoreTestBase.java
Modified:
    jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/ExternalPrivateStoreIT.java
    jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/ExternalSharedStoreIT.java
    jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/MBeanTest.java

Added: jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/DataStoreTestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/DataStoreTestBase.java?rev=1646684&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/DataStoreTestBase.java (added)
+++ jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/DataStoreTestBase.java Fri Dec 19 11:50:29 2014
@@ -0,0 +1,204 @@
+/*
+ * 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.plugins.segment.standby;
+
+import com.google.common.io.ByteStreams;
+import org.apache.jackrabbit.core.data.FileDataStore;
+import org.apache.jackrabbit.oak.api.Blob;
+import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
+import org.apache.jackrabbit.oak.plugins.segment.NetworkErrorProxy;
+import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore;
+import org.apache.jackrabbit.oak.plugins.segment.file.FileStore;
+import org.apache.jackrabbit.oak.plugins.segment.standby.client.StandbyClient;
+import org.apache.jackrabbit.oak.plugins.segment.standby.server.StandbyServer;
+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.Before;
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.Random;
+
+import static org.apache.jackrabbit.oak.plugins.segment.SegmentTestUtils.addTestContent;
+import static org.junit.Assert.*;
+
+public class DataStoreTestBase extends TestBase {
+    final static int PROXY_PORT = 4711;
+    protected boolean storesCanBeEqual = false;
+
+    @Before
+    public void setUp() throws Exception {
+        setUpServerAndClient();
+    }
+
+    protected FileStore setupFileDataStore(File d, String path) throws IOException {
+        FileDataStore fds = new FileDataStore();
+        fds.setMinRecordLength(4092);
+        fds.init(path);
+        DataStoreBlobStore blobStore = new DataStoreBlobStore(fds);
+        return new FileStore(blobStore, d, 1, false);
+    }
+
+    protected byte[] addTestContent(NodeStore store, String child, int size)
+            throws CommitFailedException, IOException {
+        NodeBuilder builder = store.getRoot().builder();
+        builder.child(child).setProperty("ts", System.currentTimeMillis());
+
+        byte[] data = new byte[size];
+        new Random().nextBytes(data);
+        Blob blob = store.createBlob(new ByteArrayInputStream(data));
+
+        builder.child(child).setProperty("testBlob", blob);
+
+        store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
+        return data;
+    }
+
+    @Test
+    public void testSync() throws Exception {
+        final int mb = 1 * 1024 * 1024;
+        final int blobSize = 5 * mb;
+        FileStore primary = getPrimary();
+        FileStore secondary = getSecondary();
+
+        NodeStore store = new SegmentNodeStore(primary);
+        final StandbyServer server = new StandbyServer(getPort(), primary);
+        server.start();
+        byte[] data = addTestContent(store, "server", blobSize);
+
+        StandbyClient cl = new StandbyClient("127.0.0.1", getPort(), secondary);
+        cl.run();
+
+        try {
+            assertEquals(primary.getHead(), secondary.getHead());
+        } finally {
+            server.close();
+            cl.close();
+        }
+
+        assertTrue(primary.size() < mb);
+        assertTrue(secondary.size() < mb);
+
+        PropertyState ps = secondary.getHead().getChildNode("root")
+                .getChildNode("server").getProperty("testBlob");
+        assertNotNull(ps);
+        assertEquals(Type.BINARY.tag(), ps.getType().tag());
+        Blob b = ps.getValue(Type.BINARY);
+        assertEquals(blobSize, b.length());
+        byte[] testData = new byte[blobSize];
+        ByteStreams.readFully(b.getNewStream(), testData);
+        assertArrayEquals(data, testData);
+    }
+
+    @Test
+    public void testProxySkippedBytes() throws Exception {
+        useProxy(100, 1, -1, false);
+    }
+
+    @Test
+    public void testProxySkippedBytesIntermediateChange() throws Exception {
+        useProxy(100, 1, -1, true);
+    }
+
+    @Test
+    public void testProxyFlippedStartByte() throws Exception {
+        useProxy(0, 0, 0, false);
+    }
+
+    @Test
+    public void testProxyFlippedIntermediateByte() throws Exception {
+        useProxy(0, 0, 150, false);
+    }
+
+    @Test
+    public void testProxyFlippedIntermediateByte2() throws Exception {
+        useProxy(0, 0, 150000, false);
+    }
+
+    @Test
+    public void testProxyFlippedIntermediateByteChange() throws Exception {
+        useProxy(0, 0, 150, true);
+    }
+
+    @Test
+    public void testProxyFlippedIntermediateByteChange2() throws Exception {
+        useProxy(0, 0, 150000, true);
+    }
+
+
+    private void useProxy(int skipPosition, int skipBytes, int flipPosition, boolean intermediateChange) throws Exception {
+        final int mb = 1 * 1024 * 1024;
+        int blobSize = 5 * mb;
+        FileStore primary = getPrimary();
+        FileStore secondary = getSecondary();
+
+        NetworkErrorProxy p = new NetworkErrorProxy(PROXY_PORT, LOCALHOST, port);
+        p.skipBytes(skipPosition, skipBytes);
+        p.flipByte(flipPosition);
+        p.run();
+
+        NodeStore store = new SegmentNodeStore(primary);
+        final StandbyServer server = new StandbyServer(getPort(), primary);
+        server.start();
+        byte[] data = addTestContent(store, "server", blobSize);
+
+        StandbyClient cl = new StandbyClient("127.0.0.1", PROXY_PORT, secondary);
+        cl.run();
+
+        try {
+            if (skipBytes > 0 || flipPosition >= 0) {
+                if (!this.storesCanBeEqual) {
+                    assertFalse("stores are not expected to be equal", primary.getHead().equals(secondary.getHead()));
+                }
+                p.reset();
+                if (intermediateChange) {
+                    blobSize = 2 * mb;
+                    data = addTestContent(store, "server", blobSize);
+                }
+                cl.run();
+            }
+            assertEquals(primary.getHead(), secondary.getHead());
+        } finally {
+            server.close();
+            cl.close();
+            p.close();
+        }
+
+        assertTrue(primary.size() < mb);
+        assertTrue(secondary.size() < mb);
+
+        PropertyState ps = secondary.getHead().getChildNode("root")
+                .getChildNode("server").getProperty("testBlob");
+        assertNotNull(ps);
+        assertEquals(Type.BINARY.tag(), ps.getType().tag());
+        Blob b = ps.getValue(Type.BINARY);
+        assertEquals(blobSize, b.length());
+        byte[] testData = new byte[blobSize];
+        ByteStreams.readFully(b.getNewStream(), testData);
+        assertArrayEquals(data, testData);
+    }
+}

Modified: jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/ExternalPrivateStoreIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/ExternalPrivateStoreIT.java?rev=1646684&r1=1646683&r2=1646684&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/ExternalPrivateStoreIT.java (original)
+++ jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/ExternalPrivateStoreIT.java Fri Dec 19 11:50:29 2014
@@ -1,152 +1,59 @@
-/*
- * 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.plugins.segment.standby;
-
-import static org.apache.jackrabbit.oak.plugins.segment.SegmentTestUtils.createTmpTargetDir;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.util.Random;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.jackrabbit.core.data.FileDataStore;
-import org.apache.jackrabbit.oak.api.Blob;
-import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.api.Type;
-import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
-import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore;
-import org.apache.jackrabbit.oak.plugins.segment.file.FileStore;
-import org.apache.jackrabbit.oak.plugins.segment.standby.client.StandbyClient;
-import org.apache.jackrabbit.oak.plugins.segment.standby.server.StandbyServer;
-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.Test;
-
-import com.google.common.io.ByteStreams;
-
-public class ExternalPrivateStoreIT extends TestBase {
-
-    private File primaryStore;
-    private File secondaryStore;
-
-    @Before
-    public void setUp() throws Exception {
-        setUpServerAndClient();
-    }
-
-    @After
-    public void after() {
-        closeServerAndClient();
-        try {
-            FileUtils.deleteDirectory(primaryStore);
-            FileUtils.deleteDirectory(secondaryStore);
-        } catch (IOException e) {
-        }
-    }
-
-    @Override
-    protected FileStore setupPrimary(File d) throws IOException {
-        primaryStore = getPrimaryStoreDir();
-        FileDataStore fds = new FileDataStore();
-        fds.setMinRecordLength(4092);
-        fds.init(primaryStore.getAbsolutePath());
-        DataStoreBlobStore blobStore = new DataStoreBlobStore(fds);
-        return new FileStore(blobStore, d, 1, false);
-    }
-
-    private static File getPrimaryStoreDir() throws IOException {
-        return createTmpTargetDir("ExternalStoreITPrimary");
-    }
-
-    @Override
-    protected FileStore setupSecondary(File d) throws IOException {
-        secondaryStore = getSecondaryStoreDir();
-        FileDataStore fds = new FileDataStore();
-        fds.setMinRecordLength(4092);
-        fds.init(secondaryStore.getAbsolutePath());
-        DataStoreBlobStore blobStore = new DataStoreBlobStore(fds);
-        return new FileStore(blobStore, d, 1, false);
-    }
-
-    private static File getSecondaryStoreDir() throws IOException {
-        return createTmpTargetDir("ExternalStoreITSecondary");
-    }
-
-    @Test
-    public void testSync() throws Exception {
-        final int mb = 1 * 1024 * 1024;
-        final int blobSize = 5 * mb;
-        FileStore primary = getPrimary();
-        FileStore secondary = getSecondary();
-
-        NodeStore store = new SegmentNodeStore(primary);
-        final StandbyServer server = new StandbyServer(getPort(), primary);
-        server.start();
-        byte[] data = addTestContent(store, "server", blobSize);
-
-        StandbyClient cl = new StandbyClient("127.0.0.1", getPort(), secondary);
-        cl.run();
-
-        try {
-            assertEquals(primary.getHead(), secondary.getHead());
-        } finally {
-            server.close();
-            cl.close();
-        }
-
-        assertTrue(primary.size() < mb);
-        assertTrue(secondary.size() < mb);
-
-        PropertyState ps = secondary.getHead().getChildNode("root")
-                .getChildNode("server").getProperty("testBlob");
-        assertNotNull(ps);
-        assertEquals(Type.BINARY.tag(), ps.getType().tag());
-        Blob b = ps.getValue(Type.BINARY);
-        assertEquals(blobSize, b.length());
-        byte[] testData = new byte[blobSize];
-        ByteStreams.readFully(b.getNewStream(), testData);
-        assertArrayEquals(data, testData);
-    }
-
-    private static byte[] addTestContent(NodeStore store, String child, int size)
-            throws CommitFailedException, IOException {
-        NodeBuilder builder = store.getRoot().builder();
-        builder.child(child).setProperty("ts", System.currentTimeMillis());
-
-        byte[] data = new byte[size];
-        new Random().nextBytes(data);
-        Blob blob = store.createBlob(new ByteArrayInputStream(data));
-
-        builder.child(child).setProperty("testBlob", blob);
-
-        store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
-        return data;
-    }
-
-}
+/*
+ * 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.plugins.segment.standby;
+
+import static org.apache.jackrabbit.oak.plugins.segment.SegmentTestUtils.createTmpTargetDir;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.jackrabbit.oak.plugins.segment.file.FileStore;
+
+import org.junit.After;
+
+
+public class ExternalPrivateStoreIT extends DataStoreTestBase {
+
+    private File primaryStore;
+    private File secondaryStore;
+
+    @After
+    public void after() {
+        closeServerAndClient();
+        try {
+            FileUtils.deleteDirectory(primaryStore);
+            FileUtils.deleteDirectory(secondaryStore);
+        } catch (IOException e) {
+        }
+    }
+
+    @Override
+    protected FileStore setupPrimary(File d) throws IOException {
+        primaryStore = createTmpTargetDir("ExternalStoreITPrimary");
+        return setupFileDataStore(d, primaryStore.getAbsolutePath());
+    }
+
+    @Override
+    protected FileStore setupSecondary(File d) throws IOException {
+        secondaryStore = createTmpTargetDir("ExternalStoreITSecondary");
+        return setupFileDataStore(d, secondaryStore.getAbsolutePath());
+    }
+
+}

Modified: jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/ExternalSharedStoreIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/ExternalSharedStoreIT.java?rev=1646684&r1=1646683&r2=1646684&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/ExternalSharedStoreIT.java (original)
+++ jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/ExternalSharedStoreIT.java Fri Dec 19 11:50:29 2014
@@ -1,145 +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.plugins.segment.standby;
-
-import static org.apache.jackrabbit.oak.plugins.segment.SegmentTestUtils.createTmpTargetDir;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.util.Random;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.jackrabbit.core.data.FileDataStore;
-import org.apache.jackrabbit.oak.api.Blob;
-import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.api.Type;
-import org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore;
-import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore;
-import org.apache.jackrabbit.oak.plugins.segment.file.FileStore;
-import org.apache.jackrabbit.oak.plugins.segment.standby.client.StandbyClient;
-import org.apache.jackrabbit.oak.plugins.segment.standby.server.StandbyServer;
-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.Test;
-
-import com.google.common.io.ByteStreams;
-
-public class ExternalSharedStoreIT extends TestBase {
-
-    private File externalStore;
-
-    @Before
-    public void setUp() throws Exception {
-        setUpServerAndClient();
-    }
-
-    @After
-    public void after() {
-        closeServerAndClient();
-        try {
-            FileUtils.deleteDirectory(externalStore);
-        } catch (IOException e) {
-        }
-    }
-
-    @Override
-    protected FileStore setupPrimary(File d) throws IOException {
-        externalStore = getPrimaryStoreDir();
-        FileDataStore fds = new FileDataStore();
-        fds.setMinRecordLength(4092);
-        fds.init(externalStore.getAbsolutePath());
-        DataStoreBlobStore blobStore = new DataStoreBlobStore(fds);
-        return new FileStore(blobStore, d, 1, false);
-    }
-
-    private static File getPrimaryStoreDir() throws IOException {
-        return createTmpTargetDir("ExternalCommonStoreIT");
-    }
-
-    @Override
-    protected FileStore setupSecondary(File d) throws IOException {
-        FileDataStore fds = new FileDataStore();
-        fds.setMinRecordLength(4092);
-        fds.init(externalStore.getAbsolutePath());
-        DataStoreBlobStore blobStore = new DataStoreBlobStore(fds);
-        return new FileStore(blobStore, d, 1, false);
-    }
-
-    @Test
-    public void testSync() throws Exception {
-        final int mb = 1 * 1024 * 1024;
-        final int blobSize = 5 * mb;
-        FileStore primary = getPrimary();
-        FileStore secondary = getSecondary();
-
-        NodeStore store = new SegmentNodeStore(primary);
-        final StandbyServer server = new StandbyServer(getPort(), primary);
-        server.start();
-        byte[] data = addTestContent(store, "server", blobSize);
-
-        StandbyClient cl = new StandbyClient("127.0.0.1", getPort(), secondary);
-        cl.run();
-
-        try {
-            assertEquals(primary.getHead(), secondary.getHead());
-        } finally {
-            server.close();
-            cl.close();
-        }
-
-        assertTrue(primary.size() < mb);
-        assertTrue(secondary.size() < mb);
-
-        PropertyState ps = secondary.getHead().getChildNode("root")
-                .getChildNode("server").getProperty("testBlob");
-        assertNotNull(ps);
-        assertEquals(Type.BINARY.tag(), ps.getType().tag());
-        Blob b = ps.getValue(Type.BINARY);
-        assertEquals(blobSize, b.length());
-        byte[] testData = new byte[blobSize];
-        ByteStreams.readFully(b.getNewStream(), testData);
-        assertArrayEquals(data, testData);
-    }
-
-    private static byte[] addTestContent(NodeStore store, String child, int size)
-            throws CommitFailedException, IOException {
-        NodeBuilder builder = store.getRoot().builder();
-        builder.child(child).setProperty("ts", System.currentTimeMillis());
-
-        byte[] data = new byte[size];
-        new Random().nextBytes(data);
-        Blob blob = store.createBlob(new ByteArrayInputStream(data));
-
-        builder.child(child).setProperty("testBlob", blob);
-
-        store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
-        return data;
-    }
-
-}
+/*
+ * 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.plugins.segment.standby;
+
+import static org.apache.jackrabbit.oak.plugins.segment.SegmentTestUtils.createTmpTargetDir;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.jackrabbit.oak.plugins.segment.file.FileStore;
+
+import org.junit.After;
+
+public class ExternalSharedStoreIT extends DataStoreTestBase {
+    private File externalStore;
+
+    public ExternalSharedStoreIT() {
+        super();
+        this.storesCanBeEqual = true;
+    }
+
+    @After
+    public void after() {
+        closeServerAndClient();
+        try {
+            FileUtils.deleteDirectory(externalStore);
+        } catch (IOException e) {
+        }
+    }
+
+    @Override
+    protected FileStore setupPrimary(File d) throws IOException {
+        externalStore = createTmpTargetDir("ExternalCommonStoreIT");
+        return setupFileDataStore(d, externalStore.getAbsolutePath());
+    }
+
+    @Override
+    protected FileStore setupSecondary(File d) throws IOException {
+        return setupFileDataStore(d, externalStore.getAbsolutePath());
+    }
+}

Modified: jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/MBeanTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/MBeanTest.java?rev=1646684&r1=1646683&r2=1646684&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/MBeanTest.java (original)
+++ jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/standby/MBeanTest.java Fri Dec 19 11:50:29 2014
@@ -60,10 +60,10 @@ public class MBeanTest extends TestBase
             assertEquals(new ObjectName(server.getMBeanName()), status);
             assertTrue(jmxServer.isRegistered(status));
 
-            assertEquals("master", jmxServer.getAttribute(status, "Mode"));
+            assertEquals("primary", jmxServer.getAttribute(status, "Mode"));
             String m = jmxServer.getAttribute(status, "Status").toString();
             if (!m.equals(StandbyStatusMBean.STATUS_STARTING) && !m.equals("channel unregistered"))
-                fail("unexpected Status" + m);
+                fail("unexpected Status " + m);
 
             assertEquals(StandbyStatusMBean.STATUS_STARTING, jmxServer.getAttribute(status, "Status"));
             assertEquals(true, jmxServer.getAttribute(status, "Running"));
@@ -73,7 +73,7 @@ public class MBeanTest extends TestBase
             jmxServer.invoke(status, "start", null, null);
 
             assertEquals(true, jmxServer.getAttribute(status, "Running"));
-            assertEquals(StandbyStatusMBean.STATUS_STARTING, jmxServer.getAttribute(status, "Status"));
+            assertEquals(StandbyStatusMBean.STATUS_RUNNING, jmxServer.getAttribute(status, "Status"));
         } finally {
             server.close();
         }
@@ -98,10 +98,10 @@ public class MBeanTest extends TestBase
             String m = jmxServer.getAttribute(status, "Mode").toString();
             if (!m.startsWith("client: ")) fail("unexpected mode " + m);
 
-            assertEquals("1", jmxServer.getAttribute(status, "FailedRequests").toString());
+            assertEquals("0", jmxServer.getAttribute(status, "FailedRequests").toString());
             assertEquals("-1", jmxServer.getAttribute(status, "SecondsSinceLastSuccess").toString());
 
-            assertEquals(StandbyStatusMBean.STATUS_STOPPED, jmxServer.getAttribute(status, "Status"));
+            assertEquals(StandbyStatusMBean.STATUS_INITIALIZING, jmxServer.getAttribute(status, "Status"));
 
             assertEquals(false, jmxServer.getAttribute(status, "Running"));
             jmxServer.invoke(status, "stop", null, null);