private void prepareRuntimeDelete() { prepareRuntime(); when(translationService.getTranslation(RuntimePresenter_RuntimeConfirmDeleteTitle)).thenReturn(TITLE); when(translationService.getTranslation(RuntimePresenter_RuntimeConfirmDeleteMessage)).thenReturn(CONFIRM_MESSAGE); presenter.deleteRuntime(); verify(popupHelper, times(1)).showYesNoPopup(eq(TITLE), eq(CONFIRM_MESSAGE), yesCommandCaptor.capture(), noCommandCaptor.capture()); }
private void prepareRuntimeDelete() { prepareRuntime(); when(translationService.getTranslation(RuntimePresenter_RuntimeConfirmDeleteTitle)).thenReturn(TITLE); when(translationService.getTranslation(RuntimePresenter_RuntimeConfirmDeleteMessage)).thenReturn(CONFIRM_MESSAGE); presenter.deleteRuntime(); verify(popupHelper, times(1)).showYesNoPopup(eq(TITLE), eq(CONFIRM_MESSAGE), yesCommandCaptor.capture(), noCommandCaptor.capture()); }
private void prepareRuntimeForceDelete() { prepareRuntime(); when(translationService.getTranslation(RuntimePresenter_RuntimeConfirmForcedDeleteTitle)).thenReturn(TITLE); when(translationService.getTranslation(RuntimePresenter_RuntimeConfirmForcedDeleteMessage)).thenReturn(CONFIRM_MESSAGE); presenter.forceDeleteRuntime(); verify(popupHelper, times(1)).showYesNoPopup(eq(TITLE), eq(CONFIRM_MESSAGE), yesCommandCaptor.capture(), noCommandCaptor.capture()); }
private void prepareRuntimeStop() { prepareRuntime(); when(translationService.getTranslation(RuntimePresenter_RuntimeConfirmStopTitle)).thenReturn(TITLE); when(translationService.getTranslation(RuntimePresenter_RuntimeConfirmStopMessage)).thenReturn(CONFIRM_MESSAGE); presenter.stopRuntime(); verify(popupHelper, times(1)).showYesNoPopup(eq(TITLE), eq(CONFIRM_MESSAGE), yesCommandCaptor.capture(), noCommandCaptor.capture()); }
private void prepareRuntimeForceDelete() { prepareRuntime(); when(translationService.getTranslation(RuntimePresenter_RuntimeConfirmForcedDeleteTitle)).thenReturn(TITLE); when(translationService.getTranslation(RuntimePresenter_RuntimeConfirmForcedDeleteMessage)).thenReturn(CONFIRM_MESSAGE); presenter.forceDeleteRuntime(); verify(popupHelper, times(1)).showYesNoPopup(eq(TITLE), eq(CONFIRM_MESSAGE), yesCommandCaptor.capture(), noCommandCaptor.capture()); }
private void prepareRuntimeStop() { prepareRuntime(); when(translationService.getTranslation(RuntimePresenter_RuntimeConfirmStopTitle)).thenReturn(TITLE); when(translationService.getTranslation(RuntimePresenter_RuntimeConfirmStopMessage)).thenReturn(CONFIRM_MESSAGE); presenter.stopRuntime(); verify(popupHelper, times(1)).showYesNoPopup(eq(TITLE), eq(CONFIRM_MESSAGE), yesCommandCaptor.capture(), noCommandCaptor.capture()); }
@Test public void testOnOtherRuntimeStarted() { prepareRuntime(); RuntimeKey otherKey = mock(RuntimeKey.class); presenter.onRuntimeChangeEvent(new RuntimeChangeEvent(RuntimeChange.STARTED, otherKey)); verify(presenter, never()).refresh(any(RuntimeKey.class)); }
@Test public void testOnOtherRuntimeStopped() { prepareRuntime(); RuntimeKey otherKey = mock(RuntimeKey.class); presenter.onRuntimeChangeEvent(new RuntimeChangeEvent(RuntimeChange.STOPPED, otherKey)); verify(presenter, never()).refresh(any(RuntimeKey.class)); }
@Test public void testOnOtherRuntimeStarted() { prepareRuntime(); RuntimeKey otherKey = mock(RuntimeKey.class); presenter.onRuntimeChangeEvent(new RuntimeChangeEvent(RuntimeChange.STARTED, otherKey)); verify(presenter, never()).refresh(any(RuntimeKey.class)); }
@Test public void testOnOtherRuntimeStopped() { prepareRuntime(); RuntimeKey otherKey = mock(RuntimeKey.class); presenter.onRuntimeChangeEvent(new RuntimeChangeEvent(RuntimeChange.STOPPED, otherKey)); verify(presenter, never()).refresh(any(RuntimeKey.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 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 testStartRuntimeFailed() { prepareRuntime(); RuntimeKey currentKey = runtime.getKey(); doThrow(new RuntimeException(ERROR_MESSAGE)) .when(runtimeService) .startRuntime(currentKey); when(translationService.getTranslation(RuntimePresenter_RuntimeStartingMessage)).thenReturn(BUSY_POPUP_MESSAGE); presenter.startRuntime(); verify(popupHelper, times(1)).showBusyIndicator(BUSY_POPUP_MESSAGE); verify(popupHelper, times(1)).hideBusyIndicator(); verify(notificationEvent, times(0)).fire(any(NotificationEvent.class)); verify(defaultErrorCallback, times(1)).error(any(Message.class), exceptionCaptor.capture()); assertEquals(ERROR_MESSAGE, exceptionCaptor.getValue().getCause().getMessage()); }
@Test public void testStartRuntimeSuccessful() { prepareRuntime(); RuntimeKey currentKey = runtime.getKey(); when(translationService.format(RuntimePresenter_RuntimeStartSuccessMessage, currentKey.getId())).thenReturn(SUCCESS_MESSAGE); when(translationService.getTranslation(RuntimePresenter_RuntimeStartingMessage)).thenReturn(BUSY_POPUP_MESSAGE); presenter.startRuntime(); verify(popupHelper, times(1)).showBusyIndicator(BUSY_POPUP_MESSAGE); verify(popupHelper, times(1)).hideBusyIndicator(); verify(notificationEvent, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS)); }
@Test public void testStartRuntimeFailed() { prepareRuntime(); RuntimeKey currentKey = runtime.getKey(); doThrow(new RuntimeException(ERROR_MESSAGE)) .when(runtimeService) .startRuntime(currentKey); when(translationService.getTranslation(RuntimePresenter_RuntimeStartingMessage)).thenReturn(BUSY_POPUP_MESSAGE); presenter.startRuntime(); verify(popupHelper, times(1)).showBusyIndicator(BUSY_POPUP_MESSAGE); verify(popupHelper, times(1)).hideBusyIndicator(); verify(notificationEvent, times(0)).fire(any(NotificationEvent.class)); verify(defaultErrorCallback, times(1)).error(any(Message.class), exceptionCaptor.capture()); assertEquals(ERROR_MESSAGE, exceptionCaptor.getValue().getMessage()); }
@Test public void testStartRuntimeSuccessful() { prepareRuntime(); RuntimeKey currentKey = runtime.getKey(); when(translationService.format(RuntimePresenter_RuntimeStartSuccessMessage, currentKey.getId())).thenReturn(SUCCESS_MESSAGE); when(translationService.getTranslation(RuntimePresenter_RuntimeStartingMessage)).thenReturn(BUSY_POPUP_MESSAGE); presenter.startRuntime(); verify(popupHelper, times(1)).showBusyIndicator(BUSY_POPUP_MESSAGE); verify(popupHelper, times(1)).hideBusyIndicator(); verify(notificationEvent, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS)); }
@Test public void testOnCurrentRuntimeStopped() { prepareRuntime(); RuntimeKey currentKey = runtime.getKey(); presenter.onRuntimeChangeEvent(new RuntimeChangeEvent(RuntimeChange.STOPPED, currentKey)); verify(presenter, times(1)).refresh(currentKey); }
@Test public void testOnCurrentRuntimeStarted() { prepareRuntime(); RuntimeKey currentKey = runtime.getKey(); presenter.onRuntimeChangeEvent(new RuntimeChangeEvent(RuntimeChange.STARTED, currentKey)); verify(presenter, times(1)).refresh(currentKey); }
@Test public void testOnCurrentRuntimeStopped() { prepareRuntime(); RuntimeKey currentKey = runtime.getKey(); presenter.onRuntimeChangeEvent(new RuntimeChangeEvent(RuntimeChange.STOPPED, currentKey)); verify(presenter, times(1)).refresh(currentKey); }
@Test public void testOnCurrentRuntimeStarted() { prepareRuntime(); RuntimeKey currentKey = runtime.getKey(); presenter.onRuntimeChangeEvent(new RuntimeChangeEvent(RuntimeChange.STARTED, currentKey)); verify(presenter, times(1)).refresh(currentKey); }