From a4a0c66483fd763901c43513f8fbca65b0e7c5a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Wed, 25 Apr 2012 10:59:52 +0200 Subject: Set timeouts for all RPCs. Implemented with an RpcFactory. --- .../java/com/orbekk/paxos/PaxosServiceFunctionalTest.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'same/src/test/java/com/orbekk/paxos') diff --git a/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java b/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java index 98631b0..2918f3e 100644 --- a/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java +++ b/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java @@ -15,12 +15,14 @@ import org.junit.Test; import com.orbekk.protobuf.SimpleProtobufServer; import com.orbekk.same.ConnectionManagerImpl; +import com.orbekk.same.RpcFactory; import com.orbekk.same.Services.ClientState; public class PaxosServiceFunctionalTest { ConnectionManagerImpl connections = new ConnectionManagerImpl(500, 500); List paxosUrls = new ArrayList(); List servers = new ArrayList(); + RpcFactory rpcf = new RpcFactory(5000); String myUrl; int successfulProposals = 0; ClientState client1 = ClientState.newBuilder() @@ -70,14 +72,14 @@ public class PaxosServiceFunctionalTest { @Test public void testMasterElection() throws InterruptedException { MasterProposer m1 = new MasterProposer(client1, paxosUrls, - connections); + connections, rpcf); assertTrue(m1.propose(1)); } @Test public void testMasterElectionTask() throws InterruptedException, ExecutionException { MasterProposer m1 = new MasterProposer(client1, paxosUrls, - connections); + connections, rpcf); Future result = m1.startProposalTask(1, null); assertEquals(new Integer(1), result.get()); } @@ -85,7 +87,7 @@ public class PaxosServiceFunctionalTest { @Test public void cancelledElection() throws InterruptedException { MasterProposer m1 = new MasterProposer(client1, paxosUrls, - connections); + connections, rpcf); assertTrue(m1.propose(1)); Future result = m1.startProposalTask(1, sleepForever); @@ -96,10 +98,10 @@ public class PaxosServiceFunctionalTest { @Test public void testOnlyOneCompletes() throws InterruptedException, ExecutionException { MasterProposer m1 = new MasterProposer(client1, paxosUrls, - connections); + connections, rpcf); ClientState client2 = ClientState.newBuilder().setLocation("client2").build(); MasterProposer m2 = new MasterProposer(client2, paxosUrls, - connections); + connections, rpcf); final Future result1 = m1.startProposalTask(1, sleepForever); final Future result2 = m2.startProposalTask(1, sleepForever); @@ -160,7 +162,7 @@ public class PaxosServiceFunctionalTest { .build(); MasterProposer proposer = new MasterProposer(client, paxosUrls, - connections); + connections, rpcf); try { if (proposer.proposeRetry(1)) { incrementSuccessfulProposals(); -- cgit v1.2.3