Class CallActivityMock
- java.lang.Object
-
- org.camunda.bpm.extension.mockito.process.CallActivityMock
-
- Direct Known Subclasses:
CallActivityMockForSpringContext
public class CallActivityMock extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceCallActivityMock.MockedModelConfigurerInterface used as a callback to set some attributes of the mocked process model (e.g.
-
Constructor Summary
Constructors Constructor Description CallActivityMock(String processId)CallActivityMock(String processId, CallActivityMock.MockedModelConfigurer modelConfigurer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.camunda.bpm.engine.repository.Deploymentdeploy(org.camunda.bpm.engine.ProcessEngineServices processEngineServices)org.camunda.bpm.engine.repository.Deploymentdeploy(org.camunda.bpm.engine.RepositoryService repositoryService)This will deploy the mock process.CallActivityMockonExecutionAddVariable(String key, Object val)On execution, the MockProcess will add the given process variableCallActivityMockonExecutionAddVariables(org.camunda.bpm.engine.variable.VariableMap variables)On execution, the MockProcess will add the given VariableMap to the executionCallActivityMockonExecutionDo(String serviceId, java.util.function.Consumer<org.camunda.bpm.engine.delegate.DelegateExecution> consumer)On execution, the MockProcess will execute the given consumer with a DelegateExecution.CallActivityMockonExecutionDo(java.util.function.Consumer<org.camunda.bpm.engine.delegate.DelegateExecution> consumer)On execution, the MockProcess will call the given consumer with a DelegateExecution.CallActivityMockonExecutionRunIntoError(Throwable exception)On execution, the MockProcess will throw a RuntimeException for the given Throwable.CallActivityMockonExecutionSendMessage(String message)On execution, the MockProcess will send the given message to allCallActivityMockonExecutionSendMessage(String message, String businessId)On execution, the MockProcess will send the given message to a process instance with the given businessIdCallActivityMockonExecutionSetVariables(org.camunda.bpm.engine.variable.VariableMap variables)On execution, the MockProcess will set the given VariableMap to the execution (ATTENTION: This means all current process variables are replaced with the given Map!)CallActivityMockonExecutionWaitForMessage(String message)On execution, the MockProcess will wait for the given messageCallActivityMockonExecutionWaitForSignal(String signalName)On execution, the MockProcess will wait for the given signalCallActivityMockonExecutionWaitForTimerWithDate(String iso8601date)On execution, the MockProcess will wait on a timer which is configured with an ISO 8601 date.CallActivityMockonExecutionWaitForTimerWithDate(Date date)On execution, the MockProcess will wait on a timer which is configured with an dateCallActivityMockonExecutionWaitForTimerWithDuration(String iso8601duration)On execution, the MockProcess will wait on a timer which is configured with an ISO 8601 duration.protected voidregisterJavaDelegateMock(String delegateReferenceName, org.camunda.bpm.engine.delegate.JavaDelegate delegate)Registers a delegate under the specified name within the appropriate context.
-
-
-
Constructor Detail
-
CallActivityMock
public CallActivityMock(String processId, CallActivityMock.MockedModelConfigurer modelConfigurer)
-
CallActivityMock
public CallActivityMock(String processId)
-
-
Method Detail
-
registerJavaDelegateMock
protected void registerJavaDelegateMock(String delegateReferenceName, org.camunda.bpm.engine.delegate.JavaDelegate delegate)
Registers a delegate under the specified name within the appropriate context. The implementation in this class uses the thread local mock registry, but subclasses might use e.g. a Spring context.- Parameters:
delegateReferenceName- Name under which the delegate should be registered. After the registration, the delegate can be referenced in process models as '${name}'.delegate- The delegate instance to register
-
onExecutionSetVariables
public CallActivityMock onExecutionSetVariables(org.camunda.bpm.engine.variable.VariableMap variables)
On execution, the MockProcess will set the given VariableMap to the execution (ATTENTION: This means all current process variables are replaced with the given Map!)- Parameters:
variables- variables to set- Returns:
- this mock instance
-
onExecutionAddVariables
public CallActivityMock onExecutionAddVariables(org.camunda.bpm.engine.variable.VariableMap variables)
On execution, the MockProcess will add the given VariableMap to the execution- Parameters:
variables- the variables to add- Returns:
- self
-
onExecutionAddVariable
public CallActivityMock onExecutionAddVariable(String key, Object val)
On execution, the MockProcess will add the given process variable- Parameters:
key- ... key of the process variableval- ... value of the process variable- Returns:
- self
-
onExecutionDo
public CallActivityMock onExecutionDo(java.util.function.Consumer<org.camunda.bpm.engine.delegate.DelegateExecution> consumer)
On execution, the MockProcess will call the given consumer with a DelegateExecution.- Parameters:
consumer- the javaDelegate code to be called on execution- Returns:
- self
-
onExecutionDo
public CallActivityMock onExecutionDo(String serviceId, java.util.function.Consumer<org.camunda.bpm.engine.delegate.DelegateExecution> consumer)
On execution, the MockProcess will execute the given consumer with a DelegateExecution.- Parameters:
serviceId- ... the id of the mock delegateconsumer- delegate for service task- Returns:
- self
-
onExecutionWaitForTimerWithDate
public CallActivityMock onExecutionWaitForTimerWithDate(Date date)
On execution, the MockProcess will wait on a timer which is configured with an date- Parameters:
date- the timer dueDate- Returns:
- self
-
onExecutionWaitForTimerWithDate
public CallActivityMock onExecutionWaitForTimerWithDate(String iso8601date)
On execution, the MockProcess will wait on a timer which is configured with an ISO 8601 date. E.g.: 2018-10-14T14:10:00Z- Parameters:
iso8601date- the timer dueDate- Returns:
- self
-
onExecutionWaitForTimerWithDuration
public CallActivityMock onExecutionWaitForTimerWithDuration(String iso8601duration)
On execution, the MockProcess will wait on a timer which is configured with an ISO 8601 duration. E.g.: PT60S ... will wait for 60 sec- Parameters:
iso8601duration- the timer dueDate- Returns:
- self
-
onExecutionSendMessage
public CallActivityMock onExecutionSendMessage(String message)
On execution, the MockProcess will send the given message to all- Parameters:
message- the message to receive- Returns:
- self
-
onExecutionSendMessage
public CallActivityMock onExecutionSendMessage(String message, String businessId)
On execution, the MockProcess will send the given message to a process instance with the given businessId- Parameters:
message- the message to receivebusinessId- the process business key- Returns:
- self
-
onExecutionWaitForMessage
public CallActivityMock onExecutionWaitForMessage(String message)
On execution, the MockProcess will wait for the given message- Parameters:
message- the message to receive- Returns:
- self
-
onExecutionRunIntoError
public CallActivityMock onExecutionRunIntoError(Throwable exception)
On execution, the MockProcess will throw a RuntimeException for the given Throwable.- Parameters:
exception- the error to throw- Returns:
- self
-
onExecutionWaitForSignal
public CallActivityMock onExecutionWaitForSignal(String signalName)
On execution, the MockProcess will wait for the given signal- Parameters:
signalName- the signal to receive- Returns:
- self
-
deploy
public org.camunda.bpm.engine.repository.Deployment deploy(org.camunda.bpm.engine.RepositoryService repositoryService)
This will deploy the mock process.
-
deploy
public org.camunda.bpm.engine.repository.Deployment deploy(org.camunda.bpm.engine.ProcessEngineServices processEngineServices)
-
-