Behavior tab

This tab enables you to add reusable behavioral entities, that is, pre-programmed intelligence, to your stub.
Note: This tab is not displayed when editing a deterministic stub.

A behaviour can act as a source of events that cause a stub to execute an operation that is not a reaction to an incoming message from an external system. For example, you might want to create a stub that can proactively publish messages that are not just "responses" to an incoming message.

After you have defined one or more behaviors on the Behaviour tab, you can use them as "events" on the Events tab.

The upper half of the Behaviour tab comprises:

The lower half of the tab comprises a Configuration window that displays details about any behavioral entity with custom instance names.

The following table outlines the default behaviour-types that are supplied with IBM® Rational® Integration Tester.

Behaviour-Type Description
Lifecycle This enables you to execute certain actions when the currently selected stub starts up or shuts down.

For example, you can set up and later clean up any resources that may be required by the stub.

Timer This enables you to set up a timer that schedules a future callback after a specified delay so that the stub will receive an event to which it can respond.
Note: Callback timer settings for a stub can be overridden for each event created for the stub (for information about this, refer to Events tab).
Note: Rational Integration Tester provides the means to create additional custom behaviors. For more information about this, refer to Creating behaviors.

The following table describes the buttons on the upper half of the Behaviour tab.

Button Description
Add Clicking this button opens the Add Behavioral Entity dialog box.

Add Behavioral Entity dialog box
The upper left side of the Add Behavioral Entity dialog box displays the available behaviour-types. The upper right side of the Add Behavioral Entity dialog box displays a description for each selected behaviour-type.

The default available behaviour-types are as follows:
  • Lifecycle
  • Timer

The lower half of the Add Behavioral Entity dialog box displays the available sample behaviors for the currently selected behaviour type. The Instance field is used to refer to the behavioral entity in function actions. This field is an optional field that enables you to create multiple instances of a behaviour. Based on the selected behavior, a default instance name is displayed. If required, you can specify a different instance name.

The following type of behaviors are listed:
  • Functions: The functions are indicated with the right arrows functions and can be called within the function script in the business logic view of the stub events. The three functions that can be called within scripts are: scheduleTimerEvent, scheduleRepeatingTimerEvent, and cancelTimerEvent.
  • Events: The events are indicated with the left arrows functions and can be selected in the Events tab to perform business logic or send a message when the event occurs. The callback named onTimerEvent, provides an event to the stub when a timer runs out.
An example of calling a Function Action from the logon event for setting a timer to log out the user from a session after a period of time.
logoffTimer.scheduleTimerEvent("logOutSession", tags["SESSION/KEY/sessionID"], 30, java.util.concurrent.TimeUnit.SECONDS)
In this example:
  • logoffTimer is the name of the instance. This instance must be added to the onTimerEvent, which is displayed as logoffTimer.onTimerEvent to the Events tab and executed when the specified time period has elapsed.
  • The value of tags, ["SESSION/KEY/sessionID"], is evaluated at the point when the timer is started and is passed as the parameter to the event's input tab.
  • logOutSession is the identifier for this timer that is passed to the Input tab of the onTimerEvent event.
  • logOutSession identifier can also be used as a parameter of the cancelTimeEvent function to cancel the timer
Note: To select multiple behaviors for a behavioral entity, hold the CTRL key and click each behaviour after selecting a behaviour-type on the upper left side of the Add Behavioral Entity dialog box.

After specifying the properties of a behaviour, click Add to complete creating the behaviour and to close the Behaviour dialog box.

Note: In addition to being displayed on the list window on the upper left side of the Behaviour tab, each newly created behavioral entity also has its events (qualified by the name of the behaviour instance) available as values in the Events field on the Events tab for the stub. For more information, see Events tab.
Edit Clicking this button opens the Edit Behavioral Entity dialog box, which enables you to modify instance details for the selected behavioral entity.
Delete Clicking this button deletes any behavioral entities selected in the list window on the tab.
Note: To select multiple behavioral entities for deletion, hold down CTRL and click each entity.

Feedback