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