Search in sources :

Example 1 with ListTopicsResult

use of org.apache.kafka.clients.admin.ListTopicsResult in project ksql by confluentinc.

the class KafkaTopicClientImplTest method getListTopicsResult.

private ListTopicsResult getListTopicsResult() {
    ListTopicsResult listTopicsResult = mock(ListTopicsResult.class);
    List<String> topicNamesList = Arrays.asList(topicName1, topicName2, topicName3);
    expect(listTopicsResult.names()).andReturn(KafkaFuture.completedFuture(new HashSet<>(topicNamesList)));
    replay(listTopicsResult);
    return listTopicsResult;
}
Also used : ListTopicsResult(org.apache.kafka.clients.admin.ListTopicsResult) HashSet(java.util.HashSet)

Example 2 with ListTopicsResult

use of org.apache.kafka.clients.admin.ListTopicsResult in project strimzi by strimzi.

the class BaseKafkaImpl method listTopics.

@Override
public void listTopics(Handler<AsyncResult<Set<String>>> handler) {
    LOGGER.debug("Listing topics");
    ListTopicsResult future = adminClient.listTopics();
    queueWork(new UniWork<>("listTopics", future.names(), handler));
}
Also used : ListTopicsResult(org.apache.kafka.clients.admin.ListTopicsResult)

Example 3 with ListTopicsResult

use of org.apache.kafka.clients.admin.ListTopicsResult in project ksql by confluentinc.

the class KafkaTopicClientImplTest method getListTopicsResultWithInternalTopics.

private ListTopicsResult getListTopicsResultWithInternalTopics() {
    ListTopicsResult listTopicsResult = mock(ListTopicsResult.class);
    List<String> topicNamesList = Arrays.asList(topicName1, topicName2, topicName3, internalTopic1, internalTopic2, confluentInternalTopic);
    expect(listTopicsResult.names()).andReturn(KafkaFuture.completedFuture(new HashSet<>(topicNamesList)));
    replay(listTopicsResult);
    return listTopicsResult;
}
Also used : ListTopicsResult(org.apache.kafka.clients.admin.ListTopicsResult) HashSet(java.util.HashSet)

Example 4 with ListTopicsResult

use of org.apache.kafka.clients.admin.ListTopicsResult in project ksql by confluentinc.

the class KafkaTopicClientImplTest method getEmptyListTopicResult.

private ListTopicsResult getEmptyListTopicResult() {
    ListTopicsResult listTopicsResult = mock(ListTopicsResult.class);
    List<String> topicNamesList = Collections.emptyList();
    expect(listTopicsResult.names()).andReturn(KafkaFuture.completedFuture(new HashSet<>(topicNamesList)));
    replay(listTopicsResult);
    return listTopicsResult;
}
Also used : ListTopicsResult(org.apache.kafka.clients.admin.ListTopicsResult) HashSet(java.util.HashSet)

Example 5 with ListTopicsResult

use of org.apache.kafka.clients.admin.ListTopicsResult in project ksql by confluentinc.

the class KafkaTopicClientImplTest method listTopicResultWithNotControllerException.

@SuppressWarnings("unchecked")
private ListTopicsResult listTopicResultWithNotControllerException() {
    ListTopicsResult listTopicsResult = mock(ListTopicsResult.class);
    expect(listTopicsResult.names()).andReturn(failedFuture(new NotControllerException("Not Controller")));
    replay(listTopicsResult);
    return listTopicsResult;
}
Also used : ListTopicsResult(org.apache.kafka.clients.admin.ListTopicsResult) NotControllerException(org.apache.kafka.common.errors.NotControllerException)

Aggregations

ListTopicsResult (org.apache.kafka.clients.admin.ListTopicsResult)5 HashSet (java.util.HashSet)3 NotControllerException (org.apache.kafka.common.errors.NotControllerException)1