Search in sources :

Example 1 with Stage

use of org.guvnor.ala.pipeline.Stage in project kie-wb-common by kiegroup.

the class PipelineExecutorTaskManagerImplTestBase method mockStages.

public static List<Stage> mockStages(int count) {
    List<Stage> result = new ArrayList<>();
    for (int i = 0; i < count; i++) {
        Stage stage = mock(Stage.class);
        when(stage.getName()).thenReturn("Stage.name." + Integer.toString(i));
        result.add(stage);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) Stage(org.guvnor.ala.pipeline.Stage)

Example 2 with Stage

use of org.guvnor.ala.pipeline.Stage in project kie-wb-common by kiegroup.

the class PipelineExecutorTraceImplMarshallerTest method getValue.

@Override
public PipelineExecutorTraceImpl getValue() {
    // only the stage names are used by the taskDef, so the pipeline can be mocked.
    List<Stage> stages = mockStages(STAGE_COUNT);
    Pipeline pipeline = new BasePipeline(PIPELINE_NAME, stages) {
    };
    Input input = mockInput(PIPELINE_INPUT_SIZE);
    PipelineExecutorTaskDefImpl taskDef = new PipelineExecutorTaskDefImpl(pipeline, input);
    PipelineExecutorTaskImpl taskImpl = new PipelineExecutorTaskImpl(taskDef, PIPELINE_EXECUTION_ID);
    taskImpl.setPipelineStatus(PipelineExecutorTask.Status.SCHEDULED);
    taskImpl.setPipelineError(mockError(PIPELINE_ERROR, PIPELINE_ERROR_DETAIL));
    taskImpl.getTaskDef().getStages().forEach(stage -> taskImpl.setStageError(stage, mockStageError(stage)));
    taskImpl.setOutput(new MockPipelineOutput(PIPELINE_OUTPUT));
    return new PipelineExecutorTraceImpl(taskImpl);
}
Also used : PipelineExecutorTaskDefImpl(org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTaskDefImpl) Input(org.guvnor.ala.pipeline.Input) PipelineExecutorTaskImpl(org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTaskImpl) PipelineExecutorTraceImpl(org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTraceImpl) Stage(org.guvnor.ala.pipeline.Stage) BasePipeline(org.guvnor.ala.pipeline.impl.BasePipeline) BasePipeline(org.guvnor.ala.pipeline.impl.BasePipeline) Pipeline(org.guvnor.ala.pipeline.Pipeline)

Example 3 with Stage

use of org.guvnor.ala.pipeline.Stage in project kie-wb-common by kiegroup.

the class PipelineExecutorTraceImplMarshallerTest method mockStages.

private List<Stage> mockStages(int count) {
    List<Stage> stages = new ArrayList<>();
    for (int i = 0; i < count; i++) {
        Stage stage = mock(Stage.class);
        when(stage.getName()).thenReturn("Stage.name." + Integer.toString(i));
        stages.add(stage);
    }
    return stages;
}
Also used : ArrayList(java.util.ArrayList) Stage(org.guvnor.ala.pipeline.Stage)

Example 4 with Stage

use of org.guvnor.ala.pipeline.Stage in project kie-wb-common by kiegroup.

the class PipelineExecutionListenerTest method setUp.

@Before
public void setUp() {
    traceKey = new PipelineExecutionTraceKey(EXECUTION_ID);
    pipeline = mock(Pipeline.class);
    stage = mock(Stage.class);
    when(stage.getName()).thenReturn(STAGE_NAME);
    throwable = mock(Throwable.class);
    listener = new PipelineExecutionListener(pipelineStatusChangeEvent, stageStatusChangeEvent);
}
Also used : Stage(org.guvnor.ala.pipeline.Stage) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey) Pipeline(org.guvnor.ala.pipeline.Pipeline) Before(org.junit.Before)

Aggregations

Stage (org.guvnor.ala.pipeline.Stage)4 ArrayList (java.util.ArrayList)2 Pipeline (org.guvnor.ala.pipeline.Pipeline)2 Input (org.guvnor.ala.pipeline.Input)1 PipelineExecutorTaskDefImpl (org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTaskDefImpl)1 PipelineExecutorTaskImpl (org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTaskImpl)1 PipelineExecutorTraceImpl (org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTraceImpl)1 BasePipeline (org.guvnor.ala.pipeline.impl.BasePipeline)1 PipelineExecutionTraceKey (org.guvnor.ala.ui.model.PipelineExecutionTraceKey)1 Before (org.junit.Before)1