use of org.apache.kafka.clients.admin.ListConsumerGroupsResult in project ksql by confluentinc.
the class ListTopicsExecutorTest method shouldListKafkaTopicsExtended.
@Test
public void shouldListKafkaTopicsExtended() {
// Given:
engine.givenKafkaTopic("topic1");
engine.givenKafkaTopic("topic2");
final ListConsumerGroupsResult result = mock(ListConsumerGroupsResult.class);
final KafkaFutureImpl<Collection<ConsumerGroupListing>> groups = new KafkaFutureImpl<>();
when(result.all()).thenReturn(groups);
when(adminClient.listConsumerGroups()).thenReturn(result);
groups.complete(ImmutableList.of());
// When:
final KafkaTopicsListExtended topicsList = (KafkaTopicsListExtended) CUSTOM_EXECUTORS.listTopics().execute((ConfiguredStatement<ListTopics>) engine.configure("LIST TOPICS EXTENDED;"), mock(SessionProperties.class), engine.getEngine(), serviceContext).getEntity().orElseThrow(IllegalStateException::new);
// Then:
assertThat(topicsList.getTopics(), containsInAnyOrder(new KafkaTopicInfoExtended("topic1", ImmutableList.of(1), 0, 0), new KafkaTopicInfoExtended("topic2", ImmutableList.of(1), 0, 0)));
}
Aggregations