Search in sources :

Example 41 with CronTrigger

use of org.quartz.CronTrigger in project spring-framework by spring-projects.

the class CronTriggerFactoryBeanTests method createWithoutJobDetail.

@Test
public void createWithoutJobDetail() throws ParseException {
    CronTriggerFactoryBean factory = new CronTriggerFactoryBean();
    factory.setName("myTrigger");
    factory.setCronExpression("0 15 10 ? * *");
    factory.afterPropertiesSet();
    CronTrigger trigger = factory.getObject();
    assertEquals("0 15 10 ? * *", trigger.getCronExpression());
}
Also used : CronTrigger(org.quartz.CronTrigger) Test(org.junit.Test)

Example 42 with CronTrigger

use of org.quartz.CronTrigger in project engine by craftercms.

the class FolderBasedScriptJobResolverTest method testResolveJobs.

@Test
public void testResolveJobs() throws Exception {
    List<JobContext> jobContexts = resolver.resolveJobs(siteContext);
    assertNotNull(jobContexts);
    assertEquals(1, jobContexts.size());
    JobDetailImpl jobDetail = (JobDetailImpl) jobContexts.get(0).getDetail();
    CronTrigger trigger = (CronTrigger) jobContexts.get(0).getTrigger();
    assertEquals(ScriptJob.class, jobDetail.getJobClass());
    assertEquals("/scripts/jobs/testJob.groovy", jobDetail.getJobDataMap().getString(ScriptJob.SCRIPT_URL_DATA_KEY));
    assertEquals(HOURLY_CRON_EXPRESSION, trigger.getCronExpression());
}
Also used : CronTrigger(org.quartz.CronTrigger) JobDetailImpl(org.quartz.impl.JobDetailImpl) JobContext(org.craftercms.engine.util.quartz.JobContext) Test(org.junit.Test)

Aggregations

CronTrigger (org.quartz.CronTrigger)42 JobDetail (org.quartz.JobDetail)20 Test (org.junit.Test)17 Trigger (org.quartz.Trigger)14 SchedulerException (org.quartz.SchedulerException)13 Scheduler (org.quartz.Scheduler)12 SimpleTrigger (org.quartz.SimpleTrigger)11 TriggerKey (org.quartz.TriggerKey)7 JobKey (org.quartz.JobKey)5 Date (java.util.Date)4 CamelContext (org.apache.camel.CamelContext)4 JobDataMap (org.quartz.JobDataMap)4 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)4 ParseException (java.text.ParseException)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)2 JobContext (org.craftercms.engine.util.quartz.JobContext)2 CronScheduleBuilder (org.quartz.CronScheduleBuilder)2 JobExecutionException (org.quartz.JobExecutionException)2