use of org.folio.rest.jaxrs.model.JobMonitoring in project mod-source-record-manager by folio-org.
the class DataImportInitConsumerVerticleTest method assertProgressAndMonitoringAndJobExecutionStatus.
private void assertProgressAndMonitoringAndJobExecutionStatus(JobExecution.Status statusToCheck, Async async) {
jobExecutionProgressService.getByJobExecutionId(jobExecutionId, TENANT_ID).onSuccess(progress -> {
assertEquals(jobExecutionId, progress.getJobExecutionId());
assertEquals(TOTAL_RECORDS, progress.getTotal());
jobExecutionService.getJobExecutionById(jobExecutionId, TENANT_ID).onSuccess(jobExecutionOptional -> {
JobExecution jobExecution = jobExecutionOptional.get();
assertEquals(statusToCheck, jobExecution.getStatus());
jobMonitoringService.getByJobExecutionId(jobExecution.getId(), TENANT_ID).onSuccess(jobMonitoringOptional -> {
JobMonitoring jobMonitoring = jobMonitoringOptional.get();
assertEquals(jobExecutionId, jobMonitoring.getJobExecutionId());
async.complete();
});
});
});
}
use of org.folio.rest.jaxrs.model.JobMonitoring in project mod-source-record-manager by folio-org.
the class JobExecutionProgressServiceImplTest method shouldInitProgress.
@Test
public void shouldInitProgress(TestContext context) {
Async async = context.async();
int expectedTotalRecords = 62;
Future<JobExecutionProgress> future = jobExecutionService.initializeJobExecutions(initJobExecutionsRqDto, params).compose(initJobExecutionsRsDto -> jobExecutionProgressService.initializeJobExecutionProgress(initJobExecutionsRsDto.getParentJobExecutionId(), expectedTotalRecords, TENANT_ID)).compose(progress -> jobExecutionProgressService.getByJobExecutionId(progress.getJobExecutionId(), TENANT_ID));
future.onComplete(ar -> {
context.assertTrue(ar.succeeded());
JobExecutionProgress progress = ar.result();
context.assertEquals(expectedTotalRecords, progress.getTotal());
jobMonitoringService.getByJobExecutionId(progress.getJobExecutionId(), params.getTenantId()).onSuccess(optionalJobMonitoring -> {
context.assertTrue(optionalJobMonitoring.isPresent());
JobMonitoring jobMonitoring = optionalJobMonitoring.get();
context.assertNotNull(jobMonitoring.getId());
context.assertEquals(progress.getJobExecutionId(), jobMonitoring.getJobExecutionId());
context.assertNotNull(jobMonitoring.getLastEventTimestamp());
context.assertFalse(jobMonitoring.getNotificationSent());
async.complete();
});
});
}
use of org.folio.rest.jaxrs.model.JobMonitoring in project mod-source-record-manager by folio-org.
the class JobMonitoringServiceImplTest method shouldDeleteJobMonitoring.
@Test
public void shouldDeleteJobMonitoring(TestContext context) {
Async async = context.async();
Future<Optional<JobMonitoring>> future = jobExecutionService.initializeJobExecutions(initJobExecutionsRqDto, params).compose(initJobExecutionsRsDto -> jobMonitoringService.saveNew(initJobExecutionsRsDto.getParentJobExecutionId(), TENANT_ID).compose(jobMonitoring -> jobMonitoringService.deleteByJobExecutionId(jobMonitoring.getJobExecutionId(), TENANT_ID)).compose(deleted -> jobMonitoringService.getByJobExecutionId(initJobExecutionsRsDto.getParentJobExecutionId(), TENANT_ID)));
future.onComplete(ar -> {
context.assertTrue(ar.succeeded());
Optional<JobMonitoring> optionalJobMonitoring = ar.result();
context.assertTrue(optionalJobMonitoring.isEmpty());
async.complete();
});
}
use of org.folio.rest.jaxrs.model.JobMonitoring in project mod-source-record-manager by folio-org.
the class JobMonitoringServiceImplTest method shouldSaveJobMonitoring.
@Test
public void shouldSaveJobMonitoring(TestContext context) {
Async async = context.async();
Future<Optional<JobMonitoring>> future = jobExecutionService.initializeJobExecutions(initJobExecutionsRqDto, params).compose(initJobExecutionsRsDto -> jobMonitoringService.saveNew(initJobExecutionsRsDto.getParentJobExecutionId(), TENANT_ID)).compose(jobMonitoring -> jobMonitoringService.getByJobExecutionId(jobMonitoring.getJobExecutionId(), TENANT_ID));
future.onComplete(ar -> {
context.assertTrue(ar.succeeded());
Optional<JobMonitoring> optionalJobMonitoring = ar.result();
context.assertTrue(optionalJobMonitoring.isPresent());
JobMonitoring savedJobMonitoring = optionalJobMonitoring.get();
context.assertNotNull(savedJobMonitoring.getId());
context.assertNotNull(savedJobMonitoring.getJobExecutionId());
context.assertNotNull(savedJobMonitoring.getLastEventTimestamp());
context.assertFalse(savedJobMonitoring.getNotificationSent());
async.complete();
});
}
use of org.folio.rest.jaxrs.model.JobMonitoring in project mod-source-record-manager by folio-org.
the class JobMonitoringServiceImplTest method shouldFindAllInactiveJobMonitors.
@Test
public void shouldFindAllInactiveJobMonitors(TestContext context) {
Async async = context.async();
var future = jobExecutionService.initializeJobExecutions(initJobExecutionsRqDto, params).compose(initJobExecutionsRsDto -> jobMonitoringService.saveNew(initJobExecutionsRsDto.getParentJobExecutionId(), TENANT_ID)).compose(initJobExecutionsRsDto2 -> jobExecutionService.initializeJobExecutions(initJobExecutionsRqDto, params)).compose(initJobExecutionsRsDto2 -> jobMonitoringService.saveNew(initJobExecutionsRsDto2.getParentJobExecutionId(), TENANT_ID));
vertx.setTimer(10L, timerId -> future.compose(list -> jobMonitoringService.getInactiveJobMonitors(1L, TENANT_ID)).onComplete(ar -> {
context.assertTrue(ar.succeeded());
List<JobMonitoring> jobMonitors = ar.result();
context.assertTrue(!jobMonitors.isEmpty());
System.out.println(jobMonitors.size());
context.assertTrue(jobMonitors.size() == 2);
async.complete();
}));
}
Aggregations