Package org.camunda.community.bpmndt.api
Class JobHandler
java.lang.Object
org.camunda.community.bpmndt.api.JobHandler
Fluent API to handle jobs (asynchronous continuation and timer catch events).
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionJobHandler(org.camunda.bpm.engine.ProcessEngine processEngine, String activityId) JobHandler(org.camunda.bpm.engine.ProcessEngine processEngine, String activityId, JobHandler.Cardinality cardinality) Creates a new job handler. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapply(org.camunda.bpm.engine.runtime.ProcessInstance pi) customize(Consumer<JobHandler> customizer) Customizes the handler, using the givenConsumerfunction.voidexecute()Executes the job with an action that callsexecuteJob, when the process instance is waiting at the corresponding activity.voidExecutes a custom action that handles the job, when the process instance is waiting at the corresponding activity.protected voidexecute(org.camunda.bpm.engine.runtime.Job job) verify(BiConsumer<org.camunda.bpm.engine.test.assertions.bpmn.ProcessInstanceAssert, org.camunda.bpm.engine.test.assertions.bpmn.JobAssert> verifier) Verifies the job's waiting state.
-
Constructor Details
-
JobHandler
-
JobHandler
public JobHandler(org.camunda.bpm.engine.ProcessEngine processEngine, String activityId, JobHandler.Cardinality cardinality) Creates a new job handler. This constructor is used in the context of multi instance activities.- Parameters:
processEngine- The used process engine.activityId- The ID of the related activity.cardinality- Expected job cardinality.
-
-
Method Details
-
apply
protected void apply(org.camunda.bpm.engine.runtime.ProcessInstance pi) -
customize
Customizes the handler, using the givenConsumerfunction. This method can be used to apply a common customization needed for different test cases.tc.handleJob().customize(this::prepareJob);
- Parameters:
customizer- A function that accepts aJobHandler.- Returns:
- The handler.
-
execute
public void execute()Executes the job with an action that callsexecuteJob, when the process instance is waiting at the corresponding activity. Please note: this is the default behavior.- See Also:
-
execute
Executes a custom action that handles the job, when the process instance is waiting at the corresponding activity.- Parameters:
action- A specific action that accepts the relatedJob.- Throws:
IllegalArgumentException- if action isnull.
-
execute
protected void execute(org.camunda.bpm.engine.runtime.Job job) -
verify
public JobHandler verify(BiConsumer<org.camunda.bpm.engine.test.assertions.bpmn.ProcessInstanceAssert, org.camunda.bpm.engine.test.assertions.bpmn.JobAssert> verifier) Verifies the job's waiting state.- Parameters:
verifier- Verifier that accepts anProcessInstanceAssertand anJobAssertinstance.- Returns:
- The handler.
-