Search in sources :

Example 6 with RepeatingPeriodSchedulableJob

use of org.motechproject.scheduler.contract.RepeatingPeriodSchedulableJob in project motech by motech.

the class SchedulableJobValidatorTest method shouldThrowIllegalArgumentExceptionIfRepeatPeriodIsNull.

@Test(expected = IllegalArgumentException.class)
public void shouldThrowIllegalArgumentExceptionIfRepeatPeriodIsNull() {
    RepeatingPeriodSchedulableJob job = new RepeatingPeriodSchedulableJob(motechEvent, DateTime.now(), null, null, false, true, true);
    SchedulableJobValidator.validateRepeatingPeriodSchedulableJob(job);
}
Also used : RepeatingPeriodSchedulableJob(org.motechproject.scheduler.contract.RepeatingPeriodSchedulableJob) Test(org.junit.Test)

Example 7 with RepeatingPeriodSchedulableJob

use of org.motechproject.scheduler.contract.RepeatingPeriodSchedulableJob in project motech by motech.

the class SchedulableJobValidatorTest method shouldThrowIllegalArgumentExceptionIfMotechEventIsNullInRepeatingPeriodJob.

@Test(expected = IllegalArgumentException.class)
public void shouldThrowIllegalArgumentExceptionIfMotechEventIsNullInRepeatingPeriodJob() {
    RepeatingPeriodSchedulableJob job = new RepeatingPeriodSchedulableJob(null, DateTime.now(), null, null, false, true, true);
    SchedulableJobValidator.validateRepeatingPeriodSchedulableJob(job);
}
Also used : RepeatingPeriodSchedulableJob(org.motechproject.scheduler.contract.RepeatingPeriodSchedulableJob) Test(org.junit.Test)

Example 8 with RepeatingPeriodSchedulableJob

use of org.motechproject.scheduler.contract.RepeatingPeriodSchedulableJob in project motech by motech.

the class SchedulableJobBuilder method buildRepeatingPeriodSchedulableJob.

private static SchedulableJob buildRepeatingPeriodSchedulableJob(Trigger trigger, JobDataMap dataMap) {
    PeriodIntervalTrigger periodTrigger = (PeriodIntervalTrigger) trigger;
    RepeatingPeriodSchedulableJob job = new RepeatingPeriodSchedulableJob();
    job.setEndDate(getEndDate(periodTrigger));
    job.setRepeatPeriod(periodTrigger.getRepeatPeriod());
    job.setIgnorePastFiresAtStart(dataMap.getBoolean(IGNORE_PAST_FIRES_AT_START));
    job.setUseOriginalFireTimeAfterMisfire(dataMap.getBoolean(USE_ORIGINAL_FIRE_TIME_AFTER_MISFIRE));
    return job;
}
Also used : RepeatingPeriodSchedulableJob(org.motechproject.scheduler.contract.RepeatingPeriodSchedulableJob) PeriodIntervalTrigger(org.motechproject.scheduler.trigger.PeriodIntervalTrigger)

Example 9 with RepeatingPeriodSchedulableJob

use of org.motechproject.scheduler.contract.RepeatingPeriodSchedulableJob in project motech by motech.

the class MotechSchedulerActionProxyServiceImpl method scheduleRepeatingPeriodJob.

@Override
public void scheduleRepeatingPeriodJob(String subject, Map<Object, Object> parameters, DateTime startTime, DateTime endTime, Period repeatPeriod, Boolean ignorePastFiresAtStart, Boolean useOriginalFireTimeAfterMisfire) {
    MotechEvent motechEvent = new MotechEvent(subject, createMotechEventParameters(parameters));
    RepeatingPeriodSchedulableJob job = new RepeatingPeriodSchedulableJob(motechEvent, startTime, endTime, repeatPeriod, ignorePastFiresAtStart);
    job.setUseOriginalFireTimeAfterMisfire(useOriginalFireTimeAfterMisfire);
    scheduler.scheduleRepeatingPeriodJob(job);
}
Also used : RepeatingPeriodSchedulableJob(org.motechproject.scheduler.contract.RepeatingPeriodSchedulableJob) MotechEvent(org.motechproject.event.MotechEvent)

Aggregations

RepeatingPeriodSchedulableJob (org.motechproject.scheduler.contract.RepeatingPeriodSchedulableJob)9 Test (org.junit.Test)7 MotechEvent (org.motechproject.event.MotechEvent)4 HashMap (java.util.HashMap)3 Period (org.joda.time.Period)3 ArrayList (java.util.ArrayList)2 JobBasicInfo (org.motechproject.scheduler.contract.JobBasicInfo)2 RepeatingSchedulableJob (org.motechproject.scheduler.contract.RepeatingSchedulableJob)2 DateTime (org.joda.time.DateTime)1 DateUtil.newDateTime (org.motechproject.commons.date.util.DateUtil.newDateTime)1 CronSchedulableJob (org.motechproject.scheduler.contract.CronSchedulableJob)1 JobsSearchSettings (org.motechproject.scheduler.contract.JobsSearchSettings)1 RunOnceSchedulableJob (org.motechproject.scheduler.contract.RunOnceSchedulableJob)1 PeriodIntervalTrigger (org.motechproject.scheduler.trigger.PeriodIntervalTrigger)1 JobKey (org.quartz.JobKey)1