use of org.zalando.nakadi.repository.kafka.NakadiKafkaConsumer in project nakadi by zalando.
the class EventStreamTest method emptyConsumer.
private static NakadiKafkaConsumer emptyConsumer() throws NakadiException {
final NakadiKafkaConsumer nakadiKafkaConsumer = mock(NakadiKafkaConsumer.class);
when(nakadiKafkaConsumer.readEvents()).thenReturn(Collections.emptyList());
return nakadiKafkaConsumer;
}
use of org.zalando.nakadi.repository.kafka.NakadiKafkaConsumer in project nakadi by zalando.
the class EventStreamTest method predefinedConsumer.
private static NakadiKafkaConsumer predefinedConsumer(final List<ConsumedEvent> events) throws NakadiException {
final NakadiKafkaConsumer nakadiKafkaConsumer = mock(NakadiKafkaConsumer.class);
final AtomicBoolean sent = new AtomicBoolean(false);
when(nakadiKafkaConsumer.readEvents()).thenAnswer(invocation -> {
if (sent.get()) {
return Collections.emptyList();
} else {
sent.set(true);
return events;
}
});
return nakadiKafkaConsumer;
}
use of org.zalando.nakadi.repository.kafka.NakadiKafkaConsumer in project nakadi by zalando.
the class EventStreamTest method nCountDummyConsumerForPartition.
private static NakadiKafkaConsumer nCountDummyConsumerForPartition(final int eventNum, final String partition) throws NakadiException {
final NakadiKafkaConsumer nakadiKafkaConsumer = mock(NakadiKafkaConsumer.class);
final AtomicInteger eventsToCreate = new AtomicInteger(eventNum);
when(nakadiKafkaConsumer.readEvents()).thenAnswer(invocation -> {
if (eventsToCreate.get() > 0) {
eventsToCreate.set(eventsToCreate.get() - 1);
return Collections.singletonList(new ConsumedEvent(DUMMY, NakadiCursor.of(TIMELINE, partition, "000000000000000000")));
} else {
return Collections.emptyList();
}
});
return nakadiKafkaConsumer;
}
use of org.zalando.nakadi.repository.kafka.NakadiKafkaConsumer in project nakadi by zalando.
the class EventStreamTest method endlessDummyConsumerForPartition.
private static NakadiKafkaConsumer endlessDummyConsumerForPartition(final String partition) throws NakadiException {
final NakadiKafkaConsumer nakadiKafkaConsumer = mock(NakadiKafkaConsumer.class);
when(nakadiKafkaConsumer.readEvents()).thenReturn(Collections.singletonList(new ConsumedEvent(DUMMY, NakadiCursor.of(TIMELINE, partition, "0"))));
return nakadiKafkaConsumer;
}
Aggregations