Search in sources :

Example 21 with NotificationEvent

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

the class BaseViewPresenter method getRenameSuccessCallback.

protected RemoteCallback<Void> getRenameSuccessCallback(final RenamePopUpPresenter.View renamePopupView) {
    return new RemoteCallback<Void>() {

        @Override
        public void callback(final Void o) {
            renamePopupView.hide();
            notification.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemRenamedSuccessfully()));
            baseView.hideBusyIndicator();
            refresh();
        }
    };
}
Also used : NotificationEvent(org.uberfire.workbench.events.NotificationEvent) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback)

Example 22 with NotificationEvent

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

the class BaseViewPresenter method getCopySuccessCallback.

protected RemoteCallback<Void> getCopySuccessCallback(final CopyPopUpPresenter.View copyPopupView) {
    return new RemoteCallback<Void>() {

        @Override
        public void callback(final Void o) {
            copyPopupView.hide();
            notification.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemCopiedSuccessfully()));
            baseView.hideBusyIndicator();
            refresh();
        }
    };
}
Also used : NotificationEvent(org.uberfire.workbench.events.NotificationEvent) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback)

Example 23 with NotificationEvent

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

the class ArchetypeManagementScreenPresenterTest method fireNotificationOnArchetypeListUpdatedEvent.

private void fireNotificationOnArchetypeListUpdatedEvent(final ArchetypeListOperation operation, final String notificationMsg, final String tsKey) {
    doReturn(notificationMsg).when(ts).getTranslation(tsKey);
    doReturn(true).when(archetypeTablePresenter).isSetup();
    presenter.onArchetypeListUpdatedEvent(new ArchetypeListUpdatedEvent(operation));
    verify(notificationEvent).fire(new NotificationEvent(notificationMsg, NotificationEvent.NotificationType.SUCCESS));
}
Also used : ArchetypeListUpdatedEvent(org.kie.workbench.common.screens.archetype.mgmt.shared.events.ArchetypeListUpdatedEvent) NotificationEvent(org.uberfire.workbench.events.NotificationEvent)

Example 24 with NotificationEvent

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

the class AbstractExecutorTest method verifyNotification.

protected void verifyNotification(final String message, final NotificationEvent.NotificationType type) {
    verify(notificationEvent).fire(argThat(new ArgumentMatcher<NotificationEvent>() {

        @Override
        public boolean matches(final NotificationEvent argument) {
            final NotificationEvent event = (NotificationEvent) argument;
            final String notification = event.getNotification();
            return notification.equals(message) && type.equals(event.getType());
        }
    }));
}
Also used : ArgumentMatcher(org.mockito.ArgumentMatcher) NotificationEvent(org.uberfire.workbench.events.NotificationEvent)

Example 25 with NotificationEvent

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

the class AbstractBuildAndDeployExecutorTest method testBuildAndDeployWithoutServerTemplateError.

@Test
public void testBuildAndDeployWithoutServerTemplateError() {
    Answer answer = new Answer() {

        boolean executed = false;

        @Override
        public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
            if (!executed) {
                executed = true;
                throw new Exception();
            }
            return new BuildResults();
        }
    };
    when(buildServiceMock.buildAndDeploy(any(Module.class), any(DeploymentMode.class))).thenAnswer(answer);
    runner.run(context);
    verify(buildDialog, times(2)).showBusyIndicator(CONSTANTS.Building());
    verify(notificationEvent, times(2)).fire(any(NotificationEvent.class));
    verify(buildDialog, atLeastOnce()).stopBuild();
    verify(buildDialog).stopBuild();
}
Also used : Answer(org.mockito.stubbing.Answer) BuildResults(org.guvnor.common.services.project.builder.model.BuildResults) InvocationOnMock(org.mockito.invocation.InvocationOnMock) DeploymentMode(org.guvnor.common.services.project.service.DeploymentMode) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Module(org.guvnor.common.services.project.model.Module) Test(org.junit.Test) AbstractExecutorTest(org.kie.workbench.common.screens.projecteditor.client.build.exec.impl.executors.AbstractExecutorTest)

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