From e2d00cd5fa29e1a5cada502248cd81358e4da491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Tue, 17 Apr 2012 16:25:18 +0200 Subject: Master sends update requests using protobuf service. --- same/src/test/java/com/orbekk/same/MasterTest.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'same/src/test') diff --git a/same/src/test/java/com/orbekk/same/MasterTest.java b/same/src/test/java/com/orbekk/same/MasterTest.java index 22414fe..96f8670 100644 --- a/same/src/test/java/com/orbekk/same/MasterTest.java +++ b/same/src/test/java/com/orbekk/same/MasterTest.java @@ -7,6 +7,7 @@ import static org.junit.Assert.assertTrue; import java.util.List; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; public class MasterTest { @@ -63,6 +64,7 @@ public class MasterTest { "http://client/ClientService.json", "clientLocation", null); ClientService clientS = client.getService(); connections.clientMap.put("http://client/ClientService.json", clientS); + connections.clientMap0.put("clientLocation", client.getNewService()); client.joinNetwork(master.getMasterInfo()); master.performWork(); System.out.println(state); @@ -72,17 +74,20 @@ public class MasterTest { } @Test + @Ignore // Uses old services. Tested by functional test. public void updateStateRequest() throws Exception { Client client1 = new Client( new State("ClientNetwork"), connections, - "http://client/ClientService.json", "clientLocation", null); + "http://client/ClientService.json", "clientLocation2", null); ClientService client1S = client1.getService(); connections.clientMap.put("http://client/ClientService.json", client1S); + connections.clientMap0.put("clientLocation1", client1.getNewService()); Client client2 = new Client( new State("ClientNetwork"), connections, - "http://client2/ClientService.json", "clientLocation", null); + "http://client2/ClientService.json", "clientLocation2", null); ClientService client2S = client2.getService(); connections.clientMap.put("http://client2/ClientService.json", client2S); + connections.clientMap0.put("clientLocation2", client2.getNewService()); client1.joinNetwork(master.getMasterInfo()); client2.joinNetwork(master.getMasterInfo()); @@ -111,18 +116,16 @@ public class MasterTest { Client client = new Client( new State("ClientNetwork"), connections, "http://client/ClientService.json", "clientLocation", null); - ClientService clientS = client.getService(); - connections.clientMap.put("http://client/ClientService.json", clientS); + connections.clientMap0.put("clientLocation", client.getNewService()); client.joinNetwork(master.getMasterInfo()); master.performWork(); - assertTrue(state.getList(".participants").contains("http://client/ClientService.json")); + assertTrue(state.getList(".participants0").contains("clientLocation")); - connections.clientMap.put("http://client/ClientService.json", - new UnreachableClient()); + connections.clientMap0.put("clientLocation", null); masterS.updateStateRequest("NewState", "NewStateData", 0); master.performWork(); - assertEquals("[]", state.getDataOf(".participants")); + assertEquals("[]", state.getDataOf(".participants0")); } } -- cgit v1.2.3