Search in sources :

Example 6 with TopicConfig

use of io.confluent.kafkarest.entities.TopicConfig in project kafka-rest by confluentinc.

the class ListAllTopicsConfigsActionTest method listTopicConfigs_noTopics_returnsEmptyConfigs.

@Test
public void listTopicConfigs_noTopics_returnsEmptyConfigs() {
    expect(topicManager.listTopics(CLUSTER_ID)).andReturn(completedFuture(new ArrayList<>()));
    expect(topicConfigManager.listTopicConfigs(CLUSTER_ID, new ArrayList<>())).andReturn(completedFuture(new HashMap<String, List<TopicConfig>>()));
    replay(topicManager, topicConfigManager);
    FakeAsyncResponse response = new FakeAsyncResponse();
    allTopicConfigsResource.listTopicConfigs(response, CLUSTER_ID);
    ListTopicConfigsResponse expected = ListTopicConfigsResponse.create(TopicConfigDataList.builder().setMetadata(ResourceCollection.Metadata.builder().setSelf("/v3/clusters/cluster-1/topics/-/configs").build()).setData(new ArrayList<>()).build());
    assertEquals(expected, response.getValue());
}
Also used : HashMap(java.util.HashMap) ListTopicConfigsResponse(io.confluent.kafkarest.entities.v3.ListTopicConfigsResponse) FakeAsyncResponse(io.confluent.kafkarest.response.FakeAsyncResponse) ArrayList(java.util.ArrayList) TopicConfig(io.confluent.kafkarest.entities.TopicConfig) Test(org.junit.jupiter.api.Test)

Aggregations

TopicConfig (io.confluent.kafkarest.entities.TopicConfig)6 Test (org.junit.jupiter.api.Test)5 ListTopicConfigsResponse (io.confluent.kafkarest.entities.v3.ListTopicConfigsResponse)3 DescribeConfigsOptions (org.apache.kafka.clients.admin.DescribeConfigsOptions)3 ConfigResource (org.apache.kafka.common.config.ConfigResource)3 FakeAsyncResponse (io.confluent.kafkarest.response.FakeAsyncResponse)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 TopicConfigManager (io.confluent.kafkarest.controllers.TopicConfigManager)1 TopicManager (io.confluent.kafkarest.controllers.TopicManager)1 ResourceCollection (io.confluent.kafkarest.entities.v3.ResourceCollection)1 TopicConfigDataList (io.confluent.kafkarest.entities.v3.TopicConfigDataList)1 ResourceName (io.confluent.kafkarest.extension.ResourceAccesslistFeature.ResourceName)1 AsyncResponses (io.confluent.kafkarest.resources.AsyncResponses)1 CrnFactory (io.confluent.kafkarest.response.CrnFactory)1 UrlFactory (io.confluent.kafkarest.response.UrlFactory)1 PerformanceMetric (io.confluent.rest.annotations.PerformanceMetric)1 Comparator (java.util.Comparator)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 CompletableFuture (java.util.concurrent.CompletableFuture)1