use of org.kie.workbench.common.screens.server.management.client.events.ContainerSpecSelected in project kie-wb-common by kiegroup.
the class ServerTemplatePresenterTest method testOnContainerSelect.
@Test
public void testOnContainerSelect() {
final ServerTemplateKey serverTemplateKey = new ServerTemplateKey("ServerTemplateKeyId", "ServerTemplateKeyName");
final ContainerSpecKey containerSpecKey = new ContainerSpecKey("containerId", "containerName", serverTemplateKey);
presenter.onContainerSelect(new ContainerSpecSelected(containerSpecKey));
verify(view).selectContainer(serverTemplateKey.getId(), containerSpecKey.getId());
}
use of org.kie.workbench.common.screens.server.management.client.events.ContainerSpecSelected 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.workbench.common.screens.server.management.client.events.ContainerSpecSelected in project kie-wb-common by kiegroup.
the class ServerTemplatePresenter method setup.
public void setup(final ServerTemplate serverTemplate, final ContainerSpec firstContainerSpec) {
view.clear();
this.serverTemplate = serverTemplate;
view.setTemplate(serverTemplate.getId(), serverTemplate.getName());
view.setProcessCapability(serverTemplate.getCapabilities().contains(Capability.PROCESS.toString()));
view.setRulesCapability(serverTemplate.getCapabilities().contains(Capability.RULE.toString()));
view.setPlanningCapability(serverTemplate.getCapabilities().contains(Capability.PLANNING.toString()));
if (firstContainerSpec != null) {
addContainer(firstContainerSpec);
for (final ContainerSpec containerSpec : serverTemplate.getContainersSpec()) {
if (!containerSpec.getId().equals(firstContainerSpec.getId())) {
addContainer(containerSpec);
}
}
containerSpecSelectedEvent.fire(new ContainerSpecSelected(firstContainerSpec));
}
for (final ServerInstanceKey serverInstanceKey : serverTemplate.getServerInstanceKeys()) {
addServerInstance(serverInstanceKey);
}
}
use of org.kie.workbench.common.screens.server.management.client.events.ContainerSpecSelected in project kie-wb-common by kiegroup.
the class ContainerCardPresenter method setup.
public void setup(final Container container) {
final LinkTitlePresenter linkTitlePresenter = presenterProvider.select(LinkTitlePresenter.class).get();
linkTitlePresenter.setup(container.getContainerName(), new Command() {
@Override
public void execute() {
containerSpecSelectedEvent.fire(new ContainerSpecSelected(buildContainerSpecKey(container)));
}
});
final InfoTitlePresenter infoTitlePresenter = presenterProvider.select(InfoTitlePresenter.class).get();
infoTitlePresenter.setup(container.getResolvedReleasedId());
final BodyPresenter bodyPresenter = presenterProvider.select(BodyPresenter.class).get();
bodyPresenter.setup(container.getMessages());
final FooterPresenter footerPresenter = presenterProvider.select(FooterPresenter.class).get();
footerPresenter.setup(container.getUrl(), container.getResolvedReleasedId().getVersion());
CardPresenter card = presenterProvider.select(CardPresenter.class).get();
card.addTitle(linkTitlePresenter);
card.addTitle(infoTitlePresenter);
card.addBody(bodyPresenter);
card.addFooter(footerPresenter);
view.setCard(card.getView());
}
use of org.kie.workbench.common.screens.server.management.client.events.ContainerSpecSelected in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenterTest method testOnSelectedContainerSpec.
@Test
public void testOnSelectedContainerSpec() {
final ContainerPresenter.View containerView = mock(ContainerPresenter.View.class);
when(containerPresenter.getView()).thenReturn(containerView);
presenter.onSelected(new ContainerSpecSelected(new ContainerSpecKey()));
verify(view).setContent(containerView);
}
Aggregations