use of org.kie.server.controller.api.model.spec.ProcessConfig in project kie-wb-common by kiegroup.
the class ServerTemplateVFSStorageTest method testStoreAndLoadServerTemplates.
@Test
public void testStoreAndLoadServerTemplates() {
templateStorage.store(serverTemplate);
Collection<ServerTemplateKey> templateKeys = templateStorage.loadKeys();
assertNotNull(templateKeys);
assertEquals(1, templateKeys.size());
ServerTemplateKey templateKey = templateKeys.iterator().next();
assertNotNull(templateKey);
assertEquals(serverTemplate.getId(), templateKey.getId());
assertEquals(serverTemplate.getName(), templateKey.getName());
Collection<ServerTemplate> templates = templateStorage.load();
assertNotNull(templates);
assertEquals(1, templates.size());
ServerTemplate template = templates.iterator().next();
assertNotNull(template);
assertEquals(serverTemplate.getId(), template.getId());
assertEquals(serverTemplate.getName(), template.getName());
Collection<ServerInstanceKey> instances = template.getServerInstanceKeys();
assertNotNull(instances);
assertEquals(0, instances.size());
Collection<ContainerSpec> containerSpecs = template.getContainersSpec();
assertNotNull(containerSpecs);
assertEquals(1, containerSpecs.size());
ContainerSpec spec = containerSpecs.iterator().next();
assertNotNull(spec);
assertEquals(containerSpec.getId(), spec.getId());
assertEquals(containerSpec.getReleasedId(), spec.getReleasedId());
assertEquals(containerSpec.getServerTemplateKey().getId(), spec.getServerTemplateKey().getId());
assertEquals(containerSpec.getServerTemplateKey().getName(), spec.getServerTemplateKey().getName());
assertEquals(containerSpec.getConfigs().size(), spec.getConfigs().size());
assertTrue(spec.getConfigs().containsKey(Capability.RULE));
assertTrue(spec.getConfigs().containsKey(Capability.PROCESS));
RuleConfig ruleConfig = (RuleConfig) spec.getConfigs().get(Capability.RULE);
assertNotNull(ruleConfig);
assertEquals(this.ruleConfig.getPollInterval(), ruleConfig.getPollInterval());
assertEquals(this.ruleConfig.getScannerStatus(), ruleConfig.getScannerStatus());
ProcessConfig processConfig = (ProcessConfig) spec.getConfigs().get(Capability.PROCESS);
assertNotNull(processConfig);
assertEquals(this.processConfig.getKBase(), processConfig.getKBase());
assertEquals(this.processConfig.getKSession(), processConfig.getKSession());
assertEquals(this.processConfig.getMergeMode(), processConfig.getMergeMode());
assertEquals(this.processConfig.getRuntimeStrategy(), processConfig.getRuntimeStrategy());
}
use of org.kie.server.controller.api.model.spec.ProcessConfig in project kie-wb-common by kiegroup.
the class ServerTemplateVFSStorageTest method testStoreServerTemplate.
@Test
public void testStoreServerTemplate() {
templateStorage.store(serverTemplate);
boolean exists = templateStorage.exists(serverTemplate.getId());
assertTrue(exists);
ServerTemplate fromStorage = templateStorage.load(serverTemplate.getId());
assertNotNull(fromStorage);
assertEquals(serverTemplate.getId(), fromStorage.getId());
assertEquals(serverTemplate.getName(), fromStorage.getName());
Collection<ServerInstanceKey> instances = fromStorage.getServerInstanceKeys();
assertNotNull(instances);
assertEquals(0, instances.size());
Collection<ContainerSpec> containerSpecs = fromStorage.getContainersSpec();
assertNotNull(containerSpecs);
assertEquals(1, containerSpecs.size());
ContainerSpec spec = containerSpecs.iterator().next();
assertNotNull(spec);
assertEquals(containerSpec.getId(), spec.getId());
assertEquals(containerSpec.getReleasedId(), spec.getReleasedId());
assertEquals(containerSpec.getServerTemplateKey().getId(), spec.getServerTemplateKey().getId());
assertEquals(containerSpec.getServerTemplateKey().getName(), spec.getServerTemplateKey().getName());
assertEquals(containerSpec.getConfigs().size(), spec.getConfigs().size());
assertTrue(spec.getConfigs().containsKey(Capability.RULE));
assertTrue(spec.getConfigs().containsKey(Capability.PROCESS));
RuleConfig ruleConfig = (RuleConfig) spec.getConfigs().get(Capability.RULE);
assertNotNull(ruleConfig);
assertEquals(this.ruleConfig.getPollInterval(), ruleConfig.getPollInterval());
assertEquals(this.ruleConfig.getScannerStatus(), ruleConfig.getScannerStatus());
ProcessConfig processConfig = (ProcessConfig) spec.getConfigs().get(Capability.PROCESS);
assertNotNull(processConfig);
assertEquals(this.processConfig.getKBase(), processConfig.getKBase());
assertEquals(this.processConfig.getKSession(), processConfig.getKSession());
assertEquals(this.processConfig.getMergeMode(), processConfig.getMergeMode());
assertEquals(this.processConfig.getRuntimeStrategy(), processConfig.getRuntimeStrategy());
}
use of org.kie.server.controller.api.model.spec.ProcessConfig in project kie-wb-common by kiegroup.
the class ContainerProcessConfigPresenter method save.
public void save() {
view.disableActions();
final ProcessConfig newProcessConfig = processConfigPresenter.buildProcessConfig();
specManagementService.call(new RemoteCallback<Void>() {
@Override
public void callback(final Void containerConfig) {
notification.fire(new NotificationEvent(view.getSaveSuccessMessage(), NotificationEvent.NotificationType.SUCCESS));
setupView(newProcessConfig);
}
}, new ErrorCallback<Object>() {
@Override
public boolean error(final Object o, final Throwable throwable) {
notification.fire(new NotificationEvent(view.getSaveErrorMessage(), NotificationEvent.NotificationType.ERROR));
setupView(processConfigPresenter.getProcessConfig());
return false;
}
}).updateContainerConfig(processConfigPresenter.getContainerSpecKey().getServerTemplateKey().getId(), processConfigPresenter.getContainerSpecKey().getId(), Capability.PROCESS, newProcessConfig);
}
use of org.kie.server.controller.api.model.spec.ProcessConfig in project kie-wb-common by kiegroup.
the class ContainerProcessConfigPresenterTest method testSave.
@Test
public void testSave() {
final String templateKey = "templateKey";
final String containerKey = "containerKey";
when(serverTemplateKey.getId()).thenReturn(templateKey);
when(containerSpecKey.getId()).thenReturn(containerKey);
when(view.getSaveSuccessMessage()).thenReturn("SUCCESS");
presenter.save();
verify(notification).fire(new NotificationEvent("SUCCESS", NotificationEvent.NotificationType.SUCCESS));
verify(view).disableActions();
verify(processConfigPresenter).buildProcessConfig();
final ArgumentCaptor<ProcessConfig> processConfigCaptor = ArgumentCaptor.forClass(ProcessConfig.class);
verify(specManagementService).updateContainerConfig(eq(templateKey), eq(containerKey), eq(Capability.PROCESS), processConfigCaptor.capture());
verify(view).enableActions();
verify(processConfigPresenter).setProcessConfig(processConfigCaptor.getValue());
}
use of org.kie.server.controller.api.model.spec.ProcessConfig in project kie-wb-common by kiegroup.
the class ProcessConfigPresenterTest method testBuildProcessConfig.
@Test
public void testBuildProcessConfig() {
when(view.getRuntimeStrategy()).thenReturn("a");
when(view.getKBase()).thenReturn("b");
when(view.getKSession()).thenReturn("c");
when(view.getMergeMode()).thenReturn("d");
final ProcessConfig processConfig = presenter.buildProcessConfig();
assertEquals("SINGLETON", processConfig.getRuntimeStrategy());
assertEquals("b", processConfig.getKBase());
assertEquals("c", processConfig.getKSession());
assertEquals("KEEP_ALL", processConfig.getMergeMode());
}
Aggregations