Skip to content

Commit

Permalink
MINOR: Remove unused TopicAndPartition usage in tests (apache#5419)
Browse files Browse the repository at this point in the history
Also replace `TopicAndPartition` with `TopicPartition` in `MetadataCache`.

Reviewers: Ismael Juma <[email protected]>
  • Loading branch information
omkreddy authored and ijuma committed Jul 24, 2018
1 parent 4b60ed3 commit 52c5b5f
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 8 deletions.
3 changes: 1 addition & 2 deletions core/src/main/scala/kafka/server/MetadataCache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import scala.collection.{Seq, Set, mutable}
import scala.collection.JavaConverters._
import kafka.cluster.{Broker, EndPoint}
import kafka.api._
import kafka.common.TopicAndPartition
import kafka.controller.StateChangeLogger
import kafka.utils.CoreUtils._
import kafka.utils.Logging
Expand Down Expand Up @@ -71,7 +70,7 @@ class MetadataCache(brokerId: Int) extends Logging {
errorUnavailableListeners: Boolean): Option[Iterable[MetadataResponse.PartitionMetadata]] = {
cache.get(topic).map { partitions =>
partitions.map { case (partitionId, partitionState) =>
val topicPartition = TopicAndPartition(topic, partitionId)
val topicPartition = new TopicPartition(topic, partitionId)
val leaderBrokerId = partitionState.basePartitionState.leader
val maybeLeader = getAliveEndpoint(leaderBrokerId, listenerName)
val replicas = partitionState.basePartitionState.replicas.asScala.map(_.toInt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import java.util.{ArrayList, Collections, Properties}
import java.time.Duration

import kafka.admin.ConsumerGroupCommand.{ConsumerGroupCommandOptions, ConsumerGroupService}
import kafka.common.TopicAndPartition
import kafka.log.LogConfig
import kafka.network.SocketServer
import kafka.security.auth._
Expand Down Expand Up @@ -70,7 +69,6 @@ class AuthorizerIntegrationTest extends BaseRequestTest {
val tp = new TopicPartition(topic, part)
val logDir = "logDir"
val deleteRecordsPartition = new TopicPartition(deleteTopic, part)
val topicAndPartition = TopicAndPartition(topic, part)
val group = "my-group"
val topicResource = Resource(Topic, topic, LITERAL)
val groupResource = Resource(Group, group, LITERAL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import java.util.ArrayList
import java.util.concurrent.ExecutionException

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import java.util.concurrent.ExecutionException
import java.util.concurrent.atomic.AtomicReference
import java.util.Properties

import kafka.common.TopicAndPartition
import kafka.integration.KafkaServerTestHarness
import kafka.server._
import kafka.utils._
Expand Down Expand Up @@ -100,7 +99,6 @@ class EndToEndClusterIdTest extends KafkaServerTestHarness {
val topic = "e2etopic"
val part = 0
val tp = new TopicPartition(topic, part)
val topicAndPartition = TopicAndPartition(topic, part)
this.serverConfig.setProperty(KafkaConfig.MetricReporterClassesProp, classOf[MockBrokerMetricsReporter].getName)

override def generateConfigs = {
Expand Down

0 comments on commit 52c5b5f

Please sign in to comment.