Skip Headers
Oracle® Application Testing Suite OpenScript User's Guide
Version 9.01 for Microsoft Windows (32-Bit)

Part Number E15488-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

13 Using the Shared Data Module

This chapter provides instructions on using the OpenScript Shared Data Module, which allows data to be passed between scripts using a shared data queue.

About the Shared Data Module

The Shared Data Module is an extension module to the OpenScript Basic Module that extends the other testing modules with message queue and hash map capabilities.

The "Shared Data" is in memory space that resides in the Oracle Load Testing for Web Applications server and is managed by a "Shared Data Manager". The Shared Data Service supplies methods for users to store/retrieve data in a memory space that resides in Oracle Load Testing for Web Applications. The methods send messages to the Shared Data Manager in Oracle Load Testing for Web Applications through the JMS server. There are two JMS topics configured in a JMS configuration file for WebLogic that are used for the communication: "topic/requestSharedData" and "topic/responseSharedData". They are created by the WebLogic server startup process and destroyed once the server is stopped.

The scripts or java agents send messages to the "topic/requestSharedData" and receive messages from the "topic/responseSharedData". The Shared Data Manager sends to the "topic/responseSharedData" and receives from "topic/requestSharedData". The messages are serializable java objects. Agents send request messages that request data or request to store data. The Shared Data Manager sends response messages that contain the requested data.

Shared Data is typically used to pass data between load testing scripts running as Virtual Users in Oracle Load Testing for Web Applications. The Shared Data can also be used to pass data between functional testing scripts running from the command line.

Key Features of the Shared Data Module

The Shared Data module provides the following features:

  • Preferences - shared data connection preferences can be set under the OpenScript Playback preferences.

  • Message Queue Manipulation - create, peek, and poll message queues.

  • Hash Map Manipulation - create, put, and get hash maps.

  • Shared Data Module API - The Shared Data Module API includes a "sharedData" class that provides additional programming functionality.

Setting Shared Data Preferences

To set Shared Data preferences:

  1. Start OpenScript.

  2. Select OpenScript Preferences from the View menu.

  3. Expand the OpenScript node and the Playback category.

  4. Select Shared Data.

  5. Set the Shared Data Preferences as follows:

    • OATS Credential: Specifies the authentication credentials to use to establish the communication between the shared queue and the Virtual User.

      • Address: Specifies the address of the Oracle Load Testing for Web Application server to use for the shared data service.

      • User name: Specifies the user name to use for authentication. The default name is oats unless changed in the Oracle Application Testing Suite configuration.

      • Password: Specifies the password to use for authentication. This should be the same password specified in the Encryption setting of the General preferences if the Encrypt script data setting is selected.

    • Actions on Shared Data: Specifies actions on shared data.

      • Timeout: Specifies the maximum number of seconds to wait for actions on shared data to occur before timing out.

  6. Click OK.

Using the Shared Data Service

This section describes how to enable and use the Shared Data Service.

Enabling the Shared Data Service

To enable the Shared Data Service:

  1. Start OpenScript.

  2. Open an existing script or create and record a new script.

  3. Select Script Properties from the Script menu.

  4. Select the Modules category.

  5. Select the Shared Data module.

  6. Click OK. The Shared Data Service will be added to the script class in the Java Code as follows.

    @ScriptService oracle.oats.scripting.modules.sharedData.api.SharedDataService sharedData;
    

    Once you have enabled the Shared Data service, you can set the password encryption and the connection parameters and then use the Shared Data API to manipulate message queues or hash maps. You use the sharedData class in the Java code view to create manipulate message queues and hash maps.

Setting the Password Encryption

The Password encryption is set in the General Preferences. To set the password encryption:

  1. Select OpenScript Preferences from the View menu.

  2. Expand the OpenScript node and the General category.

  3. Select Encryption.

  4. Select Obfuscate script data or Encrypt script data to make sure the connection to the Shared Data Service uses an obfuscated or encrypted password.

  5. If you select Encrypt script data, enter a password.

  6. Click OK.

Setting the Connection Parameters

The connection parameters specify the Oracle Load Testing for Web Applications server to use for the Shared Data Service and the authentication settings. To set the connection parameters:

  1. Make sure the Shared Data Service is enabled and the password encryption is specified as previously described.

  2. Select the script node where you want to set the connection parameters.

  3. Select Add from the Script menu and then select Other.

  4. Expand the Shared Data folder.

  5. Select Set Connection Parameters and click OK.

  6. Set the connection parameters as follows:

    • Address: Specify the address of the machine to use for the Shared Data Service. For example: t3://localhost:8088 or t3://machinename.us.oracle.com:8088.

    • User Name: Specify the user name to use for authentication. The default name is oats unless changed in the Oracle Application Testing Suite configuration.

    • Password: Specify the password to use for authentication.

  7. Click OK. A Connection Parameters node will be added to the script tree.

  8. In the Java Code view, the Connection Parameters consist of the code executed in the sharedData.setConnectionParameters procedure:

    sharedData.setConnectionParameters("t3://localhost:8088", "oats",
    
      decrypt("L4I57b+KpnI2BQSRKPG88w=="));
    

After setting the connection parameters, you can user the Shared Data API in the Java Code view to manipulate data in message queues and hash maps.

Using The Shared Data API

The Shared Data Module includes a script Application Programming Interface (API) for Shared Data actions. You can use the Shared Data API to pass data between load testing scripts running as Virtual Users in Oracle Load Testing for Web Applications. The Shared Data can also be used to pass data between functional testing scripts running from the command line. Commands that are specific to the Shared Data Module are part of the "sharedData" class. The Shared Data service must be enabled separately for use with other types of scripts. You can also leverage other commands from other enabled classes (services) or general Java commands in your scripts.

Some examples of the Shared Data Module API include:

  • clearMap

  • clearQueue

  • createMap

  • createQueue

  • getFromMap

  • getKeysOfMap

  • getLengthOfQueue

  • offerFirst

  • offerLast

  • peekFirst

  • peekLast

  • pollFirst

  • pollLast

  • putToMap

  • removeFromMap

  • setConnectionParameters

  • waitFor

The setConnectionParameters API method can be added using the script Tree View. Additional methods can be added using the Java Code view.