diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-24 11:11:45 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-24 11:11:45 +0100 |
commit | 263f3a0b4425287ef234d0dbf039e0027c4ad6c1 (patch) | |
tree | 20f06878f41654007d9ae243eda25cd6e3a6e5a7 /same/src/test/java | |
parent | 3e50334e2233b7180b9895d106074aad914ca412 (diff) |
Paxos: Remove roundId parameter.
Diffstat (limited to 'same/src/test/java')
3 files changed, 18 insertions, 30 deletions
diff --git a/same/src/test/java/com/orbekk/paxos/MasterProposerTest.java b/same/src/test/java/com/orbekk/paxos/MasterProposerTest.java index 8056ab6..45ee53e 100644 --- a/same/src/test/java/com/orbekk/paxos/MasterProposerTest.java +++ b/same/src/test/java/com/orbekk/paxos/MasterProposerTest.java @@ -30,25 +30,25 @@ public class MasterProposerTest { @Test public void successfulProposal() { connections.paxosMap.put("p1", p1); - when(p1.propose("client1", 1, 1)).thenReturn(true); - when(p1.acceptRequest("client1", 1, 1)).thenReturn(true); + when(p1.propose("client1", 1)).thenReturn(true); + when(p1.acceptRequest("client1", 1)).thenReturn(true); MasterProposer c1 = new MasterProposer( "client1", paxosUrls(), connections); - assertTrue(c1.propose(1, 1)); + assertTrue(c1.propose(1)); } @Test public void unsucessfulProposal() { connections.paxosMap.put("p1", p1); - when(p1.propose("client1", 1, 1)).thenReturn(true); - when(p1.acceptRequest("client1", 1, 1)).thenReturn(false); + when(p1.propose("client1", 1)).thenReturn(true); + when(p1.acceptRequest("client1", 1)).thenReturn(false); MasterProposer c1 = new MasterProposer( "client1", paxosUrls(), connections); - assertFalse(c1.propose(1, 1)); + assertFalse(c1.propose(1)); } } diff --git a/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java b/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java index 757d27c..45d6624 100644 --- a/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java +++ b/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java @@ -42,7 +42,7 @@ public class PaxosServiceFunctionalTest { public void testMasterElection() { MasterProposer m1 = new MasterProposer("http://client1", paxosUrls, connections); - assertTrue(m1.propose(1, 1)); + assertTrue(m1.propose(1)); } @Test @@ -56,7 +56,7 @@ public class PaxosServiceFunctionalTest { MasterProposer client = new MasterProposer("http:/client" + j, paxosUrls, connections); - if (client.propose(1, 1)) { + if (client.propose(1)) { incrementSuccessfulProposals(); } } diff --git a/same/src/test/java/com/orbekk/paxos/PaxosServiceTest.java b/same/src/test/java/com/orbekk/paxos/PaxosServiceTest.java index a6a1f0b..f9ee058 100644 --- a/same/src/test/java/com/orbekk/paxos/PaxosServiceTest.java +++ b/same/src/test/java/com/orbekk/paxos/PaxosServiceTest.java @@ -37,35 +37,23 @@ public class PaxosServiceTest { @Test public void simpleCase() { - assertTrue(p1.propose(client, 1, 1)); - assertTrue(p1.acceptRequest(client, 1, 1)); + assertTrue(p1.propose(client, 1)); + assertTrue(p1.acceptRequest(client, 1)); } @Test public void lowerProposalFails() { - assertTrue(p1.propose(client1, 5, 10)); - assertFalse(p1.propose(client2, 3, 9)); - assertFalse(p1.propose(client2, 4, 100)); - assertFalse(p1.propose(client2, 5, 9)); - assertFalse(p1.propose(client2, 5, 10)); - assertTrue(p1.propose(client2, 5, 11)); + assertTrue(p1.propose(client1, 10)); + assertFalse(p1.propose(client2, 9)); + assertTrue(p1.propose(client2, 100)); } @Test public void testAccept() { - assertTrue(p1.propose(client1, 2, 3)); - assertTrue(p1.propose(client2, 2, 4)); - assertFalse(p1.acceptRequest(client1, 2, 3)); - assertTrue(p1.acceptRequest(client2, 2, 4)); - } - - @Test - public void testRoundFinished() { - assertTrue(p1.propose(client1, 4, 5)); - assertTrue(p1.acceptRequest(client1, 4, 5)); - assertFalse(p1.propose(client2, 4, 5)); - assertFalse(p1.acceptRequest(client2, 4, 5)); - assertTrue(p1.propose(client1, 5, 1)); + assertTrue(p1.propose(client1, 3)); + assertTrue(p1.propose(client2, 4)); + assertFalse(p1.acceptRequest(client1, 3)); + assertTrue(p1.acceptRequest(client2, 4)); } public List<String> paxosUrls() { @@ -76,6 +64,6 @@ public class PaxosServiceTest { public void integrationTest() { MasterProposer proposer = new MasterProposer("client1", paxosUrls(), connections); - assertTrue(proposer.propose(1, 1)); + assertTrue(proposer.propose(1)); } } |