@Test public void testResetProgress() { Agenda agenda = createAgenda(Arrays.asList( createOperation("op.1"), createOperation("op.2") )); AgendaProgress agendaProgress = createAgendaProgressWithAgendaOps( ProcessingState.COMPLETE, CompleteStateMessage.FAILED.toString(), agenda); Map<RerunAgendaParameter, String> retryParameters = new HashMap<>(); progressResetProcessor.resetProgress(agenda, agendaProgress, retryParameters); Assert.assertEquals(agendaProgress.getProcessingState(), ProcessingState.WAITING); Assert.assertEquals(agendaProgress.getProcessingStateMessage(), WaitingStateMessage.PENDING.toString()); for(OperationProgress opProgress : agendaProgress.getOperationProgress()) { Assert.assertEquals(opProgress.getProcessingState(), ProcessingState.WAITING); Assert.assertEquals(opProgress.getProcessingStateMessage(), WaitingStateMessage.PENDING.toString()); Assert.assertEquals(opProgress.getResultPayload(), ProgressResetProcessor.RESET_OP_PAYLOAD); } }
public ProgressResetResult resetProgress(Agenda agenda, AgendaProgress agendaProgress, Map<RerunAgendaParameter, String> retryParameters) { boolean resetAll = retryParameters.containsKey(RerunAgendaParameter.RESET_ALL); boolean continueOnly = retryParameters.containsKey(RerunAgendaParameter.CONTINUE); Set<String> operationsToReset = getSpecifiedOperationsToReset(retryParameters, agendaProgress); if (!resetAll && operationsToReset.size() == 0 && !continueOnly) { resetAll = true; } if(resetAll) { operationsToReset = getAllOperations(agenda); } resetAgendaProgress(agendaProgress); ProgressResetResult progressResetResult = generateResetResult(agenda, operationsToReset); resetOperationProgresses(agendaProgress, progressResetResult.getOperationsToReset()); return progressResetResult; }
ProgressResetProcessor { public ProgressResetResult resetProgress(Agenda agenda, AgendaProgress agendaProgress, Map<RerunAgendaParameter, String> retryParameters) { boolean resetAll = retryParameters.containsKey(RerunAgendaParameter.RESET_ALL); boolean continueOnly = retryParameters.containsKey(RerunAgendaParameter.CONTINUE); Set<String> operationsToReset = getSpecifiedOperationsToReset(retryParameters, agendaProgress); if (!resetAll && operationsToReset.size() == 0 && !continueOnly) { resetAll = true; } if(resetAll) { operationsToReset = getAllOperations(agenda); } resetAgendaProgress(agendaProgress); ProgressResetResult progressResetResult = generateResetResult(agenda, operationsToReset); resetOperationProgresses(agendaProgress, progressResetResult.getOperationsToReset()); return progressResetResult; } }
ProgressResetProcessor { public ProgressResetResult resetProgress(Agenda agenda, AgendaProgress agendaProgress, Map<RerunAgendaParameter, String> retryParameters) { boolean resetAll = retryParameters.containsKey(RerunAgendaParameter.RESET_ALL); boolean continueOnly = retryParameters.containsKey(RerunAgendaParameter.CONTINUE); Set<String> operationsToReset = getSpecifiedOperationsToReset(retryParameters, agendaProgress); if (!resetAll && operationsToReset.size() == 0 && !continueOnly) { resetAll = true; } if(resetAll) { operationsToReset = getAllOperations(agenda); } resetAgendaProgress(agendaProgress); ProgressResetResult progressResetResult = generateResetResult(agenda, operationsToReset); resetOperationProgresses(agendaProgress, progressResetResult.getOperationsToReset()); return progressResetResult; }  }
ProgressResetProcessor { public ProgressResetResult resetProgress(Agenda agenda, AgendaProgress agendaProgress, Map<RerunAgendaParameter, String> retryParameters) { boolean resetAll = retryParameters.containsKey(RerunAgendaParameter.RESET_ALL); boolean continueOnly = retryParameters.containsKey(RerunAgendaParameter.CONTINUE); Set<String> operationsToReset = getSpecifiedOperationsToReset(retryParameters, agendaProgress); if (!resetAll && operationsToReset.size() == 0 && !continueOnly) { resetAll = true; } if(resetAll) { operationsToReset = getAllOperations(agenda); } resetAgendaProgress(agendaProgress); ProgressResetResult progressResetResult = generateResetResult(agenda, operationsToReset); resetOperationProgresses(agendaProgress, progressResetResult.getOperationsToReset()); return progressResetResult; }  ProgressResetResult resetProgress(Agenda agenda, AgendaProgress agendaProgress, Map<RerunAgendaParameter, String> retryParameters); }
ProgressResetProcessor { public ProgressResetResult resetProgress(Agenda agenda, AgendaProgress agendaProgress, Map<RerunAgendaParameter, String> retryParameters) { boolean resetAll = retryParameters.containsKey(RerunAgendaParameter.RESET_ALL); boolean continueOnly = retryParameters.containsKey(RerunAgendaParameter.CONTINUE); Set<String> operationsToReset = getSpecifiedOperationsToReset(retryParameters, agendaProgress); if (!resetAll && operationsToReset.size() == 0 && !continueOnly) { resetAll = true; } if(resetAll) { operationsToReset = getAllOperations(agenda); } resetAgendaProgress(agendaProgress); ProgressResetResult progressResetResult = generateResetResult(agenda, operationsToReset); resetOperationProgresses(agendaProgress, progressResetResult.getOperationsToReset()); return progressResetResult; }  ProgressResetResult resetProgress(Agenda agenda, AgendaProgress agendaProgress, Map<RerunAgendaParameter, String> retryParameters);  }