From cdfd589b1325cb4c4afa39556ca0b79117803967 Mon Sep 17 00:00:00 2001 From: yx9o Date: Sun, 31 Aug 2025 00:02:29 +0800 Subject: [PATCH 1/3] [ISSUE #9650] Unified FAQ related URLs --- .../apache/rocketmq/common/help/FAQUrl.java | 28 +++++++------ .../rocketmq/common/help/FAQUrlTest.java | 40 +++++++++++++++++++ 2 files changed, 55 insertions(+), 13 deletions(-) create mode 100644 common/src/test/java/org/apache/rocketmq/common/help/FAQUrlTest.java diff --git a/common/src/main/java/org/apache/rocketmq/common/help/FAQUrl.java b/common/src/main/java/org/apache/rocketmq/common/help/FAQUrl.java index 4a6588e4124..7154b3f169f 100644 --- a/common/src/main/java/org/apache/rocketmq/common/help/FAQUrl.java +++ b/common/src/main/java/org/apache/rocketmq/common/help/FAQUrl.java @@ -18,32 +18,34 @@ public class FAQUrl { - public static final String APPLY_TOPIC_URL = "https://rocketmq.apache.org/docs/bestPractice/06FAQ"; + public static final String DEFAULT_FAQ_URL = "https://rocketmq.apache.org/docs/bestPractice/06FAQ"; - public static final String NAME_SERVER_ADDR_NOT_EXIST_URL = "https://rocketmq.apache.org/docs/bestPractice/06FAQ"; + public static final String APPLY_TOPIC_URL = DEFAULT_FAQ_URL; - public static final String GROUP_NAME_DUPLICATE_URL = "https://rocketmq.apache.org/docs/bestPractice/06FAQ"; + public static final String NAME_SERVER_ADDR_NOT_EXIST_URL = DEFAULT_FAQ_URL; - public static final String CLIENT_PARAMETER_CHECK_URL = "https://rocketmq.apache.org/docs/bestPractice/06FAQ"; + public static final String GROUP_NAME_DUPLICATE_URL = DEFAULT_FAQ_URL; - public static final String SUBSCRIPTION_GROUP_NOT_EXIST = "https://rocketmq.apache.org/docs/bestPractice/06FAQ"; + public static final String CLIENT_PARAMETER_CHECK_URL = DEFAULT_FAQ_URL; - public static final String CLIENT_SERVICE_NOT_OK = "https://rocketmq.apache.org/docs/bestPractice/06FAQ"; + public static final String SUBSCRIPTION_GROUP_NOT_EXIST = DEFAULT_FAQ_URL; + + public static final String CLIENT_SERVICE_NOT_OK = DEFAULT_FAQ_URL; // FAQ: No route info of this topic, TopicABC - public static final String NO_TOPIC_ROUTE_INFO = "https://rocketmq.apache.org/docs/bestPractice/06FAQ"; + public static final String NO_TOPIC_ROUTE_INFO = DEFAULT_FAQ_URL; - public static final String LOAD_JSON_EXCEPTION = "https://rocketmq.apache.org/docs/bestPractice/06FAQ"; + public static final String LOAD_JSON_EXCEPTION = DEFAULT_FAQ_URL; - public static final String SAME_GROUP_DIFFERENT_TOPIC = "https://rocketmq.apache.org/docs/bestPractice/06FAQ"; + public static final String SAME_GROUP_DIFFERENT_TOPIC = DEFAULT_FAQ_URL; - public static final String MQLIST_NOT_EXIST = "https://rocketmq.apache.org/docs/bestPractice/06FAQ"; + public static final String MQLIST_NOT_EXIST = DEFAULT_FAQ_URL; - public static final String UNEXPECTED_EXCEPTION_URL = "https://rocketmq.apache.org/docs/bestPractice/06FAQ"; + public static final String UNEXPECTED_EXCEPTION_URL = DEFAULT_FAQ_URL; - public static final String SEND_MSG_FAILED = "https://rocketmq.apache.org/docs/bestPractice/06FAQ"; + public static final String SEND_MSG_FAILED = DEFAULT_FAQ_URL; - public static final String UNKNOWN_HOST_EXCEPTION = "https://rocketmq.apache.org/docs/bestPractice/06FAQ"; + public static final String UNKNOWN_HOST_EXCEPTION = DEFAULT_FAQ_URL; private static final String TIP_STRING_BEGIN = "\nSee "; private static final String TIP_STRING_END = " for further details."; diff --git a/common/src/test/java/org/apache/rocketmq/common/help/FAQUrlTest.java b/common/src/test/java/org/apache/rocketmq/common/help/FAQUrlTest.java new file mode 100644 index 00000000000..27e7bdcd22d --- /dev/null +++ b/common/src/test/java/org/apache/rocketmq/common/help/FAQUrlTest.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.rocketmq.common.help; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class FAQUrlTest { + + @Test + public void testSuggestTodo() { + String expected = "\nSee " + FAQUrl.DEFAULT_FAQ_URL + " for further details."; + String actual = FAQUrl.suggestTodo(FAQUrl.DEFAULT_FAQ_URL); + assertEquals(expected, actual); + } + + @Test + public void testAttachDefaultURL() { + String errorMsg = "errorMsg"; + String expected = errorMsg + "\nFor more information, please visit the url, " + FAQUrl.UNEXPECTED_EXCEPTION_URL; + String actual = FAQUrl.attachDefaultURL(errorMsg); + assertEquals(expected, actual); + } +} From 6f1456f55aef8033ef1a74445673d1e9d5cf8260 Mon Sep 17 00:00:00 2001 From: yx9o Date: Sun, 31 Aug 2025 10:47:51 +0800 Subject: [PATCH 2/3] Update --- .../test/java/org/apache/rocketmq/common/help/FAQUrlTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/test/java/org/apache/rocketmq/common/help/FAQUrlTest.java b/common/src/test/java/org/apache/rocketmq/common/help/FAQUrlTest.java index 27e7bdcd22d..8365522f168 100644 --- a/common/src/test/java/org/apache/rocketmq/common/help/FAQUrlTest.java +++ b/common/src/test/java/org/apache/rocketmq/common/help/FAQUrlTest.java @@ -33,7 +33,8 @@ public void testSuggestTodo() { @Test public void testAttachDefaultURL() { String errorMsg = "errorMsg"; - String expected = errorMsg + "\nFor more information, please visit the url, " + FAQUrl.UNEXPECTED_EXCEPTION_URL; + String expected = errorMsg + "\nFor more information, please visit the url, " + + FAQUrl.UNEXPECTED_EXCEPTION_URL; String actual = FAQUrl.attachDefaultURL(errorMsg); assertEquals(expected, actual); } From 4db623bdd4fa38b98ff697d65b19b9b1a4238175 Mon Sep 17 00:00:00 2001 From: yx9o Date: Sun, 31 Aug 2025 13:27:53 +0800 Subject: [PATCH 3/3] Update --- .../test/java/org/apache/rocketmq/common/help/FAQUrlTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/test/java/org/apache/rocketmq/common/help/FAQUrlTest.java b/common/src/test/java/org/apache/rocketmq/common/help/FAQUrlTest.java index 8365522f168..f7d0603ce2b 100644 --- a/common/src/test/java/org/apache/rocketmq/common/help/FAQUrlTest.java +++ b/common/src/test/java/org/apache/rocketmq/common/help/FAQUrlTest.java @@ -33,7 +33,8 @@ public void testSuggestTodo() { @Test public void testAttachDefaultURL() { String errorMsg = "errorMsg"; - String expected = errorMsg + "\nFor more information, please visit the url, " + String expected = errorMsg + + "\nFor more information, please visit the url, " + FAQUrl.UNEXPECTED_EXCEPTION_URL; String actual = FAQUrl.attachDefaultURL(errorMsg); assertEquals(expected, actual);