Working with business objects

To test whether a business process interface has been developed correctly, you need to verify that business objects can be successfully exchanged and processed. This section describes how to:

Working with request business objects

Request business objects are those that you send from Test Connector when it is emulating a connector that is the source of the events that trigger an interface. Working with request business objects consists of creating a business object instance, populating it with data, and sending the request.

Creating request business objects

To create a new business object in Test Connector, do the following:

  1. In the "Supported Business Objects" pane, select the name of the business object you want to create from the BOType drop-down menu.
  2. Click Create next to the BOInstance field.
  3. When presented with the "New Instance" dialog, type a name for the instance in the Enter Name field.
  4. Select the desired verb from the Verb drop-down menu.
  5. Select the desired locale from the the BOLocale drop-down menu.
  6. Provide values for the simple attributes and child business objects within the top-level object, as described in Setting values for business object attributes.
  7. Click OK.

Sending request business objects

Once you have created or loaded a business object and specified values for its attributes, you have several ways to send the business object as a request to the integration broker.

Sending request business objects asynchronously

When a source connector sends a request business object in asynchronous mode, it does not expect to get back a response business object. Once the request business object is dispatched, the source connector's role in the transaction is finished. The response business object is typically processed by the integration broker. The default mode for Test Connector is asynchronous.

To send a business object asynchronously, do the following:

  1. Select Request > Mode >Asynchronous from the menu bar.
    Note:
    Test Connector operates in "Asynchronous" mode by default, so you only have to perform this step if you previously were sending synchronous requests from the connector. Furthermore, you do not have to set the mode before sending each request.
  2. Select Request > Send from the menu bar.

The business object request is sent to the server for processing.

Sending request business objects synchronously

When a source connector sends a request business object synchronously, it expects to get back a response business object from the integration broker after any destination applications have processed the request. In synchronous mode, Test Connector puts the response business object on the queue specified by the source connector's Synchronous Request Queue property. The default mode for Test Connector is asynchronous.

  1. Set Test Connector to synchronous mode by selecting Request > Mode > Synchronous from the menu bar.
  2. Select Request > Send from the menu bar.
  3. If the broker specified in the connector definition is InterChange Server Express then the "Select Collaboration" dialog is displayed. Select the collaboration to which the business object should be sent from the Collaboration drop-down menu and click OK.

The business object request is sent to the configured port of the collaboration object chosen for processing.

Sending request business objects in batch mode

In batch mode, Test Connector lets you specify the number of instances of a particular business object you want to send, as well as one attribute in the top-level object --a primary key attribute, for example--that you want set to a unique value for each instance. Test Connector copies the business object as many times as you have specified, incrementing the value of the single attribute you specified, and sends each business object. This option allows you to create a large number of business objects quickly and easily.

If the selected attribute is a key field that participates in dynamic cross-referencing as part of an identity relationship, then you must guarantee that the initial value and all those that follow it are unique. Otherwise, the cross-referencing logic will fail, causing the request business objects to fail.

To ensure that the values are unique, you can use Relationship Manager or execute SQL statements against the table for the relationship participant as follows.

To send business objects in batch mode, do the following:

  1. Select the name of the business object you would like to send from the BOType drop-down menu.
  2. Select Request > Send Batch from the menu bar.
  3. In the "Batch Mode" window, select from the Attribute list the attribute in the top-level business object that you want incremented with each business object request in the batch.

    The selected attribute should typically be an attribute that uniquely identifies the business object, such as a primary key.

  4. In the Initial Value field, type the starting value for the attribute to be incremented.
  5. In the No. of BO's field, type the number of business object instances you want generated and sent.
  6. Click OK.

    Test Connector generates the number of business objects you specified, all identical with the exception of the one specified attribute, whose value is incremented for each instance. Then the business object request is sent to the server for processing.

Setting values for business object attributes

The following sections describe the various ways you can set the values of simple and compound attributes in a business object instance:

Setting values for simple attributes

To provide a value for a simple attribute, click its cell in the Value column and enter a value.

Adding child business objects

To add an instance of a child business object, right-click the attribute that represents the child object and select Add Instance from the context menu.

A plus sign (+) is added next to the attribute that represents child business object to show that there is at least one child business object instance. If you expand the child object attribute, numbered entries are displayed for each instance. The individual instances also have plus signs (+) next to them, so you can expand them and set values for their attributes.

To add more child business object instances, right-click the attribute that represents the child object and select Add Instance from the context menu.

Note:
If the Card property of the attribute that references the child business object is set to the value 1 (indicating it is of single-cardinality), then you will only be able to add one instance of the child object.

Removing child business objects

To remove an instance of a child business object, right-click the instance and select Remove Instance from the context menu.

To remove all instances of a child business object, right-click the attribute that represents the child business object and select Delete All Instances from the context menu.

Setting the verb of a child business object

You can set the verb of a child business object to test the effect that value has on the business process. This can be helpful when you are troubleshooting logic that involves the cross-referencing of child objects.

To set the verb of a child business object instance, right-click it and choose Set Verb from the context menu. When presented with the "Select Verb" prompt, selected the desired verb and click OK.

Using the Response BO toolbar

You can edit the attributes of a business object received by a destination connector before you send it as a response. The toolbar of the "Response BO" dialog that you use when doing so has several toolbar buttons that can be used to set the values of the business object. For more information, see Editing response business objects.

Saving a business object

You can save a business object in Test Connector so that it can be used for later tests, shared with technical support (to help troubleshoot problems), or used as response data. You can save any business object, including ones that you have created and ones that appear as requests in the Test Connector window of a destination connector. By default, business objects are saved to a file with a business object extension (.bo).

It is recommended that you create a directory or directory structure specifically for test data files, with subdirectories dedicated to each interface or to each connector, as appropriate. This organization makes the necessary files are easy to locate and makes testing more efficient. Furthermore, it is recommended that you give the test data file for a business object the same name as the business object definition itself.

Saving business object requests

Do the following to save a business object instance that you have created as a request:

  1. Select the business object you want to save.
  2. From the menu bar, select Edit > Save BO.
  3. Navigate to the desired directory and specify a name for the file in the File name field.
  4. Click Save.

Saving business object responses

Do the following to save a business object instance that has been received by a destination instance of Test Connector and will be sent as a response:

  1. Select the business object instance in the "BO Request List" pane.
  2. Select Request > Edit Response from the menu bar.
  3. Click Save BO.
  4. Navigate to the desired directory and specify a name for the file in the File name field.
  5. Click Save.

Loading a business object

To load a business object that has been saved to a file, do the following:

  1. Select Edit > Load BO from the menu bar of Test Connector.
  2. Navigate to the business object test data file and open it.
  3. When presented with the "New Instance" dialog, type a name for the instance in the Enter Name field.
  4. Click OK.

Deleting a business object

To delete a business object from Test Connector, select Edit > Delete BO from the menu bar.

Note:
This action only removes the business object from the Test Connector. It does not remove the connector's support for the business object definition.

Accepting a request business object

When you send a business object as a request, the business object appears in the "BO Request List" pane of any Test Connector instances that are emulating destination connectors in the interface, provided that the transaction did not fail.

After you have accepted the request business object, you can edit it if necessary as described in Editing response business objects.

Working with response business objects

Response business objects are those that you send from Test Connector when it is emulating a connector that is the recipient of business object requests in an interface. Working with request business objects consists of editing the values in the business object instance and sending the response back to the broker.

Editing response business objects

When you receive a business object request in a destination instance of Test Connector, you commonly want to edit the values of the attributes. For instance, you will want to provide unique values for primary key attributes that participate in relationships, or you will want to modify the value of other attributes to test map or collaboration logic that responds differently depending on the exact values in the business object. Do the following to set the values of business object attributes :

  1. Select the business object instance in the "BO Request List" pane.
  2. Select Request > Edit Response from the menu bar.
  3. Do the following to edit the attributes of the business object:

Sending a response business object

After you accept a request business object, edit the business object, if needed, and send it back as a reply.

Table 11 lists Test Connector's reply options and shows their corresponding connector return codes for both C++ and Java connectors.

Table 11. Test Connector reply types and connector return codes.

Test Connector reply type C++ connector return code Java connector return code
Success BON_SUCCESS SUCCESS
Fail BON_FAIL FAIL
Multiple Hits BON_MULTIPLE_HITS MULTIPLE_HITS
Retrieve By Content Fail BON_FAIL_RETRIEVE_BY_CONTENT RETRIEVEBYCONTENT_FAILED
Not Found BON_BO_DOES_NOT_EXIST BO_DOES_NOT_EXIST
Value Duplicate BON_VALDUPES VALDUPES

To reply to a request business object, do the following:

  1. Select the business object in the "BO Request List" pane.
  2. From the menu bar, select Request > Reply.
  3. Select an item from the Reply submenu.

Comparing business object instances

Test Connector can compare two business objects of the same type and display the attributes that differ in value. You can use this function to view changes to a business object at different points in the execution of a transaction (for instance, you could compare a business object that has been sent to the integration broker with the same business object after the integration broker has updated it). To compare two business objects, do the following:

  1. Create a request business object instance by following the instructions in either Creating request business objects or Loading a business object.
  2. Select the response business object instance in the "BO Request List" pane that you would like to compare the request business object instance to.
  3. From the menu bar, select Edit > Compare BO's.

    Test Connector opens the "Compare Business Objects" window with a table that displays the attributes which have different values in the two business objects.

  4. Click OK to close the window.

Copyright IBM Corp. 2003