Getting Started

Getting Started

Part 8: Simulating the Process

Part 8: Simulating the Process

To start at the beginning of the tutorial, see Introduction to Process Developer Tutorial.
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:
  • tutorial.bpel
    that you created in Part 2
  • tutorialCompleted.bpel
    , 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.
  1. Open
    tutorial.bpel
    .
  2. Ensure that the Abstract Process property is set as follows:
    1. Select Properties view.
    2. Click on an empty part of the Process Editor (or select
      tutorial
      from the Outline view).
    3. 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.
      Showing Abstract Process set to No
  3. Ensure that Process Developer is reporting BPEL validation tasks, as follows:
    1. Select Window > Preferences > Process Developer > Tasks and Problems.
    2. All BPEL Validation settings should be selected, as shown.
      BPEL validation tasks circled
  4. Validate your file by selecting the Validate Process toolbar button. This action ensures that all validation tasks appear in the Problems view.
    Validate Process toolbar button
  5. Select Problems view.
  6. If an error task exists, such as the one shown in the following example, correct the error, and save your file.
    Example of invalid activity marked with red X icon
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.
  1. 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.
  2. Select Process Variables view.
  3. Open the
    creditInformation
    variable by double-clicking it. You can see the data type definition.
  4. Right-mouse click
    creditInformation
    and select View Data.
  5. Right-mouse click and select Load Data > From Project File.
  6. Select
    CredInfo_Jones5001.xml
    from the sample-data folder.
    Your
    creditInformation
    variable should look similar to the following example.
    Variable view with sample data added
  7. Load
    assessment_low.xml
    sample data file for the
    riskAssessment
    variable.
Step 3: Generating a New Sample Data File for the errorRisk Variable
The
errorRisk
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
loanmessages.xsd
.
  1. In Participants view, select the loanProcessor participant to view the request operation's messages.
  2. Expand the Fault errorMessage.
  3. Select the document part of the fault message, and from the right-mouse menu, select Generate Sample as the illustration shows.
    generate sample menu option on message part in Interfaces
  4. The definition of the message points to a schema element, which was selected by the wizard as shown in the following example:
    XML Data Wizard Preferences page
  5. Leave the remaining preferences as is, since they do not apply to the schema definition of this message, and click
    Next
    .
  6. In the Save Results wizard page, select the
    Tutorial\sample-data
    folder, and name the generated sample data file
    errorSample
    .
  7. Click
    Finish
    , and then expand the Document message part to see the
    errorSample.xml
    file.
    Generated sample data file
    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.
  8. In Process Variables, notice that
    errorSample.xml
    was loaded into the
    errorRisk
    variable.
  9. Your open process variables should look similar to the following:
    Process variables view with sample data added to all messages
Notice the following visual information cues in the Process Variables view:
  • In the Process Variables list,
    bold
    indicates an open variable.
  • The
    errorRisk
    and
    errorApprove
    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.
  1. Click on a blank part of the Process Editor canvas to activate the main toolbar.
  2. Select the Start Simulation icon, as shown.
    Debug perspective with Start Simulation toolbar icon circled
  3. Notice the changes to the Process Developer environment, as shown in the following example.
    Debug perspective annotated
    1
    The perspective switches to a Debug perspective.
    2
    The beginning activity is highlighted
    3
    The current variable is highlighted
    4
    The sample data is cleared
    5
    The
    Debug
    view is opened to run and step through a process
    6
    The Process Console view is opened to report simulation events
  4. In the Debug view, click the Step Into button to continue, as shown.
    Debug view with Step Over toolbar icon circled
  5. 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.
    Simulation path of process via InvokeLoanAssessor
Step 5: Clear the Process Execution State
  1. Click anywhere on a blank part of the Process Editor canvas.
  2. On the main toolbar, click the Clear Process Execution State icon, which is next to the
    Start Simulation
    icon.
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.
  1. Select the Receive activity.
  2. In the Process Variables view, open the
    creditInformation
    variable.
  3. Right-mouse-click and select Load Data > from Project File.
  4. From the sample-data folder, load
    credInfo_Jones15001.xml
    .
    Set Simulation Data dialog
  5. Save and rerun the process.
  6. 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
    approval_approved.xml
    .
  7. Your simulation path should look like the following example:
    Simulation path of process via InvokeLoanApprover
  8. Clear the process execution state.
  9. Inspect the Process Console view to see all simulation events.
  10. 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.
  1. On the Process Editor canvas, select the Invoke Loan Approval activity.
  2. In Properties view, select the All tab, and under Simulation, do the following:
    1. Set Result to Fault.
    2. Set Fault Name to loanProcessFault.
  3. Start simulation and step through the process.
  4. The simulator executes the fault handler, as shown.
    Simulator executing fault handler
  5. In the Process Activities tab, the simulator shows the activity with a fault, as shown.
    Simulation path of process faulted at InvokeLoanApprover
  6. Look at the Process Console view to see execution path events.
  7. Clear the process execution state.
Tip
: 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
amountRequested
to be less than 10000 and re-simulate.

0 COMMENTS

We’d like to hear from you!