Search in sources :

Example 11 with ProcessConfig

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

the class ServerTemplateVFSStorageTest method createServerTemplateWithContainer.

/*
     * helper method to setup template container and container spec
     */
protected void createServerTemplateWithContainer() {
    serverTemplate = new ServerTemplate();
    serverTemplate.setName("test server");
    serverTemplate.setId(UUID.randomUUID().toString());
    Map<Capability, ContainerConfig> configs = new HashMap<Capability, ContainerConfig>();
    ruleConfig = new RuleConfig();
    ruleConfig.setPollInterval(1000l);
    ruleConfig.setScannerStatus(KieScannerStatus.STARTED);
    configs.put(Capability.RULE, ruleConfig);
    processConfig = new ProcessConfig();
    processConfig.setKBase("defaultKieBase");
    processConfig.setKSession("defaultKieSession");
    processConfig.setMergeMode("MERGE_COLLECTION");
    processConfig.setRuntimeStrategy("PER_PROCESS_INSTANCE");
    configs.put(Capability.PROCESS, processConfig);
    containerSpec = new ContainerSpec();
    containerSpec.setId("test container");
    containerSpec.setServerTemplateKey(new ServerTemplateKey(serverTemplate.getId(), serverTemplate.getName()));
    containerSpec.setReleasedId(new ReleaseId("org.kie", "kie-server-kjar", "1.0"));
    containerSpec.setStatus(KieContainerStatus.STOPPED);
    containerSpec.setConfigs(configs);
    serverTemplate.addContainerSpec(containerSpec);
    container = new Container();
    container.setServerInstanceId(serverTemplate.getId());
    container.setServerTemplateId(serverTemplate.getId());
    container.setResolvedReleasedId(containerSpec.getReleasedId());
    container.setContainerName(containerSpec.getContainerName());
    container.setContainerSpecId(containerSpec.getId());
    container.setUrl("http://fake.server.net/kie-server");
}
Also used : ContainerConfig(org.kie.server.controller.api.model.spec.ContainerConfig) ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) Container(org.kie.server.controller.api.model.runtime.Container) Capability(org.kie.server.controller.api.model.spec.Capability) ProcessConfig(org.kie.server.controller.api.model.spec.ProcessConfig) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) HashMap(java.util.HashMap) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) RuleConfig(org.kie.server.controller.api.model.spec.RuleConfig) ReleaseId(org.kie.server.api.model.ReleaseId)

Example 12 with ProcessConfig

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

the class ContainerProcessConfigPresenterTest method testSetup.

@Test
public void testSetup() {
    final ContainerSpecKey containerSpecKey = new ContainerSpecKey("id", "container-name", new ServerTemplateKey("template-id", "template-name"));
    final ProcessConfig processConfig = new ProcessConfig(RuntimeStrategy.PER_REQUEST.toString(), "kbase", "ksession", MergeMode.KEEP_ALL.toString());
    presenter.setup(containerSpecKey, processConfig);
    verify(view).enableActions();
    verify(processConfigPresenter).setup(containerSpecKey, processConfig);
    verify(processConfigPresenter).setProcessConfig(processConfig);
}
Also used : ServerTemplateKey(org.kie.server.controller.api.model.spec.ServerTemplateKey) ProcessConfig(org.kie.server.controller.api.model.spec.ProcessConfig) ContainerSpecKey(org.kie.server.controller.api.model.spec.ContainerSpecKey) Test(org.junit.Test)

Example 13 with ProcessConfig

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

the class ProcessConfigPresenterTest method testBuildProcessConfig2.

@Test
public void testBuildProcessConfig2() {
    when(view.getRuntimeStrategy()).thenReturn(Constants.ClientRuntimeStrategy_PerProcessInstance);
    when(view.getKBase()).thenReturn("b");
    when(view.getKSession()).thenReturn("c");
    when(view.getMergeMode()).thenReturn(Constants.ClientMergeMode_MergeCollections);
    final ProcessConfig processConfig = presenter.buildProcessConfig();
    assertEquals("PER_PROCESS_INSTANCE", processConfig.getRuntimeStrategy());
    assertEquals("b", processConfig.getKBase());
    assertEquals("c", processConfig.getKSession());
    assertEquals("MERGE_COLLECTIONS", processConfig.getMergeMode());
}
Also used : ProcessConfig(org.kie.server.controller.api.model.spec.ProcessConfig) Test(org.junit.Test)

Example 14 with ProcessConfig

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

the class ProcessConfigPresenterTest method testSetup.

@Test
public void testSetup() {
    final ContainerSpecKey containerSpecKey = new ContainerSpecKey();
    final ProcessConfig processConfig = new ProcessConfig(ClientRuntimeStrategy.PER_CASE.toString(), "kBase", "kSession", ClientMergeMode.KEEP_ALL.toString());
    presenter.setup(containerSpecKey, processConfig);
    verify(view).setContent(ClientRuntimeStrategy.PER_CASE.getValue(translationService), processConfig.getKBase(), processConfig.getKSession(), ClientMergeMode.convert(processConfig.getMergeMode(), translationService).getValue(translationService));
    assertEquals(containerSpecKey, presenter.getContainerSpecKey());
    assertEquals(processConfig, presenter.getProcessConfig());
    presenter.clear();
    assertNull(presenter.getContainerSpecKey());
    assertNull(presenter.getProcessConfig());
}
Also used : ProcessConfig(org.kie.server.controller.api.model.spec.ProcessConfig) ContainerSpecKey(org.kie.server.controller.api.model.spec.ContainerSpecKey) Test(org.junit.Test)

Example 15 with ProcessConfig

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

the class ProcessConfigPresenterTest method testCancel.

@Test
public void testCancel() {
    final ProcessConfig processConfig = new ProcessConfig(ClientRuntimeStrategy.PER_CASE.toString(), "kBase", "kSession", ClientMergeMode.OVERRIDE_ALL.toString());
    presenter.setProcessConfig(processConfig);
    presenter.cancel();
    verify(view, times(2)).setContent(ClientRuntimeStrategy.PER_CASE.getValue(translationService), processConfig.getKBase(), processConfig.getKSession(), ClientMergeMode.OVERRIDE_ALL.getValue(translationService));
}
Also used : ProcessConfig(org.kie.server.controller.api.model.spec.ProcessConfig) Test(org.junit.Test)

Aggregations

ProcessConfig (org.kie.server.controller.api.model.spec.ProcessConfig)15 Test (org.junit.Test)12 RuleConfig (org.kie.server.controller.api.model.spec.RuleConfig)8 ServerTemplate (org.kie.server.controller.api.model.spec.ServerTemplate)7 ContainerSpec (org.kie.server.controller.api.model.spec.ContainerSpec)5 ServerTemplateKey (org.kie.server.controller.api.model.spec.ServerTemplateKey)5 HashMap (java.util.HashMap)4 Capability (org.kie.server.controller.api.model.spec.Capability)4 ContainerConfig (org.kie.server.controller.api.model.spec.ContainerConfig)4 ReleaseId (org.kie.server.api.model.ReleaseId)3 ServerInstanceKey (org.kie.server.controller.api.model.runtime.ServerInstanceKey)3 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)3 Container (org.kie.server.controller.api.model.runtime.Container)2 ContainerSpecKey (org.kie.server.controller.api.model.spec.ContainerSpecKey)2 Matchers.anyString (org.mockito.Matchers.anyString)2 ErrorCallback (org.jboss.errai.common.client.api.ErrorCallback)1 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)1 Before (org.junit.Before)1 ServerTemplateSelected (org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected)1 ContainerSpecData (org.kie.workbench.common.screens.server.management.model.ContainerSpecData)1