use of org.camunda.bpm.engine.runtime.ExecutionQuery in project camunda-bpm-platform by camunda.
the class ExecutionQueryTest method testQueryByInvalidActivityId.
public void testQueryByInvalidActivityId() {
ExecutionQuery query = runtimeService.createExecutionQuery().activityId("invalid");
assertNull(query.singleResult());
assertEquals(0, query.list().size());
assertEquals(0, query.count());
}
use of org.camunda.bpm.engine.runtime.ExecutionQuery in project camunda-bpm-platform by camunda.
the class SignalEventExpressionNameTest method testSignalStartEventInEventSubProcess.
@Deployment
public void testSignalStartEventInEventSubProcess() {
// given
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("signalStartEventInEventSubProcess");
// check if execution exists
ExecutionQuery executionQuery = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId());
assertEquals(1, executionQuery.count());
// check if user task exists
TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(processInstance.getId());
assertEquals(1, taskQuery.count());
// when
runtimeService.signalEventReceived("alert-foo");
// then
assertEquals(true, DummyServiceTask.wasExecuted);
// check if user task doesn't exist because signal start event is interrupting
taskQuery = taskService.createTaskQuery().processInstanceId(processInstance.getId());
assertEquals(0, taskQuery.count());
// check if execution doesn't exist because signal start event is interrupting
executionQuery = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId());
assertEquals(0, executionQuery.count());
}
use of org.camunda.bpm.engine.runtime.ExecutionQuery in project camunda-bpm-platform by camunda.
the class SignalEventTest method testNonInterruptingSignalStartEventInEventSubProcess.
@Deployment
@Test
public void testNonInterruptingSignalStartEventInEventSubProcess() {
// start process instance
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("nonInterruptingSignalStartEventInEventSubProcess");
// check if execution exists
ExecutionQuery executionQuery = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId());
assertEquals(1, executionQuery.count());
// check if user task exists
TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(processInstance.getId());
assertEquals(1, taskQuery.count());
// send non interrupting signal to event sub process
runtimeService.signalEventReceived("alert");
assertEquals(true, DummyServiceTask.wasExecuted);
// check if user task still exists because signal start event is non interrupting
taskQuery = taskService.createTaskQuery().processInstanceId(processInstance.getId());
assertEquals(1, taskQuery.count());
// check if execution still exists because signal start event is non interrupting
executionQuery = runtimeService.createExecutionQuery().processInstanceId(processInstance.getId());
assertEquals(1, executionQuery.count());
}
use of org.camunda.bpm.engine.runtime.ExecutionQuery in project camunda-bpm-platform by camunda.
the class StartTimerEventTest method testStartTimerEventSubProcessInParallelMultiInstanceSubProcessWithInterruptingBoundaryTimerEvent.
/**
* test scenario: - start process instance with multiInstance parallel -
* execute interrupting timer job of event subprocess - execute interrupting
* timer boundary event of subprocess
*/
@Deployment
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());
assertProcessEnded(processInstance.getId());
}
use of org.camunda.bpm.engine.runtime.ExecutionQuery in project camunda-bpm-platform by camunda.
the class StartTimerEventTest method testStartTimerEventSubProcessInParallelMultiInstanceSubProcessWithNonInterruptingBoundaryTimerEvent.
/**
* test scenario: - start process instance with multiInstance parallel -
* execute interrupting timer job of event subprocess - execute non
* interrupting timer boundary event of subprocess
*/
@Deployment
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());
}
Aggregations