use of org.kie.internal.process.CorrelationKey in project jbpm by kiegroup.
the class ProcessServiceEJBIntegrationTest method testStartProcessWithCorrelationKey.
@Test
public void testStartProcessWithCorrelationKey() {
assertNotNull(deploymentService);
KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
assertNotNull(processService);
CorrelationKey key = KieInternalServices.Factory.get().newCorrelationKeyFactory().newCorrelationKey("my business key");
long processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "customtask", key);
assertNotNull(processInstanceId);
ProcessInstance pi = processService.getProcessInstance(key);
assertNull(pi);
}
use of org.kie.internal.process.CorrelationKey in project jbpm by kiegroup.
the class CorrelationKeyTest method testNotUniqueMultiValuedKey.
@Test
public void testNotUniqueMultiValuedKey() {
CorrelationKey key = keyFactory.newCorrelationKey(COMPOSED_KEY);
ProcessInstance processInstance = ksession.startProcess(PROCESS, key, null);
assertProcessInstanceActive(processInstance.getId());
try {
ksession.startProcess(PROCESS, key, null);
Assertions.fail("Not unique correlation key used. Exception should have been thrown.");
} catch (RuntimeException ex) {
ex.printStackTrace();
Assertions.assertThat(ex.getMessage()).contains("already exists");
}
}
use of org.kie.internal.process.CorrelationKey in project jbpm by kiegroup.
the class CorrelationKeyTest method testNotUniqueSimpleKey.
@Test
public void testNotUniqueSimpleKey() {
CorrelationKey key = keyFactory.newCorrelationKey(SIMPLE_KEY);
ProcessInstance processInstance = ksession.startProcess(PROCESS, key, null);
assertProcessInstanceActive(processInstance.getId());
try {
ksession.startProcess(PROCESS, key, null);
Assertions.fail("Not unique correlation key used. Exception should have been thrown.");
} catch (RuntimeException ex) {
ex.printStackTrace();
Assertions.assertThat(ex.getMessage()).contains("already exists");
}
}
Aggregations