AbstractSystemJob extends QuartzJobBean { public abstract String getCronExpression();  void setParameters(Map<String, String> parameters); abstract void validateParameters(List<Parameter> parameters); abstract String getCronExpression(); abstract JobDataMap getJobDataMap(); JobDataMap getJobDataMap(List<Parameter> parameters); static final String SYSTEM_JOB_PARAMETERS; static final String CRON_TRIGGER_SUFFIX; static final String RUN_ONCE_TRIGGER_SUFFIX; }
@Test public void testGetCronExpression() throws ParseException { Map<String, AbstractSystemJob> systemJobs = applicationContext.getBeansOfType(AbstractSystemJob.class); assertEquals(7, CollectionUtils.size(systemJobs)); for (Map.Entry<String, AbstractSystemJob> entry : systemJobs.entrySet()) { String jobName = entry.getKey(); AbstractSystemJob systemJob = entry.getValue(); String cronExpressionAsText = systemJob.getCronExpression(); LOGGER.info(String.format("Testing cron expression \"%s\" specified for \"%s\" system job...", cronExpressionAsText, jobName)); if (CronExpression.isValidExpression(cronExpressionAsText)) { CronExpression cronExpression = new CronExpression(cronExpressionAsText); LOGGER.info(String.format("Next valid time for \"%s\" cron expression after now is \"%s\".", cronExpressionAsText, cronExpression.getNextValidTimeAfter(new Date()))); } else { fail(String.format("Cron expression \"%s\" specified for \"%s\" system job is not valid.", cronExpressionAsText, jobName)); } } }