Skip to content

Commit

Permalink
fix: address deprecation of getAdminClient (#3276)
Browse files Browse the repository at this point in the history
  • Loading branch information
agavra authored Aug 26, 2019
1 parent 76aaa18 commit 6a50fca
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.Admin;
import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.streams.KafkaClientSupplier;
Expand Down Expand Up @@ -49,8 +49,8 @@ public Map<String, Object> injectSupplierProperties(final Map<String, Object> co
}

@Override
public AdminClient getAdminClient(final Map<String, Object> config) {
return defaultSupplier.getAdminClient(injectSupplierProperties(config));
public Admin getAdmin(final Map<String, Object> config) {
return defaultSupplier.getAdmin(injectSupplierProperties(config));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package io.confluent.ksql.services;

import java.util.Map;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.Admin;
import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.streams.KafkaClientSupplier;
Expand All @@ -35,7 +35,7 @@ class SandboxedKafkaClientSupplier implements KafkaClientSupplier {
}

@Override
public AdminClient getAdminClient(final Map<String, Object> config) {
public Admin getAdmin(final Map<String, Object> config) {
return new SandboxedAdminClient();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static ServiceContext create(
final KafkaClientSupplier kafkaClientSupplier,
final Supplier<SchemaRegistryClient> srClientFactory
) {
final Admin adminClient = kafkaClientSupplier.getAdminClient(
final Admin adminClient = kafkaClientSupplier.getAdmin(
ksqlConfig.getKsqlAdminClientConfigProps()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static KsqlContext create(
final KafkaClientSupplier clientSupplier = new DefaultKafkaClientSupplier();

final Admin adminClient = clientSupplier
.getAdminClient(ksqlConfig.getKsqlAdminClientConfigProps());
.getAdmin(ksqlConfig.getKsqlAdminClientConfigProps());

final KafkaTopicClient kafkaTopicClient = new KafkaTopicClientImpl(adminClient);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static class UnsupportedMethods {
@Parameterized.Parameters(name = "{0}")
public static Collection<TestCase<SandboxedKafkaClientSupplier>> getMethodsToTest() {
return TestMethods.builder(SandboxedKafkaClientSupplier.class)
.ignore("getAdminClient", Map.class)
.ignore("getAdmin", Map.class)
.ignore("getProducer", Map.class)
.ignore("getConsumer", Map.class)
.ignore("getRestoreConsumer", Map.class)
Expand Down Expand Up @@ -83,7 +83,7 @@ public void setUp() {

@Test
public void shouldReturnTryAdminClient() {
assertThat(sandboxedKafkaClientSupplier.getAdminClient(config),
assertThat(sandboxedKafkaClientSupplier.getAdmin(config),
is(instanceOf(SandboxedAdminClient.class)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static ServiceContext create(
) {
return create(
new FakeKafkaClientSupplier(),
new FakeKafkaClientSupplier().getAdminClient(Collections.emptyMap()),
new FakeKafkaClientSupplier().getAdmin(Collections.emptyMap()),
topicClient,
srClientFactory,
new DefaultConnectClient("http://localhost:8083")
Expand All @@ -73,7 +73,7 @@ public static ServiceContext create(
) {
final DefaultKafkaClientSupplier kafkaClientSupplier = new DefaultKafkaClientSupplier();
final Admin adminClient = kafkaClientSupplier
.getAdminClient(ksqlConfig.getKsqlAdminClientConfigProps());
.getAdmin(ksqlConfig.getKsqlAdminClientConfigProps());

return create(
kafkaClientSupplier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import java.util.Collections;
import java.util.Map;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.Admin;
import org.apache.kafka.clients.admin.MockAdminClient;
import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.consumer.MockConsumer;
Expand All @@ -30,7 +30,7 @@
public class FakeKafkaClientSupplier implements KafkaClientSupplier {

@Override
public AdminClient getAdminClient(final Map<String, Object> config) {
public Admin getAdmin(final Map<String, Object> config) {
final Node node = new Node(1, "localhost", 1234);
return new MockAdminClient(Collections.singletonList(node), node);
}
Expand Down

0 comments on commit 6a50fca

Please sign in to comment.