use of org.onap.so.serviceinstancebeans.InstanceReferences in project so by onap.
the class OrchestrationRequestsUnitTest method mapRequestStatusNullFormatTest.
@Test
public void mapRequestStatusNullFormatTest() throws ApiException {
doReturn("TaskName").when(camundaRequestHandler).getTaskName(REQUEST_ID);
InstanceReferences instanceReferences = new InstanceReferences();
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
RequestStatus requestStatus = new RequestStatus();
requestStatus.setRequestState(iar.getRequestStatus());
requestStatus.setStatusMessage("FLOW STATUS: FlowStatus TASK INFORMATION: TaskName RETRY STATUS: RetryStatusMessage ROLLBACK STATUS: RollbackStatusMessage RESOURCE STATUS: The vf module already exist");
Request expected = new Request();
expected.setRequestId(REQUEST_ID);
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, null, "v7");
assertThat(expected, sameBeanAs(actual));
}
use of org.onap.so.serviceinstancebeans.InstanceReferences in project so by onap.
the class OrchestrationRequestsUnitTest method mapInfraActiveRequestToRequestWithWorkflowNameAndOperationNameTest.
@Test
public void mapInfraActiveRequestToRequestWithWorkflowNameAndOperationNameTest() throws ApiException {
doReturn("Last task executed: Call SDNC").when(camundaRequestHandler).getTaskName(REQUEST_ID);
InstanceReferences instanceReferences = new InstanceReferences();
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
RequestStatus requestStatus = new RequestStatus();
requestStatus.setRequestState(iar.getRequestStatus());
requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s RESOURCE STATUS: %s", FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE, "The vf module already exist"));
Request expected = new Request();
expected.setRequestId(REQUEST_ID);
expected.setOriginalRequestId(ORIGINAL_REQUEST_ID);
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
expected.setWorkflowName(WORKFLOW_NAME);
expected.setOperationName(OPERATION_NAME);
iar.setOriginalRequestId(ORIGINAL_REQUEST_ID);
iar.setWorkflowName(WORKFLOW_NAME);
iar.setOperationName(OPERATION_NAME);
Request result = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, OrchestrationRequestFormat.DETAIL.toString(), "v8");
assertThat(result, sameBeanAs(expected));
}
use of org.onap.so.serviceinstancebeans.InstanceReferences in project so by onap.
the class OrchestrationRequestsUnitTest method mapRequestStatusAndExtSysErrSrcToRequestStatusDetailV8Test.
@Test
public void mapRequestStatusAndExtSysErrSrcToRequestStatusDetailV8Test() throws ApiException {
doReturn(null).when(camundaRequestHandler).getTaskName(REQUEST_ID);
InstanceReferences instanceReferences = new InstanceReferences();
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
RequestStatus requestStatus = new RequestStatus();
requestStatus.setExtSystemErrorSource(EXT_SYSTEM_ERROR_SOURCE);
requestStatus.setRollbackExtSystemErrorSource(ROLLBACK_EXT_SYSTEM_ERROR_SOURCE);
requestStatus.setRequestState(iar.getRequestStatus());
requestStatus.setFlowStatus(FLOW_STATUS);
requestStatus.setRollbackStatusMessage(ROLLBACK_STATUS_MESSAGE);
requestStatus.setRetryStatusMessage(RETRY_STATUS_MESSAGE);
requestStatus.setResourceStatusMessage("The vf module already exist");
Request expected = new Request();
expected.setRequestId(REQUEST_ID);
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, OrchestrationRequestFormat.STATUSDETAIL.toString(), "v8");
assertThat(actual, sameBeanAs(expected));
}
use of org.onap.so.serviceinstancebeans.InstanceReferences in project so by onap.
the class OrchestrationRequestsUnitTest method mapInfraActiveRequestToRequestWithNoWorkflowNameAndNoOperationNameTest.
@Test
public void mapInfraActiveRequestToRequestWithNoWorkflowNameAndNoOperationNameTest() throws ApiException {
doReturn("Last task executed: Call SDNC").when(camundaRequestHandler).getTaskName(REQUEST_ID);
InstanceReferences instanceReferences = new InstanceReferences();
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
RequestStatus requestStatus = new RequestStatus();
requestStatus.setRequestState(iar.getRequestStatus());
requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s RESOURCE STATUS: %s", FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE, "The vf module already exist"));
Request expected = new Request();
expected.setRequestId(REQUEST_ID);
expected.setOriginalRequestId(ORIGINAL_REQUEST_ID);
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
expected.setWorkflowName(REQUEST_ACTION);
expected.setRequestType(REQUEST_ACTION);
iar.setOriginalRequestId(ORIGINAL_REQUEST_ID);
iar.setRequestAction(REQUEST_ACTION);
iar.setWorkflowName(null);
iar.setOperationName(null);
Request result = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, OrchestrationRequestFormat.DETAIL.toString(), "v8");
assertThat(result, sameBeanAs(expected));
}
use of org.onap.so.serviceinstancebeans.InstanceReferences in project so by onap.
the class OrchestrationRequestsUnitTest method mapInfraActiveRequestToRequestOriginalRequestIdNullTest.
@Test
public void mapInfraActiveRequestToRequestOriginalRequestIdNullTest() throws ApiException {
doReturn("Last task executed: Call SDNC").when(camundaRequestHandler).getTaskName(REQUEST_ID);
InstanceReferences instanceReferences = new InstanceReferences();
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
RequestStatus requestStatus = new RequestStatus();
requestStatus.setRequestState(iar.getRequestStatus());
requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s RESOURCE STATUS: %s", FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE, "The vf module already exist"));
Request expected = new Request();
expected.setRequestId(REQUEST_ID);
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
iar.setWorkflowName(WORKFLOW_NAME);
iar.setOperationName(OPERATION_NAME);
Request result = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, OrchestrationRequestFormat.DETAIL.toString(), "v7");
assertThat(result, sameBeanAs(expected));
}
Aggregations