Search in sources :

Example 11 with InstanceReferences

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));
}
Also used : InstanceReferences(org.onap.so.serviceinstancebeans.InstanceReferences) Request(org.onap.so.serviceinstancebeans.Request) SimpleDateFormat(java.text.SimpleDateFormat) RequestStatus(org.onap.so.serviceinstancebeans.RequestStatus) Test(org.junit.Test)

Example 12 with InstanceReferences

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));
}
Also used : InstanceReferences(org.onap.so.serviceinstancebeans.InstanceReferences) Request(org.onap.so.serviceinstancebeans.Request) SimpleDateFormat(java.text.SimpleDateFormat) RequestStatus(org.onap.so.serviceinstancebeans.RequestStatus) Test(org.junit.Test)

Example 13 with InstanceReferences

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));
}
Also used : InstanceReferences(org.onap.so.serviceinstancebeans.InstanceReferences) Request(org.onap.so.serviceinstancebeans.Request) SimpleDateFormat(java.text.SimpleDateFormat) RequestStatus(org.onap.so.serviceinstancebeans.RequestStatus) Test(org.junit.Test)

Example 14 with InstanceReferences

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));
}
Also used : InstanceReferences(org.onap.so.serviceinstancebeans.InstanceReferences) Request(org.onap.so.serviceinstancebeans.Request) SimpleDateFormat(java.text.SimpleDateFormat) RequestStatus(org.onap.so.serviceinstancebeans.RequestStatus) Test(org.junit.Test)

Example 15 with InstanceReferences

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));
}
Also used : InstanceReferences(org.onap.so.serviceinstancebeans.InstanceReferences) Request(org.onap.so.serviceinstancebeans.Request) SimpleDateFormat(java.text.SimpleDateFormat) RequestStatus(org.onap.so.serviceinstancebeans.RequestStatus) Test(org.junit.Test)

Aggregations

InstanceReferences (org.onap.so.serviceinstancebeans.InstanceReferences)15 Request (org.onap.so.serviceinstancebeans.Request)15 SimpleDateFormat (java.text.SimpleDateFormat)14 Test (org.junit.Test)14 RequestStatus (org.onap.so.serviceinstancebeans.RequestStatus)14 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IOException (java.io.IOException)1 ResponseBuilder (org.onap.so.apihandler.common.ResponseBuilder)1 ApiException (org.onap.so.apihandlerinfra.exceptions.ApiException)1 ValidateException (org.onap.so.apihandlerinfra.exceptions.ValidateException)1 ErrorLoggerInfo (org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo)1 ValidationException (org.onap.so.exceptions.ValidationException)1 CloudRequestData (org.onap.so.serviceinstancebeans.CloudRequestData)1 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)1 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)1