This is an automated email from the ASF dual-hosted git repository.

healchow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 56cb13f13 [INLONG-3975][TubeMQ] Modify the MasterConfigTest to 
configure the incoming parameters (#3976)
56cb13f13 is described below

commit 56cb13f13d3b75b5585ea6fbc5df14bb963a6f14
Author: gosonzhang <[email protected]>
AuthorDate: Wed Apr 27 19:43:38 2022 +0800

    [INLONG-3975][TubeMQ] Modify the MasterConfigTest to configure the incoming 
parameters (#3976)
---
 .../tubemq/server/master/MasterConfigTest.java     | 44 +++++++++++-----------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git 
a/inlong-tubemq/tubemq-server/src/test/java/org/apache/inlong/tubemq/server/master/MasterConfigTest.java
 
b/inlong-tubemq/tubemq-server/src/test/java/org/apache/inlong/tubemq/server/master/MasterConfigTest.java
index 7bdac5722..43e1dda6d 100644
--- 
a/inlong-tubemq/tubemq-server/src/test/java/org/apache/inlong/tubemq/server/master/MasterConfigTest.java
+++ 
b/inlong-tubemq/tubemq-server/src/test/java/org/apache/inlong/tubemq/server/master/MasterConfigTest.java
@@ -18,6 +18,9 @@
 package org.apache.inlong.tubemq.server.master;
 
 import com.sleepycat.je.Durability;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Objects;
 import org.apache.inlong.tubemq.server.common.fileconfig.BdbMetaConfig;
 import org.apache.inlong.tubemq.server.common.fileconfig.ZKMetaConfig;
 import org.junit.Assert;
@@ -30,11 +33,11 @@ public class MasterConfigTest {
     }
 
     @Test
-    public void testMetaBdbConfig() {
+    public void testMetaBdbConfig() throws Exception {
         final MasterConfig masterConfig = new MasterConfig();
-        masterConfig.loadFromFile(this.getClass()
-                .getResource("/master-meta-bdb.ini").getPath());
-
+        Path configUrl = Paths.get(Objects.requireNonNull(
+                
getClass().getClassLoader().getResource("master-meta-bdb.ini")).toURI());
+        masterConfig.loadFromFile(configUrl.toString());
         Assert.assertEquals(masterConfig.getMetaDataPath(), "var/meta_data");
         Assert.assertTrue(masterConfig.isUseBdbStoreMetaData());
         final BdbMetaConfig repConfig = masterConfig.getBdbMetaConfig();
@@ -49,11 +52,11 @@ public class MasterConfigTest {
     }
 
     @Test
-    public void testMetaZooKeeperConfig() {
+    public void testMetaZooKeeperConfig() throws Exception {
         final MasterConfig masterConfig = new MasterConfig();
-        masterConfig.loadFromFile(this.getClass()
-                .getResource("/master-meta-zk.ini").getPath());
-
+        Path configUrl = Paths.get(Objects.requireNonNull(
+                
getClass().getClassLoader().getResource("master-meta-zk.ini")).toURI());
+        masterConfig.loadFromFile(configUrl.toString());
         Assert.assertFalse(masterConfig.isUseBdbStoreMetaData());
         final ZKMetaConfig zkMetaConfig = masterConfig.getZkMetaConfig();
         Assert.assertEquals("/tubemq", zkMetaConfig.getZkNodeRoot());
@@ -66,10 +69,11 @@ public class MasterConfigTest {
     }
 
     @Test
-    public void testNormalConfig() {
+    public void testNormalConfig() throws Exception {
         final MasterConfig masterConfig = new MasterConfig();
-        
masterConfig.loadFromFile(this.getClass().getResource("/master-normal.ini").getPath());
-
+        Path configUrl = Paths.get(Objects.requireNonNull(
+                
getClass().getClassLoader().getResource("master-normal.ini")).toURI());
+        masterConfig.loadFromFile(configUrl.toString());
         Assert.assertEquals("127.0.0.1", masterConfig.getHostName());
         Assert.assertEquals(8000, masterConfig.getPort());
         Assert.assertEquals(8080, masterConfig.getWebPort());
@@ -94,13 +98,12 @@ public class MasterConfigTest {
     }
 
     @Test
-    public void testOptionalReplicationConfig() {
+    public void testOptionalReplicationConfig() throws Exception {
         final MasterConfig masterConfig = new MasterConfig();
-        masterConfig.loadFromFile(this.getClass()
-            .getResource("/master-replication-optional.ini").getPath());
-
+        Path configUrl = Paths.get(Objects.requireNonNull(
+                
getClass().getClassLoader().getResource("master-replication-optional.ini")).toURI());
+        masterConfig.loadFromFile(configUrl.toString());
         Assert.assertEquals(masterConfig.getMetaDataPath(), "var/meta_data");
-
         final BdbMetaConfig repConfig = masterConfig.getBdbMetaConfig();
         Assert.assertEquals("tubemqMasterGroup", repConfig.getRepGroupName());
         Assert.assertEquals("tubemqMasterGroupNode1", 
repConfig.getRepNodeName());
@@ -113,13 +116,12 @@ public class MasterConfigTest {
     }
 
     @Test
-    public void testReplicationConfigBackwardCompatibility() {
+    public void testReplicationConfigBackwardCompatibility() throws Exception {
         final MasterConfig masterConfig = new MasterConfig();
-        masterConfig.loadFromFile(this.getClass()
-            .getResource("/master-replication-compatibility.ini").getPath());
-
+        Path configUrl = Paths.get(Objects.requireNonNull(
+                
getClass().getClassLoader().getResource("master-replication-compatibility.ini")).toURI());
+        masterConfig.loadFromFile(configUrl.toString());
         Assert.assertEquals("var/tubemqMasterGroup/master_data", 
masterConfig.getMetaDataPath());
-
         final BdbMetaConfig repConfig = masterConfig.getBdbMetaConfig();
         Assert.assertEquals("gp1", repConfig.getRepGroupName());
         Assert.assertEquals("tubemqMasterGroupNode1", 
repConfig.getRepNodeName());

Reply via email to