Ejemplo n.º 1
0
 @After
 public void tearDown() throws Exception {
   leader.cancel();
   followA.cancel();
   followB.cancel();
   followC.cancel();
 }
Ejemplo n.º 2
0
 boolean isProposalPending(long id) {
   return (followA.getProposal(id) == null
       || followA.getProposal(id).getState() != ProposalState.ACCEPTED
       || followB.getProposal(id) == null
       || followB.getProposal(id).getState() != ProposalState.ACCEPTED
       || followC.getProposal(id) == null
       || followC.getProposal(id).getState() != ProposalState.ACCEPTED);
 }
Ejemplo n.º 3
0
  // TODO fix test
  // @Test(timeout = 1000)
  public void testCommitWithFailure() throws Exception {
    log.trace("PaxosTest::testCommit()");

    serverL.run();
    serverA.run();
    serverB.run();
    // C missing

    long id = leader.addProposal(new NullOperation("one"));

    while (followA.getProposal(id) == null
        || followA.getProposal(id).getState() != ProposalState.ACCEPTED
        || followB.getProposal(id) == null
        || followB.getProposal(id).getState() != ProposalState.ACCEPTED) {
      Thread.sleep(100);
    }
  }
Ejemplo n.º 4
0
  @Test(timeout = 1000)
  public void testOperationHanddown() throws Exception {
    log.trace("PaxosTest::testCommit()");

    serverL.run();
    serverA.run();
    serverB.run();
    serverC.run();

    long id = leader.addProposal(new NullOperation("one"));

    while (isProposalPending(id)) {
      Thread.sleep(100);
    }

    assertNotNull(followA.getProposal(id).getOperation());
    assertNotNull(followB.getProposal(id).getOperation());
    assertNotNull(followC.getProposal(id).getOperation());
  }