Пример #1
0
 /** 初始化作业. */
 public void init() {
   log.debug("Elastic job: job controller init, job name is: {}.", jobConfiguration.getJobName());
   coordinatorRegistryCenter.addCacheData("/" + jobConfiguration.getJobName());
   registerElasticEnv();
   jobDetail = createJobDetail();
   try {
     scheduler = initializeScheduler(jobDetail.getKey().toString());
     scheduleJob(createTrigger(configService.getCron()));
   } catch (final SchedulerException ex) {
     throw new JobException(ex);
   }
   JobRegistry.getInstance().addJob(jobConfiguration.getJobName(), this);
 }
 @Test
 public void testGetCron() {
   when(configService.getCron()).thenReturn("0 * * * * *");
   assertThat(schedulerFacade.getCron(), is("0 * * * * *"));
 }