diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-23 20:13:26 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-23 20:13:26 +0100 |
commit | 675d39342eeee15dda340557c88321edb431de98 (patch) | |
tree | a8c0edc234e44c0bbebbc221b7f96468fe921b02 /same/src/test/java/com/orbekk/paxos | |
parent | 1ae55b79f849cfd2e8b24311b63caa04baa5d3c2 (diff) |
Add Paxos integration test.
Diffstat (limited to 'same/src/test/java/com/orbekk/paxos')
-rw-r--r-- | same/src/test/java/com/orbekk/paxos/PaxosServiceTest.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/same/src/test/java/com/orbekk/paxos/PaxosServiceTest.java b/same/src/test/java/com/orbekk/paxos/PaxosServiceTest.java index d09ff70..a6a1f0b 100644 --- a/same/src/test/java/com/orbekk/paxos/PaxosServiceTest.java +++ b/same/src/test/java/com/orbekk/paxos/PaxosServiceTest.java @@ -2,6 +2,8 @@ package com.orbekk.paxos; import static org.junit.Assert.*; +import com.orbekk.same.TestConnectionManager; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -9,6 +11,7 @@ import org.junit.Before; import org.junit.Test; public class PaxosServiceTest { + TestConnectionManager connections = new TestConnectionManager(); private PaxosServiceImpl p1 = new PaxosServiceImpl("P1: "); private PaxosServiceImpl p2 = new PaxosServiceImpl("P2: "); private PaxosServiceImpl p3 = new PaxosServiceImpl("P3: "); @@ -25,6 +28,11 @@ public class PaxosServiceTest { @Before public void setUp() { Collections.addAll(servers, p1, p2, p3, p4, p5); + connections.paxosMap.put("p1", p1); + connections.paxosMap.put("p2", p2); + connections.paxosMap.put("p3", p3); + connections.paxosMap.put("p4", p4); + connections.paxosMap.put("p5", p5); } @Test @@ -59,4 +67,15 @@ public class PaxosServiceTest { assertFalse(p1.acceptRequest(client2, 4, 5)); assertTrue(p1.propose(client1, 5, 1)); } + + public List<String> paxosUrls() { + return new ArrayList<String>(connections.paxosMap.keySet()); + } + + @Test + public void integrationTest() { + MasterProposer proposer = new MasterProposer("client1", paxosUrls(), + connections); + assertTrue(proposer.propose(1, 1)); + } } |