@Test public void listBrokerConfigs_existingBroker_returnsConfigs() 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.values()) .andReturn( singletonMap( new ConfigResource(ConfigResource.Type.BROKER, String.valueOf(BROKER_ID)), KafkaFuture.completedFuture(CONFIG))); replay(adminClient, clusterManager, describeConfigsResult); List<BrokerConfig> configs = brokerConfigManager.listBrokerConfigs(CLUSTER_ID, BROKER_ID).get(); assertEquals(new HashSet<>(Arrays.asList(CONFIG_1, CONFIG_2, CONFIG_3)), new HashSet<>(configs)); }
@Override public CompletableFuture<List<BrokerConfig>> listBrokerConfigs( String clusterId, int brokerId) { return listConfigs( clusterId, new ConfigResource(ConfigResource.Type.BROKER, String.valueOf(brokerId)), BrokerConfig.builder().setClusterId(clusterId).setBrokerId(brokerId)); }
BrokerConfigManagerImpl extends AbstractConfigManager<BrokerConfig, BrokerConfig.Builder> implements BrokerConfigManager { @Override public CompletableFuture<List<BrokerConfig>> listBrokerConfigs( String clusterId, int brokerId) { return listConfigs( clusterId, new ConfigResource(ConfigResource.Type.BROKER, String.valueOf(brokerId)), BrokerConfig.builder().setClusterId(clusterId).setBrokerId(brokerId)); } }
BrokerConfigManagerImpl extends AbstractConfigManager<BrokerConfig, BrokerConfig.Builder> implements BrokerConfigManager { @Override public CompletableFuture<List<BrokerConfig>> listBrokerConfigs( String clusterId, int brokerId) { return listConfigs( clusterId, new ConfigResource(ConfigResource.Type.BROKER, String.valueOf(brokerId)), BrokerConfig.builder().setClusterId(clusterId).setBrokerId(brokerId)); } @Inject  BrokerConfigManagerImpl(Admin adminClient, ClusterManager clusterManager); }
BrokerConfigManagerImpl extends AbstractConfigManager<BrokerConfig, BrokerConfig.Builder> implements BrokerConfigManager { @Override public CompletableFuture<List<BrokerConfig>> listBrokerConfigs( String clusterId, int brokerId) { return listConfigs( clusterId, new ConfigResource(ConfigResource.Type.BROKER, String.valueOf(brokerId)), BrokerConfig.builder().setClusterId(clusterId).setBrokerId(brokerId)); } @Inject  BrokerConfigManagerImpl(Admin adminClient, ClusterManager clusterManager); @Override CompletableFuture<List<BrokerConfig>> listBrokerConfigs(
      String clusterId, int brokerId); @Override CompletableFuture<Optional<BrokerConfig>> getBrokerConfig(
      String clusterId, int brokerId, String name); @Override CompletableFuture<Void> updateBrokerConfig(
      String clusterId, int brokerId, String name, String newValue); @Override CompletableFuture<Void> resetBrokerConfig(
      String clusterId, int brokerId, String name); @Override CompletableFuture<Void> alterBrokerConfigs(
      String clusterId, int brokerId, List<AlterConfigCommand> commands); }
BrokerConfigManagerImpl extends AbstractConfigManager<BrokerConfig, BrokerConfig.Builder> implements BrokerConfigManager { @Override public CompletableFuture<List<BrokerConfig>> listBrokerConfigs( String clusterId, int brokerId) { return listConfigs( clusterId, new ConfigResource(ConfigResource.Type.BROKER, String.valueOf(brokerId)), BrokerConfig.builder().setClusterId(clusterId).setBrokerId(brokerId)); } @Inject  BrokerConfigManagerImpl(Admin adminClient, ClusterManager clusterManager); @Override CompletableFuture<List<BrokerConfig>> listBrokerConfigs(
      String clusterId, int brokerId); @Override CompletableFuture<Optional<BrokerConfig>> getBrokerConfig(
      String clusterId, int brokerId, String name); @Override CompletableFuture<Void> updateBrokerConfig(
      String clusterId, int brokerId, String name, String newValue); @Override CompletableFuture<Void> resetBrokerConfig(
      String clusterId, int brokerId, String name); @Override CompletableFuture<Void> alterBrokerConfigs(
      String clusterId, int brokerId, List<AlterConfigCommand> commands);  }