use of pipelite.stage.StageState in project pipelite by enasequence.
the class DependencyResolverTest method othersActivePendingIndependentOnePermanentError.
@Test
public void othersActivePendingIndependentOnePermanentError() {
for (StageState stageState : EnumSet.of(ACTIVE, PENDING)) {
ProcessBuilder builder = createProcessBuilder();
Process process = builder.execute("STAGE1").withSyncTestExecutor(StageExecutorState.ERROR).execute("STAGE2").withSyncTestExecutor().execute("STAGE3").withSyncTestExecutor().execute("STAGE4").withSyncTestExecutor().build();
Set<Stage> stages = process.getStages();
int stageNumber = 0;
for (Stage stage : stages) {
if (stageNumber == 0) {
simulateStageExecution(stage, ErrorType.PERMANENT_ERROR);
} else {
simulateStageExecution(stage, stageState);
}
stageNumber++;
}
assertGetDependsOnStages(process, "STAGE1", Collections.emptyList());
assertGetDependsOnStages(process, "STAGE2", Collections.emptyList());
assertGetDependsOnStages(process, "STAGE3", Collections.emptyList());
assertGetDependsOnStages(process, "STAGE4", Collections.emptyList());
assertGetDependsOnStagesDirectly(process, "STAGE1", Collections.emptyList());
assertGetDependsOnStagesDirectly(process, "STAGE2", Collections.emptyList());
assertGetDependsOnStagesDirectly(process, "STAGE3", Collections.emptyList());
assertGetDependsOnStagesDirectly(process, "STAGE4", Collections.emptyList());
assertGetDependentStages(process, "STAGE1", Collections.emptyList());
assertGetDependentStages(process, "STAGE2", Collections.emptyList());
assertGetDependentStages(process, "STAGE3", Collections.emptyList());
assertGetDependentStages(process, "STAGE4", Collections.emptyList());
assertGetPermanentFailedStages(stages, Arrays.asList("STAGE1"));
assertGetImmediatelyExecutableStages(process, Arrays.asList("STAGE2", "STAGE3", "STAGE4"));
assertGetEventuallyExecutableStages(process, Arrays.asList("STAGE2", "STAGE3", "STAGE4"));
}
}
use of pipelite.stage.StageState in project pipelite by enasequence.
the class ProcessRunner method evaluateProcessState.
/**
* Evaluates the process state using the stage execution result types.
*
* @param process the process
* @return the process state
*/
public static ProcessState evaluateProcessState(Process process) {
int errorCount = 0;
for (Stage stage : process.getStages()) {
StageEntity stageEntity = stage.getStageEntity();
StageState stageState = stageEntity.getStageState();
if (stageState == SUCCESS) {
continue;
}
if (DependencyResolver.isEventuallyExecutableStage(process, stage)) {
return ProcessState.ACTIVE;
} else {
errorCount++;
}
}
if (errorCount > 0) {
return ProcessState.FAILED;
}
return ProcessState.COMPLETED;
}
use of pipelite.stage.StageState in project pipelite by enasequence.
the class DependencyResolverTest method othersActivePendingIndependentOneErrorMaxAndImmediateRetriesLeft.
@Test
public void othersActivePendingIndependentOneErrorMaxAndImmediateRetriesLeft() {
for (StageState stageState : EnumSet.of(ACTIVE, PENDING)) {
ProcessBuilder builder = createProcessBuilder();
Process process = builder.execute("STAGE1").withSyncTestExecutor(StageExecutorState.ERROR, ExecutorParameters.builder().maximumRetries(1).immediateRetries(1).build()).execute("STAGE2").withSyncTestExecutor().execute("STAGE3").withSyncTestExecutor().build();
Set<Stage> stages = process.getStages();
int stageNumber = 0;
for (Stage stage : process.getStages()) {
if (stageNumber == 0) {
simulateStageExecution(stage, StageState.ERROR);
} else {
simulateStageExecution(stage, stageState);
}
stageNumber++;
}
assertGetDependsOnStages(process, "STAGE1", Collections.emptyList());
assertGetDependsOnStages(process, "STAGE2", Collections.emptyList());
assertGetDependsOnStages(process, "STAGE3", Collections.emptyList());
assertGetDependsOnStagesDirectly(process, "STAGE1", Collections.emptyList());
assertGetDependsOnStagesDirectly(process, "STAGE2", Collections.emptyList());
assertGetDependsOnStagesDirectly(process, "STAGE3", Collections.emptyList());
assertGetDependentStages(process, "STAGE1", Collections.emptyList());
assertGetDependentStages(process, "STAGE2", Collections.emptyList());
assertGetDependentStages(process, "STAGE3", Collections.emptyList());
assertGetPermanentFailedStages(stages, Collections.emptyList());
assertGetImmediatelyExecutableStages(process, Arrays.asList("STAGE1", "STAGE2", "STAGE3"));
assertGetEventuallyExecutableStages(process, Arrays.asList("STAGE1", "STAGE2", "STAGE3"));
}
}
use of pipelite.stage.StageState in project pipelite by enasequence.
the class DependencyResolverTest method allActivePendingOthersDependOnFirstAllActive.
@Test
public void allActivePendingOthersDependOnFirstAllActive() {
for (StageState stageState : EnumSet.of(ACTIVE, PENDING)) {
ProcessBuilder builder = createProcessBuilder();
Process process = builder.execute("STAGE1").withSyncTestExecutor().executeAfter("STAGE2", "STAGE1").withSyncTestExecutor().executeAfter("STAGE3", "STAGE1").withSyncTestExecutor().build();
Set<Stage> stages = process.getStages();
for (Stage stage : process.getStages()) {
simulateStageExecution(stage, stageState);
}
assertGetDependsOnStages(process, "STAGE1", Collections.emptyList());
assertGetDependsOnStages(process, "STAGE2", Arrays.asList("STAGE1"));
assertGetDependsOnStages(process, "STAGE3", Arrays.asList("STAGE1"));
assertGetDependsOnStagesDirectly(process, "STAGE1", Collections.emptyList());
assertGetDependsOnStagesDirectly(process, "STAGE2", Arrays.asList("STAGE1"));
assertGetDependsOnStagesDirectly(process, "STAGE3", Arrays.asList("STAGE1"));
assertGetDependentStages(process, "STAGE1", Arrays.asList("STAGE2", "STAGE3"));
assertGetDependentStages(process, "STAGE2", Collections.emptyList());
assertGetDependentStages(process, "STAGE3", Collections.emptyList());
assertGetPermanentFailedStages(stages, Collections.emptyList());
assertGetImmediatelyExecutableStages(process, Arrays.asList("STAGE1"));
assertGetEventuallyExecutableStages(process, Arrays.asList("STAGE1", "STAGE2", "STAGE3"));
}
}
use of pipelite.stage.StageState in project pipelite by enasequence.
the class DependencyResolverTest method othersActivePendingIndependentOneErrorMaxRetriesLeft.
@Test
public void othersActivePendingIndependentOneErrorMaxRetriesLeft() {
for (StageState stageState : EnumSet.of(ACTIVE, PENDING)) {
ProcessBuilder builder = createProcessBuilder();
Process process = builder.execute("STAGE1").withSyncTestExecutor(StageExecutorState.ERROR, ExecutorParameters.builder().maximumRetries(1).immediateRetries(0).build()).execute("STAGE2").withSyncTestExecutor().execute("STAGE3").withSyncTestExecutor().execute("STAGE4").withSyncTestExecutor().build();
Set<Stage> stages = process.getStages();
int stageNumber = 0;
for (Stage stage : process.getStages()) {
if (stageNumber == 0) {
simulateStageExecution(stage, StageState.ERROR);
} else {
simulateStageExecution(stage, stageState);
}
stageNumber++;
}
assertGetDependsOnStages(process, "STAGE1", Collections.emptyList());
assertGetDependsOnStages(process, "STAGE2", Collections.emptyList());
assertGetDependsOnStages(process, "STAGE3", Collections.emptyList());
assertGetDependsOnStages(process, "STAGE4", Collections.emptyList());
assertGetDependsOnStagesDirectly(process, "STAGE1", Collections.emptyList());
assertGetDependsOnStagesDirectly(process, "STAGE2", Collections.emptyList());
assertGetDependsOnStagesDirectly(process, "STAGE3", Collections.emptyList());
assertGetDependsOnStagesDirectly(process, "STAGE4", Collections.emptyList());
assertGetDependentStages(process, "STAGE1", Collections.emptyList());
assertGetDependentStages(process, "STAGE2", Collections.emptyList());
assertGetDependentStages(process, "STAGE3", Collections.emptyList());
assertGetDependentStages(process, "STAGE4", Collections.emptyList());
assertGetPermanentFailedStages(stages, Collections.emptyList());
assertGetImmediatelyExecutableStages(process, Arrays.asList("STAGE2", "STAGE3", "STAGE4"));
assertGetEventuallyExecutableStages(process, Arrays.asList("STAGE1", "STAGE2", "STAGE3", "STAGE4"));
}
}
Aggregations