Search in sources :

Example 91 with Time

use of org.apache.kafka.common.utils.Time in project kafka by apache.

the class KafkaAdminClientTest method testOffsetCommitWithMultipleErrors.

@Test
public void testOffsetCommitWithMultipleErrors() throws Exception {
    final Cluster cluster = mockCluster(3, 0);
    final Time time = new MockTime();
    try (AdminClientUnitTestEnv env = new AdminClientUnitTestEnv(time, cluster, AdminClientConfig.RETRIES_CONFIG, "0")) {
        env.kafkaClient().setNodeApiVersions(NodeApiVersions.create());
        final TopicPartition foo0 = new TopicPartition("foo", 0);
        final TopicPartition foo1 = new TopicPartition("foo", 1);
        env.kafkaClient().prepareResponse(prepareFindCoordinatorResponse(Errors.NONE, env.cluster().controller()));
        Map<TopicPartition, Errors> responseData = new HashMap<>();
        responseData.put(foo0, Errors.NONE);
        responseData.put(foo1, Errors.UNKNOWN_TOPIC_OR_PARTITION);
        env.kafkaClient().prepareResponse(new OffsetCommitResponse(0, responseData));
        Map<TopicPartition, OffsetAndMetadata> offsets = new HashMap<>();
        offsets.put(foo0, new OffsetAndMetadata(123L));
        offsets.put(foo1, new OffsetAndMetadata(456L));
        final AlterConsumerGroupOffsetsResult result = env.adminClient().alterConsumerGroupOffsets(GROUP_ID, offsets);
        assertNull(result.partitionResult(foo0).get());
        TestUtils.assertFutureError(result.partitionResult(foo1), UnknownTopicOrPartitionException.class);
        TestUtils.assertFutureError(result.all(), UnknownTopicOrPartitionException.class);
    }
}
Also used : Errors(org.apache.kafka.common.protocol.Errors) HashMap(java.util.HashMap) TopicPartition(org.apache.kafka.common.TopicPartition) OffsetCommitResponse(org.apache.kafka.common.requests.OffsetCommitResponse) OffsetAndMetadata(org.apache.kafka.clients.consumer.OffsetAndMetadata) Cluster(org.apache.kafka.common.Cluster) Time(org.apache.kafka.common.utils.Time) MockTime(org.apache.kafka.common.utils.MockTime) MockTime(org.apache.kafka.common.utils.MockTime) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Test(org.junit.jupiter.api.Test)

Example 92 with Time

use of org.apache.kafka.common.utils.Time in project kafka by apache.

the class InFlightRequestsTest method testTimedOutNodes.

@Test
public void testTimedOutNodes() {
    Time time = new MockTime();
    addRequest("A", time.milliseconds(), 50);
    addRequest("B", time.milliseconds(), 200);
    addRequest("B", time.milliseconds(), 100);
    time.sleep(50);
    assertEquals(Collections.emptyList(), inFlightRequests.nodesWithTimedOutRequests(time.milliseconds()));
    time.sleep(25);
    assertEquals(Collections.singletonList("A"), inFlightRequests.nodesWithTimedOutRequests(time.milliseconds()));
    time.sleep(50);
    assertEquals(Arrays.asList("A", "B"), inFlightRequests.nodesWithTimedOutRequests(time.milliseconds()));
}
Also used : MockTime(org.apache.kafka.common.utils.MockTime) Time(org.apache.kafka.common.utils.Time) MockTime(org.apache.kafka.common.utils.MockTime) Test(org.junit.jupiter.api.Test)

Example 93 with Time

use of org.apache.kafka.common.utils.Time in project kafka by apache.

the class Sender method sendProduceRequest.

/**
 * Create a produce request from the given record batches
 */
private void sendProduceRequest(long now, int destination, short acks, int timeout, List<ProducerBatch> batches) {
    if (batches.isEmpty())
        return;
    final Map<TopicPartition, ProducerBatch> recordsByPartition = new HashMap<>(batches.size());
    // find the minimum magic version used when creating the record sets
    byte minUsedMagic = apiVersions.maxUsableProduceMagic();
    for (ProducerBatch batch : batches) {
        if (batch.magic() < minUsedMagic)
            minUsedMagic = batch.magic();
    }
    ProduceRequestData.TopicProduceDataCollection tpd = new ProduceRequestData.TopicProduceDataCollection();
    for (ProducerBatch batch : batches) {
        TopicPartition tp = batch.topicPartition;
        MemoryRecords records = batch.records();
        // which is supporting the new magic version to one which doesn't, then we will need to convert.
        if (!records.hasMatchingMagic(minUsedMagic))
            records = batch.records().downConvert(minUsedMagic, 0, time).records();
        ProduceRequestData.TopicProduceData tpData = tpd.find(tp.topic());
        if (tpData == null) {
            tpData = new ProduceRequestData.TopicProduceData().setName(tp.topic());
            tpd.add(tpData);
        }
        tpData.partitionData().add(new ProduceRequestData.PartitionProduceData().setIndex(tp.partition()).setRecords(records));
        recordsByPartition.put(tp, batch);
    }
    String transactionalId = null;
    if (transactionManager != null && transactionManager.isTransactional()) {
        transactionalId = transactionManager.transactionalId();
    }
    ProduceRequest.Builder requestBuilder = ProduceRequest.forMagic(minUsedMagic, new ProduceRequestData().setAcks(acks).setTimeoutMs(timeout).setTransactionalId(transactionalId).setTopicData(tpd));
    RequestCompletionHandler callback = response -> handleProduceResponse(response, recordsByPartition, time.milliseconds());
    String nodeId = Integer.toString(destination);
    ClientRequest clientRequest = client.newClientRequest(nodeId, requestBuilder, now, acks != 0, requestTimeoutMs, callback);
    client.send(clientRequest, now);
    log.trace("Sent produce request to {}: {}", nodeId, requestBuilder);
}
Also used : Max(org.apache.kafka.common.metrics.stats.Max) TransactionAbortedException(org.apache.kafka.common.errors.TransactionAbortedException) ProduceRequest(org.apache.kafka.common.requests.ProduceRequest) Metadata(org.apache.kafka.clients.Metadata) KafkaException(org.apache.kafka.common.KafkaException) HashMap(java.util.HashMap) RetriableException(org.apache.kafka.common.errors.RetriableException) AbstractRequest(org.apache.kafka.common.requests.AbstractRequest) ClusterAuthorizationException(org.apache.kafka.common.errors.ClusterAuthorizationException) Function(java.util.function.Function) ClientRequest(org.apache.kafka.clients.ClientRequest) InvalidRecordException(org.apache.kafka.common.InvalidRecordException) ArrayList(java.util.ArrayList) Cluster(org.apache.kafka.common.Cluster) RequestHeader(org.apache.kafka.common.requests.RequestHeader) FindCoordinatorRequest(org.apache.kafka.common.requests.FindCoordinatorRequest) InvalidMetadataException(org.apache.kafka.common.errors.InvalidMetadataException) KafkaClient(org.apache.kafka.clients.KafkaClient) RecordBatch(org.apache.kafka.common.record.RecordBatch) LogContext(org.apache.kafka.common.utils.LogContext) Map(java.util.Map) MetricName(org.apache.kafka.common.MetricName) ProduceRequestData(org.apache.kafka.common.message.ProduceRequestData) ProduceResponse(org.apache.kafka.common.requests.ProduceResponse) TopicPartition(org.apache.kafka.common.TopicPartition) Sensor(org.apache.kafka.common.metrics.Sensor) TimeoutException(org.apache.kafka.common.errors.TimeoutException) Logger(org.slf4j.Logger) Time(org.apache.kafka.common.utils.Time) Iterator(java.util.Iterator) IOException(java.io.IOException) ApiVersions(org.apache.kafka.clients.ApiVersions) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) MemoryRecords(org.apache.kafka.common.record.MemoryRecords) List(java.util.List) NetworkClientUtils(org.apache.kafka.clients.NetworkClientUtils) RequestCompletionHandler(org.apache.kafka.clients.RequestCompletionHandler) Avg(org.apache.kafka.common.metrics.stats.Avg) TopicAuthorizationException(org.apache.kafka.common.errors.TopicAuthorizationException) Errors(org.apache.kafka.common.protocol.Errors) Node(org.apache.kafka.common.Node) UnknownTopicOrPartitionException(org.apache.kafka.common.errors.UnknownTopicOrPartitionException) Meter(org.apache.kafka.common.metrics.stats.Meter) Collections(java.util.Collections) ClientResponse(org.apache.kafka.clients.ClientResponse) AuthenticationException(org.apache.kafka.common.errors.AuthenticationException) HashMap(java.util.HashMap) ProduceRequest(org.apache.kafka.common.requests.ProduceRequest) ProduceRequestData(org.apache.kafka.common.message.ProduceRequestData) RequestCompletionHandler(org.apache.kafka.clients.RequestCompletionHandler) TopicPartition(org.apache.kafka.common.TopicPartition) ClientRequest(org.apache.kafka.clients.ClientRequest) MemoryRecords(org.apache.kafka.common.record.MemoryRecords)

Example 94 with Time

use of org.apache.kafka.common.utils.Time in project kafka by apache.

the class SaslAuthenticatorTest method testTokenReauthenticationOverSaslScram.

@Test
public void testTokenReauthenticationOverSaslScram() throws Exception {
    SecurityProtocol securityProtocol = SecurityProtocol.SASL_SSL;
    TestJaasConfig jaasConfig = configureMechanisms("SCRAM-SHA-256", Arrays.asList("SCRAM-SHA-256"));
    // create jaas config for token auth
    Map<String, Object> options = new HashMap<>();
    String tokenId = "token1";
    String tokenHmac = "abcdefghijkl";
    // tokenId
    options.put("username", tokenId);
    // token hmac
    options.put("password", tokenHmac);
    // enable token authentication
    options.put(ScramLoginModule.TOKEN_AUTH_CONFIG, "true");
    jaasConfig.createOrUpdateEntry(TestJaasConfig.LOGIN_CONTEXT_CLIENT, ScramLoginModule.class.getName(), options);
    // ensure re-authentication based on token expiry rather than a default value
    saslServerConfigs.put(BrokerSecurityConfigs.CONNECTIONS_MAX_REAUTH_MS, Long.MAX_VALUE);
    /*
         * create a token cache that adjusts the token expiration dynamically so that
         * the first time the expiry is read during authentication we use it to define a
         * session expiration time that we can then sleep through; then the second time
         * the value is read (during re-authentication) it will be in the future.
         */
    Function<Integer, Long> tokenLifetime = callNum -> 10 * callNum * CONNECTIONS_MAX_REAUTH_MS_VALUE;
    DelegationTokenCache tokenCache = new DelegationTokenCache(ScramMechanism.mechanismNames()) {

        int callNum = 0;

        @Override
        public TokenInformation token(String tokenId) {
            TokenInformation baseTokenInfo = super.token(tokenId);
            long thisLifetimeMs = System.currentTimeMillis() + tokenLifetime.apply(++callNum).longValue();
            TokenInformation retvalTokenInfo = new TokenInformation(baseTokenInfo.tokenId(), baseTokenInfo.owner(), baseTokenInfo.renewers(), baseTokenInfo.issueTimestamp(), thisLifetimeMs, thisLifetimeMs);
            return retvalTokenInfo;
        }
    };
    server = createEchoServer(ListenerName.forSecurityProtocol(securityProtocol), securityProtocol, tokenCache);
    KafkaPrincipal owner = SecurityUtils.parseKafkaPrincipal("User:Owner");
    KafkaPrincipal renewer = SecurityUtils.parseKafkaPrincipal("User:Renewer1");
    TokenInformation tokenInfo = new TokenInformation(tokenId, owner, Collections.singleton(renewer), System.currentTimeMillis(), System.currentTimeMillis(), System.currentTimeMillis());
    server.tokenCache().addToken(tokenId, tokenInfo);
    updateTokenCredentialCache(tokenId, tokenHmac);
    // initial authentication must succeed
    createClientConnection(securityProtocol, "0");
    checkClientConnection("0");
    // ensure metrics are as expected before trying to re-authenticate
    server.verifyAuthenticationMetrics(1, 0);
    server.verifyReauthenticationMetrics(0, 0);
    /*
         * Now re-authenticate and ensure it succeeds. We have to sleep long enough so
         * that the current delegation token will be expired when the next write occurs;
         * this will trigger a re-authentication. Then the second time the delegation
         * token is read and transmitted to the server it will again have an expiration
         * date in the future.
         */
    delay(tokenLifetime.apply(1));
    checkClientConnection("0");
    server.verifyReauthenticationMetrics(1, 0);
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) MockTime(org.apache.kafka.common.utils.MockTime) Arrays(java.util.Arrays) ApiVersionsRequest(org.apache.kafka.common.requests.ApiVersionsRequest) SaslAuthenticateRequestData(org.apache.kafka.common.message.SaslAuthenticateRequestData) UnsupportedCallbackException(javax.security.auth.callback.UnsupportedCallbackException) KafkaException(org.apache.kafka.common.KafkaException) AuthenticateCallbackHandler(org.apache.kafka.common.security.auth.AuthenticateCallbackHandler) SaslException(javax.security.sasl.SaslException) SaslClient(javax.security.sasl.SaslClient) OAuthBearerIllegalTokenException(org.apache.kafka.common.security.oauthbearer.internals.unsecured.OAuthBearerIllegalTokenException) ScramCredentialUtils(org.apache.kafka.common.security.scram.internals.ScramCredentialUtils) ApiVersionsResponse(org.apache.kafka.common.requests.ApiVersionsResponse) ListOffsetsResponse(org.apache.kafka.common.requests.ListOffsetsResponse) LogContext(org.apache.kafka.common.utils.LogContext) Map(java.util.Map) TestUtils(org.apache.kafka.test.TestUtils) Set(java.util.Set) ScramLoginModule(org.apache.kafka.common.security.scram.ScramLoginModule) RequestHeaderData(org.apache.kafka.common.message.RequestHeaderData) PlainServerCallbackHandler(org.apache.kafka.common.security.plain.internals.PlainServerCallbackHandler) StandardCharsets(java.nio.charset.StandardCharsets) SecurityUtils(org.apache.kafka.common.utils.SecurityUtils) LIST_OFFSETS(org.apache.kafka.common.protocol.ApiKeys.LIST_OFFSETS) ApiMessageType(org.apache.kafka.common.message.ApiMessageType) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) ListOffsetsTopicResponse(org.apache.kafka.common.message.ListOffsetsResponseData.ListOffsetsTopicResponse) OAuthBearerUnsecuredJws(org.apache.kafka.common.security.oauthbearer.internals.unsecured.OAuthBearerUnsecuredJws) Errors(org.apache.kafka.common.protocol.Errors) NetworkSend(org.apache.kafka.common.network.NetworkSend) AuthenticationContext(org.apache.kafka.common.security.auth.AuthenticationContext) Callback(javax.security.auth.callback.Callback) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) Assertions.fail(org.junit.jupiter.api.Assertions.fail) Password(org.apache.kafka.common.config.types.Password) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) Selector(org.apache.kafka.common.network.Selector) AbstractResponse(org.apache.kafka.common.requests.AbstractResponse) ApiVersionsRequestData(org.apache.kafka.common.message.ApiVersionsRequestData) RequestTestUtils(org.apache.kafka.common.requests.RequestTestUtils) ListOffsetsPartitionResponse(org.apache.kafka.common.message.ListOffsetsResponseData.ListOffsetsPartitionResponse) OAuthBearerConfigException(org.apache.kafka.common.security.oauthbearer.internals.unsecured.OAuthBearerConfigException) Supplier(java.util.function.Supplier) OAuthBearerTokenCallback(org.apache.kafka.common.security.oauthbearer.OAuthBearerTokenCallback) ArrayList(java.util.ArrayList) ListenerName(org.apache.kafka.common.network.ListenerName) NetworkClient(org.apache.kafka.clients.NetworkClient) SaslAuthenticateRequest(org.apache.kafka.common.requests.SaslAuthenticateRequest) PlainLoginModule(org.apache.kafka.common.security.plain.PlainLoginModule) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) SslConfigs(org.apache.kafka.common.config.SslConfigs) SaslAuthenticationException(org.apache.kafka.common.errors.SaslAuthenticationException) ScramFormatter(org.apache.kafka.common.security.scram.internals.ScramFormatter) SelectionKey(java.nio.channels.SelectionKey) IOException(java.io.IOException) SslClientAuth(org.apache.kafka.common.config.SslClientAuth) AfterEach(org.junit.jupiter.api.AfterEach) OAuthBearerUnsecuredLoginCallbackHandler(org.apache.kafka.common.security.oauthbearer.internals.unsecured.OAuthBearerUnsecuredLoginCallbackHandler) NameCallback(javax.security.auth.callback.NameCallback) KafkaPrincipalBuilder(org.apache.kafka.common.security.auth.KafkaPrincipalBuilder) CertStores(org.apache.kafka.common.network.CertStores) ChannelState(org.apache.kafka.common.network.ChannelState) LoginException(javax.security.auth.login.LoginException) Random(java.util.Random) AbstractRequest(org.apache.kafka.common.requests.AbstractRequest) ChannelBuilder(org.apache.kafka.common.network.ChannelBuilder) SecurityProtocol(org.apache.kafka.common.security.auth.SecurityProtocol) TokenInformation(org.apache.kafka.common.security.token.delegation.TokenInformation) ByteBuffer(java.nio.ByteBuffer) CallbackHandler(javax.security.auth.callback.CallbackHandler) RequestHeader(org.apache.kafka.common.requests.RequestHeader) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) AssertionFailedError(org.opentest4j.AssertionFailedError) ApiVersionsResponseData(org.apache.kafka.common.message.ApiVersionsResponseData) Configuration(javax.security.auth.login.Configuration) PasswordCallback(javax.security.auth.callback.PasswordCallback) ByteBufferSend(org.apache.kafka.common.network.ByteBufferSend) Time(org.apache.kafka.common.utils.Time) OAuthBearerToken(org.apache.kafka.common.security.oauthbearer.OAuthBearerToken) BrokerSecurityConfigs(org.apache.kafka.common.config.internals.BrokerSecurityConfigs) TransportLayer(org.apache.kafka.common.network.TransportLayer) ApiVersionCollection(org.apache.kafka.common.message.ApiVersionsResponseData.ApiVersionCollection) DigestServerCallbackHandler(org.apache.kafka.common.security.authenticator.TestDigestLoginModule.DigestServerCallbackHandler) ScramMechanism(org.apache.kafka.common.security.scram.internals.ScramMechanism) InetSocketAddress(java.net.InetSocketAddress) Collectors(java.util.stream.Collectors) ListOffsetsResponseData(org.apache.kafka.common.message.ListOffsetsResponseData) SaslHandshakeRequestData(org.apache.kafka.common.message.SaslHandshakeRequestData) Test(org.junit.jupiter.api.Test) Base64(java.util.Base64) List(java.util.List) ChannelBuilders(org.apache.kafka.common.network.ChannelBuilders) ChannelMetadataRegistry(org.apache.kafka.common.network.ChannelMetadataRegistry) OAuthBearerLoginModule(org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule) IntStream(java.util.stream.IntStream) AppConfigurationEntry(javax.security.auth.login.AppConfigurationEntry) Encoder(java.util.Base64.Encoder) DelegationTokenCache(org.apache.kafka.common.security.token.delegation.internals.DelegationTokenCache) SaslAuthenticationContext(org.apache.kafka.common.security.auth.SaslAuthenticationContext) SaslChannelBuilder(org.apache.kafka.common.network.SaslChannelBuilder) HashMap(java.util.HashMap) JaasContext(org.apache.kafka.common.security.JaasContext) SchemaException(org.apache.kafka.common.protocol.types.SchemaException) Function(java.util.function.Function) LoginContext(javax.security.auth.login.LoginContext) MetadataRequest(org.apache.kafka.common.requests.MetadataRequest) SaslHandshakeResponse(org.apache.kafka.common.requests.SaslHandshakeResponse) ApiVersion(org.apache.kafka.common.message.ApiVersionsResponseData.ApiVersion) SaslConfigs(org.apache.kafka.common.config.SaslConfigs) Utils(org.apache.kafka.common.utils.Utils) ResponseHeader(org.apache.kafka.common.requests.ResponseHeader) SaslHandshakeRequest(org.apache.kafka.common.requests.SaslHandshakeRequest) Login(org.apache.kafka.common.security.auth.Login) ApiKeys(org.apache.kafka.common.protocol.ApiKeys) Subject(javax.security.auth.Subject) NetworkTestUtils(org.apache.kafka.common.network.NetworkTestUtils) Mode(org.apache.kafka.common.network.Mode) SslAuthenticationException(org.apache.kafka.common.errors.SslAuthenticationException) NioEchoServer(org.apache.kafka.common.network.NioEchoServer) TestSecurityConfig(org.apache.kafka.common.security.TestSecurityConfig) ScramCredential(org.apache.kafka.common.security.scram.ScramCredential) KafkaPrincipal(org.apache.kafka.common.security.auth.KafkaPrincipal) Collections(java.util.Collections) SSLPeerUnverifiedException(javax.net.ssl.SSLPeerUnverifiedException) HashMap(java.util.HashMap) SecurityProtocol(org.apache.kafka.common.security.auth.SecurityProtocol) TokenInformation(org.apache.kafka.common.security.token.delegation.TokenInformation) KafkaPrincipal(org.apache.kafka.common.security.auth.KafkaPrincipal) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ScramLoginModule(org.apache.kafka.common.security.scram.ScramLoginModule) DelegationTokenCache(org.apache.kafka.common.security.token.delegation.internals.DelegationTokenCache) Test(org.junit.jupiter.api.Test)

Example 95 with Time

use of org.apache.kafka.common.utils.Time in project kafka by apache.

the class KafkaConsumerTest method testMeasureCommitSyncDuration.

@Test
public void testMeasureCommitSyncDuration() {
    Time time = new MockTime(Duration.ofSeconds(1).toMillis());
    SubscriptionState subscription = new SubscriptionState(new LogContext(), OffsetResetStrategy.EARLIEST);
    ConsumerMetadata metadata = createMetadata(subscription);
    MockClient client = new MockClient(time, metadata);
    initMetadata(client, Collections.singletonMap(topic, 2));
    Node node = metadata.fetch().nodes().get(0);
    KafkaConsumer<String, String> consumer = newConsumer(time, client, subscription, metadata, assignor, true, groupInstanceId);
    consumer.assign(singletonList(tp0));
    client.prepareResponseFrom(FindCoordinatorResponse.prepareResponse(Errors.NONE, groupId, node), node);
    Node coordinator = new Node(Integer.MAX_VALUE - node.id(), node.host(), node.port());
    client.prepareResponseFrom(offsetCommitResponse(Collections.singletonMap(tp0, Errors.NONE)), coordinator);
    consumer.commitSync(Collections.singletonMap(tp0, new OffsetAndMetadata(10L)));
    final Metric metric = consumer.metrics().get(consumer.metrics.metricName("commit-sync-time-ns-total", "consumer-metrics"));
    assertTrue((Double) metric.metricValue() >= Duration.ofMillis(999).toNanos());
}
Also used : ConsumerMetadata(org.apache.kafka.clients.consumer.internals.ConsumerMetadata) SubscriptionState(org.apache.kafka.clients.consumer.internals.SubscriptionState) Node(org.apache.kafka.common.Node) LogContext(org.apache.kafka.common.utils.LogContext) MockTime(org.apache.kafka.common.utils.MockTime) Time(org.apache.kafka.common.utils.Time) Metric(org.apache.kafka.common.Metric) MockTime(org.apache.kafka.common.utils.MockTime) MockClient(org.apache.kafka.clients.MockClient) Test(org.junit.jupiter.api.Test)

Aggregations

Time (org.apache.kafka.common.utils.Time)125 MockTime (org.apache.kafka.common.utils.MockTime)107 Test (org.junit.jupiter.api.Test)63 MockClient (org.apache.kafka.clients.MockClient)55 HashMap (java.util.HashMap)53 Cluster (org.apache.kafka.common.Cluster)41 Test (org.junit.Test)40 Node (org.apache.kafka.common.Node)39 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)32 MetadataResponse (org.apache.kafka.common.requests.MetadataResponse)31 StringSerializer (org.apache.kafka.common.serialization.StringSerializer)30 Metadata (org.apache.kafka.clients.Metadata)28 ProducerMetadata (org.apache.kafka.clients.producer.internals.ProducerMetadata)25 TopicPartition (org.apache.kafka.common.TopicPartition)22 PartitionAssignor (org.apache.kafka.clients.consumer.internals.PartitionAssignor)21 LogContext (org.apache.kafka.common.utils.LogContext)17 Map (java.util.Map)14 Properties (java.util.Properties)14 MetricName (org.apache.kafka.common.MetricName)14 ExecutionException (java.util.concurrent.ExecutionException)13