Search in sources :

Example 6 with ServerInstanceSelected

use of org.kie.workbench.common.screens.server.management.client.events.ServerInstanceSelected in project kie-wb-common by kiegroup.

the class ContainerCardPresenterTest method testSetup.

@Test
public void testSetup() {
    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(serverInstanceKey, container);
    verify(linkTitlePresenter).setup(eq(serverInstanceKey.getServerName()), any(Command.class));
    verify(bodyPresenter).setup(Arrays.asList(message));
    verify(footerPresenter).setup(container.getUrl(), resolvedReleasedId.getVersion());
    verify(cardPresenter).addTitle(linkTitlePresenter);
    verify(cardPresenter).addBody(bodyPresenter);
    verify(cardPresenter).addFooter(footerPresenter);
    verify(view).setCard(cardPresenterView);
    linkTitlePresenter.onSelect();
    verify(remoteServerSelectedEvent).fire(eq(new ServerInstanceSelected(serverInstanceKey)));
}
Also used : Container(org.kie.server.controller.api.model.runtime.Container) Message(org.kie.server.api.model.Message) Command(org.uberfire.mvp.Command) FooterPresenter(org.kie.workbench.common.screens.server.management.client.widget.card.footer.FooterPresenter) CardPresenter(org.kie.workbench.common.screens.server.management.client.widget.card.CardPresenter) ServerInstanceKey(org.kie.server.controller.api.model.runtime.ServerInstanceKey) ReleaseId(org.kie.server.api.model.ReleaseId) LinkTitlePresenter(org.kie.workbench.common.screens.server.management.client.widget.card.title.LinkTitlePresenter) ServerInstanceSelected(org.kie.workbench.common.screens.server.management.client.events.ServerInstanceSelected) BodyPresenter(org.kie.workbench.common.screens.server.management.client.widget.card.body.BodyPresenter) Test(org.junit.Test)

Example 7 with ServerInstanceSelected

use of org.kie.workbench.common.screens.server.management.client.events.ServerInstanceSelected in project kie-wb-common by kiegroup.

the class ServerManagementBrowserPresenterTest method testOnSelectedServerInstance.

@Test
public void testOnSelectedServerInstance() {
    final RemotePresenter.View remoteView = mock(RemotePresenter.View.class);
    when(remotePresenter.getView()).thenReturn(remoteView);
    presenter.onSelected(new ServerInstanceSelected(new ServerInstanceKey()));
    verify(view).setContent(remoteView);
}
Also used : RemotePresenter(org.kie.workbench.common.screens.server.management.client.remote.RemotePresenter) ServerInstanceKey(org.kie.server.controller.api.model.runtime.ServerInstanceKey) ServerInstanceSelected(org.kie.workbench.common.screens.server.management.client.events.ServerInstanceSelected) Test(org.junit.Test)

Example 8 with ServerInstanceSelected

use of org.kie.workbench.common.screens.server.management.client.events.ServerInstanceSelected in project kie-wb-common by kiegroup.

the class RemotePresenterTest method testOnInstanceUpdate.

@Test
public void testOnInstanceUpdate() {
    final ServerInstance serverInstance = new ServerInstance("templateId", "serverName", "serverInstanceId", "url", "1.0", Collections.<Message>emptyList(), Collections.<Container>emptyList());
    presenter.onSelect(new ServerInstanceSelected(serverInstance));
    presenter.onInstanceUpdate(new ServerInstanceUpdated(serverInstance));
    verify(view, times(2)).clear();
    verify(view, times(2)).setServerName(serverInstance.getServerName());
    verify(view, times(2)).setServerURL(serverInstance.getUrl());
    verify(view, times(2)).setEmptyView(remoteEmptyPresenter.getView());
}
Also used : ServerInstanceUpdated(org.kie.server.controller.api.model.events.ServerInstanceUpdated) ServerInstance(org.kie.server.controller.api.model.runtime.ServerInstance) ServerInstanceSelected(org.kie.workbench.common.screens.server.management.client.events.ServerInstanceSelected) Test(org.junit.Test)

Example 9 with ServerInstanceSelected

use of org.kie.workbench.common.screens.server.management.client.events.ServerInstanceSelected in project kie-wb-common by kiegroup.

the class RemotePresenterTest method testOnInstanceUpdateDifferentServer.

@Test
public void testOnInstanceUpdateDifferentServer() {
    final ServerInstance serverInstance = new ServerInstance("templateId", "serverName", "serverInstanceId", "url", "1.0", Collections.<Message>emptyList(), Collections.<Container>emptyList());
    presenter.onSelect(new ServerInstanceSelected(serverInstance));
    final ServerInstance serverInstance2 = new ServerInstance("templateId2", "serverName2", "serverInstanceId2", "url", "1.0", Collections.<Message>emptyList(), Collections.<Container>emptyList());
    presenter.onInstanceUpdate(new ServerInstanceUpdated(serverInstance2));
    verify(view).clear();
    verify(view).setServerName(serverInstance.getServerName());
    verify(view).setServerURL(serverInstance.getUrl());
    verify(view).setEmptyView(remoteEmptyPresenter.getView());
}
Also used : ServerInstanceUpdated(org.kie.server.controller.api.model.events.ServerInstanceUpdated) ServerInstance(org.kie.server.controller.api.model.runtime.ServerInstance) ServerInstanceSelected(org.kie.workbench.common.screens.server.management.client.events.ServerInstanceSelected) Test(org.junit.Test)

Example 10 with ServerInstanceSelected

use of org.kie.workbench.common.screens.server.management.client.events.ServerInstanceSelected in project kie-wb-common by kiegroup.

the class RemotePresenterTest method testSelectAndRefreshEmptyContainers.

@Test
public void testSelectAndRefreshEmptyContainers() {
    final ServerInstanceKey serverInstanceKey = new ServerInstanceKey("templateId", "serverName", "serverInstanceId", "url");
    when(runtimeManagementService.getContainersByServerInstance(serverInstanceKey.getServerTemplateId(), serverInstanceKey.getServerInstanceId())).thenReturn(Collections.<Container>emptyList());
    presenter.onSelect(new ServerInstanceSelected(serverInstanceKey));
    verify(view).clear();
    verify(view).setServerName(serverInstanceKey.getServerName());
    verify(view).setServerURL(serverInstanceKey.getUrl());
    verify(view).setEmptyView(remoteEmptyPresenter.getView());
}
Also used : ServerInstanceKey(org.kie.server.controller.api.model.runtime.ServerInstanceKey) ServerInstanceSelected(org.kie.workbench.common.screens.server.management.client.events.ServerInstanceSelected) Test(org.junit.Test)

Aggregations

ServerInstanceSelected (org.kie.workbench.common.screens.server.management.client.events.ServerInstanceSelected)11 Test (org.junit.Test)9 ServerInstanceKey (org.kie.server.controller.api.model.runtime.ServerInstanceKey)7 Command (org.uberfire.mvp.Command)3 ServerInstanceUpdated (org.kie.server.controller.api.model.events.ServerInstanceUpdated)2 Container (org.kie.server.controller.api.model.runtime.Container)2 ServerInstance (org.kie.server.controller.api.model.runtime.ServerInstance)2 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)2 Message (org.kie.server.api.model.Message)1 ReleaseId (org.kie.server.api.model.ReleaseId)1 RemotePresenter (org.kie.workbench.common.screens.server.management.client.remote.RemotePresenter)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 LinkTitlePresenter (org.kie.workbench.common.screens.server.management.client.widget.card.title.LinkTitlePresenter)1 ParameterizedCommand (org.uberfire.mvp.ParameterizedCommand)1