Examples of RequestVote


Examples of org.robotninjas.barge.api.RequestVote

  @VisibleForTesting
  ListenableFuture<RequestVoteResponse> sendVoteRequest(RaftStateContext ctx, Replica replica) {

    RaftLog log = getLog();
    RequestVote request =
      RequestVote.newBuilder()
        .setTerm(log.currentTerm())
        .setCandidateId(log.self().toString())
        .setLastLogIndex(log.lastLogIndex())
        .setLastLogTerm(log.lastLogTerm())
View Full Code Here

Examples of org.robotninjas.barge.api.RequestVote

    verify(listener).send(contains("appendEntries"));
  }

  @Test
  public void dispatch_runnable_notifying_request_vote_to_registered_listener() throws Exception {
    RequestVote vote = RequestVote.getDefaultInstance();

    wsEventListener.addClient(listener);
    wsEventListener.requestVote(raft, vote);

    fiber.executeAllPending();
View Full Code Here

Examples of org.robotninjas.barge.api.RequestVote

  @Test
  public void testHaventVoted() {

    BaseState state = new EmptyState(mockRaftLog);

    RequestVote requestVote = RequestVote.newBuilder()
      .setCandidateId(candidate.toString())
      .setLastLogIndex(2)
      .setLastLogTerm(2)
      .setTerm(2)
      .build();
View Full Code Here

Examples of org.robotninjas.barge.api.RequestVote

  @Test
  public void testAlreadyVotedForCandidate() {

    BaseState state = new EmptyState(mockRaftLog);

    RequestVote requestVote = RequestVote.newBuilder()
      .setCandidateId(candidate.toString())
      .setLastLogIndex(2)
      .setLastLogTerm(2)
      .setTerm(2)
      .build();
View Full Code Here

Examples of org.robotninjas.barge.api.RequestVote

  @Ignore
  public void testCandidateWithGreaterTerm() {

    BaseState state = new EmptyState(mockRaftLog);

    RequestVote requestVote = RequestVote.newBuilder()
      .setCandidateId(candidate.toString())
      .setLastLogIndex(2)
      .setLastLogTerm(3)
      .setTerm(2)
      .build();
View Full Code Here

Examples of org.robotninjas.barge.api.RequestVote

  @Test
  public void testCandidateWithLesserTerm() {

    BaseState state = new EmptyState(mockRaftLog);

    RequestVote requestVote = RequestVote.newBuilder()
      .setCandidateId(candidate.toString())
      .setLastLogIndex(2)
      .setLastLogTerm(1)
      .setTerm(2)
      .build();
View Full Code Here

Examples of org.robotninjas.barge.api.RequestVote

  @Test
  public void testCandidateWithLesserIndex() {

    BaseState state = new EmptyState(mockRaftLog);

    RequestVote requestVote = RequestVote.newBuilder()
      .setCandidateId(candidate.toString())
      .setLastLogIndex(1)
      .setLastLogTerm(2)
      .setTerm(2)
      .build();
View Full Code Here

Examples of org.robotninjas.barge.api.RequestVote

  @Ignore
  public void testCandidateWithGreaterIndex() {

    BaseState state = new EmptyState(mockRaftLog);

    RequestVote requestVote = RequestVote.newBuilder()
      .setCandidateId(candidate.toString())
      .setLastLogIndex(3)
      .setLastLogTerm(2)
      .setTerm(2)
      .build();
View Full Code Here

Examples of org.robotninjas.barge.api.RequestVote

    Candidate candidate = new Candidate(mockRaftLog, scheduler, 150, mockRaftClient);
    candidate.init(mockRaftStateContext);

    Replica mockCandidate = config.getReplica("other");

    RequestVote request =
      RequestVote.newBuilder()
        .setCandidateId(mockCandidate.toString())
        .setLastLogIndex(1L)
        .setLastLogTerm(1L)
        .setTerm(4L)
View Full Code Here

Examples of org.robotninjas.barge.api.RequestVote

    Candidate candidate = new Candidate(mockRaftLog, scheduler, 150, mockRaftClient);
    candidate.init(mockRaftStateContext);

    Replica mockCandidate = config.getReplica("other");

    RequestVote request =
      RequestVote.newBuilder()
        .setCandidateId(mockCandidate.toString())
        .setLastLogIndex(1L)
        .setLastLogTerm(1L)
        .setTerm(1L)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.