X-Git-Url: https://gerrit.onap.org/r/gitweb?p=holmes%2Fcommon.git;a=blobdiff_plain;f=holmes-actions%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fholmes%2Fcommon%2Faai%2FAaiQuery4CcvpnTest.java;h=51c3444d7f7f535b009402cd11fb06839438250b;hp=43cb5173a4fab05c72994b0d8ceaf76f193934f7;hb=c7fd788a1cfc030e54047701b1c1f27e42a91d1c;hpb=67ef2af341cbe8530437f67bbffdc7721f4e5587 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 43cb517..51c3444 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 @@ -121,11 +121,12 @@ public class AaiQuery4CcvpnTest { } @Test - public void test_getLogicLink_exception() { + public void test_getLogicLink_exception() throws CorrelationException { mockGetMethod(); EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.NOT_FOUND).times(2); + EasyMock.expect(response.readEntity(String.class)).andReturn("Error!"); - thrown.expect(RuntimeException.class); + thrown.expect(CorrelationException.class); PowerMock.replayAll(); @@ -138,9 +139,9 @@ public class AaiQuery4CcvpnTest { } @Test - public void test_getLogicLink() { + public void test_getLogicLink() throws CorrelationException { mockGetMethod(); - EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("logic-link")); + EasyMock.expect(response.readEntity(String.class)).andReturn(data.getJSONObject("logic-link").toJSONString()); EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK); PowerMock.replayAll(); @@ -156,19 +157,21 @@ public class AaiQuery4CcvpnTest { @Test public void test_getServiceInstances_exception() { mockGetMethod(); - EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("vpn-binding")); + EasyMock.expect(response.readEntity(String.class)).andReturn(data.getJSONObject("vpn-binding").toJSONString()); EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK); mockGetMethod(); - EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("connectivity")); + EasyMock.expect(response.readEntity(String.class)).andReturn(data.getJSONObject("connectivity").toJSONString()); EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK); mockGetMethod(); - EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("service-instance-by-connectivity")); + EasyMock.expect(response.readEntity(String.class)) + .andReturn(data.getJSONObject("service-instance-by-connectivity").toJSONString()); EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK); mockGetMethod(); - EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("service-instances-by-service-type")); + EasyMock.expect(response.readEntity(String.class)) + .andReturn(data.getJSONObject("service-instances-by-service-type").toJSONString()); EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.NOT_FOUND).times(2); mockGetMethod(); @@ -190,19 +193,21 @@ public class AaiQuery4CcvpnTest { @Test public void test_getServiceInstances() { mockGetMethod(); - EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("vpn-binding")); + EasyMock.expect(response.readEntity(String.class)).andReturn(data.getJSONObject("vpn-binding").toJSONString()); EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK); mockGetMethod(); - EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("connectivity")); + EasyMock.expect(response.readEntity(String.class)).andReturn(data.getJSONObject("connectivity").toJSONString()); EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK); mockGetMethod(); - EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("service-instance-by-connectivity")); + EasyMock.expect(response.readEntity(String.class)) + .andReturn(data.getJSONObject("service-instance-by-connectivity").toJSONString()); EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK); mockGetMethod(); - EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("service-instances-by-service-type")); + EasyMock.expect(response.readEntity(String.class)) + .andReturn(data.getJSONObject("service-instances-by-service-type").toJSONString()); EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK); mockGetMethod(); @@ -232,7 +237,8 @@ public class AaiQuery4CcvpnTest { @Test public void test_getServiceInstances_1() throws Exception { mockGetMethod(); - EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("service-instances-by-service-type")); + EasyMock.expect(response.readEntity(String.class)) + .andReturn(data.getJSONObject("service-instances-by-service-type").toJSONString()); EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK); PowerMock.replayAll(); @@ -250,7 +256,7 @@ public class AaiQuery4CcvpnTest { @Test public void test_getServiceInstances_1_exception() throws Exception { mockGetMethod(); - EasyMock.expect(response.getEntity()).andReturn(data.getJSONObject("service-instances-by-service-type")); + EasyMock.expect(response.readEntity(String.class)).andReturn("Failed to get the service instance by type."); EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.NOT_FOUND).times(2); thrown.expect(CorrelationException.class); @@ -283,6 +289,7 @@ public class AaiQuery4CcvpnTest { public void test_updateTerminalPointStatus_exception() throws CorrelationException { mockPatchMethod(); EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.NOT_FOUND).times(2); + EasyMock.expect(response.readEntity(String.class)).andReturn("Failed to update the TP information."); thrown.expect(CorrelationException.class); @@ -309,6 +316,7 @@ public class AaiQuery4CcvpnTest { public void test_updateLogicLinkStatus_exception() throws CorrelationException { mockPatchMethod(); EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.NOT_FOUND).times(2); + EasyMock.expect(response.readEntity(String.class)).andReturn("Failed to update the logic link information."); thrown.expect(CorrelationException.class);