Search in sources :

Example 26 with ServerTemplate

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

the class DeploymentPopupBuilderTest method testSingleServerTemplatesValidationContainerNameDoesNotExist.

@Test
public void testSingleServerTemplatesValidationContainerNameDoesNotExist() throws Exception {
    final ServerTemplate serverTemplate = mock(ServerTemplate.class);
    final Set<String> containers = new HashSet<String>() {

        {
            add("container1");
            add("container2");
            add("container3");
        }
    };
    doReturn(containers).when(buildExecutor).existingContainers(serverTemplate);
    final ValidateExistingContainerCallback validation = builder.singleServerTemplatesValidation(serverTemplate);
    assertFalse(validation.containerNameExists("container4"));
}
Also used : ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) ValidateExistingContainerCallback(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentScreenPopupViewImpl.ValidateExistingContainerCallback) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 27 with ServerTemplate

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

the class DeploymentPopupBuilderTest method testMultipleServerTemplatesValidationWhenContainerNameExists.

@Test
public void testMultipleServerTemplatesValidationWhenContainerNameExists() throws Exception {
    final List<ServerTemplate> serverTemplates = new ArrayList<ServerTemplate>() {

        {
            add(serverTemplate("serverTemplate1", "container1", "container2"));
            add(serverTemplate("serverTemplate2", "container1", "container2", "container3"));
            add(serverTemplate("serverTemplate3", "container1", "container2"));
        }
    };
    doNothing().when(popupView).addServerTemplates(any());
    doReturn("serverTemplate2").when(popupView).getServerTemplate();
    final ValidateExistingContainerCallback validation = builder.multipleServerTemplatesValidation(serverTemplates);
    assertTrue(validation.containerNameExists("container3"));
}
Also used : ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) ArrayList(java.util.ArrayList) ValidateExistingContainerCallback(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentScreenPopupViewImpl.ValidateExistingContainerCallback) Test(org.junit.Test)

Example 28 with ServerTemplate

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

the class DeploymentPopupBuilderTest method testSingleServerTemplatesValidationContainerNameExists.

@Test
public void testSingleServerTemplatesValidationContainerNameExists() throws Exception {
    final ServerTemplate serverTemplate = mock(ServerTemplate.class);
    final Set<String> containers = new HashSet<String>() {

        {
            add("container1");
            add("container2");
            add("container3");
        }
    };
    doReturn(containers).when(buildExecutor).existingContainers(serverTemplate);
    final ValidateExistingContainerCallback validation = builder.singleServerTemplatesValidation(serverTemplate);
    assertTrue(validation.containerNameExists("container3"));
}
Also used : ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) ValidateExistingContainerCallback(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentScreenPopupViewImpl.ValidateExistingContainerCallback) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 29 with ServerTemplate

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

the class DeploymentPopupBuilderTest method testBuildDeployWithMultipleServerTemplates.

@Test
public void testBuildDeployWithMultipleServerTemplates() throws Exception {
    final List<ServerTemplate> serverTemplates = new ArrayList<>();
    final ValidateExistingContainerCallback callback = mock(ValidateExistingContainerCallback.class);
    final ParameterizedCommand<DeploymentScreenPopupViewImpl> onSuccess = (v) -> {
    };
    doReturn(callback).when(builder).multipleServerTemplatesValidation(serverTemplates);
    builder.buildDeployWithMultipleServerTemplates(serverTemplates, onSuccess);
    verify(builder).setViewFields(onSuccess, callback);
}
Also used : DeploymentScreenPopupViewImpl(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentScreenPopupViewImpl) GwtMockitoTestRunner(com.google.gwtmockito.GwtMockitoTestRunner) ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) BeforeClass(org.junit.BeforeClass) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) Mock(org.mockito.Mock) ValidateExistingContainerCallback(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentScreenPopupViewImpl.ValidateExistingContainerCallback) RunWith(org.junit.runner.RunWith) Set(java.util.Set) Test(org.junit.Test) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Mockito(org.mockito.Mockito) List(java.util.List) GWTMockUtilities(com.google.gwt.junit.GWTMockUtilities) DeploymentScreenPopupViewImpl(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentScreenPopupViewImpl) Assert(org.junit.Assert) Before(org.junit.Before) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) ArrayList(java.util.ArrayList) ValidateExistingContainerCallback(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentScreenPopupViewImpl.ValidateExistingContainerCallback) Test(org.junit.Test)

Example 30 with ServerTemplate

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

the class DeploymentPopupBuilderTest method testBuildDeployWithOneServerTemplate.

@Test
public void testBuildDeployWithOneServerTemplate() throws Exception {
    final ServerTemplate serverTemplate = mock(ServerTemplate.class);
    final ValidateExistingContainerCallback callback = mock(ValidateExistingContainerCallback.class);
    final ParameterizedCommand<DeploymentScreenPopupViewImpl> onSuccess = (v) -> {
    };
    doReturn(callback).when(builder).singleServerTemplatesValidation(serverTemplate);
    builder.buildDeployWithOneServerTemplate(serverTemplate, onSuccess);
    verify(builder).setViewFields(onSuccess, callback);
}
Also used : DeploymentScreenPopupViewImpl(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentScreenPopupViewImpl) GwtMockitoTestRunner(com.google.gwtmockito.GwtMockitoTestRunner) ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) BeforeClass(org.junit.BeforeClass) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) Mock(org.mockito.Mock) ValidateExistingContainerCallback(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentScreenPopupViewImpl.ValidateExistingContainerCallback) RunWith(org.junit.runner.RunWith) Set(java.util.Set) Test(org.junit.Test) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Mockito(org.mockito.Mockito) List(java.util.List) GWTMockUtilities(com.google.gwt.junit.GWTMockUtilities) DeploymentScreenPopupViewImpl(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentScreenPopupViewImpl) Assert(org.junit.Assert) Before(org.junit.Before) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) ValidateExistingContainerCallback(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentScreenPopupViewImpl.ValidateExistingContainerCallback) 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