From a454f2a404351302c8b1df2ed65b0945cf0c9123 Mon Sep 17 00:00:00 2001 From: gongxuanzhang Date: Sun, 9 Jun 2024 05:36:17 +0800 Subject: [PATCH] KAFKA-10787 Apply spotless to transaction-coordinator and server-common (#16172) Reviewers: Chia-Ping Tsai --- build.gradle | 8 ++-- .../kafka/deferred/DeferredEventQueue.java | 1 + .../apache/kafka/queue/KafkaEventQueue.java | 13 +++--- .../security/EncryptingPasswordEncoder.java | 9 ++-- .../kafka/security/GcmParamsEncoder.java | 3 +- .../kafka/security/IvParamsEncoder.java | 3 +- .../kafka/server/common/MetadataVersion.java | 3 +- .../common/MetadataVersionValidator.java | 5 ++- .../kafka/server/config/QuotaConfigs.java | 1 + .../config/ServerTopicConfigSynonyms.java | 7 +-- .../fault/ProcessTerminatingFaultHandler.java | 4 +- .../PCollectionsImmutableMap.java | 1 + .../PCollectionsImmutableNavigableSet.java | 1 + .../PCollectionsImmutableSet.java | 1 + .../server/metrics/KafkaMetricsGroup.java | 15 ++++--- .../server/metrics/KafkaYammerMetrics.java | 5 ++- .../server/network/EndpointReadyFutures.java | 1 + .../kafka/server/util/CommandLineUtils.java | 7 +-- .../apache/kafka/server/util/FutureUtils.java | 1 + .../server/util/InterBrokerSendThread.java | 21 ++++----- .../org/apache/kafka/server/util/Json.java | 3 +- .../kafka/server/util/KafkaScheduler.java | 1 + .../kafka/server/util/ShutdownableThread.java | 1 + .../server/util/ThroughputThrottler.java | 1 - .../apache/kafka/server/util/TopicFilter.java | 1 + .../kafka/timeline/SnapshotRegistry.java | 7 +-- .../deferred/DeferredEventQueueTest.java | 9 ++-- .../kafka/metadata/AssignmentsHelperTest.java | 1 + .../kafka/queue/KafkaEventQueueTest.java | 22 +++++----- .../kafka/security/PasswordEncoderTest.java | 5 ++- .../common/MetadataVersionValidatorTest.java | 4 +- .../ProcessTerminatingFaultHandlerTest.java | 5 ++- .../PCollectionsImmutableMapTest.java | 1 + ...PCollectionsImmutableNavigableSetTest.java | 1 + .../PCollectionsImmutableSetTest.java | 1 + .../metrics/KafkaYammerMetricsTest.java | 1 + .../network/EndpointReadyFuturesTest.java | 10 +++-- .../record/BrokerCompressionTypeTest.java | 1 + .../server/util/CommandLineUtilsTest.java | 7 +-- .../kafka/server/util/DeadlineTest.java | 1 + .../kafka/server/util/FutureUtilsTest.java | 1 + .../util/InterBrokerSendThreadTest.java | 43 ++++++++++--------- .../apache/kafka/server/util/JsonTest.java | 8 ++-- .../server/util/ShutdownableThreadTest.java | 1 + .../kafka/server/util/TopicFilterTest.java | 3 +- .../util/timer/SystemTimerReaperTest.java | 1 + .../server/util/timer/TimerTaskListTest.java | 1 + .../kafka/server/util/timer/TimerTest.java | 1 + .../kafka/timeline/BaseHashTableTest.java | 11 ++--- .../kafka/timeline/SnapshotRegistryTest.java | 11 ++--- .../timeline/SnapshottableHashTableTest.java | 11 ++--- .../kafka/timeline/TimelineHashMapTest.java | 9 ++-- .../kafka/timeline/TimelineHashSetTest.java | 5 ++- .../kafka/timeline/TimelineIntegerTest.java | 5 ++- .../kafka/timeline/TimelineLongTest.java | 5 ++- .../kafka/timeline/TimelineObjectTest.java | 5 ++- 56 files changed, 186 insertions(+), 128 deletions(-) diff --git a/build.gradle b/build.gradle index 7561708b7fcfc..ee51d2edc7995 100644 --- a/build.gradle +++ b/build.gradle @@ -221,7 +221,6 @@ def excludedSpotlessModules = [':clients', ':metadata', ':raft', ':server', - ':server-common', ':shell', ':storage', ':storage:storage-api', // rename in settings.gradle @@ -254,7 +253,6 @@ def excludedSpotlessModules = [':clients', ':streams:upgrade-system-tests-37', ':tools', ':tools:tools-api', - ':transaction-coordinator', ':trogdor'] @@ -842,8 +840,10 @@ subprojects { skipProjects = [ ":jmh-benchmarks", ":trogdor" ] skipConfigurations = [ "zinc" ] } - - if(JavaVersion.current().isJava11Compatible() && project.path !in excludedSpotlessModules) { + // the task `removeUnusedImports` is implemented by google-java-format, + // 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' spotless { java { diff --git a/server-common/src/main/java/org/apache/kafka/deferred/DeferredEventQueue.java b/server-common/src/main/java/org/apache/kafka/deferred/DeferredEventQueue.java index a59724dc5ec48..2af9ef54fa39d 100644 --- a/server-common/src/main/java/org/apache/kafka/deferred/DeferredEventQueue.java +++ b/server-common/src/main/java/org/apache/kafka/deferred/DeferredEventQueue.java @@ -18,6 +18,7 @@ package org.apache.kafka.deferred; import org.apache.kafka.common.utils.LogContext; + import org.slf4j.Logger; import java.util.ArrayList; diff --git a/server-common/src/main/java/org/apache/kafka/queue/KafkaEventQueue.java b/server-common/src/main/java/org/apache/kafka/queue/KafkaEventQueue.java index 3611359f72a3d..b32183a214f82 100644 --- a/server-common/src/main/java/org/apache/kafka/queue/KafkaEventQueue.java +++ b/server-common/src/main/java/org/apache/kafka/queue/KafkaEventQueue.java @@ -17,6 +17,13 @@ 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.Map; import java.util.Objects; @@ -28,12 +35,6 @@ import java.util.concurrent.locks.ReentrantLock; 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 { diff --git a/server-common/src/main/java/org/apache/kafka/security/EncryptingPasswordEncoder.java b/server-common/src/main/java/org/apache/kafka/security/EncryptingPasswordEncoder.java index 747505645f2ea..88a7216acf727 100644 --- a/server-common/src/main/java/org/apache/kafka/security/EncryptingPasswordEncoder.java +++ b/server-common/src/main/java/org/apache/kafka/security/EncryptingPasswordEncoder.java @@ -20,10 +20,6 @@ import org.apache.kafka.common.config.types.Password; 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.security.GeneralSecurityException; import java.security.NoSuchAlgorithmException; @@ -33,6 +29,11 @@ import java.util.Map; 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 * containing the encoded password in base64 and along with the properties used for encryption. diff --git a/server-common/src/main/java/org/apache/kafka/security/GcmParamsEncoder.java b/server-common/src/main/java/org/apache/kafka/security/GcmParamsEncoder.java index afe3387b2e71a..d089d27d6887a 100644 --- a/server-common/src/main/java/org/apache/kafka/security/GcmParamsEncoder.java +++ b/server-common/src/main/java/org/apache/kafka/security/GcmParamsEncoder.java @@ -16,13 +16,14 @@ */ package org.apache.kafka.security; -import javax.crypto.spec.GCMParameterSpec; import java.security.AlgorithmParameters; import java.security.spec.AlgorithmParameterSpec; import java.security.spec.InvalidParameterSpecException; import java.util.HashMap; import java.util.Map; +import javax.crypto.spec.GCMParameterSpec; + public class GcmParamsEncoder implements CipherParamsEncoder { private static final String AUTHENTICATION_TAG_LENGTH = "authenticationTagLength"; diff --git a/server-common/src/main/java/org/apache/kafka/security/IvParamsEncoder.java b/server-common/src/main/java/org/apache/kafka/security/IvParamsEncoder.java index c156d502bd7ec..0e38c925991f3 100644 --- a/server-common/src/main/java/org/apache/kafka/security/IvParamsEncoder.java +++ b/server-common/src/main/java/org/apache/kafka/security/IvParamsEncoder.java @@ -16,13 +16,14 @@ */ package org.apache.kafka.security; -import javax.crypto.spec.IvParameterSpec; import java.security.AlgorithmParameters; import java.security.spec.AlgorithmParameterSpec; import java.security.spec.InvalidParameterSpecException; import java.util.Collections; import java.util.Map; +import javax.crypto.spec.IvParameterSpec; + public class IvParamsEncoder implements CipherParamsEncoder { @Override diff --git a/server-common/src/main/java/org/apache/kafka/server/common/MetadataVersion.java b/server-common/src/main/java/org/apache/kafka/server/common/MetadataVersion.java index f867edb54e107..90ac27feeea71 100644 --- a/server-common/src/main/java/org/apache/kafka/server/common/MetadataVersion.java +++ b/server-common/src/main/java/org/apache/kafka/server/common/MetadataVersion.java @@ -16,12 +16,13 @@ */ package org.apache.kafka.server.common; +import org.apache.kafka.common.record.RecordVersion; + import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Optional; import java.util.regex.Pattern; -import org.apache.kafka.common.record.RecordVersion; /** * This class contains the different Kafka versions. diff --git a/server-common/src/main/java/org/apache/kafka/server/common/MetadataVersionValidator.java b/server-common/src/main/java/org/apache/kafka/server/common/MetadataVersionValidator.java index 072f956eb8b4d..18ef9ebb3c016 100644 --- a/server-common/src/main/java/org/apache/kafka/server/common/MetadataVersionValidator.java +++ b/server-common/src/main/java/org/apache/kafka/server/common/MetadataVersionValidator.java @@ -16,11 +16,12 @@ */ 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.ConfigException; +import java.util.Arrays; +import java.util.stream.Collectors; + public class MetadataVersionValidator implements Validator { @Override diff --git a/server-common/src/main/java/org/apache/kafka/server/config/QuotaConfigs.java b/server-common/src/main/java/org/apache/kafka/server/config/QuotaConfigs.java index 9c17e49ec3d40..14dbd58c64716 100644 --- a/server-common/src/main/java/org/apache/kafka/server/config/QuotaConfigs.java +++ b/server-common/src/main/java/org/apache/kafka/server/config/QuotaConfigs.java @@ -18,6 +18,7 @@ import org.apache.kafka.common.config.ConfigDef; import org.apache.kafka.common.security.scram.internals.ScramMechanism; + import java.util.Arrays; import java.util.Collections; import java.util.HashSet; diff --git a/server-common/src/main/java/org/apache/kafka/server/config/ServerTopicConfigSynonyms.java b/server-common/src/main/java/org/apache/kafka/server/config/ServerTopicConfigSynonyms.java index 757c65b6b7fa4..66747e74364fb 100644 --- a/server-common/src/main/java/org/apache/kafka/server/config/ServerTopicConfigSynonyms.java +++ b/server-common/src/main/java/org/apache/kafka/server/config/ServerTopicConfigSynonyms.java @@ -16,7 +16,8 @@ */ 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.Collections; @@ -25,8 +26,8 @@ import java.util.Map.Entry; import java.util.NoSuchElementException; 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 static final String LOG_PREFIX = "log."; diff --git a/server-common/src/main/java/org/apache/kafka/server/fault/ProcessTerminatingFaultHandler.java b/server-common/src/main/java/org/apache/kafka/server/fault/ProcessTerminatingFaultHandler.java index 943de3ca34ed1..25ba8877cd1c1 100644 --- a/server-common/src/main/java/org/apache/kafka/server/fault/ProcessTerminatingFaultHandler.java +++ b/server-common/src/main/java/org/apache/kafka/server/fault/ProcessTerminatingFaultHandler.java @@ -17,11 +17,13 @@ package org.apache.kafka.server.fault; -import java.util.Objects; import org.apache.kafka.common.utils.Exit; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.Objects; + /** * This is a fault handler which terminates the JVM process. */ diff --git a/server-common/src/main/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableMap.java b/server-common/src/main/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableMap.java index d808f0db9c3fd..9b73ee25796fd 100644 --- a/server-common/src/main/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableMap.java +++ b/server-common/src/main/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableMap.java @@ -18,6 +18,7 @@ package org.apache.kafka.server.immutable.pcollections; import org.apache.kafka.server.immutable.ImmutableMap; + import org.pcollections.HashPMap; import org.pcollections.HashTreePMap; diff --git a/server-common/src/main/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableNavigableSet.java b/server-common/src/main/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableNavigableSet.java index 626dd10be5442..25fb5edc7048b 100644 --- a/server-common/src/main/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableNavigableSet.java +++ b/server-common/src/main/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableNavigableSet.java @@ -18,6 +18,7 @@ package org.apache.kafka.server.immutable.pcollections; import org.apache.kafka.server.immutable.ImmutableNavigableSet; + import org.pcollections.TreePSet; import java.util.Collection; diff --git a/server-common/src/main/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableSet.java b/server-common/src/main/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableSet.java index 77b010bbc2576..54d94c90b3e44 100644 --- a/server-common/src/main/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableSet.java +++ b/server-common/src/main/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableSet.java @@ -18,6 +18,7 @@ package org.apache.kafka.server.immutable.pcollections; import org.apache.kafka.server.immutable.ImmutableSet; + import org.pcollections.HashTreePSet; import org.pcollections.MapPSet; diff --git a/server-common/src/main/java/org/apache/kafka/server/metrics/KafkaMetricsGroup.java b/server-common/src/main/java/org/apache/kafka/server/metrics/KafkaMetricsGroup.java index 9f25261e8a65d..43cc7d184861c 100644 --- a/server-common/src/main/java/org/apache/kafka/server/metrics/KafkaMetricsGroup.java +++ b/server-common/src/main/java/org/apache/kafka/server/metrics/KafkaMetricsGroup.java @@ -16,19 +16,20 @@ */ package org.apache.kafka.server.metrics; -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; +import org.apache.kafka.common.utils.Sanitizer; import com.yammer.metrics.core.Gauge; import com.yammer.metrics.core.Histogram; import com.yammer.metrics.core.Meter; import com.yammer.metrics.core.MetricName; 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 { private final Class klass; diff --git a/server-common/src/main/java/org/apache/kafka/server/metrics/KafkaYammerMetrics.java b/server-common/src/main/java/org/apache/kafka/server/metrics/KafkaYammerMetrics.java index 4cdb49ec223ec..7909c63e242bd 100644 --- a/server-common/src/main/java/org/apache/kafka/server/metrics/KafkaYammerMetrics.java +++ b/server-common/src/main/java/org/apache/kafka/server/metrics/KafkaYammerMetrics.java @@ -17,14 +17,15 @@ 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.config.ConfigException; import org.apache.kafka.common.metrics.JmxReporter; import org.apache.kafka.common.utils.Exit; 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.LinkedHashMap; import java.util.Map; diff --git a/server-common/src/main/java/org/apache/kafka/server/network/EndpointReadyFutures.java b/server-common/src/main/java/org/apache/kafka/server/network/EndpointReadyFutures.java index 578079b4bd3d6..212f2b9fbd7ba 100644 --- a/server-common/src/main/java/org/apache/kafka/server/network/EndpointReadyFutures.java +++ b/server-common/src/main/java/org/apache/kafka/server/network/EndpointReadyFutures.java @@ -21,6 +21,7 @@ import org.apache.kafka.common.utils.LogContext; import org.apache.kafka.server.authorizer.Authorizer; import org.apache.kafka.server.authorizer.AuthorizerServerInfo; + import org.slf4j.Logger; import java.util.ArrayList; diff --git a/server-common/src/main/java/org/apache/kafka/server/util/CommandLineUtils.java b/server-common/src/main/java/org/apache/kafka/server/util/CommandLineUtils.java index 6ffd5f7950193..82a02482db8f5 100644 --- a/server-common/src/main/java/org/apache/kafka/server/util/CommandLineUtils.java +++ b/server-common/src/main/java/org/apache/kafka/server/util/CommandLineUtils.java @@ -16,9 +16,6 @@ */ 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.admin.AdminClientConfig; import org.apache.kafka.common.utils.AppInfoParser; @@ -31,6 +28,10 @@ import java.util.Properties; import java.util.Set; +import joptsimple.OptionParser; +import joptsimple.OptionSet; +import joptsimple.OptionSpec; + /** * Helper functions for dealing with command line utilities. */ diff --git a/server-common/src/main/java/org/apache/kafka/server/util/FutureUtils.java b/server-common/src/main/java/org/apache/kafka/server/util/FutureUtils.java index a95716407b465..14d963d626c7b 100644 --- a/server-common/src/main/java/org/apache/kafka/server/util/FutureUtils.java +++ b/server-common/src/main/java/org/apache/kafka/server/util/FutureUtils.java @@ -17,6 +17,7 @@ package org.apache.kafka.server.util; import org.apache.kafka.common.utils.Time; + import org.slf4j.Logger; import java.util.ArrayList; diff --git a/server-common/src/main/java/org/apache/kafka/server/util/InterBrokerSendThread.java b/server-common/src/main/java/org/apache/kafka/server/util/InterBrokerSendThread.java index 7b27d1c255ce1..1ef60a547bcca 100644 --- a/server-common/src/main/java/org/apache/kafka/server/util/InterBrokerSendThread.java +++ b/server-common/src/main/java/org/apache/kafka/server/util/InterBrokerSendThread.java @@ -16,16 +16,6 @@ */ 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.ClientResponse; import org.apache.kafka.clients.KafkaClient; @@ -37,6 +27,17 @@ import org.apache.kafka.common.utils.Time; 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. */ diff --git a/server-common/src/main/java/org/apache/kafka/server/util/Json.java b/server-common/src/main/java/org/apache/kafka/server/util/Json.java index dbb73c02204c3..53ef89dd5f613 100644 --- a/server-common/src/main/java/org/apache/kafka/server/util/Json.java +++ b/server-common/src/main/java/org/apache/kafka/server/util/Json.java @@ -17,11 +17,12 @@ 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.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.MissingNode; -import org.apache.kafka.server.util.json.JsonValue; import java.io.IOException; import java.util.Optional; diff --git a/server-common/src/main/java/org/apache/kafka/server/util/KafkaScheduler.java b/server-common/src/main/java/org/apache/kafka/server/util/KafkaScheduler.java index f451795f85fbc..96d3ae797a0c1 100644 --- a/server-common/src/main/java/org/apache/kafka/server/util/KafkaScheduler.java +++ b/server-common/src/main/java/org/apache/kafka/server/util/KafkaScheduler.java @@ -17,6 +17,7 @@ package org.apache.kafka.server.util; import org.apache.kafka.common.utils.KafkaThread; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/server-common/src/main/java/org/apache/kafka/server/util/ShutdownableThread.java b/server-common/src/main/java/org/apache/kafka/server/util/ShutdownableThread.java index 4268af92f84f5..7d18975b6cdc9 100644 --- a/server-common/src/main/java/org/apache/kafka/server/util/ShutdownableThread.java +++ b/server-common/src/main/java/org/apache/kafka/server/util/ShutdownableThread.java @@ -20,6 +20,7 @@ import org.apache.kafka.common.internals.FatalExitError; import org.apache.kafka.common.utils.Exit; import org.apache.kafka.common.utils.LogContext; + import org.slf4j.Logger; import java.util.concurrent.CountDownLatch; diff --git a/server-common/src/main/java/org/apache/kafka/server/util/ThroughputThrottler.java b/server-common/src/main/java/org/apache/kafka/server/util/ThroughputThrottler.java index e6a5e6f129008..84a12b3732ce5 100644 --- a/server-common/src/main/java/org/apache/kafka/server/util/ThroughputThrottler.java +++ b/server-common/src/main/java/org/apache/kafka/server/util/ThroughputThrottler.java @@ -136,4 +136,3 @@ public void wakeup() { } } } - diff --git a/server-common/src/main/java/org/apache/kafka/server/util/TopicFilter.java b/server-common/src/main/java/org/apache/kafka/server/util/TopicFilter.java index 4127ce46d8200..1dbebdfdecc4d 100644 --- a/server-common/src/main/java/org/apache/kafka/server/util/TopicFilter.java +++ b/server-common/src/main/java/org/apache/kafka/server/util/TopicFilter.java @@ -17,6 +17,7 @@ package org.apache.kafka.server.util; import org.apache.kafka.common.internals.Topic; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/server-common/src/main/java/org/apache/kafka/timeline/SnapshotRegistry.java b/server-common/src/main/java/org/apache/kafka/timeline/SnapshotRegistry.java index 9f484185602cd..b35670a0bccb0 100644 --- a/server-common/src/main/java/org/apache/kafka/timeline/SnapshotRegistry.java +++ b/server-common/src/main/java/org/apache/kafka/timeline/SnapshotRegistry.java @@ -17,15 +17,16 @@ package org.apache.kafka.timeline; +import org.apache.kafka.common.utils.LogContext; + +import org.slf4j.Logger; + import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.stream.Collectors; -import org.apache.kafka.common.utils.LogContext; -import org.slf4j.Logger; - /** * A registry containing snapshots of timeline data structures. diff --git a/server-common/src/test/java/org/apache/kafka/deferred/DeferredEventQueueTest.java b/server-common/src/test/java/org/apache/kafka/deferred/DeferredEventQueueTest.java index 525068cd79477..39680b22cae9e 100644 --- a/server-common/src/test/java/org/apache/kafka/deferred/DeferredEventQueueTest.java +++ b/server-common/src/test/java/org/apache/kafka/deferred/DeferredEventQueueTest.java @@ -17,14 +17,15 @@ package org.apache.kafka.deferred; -import java.util.OptionalLong; -import java.util.concurrent.CompletableFuture; -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 java.util.OptionalLong; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; + import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; diff --git a/server-common/src/test/java/org/apache/kafka/metadata/AssignmentsHelperTest.java b/server-common/src/test/java/org/apache/kafka/metadata/AssignmentsHelperTest.java index 89120d9ab5022..df1ea9821c460 100644 --- a/server-common/src/test/java/org/apache/kafka/metadata/AssignmentsHelperTest.java +++ b/server-common/src/test/java/org/apache/kafka/metadata/AssignmentsHelperTest.java @@ -20,6 +20,7 @@ import org.apache.kafka.common.Uuid; import org.apache.kafka.common.message.AssignReplicasToDirsRequestData; import org.apache.kafka.server.common.TopicIdPartition; + import org.junit.jupiter.api.Test; import java.util.Arrays; diff --git a/server-common/src/test/java/org/apache/kafka/queue/KafkaEventQueueTest.java b/server-common/src/test/java/org/apache/kafka/queue/KafkaEventQueueTest.java index 68abf6a4b558a..550de557bef0b 100644 --- a/server-common/src/test/java/org/apache/kafka/queue/KafkaEventQueueTest.java +++ b/server-common/src/test/java/org/apache/kafka/queue/KafkaEventQueueTest.java @@ -17,27 +17,29 @@ package org.apache.kafka.queue; -import java.util.Arrays; -import java.util.List; -import java.util.OptionalLong; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.RejectedExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; -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 java.util.Arrays; +import java.util.List; +import java.util.OptionalLong; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.RejectedExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Supplier; + import static java.util.concurrent.TimeUnit.HOURS; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; diff --git a/server-common/src/test/java/org/apache/kafka/security/PasswordEncoderTest.java b/server-common/src/test/java/org/apache/kafka/security/PasswordEncoderTest.java index a513ed25c28cd..eaa8c3ec87de7 100644 --- a/server-common/src/test/java/org/apache/kafka/security/PasswordEncoderTest.java +++ b/server-common/src/test/java/org/apache/kafka/security/PasswordEncoderTest.java @@ -16,16 +16,17 @@ */ package org.apache.kafka.security; -import javax.crypto.SecretKeyFactory; - import org.apache.kafka.common.config.ConfigException; import org.apache.kafka.common.config.types.Password; import org.apache.kafka.server.util.Csv; + import org.junit.jupiter.api.Test; import java.security.GeneralSecurityException; import java.util.Map; +import javax.crypto.SecretKeyFactory; + import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; diff --git a/server-common/src/test/java/org/apache/kafka/server/common/MetadataVersionValidatorTest.java b/server-common/src/test/java/org/apache/kafka/server/common/MetadataVersionValidatorTest.java index 707d0d11d3e0d..16cd2c83435a5 100644 --- a/server-common/src/test/java/org/apache/kafka/server/common/MetadataVersionValidatorTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/common/MetadataVersionValidatorTest.java @@ -17,10 +17,10 @@ package org.apache.kafka.server.common; -import static org.junit.jupiter.api.Assertions.assertEquals; - import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class MetadataVersionValidatorTest { @Test diff --git a/server-common/src/test/java/org/apache/kafka/server/fault/ProcessTerminatingFaultHandlerTest.java b/server-common/src/test/java/org/apache/kafka/server/fault/ProcessTerminatingFaultHandlerTest.java index 117fa4980f81c..35819e4414f6d 100644 --- a/server-common/src/test/java/org/apache/kafka/server/fault/ProcessTerminatingFaultHandlerTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/fault/ProcessTerminatingFaultHandlerTest.java @@ -17,10 +17,13 @@ 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.Procedure; + 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.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; diff --git a/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableMapTest.java b/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableMapTest.java index 87cf1665d2712..58d305d5421b9 100644 --- a/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableMapTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableMapTest.java @@ -19,6 +19,7 @@ import org.apache.kafka.server.immutable.DelegationChecker; import org.apache.kafka.server.immutable.ImmutableMap; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; diff --git a/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableNavigableSetTest.java b/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableNavigableSetTest.java index 8b2e9666dd956..525040a474ae1 100644 --- a/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableNavigableSetTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableNavigableSetTest.java @@ -19,6 +19,7 @@ import org.apache.kafka.server.immutable.DelegationChecker; import org.apache.kafka.server.immutable.ImmutableNavigableSet; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; diff --git a/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableSetTest.java b/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableSetTest.java index 9854f4282231d..ca76b05179991 100644 --- a/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableSetTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/immutable/pcollections/PCollectionsImmutableSetTest.java @@ -19,6 +19,7 @@ import org.apache.kafka.server.immutable.DelegationChecker; import org.apache.kafka.server.immutable.ImmutableSet; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; diff --git a/server-common/src/test/java/org/apache/kafka/server/metrics/KafkaYammerMetricsTest.java b/server-common/src/test/java/org/apache/kafka/server/metrics/KafkaYammerMetricsTest.java index dfe0aaf416e5b..36e75fcfb4165 100644 --- a/server-common/src/test/java/org/apache/kafka/server/metrics/KafkaYammerMetricsTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/metrics/KafkaYammerMetricsTest.java @@ -18,6 +18,7 @@ package org.apache.kafka.server.metrics; import com.yammer.metrics.core.MetricName; + import org.junit.jupiter.api.Test; import java.util.LinkedHashMap; diff --git a/server-common/src/test/java/org/apache/kafka/server/network/EndpointReadyFuturesTest.java b/server-common/src/test/java/org/apache/kafka/server/network/EndpointReadyFuturesTest.java index c15ed5ebef10a..20edb7ce75704 100644 --- a/server-common/src/test/java/org/apache/kafka/server/network/EndpointReadyFuturesTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/network/EndpointReadyFuturesTest.java @@ -17,6 +17,12 @@ 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.HashMap; import java.util.HashSet; @@ -25,10 +31,6 @@ import java.util.concurrent.CompletableFuture; 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.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; diff --git a/server-common/src/test/java/org/apache/kafka/server/record/BrokerCompressionTypeTest.java b/server-common/src/test/java/org/apache/kafka/server/record/BrokerCompressionTypeTest.java index 62ac8eab059c5..ae6c3d76e3a3f 100644 --- a/server-common/src/test/java/org/apache/kafka/server/record/BrokerCompressionTypeTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/record/BrokerCompressionTypeTest.java @@ -22,6 +22,7 @@ import org.apache.kafka.common.compress.SnappyCompression; import org.apache.kafka.common.compress.ZstdCompression; import org.apache.kafka.common.record.CompressionType; + import org.junit.jupiter.api.Test; import java.util.Optional; diff --git a/server-common/src/test/java/org/apache/kafka/server/util/CommandLineUtilsTest.java b/server-common/src/test/java/org/apache/kafka/server/util/CommandLineUtilsTest.java index 0d2e754b81ff1..db3326a4a4f10 100644 --- a/server-common/src/test/java/org/apache/kafka/server/util/CommandLineUtilsTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/util/CommandLineUtilsTest.java @@ -16,9 +16,6 @@ */ package org.apache.kafka.server.util; -import joptsimple.OptionParser; -import joptsimple.OptionSet; -import joptsimple.OptionSpec; import org.junit.jupiter.api.Test; import java.util.Arrays; @@ -26,6 +23,10 @@ import java.util.Optional; 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.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; diff --git a/server-common/src/test/java/org/apache/kafka/server/util/DeadlineTest.java b/server-common/src/test/java/org/apache/kafka/server/util/DeadlineTest.java index d43fd3e750c8b..c41cd0738caec 100644 --- a/server-common/src/test/java/org/apache/kafka/server/util/DeadlineTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/util/DeadlineTest.java @@ -19,6 +19,7 @@ import org.apache.kafka.common.utils.MockTime; import org.apache.kafka.common.utils.Time; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; diff --git a/server-common/src/test/java/org/apache/kafka/server/util/FutureUtilsTest.java b/server-common/src/test/java/org/apache/kafka/server/util/FutureUtilsTest.java index 53bb86a8b63e4..b6a2e92cd4dba 100644 --- a/server-common/src/test/java/org/apache/kafka/server/util/FutureUtilsTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/util/FutureUtilsTest.java @@ -18,6 +18,7 @@ package org.apache.kafka.server.util; import org.apache.kafka.common.utils.Time; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.params.ParameterizedTest; diff --git a/server-common/src/test/java/org/apache/kafka/server/util/InterBrokerSendThreadTest.java b/server-common/src/test/java/org/apache/kafka/server/util/InterBrokerSendThreadTest.java index 90b55ed4a1776..f0d029de8e2fd 100644 --- a/server-common/src/test/java/org/apache/kafka/server/util/InterBrokerSendThreadTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/util/InterBrokerSendThreadTest.java @@ -16,27 +16,6 @@ */ package org.apache.kafka.server.util; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertInstanceOf; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.same; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -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; @@ -48,11 +27,33 @@ 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.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.same; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + public class InterBrokerSendThreadTest { private final Time time = new MockTime(); diff --git a/server-common/src/test/java/org/apache/kafka/server/util/JsonTest.java b/server-common/src/test/java/org/apache/kafka/server/util/JsonTest.java index 8e7099655f46b..c8b2dc787f4aa 100644 --- a/server-common/src/test/java/org/apache/kafka/server/util/JsonTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/util/JsonTest.java @@ -17,12 +17,14 @@ 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.JsonObject; 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 java.util.AbstractMap; diff --git a/server-common/src/test/java/org/apache/kafka/server/util/ShutdownableThreadTest.java b/server-common/src/test/java/org/apache/kafka/server/util/ShutdownableThreadTest.java index e59acc9767ec2..038087cea185c 100644 --- a/server-common/src/test/java/org/apache/kafka/server/util/ShutdownableThreadTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/util/ShutdownableThreadTest.java @@ -20,6 +20,7 @@ import org.apache.kafka.common.utils.Exit; import org.apache.kafka.common.utils.Utils; import org.apache.kafka.test.TestUtils; + import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; diff --git a/server-common/src/test/java/org/apache/kafka/server/util/TopicFilterTest.java b/server-common/src/test/java/org/apache/kafka/server/util/TopicFilterTest.java index 634bae7e74f97..d821fc9a52ac7 100644 --- a/server-common/src/test/java/org/apache/kafka/server/util/TopicFilterTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/util/TopicFilterTest.java @@ -18,10 +18,11 @@ import org.apache.kafka.common.internals.Topic; import org.apache.kafka.server.util.TopicFilter.IncludeList; + 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.assertTrue; public class TopicFilterTest { @Test diff --git a/server-common/src/test/java/org/apache/kafka/server/util/timer/SystemTimerReaperTest.java b/server-common/src/test/java/org/apache/kafka/server/util/timer/SystemTimerReaperTest.java index d2074cc8611a0..a87368e378dce 100644 --- a/server-common/src/test/java/org/apache/kafka/server/util/timer/SystemTimerReaperTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/util/timer/SystemTimerReaperTest.java @@ -18,6 +18,7 @@ import org.apache.kafka.common.errors.TimeoutException; import org.apache.kafka.test.TestUtils; + import org.junit.jupiter.api.Test; import org.mockito.Mockito; diff --git a/server-common/src/test/java/org/apache/kafka/server/util/timer/TimerTaskListTest.java b/server-common/src/test/java/org/apache/kafka/server/util/timer/TimerTaskListTest.java index 3ac4b1fcfbdac..2367590824a90 100644 --- a/server-common/src/test/java/org/apache/kafka/server/util/timer/TimerTaskListTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/util/timer/TimerTaskListTest.java @@ -17,6 +17,7 @@ package org.apache.kafka.server.util.timer; import org.apache.kafka.common.utils.MockTime; + import org.junit.jupiter.api.Test; import java.util.List; diff --git a/server-common/src/test/java/org/apache/kafka/server/util/timer/TimerTest.java b/server-common/src/test/java/org/apache/kafka/server/util/timer/TimerTest.java index 3e3a83e144796..3b4d001f74818 100644 --- a/server-common/src/test/java/org/apache/kafka/server/util/timer/TimerTest.java +++ b/server-common/src/test/java/org/apache/kafka/server/util/timer/TimerTest.java @@ -18,6 +18,7 @@ import org.apache.kafka.common.utils.Time; import org.apache.kafka.test.TestUtils; + import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/server-common/src/test/java/org/apache/kafka/timeline/BaseHashTableTest.java b/server-common/src/test/java/org/apache/kafka/timeline/BaseHashTableTest.java index 54063db69faa6..32b9c261e979f 100644 --- a/server-common/src/test/java/org/apache/kafka/timeline/BaseHashTableTest.java +++ b/server-common/src/test/java/org/apache/kafka/timeline/BaseHashTableTest.java @@ -17,14 +17,15 @@ package org.apache.kafka.timeline; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; import java.util.HashSet; 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) public class BaseHashTableTest { diff --git a/server-common/src/test/java/org/apache/kafka/timeline/SnapshotRegistryTest.java b/server-common/src/test/java/org/apache/kafka/timeline/SnapshotRegistryTest.java index ef322d9ea8f35..264c9231f9c4c 100644 --- a/server-common/src/test/java/org/apache/kafka/timeline/SnapshotRegistryTest.java +++ b/server-common/src/test/java/org/apache/kafka/timeline/SnapshotRegistryTest.java @@ -17,17 +17,18 @@ package org.apache.kafka.timeline; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; +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.Arrays; import java.util.Iterator; import java.util.List; -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.assertThrows; @Timeout(value = 40) diff --git a/server-common/src/test/java/org/apache/kafka/timeline/SnapshottableHashTableTest.java b/server-common/src/test/java/org/apache/kafka/timeline/SnapshottableHashTableTest.java index c330d93d4e834..d51ed67098f67 100644 --- a/server-common/src/test/java/org/apache/kafka/timeline/SnapshottableHashTableTest.java +++ b/server-common/src/test/java/org/apache/kafka/timeline/SnapshottableHashTableTest.java @@ -17,6 +17,11 @@ 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.Collections; import java.util.IdentityHashMap; @@ -24,17 +29,13 @@ import java.util.List; 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.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.assertFalse; @Timeout(value = 40) public class SnapshottableHashTableTest { diff --git a/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashMapTest.java b/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashMapTest.java index 65413ab5cf432..799a7fc187cbd 100644 --- a/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashMapTest.java +++ b/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashMapTest.java @@ -17,16 +17,17 @@ 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.Collections; import java.util.Iterator; import java.util.List; 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.Matchers.containsInAnyOrder; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashSetTest.java b/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashSetTest.java index 070893cdc84be..1890750f114d1 100644 --- a/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashSetTest.java +++ b/server-common/src/test/java/org/apache/kafka/timeline/TimelineHashSetTest.java @@ -17,12 +17,13 @@ package org.apache.kafka.timeline; -import java.util.Arrays; - import org.apache.kafka.common.utils.LogContext; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; +import java.util.Arrays; + import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.junit.jupiter.api.Assertions.assertArrayEquals; diff --git a/server-common/src/test/java/org/apache/kafka/timeline/TimelineIntegerTest.java b/server-common/src/test/java/org/apache/kafka/timeline/TimelineIntegerTest.java index 736c4cba13bf2..1a61b7dd359be 100644 --- a/server-common/src/test/java/org/apache/kafka/timeline/TimelineIntegerTest.java +++ b/server-common/src/test/java/org/apache/kafka/timeline/TimelineIntegerTest.java @@ -17,12 +17,13 @@ package org.apache.kafka.timeline; -import java.util.Collections; - import org.apache.kafka.common.utils.LogContext; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; +import java.util.Collections; + import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/server-common/src/test/java/org/apache/kafka/timeline/TimelineLongTest.java b/server-common/src/test/java/org/apache/kafka/timeline/TimelineLongTest.java index 26412a50c108e..c52bb5474cf10 100644 --- a/server-common/src/test/java/org/apache/kafka/timeline/TimelineLongTest.java +++ b/server-common/src/test/java/org/apache/kafka/timeline/TimelineLongTest.java @@ -17,12 +17,13 @@ package org.apache.kafka.timeline; -import java.util.Collections; - import org.apache.kafka.common.utils.LogContext; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; +import java.util.Collections; + import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/server-common/src/test/java/org/apache/kafka/timeline/TimelineObjectTest.java b/server-common/src/test/java/org/apache/kafka/timeline/TimelineObjectTest.java index 0b9ffc4c2bda6..b17f5f056b011 100644 --- a/server-common/src/test/java/org/apache/kafka/timeline/TimelineObjectTest.java +++ b/server-common/src/test/java/org/apache/kafka/timeline/TimelineObjectTest.java @@ -17,12 +17,13 @@ package org.apache.kafka.timeline; -import java.util.Collections; - import org.apache.kafka.common.utils.LogContext; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; +import java.util.Collections; + import static org.junit.jupiter.api.Assertions.assertEquals;