use of org.kie.workbench.common.screens.server.management.client.navigation.template.ServerTemplatePresenter in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenterTest method testOnSelectedNonEmptyServerTemplate.
@Test
public void testOnSelectedNonEmptyServerTemplate() {
final ServerTemplate serverTemplate = new ServerTemplate("ServerTemplateId", "ServerTemplateName");
final ContainerSpec toBeSelected = mock(ContainerSpec.class);
serverTemplate.addContainerSpec(toBeSelected);
when(toBeSelected.getId()).thenReturn("other-id");
final ContainerSpec forcedToBeSelected = mock(ContainerSpec.class);
when(forcedToBeSelected.getId()).thenReturn("container-id");
serverTemplate.addContainerSpec(forcedToBeSelected);
final ServerTemplateKey serverTemplateKey = new ServerTemplateKey("ServerTemplateKeyId", "ServerTemplateKeyName");
when(specManagementService.getServerTemplate(serverTemplateKey.getId())).thenReturn(serverTemplate);
final ServerTemplatePresenter.View serverView = mock(ServerTemplatePresenter.View.class);
when(serverTemplatePresenter.getView()).thenReturn(serverView);
presenter.onSelected(new ServerTemplateSelected(serverTemplateKey));
verify(view).setServerTemplate(serverView);
verify(specManagementService).getServerTemplate(serverTemplateKey.getId());
verify(serverTemplatePresenter).setup(serverTemplate, toBeSelected);
presenter.onSelected(new ServerTemplateSelected(serverTemplateKey, "container-id"));
verify(serverTemplatePresenter).setup(serverTemplate, forcedToBeSelected);
}
use of org.kie.workbench.common.screens.server.management.client.navigation.template.ServerTemplatePresenter in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenterTest method testOnSelectedServerTemplate.
@Test
public void testOnSelectedServerTemplate() {
final ServerTemplate serverTemplate = new ServerTemplate("ServerTemplateId", "ServerTemplateName");
final ServerTemplateKey serverTemplateKey = new ServerTemplateKey("ServerTemplateKeyId", "ServerTemplateKeyName");
when(specManagementService.getServerTemplate(serverTemplateKey.getId())).thenReturn(serverTemplate);
final ServerTemplatePresenter.View serverView = mock(ServerTemplatePresenter.View.class);
when(serverTemplatePresenter.getView()).thenReturn(serverView);
final ServerContainerEmptyPresenter.View serverEmptyView = mock(ServerContainerEmptyPresenter.View.class);
when(serverContainerEmptyPresenter.getView()).thenReturn(serverEmptyView);
presenter.onSelected(new ServerTemplateSelected(serverTemplateKey));
verify(view).setServerTemplate(serverView);
verify(specManagementService).getServerTemplate(serverTemplateKey.getId());
verify(serverContainerEmptyPresenter).setTemplate(serverTemplate);
verify(view).setContent(serverEmptyView);
verify(serverTemplatePresenter).setup(serverTemplate, null);
}
Aggregations