Search in sources :

Example 6 with CorrelationKey

use of org.kie.internal.process.CorrelationKey in project jbpm by kiegroup.

the class CorrelationKeyTest method testMultiValuedKey.

@Test
public void testMultiValuedKey() {
    CorrelationKey key = keyFactory.newCorrelationKey(COMPOSED_KEY);
    ProcessInstance processInstance = ksession.startProcess(PROCESS, key, null);
    assertProcessInstanceActive(processInstance.getId());
    CorrelationKey keyCopy = keyFactory.newCorrelationKey(COMPOSED_KEY);
    ProcessInstance processInstanceCopy = ksession.getProcessInstance(keyCopy);
    Assertions.assertThat(processInstanceCopy.getId()).isEqualTo(processInstance.getId());
}
Also used : CorrelationKey(org.kie.internal.process.CorrelationKey) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) Test(org.junit.Test)

Example 7 with CorrelationKey

use of org.kie.internal.process.CorrelationKey in project jbpm by kiegroup.

the class CorrelationKeyTest method testGetNotExistingSimpleKey.

@Test
public void testGetNotExistingSimpleKey() {
    CorrelationKey key = keyFactory.newCorrelationKey(SIMPLE_KEY);
    ProcessInstance processInstance = ksession.getProcessInstance(key);
    Assertions.assertThat(processInstance).isNull();
}
Also used : CorrelationKey(org.kie.internal.process.CorrelationKey) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) Test(org.junit.Test)

Example 8 with CorrelationKey

use of org.kie.internal.process.CorrelationKey in project jbpm by kiegroup.

the class CorrelationKeyTest method testMultiValuedKeyUniqueButInclusive.

@Test
public void testMultiValuedKeyUniqueButInclusive() {
    // JBPM-5897
    CorrelationKey key1 = keyFactory.newCorrelationKey(Arrays.asList("ABC", "DEF", "DEF"));
    ProcessInstance processInstance = ksession.startProcess(PROCESS, key1, null);
    assertProcessInstanceActive(processInstance.getId());
    CorrelationKey key2 = keyFactory.newCorrelationKey(Arrays.asList("ABC", "DEF", "GHI"));
    ProcessInstance processInstance2 = ksession.startProcess(PROCESS, key2, null);
    assertProcessInstanceActive(processInstance2.getId());
}
Also used : CorrelationKey(org.kie.internal.process.CorrelationKey) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) Test(org.junit.Test)

Example 9 with CorrelationKey

use of org.kie.internal.process.CorrelationKey in project jbpm by kiegroup.

the class CorrelationKeyTest method testStartProcessParametersPassing.

@Test
public void testStartProcessParametersPassing() {
    CorrelationKey key = keyFactory.newCorrelationKey(SIMPLE_KEY);
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(VARIABLE_ID, VARIABLE_VALUE);
    ProcessInstance processInstance = ksession.startProcess(PROCESS, key, parameters);
    assertProcessInstanceActive(processInstance.getId());
    List<? extends VariableInstanceLog> variables = getLogService().findVariableInstances(processInstance.getId());
    Assertions.assertThat(variables).isNotEmpty();
    Assertions.assertThat(variables.get(0).getVariableId()).isEqualTo(VARIABLE_ID);
    Assertions.assertThat(variables.get(0).getValue()).isEqualTo(VARIABLE_VALUE);
}
Also used : CorrelationKey(org.kie.internal.process.CorrelationKey) HashMap(java.util.HashMap) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) Test(org.junit.Test)

Example 10 with CorrelationKey

use of org.kie.internal.process.CorrelationKey in project jbpm by kiegroup.

the class CorrelationKeyTest method testGetNotExistingMultiValuedKey.

@Test
public void testGetNotExistingMultiValuedKey() {
    CorrelationKey key = keyFactory.newCorrelationKey(COMPOSED_KEY);
    ProcessInstance processInstance = ksession.getProcessInstance(key);
    Assertions.assertThat(processInstance).isNull();
}
Also used : CorrelationKey(org.kie.internal.process.CorrelationKey) ProcessInstance(org.kie.api.runtime.process.ProcessInstance) Test(org.junit.Test)

Aggregations

CorrelationKey (org.kie.internal.process.CorrelationKey)38 Test (org.junit.Test)27 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)21 ProcessInstanceDesc (org.jbpm.services.api.model.ProcessInstanceDesc)12 QueryContext (org.kie.api.runtime.query.QueryContext)12 HashMap (java.util.HashMap)10 ArrayList (java.util.ArrayList)9 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)8 UserTaskInstanceDesc (org.jbpm.services.api.model.UserTaskInstanceDesc)7 CorrelationKeyFactory (org.kie.internal.process.CorrelationKeyFactory)7 KModuleDeploymentUnit (org.jbpm.kie.services.impl.KModuleDeploymentUnit)6 KieSession (org.kie.api.runtime.KieSession)6 CaseNotFoundException (org.jbpm.casemgmt.api.CaseNotFoundException)5 Collection (java.util.Collection)4 List (java.util.List)4 Map (java.util.Map)4 Collectors.toList (java.util.stream.Collectors.toList)4 RegistryContext (org.drools.core.command.impl.RegistryContext)4 CaseEventSupport (org.jbpm.casemgmt.impl.event.CaseEventSupport)4 RuntimeDataService (org.jbpm.services.api.RuntimeDataService)4