use of org.apache.kafka.common.message.VoteResponseData in project kafka by apache.
the class RaftClientTestContext method assertSentVoteResponse.
void assertSentVoteResponse(Errors error) {
List<RaftResponse.Outbound> sentMessages = drainSentResponses(ApiKeys.VOTE);
assertEquals(1, sentMessages.size());
RaftMessage raftMessage = sentMessages.get(0);
assertTrue(raftMessage.data() instanceof VoteResponseData);
VoteResponseData response = (VoteResponseData) raftMessage.data();
assertEquals(error, Errors.forCode(response.errorCode()));
}
use of org.apache.kafka.common.message.VoteResponseData in project kafka by apache.
the class RaftClientTestContext method expectAndGrantVotes.
void expectAndGrantVotes(int epoch) throws Exception {
pollUntilRequest();
List<RaftRequest.Outbound> voteRequests = collectVoteRequests(epoch, log.lastFetchedEpoch(), log.endOffset().offset);
for (RaftRequest.Outbound request : voteRequests) {
VoteResponseData voteResponse = voteResponse(true, Optional.empty(), epoch);
deliverResponse(request.correlationId, request.destinationId(), voteResponse);
}
client.poll();
assertElectedLeader(epoch, localIdOrThrow());
}
Aggregations