org.camunda.bpm.engine.test.assertions
Class ProcessEngineTests

java.lang.Object
  extended by org.assertj.core.api.Assertions
      extended by org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions
          extended by org.camunda.bpm.engine.test.assertions.ProcessEngineTests

public class ProcessEngineTests
extends ProcessEngineAssertions

Convenience class to access all assertions camunda BPM Process Engine Assertions - PLUS a few helper methods. In your code use import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*;

Author:
Martin Schimak
See Also:
ProcessEngineAssertions

Method Summary
static org.camunda.bpm.engine.AuthorizationService authorizationService()
          Helper method to easily access AuthorizationService
static org.camunda.bpm.engine.runtime.ProcessInstance calledProcessInstance()
          Helper method to easily access the only called process instance currently available in the context of the last asserted process instance.
static org.camunda.bpm.engine.runtime.ProcessInstance calledProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance processInstance)
          Helper method to easily access the only called process instance currently available in the context of the given process instance.
static org.camunda.bpm.engine.runtime.ProcessInstance calledProcessInstance(org.camunda.bpm.engine.runtime.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 org.camunda.bpm.engine.runtime.ProcessInstance calledProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstanceQuery processInstanceQuery, org.camunda.bpm.engine.runtime.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 org.camunda.bpm.engine.runtime.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 org.camunda.bpm.engine.runtime.ProcessInstance calledProcessInstance(String processDefinitionKey, org.camunda.bpm.engine.runtime.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 org.camunda.bpm.engine.task.Task claim(org.camunda.bpm.engine.task.Task task, String assigneeUserId)
          Helper method to easily claim a task for a specific assignee.
static void complete(org.camunda.bpm.engine.task.Task task)
          Helper method to easily complete a task.
static void complete(org.camunda.bpm.engine.task.Task task, Map<String,Object> variables)
          Helper method to easily complete a task and pass some process variables.
static void execute(org.camunda.bpm.engine.runtime.Job job)
          Helper method to easily execute a job.
static org.camunda.bpm.engine.runtime.ExecutionQuery executionQuery()
          Helper method to easily create a new ExecutionQuery
static org.camunda.bpm.engine.FormService formService()
          Helper method to easily access FormService
static org.camunda.bpm.engine.HistoryService historyService()
          Helper method to easily access HistoryService
static org.camunda.bpm.engine.IdentityService identityService()
          Helper method to easily access IdentityService
static org.camunda.bpm.engine.runtime.Job job()
          Helper method to easily access the only job currently available in the context of the last asserted process instance.
static org.camunda.bpm.engine.runtime.Job job(org.camunda.bpm.engine.runtime.JobQuery jobQuery)
          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 org.camunda.bpm.engine.runtime.Job job(org.camunda.bpm.engine.runtime.JobQuery jobQuery, org.camunda.bpm.engine.runtime.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 org.camunda.bpm.engine.runtime.Job job(org.camunda.bpm.engine.runtime.ProcessInstance processInstance)
          Helper method to easily access the only job currently available in the context of the given process instance.
static org.camunda.bpm.engine.runtime.Job job(String activityId)
          Helper method to easily access the only job with the given activityId currently available in the context of the last asserted process instance.
static org.camunda.bpm.engine.runtime.Job job(String activityId, org.camunda.bpm.engine.runtime.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 org.camunda.bpm.engine.runtime.JobQuery jobQuery()
          Helper method to easily create a new JobQuery
static org.camunda.bpm.engine.ManagementService managementService()
          Helper method to easily access ManagementService
static org.camunda.bpm.engine.repository.ProcessDefinition processDefinition()
          Helper method to easily access the process definition on which the last asserted process instance is based.
static org.camunda.bpm.engine.repository.ProcessDefinition processDefinition(org.camunda.bpm.engine.repository.ProcessDefinitionQuery processDefinitionQuery)
          Helper method to easily access the process definition compliant to a given process definition query.
static org.camunda.bpm.engine.repository.ProcessDefinition processDefinition(org.camunda.bpm.engine.runtime.ProcessInstance processInstance)
          Helper method to easily access the process definition on which the given process instance is based.
static org.camunda.bpm.engine.repository.ProcessDefinition processDefinition(String processDefinitionKey)
          Helper method to easily access the process definition with the given processDefinitionKey.
static org.camunda.bpm.engine.repository.ProcessDefinitionQuery processDefinitionQuery()
          Helper method to easily create a new ProcessDefinitionQuery
static org.camunda.bpm.engine.runtime.ProcessInstanceQuery processInstanceQuery()
          Helper method to easily create a new ProcessInstanceQuery
static org.camunda.bpm.engine.RepositoryService repositoryService()
          Helper method to easily access RepositoryService
static org.camunda.bpm.engine.RuntimeService runtimeService()
          Helper method to easily access RuntimeService
static org.camunda.bpm.engine.task.Task task()
          Helper method to easily access the only task currently available in the context of the last asserted process instance.
static org.camunda.bpm.engine.task.Task task(org.camunda.bpm.engine.runtime.ProcessInstance processInstance)
          Helper method to easily access the only task currently available in the context of the given process instance.
static org.camunda.bpm.engine.task.Task task(String taskDefinitionKey)
          Helper method to easily access the only task with the given taskDefinitionKey currently available in the context of the last asserted process instance.
static org.camunda.bpm.engine.task.Task task(String taskDefinitionKey, org.camunda.bpm.engine.runtime.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 org.camunda.bpm.engine.task.Task task(org.camunda.bpm.engine.task.TaskQuery taskQuery)
          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 org.camunda.bpm.engine.task.Task task(org.camunda.bpm.engine.task.TaskQuery taskQuery, org.camunda.bpm.engine.runtime.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 org.camunda.bpm.engine.task.TaskQuery taskQuery()
          Helper method to easily create a new TaskQuery
static org.camunda.bpm.engine.TaskService taskService()
          Helper method to easily access TaskService
static org.camunda.bpm.engine.task.Task unclaim(org.camunda.bpm.engine.task.Task task)
          Helper method to easily unclaim a task.
static Map<String,Object> withVariables(String key, Object value, Object... furtherKeyValuePairs)
          Helper method to easily construct a map of process variables
 
Methods inherited from class org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions
assertThat, assertThat, assertThat, assertThat, init, processEngine, reset
 
Methods inherited from class org.assertj.core.api.Assertions
allOf, allOf, anyOf, anyOf, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, atIndex, contentOf, contentOf, contentOf, doesNotHave, entry, extractProperty, extractProperty, fail, fail, failBecauseExceptionWasNotThrown, filter, filter, linesOf, linesOf, linesOf, not, offset, offset, registerCustomDateFormat, registerCustomDateFormat, setAllowExtractingPrivateFields, setRemoveAssertJRelatedElementsFromStackTrace, tuple, useDateFormat, useDateFormat, useDefaultDateFormats, useDefaultDateFormatsOnly, useIsoDateFormat, useIsoDateTimeFormat, useIsoDateTimeWithMsFormat, within, within, within
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

runtimeService

public static org.camunda.bpm.engine.RuntimeService runtimeService()
Helper method to easily access RuntimeService

Returns:
RuntimeService of process engine bound to this testing thread
See Also:
RuntimeService

authorizationService

public static org.camunda.bpm.engine.AuthorizationService authorizationService()
Helper method to easily access AuthorizationService

Returns:
AuthorizationService of process engine bound to this testing thread
See Also:
AuthorizationService

formService

public static org.camunda.bpm.engine.FormService formService()
Helper method to easily access FormService

Returns:
FormService of process engine bound to this testing thread
See Also:
FormService

historyService

public static org.camunda.bpm.engine.HistoryService historyService()
Helper method to easily access HistoryService

Returns:
HistoryService of process engine bound to this testing thread
See Also:
HistoryService

identityService

public static org.camunda.bpm.engine.IdentityService identityService()
Helper method to easily access IdentityService

Returns:
IdentityService of process engine bound to this testing thread
See Also:
IdentityService

managementService

public static org.camunda.bpm.engine.ManagementService managementService()
Helper method to easily access ManagementService

Returns:
ManagementService of process engine bound to this testing thread
See Also:
ManagementService

repositoryService

public static org.camunda.bpm.engine.RepositoryService repositoryService()
Helper method to easily access RepositoryService

Returns:
RepositoryService of process engine bound to this testing thread
See Also:
RepositoryService

taskService

public static org.camunda.bpm.engine.TaskService taskService()
Helper method to easily access TaskService

Returns:
TaskService of process engine bound to this testing thread
See Also:
TaskService

taskQuery

public static org.camunda.bpm.engine.task.TaskQuery taskQuery()
Helper method to easily create a new TaskQuery

Returns:
new TaskQuery for process engine bound to this testing thread
See Also:
TaskQuery

jobQuery

public static org.camunda.bpm.engine.runtime.JobQuery jobQuery()
Helper method to easily create a new JobQuery

Returns:
new JobQuery for process engine bound to this testing thread
See Also:
JobQuery

processInstanceQuery

public static org.camunda.bpm.engine.runtime.ProcessInstanceQuery processInstanceQuery()
Helper method to easily create a new ProcessInstanceQuery

Returns:
new ProcessInstanceQuery for process engine bound to this testing thread
See Also:
ProcessInstanceQuery

processDefinitionQuery

public static org.camunda.bpm.engine.repository.ProcessDefinitionQuery processDefinitionQuery()
Helper method to easily create a new ProcessDefinitionQuery

Returns:
new ProcessDefinitionQuery for process engine bound to this testing thread
See Also:
ProcessDefinitionQuery

executionQuery

public static org.camunda.bpm.engine.runtime.ExecutionQuery executionQuery()
Helper method to easily create a new ExecutionQuery

Returns:
new ExecutionQuery for process engine bound to this testing thread
See Also:
ExecutionQuery

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 variable
value - (obligatory) value of first process variable
furtherKeyValuePairs - (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

public static org.camunda.bpm.engine.task.Task 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

public static org.camunda.bpm.engine.task.Task task(org.camunda.bpm.engine.runtime.ProcessInstance processInstance)
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

public static org.camunda.bpm.engine.task.Task task(String taskDefinitionKey)
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

public static org.camunda.bpm.engine.task.Task task(String taskDefinitionKey,
                                                    org.camunda.bpm.engine.runtime.ProcessInstance processInstance)
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

public static org.camunda.bpm.engine.task.Task task(org.camunda.bpm.engine.task.TaskQuery taskQuery)
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

public static org.camunda.bpm.engine.task.Task task(org.camunda.bpm.engine.task.TaskQuery taskQuery,
                                                    org.camunda.bpm.engine.runtime.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.

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.

processDefinition

public static org.camunda.bpm.engine.repository.ProcessDefinition 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

public static org.camunda.bpm.engine.repository.ProcessDefinition processDefinition(org.camunda.bpm.engine.runtime.ProcessInstance processInstance)
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

public static org.camunda.bpm.engine.repository.ProcessDefinition processDefinition(String processDefinitionKey)
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

public static org.camunda.bpm.engine.repository.ProcessDefinition processDefinition(org.camunda.bpm.engine.repository.ProcessDefinitionQuery processDefinitionQuery)
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:
org.camunda.bpm.engine.ProcessEngineException - in case more than one process definition is delivered by the underlying query.

calledProcessInstance

public static org.camunda.bpm.engine.runtime.ProcessInstance 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

public static org.camunda.bpm.engine.runtime.ProcessInstance calledProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance processInstance)
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

public static org.camunda.bpm.engine.runtime.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.

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 org.camunda.bpm.engine.runtime.ProcessInstance calledProcessInstance(String processDefinitionKey,
                                                                                   org.camunda.bpm.engine.runtime.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

public static org.camunda.bpm.engine.runtime.ProcessInstance calledProcessInstance(org.camunda.bpm.engine.runtime.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.

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 org.camunda.bpm.engine.runtime.ProcessInstance calledProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstanceQuery processInstanceQuery,
                                                                                   org.camunda.bpm.engine.runtime.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

public static org.camunda.bpm.engine.runtime.Job 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

public static org.camunda.bpm.engine.runtime.Job job(org.camunda.bpm.engine.runtime.ProcessInstance processInstance)
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

public static org.camunda.bpm.engine.runtime.Job job(String activityId)
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

public static org.camunda.bpm.engine.runtime.Job job(String activityId,
                                                     org.camunda.bpm.engine.runtime.ProcessInstance processInstance)
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

public static org.camunda.bpm.engine.runtime.Job job(org.camunda.bpm.engine.runtime.JobQuery jobQuery)
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

public static org.camunda.bpm.engine.runtime.Job job(org.camunda.bpm.engine.runtime.JobQuery jobQuery,
                                                     org.camunda.bpm.engine.runtime.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.

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

public static org.camunda.bpm.engine.task.Task claim(org.camunda.bpm.engine.task.Task task,
                                                     String assigneeUserId)
Helper method to easily claim a task for a specific assignee.

Parameters:
task - Task to be claimed for an assignee
assigneeUserId - userId of assignee for which the task should be claimed
Returns:
the assigned task - properly refreshed to its assigned state.

unclaim

public static org.camunda.bpm.engine.task.Task unclaim(org.camunda.bpm.engine.task.Task task)
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

public static void complete(org.camunda.bpm.engine.task.Task task,
                            Map<String,Object> variables)
Helper method to easily complete a task and pass some process variables.

Parameters:
task - Task to be completed
variables - 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(org.camunda.bpm.engine.task.Task task)
Helper method to easily complete a task.

Parameters:
task - Task to be completed

execute

public static void execute(org.camunda.bpm.engine.runtime.Job job)
Helper method to easily execute a job.

Parameters:
job - Job to be executed.


Copyright © 2014 camunda services GmbH. All Rights Reserved.