diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-24 11:48:19 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-24 11:48:19 +0100 |
commit | 55beb6df753604996ae61f8a099db40f0906804e (patch) | |
tree | 4f1424195a0b5d47e9b39e76b427b27926cab8dd /same/src/test/java/com/orbekk/paxos | |
parent | 5f36d81e47fd142ee7b7c172012917b11411db8d (diff) |
Basic Paxos working.
Diffstat (limited to 'same/src/test/java/com/orbekk/paxos')
-rw-r--r-- | same/src/test/java/com/orbekk/paxos/MasterProposerTest.java | 4 | ||||
-rw-r--r-- | same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/same/src/test/java/com/orbekk/paxos/MasterProposerTest.java b/same/src/test/java/com/orbekk/paxos/MasterProposerTest.java index dfc0b19..601a357 100644 --- a/same/src/test/java/com/orbekk/paxos/MasterProposerTest.java +++ b/same/src/test/java/com/orbekk/paxos/MasterProposerTest.java @@ -42,8 +42,8 @@ public class MasterProposerTest { @Test public void unsucessfulProposal() { connections.paxosMap.put("p1", p1); - when(p1.propose("client1", 1)).thenReturn(1); - when(p1.acceptRequest("client1", 1)).thenReturn(1); + when(p1.propose("client1", 1)).thenReturn(-1); + when(p1.acceptRequest("client1", 1)).thenReturn(-1); MasterProposer c1 = new MasterProposer( "client1", diff --git a/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java b/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java index 45d6624..4fe3e27 100644 --- a/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java +++ b/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java @@ -25,7 +25,7 @@ public class PaxosServiceFunctionalTest { public void setUp() throws Exception { server = TestServer.create(handler); myUrl = "http://localhost:" + server.port; - setupPaxos(5); + setupPaxos(10); } public void setupPaxos(int instances) { @@ -56,7 +56,7 @@ public class PaxosServiceFunctionalTest { MasterProposer client = new MasterProposer("http:/client" + j, paxosUrls, connections); - if (client.propose(1)) { + if (client.proposeRetry(1)) { incrementSuccessfulProposals(); } } @@ -72,7 +72,7 @@ public class PaxosServiceFunctionalTest { // Ignore. } } - assertEquals(1, successfulProposals); + assertEquals(5, successfulProposals); } public synchronized void incrementSuccessfulProposals() { |