@Test public void testStopPipelineConfirmNo() { preparePipelineStop(); noCommandCaptor.getValue().execute(); verify(runtimeService, never()).stopPipelineExecution(any(PipelineExecutionTraceKey.class)); }
@Test public void testStopPipelineConfirmNo() { preparePipelineStop(); noCommandCaptor.getValue().execute(); verify(runtimeService, never()).stopPipelineExecution(any(PipelineExecutionTraceKey.class)); }
@Test public void testStopPipelineConfirmYesAndFailed() { preparePipelineStop(); PipelineExecutionTraceKey currentKey = trace.getKey(); doThrow(new RuntimeException(ERROR_MESSAGE)) .when(runtimeService) .stopPipelineExecution(currentKey); yesCommandCaptor.getValue().execute(); verify(runtimeService, times(1)).stopPipelineExecution(currentKey); verify(defaultErrorCallback, times(1)).error(any(Message.class), exceptionCaptor.capture()); assertEquals(ERROR_MESSAGE, exceptionCaptor.getValue().getMessage()); }
@Test public void testStopPipelineConfirmYesAndFailed() { preparePipelineStop(); PipelineExecutionTraceKey currentKey = trace.getKey(); doThrow(new RuntimeException(ERROR_MESSAGE)) .when(runtimeService) .stopPipelineExecution(currentKey); yesCommandCaptor.getValue().execute(); verify(runtimeService, times(1)).stopPipelineExecution(currentKey); verify(defaultErrorCallback, times(1)).error(any(Message.class), exceptionCaptor.capture()); assertEquals(ERROR_MESSAGE, exceptionCaptor.getValue().getCause().getMessage()); }
@Test public void testStopPipelineConfirmYesButWasARuntime() { prepareRuntime(); when(translationService.getTranslation(RuntimePresenter_PipelineExecutionConfirmStopTitle)).thenReturn(TITLE); when(translationService.getTranslation(RuntimePresenter_PipelineExecutionConfirmStopMessage)).thenReturn(CONFIRM_MESSAGE); when(translationService.getTranslation(RuntimePresenter_PipelineExecutionAlreadyStoppedMessage)).thenReturn(ERROR_MESSAGE); presenter.stopPipeline(); verify(popupHelper, times(1)).showYesNoPopup(eq(TITLE), eq(CONFIRM_MESSAGE), yesCommandCaptor.capture(), noCommandCaptor.capture()); //say yes yesCommandCaptor.getValue().execute(); verify(popupHelper, times(1)).showInformationPopup(ERROR_MESSAGE); verify(runtimeService, never()).stopPipelineExecution(any(PipelineExecutionTraceKey.class)); }
@Test public void testStopPipelineConfirmYesButWasARuntime() { prepareRuntime(); when(translationService.getTranslation(RuntimePresenter_PipelineExecutionConfirmStopTitle)).thenReturn(TITLE); when(translationService.getTranslation(RuntimePresenter_PipelineExecutionConfirmStopMessage)).thenReturn(CONFIRM_MESSAGE); when(translationService.getTranslation(RuntimePresenter_PipelineExecutionAlreadyStoppedMessage)).thenReturn(ERROR_MESSAGE); presenter.stopPipeline(); verify(popupHelper, times(1)).showYesNoPopup(eq(TITLE), eq(CONFIRM_MESSAGE), yesCommandCaptor.capture(), noCommandCaptor.capture()); //say yes yesCommandCaptor.getValue().execute(); verify(popupHelper, times(1)).showInformationPopup(ERROR_MESSAGE); verify(runtimeService, never()).stopPipelineExecution(any(PipelineExecutionTraceKey.class)); }
@Test public void testStopPipelineExecution() { PipelineExecutionTraceKey pipelineExecutionTraceKey = new PipelineExecutionTraceKey(PIPELINE_EXECUTION_ID); service.stopPipelineExecution(pipelineExecutionTraceKey); verify(pipelineService, times(1)).stopPipelineExecution(PIPELINE_EXECUTION_ID); verify(pipelineExecutionChangeEvent, times(1)).fire(new PipelineExecutionChangeEvent(PipelineExecutionChange.STOPPED, pipelineExecutionTraceKey)); }
@Test public void testStopPipelineExecution() { PipelineExecutionTraceKey pipelineExecutionTraceKey = new PipelineExecutionTraceKey(PIPELINE_EXECUTION_ID); service.stopPipelineExecution(pipelineExecutionTraceKey); verify(pipelineService, times(1)).stopPipelineExecution(PIPELINE_EXECUTION_ID); verify(pipelineExecutionChangeEvent, times(1)).fire(new PipelineExecutionChangeEvent(PipelineExecutionChange.STOPPED, pipelineExecutionTraceKey)); }
@Test public void testStopPipelineConfirmYesAndSuccessful() { preparePipelineStop(); PipelineExecutionTraceKey currentKey = trace.getKey(); when(translationService.format(RuntimePresenter_PipelineExecutionStopSuccessMessage, currentKey.getId())).thenReturn(SUCCESS_MESSAGE); yesCommandCaptor.getValue().execute(); verify(runtimeService, times(1)).stopPipelineExecution(currentKey); verify(notificationEvent, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS)); }
@Test public void testStopPipelineConfirmYesAndSuccessful() { preparePipelineStop(); PipelineExecutionTraceKey currentKey = trace.getKey(); when(translationService.format(RuntimePresenter_PipelineExecutionStopSuccessMessage, currentKey.getId())).thenReturn(SUCCESS_MESSAGE); yesCommandCaptor.getValue().execute(); verify(runtimeService, times(1)).stopPipelineExecution(currentKey); verify(notificationEvent, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS)); }
protected void stopPipeline() { confirmAndExecute(translationService.getTranslation(RuntimePresenter_PipelineExecutionConfirmStopTitle), translationService.getTranslation(RuntimePresenter_PipelineExecutionConfirmStopMessage), () -> { if (item.isRuntime()) { popupHelper.showInformationPopup(translationService.getTranslation(RuntimePresenter_PipelineExecutionAlreadyStoppedMessage)); } else { runtimeService.call(getStopPipelineSuccessCallback(), getDefaultErrorCallback()).stopPipelineExecution(item.getPipelineTrace().getKey()); } }); }
protected void stopPipeline() { confirmAndExecute(translationService.getTranslation(RuntimePresenter_PipelineExecutionConfirmStopTitle), translationService.getTranslation(RuntimePresenter_PipelineExecutionConfirmStopMessage), () -> { if (item.isRuntime()) { popupHelper.showInformationPopup(translationService.getTranslation(RuntimePresenter_PipelineExecutionAlreadyStoppedMessage)); } else { runtimeService.call(getStopPipelineSuccessCallback(), getDefaultErrorCallback()).stopPipelineExecution(item.getPipelineTrace().getKey()); } }); }