@Test
public void testOutofElection() {
HashMap<Long,Vote> outofelection = new HashMap<Long,Vote>();
outofelection.put(1L, new Vote(0x0, 5, ZxidUtils.makeZxid(15, 0), 0xa, 0x17, ServerState.FOLLOWING));
outofelection.put(2L, new Vote(0x0, 5, ZxidUtils.makeZxid(15, 0), 0xa, 0x17, ServerState.FOLLOWING));
outofelection.put(4L, new Vote(0x1, 5, ZxidUtils.makeZxid(15, 0), 0xa, 0x18, ServerState.FOLLOWING));
Vote vote = new Vote(0x1, 5, ZxidUtils.makeZxid(15, 0), 0xa, 0x18, ServerState.LEADING);
outofelection.put(5L, vote);
Notification n = new Notification();
n.version = vote.getVersion();
n.leader = vote.getId();
n.zxid = vote.getZxid();
n.electionEpoch = vote.getElectionEpoch();
n.state = vote.getState();
n.peerEpoch = vote.getPeerEpoch();
n.sid = 5L;
fle.logicalclock.set(0x1);
Assert.assertTrue("Quorum check failed",
fle.getVoteTracker(outofelection, new Vote(n.version, n.leader,
n.zxid, n.electionEpoch, n.peerEpoch, n.state)).hasAllQuorums());
Assert.assertTrue("Leader check failed", fle.checkLeader(outofelection,
n.leader, n.electionEpoch));
}
}