From 3e50334e2233b7180b9895d106074aad914ca412 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= <kjetil.orbekk@gmail.com>
Date: Tue, 24 Jan 2012 10:31:44 +0100
Subject: Add failing Paxos test.

Fails because proposers do not retry.
---
 .../java/com/orbekk/paxos/PaxosServiceFunctionalTest.java    | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

(limited to 'same')

diff --git a/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java b/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java
index 8f20273..757d27c 100644
--- a/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java
+++ b/same/src/test/java/com/orbekk/paxos/PaxosServiceFunctionalTest.java
@@ -19,7 +19,8 @@ public class PaxosServiceFunctionalTest {
     RpcHandler handler = new RpcHandler(null);
     TestServer server;
     String myUrl;
-
+    int successfulProposals = 0;
+    
     @Before
     public void setUp() throws Exception {
         server = TestServer.create(handler);
@@ -55,7 +56,9 @@ public class PaxosServiceFunctionalTest {
                     MasterProposer client =
                             new MasterProposer("http:/client" + j, paxosUrls,
                                     connections);
-                    client.propose(1, 1);
+                    if (client.propose(1, 1)) {
+                        incrementSuccessfulProposals(); 
+                    }
                 }
             });
         }
@@ -69,8 +72,13 @@ public class PaxosServiceFunctionalTest {
                 // Ignore.
             }
         }
+        assertEquals(1, successfulProposals);
     }
 
+    public synchronized void incrementSuccessfulProposals() {
+        successfulProposals += 1;
+    }
+    
     public static class TestServer {
         public Server server;
         public int port;
-- 
cgit v1.2.3