use of com.enonic.xp.scheduler.CreateScheduledJobParams in project xp by enonic.
the class SchedulerConfigImplTest method defaultJob.
@Test
void defaultJob() {
final Map<String, String> properties = new HashMap<>();
schedulerConfig = new SchedulerConfigImpl(properties, propertyTreeMarshallerService, calendarService);
final Set<CreateScheduledJobParams> jobs = schedulerConfig.jobs();
assertEquals(1, jobs.size());
final CreateScheduledJobParams job = jobs.stream().findAny().orElseThrow(RuntimeException::new);
assertFalse(job.isEnabled());
assertEquals(DescriptorKey.from("com.enonic.xp.app.system:audit-log-cleanup"), job.getDescriptor());
assertEquals(ScheduleCalendarType.CRON, job.getCalendar().getType());
assertEquals("0 5 * * *", ((CronCalendar) job.getCalendar()).getCronValue());
assertEquals(1, job.getConfig().getTotalSize());
assertEquals("PT2s", job.getConfig().getProperty("ageThreshold").getString());
assertEquals("user:system:custom", job.getUser().toString());
}
use of com.enonic.xp.scheduler.CreateScheduledJobParams in project xp by enonic.
the class CreateScheduledJobHandler method doExecute.
@Override
protected ScheduledJobMapper doExecute() {
final CreateScheduledJobParams params = createParams();
final ScheduledJob scheduledJob = this.schedulerService.get().create(params);
return ScheduledJobMapper.from(scheduledJob);
}
Aggregations