diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-16 21:16:34 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-16 21:16:34 +0100 |
commit | 489cd721117cdc5b66bbe3bc180bdfab7aaae301 (patch) | |
tree | d996bf9c7349490f906370cb576d04564d595640 /same/src/test/java | |
parent | 7a05213bc091688d5330212e9c785005ccb147b5 (diff) |
Fix network joining.
Prevent infinite loop in master thread.
Diffstat (limited to 'same/src/test/java')
3 files changed, 4 insertions, 52 deletions
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<String> 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<String> 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<String, ClientService> clientMap = - new HashMap<String, ClientService>(); - public Map<String, MasterService> masterMap = - new HashMap<String, MasterService>(); - - public TestConnectionManager() { - } - - public ClientService getClient(String url) { - return clientMap.get(url); - } - - public MasterService getMaster(String url) { - return masterMap.get(url); - } -} |