diff options
Diffstat (limited to 'nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm')
3 files changed, 26 insertions, 3 deletions
diff --git a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/HttpTestServer.java b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/HttpTestServer.java index 9b032824..4109b132 100644 --- a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/HttpTestServer.java +++ b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/HttpTestServer.java @@ -47,6 +47,8 @@ public class HttpTestServer { startServer(); } + //the server starts up asynchronously there is no other way to wait for the server to be up and running + @SuppressWarnings("squid:S2925") private void startServer() throws Exception { requests.clear(); codes.clear(); diff --git a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestLifecycleManager.java b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestLifecycleManager.java index 1a622151..9095eea3 100644 --- a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestLifecycleManager.java +++ b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestLifecycleManager.java @@ -286,7 +286,7 @@ public class TestLifecycleManager extends TestBase { @Test public void testInstantiationV2WithSsl() throws Exception { VnfInstantiateRequest instantiationRequest = prepareInstantiationRequest(VimInfo.VimInfoTypeEnum.OPENSTACK_V2_INFO); - + when(logger.isInfoEnabled()).thenReturn(false); when(vnfApi.vnfsPost(createRequest.capture(), eq(NOKIA_LCM_API_VERSION))).thenReturn(buildObservable(vnfInfo)); additionalParam.setInstantiationLevel(INSTANTIATION_LEVEL); when(vfcGrantManager.requestGrantForInstantiate(VNFM_ID, VNF_ID, VIM_ID, ONAP_CSAR_ID, INSTANTIATION_LEVEL, cbamVnfdContent, JOB_ID)).thenReturn(grantResponse); @@ -312,6 +312,7 @@ public class TestLifecycleManager extends TestBase { assertTrue(!actualVim.getInterfaceInfo().isSkipCertificateVerification()); assertTrue(!actualVim.getInterfaceInfo().isSkipCertificateHostnameCheck()); verify(logger).warn("No additional parameters were specified for the operation"); + verify(logger, never()).info(eq("Starting {} operation on VNF with {} identifier with {} parameter"), anyString(), anyString(), anyString()); } /** diff --git a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/TestLifecycleChangeNotificationManager.java b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/TestLifecycleChangeNotificationManager.java index bf85dedd..dc1b8ddf 100644 --- a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/TestLifecycleChangeNotificationManager.java +++ b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/notification/TestLifecycleChangeNotificationManager.java @@ -294,10 +294,10 @@ public class TestLifecycleChangeNotificationManager extends TestBase { } /** - * if unable to send LCN to VF-C the error is propagated + * if unable to query all operation executions from CBAM the error is propagated */ @Test - public void testUnableToQueryCurrentOperation() throws Exception { + public void testUnableToQueryCurrentOperations() throws Exception { recievedLcn.setOperation(OperationType.TERMINATE); recievedLcn.setStatus(OperationStatus.FINISHED); RuntimeException expectedException = new RuntimeException(); @@ -314,6 +314,26 @@ public class TestLifecycleChangeNotificationManager extends TestBase { } /** + * if unable to query the given operation execution from CBAM the error is propagated + */ + @Test + public void testUnableToQueryCurrentOperation() throws Exception { + recievedLcn.setOperation(OperationType.TERMINATE); + recievedLcn.setStatus(OperationStatus.FINISHED); + RuntimeException expectedException = new RuntimeException(); + when(operationExecutionApi.operationExecutionsOperationExecutionIdGet(recievedLcn.getLifecycleOperationOccurrenceId(), NOKIA_LCM_API_VERSION)).thenThrow(expectedException); + //when + try { + lifecycleChangeNotificationManager.handleLcn(recievedLcn); + fail(); + } catch (Exception e) { + //verify + assertEquals(expectedException, e.getCause()); + verify(logger).error("Unable to retrieve the operation execution with instantiationOperationExecutionId identifier", e.getCause()); + } + } + + /** * test that waitForTerminationToBeProcessed outwaits the successfull processing of the termination notification */ @Test |