@Test void executeBeforeStepHooks() { Module moduleToDeploy = createModule("test-module"); Mockito.when(hooksCalculator.isInPreExecuteStepPhase(StepPhase.EXECUTE)) .thenReturn(true); Mockito.when(processTypeParser.getProcessType(any())) .thenReturn(ProcessType.BLUE_GREEN_DEPLOY); List<Hook> expectedHooksForExecution = List.of(createHook("test-hook", Collections.emptyList())); Mockito.when(hooksCalculator.calculateHooksForExecution(moduleToDeploy, StepPhase.EXECUTE)) .thenReturn(expectedHooksForExecution); HooksExecutor hooksExecutor = new HooksExecutor(hooksCalculator, moduleToDeploy); List<Hook> hooksForExecution = hooksExecutor.executeBeforeStepHooks(StepPhase.EXECUTE); Assertions.assertEquals(expectedHooksForExecution, hooksForExecution); }
public List<Hook> executeBeforeStepHooks(StepPhase currentStepPhase) { if (!hooksCalculator.isInPreExecuteStepPhase(currentStepPhase)) { return Collections.emptyList(); } return executeHooks(currentStepPhase); }
HooksExecutor { public List<Hook> executeBeforeStepHooks(StepPhase currentStepPhase) { if (!hooksCalculator.isInPreExecuteStepPhase(currentStepPhase)) { return Collections.emptyList(); } return executeHooks(currentStepPhase); } }
HooksExecutor { public List<Hook> executeBeforeStepHooks(StepPhase currentStepPhase) { if (!hooksCalculator.isInPreExecuteStepPhase(currentStepPhase)) { return Collections.emptyList(); } return executeHooks(currentStepPhase); } HooksExecutor(HooksCalculator hooksCalculator, Module moduleToDeploy); }
HooksExecutor { public List<Hook> executeBeforeStepHooks(StepPhase currentStepPhase) { if (!hooksCalculator.isInPreExecuteStepPhase(currentStepPhase)) { return Collections.emptyList(); } return executeHooks(currentStepPhase); } HooksExecutor(HooksCalculator hooksCalculator, Module moduleToDeploy); List<Hook> executeBeforeStepHooks(StepPhase currentStepPhase); List<Hook> executeAfterStepHooks(StepPhase currentStepPhase); }
HooksExecutor { public List<Hook> executeBeforeStepHooks(StepPhase currentStepPhase) { if (!hooksCalculator.isInPreExecuteStepPhase(currentStepPhase)) { return Collections.emptyList(); } return executeHooks(currentStepPhase); } HooksExecutor(HooksCalculator hooksCalculator, Module moduleToDeploy); List<Hook> executeBeforeStepHooks(StepPhase currentStepPhase); List<Hook> executeAfterStepHooks(StepPhase currentStepPhase);  }