Search in sources :

Example 1 with ContainerSpecKey

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

the class ServerTemplatePresenterTest method testOnContainerSelect.

@Test
public void testOnContainerSelect() {
    final ServerTemplateKey serverTemplateKey = new ServerTemplateKey("ServerTemplateKeyId", "ServerTemplateKeyName");
    final ContainerSpecKey containerSpecKey = new ContainerSpecKey("containerId", "containerName", serverTemplateKey);
    presenter.onContainerSelect(new ContainerSpecSelected(containerSpecKey));
    verify(view).selectContainer(serverTemplateKey.getId(), containerSpecKey.getId());
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) ContainerSpecSelected(org.kie.workbench.common.screens.server.management.client.events.ContainerSpecSelected) ContainerSpecKey(org.kie.server.controller.api.model.spec.ContainerSpecKey) Test(org.junit.Test)

Example 2 with ContainerSpecKey

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

the class ContainerCardPresenterTest method testSetup.

@Test
public void testSetup() {
    final InfoTitlePresenter infoTitlePresenter = mock(InfoTitlePresenter.class);
    when(infoTitlePresenterProvider.get()).thenReturn(infoTitlePresenter);
    final LinkTitlePresenter linkTitlePresenter = spy(new LinkTitlePresenter(mock(LinkTitlePresenter.View.class)));
    when(linkTitlePresenterProvider.get()).thenReturn(linkTitlePresenter);
    final BodyPresenter bodyPresenter = mock(BodyPresenter.class);
    when(bodyPresenterProvider.get()).thenReturn(bodyPresenter);
    final FooterPresenter footerPresenter = mock(FooterPresenter.class);
    when(footerPresenterProvider.get()).thenReturn(footerPresenter);
    final CardPresenter.View cardPresenterView = mock(CardPresenter.View.class);
    final CardPresenter cardPresenter = spy(new CardPresenter(cardPresenterView));
    when(cardPresenterProvider.get()).thenReturn(cardPresenter);
    final ServerInstanceKey serverInstanceKey = new ServerInstanceKey("templateId", "serverName", "serverInstanceId", "url");
    final Message message = new Message(Severity.INFO, "testMessage");
    final ReleaseId resolvedReleasedId = new ReleaseId("org.kie", "container", "1.0.0");
    final Container container = new Container("containerSpecId", "containerName", serverInstanceKey, Collections.singletonList(message), resolvedReleasedId, null);
    presenter.setup(container);
    verify(linkTitlePresenter).setup(eq(container.getContainerName()), any(Command.class));
    verify(infoTitlePresenter).setup(container.getResolvedReleasedId());
    verify(bodyPresenter).setup(Arrays.asList(message));
    verify(footerPresenter).setup(container.getUrl(), resolvedReleasedId.getVersion());
    verify(cardPresenter).addTitle(linkTitlePresenter);
    verify(cardPresenter).addTitle(infoTitlePresenter);
    verify(cardPresenter).addBody(bodyPresenter);
    verify(cardPresenter).addFooter(footerPresenter);
    verify(view).setCard(cardPresenterView);
    linkTitlePresenter.onSelect();
    final ContainerSpecKey containerSpecKey = new ContainerSpecKey(container.getContainerSpecId(), container.getContainerName(), new ServerTemplateKey(container.getServerInstanceKey().getServerTemplateId(), ""));
    verify(containerSpecSelectedEvent).fire(eq(new ContainerSpecSelected(containerSpecKey)));
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) Message(org.kie.server.api.model.Message) FooterPresenter(org.kie.workbench.common.screens.server.management.client.widget.card.footer.FooterPresenter) ReleaseId(org.kie.server.api.model.ReleaseId) ContainerSpecKey(org.kie.server.controller.api.model.spec.ContainerSpecKey) InfoTitlePresenter(org.kie.workbench.common.screens.server.management.client.widget.card.title.InfoTitlePresenter) Container(org.kie.server.controller.api.model.runtime.Container) Command(org.uberfire.mvp.Command) CardPresenter(org.kie.workbench.common.screens.server.management.client.widget.card.CardPresenter) ContainerSpecSelected(org.kie.workbench.common.screens.server.management.client.events.ContainerSpecSelected) ServerInstanceKey(org.kie.server.controller.api.model.runtime.ServerInstanceKey) LinkTitlePresenter(org.kie.workbench.common.screens.server.management.client.widget.card.title.LinkTitlePresenter) BodyPresenter(org.kie.workbench.common.screens.server.management.client.widget.card.body.BodyPresenter) Test(org.junit.Test)

Example 3 with ContainerSpecKey

use of org.kie.server.controller.api.model.spec.ContainerSpecKey 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)

Example 4 with ContainerSpecKey

use of org.kie.server.controller.api.model.spec.ContainerSpecKey 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 5 with ContainerSpecKey

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

the class ServerManagementBrowserPresenterTest method testOnSelectedContainerSpec.

@Test
public void testOnSelectedContainerSpec() {
    final ContainerPresenter.View containerView = mock(ContainerPresenter.View.class);
    when(containerPresenter.getView()).thenReturn(containerView);
    presenter.onSelected(new ContainerSpecSelected(new ContainerSpecKey()));
    verify(view).setContent(containerView);
}
Also used : ContainerSpecSelected(org.kie.workbench.common.screens.server.management.client.events.ContainerSpecSelected) ContainerSpecKey(org.kie.server.controller.api.model.spec.ContainerSpecKey) ContainerPresenter(org.kie.workbench.common.screens.server.management.client.container.ContainerPresenter) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 ContainerSpecKey (org.kie.server.controller.api.model.spec.ContainerSpecKey)8 ServerTemplateKey (org.kie.server.controller.api.model.spec.ServerTemplateKey)5 ContainerSpecSelected (org.kie.workbench.common.screens.server.management.client.events.ContainerSpecSelected)3 ProcessConfig (org.kie.server.controller.api.model.spec.ProcessConfig)2 Message (org.kie.server.api.model.Message)1 ReleaseId (org.kie.server.api.model.ReleaseId)1 RuleConfigUpdated (org.kie.server.controller.api.model.events.RuleConfigUpdated)1 Container (org.kie.server.controller.api.model.runtime.Container)1 ServerInstanceKey (org.kie.server.controller.api.model.runtime.ServerInstanceKey)1 RuleConfig (org.kie.server.controller.api.model.spec.RuleConfig)1 ContainerPresenter (org.kie.workbench.common.screens.server.management.client.container.ContainerPresenter)1 RefreshRemoteServers (org.kie.workbench.common.screens.server.management.client.events.RefreshRemoteServers)1 State (org.kie.workbench.common.screens.server.management.client.util.State)1 CardPresenter (org.kie.workbench.common.screens.server.management.client.widget.card.CardPresenter)1 BodyPresenter (org.kie.workbench.common.screens.server.management.client.widget.card.body.BodyPresenter)1 FooterPresenter (org.kie.workbench.common.screens.server.management.client.widget.card.footer.FooterPresenter)1 InfoTitlePresenter (org.kie.workbench.common.screens.server.management.client.widget.card.title.InfoTitlePresenter)1 LinkTitlePresenter (org.kie.workbench.common.screens.server.management.client.widget.card.title.LinkTitlePresenter)1 ContainerSpecData (org.kie.workbench.common.screens.server.management.model.ContainerSpecData)1