Search in sources :

Example 1 with PruneLogCommand

use of org.neo4j.causalclustering.core.consensus.outcome.PruneLogCommand in project neo4j by neo4j.

the class PruningTest method shouldGeneratePruneCommandsOnRequest.

@Test
public void shouldGeneratePruneCommandsOnRequest() throws Exception {
    // given
    InMemoryRaftLog raftLog = new InMemoryRaftLog();
    RaftState state = raftState().myself(myself).entryLog(raftLog).build();
    // when
    RaftMessages.PruneRequest pruneRequest = new RaftMessages.PruneRequest(1000);
    Outcome outcome = role.handler.handle(pruneRequest, state, log());
    // then
    assertThat(outcome.getLogCommands(), hasItem(new PruneLogCommand(1000)));
}
Also used : InMemoryRaftLog(org.neo4j.causalclustering.core.consensus.log.InMemoryRaftLog) Outcome(org.neo4j.causalclustering.core.consensus.outcome.Outcome) PruneLogCommand(org.neo4j.causalclustering.core.consensus.outcome.PruneLogCommand) RaftState(org.neo4j.causalclustering.core.consensus.state.RaftState) RaftMessages(org.neo4j.causalclustering.core.consensus.RaftMessages) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 RaftMessages (org.neo4j.causalclustering.core.consensus.RaftMessages)1 InMemoryRaftLog (org.neo4j.causalclustering.core.consensus.log.InMemoryRaftLog)1 Outcome (org.neo4j.causalclustering.core.consensus.outcome.Outcome)1 PruneLogCommand (org.neo4j.causalclustering.core.consensus.outcome.PruneLogCommand)1 RaftState (org.neo4j.causalclustering.core.consensus.state.RaftState)1