private void verifyPipelineActionsCommonSetup() { verify(view, times(1)).clearActionItems(); verify(stopActionPresenter, times(1)).setup(eq(STOP_PIPELINE_ACTION), any(Command.class)); verify(deleteActionPresenter, times(1)).setup(eq(DELETE_PIPELINE_ACTION), any(Command.class)); verify(showErrorActionPresenter, times(1)).setup(eq(SHOW_PIPELINE_ERROR_ACTION), any(Command.class)); verify(view, times(1)).addActionItem(stopActionPresenter.getView()); verify(view, times(1)).addActionItem(separatorPresenter.getView()); verify(view, times(1)).addActionItem(deleteActionPresenter.getView()); verify(view, never()).addActionItem(startActionPresenter.getView()); verify(stopActionPresenter, times(1)).setEnabled(false); verify(startActionPresenter, times(1)).setEnabled(false); verify(deleteActionPresenter, times(1)).setEnabled(false); }
presenter.init(); verify(view, times(1)).init(presenter); verify(actionItemPresenterInstance, times(3)).get();
/** * Tests the case when the item is a Runtime with pipeline execution trace. */ @Test public void testSetupRuntimeWithTrace() { runtime = mockRuntime(); preparePipelineExecutionTraceSetup(); item = new RuntimeListItem(RUNTIME_NAME, trace); //set the trace on the runtime. runtime.setPipelineTrace(trace); item = new RuntimeListItem(RUNTIME_NAME, runtime); presenter.setup(item); verify(pipelinePresenter, times(2)).clearStages(); verify(view, times(1)).setup(RUNTIME_NAME, CREATED_DATE, PIPELINE_NAME); verify(view, times(1)).setEndpoint(ENDPOINT); verifyPipelineWasSet(trace, displayableStages); }
presenter.init(); verify(view, times(1)).init(presenter); verify(actionItemPresenterInstance, times(4)).get();
private void processPipelineStatus(final PipelineStatus status) { view.clearActionItems(); enableActions(false, startAction, deleteAction, showErrorAction); view.addActionItem(stopAction.getView()); view.addActionItem(separator.getView()); view.addActionItem(deleteAction.getView()); case ERROR: deleteAction.setEnabled(true); view.addActionItem(secondarySeparator.getView()); view.addActionItem(showErrorAction.getView()); showErrorAction.setEnabled(true); break; view.setStatus(buildIconStyle(status)); view.setStatusTitle(status.name());
private void processPipelineStatus(final PipelineStatus status) { view.clearActionItems(); enableActions(false); view.addActionItem(stopAction.getView()); view.addActionItem(separator.getView()); view.addActionItem(deleteAction.getView()); stopAction.setup(translationService.getTranslation(RuntimePresenter_PipelineExecutionStopAction), this::stopPipeline); deleteAction.setup(translationService.getTranslation(RuntimePresenter_PipelineExecutionDeleteAction), this::deletePipeline); switch (status) { case SCHEDULED: case RUNNING: stopAction.setEnabled(true); break; case ERROR: case STOPPED: deleteAction.setEnabled(true); break; case FINISHED: if (item.getRuntime() == null) { deleteAction.setEnabled(true); } break; } view.setStatus(buildIconStyle(status)); view.setStatusTitle(status.name()); }
private void verifyRuntimeActionsCommonSetup() { verify(view, times(1)).clearActionItems(); verify(startActionPresenter, times(1)).setup(eq(START_RUNTIME_ACTION), any(Command.class)); verify(stopActionPresenter, times(1)).setup(eq(STOP_RUNTIME_ACTION), any(Command.class)); verify(deleteActionPresenter, times(1)).setup(eq(DELETE_RUNTIME_ACTION), any(Command.class)); verify(view, times(1)).addActionItem(stopActionPresenter.getView()); verify(view, times(1)).addActionItem(deleteActionPresenter.getView()); verify(view, times(1)).addActionItem(separatorPresenter.getView()); verify(view, times(1)).addActionItem(deleteActionPresenter.getView()); verify(stopActionPresenter, times(1)).setEnabled(true); verify(startActionPresenter, times(1)).setEnabled(true); verify(deleteActionPresenter, times(1)).setEnabled(true); } }
/** * Tests the case when the item is a Runtime with pipeline execution trace. */ @Test public void testSetupRuntimeWithTrace() { runtime = mockRuntime(); preparePipelineExecutionTraceSetup(); item = new RuntimeListItem(RUNTIME_NAME, trace); //set the trace on the runtime. runtime.setPipelineTrace(trace); item = new RuntimeListItem(RUNTIME_NAME, runtime); presenter.setup(item); verify(pipelinePresenter, times(2)).clearStages(); verify(view, times(1)).setup(RUNTIME_NAME, CREATED_DATE, PIPELINE_NAME); verify(view, times(1)).setEndpoint(ENDPOINT); verifyPipelineWasSet(trace, displayableStages); }
private void verifyPipelineActionsCommonSetup() { verify(view, times(1)).clearActionItems(); verify(stopActionPresenter, times(1)).setup(eq(STOP_PIPELINE_ACTION), any(Command.class)); verify(deleteActionPresenter, times(1)).setup(eq(DELETE_PIPELINE_ACTION), any(Command.class)); verify(view, times(1)).addActionItem(stopActionPresenter.getView()); verify(view, times(1)).addActionItem(separatorPresenter.getView()); verify(view, times(1)).addActionItem(deleteActionPresenter.getView()); verify(view, never()).addActionItem(startActionPresenter.getView()); verify(stopActionPresenter, times(1)).setEnabled(false); verify(startActionPresenter, times(1)).setEnabled(false); verify(deleteActionPresenter, times(1)).setEnabled(false); }
private void processRuntimeStatus(final Runtime runtime) { view.clearActionItems(); enableActions(true, startAction, stopAction, deleteAction); view.addActionItem(startAction.getView()); view.addActionItem(stopAction.getView()); view.addActionItem(separator.getView()); view.addActionItem(deleteAction.getView()); startAction.setup(translationService.getTranslation(RuntimePresenter_RuntimeStartAction), this::startRuntime); stopAction.setup(translationService.getTranslation(RuntimePresenter_RuntimeStopAction), this::stopRuntime); deleteAction.setup(translationService.getTranslation(RuntimePresenter_RuntimeDeleteAction), this::deleteRuntime); RuntimeStatus runtimeStatus = buildRuntimeStatus(runtime.getStatus()); if (RUNNING == runtimeStatus) { startAction.setEnabled(false); } if (STOPPED == runtimeStatus || READY == runtimeStatus) { stopAction.setEnabled(false); } view.setStatus(buildIconStyle(runtimeStatus)); view.setStatusTitle(runtime.getStatus()); }
private void verifyRuntimeActionsCommonSetup() { verify(view, times(1)).clearActionItems(); verify(startActionPresenter, times(1)).setup(eq(START_RUNTIME_ACTION), any(Command.class)); verify(stopActionPresenter, times(1)).setup(eq(STOP_RUNTIME_ACTION), any(Command.class)); verify(deleteActionPresenter, times(1)).setup(eq(DELETE_RUNTIME_ACTION), any(Command.class)); verify(view, times(1)).addActionItem(stopActionPresenter.getView()); verify(view, times(1)).addActionItem(deleteActionPresenter.getView()); verify(view, times(1)).addActionItem(separatorPresenter.getView()); verify(view, times(1)).addActionItem(deleteActionPresenter.getView()); verify(stopActionPresenter, times(1)).setEnabled(true); verify(startActionPresenter, times(1)).setEnabled(true); verify(deleteActionPresenter, times(1)).setEnabled(true); } }
private void processRuntimeStatus(final Runtime runtime) { view.clearActionItems(); enableActions(true); view.addActionItem(startAction.getView()); view.addActionItem(stopAction.getView()); view.addActionItem(separator.getView()); view.addActionItem(deleteAction.getView()); startAction.setup(translationService.getTranslation(RuntimePresenter_RuntimeStartAction), this::startRuntime); stopAction.setup(translationService.getTranslation(RuntimePresenter_RuntimeStopAction), this::stopRuntime); deleteAction.setup(translationService.getTranslation(RuntimePresenter_RuntimeDeleteAction), this::deleteRuntime); RuntimeStatus runtimeStatus = buildRuntimeStatus(runtime.getStatus()); if (RUNNING == runtimeStatus) { startAction.setEnabled(false); } if (STOPPED == runtimeStatus || READY == runtimeStatus) { stopAction.setEnabled(false); } view.setStatus(buildIconStyle(runtimeStatus)); view.setStatusTitle(runtime.getStatus()); }
private void setupRuntime(RuntimeListItem item) { String itemLabel = item.getItemLabel(); String pipelineName = SYSTEM_PIPELINE_NAME; String createdDate = item.getRuntime().getCreatedDate(); String endpoint = ""; Runtime runtime = item.getRuntime(); PipelineExecutionTrace trace = runtime.getPipelineTrace(); if (trace != null) { pipelineName = trace.getPipeline().getKey().getId(); setupPipeline(trace); } view.setup(itemLabel, createdDate, pipelineName); if (runtime.getEndpoint() != null) { endpoint = runtime.getEndpoint(); } view.setEndpoint(endpoint); processRuntimeStatus(runtime); }
/** * 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); }
private void setupRuntime(RuntimeListItem item) { String itemLabel = item.getItemLabel(); String pipelineName = SYSTEM_PIPELINE_NAME; String createdDate = item.getRuntime().getCreatedDate(); String endpoint = ""; Runtime runtime = item.getRuntime(); PipelineExecutionTrace trace = runtime.getPipelineTrace(); if (trace != null) { pipelineName = trace.getPipeline().getKey().getId(); setupPipeline(trace); } view.setup(itemLabel, createdDate, pipelineName); if (runtime.getEndpoint() != null) { endpoint = runtime.getEndpoint(); } view.setEndpoint(endpoint); processRuntimeStatus(runtime); }
/** * 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)); }
/** * 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 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 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)); }