Search in sources :

Example 6 with RecordingLog

use of io.aeron.cluster.client.RecordingLog in project aeron by real-logic.

the class RecordingLogTest method shouldAppendAndThenCommitTermPosition.

@Test
public void shouldAppendAndThenCommitTermPosition() {
    final RecordingLog recordingLog = new RecordingLog(TEMP_DIR);
    final long leadershipTermId = 1111L;
    final long termBaseLogPosition = 2222L;
    final long timestamp = 3333L;
    final int votedForMemberId = 1;
    recordingLog.appendTerm(leadershipTermId, termBaseLogPosition, timestamp, votedForMemberId);
    final long newPosition = 9999L;
    recordingLog.commitLeadershipTermPosition(leadershipTermId, newPosition);
    final RecordingLog recordingLogTwo = new RecordingLog(TEMP_DIR);
    assertThat(recordingLogTwo.entries().size(), is(1));
    final RecordingLog.Entry actualEntry = recordingLogTwo.entries().get(0);
    assertEquals(newPosition, actualEntry.termPosition);
}
Also used : RecordingLog(io.aeron.cluster.client.RecordingLog) Test(org.junit.Test)

Aggregations

RecordingLog (io.aeron.cluster.client.RecordingLog)6 Test (org.junit.Test)5 ReadableCounter (io.aeron.status.ReadableCounter)1