use of org.kie.server.controller.api.model.events.ServerInstanceDeleted in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenterTest method testOnDelete.
@Test
public void testOnDelete() {
final ServerInstanceKey serverInstanceKey = new ServerInstanceKey("serverInstanceKeyId", "serverName", "serverInstanceId", "url");
final ServerTemplate serverTemplate = new ServerTemplate("ServerTemplateId", "ServerTemplateName");
serverTemplate.addServerInstance(serverInstanceKey);
when(serverTemplatePresenter.getCurrentServerTemplate()).thenReturn(serverTemplate);
final ServerTemplateKey serverTemplateKey = new ServerTemplateKey("ServerTemplateKeyId", "ServerTemplateKeyName");
final List<ServerTemplateKey> serverTemplateKeys = Collections.singletonList(serverTemplateKey);
when(specManagementService.listServerTemplateKeys()).thenReturn(new ServerTemplateKeyList(serverTemplateKeys));
presenter.onDelete(new ServerInstanceDeleted(serverInstanceKey.getServerInstanceId()));
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.server.controller.api.model.events.ServerInstanceDeleted in project kie-wb-common by kiegroup.
the class ContainerRemoteStatusPresenterTest method testOnDelete.
@Test
public void testOnDelete() {
final ContainerCardPresenter cardPresenter = mock(ContainerCardPresenter.class);
when(cardPresenter.getView()).thenReturn(mock(ContainerCardPresenter.View.class));
when(presenterProvider.get()).thenReturn(cardPresenter);
final ServerInstanceKey serverInstanceKey = new ServerInstanceKey("templateId", "serverName", "serverInstanceId", "url");
final Container container = new Container("containerSpecId", "containerName", serverInstanceKey, Collections.<Message>emptyList(), null, null);
container.setStatus(KieContainerStatus.STARTED);
presenter.setup(new ContainerSpec(), Collections.singletonList(container));
verify(view).clear();
verify(cardPresenter).setup(container.getServerInstanceKey(), container);
verify(view).addCard(any(IsWidget.class));
presenter.onDelete(new ServerInstanceDeleted(serverInstanceKey.getServerInstanceId()));
verify(cardPresenter).delete();
presenter.onDelete(new ServerInstanceDeleted("randomKey"));
verify(cardPresenter).delete();
}
use of org.kie.server.controller.api.model.events.ServerInstanceDeleted in project kie-wb-common by kiegroup.
the class ServerManagementBrowserPresenterTest method testOnDeleteWithoutCurrentServer.
@Test
public void testOnDeleteWithoutCurrentServer() {
final ServerInstanceKey serverInstanceKey = new ServerInstanceKey("serverInstanceKeyId", "serverName", "serverInstanceId", "url");
presenter.onDelete(new ServerInstanceDeleted(serverInstanceKey.getServerInstanceId()));
verify(specManagementService, never()).listServerTemplateKeys();
}
use of org.kie.server.controller.api.model.events.ServerInstanceDeleted in project kie-wb-common by kiegroup.
the class ServerTemplatePresenterTest method testOnServerInstanceUpdated.
@Test
public void testOnServerInstanceUpdated() {
final ServerTemplate serverTemplate = new ServerTemplate("ServerTemplateId", "ServerTemplateName");
presenter.setup(serverTemplate, null);
assertEquals(serverTemplate, presenter.getCurrentServerTemplate());
final ServerInstance serverInstance = new ServerInstance(serverTemplate.getId(), "serverName", "serverInstanceId", "url", "1.0", Collections.<Message>emptyList(), Collections.<Container>emptyList());
presenter.onServerInstanceUpdated(new ServerInstanceUpdated(serverInstance));
presenter.onServerInstanceUpdated(new ServerInstanceUpdated(serverInstance));
verify(view).addServerInstance(eq(serverInstance.getServerTemplateId()), eq(serverInstance.getServerInstanceId()), eq(serverInstance.getServerName()), any(Command.class));
presenter.onServerInstanceDeleted(new ServerInstanceDeleted(serverInstance.getServerInstanceId()));
presenter.onServerInstanceUpdated(new ServerInstanceUpdated(serverInstance));
verify(view, times(2)).addServerInstance(eq(serverInstance.getServerTemplateId()), eq(serverInstance.getServerInstanceId()), eq(serverInstance.getServerName()), any(Command.class));
}
Aggregations