use of org.apache.kafka.clients.admin.AlterConfigsResult in project ksql by confluentinc.
the class KafkaTopicClientImplTest method alterTopicConfigResponse.
private static AlterConfigsResult alterTopicConfigResponse(final Exception cause) {
final AlterConfigsResult response = mock(AlterConfigsResult.class);
expect(response.all()).andReturn(failedFuture(cause));
replay(response);
return response;
}
use of org.apache.kafka.clients.admin.AlterConfigsResult in project strimzi by strimzi.
the class ControllerIT method alterTopicConfig.
private void alterTopicConfig(TestContext context, String topicName, String configMapName) throws InterruptedException, ExecutionException {
// Get the topic config
ConfigResource configResource = topicConfigResource(topicName);
org.apache.kafka.clients.admin.Config config = getTopicConfig(configResource);
String key = "compression.type";
Map<String, ConfigEntry> m = new HashMap<>();
for (ConfigEntry entry : config.entries()) {
m.put(entry.name(), entry);
}
final String changedValue;
if ("snappy".equals(m.get(key).value())) {
changedValue = "lz4";
} else {
changedValue = "snappy";
}
m.put(key, new ConfigEntry(key, changedValue));
LOGGER.info("Changing topic config {} to {}", key, changedValue);
// Update the topic config
AlterConfigsResult cgf = adminClient.alterConfigs(singletonMap(configResource, new org.apache.kafka.clients.admin.Config(m.values())));
cgf.all().get();
// Wait for the configmap to be modified
waitFor(context, () -> {
ConfigMap cm = kubeClient.configMaps().inNamespace(NAMESPACE).withName(configMapName).get();
LOGGER.info("Polled configmap {}, waiting for config change", configMapName);
String gotValue = TopicSerialization.fromConfigMap(cm).getConfig().get(key);
LOGGER.info("Got value {}", gotValue);
return changedValue.equals(gotValue);
}, timeout, "Expected the configmap to have been deleted by now");
}
use of org.apache.kafka.clients.admin.AlterConfigsResult in project ksql by confluentinc.
the class KafkaTopicClientImplTest method alterTopicConfigResponse.
private static AlterConfigsResult alterTopicConfigResponse() {
final AlterConfigsResult response = mock(AlterConfigsResult.class);
expect(response.all()).andReturn(KafkaFuture.completedFuture(null));
replay(response);
return response;
}
Aggregations