chia7712 commented on code in PR #21272:
URL: https://github.com/apache/kafka/pull/21272#discussion_r2691273387
##########
core/src/test/scala/unit/kafka/server/AutoTopicCreationManagerTest.scala:
##########
@@ -42,24 +40,76 @@ import
org.apache.kafka.coordinator.share.{ShareCoordinator, ShareCoordinatorCon
import org.apache.kafka.metadata.MetadataCache
import org.apache.kafka.server.config.ServerConfigs
import org.apache.kafka.coordinator.transaction.TransactionLogConfig
-import org.apache.kafka.server.common.{ControllerRequestCompletionHandler,
NodeToControllerChannelManager}
import org.apache.kafka.server.quota.ControllerMutationQuota
-import org.junit.jupiter.api.Assertions.{assertEquals, assertThrows,
assertTrue}
+import org.junit.jupiter.api.Assertions.{assertEquals, assertTrue}
import org.junit.jupiter.api.{BeforeEach, Test}
-import org.mockito.ArgumentMatchers.any
-import org.mockito.{ArgumentCaptor, ArgumentMatchers, Mockito}
-import org.mockito.Mockito.never
+import org.mockito.{ArgumentMatchers, Mockito}
import scala.collection.{Map, Seq}
import scala.jdk.CollectionConverters._
+import scala.collection.mutable.ListBuffer
+
+/**
+ * Test implementation of TopicCreator that tracks method calls and allows
configuring responses.
+ */
+class TestTopicCreator extends TopicCreator {
+ private val withPrincipalCalls = ListBuffer[(RequestContext,
CreateTopicsRequest.Builder)]()
+ private val withoutPrincipalCalls = ListBuffer[CreateTopicsRequest.Builder]()
+ private var withPrincipalResponse: CompletableFuture[CreateTopicsResponse] =
_
+ private var withoutPrincipalResponse:
CompletableFuture[CreateTopicsResponse] = _
+
+ override def createTopicWithPrincipal(
+ requestContext: RequestContext,
+ request: CreateTopicsRequest.Builder
+ ): CompletableFuture[CreateTopicsResponse] = {
+ withPrincipalCalls += ((requestContext, request))
Review Comment:
Would you mind removing the redundant parentheses?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]