use of org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected in project kie-wb-common by kiegroup.
the class NewContainerWizard method complete.
@Override
public void complete() {
final Map<Capability, ContainerConfig> mapConfig = new HashMap<Capability, ContainerConfig>();
if (getPages().size() == 2) {
mapConfig.put(Capability.PROCESS, processConfigPagePresenter.buildProcessConfig());
}
mapConfig.put(Capability.RULE, new RuleConfig(null, KieScannerStatus.STOPPED));
final ContainerSpec newContainer = newContainerFormPresenter.buildContainerSpec(newContainerFormPresenter.getServerTemplate().getId(), mapConfig);
specManagementService.call(new RemoteCallback<Void>() {
@Override
public void callback(final Void o) {
notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerWizardSaveSuccess(), NotificationEvent.NotificationType.SUCCESS));
clear();
NewContainerWizard.super.complete();
serverTemplateSelectedEvent.fire(new ServerTemplateSelected(serverTemplate, newContainer.getId()));
}
}, new ErrorCallback<Object>() {
@Override
public boolean error(final Object o, final Throwable throwable) {
notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerWizardSaveError(), NotificationEvent.NotificationType.ERROR));
NewContainerWizard.this.pageSelected(0);
NewContainerWizard.this.start();
return false;
}
}).saveContainerSpec(newContainerFormPresenter.getServerTemplate().getId(), newContainer);
}
use of org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected 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);
}
use of org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenterTest method testOnServerTemplateUpdated.
@Test
public void testOnServerTemplateUpdated() {
final ServerTemplate serverTemplate = new ServerTemplate("ServerTemplateId", "ServerTemplateName");
presenter.onServerTemplateUpdated(new ServerTemplateUpdated(serverTemplate));
final ArgumentCaptor<Collection> serverTemplateKeysCaptor = ArgumentCaptor.forClass(Collection.class);
verify(navigationPresenter).setup(eq(serverTemplate), serverTemplateKeysCaptor.capture());
final Collection<ServerTemplateKey> serverTemplateKeys = serverTemplateKeysCaptor.getValue();
assertEquals(1, serverTemplateKeys.size());
assertTrue(serverTemplateKeys.contains(serverTemplate));
final ArgumentCaptor<ServerTemplateSelected> templateSelectedCaptor = ArgumentCaptor.forClass(ServerTemplateSelected.class);
verify(serverTemplateSelectedEvent).fire(templateSelectedCaptor.capture());
assertEquals(serverTemplate, templateSelectedCaptor.getValue().getServerTemplateKey());
}
use of org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenterTest method testOnOpen.
@Test
public void testOnOpen() {
final ServerTemplateKey serverTemplateKey = new ServerTemplateKey("ServerTemplateKeyId", "ServerTemplateKeyName");
final List<ServerTemplateKey> serverTemplateKeys = Collections.singletonList(serverTemplateKey);
when(specManagementService.listServerTemplateKeys()).thenReturn(new ServerTemplateKeyList(serverTemplateKeys));
presenter.onOpen();
verify(navigationPresenter).setup(serverTemplateKey, serverTemplateKeys);
final ArgumentCaptor<ServerTemplateSelected> templateSelectedCaptor = ArgumentCaptor.forClass(ServerTemplateSelected.class);
verify(serverTemplateSelectedEvent).fire(templateSelectedCaptor.capture());
assertEquals(serverTemplateKey, templateSelectedCaptor.getValue().getServerTemplateKey());
}
use of org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenterTest method testOnServerDeleted.
@Test
public void testOnServerDeleted() {
final ServerTemplateKey serverTemplateKey = new ServerTemplateKey("ServerTemplateKeyId", "ServerTemplateKeyName");
final List<ServerTemplateKey> serverTemplateKeys = Collections.singletonList(serverTemplateKey);
when(specManagementService.listServerTemplateKeys()).thenReturn(new ServerTemplateKeyList(serverTemplateKeys));
presenter.onServerDeleted(new ServerTemplateDeleted());
verify(navigationPresenter).setup(serverTemplateKey, serverTemplateKeys);
final ArgumentCaptor<ServerTemplateSelected> templateSelectedCaptor = ArgumentCaptor.forClass(ServerTemplateSelected.class);
verify(serverTemplateSelectedEvent).fire(templateSelectedCaptor.capture());
assertEquals(serverTemplateKey, templateSelectedCaptor.getValue().getServerTemplateKey());
}
Aggregations