@After public void tearDown() throws Exception { leader.cancel(); followA.cancel(); followB.cancel(); followC.cancel(); }
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); }
// 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); } }
@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()); }