From 25a0948882d2e30af414778b9dc3e211bb17d0d2 Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Sun, 10 May 2015 10:36:00 +0100 Subject: [PATCH] removed @Ignore --- .../java/eg/TestNesterInterfaceMarshal.java | 1 - .../chronicle/map/StatelessClientTest.java | 3 +- .../map/TCPSocketReplicationTest.java | 1 - .../map/TcpTimeBasedReplicationSoakTest.java | 1 - ...esSpanningSeveralChunksReplicationHub.java | 56 ++++++++++++++++--- 5 files changed, 50 insertions(+), 12 deletions(-) diff --git a/src/test/java/eg/TestNesterInterfaceMarshal.java b/src/test/java/eg/TestNesterInterfaceMarshal.java index 7e39339f6..953314bde 100644 --- a/src/test/java/eg/TestNesterInterfaceMarshal.java +++ b/src/test/java/eg/TestNesterInterfaceMarshal.java @@ -25,7 +25,6 @@ public class TestNesterInterfaceMarshal { * @throws Exception */ @Test - public void testReplicatedMap() throws Exception { ChronicleMap chronicleMap = null; diff --git a/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java b/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java index ed6a93b22..84bea0da7 100644 --- a/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java +++ b/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java @@ -153,8 +153,7 @@ public class StatelessClientTest { } } - // TODO ignore why? - @Ignore + @Test(timeout = 10000) public void testBufferOverFlowPutAllAndEntrySet() throws IOException, InterruptedException { int port = s_port++; diff --git a/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationTest.java b/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationTest.java index a513c546b..4bd17c09b 100644 --- a/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationTest.java +++ b/src/test/java/net/openhft/chronicle/map/TCPSocketReplicationTest.java @@ -122,7 +122,6 @@ public class TCPSocketReplicationTest { assertTrue(!map1.isEmpty()); } - @Ignore("todo fix : failed on TC") @Test public void test2() throws IOException, InterruptedException { diff --git a/src/test/java/net/openhft/chronicle/map/TcpTimeBasedReplicationSoakTest.java b/src/test/java/net/openhft/chronicle/map/TcpTimeBasedReplicationSoakTest.java index 208972d8a..7d7ff6292 100644 --- a/src/test/java/net/openhft/chronicle/map/TcpTimeBasedReplicationSoakTest.java +++ b/src/test/java/net/openhft/chronicle/map/TcpTimeBasedReplicationSoakTest.java @@ -101,7 +101,6 @@ public class TcpTimeBasedReplicationSoakTest { } - @Ignore @Test public void testSoakTestWithRandomData() throws IOException, InterruptedException { diff --git a/src/test/java/net/openhft/chronicle/map/TestEntriesSpanningSeveralChunksReplicationHub.java b/src/test/java/net/openhft/chronicle/map/TestEntriesSpanningSeveralChunksReplicationHub.java index 2b8dcb847..851707e41 100644 --- a/src/test/java/net/openhft/chronicle/map/TestEntriesSpanningSeveralChunksReplicationHub.java +++ b/src/test/java/net/openhft/chronicle/map/TestEntriesSpanningSeveralChunksReplicationHub.java @@ -3,9 +3,8 @@ package net.openhft.chronicle.map; import net.openhft.chronicle.hash.replication.ReplicationChannel; import net.openhft.chronicle.hash.replication.ReplicationHub; import net.openhft.chronicle.hash.replication.TcpTransportAndNetworkConfig; -import net.openhft.lang.model.constraints.MaxSize; -import net.openhft.lang.values.DoubleArray; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import java.io.IOException; @@ -22,6 +21,8 @@ import static org.junit.Assert.assertEquals; */ public class TestEntriesSpanningSeveralChunksReplicationHub { + + @Ignore("performacne test") @Test public void testReplicationHubHandlesSpanningSeveralChunksEntries() throws IOException, InterruptedException { @@ -137,6 +138,8 @@ public class TestEntriesSpanningSeveralChunksReplicationHub { final HashMap map1 = new HashMap<>(); final HashMap map2 = new HashMap<>(); + ReplicationHub hubOnServer1; + ReplicationHub hubOnServer2; // server 1 with identifier = 1 { @@ -149,9 +152,9 @@ public class TestEntriesSpanningSeveralChunksReplicationHub { byte identifier = (byte) 1; TcpTransportAndNetworkConfig tcpConfig = TcpTransportAndNetworkConfig - .of(8053); + .of(8059); - ReplicationHub hubOnServer1 = ReplicationHub.builder() + hubOnServer1 = ReplicationHub.builder() .tcpTransportAndNetwork(tcpConfig) .maxNumberOfChannels(NUMBER_OF_CHANNELS) .createWithId(identifier); @@ -177,15 +180,15 @@ public class TestEntriesSpanningSeveralChunksReplicationHub { byte identifier = (byte) 2; TcpTransportAndNetworkConfig tcpConfig = TcpTransportAndNetworkConfig - .of(8054, new InetSocketAddress("localhost", 8053)); + .of(8054, new InetSocketAddress("localhost", 8059)); - ReplicationHub hubOnServer1 = ReplicationHub.builder() + hubOnServer2 = ReplicationHub.builder() .tcpTransportAndNetwork(tcpConfig) .maxNumberOfChannels(NUMBER_OF_CHANNELS) .createWithId(identifier); for (short channelId = 1; channelId < NUMBER_OF_CHANNELS; channelId++) { - ReplicationChannel channel = hubOnServer1.createChannel(channelId); + ReplicationChannel channel = hubOnServer2.createChannel(channelId); ChronicleMap map = builder.instance().replicatedViaChannel(channel).create(); map.put("key", channelId); @@ -224,11 +227,50 @@ public class TestEntriesSpanningSeveralChunksReplicationHub { Assert.assertEquals(channelId, v1.get("key")); Assert.assertEquals(channelId, v2.get("key")); + v1.put("key2", (short) 1); + v2.put("key2", (short) 1); break; } } + + // check that the maps are the same, if the are not the same the test will timeout + // we have to give a few seconds for the replication to propagate + for (short channelId = 1; channelId < NUMBER_OF_CHANNELS; channelId++) { + // allow time for the recompilation to resolve + + final ChronicleMap v1 = map1.get(channelId); + final ChronicleMap v2 = map2.get(channelId); + + for (; ; ) { + + + if (v1 == null || v2 == null) { + Thread.sleep(10); + continue; + } + + if (v1.isEmpty() || v2.isEmpty()) { + Thread.sleep(10); + continue; + } + + if (!v1.equals(v2)) { + Thread.sleep(10); + continue; + } + + + Assert.assertEquals((short)1, v1.get("key2")); + Assert.assertEquals((short)1, v2.get("key2")); + + break; + } + + } + + // close for (short channelId = 1; channelId < NUMBER_OF_CHANNELS; channelId++) {