use of org.folio.rest.jaxrs.model.JobExecutionDetail in project mod-source-record-manager by folio-org.
the class JobExecutionDaoImplTest method shouldNotDeleteIfCompletedDateNotExceeds.
@Test
public void shouldNotDeleteIfCompletedDateNotExceeds(TestContext context) {
/*
In this test we setup job execution that finishes 1 day ago, after this job execution has been soft deleted.
Periodic job should not hard delete it, because 1 day does not meet condition: older than 2 days.
*/
Async async = context.async();
Instant minusOneDay = LocalDateTime.now().minus(1, ChronoUnit.DAYS).atOffset(ZoneOffset.UTC).toInstant();
Future<JobExecution> preparationFuture = prepareDataForDeletion(minusOneDay);
preparationFuture.onComplete(ar -> {
JobExecution jobExecution = ar.result();
List<String> jobExecutionIds = List.of(jobExecution.getId());
jobExecutionDao.softDeleteJobExecutionsByIds(jobExecutionIds, TENANT_ID).onSuccess(reply -> {
JobExecutionDetail jobExecutionDetail = reply.getJobExecutionDetails().get(0);
assertEquals(jobExecutionDetail.getJobExecutionId(), jobExecution.getId());
assertTrue(jobExecutionDetail.getIsDeleted());
jobExecutionDao.hardDeleteJobExecutions(2, TENANT_ID).onSuccess(resp -> checkDataExistenceAfterHardDeleting(1, jobExecutionIds, async));
});
});
}
use of org.folio.rest.jaxrs.model.JobExecutionDetail 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;
}
use of org.folio.rest.jaxrs.model.JobExecutionDetail in project mod-source-record-manager by folio-org.
the class JobExecutionDaoImplTest method shouldDeleteRecordsMarkedForJobExecutionsDeletion.
@Test
public void shouldDeleteRecordsMarkedForJobExecutionsDeletion(TestContext context) {
/*
In this test we setup job execution that finishes 3 days ago, after this job execution has been soft deleted.
Periodic job should hard delete it, because it checks soft deleted jobs older than 2 days.
*/
Async async = context.async();
Instant minusThreeDays = LocalDateTime.now().minus(3, ChronoUnit.DAYS).atOffset(ZoneOffset.UTC).toInstant();
Future<JobExecution> preparationFuture = prepareDataForDeletion(minusThreeDays);
preparationFuture.onComplete(ar -> {
JobExecution jobExecution = ar.result();
List<String> jobExecutionIds = List.of(jobExecution.getId());
jobExecutionDao.softDeleteJobExecutionsByIds(jobExecutionIds, TENANT_ID).onSuccess(reply -> {
JobExecutionDetail jobExecutionDetail = reply.getJobExecutionDetails().get(0);
assertEquals(jobExecutionDetail.getJobExecutionId(), jobExecution.getId());
assertTrue(jobExecutionDetail.getIsDeleted());
jobExecutionDao.hardDeleteJobExecutions(2, TENANT_ID).onSuccess(resp -> checkDataExistenceAfterHardDeleting(0, jobExecutionIds, async));
});
});
}
Aggregations