LeaderRole extends ActiveRole implements ZeebeLogAppender { @Override public void appendEntry( final long lowestPosition, final long highestPosition, final ByteBuffer data, final AppendListener appendListener) { raft.getThreadContext() .execute(() -> safeAppendEntry(lowestPosition, highestPosition, data, appendListener)); } LeaderRole(final RaftContext context); @Override synchronized CompletableFuture<RaftRole> start(); @Override synchronized CompletableFuture<Void> stop(); @Override RaftServer.Role role(); @Override CompletableFuture<JoinResponse> onJoin(final JoinRequest request); @Override CompletableFuture<ReconfigureResponse> onReconfigure(final ReconfigureRequest request); @Override CompletableFuture<LeaveResponse> onLeave(final LeaveRequest request); @Override CompletableFuture<ConfigureResponse> onConfigure(final ConfigureRequest request); @Override CompletableFuture<TransferResponse> onTransfer(final TransferRequest request); @Override CompletableFuture<AppendResponse> onAppend(final AppendRequest request); @Override CompletableFuture<PollResponse> onPoll(final PollRequest request); @Override CompletableFuture<VoteResponse> onVote(final VoteRequest request); @Override void appendEntry(
      final long lowestPosition,
      final long highestPosition,
      final ByteBuffer data,
      final AppendListener appendListener); synchronized void onInitialEntriesCommitted(final Runnable runnable);  }
@Test public void shouldAppendEntry() throws InterruptedException { final ByteBuffer data = ByteBuffer.allocate(Integer.BYTES).putInt(0, 1); final CountDownLatch latch = new CountDownLatch(1); final AppendListener listener = new AppendListener() { @Override public void onWrite(final Indexed<ZeebeEntry> indexed) { latch.countDown(); } @Override public void onWriteError(final Throwable error) {} @Override public void onCommit(final Indexed<ZeebeEntry> indexed) {} @Override public void onCommitError(final Indexed<ZeebeEntry> indexed, final Throwable error) {} }; leaderRole.appendEntry(0, 1, data, listener); latch.await(10, TimeUnit.SECONDS); assertEquals(0, latch.getCount()); }