use of org.apache.kafka.test.MockBatchingStateRestoreListener in project apache-kafka-on-k8s by banzaicloud.
the class ProcessorStateManagerTest method shouldRestoreStoreWithBatchingRestoreSpecification.
@Test
public void shouldRestoreStoreWithBatchingRestoreSpecification() throws Exception {
final TaskId taskId = new TaskId(0, 2);
final MockBatchingStateRestoreListener batchingRestoreCallback = new MockBatchingStateRestoreListener();
final KeyValue<byte[], byte[]> expectedKeyValue = KeyValue.pair(key, value);
final MockStateStore persistentStore = getPersistentStore();
final ProcessorStateManager stateMgr = getStandByStateManager(taskId);
try {
stateMgr.register(persistentStore, batchingRestoreCallback);
stateMgr.updateStandbyStates(persistentStorePartition, Collections.singletonList(consumerRecord));
assertThat(batchingRestoreCallback.getRestoredRecords().size(), is(1));
assertTrue(batchingRestoreCallback.getRestoredRecords().contains(expectedKeyValue));
} finally {
stateMgr.close(Collections.<TopicPartition, Long>emptyMap());
}
}
Aggregations