rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dongefore...@apache.org
Subject [16/51] [abbrv] incubator-rocketmq git commit: BugFix: WS_DOMAIN_NAME, SUBGROUP default values override custom values passed by java options options
Date Tue, 06 Jun 2017 03:38:36 GMT
BugFix: WS_DOMAIN_NAME, SUBGROUP default values override custom values passed by java options
options


Project: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/commit/051527d4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/tree/051527d4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/diff/051527d4

Branch: refs/heads/master
Commit: 051527d44a758ba25b497dd30ba800f9b06ca823
Parents: cf723ad
Author: Zhanhui Li <lizhanhui@apache.org>
Authored: Wed Apr 12 22:25:11 2017 +0800
Committer: dongeforever <zhendongliu92@yeah.net>
Committed: Tue Jun 6 11:37:29 2017 +0800

----------------------------------------------------------------------
 broker/pom.xml                                  | 13 +++++++
 .../apache/rocketmq/broker/BrokerStartup.java   |  6 +--
 .../rocketmq/broker/BrokerStartupTest.java      | 40 ++++++++++++++++++++
 3 files changed, 55 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/051527d4/broker/pom.xml
----------------------------------------------------------------------
diff --git a/broker/pom.xml b/broker/pom.xml
index 4d0aae6..8cdafea 100644
--- a/broker/pom.xml
+++ b/broker/pom.xml
@@ -65,4 +65,17 @@
             <artifactId>javassist</artifactId>
         </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.19.1</version>
+                <configuration>
+                    <forkCount>1</forkCount>
+                    <reuseForks>false</reuseForks>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/051527d4/broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java
----------------------------------------------------------------------
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java b/broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java
index 39ee8dd..98ff136 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/BrokerStartup.java
@@ -232,12 +232,10 @@ public class BrokerStartup {
 
     private static void properties2SystemEnv(Properties properties) {
         if (properties == null) {
-            log.info("No properties to set system environment");
             return;
         }
-
-        String rmqAddressServerDomain = properties.getProperty("rmqAddressServerDomain",
MixAll.DEFAULT_NAMESRV_ADDR_LOOKUP);
-        String rmqAddressServerSubGroup = properties.getProperty("rmqAddressServerSubGroup",
"nsaddr");
+        String rmqAddressServerDomain = properties.getProperty("rmqAddressServerDomain",
MixAll.WS_DOMAIN_NAME);
+        String rmqAddressServerSubGroup = properties.getProperty("rmqAddressServerSubGroup",
MixAll.WS_DOMAIN_SUBGROUP);
         System.setProperty("rocketmq.namesrv.domain", rmqAddressServerDomain);
         System.setProperty("rocketmq.namesrv.domain.subgroup", rmqAddressServerSubGroup);
     }

http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/051527d4/broker/src/test/java/org/apache/rocketmq/broker/BrokerStartupTest.java
----------------------------------------------------------------------
diff --git a/broker/src/test/java/org/apache/rocketmq/broker/BrokerStartupTest.java b/broker/src/test/java/org/apache/rocketmq/broker/BrokerStartupTest.java
new file mode 100644
index 0000000..a5ad3ac
--- /dev/null
+++ b/broker/src/test/java/org/apache/rocketmq/broker/BrokerStartupTest.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.broker;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Properties;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class BrokerStartupTest {
+
+    @Test
+    public void testProperties2SystemEnv() throws NoSuchMethodException, InvocationTargetException,
+        IllegalAccessException {
+        Properties properties = new Properties();
+        Class<BrokerStartup> clazz = BrokerStartup.class;
+        Method method = clazz.getDeclaredMethod("properties2SystemEnv", Properties.class);
+        method.setAccessible(true);
+        System.setProperty("rocketmq.namesrv.domain", "value");
+        method.invoke(null, properties);
+        Assert.assertEquals("value", System.getProperty("rocketmq.namesrv.domain"));
+    }
+
+}
\ No newline at end of file


Mime
View raw message