Search in sources :

Example 81 with NotificationEvent

use of org.uberfire.workbench.events.NotificationEvent 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(Mockito.<Message>any(), exceptionCaptor.capture());
    assertEquals(ERROR_MESSAGE, exceptionCaptor.getValue().getMessage());
}
Also used : RuntimeKey(org.guvnor.ala.ui.model.RuntimeKey) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Example 82 with NotificationEvent

use of org.uberfire.workbench.events.NotificationEvent 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 83 with NotificationEvent

use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.

the class RuntimePresenterActionsTest method testStopPipelineConfirmYesAndSuccessful.

@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));
}
Also used : NotificationEvent(org.uberfire.workbench.events.NotificationEvent) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey) Test(org.junit.Test)

Example 84 with NotificationEvent

use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.

the class NewProviderWizardTest method testCreateProviderSuccess.

@Test
public void testCreateProviderSuccess() {
    // initialize and start the wizard.
    wizard.start(providerType);
    // emulate the user completing the wizard.
    preCompleteWizard();
    // emulate the user pressing the finish button.
    wizard.complete();
    // verify that the provider has been created and the proper notifications were fired.
    verify(providerService, times(1)).createProvider(providerType, providerConfiguration);
    verify(notification, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS));
    verify(providerTypeSelectedEvent, times(1)).fire(new ProviderTypeSelectedEvent(providerType.getKey(), providerConfiguration.getId()));
}
Also used : ProviderTypeSelectedEvent(org.guvnor.ala.ui.client.events.ProviderTypeSelectedEvent) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Example 85 with NotificationEvent

use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.

the class DataModelerScreenPresenter method getCopySuccessCallback.

private RemoteCallback<Path> getCopySuccessCallback(final CopyPopUpPresenter.View copyPopupView) {
    return new RemoteCallback<Path>() {

        @Override
        public void callback(final Path response) {
            copyPopupView.hide();
            view.hideBusyIndicator();
            notification.fire(new NotificationEvent(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants.INSTANCE.ItemCopiedSuccessfully(), NotificationEvent.NotificationType.SUCCESS));
        }
    };
}
Also used : ObservablePath(org.uberfire.backend.vfs.ObservablePath) Path(org.uberfire.backend.vfs.Path) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback)

Aggregations

NotificationEvent (org.uberfire.workbench.events.NotificationEvent)151 Test (org.junit.Test)65 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)34 ServerTemplate (org.kie.server.controller.api.model.spec.ServerTemplate)28 ContainerSpec (org.kie.server.controller.api.model.spec.ContainerSpec)22 ServerTemplateList (org.kie.server.controller.api.model.spec.ServerTemplateList)21 List (java.util.List)17 Path (org.uberfire.backend.vfs.Path)17 ErrorCallback (org.jboss.errai.common.client.api.ErrorCallback)16 ArrayList (java.util.ArrayList)14 Event (javax.enterprise.event.Event)14 Inject (javax.inject.Inject)12 ObservablePath (org.uberfire.backend.vfs.ObservablePath)12 PostConstruct (javax.annotation.PostConstruct)9 Observes (javax.enterprise.event.Observes)9 Caller (org.jboss.errai.common.client.api.Caller)9 Map (java.util.Map)8 Promise (elemental2.promise.Promise)7 Arrays (java.util.Arrays)7 Dependent (javax.enterprise.context.Dependent)7