diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-16 18:23:42 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-16 18:23:42 +0100 |
commit | 03883f9e08f7319138b3ec26aff333711f2699f7 (patch) | |
tree | 44bbf8e12485686a0ec0bc5decdb3bc8f83f287f /same/src/test/java | |
parent | 3800131c3ea981cb9cbaec1e58ed45921b0071d8 (diff) |
Send state to clients.
– Adds failing test - need to compare states of master and client.
Diffstat (limited to 'same/src/test/java')
-rw-r--r-- | same/src/test/java/com/orbekk/same/ClientServiceImplTest.java | 18 | ||||
-rw-r--r-- | same/src/test/java/com/orbekk/same/MasterServiceImplTest.java | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/same/src/test/java/com/orbekk/same/ClientServiceImplTest.java b/same/src/test/java/com/orbekk/same/ClientServiceImplTest.java new file mode 100644 index 0000000..75bf75d --- /dev/null +++ b/same/src/test/java/com/orbekk/same/ClientServiceImplTest.java @@ -0,0 +1,18 @@ +package com.orbekk.same; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ClientServiceImplTest { + private State state = new State("ClientNetwork"); + private TestConnectionManager connections = new TestConnectionManager(); + private TestBroadcaster broadcaster = new TestBroadcaster(connections); + private ClientServiceImpl client = new ClientServiceImpl(state, connections); + + @Test public void testSetState() { + client.setState("TestState", "Test data", 100); + assertEquals(100, state.getRevision("TestState")); + assertEquals("Test data", state.getDataOf("TestState")); + } +} diff --git a/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java b/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java index 3cd78d1..25b4073 100644 --- a/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java +++ b/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java @@ -56,5 +56,6 @@ public class MasterServiceImplTest { master.joinNetworkRequest("TestNetwork", "http://client"); assertTrue(master._performWork()); assertTrue(state.getList(".participants").contains("http://client")); + assertEquals(state, client.testGetState()); } } |