@Test public void throwsExceptionContainingWorkflowIDIfWorkflowNotFound() { WorkflowConfiguration emptyConf = new WorkflowConfiguration(); int slidingWindowHours = 24; Scheduler scheduler = new Scheduler(emptyConf, slidingWindowHours); String id = "nonexisting-workflow"; DependentSchedule schedule = new DependentSchedule(new WorkflowID(id)); try { schedule.getScheduledTimes(scheduler, ScheduledTime.now(), ScheduledTime.now()); } catch(Exception e) { if (!e.getMessage().contains(id)) { Assert.assertFalse(true); } } }
@Override public SortedSet<ScheduledTime> getScheduledTimes(Scheduler scheduler, ScheduledTime start, ScheduledTime end) { Workflow otherWorkflow = scheduler.getWorkflowConfiguration().findWorkflow(getOtherWorkflowID()); if (otherWorkflow == null) { throw new RuntimeException("Workflow " + getOtherWorkflowID() + " doesn't exist."); } Schedule otherSchedule = otherWorkflow.getSchedule(); return otherSchedule.getScheduledTimes(scheduler, start, end); }
DependentSchedule implements Schedule { @Override public SortedSet<ScheduledTime> getScheduledTimes(Scheduler scheduler, ScheduledTime start, ScheduledTime end) { Workflow otherWorkflow = scheduler.getWorkflowConfiguration().findWorkflow(getOtherWorkflowID()); if (otherWorkflow == null) { throw new RuntimeException("Workflow " + getOtherWorkflowID() + " doesn't exist."); } Schedule otherSchedule = otherWorkflow.getSchedule(); return otherSchedule.getScheduledTimes(scheduler, start, end); } }
DependentSchedule implements Schedule { @Override public SortedSet<ScheduledTime> getScheduledTimes(Scheduler scheduler, ScheduledTime start, ScheduledTime end) { Workflow otherWorkflow = scheduler.getWorkflowConfiguration().findWorkflow(getOtherWorkflowID()); if (otherWorkflow == null) { throw new RuntimeException("Workflow " + getOtherWorkflowID() + " doesn't exist."); } Schedule otherSchedule = otherWorkflow.getSchedule(); return otherSchedule.getScheduledTimes(scheduler, start, end); } DependentSchedule(WorkflowID otherWorkflowID); }
DependentSchedule implements Schedule { @Override public SortedSet<ScheduledTime> getScheduledTimes(Scheduler scheduler, ScheduledTime start, ScheduledTime end) { Workflow otherWorkflow = scheduler.getWorkflowConfiguration().findWorkflow(getOtherWorkflowID()); if (otherWorkflow == null) { throw new RuntimeException("Workflow " + getOtherWorkflowID() + " doesn't exist."); } Schedule otherSchedule = otherWorkflow.getSchedule(); return otherSchedule.getScheduledTimes(scheduler, start, end); } DependentSchedule(WorkflowID otherWorkflowID); @Override SortedSet<ScheduledTime> getScheduledTimes(Scheduler scheduler, ScheduledTime start, ScheduledTime end); WorkflowID getOtherWorkflowID(); }
DependentSchedule implements Schedule { @Override public SortedSet<ScheduledTime> getScheduledTimes(Scheduler scheduler, ScheduledTime start, ScheduledTime end) { Workflow otherWorkflow = scheduler.getWorkflowConfiguration().findWorkflow(getOtherWorkflowID()); if (otherWorkflow == null) { throw new RuntimeException("Workflow " + getOtherWorkflowID() + " doesn't exist."); } Schedule otherSchedule = otherWorkflow.getSchedule(); return otherSchedule.getScheduledTimes(scheduler, start, end); } DependentSchedule(WorkflowID otherWorkflowID); @Override SortedSet<ScheduledTime> getScheduledTimes(Scheduler scheduler, ScheduledTime start, ScheduledTime end); WorkflowID getOtherWorkflowID();  }