From 1074ef7822c7713bdd17f7b7cc53a042ec26e269 Mon Sep 17 00:00:00 2001 From: dongeforever Date: Wed, 24 Nov 2021 17:37:55 +0800 Subject: [PATCH] Polish the variable name in StaticTopicIT --- .../rocketmq/test/smoke/StaticTopicIT.java | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/test/src/test/java/org/apache/rocketmq/test/smoke/StaticTopicIT.java b/test/src/test/java/org/apache/rocketmq/test/smoke/StaticTopicIT.java index 73215ba2..9d3e0c38 100644 --- a/test/src/test/java/org/apache/rocketmq/test/smoke/StaticTopicIT.java +++ b/test/src/test/java/org/apache/rocketmq/test/smoke/StaticTopicIT.java @@ -6,7 +6,6 @@ import org.apache.rocketmq.common.rpc.ClientMetadata; import org.apache.rocketmq.common.statictopic.TopicConfigAndQueueMapping; import org.apache.rocketmq.common.statictopic.TopicQueueMappingOne; import org.apache.rocketmq.common.statictopic.TopicQueueMappingUtils; -import org.apache.rocketmq.common.statictopic.TopicRemappingDetailWrapper; import org.apache.rocketmq.test.base.BaseConf; import org.apache.rocketmq.test.util.MQRandomUtils; import org.apache.rocketmq.tools.admin.DefaultMQAdminExt; @@ -17,8 +16,6 @@ import org.junit.FixMethodOrder; import org.junit.Test; import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -49,6 +46,7 @@ public class StaticTopicIT extends BaseConf { Map brokerConfigMap = defaultMQAdminExt.examineTopicConfigAll(clientMetadata, topic); Assert.assertTrue(brokerConfigMap.isEmpty()); TopicQueueMappingUtils.createTopicConfigMapping(topic, queueNum, targetBrokers, brokerConfigMap); + Assert.assertEquals(2, brokerConfigMap.size()); //If some succeed, and others fail, it will cause inconsistent data for (Map.Entry entry : brokerConfigMap.entrySet()) { String broker = entry.getKey(); @@ -63,19 +61,19 @@ public class StaticTopicIT extends BaseConf { public void testCreateAndRemappingStaticTopic() throws Exception { String topic = "static" + MQRandomUtils.getRandomTopic(); int queueNum = 10; - Map brokerConfigMap = createStaticTopic(topic, queueNum, getBrokers()); + Map localBrokerConfigMap = createStaticTopic(topic, queueNum, getBrokers()); { - Map brokerConfigMapFromRemote = defaultMQAdminExt.examineTopicConfigAll(clientMetadata, topic); - Assert.assertEquals(2, brokerConfigMapFromRemote.size()); - for (Map.Entry entry: brokerConfigMapFromRemote.entrySet()) { + Map remoteBrokerConfigMap = defaultMQAdminExt.examineTopicConfigAll(clientMetadata, topic); + Assert.assertEquals(2, remoteBrokerConfigMap.size()); + for (Map.Entry entry: remoteBrokerConfigMap.entrySet()) { String broker = entry.getKey(); TopicConfigAndQueueMapping configMapping = entry.getValue(); - TopicConfigAndQueueMapping configMappingLocal = brokerConfigMap.get(broker); - Assert.assertNotNull(configMappingLocal); - Assert.assertEquals(configMapping, configMappingLocal); + TopicConfigAndQueueMapping localConfigMapping = localBrokerConfigMap.get(broker); + Assert.assertNotNull(localConfigMapping); + Assert.assertEquals(configMapping, localConfigMapping); } - TopicQueueMappingUtils.checkConsistenceOfTopicConfigAndQueueMapping(topic, brokerConfigMapFromRemote); - Map globalIdMap = TopicQueueMappingUtils.checkAndBuildMappingItems(new ArrayList<>(getMappingDetailFromConfig(brokerConfigMapFromRemote.values())), false, true); + TopicQueueMappingUtils.checkConsistenceOfTopicConfigAndQueueMapping(topic, remoteBrokerConfigMap); + Map globalIdMap = TopicQueueMappingUtils.checkAndBuildMappingItems(new ArrayList<>(getMappingDetailFromConfig(remoteBrokerConfigMap.values())), false, true); Assert.assertEquals(queueNum, globalIdMap.size()); } /*{ -- GitLab