From f1ecdc937af42ce524bf269a3e87aa93e815b9aa Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Mon, 22 Dec 2014 19:52:36 +0000 Subject: [PATCH] updated test case --- .../chronicle/map/TcpReplicationSoakTest.java | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/test/java/net/openhft/chronicle/map/TcpReplicationSoakTest.java b/src/test/java/net/openhft/chronicle/map/TcpReplicationSoakTest.java index cf2365f1f..0a29d0892 100644 --- a/src/test/java/net/openhft/chronicle/map/TcpReplicationSoakTest.java +++ b/src/test/java/net/openhft/chronicle/map/TcpReplicationSoakTest.java @@ -29,7 +29,7 @@ public class TcpReplicationSoakTest { private ChronicleMap map1; private ChronicleMap map2; private IntValue value; - static int s_port = 8010; + static int s_port = 8093; @Before public void setup() throws IOException { @@ -100,30 +100,34 @@ public class TcpReplicationSoakTest { @Test public void testSoakTestWithRandomData() throws IOException, InterruptedException { + try { + System.out.print("SoakTesting "); + for (int j = 1; j < 2 * Builder.SIZE; j++) { + if (j % 1000 == 0) + System.out.print("."); + Random rnd = new Random(j); + for (int i = 1; i < 10; i++) { + final int select = rnd.nextInt(2); + final ChronicleMap map = select > 0 ? map1 : map2; - System.out.print("SoakTesting "); - for (int j = 1; j < 2 * Builder.SIZE; j++) { - if (j % 1000 == 0) - System.out.print("."); - Random rnd = new Random(j); - for (int i = 1; i < 10; i++) { - final int select = rnd.nextInt(2); - final ChronicleMap map = select > 0 ? map1 : map2; - - if (rnd.nextBoolean()) { - map.put(rnd.nextInt(Builder.SIZE), "test" + j); - } else { - map.remove(rnd.nextInt(Builder.SIZE)); + if (rnd.nextBoolean()) { + map.put(rnd.nextInt(Builder.SIZE), "test" + j); + } else { + map.remove(rnd.nextInt(Builder.SIZE)); + } } } + + System.out.println("\nwaiting till equal"); + + waitTillEqual(15000); + + Assert.assertEquals(map1, map2); + } finally { + map1.close(); + map2.close(); } - System.out.println("\nwaiting till equal"); - - waitTillEqual(15000); - - Assert.assertEquals(map1, map2); - }