use of org.onap.so.serviceinstancebeans.RequestStatus in project so by onap.
the class OrchestrationRequestsUnitTest method taskNameLookup.
@Test
public void taskNameLookup() throws ContactCamundaException {
InfraActiveRequests req = new InfraActiveRequests();
req.setRequestId("70debc2a-d6bc-4795-87ba-38a94d9b0b99");
Instant startInstant = Instant.now().minus(1, ChronoUnit.DAYS);
req.setStartTime(Timestamp.from(startInstant));
when(env.getProperty("mso.camundaCleanupInterval")).thenReturn(null);
when(camundaRequestHandler.getTaskName("70debc2a-d6bc-4795-87ba-38a94d9b0b99")).thenReturn("taskName");
RequestStatus requestStatus = new RequestStatus();
req.setFlowStatus("Building blocks 1 of 3 completed.");
orchestrationRequests.mapRequestStatusAndExtSysErrSrcToRequest(req, requestStatus, null, "v7");
assertEquals("FLOW STATUS: Building blocks 1 of 3 completed. TASK INFORMATION: taskName", requestStatus.getStatusMessage());
}
use of org.onap.so.serviceinstancebeans.RequestStatus 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));
}
use of org.onap.so.serviceinstancebeans.RequestStatus 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));
}
use of org.onap.so.serviceinstancebeans.RequestStatus in project so by onap.
the class OrchestrationRequestsUnitTest method requestStatusExtSystemErrorSourceTest.
@Test
public void requestStatusExtSystemErrorSourceTest() {
RequestStatus requestStatus = new RequestStatus();
requestStatus.setExtSystemErrorSource(EXT_SYSTEM_ERROR_SOURCE);
assertThat(requestStatus.getExtSystemErrorSource(), is(equalTo(EXT_SYSTEM_ERROR_SOURCE)));
}
use of org.onap.so.serviceinstancebeans.RequestStatus in project so by onap.
the class OrchestrationRequestsUnitTest method noCamundaLookupAfterInterval.
@Test
public void noCamundaLookupAfterInterval() throws ContactCamundaException {
InfraActiveRequests req = new InfraActiveRequests();
req.setRequestId("70debc2a-d6bc-4795-87ba-38a94d9b0b99");
Instant startInstant = Instant.now().minus(36, ChronoUnit.DAYS);
req.setStartTime(Timestamp.from(startInstant));
when(env.getProperty("mso.camundaCleanupInterval")).thenReturn("35");
RequestStatus requestStatus = new RequestStatus();
req.setFlowStatus("Building blocks 1 of 3 completed.");
orchestrationRequests.mapRequestStatusAndExtSysErrSrcToRequest(req, requestStatus, null, "v7");
assertEquals("FLOW STATUS: Building blocks 1 of 3 completed.", requestStatus.getStatusMessage());
}
Aggregations