diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-03-20 10:10:14 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-03-20 10:10:14 +0100 |
commit | ac5b56dfcd1233eb2c6273ec94c3c4eebbea2461 (patch) | |
tree | 5ea44c85e922e943bdd39c69d3c09d54a55f0e66 /same/src | |
parent | 1a2497d1a6ab3c577faf81ca692c218bbdc33fa6 (diff) |
Add Broadcaster in Client.
Diffstat (limited to 'same/src')
5 files changed, 10 insertions, 8 deletions
diff --git a/same/src/main/java/com/orbekk/same/Client.java b/same/src/main/java/com/orbekk/same/Client.java index d4ec19e..7079016 100644 --- a/same/src/main/java/com/orbekk/same/Client.java +++ b/same/src/main/java/com/orbekk/same/Client.java @@ -24,6 +24,7 @@ public class Client implements DiscoveryListener { String masterUrl; private int masterId = -1; private MasterController masterController = null; + private Broadcaster broadcaster; private List<StateChangedListener> stateListeners = new ArrayList<StateChangedListener>(); @@ -134,10 +135,11 @@ public class Client implements DiscoveryListener { }; public Client(State state, ConnectionManager connections, - String myUrl) { + String myUrl, Broadcaster broadcaster) { this.state = state; this.connections = connections; this.myUrl = myUrl; + this.broadcaster = broadcaster; } public void start() { diff --git a/same/src/main/java/com/orbekk/same/SameController.java b/same/src/main/java/com/orbekk/same/SameController.java index a9b389c..ceeca73 100644 --- a/same/src/main/java/com/orbekk/same/SameController.java +++ b/same/src/main/java/com/orbekk/same/SameController.java @@ -77,7 +77,7 @@ public class SameController { // masterUrl, configuration.get("networkName")); Client client = new Client(clientState, connections, - clientUrl); + clientUrl, BroadcasterImpl.getDefaultBroadcastRunner()); PaxosServiceImpl paxos = new PaxosServiceImpl(""); DiscoveryService discoveryService = null; diff --git a/same/src/test/java/com/orbekk/same/ClientTest.java b/same/src/test/java/com/orbekk/same/ClientTest.java index d20b1d3..a94c039 100644 --- a/same/src/test/java/com/orbekk/same/ClientTest.java +++ b/same/src/test/java/com/orbekk/same/ClientTest.java @@ -17,7 +17,7 @@ public class ClientTest { private State state = new State("ClientNetwork"); private TestConnectionManager connections = new TestConnectionManager(); private Client client = new Client(state, connections, - "http://client/ClientService.json"); + "http://client/ClientService.json", null); private ClientService clientS = client.getService(); private MasterService mockMaster = mock(MasterService.class); diff --git a/same/src/test/java/com/orbekk/same/FunctionalTest.java b/same/src/test/java/com/orbekk/same/FunctionalTest.java index 215efd9..102ae14 100644 --- a/same/src/test/java/com/orbekk/same/FunctionalTest.java +++ b/same/src/test/java/com/orbekk/same/FunctionalTest.java @@ -41,7 +41,7 @@ public class FunctionalTest { Client newClient(String clientName, String clientUrl) { Client client = new Client(new State(clientName), connections, - clientUrl); + clientUrl, broadcaster); connections.clientMap.put(clientUrl, client.getService()); clients.add(client); return client; diff --git a/same/src/test/java/com/orbekk/same/MasterTest.java b/same/src/test/java/com/orbekk/same/MasterTest.java index ec0a56c..fb5a45c 100644 --- a/same/src/test/java/com/orbekk/same/MasterTest.java +++ b/same/src/test/java/com/orbekk/same/MasterTest.java @@ -61,7 +61,7 @@ public class MasterTest { public void clientJoin() { Client client = new Client( new State("ClientNetwork"), connections, - "http://client/ClientService.json"); + "http://client/ClientService.json", null); ClientService clientS = client.getService(); connections.clientMap.put("http://client/ClientService.json", clientS); client.joinNetwork("http://master/MasterService.json"); @@ -74,12 +74,12 @@ public class MasterTest { public void updateStateRequest() throws Exception { Client client1 = new Client( new State("ClientNetwork"), connections, - "http://client/ClientService.json"); + "http://client/ClientService.json", null); ClientService client1S = client1.getService(); connections.clientMap.put("http://client/ClientService.json", client1S); Client client2 = new Client( new State("ClientNetwork"), connections, - "http://client2/ClientService.json"); + "http://client2/ClientService.json", null); ClientService client2S = client2.getService(); connections.clientMap.put("http://client2/ClientService.json", client2S); @@ -109,7 +109,7 @@ public class MasterTest { public void masterRemovesParticipant() throws Exception { Client client = new Client( new State("ClientNetwork"), connections, - "http://client/ClientService.json"); + "http://client/ClientService.json", null); ClientService clientS = client.getService(); connections.clientMap.put("http://client/ClientService.json", clientS); client.joinNetwork("http://master/MasterService.json"); |