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