use of org.kie.workbench.common.screens.projecteditor.build.exec.SnapshotDeployment in project kie-wb-common by kiegroup.
the class SnapshotBuildAndDeployExecutorTest method testBuildAndDeployWithMultipleTemplatesWithPreviousDeployment.
@Test
public void testBuildAndDeployWithMultipleTemplatesWithPreviousDeployment() {
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);
ContainerSpec spec = mock(ContainerSpec.class);
when(spec.getId()).thenReturn(context.getContainerId());
serverTemplate2.addContainerSpec(spec);
when(settings.getDeployment(anyString(), anyString())).thenReturn(Optional.of(new SnapshotDeployment(GROUP, ARTIFACT, SERVER_TEMPLATE_ID2)));
when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Arrays.asList(serverTemplate, serverTemplate2)));
runner.run(context);
verify(buildDialog).startBuild();
verify(buildDialog).showBusyIndicator(CONSTANTS.Building());
ArgumentCaptor<ContainerSpec> containerSpecArgumentCaptor = ArgumentCaptor.forClass(ContainerSpec.class);
verify(specManagementServiceMock).updateContainerSpec(eq(SERVER_TEMPLATE_ID2), containerSpecArgumentCaptor.capture());
ContainerSpec containerSpec = containerSpecArgumentCaptor.getValue();
assertEquals(module.getPom().getGav().getArtifactId(), containerSpec.getContainerName());
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());
}
use of org.kie.workbench.common.screens.projecteditor.build.exec.SnapshotDeployment in project kie-wb-common by kiegroup.
the class SnapshotRedeployExecutorTest method testRedeployWithMultipleTemplatesWithPreviousDeployment.
@Test
public void testRedeployWithMultipleTemplatesWithPreviousDeployment() {
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);
ContainerSpec spec = mock(ContainerSpec.class);
when(spec.getId()).thenReturn(context.getContainerId());
serverTemplate2.addContainerSpec(spec);
when(settings.getDeployment(anyString(), anyString())).thenReturn(Optional.of(new SnapshotDeployment(GROUP, ARTIFACT, SERVER_TEMPLATE_ID2)));
when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Arrays.asList(serverTemplate, serverTemplate2)));
runner.run(context);
verify(buildDialog).startBuild();
verify(buildDialog).showBusyIndicator(CONSTANTS.Building());
ArgumentCaptor<ContainerSpec> containerSpecArgumentCaptor = ArgumentCaptor.forClass(ContainerSpec.class);
verify(specManagementServiceMock).updateContainerSpec(eq(SERVER_TEMPLATE_ID2), eq(context.getContainerId()), containerSpecArgumentCaptor.capture(), eq(true));
ContainerSpec containerSpec = containerSpecArgumentCaptor.getValue();
assertEquals(module.getPom().getGav().getArtifactId(), containerSpec.getContainerName());
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());
}
use of org.kie.workbench.common.screens.projecteditor.build.exec.SnapshotDeployment in project kie-wb-common by kiegroup.
the class SnapshotBuildAndDeployExecutor method buildDeployWithMultipleServerTemplates.
@Override
void buildDeployWithMultipleServerTemplates(BuildExecutionContext context, List<ServerTemplate> serverTemplates) {
GAV gav = context.getModule().getPom().getGav();
Optional<SnapshotDeployment> optional = settings.getDeployment(gav.getGroupId(), gav.getArtifactId());
if (optional.isPresent()) {
SnapshotDeployment previousDeployment = optional.get();
Optional<ServerTemplate> serverOptional = serverTemplates.stream().filter(s -> s.getId().equals(previousDeployment.getServer())).findFirst();
if (serverOptional.isPresent()) {
buildDeployWithOneServerTemplate(context, serverOptional.get());
return;
}
}
context.setServerTemplate(serverTemplates.get(0));
deploymentPopup.show(new DefaultDeploymentPopupDriver(context, DeploymentPopup.Mode.MULTIPLE_SERVER_FORCED, () -> serverTemplates, () -> buildDeployWithOneServerTemplate(context, context.getServerTemplate()), () -> finish()));
}
Aggregations