@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()); }
@Override protected void updateContainerSpec(final BuildExecutionContext context, final ContainerSpec containerSpec) { containerSpec.setStatus(context.getServerTemplate().getContainerSpec(containerSpec.getId()).getStatus()); specManagementService.call(ignore -> { notifyUpdateSuccess(); }, (o, throwable) -> { notifyUpdateError(); return false; }).updateContainerSpec(context.getServerTemplate().getId(), context.getContainerId(), containerSpec, true); }
SnapshotRedeployExecutor extends SnapshotBuildAndDeployExecutor { @Override protected void updateContainerSpec(final BuildExecutionContext context, final ContainerSpec containerSpec) { containerSpec.setStatus(context.getServerTemplate().getContainerSpec(containerSpec.getId()).getStatus()); specManagementService.call(ignore -> { notifyUpdateSuccess(); }, (o, throwable) -> { notifyUpdateError(); return false; }).updateContainerSpec(context.getServerTemplate().getId(), context.getContainerId(), containerSpec, true); } }
SnapshotRedeployExecutor extends SnapshotBuildAndDeployExecutor { @Override protected void updateContainerSpec(final BuildExecutionContext context, final ContainerSpec containerSpec) { containerSpec.setStatus(context.getServerTemplate().getContainerSpec(containerSpec.getId()).getStatus()); specManagementService.call(ignore -> { notifyUpdateSuccess(); }, (o, throwable) -> { notifyUpdateError(); return false; }).updateContainerSpec(context.getServerTemplate().getId(), context.getContainerId(), containerSpec, true); } SnapshotRedeployExecutor(final Caller<BuildService> buildServiceCaller,
                                    final Event<BuildResults> buildResultsEvent,
                                    final Event<NotificationEvent> notificationEvent,
                                    final BuildDialog buildDialog,
                                    final DeploymentPopup deploymentPopup,
                                    final Caller<SpecManagementService> specManagementService,
                                    final SnapshotDeploymentSettings settings); }
SnapshotRedeployExecutor extends SnapshotBuildAndDeployExecutor { @Override protected void updateContainerSpec(final BuildExecutionContext context, final ContainerSpec containerSpec) { containerSpec.setStatus(context.getServerTemplate().getContainerSpec(containerSpec.getId()).getStatus()); specManagementService.call(ignore -> { notifyUpdateSuccess(); }, (o, throwable) -> { notifyUpdateError(); return false; }).updateContainerSpec(context.getServerTemplate().getId(), context.getContainerId(), containerSpec, true); } SnapshotRedeployExecutor(final Caller<BuildService> buildServiceCaller,
                                    final Event<BuildResults> buildResultsEvent,
                                    final Event<NotificationEvent> notificationEvent,
                                    final BuildDialog buildDialog,
                                    final DeploymentPopup deploymentPopup,
                                    final Caller<SpecManagementService> specManagementService,
                                    final SnapshotDeploymentSettings settings);  }
SnapshotRedeployExecutor extends SnapshotBuildAndDeployExecutor { @Override protected void updateContainerSpec(final BuildExecutionContext context, final ContainerSpec containerSpec) { containerSpec.setStatus(context.getServerTemplate().getContainerSpec(containerSpec.getId()).getStatus()); specManagementService.call(ignore -> { notifyUpdateSuccess(); }, (o, throwable) -> { notifyUpdateError(); return false; }).updateContainerSpec(context.getServerTemplate().getId(), context.getContainerId(), containerSpec, true); } SnapshotRedeployExecutor(final Caller<BuildService> buildServiceCaller,
                                    final Event<BuildResults> buildResultsEvent,
                                    final Event<NotificationEvent> notificationEvent,
                                    final BuildDialog buildDialog,
                                    final DeploymentPopup deploymentPopup,
                                    final Caller<SpecManagementService> specManagementService,
                                    final SnapshotDeploymentSettings settings);   }