summaryrefslogtreecommitdiff
path: root/same/src
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-02-06 14:33:08 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-02-06 14:33:08 +0100
commit0ac907ad19d62cc773f6f13f74af52bd75f0b5db (patch)
treea44f26d49c9dd12afb8e27a76e38baad6fdb5f2f /same/src
parent34366d7ae525d28ef153ad6059779d9cef3952c6 (diff)
Fix failing tests.
Tests were failing because of URL problems after refactoring.
Diffstat (limited to 'same/src')
-rw-r--r--same/src/main/java/com/orbekk/same/MasterServiceImpl.java2
-rw-r--r--same/src/test/java/com/orbekk/same/MasterServiceImplTest.java9
2 files changed, 6 insertions, 5 deletions
diff --git a/same/src/main/java/com/orbekk/same/MasterServiceImpl.java b/same/src/main/java/com/orbekk/same/MasterServiceImpl.java
index c0df078..7e25fc1 100644
--- a/same/src/main/java/com/orbekk/same/MasterServiceImpl.java
+++ b/same/src/main/java/com/orbekk/same/MasterServiceImpl.java
@@ -26,7 +26,7 @@ public class MasterServiceImpl implements MasterService, Runnable {
/** Constructor for internal use.
*/
- private MasterServiceImpl(State initialState, ConnectionManager connections,
+ MasterServiceImpl(State initialState, ConnectionManager connections,
Broadcaster broadcaster) {
this.state = initialState;
this.connections = connections;
diff --git a/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java b/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java
index d5126b6..cc89054 100644
--- a/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java
+++ b/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java
@@ -12,8 +12,7 @@ public class MasterServiceImplTest {
private State state = new State("TestNetwork");
private TestConnectionManager connections = new TestConnectionManager();
private TestBroadcaster broadcaster = new TestBroadcaster();
- private MasterServiceImpl master = MasterServiceImpl.create(
- connections, broadcaster, "http://master/MasterService.json");
+ private MasterServiceImpl master;
public static class UnreachableClient implements ClientService {
@Override
@@ -36,6 +35,8 @@ public class MasterServiceImplTest {
@Before
public void setUp() {
+ state.update(".masterUrl", "http://master/MasterService.json", 1);
+ master = new MasterServiceImpl(state, connections, broadcaster);
connections.masterMap.put("http://master/MasterService.json", master);
}
@@ -70,7 +71,7 @@ public class MasterServiceImplTest {
"http://client/ClientService.json");
ClientService clientS = client.getService();
connections.clientMap.put("http://client/ClientService.json", clientS);
- client.joinNetwork("http://master");
+ client.joinNetwork("http://master/MasterService.json");
assertTrue(master._performWork());
assertTrue(state.getList(".participants").contains("http://client/ClientService.json"));
assertEquals(state, client.testGetState());
@@ -118,7 +119,7 @@ public class MasterServiceImplTest {
"http://client/ClientService.json");
ClientService clientS = client.getService();
connections.clientMap.put("http://client/ClientService.json", clientS);
- client.joinNetwork("http://master");
+ client.joinNetwork("http://master/MasterService.json");
assertTrue(master._performWork());
assertTrue(state.getList(".participants").contains("http://client/ClientService.json"));