use of org.apache.kafka.common.requests.IsolationLevel in project apache-kafka-on-k8s by banzaicloud.
the class FetcherTest method testListOffsetsSendsIsolationLevel.
@Test
public void testListOffsetsSendsIsolationLevel() {
for (final IsolationLevel isolationLevel : IsolationLevel.values()) {
Fetcher<byte[], byte[]> fetcher = createFetcher(subscriptions, new Metrics(), new ByteArrayDeserializer(), new ByteArrayDeserializer(), Integer.MAX_VALUE, isolationLevel);
subscriptions.assignFromUser(singleton(tp0));
subscriptions.requestOffsetReset(tp0, OffsetResetStrategy.LATEST);
client.prepareResponse(new MockClient.RequestMatcher() {
@Override
public boolean matches(AbstractRequest body) {
ListOffsetRequest request = (ListOffsetRequest) body;
return request.isolationLevel() == isolationLevel;
}
}, listOffsetResponse(Errors.NONE, 1L, 5L));
fetcher.resetOffsetsIfNeeded();
consumerClient.pollNoWakeup();
assertFalse(subscriptions.isOffsetResetNeeded(tp0));
assertTrue(subscriptions.isFetchable(tp0));
assertEquals(5, subscriptions.position(tp0).longValue());
}
}
Aggregations