use of org.kie.server.controller.api.model.spec.ServerTemplate in project kie-wb-common by kiegroup.
the class BuildExecutorTest method testMakeConfigsWhenServerTemplateHasProcessCapabilityWithStrategy.
@Test
public void testMakeConfigsWhenServerTemplateHasProcessCapabilityWithStrategy() {
final ServerTemplate serverTemplate = mock(ServerTemplate.class);
final RuleConfig ruleConfig = mock(RuleConfig.class);
doReturn(ruleConfig).when(buildExecutor).makeRuleConfig();
doReturn(true).when(buildExecutor).hasProcessCapability(any());
Map<String, String> params = new HashMap<>();
params.put("RuntimeStrategy", RuntimeStrategy.PER_PROCESS_INSTANCE.name());
final Map<Capability, ContainerConfig> configs = buildExecutor.makeConfigs(serverTemplate, params);
assertTrue(configs.keySet().contains(Capability.RULE));
assertTrue(configs.keySet().contains(Capability.PROCESS));
assertTrue(configs.values().contains(ruleConfig));
assertEquals(2, configs.size());
ProcessConfig processConf = (ProcessConfig) configs.get(Capability.PROCESS);
assertEquals(RuntimeStrategy.PER_PROCESS_INSTANCE.name(), processConf.getRuntimeStrategy());
}
use of org.kie.server.controller.api.model.spec.ServerTemplate in project kie-wb-common by kiegroup.
the class BuildExecutorTest method testMakeConfigsWhenServerTemplateHasProcessCapabilityWithDefaultStrategy.
@Test
public void testMakeConfigsWhenServerTemplateHasProcessCapabilityWithDefaultStrategy() {
final ServerTemplate serverTemplate = mock(ServerTemplate.class);
final RuleConfig ruleConfig = mock(RuleConfig.class);
doReturn(ruleConfig).when(buildExecutor).makeRuleConfig();
doReturn(true).when(buildExecutor).hasProcessCapability(any());
Map<String, String> params = new HashMap<>();
final Map<Capability, ContainerConfig> configs = buildExecutor.makeConfigs(serverTemplate, params);
assertTrue(configs.keySet().contains(Capability.RULE));
assertTrue(configs.keySet().contains(Capability.PROCESS));
assertTrue(configs.values().contains(ruleConfig));
assertEquals(2, configs.size());
ProcessConfig processConf = (ProcessConfig) configs.get(Capability.PROCESS);
assertEquals(RuntimeStrategy.SINGLETON.name(), processConf.getRuntimeStrategy());
}
use of org.kie.server.controller.api.model.spec.ServerTemplate in project kie-wb-common by kiegroup.
the class BuildExecutorTest method testMakeConfigsWhenServerTemplateHasProcessCapability.
@Test
public void testMakeConfigsWhenServerTemplateHasProcessCapability() {
final ServerTemplate serverTemplate = mock(ServerTemplate.class);
final RuleConfig ruleConfig = mock(RuleConfig.class);
final ProcessConfig processConfig = mock(ProcessConfig.class);
doReturn(ruleConfig).when(buildExecutor).makeRuleConfig();
doReturn(processConfig).when(buildExecutor).makeProcessConfig(new HashMap<>());
doReturn(true).when(buildExecutor).hasProcessCapability(any());
final Map<Capability, ContainerConfig> configs = buildExecutor.makeConfigs(serverTemplate, new HashMap<>());
assertTrue(configs.keySet().contains(Capability.RULE));
assertTrue(configs.keySet().contains(Capability.PROCESS));
assertTrue(configs.values().contains(ruleConfig));
assertTrue(configs.values().contains(processConfig));
assertEquals(2, configs.size());
}
use of org.kie.server.controller.api.model.spec.ServerTemplate in project kie-wb-common by kiegroup.
the class BuildExecutorTest method testBuildAndDeployCommandSingleServerTemplate.
@Test
public void testBuildAndDeployCommandSingleServerTemplate() {
final ServerTemplate serverTemplate = new ServerTemplate("id", "name");
when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Collections.singletonList(serverTemplate)));
buildExecutor.triggerBuildAndDeploy();
ArgumentCaptor<ContainerSpec> containerSpecArgumentCaptor = ArgumentCaptor.forClass(ContainerSpec.class);
verify(specManagementServiceMock).saveContainerSpec(eq(serverTemplate.getId()), containerSpecArgumentCaptor.capture());
final ContainerSpec containerSpec = containerSpecArgumentCaptor.getValue();
assertEquals(module.getPom().getGav().getArtifactId(), containerSpec.getContainerName());
verifyNotification(ProjectEditorResources.CONSTANTS.BuildSuccessful(), NotificationEvent.NotificationType.SUCCESS);
verifyNotification(ProjectEditorResources.CONSTANTS.DeploySuccessful(), NotificationEvent.NotificationType.SUCCESS);
verify(notificationEvent, times(2)).fire(any(NotificationEvent.class));
verifyBusyShowHideAnyString(1, 1);
}
use of org.kie.server.controller.api.model.spec.ServerTemplate in project kie-wb-common by kiegroup.
the class DeploymentPopupBuilderTest method testMultipleServerTemplatesValidationWhenContainerNameDoesNotExist.
@Test
public void testMultipleServerTemplatesValidationWhenContainerNameDoesNotExist() 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("serverTemplate1").when(popupView).getServerTemplate();
final ValidateExistingContainerCallback validation = builder.multipleServerTemplatesValidation(serverTemplates);
assertFalse(validation.containerNameExists("container3"));
}
Aggregations