Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINOR: Replace ImplicitConversions with CollectionConverters #18412

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import org.junit.jupiter.api.Assertions.{assertEquals, fail}
import java.util.{Comparator, Properties}
import java.util.stream.Collectors
import scala.collection.Seq
import scala.collection.convert.ImplicitConversions.{`collection AsScalaIterable`, `map AsScala`}
import scala.jdk.CollectionConverters._
import scala.reflect.ClassTag

Expand Down Expand Up @@ -123,11 +122,11 @@ class GroupCoordinatorBaseRequestTest(cluster: ClusterInstance) {
}

protected def getTopicIds: Map[String, Uuid] = {
cluster.controllers().get(cluster.controllerIds().iterator().next()).controller.findAllTopicIds(ANONYMOUS_CONTEXT).get().toMap
cluster.controllers().get(cluster.controllerIds().iterator().next()).controller.findAllTopicIds(ANONYMOUS_CONTEXT).get().asScala.toMap
}

protected def getBrokers: Seq[KafkaBroker] = {
cluster.brokers.values().stream().collect(Collectors.toList[KafkaBroker]).toSeq
cluster.brokers.values().stream().collect(Collectors.toList[KafkaBroker]).asScala.toSeq
}

protected def bootstrapServers(): String = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import org.junit.jupiter.api.extension.ExtendWith

import java.util
import java.util.Collections
import scala.collection.convert.ImplicitConversions.`list asScalaBuffer`
import scala.jdk.CollectionConverters._

@Timeout(1200)
Expand Down Expand Up @@ -266,7 +265,7 @@ class ShareFetchAcknowledgeRequestTest(cluster: ClusterInstance) extends GroupCo
val partitionsCount = shareFetchResponseData.responses().get(0).partitions().size()
if (partitionsCount > 0) {
assertEquals(topicId, shareFetchResponseData.responses().get(0).topicId())
shareFetchResponseData.responses().get(0).partitions().foreach(partitionData => {
shareFetchResponseData.responses().get(0).partitions().asScala.foreach(partitionData => {
if (!partitionData.acquiredRecords().isEmpty) {
responses = responses :+ partitionData
}
Expand Down Expand Up @@ -2275,7 +2274,7 @@ class ShareFetchAcknowledgeRequestTest(cluster: ClusterInstance) extends GroupCo
val partitionsCount = shareFetchResponseData.responses().get(0).partitions().size()
if (partitionsCount > 0) {
assertEquals(topicId, shareFetchResponseData.responses().get(0).topicId())
shareFetchResponseData.responses().get(0).partitions().foreach(partitionData => {
shareFetchResponseData.responses().get(0).partitions().asScala.foreach(partitionData => {
if (!partitionData.acquiredRecords().isEmpty) {
responses = responses :+ partitionData
}
Expand Down Expand Up @@ -2322,7 +2321,7 @@ class ShareFetchAcknowledgeRequestTest(cluster: ClusterInstance) extends GroupCo
val shareFetchResponseData = shareFetchResponse.data()

assertEquals(Errors.NONE.code, shareFetchResponseData.errorCode)
shareFetchResponseData.responses().foreach(response => {
shareFetchResponseData.responses().asScala.foreach(response => {
if (!response.partitions().isEmpty) {
response.partitions().forEach(partitionData => partitions.add(partitionData.partitionIndex))
}
Expand All @@ -2334,7 +2333,7 @@ class ShareFetchAcknowledgeRequestTest(cluster: ClusterInstance) extends GroupCo

private def expectedAcquiredRecords(firstOffsets: util.List[Long], lastOffsets: util.List[Long], deliveryCounts: util.List[Int]): util.List[AcquiredRecords] = {
val acquiredRecordsList: util.List[AcquiredRecords] = new util.ArrayList()
for (i <- firstOffsets.indices) {
for (i <- firstOffsets.asScala.indices) {
acquiredRecordsList.add(new AcquiredRecords()
.setFirstOffset(firstOffsets.get(i))
.setLastOffset(lastOffsets.get(i))
Expand Down
Loading