diff --git a/openbas-api/src/main/java/io/openbas/scheduler/jobs/InjectsExecutionJob.java b/openbas-api/src/main/java/io/openbas/scheduler/jobs/InjectsExecutionJob.java index c11321a2d3..4a54e4b578 100644 --- a/openbas-api/src/main/java/io/openbas/scheduler/jobs/InjectsExecutionJob.java +++ b/openbas-api/src/main/java/io/openbas/scheduler/jobs/InjectsExecutionJob.java @@ -55,11 +55,8 @@ public class InjectsExecutionJob implements Job { private final ExecutionExecutorService executionExecutorService; private final AtomicTestingService atomicTestingService; private final InjectDependenciesRepository injectDependenciesRepository; - private final ExerciseExpectationService exerciseExpectationService; private final InjectExpectationRepository injectExpectationRepository; - private static final String EXPECTATIONS = "expectations"; - private final List executionStatusesNotReady = List.of(ExecutionStatus.QUEUING, ExecutionStatus.DRAFT, ExecutionStatus.EXECUTING, ExecutionStatus.PENDING); @@ -238,6 +235,12 @@ private void executeInject(ExecutableInject executableInject) { } } + /** + * Get error messages if pre execution conditions are not met + * @param exerciseId the id of the exercise + * @param inject the inject to check + * @return an optional of list of error message + */ private Optional> getErrorMessagesPreExecution(String exerciseId, Inject inject) { List injectDependencies = injectDependenciesRepository.findParents(List.of(inject.getId())); if (!injectDependencies.isEmpty()) { @@ -272,6 +275,13 @@ private Optional> getErrorMessagesPreExecution(String exerciseId, I return Optional.empty(); } + /** + * Get a map containing the expectations and if they are met or not + * @param parents the parents injects + * @param exerciseId the id of the exercise + * @param injectDependencies the list of dependencies + * @return a map of expectations and their value + */ private @NotNull Map getStringBooleanMap(List parents, String exerciseId, List injectDependencies) { Map mapCondition = new HashMap<>();