Search in sources :

Example 6 with ListBrokerConfigsResponse

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

the class BrokerConfigResourceTest method listBrokerConfigs_existingBroker_returnsConfigs.

@Test
public void listBrokerConfigs_existingBroker_returnsConfigs() {
    expect(brokerConfigManager.listBrokerConfigs(CLUSTER_ID, BROKER_ID)).andReturn(completedFuture(Arrays.asList(CONFIG_1, CONFIG_2, CONFIG_3)));
    replay(brokerConfigManager);
    FakeAsyncResponse response = new FakeAsyncResponse();
    brokerConfigsResource.listBrokerConfigs(response, CLUSTER_ID, BROKER_ID);
    ListBrokerConfigsResponse expected = ListBrokerConfigsResponse.create(BrokerConfigDataList.builder().setMetadata(ResourceCollection.Metadata.builder().setSelf("/v3/clusters/cluster-1/brokers/1/configs").build()).setData(Arrays.asList(BrokerConfigData.builder().setMetadata(Resource.Metadata.builder().setSelf("/v3/clusters/cluster-1/brokers/1/configs/config-1").setResourceName("crn:///kafka=cluster-1/broker=1/config=config-1").build()).setClusterId(CLUSTER_ID).setBrokerId(BROKER_ID).setName(CONFIG_1.getName()).setValue(CONFIG_1.getValue()).setDefault(CONFIG_1.isDefault()).setReadOnly(CONFIG_1.isReadOnly()).setSensitive(CONFIG_1.isSensitive()).setSource(CONFIG_1.getSource()).setSynonyms(CONFIG_1.getSynonyms().stream().map(ConfigSynonymData::fromConfigSynonym).collect(Collectors.toList())).build(), BrokerConfigData.builder().setMetadata(Resource.Metadata.builder().setSelf("/v3/clusters/cluster-1/brokers/1/configs/config-2").setResourceName("crn:///kafka=cluster-1/broker=1/config=config-2").build()).setClusterId(CLUSTER_ID).setBrokerId(BROKER_ID).setName(CONFIG_2.getName()).setValue(CONFIG_2.getValue()).setDefault(CONFIG_2.isDefault()).setReadOnly(CONFIG_2.isReadOnly()).setSensitive(CONFIG_2.isSensitive()).setSource(CONFIG_2.getSource()).setSynonyms(CONFIG_2.getSynonyms().stream().map(ConfigSynonymData::fromConfigSynonym).collect(Collectors.toList())).build(), BrokerConfigData.builder().setMetadata(Resource.Metadata.builder().setSelf("/v3/clusters/cluster-1/brokers/1/configs/config-3").setResourceName("crn:///kafka=cluster-1/broker=1/config=config-3").build()).setClusterId(CLUSTER_ID).setBrokerId(BROKER_ID).setName(CONFIG_3.getName()).setValue(CONFIG_3.getValue()).setDefault(CONFIG_3.isDefault()).setReadOnly(CONFIG_3.isReadOnly()).setSensitive(CONFIG_3.isSensitive()).setSource(CONFIG_3.getSource()).setSynonyms(CONFIG_3.getSynonyms().stream().map(ConfigSynonymData::fromConfigSynonym).collect(Collectors.toList())).build())).build());
    assertEquals(expected, response.getValue());
}
Also used : FakeAsyncResponse(io.confluent.kafkarest.response.FakeAsyncResponse) ListBrokerConfigsResponse(io.confluent.kafkarest.entities.v3.ListBrokerConfigsResponse) Test(org.junit.jupiter.api.Test)

Aggregations

ListBrokerConfigsResponse (io.confluent.kafkarest.entities.v3.ListBrokerConfigsResponse)6 Test (org.junit.jupiter.api.Test)5 BrokerConfig (io.confluent.kafkarest.entities.BrokerConfig)3 ResourceCollection (io.confluent.kafkarest.entities.v3.ResourceCollection)3 FakeAsyncResponse (io.confluent.kafkarest.response.FakeAsyncResponse)3 BrokerConfigData (io.confluent.kafkarest.entities.v3.BrokerConfigData)2 HashMap (java.util.HashMap)2 Collectors (java.util.stream.Collectors)2 MediaType (javax.ws.rs.core.MediaType)2 Response (javax.ws.rs.core.Response)2 ImmutableList (com.google.common.collect.ImmutableList)1 BrokerConfigManager (io.confluent.kafkarest.controllers.BrokerConfigManager)1 BrokerManager (io.confluent.kafkarest.controllers.BrokerManager)1 Broker (io.confluent.kafkarest.entities.Broker)1 ConfigSource (io.confluent.kafkarest.entities.ConfigSource)1 BrokerConfigDataList (io.confluent.kafkarest.entities.v3.BrokerConfigDataList)1 ConfigSynonymData (io.confluent.kafkarest.entities.v3.ConfigSynonymData)1 GetBrokerConfigResponse (io.confluent.kafkarest.entities.v3.GetBrokerConfigResponse)1 Resource (io.confluent.kafkarest.entities.v3.Resource)1 ResourceName (io.confluent.kafkarest.extension.ResourceAccesslistFeature.ResourceName)1