Class AdminClientUnitTestEnv
java.lang.Object
org.apache.kafka.clients.admin.AdminClientUnitTestEnv
- All Implemented Interfaces:
AutoCloseable
Simple utility for setting up a mock
KafkaAdminClient that uses a MockClient for a supplied
Cluster. Create a Cluster manually or use TestUtils methods to
easily create a simple cluster.
To use in a test, create an instance and prepare its MockClient with the expected responses
for the Admin. Then, use the AdminClient in the test, which will then use the MockClient
and receive the responses you provided.
Since MockClient is not thread-safe,
users should be wary of calling its methods after the AdminClient is instantiated.
When finished, be sure to close the environment object.
-
Constructor Summary
ConstructorsConstructorDescriptionAdminClientUnitTestEnv(org.apache.kafka.common.Cluster cluster, String... vals) AdminClientUnitTestEnv(org.apache.kafka.common.utils.Time time, org.apache.kafka.common.Cluster cluster) AdminClientUnitTestEnv(org.apache.kafka.common.utils.Time time, org.apache.kafka.common.Cluster cluster, String... vals) AdminClientUnitTestEnv(org.apache.kafka.common.utils.Time time, org.apache.kafka.common.Cluster cluster, Map<String, Object> config) AdminClientUnitTestEnv(org.apache.kafka.common.utils.Time time, org.apache.kafka.common.Cluster cluster, Map<String, Object> config, Map<org.apache.kafka.common.Node, Long> unreachableNodes) AdminClientUnitTestEnv(org.apache.kafka.common.utils.Time time, org.apache.kafka.common.Cluster cluster, Map<String, Object> config, Map<org.apache.kafka.common.Node, Long> unreachableNodes, org.apache.kafka.clients.admin.internals.AdminRequestInterceptor.Factory interceptorFactory) -
Method Summary
-
Constructor Details
-
AdminClientUnitTestEnv
-
AdminClientUnitTestEnv
public AdminClientUnitTestEnv(org.apache.kafka.common.utils.Time time, org.apache.kafka.common.Cluster cluster, String... vals) -
AdminClientUnitTestEnv
public AdminClientUnitTestEnv(org.apache.kafka.common.utils.Time time, org.apache.kafka.common.Cluster cluster) -
AdminClientUnitTestEnv
-
AdminClientUnitTestEnv
-
AdminClientUnitTestEnv
-
-
Method Details
-
time
public org.apache.kafka.common.utils.Time time() -
cluster
public org.apache.kafka.common.Cluster cluster() -
adminClient
public io.confluent.kafka.clients.CloudAdmin adminClient() -
kafkaClient
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
kafkaAdminClientNetworkThreadPrefix
-