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