Browse Source

MINOR: Remove unused TopicAndPartition usage in tests (#5419)

Also replace `TopicAndPartition` with `TopicPartition` in `MetadataCache`.

Reviewers: Ismael Juma <ismael@juma.me.uk>
pull/5168/head
Manikumar Reddy O 6 years ago committed by Ismael Juma
parent
commit
52c5b5f111
  1. 3
      core/src/main/scala/kafka/server/MetadataCache.scala
  2. 2
      core/src/test/scala/integration/kafka/api/AuthorizerIntegrationTest.scala
  3. 2
      core/src/test/scala/integration/kafka/api/EndToEndAuthorizationTest.scala
  4. 2
      core/src/test/scala/integration/kafka/api/EndToEndClusterIdTest.scala

3
core/src/main/scala/kafka/server/MetadataCache.scala

@ -24,7 +24,6 @@ import scala.collection.{Seq, Set, mutable}
import scala.collection.JavaConverters._ import scala.collection.JavaConverters._
import kafka.cluster.{Broker, EndPoint} import kafka.cluster.{Broker, EndPoint}
import kafka.api._ import kafka.api._
import kafka.common.TopicAndPartition
import kafka.controller.StateChangeLogger import kafka.controller.StateChangeLogger
import kafka.utils.CoreUtils._ import kafka.utils.CoreUtils._
import kafka.utils.Logging import kafka.utils.Logging
@ -71,7 +70,7 @@ class MetadataCache(brokerId: Int) extends Logging {
errorUnavailableListeners: Boolean): Option[Iterable[MetadataResponse.PartitionMetadata]] = { errorUnavailableListeners: Boolean): Option[Iterable[MetadataResponse.PartitionMetadata]] = {
cache.get(topic).map { partitions => cache.get(topic).map { partitions =>
partitions.map { case (partitionId, partitionState) => partitions.map { case (partitionId, partitionState) =>
val topicPartition = TopicAndPartition(topic, partitionId) val topicPartition = new TopicPartition(topic, partitionId)
val leaderBrokerId = partitionState.basePartitionState.leader val leaderBrokerId = partitionState.basePartitionState.leader
val maybeLeader = getAliveEndpoint(leaderBrokerId, listenerName) val maybeLeader = getAliveEndpoint(leaderBrokerId, listenerName)
val replicas = partitionState.basePartitionState.replicas.asScala.map(_.toInt) val replicas = partitionState.basePartitionState.replicas.asScala.map(_.toInt)

2
core/src/test/scala/integration/kafka/api/AuthorizerIntegrationTest.scala

@ -20,7 +20,6 @@ import java.util.{ArrayList, Collections, Properties}
import java.time.Duration import java.time.Duration
import kafka.admin.ConsumerGroupCommand.{ConsumerGroupCommandOptions, ConsumerGroupService} import kafka.admin.ConsumerGroupCommand.{ConsumerGroupCommandOptions, ConsumerGroupService}
import kafka.common.TopicAndPartition
import kafka.log.LogConfig import kafka.log.LogConfig
import kafka.network.SocketServer import kafka.network.SocketServer
import kafka.security.auth._ import kafka.security.auth._
@ -70,7 +69,6 @@ class AuthorizerIntegrationTest extends BaseRequestTest {
val tp = new TopicPartition(topic, part) val tp = new TopicPartition(topic, part)
val logDir = "logDir" val logDir = "logDir"
val deleteRecordsPartition = new TopicPartition(deleteTopic, part) val deleteRecordsPartition = new TopicPartition(deleteTopic, part)
val topicAndPartition = TopicAndPartition(topic, part)
val group = "my-group" val group = "my-group"
val topicResource = Resource(Topic, topic, LITERAL) val topicResource = Resource(Topic, topic, LITERAL)
val groupResource = Resource(Group, group, LITERAL) val groupResource = Resource(Group, group, LITERAL)

2
core/src/test/scala/integration/kafka/api/EndToEndAuthorizationTest.scala

@ -22,7 +22,6 @@ import java.util.ArrayList
import java.util.concurrent.ExecutionException import java.util.concurrent.ExecutionException
import kafka.admin.AclCommand import kafka.admin.AclCommand
import kafka.common.TopicAndPartition
import kafka.security.auth._ import kafka.security.auth._
import kafka.server._ import kafka.server._
import kafka.utils._ import kafka.utils._
@ -73,7 +72,6 @@ abstract class EndToEndAuthorizationTest extends IntegrationTestHarness with Sas
val wildcard = "*" val wildcard = "*"
val part = 0 val part = 0
val tp = new TopicPartition(topic, part) val tp = new TopicPartition(topic, part)
val topicAndPartition = TopicAndPartition(topic, part)
val clientPrincipal: String val clientPrincipal: String
val kafkaPrincipal: String val kafkaPrincipal: String

2
core/src/test/scala/integration/kafka/api/EndToEndClusterIdTest.scala

@ -21,7 +21,6 @@ import java.util.concurrent.ExecutionException
import java.util.concurrent.atomic.AtomicReference import java.util.concurrent.atomic.AtomicReference
import java.util.Properties import java.util.Properties
import kafka.common.TopicAndPartition
import kafka.integration.KafkaServerTestHarness import kafka.integration.KafkaServerTestHarness
import kafka.server._ import kafka.server._
import kafka.utils._ import kafka.utils._
@ -100,7 +99,6 @@ class EndToEndClusterIdTest extends KafkaServerTestHarness {
val topic = "e2etopic" val topic = "e2etopic"
val part = 0 val part = 0
val tp = new TopicPartition(topic, part) val tp = new TopicPartition(topic, part)
val topicAndPartition = TopicAndPartition(topic, part)
this.serverConfig.setProperty(KafkaConfig.MetricReporterClassesProp, classOf[MockBrokerMetricsReporter].getName) this.serverConfig.setProperty(KafkaConfig.MetricReporterClassesProp, classOf[MockBrokerMetricsReporter].getName)
override def generateConfigs = { override def generateConfigs = {

Loading…
Cancel
Save