Modify the Service Addr Query Logic 77/21977/1
authorGuangrong Fu <fu.guangrong@zte.com.cn>
Fri, 3 Nov 2017 06:23:41 +0000 (14:23 +0800)
committerGuangrong Fu <fu.guangrong@zte.com.cn>
Fri, 3 Nov 2017 06:24:44 +0000 (14:24 +0800)
Change-Id: Ieac7058fc69aa5f6a7b296564e4266f4a5399e7f
Issue-ID: HOLMES-81
Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn>
rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java
rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineService.java
rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPollingTest.java

index 01fde48..7738366 100644 (file)
@@ -61,7 +61,7 @@ public class RuleActiveApp extends IOCApplication<RuleAppConfig> {
     }
 
     private MicroServiceInfo createMicroServiceInfo() {
-        String[] serviceAddrInfo = MicroServiceConfig.getServiceAddrInfo();
+        String[] serviceAddrInfo = MicroServiceConfig.getMicroServiceIpAndPort();
         MicroServiceInfo msinfo = new MicroServiceInfo();
         msinfo.setServiceName("holmes-rule-mgmt");
         msinfo.setVersion("v1");
index f3e8d5c..5dc97b4 100644 (file)
@@ -38,7 +38,7 @@ public class EngineService {
     protected Response delete(String packageName) throws IOException {\r
         Client client = createClient();\r
         WebTarget webTarget = client\r
-                .target(MicroServiceConfig.getMsbServerAddr() + RuleMgtConstant.ENGINE_PATH + "/" + packageName);\r
+                .target(MicroServiceConfig.getMsbServerAddrWithHttpPrefix() + RuleMgtConstant.ENGINE_PATH + "/" + packageName);\r
         return webTarget.request(MediaType.APPLICATION_JSON).delete();\r
     }\r
 \r
@@ -52,7 +52,7 @@ public class EngineService {
         Client client = createClient();\r
         ObjectMapper mapper = new ObjectMapper();\r
         String content = mapper.writeValueAsString(correlationCheckRule4Engine);\r
-        WebTarget webTarget = client.target(MicroServiceConfig.getMsbServerAddr() + RuleMgtConstant.ENGINE_PATH);\r
+        WebTarget webTarget = client.target(MicroServiceConfig.getMsbServerAddrWithHttpPrefix() + RuleMgtConstant.ENGINE_PATH);\r
         return webTarget.request(MediaType.APPLICATION_JSON).post(Entity.entity(content, MediaType.APPLICATION_JSON));\r
     }\r
 \r
@@ -60,7 +60,7 @@ public class EngineService {
         Client client = createClient();\r
         ObjectMapper mapper = new ObjectMapper();\r
         String content = mapper.writeValueAsString(correlationDeployRule4Engine);\r
-        WebTarget webTarget = client.target(MicroServiceConfig.getMsbServerAddr() + RuleMgtConstant.ENGINE_PATH);\r
+        WebTarget webTarget = client.target(MicroServiceConfig.getMsbServerAddrWithHttpPrefix() + RuleMgtConstant.ENGINE_PATH);\r
         return webTarget.request(MediaType.APPLICATION_JSON).put(Entity.entity(content, MediaType.APPLICATION_JSON));\r
     }\r
 }\r
index 25e211a..a330306 100644 (file)
@@ -59,7 +59,7 @@ public class DcaeConfigurationPollingTest {
         thrown.expect(CorrelationException.class);
         thrown.expectMessage("host");
         PowerMockito.mockStatic(MicroServiceConfig.class);
-        when(MicroServiceConfig.getServiceAddrInfoFromCBS("holmes-rule-mgmt"))
+        when(MicroServiceConfig.getServiceConfigInfoFromCBS("holmes-rule-mgmt"))
                 .thenReturn("host");
         PowerMock.createMock(DcaeConfigurationParser.class);
         PowerMock.expectPrivate(DcaeConfigurationParser.class, "parse", "host")
@@ -75,7 +75,7 @@ public class DcaeConfigurationPollingTest {
         PowerMock.resetAll();
         thrown.expect(CorrelationException.class);
         PowerMockito.mockStatic(MicroServiceConfig.class);
-        when(MicroServiceConfig.getServiceAddrInfoFromCBS("holmes-rule-mgmt"))
+        when(MicroServiceConfig.getServiceConfigInfoFromCBS("holmes-rule-mgmt"))
                 .thenReturn("host");
         PowerMock.createMock(DcaeConfigurationParser.class);
         PowerMock.expectPrivate(DcaeConfigurationParser.class, "parse", "host")