diff options
author | waqas.ikram <waqas.ikram@est.tech> | 2019-05-30 13:15:16 +0000 |
---|---|---|
committer | waqas.ikram <waqas.ikram@est.tech> | 2019-05-30 13:15:16 +0000 |
commit | 53791d7d6434eb5ae821cba4572a96796d65c2ee (patch) | |
tree | 52d32e8487d319391c5bfa72ec1baf28864b5350 /bpmn/so-bpmn-tasks/src | |
parent | 5133d030cc914a1953151b2e009076d0d043ff6e (diff) |
Fixing infinte loop of flow
Change-Id: I80dc144750406d5afcec9b4da717a55a3840e503
Issue-ID: SO-1946
Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
4 files changed, 27 insertions, 13 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java index 4645680fc2..4c84bcaa1f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java @@ -55,11 +55,18 @@ public class MonitorVnfmCreateJobTask extends MonitorVnfmJobTask { * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl} */ public void getCurrentOperationStatus(final BuildingBlockExecution execution) { - LOGGER.debug("Executing getCurrentOperationStatus ..."); - final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME); - execution.setVariable(OPERATION_STATUS_PARAM_NAME, - getOperationStatus(execution, vnfInstantiateResponse.getJobId())); - LOGGER.debug("Finished executing getCurrentOperationStatus ..."); + try { + LOGGER.debug("Executing getCurrentOperationStatus ..."); + final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME); + execution.setVariable(OPERATION_STATUS_PARAM_NAME, + getOperationStatus(execution, vnfInstantiateResponse.getJobId())); + LOGGER.debug("Finished executing getCurrentOperationStatus ..."); + } catch (final Exception exception) { + final String message = "Unable to invoke get current Operation status"; + LOGGER.error(message); + exceptionUtil.buildAndThrowWorkflowException(execution, 1209, message); + + } } /** diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java index e91f362d53..34e3efa8f5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java @@ -56,10 +56,18 @@ public class MonitorVnfmDeleteJobTask extends MonitorVnfmJobTask { * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl} */ public void getCurrentOperationStatus(final BuildingBlockExecution execution) { - LOGGER.debug("Executing getCurrentOperationStatus ..."); - final DeleteVnfResponse deleteVnfResponse = execution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME); - execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, deleteVnfResponse.getJobId())); - LOGGER.debug("Finished executing getCurrentOperationStatus ..."); + try { + LOGGER.debug("Executing getCurrentOperationStatus ..."); + final DeleteVnfResponse deleteVnfResponse = execution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME); + execution.setVariable(OPERATION_STATUS_PARAM_NAME, + getOperationStatus(execution, deleteVnfResponse.getJobId())); + LOGGER.debug("Finished executing getCurrentOperationStatus ..."); + } catch (final Exception exception) { + final String message = "Unable to invoke get current Operation status"; + LOGGER.error(message); + exceptionUtil.buildAndThrowWorkflowException(execution, 1216, message); + + } } /** diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java index f193967a32..4a51891184 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java @@ -145,7 +145,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide return Optional.of(response.getBody()); } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) { LOGGER.error("Unexpected error while processing job request", httpInvocationException); - return Optional.absent(); + throw httpInvocationException; } } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java index 7bd6435b60..e94d7c2923 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java @@ -228,7 +228,7 @@ public class VnfmAdapterServiceProviderImplTest { assertFalse(actual.isPresent()); } - @Test + @Test(expected = RestProcessingException.class) public void testGetInstantiateOperationJobStatus_Exception() { when(mockedHttpServiceProvider.getHttpResponse(eq(TestConstants.JOB_STATUS_EXPECTED_URL), @@ -237,8 +237,7 @@ public class VnfmAdapterServiceProviderImplTest { final VnfmAdapterServiceProvider objUnderTest = new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider); - final Optional<QueryJobResponse> actual = objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID); - assertFalse(actual.isPresent()); + objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID); } private QueryJobResponse getQueryJobResponse() { |