File persistDirSeed = testDirectoryManager.makeDirectory("queue-to-stop");
Map<String, MonitorCheckpoint> monPoints = null;
String checkpoint = null;
{ /* Make recovery file that finishes 2nd batch. */
ChangeSource changeSource = new MockChangeSource(6);
CheckpointAndChangeQueue q = new CheckpointAndChangeQueue(changeSource,
persistDirSeed, internalFactory, clientFactory);
q.setMaximumQueueSize(2);
q.start(checkpoint);
List<CheckpointAndChange> firstBatch = q.resume(checkpoint);
checkpoint = firstBatch.get(1).getCheckpoint().toString();
List<CheckpointAndChange> secondBatch = q.resume(checkpoint);
checkpoint = secondBatch.get(1).getCheckpoint().toString();
q.resume(checkpoint);
monPoints = q.getMonitorRestartPoints();
File recoveryFiles[] = persistDirSeed.listFiles();
assertEquals(1, recoveryFiles.length);
File recoveryFile = recoveryFiles[0];
recoveryFile.renameTo(new File(persistDir, recoveryFile.getName()));
}
ChangeSource changeSource = new MockChangeSource(6);
CheckpointAndChangeQueue q = new CheckpointAndChangeQueue(changeSource,
persistDir, internalFactory, clientFactory);
q.setMaximumQueueSize(2);
q.start(checkpoint);
// Note: It's important that q.resume(checkpoint) is not called.