From: Guangrong Fu Date: Fri, 24 Mar 2023 01:43:46 +0000 (+0800) Subject: Removed redundant env vars X-Git-Tag: 1.4.6~2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=6e0fd04861ecd2a00ca2d158b0639454eae94702;hp=6bc2f1eb5ff3f271c9584a0c48498354d2fcc4cc;p=holmes%2Fcommon.git Removed redundant env vars Issue-ID: HOLMES-613 Signed-off-by: Guangrong Fu Change-Id: I754658a0ce3172dffd4e4dd28a95922d5eb7d991 --- diff --git a/holmes-actions/pom.xml b/holmes-actions/pom.xml index cec3209..b09b882 100644 --- a/holmes-actions/pom.xml +++ b/holmes-actions/pom.xml @@ -12,7 +12,7 @@ org.onap.holmes.common holmes-common-parent - 1.4.5-SNAPSHOT + 1.4.6-SNAPSHOT holmes-common-service diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java b/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java index 621e23b..4702d7b 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java @@ -33,13 +33,10 @@ public class MicroServiceConfig { final static public String HOSTNAME = "HOSTNAME"; final static public String POD_IP = "POD_IP"; final static public String CONFIG_BINDING_SERVICE = "CONFIG_BINDING_SERVICE"; - final static public String MSB_ADDR = "MSB_ADDR"; final static public String MSB_IAG_SERVICE_HOST = "MSB_IAG_SERVICE_HOST"; final static public String MSB_IAG_SERVICE_PORT = "MSB_IAG_SERVICE_PORT"; - final static public String BASE_URL = "BASE_URL"; - final static public String PRE_ADDR = "PRE_ADDR"; - final static public String POST_ADDR = "POST_ADDR"; final static public String AAI_ADDR = "AAI_ADDR"; + final static public String NAMESPACE = "NAMESPACE"; final static public String PROTOCOL_HTTP = "http"; final static public String PROTOCOL_HTTPS = "https"; final static public int PLAIN_PORT = 80; @@ -97,12 +94,10 @@ public class MicroServiceConfig { public static String getAaiAddr() { boolean tlsEnabled = Boolean.valueOf(getEnv("ENABLE_ENCRYPT")); - return String.format("%s://%s%s%s.%s:%d", + return String.format("%s://%s.%s:%d", tlsEnabled ? PROTOCOL_HTTPS : PROTOCOL_HTTP, - nullToEmptyString(getEnv(PRE_ADDR)), nullToEmptyString(getEnv(AAI_ADDR)), - nullToEmptyString(getEnv(POST_ADDR)), - nullToEmptyString(getEnv(BASE_URL)), + nullToEmptyString(getEnv(NAMESPACE)), tlsEnabled ? TLS_PORT : PLAIN_PORT); } diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn2Test.java b/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn2Test.java index 9b9d75c..18b0fe0 100644 --- a/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn2Test.java +++ b/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQuery4Ccvpn2Test.java @@ -44,8 +44,6 @@ import java.util.Map; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNull.nullValue; -import static org.onap.holmes.common.config.MicroServiceConfig.MSB_ADDR; - @RunWith(PowerMockRunner.class) @PrepareForTest({JerseyClient.class}) @@ -61,7 +59,6 @@ public class AaiQuery4Ccvpn2Test { @BeforeClass static public void beforeClass() { - System.setProperty(MSB_ADDR, "127.0.0.1:80"); File file = new File(AaiQuery4Ccvpn2Test.class.getClassLoader().getResource("./ccvpn2.data.json").getFile()); BufferedReader reader = null; diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQuery4CcvpnTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQuery4CcvpnTest.java index 55e7b6b..0430e28 100644 --- a/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQuery4CcvpnTest.java +++ b/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQuery4CcvpnTest.java @@ -36,8 +36,6 @@ import static org.easymock.EasyMock.anyObject; import static org.easymock.EasyMock.anyString; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertThat; -import static org.onap.holmes.common.config.MicroServiceConfig.MSB_ADDR; - @RunWith(PowerMockRunner.class) @PrepareForTest(JerseyClient.class) @@ -56,8 +54,6 @@ public class AaiQuery4CcvpnTest { @BeforeClass static public void beforeClass() { - System.setProperty(MSB_ADDR, "127.0.0.1:80"); - File file = new File(AaiQuery4CcvpnTest.class.getClassLoader().getResource("./ccvpn.data.json").getFile()); BufferedReader reader = null; try { diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryMdonsTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryMdonsTest.java index 8b176eb..6c038c2 100644 --- a/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryMdonsTest.java +++ b/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryMdonsTest.java @@ -38,7 +38,6 @@ import java.util.Map; import static org.easymock.EasyMock.anyObject; import static org.junit.Assert.assertEquals; -import static org.onap.holmes.common.config.MicroServiceConfig.MSB_ADDR; @RunWith(PowerMockRunner.class) @PowerMockIgnore("javax.net.ssl.*") @@ -57,10 +56,9 @@ public class AaiQueryMdonsTest { @BeforeClass public static void beforeClass() { - System.setProperty(MSB_ADDR, "127.0.0.1:80"); System.setProperty("ENABLE_ENCRYPT", "true"); System.setProperty(MicroServiceConfig.AAI_ADDR, "aai"); - System.setProperty(MicroServiceConfig.BASE_URL, "onap"); + System.setProperty(MicroServiceConfig.NAMESPACE, "onap"); File file = new File(AaiQueryMdonsTest.class.getClassLoader().getResource("./aai-mdons.json").getFile()); BufferedReader reader = null; diff --git a/pom.xml b/pom.xml index a0de13b..2af85ea 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ holmes-common-parent pom - 1.4.5-SNAPSHOT + 1.4.6-SNAPSHOT holmes-common holmes-actions