PipelineContext(final Pipeline pipeline) { this.pipeline = pipeline; this.iterator = pipeline.getStages().iterator(); }
PipelineContext(final Pipeline pipeline) { this.pipeline = pipeline; this.iterator = pipeline.getStages().iterator(); }
private PipelineExecutorTaskDefImpl(final Pipeline pipeline) { this.pipeline = pipeline.getName(); pipeline.getStages().forEach(stage -> stages.add(stage.getName())); }
private PipelineExecutorTaskDefImpl(final Pipeline pipeline) { this.pipeline = pipeline.getName(); pipeline.getStages().forEach(stage -> stages.add(stage.getName())); }
private void prepareExecution() { //mock the execution inputs pipeline = mock(Pipeline.class); stages = mockStages(PIPELINE_STAGES_SIZE); when(pipeline.getStages()).thenReturn(stages); when(pipeline.getName()).thenReturn(PIPELINE_ID); when(pipelineRegistry.getPipelineByName(PIPELINE_ID)).thenReturn(pipeline); taskDef = mock(PipelineExecutorTaskDef.class); input = mock(Input.class); when(taskDef.getInput()).thenReturn(input); when(taskDef.getPipeline()).thenReturn(PIPELINE_ID); }
private void prepareExecution() { //mock the execution inputs pipeline = mock(Pipeline.class); stages = mockStages(PIPELINE_STAGES_SIZE); when(pipeline.getStages()).thenReturn(stages); when(pipeline.getName()).thenReturn(PIPELINE_ID); when(pipelineRegistry.getPipelineByName(PIPELINE_ID)).thenReturn(pipeline); taskDef = mock(PipelineExecutorTaskDef.class); input = mock(Input.class); when(taskDef.getInput()).thenReturn(input); when(taskDef.getPipeline()).thenReturn(PIPELINE_ID); }
@Before public void setUp() { super.setUp(); error = mock(Throwable.class); when(error.getMessage()).thenReturn(ERROR_MESSAGE); pipelineExecutorExceptionCaptor = ArgumentCaptor.forClass(PipelineExecutorException.class); pipeline = mock(Pipeline.class); stages = mockStages(PIPELINE_STAGES_SIZE); when(pipeline.getStages()).thenReturn(stages); when(pipeline.getName()).thenReturn(PIPELINE_ID); when(pipelineRegistry.getPipelineByName(PIPELINE_ID)).thenReturn(pipeline); //pick an arbitrary stage for events testing. stage = stages.get(0); taskDef = mock(PipelineExecutorTaskDef.class); input = mock(Input.class); when(taskDef.getInput()).thenReturn(input); when(taskDef.getPipeline()).thenReturn(PIPELINE_ID); task = spy(taskManagerHelper.createTask(taskDef, TASK_ID)); taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class); when(taskEntry.getTask()).thenReturn(task); //emulate there's a running task. taskManager.currentTasks.put(TASK_ID, taskEntry); taskManager.init(); }
@Before public void setUp() { super.setUp(); error = mock(Throwable.class); when(error.getMessage()).thenReturn(ERROR_MESSAGE); pipelineExecutorErrorCaptor = ArgumentCaptor.forClass(PipelineExecutorError.class); pipeline = mock(Pipeline.class); stages = mockStages(PIPELINE_STAGES_SIZE); when(pipeline.getStages()).thenReturn(stages); when(pipeline.getName()).thenReturn(PIPELINE_ID); when(pipelineRegistry.getPipelineByName(PIPELINE_ID)).thenReturn(pipeline); //pick an arbitrary stage for events testing. stage = stages.get(0); taskDef = mock(PipelineExecutorTaskDef.class); input = mock(Input.class); when(taskDef.getInput()).thenReturn(input); when(taskDef.getPipeline()).thenReturn(PIPELINE_ID); task = spy(taskManagerHelper.createTask(taskDef, TASK_ID)); taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class); when(taskEntry.getTask()).thenReturn(task); //emulate there's a running task. taskManager.currentTasks.put(TASK_ID, taskEntry); taskManager.init(); }
times(4)).afterStageExecution(afterStageExecutionCaptor.capture()); for (int i = 0; i < pipe.getStages().size(); i++) { assertEquals(pipe.getStages().get(i), beforeStageExecutionCaptor.getAllValues().get(i).getStage()); assertEquals(pipe, beforeStageExecutionCaptor.getAllValues().get(i).getPipeline()); assertEquals(pipe.getStages().get(i), afterStageExecutionCaptor.getAllValues().get(i).getStage()); assertEquals(pipe,
when(task.getTaskDef()).thenReturn(taskDef); Pipeline pipeline = mock(Pipeline.class); when(pipeline.getStages()).thenReturn(mock(List.class)); when(taskDef.getPipeline()).thenReturn(PIPELINE_ID);
when(task.getTaskDef()).thenReturn(taskDef); Pipeline pipeline = mock(Pipeline.class); when(pipeline.getStages()).thenReturn(mock(List.class)); when(taskDef.getPipeline()).thenReturn(PIPELINE_ID);
List<Stage> stages = pipe.getStages(); assertEquals(4, stages.size());