use of org.folio.rest.jaxrs.model.JobExecutionDto in project mod-source-record-manager by folio-org.
the class JobExecutionDaoImplTest method shouldSubstituteJobExecutionProgressToJobExecutions.
@Test
public void shouldSubstituteJobExecutionProgressToJobExecutions(TestContext context) {
Async async = context.async();
Future<List<JobExecutionDto>> future = jobExecutionService.initializeJobExecutions(initJobExecutionsRqDto, params).map(InitJobExecutionsRsDto::getJobExecutions).compose(this::createProgressForJobExecutions).compose(ar -> jobExecutionDao.getJobExecutionsWithoutParentMultiple(new JobExecutionFilter(), null, 0, 10, params.getTenantId())).map(JobExecutionDtoCollection::getJobExecutions);
future.onComplete(ar -> {
context.assertTrue(ar.succeeded());
Async async2 = context.async(ar.result().size());
for (JobExecutionDto jobExecution : ar.result()) {
jobExecutionProgressDao.getByJobExecutionId(jobExecution.getId(), params.getTenantId()).onComplete(progressAr -> {
context.assertTrue(progressAr.succeeded());
context.assertTrue(progressAr.result().isPresent());
JobExecutionProgress progress = progressAr.result().get();
context.assertEquals(progress.getTotal(), jobExecution.getProgress().getTotal());
context.assertEquals(progress.getCurrentlySucceeded() + progress.getCurrentlyFailed(), jobExecution.getProgress().getCurrent());
async2.countDown();
});
}
async.complete();
});
}
Aggregations