Search in sources :

Example 21 with ServerTemplateKey

use of org.kie.server.controller.api.model.spec.ServerTemplateKey in project kie-wb-common by kiegroup.

the class ServerManagementBrowserPresenterTest method testOnServerTemplateUpdated.

@Test
public void testOnServerTemplateUpdated() {
    final ServerTemplate serverTemplate = new ServerTemplate("ServerTemplateId", "ServerTemplateName");
    presenter.onServerTemplateUpdated(new ServerTemplateUpdated(serverTemplate));
    final ArgumentCaptor<Collection> serverTemplateKeysCaptor = ArgumentCaptor.forClass(Collection.class);
    verify(navigationPresenter).setup(eq(serverTemplate), serverTemplateKeysCaptor.capture());
    final Collection<ServerTemplateKey> serverTemplateKeys = serverTemplateKeysCaptor.getValue();
    assertEquals(1, serverTemplateKeys.size());
    assertTrue(serverTemplateKeys.contains(serverTemplate));
    final ArgumentCaptor<ServerTemplateSelected> templateSelectedCaptor = ArgumentCaptor.forClass(ServerTemplateSelected.class);
    verify(serverTemplateSelectedEvent).fire(templateSelectedCaptor.capture());
    assertEquals(serverTemplate, templateSelectedCaptor.getValue().getServerTemplateKey());
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) Collection(java.util.Collection) ServerTemplateSelected(org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected) ServerTemplateUpdated(org.kie.server.controller.api.model.events.ServerTemplateUpdated) Test(org.junit.Test)

Example 22 with ServerTemplateKey

use of org.kie.server.controller.api.model.spec.ServerTemplateKey in project kie-wb-common by kiegroup.

the class ServerManagementBrowserPresenterTest method testOnOpen.

@Test
public void testOnOpen() {
    final ServerTemplateKey serverTemplateKey = new ServerTemplateKey("ServerTemplateKeyId", "ServerTemplateKeyName");
    final List<ServerTemplateKey> serverTemplateKeys = Collections.singletonList(serverTemplateKey);
    when(specManagementService.listServerTemplateKeys()).thenReturn(new ServerTemplateKeyList(serverTemplateKeys));
    presenter.onOpen();
    verify(navigationPresenter).setup(serverTemplateKey, serverTemplateKeys);
    final ArgumentCaptor<ServerTemplateSelected> templateSelectedCaptor = ArgumentCaptor.forClass(ServerTemplateSelected.class);
    verify(serverTemplateSelectedEvent).fire(templateSelectedCaptor.capture());
    assertEquals(serverTemplateKey, templateSelectedCaptor.getValue().getServerTemplateKey());
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) ServerTemplateSelected(org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected) ServerTemplateKeyList(org.kie.server.controller.api.model.spec.ServerTemplateKeyList) Test(org.junit.Test)

Example 23 with ServerTemplateKey

use of org.kie.server.controller.api.model.spec.ServerTemplateKey in project kie-wb-common by kiegroup.

the class ServerManagementBrowserPresenterTest method testOnServerDeleted.

@Test
public void testOnServerDeleted() {
    final ServerTemplateKey serverTemplateKey = new ServerTemplateKey("ServerTemplateKeyId", "ServerTemplateKeyName");
    final List<ServerTemplateKey> serverTemplateKeys = Collections.singletonList(serverTemplateKey);
    when(specManagementService.listServerTemplateKeys()).thenReturn(new ServerTemplateKeyList(serverTemplateKeys));
    presenter.onServerDeleted(new ServerTemplateDeleted());
    verify(navigationPresenter).setup(serverTemplateKey, serverTemplateKeys);
    final ArgumentCaptor<ServerTemplateSelected> templateSelectedCaptor = ArgumentCaptor.forClass(ServerTemplateSelected.class);
    verify(serverTemplateSelectedEvent).fire(templateSelectedCaptor.capture());
    assertEquals(serverTemplateKey, templateSelectedCaptor.getValue().getServerTemplateKey());
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) ServerTemplateDeleted(org.kie.server.controller.api.model.events.ServerTemplateDeleted) ServerTemplateSelected(org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected) ServerTemplateKeyList(org.kie.server.controller.api.model.spec.ServerTemplateKeyList) Test(org.junit.Test)

Example 24 with ServerTemplateKey

use of org.kie.server.controller.api.model.spec.ServerTemplateKey in project kie-wb-common by kiegroup.

the class ContainerProcessConfigPresenterTest method testSetup.

@Test
public void testSetup() {
    final ContainerSpecKey containerSpecKey = new ContainerSpecKey("id", "container-name", new ServerTemplateKey("template-id", "template-name"));
    final ProcessConfig processConfig = new ProcessConfig(RuntimeStrategy.PER_REQUEST.toString(), "kbase", "ksession", MergeMode.KEEP_ALL.toString());
    presenter.setup(containerSpecKey, processConfig);
    verify(view).enableActions();
    verify(processConfigPresenter).setup(containerSpecKey, processConfig);
    verify(processConfigPresenter).setProcessConfig(processConfig);
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) ProcessConfig(org.kie.server.controller.api.model.spec.ProcessConfig) ContainerSpecKey(org.kie.server.controller.api.model.spec.ContainerSpecKey) Test(org.junit.Test)

Example 25 with ServerTemplateKey

use of org.kie.server.controller.api.model.spec.ServerTemplateKey in project kie-wb-common by kiegroup.

the class ContainerRemoteStatusPresenterTest method testOnServerInstanceUpdatedNewInstance.

@Test
public void testOnServerInstanceUpdatedNewInstance() {
    presenter = spy(new ContainerRemoteStatusPresenter(logger, view, presenterProvider));
    final ContainerCardPresenter cardPresenter = mock(ContainerCardPresenter.class);
    when(cardPresenter.getView()).thenReturn(mock(ContainerCardPresenter.View.class));
    final ContainerCardPresenter cardPresenter2 = mock(ContainerCardPresenter.class);
    when(cardPresenter2.getView()).thenReturn(mock(ContainerCardPresenter.View.class));
    final ContainerCardPresenter cardPresenter3 = mock(ContainerCardPresenter.class);
    when(cardPresenter3.getView()).thenReturn(mock(ContainerCardPresenter.View.class));
    doReturn(cardPresenter).doReturn(cardPresenter2).doReturn(cardPresenter3).when(presenterProvider).get();
    final ServerInstance serverInstance = new ServerInstance("templateId", "serverInstanceId", "serverInstanceId", "url", "1.0", Collections.<Message>emptyList(), Collections.<Container>emptyList());
    final Container existingContainer = new Container("containerToBeRemovedSpecId", "containerToBeRemovedName", serverInstance, Collections.<Message>emptyList(), null, null);
    existingContainer.setStatus(KieContainerStatus.STARTED);
    final ServerInstance newServerInstance = new ServerInstance("templateId", "newserverInstanceId", "newserverInstanceId", "url", "1.0", Collections.<Message>emptyList(), Collections.<Container>emptyList());
    final Container newContainer = new Container("containerSpecId", "containerName", newServerInstance, Collections.<Message>emptyList(), null, null);
    newContainer.setStatus(KieContainerStatus.STARTED);
    newServerInstance.addContainer(newContainer);
    presenter.setup(new ContainerSpec("containerSpecId", "containerName", new ServerTemplateKey("templateId", "templateId"), new ReleaseId(), KieContainerStatus.STARTED, Collections.<Capability, ContainerConfig>emptyMap()), Arrays.asList(existingContainer));
    verify(cardPresenter).setup(toKey(serverInstance), existingContainer);
    presenter.onServerInstanceUpdated(new ServerInstanceUpdated(newServerInstance));
    // One container added
    verify(cardPresenter2).setup(toKey(newServerInstance), newContainer);
    final Container newContainer2 = new Container("containerSpecId", "containerNameX", newServerInstance, Collections.<Message>emptyList(), null, null);
    newContainer2.setStatus(KieContainerStatus.STARTED);
    newServerInstance.addContainer(newContainer2);
    // One new container added to existing server
    presenter.onServerInstanceUpdated(new ServerInstanceUpdated(newServerInstance));
    verify(cardPresenter3).setup(newContainer2.getServerInstanceKey(), newContainer2);
}
Also used : ContainerConfig(org.kie.server.controller.api.model.spec.ContainerConfig) ContainerCardPresenter(org.kie.workbench.common.screens.server.management.client.container.status.card.ContainerCardPresenter) Container(org.kie.server.controller.api.model.runtime.Container) ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) Capability(org.kie.server.controller.api.model.spec.Capability) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) ServerInstanceUpdated(org.kie.server.controller.api.model.events.ServerInstanceUpdated) ReleaseId(org.kie.server.api.model.ReleaseId) ServerInstance(org.kie.server.controller.api.model.runtime.ServerInstance) Test(org.junit.Test)

Aggregations

ServerTemplateKey (org.kie.server.controller.api.model.spec.ServerTemplateKey)26 Test (org.junit.Test)19 ServerTemplate (org.kie.server.controller.api.model.spec.ServerTemplate)11 ContainerSpec (org.kie.server.controller.api.model.spec.ContainerSpec)9 ServerTemplateSelected (org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected)9 ReleaseId (org.kie.server.api.model.ReleaseId)8 Container (org.kie.server.controller.api.model.runtime.Container)5 ServerInstanceKey (org.kie.server.controller.api.model.runtime.ServerInstanceKey)5 ContainerSpecKey (org.kie.server.controller.api.model.spec.ContainerSpecKey)5 ProcessConfig (org.kie.server.controller.api.model.spec.ProcessConfig)5 RuleConfig (org.kie.server.controller.api.model.spec.RuleConfig)4 Capability (org.kie.server.controller.api.model.spec.Capability)3 ContainerConfig (org.kie.server.controller.api.model.spec.ContainerConfig)3 ServerTemplateKeyList (org.kie.server.controller.api.model.spec.ServerTemplateKeyList)3 ContainerSpecData (org.kie.workbench.common.screens.server.management.model.ContainerSpecData)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Before (org.junit.Before)2 ContainerSpecSelected (org.kie.workbench.common.screens.server.management.client.events.ContainerSpecSelected)2 ServerTemplatePresenter (org.kie.workbench.common.screens.server.management.client.navigation.template.ServerTemplatePresenter)2