Search in sources :

Example 6 with Message

use of org.kie.server.api.model.Message 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 Message

use of org.kie.server.api.model.Message in project kie-wb-common by kiegroup.

the class NotificationPresenterTest method testSetupSingleMessage.

@Test
public void testSetupSingleMessage() {
    final Message message = new Message(Severity.ERROR, "single error");
    presenter.setup(message);
    verify(view).setup(NotificationType.ERROR, "1", "1: single error");
}
Also used : Message(org.kie.server.api.model.Message) Test(org.junit.Test)

Example 8 with Message

use of org.kie.server.api.model.Message in project kie-wb-common by kiegroup.

the class NotificationPresenterTest method testSetupOk.

@Test
public void testSetupOk() {
    final Message message = new Message();
    message.setSeverity(Severity.INFO);
    presenter.setup(message);
    verify(view).setupOk();
}
Also used : Message(org.kie.server.api.model.Message) Test(org.junit.Test)

Example 9 with Message

use of org.kie.server.api.model.Message in project kie-wb-common by kiegroup.

the class ConvertTest method testToKey.

@Test
public void testToKey() {
    final String serverTemplateId = "serverTemplateId";
    final String serverName = "serverName";
    final String serverInstanceId = "serverInstanceId";
    final String url = "url";
    ServerInstance serverInstance = new ServerInstance(serverTemplateId, serverName, serverInstanceId, url, "version", new ArrayList<Message>(), new ArrayList<Container>());
    ServerInstanceKey key = Convert.toKey(serverInstance);
    assertEquals(serverTemplateId, key.getServerTemplateId());
    assertEquals(serverName, key.getServerName());
    assertEquals(serverInstanceId, key.getServerInstanceId());
    assertEquals(url, key.getUrl());
}
Also used : Container(org.kie.server.controller.api.model.runtime.Container) Message(org.kie.server.api.model.Message) ServerInstanceKey(org.kie.server.controller.api.model.runtime.ServerInstanceKey) ServerInstance(org.kie.server.controller.api.model.runtime.ServerInstance) Test(org.junit.Test)

Example 10 with Message

use of org.kie.server.api.model.Message in project kie-wb-common by kiegroup.

the class BodyPresenterTest method testSetup.

@Test
public void testSetup() {
    final Message message = mock(Message.class);
    presenter.setup(Arrays.asList(message));
    verify(notificationPresenter).setup(message);
    verify(view).clear();
    verify(view).addNotification(notificationPresenter.getView());
}
Also used : Message(org.kie.server.api.model.Message) Test(org.junit.Test)

Aggregations

Message (org.kie.server.api.model.Message)15 Test (org.junit.Test)10 Container (org.kie.server.controller.api.model.runtime.Container)4 ServerInstanceKey (org.kie.server.controller.api.model.runtime.ServerInstanceKey)4 ArrayList (java.util.ArrayList)3 ReleaseId (org.kie.server.api.model.ReleaseId)3 CardPresenter (org.kie.workbench.common.screens.server.management.client.widget.card.CardPresenter)3 BodyPresenter (org.kie.workbench.common.screens.server.management.client.widget.card.body.BodyPresenter)3 FooterPresenter (org.kie.workbench.common.screens.server.management.client.widget.card.footer.FooterPresenter)3 LinkTitlePresenter (org.kie.workbench.common.screens.server.management.client.widget.card.title.LinkTitlePresenter)3 ContainerUpdateEvent (org.kie.workbench.common.screens.server.management.model.ContainerUpdateEvent)3 Command (org.uberfire.mvp.Command)3 ContainerSpecKey (org.kie.server.controller.api.model.spec.ContainerSpecKey)2 ServerTemplateKey (org.kie.server.controller.api.model.spec.ServerTemplateKey)2 ContainerSpecSelected (org.kie.workbench.common.screens.server.management.client.events.ContainerSpecSelected)2 InfoTitlePresenter (org.kie.workbench.common.screens.server.management.client.widget.card.title.InfoTitlePresenter)2 ServerInstance (org.kie.server.controller.api.model.runtime.ServerInstance)1 ServerInstanceSelected (org.kie.workbench.common.screens.server.management.client.events.ServerInstanceSelected)1