Search in sources :

Example 26 with NotificationEvent

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

the class SnapshotBuildAndDeployExecutorTest method testBuildAndDeployWithMultipleTemplates.

@Test
public void testBuildAndDeployWithMultipleTemplates() {
    final ServerTemplate serverTemplate = new ServerTemplate(SERVER_TEMPLATE_ID, SERVER_TEMPLATE_NAME);
    serverTemplate.setMode(KieServerMode.DEVELOPMENT);
    final ServerTemplate serverTemplate2 = new ServerTemplate(SERVER_TEMPLATE_ID2, SERVER_TEMPLATE_NAME2);
    serverTemplate2.setMode(KieServerMode.DEVELOPMENT);
    when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Arrays.asList(serverTemplate, serverTemplate2)));
    runner.run(context);
    verify(buildDialog).startBuild();
    ArgumentCaptor<DeploymentPopup.Driver> driverArgumentCaptor = ArgumentCaptor.forClass(DeploymentPopup.Driver.class);
    verify(deploymentPopup).show(driverArgumentCaptor.capture());
    DeploymentPopup.Driver driver = driverArgumentCaptor.getValue();
    driver.finish(context.getContainerId(), context.getContainerAlias(), SERVER_TEMPLATE_ID, true);
    verify(buildDialog).showBusyIndicator(CONSTANTS.Building());
    verifyNotification(ProjectEditorResources.CONSTANTS.BuildSuccessful(), NotificationEvent.NotificationType.SUCCESS);
    verifyNotification(ProjectEditorResources.CONSTANTS.DeploySuccessfulAndContainerStarted(), NotificationEvent.NotificationType.SUCCESS);
    verify(notificationEvent, times(2)).fire(any(NotificationEvent.class));
    verify(settings).save();
    verify(buildDialog).stopBuild();
    driver.cancel();
    verify(buildDialog, times(2)).stopBuild();
}
Also used : ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) DeploymentPopup(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentPopup) ServerTemplateList(org.kie.server.controller.api.model.spec.ServerTemplateList) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Example 27 with NotificationEvent

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

the class SnapshotBuildAndDeployExecutorTest method testBuildAndDeploySingleServerTemplateStartServer.

@Test
public void testBuildAndDeploySingleServerTemplateStartServer() {
    final ServerTemplate serverTemplate = new ServerTemplate(SERVER_TEMPLATE_ID, SERVER_TEMPLATE_NAME);
    serverTemplate.setMode(KieServerMode.DEVELOPMENT);
    when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Collections.singletonList(serverTemplate)));
    runner.run(context);
    verify(buildDialog).startBuild();
    verify(buildDialog).showBusyIndicator(CONSTANTS.Building());
    ArgumentCaptor<ContainerSpec> containerSpecArgumentCaptor = ArgumentCaptor.forClass(ContainerSpec.class);
    verify(specManagementServiceMock).saveContainerSpec(eq(serverTemplate.getId()), containerSpecArgumentCaptor.capture());
    ContainerSpec containerSpec = containerSpecArgumentCaptor.getValue();
    assertEquals(module.getPom().getGav().getArtifactId(), containerSpec.getContainerName());
    verify(specManagementServiceMock).startContainer(containerSpecArgumentCaptor.capture());
    containerSpec = containerSpecArgumentCaptor.getValue();
    assertEquals(module.getPom().getGav().getArtifactId(), containerSpec.getContainerName());
    verifyNotification(ProjectEditorResources.CONSTANTS.BuildSuccessful(), NotificationEvent.NotificationType.SUCCESS);
    verifyNotification(ProjectEditorResources.CONSTANTS.DeploySuccessfulAndContainerStarted(), NotificationEvent.NotificationType.SUCCESS);
    verify(notificationEvent, times(2)).fire(any(NotificationEvent.class));
    verify(buildDialog, atLeastOnce()).stopBuild();
    verify(deploymentPopup, never()).show(any());
}
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 28 with NotificationEvent

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

the class SnapshotRedeployExecutorTest method testRedeploySingleServerTemplateWithoutStart.

@Test
public void testRedeploySingleServerTemplateWithoutStart() {
    final ServerTemplate serverTemplate = new ServerTemplate(SERVER_TEMPLATE_ID, SERVER_TEMPLATE_NAME);
    serverTemplate.setMode(KieServerMode.DEVELOPMENT);
    when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Collections.singletonList(serverTemplate)));
    context.setStartContainer(false);
    runner.run(context);
    verify(buildDialog).startBuild();
    verify(buildDialog).showBusyIndicator(CONSTANTS.Building());
    ArgumentCaptor<ContainerSpec> containerSpecArgumentCaptor = ArgumentCaptor.forClass(ContainerSpec.class);
    verify(specManagementServiceMock).saveContainerSpec(eq(serverTemplate.getId()), containerSpecArgumentCaptor.capture());
    ContainerSpec containerSpec = containerSpecArgumentCaptor.getValue();
    assertEquals(module.getPom().getGav().getArtifactId(), containerSpec.getContainerName());
    verify(specManagementServiceMock, never()).startContainer(any());
    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));
    verify(buildDialog, atLeastOnce()).stopBuild();
    verify(deploymentPopup, never()).show(any());
}
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) AbstractBuildAndDeployExecutorTest(org.kie.workbench.common.screens.projecteditor.client.build.exec.impl.executors.deploy.AbstractBuildAndDeployExecutorTest) Test(org.junit.Test)

Example 29 with NotificationEvent

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

the class SnapshotRedeployExecutorTest method testRedeployWithMultipleTemplates.

@Test
public void testRedeployWithMultipleTemplates() {
    final ServerTemplate serverTemplate = new ServerTemplate(SERVER_TEMPLATE_ID, SERVER_TEMPLATE_NAME);
    serverTemplate.setMode(KieServerMode.DEVELOPMENT);
    final ServerTemplate serverTemplate2 = new ServerTemplate(SERVER_TEMPLATE_ID2, SERVER_TEMPLATE_NAME2);
    serverTemplate2.setMode(KieServerMode.DEVELOPMENT);
    when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Arrays.asList(serverTemplate, serverTemplate2)));
    runner.run(context);
    verify(buildDialog).startBuild();
    ArgumentCaptor<DeploymentPopup.Driver> driverArgumentCaptor = ArgumentCaptor.forClass(DeploymentPopup.Driver.class);
    verify(deploymentPopup).show(driverArgumentCaptor.capture());
    DeploymentPopup.Driver driver = driverArgumentCaptor.getValue();
    driver.finish(context.getContainerId(), context.getContainerAlias(), SERVER_TEMPLATE_ID, true);
    verify(buildDialog).showBusyIndicator(CONSTANTS.Building());
    verifyNotification(ProjectEditorResources.CONSTANTS.BuildSuccessful(), NotificationEvent.NotificationType.SUCCESS);
    verifyNotification(ProjectEditorResources.CONSTANTS.DeploySuccessfulAndContainerStarted(), NotificationEvent.NotificationType.SUCCESS);
    verify(notificationEvent, times(2)).fire(any(NotificationEvent.class));
    verify(settings).save();
    verify(buildDialog).stopBuild();
    driver.cancel();
    verify(buildDialog, times(2)).stopBuild();
}
Also used : ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) DeploymentPopup(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentPopup) ServerTemplateList(org.kie.server.controller.api.model.spec.ServerTemplateList) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) AbstractBuildAndDeployExecutorTest(org.kie.workbench.common.screens.projecteditor.client.build.exec.impl.executors.deploy.AbstractBuildAndDeployExecutorTest) Test(org.junit.Test)

Example 30 with NotificationEvent

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

the class SnapshotRedeployExecutorTest method testRedeploySingleServerTemplateUpdateServer.

@Test
public void testRedeploySingleServerTemplateUpdateServer() {
    final ServerTemplate serverTemplate = new ServerTemplate(SERVER_TEMPLATE_ID, SERVER_TEMPLATE_NAME);
    serverTemplate.setMode(KieServerMode.DEVELOPMENT);
    ContainerSpec spec = mock(ContainerSpec.class);
    when(spec.getId()).thenReturn(context.getContainerId());
    when(spec.getStatus()).thenReturn(KieContainerStatus.STARTED);
    serverTemplate.addContainerSpec(spec);
    when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Collections.singletonList(serverTemplate)));
    runner.run(context);
    verify(buildDialog).startBuild();
    verify(buildDialog).showBusyIndicator(CONSTANTS.Building());
    ArgumentCaptor<ContainerSpec> containerSpecArgumentCaptor = ArgumentCaptor.forClass(ContainerSpec.class);
    verify(specManagementServiceMock).updateContainerSpec(eq(SERVER_TEMPLATE_ID), eq(context.getContainerId()), containerSpecArgumentCaptor.capture(), eq(true));
    ContainerSpec containerSpec = containerSpecArgumentCaptor.getValue();
    assertEquals(module.getPom().getGav().getArtifactId(), containerSpec.getContainerName());
    assertEquals(KieContainerStatus.STARTED, containerSpec.getStatus());
    verifyNotification(ProjectEditorResources.CONSTANTS.BuildSuccessful(), NotificationEvent.NotificationType.SUCCESS);
    verifyNotification(ProjectEditorResources.CONSTANTS.DeploySuccessfulAndContainerUpdated(), NotificationEvent.NotificationType.SUCCESS);
    verify(notificationEvent, times(2)).fire(any(NotificationEvent.class));
    verify(buildDialog, atLeastOnce()).stopBuild();
    verify(deploymentPopup, never()).show(any());
}
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) AbstractBuildAndDeployExecutorTest(org.kie.workbench.common.screens.projecteditor.client.build.exec.impl.executors.deploy.AbstractBuildAndDeployExecutorTest) Test(org.junit.Test)

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