use of org.neo4j.causalclustering.core.consensus.log.monitoring.RaftLogCommitIndexMonitor in project neo4j by neo4j.
the class CommandApplicationProcessTest method shouldApplyCommittedCommand.
@Test
public void shouldApplyCommittedCommand() throws Throwable {
// given
RaftLogCommitIndexMonitor listener = mock(RaftLogCommitIndexMonitor.class);
monitors.addMonitorListener(listener);
applicationProcess.start();
InOrder inOrder = inOrder(coreStateMachines, commandDispatcher);
// when
raftLog.append(new RaftLogEntry(0, operation(nullTx)));
raftLog.append(new RaftLogEntry(0, operation(nullTx)));
raftLog.append(new RaftLogEntry(0, operation(nullTx)));
applicationProcess.notifyCommitted(2);
applier.sync(false);
// then
inOrder.verify(coreStateMachines).commandDispatcher();
inOrder.verify(commandDispatcher).dispatch(eq(nullTx), eq(0L), anyCallback());
inOrder.verify(commandDispatcher).dispatch(eq(nullTx), eq(1L), anyCallback());
inOrder.verify(commandDispatcher).dispatch(eq(nullTx), eq(2L), anyCallback());
inOrder.verify(commandDispatcher).close();
verify(listener).commitIndex(2);
}
Aggregations