KAFKA-10787 Apply spotless to transaction-coordinator and server-common (#16172)

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
gongxuanzhang 2024-06-09 05:36:17 +08:00 committed by GitHub
parent 3d5d1504f7
commit 816209d187
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
56 changed files with 189 additions and 131 deletions

View File

@ -221,7 +221,6 @@ def excludedSpotlessModules = [':clients',
':metadata', ':metadata',
':raft', ':raft',
':server', ':server',
':server-common',
':shell', ':shell',
':storage', ':storage',
':storage:storage-api', // rename in settings.gradle ':storage:storage-api', // rename in settings.gradle
@ -254,7 +253,6 @@ def excludedSpotlessModules = [':clients',
':streams:upgrade-system-tests-37', ':streams:upgrade-system-tests-37',
':tools', ':tools',
':tools:tools-api', ':tools:tools-api',
':transaction-coordinator',
':trogdor'] ':trogdor']
@ -842,8 +840,10 @@ subprojects {
skipProjects = [ ":jmh-benchmarks", ":trogdor" ] skipProjects = [ ":jmh-benchmarks", ":trogdor" ]
skipConfigurations = [ "zinc" ] skipConfigurations = [ "zinc" ]
} }
// the task `removeUnusedImports` is implemented by google-java-format,
if(JavaVersion.current().isJava11Compatible() && project.path !in excludedSpotlessModules) { // and unfortunately the google-java-format version used by spotless 6.14.0 can't work with JDK 21.
// Hence, we apply spotless tasks only if the env is either JDK11 or JDK17
if ((JavaVersion.current().isJava11() || (JavaVersion.current() == JavaVersion.VERSION_17)) && project.path !in excludedSpotlessModules) {
apply plugin: 'com.diffplug.spotless' apply plugin: 'com.diffplug.spotless'
spotless { spotless {
java { java {

View File

@ -18,6 +18,7 @@
package org.apache.kafka.deferred; package org.apache.kafka.deferred;
import org.apache.kafka.common.utils.LogContext; import org.apache.kafka.common.utils.LogContext;
import org.slf4j.Logger; import org.slf4j.Logger;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -17,6 +17,13 @@
package org.apache.kafka.queue; package org.apache.kafka.queue;
import org.apache.kafka.common.errors.TimeoutException;
import org.apache.kafka.common.utils.KafkaThread;
import org.apache.kafka.common.utils.LogContext;
import org.apache.kafka.common.utils.Time;
import org.slf4j.Logger;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@ -28,12 +35,6 @@ import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Function; import java.util.function.Function;
import org.apache.kafka.common.errors.TimeoutException;
import org.apache.kafka.common.utils.KafkaThread;
import org.apache.kafka.common.utils.LogContext;
import org.apache.kafka.common.utils.Time;
import org.slf4j.Logger;
public final class KafkaEventQueue implements EventQueue { public final class KafkaEventQueue implements EventQueue {

View File

@ -20,10 +20,6 @@ import org.apache.kafka.common.config.ConfigException;
import org.apache.kafka.common.config.types.Password; import org.apache.kafka.common.config.types.Password;
import org.apache.kafka.server.util.Csv; import org.apache.kafka.server.util.Csv;
import javax.crypto.Cipher;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
@ -33,6 +29,11 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.crypto.Cipher;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
/** /**
* Password encoder and decoder implementation. Encoded passwords are persisted as a CSV map * Password encoder and decoder implementation. Encoded passwords are persisted as a CSV map
* containing the encoded password in base64 and along with the properties used for encryption. * containing the encoded password in base64 and along with the properties used for encryption.

View File

@ -16,13 +16,14 @@
*/ */
package org.apache.kafka.security; package org.apache.kafka.security;
import javax.crypto.spec.GCMParameterSpec;
import java.security.AlgorithmParameters; import java.security.AlgorithmParameters;
import java.security.spec.AlgorithmParameterSpec; import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.InvalidParameterSpecException; import java.security.spec.InvalidParameterSpecException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.crypto.spec.GCMParameterSpec;
public class GcmParamsEncoder implements CipherParamsEncoder { public class GcmParamsEncoder implements CipherParamsEncoder {
private static final String AUTHENTICATION_TAG_LENGTH = "authenticationTagLength"; private static final String AUTHENTICATION_TAG_LENGTH = "authenticationTagLength";

View File

@ -16,13 +16,14 @@
*/ */
package org.apache.kafka.security; package org.apache.kafka.security;
import javax.crypto.spec.IvParameterSpec;
import java.security.AlgorithmParameters; import java.security.AlgorithmParameters;
import java.security.spec.AlgorithmParameterSpec; import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.InvalidParameterSpecException; import java.security.spec.InvalidParameterSpecException;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
import javax.crypto.spec.IvParameterSpec;
public class IvParamsEncoder implements CipherParamsEncoder { public class IvParamsEncoder implements CipherParamsEncoder {
@Override @Override

View File

@ -16,12 +16,13 @@
*/ */
package org.apache.kafka.server.common; package org.apache.kafka.server.common;
import org.apache.kafka.common.record.RecordVersion;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.apache.kafka.common.record.RecordVersion;
/** /**
* This class contains the different Kafka versions. * This class contains the different Kafka versions.

View File

@ -16,11 +16,12 @@
*/ */
package org.apache.kafka.server.common; package org.apache.kafka.server.common;
import java.util.Arrays;
import java.util.stream.Collectors;
import org.apache.kafka.common.config.ConfigDef.Validator; import org.apache.kafka.common.config.ConfigDef.Validator;
import org.apache.kafka.common.config.ConfigException; import org.apache.kafka.common.config.ConfigException;
import java.util.Arrays;
import java.util.stream.Collectors;
public class MetadataVersionValidator implements Validator { public class MetadataVersionValidator implements Validator {
@Override @Override

View File

@ -18,6 +18,7 @@ package org.apache.kafka.server.config;
import org.apache.kafka.common.config.ConfigDef; import org.apache.kafka.common.config.ConfigDef;
import org.apache.kafka.common.security.scram.internals.ScramMechanism; import org.apache.kafka.common.security.scram.internals.ScramMechanism;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;

View File

@ -16,7 +16,8 @@
*/ */
package org.apache.kafka.server.config; package org.apache.kafka.server.config;
import static java.util.Arrays.asList; import org.apache.kafka.common.config.TopicConfig;
import org.apache.kafka.common.utils.Utils;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -25,8 +26,8 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.kafka.common.config.TopicConfig;
import org.apache.kafka.common.utils.Utils; import static java.util.Arrays.asList;
public final class ServerTopicConfigSynonyms { public final class ServerTopicConfigSynonyms {
public static final String LOG_PREFIX = "log."; public static final String LOG_PREFIX = "log.";

View File

@ -17,11 +17,13 @@
package org.apache.kafka.server.fault; package org.apache.kafka.server.fault;
import java.util.Objects;
import org.apache.kafka.common.utils.Exit; import org.apache.kafka.common.utils.Exit;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Objects;
/** /**
* This is a fault handler which terminates the JVM process. * This is a fault handler which terminates the JVM process.
*/ */

View File

@ -18,6 +18,7 @@
package org.apache.kafka.server.immutable.pcollections; package org.apache.kafka.server.immutable.pcollections;
import org.apache.kafka.server.immutable.ImmutableMap; import org.apache.kafka.server.immutable.ImmutableMap;
import org.pcollections.HashPMap; import org.pcollections.HashPMap;
import org.pcollections.HashTreePMap; import org.pcollections.HashTreePMap;

View File

@ -18,6 +18,7 @@
package org.apache.kafka.server.immutable.pcollections; package org.apache.kafka.server.immutable.pcollections;
import org.apache.kafka.server.immutable.ImmutableNavigableSet; import org.apache.kafka.server.immutable.ImmutableNavigableSet;
import org.pcollections.TreePSet; import org.pcollections.TreePSet;
import java.util.Collection; import java.util.Collection;

View File

@ -18,6 +18,7 @@
package org.apache.kafka.server.immutable.pcollections; package org.apache.kafka.server.immutable.pcollections;
import org.apache.kafka.server.immutable.ImmutableSet; import org.apache.kafka.server.immutable.ImmutableSet;
import org.pcollections.HashTreePSet; import org.pcollections.HashTreePSet;
import org.pcollections.MapPSet; import org.pcollections.MapPSet;

View File

@ -16,19 +16,20 @@
*/ */
package org.apache.kafka.server.metrics; package org.apache.kafka.server.metrics;
import java.util.Collections; import org.apache.kafka.common.utils.Sanitizer;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import com.yammer.metrics.core.Gauge; import com.yammer.metrics.core.Gauge;
import com.yammer.metrics.core.Histogram; import com.yammer.metrics.core.Histogram;
import com.yammer.metrics.core.Meter; import com.yammer.metrics.core.Meter;
import com.yammer.metrics.core.MetricName; import com.yammer.metrics.core.MetricName;
import com.yammer.metrics.core.Timer; import com.yammer.metrics.core.Timer;
import org.apache.kafka.common.utils.Sanitizer;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
public class KafkaMetricsGroup { public class KafkaMetricsGroup {
private final Class<?> klass; private final Class<?> klass;

View File

@ -17,14 +17,15 @@
package org.apache.kafka.server.metrics; package org.apache.kafka.server.metrics;
import com.yammer.metrics.core.MetricName;
import com.yammer.metrics.core.MetricsRegistry;
import org.apache.kafka.common.Reconfigurable; import org.apache.kafka.common.Reconfigurable;
import org.apache.kafka.common.config.ConfigException; import org.apache.kafka.common.config.ConfigException;
import org.apache.kafka.common.metrics.JmxReporter; import org.apache.kafka.common.metrics.JmxReporter;
import org.apache.kafka.common.utils.Exit; import org.apache.kafka.common.utils.Exit;
import org.apache.kafka.common.utils.Sanitizer; import org.apache.kafka.common.utils.Sanitizer;
import com.yammer.metrics.core.MetricName;
import com.yammer.metrics.core.MetricsRegistry;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;

View File

@ -21,6 +21,7 @@ import org.apache.kafka.common.Endpoint;
import org.apache.kafka.common.utils.LogContext; import org.apache.kafka.common.utils.LogContext;
import org.apache.kafka.server.authorizer.Authorizer; import org.apache.kafka.server.authorizer.Authorizer;
import org.apache.kafka.server.authorizer.AuthorizerServerInfo; import org.apache.kafka.server.authorizer.AuthorizerServerInfo;
import org.slf4j.Logger; import org.slf4j.Logger;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -16,9 +16,6 @@
*/ */
package org.apache.kafka.server.util; package org.apache.kafka.server.util;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import org.apache.kafka.clients.CommonClientConfigs; import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.admin.AdminClientConfig; import org.apache.kafka.clients.admin.AdminClientConfig;
import org.apache.kafka.common.utils.AppInfoParser; import org.apache.kafka.common.utils.AppInfoParser;
@ -31,6 +28,10 @@ import java.util.Optional;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
/** /**
* Helper functions for dealing with command line utilities. * Helper functions for dealing with command line utilities.
*/ */

View File

@ -17,6 +17,7 @@
package org.apache.kafka.server.util; package org.apache.kafka.server.util;
import org.apache.kafka.common.utils.Time; import org.apache.kafka.common.utils.Time;
import org.slf4j.Logger; import org.slf4j.Logger;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -16,16 +16,6 @@
*/ */
package org.apache.kafka.server.util; package org.apache.kafka.server.util;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.kafka.clients.ClientRequest; import org.apache.kafka.clients.ClientRequest;
import org.apache.kafka.clients.ClientResponse; import org.apache.kafka.clients.ClientResponse;
import org.apache.kafka.clients.KafkaClient; import org.apache.kafka.clients.KafkaClient;
@ -37,6 +27,17 @@ import org.apache.kafka.common.internals.FatalExitError;
import org.apache.kafka.common.utils.Time; import org.apache.kafka.common.utils.Time;
import org.apache.kafka.common.utils.Utils; import org.apache.kafka.common.utils.Utils;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
/** /**
* An inter-broker send thread that utilizes a non-blocking network client. * An inter-broker send thread that utilizes a non-blocking network client.
*/ */

View File

@ -17,11 +17,12 @@
package org.apache.kafka.server.util; package org.apache.kafka.server.util;
import org.apache.kafka.server.util.json.JsonValue;
import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.MissingNode; import com.fasterxml.jackson.databind.node.MissingNode;
import org.apache.kafka.server.util.json.JsonValue;
import java.io.IOException; import java.io.IOException;
import java.util.Optional; import java.util.Optional;

View File

@ -17,6 +17,7 @@
package org.apache.kafka.server.util; package org.apache.kafka.server.util;
import org.apache.kafka.common.utils.KafkaThread; import org.apache.kafka.common.utils.KafkaThread;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View File

@ -20,6 +20,7 @@ package org.apache.kafka.server.util;
import org.apache.kafka.common.internals.FatalExitError; import org.apache.kafka.common.internals.FatalExitError;
import org.apache.kafka.common.utils.Exit; import org.apache.kafka.common.utils.Exit;
import org.apache.kafka.common.utils.LogContext; import org.apache.kafka.common.utils.LogContext;
import org.slf4j.Logger; import org.slf4j.Logger;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;

View File

@ -136,4 +136,3 @@ public class ThroughputThrottler {
} }
} }
} }

View File

@ -17,6 +17,7 @@
package org.apache.kafka.server.util; package org.apache.kafka.server.util;
import org.apache.kafka.common.internals.Topic; import org.apache.kafka.common.internals.Topic;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View File

@ -17,15 +17,16 @@
package org.apache.kafka.timeline; package org.apache.kafka.timeline;
import org.apache.kafka.common.utils.LogContext;
import org.slf4j.Logger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.kafka.common.utils.LogContext;
import org.slf4j.Logger;
/** /**
* A registry containing snapshots of timeline data structures. * A registry containing snapshots of timeline data structures.

View File

@ -17,14 +17,15 @@
package org.apache.kafka.deferred; package org.apache.kafka.deferred;
import org.apache.kafka.common.utils.LogContext;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import java.util.OptionalLong; import java.util.OptionalLong;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import org.apache.kafka.common.utils.LogContext;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;

View File

@ -20,6 +20,7 @@ package org.apache.kafka.metadata;
import org.apache.kafka.common.Uuid; import org.apache.kafka.common.Uuid;
import org.apache.kafka.common.message.AssignReplicasToDirsRequestData; import org.apache.kafka.common.message.AssignReplicasToDirsRequestData;
import org.apache.kafka.server.common.TopicIdPartition; import org.apache.kafka.server.common.TopicIdPartition;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.Arrays; import java.util.Arrays;

View File

@ -17,6 +17,18 @@
package org.apache.kafka.queue; package org.apache.kafka.queue;
import org.apache.kafka.common.errors.TimeoutException;
import org.apache.kafka.common.utils.LogContext;
import org.apache.kafka.common.utils.MockTime;
import org.apache.kafka.common.utils.Time;
import org.apache.kafka.test.TestUtils;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.Timeout;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.OptionalLong; import java.util.OptionalLong;
@ -27,16 +39,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Supplier; import java.util.function.Supplier;
import org.apache.kafka.common.errors.TimeoutException;
import org.apache.kafka.common.utils.LogContext;
import org.apache.kafka.common.utils.MockTime;
import org.apache.kafka.common.utils.Time;
import org.apache.kafka.test.TestUtils;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.Timeout;
import static java.util.concurrent.TimeUnit.HOURS; import static java.util.concurrent.TimeUnit.HOURS;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;

View File

@ -16,16 +16,17 @@
*/ */
package org.apache.kafka.security; package org.apache.kafka.security;
import javax.crypto.SecretKeyFactory;
import org.apache.kafka.common.config.ConfigException; import org.apache.kafka.common.config.ConfigException;
import org.apache.kafka.common.config.types.Password; import org.apache.kafka.common.config.types.Password;
import org.apache.kafka.server.util.Csv; import org.apache.kafka.server.util.Csv;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;
import java.util.Map; import java.util.Map;
import javax.crypto.SecretKeyFactory;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;

View File

@ -17,10 +17,10 @@
package org.apache.kafka.server.common; package org.apache.kafka.server.common;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class MetadataVersionValidatorTest { public class MetadataVersionValidatorTest {
@Test @Test

View File

@ -17,10 +17,13 @@
package org.apache.kafka.server.fault; package org.apache.kafka.server.fault;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.kafka.common.utils.Exit; import org.apache.kafka.common.utils.Exit;
import org.apache.kafka.common.utils.Exit.Procedure; import org.apache.kafka.common.utils.Exit.Procedure;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.concurrent.atomic.AtomicBoolean;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;

View File

@ -19,6 +19,7 @@ package org.apache.kafka.server.immutable.pcollections;
import org.apache.kafka.server.immutable.DelegationChecker; import org.apache.kafka.server.immutable.DelegationChecker;
import org.apache.kafka.server.immutable.ImmutableMap; import org.apache.kafka.server.immutable.ImmutableMap;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;

View File

@ -19,6 +19,7 @@ package org.apache.kafka.server.immutable.pcollections;
import org.apache.kafka.server.immutable.DelegationChecker; import org.apache.kafka.server.immutable.DelegationChecker;
import org.apache.kafka.server.immutable.ImmutableNavigableSet; import org.apache.kafka.server.immutable.ImmutableNavigableSet;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;

View File

@ -19,6 +19,7 @@ package org.apache.kafka.server.immutable.pcollections;
import org.apache.kafka.server.immutable.DelegationChecker; import org.apache.kafka.server.immutable.DelegationChecker;
import org.apache.kafka.server.immutable.ImmutableSet; import org.apache.kafka.server.immutable.ImmutableSet;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;

View File

@ -18,6 +18,7 @@
package org.apache.kafka.server.metrics; package org.apache.kafka.server.metrics;
import com.yammer.metrics.core.MetricName; import com.yammer.metrics.core.MetricName;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;

View File

@ -17,6 +17,12 @@
package org.apache.kafka.server.network; package org.apache.kafka.server.network;
import org.apache.kafka.common.ClusterResource;
import org.apache.kafka.common.Endpoint;
import org.apache.kafka.common.security.auth.SecurityProtocol;
import org.junit.jupiter.api.Test;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -25,10 +31,6 @@ import java.util.Optional;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException; import java.util.concurrent.CompletionException;
import org.apache.kafka.common.ClusterResource;
import org.apache.kafka.common.Endpoint;
import org.apache.kafka.common.security.auth.SecurityProtocol;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;

View File

@ -22,6 +22,7 @@ import org.apache.kafka.common.compress.Lz4Compression;
import org.apache.kafka.common.compress.SnappyCompression; import org.apache.kafka.common.compress.SnappyCompression;
import org.apache.kafka.common.compress.ZstdCompression; import org.apache.kafka.common.compress.ZstdCompression;
import org.apache.kafka.common.record.CompressionType; import org.apache.kafka.common.record.CompressionType;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.Optional; import java.util.Optional;

View File

@ -16,9 +16,6 @@
*/ */
package org.apache.kafka.server.util; package org.apache.kafka.server.util;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.Arrays; import java.util.Arrays;
@ -26,6 +23,10 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Properties; import java.util.Properties;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;

View File

@ -19,6 +19,7 @@ package org.apache.kafka.server.util;
import org.apache.kafka.common.utils.MockTime; import org.apache.kafka.common.utils.MockTime;
import org.apache.kafka.common.utils.Time; import org.apache.kafka.common.utils.Time;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.Timeout;

View File

@ -18,6 +18,7 @@
package org.apache.kafka.server.util; package org.apache.kafka.server.util;
import org.apache.kafka.common.utils.Time; import org.apache.kafka.common.utils.Time;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;

View File

@ -16,6 +16,31 @@
*/ */
package org.apache.kafka.server.util; package org.apache.kafka.server.util;
import org.apache.kafka.clients.ClientRequest;
import org.apache.kafka.clients.ClientResponse;
import org.apache.kafka.clients.KafkaClient;
import org.apache.kafka.clients.RequestCompletionHandler;
import org.apache.kafka.common.Node;
import org.apache.kafka.common.errors.AuthenticationException;
import org.apache.kafka.common.errors.DisconnectException;
import org.apache.kafka.common.internals.FatalExitError;
import org.apache.kafka.common.protocol.ApiKeys;
import org.apache.kafka.common.requests.AbstractRequest;
import org.apache.kafka.common.utils.Time;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentMatchers;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Collections;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
@ -29,30 +54,6 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Collections;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import org.apache.kafka.clients.ClientRequest;
import org.apache.kafka.clients.ClientResponse;
import org.apache.kafka.clients.KafkaClient;
import org.apache.kafka.clients.RequestCompletionHandler;
import org.apache.kafka.common.Node;
import org.apache.kafka.common.errors.AuthenticationException;
import org.apache.kafka.common.errors.DisconnectException;
import org.apache.kafka.common.internals.FatalExitError;
import org.apache.kafka.common.protocol.ApiKeys;
import org.apache.kafka.common.requests.AbstractRequest;
import org.apache.kafka.common.utils.Time;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentMatchers;
public class InterBrokerSendThreadTest { public class InterBrokerSendThreadTest {
private final Time time = new MockTime(); private final Time time = new MockTime();

View File

@ -17,12 +17,14 @@
package org.apache.kafka.server.util; package org.apache.kafka.server.util;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.kafka.server.util.json.DecodeJson; import org.apache.kafka.server.util.json.DecodeJson;
import org.apache.kafka.server.util.json.JsonObject; import org.apache.kafka.server.util.json.JsonObject;
import org.apache.kafka.server.util.json.JsonValue; import org.apache.kafka.server.util.json.JsonValue;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.AbstractMap; import java.util.AbstractMap;

View File

@ -20,6 +20,7 @@ import org.apache.kafka.common.internals.FatalExitError;
import org.apache.kafka.common.utils.Exit; import org.apache.kafka.common.utils.Exit;
import org.apache.kafka.common.utils.Utils; import org.apache.kafka.common.utils.Utils;
import org.apache.kafka.test.TestUtils; import org.apache.kafka.test.TestUtils;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;

View File

@ -18,10 +18,11 @@ package org.apache.kafka.server.util;
import org.apache.kafka.common.internals.Topic; import org.apache.kafka.common.internals.Topic;
import org.apache.kafka.server.util.TopicFilter.IncludeList; import org.apache.kafka.server.util.TopicFilter.IncludeList;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class TopicFilterTest { public class TopicFilterTest {
@Test @Test

View File

@ -18,6 +18,7 @@ package org.apache.kafka.server.util.timer;
import org.apache.kafka.common.errors.TimeoutException; import org.apache.kafka.common.errors.TimeoutException;
import org.apache.kafka.test.TestUtils; import org.apache.kafka.test.TestUtils;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.mockito.Mockito; import org.mockito.Mockito;

View File

@ -17,6 +17,7 @@
package org.apache.kafka.server.util.timer; package org.apache.kafka.server.util.timer;
import org.apache.kafka.common.utils.MockTime; import org.apache.kafka.common.utils.MockTime;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.List; import java.util.List;

View File

@ -18,6 +18,7 @@ package org.apache.kafka.server.util.timer;
import org.apache.kafka.common.utils.Time; import org.apache.kafka.common.utils.Time;
import org.apache.kafka.test.TestUtils; import org.apache.kafka.test.TestUtils;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View File

@ -17,14 +17,15 @@
package org.apache.kafka.timeline; package org.apache.kafka.timeline;
import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNull; import org.junit.jupiter.api.Timeout;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.HashSet; import java.util.HashSet;
import java.util.Random; import java.util.Random;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@Timeout(value = 40) @Timeout(value = 40)
public class BaseHashTableTest { public class BaseHashTableTest {

View File

@ -17,17 +17,18 @@
package org.apache.kafka.timeline; package org.apache.kafka.timeline;
import static org.junit.jupiter.api.Assertions.assertEquals; import org.apache.kafka.common.utils.LogContext;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.kafka.common.utils.LogContext; import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Timeout;
@Timeout(value = 40) @Timeout(value = 40)

View File

@ -17,6 +17,11 @@
package org.apache.kafka.timeline; package org.apache.kafka.timeline;
import org.apache.kafka.common.utils.LogContext;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.IdentityHashMap; import java.util.IdentityHashMap;
@ -24,17 +29,13 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.kafka.common.utils.LogContext;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
@Timeout(value = 40) @Timeout(value = 40)
public class SnapshottableHashTableTest { public class SnapshottableHashTableTest {

View File

@ -17,16 +17,17 @@
package org.apache.kafka.timeline; package org.apache.kafka.timeline;
import org.apache.kafka.common.utils.LogContext;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.kafka.common.utils.LogContext;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;

View File

@ -17,12 +17,13 @@
package org.apache.kafka.timeline; package org.apache.kafka.timeline;
import java.util.Arrays;
import org.apache.kafka.common.utils.LogContext; import org.apache.kafka.common.utils.LogContext;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.Timeout;
import java.util.Arrays;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertArrayEquals;

View File

@ -17,12 +17,13 @@
package org.apache.kafka.timeline; package org.apache.kafka.timeline;
import java.util.Collections;
import org.apache.kafka.common.utils.LogContext; import org.apache.kafka.common.utils.LogContext;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.Timeout;
import java.util.Collections;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;

View File

@ -17,12 +17,13 @@
package org.apache.kafka.timeline; package org.apache.kafka.timeline;
import java.util.Collections;
import org.apache.kafka.common.utils.LogContext; import org.apache.kafka.common.utils.LogContext;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.Timeout;
import java.util.Collections;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;

View File

@ -17,12 +17,13 @@
package org.apache.kafka.timeline; package org.apache.kafka.timeline;
import java.util.Collections;
import org.apache.kafka.common.utils.LogContext; import org.apache.kafka.common.utils.LogContext;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.Timeout;
import java.util.Collections;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;