Search in sources :

Example 6 with ServerTemplateKey

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

the class ServerTemplateVFSStorageTest method testStoreLoadAndDeleteServerTemplate.

@Test
public void testStoreLoadAndDeleteServerTemplate() {
    templateStorage.store(serverTemplate);
    Collection<ServerTemplateKey> templateKeys = templateStorage.loadKeys();
    assertNotNull(templateKeys);
    assertEquals(1, templateKeys.size());
    templateStorage.delete(serverTemplate.getId());
    boolean exists = templateStorage.exists(serverTemplate.getId());
    assertFalse(exists);
    ServerTemplate template = templateStorage.load("not existing");
    assertNull(template);
    templateKeys = templateStorage.loadKeys();
    assertNotNull(templateKeys);
    assertEquals(0, templateKeys.size());
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) Test(org.junit.Test)

Example 7 with ServerTemplateKey

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

the class ServerNavigationPresenter method setup.

public void setup(final ServerTemplateKey firstTemplate, final Collection<ServerTemplateKey> serverTemplateKeys) {
    view.clean();
    serverTemplates.clear();
    addTemplate(checkNotNull("serverTemplate2BeSelected", firstTemplate));
    for (final ServerTemplateKey serverTemplateKey : serverTemplateKeys) {
        if (!serverTemplateKey.equals(firstTemplate)) {
            addTemplate(serverTemplateKey);
        }
    }
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey)

Example 8 with ServerTemplateKey

use of org.kie.server.controller.api.model.spec.ServerTemplateKey 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());
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) ServerInstanceDeleted(org.kie.server.controller.api.model.events.ServerInstanceDeleted) ServerTemplateSelected(org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected) ServerInstanceKey(org.kie.server.controller.api.model.runtime.ServerInstanceKey) ServerTemplateKeyList(org.kie.server.controller.api.model.spec.ServerTemplateKeyList) Test(org.junit.Test)

Example 9 with ServerTemplateKey

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

the class ServerManagementBrowserPresenterTest method testOnSelectedNonEmptyServerTemplate.

@Test
public void testOnSelectedNonEmptyServerTemplate() {
    final ServerTemplate serverTemplate = new ServerTemplate("ServerTemplateId", "ServerTemplateName");
    final ContainerSpec toBeSelected = mock(ContainerSpec.class);
    serverTemplate.addContainerSpec(toBeSelected);
    when(toBeSelected.getId()).thenReturn("other-id");
    final ContainerSpec forcedToBeSelected = mock(ContainerSpec.class);
    when(forcedToBeSelected.getId()).thenReturn("container-id");
    serverTemplate.addContainerSpec(forcedToBeSelected);
    final ServerTemplateKey serverTemplateKey = new ServerTemplateKey("ServerTemplateKeyId", "ServerTemplateKeyName");
    when(specManagementService.getServerTemplate(serverTemplateKey.getId())).thenReturn(serverTemplate);
    final ServerTemplatePresenter.View serverView = mock(ServerTemplatePresenter.View.class);
    when(serverTemplatePresenter.getView()).thenReturn(serverView);
    presenter.onSelected(new ServerTemplateSelected(serverTemplateKey));
    verify(view).setServerTemplate(serverView);
    verify(specManagementService).getServerTemplate(serverTemplateKey.getId());
    verify(serverTemplatePresenter).setup(serverTemplate, toBeSelected);
    presenter.onSelected(new ServerTemplateSelected(serverTemplateKey, "container-id"));
    verify(serverTemplatePresenter).setup(serverTemplate, forcedToBeSelected);
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) ServerTemplatePresenter(org.kie.workbench.common.screens.server.management.client.navigation.template.ServerTemplatePresenter) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) ServerTemplateSelected(org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected) Test(org.junit.Test)

Example 10 with ServerTemplateKey

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

the class ContainerPresenterTest method testLoadWhenRuntimeManagementServiceReturnsInvalidData.

// Test fix for GUVNOR-3579
@Test
public void testLoadWhenRuntimeManagementServiceReturnsInvalidData() {
    ContainerSpecData badData = new ContainerSpecData(null, null);
    when(runtimeManagementService.getContainersByContainerSpec(anyObject(), anyObject())).thenReturn(badData);
    ContainerSpecKey lookupKey = new ContainerSpecKey("dummyId", "dummyName", new ServerTemplateKey("keyId", "keyName"));
    // Doesn't throw NPE when ContainerSpecData contain nulls
    presenter.load(lookupKey);
    verify(view, never()).setContainerName(anyString());
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) ContainerSpecData(org.kie.workbench.common.screens.server.management.model.ContainerSpecData) ContainerSpecKey(org.kie.server.controller.api.model.spec.ContainerSpecKey) 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