containerSpec.setServerTemplateKey(new ServerTemplateKey(containerSpec.getServerTemplateKey().getId(), containerSpec.getServerTemplateKey().getName()));
private void addContainer( final ContainerSpec containerSpec ) { view.addContainer( containerSpec.getServerTemplateKey().getId(), containerSpec.getId(), containerSpec.getContainerName(), new Command() { @Override public void execute() { containerSpecSelectedEvent.fire( new ContainerSpecSelected( containerSpec ) ); } } ); }
@Override public void execute() { specManagementService.call(new RemoteCallback<Void>() { @Override public void callback(final Void response) { notification.fire(new NotificationEvent(view.getRemoveContainerSuccessMessage(), NotificationEvent.NotificationType.SUCCESS)); serverTemplateSelectedEvent.fire(new ServerTemplateSelected(containerSpec.getServerTemplateKey())); } }, new ErrorCallback<Object>() { @Override public boolean error(final Object o, final Throwable throwable) { notification.fire(new NotificationEvent(view.getRemoveContainerErrorMessage(), NotificationEvent.NotificationType.ERROR)); serverTemplateSelectedEvent.fire(new ServerTemplateSelected(containerSpec.getServerTemplateKey())); return false; } }).deleteContainerSpec(containerSpec.getServerTemplateKey().getId(), containerSpec.getId()); } });
if ( container.getServerTemplateId().equals( containerSpec.getServerTemplateKey().getId() ) && container.getContainerSpecId().equals( containerSpec.getId() ) ) { buildAndIndexContainer( container );
NotificationEvent.NotificationType.ERROR)); verify(serverTemplateSelectedEvent, times(2)).fire(new ServerTemplateSelected(containerSpec.getServerTemplateKey()));
eq( containerSpec.getServerTemplateKey().getId() ), eq( containerSpec.getId() ), eq( containerSpec.getContainerName() ), eq( containerSpec1.getServerTemplateKey().getId() ), eq( containerSpec1.getId() ), eq( containerSpec1.getContainerName() ),
assertEquals(containerSpec.getServerTemplateKey().getId(), spec.getServerTemplateKey().getId()); assertEquals(containerSpec.getServerTemplateKey().getName(), spec.getServerTemplateKey().getName()); assertEquals(containerSpec.getConfigs().size(), spec.getConfigs().size());
assertEquals(serverTemplateId, spec.getServerTemplateKey().getId()); assertEquals("kie server name", spec.getServerTemplateKey().getName()); assertEquals(KieContainerStatus.STARTED, spec.getStatus()); assertEquals(0, spec.getConfigs().size());
assertEquals(serverTemplateId, spec.getServerTemplateKey().getId()); assertEquals("kie server name", spec.getServerTemplateKey().getName()); assertEquals(KieContainerStatus.STARTED, spec.getStatus()); assertEquals(0, spec.getConfigs().size()); assertEquals(serverTemplateId, spec.getServerTemplateKey().getId()); assertEquals("kie server name", spec.getServerTemplateKey().getName()); assertEquals(KieContainerStatus.STOPPED, spec.getStatus()); assertEquals(0, spec.getConfigs().size()); assertEquals(serverTemplateId, spec.getServerTemplateKey().getId()); assertEquals("kie server name", spec.getServerTemplateKey().getName()); assertEquals(KieContainerStatus.STARTED, spec.getStatus()); assertEquals(0, spec.getConfigs().size());
assertEquals(containerSpec.getServerTemplateKey().getId(), spec.getServerTemplateKey().getId()); assertEquals(containerSpec.getServerTemplateKey().getName(), spec.getServerTemplateKey().getName()); assertEquals(containerSpec.getConfigs().size(), spec.getConfigs().size());
@Override public synchronized void updateContainerSpec(final String serverTemplateId, final String containerId, final ContainerSpec containerSpec) { ServerTemplate serverTemplate = templateStorage.load(serverTemplateId); if (serverTemplate == null) { throw new KieServerControllerIllegalArgumentException("No server template found for id " + serverTemplateId); } if (!containerSpec.getId().equals(containerId)) { throw new KieServerControllerException("Cannot update container " + containerSpec.getId() + " on container " + containerId); } if (!serverTemplate.hasContainerSpec(containerSpec.getId())) { throw new KieServerControllerIllegalArgumentException("Server template with id " + serverTemplateId + " has no container with id " + containerSpec.getId()); } if (!serverTemplate.hasMatchingId(containerSpec.getServerTemplateKey())) { throw new KieServerControllerException("Cannot change container template key during update."); } // make sure correct server template is set containerSpec.setServerTemplateKey(new ServerTemplateKey(serverTemplate.getId(), serverTemplate.getName())); ContainerSpec currentVersion = serverTemplate.getContainerSpec(containerSpec.getId()); serverTemplate.deleteContainerSpec(currentVersion.getId()); serverTemplate.addContainerSpec(containerSpec); templateStorage.update(serverTemplate); notificationService.notify(new ServerTemplateUpdated(serverTemplate)); // in case container was started before it was update or update comes with status started update container in running servers if (currentVersion.getStatus().equals(KieContainerStatus.STARTED) || containerSpec.getStatus().equals(KieContainerStatus.STARTED)) { List<Container> containers = kieServerInstanceManager.upgradeAndStartContainer(serverTemplate, containerSpec); notificationService.notify(serverTemplate, containerSpec, containers); } }
assertEquals(containerSpec.getServerTemplateKey().getId(), spec.getServerTemplateKey().getId()); assertEquals(containerSpec.getServerTemplateKey().getName(), spec.getServerTemplateKey().getName()); assertEquals(containerSpec.getConfigs().size(), spec.getConfigs().size()); assertEquals(newContainerSpec.getServerTemplateKey().getId(), spec.getServerTemplateKey().getId()); assertEquals(newContainerSpec.getServerTemplateKey().getName(), spec.getServerTemplateKey().getName()); assertEquals(newContainerSpec.getConfigs().size(), spec.getConfigs().size());
assertEquals(containerSpec.getServerTemplateKey(), container.getServerTemplateKey()); assertEquals(containerSpec.getReleasedId(), container.getReleasedId()); assertEquals(containerSpec.getServerTemplateKey(), container.getServerTemplateKey()); assertEquals(containerSpec.getReleasedId(), container.getReleasedId());
assertEquals(containerSpec.getServerTemplateKey(), container.getServerTemplateKey()); assertEquals(containerSpec.getReleasedId(), container.getReleasedId()); assertEquals(newServerTemplateId, container.getServerTemplateKey().getId()); assertEquals(newServerTemplateName, container.getServerTemplateKey().getName()); assertEquals(containerSpec.getReleasedId(), container.getReleasedId());
assertEquals(containerSpec.getServerTemplateKey(), container.getServerTemplateKey()); assertEquals(containerSpec.getReleasedId(), container.getReleasedId()); assertEquals(containerSpec.getServerTemplateKey(), container.getServerTemplateKey()); assertEquals(containerSpec.getReleasedId(), container.getReleasedId());