T - The generated multi instance handler type.U - The activity handler type (e.g. UserTaskHandler).public class MultiInstanceHandler<T extends MultiInstanceHandler<?,?>,U> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected TestCaseInstance |
instance |
| Constructor and Description |
|---|
MultiInstanceHandler(TestCaseInstance instance,
String activityId) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
apply(org.camunda.bpm.engine.runtime.ProcessInstance pi) |
protected boolean |
apply(org.camunda.bpm.engine.runtime.ProcessInstance pi,
int loopIndex)
Applies the multi instance loop for the given index.
|
protected U |
createHandler(int loopIndex)
Creates a new activity handler.
|
protected JobHandler |
createHandlerAfter(int loopIndex)
Creates a new job handler for the asynchronous continuation after the activity.
|
protected JobHandler |
createHandlerBefore(int loopIndex)
Creates a new job handler for the asynchronous continuation before the activity.
|
T |
customize(Consumer<MultiInstanceHandler<T,U>> customizer)
Customizes the handler, using the given
Consumer function. |
protected U |
getHandler(int loopIndex) |
protected JobHandler |
getHandlerAfter(int loopIndex) |
protected JobHandler |
getHandlerBefore(int loopIndex) |
protected org.camunda.bpm.engine.ProcessEngine |
getProcessEngine() |
U |
handle()
Returns the default activity handler, which is used when for a multi instance loop with a
specific index no handler is defined.
|
U |
handle(int loopIndex)
Returns the activity handler, which is applied on the multi instance loop with the given index.
|
JobHandler |
handleAfter()
Returns the default job handler for the asynchronous continuation after the activity, which is
used when for a multi instance loop with a specific index no handler is defined.
|
JobHandler |
handleAfter(int loopIndex)
Returns the job handler for the asynchronous continuation after the activity, which is applied on
the multi instance loop with the given index.
|
JobHandler |
handleBefore()
Returns the default job handler for the asynchronous continuation before the activity, which is
used when for a multi instance loop with a specific index no handler is defined.
|
JobHandler |
handleBefore(int loopIndex)
Returns the job handler for the asynchronous continuation before the activity, which is applied
on the multi instance loop with the given index.
|
protected boolean |
isEnded(org.camunda.bpm.engine.runtime.ProcessInstance pi)
Checks if the multi instance scope is ended or not.
|
protected boolean |
isSequential()
Determines if the multi instance loop is sequentially executed or not.
|
protected void |
registerCallActivityHandler(CallActivityHandler handler)
Registers the given call activity handler at the test case instance, so that it will be executed
when the custom call activity behavior is applied.
Since there can be multiple handlers (one for each loop index), it is necessary to register the correct one before the next multi instance loop is executed. |
T |
verifyLoopCount(int loopCount)
Verifies that the multi instance loop is executed n-times.
|
T |
verifyParallel()
Verifies that the multi instance loop execution is done in parallel.
|
T |
verifySequential()
Verifies that the multi instance loop is sequentially executed.
|
protected final TestCaseInstance instance
public MultiInstanceHandler(TestCaseInstance instance, String activityId)
protected void apply(org.camunda.bpm.engine.runtime.ProcessInstance pi)
protected boolean apply(org.camunda.bpm.engine.runtime.ProcessInstance pi,
int loopIndex)
pi - The process instance, used to execute the test case.loopIndex - The current loop index.true, if the multi instance execution should be continued. Otherwise
false.protected U createHandler(int loopIndex)
loopIndex - The current loop index.protected JobHandler createHandlerAfter(int loopIndex)
loopIndex - The current loop index.protected JobHandler createHandlerBefore(int loopIndex)
loopIndex - The current loop index.public T customize(Consumer<MultiInstanceHandler<T,U>> customizer)
Consumer function. This method can be used to
apply a common customization needed for different test cases.
tc.handleMultiInstance().customize(this::prepareMultiInstance);
customizer - A function that accepts a suitable MultiInstanceHandler.protected U getHandler(int loopIndex)
protected JobHandler getHandlerAfter(int loopIndex)
protected JobHandler getHandlerBefore(int loopIndex)
protected org.camunda.bpm.engine.ProcessEngine getProcessEngine()
public U handle()
public U handle(int loopIndex)
loopIndex - A specific loop index.public JobHandler handleAfter()
public JobHandler handleAfter(int loopIndex)
loopIndex - A specific loop index.public JobHandler handleBefore()
public JobHandler handleBefore(int loopIndex)
loopIndex - A specific loop index.protected boolean isEnded(org.camunda.bpm.engine.runtime.ProcessInstance pi)
pi - The related process instance.true, if the multi instance scope is ended. Otherwise false.protected boolean isSequential()
true, if execution is done sequentially. false, if execution is done in
parallel.protected void registerCallActivityHandler(CallActivityHandler handler)
handler - The handler to be executed next.public T verifyLoopCount(int loopCount)
loopCount - The expected loop count at the point of time when the multi instance is left
(finished or terminated by a boundary event).public T verifyParallel()
public T verifySequential()
Copyright © 2022 Camunda Services GmbH. All rights reserved.