From 4b23b521ae9649870212bdcd2349dd4771f45592 Mon Sep 17 00:00:00 2001 From: Balint Molnar Date: Tue, 6 Jun 2017 14:48:00 +0200 Subject: [PATCH] KAFKA-5389 Replace zkClient.exists method with zkUtils.pathExists --- .../scala/unit/kafka/admin/TopicCommandTest.scala | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/test/scala/unit/kafka/admin/TopicCommandTest.scala b/core/src/test/scala/unit/kafka/admin/TopicCommandTest.scala index e72a4e352ded4..53efa34b7e390 100644 --- a/core/src/test/scala/unit/kafka/admin/TopicCommandTest.scala +++ b/core/src/test/scala/unit/kafka/admin/TopicCommandTest.scala @@ -23,7 +23,8 @@ import kafka.utils.TestUtils import kafka.zk.ZooKeeperTestHarness import kafka.server.ConfigType import kafka.admin.TopicCommand.TopicCommandOptions -import kafka.utils.ZkUtils._ +import kafka.utils.ZkUtils.ConfigChangesPath +import kafka.utils.ZkUtils.getDeleteTopicPath import org.apache.kafka.common.errors.TopicExistsException import org.apache.kafka.common.internals.Topic @@ -79,9 +80,9 @@ class TopicCommandTest extends ZooKeeperTestHarness with Logging with RackAwareT // delete the NormalTopic val deleteOpts = new TopicCommandOptions(Array("--topic", normalTopic)) val deletePath = getDeleteTopicPath(normalTopic) - assertFalse("Delete path for topic shouldn't exist before deletion.", zkUtils.zkClient.exists(deletePath)) + assertFalse("Delete path for topic shouldn't exist before deletion.", zkUtils.pathExists(deletePath)) TopicCommand.deleteTopic(zkUtils, deleteOpts) - assertTrue("Delete path for topic should exist after deletion.", zkUtils.zkClient.exists(deletePath)) + assertTrue("Delete path for topic should exist after deletion.", zkUtils.pathExists(deletePath)) // create the offset topic val createOffsetTopicOpts = new TopicCommandOptions(Array("--partitions", numPartitionsOriginal.toString, @@ -92,11 +93,11 @@ class TopicCommandTest extends ZooKeeperTestHarness with Logging with RackAwareT // try to delete the Topic.GROUP_METADATA_TOPIC_NAME and make sure it doesn't val deleteOffsetTopicOpts = new TopicCommandOptions(Array("--topic", Topic.GROUP_METADATA_TOPIC_NAME)) val deleteOffsetTopicPath = getDeleteTopicPath(Topic.GROUP_METADATA_TOPIC_NAME) - assertFalse("Delete path for topic shouldn't exist before deletion.", zkUtils.zkClient.exists(deleteOffsetTopicPath)) + assertFalse("Delete path for topic shouldn't exist before deletion.", zkUtils.pathExists(deleteOffsetTopicPath)) intercept[AdminOperationException] { TopicCommand.deleteTopic(zkUtils, deleteOffsetTopicOpts) } - assertFalse("Delete path for topic shouldn't exist after deletion.", zkUtils.zkClient.exists(deleteOffsetTopicPath)) + assertFalse("Delete path for topic shouldn't exist after deletion.", zkUtils.pathExists(deleteOffsetTopicPath)) } @Test