Search in sources :

Example 1 with DeleteJobExecutionsResp

use of org.folio.rest.jaxrs.model.DeleteJobExecutionsResp in project mod-source-record-manager by folio-org.

the class JobExecutionDaoImpl method mapRowSetToDeleteChangeManagerJobExeResp.

private DeleteJobExecutionsResp mapRowSetToDeleteChangeManagerJobExeResp(RowSet<Row> rowSet) {
    DeleteJobExecutionsResp deleteJobExecutionsResp = new DeleteJobExecutionsResp();
    List<JobExecutionDetail> jobExecutionDetails = new ArrayList<>();
    rowSet.forEach(row -> {
        JobExecutionDetail executionLogDetail = new JobExecutionDetail();
        executionLogDetail.setJobExecutionId(row.getUUID(ID).toString());
        executionLogDetail.setIsDeleted(row.getBoolean(IS_DELETED));
        jobExecutionDetails.add(executionLogDetail);
    });
    deleteJobExecutionsResp.setJobExecutionDetails(jobExecutionDetails);
    return deleteJobExecutionsResp;
}
Also used : ArrayList(java.util.ArrayList) JobExecutionDetail(org.folio.rest.jaxrs.model.JobExecutionDetail) DeleteJobExecutionsResp(org.folio.rest.jaxrs.model.DeleteJobExecutionsResp)

Example 2 with DeleteJobExecutionsResp

use of org.folio.rest.jaxrs.model.DeleteJobExecutionsResp in project mod-source-record-manager by folio-org.

the class ChangeManagerAPITest method shouldNotReturnAnyChildrenOfAnyParentOnGetChildrenByIdForDeletedLogs.

@Test
public void shouldNotReturnAnyChildrenOfAnyParentOnGetChildrenByIdForDeletedLogs() {
    InitJobExecutionsRsDto response = constructAndPostInitJobExecutionRqDto(25);
    List<JobExecution> createdJobExecutions = response.getJobExecutions();
    assertThat(createdJobExecutions.size(), is(26));
    JobExecution multipleParent = createdJobExecutions.stream().filter(jobExec -> jobExec.getSubordinationType().equals(JobExecution.SubordinationType.PARENT_MULTIPLE)).findFirst().get();
    DeleteJobExecutionsResp deleteJobExecutionsResp = returnDeletedJobExecutionResponse(new String[] { multipleParent.getId() });
    assertThat(deleteJobExecutionsResp.getJobExecutionDetails().get(0).getJobExecutionId(), is(multipleParent.getId()));
    assertThat(deleteJobExecutionsResp.getJobExecutionDetails().get(0).getIsDeleted(), is(true));
    RestAssured.given().spec(spec).when().get(JOB_EXECUTION_PATH + multipleParent.getId() + CHILDREN_PATH).then().statusCode(HttpStatus.SC_NOT_FOUND);
}
Also used : JobExecution(org.folio.rest.jaxrs.model.JobExecution) DeleteJobExecutionsResp(org.folio.rest.jaxrs.model.DeleteJobExecutionsResp) InitJobExecutionsRsDto(org.folio.rest.jaxrs.model.InitJobExecutionsRsDto) AbstractRestTest(org.folio.rest.impl.AbstractRestTest) Test(org.junit.Test)

Example 3 with DeleteJobExecutionsResp

use of org.folio.rest.jaxrs.model.DeleteJobExecutionsResp in project mod-source-record-manager by folio-org.

the class ChangeManagerAPITest method testDeleteChangeManagerJobExecutionsDeletedIds.

@Test
public void testDeleteChangeManagerJobExecutionsDeletedIds() {
    String parentJobExecutionId = constructAndPostInitJobExecutionRqDto(1).getParentJobExecutionId();
    String parentJobExecutionId_2 = constructAndPostInitJobExecutionRqDto(1).getParentJobExecutionId();
    DeleteJobExecutionsResp deleteJobExecutionsResp = returnDeletedJobExecutionResponse(new String[] { parentJobExecutionId });
    assertThat(deleteJobExecutionsResp.getJobExecutionDetails().get(0).getJobExecutionId(), is(parentJobExecutionId));
    assertThat(deleteJobExecutionsResp.getJobExecutionDetails().get(0).getIsDeleted(), is(true));
    RestAssured.given().spec(spec).when().get(JOB_EXECUTION_PATH + parentJobExecutionId).then().statusCode(HttpStatus.SC_NOT_FOUND);
    RestAssured.given().spec(spec).when().get(JOB_EXECUTION_PATH + parentJobExecutionId_2).then().statusCode(HttpStatus.SC_OK);
}
Also used : DeleteJobExecutionsResp(org.folio.rest.jaxrs.model.DeleteJobExecutionsResp) Matchers.containsString(org.hamcrest.Matchers.containsString) AbstractRestTest(org.folio.rest.impl.AbstractRestTest) Test(org.junit.Test)

Example 4 with DeleteJobExecutionsResp

use of org.folio.rest.jaxrs.model.DeleteJobExecutionsResp in project mod-source-record-manager by folio-org.

the class MetadataProviderJobExecutionAPITest method shouldNotReturnDeletedJobExecutionRecords.

@Test
public void shouldNotReturnDeletedJobExecutionRecords(TestContext context) {
    JobExecution createdJobExecution = constructAndPostInitJobExecutionRqDto(1).getJobExecutions().get(0);
    putJobExecution(createdJobExecution);
    DeleteJobExecutionsResp deleteJobExecutionsResp = ChangeManagerAPITest.returnDeletedJobExecutionResponse(new String[] { createdJobExecution.getId() });
    assertThat(deleteJobExecutionsResp.getJobExecutionDetails().get(0).getJobExecutionId(), is(createdJobExecution.getId()));
    assertThat(deleteJobExecutionsResp.getJobExecutionDetails().get(0).getIsDeleted(), is(true));
    RestAssured.given().spec(spec).when().queryParam("hrid", createdJobExecution.getHrId()).get(GET_JOB_EXECUTIONS_PATH).then().statusCode(HttpStatus.SC_OK).body("jobExecutions", empty()).body("totalRecords", is(0));
}
Also used : JobExecution(org.folio.rest.jaxrs.model.JobExecution) DeleteJobExecutionsResp(org.folio.rest.jaxrs.model.DeleteJobExecutionsResp) ChangeManagerAPITest(org.folio.rest.impl.changeManager.ChangeManagerAPITest) AbstractRestTest(org.folio.rest.impl.AbstractRestTest) Test(org.junit.Test)

Example 5 with DeleteJobExecutionsResp

use of org.folio.rest.jaxrs.model.DeleteJobExecutionsResp in project mod-source-record-manager by folio-org.

the class MetadataProviderJobExecutionAPITest method shouldReturnEmptyListWhenLogsAreMarkedForDeletion.

@Test
public void shouldReturnEmptyListWhenLogsAreMarkedForDeletion() {
    InitJobExecutionsRsDto response = constructAndPostInitJobExecutionRqDto(1);
    List<JobExecution> createdJobExecutions = response.getJobExecutions();
    assertThat(createdJobExecutions.size(), is(1));
    JobExecution jobExec = createdJobExecutions.get(0);
    DeleteJobExecutionsResp deleteJobExecutionsResp = ChangeManagerAPITest.returnDeletedJobExecutionResponse(new String[] { jobExec.getId() });
    assertThat(deleteJobExecutionsResp.getJobExecutionDetails().get(0).getJobExecutionId(), is(jobExec.getId()));
    assertThat(deleteJobExecutionsResp.getJobExecutionDetails().get(0).getIsDeleted(), is(true));
    RestAssured.given().spec(spec).when().get(GET_JOB_EXECUTION_JOURNAL_RECORDS_PATH + "/" + jobExec.getId()).then().statusCode(HttpStatus.SC_NOT_FOUND);
}
Also used : JobExecution(org.folio.rest.jaxrs.model.JobExecution) DeleteJobExecutionsResp(org.folio.rest.jaxrs.model.DeleteJobExecutionsResp) InitJobExecutionsRsDto(org.folio.rest.jaxrs.model.InitJobExecutionsRsDto) ChangeManagerAPITest(org.folio.rest.impl.changeManager.ChangeManagerAPITest) AbstractRestTest(org.folio.rest.impl.AbstractRestTest) Test(org.junit.Test)

Aggregations

DeleteJobExecutionsResp (org.folio.rest.jaxrs.model.DeleteJobExecutionsResp)8 AbstractRestTest (org.folio.rest.impl.AbstractRestTest)7 Test (org.junit.Test)7 JobExecution (org.folio.rest.jaxrs.model.JobExecution)6 InitJobExecutionsRsDto (org.folio.rest.jaxrs.model.InitJobExecutionsRsDto)5 ChangeManagerAPITest (org.folio.rest.impl.changeManager.ChangeManagerAPITest)2 Async (io.vertx.ext.unit.Async)1 ArrayList (java.util.ArrayList)1 JobExecutionDetail (org.folio.rest.jaxrs.model.JobExecutionDetail)1 JobProfileInfo (org.folio.rest.jaxrs.model.JobProfileInfo)1 StatusDto (org.folio.rest.jaxrs.model.StatusDto)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1