use of org.onap.so.db.request.beans.InfraActiveRequests 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.db.request.beans.InfraActiveRequests in project so by onap.
the class OrchestrationRequestsUnitTest method setup.
@Before
public void setup() {
iar = new InfraActiveRequests();
iar.setRequestScope(SERVICE);
iar.setRequestId(REQUEST_ID);
iar.setServiceInstanceId(SERVICE_INSTANCE_ID);
iar.setExtSystemErrorSource(EXT_SYSTEM_ERROR_SOURCE);
iar.setRollbackExtSystemErrorSource(ROLLBACK_EXT_SYSTEM_ERROR_SOURCE);
iar.setFlowStatus(FLOW_STATUS);
iar.setRollbackStatusMessage(ROLLBACK_STATUS_MESSAGE);
iar.setRetryStatusMessage(RETRY_STATUS_MESSAGE);
iar.setResourceStatusMessage("The vf module already exist");
iar.setStartTime(startTime);
}
use of org.onap.so.db.request.beans.InfraActiveRequests 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());
}
use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.
the class RequestHandlerUtilsTest method camundaHistoryCheckNoneFoundTest.
@Test
public void camundaHistoryCheckNoneFoundTest() throws ContactCamundaException, RequestDbFailureException {
wireMockServer.stubFor(get(("/sobpmnengine/history/process-instance?processInstanceBusinessKey=f0a35706-efc4-4e27-80ea-a995d7a2a40f&active=true&maxResults=1")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody("[]").withStatus(org.apache.http.HttpStatus.SC_OK)));
InfraActiveRequests duplicateRecord = new InfraActiveRequests();
duplicateRecord.setRequestId("f0a35706-efc4-4e27-80ea-a995d7a2a40f");
boolean inProgress = false;
inProgress = requestHandlerUtils.camundaHistoryCheck(duplicateRecord, null);
assertFalse(inProgress);
}
use of org.onap.so.db.request.beans.InfraActiveRequests in project so by onap.
the class ServiceInstancesTest method convertJsonToServiceInstanceRequestFail.
@Test
public void convertJsonToServiceInstanceRequestFail() throws IOException {
// ExpectedRecord
InfraActiveRequests expectedRecord = new InfraActiveRequests();
expectedRecord.setRequestStatus("FAILED");
expectedRecord.setStatusMessage("Error mapping request: ");
expectedRecord.setProgress(100L);
expectedRecord.setRequestBody(inputStream("/ConvertRequestFail.json"));
expectedRecord.setLastModifiedBy("APIH");
expectedRecord.setRequestScope("network");
expectedRecord.setRequestAction("deleteInstance");
expectedRecord.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d");
uri = servInstanceuri + "v6" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb";
ResponseEntity<String> response = sendRequest(inputStream("/ConvertRequestFail.json"), uri, HttpMethod.DELETE, headers);
// ActualRecord
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
}
Aggregations