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: fix scala 2.12 compilation #15344

Closed
wants to merge 1 commit into from
Closed
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 @@ -26,11 +26,12 @@ import org.apache.kafka.common.resource.{PatternType, ResourcePattern, ResourceP
import org.apache.kafka.common.security.auth.KafkaPrincipal
import org.apache.kafka.common.utils.SecurityUtils
import org.apache.kafka.image.{MetadataDelta, MetadataImage, MetadataProvenance}
import org.apache.kafka.metadata.migration.KRaftMigrationZkWriter
import org.apache.kafka.metadata.migration.{KRaftMigrationOperation, KRaftMigrationOperationConsumer, KRaftMigrationZkWriter}
import org.apache.kafka.server.common.ApiMessageAndVersion
import org.junit.jupiter.api.Assertions.{assertEquals, assertTrue, fail}
import org.junit.jupiter.api.Test

import java.util.function.Consumer
import scala.collection.mutable
import scala.jdk.CollectionConverters._

Expand Down Expand Up @@ -170,7 +171,12 @@ class ZkAclMigrationClientTest extends ZkMigrationTestHarness {

// load snapshot to Zookeeper.
val kraftMigrationZkWriter = new KRaftMigrationZkWriter(migrationClient, fail(_))
kraftMigrationZkWriter.handleSnapshot(image, (_, _, operation) => { migrationState = operation.apply(migrationState) })
kraftMigrationZkWriter.handleSnapshot(image,
new KRaftMigrationOperationConsumer() {
def accept(opType: String, logMsg: String, operation: KRaftMigrationOperation): Unit = {
migrationState = operation.apply(migrationState)
}
})

// Verify the new ACLs in Zookeeper.
val resource1AclsInZk = zkClient.getVersionedAclsForResource(resource1).acls
Expand Down Expand Up @@ -231,10 +237,16 @@ class ZkAclMigrationClientTest extends ZkMigrationTestHarness {

// Sync image to ZK
val errorLogs = mutable.Buffer[String]()
val kraftMigrationZkWriter = new KRaftMigrationZkWriter(migrationClient, errorLogs.append)
kraftMigrationZkWriter.handleSnapshot(image, (_, _, operation) => {
migrationState = operation.apply(migrationState)
})
val kraftMigrationZkWriter = new KRaftMigrationZkWriter(migrationClient,
new Consumer[String]() {
override def accept(t: String): Unit = errorLogs.append(t)
})
kraftMigrationZkWriter.handleSnapshot(image,
new KRaftMigrationOperationConsumer() {
def accept(opType: String, logMsg: String, operation: KRaftMigrationOperation): Unit = {
migrationState = operation.apply(migrationState)
}
})

// verify 3 ACLs in ZK
val aclsInZk = zkClient.getVersionedAclsForResource(resource).acls
Expand Down Expand Up @@ -276,7 +288,10 @@ class ZkAclMigrationClientTest extends ZkMigrationTestHarness {
def testAclUpdateAndDelete(): Unit = {
zkClient.createAclPaths()
val errorLogs = mutable.Buffer[String]()
val kraftMigrationZkWriter = new KRaftMigrationZkWriter(migrationClient, errorLogs.append)
val kraftMigrationZkWriter = new KRaftMigrationZkWriter(migrationClient,
new Consumer[String]() {
override def accept(t: String): Unit = errorLogs.append(t)
})

val topicName = "topic-" + Uuid.randomUuid()
val otherName = "other-" + Uuid.randomUuid()
Expand Down