private void preparePipeline() { trace = mockPipelineExecutionTrace(EXECUTION_ID, mockPipeline(PIPELINE_NAME, STAGE_NUMBER), mock(PipelineStatus.class), mock(PipelineStatus.class)); item = new RuntimeListItem(RUNTIME_NAME, trace); presenter.setup(item); } }
private void prepareRuntime() { runtime = mockRuntime(); item = new RuntimeListItem(RUNTIME_NAME, runtime); presenter.setup(item); }
private void preparePipeline() { trace = mockPipelineExecutionTrace(EXECUTION_ID, mockPipeline(PIPELINE_NAME, STAGE_NUMBER), mock(PipelineStatus.class), mock(PipelineStatus.class)); item = new RuntimeListItem(RUNTIME_NAME, trace); presenter.setup(item); } }
private void prepareRuntime() { runtime = mockRuntime(); item = new RuntimeListItem(RUNTIME_NAME, runtime); presenter.setup(item); }
@Test public void testOnOtherPipelineExecutionStopped() { preparePipelineExecutionTraceSetup(); PipelineExecutionTraceKey otherKey = mock(PipelineExecutionTraceKey.class); RuntimeListItem item = new RuntimeListItem(RUNTIME_NAME, trace); presenter.setup(item); presenter.onPipelineExecutionChange(new PipelineExecutionChangeEvent(PipelineExecutionChange.STOPPED, otherKey)); verify(presenter, never()).refresh(any(PipelineExecutionTraceKey.class)); }
/** * Tests the case when the item is a Runtime with no pipeline execution trace. */ @Test public void testSetupRuntimeWithNoTrace() { runtime = mockRuntime(); item = new RuntimeListItem(RUNTIME_NAME, runtime); presenter.setup(item); verify(pipelinePresenter, times(1)).clearStages(); verify(view, times(1)).setup(RUNTIME_NAME, CREATED_DATE, DEFAULT_PIPELINE_NAME); verify(view, times(1)).setEndpoint(ENDPOINT); verify(pipelinePresenter, never()).addStage(any(IsElement.class)); }
/** * Tests the case when the item is a Runtime with no pipeline execution trace. */ @Test public void testSetupRuntimeWithNoTrace() { runtime = mockRuntime(); item = new RuntimeListItem(RUNTIME_NAME, runtime); presenter.setup(item); verify(pipelinePresenter, times(1)).clearStages(); verify(view, times(1)).setup(RUNTIME_NAME, CREATED_DATE, DEFAULT_PIPELINE_NAME); verify(view, times(1)).setEndpoint(ENDPOINT); verify(pipelinePresenter, never()).addStage(any(IsElement.class)); }
@Test public void testOnOtherPipelineExecutionStopped() { preparePipelineExecutionTraceSetup(); PipelineExecutionTraceKey otherKey = mock(PipelineExecutionTraceKey.class); RuntimeListItem item = new RuntimeListItem(RUNTIME_NAME, trace); presenter.setup(item); presenter.onPipelineExecutionChange(new PipelineExecutionChangeEvent(PipelineExecutionChange.STOPPED, otherKey)); verify(presenter, never()).refresh(any(PipelineExecutionTraceKey.class)); }
private void prepareRuntimeActionsSetupTest(final String status) { runtime = mockRuntime(); runtime.setStatus(status); item = new RuntimeListItem(RUNTIME_NAME, runtime); presenter.setup(item); }
private void preparePipelineActionsSetupTest(final PipelineStatus status) { preparePipelineExecutionTraceSetup(); trace.setPipelineStatus(status); RuntimeListItem item = new RuntimeListItem(RUNTIME_NAME, trace); presenter.setup(item); }
private void preparePipelineActionsSetupTest(final PipelineStatus status) { preparePipelineExecutionTraceSetup(); trace.setPipelineStatus(status); RuntimeListItem item = new RuntimeListItem(RUNTIME_NAME, trace); presenter.setup(item); }
private void prepareRuntimeActionsSetupTest(final String status) { runtime = mockRuntime(); runtime.setStatus(status); item = new RuntimeListItem(RUNTIME_NAME, runtime); presenter.setup(item); }
/** * Tests the case when the item is a PipelineExecutionTrace execution trace. */ @Test public void testSetupPipelineExecutionTrace() { preparePipelineExecutionTraceSetup(); RuntimeListItem item = new RuntimeListItem(RUNTIME_NAME, trace); presenter.setup(item); verify(pipelinePresenter, times(2)).clearStages(); verify(view, times(1)).setup(RUNTIME_NAME, "", PIPELINE_NAME); verifyPipelineWasSet(trace, displayableStages); }
/** * Tests the case when the item is a PipelineExecutionTrace execution trace. */ @Test public void testSetupPipelineExecutionTrace() { preparePipelineExecutionTraceSetup(); RuntimeListItem item = new RuntimeListItem(RUNTIME_NAME, trace); presenter.setup(item); verify(pipelinePresenter, times(2)).clearStages(); verify(view, times(1)).setup(RUNTIME_NAME, "", PIPELINE_NAME); verifyPipelineWasSet(trace, displayableStages); }
@Test public void testOnCurrentPipelineExecutionStopped() { preparePipelineExecutionTraceSetup(); PipelineExecutionTraceKey currentKey = trace.getKey(); RuntimeListItem item = new RuntimeListItem(RUNTIME_NAME, trace); presenter.setup(item); presenter.onPipelineExecutionChange(new PipelineExecutionChangeEvent(PipelineExecutionChange.STOPPED, currentKey)); verify(presenter, times(1)).refresh(currentKey); }
/** * an item with a pipeline execution trace was initially set and a new stage status not yet drawn has changed. */ @Test public void testOnStageStatusChangeNewStageChanged() { preparePipelineExecutionTraceSetup(); RuntimeListItem item = new RuntimeListItem(RUNTIME_NAME, trace); //setup the presenter. presenter.setup(item); int initialStagePresentersSize = stagePresenters.size(); //emulate the next stage consecutive stage finishing. Stage stage = item.getPipelineTrace().getPipeline().getStages().get(displayableStages.size()); presenter.onStageStatusChange(new StageStatusChangeEvent(trace.getKey(), stage.getName(), PipelineStatus.RUNNING)); //an additional stage was added. verify(stagePresenterInstance, times(initialStagePresentersSize + 1)).get(); //the newly stage is set to EXECUTING in the UI StagePresenter stagePresenter = stagePresenters.get(stagePresenters.size() - 1); verify(stagePresenter, times(1)).setup(stage); verify(stagePresenter, times(1)).setState(State.EXECUTING); }
@Test public void testOnCurrentPipelineExecutionStopped() { preparePipelineExecutionTraceSetup(); PipelineExecutionTraceKey currentKey = trace.getKey(); RuntimeListItem item = new RuntimeListItem(RUNTIME_NAME, trace); presenter.setup(item); presenter.onPipelineExecutionChange(new PipelineExecutionChangeEvent(PipelineExecutionChange.STOPPED, currentKey)); verify(presenter, times(1)).refresh(currentKey); }
@Test public void testOnPipelineStatusChange() { preparePipelineExecutionTraceSetup(); RuntimeListItem item = new RuntimeListItem(RUNTIME_NAME, trace); //setup the presenter. presenter.setup(item); //the pipeline finishes presenter.onPipelineStatusChange(new PipelineStatusChangeEvent(trace.getKey(), PipelineStatus.FINISHED)); verify(view, times(1)).setStatus(RuntimePresenterHelper.buildIconStyle(PipelineStatus.FINISHED)); }
@Test public void testShowPipelineExecutionError() { trace = mockPipelineExecutionTrace(EXECUTION_ID, mockPipeline(PIPELINE_NAME, STAGE_NUMBER), mock(PipelineStatus.class), mock(PipelineStatus.class)); trace.setPipelineStatus(PipelineStatus.ERROR); trace.setPipelineError(new PipelineError(PIPELINE_ERROR, PIPELINE_ERROR_DETAIL)); item = new RuntimeListItem(RUNTIME_NAME, trace); presenter.setup(item); presenter.showPipelineError(); verify(popupHelper, times(1)).showErrorPopup(PIPELINE_ERROR, PIPELINE_ERROR_DETAIL); }
@Test public void testOnPipelineStatusChange() { preparePipelineExecutionTraceSetup(); RuntimeListItem item = new RuntimeListItem(RUNTIME_NAME, trace); //setup the presenter. presenter.setup(item); //the pipeline finishes presenter.onPipelineStatusChange(new PipelineStatusChangeEvent(trace.getKey(), PipelineStatus.FINISHED)); verify(view, times(1)).setStatus(RuntimePresenterHelper.buildIconStyle(PipelineStatus.FINISHED)); }