Search in sources :

Example 6 with BrokerConfig

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

the class BrokerConfigManagerImplTest method getBrokerConfig_existingConfig_returnsConfig.

@Test
public void getBrokerConfig_existingConfig_returnsConfig() throws Exception {
    expect(clusterManager.getCluster(CLUSTER_ID)).andReturn(completedFuture(Optional.of(CLUSTER)));
    expect(adminClient.describeConfigs(eq(singletonList(new ConfigResource(ConfigResource.Type.BROKER, String.valueOf(BROKER_ID)))), anyObject(DescribeConfigsOptions.class))).andReturn(describeConfigsResult);
    expect(describeConfigsResult.all()).andReturn(KafkaFuture.completedFuture(singletonMap(new ConfigResource(ConfigResource.Type.BROKER, String.valueOf(BROKER_ID)), CONFIG)));
    replay(adminClient, clusterManager, describeConfigsResult);
    BrokerConfig config = brokerConfigManager.getBrokerConfig(CLUSTER_ID, BROKER_ID, CONFIG_1.getName()).get().get();
    assertEquals(CONFIG_1, config);
}
Also used : BrokerConfig(io.confluent.kafkarest.entities.BrokerConfig) DescribeConfigsOptions(org.apache.kafka.clients.admin.DescribeConfigsOptions) ConfigResource(org.apache.kafka.common.config.ConfigResource) Test(org.junit.jupiter.api.Test)

Aggregations

BrokerConfig (io.confluent.kafkarest.entities.BrokerConfig)6 Test (org.junit.jupiter.api.Test)5 ListBrokerConfigsResponse (io.confluent.kafkarest.entities.v3.ListBrokerConfigsResponse)3 DescribeConfigsOptions (org.apache.kafka.clients.admin.DescribeConfigsOptions)3 ConfigResource (org.apache.kafka.common.config.ConfigResource)3 FakeAsyncResponse (io.confluent.kafkarest.response.FakeAsyncResponse)2 HashMap (java.util.HashMap)2 BrokerConfigManager (io.confluent.kafkarest.controllers.BrokerConfigManager)1 BrokerManager (io.confluent.kafkarest.controllers.BrokerManager)1 Broker (io.confluent.kafkarest.entities.Broker)1 BrokerConfigDataList (io.confluent.kafkarest.entities.v3.BrokerConfigDataList)1 ResourceCollection (io.confluent.kafkarest.entities.v3.ResourceCollection)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 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1