code stringlengths 25 201k | docstring stringlengths 19 96.2k | func_name stringlengths 0 235 | language stringclasses 1 value | repo stringlengths 8 51 | path stringlengths 11 314 | url stringlengths 62 377 | license stringclasses 7 values |
|---|---|---|---|---|---|---|---|
public void testMethod(DelegateExecution delegateExecution) {
delegateExecution.setVariable("testVar", "myValue");
} | Class used to test passing of execution in expressions/
@author Frederik Heremans | testMethod | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/el/ExecutionTestVariable.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/el/ExecutionTestVariable.java | Apache-2.0 |
@Test
@Deployment(resources = {
"org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTests.throwSignalWithPayload.bpmn20.xml",
"org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTests.catchSignalWithPayloadStart.bpmn20.xml" })
public void testSignalPayloadStart() {
// given
Map<String, Object> variables = new HashMap<>();
variables.put("payloadVar1", "payloadVal1");
variables.put("payloadVar2", "payloadVal2");
// when
runtimeService.startProcessInstanceByKey("throwPayloadSignal", variables);
// then
Task catchingPiUserTask = taskService.createTaskQuery().singleResult();
List<VariableInstance> catchingPiVariables = runtimeService.createVariableInstanceQuery()
.processInstanceIdIn(catchingPiUserTask.getProcessInstanceId())
.list();
assertEquals(2, catchingPiVariables.size());
for(VariableInstance variable : catchingPiVariables) {
if(variable.getName().equals("payloadVar1Target")) {
assertEquals("payloadVal1", variable.getValue());
} else {
assertEquals("payloadVal2", variable.getValue());
}
}
} | Test case for CAM-8820 with a catching Start Signal event.
Using Source and Target Variable name mapping attributes. | testSignalPayloadStart | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTest.java | Apache-2.0 |
@Test
@Deployment(resources = {
"org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTests.throwSignalWithPayload.bpmn20.xml",
"org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTests.catchSignalWithPayloadIntermediate.bpmn20.xml" })
public void testSignalPayloadIntermediate() {
// given
Map<String, Object> variables = new HashMap<>();
variables.put("payloadVar1", "payloadVal1");
variables.put("payloadVar2", "payloadVal2");
ProcessInstance catchingPI = runtimeService.startProcessInstanceByKey("catchIntermediatePayloadSignal");
// when
runtimeService.startProcessInstanceByKey("throwPayloadSignal", variables);
// then
List<VariableInstance> catchingPiVariables = runtimeService
.createVariableInstanceQuery()
.processInstanceIdIn(catchingPI.getId())
.list();
assertEquals(2, catchingPiVariables.size());
for(VariableInstance variable : catchingPiVariables) {
if(variable.getName().equals("payloadVar1Target")) {
assertEquals("payloadVal1", variable.getValue());
} else {
assertEquals("payloadVal2", variable.getValue());
}
}
} | Test case for CAM-8820 with a catching Intermediate Signal event.
Using Source and Target Variable name mapping attributes. | testSignalPayloadIntermediate | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTest.java | Apache-2.0 |
@Test
@Deployment(resources = {
"org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTests.throwSignalWithExpressionPayload.bpmn20.xml",
"org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTests.catchSignalWithPayloadIntermediate.bpmn20.xml" })
public void testSignalSourceExpressionPayload() {
// given
Map<String, Object> variables = new HashMap<>();
variables.put("payloadVar", "Val");
ProcessInstance catchingPI = runtimeService.startProcessInstanceByKey("catchIntermediatePayloadSignal");
// when
runtimeService.startProcessInstanceByKey("throwExpressionPayloadSignal", variables);
// then
List<VariableInstance> catchingPiVariables = runtimeService
.createVariableInstanceQuery()
.processInstanceIdIn(catchingPI.getId())
.list();
assertEquals(1, catchingPiVariables.size());
assertEquals("srcExpressionResVal", catchingPiVariables.get(0).getName());
assertEquals("sourceVal", catchingPiVariables.get(0).getValue());
} | Test case for CAM-8820 with an expression as a source. | testSignalSourceExpressionPayload | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTest.java | Apache-2.0 |
@Test
@Deployment(resources = {
"org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTests.throwSignalWithAllVariablesPayload.bpmn20.xml",
"org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTests.catchSignalWithPayloadIntermediate.bpmn20.xml" })
public void testSignalAllSourceVariablesPayload() {
// given
Map<String, Object> variables = new HashMap<>();
variables.put("payloadVar1", "payloadVal1");
variables.put("payloadVar2", "payloadVal2");
ProcessInstance catchingPI = runtimeService.startProcessInstanceByKey("catchIntermediatePayloadSignal");
// when
runtimeService.startProcessInstanceByKey("throwPayloadSignal", variables);
// then
List<VariableInstance> catchingPiVariables = runtimeService
.createVariableInstanceQuery()
.processInstanceIdIn(catchingPI.getId())
.list();
assertEquals(2, catchingPiVariables.size());
for(VariableInstance variable : catchingPiVariables) {
if(variable.getName().equals("payloadVar1")) {
assertEquals("payloadVal1", variable.getValue());
} else {
assertEquals("payloadVal2", variable.getValue());
}
}
} | Test case for CAM-8820 with all the (global) source variables
as the signal payload. | testSignalAllSourceVariablesPayload | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTest.java | Apache-2.0 |
@Test
@Deployment(resources = {
"org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTests.throwEndSignalEventWithAllLocalVariablesPayload.bpmn20.xml",
"org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTests.catchSignalWithPayloadIntermediate.bpmn20.xml" })
public void testSignalAllLocalSourceVariablesPayload() {
// given
Map<String, Object> variables = new HashMap<>();
variables.put("payloadVar1", "payloadVal1");
String localVar1 = "localVar1";
String localVal1 = "localVal1";
String localVar2 = "localVar2";
String localVal2 = "localVal2";
ProcessInstance catchingPI = runtimeService.startProcessInstanceByKey("catchIntermediatePayloadSignal");
// when
runtimeService.startProcessInstanceByKey("throwPayloadSignal", variables);
// then
List<VariableInstance> catchingPiVariables = runtimeService
.createVariableInstanceQuery()
.processInstanceIdIn(catchingPI.getId())
.list();
assertEquals(2, catchingPiVariables.size());
for(VariableInstance variable : catchingPiVariables) {
if(variable.getName().equals(localVar1)) {
assertEquals(localVal1, variable.getValue());
} else {
assertEquals(localVal2, variable.getValue());
}
}
} | Test case for CAM-8820 with all the (local) source variables
as the signal payload. | testSignalAllLocalSourceVariablesPayload | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTest.java | Apache-2.0 |
@Test
@Deployment(resources = {
"org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTests.throwSignalWithBusinessKeyPayload.bpmn20.xml",
"org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTests.catchSignalWithPayloadStart.bpmn20.xml" })
public void testSignalBusinessKeyPayload() {
// given
String businessKey = "aBusinessKey";
// when
runtimeService.startProcessInstanceByKey("throwBusinessKeyPayloadSignal", businessKey);
// then
ProcessInstance catchingPI = runtimeService.createProcessInstanceQuery().singleResult();
assertEquals(businessKey, catchingPI.getBusinessKey());
} | Test case for CAM-8820 with a Business Key
as signal payload. | testSignalBusinessKeyPayload | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTest.java | Apache-2.0 |
@Test
@Deployment(resources = {
"org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTests.throwSignalWithAllOptions.bpmn20.xml",
"org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTests.catchSignalWithPayloadStart.bpmn20.xml"})
public void testSignalPayloadWithAllOptions() {
// given
Map<String, Object> variables = new HashMap<>();
String globalVar1 = "payloadVar1";
String globalVal1 = "payloadVar1";
String globalVar2 = "payloadVar2";
String globalVal2 = "payloadVal2";
variables.put(globalVar1, globalVal1);
variables.put(globalVar2, globalVal2);
String localVar1 = "localVar1";
String localVal1 = "localVal1";;
String localVar2 = "localVar2";
String localVal2 = "localVal2";
String businessKey = "aBusinessKey";
// when
runtimeService.startProcessInstanceByKey("throwCompletePayloadSignal", businessKey, variables);
// then
Task catchingPiUserTask = taskService.createTaskQuery().singleResult();
ProcessInstance catchingPI = runtimeService.createProcessInstanceQuery().processInstanceId(catchingPiUserTask.getProcessInstanceId()).singleResult();
assertEquals(businessKey, catchingPI.getBusinessKey());
List<VariableInstance> targetVariables = runtimeService.createVariableInstanceQuery().processInstanceIdIn(catchingPiUserTask.getProcessInstanceId()).list();
assertEquals(4, targetVariables.size());
for (VariableInstance variable : targetVariables) {
if (variable.getName().equals(globalVar1 + "Target")) {
assertEquals(globalVal1, variable.getValue());
} else if (variable.getName().equals(globalVar2 + "Target")) {
assertEquals(globalVal2 + "Source", variable.getValue());
} else if (variable.getName().equals(localVar1)) {
assertEquals(localVal1, variable.getValue());
} else if (variable.getName().equals(localVar2)) {
assertEquals(localVal2, variable.getValue());
}
}
} | Test case for CAM-8820 with all possible options for a signal payload. | testSignalPayloadWithAllOptions | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventPayloadTest.java | Apache-2.0 |
@Deployment
@Test
public void testStartTimerEventSubProcessInMultiInstanceSubProcessWithNonInterruptingBoundaryTimerEvent() {
DummyServiceTask.wasExecuted = false;
// start process instance
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
// check if user task exists
TaskQuery taskQuery = taskService.createTaskQuery();
assertEquals(1, taskQuery.count());
JobQuery jobQuery = managementService.createJobQuery();
// 1 start timer job and 1 boundary timer job
assertEquals(2, jobQuery.count());
// execute interrupting start timer event subprocess job
managementService.executeJob(jobQuery.orderByJobDuedate().asc().list().get(1).getId());
assertEquals(true, DummyServiceTask.wasExecuted);
// after first interrupting start timer event sub process execution
// multiInstance loop number 2
assertEquals(1, taskQuery.count());
assertEquals(2, jobQuery.count());
// execute non interrupting boundary timer job
managementService.executeJob(jobQuery.orderByJobDuedate().asc().list().get(0).getId());
// after non interrupting boundary timer job execution
assertEquals(1, jobQuery.count());
assertEquals(1, taskQuery.count());
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId());
assertEquals(1, processInstanceQuery.count());
} | test scenario: - start process instance with multiInstance sequential -
execute interrupting timer job of event subprocess - execute non
interrupting timer boundary event of subprocess | testStartTimerEventSubProcessInMultiInstanceSubProcessWithNonInterruptingBoundaryTimerEvent | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/timer/StartTimerEventTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/timer/StartTimerEventTest.java | Apache-2.0 |
@Deployment
@Test
public void testStartTimerEventSubProcessInParallelMultiInstanceSubProcessWithNonInterruptingBoundaryTimerEvent() {
DummyServiceTask.wasExecuted = false;
// start process instance
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
// execute multiInstance loop number 1
// check if execution exists
ExecutionQuery executionQuery = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId());
assertEquals(6, executionQuery.count());
// check if user task exists
TaskQuery taskQuery = taskService.createTaskQuery();
assertEquals(2, taskQuery.count());
JobQuery jobQuery = managementService.createJobQuery();
assertEquals(3, jobQuery.count());
// execute interrupting timer job
managementService.executeJob(jobQuery.orderByJobDuedate().asc().list().get(1).getId());
assertEquals(true, DummyServiceTask.wasExecuted);
// after interrupting timer job execution
assertEquals(2, jobQuery.count());
assertEquals(1, taskQuery.count());
assertEquals(5, executionQuery.count());
// execute non interrupting boundary timer job
managementService.executeJob(jobQuery.orderByJobDuedate().asc().list().get(0).getId());
// after non interrupting boundary timer job execution
assertEquals(1, jobQuery.count());
assertEquals(1, taskQuery.count());
assertEquals(5, executionQuery.count());
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId());
assertEquals(1, processInstanceQuery.count());
} | test scenario: - start process instance with multiInstance parallel -
execute interrupting timer job of event subprocess - execute non
interrupting timer boundary event of subprocess | testStartTimerEventSubProcessInParallelMultiInstanceSubProcessWithNonInterruptingBoundaryTimerEvent | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/timer/StartTimerEventTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/timer/StartTimerEventTest.java | Apache-2.0 |
@Deployment
@Test
public void testStartTimerEventSubProcessInParallelMultiInstanceSubProcessWithInterruptingBoundaryTimerEvent() {
// start process instance
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
// execute multiInstance loop number 1
// check if execution exists
ExecutionQuery executionQuery = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId());
assertEquals(6, executionQuery.count());
// check if user task exists
TaskQuery taskQuery = taskService.createTaskQuery();
assertEquals(2, taskQuery.count());
JobQuery jobQuery = managementService.createJobQuery();
assertEquals(3, jobQuery.count());
// execute interrupting timer job
managementService.executeJob(jobQuery.orderByJobDuedate().asc().list().get(1).getId());
// after interrupting timer job execution
assertEquals(2, jobQuery.count());
assertEquals(1, taskQuery.count());
assertEquals(5, executionQuery.count());
// execute interrupting boundary timer job
managementService.executeJob(jobQuery.orderByJobDuedate().asc().list().get(0).getId());
// after interrupting boundary timer job execution
assertEquals(0, jobQuery.count());
assertEquals(0, taskQuery.count());
assertEquals(0, executionQuery.count());
testRule.assertProcessEnded(processInstance.getId());
} | test scenario: - start process instance with multiInstance parallel -
execute interrupting timer job of event subprocess - execute interrupting
timer boundary event of subprocess | testStartTimerEventSubProcessInParallelMultiInstanceSubProcessWithInterruptingBoundaryTimerEvent | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/timer/StartTimerEventTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/event/timer/StartTimerEventTest.java | Apache-2.0 |
public void notify(DelegateExecution execution) throws Exception {
boolean instanceEnded = execution.getBpmnModelElementInstance() instanceof EndEvent;
boolean instanceCanceled = execution.getProcessInstance() != null && execution.getProcessInstance().isCanceled();
if (instanceCanceled) {
execution.setVariable("canceled", true);
} else if (instanceEnded) {
execution.setVariable("finished", true);
} else {
execution.setVariable("running", true);
}
} | Simple {@link ExecutionListener} that sets a variable on the execution depending on the execution's state.
@author Tobias Metzke | notify | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/executionlistener/ExampleExecutionListenerEnd.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/executionlistener/ExampleExecutionListenerEnd.java | Apache-2.0 |
public void notify(DelegateExecution execution) throws Exception {
execution.setVariable("var", fixedValue.getValue(execution).toString() + dynamicValue.getValue(execution).toString());
} | Example {@link ExecutionListener} which gets 2 fields injected.
@author Frederik Heremans | notify | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/executionlistener/ExampleFieldInjectedExecutionListener.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/executionlistener/ExampleFieldInjectedExecutionListener.java | Apache-2.0 |
@Deployment
@Test
public void testDecisionFunctionality() {
Map<String, Object> variables = new HashMap<String, Object>();
// Test with input == 1
variables.put("input", 1);
ProcessInstance pi = runtimeService.startProcessInstanceByKey("exclusiveGateway", variables);
Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
assertEquals("Send e-mail for more information", task.getName());
// Test with input == 2
variables.put("input", 2);
pi = runtimeService.startProcessInstanceByKey("exclusiveGateway", variables);
task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
assertEquals("Check account balance", task.getName());
// Test with input == 3
variables.put("input", 3);
pi = runtimeService.startProcessInstanceByKey("exclusiveGateway", variables);
task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
assertEquals("Call customer", task.getName());
// Test with input == 4
variables.put("input", 4);
try {
runtimeService.startProcessInstanceByKey("exclusiveGateway", variables);
fail();
} catch (ProcessEngineException e) {
// Exception is expected since no outgoing sequence flow matches
}
} | The test process has an XOR gateway where, the 'input' variable is used to
select one of the outgoing sequence flow. Every one of those sequence flow
goes to another task, allowing us to test the decision very easily. | testDecisionFunctionality | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/gateway/ExclusiveGatewayTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/gateway/ExclusiveGatewayTest.java | Apache-2.0 |
@Deployment
@Test
public void testParentActivationOnNonJoiningEnd() throws Exception {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("parentActivationOnNonJoiningEnd");
List<Execution> executionsBefore = runtimeService.createExecutionQuery().list();
assertEquals(3, executionsBefore.size());
// start first round of tasks
List<Task> firstTasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
assertEquals(2, firstTasks.size());
for (Task t: firstTasks) {
taskService.complete(t.getId());
}
// start first round of tasks
List<Task> secondTasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
assertEquals(2, secondTasks.size());
// complete one task
Task task = secondTasks.get(0);
taskService.complete(task.getId());
// should have merged last child execution into parent
List<Execution> executionsAfter = runtimeService.createExecutionQuery().list();
assertEquals(1, executionsAfter.size());
Execution execution = executionsAfter.get(0);
// and should have one active activity
List<String> activeActivityIds = runtimeService.getActiveActivityIds(execution.getId());
assertEquals(1, activeActivityIds.size());
// Completing last task should finish the process instance
Task lastTask = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
taskService.complete(lastTask.getId());
assertEquals(0l, runtimeService.createProcessInstanceQuery().active().count());
} | Test for ACT-1216: When merging a concurrent execution the parent is not activated correctly | testParentActivationOnNonJoiningEnd | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/gateway/InclusiveGatewayTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/gateway/InclusiveGatewayTest.java | Apache-2.0 |
@Deployment
@Test
public void testNoExpressionTrueThrowsException() {
Map<String, Object> variables = CollectionUtil.singletonMap("input", "non-existing-value");
try {
runtimeService.startProcessInstanceByKey("condSeqFlowUelExpr", variables);
fail("Expected ProcessEngineException");
} catch (ProcessEngineException e) {
testRule.assertTextPresent("No conditional sequence flow leaving the Flow Node 'theStart' could be selected for continuing the process", e.getMessage());
}
} | Test that Conditional Sequence Flows throw an exception, if no condition
evaluates to true.
BPMN 2.0.1 p. 427 (PDF 457):
"Multiple outgoing Sequence Flows with conditions behaves as an inclusive split."
BPMN 2.0.1 p. 436 (PDF 466):
"The inclusive gateway throws an exception in case all conditions evaluate to false and a default flow has not been specified."
@see <a href="https://app.camunda.com/jira/browse/CAM-1773">https://app.camunda.com/jira/browse/CAM-1773</a> | testNoExpressionTrueThrowsException | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/sequenceflow/ConditionalSequenceFlowTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/sequenceflow/ConditionalSequenceFlowTest.java | Apache-2.0 |
@Deployment
@Test
public void testDefaultSequenceFlowOnTask() {
String procId = runtimeService.startProcessInstanceByKey("defaultSeqFlow",
CollectionUtil.singletonMap("input", 2)).getId();
assertNotNull(runtimeService.createExecutionQuery().processInstanceId(procId).activityId("task2").singleResult());
procId = runtimeService.startProcessInstanceByKey("defaultSeqFlow",
CollectionUtil.singletonMap("input", 3)).getId();
assertNotNull(runtimeService.createExecutionQuery().processInstanceId(procId).activityId("task3").singleResult());
procId = runtimeService.startProcessInstanceByKey("defaultSeqFlow",
CollectionUtil.singletonMap("input", 123)).getId();
assertNotNull(runtimeService.createExecutionQuery().processInstanceId(procId).activityId("task1").singleResult());
} | See {@link ExclusiveGatewayTest} for a default sequence flow test on an exclusive gateway.
@author Joram Barrez | testDefaultSequenceFlowOnTask | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/sequenceflow/DefaultSequenceFlowTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/sequenceflow/DefaultSequenceFlowTest.java | Apache-2.0 |
public void execute(DelegateExecution execution) throws Exception {
execution.setVariable("businessKeySetOnExecution", execution.getProcessBusinessKey());
execution.setVariable("businessKeyAsProcessBusinessKey", execution.getBusinessKey());
} | Delegate that gets the business-key from the delegate-execution and puts the
value in a variable.
@author Frederik Heremans | execute | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/servicetask/util/BusinessKeyCheckJavaDelegate.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/servicetask/util/BusinessKeyCheckJavaDelegate.java | Apache-2.0 |
public String getGenderString(String gender) {
return "Your gender is: " + gender;
} | Simple class for testing purposes.
@author Frederik Heremans | getGenderString | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/servicetask/util/GenderBean.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/servicetask/util/GenderBean.java | Apache-2.0 |
public void execute(DelegateExecution execution) {
String value1 = (String) text1.getValue(execution);
execution.setVariable("var1", new StringBuffer(value1).reverse().toString());
String value2 = (String) text2.getValue(execution);
execution.setVariable("var2", new StringBuffer(value2).reverse().toString());
} | Example JavaDelegate that uses an injected
{@link Expression}s in fields 'text1' and 'text2'. While executing, 'var1' is set with the reversed result of the
method invocation and 'var2' will be the reversed result of the value expression.
@author Frederik Heremans | execute | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/servicetask/util/ReverseStringsFieldInjected.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/servicetask/util/ReverseStringsFieldInjected.java | Apache-2.0 |
@Deployment
public void IGNORE_testSimpleSubProcessWithConcurrentTimer() {
// After staring the process, the task in the subprocess should be active
ProcessInstance pi = runtimeService.startProcessInstanceByKey("simpleSubProcessWithConcurrentTimer");
TaskQuery taskQuery = taskService
.createTaskQuery()
.processInstanceId(pi.getId())
.orderByTaskName()
.asc();
Task subProcessTask = taskQuery.singleResult();
assertEquals("Task in subprocess", subProcessTask.getName());
// When the timer is fired (after 2 hours), two concurrent paths should be created
Job job = managementService.createJobQuery().singleResult();
managementService.executeJob(job.getId());
List<Task> tasksAfterTimer = taskQuery.list();
assertEquals(2, tasksAfterTimer.size());
Task taskAfterTimer1 = tasksAfterTimer.get(0);
Task taskAfterTimer2 = tasksAfterTimer.get(1);
assertEquals("Task after timer 1", taskAfterTimer1.getName());
assertEquals("Task after timer 2", taskAfterTimer2.getName());
// Completing the two tasks should end the process instance
taskService.complete(taskAfterTimer1.getId());
taskService.complete(taskAfterTimer2.getId());
testRule.assertProcessEnded(pi.getId());
} | A test case that has a timer attached to the subprocess,
where 2 concurrent paths are defined when the timer fires. | IGNORE_testSimpleSubProcessWithConcurrentTimer | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/subprocess/SubProcessTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/subprocess/SubProcessTest.java | Apache-2.0 |
@SuppressWarnings("unchecked")
public void notify(DelegateTask delegateTask) {
// get mapping table from variable
DelegateExecution execution = delegateTask.getExecution();
Map<String, String> assigneeMappingTable = (Map<String, String>) execution.getVariable("assigneeMappingTable");
// get assignee from process
String assigneeFromProcessDefinition = delegateTask.getAssignee();
// overwrite assignee if there is an entry in the mapping table
if (assigneeMappingTable.containsKey(assigneeFromProcessDefinition)) {
String assigneeFromMappingTable = assigneeMappingTable.get(assigneeFromProcessDefinition);
delegateTask.setAssignee(assigneeFromMappingTable);
}
} | @author Falko Menge <falko.menge@camunda.com> | notify | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/tasklistener/util/AssigneeOverwriteFromVariable.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/tasklistener/util/AssigneeOverwriteFromVariable.java | Apache-2.0 |
@Deployment
@Test
public void testTaskAssignee() {
// Start process instance
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("taskAssigneeExampleProcess");
// Get task list
List<Task> tasks = taskService
.createTaskQuery()
.taskAssignee("kermit")
.list();
assertEquals(1, tasks.size());
Task myTask = tasks.get(0);
assertEquals("Schedule meeting", myTask.getName());
assertEquals("Schedule an engineering meeting for next week with the new hire.", myTask.getDescription());
// Complete task. Process is now finished
taskService.complete(myTask.getId());
// assert if the process instance completed
testRule.assertProcessEnded(processInstance.getId());
} | Simple process test to validate the current implementation protoype.
@author Joram Barrez | testTaskAssignee | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/usertask/TaskAssigneeTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/usertask/TaskAssigneeTest.java | Apache-2.0 |
public void notify(DelegateTask delegateTask) {
if (this.expression != null && this.expression.getValue(delegateTask) != null) {
// get the expression variable
String expression = this.expression.getValue(delegateTask).toString();
// this expression will be evaluated when completing the task
delegateTask.setVariableLocal("validationRule", expression);
}
} | This is for test case UserTaskTest.testCompleteAfterParallelGateway | notify | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/bpmn/usertask/UserTaskTestCreateTaskListener.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/bpmn/usertask/UserTaskTestCreateTaskListener.java | Apache-2.0 |
@Deployment(resources = {
"org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputBusinessKey.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"
})
@Test
public void testInputBusinessKey() {
// given
String businessKey = "myBusinessKey";
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE, businessKey).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
String superCaseExecutionId = subCaseInstance.getSuperCaseExecutionId();
CaseExecution superCaseExecution = queryCaseExecutionById(superCaseExecutionId);
assertEquals(caseTaskId, superCaseExecutionId);
assertEquals(superCaseInstanceId, superCaseExecution.getCaseInstanceId());
assertEquals(businessKey, subCaseInstance.getBusinessKey());
// complete ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
testRule.assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
testRule.assertCaseEnded(superCaseInstanceId);
} | assertion on default behaviour - remove manual activation | testInputBusinessKey | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | Apache-2.0 |
@Deployment(resources = {
"org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputDifferentBusinessKey.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"
})
@Test
public void testInputDifferentBusinessKey() {
// given
String businessKey = "myBusinessKey";
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE, businessKey).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
// when
caseService
.withCaseExecution(caseTaskId)
.setVariable("myOwnBusinessKey", "myOwnBusinessKey")
.manualStart();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
String superCaseExecutionId = subCaseInstance.getSuperCaseExecutionId();
CaseExecution superCaseExecution = queryCaseExecutionById(superCaseExecutionId);
assertEquals(caseTaskId, superCaseExecutionId);
assertEquals(superCaseInstanceId, superCaseExecution.getCaseInstanceId());
assertEquals("myOwnBusinessKey", subCaseInstance.getBusinessKey());
// complete ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
testRule.assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
testRule.assertCaseEnded(superCaseInstanceId);
} | variable passed in manual activation - change process definition | testInputDifferentBusinessKey | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | Apache-2.0 |
@Deployment(resources = {
"org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputSourceWithManualActivation.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"
})
@Test
public void testInputSource() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
// when
caseService
.withCaseExecution(caseTaskId)
.setVariable("aVariable", "abc")
.setVariable("anotherVariable", 999)
.setVariable("aThirdVariable", "def")
.manualStart();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
List<VariableInstance> variables = runtimeService
.createVariableInstanceQuery()
.caseInstanceIdIn(subCaseInstance.getId())
.list();
assertFalse(variables.isEmpty());
assertEquals(2, variables.size());
for (VariableInstance variable : variables) {
String name = variable.getName();
if ("aVariable".equals(name)) {
assertEquals("aVariable", name);
assertEquals("abc", variable.getValue());
} else if ("anotherVariable".equals(name)) {
assertEquals("anotherVariable", name);
assertEquals(999, variable.getValue());
} else {
fail("Found an unexpected variable: '"+name+"'");
}
}
// complete ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
testRule.assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
testRule.assertCaseEnded(superCaseInstanceId);
} | assertion on variables which are set on manual start - change process definition | testInputSource | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | Apache-2.0 |
@Deployment(resources = {
"org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputSourceDifferentTarget.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"
})
@Test
public void testInputSourceDifferentTarget() {
// given
VariableMap vars = new VariableMapImpl();
vars.putValue("aVariable", "abc");
vars.putValue("anotherVariable", 999);
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE, vars).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
List<VariableInstance> variables = runtimeService
.createVariableInstanceQuery()
.caseInstanceIdIn(subCaseInstance.getId())
.list();
assertFalse(variables.isEmpty());
assertEquals(2, variables.size());
for (VariableInstance variable : variables) {
String name = variable.getName();
if ("myVariable".equals(name)) {
assertEquals("myVariable", name);
assertEquals("abc", variable.getValue());
} else if ("myAnotherVariable".equals(name)) {
assertEquals("myAnotherVariable", name);
assertEquals(999, variable.getValue());
} else {
fail("Found an unexpected variable: '"+name+"'");
}
}
// complete ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
testRule.assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
testRule.assertCaseEnded(superCaseInstanceId);
} | default manual activation behaviour changed - remove manual activation statement | testInputSourceDifferentTarget | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | Apache-2.0 |
@Deployment(resources = {
"org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputSource.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"
})
@Test
public void testInputSourceNullValue() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
List<VariableInstance> variables = runtimeService
.createVariableInstanceQuery()
.caseInstanceIdIn(subCaseInstance.getId())
.list();
assertFalse(variables.isEmpty());
assertEquals(2, variables.size());
for (VariableInstance variable : variables) {
String name = variable.getName();
if ("aVariable".equals(name)) {
assertEquals("aVariable", name);
} else if ("anotherVariable".equals(name)) {
assertEquals("anotherVariable", name);
} else {
fail("Found an unexpected variable: '"+name+"'");
}
assertNull(variable.getValue());
}
// complete ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
testRule.assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
testRule.assertCaseEnded(superCaseInstanceId);
} | assertion on default execution - take manual start out | testInputSourceNullValue | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | Apache-2.0 |
@Deployment(resources = {
"org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputAllLocal.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"
})
@Test
public void testInputAllLocal() {
// given
createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
// when
caseService
.withCaseExecution(caseTaskId)
.setVariable("aVariable", "abc")
.setVariableLocal("aLocalVariable", "def")
.manualStart();
// then only the local variable is mapped to the subCaseInstance
CaseInstance subCaseInstance = queryOneTaskCaseInstance();
List<VariableInstance> variables = runtimeService
.createVariableInstanceQuery()
.caseInstanceIdIn(subCaseInstance.getId())
.list();
assertEquals(1, variables.size());
assertEquals("aLocalVariable", variables.get(0).getName());
} | assert on variable defined during manual start - change process definition | testInputAllLocal | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | Apache-2.0 |
@Deployment(resources = {
"org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCaseWithManualActivation.cmmn"
})
@Test
public void testCaseNotFound() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
try {
// when
caseService
.withCaseExecution(caseTaskId)
.manualStart();
fail("It should not be possible to start a not existing case instance.");
} catch (NotFoundException e) {}
// complete //////////////////////////////////////////////////////////
caseService
.withCaseExecution(caseTaskId)
.disable();
close(superCaseInstanceId);
} | assertion on manual activation operation - change process definition | testCaseNotFound | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | Apache-2.0 |
@Deployment(resources = {
"org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testOutputSource.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCaseWithManualActivation.cmmn"
})
@Test
public void testOutputSource() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String subCaseInstanceId = queryOneTaskCaseInstance().getId();
caseService
.withCaseExecution(subCaseInstanceId)
.setVariable("aVariable", "abc")
.setVariable("anotherVariable", 999)
.setVariable("aThirdVariable", "def")
.execute();
String humanTaskId = queryCaseExecutionByActivityId("PI_HumanTask_1").getId();
caseService
.withCaseExecution(humanTaskId)
.manualStart();
caseService
.withCaseExecution(humanTaskId)
.complete();
// when
caseService
.withCaseExecution(subCaseInstanceId)
.close();
// then
List<VariableInstance> variables = runtimeService
.createVariableInstanceQuery()
.caseInstanceIdIn(superCaseInstanceId)
.list();
assertFalse(variables.isEmpty());
assertEquals(2, variables.size());
for (VariableInstance variable : variables) {
String name = variable.getName();
if ("aVariable".equals(name)) {
assertEquals("aVariable", name);
assertEquals("abc", variable.getValue());
} else if ("anotherVariable".equals(name)) {
assertEquals("anotherVariable", name);
assertEquals(999, variable.getValue());
} else {
fail("Found an unexpected variable: '"+name+"'");
}
}
// complete ////////////////////////////////////////////////////////
close(superCaseInstanceId);
testRule.assertCaseEnded(superCaseInstanceId);
} | subprocess manual start with variables - change process definition | testOutputSource | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | Apache-2.0 |
@Deployment(resources = {
"org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testOutputSource.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"
})
@Test
public void testOutputSourceNullValue() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String subCaseInstanceId = queryOneTaskCaseInstance().getId();
String humanTaskId = queryCaseExecutionByActivityId("PI_HumanTask_1").getId();
caseService
.withCaseExecution(humanTaskId)
.complete();
// when
caseService
.withCaseExecution(subCaseInstanceId)
.close();
// then
List<VariableInstance> variables = runtimeService
.createVariableInstanceQuery()
.caseInstanceIdIn(superCaseInstanceId)
.list();
assertFalse(variables.isEmpty());
assertEquals(2, variables.size());
for (VariableInstance variable : variables) {
String name = variable.getName();
if ("aVariable".equals(name)) {
assertEquals("aVariable", name);
} else if ("anotherVariable".equals(name)) {
assertEquals("anotherVariable", name);
} else {
fail("Found an unexpected variable: '"+name+"'");
}
assertNull(variable.getValue());
}
// complete ////////////////////////////////////////////////////////
close(superCaseInstanceId);
testRule.assertCaseEnded(superCaseInstanceId);
} | assertion on default behaviour - remove manual activations | testOutputSourceNullValue | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | Apache-2.0 |
@Deployment(resources = {
"org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testOutputSourceExpression.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCaseWithManualActivation.cmmn"
})
@Test
public void testOutputSourceExpression() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String subCaseInstanceId = queryOneTaskCaseInstance().getId();
caseService
.withCaseExecution(subCaseInstanceId)
.setVariable("aVariable", "abc")
.setVariable("anotherVariable", 999)
.execute();
String humanTaskId = queryCaseExecutionByActivityId("PI_HumanTask_1").getId();
caseService
.withCaseExecution(humanTaskId)
.manualStart();
caseService
.withCaseExecution(humanTaskId)
.complete();
// when
caseService
.withCaseExecution(subCaseInstanceId)
.close();
// then
List<VariableInstance> variables = runtimeService
.createVariableInstanceQuery()
.caseInstanceIdIn(superCaseInstanceId)
.list();
assertFalse(variables.isEmpty());
assertEquals(2, variables.size());
for (VariableInstance variable : variables) {
String name = variable.getName();
if ("aVariable".equals(name)) {
assertEquals("aVariable", name);
assertEquals("abc", variable.getValue());
} else if ("anotherVariable".equals(name)) {
assertEquals("anotherVariable", name);
assertEquals((long) 1000, variable.getValue());
} else {
fail("Found an unexpected variable: '"+name+"'");
}
}
// complete ////////////////////////////////////////////////////////
close(superCaseInstanceId);
testRule.assertCaseEnded(superCaseInstanceId);
} | assertion on variables - change process definition
manual start on case not needed enaymore and therefore removed | testOutputSourceExpression | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | Apache-2.0 |
@Deployment(resources = {
"org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testVariablesRoundtrip.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCaseWithManualActivation.cmmn"
})
@Test
public void testVariablesRoundtrip() {
// given
VariableMap vars = new VariableMapImpl();
vars.putValue("aVariable", "xyz");
vars.putValue("anotherVariable", 123);
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE, vars).getId();
String subCaseInstanceId = queryOneTaskCaseInstance().getId();
caseService
.withCaseExecution(subCaseInstanceId)
.setVariable("aVariable", "abc")
.setVariable("anotherVariable", 999)
.execute();
String humanTaskId = queryCaseExecutionByActivityId("PI_HumanTask_1").getId();
caseService
.withCaseExecution(humanTaskId)
.manualStart();
caseService
.withCaseExecution(humanTaskId)
.complete();
// when
caseService
.withCaseExecution(subCaseInstanceId)
.close();
// then
List<VariableInstance> variables = runtimeService
.createVariableInstanceQuery()
.caseInstanceIdIn(superCaseInstanceId)
.list();
assertFalse(variables.isEmpty());
assertEquals(2, variables.size());
for (VariableInstance variable : variables) {
String name = variable.getName();
if ("aVariable".equals(name)) {
assertEquals("aVariable", name);
assertEquals("abc", variable.getValue());
} else if ("anotherVariable".equals(name)) {
assertEquals("anotherVariable", name);
assertEquals(999, variable.getValue());
} else {
fail("Found an unexpected variable: '"+name+"'");
}
}
// complete ////////////////////////////////////////////////////////
close(superCaseInstanceId);
testRule.assertCaseEnded(superCaseInstanceId);
} | assertion on variables - change subprocess definition | testVariablesRoundtrip | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | Apache-2.0 |
@Deployment(resources = {
"org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCase.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"
})
@Test
public void testCompleteCaseTask() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
try {
// when
caseService
.withCaseExecution(caseTaskId)
.complete();
fail("It should not be possible to complete a case task, while the case instance is active.");
} catch (NotAllowedException e) {}
// complete ////////////////////////////////////////////////////////
String subCaseInstanceId = queryOneTaskCaseInstance().getId();
terminate(subCaseInstanceId);
close(subCaseInstanceId);
testRule.assertCaseEnded(subCaseInstanceId);
terminate(caseTaskId);
close(superCaseInstanceId);
testRule.assertCaseEnded(superCaseInstanceId);
} | Default behaviour changed, so manual start is taken out | testCompleteCaseTask | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | Apache-2.0 |
@Deployment(resources = {
"org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCase.cmmn",
"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"
})
@Test
public void testTerminateSubCaseInstance() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
String subCaseInstanceId = queryOneTaskCaseInstance().getId();
// when
terminate(subCaseInstanceId);
// then
CmmnExecution subCaseInstance = (CmmnExecution) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
assertTrue(subCaseInstance.isTerminated());
CaseExecution caseTask = queryCaseExecutionByActivityId(CASE_TASK);
assertNotNull(caseTask);
assertTrue(caseTask.isActive());
// complete ////////////////////////////////////////////////////////
close(subCaseInstanceId);
testRule.assertCaseEnded(subCaseInstanceId);
terminate(caseTaskId);
close(superCaseInstanceId);
testRule.assertCaseEnded(superCaseInstanceId);
} | removed manual start as it is handled by default behaviour | testTerminateSubCaseInstance | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.java | Apache-2.0 |
@Test
public void testAcquiringEverLivingJobSucceeds() {
// given
jobExecutor.indicateOptimisticLockingException();
String jobId = historyService.cleanUpHistoryAsync(true).getId();
lockEverLivingJob(jobId);
cleanupThread = executeControllableCommand(new CleanupThread(jobId));
cleanupThread.waitForSync(); // wait before flush of execution
cleanupThread.makeContinueAndWaitForSync(); // flush execution and wait before flush of rescheduler
jobExecutor.start();
acquisitionThread.waitForSync();
acquisitionThread.makeContinueAndWaitForSync(); // wait before flush of acquisition
// when
cleanupThread.makeContinue(); // flush rescheduler
cleanupThread.join();
acquisitionThread.makeContinueAndWaitForSync(); // flush acquisition
Job job = managementService.createJobQuery().jobId(jobId).singleResult();
// then
assertThat(job.getDuedate()).isEqualTo(addSeconds(CURRENT_DATE, START_DELAY));
assertThat(jobExecutor.isOleThrown()).isFalse();
} | Problem
GIVEN
Within the Execution TX the job lock was removed
WHEN
1) the acquisition thread tries to lock the job
2) the cleanup scheduler reschedules the job
THEN
The acquisition fails due to an Optimistic Locking Exception | testAcquiringEverLivingJobSucceeds | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/concurrency/CompetingHistoryCleanupAcquisitionTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/concurrency/CompetingHistoryCleanupAcquisitionTest.java | Apache-2.0 |
@Deployment
@Test
public void testCompetingSuspension() {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("CompetingSuspensionProcess").singleResult();
ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId());
Execution execution = runtimeService
.createExecutionQuery()
.processInstanceId(processInstance.getId())
.activityId("wait1")
.singleResult();
SuspendProcessDefinitionThread suspensionThread = new SuspendProcessDefinitionThread(processDefinition.getId());
suspensionThread.startAndWaitUntilControlIsReturned();
SignalThread signalExecutionThread = new SignalThread(execution.getId());
signalExecutionThread.startAndWaitUntilControlIsReturned();
suspensionThread.proceedAndWaitTillDone();
assertNull(suspensionThread.exception);
signalExecutionThread.proceedAndWaitTillDone();
assertNotNull(signalExecutionThread.exception);
} | Ensures that suspending a process definition and its process instances will also increase the revision of the executions
such that concurrent updates fail with an OptimisticLockingException. | testCompetingSuspension | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/concurrency/CompetingSuspensionTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/concurrency/CompetingSuspensionTest.java | Apache-2.0 |
protected void startProcessAndCompleteUserTask() {
runtimeService.startProcessInstanceByKey("HistoryLevelTest");
Task task = taskService.createTaskQuery().singleResult();
taskService.complete(task.getId());
} | The helper method to execute the test task. | startProcessAndCompleteUserTask | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/history/AbstractCompositeHistoryEventHandlerTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/history/AbstractCompositeHistoryEventHandlerTest.java | Apache-2.0 |
private void createLogEntries() {
ClockUtil.setCurrentTime(yesterday);
// create a process with a userTask and work with it
process = runtimeService.startProcessInstanceByKey("oneTaskProcess");
execution = processEngine.getRuntimeService().createExecutionQuery().processInstanceId(process.getId()).singleResult();
processTaskId = taskService.createTaskQuery().singleResult().getId();
// user "icke" works on the process userTask
identityService.setAuthenticatedUserId("icke");
// create and remove some links
taskService.addCandidateUser(processTaskId, "er");
taskService.deleteCandidateUser(processTaskId, "er");
taskService.addCandidateGroup(processTaskId, "wir");
taskService.deleteCandidateGroup(processTaskId, "wir");
// assign and reassign the userTask
ClockUtil.setCurrentTime(today);
taskService.setOwner(processTaskId, "icke");
taskService.claim(processTaskId, "icke");
taskService.setAssignee(processTaskId, "er");
// change priority of task
taskService.setPriority(processTaskId, 10);
// add and delete an attachment
Attachment attachment = taskService.createAttachment("image/ico", processTaskId, process.getId(), "favicon.ico", "favicon", "http://camunda.com/favicon.ico");
taskService.deleteAttachment(attachment.getId());
// complete the userTask to finish the process
taskService.complete(processTaskId);
testRule.assertProcessEnded(process.getId());
// user "er" works on the process userTask
identityService.setAuthenticatedUserId("er");
// create a standalone userTask
userTask = taskService.newTask();
userTask.setName("to do");
taskService.saveTask(userTask);
// change some properties manually to create an update event
ClockUtil.setCurrentTime(tomorrow);
userTask.setDescription("desc");
userTask.setOwner("icke");
userTask.setAssignee("er");
userTask.setDueDate(new Date());
taskService.saveTask(userTask);
// complete the userTask
taskService.complete(userTask.getId());
} | start process and operate on userTask to create some log entries for the query tests | createLogEntries | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/history/useroperationlog/UserOperationLogQueryTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/history/useroperationlog/UserOperationLogQueryTest.java | Apache-2.0 |
public boolean isSyncAsSuspendEnabled() {
return syncAsSuspendEnabled;
} | <p>Creates the job executor and registers the given process engine
with it.
<p>Use this constructor if the process engine is not registered
with the job executor when the process engine is bootstrapped.
<p>Note: this is a hack since it enables to use multiple job executors with
the same engine which is not a supported feature (and for example clashes with
processEngineConfiguration#getJobExecutor) | isSyncAsSuspendEnabled | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/jobexecutor/ControllableJobExecutor.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/jobexecutor/ControllableJobExecutor.java | Apache-2.0 |
public static void suspendInstances(ProcessEngine processEngine, int numInstances) {
List<ProcessInstance> instancesToSuspend = processEngine.getRuntimeService().createProcessInstanceQuery()
.active().listPage(0, numInstances);
if (instancesToSuspend.size() < numInstances) {
throw new ProcessEngineException("Cannot suspend " + numInstances + " process instances");
}
for (ProcessInstance activeInstance : instancesToSuspend) {
processEngine.getRuntimeService().suspendProcessInstanceById(activeInstance.getId());
}
} | suspends random process instances that are active | suspendInstances | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/jobexecutor/JobAcquisitionTestHelper.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/jobexecutor/JobAcquisitionTestHelper.java | Apache-2.0 |
public static TestMdcFacade empty() {
return new TestMdcFacade();
} | Class that encapsulates the creation of MDC properties such as Logging Context Parameters or any other third party
property that might be requested by the test.
<p>
It also provides useful cleanup and assertion methods for test cases. | empty | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/logging/TestMdcFacade.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/logging/TestMdcFacade.java | Apache-2.0 |
public static TestMdcFacade defaultLoggingContextParameters(String activityId,
String activityName,
String applicationName,
String businessKey,
String processDefinitionId,
String processDefinitionKey,
String processInstanceId,
String tenantId,
String engineName) {
return new TestMdcFacade().withDefaultLoggingContextParameters(
activityId,
activityName,
applicationName,
businessKey,
processDefinitionId,
processDefinitionKey,
processInstanceId,
tenantId,
engineName
);
} | Creates a new Test MDC Facade to populate the MDC with all the Default Logging Context Parameters. | defaultLoggingContextParameters | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/logging/TestMdcFacade.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/logging/TestMdcFacade.java | Apache-2.0 |
public TestMdcFacade withDefaultLoggingContextParameters(String activityId,
String activityName,
String applicationName,
String businessKey,
String processDefinitionId,
String processDefinitionKey,
String processInstanceId,
String tenantId,
String engineName) {
Map<String, String> result = new HashMap<>();
result.put("activityId", activityId);
result.put("activityName", activityName);
result.put("applicationName", applicationName);
result.put("businessKey", businessKey);
result.put("processDefinitionId", processDefinitionId);
result.put("processDefinitionKey", processDefinitionKey);
result.put("processInstanceId", processInstanceId);
result.put("tenantId", tenantId);
result.put("engineName", engineName);
return withMDCProperties(result);
} | Constructor using the default Logging Context Parameter values. | withDefaultLoggingContextParameters | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/logging/TestMdcFacade.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/logging/TestMdcFacade.java | Apache-2.0 |
public TestMdcFacade withMDCProperties(Map<String, String> keyValuePairs) {
this.keyValuePairs.putAll(keyValuePairs);
this.keyValuePairs.forEach(MdcAccess::put);
return this;
} | Populate the MDC with custom key value pairs
@param keyValuePairs value pairs that are to be inserted in the MDC that represent MDC Property pairs. | withMDCProperties | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/logging/TestMdcFacade.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/logging/TestMdcFacade.java | Apache-2.0 |
public TestMdcFacade withMDCProperty(String key, String value) {
keyValuePairs.put(key, value);
MdcAccess.put(key, value);
return this;
} | Inserts an additional property outside the context of Logging Context Parameters.
@param key the key of the property
@param value the value of the property | withMDCProperty | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/logging/TestMdcFacade.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/logging/TestMdcFacade.java | Apache-2.0 |
public void clear() {
this.keyValuePairs.forEach((k, v) -> MdcAccess.remove(k));
} | Clears any property that was inserted in the MDC. | clear | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/logging/TestMdcFacade.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/logging/TestMdcFacade.java | Apache-2.0 |
public void assertAllInsertedPropertiesAreInMdc() {
this.keyValuePairs.forEach((k, v) -> {
assertThat(MdcAccess.get(k)).isNotNull();
});
} | Asserts all test inserted properties in the MDC are still there. | assertAllInsertedPropertiesAreInMdc | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/logging/TestMdcFacade.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/logging/TestMdcFacade.java | Apache-2.0 |
@Test
public void testEmbeddedSubProcess() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder()
.createActivity("start")
.initial()
.behavior(new Automatic())
.transition("embeddedsubprocess")
.endActivity()
.createActivity("embeddedsubprocess")
.scope()
.behavior(new EmbeddedSubProcess())
.createActivity("startInside")
.behavior(new Automatic())
.transition("endInside")
.endActivity()
.createActivity("endInside")
.behavior(new End())
.endActivity()
.transition("end")
.endActivity()
.createActivity("end")
.behavior(new WaitState())
.endActivity()
.buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
List<String> expectedActiveActivityIds = new ArrayList<String>();
expectedActiveActivityIds.add("end");
assertEquals(expectedActiveActivityIds, processInstance.findActiveActivityIds());
} | +------------------------------+
| embedded subprocess |
+-----+ | +-----------+ +---------+ | +---+
|start|-->| |startInside|-->|endInside| |-->|end|
+-----+ | +-----------+ +---------+ | +---+
+------------------------------+ | testEmbeddedSubProcess | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/standalone/pvm/PvmEmbeddedSubProcessTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/standalone/pvm/PvmEmbeddedSubProcessTest.java | Apache-2.0 |
@Test
public void testActivityEndDestroysEventScopes() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder()
.createActivity("start")
.initial()
.behavior(new Automatic())
.transition("embeddedsubprocess")
.endActivity()
.createActivity("embeddedsubprocess")
.scope()
.behavior(new EventScopeCreatingSubprocess())
.createActivity("startInside")
.behavior(new Automatic())
.transition("endInside")
.endActivity()
.createActivity("endInside")
.behavior(new Automatic())
.endActivity()
.transition("wait")
.endActivity()
.createActivity("wait")
.behavior(new WaitState())
.transition("end")
.endActivity()
.createActivity("end")
.behavior(new Automatic())
.endActivity()
.buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
boolean eventScopeFound = false;
List<ExecutionImpl> executions = ((ExecutionImpl)processInstance).getExecutions();
for (ExecutionImpl executionImpl : executions) {
if(executionImpl.isEventScope()) {
eventScopeFound = true;
break;
}
}
assertTrue(eventScopeFound);
processInstance.signal(null, null);
assertTrue(processInstance.isEnded());
} | create evt scope --+
|
v
+------------------------------+
| embedded subprocess |
+-----+ | +-----------+ +---------+ | +----+ +---+
|start|-->| |startInside|-->|endInside| |-->|wait|-->|end|
+-----+ | +-----------+ +---------+ | +----+ +---+
+------------------------------+
^
|
destroy evt scope --+ | testActivityEndDestroysEventScopes | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/standalone/pvm/PvmEventScopesTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/standalone/pvm/PvmEventScopesTest.java | Apache-2.0 |
@Test
public void testTransitionDestroysEventScope() {
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder()
.createActivity("start")
.initial()
.behavior(new Automatic())
.transition("embeddedsubprocess")
.endActivity()
.createActivity("embeddedsubprocess")
.scope()
.behavior(new EmbeddedSubProcess())
.createActivity("startInside")
.behavior(new Automatic())
.transition("nestedSubProcess")
.endActivity()
.createActivity("nestedSubProcess")
.scope()
.behavior(new EventScopeCreatingSubprocess())
.createActivity("startNestedInside")
.behavior(new Automatic())
.endActivity()
.transition("wait")
.endActivity()
.createActivity("wait")
.behavior(new WaitState())
.transition("endInside")
.endActivity()
.createActivity("endInside")
.behavior(new Automatic())
.endActivity()
.transition("end")
.endActivity()
.createActivity("end")
.behavior(new Automatic())
.endActivity()
.buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
List<String> expectedActiveActivityIds = new ArrayList<String>();
expectedActiveActivityIds.add("wait");
assertEquals(expectedActiveActivityIds, processInstance.findActiveActivityIds());
PvmExecution execution = processInstance.findExecution("wait");
execution.signal(null, null);
assertTrue(processInstance.isEnded());
} | +----------------------------------------------------------------------+
| embedded subprocess |
| |
| create evt scope --+ |
| | |
| v |
| |
| +--------------------------------+ |
| | nested embedded subprocess | |
+-----+ | +-----------+ | +-----------------+ | +----+ +---+ | +---+
|start|-->| |startInside|--> | |startNestedInside| |-->|wait|-->|end| |-->|end|
+-----+ | +-----------+ | +-----------------+ | +----+ +---+ | +---+
| +--------------------------------+ |
| |
+----------------------------------------------------------------------+
^
|
destroy evt scope --+ | testTransitionDestroysEventScope | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/standalone/pvm/PvmEventScopesTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/standalone/pvm/PvmEventScopesTest.java | Apache-2.0 |
@Test
@Deployment
public void ruleUsageExample() {
RuntimeService runtimeService = engineRule.getRuntimeService();
runtimeService.startProcessInstanceByKey("ruleUsage");
TaskService taskService = engineRule.getTaskService();
Task task = taskService.createTaskQuery().singleResult();
assertEquals("My Task", task.getName());
taskService.complete(task.getId());
assertEquals(0, runtimeService.createProcessInstanceQuery().count());
} | Test runners follow the this rule:
- if the class extends Testcase, run as Junit 3
- otherwise use Junit 4
So this test can be included in the regular test suite without problems.
@author Joram Barrez | ruleUsageExample | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/standalone/testing/ProcessEngineRuleJunit4Test.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/standalone/testing/ProcessEngineRuleJunit4Test.java | Apache-2.0 |
@Test
public void requiredHistoryLevelOnSuperClass() {
assertThat(currentHistoryLevel()).isIn(ProcessEngineConfiguration.HISTORY_AUDIT, ProcessEngineConfiguration.HISTORY_FULL);
} | Checks if the test is ignored than the current history level is lower than
the required history level which is specified on the super class. | requiredHistoryLevelOnSuperClass | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/standalone/testing/ProcessEngineRuleRequiredHistoryLevelSuperClassTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/standalone/testing/ProcessEngineRuleRequiredHistoryLevelSuperClassTest.java | Apache-2.0 |
@Deployment
@Test
public void testVariableNamesScope() {
// After starting the process, the task in the subprocess should be active
Map<String, Object> varMap = new HashMap<String, Object>();
varMap.put("test", "test");
varMap.put("helloWorld", "helloWorld");
ProcessInstance pi = runtimeService.startProcessInstanceByKey("simpleSubProcess", varMap);
Task subProcessTask = taskService.createTaskQuery()
.processInstanceId(pi.getId())
.singleResult();
runtimeService.setVariableLocal(pi.getProcessInstanceId(), "mainProcessLocalVariable", "Hello World");
assertEquals("Task in subprocess", subProcessTask.getName());
runtimeService.setVariableLocal(subProcessTask.getExecutionId(), "subProcessLocalVariable", "Hello SubProcess");
// Returns a set of local variablenames of pi
List<String> result = processEngineConfiguration.
getCommandExecutorTxRequired().
execute(new GetVariableNamesCommand(pi.getProcessInstanceId(), true));
// pi contains local the variablenames "test", "helloWorld" and "mainProcessLocalVariable" but not "subProcessLocalVariable"
assertTrue(result.contains("test"));
assertTrue(result.contains("helloWorld"));
assertTrue(result.contains("mainProcessLocalVariable"));
assertFalse(result.contains("subProcessLocalVariable"));
// Returns a set of global variablenames of pi
result = processEngineConfiguration.
getCommandExecutorTxRequired().
execute(new GetVariableNamesCommand(pi.getProcessInstanceId(), false));
// pi contains global the variablenames "test", "helloWorld" and "mainProcessLocalVariable" but not "subProcessLocalVariable"
assertTrue(result.contains("test"));
assertTrue(result.contains("mainProcessLocalVariable"));
assertTrue(result.contains("helloWorld"));
assertFalse(result.contains("subProcessLocalVariable"));
// Returns a set of local variablenames of subProcessTask execution
result = processEngineConfiguration.
getCommandExecutorTxRequired().
execute(new GetVariableNamesCommand(subProcessTask.getExecutionId(), true));
// subProcessTask execution contains local the variablenames "test", "subProcessLocalVariable" but not "helloWorld" and "mainProcessLocalVariable"
assertTrue(result.contains("test")); // the variable "test" was set locally by SetLocalVariableTask
assertTrue(result.contains("subProcessLocalVariable"));
assertFalse(result.contains("helloWorld"));
assertFalse(result.contains("mainProcessLocalVariable"));
// Returns a set of global variablenames of subProcessTask execution
result = processEngineConfiguration.
getCommandExecutorTxRequired().
execute(new GetVariableNamesCommand(subProcessTask.getExecutionId(), false));
// subProcessTask execution contains global all defined variablenames
assertTrue(result.contains("test")); // the variable "test" was set locally by SetLocalVariableTask
assertTrue(result.contains("subProcessLocalVariable"));
assertTrue(result.contains("helloWorld"));
assertTrue(result.contains("mainProcessLocalVariable"));
taskService.complete(subProcessTask.getId());
} | A testcase to produce and fix issue ACT-862. | testVariableNamesScope | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/standalone/variablescope/VariableScopeTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/standalone/variablescope/VariableScopeTest.java | Apache-2.0 |
public List<String> execute(CommandContext commandContext) {
ensureNotNull("executionId", executionId);
ExecutionEntity execution = commandContext
.getExecutionManager()
.findExecutionById(executionId);
ensureNotNull("execution " + executionId + " doesn't exist", "execution", execution);
List<String> executionVariables;
if (isLocal) {
executionVariables = new ArrayList<String>(execution.getVariableNamesLocal());
} else {
executionVariables = new ArrayList<String>(execution.getVariableNames());
}
return executionVariables;
} | A command to get the names of the variables
@author Roman Smirnov
@author Christian Lipphardt | execute | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/standalone/variablescope/VariableScopeTest.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/standalone/variablescope/VariableScopeTest.java | Apache-2.0 |
public static void assertEqualsSecondPrecision(Date expected, Date actual) {
Assert.assertEquals("expected " + expected + " but got " + actual,
expected.getTime() / 1000L, actual.getTime() / 1000L);
} | Drop milliseconds since older MySQL versions cannot store them | assertEqualsSecondPrecision | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/util/AssertUtil.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/util/AssertUtil.java | Apache-2.0 |
public static Date incrementClock(long seconds) {
long time = ClockUtil.getCurrentTime().getTime();
ClockUtil.setCurrentTime(new Date(time + seconds * 1000));
return ClockUtil.getCurrentTime();
} | Increments the current time by the given seconds.
@param seconds the seconds to add to the clock
@return the new current time | incrementClock | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/util/ClockTestUtil.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/util/ClockTestUtil.java | Apache-2.0 |
public static Date setClockToDateWithoutMilliseconds() {
ClockUtil.setCurrentTime(new GregorianCalendar(2023, Calendar.AUGUST, 18, 8, 0, 0).getTime());
return ClockUtil.getCurrentTime();
} | Sets the clock to a date without milliseconds. Older mysql
versions do not support milliseconds. Test which test timestamp
should avoid timestamps with milliseconds.
@return the new current time | setClockToDateWithoutMilliseconds | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/util/ClockTestUtil.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/util/ClockTestUtil.java | Apache-2.0 |
public static void waitForJobExecutorToProcessAllJobs(long maxMillisToWait,
long intervalMillis,
JobExecutor jobExecutor,
ManagementService managementService,
boolean shutdown) {
try {
waitForCondition(maxMillisToWait, intervalMillis, () -> !areJobsAvailable(managementService));
} finally {
if (shutdown) {
jobExecutor.shutdown();
}
}
} | Wait on the given job executor until it finishes with all jobs processing.
@param maxMillisToWait the max time (ms) to wait before throwing an exception
@param intervalMillis the internal (ms) time to use for checking the job processing state periodically
@param jobExecutor the job executor to use
@param managementService the management service to use for query purposes
@param shutdown if true, the job executor will be shutdown at the end of this function | waitForJobExecutorToProcessAllJobs | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/util/JobExecutorWaitUtils.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/util/JobExecutorWaitUtils.java | Apache-2.0 |
public static MethodInvocation of(Object object, String methodName, Object[] args) {
Method method = getMethodByName(object, methodName, args);
return new MethodInvocation(object, method, args);
} | Static factory method using a method name and arguments.
@param object The object on which to invoke the method
@param methodName Simple method name of the mtehod to invoke on the object
@param args the arguments passed to the method
@return the method invocation object | of | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/util/MethodInvocation.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/util/MethodInvocation.java | Apache-2.0 |
public static MethodInvocation of(Object object, String methodName) {
Method method = getMethodByName(object, methodName, null);
return new MethodInvocation(object, method, null);
} | Static factory method for creating a method.
@param object The object on which to invoke a method.
@param methodName simple method name of the method to invoke on the object.
@return the method invocation object | of | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/util/MethodInvocation.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/util/MethodInvocation.java | Apache-2.0 |
public void remove(Class<?> clazz) throws EntityRemoveException {
Objects.requireNonNull(clazz, "remove does not accept null arguments");
ThrowingRunnable runnable = mappings.get(clazz);
if (runnable == null) {
throw new UnsupportedOperationException("class " + clazz.getName() + " is not supported yet for Removal");
}
if (!isInitialized()) {
throw new EntityRemoveException("Removable is not initialized");
}
try {
runnable.execute();
} catch (Exception e) {
throw new EntityRemoveException(e);
}
} | Removes the associated mapped entities from the db for the given class.
@param clazz the given class to delete associated entities for
@throws EntityRemoveException in case anything fails during the process of deletion | remove | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/util/Removable.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/util/Removable.java | Apache-2.0 |
public void remove(Class<?>[] classes) throws EntityRemoveException {
Objects.requireNonNull(classes, "remove does not accept null arguments");
for (Class<?> clazz : classes) {
remove(clazz);
}
} | Removes the associated mapped entities from the db for the given classes.
@param classes the given classes to delete associated entities for
@throws EntityRemoveException in case anything fails during the process of deletion for any of the classes | remove | java | camunda/camunda-bpm-platform | engine/src/test/java/org/camunda/bpm/engine/test/util/Removable.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/util/Removable.java | Apache-2.0 |
public void associateExecutionById(String executionId) {
Execution execution = processEngine.getRuntimeService()
.createExecutionQuery()
.executionId(executionId)
.singleResult();
if(execution == null) {
throw new ProcessEngineCdiException("Cannot associate execution by id: no execution with id '"+executionId+"' found.");
}
associationManager.setExecution(execution);
} | Associate with the provided execution. This starts a unit of work.
@param executionId
the id of the execution to associate with.
@throw ProcessEngineCdiException
if no such execution exists | associateExecutionById | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public boolean isAssociated() {
return associationManager.getExecutionId() != null;
} | returns true if an {@link Execution} is associated.
@see #associateExecutionById(String) | isAssociated | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public void signalExecution() {
assertExecutionAssociated();
processEngine.getRuntimeService().setVariablesLocal(associationManager.getExecutionId(), getAndClearCachedLocalVariableMap());
processEngine.getRuntimeService().signal(associationManager.getExecutionId(), getAndClearCachedVariableMap());
associationManager.disAssociate();
} | Signals the current execution, see {@link RuntimeService#signal(String)}
<p/>
Ends the current unit of work (flushes changes to process variables set
using {@link #setVariable(String, Object)} or made on
{@link BusinessProcessScoped @BusinessProcessScoped} beans).
@throws ProcessEngineCdiException
if no execution is currently associated
@throws ProcessEngineException
if the activiti command fails | signalExecution | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public void signalExecution(boolean endConversation) {
signalExecution();
if(endConversation) {
conversationInstance.get().end();
}
} | @see #signalExecution()
In addition, this method allows to end the current conversation | signalExecution | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public Task startTask(String taskId) {
Task currentTask = associationManager.getTask();
if(currentTask != null && currentTask.getId().equals(taskId)) {
return currentTask;
}
Task task = processEngine.getTaskService().createTaskQuery().taskId(taskId).singleResult();
if(task == null) {
throw new ProcessEngineCdiException("Cannot resume task with id '"+taskId+"', no such task.");
}
associationManager.setTask(task);
associateExecutionById(task.getExecutionId());
return task;
} | Associates the task with the provided taskId with the current conversation.
<p/>
@param taskId
the id of the task
@return the resumed task
@throws ProcessEngineCdiException
if no such task is found | startTask | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public Task startTask(String taskId, boolean beginConversation) {
if(beginConversation) {
Conversation conversation = conversationInstance.get();
if(conversation.isTransient()) {
conversation.begin();
}
}
return startTask(taskId);
} | @see #startTask(String)
this method allows to start a conversation if no conversation is active | startTask | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public void completeTask() {
assertTaskAssociated();
processEngine.getTaskService().setVariablesLocal(getTask().getId(), getAndClearCachedLocalVariableMap());
processEngine.getTaskService().setVariables(getTask().getId(), getAndClearCachedVariableMap());
processEngine.getTaskService().complete(getTask().getId());
associationManager.disAssociate();
} | Completes the current UserTask, see {@link TaskService#complete(String)}
<p/>
Ends the current unit of work (flushes changes to process variables set
using {@link #setVariable(String, Object)} or made on
{@link BusinessProcessScoped @BusinessProcessScoped} beans).
@throws ProcessEngineCdiException
if no task is currently associated
@throws ProcessEngineException
if the activiti command fails | completeTask | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public void saveTask() {
assertCommandContextNotActive();
assertTaskAssociated();
final Task task = getTask();
// save the task
processEngine.getTaskService().saveTask(task);
} | Save the currently associated task.
@throws ProcessEngineCdiException if called from a process engine command or if no Task is currently associated. | saveTask | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public void stopTask() {
assertCommandContextNotActive();
assertTaskAssociated();
associationManager.disAssociate();
} | <p>Stop working on a task. Clears the current association.</p>
<p>NOTE: this method does not flush any changes.</p>
<ul>
<li>If you want to flush changes to process variables, call {@link #flushVariableCache()} prior to calling this method,</li>
<li>If you need to flush changes to the task object, use {@link #saveTask()} prior to calling this method.</li>
</ul>
@throws ProcessEngineCdiException if called from a process engine command or if no Task is currently associated. | stopTask | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public void stopTask(boolean endConversation) {
stopTask();
if(endConversation) {
conversationInstance.get().end();
}
} | <p>Stop working on a task. Clears the current association.</p>
<p>NOTE: this method does not flush any changes.</p>
<ul>
<li>If you want to flush changes to process variables, call {@link #flushVariableCache()} prior to calling this method,</li>
<li>If you need to flush changes to the task object, use {@link #saveTask()} prior to calling this method.</li>
</ul>
<p>This method allows you to optionally end the current conversation</p>
@param endConversation if true, end current conversation.
@throws ProcessEngineCdiException if called from a process engine command or if no Task is currently associated. | stopTask | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
@SuppressWarnings("unchecked")
public <T> T getVariable(String variableName) {
TypedValue variable = getVariableTyped(variableName);
if (variable != null) {
Object value = variable.getValue();
if (value != null) {
return (T) value;
}
}
return null;
} | @param variableName
the name of the process variable for which the value is to be
retrieved
@return the value of the provided process variable or 'null' if no such
variable is set | getVariable | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
@SuppressWarnings("unchecked")
public <T extends TypedValue> T getVariableTyped(String variableName) {
TypedValue variable = associationManager.getVariable(variableName);
return variable != null ? (T) (variable) : null;
} | @param variableName
the name of the process variable for which the value is to be
retrieved
@return the typed value of the provided process variable or 'null' if no
such variable is set
@since 7.3 | getVariableTyped | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public void setVariable(String variableName, Object value) {
associationManager.setVariable(variableName, value);
} | Set a value for a process variable.
<p />
<strong>NOTE:</strong> If no execution is currently associated,
the value is temporarily cached and flushed to the process instance
at the end of the unit of work
@param variableName
the name of the process variable for which a value is to be set
@param value
the value to be set | setVariable | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public VariableMap getAndClearCachedVariableMap() {
VariableMap cachedVariables = associationManager.getCachedVariables();
VariableMap copy = new VariableMapImpl(cachedVariables);
cachedVariables.clear();
return copy;
} | Get the {@link VariableMap} of cached variables and clear the internal variable cache.
@return the {@link VariableMap} of cached variables
@since 7.3 | getAndClearCachedVariableMap | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
@Deprecated
public Map<String, Object> getAndClearVariableCache() {
return getAndClearCachedVariableMap();
} | Get the map of cached variables and clear the internal variable cache.
@return the map of cached variables
@deprecated use {@link #getAndClearCachedVariableMap()} instead | getAndClearVariableCache | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public VariableMap getCachedVariableMap() {
return new VariableMapImpl(associationManager.getCachedVariables());
} | Get a copy of the {@link VariableMap} of cached variables.
@return a copy of the {@link VariableMap} of cached variables.
@since 7.3 | getCachedVariableMap | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
@Deprecated
public Map<String, Object> getVariableCache() {
return getCachedVariableMap();
} | Get a copy of the map of cached variables.
@return a copy of the map of cached variables.
@deprecated use {@link #getCachedVariableMap()} instead | getVariableCache | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
@SuppressWarnings("unchecked")
public <T> T getVariableLocal(String variableName) {
TypedValue variable = getVariableLocalTyped(variableName);
if (variable != null) {
Object value = variable.getValue();
if (value != null) {
return (T) value;
}
}
return null;
} | @param variableName
the name of the local process variable for which the value is to be
retrieved
@return the value of the provided local process variable or 'null' if no such
variable is set | getVariableLocal | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
@SuppressWarnings("unchecked")
public <T extends TypedValue> T getVariableLocalTyped(String variableName) {
TypedValue variable = associationManager.getVariableLocal(variableName);
return variable != null ? (T) variable : null;
} | @param variableName
the name of the local process variable for which the value is to
be retrieved
@return the typed value of the provided local process variable or 'null' if
no such variable is set
@since 7.3 | getVariableLocalTyped | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public void setVariableLocal(String variableName, Object value) {
associationManager.setVariableLocal(variableName, value);
} | Set a value for a local process variable.
<p />
<strong>NOTE:</strong> If a task or execution is currently associated,
the value is temporarily cached and flushed to the process instance
at the end of the unit of work - otherwise an Exception will be thrown
@param variableName
the name of the local process variable for which a value is to be set
@param value
the value to be set | setVariableLocal | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public VariableMap getAndClearCachedLocalVariableMap() {
VariableMap cachedVariablesLocal = associationManager.getCachedLocalVariables();
VariableMap copy = new VariableMapImpl(cachedVariablesLocal);
cachedVariablesLocal.clear();
return copy;
} | Get the {@link VariableMap} of local cached variables and clear the internal variable cache.
@return the {@link VariableMap} of cached variables
@since 7.3 | getAndClearCachedLocalVariableMap | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
@Deprecated
public Map<String, Object> getAndClearVariableLocalCache() {
return getAndClearCachedLocalVariableMap();
} | Get the map of local cached variables and clear the internal variable cache.
@return the map of cached variables
@deprecated use {@link #getAndClearCachedLocalVariableMap()} instead | getAndClearVariableLocalCache | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public VariableMap getCachedLocalVariableMap() {
return new VariableMapImpl(associationManager.getCachedLocalVariables());
} | Get a copy of the {@link VariableMap} of local cached variables.
@return a copy of the {@link VariableMap} of local cached variables.
@since 7.3 | getCachedLocalVariableMap | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
@Deprecated
public Map<String, Object> getVariableLocalCache() {
return getCachedLocalVariableMap();
} | Get a copy of the map of local cached variables.
@return a copy of the map of local cached variables.
@deprecated use {@link #getCachedLocalVariableMap()} instead | getVariableLocalCache | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public String getTaskId() {
Task task = getTask();
return task != null ? task.getId() : null;
} | Returns the id of the task associated with the current conversation or 'null'. | getTaskId | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public Task getTask() {
return associationManager.getTask();
} | Returns the currently associated {@link Task} or 'null'
@throws ProcessEngineCdiException
if no {@link Task} is associated. Use {@link #isTaskAssociated()}
to check whether an association exists. | getTask | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
public Execution getExecution() {
return associationManager.getExecution();
} | Returns the currently associated execution or 'null' | getExecution | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | Apache-2.0 |
@Override
protected ELResolver createElResolver() {
CompositeELResolver compositeElResolver = new CompositeELResolver();
compositeElResolver.add(new VariableScopeElResolver());
compositeElResolver.add(new VariableContextElResolver());
compositeElResolver.add(new CdiResolver());
compositeElResolver.add(new ArrayELResolver());
compositeElResolver.add(new ListELResolver());
compositeElResolver.add(new MapELResolver());
compositeElResolver.add(new BeanELResolver());
return compositeElResolver;
} | {@link ExpressionManager} for resolving Cdi-managed beans.
This {@link ExpressionManager} implementation performs lazy lookup of the
Cdi-BeanManager and can thus be configured using the spring-based
configuration of the process engine:
<pre>
<property name="expressionManager">
<bean class="org.camunda.bpm.engine.test.cdi.CdiExpressionManager" />
</property>
</pre>
@author Daniel Meyer | createElResolver | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/CdiExpressionManager.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/CdiExpressionManager.java | Apache-2.0 |
@Produces
@Named
@Typed(ProcessInstance.class)
public ProcessInstance getProcessInstance() {
return businessProcess.getProcessInstance();
} | Returns the {@link ProcessInstance} currently associated or 'null'
@throws ProcessEngineCdiException
if no {@link Execution} is associated. Use
{@link BusinessProcess#isAssociated()} to check whether an
association exists. | getProcessInstance | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/CurrentProcessInstance.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/CurrentProcessInstance.java | Apache-2.0 |
@Produces
@Named
public Execution getExecution() {
return businessProcess.getExecution();
} | Returns the currently associated execution or 'null' | getExecution | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/CurrentProcessInstance.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/CurrentProcessInstance.java | Apache-2.0 |
@Produces
@Named
public Task getTask() {
return businessProcess.getTask();
} | Returns the currently associated {@link Task} or 'null'
@throws ProcessEngineCdiException
if no {@link Task} is associated. Use
{@link BusinessProcess#isTaskAssociated()} to check whether an
association exists. | getTask | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/CurrentProcessInstance.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/CurrentProcessInstance.java | Apache-2.0 |
@Produces
@Named
@TaskId
public String getTaskId() {
return businessProcess.getTaskId();
} | Returns the id of the task associated with the current conversation or
'null'. | getTaskId | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/CurrentProcessInstance.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/CurrentProcessInstance.java | Apache-2.0 |
@Produces @ProcessEngineName("")
public ProcessEngine processEngine(InjectionPoint ip) {
ProcessEngineName annotation = ip.getAnnotated().getAnnotation(ProcessEngineName.class);
String processEngineName = annotation.value();
if(processEngineName == null || processEngineName.length() == 0) {
throw new ProcessEngineException("Cannot determine which process engine to inject: @ProcessEngineName must specify the name of a process engine.");
}
try {
ProcessEngineService processEngineService = BpmPlatform.getProcessEngineService();
return processEngineService.getProcessEngine(processEngineName);
}catch (Exception e) {
throw new ProcessEngineException("Cannot find process engine named '"+processEngineName+"' specified using @ProcessEngineName: "+e.getMessage(), e);
}
} | This bean provides producers for the process engine services such
that the injection point can choose the process engine it wants to
inject by its name:
@Inject
@ProcessEngineName("second-engine")
private RuntimeService runtimeService;
@author Daniel Meyer | processEngine | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/impl/NamedProcessEngineServicesProducer.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/impl/NamedProcessEngineServicesProducer.java | Apache-2.0 |
@Produces
@Named
@ApplicationScoped
public ProcessEngine processEngine() {
ProcessEngine processEngine = BpmPlatform.getProcessEngineService().getDefaultProcessEngine();
if(processEngine != null) {
return processEngine;
} else {
List<ProcessEngine> processEngines = BpmPlatform.getProcessEngineService().getProcessEngines();
if (processEngines != null && processEngines.size() == 1) {
return processEngines.get(0);
} else {
return ProcessEngines.getDefaultProcessEngine(false);
}
}
} | Makes the managed process engine and the provided services available for injection
@author Daniel Meyer
@author Falko Menge | processEngine | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/impl/ProcessEngineServicesProducer.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/impl/ProcessEngineServicesProducer.java | Apache-2.0 |
@Produces
@Named
@BusinessKey
public String businessKey(ProcessInstance processInstance) {
return processInstance.getBusinessKey();
} | Producer for the current business key.
@author Daniel Meyer | businessKey | java | camunda/camunda-bpm-platform | engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/impl/annotation/BusinessKeyProducer.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/core/src/main/java/org/camunda/bpm/engine/cdi/impl/annotation/BusinessKeyProducer.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.