Class BpmnAwareTests
- Direct Known Subclasses:
CmmnAwareTests
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ExternalTaskAssert
assertThat
(ExternalTask actual) Assert that...static ProcessDefinitionAssert
assertThat
(ProcessDefinition actual) Assert that...static JobAssert
assertThat
(Job actual) Assert that...static ProcessInstanceAssert
assertThat
(ProcessInstance actual) Assert that...static TaskAssert
assertThat
(Task actual) Assert that...static AuthorizationService
Helper method to easily access AuthorizationServicestatic ProcessInstance
Helper method to easily access the only called process instance currently available in the context of the last asserted process instance.static ProcessInstance
calledProcessInstance
(String processDefinitionKey) Helper method to easily access the only called process instance with the given processDefinitionKey currently available in the context of the last asserted process instance.static ProcessInstance
calledProcessInstance
(String processDefinitionKey, ProcessInstance processInstance) Helper method to easily access the only called process instance with the given processDefinitionKey currently available in the context of the given process instance.static ProcessInstance
calledProcessInstance
(ProcessInstance processInstance) Helper method to easily access the only called process instance currently available in the context of the given process instance.static ProcessInstance
calledProcessInstance
(ProcessInstanceQuery processInstanceQuery) Helper method to easily access the only called process instance compliant to a given processInstanceQuery and currently available in the context of the last asserted process instance.static ProcessInstance
calledProcessInstance
(ProcessInstanceQuery processInstanceQuery, ProcessInstance processInstance) Helper method to easily access the only called process instance compliant to a given processInstanceQuery and currently available in the context of the given process instance.static Task
Helper method to easily claim a task for a specific assignee.static void
complete
(ExternalTask externalTask) Helper method to easily fetch, lock and complete an external task.static void
complete
(ExternalTask externalTask, Map<String, Object> variables) Helper method to easily fetch, lock and complete an external task.static void
complete
(ExternalTask externalTask, Map<String, Object> variables, Map<String, Object> localVariables) Helper method to easily fetch, lock and complete an external task.static void
complete
(LockedExternalTask lockedExternalTask) Helper method to easily complete a locked external task.static void
complete
(LockedExternalTask lockedExternalTask, Map<String, Object> variables) Helper method to easily complete a locked external task.static void
complete
(LockedExternalTask lockedExternalTask, Map<String, Object> variables, Map<String, Object> localVariables) Helper method to easily complete a locked external task.static void
Helper method to easily complete a task.static void
Helper method to easily complete a task and pass some process variables.static DecisionService
Helper method to easily access DecisionServicestatic void
Helper method to easily execute a job.static ExecutionQuery
Helper method to easily create a new ExecutionQuerystatic ExternalTask
Helper method to easily access the only external task currently available in the context of the last asserted process instance.static ExternalTask
externalTask
(String activityId) Helper method to easily access the only external task with the given activityId currently available in the context of the last asserted process instance.static ExternalTask
externalTask
(String activityId, ProcessInstance processInstance) Helper method to easily access the only external task with the given activityId currently available in the context of the given process instance.static ExternalTask
externalTask
(ExternalTaskQuery externalTaskQuery) Helper method to easily access the only external task compliant to a given externalTaskQuery and currently available in the context of the last asserted process instance.static ExternalTask
externalTask
(ExternalTaskQuery externalTaskQuery, ProcessInstance processInstance) Helper method to easily access the only external task compliant to a given externalTaskQuery and currently available in the context of the given process instance.static ExternalTask
externalTask
(ProcessInstance processInstance) Helper method to easily access the only external task currently available in the context of the given process instance.static ExternalTaskQuery
Helper method to easily create a new ExternalTaskQuerystatic ExternalTaskService
Helper method to easily access ExternalTaskServicestatic List<LockedExternalTask>
fetchAndLock
(String topic, String workerId, int maxResults) Helper method to easily fetch and lock external tasks from a given topic using a given workerId.static String
Maps any element (task, event, gateway) from the name to the ID.static FormService
Helper method to easily access FormServicestatic HistoryService
Helper method to easily access HistoryServicestatic IdentityService
Helper method to easily access IdentityServicestatic Job
job()
Helper method to easily access the only job currently available in the context of the last asserted process instance.static Job
Helper method to easily access the only job with the given activityId currently available in the context of the last asserted process instance.static Job
job
(String activityId, ProcessInstance processInstance) Helper method to easily access the only job with the given activityId currently available in the context of the given process instance.static Job
Helper method to easily access the only job compliant to a given jobQuery and currently available in the context of the last asserted process instance.static Job
job
(JobQuery jobQuery, ProcessInstance processInstance) Helper method to easily access the only job compliant to a given jobQuery and currently available in the context of the given process instance.static Job
job
(ProcessInstance processInstance) Helper method to easily access the only job currently available in the context of the given process instance.static JobQuery
jobQuery()
Helper method to easily create a new JobQuerystatic ManagementService
Helper method to easily access ManagementServicestatic ProcessDefinition
Helper method to easily access the process definition on which the last asserted process instance is based.static ProcessDefinition
processDefinition
(String processDefinitionKey) Helper method to easily access the process definition with the given processDefinitionKey.static ProcessDefinition
processDefinition
(ProcessDefinitionQuery processDefinitionQuery) Helper method to easily access the process definition compliant to a given process definition query.static ProcessDefinition
processDefinition
(ProcessInstance processInstance) Helper method to easily access the process definition on which the given process instance is based.static ProcessDefinitionQuery
Helper method to easily create a new ProcessDefinitionQuerystatic ProcessInstanceQuery
Helper method to easily create a new ProcessInstanceQuerystatic RepositoryService
Helper method to easily access RepositoryServicestatic RuntimeService
Helper method to easily access RuntimeServicestatic Task
task()
Helper method to easily access the only task currently available in the context of the last asserted process instance.static Task
Helper method to easily access the only task with the given taskDefinitionKey currently available in the context of the last asserted process instance.static Task
task
(String taskDefinitionKey, ProcessInstance processInstance) Helper method to easily access the only task with the given taskDefinitionKey currently available in the context of the given process instance.static Task
task
(ProcessInstance processInstance) Helper method to easily access the only task currently available in the context of the given process instance.static Task
Helper method to easily access the only task compliant to a given taskQuery and currently available in the context of the last asserted process instance.static Task
task
(TaskQuery taskQuery, ProcessInstance processInstance) Helper method to easily access the only task compliant to a given taskQuery and currently available in the context of the given process instance.static TaskQuery
Helper method to easily create a new TaskQuerystatic TaskService
Helper method to easily access TaskServicestatic Task
Helper method to easily unclaim a task.withVariables
(String key, Object value, Object... furtherKeyValuePairs) Helper method to easily construct a map of process variablesMethods inherited from class org.camunda.bpm.engine.test.assertions.bpmn.AbstractAssertions
init, processEngine, reset
-
Field Details
-
DEFAULT_LOCK_DURATION_EXTERNAL_TASK
public static final long DEFAULT_LOCK_DURATION_EXTERNAL_TASK- See Also:
-
DEFAULT_WORKER_EXTERNAL_TASK
- See Also:
-
-
Constructor Details
-
BpmnAwareTests
protected BpmnAwareTests()
-
-
Method Details
-
assertThat
Assert that... the given ProcessDefinition meets your expectations.- Parameters:
actual
- ProcessDefinition under test- Returns:
- Assert object offering ProcessDefinition specific assertions.
-
assertThat
Assert that... the given ProcessInstance meets your expectations.- Parameters:
actual
- ProcessInstance under test- Returns:
- Assert object offering ProcessInstance specific assertions.
-
assertThat
Assert that... the given Task meets your expectations.- Parameters:
actual
- Task under test- Returns:
- Assert object offering Task specific assertions.
-
assertThat
Assert that... the given ExternalTask meets your expectations.- Parameters:
actual
- ExternalTask under test- Returns:
- Assert object offering Task specific assertions.
-
assertThat
Assert that... the given Job meets your expectations.- Parameters:
actual
- Job under test- Returns:
- Assert object offering Job specific assertions.
-
runtimeService
Helper method to easily access RuntimeService- Returns:
- RuntimeService of process engine bound to this testing thread
- See Also:
-
authorizationService
Helper method to easily access AuthorizationService- Returns:
- AuthorizationService of process engine bound to this testing thread
- See Also:
-
formService
Helper method to easily access FormService- Returns:
- FormService of process engine bound to this testing thread
- See Also:
-
historyService
Helper method to easily access HistoryService- Returns:
- HistoryService of process engine bound to this testing thread
- See Also:
-
identityService
Helper method to easily access IdentityService- Returns:
- IdentityService of process engine bound to this testing thread
- See Also:
-
managementService
Helper method to easily access ManagementService- Returns:
- ManagementService of process engine bound to this testing thread
- See Also:
-
repositoryService
Helper method to easily access RepositoryService- Returns:
- RepositoryService of process engine bound to this testing thread
- See Also:
-
taskService
Helper method to easily access TaskService- Returns:
- TaskService of process engine bound to this testing thread
- See Also:
-
externalTaskService
Helper method to easily access ExternalTaskService- Returns:
- ExternalTaskService of process engine bound to this testing thread
- See Also:
-
decisionService
Helper method to easily access DecisionService- Returns:
- DecisionService of process engine bound to this testing thread
- See Also:
-
taskQuery
Helper method to easily create a new TaskQuery- Returns:
- new TaskQuery for process engine bound to this testing thread
- See Also:
-
externalTaskQuery
Helper method to easily create a new ExternalTaskQuery- Returns:
- new ExternalTaskQuery for process engine bound to this testing thread
- See Also:
-
jobQuery
Helper method to easily create a new JobQuery- Returns:
- new JobQuery for process engine bound to this testing thread
- See Also:
-
processInstanceQuery
Helper method to easily create a new ProcessInstanceQuery- Returns:
- new ProcessInstanceQuery for process engine bound to this testing thread
- See Also:
-
processDefinitionQuery
Helper method to easily create a new ProcessDefinitionQuery- Returns:
- new ProcessDefinitionQuery for process engine bound to this testing thread
- See Also:
-
executionQuery
Helper method to easily create a new ExecutionQuery- Returns:
- new ExecutionQuery for process engine bound to this testing thread
- See Also:
-
withVariables
public static Map<String,Object> withVariables(String key, Object value, Object... furtherKeyValuePairs) Helper method to easily construct a map of process variables- Parameters:
key
- (obligatory) key of first process variablevalue
- (obligatory) value of first process variablefurtherKeyValuePairs
- (optional) key/value pairs for further process variables- Returns:
- a map of process variables by passing a list of String, Object key value pairs.
-
task
Helper method to easily access the only task currently available in the context of the last asserted process instance.- Returns:
- the only task of the last asserted process instance. May return null if no such task exists.
- Throws:
IllegalStateException
- in case more than one task is delivered by the underlying query or in case no process instance was asserted yet.
-
task
Helper method to easily access the only task currently available in the context of the given process instance.- Parameters:
processInstance
- the process instance for which a task should be retrieved.- Returns:
- the only task of the process instance. May return null if no such task exists.
- Throws:
IllegalStateException
- in case more than one task is delivered by the underlying query.
-
task
Helper method to easily access the only task with the given taskDefinitionKey currently available in the context of the last asserted process instance.- Parameters:
taskDefinitionKey
- the key of the task that should be retrieved.- Returns:
- the only task of the last asserted process instance. May return null if no such task exists.
- Throws:
IllegalStateException
- in case more than one task is delivered by the underlying query or in case no process instance was asserted yet.
-
task
Helper method to easily access the only task with the given taskDefinitionKey currently available in the context of the given process instance.- Parameters:
taskDefinitionKey
- the key of the task that should be retrieved.processInstance
- the process instance for which a task should be retrieved.- Returns:
- the only task of the given process instance. May return null if no such task exists.
- Throws:
IllegalStateException
- in case more than one task is delivered by the underlying query.
-
task
Helper method to easily access the only task compliant to a given taskQuery and currently available in the context of the last asserted process instance.- Parameters:
taskQuery
- the query with which the task should be retrieved. This query will be further narrowed to the last asserted process instance.- Returns:
- the only task of the last asserted process instance and compliant to the given query. May return null in case no such task exists.
- Throws:
IllegalStateException
- in case more than one task is delivered by the underlying query or in case no process instance was asserted yet.
-
task
Helper method to easily access the only task compliant to a given taskQuery and currently available in the context of the given process instance.- Parameters:
taskQuery
- the query with which the task should be retrieved. This query will be further narrowed to the given process instance.processInstance
- the process instance for which a task should be retrieved.- Returns:
- the only task of the given process instance and compliant to the given query. May return null in case no such task exists.
- Throws:
IllegalStateException
- in case more than one task is delivered by the underlying query.
-
externalTask
Helper method to easily access the only external task currently available in the context of the last asserted process instance.- Returns:
- the only external task of the last asserted process instance. May return null if no such external task exists.
- Throws:
IllegalStateException
- in case more than one external task is delivered by the underlying query or in case no process instance was asserted yet.
-
externalTask
Helper method to easily access the only external task currently available in the context of the given process instance.- Parameters:
processInstance
- the process instance for which an external task should be retrieved.- Returns:
- the only external task of the process instance. May return null if no such external task exists.
- Throws:
IllegalStateException
- in case more than one external task is delivered by the underlying query.
-
externalTask
Helper method to easily access the only external task with the given activityId currently available in the context of the last asserted process instance.- Parameters:
activityId
- the key of the external task that should be retrieved.- Returns:
- the only external task of the last asserted process instance. May return null if no such external task exists.
- Throws:
IllegalStateException
- in case more than one external task is delivered by the underlying query or in case no process instance was asserted yet.
-
externalTask
Helper method to easily access the only external task with the given activityId currently available in the context of the given process instance.- Parameters:
activityId
- the key of the external task that should be retrieved.processInstance
- the process instance for which a external task should be retrieved.- Returns:
- the only external task of the given process instance. May return null if no such external task exists.
- Throws:
IllegalStateException
- in case more than one external task is delivered by the underlying query.
-
externalTask
Helper method to easily access the only external task compliant to a given externalTaskQuery and currently available in the context of the last asserted process instance.- Parameters:
externalTaskQuery
- the query with which the external task should be retrieved. This query will be further narrowed to the last asserted process instance.- Returns:
- the only external task of the last asserted process instance and compliant to the given query. May return null in case no such external task exists.
- Throws:
IllegalStateException
- in case more than one external task is delivered by the underlying query or in case no process instance was asserted yet.
-
externalTask
public static ExternalTask externalTask(ExternalTaskQuery externalTaskQuery, ProcessInstance processInstance) Helper method to easily access the only external task compliant to a given externalTaskQuery and currently available in the context of the given process instance.- Parameters:
externalTaskQuery
- the query with which the external task should be retrieved. This query will be further narrowed to the given process instance.processInstance
- the process instance for which a external task should be retrieved.- Returns:
- the only external task of the given process instance and compliant to the given query. May return null in case no such external task exists.
- Throws:
IllegalStateException
- in case more than one external task is delivered by the underlying query.
-
processDefinition
Helper method to easily access the process definition on which the last asserted process instance is based.- Returns:
- the process definition on which the last asserted process instance is based.
- Throws:
IllegalStateException
- in case no process instance was asserted yet.
-
processDefinition
Helper method to easily access the process definition on which the given process instance is based.- Parameters:
processInstance
- the process instance for which the definition should be retrieved.- Returns:
- the process definition on which the given process instance is based.
-
processDefinition
Helper method to easily access the process definition with the given processDefinitionKey.- Parameters:
processDefinitionKey
- the key of the process definition that should be retrieved.- Returns:
- the process definition with the given key. May return null if no such process definition exists.
-
processDefinition
Helper method to easily access the process definition compliant to a given process definition query.- Parameters:
processDefinitionQuery
- the query with which the process definition should be retrieved.- Returns:
- the process definition compliant to the given query. May return null in case no such process definition exists.
- Throws:
ProcessEngineException
- in case more than one process definition is delivered by the underlying query.
-
calledProcessInstance
Helper method to easily access the only called process instance currently available in the context of the last asserted process instance.- Returns:
- the only called process instance called by the last asserted process instance. May return null if no such process instance exists.
- Throws:
IllegalStateException
- in case more than one process instance is delivered by the underlying query or in case no process instance was asserted yet.
-
calledProcessInstance
Helper method to easily access the only called process instance currently available in the context of the given process instance.- Parameters:
processInstance
- the process instance for which a called process instance should be retrieved.- Returns:
- the only called process instance called by the given process instance. May return null if no such process instance exists.
- Throws:
IllegalStateException
- in case more than one process instance is delivered by the underlying query.
-
calledProcessInstance
Helper method to easily access the only called process instance with the given processDefinitionKey currently available in the context of the last asserted process instance.- Parameters:
processDefinitionKey
- the key of the process instance that should be retrieved.- Returns:
- the only such process instance called by the last asserted process instance. May return null if no such process instance exists.
- Throws:
IllegalStateException
- in case more than one process instance is delivered by the underlying query or in case no process instance was asserted yet.
-
calledProcessInstance
public static ProcessInstance calledProcessInstance(String processDefinitionKey, ProcessInstance processInstance) Helper method to easily access the only called process instance with the given processDefinitionKey currently available in the context of the given process instance.- Parameters:
processDefinitionKey
- the key of the process instance that should be retrieved.processInstance
- the process instance for which a called process instance should be retrieved.- Returns:
- the only such process instance called by the given process instance. May return null if no such process instance exists.
- Throws:
IllegalStateException
- in case more than one process instance is delivered by the underlying query.
-
calledProcessInstance
Helper method to easily access the only called process instance compliant to a given processInstanceQuery and currently available in the context of the last asserted process instance.- Parameters:
processInstanceQuery
- the query with which the called process instance should be retrieved. This query will be further narrowed to the last asserted process instance.- Returns:
- the only such process instance called by the last asserted process instance and compliant to the given query. May return null in case no such task exists.
- Throws:
IllegalStateException
- in case more than one process instance is delivered by the underlying query or in case no process instance was asserted yet.
-
calledProcessInstance
public static ProcessInstance calledProcessInstance(ProcessInstanceQuery processInstanceQuery, ProcessInstance processInstance) Helper method to easily access the only called process instance compliant to a given processInstanceQuery and currently available in the context of the given process instance.- Parameters:
processInstanceQuery
- the query with which the process instance should be retrieved. This query will be further narrowed to the given process instance.processInstance
- the process instance for which a called process instance should be retrieved.- Returns:
- the only such process instance called by the given process instance and compliant to the given query. May return null in case no such process instance exists.
- Throws:
IllegalStateException
- in case more than one instance is delivered by the underlying query.
-
job
Helper method to easily access the only job currently available in the context of the last asserted process instance.- Returns:
- the only job of the last asserted process instance. May return null if no such job exists.
- Throws:
IllegalStateException
- in case more than one job is delivered by the underlying query or in case no process instance was asserted yet.
-
job
Helper method to easily access the only job currently available in the context of the given process instance.- Parameters:
processInstance
- the process instance for which a job should be retrieved.- Returns:
- the only job of the process instance. May return null if no such task exists.
- Throws:
IllegalStateException
- in case more than one job is delivered by the underlying query.
-
job
Helper method to easily access the only job with the given activityId currently available in the context of the last asserted process instance.- Parameters:
activityId
- the id of the job that should be retrieved.- Returns:
- the only job of the last asserted process instance. May return null if no such job exists.
- Throws:
IllegalStateException
- in case more than one job is delivered by the underlying query or in case no process instance was asserted yet.
-
job
Helper method to easily access the only job with the given activityId currently available in the context of the given process instance.- Parameters:
activityId
- the activityId of the job that should be retrieved.processInstance
- the process instance for which a job should be retrieved.- Returns:
- the only job of the given process instance. May return null if no such job exists.
- Throws:
IllegalStateException
- in case more than one job is delivered by the underlying query.
-
job
Helper method to easily access the only job compliant to a given jobQuery and currently available in the context of the last asserted process instance.- Parameters:
jobQuery
- the query with which the job should be retrieved. This query will be further narrowed to the last asserted process instance.- Returns:
- the only job of the last asserted process instance and compliant to the given query. May return null in case no such task exists.
- Throws:
IllegalStateException
- in case more than one job is delivered by the underlying query or in case no process instance was asserted yet.
-
job
Helper method to easily access the only job compliant to a given jobQuery and currently available in the context of the given process instance.- Parameters:
jobQuery
- the query with which the job should be retrieved. This query will be further narrowed to the given process instance.processInstance
- the process instance for which a job should be retrieved.- Returns:
- the only job of the given process instance and compliant to the given query. May return null in case no such job exists.
- Throws:
IllegalStateException
- in case more than one job is delivered by the underlying query.
-
claim
Helper method to easily claim a task for a specific assignee.- Parameters:
task
- Task to be claimed for an assigneeassigneeUserId
- userId of assignee for which the task should be claimed- Returns:
- the assigned task - properly refreshed to its assigned state.
-
unclaim
Helper method to easily unclaim a task.- Parameters:
task
- Task to be claimed for an assignee- Returns:
- the assigned task - properly refreshed to its unassigned state.
-
complete
Helper method to easily complete a task and pass some process variables.- Parameters:
task
- Task to be completedvariables
- Process variables to be passed to the process instance when completing the task. For setting those variables, you can use withVariables(String key, Object value, ...)
-
complete
Helper method to easily complete a task.- Parameters:
task
- Task to be completed
-
complete
Helper method to easily fetch, lock and complete an external task.Note: if multiple external tasks exist that can be locked for the topic of the given external task, this method might throw an
IllegalStateException
if an external task with a different id is locked by chance. In this case, it is more advisable to use thefetchAndLock
andcomplete(LockedExternalTask)
methods to achieve reliable results.- Parameters:
externalTask
- External task to be completed
-
complete
Helper method to easily fetch, lock and complete an external task.Note: if multiple external tasks exist that can be locked for the topic of the given external task, this method might throw an
IllegalStateException
if an external task with a different id is locked by chance. In this case, it is more advisable to use thefetchAndLock
andcomplete(LockedExternalTask, Map)
methods to achieve reliable results.- Parameters:
externalTask
- External task to be completedvariables
- Process variables to be passed to the process instance when completing the task. For setting those variables, you can use withVariables(String key, Object value, ...)
-
complete
public static void complete(ExternalTask externalTask, Map<String, Object> variables, Map<String, Object> localVariables) Helper method to easily fetch, lock and complete an external task.Note: if multiple external tasks exist that can be locked for the topic of the given external task, this method might throw an
IllegalStateException
if an external task with a different id is locked by chance. In this case, it is more advisable to use thefetchAndLock
andcomplete(LockedExternalTask, Map)
methods to achieve reliable results.- Parameters:
externalTask
- External task to be completedvariables
- Process variables to be passed to the process instance when completing the task. For setting those variables, you can use withVariables(String key, Object value, ...)localVariables
- Local process variables to be passed to the process instance when completing the task. For setting those variables, you can use withVariables(String key, Object value, ...)
-
fetchAndLock
Helper method to easily fetch and lock external tasks from a given topic using a given workerId. The tasks will be locked forDEFAULT_LOCK_DURATION_EXTERNAL_TASK
milliseconds.- Parameters:
topic
- the name of the topic to query external tasks fromworkerId
- the id of the worker to lock the tasks formaxResults
- the maximum number of tasks to return- Returns:
- list of external tasks locked for the given workerId
-
complete
Helper method to easily complete a locked external task.- Parameters:
lockedExternalTask
- an external task that was locked using thefetchAndLock
method
-
complete
Helper method to easily complete a locked external task.- Parameters:
lockedExternalTask
- an external task that was locked using thefetchAndLock
methodvariables
- Process variables to be passed to the process instance when completing the task. For setting those variables, you can use withVariables(String key, Object value, ...)
-
complete
public static void complete(LockedExternalTask lockedExternalTask, Map<String, Object> variables, Map<String, Object> localVariables) Helper method to easily complete a locked external task.- Parameters:
lockedExternalTask
- an external task that was locked using thefetchAndLock
methodvariables
- Process variables to be passed to the process instance when completing the task. For setting those variables, you can use withVariables(String key, Object value, ...)localVariables
- Local process variables to be passed to the process instance when completing the task. For setting those variables, you can use withVariables(String key, Object value, ...)
-
execute
Helper method to easily execute a job.- Parameters:
job
- Job to be executed.
-
findId
Maps any element (task, event, gateway) from the name to the ID.- Parameters:
name
-- Returns:
- the ID of the element
-