diff options
Diffstat (limited to 'same')
-rw-r--r-- | same/old/App.java (renamed from same/src/main/java/com/orbekk/same/App.java) | 0 | ||||
-rw-r--r-- | same/old/Client.java (renamed from same/src/main/java/com/orbekk/same/Client.java) | 0 | ||||
-rw-r--r-- | same/old/SameService.java (renamed from same/src/main/java/com/orbekk/same/SameService.java) | 0 | ||||
-rw-r--r-- | same/old/SameServiceImpl.java (renamed from same/src/main/java/com/orbekk/same/SameServiceImpl.java) | 0 | ||||
-rw-r--r-- | same/old/SameState.java (renamed from same/src/main/java/com/orbekk/same/SameState.java) | 0 | ||||
-rw-r--r-- | same/old/SameStateTest.java | 105 | ||||
-rw-r--r-- | same/src/test/java/com/orbekk/same/SameStateTest.java | 105 |
7 files changed, 105 insertions, 105 deletions
diff --git a/same/src/main/java/com/orbekk/same/App.java b/same/old/App.java index 5d94678..5d94678 100644 --- a/same/src/main/java/com/orbekk/same/App.java +++ b/same/old/App.java diff --git a/same/src/main/java/com/orbekk/same/Client.java b/same/old/Client.java index 11a7449..11a7449 100644 --- a/same/src/main/java/com/orbekk/same/Client.java +++ b/same/old/Client.java diff --git a/same/src/main/java/com/orbekk/same/SameService.java b/same/old/SameService.java index 8f239da..8f239da 100644 --- a/same/src/main/java/com/orbekk/same/SameService.java +++ b/same/old/SameService.java diff --git a/same/src/main/java/com/orbekk/same/SameServiceImpl.java b/same/old/SameServiceImpl.java index 27579b5..27579b5 100644 --- a/same/src/main/java/com/orbekk/same/SameServiceImpl.java +++ b/same/old/SameServiceImpl.java diff --git a/same/src/main/java/com/orbekk/same/SameState.java b/same/old/SameState.java index 369c5d7..369c5d7 100644 --- a/same/src/main/java/com/orbekk/same/SameState.java +++ b/same/old/SameState.java diff --git a/same/old/SameStateTest.java b/same/old/SameStateTest.java new file mode 100644 index 0000000..13378a4 --- /dev/null +++ b/same/old/SameStateTest.java @@ -0,0 +1,105 @@ +// package com.orbekk.same; +// +// import static org.junit.Assert.*; +// +// import java.util.Map; +// import java.util.HashMap; +// import org.junit.Test; +// import org.junit.Before; +// +// public class SameStateTest { +// private MockConnectionManager connections; +// private SameState state1, state2, state3; +// private SameService service1, service2, service3; +// +// public static class MockConnectionManager implements ConnectionManager { +// public Map<String, SameService> connections = +// new HashMap<String, SameService>(); +// +// @Override +// public SameService getConnection(String url) { +// return connections.get(url); +// } +// } +// +// public SameStateTest() { +// } +// +// @Before public void setUp() { +// connections = new MockConnectionManager(); +// +// state1 = new SameState("Network1", "Client1", connections); +// state1.setUrl("test://client1"); +// service1 = new SameServiceImpl(state1); +// state2 = new SameState("Network2", "Client2", connections); +// state2.setUrl("test://client2"); +// service2 = new SameServiceImpl(state2); +// state3 = new SameState("Network3", "Client3", connections); +// state3.setUrl("test://client3"); +// service3 = new SameServiceImpl(state3); +// +// connections.connections.put(state1.getUrl(), service1); +// connections.connections.put(state2.getUrl(), service2); +// connections.connections.put(state3.getUrl(), service3); +// } +// +// public void joinNetwork() { +// connections.getConnection(state1.getUrl()). +// participateNetwork("Network1", state2.getClientId(), +// state2.getUrl()); +// connections.getConnection(state1.getUrl()). +// participateNetwork("Network1", state3.getClientId(), +// state3.getUrl()); +// state1.internalRun(); +// state2.internalRun(); +// state3.internalRun(); +// +// assertTrue(state1.getParticipants().size() == 3); +// assertTrue(state2.getParticipants().size() == 3); +// assertTrue(state3.getParticipants().size() == 3); +// } +// +// @Test public void testJoinNetwork() { +// connections.getConnection(state1.getUrl()). +// participateNetwork("Network1", state2.getClientId(), +// state2.getUrl()); +// assertTrue(state1.getParticipants().size() == 1); +// assertTrue(state2.getParticipants().size() == 1); +// +// state1.internalRun(); +// state2.internalRun(); +// +// assertTrue(state1.getParticipants().size() == 2); +// assertTrue(state2.getParticipants().size() == 2); +// assertEquals(state1.getNetworkName(), state2.getNetworkName()); +// +// connections.getConnection(state2.getUrl()). +// participateNetwork("Network1", state3.getClientId(), +// state3.getUrl()); +// state2.internalRun(); +// state1.internalRun(); +// state3.internalRun(); +// state2.internalRun(); +// +// assertTrue(state1.getParticipants().size() == 3); +// assertTrue(state2.getParticipants().size() == 3); +// assertTrue(state3.getParticipants().size() == 3); +// assertEquals(state1.getNetworkName(), state2.getNetworkName()); +// assertEquals(state2.getNetworkName(), state3.getNetworkName()); +// +// assertEquals("Client1", state1.getMasterId()); +// assertEquals("Client1", state2.getMasterId()); +// assertEquals("Client1", state3.getMasterId()); +// } +// +// @Test public void setState() { +// joinNetwork(); +// state1.librarySetNewState("New state1"); +// state1.internalRun(); +// state2.internalRun(); +// state3.internalRun(); +// assertEquals("New state1", state1.getCurrentState()); +// assertEquals("New state1", state2.getCurrentState()); +// assertEquals("New state1", state2.getCurrentState()); +// } +// } diff --git a/same/src/test/java/com/orbekk/same/SameStateTest.java b/same/src/test/java/com/orbekk/same/SameStateTest.java deleted file mode 100644 index b16f5f9..0000000 --- a/same/src/test/java/com/orbekk/same/SameStateTest.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.orbekk.same; - -import static org.junit.Assert.*; - -import java.util.Map; -import java.util.HashMap; -import org.junit.Test; -import org.junit.Before; - -public class SameStateTest { - private MockConnectionManager connections; - private SameState state1, state2, state3; - private SameService service1, service2, service3; - - public static class MockConnectionManager implements ConnectionManager { - public Map<String, SameService> connections = - new HashMap<String, SameService>(); - - @Override - public SameService getConnection(String url) { - return connections.get(url); - } - } - - public SameStateTest() { - } - - @Before public void setUp() { - connections = new MockConnectionManager(); - - state1 = new SameState("Network1", "Client1", connections); - state1.setUrl("test://client1"); - service1 = new SameServiceImpl(state1); - state2 = new SameState("Network2", "Client2", connections); - state2.setUrl("test://client2"); - service2 = new SameServiceImpl(state2); - state3 = new SameState("Network3", "Client3", connections); - state3.setUrl("test://client3"); - service3 = new SameServiceImpl(state3); - - connections.connections.put(state1.getUrl(), service1); - connections.connections.put(state2.getUrl(), service2); - connections.connections.put(state3.getUrl(), service3); - } - - public void joinNetwork() { - connections.getConnection(state1.getUrl()). - participateNetwork("Network1", state2.getClientId(), - state2.getUrl()); - connections.getConnection(state1.getUrl()). - participateNetwork("Network1", state3.getClientId(), - state3.getUrl()); - state1.internalRun(); - state2.internalRun(); - state3.internalRun(); - - assertTrue(state1.getParticipants().size() == 3); - assertTrue(state2.getParticipants().size() == 3); - assertTrue(state3.getParticipants().size() == 3); - } - - @Test public void testJoinNetwork() { - connections.getConnection(state1.getUrl()). - participateNetwork("Network1", state2.getClientId(), - state2.getUrl()); - assertTrue(state1.getParticipants().size() == 1); - assertTrue(state2.getParticipants().size() == 1); - - state1.internalRun(); - state2.internalRun(); - - assertTrue(state1.getParticipants().size() == 2); - assertTrue(state2.getParticipants().size() == 2); - assertEquals(state1.getNetworkName(), state2.getNetworkName()); - - connections.getConnection(state2.getUrl()). - participateNetwork("Network1", state3.getClientId(), - state3.getUrl()); - state2.internalRun(); - state1.internalRun(); - state3.internalRun(); - state2.internalRun(); - - assertTrue(state1.getParticipants().size() == 3); - assertTrue(state2.getParticipants().size() == 3); - assertTrue(state3.getParticipants().size() == 3); - assertEquals(state1.getNetworkName(), state2.getNetworkName()); - assertEquals(state2.getNetworkName(), state3.getNetworkName()); - - assertEquals("Client1", state1.getMasterId()); - assertEquals("Client1", state2.getMasterId()); - assertEquals("Client1", state3.getMasterId()); - } - - @Test public void setState() { - joinNetwork(); - state1.librarySetNewState("New state1"); - state1.internalRun(); - state2.internalRun(); - state3.internalRun(); - assertEquals("New state1", state1.getCurrentState()); - assertEquals("New state1", state2.getCurrentState()); - assertEquals("New state1", state2.getCurrentState()); - } -} |