Search in sources :

Example 11 with RepeatingSchedulableJob

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

the class SchedulableJobValidatorTest method shouldValidateRepeatingSchedulableJob.

@Test
public void shouldValidateRepeatingSchedulableJob() {
    RepeatingSchedulableJob job = new RepeatingSchedulableJob(motechEvent, 10, 100, DateTime.now().plusHours(1), null, true, true, false);
    SchedulableJobValidator.validateRepeatingSchedulableJob(job);
}
Also used : RepeatingSchedulableJob(org.motechproject.scheduler.contract.RepeatingSchedulableJob) Test(org.junit.Test)

Example 12 with RepeatingSchedulableJob

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

the class SchedulableJobValidatorTest method shouldThrowMotechSchedulerExceptionIfRepeatIntervalIsZero.

@Test(expected = MotechSchedulerException.class)
public void shouldThrowMotechSchedulerExceptionIfRepeatIntervalIsZero() {
    RepeatingSchedulableJob job = new RepeatingSchedulableJob(motechEvent, 10, 0, DateTime.now().plusHours(1), null, true, true, false);
    SchedulableJobValidator.validateRepeatingSchedulableJob(job);
}
Also used : RepeatingSchedulableJob(org.motechproject.scheduler.contract.RepeatingSchedulableJob) Test(org.junit.Test)

Example 13 with RepeatingSchedulableJob

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

the class SchedulableJobValidatorTest method shouldThrowIllegalArgumentExceptionIfStartDateIsNullInRepeatingSchedulableJob.

@Test(expected = IllegalArgumentException.class)
public void shouldThrowIllegalArgumentExceptionIfStartDateIsNullInRepeatingSchedulableJob() {
    RepeatingSchedulableJob job = new RepeatingSchedulableJob(motechEvent, 10, 100, null, null, true, true, false);
    SchedulableJobValidator.validateRepeatingSchedulableJob(job);
}
Also used : RepeatingSchedulableJob(org.motechproject.scheduler.contract.RepeatingSchedulableJob) Test(org.junit.Test)

Example 14 with RepeatingSchedulableJob

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

the class SchedulableJobValidatorTest method shouldThrowIllegalArgumentExceptionIfRepeatIntervalIsNull.

@Test(expected = IllegalArgumentException.class)
public void shouldThrowIllegalArgumentExceptionIfRepeatIntervalIsNull() {
    RepeatingSchedulableJob job = new RepeatingSchedulableJob(motechEvent, 10, null, DateTime.now().plusHours(1), null, true, true, false);
    SchedulableJobValidator.validateRepeatingSchedulableJob(job);
}
Also used : RepeatingSchedulableJob(org.motechproject.scheduler.contract.RepeatingSchedulableJob) Test(org.junit.Test)

Example 15 with RepeatingSchedulableJob

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

the class TestEventListener method shouldThrowExceptionForNullMotechEvent.

@Test(expected = IllegalArgumentException.class)
public void shouldThrowExceptionForNullMotechEvent() throws SchedulerException {
    Map<String, Object> params = new HashMap<>();
    params.put(MotechSchedulerService.JOB_ID_KEY, "job_id");
    schedulerService.scheduleRepeatingJob(new RepeatingSchedulableJob(null, DateTimeConstants.SECONDS_PER_DAY, newDateTime(2020, 7, 15, 12, 0, 0), newDateTime(2020, 7, 18, 12, 0, 0), false));
}
Also used : RepeatingSchedulableJob(org.motechproject.scheduler.contract.RepeatingSchedulableJob) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

RepeatingSchedulableJob (org.motechproject.scheduler.contract.RepeatingSchedulableJob)20 Test (org.junit.Test)14 HashMap (java.util.HashMap)12 MotechEvent (org.motechproject.event.MotechEvent)12 DateTime (org.joda.time.DateTime)7 DateUtil.newDateTime (org.motechproject.commons.date.util.DateUtil.newDateTime)6 CronSchedulableJob (org.motechproject.scheduler.contract.CronSchedulableJob)4 RunOnceSchedulableJob (org.motechproject.scheduler.contract.RunOnceSchedulableJob)4 JobBasicInfo (org.motechproject.scheduler.contract.JobBasicInfo)3 ArrayList (java.util.ArrayList)2 Period (org.joda.time.Period)2 JobsSearchSettings (org.motechproject.scheduler.contract.JobsSearchSettings)2 RepeatingPeriodSchedulableJob (org.motechproject.scheduler.contract.RepeatingPeriodSchedulableJob)2 SimpleTrigger (org.quartz.SimpleTrigger)2 Date (java.util.Date)1 Before (org.junit.Before)1 NanoStopWatch (org.motechproject.commons.api.NanoStopWatch)1 Time (org.motechproject.commons.date.model.Time)1 DayOfWeekSchedulableJob (org.motechproject.scheduler.contract.DayOfWeekSchedulableJob)1 SchedulableJobValidator.validateRepeatingSchedulableJob (org.motechproject.scheduler.validation.SchedulableJobValidator.validateRepeatingSchedulableJob)1