summaryrefslogtreecommitdiff
path: root/same/src/test/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'same/src/test/java/com')
-rw-r--r--same/src/test/java/com/orbekk/same/MasterServiceImplTest.java22
1 files changed, 21 insertions, 1 deletions
diff --git a/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java b/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java
index 826471e..9d8a134 100644
--- a/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java
+++ b/same/src/test/java/com/orbekk/same/MasterServiceImplTest.java
@@ -2,10 +2,13 @@ package com.orbekk.same;
import static org.junit.Assert.*;
+import java.util.List;
+
+import org.codehaus.jackson.type.TypeReference;
import org.junit.Test;
public class MasterServiceImplTest {
- private State state = new State();
+ private State state = new State("TestNetwork");
private MasterServiceImpl master = new MasterServiceImpl(state);
@Test
@@ -14,4 +17,21 @@ public class MasterServiceImplTest {
assertEquals("http://10.0.0.54:10050/MasterService.json",
state.getDataOf(".masterUrl"));
}
+
+ @Test
+ public void testJsonState() {
+ List<String> participants =
+ state.getParsedData(".participants",
+ new TypeReference<List<String>>() { });
+ assertEquals(participants.size(), 0);
+ participants.add("http://SomeUrl/");
+ state.updateFromObject(".participants", participants, 1);
+ }
+
+ @Test
+ public void joinNetworkAddsClient() {
+ master.joinNetworkRequest("TestNetwork", "http://clientUrl");
+ List<String> participants = state.getList(".participants");
+ assertTrue(participants.contains("http://clientUrl"));
+ }
}