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
L
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:
Simulated Respons
e. Specify the Output data.
Subprocess
. The invoke is a BPEL process, deployed as a subprocess, making the main process eligible for termination and compensation handling.
Process
. The invoke is a BPEL process, deployed as a "process" invoke handler.
Simulated Fault
. The invoke returns a fault.
Add Asserts.
Assert Match
. Specify a Label that is documentation for this Assert, message part and query for the assert, and a Pattern to match on.
Assert Equals
. Specify the input data passed to the invoke.
About Message Part Data
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).