Search in sources :

Example 71 with NotificationEvent

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

the class DecisionTableXLSEditorViewImplTest method testSubmit.

@Test
public void testSubmit() throws Exception {
    Path path = mock(Path.class);
    view.setupUploadWidget(type);
    view.submit(path);
    verify(attachmentFileWidget).submit(eq(path), eq(SERVLET_URL), commandCaptor.capture(), any(Command.class));
    commandCaptor.getValue().execute();
    verify(notificationEvent).fire(any(NotificationEvent.class));
    verify(presenter).onUploadSuccess();
}
Also used : Path(org.uberfire.backend.vfs.Path) Command(com.google.gwt.user.client.Command) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Example 72 with NotificationEvent

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

the class SettingsPresenter method setupSection.

Promise<Object> setupSection(final ProjectScreenModel model, final Section section) {
    return promises.resolve().then(ignore -> section.setup(model)).catch_(e -> {
        sections.remove(section);
        notificationEvent.fire(new NotificationEvent(getSectionSetupErrorMessage(section), WARNING));
        return promises.reject(e);
    }).then(i -> {
        section.getMenuItem().setup(section, this);
        resetDirtyIndicator(section);
        return promises.resolve();
    }).catch_(e -> {
        DomGlobal.console.info(e);
        return promises.resolve();
    });
}
Also used : ConcurrentChangePopup.newConcurrentUpdate(org.uberfire.ext.widgets.common.client.common.ConcurrentChangePopup.newConcurrentUpdate) HasBusyIndicator(org.uberfire.ext.widgets.common.client.common.HasBusyIndicator) Promises(org.uberfire.client.promise.Promises) ManagedInstance(org.jboss.errai.ioc.client.api.ManagedInstance) ListPresenter(org.kie.workbench.common.screens.library.client.settings.util.ListPresenter) HashMap(java.util.HashMap) SavePopUpPresenter(org.uberfire.ext.editor.commons.client.file.popups.SavePopUpPresenter) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Promise(elemental2.promise.Promise) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) UberElementalListItem(org.kie.workbench.common.screens.library.client.settings.util.UberElementalListItem) IsElement(org.jboss.errai.ui.client.local.api.elemental2.IsElement) ERROR(org.uberfire.workbench.events.NotificationEvent.NotificationType.ERROR) HTMLElement(elemental2.dom.HTMLElement) Map(java.util.Map) Observes(javax.enterprise.event.Observes) ProjectScreenService(org.kie.workbench.common.screens.projecteditor.service.ProjectScreenService) Customizable(org.uberfire.annotations.Customizable) DefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.DefaultErrorCallback) Event(javax.enterprise.event.Event) ListItemPresenter(org.kie.workbench.common.screens.library.client.settings.util.ListItemPresenter) DomGlobal(elemental2.dom.DomGlobal) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) WARNING(org.uberfire.workbench.events.NotificationEvent.NotificationType.WARNING) WorkspaceProjectContext(org.guvnor.common.services.project.client.context.WorkspaceProjectContext) List(java.util.List) DeploymentMode(org.guvnor.common.services.project.service.DeploymentMode) Message(org.jboss.errai.bus.client.api.messaging.Message) Collectors.toList(java.util.stream.Collectors.toList) Stream(java.util.stream.Stream) GAVAlreadyExistsException(org.guvnor.common.services.project.service.GAVAlreadyExistsException) OnOpen(org.uberfire.lifecycle.OnOpen) Dependent(javax.enterprise.context.Dependent) ConflictingRepositoriesPopup(org.guvnor.common.services.project.client.repositories.ConflictingRepositoriesPopup) ObservablePath(org.uberfire.backend.vfs.ObservablePath) SUCCESS(org.uberfire.workbench.events.NotificationEvent.NotificationType.SUCCESS) Caller(org.jboss.errai.common.client.api.Caller) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) ApplicationScoped(javax.enterprise.context.ApplicationScoped) UberElemental(org.uberfire.client.mvp.UberElemental) NotificationEvent(org.uberfire.workbench.events.NotificationEvent)

Example 73 with NotificationEvent

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

the class BuildExecutor method saveContainerSpec.

private void saveContainerSpec(final String containerId, final String containerAlias, final ServerTemplate serverTemplate, final Boolean startContainer, final Map<String, String> parameters) {
    if (containerId != null && serverTemplate != null && serverTemplate.getId() != null) {
        final ContainerSpec containerSpec = makeContainerSpec(containerId, containerAlias, serverTemplate, parameters);
        specManagementService.call(aVoid -> {
            notificationEvent.fire(new NotificationEvent(ProjectEditorResources.CONSTANTS.DeploySuccessful(), NotificationEvent.NotificationType.SUCCESS));
            if (startContainer) {
                startContainer(containerSpec);
            }
        }).saveContainerSpec(serverTemplate.getId(), containerSpec);
    }
}
Also used : UnexpectedTypeException(javax.validation.UnexpectedTypeException) Arrays(java.util.Arrays) ProcessConfig(org.kie.server.controller.api.model.spec.ProcessConfig) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) HasBusyIndicator(org.uberfire.ext.widgets.common.client.common.HasBusyIndicator) GAV(org.guvnor.common.services.project.model.GAV) ServerTemplateList(org.kie.server.controller.api.model.spec.ServerTemplateList) HashMap(java.util.HashMap) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Inject(javax.inject.Inject) ContainerConfig(org.kie.server.controller.api.model.spec.ContainerConfig) MergeMode(org.kie.workbench.common.screens.server.management.model.MergeMode) POM(org.guvnor.common.services.project.model.POM) CommandWithThrowableDrivenErrorCallback(org.kie.workbench.common.widgets.client.callbacks.CommandWithThrowableDrivenErrorCallback) Capability(org.kie.server.controller.api.model.spec.Capability) RuleConfig(org.kie.server.controller.api.model.spec.RuleConfig) ProjectEditorResources(org.kie.workbench.common.screens.projecteditor.client.resources.ProjectEditorResources) MavenRepositoryMetadata(org.guvnor.common.services.project.model.MavenRepositoryMetadata) Map(java.util.Map) Module(org.guvnor.common.services.project.model.Module) SpecManagementService(org.kie.workbench.common.screens.server.management.service.SpecManagementService) KieContainerStatus(org.kie.server.api.model.KieContainerStatus) BuildService(org.guvnor.common.services.project.builder.service.BuildService) Command(org.uberfire.mvp.Command) Event(javax.enterprise.event.Event) BuildResults(org.guvnor.common.services.project.builder.model.BuildResults) ContainerSpecKey(org.kie.server.controller.api.model.spec.ContainerSpecKey) Collection(java.util.Collection) Set(java.util.Set) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) Collectors(java.util.stream.Collectors) WorkspaceProjectContext(org.guvnor.common.services.project.client.context.WorkspaceProjectContext) KieScannerStatus(org.kie.server.api.model.KieScannerStatus) List(java.util.List) DeploymentMode(org.guvnor.common.services.project.service.DeploymentMode) Message(org.jboss.errai.bus.client.api.messaging.Message) GAVAlreadyExistsException(org.guvnor.common.services.project.service.GAVAlreadyExistsException) ConflictingRepositoriesPopup(org.guvnor.common.services.project.client.repositories.ConflictingRepositoriesPopup) RuntimeStrategy(org.kie.workbench.common.screens.server.management.model.RuntimeStrategy) Caller(org.jboss.errai.common.client.api.Caller) DeploymentScreenPopupViewImpl(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentScreenPopupViewImpl) ReleaseId(org.kie.server.api.model.ReleaseId) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) NotificationEvent(org.uberfire.workbench.events.NotificationEvent)

Example 74 with NotificationEvent

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

the class BuildExecutorTest method testBuildAndDeployCommandSingleServerTemplate.

@Test
public void testBuildAndDeployCommandSingleServerTemplate() {
    final ServerTemplate serverTemplate = new ServerTemplate("id", "name");
    when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Collections.singletonList(serverTemplate)));
    buildExecutor.triggerBuildAndDeploy();
    ArgumentCaptor<ContainerSpec> containerSpecArgumentCaptor = ArgumentCaptor.forClass(ContainerSpec.class);
    verify(specManagementServiceMock).saveContainerSpec(eq(serverTemplate.getId()), containerSpecArgumentCaptor.capture());
    final ContainerSpec containerSpec = containerSpecArgumentCaptor.getValue();
    assertEquals(module.getPom().getGav().getArtifactId(), containerSpec.getContainerName());
    verifyNotification(ProjectEditorResources.CONSTANTS.BuildSuccessful(), NotificationEvent.NotificationType.SUCCESS);
    verifyNotification(ProjectEditorResources.CONSTANTS.DeploySuccessful(), NotificationEvent.NotificationType.SUCCESS);
    verify(notificationEvent, times(2)).fire(any(NotificationEvent.class));
    verifyBusyShowHideAnyString(1, 1);
}
Also used : ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) ServerTemplateList(org.kie.server.controller.api.model.spec.ServerTemplateList) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Example 75 with NotificationEvent

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

the class NewDeployWizard method onPipelineStartSuccess.

private void onPipelineStartSuccess() {
    notification.fire(new NotificationEvent(translationService.getTranslation(NewDeployWizard_PipelineStartSuccessMessage), NotificationEvent.NotificationType.SUCCESS));
    NewDeployWizard.super.complete();
    refreshRuntimeEvent.fire(new RefreshRuntimeEvent(provider.getKey()));
}
Also used : RefreshRuntimeEvent(org.guvnor.ala.ui.client.events.RefreshRuntimeEvent) NotificationEvent(org.uberfire.workbench.events.NotificationEvent)

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