use of com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorCheckpointer in project samza by apache.
the class TestKinesisRecordProcessor method getCheckpointer.
static IRecordProcessorCheckpointer getCheckpointer(KinesisRecordProcessor processor) throws NoSuchFieldException, IllegalAccessException {
Field f = processor.getClass().getDeclaredField("checkpointer");
f.setAccessible(true);
return (IRecordProcessorCheckpointer) f.get(processor);
}
use of com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorCheckpointer in project samza by apache.
the class TestKinesisRecordProcessor method generateRecords.
static Map<KinesisRecordProcessor, List<Record>> generateRecords(int numRecordsPerShard, List<KinesisRecordProcessor> processors) {
Map<KinesisRecordProcessor, List<Record>> processorRecordMap = new HashMap<>();
processors.forEach(processor -> {
try {
// Create records and call process records
IRecordProcessorCheckpointer checkpointer = Mockito.mock(IRecordProcessorCheckpointer.class);
doNothing().when(checkpointer).checkpoint(anyString());
doNothing().when(checkpointer).checkpoint();
ProcessRecordsInput processRecordsInput = Mockito.mock(ProcessRecordsInput.class);
when(processRecordsInput.getCheckpointer()).thenReturn(checkpointer);
when(processRecordsInput.getMillisBehindLatest()).thenReturn(1000L);
List<Record> inputRecords = createRecords(numRecordsPerShard);
processorRecordMap.put(processor, inputRecords);
when(processRecordsInput.getRecords()).thenReturn(inputRecords);
processor.processRecords(processRecordsInput);
} catch (ShutdownException | InvalidStateException ex) {
throw new RuntimeException(ex);
}
});
return processorRecordMap;
}
Aggregations