@Test void testExecuteHooksForPhaseAfterStopIdle() { HooksCalculator hooksHelper = createHooksCalculator(HookPhase.NONE, HookPhase.BLUE_GREEN_APPLICATION_AFTER_STOP_IDLE); Module moduleToDeploy = createModule("module-to-deploy"); Hook afterStopIdleHook = createHook("after-stop-idle", List.of("blue-green.application.after-stop.idle")); moduleToDeploy.setHooks(List.of(afterStopIdleHook)); Mockito.when(processTypeParser.getProcessType(context.getExecution())) .thenReturn(ProcessType.BLUE_GREEN_DEPLOY); context.setVariable(Variables.SUBPROCESS_PHASE, SubprocessPhase.BEFORE_APPLICATION_START); List<Hook> hooksForCurrentPhase = hooksHelper.calculateHooksForExecution(moduleToDeploy, StepPhase.DONE); Assertions.assertEquals(1, hooksForCurrentPhase.size()); List<String> expectedHookPhases = List.of("blue-green.application.after-stop.idle"); Assertions.assertEquals(expectedHookPhases, hooksForCurrentPhase.get(0) .getPhases()); }
public List<Hook> calculateHooksForExecution(Module moduleToDeploy, StepPhase currentStepPhase) { List<HookPhase> currentHookPhasesForExecution = determineHookPhaseForCurrentStepPhase(currentStepPhase); return getHooksForCurrentPhase(moduleToDeploy, currentHookPhasesForExecution); }
HooksCalculator { public List<Hook> calculateHooksForExecution(Module moduleToDeploy, StepPhase currentStepPhase) { List<HookPhase> currentHookPhasesForExecution = determineHookPhaseForCurrentStepPhase(currentStepPhase); return getHooksForCurrentPhase(moduleToDeploy, currentHookPhasesForExecution); } }
HooksCalculator { public List<Hook> calculateHooksForExecution(Module moduleToDeploy, StepPhase currentStepPhase) { List<HookPhase> currentHookPhasesForExecution = determineHookPhaseForCurrentStepPhase(currentStepPhase); return getHooksForCurrentPhase(moduleToDeploy, currentHookPhasesForExecution); }  }
HooksCalculator { public List<Hook> calculateHooksForExecution(Module moduleToDeploy, StepPhase currentStepPhase) { List<HookPhase> currentHookPhasesForExecution = determineHookPhaseForCurrentStepPhase(currentStepPhase); return getHooksForCurrentPhase(moduleToDeploy, currentHookPhasesForExecution); }  List<Hook> calculateHooksForExecution(Module moduleToDeploy, StepPhase currentStepPhase); void setHooksForExecution(List<Hook> hooksForExecution); abstract ProcessContext getContext(); abstract List<HookPhase> getHookPhasesBeforeStep(); abstract List<HookPhase> getHookPhasesAfterStep(); }
HooksCalculator { public List<Hook> calculateHooksForExecution(Module moduleToDeploy, StepPhase currentStepPhase) { List<HookPhase> currentHookPhasesForExecution = determineHookPhaseForCurrentStepPhase(currentStepPhase); return getHooksForCurrentPhase(moduleToDeploy, currentHookPhasesForExecution); }  List<Hook> calculateHooksForExecution(Module moduleToDeploy, StepPhase currentStepPhase); void setHooksForExecution(List<Hook> hooksForExecution); abstract ProcessContext getContext(); abstract List<HookPhase> getHookPhasesBeforeStep(); abstract List<HookPhase> getHookPhasesAfterStep();  }