use of org.apache.ratis.protocol.RaftClientReply in project alluxio by Alluxio.
the class RaftJournalWriterTest method setupRaftJournalWriter.
private void setupRaftJournalWriter() throws IOException {
mClient = mock(RaftJournalAppender.class);
RaftClientReply reply = RaftClientReply.newBuilder().setClientId(ClientId.randomId()).setServerId(RaftGroupMemberId.valueOf(RaftJournalUtils.getPeerId(new InetSocketAddress(1)), RaftGroupId.valueOf(UUID.fromString("02511d47-d67c-49a3-9011-abb3109a44c1")))).setCallId(1L).setSuccess(true).setMessage(Message.valueOf("mp")).setException(null).setLogIndex(1L).setCommitInfos(null).build();
CompletableFuture<RaftClientReply> future = new CompletableFuture<RaftClientReply>() {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
return false;
}
@Override
public boolean isCancelled() {
return false;
}
@Override
public boolean isDone() {
return false;
}
@Override
public RaftClientReply get() {
return reply;
}
@Override
public RaftClientReply get(long timeout, TimeUnit unit) {
return reply;
}
};
when(mClient.sendAsync(any(), any())).thenReturn(future);
mRaftJournalWriter = new RaftJournalWriter(1, mClient);
}
Aggregations