Search in sources :

Example 11 with RuntimeKey

use of org.guvnor.ala.ui.model.RuntimeKey in project kie-wb-common by kiegroup.

the class RuntimePresenterActionsTest method testStopRuntimeConfirmYesAndSuccessful.

@Test
public void testStopRuntimeConfirmYesAndSuccessful() {
    prepareRuntimeStop();
    RuntimeKey currentKey = runtime.getKey();
    when(translationService.format(RuntimePresenter_RuntimeStopSuccessMessage, item.getRuntime().getKey().getId())).thenReturn(SUCCESS_MESSAGE);
    when(translationService.getTranslation(RuntimePresenter_RuntimeStoppingMessage)).thenReturn(BUSY_POPUP_MESSAGE);
    yesCommandCaptor.getValue().execute();
    verify(runtimeService, times(1)).stopRuntime(currentKey);
    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));
}
Also used : RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Example 12 with RuntimeKey

use of org.guvnor.ala.ui.model.RuntimeKey in project kie-wb-common by kiegroup.

the class RuntimePresenterActionsTest method testStartRuntimeFailed.

@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());
}
Also used : RuntimePresenter_RuntimeDeletingForcedMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeletingForcedMessage) RuntimePresenter_RuntimeDeleteFailedMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeleteFailedMessage) RuntimePresenter_PipelineExecutionAlreadyStoppedMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionAlreadyStoppedMessage) RuntimePresenter_PipelineExecutionDeleteSuccessMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionDeleteSuccessMessage) RuntimePresenter_PipelineExecutionStopSuccessMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionStopSuccessMessage) RuntimePresenter_RuntimeDeleteSuccessMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeleteSuccessMessage) RuntimePresenter_RuntimeDeletingMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeletingMessage) RuntimePresenter_RuntimeConfirmForcedDeleteMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmForcedDeleteMessage) RuntimePresenter_RuntimeStopSuccessMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStopSuccessMessage) RuntimePresenter_RuntimeConfirmDeleteMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmDeleteMessage) RuntimePresenter_PipelineExecutionConfirmDeleteMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionConfirmDeleteMessage) RuntimePresenter_PipelineExecutionConfirmStopMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionConfirmStopMessage) RuntimePresenter_RuntimeConfirmStopMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmStopMessage) Message(org.jboss.errai.bus.client.api.messaging.Message) RuntimePresenter_RuntimeStartingMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStartingMessage) RuntimePresenter_RuntimeStoppingMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStoppingMessage) RuntimePresenter_RuntimeStartSuccessMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStartSuccessMessage) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Example 13 with RuntimeKey

use of org.guvnor.ala.ui.model.RuntimeKey in project kie-wb-common by kiegroup.

the class RuntimePresenterActionsTest method testDeleteRuntimeConfirmYesAndFailedAndDontForceDeletion.

@Test
public void testDeleteRuntimeConfirmYesAndFailedAndDontForceDeletion() {
    prepareRuntimeDelete();
    RuntimeKey currentKey = runtime.getKey();
    RuntimeException deleteException = new RuntimeException(ERROR_MESSAGE);
    // needs to use null instead of ERROR_MESSAGE because of the CallerMock
    when(translationService.format(RuntimePresenter_RuntimeDeleteFailedMessage, null)).thenReturn(CONFIRM_MESSAGE_2);
    when(translationService.getTranslation(RuntimePresenter_RuntimeDeleteFailedTitle)).thenReturn(TITLE_2);
    when(translationService.getTranslation(RuntimePresenter_RuntimeDeletingMessage)).thenReturn(BUSY_POPUP_MESSAGE);
    doThrow(deleteException).when(runtimeService).deleteRuntime(currentKey, false);
    yesCommandCaptor.getValue().execute();
    verify(runtimeService, times(1)).deleteRuntime(currentKey, false);
    verify(popupHelper, times(1)).showBusyIndicator(BUSY_POPUP_MESSAGE);
    verify(popupHelper, times(1)).hideBusyIndicator();
    // dialog asking if forced deletion is wanted
    verify(popupHelper, times(1)).showYesNoPopup(eq(TITLE_2), eq(CONFIRM_MESSAGE_2), yesCommandCaptor.capture(), noCommandCaptor.capture());
    // say no
    noCommandCaptor.getValue().execute();
    // forced deletion will never be produced.
    verify(runtimeService, never()).deleteRuntime(currentKey, true);
}
Also used : RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) Test(org.junit.Test)

Example 14 with RuntimeKey

use of org.guvnor.ala.ui.model.RuntimeKey in project kie-wb-common by kiegroup.

the class RuntimePresenterActionsTest method testDeleteRuntimeConfirmYesAndSuccessful.

@Test
public void testDeleteRuntimeConfirmYesAndSuccessful() {
    prepareRuntimeDelete();
    RuntimeKey currentKey = runtime.getKey();
    when(translationService.format(RuntimePresenter_RuntimeDeleteSuccessMessage, item.getRuntime().getKey().getId())).thenReturn(SUCCESS_MESSAGE);
    when(translationService.getTranslation(RuntimePresenter_RuntimeDeletingMessage)).thenReturn(BUSY_POPUP_MESSAGE);
    yesCommandCaptor.getValue().execute();
    verify(runtimeService, times(1)).deleteRuntime(currentKey, false);
    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));
}
Also used : RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Example 15 with RuntimeKey

use of org.guvnor.ala.ui.model.RuntimeKey in project kie-wb-common by kiegroup.

the class RuntimePresenterActionsTest method testForceDeleteRuntimeConfirmYesAndFailed.

@Test
public void testForceDeleteRuntimeConfirmYesAndFailed() {
    prepareRuntimeForceDelete();
    RuntimeKey currentKey = runtime.getKey();
    when(translationService.getTranslation(RuntimePresenter_RuntimeDeletingForcedMessage)).thenReturn(BUSY_POPUP_MESSAGE);
    doThrow(new RuntimeException(ERROR_MESSAGE)).when(runtimeService).deleteRuntime(currentKey, true);
    yesCommandCaptor.getValue().execute();
    verify(runtimeService, times(1)).deleteRuntime(currentKey, true);
    verify(defaultErrorCallback, times(1)).error(any(Message.class), exceptionCaptor.capture());
    assertEquals(ERROR_MESSAGE, exceptionCaptor.getValue().getCause().getMessage());
    verify(popupHelper, times(1)).showBusyIndicator(BUSY_POPUP_MESSAGE);
    verify(popupHelper, times(1)).hideBusyIndicator();
}
Also used : RuntimePresenter_RuntimeDeletingForcedMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeletingForcedMessage) RuntimePresenter_RuntimeDeleteFailedMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeleteFailedMessage) RuntimePresenter_PipelineExecutionAlreadyStoppedMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionAlreadyStoppedMessage) RuntimePresenter_PipelineExecutionDeleteSuccessMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionDeleteSuccessMessage) RuntimePresenter_PipelineExecutionStopSuccessMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionStopSuccessMessage) RuntimePresenter_RuntimeDeleteSuccessMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeleteSuccessMessage) RuntimePresenter_RuntimeDeletingMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeletingMessage) RuntimePresenter_RuntimeConfirmForcedDeleteMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmForcedDeleteMessage) RuntimePresenter_RuntimeStopSuccessMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStopSuccessMessage) RuntimePresenter_RuntimeConfirmDeleteMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmDeleteMessage) RuntimePresenter_PipelineExecutionConfirmDeleteMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionConfirmDeleteMessage) RuntimePresenter_PipelineExecutionConfirmStopMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionConfirmStopMessage) RuntimePresenter_RuntimeConfirmStopMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmStopMessage) Message(org.jboss.errai.bus.client.api.messaging.Message) RuntimePresenter_RuntimeStartingMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStartingMessage) RuntimePresenter_RuntimeStoppingMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStoppingMessage) RuntimePresenter_RuntimeStartSuccessMessage(org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStartSuccessMessage) RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) Test(org.junit.Test)

Aggregations

RuntimeKey (org.guvnor.ala.ui.model.RuntimeKey)24 Test (org.junit.Test)21 RuntimeChangeEvent (org.guvnor.ala.ui.events.RuntimeChangeEvent)9 ProviderKey (org.guvnor.ala.ui.model.ProviderKey)7 RuntimeListItem (org.guvnor.ala.ui.model.RuntimeListItem)5 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)5 RuntimePresenter_PipelineExecutionAlreadyStoppedMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionAlreadyStoppedMessage)3 RuntimePresenter_PipelineExecutionConfirmDeleteMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionConfirmDeleteMessage)3 RuntimePresenter_PipelineExecutionConfirmStopMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionConfirmStopMessage)3 RuntimePresenter_PipelineExecutionDeleteSuccessMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionDeleteSuccessMessage)3 RuntimePresenter_PipelineExecutionStopSuccessMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_PipelineExecutionStopSuccessMessage)3 RuntimePresenter_RuntimeConfirmDeleteMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmDeleteMessage)3 RuntimePresenter_RuntimeConfirmForcedDeleteMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmForcedDeleteMessage)3 RuntimePresenter_RuntimeConfirmStopMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeConfirmStopMessage)3 RuntimePresenter_RuntimeDeleteFailedMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeleteFailedMessage)3 RuntimePresenter_RuntimeDeleteSuccessMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeleteSuccessMessage)3 RuntimePresenter_RuntimeDeletingForcedMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeletingForcedMessage)3 RuntimePresenter_RuntimeDeletingMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeDeletingMessage)3 RuntimePresenter_RuntimeStartSuccessMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStartSuccessMessage)3 RuntimePresenter_RuntimeStartingMessage (org.guvnor.ala.ui.client.resources.i18n.GuvnorAlaUIConstants.RuntimePresenter_RuntimeStartingMessage)3