Search in sources :

Example 21 with ServerTemplate

use of org.kie.server.controller.api.model.spec.ServerTemplate in project kie-wb-common by kiegroup.

the class ServerManagementPerspectiveTest method testOnNewContainer.

@Test
public void testOnNewContainer() {
    final ServerTemplate template = mock(ServerTemplate.class);
    perspective.onNewContainer(new AddNewContainer(template));
    verify(newContainerWizard).clear();
    verify(newContainerWizard).setServerTemplate(eq(template));
    verify(newContainerWizard).start();
}
Also used : AddNewServerTemplate(org.kie.workbench.common.screens.server.management.client.events.AddNewServerTemplate) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) AddNewContainer(org.kie.workbench.common.screens.server.management.client.events.AddNewContainer) Test(org.junit.Test)

Example 22 with ServerTemplate

use of org.kie.server.controller.api.model.spec.ServerTemplate in project kie-wb-common by kiegroup.

the class ServerContainerEmptyPresenterTest method testTemplate.

@Test
public void testTemplate() {
    final ServerTemplate template = new ServerTemplate("id", "name");
    presenter.setTemplate(template);
    verify(view).setTemplateName(template.getName());
}
Also used : ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) Test(org.junit.Test)

Example 23 with ServerTemplate

use of org.kie.server.controller.api.model.spec.ServerTemplate in project kie-wb-common by kiegroup.

the class BuildExecutorTest method testMakeConfigsWhenServerTemplateDoesNotHaveProcessCapability.

@Test
public void testMakeConfigsWhenServerTemplateDoesNotHaveProcessCapability() {
    final ServerTemplate serverTemplate = mock(ServerTemplate.class);
    final RuleConfig ruleConfig = mock(RuleConfig.class);
    doReturn(ruleConfig).when(buildExecutor).makeRuleConfig();
    final Map<Capability, ContainerConfig> configs = buildExecutor.makeConfigs(serverTemplate, new HashMap<>());
    assertTrue(configs.keySet().contains(Capability.RULE));
    assertTrue(configs.values().contains(ruleConfig));
    assertEquals(1, configs.size());
}
Also used : ContainerConfig(org.kie.server.controller.api.model.spec.ContainerConfig) Capability(org.kie.server.controller.api.model.spec.Capability) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) RuleConfig(org.kie.server.controller.api.model.spec.RuleConfig) Test(org.junit.Test)

Example 24 with ServerTemplate

use of org.kie.server.controller.api.model.spec.ServerTemplate in project kie-wb-common by kiegroup.

the class BuildExecutorTest method testBuildAndDeployCommandSingleServerTemplateContainerExists.

@Test
public void testBuildAndDeployCommandSingleServerTemplateContainerExists() {
    final String containerId = module.getPom().getGav().getArtifactId() + "_" + module.getPom().getGav().getVersion();
    final String containerName = module.getPom().getGav().getArtifactId();
    final ServerTemplate serverTemplate = new ServerTemplate("id", "name");
    serverTemplate.addContainerSpec(new ContainerSpec(containerId, containerName, null, null, null, null));
    when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Collections.singletonList(serverTemplate)));
    buildExecutor.triggerBuildAndDeploy();
    verify(deploymentScreenPopupView).setValidateExistingContainerCallback(any(DeploymentScreenPopupViewImpl.ValidateExistingContainerCallback.class));
    verify(deploymentScreenPopupView).setContainerId(containerId);
    verify(deploymentScreenPopupView).setContainerAlias(containerName);
    verify(deploymentScreenPopupView).setStartContainer(true);
    verify(deploymentScreenPopupView).configure(any(com.google.gwt.user.client.Command.class));
    verify(deploymentScreenPopupView).show();
    verifyNoMoreInteractions(deploymentScreenPopupView);
}
Also used : ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) Command(org.uberfire.mvp.Command) ServerTemplateList(org.kie.server.controller.api.model.spec.ServerTemplateList) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 25 with ServerTemplate

use of org.kie.server.controller.api.model.spec.ServerTemplate in project kie-wb-common by kiegroup.

the class BuildExecutorTest method testBuildAndDeployCommandMultipleServerTemplate.

@Test
public void testBuildAndDeployCommandMultipleServerTemplate() {
    final String containerId = module.getPom().getGav().getArtifactId() + "_" + module.getPom().getGav().getVersion();
    final String containerName = module.getPom().getGav().getArtifactId();
    final ServerTemplate serverTemplate1 = new ServerTemplate("id1", "name1");
    final ServerTemplate serverTemplate2 = new ServerTemplate("id2", "name2");
    when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Arrays.asList(serverTemplate1, serverTemplate2)));
    buildExecutor.triggerBuildAndDeploy();
    verify(deploymentScreenPopupView).setValidateExistingContainerCallback(any(DeploymentScreenPopupViewImpl.ValidateExistingContainerCallback.class));
    verify(deploymentScreenPopupView).setContainerId(containerId);
    verify(deploymentScreenPopupView).setContainerAlias(containerName);
    verify(deploymentScreenPopupView).setStartContainer(true);
    verify(deploymentScreenPopupView).addServerTemplates(eq(Sets.newHashSet("id1", "id2")));
    verify(deploymentScreenPopupView).configure(any(com.google.gwt.user.client.Command.class));
    verify(deploymentScreenPopupView).show();
    verifyNoMoreInteractions(deploymentScreenPopupView);
}
Also used : ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) Command(org.uberfire.mvp.Command) ServerTemplateList(org.kie.server.controller.api.model.spec.ServerTemplateList) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Aggregations

ServerTemplate (org.kie.server.controller.api.model.spec.ServerTemplate)61 Test (org.junit.Test)49 ContainerSpec (org.kie.server.controller.api.model.spec.ContainerSpec)24 ServerTemplateKey (org.kie.server.controller.api.model.spec.ServerTemplateKey)12 ServerInstanceKey (org.kie.server.controller.api.model.runtime.ServerInstanceKey)11 RuleConfig (org.kie.server.controller.api.model.spec.RuleConfig)10 ArrayList (java.util.ArrayList)9 Capability (org.kie.server.controller.api.model.spec.Capability)9 ContainerConfig (org.kie.server.controller.api.model.spec.ContainerConfig)9 Path (org.uberfire.java.nio.file.Path)9 ReleaseId (org.kie.server.api.model.ReleaseId)8 ProcessConfig (org.kie.server.controller.api.model.spec.ProcessConfig)8 Command (org.uberfire.mvp.Command)7 ParameterizedCommand (org.uberfire.mvp.ParameterizedCommand)7 Matchers.anyString (org.mockito.Matchers.anyString)6 HashMap (java.util.HashMap)5 List (java.util.List)5 Container (org.kie.server.controller.api.model.runtime.Container)5 ValidateExistingContainerCallback (org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentScreenPopupViewImpl.ValidateExistingContainerCallback)5 ServerTemplateSelected (org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected)5