diff options
author | 2017-10-20 09:18:11 +0800 | |
---|---|---|
committer | 2017-10-20 09:20:53 +0800 | |
commit | 17a3500b535e9dd09a272c7428bdd9c9c945f1bb (patch) | |
tree | 974706ab947b0e167e7c45f17c4c564bf46b5d5a /holmes-actions/src | |
parent | 6c9ff5b3edcb451bb61ff2180e30f79339434d1f (diff) |
modify bug
Issue-ID: HOLMES-71
Change-Id: Ib54045fcc4505c08b0f3da28aea18a27a510bd4f
Signed-off-by: Shiwei Tian <tian.shiwei@zte.com.cn>
Diffstat (limited to 'holmes-actions/src')
3 files changed, 39 insertions, 4 deletions
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java index fb8a8ca..40390b8 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/aai/AaiQuery.java @@ -73,7 +73,7 @@ public class AaiQuery { } private String getResourceLinksResponse(String vserverId, String vserverName) throws CorrelationException { - String url = getBaseUrl(getMsbSuffixAddr(AaiConfig.AAI_VNF_ADDR) + "vserver-id:EQUALS:" + vserverId); + String url = getBaseUrl(getMsbSuffixAddr(AaiConfig.AAI_VM_ADDR) + "vserver-id:EQUALS:" + vserverId); String response = getResponse(url); if ("".equals(response) || "{}".equals(response)) { url = getBaseUrl(AaiConfig.AAI_VM_ADDR + "vserver-name:EQUALS:" + vserverName); @@ -83,7 +83,7 @@ public class AaiQuery { } private String getVnfDataResponse(String vnfId, String vnfName) throws CorrelationException { - String url = getBaseUrl(getMsbSuffixAddr(AaiConfig.AAI_VM_ADDR)+ "vnf-id=" + vnfId); + String url = getBaseUrl(getMsbSuffixAddr(AaiConfig.AAI_VNF_ADDR)+ "vnf-id=" + vnfId); String response = getResponse(url); if ("".equals(response) || "{}".equals(response)) { url = getBaseUrl(AaiConfig.AAI_VNF_ADDR + "vnf-name=" + vnfName); @@ -113,7 +113,7 @@ public class AaiQuery { private String getMsbSuffixAddr(String suffixUrl) { String[] addrSplits = suffixUrl.substring(1).split("/"); String ret = addrSplits[1]; - addrSplits[1] = addrSplits[2]; + addrSplits[1] = addrSplits[0] + "-" + addrSplits[2]; addrSplits[2] = ret; StringBuffer stringBuffer = new StringBuffer(); for (String split : addrSplits) { diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/utils/DroolsLog.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/DroolsLog.java new file mode 100644 index 0000000..579abf8 --- /dev/null +++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/DroolsLog.java @@ -0,0 +1,35 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * Licensed 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.onap.holmes.common.utils; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class DroolsLog { + + public static void printError(String msg) { + log.error("Drools Log: " + msg); + } + + public static void printWarn(String msg) { + log.warn("Drools Log: " + msg); + } + + public static void printInfo(String msg) { + log.info("Drools Log: " + msg); + } + + public static void printDebug(String msg) { + log.debug("Drools Log: " + msg); + } +} diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryTest.java index 59f8848..34a6c46 100644 --- a/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryTest.java +++ b/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryTest.java @@ -354,7 +354,7 @@ public class AaiQueryTest { public void testAaiQuery_getMsbSuffixAddr_Ok() throws Exception { PowerMock.resetAll(); String url = "/aai/v11/network/generic-vnfs/generic-vnf?"; - String expect = "/aai/network/v11/generic-vnfs/generic-vnf?"; + String expect = "/aai/aai-network/v11/generic-vnfs/generic-vnf?"; aaiQuery = new AaiQuery(); PowerMock.replayAll(); String actual = Whitebox.invokeMethod(aaiQuery, "getMsbSuffixAddr", url); |