use of com.hazelcast.cp.internal.raft.impl.RaftEndpoint in project hazelcast by hazelcast.
the class RaftLogTest method getEntryAfterSnapshot.
@Test
public void getEntryAfterSnapshot() {
LogEntry[] entries = new LogEntry[] { new LogEntry(1, 1, null), new LogEntry(1, 2, null), new LogEntry(1, 3, null) };
log.appendEntries(entries);
log.setSnapshot(new SnapshotEntry(1, 3, null, 0, Collections.<RaftEndpoint>emptySet()));
log.appendEntries(new LogEntry(1, 4, null));
log.appendEntries(new LogEntry(1, 5, null));
for (int i = 1; i <= 3; i++) {
assertNull(log.getLogEntry(i));
}
for (int i = 4; i <= log.lastLogOrSnapshotIndex(); i++) {
LogEntry entry = log.getLogEntry(i);
assertEquals(1, entry.term());
assertEquals(i, entry.index());
}
}
use of com.hazelcast.cp.internal.raft.impl.RaftEndpoint in project hazelcast by hazelcast.
the class LeaderStateTest method test_nextIndex.
@Test
public void test_nextIndex() {
Map<RaftEndpoint, Integer> indices = new HashMap<RaftEndpoint, Integer>();
for (RaftEndpoint endpoint : remoteEndpoints) {
int index = 1 + RandomPicker.getInt(100);
state.getFollowerState(endpoint).nextIndex(index);
indices.put(endpoint, index);
}
for (RaftEndpoint endpoint : remoteEndpoints) {
int index = indices.get(endpoint);
assertEquals(index, state.getFollowerState(endpoint).nextIndex());
}
}
Aggregations