Search in sources :

Example 11 with Message

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

the class NotificationPresenterTest method testSetupEmptyMessage.

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

Example 12 with Message

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

the class NotificationPresenterTest method testSetupMultiMessage.

@Test
public void testSetupMultiMessage() {
    final Message message = new Message(Severity.WARN, Arrays.asList("first error", "second error"));
    presenter.setup(message);
    verify(view).setup(NotificationType.WARNING, "2", "1: first error\n2: second error");
}
Also used : Message(org.kie.server.api.model.Message) Test(org.junit.Test)

Example 13 with Message

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

the class NotificationPresenterTest method testSetupSingleEmptyMessage.

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

Example 14 with Message

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

the class AsyncKieServerInstanceManagerTest method testContainerOperationSuccess.

private void testContainerOperationSuccess(ContainerRuntimeOperation operation) {
    List<Message> messages = new ArrayList<Message>();
    returnedContainers.addAll(createContainers(KieContainerStatus.STARTED, messages, 1));
    switch(operation) {
        case STOP_CONTAINER:
            this.kieServerInstanceManager.stopContainer(serverTemplate, containerSpec);
            break;
        case START_CONTAINER:
            this.kieServerInstanceManager.startContainer(serverTemplate, containerSpec);
            break;
        case UPGRADE_CONTAINER:
            this.kieServerInstanceManager.upgradeContainer(serverTemplate, containerSpec);
            break;
        case SCAN:
            this.kieServerInstanceManager.scanNow(serverTemplate, containerSpec);
            break;
        case START_SCANNER:
            this.kieServerInstanceManager.startScanner(serverTemplate, containerSpec, 10);
            break;
        case STOP_SCANNER:
            this.kieServerInstanceManager.stopScanner(serverTemplate, containerSpec);
            break;
    }
    assertFalse(receivedEvents.isEmpty());
    assertEquals(1, receivedEvents.size());
    ContainerUpdateEvent updateEvent = receivedEvents.get(0);
    assertContainerUpdateEvent(updateEvent, ContainerRuntimeState.ONLINE, 0);
}
Also used : Message(org.kie.server.api.model.Message) ArrayList(java.util.ArrayList) ContainerUpdateEvent(org.kie.workbench.common.screens.server.management.model.ContainerUpdateEvent)

Example 15 with Message

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

the class AsyncKieServerInstanceManagerTest method testContainerOperationPartialFailure.

private void testContainerOperationPartialFailure(ContainerRuntimeOperation operation) {
    List<Message> messages = new ArrayList<Message>();
    messages.add(new Message(Severity.ERROR, "No kmodule found"));
    returnedContainers.addAll(createContainers(KieContainerStatus.FAILED, messages, 1));
    messages.clear();
    returnedContainers.addAll(createContainers(KieContainerStatus.STARTED, messages, 1));
    switch(operation) {
        case STOP_CONTAINER:
            this.kieServerInstanceManager.stopContainer(serverTemplate, containerSpec);
            break;
        case START_CONTAINER:
            this.kieServerInstanceManager.startContainer(serverTemplate, containerSpec);
            break;
        case UPGRADE_CONTAINER:
            this.kieServerInstanceManager.upgradeContainer(serverTemplate, containerSpec);
            break;
        case SCAN:
            this.kieServerInstanceManager.scanNow(serverTemplate, containerSpec);
            break;
        case START_SCANNER:
            this.kieServerInstanceManager.startScanner(serverTemplate, containerSpec, 10);
            break;
        case STOP_SCANNER:
            this.kieServerInstanceManager.stopScanner(serverTemplate, containerSpec);
            break;
    }
    assertFalse(receivedEvents.isEmpty());
    assertEquals(1, receivedEvents.size());
    ContainerUpdateEvent updateEvent = receivedEvents.get(0);
    assertContainerUpdateEvent(updateEvent, ContainerRuntimeState.PARTIAL_ONLINE, 1);
}
Also used : Message(org.kie.server.api.model.Message) ArrayList(java.util.ArrayList) ContainerUpdateEvent(org.kie.workbench.common.screens.server.management.model.ContainerUpdateEvent)

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