use of org.motechproject.scheduler.contract.DayOfWeekSchedulableJob in project motech by motech.
the class SchedulableJobValidatorTest method shouldValidateDayOfWeekSchedulableJob.
@Test
public void shouldValidateDayOfWeekSchedulableJob() {
DayOfWeekSchedulableJob job = new DayOfWeekSchedulableJob(motechEvent, DateTime.now(), null, new ArrayList<>(), Time.valueOf("16:15"), false, true);
SchedulableJobValidator.validateDayOfWeekSchedulableJob(job);
}
use of org.motechproject.scheduler.contract.DayOfWeekSchedulableJob in project motech by motech.
the class SchedulableJobValidatorTest method shouldThrowIllegalArgumentExceptionIfStartDateIsNullInDayOfWeekSchedulableJob.
@Test(expected = IllegalArgumentException.class)
public void shouldThrowIllegalArgumentExceptionIfStartDateIsNullInDayOfWeekSchedulableJob() {
DayOfWeekSchedulableJob job = new DayOfWeekSchedulableJob(motechEvent, null, null, new ArrayList<>(), Time.valueOf("16:15"), false, true);
SchedulableJobValidator.validateDayOfWeekSchedulableJob(job);
}
use of org.motechproject.scheduler.contract.DayOfWeekSchedulableJob in project motech by motech.
the class SchedulableJobValidatorTest method shouldThrowIllegalArgumentExceptionIfMotechEventIsNullInDayOfWeekSchedulableJob.
@Test(expected = IllegalArgumentException.class)
public void shouldThrowIllegalArgumentExceptionIfMotechEventIsNullInDayOfWeekSchedulableJob() {
DayOfWeekSchedulableJob job = new DayOfWeekSchedulableJob(null, DateTime.now(), null, new ArrayList<>(), Time.valueOf("16:15"), false, true);
SchedulableJobValidator.validateDayOfWeekSchedulableJob(job);
}
use of org.motechproject.scheduler.contract.DayOfWeekSchedulableJob in project motech by motech.
the class MotechSchedulerActionProxyServiceImpl method scheduleDayOfWeekJob.
@Override
public void scheduleDayOfWeekJob(String subject, Map<Object, Object> parameters, DateTime start, DateTime end, List<Object> days, DateTime time, Boolean ignorePastFiresAtStart) {
MotechEvent motechEvent = new MotechEvent(subject, createMotechEventParameters(parameters));
Time jobTime = new Time(time.getHourOfDay(), time.getMinuteOfHour());
List<DayOfWeek> jobDayOfWeeks = createDayOfWeeks(days);
DayOfWeekSchedulableJob job = new DayOfWeekSchedulableJob(motechEvent, start, end != null ? end : null, jobDayOfWeeks, jobTime, ignorePastFiresAtStart);
scheduler.scheduleDayOfWeekJob(job);
}
use of org.motechproject.scheduler.contract.DayOfWeekSchedulableJob in project motech by motech.
the class SchedulableJobBuilder method buildDayOfWeekSchedulableJob.
private static SchedulableJob buildDayOfWeekSchedulableJob(Trigger trigger, JobDataMap dataMap) {
CronTrigger cronTrigger = (CronTrigger) trigger;
DayOfWeekSchedulableJob job = new DayOfWeekSchedulableJob();
job.setEndDate(getEndDate(trigger));
job.setIgnorePastFiresAtStart(dataMap.getBoolean(IGNORE_PAST_FIRES_AT_START));
CronExpressionUtil cronExpressionUtil = new CronExpressionUtil(cronTrigger.getCronExpression());
job.setTime(cronExpressionUtil.getTime());
job.setDays(cronExpressionUtil.getDaysOfWeek());
return job;
}
Aggregations