use of org.kie.server.controller.api.model.spec.ServerTemplate in project kie-wb-common by kiegroup.
the class ServerTemplatePresenterTest method testSetupCapabilities.
@Test
public void testSetupCapabilities() {
final ServerTemplate serverTemplate = new ServerTemplate("ServerTemplateKeyId", "ServerTemplateKeyName");
serverTemplate.getCapabilities().add(Capability.PROCESS.toString());
serverTemplate.getCapabilities().add(Capability.PLANNING.toString());
serverTemplate.getCapabilities().add(Capability.RULE.toString());
presenter.setup(serverTemplate, null);
assertEquals(serverTemplate, presenter.getCurrentServerTemplate());
verify(view).clear();
verify(view).setTemplate(serverTemplate.getId(), serverTemplate.getName());
verify(view).setProcessCapability(true);
verify(view).setRulesCapability(true);
verify(view).setPlanningCapability(true);
}
use of org.kie.server.controller.api.model.spec.ServerTemplate in project kie-wb-common by kiegroup.
the class ServerTemplatePresenterTest method testCopyTemplate.
@Test
public void testCopyTemplate() {
final String newTemplateName = "NewTemplateName";
doAnswer(new Answer<Void>() {
@Override
public Void answer(final InvocationOnMock invocation) throws Throwable {
final ParameterizedCommand command = (ParameterizedCommand) invocation.getArguments()[0];
if (command != null) {
command.execute(newTemplateName);
}
return null;
}
}).when(copyPresenter).copy(any(ParameterizedCommand.class));
final ServerTemplate serverTemplate = new ServerTemplate("ServerTemplateKeyId", "ServerTemplateKeyName");
presenter.setup(serverTemplate, null);
assertEquals(serverTemplate, presenter.getCurrentServerTemplate());
presenter.copyTemplate();
verify(specManagementService).copyServerTemplate(serverTemplate.getId(), newTemplateName, newTemplateName);
verify(copyPresenter).hide();
final ArgumentCaptor<ServerTemplateListRefresh> serverTemplateCaptor = ArgumentCaptor.forClass(ServerTemplateListRefresh.class);
verify(serverTemplateListRefreshEvent).fire(serverTemplateCaptor.capture());
assertEquals(newTemplateName, serverTemplateCaptor.getValue().getSelectServerTemplateId());
doThrow(new RuntimeException()).when(specManagementService).copyServerTemplate(serverTemplate.getId(), newTemplateName, newTemplateName);
presenter.copyTemplate();
verify(specManagementService, times(2)).copyServerTemplate(serverTemplate.getId(), newTemplateName, newTemplateName);
verify(copyPresenter).errorDuringProcessing(anyString());
}
use of org.kie.server.controller.api.model.spec.ServerTemplate in project kie-wb-common by kiegroup.
the class ServerTemplatePresenterTest method testOnServerInstanceUpdatedWithoutCurrentServer.
@Test
public void testOnServerInstanceUpdatedWithoutCurrentServer() {
final ServerTemplate serverTemplate = new ServerTemplate("ServerTemplateId", "ServerTemplateName");
final ServerInstance serverInstance = new ServerInstance(serverTemplate.getId(), "serverName", "serverInstanceId", "url", "1.0", Collections.<Message>emptyList(), Collections.<Container>emptyList());
presenter.onServerInstanceUpdated(new ServerInstanceUpdated(serverInstance));
verify(view, never()).addServerInstance(anyString(), anyString(), anyString(), any(Command.class));
}
use of org.kie.server.controller.api.model.spec.ServerTemplate in project kie-wb-common by kiegroup.
the class NewContainerWizardTest method testSetServerTemplate.
@Test
public void testSetServerTemplate() {
final ServerTemplate serverTemplate = new ServerTemplate("ServerTemplateId", "ServerTemplateName");
serverTemplate.getCapabilities().add(Capability.PROCESS.toString());
newContainerWizard.setServerTemplate(serverTemplate);
verify(newContainerFormPresenter).setServerTemplate(serverTemplate);
assertEquals(2, newContainerWizard.getPages().size());
assertTrue(newContainerWizard.getPages().contains(newContainerFormPresenter));
assertTrue(newContainerWizard.getPages().contains(processConfigPagePresenter));
}
use of org.kie.server.controller.api.model.spec.ServerTemplate in project kie-wb-common by kiegroup.
the class NewContainerFormPresenterTest method testOnDependencyPathSelectedEventWithDefaultContainerNameWhenContainerNameIsEmpty.
@Test
public void testOnDependencyPathSelectedEventWithDefaultContainerNameWhenContainerNameIsEmpty() {
final String path = "org:kie:1.0";
final String templateId = "templateId";
final GAV gav = new GAV(path);
final ServerTemplate serverTemplate = mock(ServerTemplate.class);
when(serverTemplate.getId()).thenReturn(templateId);
when(m2RepoService.loadGAVFromJar(path)).thenReturn(gav);
when(specManagementService.validContainerId(templateId, path)).thenReturn(path);
when(view.getContainerName()).thenReturn("");
presenter.setServerTemplate(serverTemplate);
presenter.asWidget();
presenter.onDependencyPathSelectedEvent(new DependencyPathSelectedEvent(artifactListWidgetPresenter, path));
verify(view).setContainerName(path);
}
Aggregations