Search in sources :

Example 1 with InstanceReferences

use of org.onap.so.serviceinstancebeans.InstanceReferences in project so by onap.

the class OrchestrationRequestsUnitTest method mapRequestStatusAndExtSysErrSrcToRequestErrorMessageTest.

@Test
public void mapRequestStatusAndExtSysErrSrcToRequestErrorMessageTest() throws ApiException {
    InstanceReferences instanceReferences = new InstanceReferences();
    instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
    iar.setExtSystemErrorSource(ROLLBACK_EXT_SYSTEM_ERROR_SOURCE);
    iar.setFlowStatus(null);
    iar.setStatusMessage("Error retrieving cloud region from AAI");
    Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, OrchestrationRequestFormat.DETAIL.toString(), "v7");
    assertTrue(actual.getRequestStatus().getStatusMessage().contains("Error Source: " + ROLLBACK_EXT_SYSTEM_ERROR_SOURCE));
}
Also used : InstanceReferences(org.onap.so.serviceinstancebeans.InstanceReferences) Request(org.onap.so.serviceinstancebeans.Request) Test(org.junit.Test)

Example 2 with InstanceReferences

use of org.onap.so.serviceinstancebeans.InstanceReferences in project so by onap.

the class OrchestrationRequestsUnitTest method mapRequestStatusAndExtSysErrSrcToRequestFlowStatusSuccessfulCompletionTest.

@Test
public void mapRequestStatusAndExtSysErrSrcToRequestFlowStatusSuccessfulCompletionTest() throws ApiException {
    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", "Successfully completed all Building Blocks", 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");
    includeCloudRequest = false;
    iar.setFlowStatus("Successfully completed all Building Blocks");
    Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, OrchestrationRequestFormat.DETAIL.toString(), "v7");
    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 3 with InstanceReferences

use of org.onap.so.serviceinstancebeans.InstanceReferences in project so by onap.

the class OrchestrationRequestsUnitTest method mapRequestStatusAndExtSysErrSrcToRequestDetailTest.

@Test
public void mapRequestStatusAndExtSysErrSrcToRequestDetailTest() 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");
    includeCloudRequest = false;
    Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, OrchestrationRequestFormat.DETAIL.toString(), "v7");
    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 4 with InstanceReferences

use of org.onap.so.serviceinstancebeans.InstanceReferences in project so by onap.

the class OrchestrationRequestsUnitTest method mapRequestStatusAndExtSysErrSrcToRequestNoFlowStatusTest.

@Test
public void mapRequestStatusAndExtSysErrSrcToRequestNoFlowStatusTest() throws ApiException {
    InstanceReferences instanceReferences = new InstanceReferences();
    instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
    RequestStatus requestStatus = new RequestStatus();
    requestStatus.setRequestState(iar.getRequestStatus());
    requestStatus.setStatusMessage(String.format("RETRY STATUS: %s ROLLBACK STATUS: %s", RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE));
    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;
    iar.setFlowStatus(null);
    iar.setResourceStatusMessage(null);
    Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, OrchestrationRequestFormat.DETAIL.toString(), "v7");
    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 5 with InstanceReferences

use of org.onap.so.serviceinstancebeans.InstanceReferences in project so by onap.

the class OrchestrationRequestsUnitTest method mapRequestStatusAndExtSysErrSrcToRequestFalseTest.

@Test
public void mapRequestStatusAndExtSysErrSrcToRequestFalseTest() 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");
    includeCloudRequest = false;
    Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, OrchestrationRequestFormat.DETAIL.toString(), "v7");
    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)

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