use of org.kie.kogito.jobs.service.model.ScheduledJob in project kogito-apps by kiegroup.
the class ScheduledJobAdapterTest method testToJobDetailsWithEmptyPayload.
@Test
void testToJobDetailsWithEmptyPayload() {
ScheduledJob scheduledJob = ScheduledJob.builder().job(JobBuilder.builder().id(UUID.randomUUID().toString()).build()).build();
JobDetails jobDetails = ScheduledJobAdapter.to(scheduledJob);
assertThat(jobDetails.getPayload()).isNull();
}
use of org.kie.kogito.jobs.service.model.ScheduledJob in project kogito-apps by kiegroup.
the class ScheduledJobAdapterTest method testToScheduledJobWithEmptyPayload.
@Test
void testToScheduledJobWithEmptyPayload() {
JobDetails jobDetails = JobDetails.builder().id(UUID.randomUUID().toString()).build();
ScheduledJob scheduledJob = ScheduledJobAdapter.of(jobDetails);
assertThat(scheduledJob.getProcessId()).isNull();
assertThat(scheduledJob.getProcessInstanceId()).isNull();
assertThat(scheduledJob.getRootProcessId()).isNull();
assertThat(scheduledJob.getRootProcessInstanceId()).isNull();
}
use of org.kie.kogito.jobs.service.model.ScheduledJob in project kogito-apps by kiegroup.
the class ScheduledJobAdapterTest method testOfJobDetailsInterval.
@Test
void testOfJobDetailsInterval() {
JobDetails jobDetails = getJobDetailsCommonBuilder().trigger(new IntervalTrigger(0, DateUtil.toDate(TIME), null, REPEAT_LIMIT, 0, INTERVAL, null, null)).build();
ScheduledJob scheduledJob = ScheduledJobAdapter.of(jobDetails);
assertScheduledJob(scheduledJob);
assertThat(scheduledJob.getRepeatLimit()).isEqualTo(REPEAT_LIMIT);
assertThat(scheduledJob.getRepeatInterval()).isEqualTo(INTERVAL);
}
use of org.kie.kogito.jobs.service.model.ScheduledJob in project kogito-apps by kiegroup.
the class ScheduledJobAdapterTest method testToJobDetailsInterval.
@Test
void testToJobDetailsInterval() {
JobBuilder jobBuilder = JobBuilder.builder().repeatLimit(REPEAT_LIMIT).repeatInterval(INTERVAL);
ScheduledJob scheduledJob = getScheduledJobCommonBuilder(jobBuilder).build();
JobDetails jobDetails = ScheduledJobAdapter.to(scheduledJob);
assertJobDetails(jobDetails);
assertThat(jobDetails.getTrigger()).isInstanceOf(IntervalTrigger.class);
IntervalTrigger intervalTrigger = (IntervalTrigger) jobDetails.getTrigger();
assertThat(intervalTrigger.getNextFireTime()).isEqualTo(DateUtil.toDate(TIME));
assertThat(intervalTrigger.getRepeatLimit()).isEqualTo(REPEAT_LIMIT);
assertThat(intervalTrigger.getPeriod()).isEqualTo(INTERVAL);
}
use of org.kie.kogito.jobs.service.model.ScheduledJob in project kogito-apps by kiegroup.
the class BaseJobResourceIT method executeTest.
@Test
void executeTest() throws Exception {
final String id = "4";
final Job job = getJob(id);
create(jobToJson(job));
final ScheduledJob scheduledJob = assertGetScheduledJob(id);
assertEquals(scheduledJob.getId(), job.getId());
assertEquals(0, scheduledJob.getRetries());
assertEquals(JobStatus.SCHEDULED, scheduledJob.getStatus());
assertNotNull(scheduledJob.getScheduledId());
}
Aggregations