summaryrefslogtreecommitdiffstats
path: root/holmes-actions/src/test
diff options
context:
space:
mode:
authorShiwei Tian <tian.shiwei@zte.com.cn>2017-10-23 15:34:22 +0800
committerShiwei Tian <tian.shiwei@zte.com.cn>2017-10-23 15:34:22 +0800
commit75b8b484b7207c393026ee6509a22b2016a22475 (patch)
tree5dbe71ffbe2ab1ef80ac09c3c690845ca0713824 /holmes-actions/src/test
parentece7abcfdf6d68a8f41732883435822ceb745c11 (diff)
modify bug
Issue-ID: HOLMES-71 Change-Id: I1f7828319a571c78ef706220dbc2ae182f4b98ad Signed-off-by: Shiwei Tian <tian.shiwei@zte.com.cn>
Diffstat (limited to 'holmes-actions/src/test')
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryTest.java35
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/dmaap/DmaapServiceTest.java8
2 files changed, 21 insertions, 22 deletions
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 34a6c46..7872f2b 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
@@ -93,13 +93,14 @@ public class AaiQueryTest {
headers.put("X-FromAppId", AaiConfig.X_FROMAPP_ID);
headers.put("Authorization", AaiConfig.getAuthenticationCredentials());
headers.put("Accept", "application/json");
- String url = "host_url";
+ String url = "http://10.96.33.33/api/aai-cloudInfrastructure/v11";
when(HttpsUtils.get(url, headers)).thenReturn("{}");
PowerMockito.mockStatic(MicroServiceConfig.class);
- when(MicroServiceConfig.getMsbServerAddr()).thenReturn("host_url");
+ when(MicroServiceConfig.getMsbServerAddr()).thenReturn("http://10.96.33.33:80");
- PowerMock.expectPrivate(aaiQuery, "getVmResourceLinks", "test1", "test2").andReturn("");
+ PowerMock.expectPrivate(aaiQuery, "getVmResourceLinks", "test1", "test2")
+ .andReturn("/aai/v11/cloud-infrastructure");
PowerMock.replayAll();
VmEntity vmEntity = Whitebox.invokeMethod(aaiQuery, "getAaiVmData", "test1", "test2");
PowerMock.verifyAll();
@@ -125,14 +126,15 @@ public class AaiQueryTest {
headers.put("X-FromAppId", AaiConfig.X_FROMAPP_ID);
headers.put("Authorization", AaiConfig.getAuthenticationCredentials());
headers.put("Accept", "application/json");
- String url = "host_url";
+ String url = "http://10.96.33.33/api/aai-cloudInfrastructure/v11";
when(HttpsUtils.get(url, headers)).thenReturn("");
PowerMockito.mockStatic(MicroServiceConfig.class);
- when(MicroServiceConfig.getMsbServerAddr()).thenReturn("host_url");
+ when(MicroServiceConfig.getMsbServerAddr()).thenReturn("http://10.96.33.33:80");
- PowerMock.expectPrivate(aaiQuery, "getVmResourceLinks", "test1", "test2").andReturn("");
+ PowerMock.expectPrivate(aaiQuery, "getVmResourceLinks", "test1", "test2")
+ .andReturn("/aai/v11/cloud-infrastructure");
PowerMock.replayAll();
Whitebox.invokeMethod(aaiQuery, "getAaiVmData", "test1", "test2");
@@ -155,14 +157,15 @@ public class AaiQueryTest {
headers.put("X-FromAppId", AaiConfig.X_FROMAPP_ID);
headers.put("Authorization", AaiConfig.getAuthenticationCredentials());
headers.put("Accept", "application/json");
- String url = "host_url";
+ String url = "http://10.96.33.33/api/aai-cloudInfrastructure/v11";
when(HttpsUtils.get(url, headers)).thenThrow(new CorrelationException(""));
PowerMockito.mockStatic(MicroServiceConfig.class);
- when(MicroServiceConfig.getMsbServerAddr()).thenReturn("host_url");
+ when(MicroServiceConfig.getMsbServerAddr()).thenReturn("http://10.96.33.33:80");
- PowerMock.expectPrivate(aaiQuery, "getVmResourceLinks", "test1", "test2").andReturn("");
+ PowerMock.expectPrivate(aaiQuery, "getVmResourceLinks", "test1", "test2")
+ .andReturn("/aai/v11/cloud-infrastructure");
PowerMock.replayAll();
Whitebox.invokeMethod(aaiQuery, "getAaiVmData", "test1", "test2");
PowerMock.verifyAll();
@@ -277,15 +280,11 @@ public class AaiQueryTest {
headers.put("Authorization", AaiConfig.getAuthenticationCredentials());
headers.put("Accept", "application/json");
String url = "host_url";
-
when(HttpsUtils.get(url, headers)).thenThrow(new CorrelationException(""));
-
PowerMock.replayAll();
String resource = Whitebox.invokeMethod(aaiQuery, "getResponse", "host_url");
PowerMock.verifyAll();
-
assertThat(resource, equalTo(""));
-
}
@Test
@@ -308,13 +307,13 @@ public class AaiQueryTest {
aaiQuery = new AaiQuery();
PowerMockito.mockStatic(MicroServiceConfig.class);
- when(MicroServiceConfig.getMsbServerAddr()).thenReturn("msb");
+ when(MicroServiceConfig.getMsbServerAddr()).thenReturn("http://10.96.33.33:80");
when(MicroServiceConfig.getServiceAddrInfoFromCBS("nihao")).thenReturn("");
PowerMock.replayAll();
- String actual = Whitebox.invokeMethod(aaiQuery,"getBaseUrl", "url");
+ String actual = Whitebox.invokeMethod(aaiQuery,"getBaseUrl", "/url");
PowerMock.verifyAll();
- assertThat(actual, equalTo("msburl"));
+ assertThat(actual, equalTo("http://10.96.33.33/url"));
}
@Test
@@ -330,7 +329,7 @@ public class AaiQueryTest {
String actual = Whitebox.invokeMethod(aaiQuery,"getBaseUrl", "url");
System.out.println(actual);
PowerMock.verifyAll();
- assertThat(actual, equalTo("https:\\\\aaiurl"));
+ assertThat(actual, equalTo("https://aaiurl"));
}
@Test
@@ -354,7 +353,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/aai-network/v11/generic-vnfs/generic-vnf?";
+ String expect = "/api/aai-network/v11/generic-vnfs/generic-vnf?";
aaiQuery = new AaiQuery();
PowerMock.replayAll();
String actual = Whitebox.invokeMethod(aaiQuery, "getMsbSuffixAddr", url);
diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/dmaap/DmaapServiceTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/dmaap/DmaapServiceTest.java
index 3f61813..c9f892b 100644
--- a/holmes-actions/src/test/java/org/onap/holmes/common/dmaap/DmaapServiceTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/dmaap/DmaapServiceTest.java
@@ -72,7 +72,7 @@ public class DmaapServiceTest {
assertThat(policyMsg.getTarget(), equalTo("vserver.vserver-name"));
assertThat(policyMsg.getTargetType(), equalTo("VM"));
- assertThat(policyMsg.getAai().get("vserver.vserver-name"), equalTo("tetss"));
+ assertThat(policyMsg.getAAI().get("vserver.vserver-name"), equalTo("tetss"));
}
@Test
@@ -189,8 +189,8 @@ public class DmaapServiceTest {
PowerMock.verifyAll();
assertThat(actual.getClosedLoopControlName(), equalTo(null));
- assertThat(actual.getAai().get("vserver.prov-status"), equalTo("prov"));
- assertThat(actual.getAai().get("vserver.vserver-name2") == null, equalTo(true));
- assertThat(actual.getAai().get("generic-vnf.service-instance-id"), equalTo(""));
+ assertThat(actual.getAAI().get("vserver.prov-status"), equalTo("prov"));
+ assertThat(actual.getAAI().get("vserver.vserver-name2") == null, equalTo(true));
+ assertThat(actual.getAAI().get("generic-vnf.service-instance-id"), equalTo(""));
}
} \ No newline at end of file