import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+
import com.google.common.base.Stopwatch;
import com.google.common.util.concurrent.Uninterruptibles;
import java.util.concurrent.TimeUnit;
}
@Test
- public void testOkToReplicate(){
+ public void testOkToReplicate() {
MockRaftActorContext context = new MockRaftActorContext();
+ context.setCommitIndex(0);
FollowerLogInformation followerLogInformation =
new FollowerLogInformationImpl(new PeerInfo("follower1", null, VotingState.VOTING), 10, context);
public void testVotingNotInitializedState() {
final PeerInfo peerInfo = new PeerInfo("follower1", null, VotingState.VOTING_NOT_INITIALIZED);
MockRaftActorContext context = new MockRaftActorContext();
+ context.setCommitIndex(0);
FollowerLogInformation followerLogInformation = new FollowerLogInformationImpl(peerInfo, -1, context);
assertFalse(followerLogInformation.okToReplicate());
public void testNonVotingState() {
final PeerInfo peerInfo = new PeerInfo("follower1", null, VotingState.NON_VOTING);
MockRaftActorContext context = new MockRaftActorContext();
+ context.setCommitIndex(0);
FollowerLogInformation followerLogInformation = new FollowerLogInformationImpl(peerInfo, -1, context);
assertTrue(followerLogInformation.okToReplicate());