@Test void runNowUnknownEntity() { when(dataService.findOneById(SCHEDULED_JOB, id)).thenReturn(null); Exception exception = assertThrows(UnknownEntityException.class, () -> jobScheduler.runNow(id)); assertThat(exception.getMessage()) .containsPattern("type:sys_job_ScheduledJob id:id attribute:null"); }
public synchronized void runNow(String scheduledJobId) { ScheduledJob scheduledJob = getJob(scheduledJobId); try { JobKey jobKey = new JobKey(scheduledJobId, SCHEDULED_JOB_GROUP); if (quartzScheduler.checkExists(jobKey)) { quartzScheduler.triggerJob(jobKey); } else { Trigger trigger = newTrigger().withIdentity(scheduledJobId, SCHEDULED_JOB_GROUP).startNow().build(); schedule(scheduledJob, trigger); } } catch (SchedulerException e) { LOG.error("Error runNow ScheduledJob", e); throw new MolgenisDataException("Error job runNow", e); } }
JobScheduler { public synchronized void runNow(String scheduledJobId) { ScheduledJob scheduledJob = getJob(scheduledJobId); try { JobKey jobKey = new JobKey(scheduledJobId, SCHEDULED_JOB_GROUP); if (quartzScheduler.checkExists(jobKey)) { quartzScheduler.triggerJob(jobKey); } else { Trigger trigger = newTrigger().withIdentity(scheduledJobId, SCHEDULED_JOB_GROUP).startNow().build(); schedule(scheduledJob, trigger); } } catch (SchedulerException e) { LOG.error("Error runNow ScheduledJob", e); throw new MolgenisDataException("Error job runNow", e); } } }
JobScheduler { public synchronized void runNow(String scheduledJobId) { ScheduledJob scheduledJob = getJob(scheduledJobId); try { JobKey jobKey = new JobKey(scheduledJobId, SCHEDULED_JOB_GROUP); if (quartzScheduler.checkExists(jobKey)) { quartzScheduler.triggerJob(jobKey); } else { Trigger trigger = newTrigger().withIdentity(scheduledJobId, SCHEDULED_JOB_GROUP).startNow().build(); schedule(scheduledJob, trigger); } } catch (SchedulerException e) { LOG.error("Error runNow ScheduledJob", e); throw new MolgenisDataException("Error job runNow", e); } } JobScheduler(Scheduler quartzScheduler, DataService dataService); }
JobScheduler { public synchronized void runNow(String scheduledJobId) { ScheduledJob scheduledJob = getJob(scheduledJobId); try { JobKey jobKey = new JobKey(scheduledJobId, SCHEDULED_JOB_GROUP); if (quartzScheduler.checkExists(jobKey)) { quartzScheduler.triggerJob(jobKey); } else { Trigger trigger = newTrigger().withIdentity(scheduledJobId, SCHEDULED_JOB_GROUP).startNow().build(); schedule(scheduledJob, trigger); } } catch (SchedulerException e) { LOG.error("Error runNow ScheduledJob", e); throw new MolgenisDataException("Error job runNow", e); } } JobScheduler(Scheduler quartzScheduler, DataService dataService); synchronized void runNow(String scheduledJobId); synchronized void schedule(ScheduledJob scheduledJob); void scheduleJobs(); }
JobScheduler { public synchronized void runNow(String scheduledJobId) { ScheduledJob scheduledJob = getJob(scheduledJobId); try { JobKey jobKey = new JobKey(scheduledJobId, SCHEDULED_JOB_GROUP); if (quartzScheduler.checkExists(jobKey)) { quartzScheduler.triggerJob(jobKey); } else { Trigger trigger = newTrigger().withIdentity(scheduledJobId, SCHEDULED_JOB_GROUP).startNow().build(); schedule(scheduledJob, trigger); } } catch (SchedulerException e) { LOG.error("Error runNow ScheduledJob", e); throw new MolgenisDataException("Error job runNow", e); } } JobScheduler(Scheduler quartzScheduler, DataService dataService); synchronized void runNow(String scheduledJobId); synchronized void schedule(ScheduledJob scheduledJob); void scheduleJobs();  }