If you have followed all tutorial parts so far, you have completed a BPEL process definition that contains all the steps for normal and fault processing.
Now you will turn from the design phase to the testing phase by simulating execution of your process.
In the Project Explorer view, you should have the following files:
that you created in Part 2
, a completed version of the file (optional)
After completing Part 8 of the tutorial, you will be able to:
Complete the prerequisite checklist for simulation.
Add sample data files for WSDL message parts.
Display data values for process variables.
Simulate execution of a BPEL process.
Test all execution paths in a process by overriding default data values.
Step 1: Complete the Prerequisite Checklist for Simulation
Process Developer validates your BPEL process before you execute it, adding validation tasks to the Problems view for you to complete. The tasks are broken down into errors, warnings, and information. You must ensure your process is executable, and you must complete all error tasks before running your process.
Ensure that the Abstract Process property is set as follows:
Select Properties view.
Click on an empty part of the Process Editor (or select
from the Outline view).
Select the All tab in the Properties view and note that Abstract Process is set to No to indicate that the process should be validated for execution.
Ensure that Process Developer is reporting BPEL validation tasks, as follows:
Select Window > Preferences > Process Developer > Tasks and Problems.
All BPEL Validation settings should be selected, as shown.
Validate your file by selecting the Validate Process toolbar button. This action ensures that all validation tasks appear in the Problems view.
Select Problems view.
If an error task exists, such as the one shown in the following example, correct the error, and save your file.
Step 2: Load Sample Data Files for the Messages
To simulate process execution, you need to initialize process variables. Process Developer has a convenient way to provide default data values and ways to override the defaults for different test scenarios.
When you create an orchestration project, you can add sample data files into the Process Variables view (or into the Project Explorer). The sample data is registered and is available for all processes that use the messages.
Expand the sample-data folder in the Tutorial project. Note that several files were created for you to test with. You will load some of these files into variables for different test scenarios.
Select Process Variables view.
variable by double-clicking it. You can see the data type definition.
and select View Data.
Right-mouse click and select Load Data > From Project File.
from the sample-data folder.
variable should look similar to the following example.
sample data file for the
Step 3: Generating a New Sample Data File for the errorRisk Variable
variable, as all the other variables, is defined with a schema complex type and requires namespace-qualified sample data. This means the sample data file must contain references to the data type definition. You will automatically generate a valid data file using the XML Data Wizard, as you can do with any variable to create your own samples. This step is similar to generating literal contents for the Copy Operation, as you did in Part 5 of the tutorial. This wizard uses the type definition located in
In Participants view, select the loanProcessor participant to view the request operation's messages.
Expand the Fault errorMessage.
Select the document part of the fault message, and from the right-mouse menu, select Generate Sample as the illustration shows.
The definition of the message points to a schema element, which was selected by the wizard as shown in the following example:
Leave the remaining preferences as is, since they do not apply to the schema definition of this message, and click
In the Save Results wizard page, select the
folder, and name the generated sample data file
, and then expand the Document message part to see the
If you wish to view the contents of the data file, right-mouse click it, and select Open. The XML file opens in the editor. Close the file when you are done.
In Process Variables, notice that
was loaded into the
Your open process variables should look similar to the following:
Notice the following visual information cues in the Process Variables view:
In the Process Variables list,
indicates an open variable.
variables are two-toned, indicating they are available only as fault variables.
Step 4: Simulate Process Execution
If you have completed all previous steps in this part of the tutorial, you are ready to begin simulating execution of your process.
Click on a blank part of the Process Editor canvas to activate the main toolbar.
Select the Start Simulation icon, as shown.
Notice the changes to the Process Developer environment, as shown in the following example.
The perspective switches to a Debug perspective.
The beginning activity is highlighted
The current variable is highlighted
The sample data is cleared
view is opened to run and step through a process
The Process Console view is opened to report simulation events
In the Debug view, click the Step Into button to continue, as shown.
Step through your process, inspecting process variables as each activity is executed. The simulator stepped through the low risk path because Jones is a low risk and the loan amount requested was less than $10,000. The Process Editor canvas should look like the following example when you are done.
Step 5: Clear the Process Execution State
Click anywhere on a blank part of the Process Editor canvas.
On the main toolbar, click the Clear Process Execution State icon, which is next to the
Step 6: Override Default Values for Different Test Scenarios
The simulation path went through the risk assessor's service using the default sample data value of 5001. To test the loan approval path, do the following.
Select the Receive activity.
In the Process Variables view, open the
Right-mouse-click and select Load Data > from Project File.
From the sample-data folder, load
Save and rerun the process.
Notice that the simulation engine informs you that sample data is missing from the approval service, and presents a list of valid data files that match the message. Select
Your simulation path should look like the following example:
Clear the process execution state.
Inspect the Process Console view to see all simulation events.
From the Debug view toolbar, select Remove All Terminated Launches.
Step 7: Simulate Fault Handling
In the loan approval process, a fault is thrown if the loan approval or risk assessment service cannot handle the customer request. In
Tutorial Part 6: Adding Fault Handling
, you added two fault handlers to catch this fault and send a reply containing an error code. You will simulate this.
On the Process Editor canvas, select the Invoke Loan Approval activity.
In Properties view, select the All tab, and under Simulation, do the following:
Set Result to Fault.
Set Fault Name to loanProcessFault.
Start simulation and step through the process.
The simulator executes the fault handler, as shown.
In the Process Activities tab, the simulator shows the activity with a fault, as shown.
Look at the Process Console view to see execution path events.
Clear the process execution state.
: You can also simulate fault handling for the risk assessment service. The same fault message is defined for both the loan approval and the risk assessment service.
To simulate fault handling for the risk assessment service, select the Invoke Risk Assessor activity and set the Result property to Fault and set the Fault Name. Change the sample data file to use an
to be less than 10000 and re-simulate.