private PipelineExecutorException mockStageError(String stage) { return mockError(buildStageErrorMessage(stage)); }
@Override public Marshaller<PipelineExecutorTraceImpl> createMarshaller() { return new PipelineExecutorTraceImplMarshaller(); }
private PipelineExecutorError mockStageError(String stage) { return mockError(buildStageErrorMessage(stage), buildStageErrorDetail(stage)); }
@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); }
@Override public void testUnMarshall() throws Exception { PipelineExecutorTraceImpl result = marshaller.unmarshal(getMarshalledValue()); PipelineExecutorTraceImpl expectedValue = getValue(); assertEqualsPipelineExecutorTrace(expectedValue, result); }
private void assertEqualsPipelineExecutorTrace(PipelineExecutorTraceImpl expectedValue, PipelineExecutorTraceImpl value) { assertEquals(expectedValue.getTaskId(), value.getTaskId()); assertEquals(expectedValue.getPipelineId(), value.getPipelineId()); assertEquals(expectedValue.getTask().getTaskDef(), value.getTask().getTaskDef()); assertEquals(expectedValue.getTask().getPipelineStatus(), value.getTask().getPipelineStatus()); assertEqualsPipelineExecutorException(expectedValue.getTask().getPipelineError(), value.getTask().getPipelineError()); for (String stage : expectedValue.getTask().getTaskDef().getStages()) { assertEquals(expectedValue.getTask().getStageStatus(stage), value.getTask().getStageStatus(stage)); assertEqualsPipelineExecutorException(expectedValue.getTask().getStageError(stage), value.getTask().getStageError(stage)); } assertEquals(expectedValue.getTask().getOutput(), value.getTask().getOutput()); }
@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)); taskImpl.getTaskDef().getStages().forEach(stage -> taskImpl.setStageError(stage, mockStageError(stage))); taskImpl.setOutput(new MockPipelineOutput(PIPELINE_OUTPUT)); return new PipelineExecutorTraceImpl(taskImpl); }
@Override public void testUnMarshall() throws Exception { PipelineExecutorTraceImpl result = marshaller.unmarshal(getMarshalledValue()); PipelineExecutorTraceImpl expectedValue = getValue(); assertEqualsPipelineExecutorTrace(expectedValue, result); }
@Override public Marshaller<PipelineExecutorTraceImpl> createMarshaller() { return new PipelineExecutorTraceImplMarshaller(); }