@Test public void retryTestWithTooSmallMaxRetryCount() throws Exception { WorkflowID wfID1 = new WorkflowID("wf1"); Schedule sch1 = makeHourlySchedule(); SchedulingStrategy str1 = new TrivialSchedulingStrategy(); Trigger tr1 = makeAlwaysTrigger(); ExternalService srv1 = new RepeatedlyFailingExternalService(3); int maxRetryCount = 2; Workflow wf1 = new Workflow(wfID1, sch1, str1, tr1, srv1, maxRetryCount, Workflow.DEFAULT_START_TIME, Workflow.DEFAULT_WAIT_TIMEOUT_SECONDS, emptyWorkflowInfo); WorkflowConfiguration cfg = new WorkflowConfiguration(); cfg.addWorkflow(wf1); MemoryStateDatabase db = new MemoryStateDatabase(); SlotID id1 = new SlotID(wfID1, new ScheduledTime("2013-11-27T20:00Z")); SlotState initial = new SlotState(id1, SlotState.Status.READY); SlotState running1 = new SlotState(id1, SlotState.Status.RUNNING, "fake-external-id", 0); SlotState retry1 = new SlotState(id1, SlotState.Status.WAITING, null, 1); SlotState ready1 = new SlotState(id1, SlotState.Status.READY, null, 1); SlotState running2 = new SlotState(id1, SlotState.Status.RUNNING, "fake-external-id", 1); SlotState retry2 = new SlotState(id1, SlotState.Status.WAITING, null, 2); SlotState ready2 = new SlotState(id1, SlotState.Status.READY, null, 2); SlotState running3 = new SlotState(id1, SlotState.Status.RUNNING, "fake-external-id", 2); SlotState failure = new SlotState(id1, SlotState.Status.FAILURE, "fake-external-id", 2); connection.putSlotState(initial); Scheduler sch = new Scheduler(cfg, 1); sch.step(new ScheduledTime("2013-11-27T20:01Z"), connection); Assert.assertEquals(running1, connection.getSlotState(id1)); sch.step(new ScheduledTime("2013-11-27T20:01Z"), connection); Assert.assertEquals(retry1, connection.getSlotState(id1)); sch.step(new ScheduledTime("2013-11-27T20:01Z"), connection); Assert.assertEquals(ready1, connection.getSlotState(id1)); sch.step(new ScheduledTime("2013-11-27T20:01Z"), connection); Assert.assertEquals(running2, connection.getSlotState(id1)); sch.step(new ScheduledTime("2013-11-27T20:01Z"), connection); Assert.assertEquals(retry2, connection.getSlotState(id1)); sch.step(new ScheduledTime("2013-11-27T20:01Z"), connection); Assert.assertEquals(ready2, connection.getSlotState(id1)); sch.step(new ScheduledTime("2013-11-27T20:01Z"), connection); Assert.assertEquals(running3, connection.getSlotState(id1)); sch.step(new ScheduledTime("2013-11-27T20:01Z"), connection); Assert.assertEquals(failure, connection.getSlotState(id1)); }
public void step(ScheduledTime current, StateDatabaseConnection connection) throws Exception { step(current, Collections.<WorkflowID>emptySet(), connection); }
Scheduler { public void step(ScheduledTime current, StateDatabaseConnection connection) throws Exception { step(current, Collections.<WorkflowID>emptySet(), connection); } }
Scheduler { public void step(ScheduledTime current, StateDatabaseConnection connection) throws Exception { step(current, Collections.<WorkflowID>emptySet(), connection); } Scheduler(WorkflowConfiguration configuration, int slidingWindowHours); }
Scheduler { public void step(ScheduledTime current, StateDatabaseConnection connection) throws Exception { step(current, Collections.<WorkflowID>emptySet(), connection); } Scheduler(WorkflowConfiguration configuration, int slidingWindowHours); void step(ScheduledTime current, StateDatabaseConnection connection); void step(ScheduledTime current, Set<WorkflowID> workflowIDs, StateDatabaseConnection connection); List<SlotState> getSlotStatesIncludingMarkedForRerun(Workflow wf, ScheduledTime current, ScheduledTime start, ScheduledTime end, StateDatabaseConnection connection); List<SlotState> getSlotStates(Workflow wf, ScheduledTime start, ScheduledTime end, StateDatabaseConnection connection); ScheduledTime getWorkflowStartTime(Workflow wf, ScheduledTime current); int getSlidingWindowHours(); WorkflowConfiguration getWorkflowConfiguration(); }
Scheduler { public void step(ScheduledTime current, StateDatabaseConnection connection) throws Exception { step(current, Collections.<WorkflowID>emptySet(), connection); } Scheduler(WorkflowConfiguration configuration, int slidingWindowHours); void step(ScheduledTime current, StateDatabaseConnection connection); void step(ScheduledTime current, Set<WorkflowID> workflowIDs, StateDatabaseConnection connection); List<SlotState> getSlotStatesIncludingMarkedForRerun(Workflow wf, ScheduledTime current, ScheduledTime start, ScheduledTime end, StateDatabaseConnection connection); List<SlotState> getSlotStates(Workflow wf, ScheduledTime start, ScheduledTime end, StateDatabaseConnection connection); ScheduledTime getWorkflowStartTime(Workflow wf, ScheduledTime current); int getSlidingWindowHours(); WorkflowConfiguration getWorkflowConfiguration();  }