use of org.uberfire.workbench.events.NotificationEvent 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();
}
use of org.uberfire.workbench.events.NotificationEvent 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();
}
use of org.uberfire.workbench.events.NotificationEvent 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();
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class ProductionBuildAndDeployExecutorTest method testBuildAndDeploySingleServerTemplateWithoutStart.
@Test
public void testBuildAndDeploySingleServerTemplateWithoutStart() {
final ServerTemplate serverTemplate = new ServerTemplate(SERVER_TEMPLATE_ID, SERVER_TEMPLATE_NAME);
serverTemplate.setMode(KieServerMode.PRODUCTION);
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());
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class SnapshotRedeployExecutorTest method testRedeploySingleServerTemplateStartServer.
@Test
public void testRedeploySingleServerTemplateStartServer() {
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());
}
Aggregations