use of org.kie.server.controller.api.model.runtime.ServerInstanceKey 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.server.controller.api.model.runtime.ServerInstanceKey in project kie-wb-common by kiegroup.
the class ContainerPresenterTest method testLoadContainersNonStoped.
@Test
public void testLoadContainersNonStoped() {
final Container container = new Container("containerSpecId", "containerName", new ServerInstanceKey(), Collections.<Message>emptyList(), null, null);
container.setStatus(KieContainerStatus.STARTED);
containerSpecData.getContainers().add(container);
presenter.loadContainers(containerSpecData);
verifyLoad(false, 1);
}
use of org.kie.server.controller.api.model.runtime.ServerInstanceKey in project kie-wb-common by kiegroup.
the class ServerTemplatePresenterTest method testSetup.
@Test
public void testSetup() {
final ServerTemplate serverTemplate = new ServerTemplate("ServerTemplateKeyId", "ServerTemplateKeyName");
final ServerInstanceKey serverInstanceKey = new ServerInstanceKey("serverTemplateId", "serverName", "serverInstanceId", "url");
serverTemplate.addServerInstance(serverInstanceKey);
final ReleaseId releaseId = new ReleaseId("org.kie", "container", "1.0.0");
final ContainerSpec containerSpec = new ContainerSpec("containerId", "containerName", serverTemplate, releaseId, KieContainerStatus.CREATING, null);
serverTemplate.addContainerSpec(containerSpec);
final ContainerSpec containerSpec1 = new ContainerSpec("containerId1", "containerName1", serverTemplate, new ReleaseId("org.kie", "container2", "1.0.0"), KieContainerStatus.CREATING, null);
serverTemplate.addContainerSpec(containerSpec1);
presenter.setup(serverTemplate, containerSpec);
assertEquals(serverTemplate, presenter.getCurrentServerTemplate());
verify(view).clear();
verify(view).setTemplate(serverTemplate.getId(), serverTemplate.getName());
verify(view).setProcessCapability(false);
verify(view).setRulesCapability(false);
verify(view).setPlanningCapability(false);
verify(view).addContainer(eq(containerSpec.getServerTemplateKey().getId()), eq(containerSpec.getId()), eq(containerSpec.getContainerName()), any(Command.class));
verify(view).addContainer(eq(containerSpec1.getServerTemplateKey().getId()), eq(containerSpec1.getId()), eq(containerSpec1.getContainerName()), any(Command.class));
final ArgumentCaptor<ContainerSpecSelected> selectedCaptor = ArgumentCaptor.forClass(ContainerSpecSelected.class);
verify(containerSpecSelectedEvent).fire(selectedCaptor.capture());
assertEquals(containerSpec, selectedCaptor.getValue().getContainerSpecKey());
verify(view).addServerInstance(eq(serverInstanceKey.getServerTemplateId()), eq(serverInstanceKey.getServerInstanceId()), eq(serverInstanceKey.getServerName()), any(Command.class));
}
use of org.kie.server.controller.api.model.runtime.ServerInstanceKey in project kie-wb-common by kiegroup.
the class RemotePresenterTest method testSelectAndRefreshEmptyContainers.
@Test
public void testSelectAndRefreshEmptyContainers() {
final ServerInstanceKey serverInstanceKey = new ServerInstanceKey("templateId", "serverName", "serverInstanceId", "url");
when(runtimeManagementService.getContainersByServerInstance(serverInstanceKey.getServerTemplateId(), serverInstanceKey.getServerInstanceId())).thenReturn(Collections.<Container>emptyList());
presenter.onSelect(new ServerInstanceSelected(serverInstanceKey));
verify(view).clear();
verify(view).setServerName(serverInstanceKey.getServerName());
verify(view).setServerURL(serverInstanceKey.getUrl());
verify(view).setEmptyView(remoteEmptyPresenter.getView());
}
use of org.kie.server.controller.api.model.runtime.ServerInstanceKey in project kie-wb-common by kiegroup.
the class RemotePresenterTest method testRemoveError.
@Test
public void testRemoveError() {
final ServerInstanceKey serverInstanceKey = new ServerInstanceKey("templateId", "serverName", "serverInstanceId", "url");
presenter.onSelect(new ServerInstanceSelected(serverInstanceKey));
doThrow(new RuntimeException()).when(specManagementService).deleteServerInstance(serverInstanceKey);
presenter.remove();
final ArgumentCaptor<NotificationEvent> notificationCaptor = ArgumentCaptor.forClass(NotificationEvent.class);
verify(notification).fire(notificationCaptor.capture());
assertEquals(NotificationEvent.NotificationType.ERROR, notificationCaptor.getValue().getType());
}
Aggregations