use of org.apache.kafka.common.message.OffsetFetchResponseData.OffsetFetchResponseGroup in project kafka by apache.
the class MessageTest method testOffsetFetchV8AndAboveSingleGroup.
@Test
public void testOffsetFetchV8AndAboveSingleGroup() throws Exception {
String groupId = "groupId";
String topicName = "topic";
List<OffsetFetchRequestTopics> topic = Collections.singletonList(new OffsetFetchRequestTopics().setName(topicName).setPartitionIndexes(Collections.singletonList(5)));
OffsetFetchRequestData allPartitionData = new OffsetFetchRequestData().setGroups(Collections.singletonList(new OffsetFetchRequestGroup().setGroupId(groupId).setTopics(null)));
OffsetFetchRequestData specifiedPartitionData = new OffsetFetchRequestData().setGroups(Collections.singletonList(new OffsetFetchRequestGroup().setGroupId(groupId).setTopics(topic))).setRequireStable(true);
testAllMessageRoundTripsOffsetFetchV8AndAbove(allPartitionData);
testAllMessageRoundTripsOffsetFetchV8AndAbove(specifiedPartitionData);
for (short version : ApiKeys.OFFSET_FETCH.allVersions()) {
if (version >= 8) {
testAllMessageRoundTripsOffsetFetchFromVersionV8AndAbove(version, specifiedPartitionData);
testAllMessageRoundTripsOffsetFetchFromVersionV8AndAbove(version, allPartitionData);
}
}
Supplier<OffsetFetchResponseData> response = () -> new OffsetFetchResponseData().setGroups(Collections.singletonList(new OffsetFetchResponseGroup().setGroupId(groupId).setTopics(Collections.singletonList(new OffsetFetchResponseTopics().setPartitions(Collections.singletonList(new OffsetFetchResponsePartitions().setPartitionIndex(5).setMetadata(null).setCommittedOffset(100).setCommittedLeaderEpoch(3).setErrorCode(Errors.UNKNOWN_TOPIC_OR_PARTITION.code()))))).setErrorCode(Errors.NOT_COORDINATOR.code()))).setThrottleTimeMs(10);
for (short version : ApiKeys.OFFSET_FETCH.allVersions()) {
if (version >= 8) {
OffsetFetchResponseData responseData = response.get();
testAllMessageRoundTripsOffsetFetchFromVersionV8AndAbove(version, responseData);
}
}
}
Aggregations