@Test(expected = JobSystemException.class) public void assertTriggerJobFailure() throws SchedulerException { JobKey jobKey = new JobKey("test_job"); when(jobDetail.getKey()).thenReturn(jobKey); when(scheduler.checkExists(jobKey)).thenReturn(true); doThrow(SchedulerException.class).when(scheduler).triggerJob(jobKey); ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); ReflectionUtils.setFieldValue(jobScheduleController, "jobDetail", jobDetail); try { jobScheduleController.triggerJob(); } finally { verify(jobDetail, times(2)).getKey(); verify(scheduler).triggerJob(jobKey); } }
public synchronized void triggerJob() { try { if (scheduler.isShutdown()) { return; } if (!scheduler.checkExists(jobDetail.getKey())) { scheduler.scheduleJob(jobDetail, createOneOffTrigger()); } else { scheduler.triggerJob(jobDetail.getKey()); } if (!scheduler.isStarted()) { scheduler.start(); } } catch (final SchedulerException ex) { throw new JobSystemException(ex); } }
JobScheduleController { public synchronized void triggerJob() { try { if (scheduler.isShutdown()) { return; } if (!scheduler.checkExists(jobDetail.getKey())) { scheduler.scheduleJob(jobDetail, createOneOffTrigger()); } else { scheduler.triggerJob(jobDetail.getKey()); } if (!scheduler.isStarted()) { scheduler.start(); } } catch (final SchedulerException ex) { throw new JobSystemException(ex); } } }
JobScheduleController { public synchronized void triggerJob() { try { if (scheduler.isShutdown()) { return; } if (!scheduler.checkExists(jobDetail.getKey())) { scheduler.scheduleJob(jobDetail, createOneOffTrigger()); } else { scheduler.triggerJob(jobDetail.getKey()); } if (!scheduler.isStarted()) { scheduler.start(); } } catch (final SchedulerException ex) { throw new JobSystemException(ex); } }  }
JobScheduleController { public synchronized void triggerJob() { try { if (scheduler.isShutdown()) { return; } if (!scheduler.checkExists(jobDetail.getKey())) { scheduler.scheduleJob(jobDetail, createOneOffTrigger()); } else { scheduler.triggerJob(jobDetail.getKey()); } if (!scheduler.isStarted()) { scheduler.start(); } } catch (final SchedulerException ex) { throw new JobSystemException(ex); } }  void scheduleJob(final String cron); synchronized void rescheduleJob(final String cron); synchronized void rescheduleJob(); synchronized boolean isPaused(); synchronized void pauseJob(); synchronized void resumeJob(); synchronized void triggerJob(); synchronized void shutdown(); synchronized void shutdown(final boolean isCleanShutdown); }
JobScheduleController { public synchronized void triggerJob() { try { if (scheduler.isShutdown()) { return; } if (!scheduler.checkExists(jobDetail.getKey())) { scheduler.scheduleJob(jobDetail, createOneOffTrigger()); } else { scheduler.triggerJob(jobDetail.getKey()); } if (!scheduler.isStarted()) { scheduler.start(); } } catch (final SchedulerException ex) { throw new JobSystemException(ex); } }  void scheduleJob(final String cron); synchronized void rescheduleJob(final String cron); synchronized void rescheduleJob(); synchronized boolean isPaused(); synchronized void pauseJob(); synchronized void resumeJob(); synchronized void triggerJob(); synchronized void shutdown(); synchronized void shutdown(final boolean isCleanShutdown);  }