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"));
}
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"));
}
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"));
}
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);
}
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);
}
Aggregations