Content starts here Test an Update Procedure
This page last changed on Mar 11, 2008.

eDocs Home > BEA AquaLogic Data Services Platform Documentation > Data Services Developer's Guide > Contents

How To Test an Update Procedure

This topic describes how to test an Update procedure in Test view in Studio.

Configure Audit Properties

To test an Update procedure in Studio, you must submit a data graph in the Parameters box in Test view. A data graph is an XML structure with a root element of <sdo:datagraph> and a <changesummary> element. The easiest way to submit a data graph is to capture one from an audit.

First, configure audit properties in the ALDSP Console.

Configuring Audit Properties in the ALDSP Console

To configure audit properties so that ALDSP generates data graphs: 

  1. Open the ALDSP Console and log in.
  2. Click the name of a data space project.
  3. Click the Audit Properties tab.
  4. Click Lock & Edit in the upper left pane.
  5. Navigate to the Update > Service node (be careful not to move to Update > Error > Procedure).
  6. For Name, Parameters, and Result, choose Always from the Is Audited menu.
  7. Click Save.
  8. Click Activate Changes in the upper left pane.

Capture the Data Graph

You can then capture a data graph from the audit messages displayed in the Studio Console tab, and edit the data graph to submit to the Update procedure in Test view.

Viewing a Data Graph in the Studio Console Tab

To capture a data graph:

  1. Open a logical data service in Studio.
  2. Click the Test tab.
  3. Choose the service's primary Read function, then click Run.
  4. Click Edit, edit a value, then click Submit.
  5. (Optional) Check the Studio Console tab.
    If you see the WebLogic Server console data, not the ALDSP console data, click the drop-down arrow next to the console icon , and choose ALDSP Console.
  6. Scroll up in the Studio Console tab until you locate the data graph, right-click, and copy it.

Submit the Update

When you update relational sources, the SDO update mechanism uses optimistic locking to avoid change conflicts. With optimistic locking, the data source is not locked when the SDO client acquires the data. Later, when the client wants to update, the data in the source is compared to a copy of the data at a time when it was acquired. If there are discrepancies, the update is not committed. Before you submit the data graph to the Update procedure, be sure that optimistic locking is enabled in the underlying data source you are updating.

You can then submit the data graph to the Update procedure. However, you may need to edit it, as the data graph you captured from the Studio Console tab reflected the last change you made, not the change you are presently submitting to the Update procedure.

Submitting the Data Graph to the Update Procedure

The data graph you submit to the Update procedure takes the place of the return type as an argument, even if you are updating only some of the elements in the return type.

To submit the data graph to an Update procedure:

  1. Enable optimistic locking on any physical relational data sources the data graph is updating.
  2. Open a data service in Studio, and click the Test tab.
  3. At Select Operation, choose an Update procedure.
  4. Copy a data graph you have captured from the Studio Console tab to the Parameters box.
  5. Edit the data graph for the change you want to make.
    The data graph you captured applies to a change made in the visual interface. Update the change summary to the values the object presently has, and the remaining elements to the new values you want to set. For example, this is a change summary captured from the Studio Console tab:
<sdo:datagraph xmlns:sdo="commonj.sdo">
      <sim:SIMPLE_CUSTOMER sdo:ref="#/sdo:datagraph/sim:SIMPLE_CUSTOMER" xmlns:sim="ld:logical/SimpleCustomer">
  <sim:SIMPLE_CUSTOMER xmlns:sim="ld:logical/SimpleCustomer">

This version has been updated in the Parameters box (note the difference in the CUSTOMER_SINCE dates):

<sdo:datagraph xmlns:sdo="commonj.sdo">
      <sim:SIMPLE_CUSTOMER sdo:ref="#/sdo:datagraph/sim:SIMPLE_CUSTOMER" xmlns:sim="ld:logical/SimpleCustomer">
  <sim:SIMPLE_CUSTOMER xmlns:sim="ld:logical/SimpleCustomer">
  1. Click Run. You should see this message in Test view:
    Operation was successful.

See Also

How Tos
Other Resources
Document generated by Confluence on Apr 28, 2008 15:57