Search in sources :

Example 1 with DeploymentPopup

use of org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentPopup 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 2 with DeploymentPopup

use of org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentPopup 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 3 with DeploymentPopup

use of org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentPopup in project kie-wb-common by kiegroup.

the class ProductionBuildAndDeployExecutorTest method testBuildAndDeployWithMultipleTemplates.

@Test
public void testBuildAndDeployWithMultipleTemplates() {
    final ServerTemplate serverTemplate = new ServerTemplate(SERVER_TEMPLATE_ID, SERVER_TEMPLATE_NAME);
    serverTemplate.setMode(KieServerMode.PRODUCTION);
    final ServerTemplate serverTemplate2 = new ServerTemplate(SERVER_TEMPLATE_ID2, SERVER_TEMPLATE_NAME2);
    serverTemplate2.setMode(KieServerMode.PRODUCTION);
    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(buildDialog, times(1)).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 4 with DeploymentPopup

use of org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentPopup in project kie-wb-common by kiegroup.

the class ProductionBuildAndDeployExecutorTest method testBuildDeploySingleServerTemplateUpdatingExistingContainer.

@Test
public void testBuildDeploySingleServerTemplateUpdatingExistingContainer() {
    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());
    serverTemplate.setContainersSpec(Collections.singletonList(spec));
    when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(new ServerTemplate[] { serverTemplate }));
    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);
    verify(specManagementServiceMock).updateContainerSpec(anyString(), any());
    verifyNotification(ProjectEditorResources.CONSTANTS.DeploySuccessfulAndContainerUpdated(), NotificationEvent.NotificationType.SUCCESS);
    verify(notificationEvent, times(2)).fire(any(NotificationEvent.class));
    verify(buildDialog, times(1)).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) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Example 5 with DeploymentPopup

use of org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentPopup in project kie-wb-common by kiegroup.

the class ProductionBuildAndDeployExecutorTest method testBuildDeploySingleServerTemplateExistingContainer.

@Test
public void testBuildDeploySingleServerTemplateExistingContainer() {
    final ServerTemplate serverTemplate = new ServerTemplate(SERVER_TEMPLATE_ID, SERVER_TEMPLATE_NAME);
    serverTemplate.setMode(KieServerMode.PRODUCTION);
    ContainerSpec spec = mock(ContainerSpec.class);
    when(spec.getId()).thenReturn(context.getContainerId());
    serverTemplate.setContainersSpec(Collections.singletonList(spec));
    when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(new ServerTemplate[] { serverTemplate }));
    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);
    verify(specManagementServiceMock, never()).saveContainerSpec(anyString(), any());
    verify(specManagementServiceMock, never()).updateContainerSpec(anyString(), any());
    verifyNotification(ProjectEditorResources.CONSTANTS.DeploymentSkippedCannotUpdateDeploymentsOnProduction(), NotificationEvent.NotificationType.ERROR);
    verify(notificationEvent, times(2)).fire(any(NotificationEvent.class));
    verify(buildDialog, times(1)).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) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)5 ServerTemplate (org.kie.server.controller.api.model.spec.ServerTemplate)5 ServerTemplateList (org.kie.server.controller.api.model.spec.ServerTemplateList)5 DeploymentPopup (org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentPopup)5 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)5 ContainerSpec (org.kie.server.controller.api.model.spec.ContainerSpec)2 AbstractBuildAndDeployExecutorTest (org.kie.workbench.common.screens.projecteditor.client.build.exec.impl.executors.deploy.AbstractBuildAndDeployExecutorTest)1