- Snapshot snapshot = Snapshot.create(snapshotBytes, Arrays.asList(unAppliedEntry),
- lastIndexDuringSnapshotCapture, 1, lastAppliedDuringSnapshotCapture, 1);
-
- sendMessageToSupport(new ApplySnapshot(snapshot));
-
- assertEquals("Journal log size", 1, context.getReplicatedLog().size());
- assertEquals("Last index", lastIndexDuringSnapshotCapture, context.getReplicatedLog().lastIndex());
- assertEquals("Last applied", lastAppliedDuringSnapshotCapture, context.getLastApplied());
- assertEquals("Commit index", -1, context.getCommitIndex());
- assertEquals("Snapshot term", 1, context.getReplicatedLog().getSnapshotTerm());
- assertEquals("Snapshot index", lastAppliedDuringSnapshotCapture, context.getReplicatedLog().getSnapshotIndex());
-
- verify(mockCohort).applySnapshot(snapshotBytes);
- }
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- @Test
- public void testOnCaptureSnapshot() throws Exception {
-
- sendMessageToSupport(new CaptureSnapshot(3, 1, 2, 1, 2, 1));
-
- ArgumentCaptor<Procedure> procedure = ArgumentCaptor.forClass(Procedure.class);
- verify(mockSnapshotManager).create(procedure.capture());
+ Snapshot snapshot = Snapshot.create(ByteState.of(snapshotBytes), Collections.<ReplicatedLogEntry>emptyList(),
+ lastIndexDuringSnapshotCapture, 1, lastAppliedDuringSnapshotCapture, 1, -1, null, null);