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);
}
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());
}
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());
}
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());
}
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();
}
}
Aggregations