Search in sources :

Example 11 with ServerTemplateKey

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

the class ContainerPresenterTest method init.

@Before
public void init() {
    runtimeManagementServiceCaller = new CallerMock<RuntimeManagementService>(runtimeManagementService);
    specManagementServiceCaller = new CallerMock<SpecManagementService>(specManagementService);
    doNothing().when(serverTemplateSelectedEvent).fire(any(ServerTemplateSelected.class));
    doNothing().when(notification).fire(any(NotificationEvent.class));
    when(containerStatusEmptyPresenter.getView()).thenReturn(containerStatusEmptyPresenterView);
    when(containerRemoteStatusPresenter.getView()).thenReturn(containerRemoteStatusPresenterView);
    presenter = spy(new ContainerPresenter(logger, view, containerRemoteStatusPresenter, containerStatusEmptyPresenter, containerProcessConfigPresenter, containerRulesConfigPresenter, runtimeManagementServiceCaller, specManagementServiceCaller, serverTemplateSelectedEvent, notification));
    releaseId = new ReleaseId("org.kie", "container", "1.0.0");
    serverTemplateKey = new ServerTemplateKey("serverTemplateKeyId", "serverTemplateKeyName");
    containerSpec = new ContainerSpec("containerId", "containerName", serverTemplateKey, releaseId, KieContainerStatus.STOPPED, new HashMap<Capability, ContainerConfig>());
    containerSpec.addConfig(Capability.PROCESS, new ProcessConfig());
    containerSpec.addConfig(Capability.RULE, new RuleConfig());
    containers = new ArrayList<Container>();
    containerSpecData = new ContainerSpecData(containerSpec, containers);
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) ProcessConfig(org.kie.server.controller.api.model.spec.ProcessConfig) HashMap(java.util.HashMap) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) ServerTemplateSelected(org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) ReleaseId(org.kie.server.api.model.ReleaseId) Container(org.kie.server.controller.api.model.runtime.Container) RuntimeManagementService(org.kie.workbench.common.screens.server.management.service.RuntimeManagementService) RuleConfig(org.kie.server.controller.api.model.spec.RuleConfig) ContainerSpecData(org.kie.workbench.common.screens.server.management.model.ContainerSpecData) SpecManagementService(org.kie.workbench.common.screens.server.management.service.SpecManagementService) Before(org.junit.Before)

Example 12 with ServerTemplateKey

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

the class ContainerStatusEmptyPresenterTest method testRefresh.

@Test
public void testRefresh() {
    final ContainerSpecKey containerSpecKey = new ContainerSpecKey("id", "name", new ServerTemplateKey());
    presenter.setup(containerSpecKey);
    presenter.refresh();
    final ArgumentCaptor<RefreshRemoteServers> refreshRemoteServersCaptor = ArgumentCaptor.forClass(RefreshRemoteServers.class);
    verify(refreshRemoteServersEvent).fire(refreshRemoteServersCaptor.capture());
    assertEquals(containerSpecKey, refreshRemoteServersCaptor.getValue().getContainerSpecKey());
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) RefreshRemoteServers(org.kie.workbench.common.screens.server.management.client.events.RefreshRemoteServers) ContainerSpecKey(org.kie.server.controller.api.model.spec.ContainerSpecKey) Test(org.junit.Test)

Example 13 with ServerTemplateKey

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

the class ServerNavigationPresenterTest method testSetupList.

@Test
public void testSetupList() {
    final ServerTemplateKey serverTemplateKey = new ServerTemplateKey("ServerTemplateKeyId", "ServerTemplateKeyName");
    final ServerTemplateKey serverTemplateKey2 = new ServerTemplateKey("ServerTemplateKeyId2", "ServerTemplateKeyName2");
    presenter.setup(serverTemplateKey, Collections.singletonList(serverTemplateKey2));
    verify(view).clean();
    verify(view).addTemplate(serverTemplateKey.getId(), serverTemplateKey.getName());
    verify(view).addTemplate(serverTemplateKey2.getId(), serverTemplateKey2.getName());
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) Test(org.junit.Test)

Example 14 with ServerTemplateKey

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

the class ServerNavigationPresenterTest method testOnSelect.

@Test
public void testOnSelect() {
    final ServerTemplateKey serverTemplateKey = new ServerTemplateKey("ServerTemplateKeyId", "ServerTemplateKeyName");
    presenter.onSelect(new ServerTemplateSelected(serverTemplateKey));
    verify(view).select(serverTemplateKey.getId());
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) ServerTemplateSelected(org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected) Test(org.junit.Test)

Example 15 with ServerTemplateKey

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

the class ServerTemplateVFSStorage method loadKeys.

@Override
public List<ServerTemplateKey> loadKeys() {
    logger.debug("About to load all available server templates (as keys only)...");
    final List<ServerTemplateKey> result = new ArrayList<ServerTemplateKey>();
    final Path dir = buildPath(null);
    try {
        ioService.startBatch(dir.getFileSystem());
        for (final Path registeredServer : ioService.newDirectoryStream(dir)) {
            try {
                ServerTemplate serverTemplate = readServerTemplate(registeredServer);
                logger.debug("Found server template {}, taking its short key version...");
                result.add(new ServerTemplateKey(serverTemplate.getId(), serverTemplate.getName()));
            } catch (final Exception ignore) {
                ioService.delete(registeredServer);
            }
        }
        logger.debug("All found server template keys {}", result);
        return result;
    } catch (final NotDirectoryException ignore) {
        logger.debug("No directory found {}, returning empty result", dir);
        return result;
    } finally {
        ioService.endBatch();
    }
}
Also used : Path(org.uberfire.java.nio.file.Path) ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) NotDirectoryException(org.uberfire.java.nio.file.NotDirectoryException) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) ArrayList(java.util.ArrayList) NotDirectoryException(org.uberfire.java.nio.file.NotDirectoryException)

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