use of org.kie.workbench.common.screens.server.management.model.ContainerUpdateEvent 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.workbench.common.screens.server.management.model.ContainerUpdateEvent in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenterTest method testOnContainerNull.
@Test
public void testOnContainerNull() {
presenter.onContainerUpdate(new ContainerUpdateEvent());
verify(notification, never()).fire(any());
}
use of org.kie.workbench.common.screens.server.management.model.ContainerUpdateEvent in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenterTest method testOnContainerUpdateFailed.
@Test
public void testOnContainerUpdateFailed() {
when(view.getErrorMessage(ClientContainerRuntimeOperation.START_CONTAINER, 2)).thenReturn("Error");
presenter.onContainerUpdate(new ContainerUpdateEvent(mock(ServerTemplateKey.class), mock(ContainerSpec.class), new ArrayList<ServerInstanceKey>() {
{
add(mock(ServerInstanceKey.class));
add(mock(ServerInstanceKey.class));
}
}, ContainerRuntimeState.OFFLINE, ContainerRuntimeOperation.START_CONTAINER));
verify(notification).fire(new NotificationEvent("Error", NotificationEvent.NotificationType.ERROR));
}
use of org.kie.workbench.common.screens.server.management.model.ContainerUpdateEvent in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenterTest method testOnContainerUpdateSuccess.
@Test
public void testOnContainerUpdateSuccess() {
when(view.getSuccessMessage(ClientContainerRuntimeOperation.START_CONTAINER, 2)).thenReturn("Success");
presenter.onContainerUpdate(new ContainerUpdateEvent(mock(ServerTemplateKey.class), mock(ContainerSpec.class), new ArrayList<ServerInstanceKey>() {
{
add(mock(ServerInstanceKey.class));
add(mock(ServerInstanceKey.class));
}
}, ContainerRuntimeState.ONLINE, ContainerRuntimeOperation.START_CONTAINER));
verify(notification).fire(new NotificationEvent("Success", NotificationEvent.NotificationType.SUCCESS));
}
use of org.kie.workbench.common.screens.server.management.model.ContainerUpdateEvent in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenterTest method testOnContainerEmptyList.
@Test
public void testOnContainerEmptyList() {
presenter.onContainerUpdate(new ContainerUpdateEvent(mock(ServerTemplateKey.class), mock(ContainerSpec.class), Collections.emptyList(), ContainerRuntimeState.PARTIAL_ONLINE, ContainerRuntimeOperation.START_CONTAINER));
verify(notification, never()).fire(any());
}
Aggregations