use of org.apache.kafka.streams.processor.CommitCallback in project kafka by apache.
the class ProcessorStateManagerTest method shouldThrowOnFailureToWritePositionCheckpointFile.
@Test
public void shouldThrowOnFailureToWritePositionCheckpointFile() throws IOException {
final ProcessorStateManager stateMgr = getStateManager(Task.TaskType.ACTIVE);
final CommitCallback persistentCheckpoint = mock(CommitCallback.class);
persistentCheckpoint.onCommit();
final IOException ioException = new IOException("asdf");
expectLastCall().andThrow(ioException);
replay(persistentCheckpoint);
stateMgr.registerStore(persistentStore, persistentStore.stateRestoreCallback, persistentCheckpoint);
final ProcessorStateException processorStateException = assertThrows(ProcessorStateException.class, stateMgr::checkpoint);
assertThat(processorStateException.getMessage(), containsString("process-state-manager-test Exception caught while trying to checkpoint store," + " changelog partition test-application-My-Topology-persistentStore-changelog-1"));
assertThat(processorStateException.getCause(), is(ioException));
}
Aggregations