Search in sources :

Example 6 with ScheduledJob

use of org.molgenis.jobs.model.ScheduledJob in project molgenis by molgenis.

the class JobSchedulerTest method scheduleInactive.

@Test
public void scheduleInactive() throws SchedulerException {
    ScheduledJob scheduledJob = scheduledJobFactory.create();
    scheduledJob.setId(id);
    scheduledJob.set(ScheduledJobMetadata.CRON_EXPRESSION, "	0/20 * * * * ?");
    scheduledJob.set(ScheduledJobMetadata.NAME, "name");
    scheduledJob.set(ScheduledJobMetadata.ACTIVE, false);
    scheduledJob.setType(scheduledJobType);
    when(quartzScheduler.checkExists(jobKey)).thenReturn(false);
    jobScheduler.schedule(scheduledJob);
    verify(quartzScheduler, Mockito.never()).scheduleJob(ArgumentMatchers.any(JobDetail.class), ArgumentMatchers.any(Trigger.class));
}
Also used : ScheduledJob(org.molgenis.jobs.model.ScheduledJob) Test(org.testng.annotations.Test) AbstractMolgenisSpringTest(org.molgenis.data.AbstractMolgenisSpringTest)

Aggregations

ScheduledJob (org.molgenis.jobs.model.ScheduledJob)6 AbstractMolgenisSpringTest (org.molgenis.data.AbstractMolgenisSpringTest)4 Test (org.testng.annotations.Test)4 MolgenisDataException (org.molgenis.data.MolgenisDataException)1 JobExecution (org.molgenis.jobs.model.JobExecution)1 RunAsSystem (org.molgenis.security.core.runas.RunAsSystem)1 TriggerBuilder.newTrigger (org.quartz.TriggerBuilder.newTrigger)1