use of org.kie.server.controller.api.model.runtime.ServerInstanceKey in project kie-wb-common by kiegroup.
the class ServerTemplatePresenterTest method testOnServerInstanceSelect.
@Test
public void testOnServerInstanceSelect() {
final ServerInstanceKey serverInstanceKey = new ServerInstanceKey("serverInstanceKeyId", "serverName", "serverInstanceId", "url");
presenter.onServerInstanceSelect(new ServerInstanceSelected(serverInstanceKey));
verify(view).selectServerInstance(serverInstanceKey.getServerTemplateId(), serverInstanceKey.getServerInstanceId());
}
use of org.kie.server.controller.api.model.runtime.ServerInstanceKey in project kie-wb-common by kiegroup.
the class RemotePresenterTest method testRemove.
@Test
public void testRemove() {
final ServerInstanceKey serverInstanceKey = new ServerInstanceKey("templateId", "serverName", "serverInstanceId", "url");
presenter.onSelect(new ServerInstanceSelected(serverInstanceKey));
presenter.remove();
verify(specManagementService).deleteServerInstance(serverInstanceKey);
verify(notification).fire(any(NotificationEvent.class));
}
use of org.kie.server.controller.api.model.runtime.ServerInstanceKey in project kie-wb-common by kiegroup.
the class RemotePresenterTest method testSelectAndRefresh.
@Test
public void testSelectAndRefresh() {
final ServerInstanceKey serverInstanceKey = new ServerInstanceKey("templateId", "serverName", "serverInstanceId", "url");
final Container container = new Container("containerSpecId", "containerName", serverInstanceKey, Collections.<Message>emptyList(), null, null);
final List<Container> containers = Collections.singletonList(container);
when(runtimeManagementService.getContainersByServerInstance(serverInstanceKey.getServerTemplateId(), serverInstanceKey.getServerInstanceId())).thenReturn(containers);
presenter.onSelect(new ServerInstanceSelected(serverInstanceKey));
verify(view).clear();
verify(view).setServerName(serverInstanceKey.getServerName());
verify(view).setServerURL(serverInstanceKey.getUrl());
verify(remoteStatusPresenter).setup(containers);
verify(view).setStatusPresenter(remoteStatusPresenter.getView());
}
use of org.kie.server.controller.api.model.runtime.ServerInstanceKey in project kie-wb-common by kiegroup.
the class ContainerCardPresenterTest method testSetup.
@Test
public void testSetup() {
final InfoTitlePresenter infoTitlePresenter = mock(InfoTitlePresenter.class);
when(infoTitlePresenterProvider.get()).thenReturn(infoTitlePresenter);
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(container);
verify(linkTitlePresenter).setup(eq(container.getContainerName()), any(Command.class));
verify(infoTitlePresenter).setup(container.getResolvedReleasedId());
verify(bodyPresenter).setup(Arrays.asList(message));
verify(footerPresenter).setup(container.getUrl(), resolvedReleasedId.getVersion());
verify(cardPresenter).addTitle(linkTitlePresenter);
verify(cardPresenter).addTitle(infoTitlePresenter);
verify(cardPresenter).addBody(bodyPresenter);
verify(cardPresenter).addFooter(footerPresenter);
verify(view).setCard(cardPresenterView);
linkTitlePresenter.onSelect();
final ContainerSpecKey containerSpecKey = new ContainerSpecKey(container.getContainerSpecId(), container.getContainerName(), new ServerTemplateKey(container.getServerInstanceKey().getServerTemplateId(), ""));
verify(containerSpecSelectedEvent).fire(eq(new ContainerSpecSelected(containerSpecKey)));
}
use of org.kie.server.controller.api.model.runtime.ServerInstanceKey in project kie-wb-common by kiegroup.
the class AsyncKieServerInstanceManager method produceContainerUpdateEvent.
protected void produceContainerUpdateEvent(ServerTemplate serverTemplate, ContainerSpec containerSpec, List<Container> containers, ContainerRuntimeOperation containerRuntimeOperation) {
List<ServerInstanceKey> failedServerInstances = new ArrayList<ServerInstanceKey>();
for (Container container : containers) {
if (hasIssues(container)) {
failedServerInstances.add(container.getServerInstanceKey());
}
}
ContainerRuntimeState containerRuntimeState = ContainerRuntimeState.ONLINE;
if (failedServerInstances.size() == containers.size()) {
containerRuntimeState = ContainerRuntimeState.OFFLINE;
} else if (!failedServerInstances.isEmpty()) {
containerRuntimeState = ContainerRuntimeState.PARTIAL_ONLINE;
}
ContainerUpdateEvent updateEvent = new ContainerUpdateEvent(serverTemplate, containerSpec, failedServerInstances, containerRuntimeState, containerRuntimeOperation);
containerUpdateEvent.fire(updateEvent);
}
Aggregations