use of org.kie.server.controller.api.model.runtime.ServerInstanceKey in project kie-wb-common by kiegroup.
the class ServerTemplatePresenter method setup.
public void setup(final ServerTemplate serverTemplate, final ContainerSpec firstContainerSpec) {
view.clear();
this.serverTemplate = serverTemplate;
view.setTemplate(serverTemplate.getId(), serverTemplate.getName());
view.setProcessCapability(serverTemplate.getCapabilities().contains(Capability.PROCESS.toString()));
view.setRulesCapability(serverTemplate.getCapabilities().contains(Capability.RULE.toString()));
view.setPlanningCapability(serverTemplate.getCapabilities().contains(Capability.PLANNING.toString()));
if (firstContainerSpec != null) {
addContainer(firstContainerSpec);
for (final ContainerSpec containerSpec : serverTemplate.getContainersSpec()) {
if (!containerSpec.getId().equals(firstContainerSpec.getId())) {
addContainer(containerSpec);
}
}
containerSpecSelectedEvent.fire(new ContainerSpecSelected(firstContainerSpec));
}
for (final ServerInstanceKey serverInstanceKey : serverTemplate.getServerInstanceKeys()) {
addServerInstance(serverInstanceKey);
}
}
use of org.kie.server.controller.api.model.runtime.ServerInstanceKey in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenterTest method testOnDelete.
@Test
public void testOnDelete() {
final ServerInstanceKey serverInstanceKey = new ServerInstanceKey("serverInstanceKeyId", "serverName", "serverInstanceId", "url");
final ServerTemplate serverTemplate = new ServerTemplate("ServerTemplateId", "ServerTemplateName");
serverTemplate.addServerInstance(serverInstanceKey);
when(serverTemplatePresenter.getCurrentServerTemplate()).thenReturn(serverTemplate);
final ServerTemplateKey serverTemplateKey = new ServerTemplateKey("ServerTemplateKeyId", "ServerTemplateKeyName");
final List<ServerTemplateKey> serverTemplateKeys = Collections.singletonList(serverTemplateKey);
when(specManagementService.listServerTemplateKeys()).thenReturn(new ServerTemplateKeyList(serverTemplateKeys));
presenter.onDelete(new ServerInstanceDeleted(serverInstanceKey.getServerInstanceId()));
verify(navigationPresenter).setup(serverTemplateKey, serverTemplateKeys);
final ArgumentCaptor<ServerTemplateSelected> templateSelectedCaptor = ArgumentCaptor.forClass(ServerTemplateSelected.class);
verify(serverTemplateSelectedEvent).fire(templateSelectedCaptor.capture());
assertEquals(serverTemplateKey, templateSelectedCaptor.getValue().getServerTemplateKey());
}
use of org.kie.server.controller.api.model.runtime.ServerInstanceKey in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenterTest method testOnContainerUpdateWarn.
@Test
public void testOnContainerUpdateWarn() {
when(view.getWarnMessage(ClientContainerRuntimeOperation.START_CONTAINER, 2)).thenReturn("Warn");
presenter.onContainerUpdate(new ContainerUpdateEvent(mock(ServerTemplateKey.class), mock(ContainerSpec.class), new ArrayList<ServerInstanceKey>() {
{
add(mock(ServerInstanceKey.class));
add(mock(ServerInstanceKey.class));
}
}, ContainerRuntimeState.PARTIAL_ONLINE, ContainerRuntimeOperation.START_CONTAINER));
verify(notification).fire(new NotificationEvent("Warn", NotificationEvent.NotificationType.WARNING));
}
use of org.kie.server.controller.api.model.runtime.ServerInstanceKey in project kie-wb-common by kiegroup.
the class ContainerPresenterTest method testLoadContainers.
@Test
public void testLoadContainers() {
final Container container = new Container("containerSpecId", "containerName", new ServerInstanceKey(), Collections.<Message>emptyList(), null, null);
containerSpecData.getContainers().add(container);
presenter.loadContainers(containerSpecData);
verifyLoad(true, 1);
}
use of org.kie.server.controller.api.model.runtime.ServerInstanceKey in project kie-wb-common by kiegroup.
the class ContainerRemoteStatusPresenterTest method testOnDelete.
@Test
public void testOnDelete() {
final ContainerCardPresenter cardPresenter = mock(ContainerCardPresenter.class);
when(cardPresenter.getView()).thenReturn(mock(ContainerCardPresenter.View.class));
when(presenterProvider.get()).thenReturn(cardPresenter);
final ServerInstanceKey serverInstanceKey = new ServerInstanceKey("templateId", "serverName", "serverInstanceId", "url");
final Container container = new Container("containerSpecId", "containerName", serverInstanceKey, Collections.<Message>emptyList(), null, null);
container.setStatus(KieContainerStatus.STARTED);
presenter.setup(new ContainerSpec(), Collections.singletonList(container));
verify(view).clear();
verify(cardPresenter).setup(container.getServerInstanceKey(), container);
verify(view).addCard(any(IsWidget.class));
presenter.onDelete(new ServerInstanceDeleted(serverInstanceKey.getServerInstanceId()));
verify(cardPresenter).delete();
presenter.onDelete(new ServerInstanceDeleted("randomKey"));
verify(cardPresenter).delete();
}
Aggregations