use of org.onap.so.adapters.etsisol003adapter.lcm.v1.model.DeleteVnfResponse in project so by onap.
the class MonitorVnfmDeleteJobTask method checkIfOperationWasSuccessful.
/**
* Check the final status of delete throw exception if not completed successfully
*
* @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
*/
public void checkIfOperationWasSuccessful(final BuildingBlockExecution execution) {
LOGGER.debug("Executing checkIfOperationWasSuccessful ...");
final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
final DeleteVnfResponse deleteVnfResponse = execution.getVariable(DELETE_VNF_RESPONSE_PARAM_NAME);
if (operationStatusOption == null || !operationStatusOption.isPresent()) {
final String message = "Unable to delete jobId: " + (deleteVnfResponse != null ? deleteVnfResponse.getJobId() : "null") + "Unable to retrieve OperationStatus";
LOGGER.error(message);
exceptionUtil.buildAndThrowWorkflowException(execution, 1214, message);
} else if (operationStatusOption != null && operationStatusOption.isPresent()) {
final OperationStateEnum operationStatus = operationStatusOption.get();
if (operationStatus != OperationStateEnum.COMPLETED) {
final String message = "Unable to Delete jobId: " + (deleteVnfResponse != null ? deleteVnfResponse.getJobId() : "null") + " OperationStatus: " + operationStatus;
LOGGER.error(message);
exceptionUtil.buildAndThrowWorkflowException(execution, 1215, message);
}
LOGGER.debug("Successfully completed Deletion of job {}", deleteVnfResponse);
}
}
use of org.onap.so.adapters.etsisol003adapter.lcm.v1.model.DeleteVnfResponse in project so by onap.
the class MonitorVnfmDeleteJobTaskTest method getDeleteVnfResponse.
private DeleteVnfResponse getDeleteVnfResponse() {
final DeleteVnfResponse response = new DeleteVnfResponse();
response.setJobId(JOB_ID);
return response;
}
use of org.onap.so.adapters.etsisol003adapter.lcm.v1.model.DeleteVnfResponse in project so by onap.
the class VnfmAdapterServiceProviderImplTest method testInvokeDeleteRequest.
@Test
public void testInvokeDeleteRequest() {
when(mockedHttpServiceProvider.deleteHttpRequest(anyString(), eq(DeleteVnfResponse.class))).thenReturn(deleteVnfResponse);
when(deleteVnfResponse.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
when(deleteVnfResponse.hasBody()).thenReturn(true);
final DeleteVnfResponse response = getDeleteVnfResponse(DUMMY_JOB_ID);
when(deleteVnfResponse.getBody()).thenReturn(response);
final VnfmAdapterServiceProvider objUnderTest = new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
final Optional<DeleteVnfResponse> actual = objUnderTest.invokeDeleteRequest(DUMMY_GENERIC_VND_ID);
assertTrue(actual.isPresent());
}
use of org.onap.so.adapters.etsisol003adapter.lcm.v1.model.DeleteVnfResponse in project so by onap.
the class VnfmAdapterServiceProviderImplTest method testInvokeDeleteRequestNoJobId.
@Test
public void testInvokeDeleteRequestNoJobId() {
when(mockedHttpServiceProvider.deleteHttpRequest(anyString(), eq(DeleteVnfResponse.class))).thenReturn(deleteVnfResponse);
when(deleteVnfResponse.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
when(deleteVnfResponse.hasBody()).thenReturn(true);
final DeleteVnfResponse response = getDeleteVnfResponse("");
when(deleteVnfResponse.getBody()).thenReturn(response);
final VnfmAdapterServiceProvider objUnderTest = new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
final Optional<DeleteVnfResponse> actual = objUnderTest.invokeDeleteRequest(DUMMY_GENERIC_VND_ID);
assertFalse(actual.isPresent());
}
use of org.onap.so.adapters.etsisol003adapter.lcm.v1.model.DeleteVnfResponse in project so by onap.
the class VnfmAdapterServiceProviderImplTest method getDeleteVnfResponse.
private DeleteVnfResponse getDeleteVnfResponse(final String jobId) {
final DeleteVnfResponse response = new DeleteVnfResponse();
response.setJobId(jobId);
return response;
}
Aggregations