Class CallActivityMock

java.lang.Object
org.camunda.community.mockito.process.CallActivityMock
All Implemented Interfaces:
DeployProcess.BpmnModelInstanceResource
Direct Known Subclasses:
CallActivityMockForSpringContext

public class CallActivityMock extends Object implements DeployProcess.BpmnModelInstanceResource
  • Constructor Details

  • Method Details

    • 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 variable
      val - ... value of the process variable
      Returns:
      self
    • onExecutionDo

      public CallActivityMock onExecutionDo(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, 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 delegate
      consumer - 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 receive
      businessId - 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
    • onExecutionThrowEscalation

      public CallActivityMock onExecutionThrowEscalation(String escalationCode)
      On execution, the MockProcess will throw escalation for the given code If called multiple times, this method adds only the last escalation to the end event.
      Parameters:
      escalationCode - the escalation code
      Returns:
      self
    • onExecutionThrowError

      public CallActivityMock onExecutionThrowError(String errorCode)
      On execution, the MockProcess will throw error for the given code when no escalation is set If called multiple times, this method adds only the last error to the end event.
      Parameters:
      errorCode - the errorCode
      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)
    • getResourceName

      public String getResourceName()
      Specified by:
      getResourceName in interface DeployProcess.BpmnModelInstanceResource
    • getModelInstance

      public org.camunda.bpm.model.bpmn.BpmnModelInstance getModelInstance()
      Specified by:
      getModelInstance in interface DeployProcess.BpmnModelInstanceResource