MINOR: Cleanup ShareFetchAcknowledgeRequestTest (#19852)
CI / build (push) Waiting to run Details

Now that Kafka supports Java 17, this PR cleans up the
ShareFetchAcknowledgeRequestTest.
The changes mostly include:
- Collections.singletonList() is replaced with List.of()
- Get rid of all asJava conversions

Reviewers: Ken Huang <s7133700@gmail.com>, Chia-Ping Tsai
 <chia7712@gmail.com>
This commit is contained in:
Sanskar Jhajharia 2025-06-26 11:26:18 +05:30 committed by GitHub
parent dc82c766fa
commit 56aeaa4c44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 490 additions and 608 deletions

View File

@ -35,6 +35,7 @@ import org.apache.kafka.server.IntegrationTestUtils
import org.junit.jupiter.api.Assertions.{assertEquals, fail}
import java.net.Socket
import java.util
import java.util.{Comparator, Properties}
import java.util.stream.Collectors
import scala.collection.Seq
@ -132,7 +133,7 @@ class GroupCoordinatorBaseRequestTest(cluster: ClusterInstance) {
replicationFactor = replicationFactor,
topicConfig = topicConfig
)
partitionToLeader.map { case (partition, leader) => new TopicIdPartition(getTopicIds(topic), new TopicPartition(topic, partition)) -> leader }
partitionToLeader.map { case (partition, leader) => new TopicIdPartition(getTopicIds.get(topic), new TopicPartition(topic, partition)) -> leader }
} finally {
admin.close()
}
@ -142,8 +143,8 @@ class GroupCoordinatorBaseRequestTest(cluster: ClusterInstance) {
cluster.brokers.values.stream.allMatch(b => b.config.unstableApiVersionsEnabled)
}
protected def getTopicIds: Map[String, Uuid] = {
cluster.controllers().get(cluster.controllerIds().iterator().next()).controller.findAllTopicIds(ANONYMOUS_CONTEXT).get().asScala.toMap
protected def getTopicIds: util.Map[String, Uuid] = {
cluster.controllers().get(cluster.controllerIds().iterator().next()).controller.findAllTopicIds(ANONYMOUS_CONTEXT).get()
}
protected def getBrokers: Seq[KafkaBroker] = {