@Test public void testGetState() { FollowerNodeRole role = new FollowerNodeRole(1, NodeId.of("B"), NodeId.of("A"), ElectionTimeout.NONE); RoleState state = role.getState(); Assert.assertEquals(1, state.getTerm()); Assert.assertEquals(NodeId.of("B"), state.getVotedFor()); Assert.assertEquals(NodeId.of("A"), state.getLeaderId()); }
@Override public RoleState getState() { DefaultRoleState state = new DefaultRoleState(RoleName.FOLLOWER, term); state.setVotedFor(votedFor); state.setLeaderId(leaderId); return state; }
FollowerNodeRole extends AbstractNodeRole { @Override public RoleState getState() { DefaultRoleState state = new DefaultRoleState(RoleName.FOLLOWER, term); state.setVotedFor(votedFor); state.setLeaderId(leaderId); return state; } }
FollowerNodeRole extends AbstractNodeRole { @Override public RoleState getState() { DefaultRoleState state = new DefaultRoleState(RoleName.FOLLOWER, term); state.setVotedFor(votedFor); state.setLeaderId(leaderId); return state; } FollowerNodeRole(int term, NodeId votedFor, NodeId leaderId, ElectionTimeout electionTimeout); }
FollowerNodeRole extends AbstractNodeRole { @Override public RoleState getState() { DefaultRoleState state = new DefaultRoleState(RoleName.FOLLOWER, term); state.setVotedFor(votedFor); state.setLeaderId(leaderId); return state; } FollowerNodeRole(int term, NodeId votedFor, NodeId leaderId, ElectionTimeout electionTimeout); NodeId getVotedFor(); NodeId getLeaderId(); @Override NodeId getLeaderId(NodeId selfId); @Override void cancelTimeoutOrTask(); @Override RoleState getState(); @Override String toString(); }
FollowerNodeRole extends AbstractNodeRole { @Override public RoleState getState() { DefaultRoleState state = new DefaultRoleState(RoleName.FOLLOWER, term); state.setVotedFor(votedFor); state.setLeaderId(leaderId); return state; } FollowerNodeRole(int term, NodeId votedFor, NodeId leaderId, ElectionTimeout electionTimeout); NodeId getVotedFor(); NodeId getLeaderId(); @Override NodeId getLeaderId(NodeId selfId); @Override void cancelTimeoutOrTask(); @Override RoleState getState(); @Override String toString();  }