From 489cd721117cdc5b66bbe3bc180bdfab7aaae301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Mon, 16 Jan 2012 21:16:34 +0100 Subject: Fix network joining. Prevent infinite loop in master thread. --- .../com/orbekk/same/MasterServiceImplTest.java | 8 ++++---- .../test/java/com/orbekk/same/TestBroadcaster.java | 24 ---------------------- .../com/orbekk/same/TestConnectionManager.java | 24 ---------------------- 3 files changed, 4 insertions(+), 52 deletions(-) delete mode 100644 same/src/test/java/com/orbekk/same/TestBroadcaster.java delete mode 100644 same/src/test/java/com/orbekk/same/TestConnectionManager.java (limited to 'same/src/test/java') diff --git a/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java b/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java index da45e38..583e464 100644 --- a/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java +++ b/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java @@ -34,7 +34,7 @@ public class MasterServiceImplTest { @Test public void joinNetworkAddsClient() { - master.joinNetworkRequest("TestNetwork", "http://clientUrl"); + master.joinNetworkRequest("http://clientUrl"); List participants = state.getList(".participants"); assertTrue(participants.contains("http://clientUrl")); } @@ -53,7 +53,7 @@ public class MasterServiceImplTest { new State("ClientNetwork"), connections); client.setUrl("http://client/"); connections.clientMap.put("http://client/ClientService.json", client); - master.joinNetworkRequest("TestNetwork", "http://client/ClientService.json"); + master.joinNetworkRequest("http://client/ClientService.json"); assertTrue(master._performWork()); assertTrue(state.getList(".participants").contains("http://client/ClientService.json")); assertEquals(state, client.testGetState()); @@ -71,8 +71,8 @@ public class MasterServiceImplTest { client1.setUrl("http://client2/"); connections.clientMap.put("http://client2/ClientService.json", client2); - master.joinNetworkRequest("TestNetwork", "http://client/ClientService.json"); - master.joinNetworkRequest("TestNetwork", "http://client2/ClientService.json"); + master.joinNetworkRequest("http://client/ClientService.json"); + master.joinNetworkRequest("http://client2/ClientService.json"); assertTrue(master._performWork()); assertTrue(state.getList(".participants").contains("http://client/ClientService.json")); diff --git a/same/src/test/java/com/orbekk/same/TestBroadcaster.java b/same/src/test/java/com/orbekk/same/TestBroadcaster.java deleted file mode 100644 index 434b107..0000000 --- a/same/src/test/java/com/orbekk/same/TestBroadcaster.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.orbekk.same; - -import java.util.List; -import org.junit.Ignore; - -@Ignore -public class TestBroadcaster implements Broadcaster { - public ConnectionManager connections; - - public TestBroadcaster() { - } - - public TestBroadcaster(ConnectionManager connections) { - this.connections = connections; - } - - public void broadcast(final List targets, - final ServiceOperation operation) { - for (String t : targets) { - ClientService client = connections.getClient(t); - operation.run(client); - } - } -} diff --git a/same/src/test/java/com/orbekk/same/TestConnectionManager.java b/same/src/test/java/com/orbekk/same/TestConnectionManager.java deleted file mode 100644 index a41ec48..0000000 --- a/same/src/test/java/com/orbekk/same/TestConnectionManager.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.orbekk.same; - -import java.util.Map; -import java.util.HashMap; -import org.junit.Ignore; - -@Ignore -public class TestConnectionManager implements ConnectionManager { - public Map clientMap = - new HashMap(); - public Map masterMap = - new HashMap(); - - public TestConnectionManager() { - } - - public ClientService getClient(String url) { - return clientMap.get(url); - } - - public MasterService getMaster(String url) { - return masterMap.get(url); - } -} -- cgit v1.2.3