use of org.folio.rest.jaxrs.model.StatusDto in project mod-source-record-manager by folio-org.
the class ChangeManagerAPITest method shouldNotUpdateStatusOfParentMultiple.
@Test
public void shouldNotUpdateStatusOfParentMultiple() {
InitJobExecutionsRsDto response = constructAndPostInitJobExecutionRqDto(3);
List<JobExecution> createdJobExecutions = response.getJobExecutions();
assertThat(createdJobExecutions.size(), is(4));
JobExecution parent = createdJobExecutions.stream().filter(jobExec -> jobExec.getSubordinationType().equals(JobExecution.SubordinationType.PARENT_MULTIPLE)).findFirst().get();
StatusDto status = new StatusDto().withStatus(StatusDto.Status.PARSING_IN_PROGRESS);
RestAssured.given().spec(spec).body(JsonObject.mapFrom(status).toString()).when().put(JOB_EXECUTION_PATH + parent.getId() + STATUS_PATH).then().statusCode(HttpStatus.SC_BAD_REQUEST);
RestAssured.given().spec(spec).when().get(JOB_EXECUTION_PATH + parent.getId()).then().statusCode(HttpStatus.SC_OK).body("status", is(JobExecution.Status.PARENT.name())).body("uiStatus", is(JobExecution.UiStatus.PARENT.name()));
}
use of org.folio.rest.jaxrs.model.StatusDto in project mod-source-record-manager by folio-org.
the class ChangeManagerAPITest method shouldUpdateStatusOfSingleParent.
@Test
public void shouldUpdateStatusOfSingleParent() {
InitJobExecutionsRsDto response = constructAndPostInitJobExecutionRqDto(1);
List<JobExecution> createdJobExecutions = response.getJobExecutions();
assertThat(createdJobExecutions.size(), is(1));
JobExecution jobExec = createdJobExecutions.get(0);
StatusDto status = new StatusDto().withStatus(StatusDto.Status.PARSING_IN_PROGRESS);
RestAssured.given().spec(spec).body(JsonObject.mapFrom(status).toString()).when().put(JOB_EXECUTION_PATH + jobExec.getId() + STATUS_PATH).then().statusCode(HttpStatus.SC_OK).body("status", is(status.getStatus().name())).body("uiStatus", is(Status.valueOf(status.getStatus().name()).getUiStatus()));
RestAssured.given().spec(spec).when().get(JOB_EXECUTION_PATH + jobExec.getId()).then().statusCode(HttpStatus.SC_OK).body("status", is(status.getStatus().name())).body("uiStatus", is(Status.valueOf(status.getStatus().name()).getUiStatus()));
}
use of org.folio.rest.jaxrs.model.StatusDto in project mod-source-record-manager by folio-org.
the class DataImportInitKafkaHandler method checkAndUpdateToInProgressState.
private Future<JobExecution> checkAndUpdateToInProgressState(String jobExecutionId, OkapiConnectionParams params) {
return jobExecutionService.getJobExecutionById(jobExecutionId, params.getTenantId()).compose(jobExecutionOptional -> {
if (jobExecutionOptional.isPresent()) {
JobExecution jobExecution = jobExecutionOptional.get();
if (jobExecution.getStatus() == JobExecution.Status.FILE_UPLOADED) {
LOGGER.info("Moving from file uploaded to in progress state for jobExecutionId: {}", jobExecutionId);
StatusDto statusDto = new StatusDto().withStatus(StatusDto.Status.PARSING_IN_PROGRESS);
return jobExecutionService.updateJobExecutionStatus(jobExecutionId, statusDto, params);
}
}
return Future.succeededFuture();
});
}
Aggregations