@Test public void resetBrokerConfig_existingConfig_resetsConfig() 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))); expect( adminClient.incrementalAlterConfigs( singletonMap( new ConfigResource(ConfigResource.Type.BROKER, String.valueOf(BROKER_ID)), singletonList( new AlterConfigOp( new ConfigEntry(CONFIG_1.getName(), null), AlterConfigOp.OpType.DELETE))))) .andReturn(alterConfigsResult); expect(alterConfigsResult.values()) .andReturn( singletonMap( new ConfigResource(ConfigResource.Type.BROKER, String.valueOf(BROKER_ID)), KafkaFuture.completedFuture(null))); replay(clusterManager, adminClient, describeConfigsResult, alterConfigsResult); brokerConfigManager.resetBrokerConfig( CLUSTER_ID, BROKER_ID, CONFIG_1.getName()).get(); verify(adminClient); }
@Override public CompletableFuture<Void> resetBrokerConfig( String clusterId, int brokerId, String name) { return safeResetConfig( clusterId, new ConfigResource(ConfigResource.Type.BROKER, String.valueOf(brokerId)), BrokerConfig.builder().setClusterId(clusterId).setBrokerId(brokerId), name); }
BrokerConfigManagerImpl extends AbstractConfigManager<BrokerConfig, BrokerConfig.Builder> implements BrokerConfigManager { @Override public CompletableFuture<Void> resetBrokerConfig( String clusterId, int brokerId, String name) { return safeResetConfig( clusterId, new ConfigResource(ConfigResource.Type.BROKER, String.valueOf(brokerId)), BrokerConfig.builder().setClusterId(clusterId).setBrokerId(brokerId), name); } }
BrokerConfigManagerImpl extends AbstractConfigManager<BrokerConfig, BrokerConfig.Builder> implements BrokerConfigManager { @Override public CompletableFuture<Void> resetBrokerConfig( String clusterId, int brokerId, String name) { return safeResetConfig( clusterId, new ConfigResource(ConfigResource.Type.BROKER, String.valueOf(brokerId)), BrokerConfig.builder().setClusterId(clusterId).setBrokerId(brokerId), name); } @Inject  BrokerConfigManagerImpl(Admin adminClient, ClusterManager clusterManager); }
BrokerConfigManagerImpl extends AbstractConfigManager<BrokerConfig, BrokerConfig.Builder> implements BrokerConfigManager { @Override public CompletableFuture<Void> resetBrokerConfig( String clusterId, int brokerId, String name) { return safeResetConfig( clusterId, new ConfigResource(ConfigResource.Type.BROKER, String.valueOf(brokerId)), BrokerConfig.builder().setClusterId(clusterId).setBrokerId(brokerId), name); } @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<Void> resetBrokerConfig( String clusterId, int brokerId, String name) { return safeResetConfig( clusterId, new ConfigResource(ConfigResource.Type.BROKER, String.valueOf(brokerId)), BrokerConfig.builder().setClusterId(clusterId).setBrokerId(brokerId), name); } @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);  }