5.6 Debugging the product arrangement system

In this section, debug the business process that was defined in 5.5.3 Defining the product arrangement business process, and then check how the business process will be processed.

The following is an overview of debugging the business process described in this section:

  1. Set a break point in an activity.
  2. Deploy the service requester.
  3. Start the HCSC server.
  4. Start the debugger.
  5. Send a request from the service requester to start the processing of the process instance.
  6. Debug each activity.
  7. To debug without calling services, use service emulation.
  8. Finish debugging the business process.
Organization of this section
(1) Setting a break point
(2) Deploying the service requester
(3) Starting the HCSC server
(4) Starting the debugger
(5) Sending a request
(6) Debugging the business process
(7) Service emulation
(8) Finishing the debugging the business process

(1) Setting a break point

Set a break point in the activity at which to stop processing of the process instance.

In this example, set a break point in the invoke service activity (StockAllocation).

The following is the procedure for setting a break point.

  1. On the canvas of the business process definition window, right-click the invoke service activity (StockAllocation), and then select Add Breakpoint.
    A break point is added to the activity. As shown in the following figure, a check mark indicating a break point appears beside the activity icon.

    [Figure]

(2) Deploying the service requester

To send a request, import the Eclipse project of the HelloProductArrangement sample program, and then deploy the service requester on the J2EE server.

The following is the procedure for deploying the service requester.

  1. Stop the HCSC server.
    From the Start menu, select Programs, Cosminexus#, and then Stop Test Server to stop Performance Tracer, J2EE server, and HCSC server (including the standard reception and user-defined reception) in the test environment.
    #
    This program folder name might have been changed. If it was changed, select the changed program folder name.
  2. From the Eclipse menu, select Window, Open Perspective, and then Other.
    The Open Perspective dialog box opens.
  3. Select Java EE (default), and then click the OK button.
    The Java EE perspective opens.
  4. From the menu, select File, and then Import.
    The Select page appears.
  5. In the tree view, select General, and then Existing Projects into Workspace.

    [Figure]

  6. Click the Next button.
    The Import Projects page appears.

    [Figure]

  7. Select the Select root directory radio button, and then click the Browse button.
    The dialog box for selecting a directory opens.
  8. Select the directory that contains the target sample program, and then click the OK button. In this example, the directory to select is as follows: service-platform-installation-directory\CSCTE\Samples\ProductStock
    The Import Projects page appears again. Make sure that the check boxes of all projects are selected.
  9. If the Copy projects into workspace check box is not selected, select it.
    If you do not select this check box, the sample programs might be deleted. Make sure that this check box is selected.

    [Figure]

  10. Click the Finish button.
    The selected projects are imported into the workspace.
  11. In the Servers view, right-click MyServer at localhost, and then select Debug.

    [Figure]

    A message indicating that processing is in progress appears, and then the server starts. If no server is displayed, see 3.5.4(3) Selecting the J2EE server.
  12. In the Servers view, right-click MyServer at localhost, and then select Add and Remove.
    The Add and Remove dialog box appears.
  13. In the Available list box, select ArrangementClient, DeliveryService, and InventoryManagementService, and then click the Add button.

    [Figure]

  14. Click the Finish button.
    A message indicating that processing is in progress appears. After processing finishes, the Java EE perspective appears again.
    When you have completed the setting, confirm that the projects ArrangementClient, DeliveryService, and InventoryManagementService are displayed under MyServer at localhost in the Servers view.

(3) Starting the HCSC server

Before starting the debugger, start the HCSC server.

  1. Start the HCSC server.
    From the Start menu, select Programs, Cosminexus#, and then Start Test Server to start Performance Tracer, J2EE server, and HCSC server (including the standard reception and user-defined reception) in the test environment.
    #
    This program folder name might have been changed. If it was changed, select the changed program folder name.

(4) Starting the debugger

The following is the procedure for starting the debugger.

  1. From the Eclipse menu, select Run, and then Debug Configurations.
    The Debug Configurations dialog box appears.
  2. In the menu of the Debug Configurations dialog box, right-click HCSC-BP, and then select New.
  3. Enter any name in Name, and then select ProductArrangement from the Debug target drop-down list.

    [Figure]

  4. Click the Debug button.
    The account authentication window appears.
  5. Enter admin in both User ID and Password, and then click the OK button.
    A message indicating that processing is in progress appears. When you start the debugger again, the account authentication window does not appear, but processing immediately starts.
  6. Click the OK button.
    The debugger starts.

(5) Sending a request

Send a request from the service requester to start the processing of the process instance.

The following is the procedure for sending a request.

  1. Access the following URL with a browser:
    http://localhost/ArrangementClientWeb/index.html
    The window for running the HelloProductArrangement sample program opens.
  2. Select the product name and quantity.

    [Figure]

  3. Click the Arrangement button.
    The dialog box asking you whether to switch the perspective appears.
  4. Click the Yes button.
    The view that displays debugging information and variables appears, and the processing of the process instance starts.
    The processing of the process instance stops at the invoke service activity (StockAllocation). On the canvas of the business process definition window, the icon color of the activity changes as shown as follows to indicate that processing is temporarily stopped.

    [Figure]

(6) Debugging the business process

If processing of the process instance is temporarily stopped, you can debug in the following window.

Figure 5-2 Business process debugging window

[Figure]

The following table shows the operations that can be performed during debugging of a business process.

Table 5-11 Operations that can be performed during debugging of a business process

ItemDescription
Check variables and correlation setsYou can check the variables and correlation sets that are currently used in the business process.
Update variablesYou can update the values of the variables that are currently used in the business process.
Step over and resumeIn the Debug view, you can perform the operations below. Use these operations to debug each activity.
  • Step-in ([Figure])
    Moves processing to the next activity. If the step-in operation is performed for a switch start activity, processing moves to the first-branch activity.
  • Step-over ([Figure])
    If the step-over operation is performed for a switch start activity, the activities up to the corresponding switch end activity are processed at one time. If the step-over operation is performed for an activity other than a switch start activity, the same operation as the step-in operation is performed.
  • Step-return ([Figure])
    If the step-return operation is performed for an activity that is subordinate to a scope activity or while activity, the activities up to the next activity to that scope or while activity are processed.
  • Resume ([Figure])
    Resumes the processing of the process instance up to the activity at which the next break point is set.
Emulate servicesYou can emulate services by using already-created response messages.
For details about the procedure for emulating services, see (7) Service emulation.

(7) Service emulation

To debug without calling services, enable service emulation. If you enable service emulation, you can use already-created response messages instead of calling actual services.

Service emulation allows you to execute a business process even when services called by the business process do not exist.

You can enable service emulation while the processing of the process instance is temporarily stopped. This subsection describes the procedure for emulating the StockAllocation service on the assumption that the processing of the process instance is temporarily stopped at an invoke service activity (StockAllocation).

The following is the procedure for emulating the StockAllocation service.

  1. Create an XML file.
  2. Display the HCSC emulation view.
  3. Use the created XML file to execute service emulation.

Before you execute service emulation, you must start the debugger and send a request from the service requester.

(a) Creating an XML file

Create an XML file that will be used as a service response.

The following shows how to create an XML file.

  1. From the Eclipse menu, select File, New, and then Other. In the dialog box that appears, select General, and then File.
    The New File dialog box appears.
  2. In the New File dialog box, select the directory in which to save the XML file.
  3. In File name, enter any file name (with a file name extension of xml).
  4. Click the Finish button.
    An XML editor appears.
  5. In the XML editor, click the Source tab, and then enter the following code ([Figure]: single-byte space):

    <?xml[Figure]version="1.0"[Figure]encoding="UTF-8"?><reserveItemResponse[Figure]xmlns="http://sample/InventoryManagementService"[Figure]><ReservationNumber>R00000001​</ReservationNumber></reserveItemResponse>

  6. From the menu, select File, and then Save.
    The XML file is saved.
(b) Displaying the HCSC emulation view

You can emulate services in the HCSC emulation view.

The following is the procedure for displaying the HCSC emulation view.

  1. From the Eclipse menu, select Window, Show View, and then Other.
    The Show View dialog box appears.
  2. Select Debug, and then HCSC Emulate. Then, click the OK button.
    The HCSC emulation view appears.
(c) Emulating a service
  1. In the Debug view, select Stock Allocation (invoke service activity).
  2. In the HCSC emulation view, click the Add button.
    A line is added to the table in the HCSC emulation view.
  3. Select the Response Type cell, and then select Normal Response.
  4. Select the Response Message cell, and then click the ... button.
    The Select files dialog box appears.
  5. Select the created XML file, and then click the OK button.
  6. Click the Step Over button.
    The response from the invoke service activity (StockAllocation) is emulated.
    The processing of the process instance proceeds to the switch start activity (CheckStockAllocationResult).

To proceed to the subsequent activities, use the Debug view. For details, see (6) Debugging the business process.

(8) Finishing the debugging the business process

Finish debugging the business process.

The following is the procedure for finishing the debugging of the business process.

  1. In the Debug view, select ProductArrangement, and then click the Finish icon.

    [Figure]

    Debugging of the business process finishes.