ActiveBPEL® Designer User’s Guide

Tutorial Part 8: Simulating the Process

To start at the beginning of the tutorial, see Introduction to ActiveBPEL 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:

By completing Part 8 of the tutorial, you will be able to:

Step 1: Complete the prerequisite checklist for simulation

ActiveBPEL 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 and Suppress Join Failure properties are 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.
    4. Note that Suppress Join Failure is set to Yes. This allows you to test various simulation paths without testing that all links to an activity are true.
  3. Ensure that Designer is reporting BPEL validation tasks, as follows:
    1. Select Window>Preferences>ActiveBPEL>Tasks and Problems.
    2. All BPEL Validation settings should be selected, as shown.

    BPEL validation tasks circled

  4. In the Process Editor canvas, move an activity slightly. This action requires that your file must be saved. Save your file to ensure that all validation tasks appear in the Problems view.
  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.
  7. 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. ActiveBPEL 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 Interfaces view. 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 have already been created for you to test with. We 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 Files.
  6. Select CredInfo_Jones5001.xml.
  7. Your creditInformation variable should look similar to the following example.

    Web References Messages view with sample data added

  8. Load assessment_high.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 the appropriate references to the data type definition. We will automatically generate a valid data file using the XML Data Wizard, as you can do with any variable to create your own samples. Furthermore, this step is similar to generating literal contents for the Copy Operation, as we did in Part 5 of the tutorial. This wizard uses the type definition located in loanmessages.xsd.

  1. In Interfaces view, select the LoanProcessLT to view the request operation’s messages.
  2. Expand errorMessage.
  3. Select the document part of the fault message, and from the right-mouse menu, select Generate Sample as the illustration shows.
  4. generate sample menu option on message part in Interfaces

  5. The definition of the message points to a schema element, which has been selected by the wizard as shown in the following example:
  6. XML Data Wizard Preferences page

  7. Leave the remaining preferences as is, since they do not apply to the schema definition of this message, and click Next.
  8. In the Save Results wizard page, select the Tutorial\sample-data folder, and name the generated sample data file errorCode.
  9. Click Finish, and then expand the Document message part to see the errorCode.xml file.
  10. Generated sample data file

    If you wish to view the contents of the data file, right-mouse click it, and select View Sample. The XML file opens in the editor. Close the file when you are done.

  11. In Process Variables, load errorCode.xml into the errorRisk variable.
  12. Your open process variables should look similar to the following:
  13. Process variables view with sample data added to all messages

Notice the following visual information cues in the Process Variables view:

Step 5: 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.
  3. Debug perspective with Start Simulation toolbar icon circled

  4. Notice the changes to the ActiveBPEL environment, as shown in the following example.
  5. 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 Console is opened to report simulation events

  6. In the Debug view, click the Step Over button to continue, as shown.
  7. Debug view with Step Over toolbar icon circled

  8. Step through your process, inspecting process variables as each activity is executed. The simulator stepped through the loan assessor path because the loan amount requested was less than $10,000. The Process Editor canvas should look like the following example when you are done.
  9. Simulation path of process via InvokeLoanAssessor

Step 6: 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 7: Override Default Values for Different Test Scenarios

The simulation path went through the loan assessor’s service using the default sample data value of 5001. To test the loan approver’s path, do the following.

  1. Select the Receive activity.
  2. In the Properties view All tab, select Input Message, under the Simulation heading.
  3. Click the button at the end of the Input Message row.
  4. In the Set Simulation Data dialog, enable the check box for Override sample data for simulation.
  5. In the Sample column, select the Dialog button.
  6. Select to load data from the Project, and from the sample-data folder, load credInfo_Jones15001.xml.
  7. Set Simulation Data dialog

  8. Rerun the process.
  9. Notice that the simulation engine informs you that sample data is missing from the approver. Open the approval variable in Data view, and load approval_approved.xml.
  10. Your simulation path should look like the following example:
  11. Simulation path of process via InvokeLoanApprover

  12. Clear the process execution state.
  13. Inspect the Console to view all simulation events.
  14. From the Debug view toolbar, select Remove All Terminated Launches.

Step 8: Simulate Fault Handling

In the loan approval process, a fault is thrown if the loan approver’s or assessor’s service cannot handle the customer request. In Tutorial Part 6: Adding Fault Handling, you added two fault handler to catch this fault and send a reply containing an error code. We will simulate this.

  1. On the Process Editor canvas, select the Invoke Loan Approver activity.
  2. In Properties View, 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.
  5. Simulator executing fault handler

  6. On the Process Activities tab, the simulator shows the activity with a fault, as shown.
  7. Simulation path of process faulted at InvokeLoanApprover

  8. View the Console to see execution path events.
  9. Clear the process execution state.

Tip: You can also simulate fault handling for the loan assessor service. The same fault message is defined for both the loan approver and the loan assessor service.

To simulate fault handling for the loan assessor service, select the Invoke 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. Be sure to deselect the Override checkbox in the Set Simulation Data dialog, if you do not use that dialog box to change the data.

Continue to Tutorial Part 9: Deploying the Process.