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();
}
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());
}
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());
}
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();
}
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());
}
Aggregations