Open a B-unit file in the B-unit editor, and select Invokes from the Outline view. To add an invoke, right-mouse click on BPEL Unit.
A common use case for an invoke is to provide a simulated response for a service that your process is invoking. When an invoke activity within the process executes, the B-unit engine looks for a matching invoke element within the B-unit file. If found, this invoke element provides the ability to do assertions on the input data passed to the invoke as well as provide a message that simulates the response from the service invoke.
B-unit invoke elements can be configured for one-way and two-way service invokes. Both styles of invokes can have assertions on the input data but only two-way service invokes are allowed to have a response.
You can define an invoke for a B-unit test as follows:
Select or add an Invoke. Add an Invoke by right-mouse clicking on BPEL Unit.
Specify the Name or
ocation Path of the invoke. If this activity is within a loop (for example, a For Each), you can specify a Count for the expected number of times to execute the activity. Specify a Delay if you want to delay before returning the response. The delay allows for better handling of onEvent and onAlarm events.
Add a default iteration.
Add the Response type expected:
e. Specify the Output data.
. The invoke is a BPEL process, deployed as a subprocess, making the main process eligible for termination and compensation handling.
. The invoke is a BPEL process, deployed as a "process" invoke handler.
. The invoke returns a fault.
. Specify a Label that is documentation for this Assert, message part and query for the assert, and a Pattern to match on.
. Specify the input data passed to the invoke.
Some information about a message and its associated parts are generated automatically in the B-unit editor when you perform certain actions including:
Fill in values for process name, partner link and operation for a Send Message.
Select Simulated Response for an invoke assertion (or extension assertion).
Select a fault name for a Simulated Fault.