Modeling the behavior of a protocol extension

To create a model element for your protocol, you must extend the com.ibm.rational.test.lt.models.behavior.impl.CBBlockImpl class. Extending this class enables you to use all the basic functionality that is provided by this model element, including persistence into the test files and APIs to set or get properties of a model element.

About this task

There are other model elements in the load test behavior model (LTBM) that are extended from the CBBlockImpl class and that provide various functionality. You could also extend those elements for your protocol. The LTBM provides common constructs (com.ibm.rational.test.lt.models.behavior.common) that can be reused by protocol extensions. These constructs are included in various packages in the LTBM. See the Javadoc information and the API topic for more details.

To create a protocol model element that is not related to any of the common constructs provided by the LTBM, extend the CBBlockImpl class. If the model element for your protocol is a specific type of an LTBM model element, extend the implementation class for that element. For example, if a protocol extension provides a special type of a CBLoop construct, it would extend the CBLoopImpl class and add additional attributes to that element.

The Javadoc for the test execution services interfaces and classes can be accessed from the product by clicking Help > Help Contents > DevOps Test Performance API Reference.

Procedure

  1. Optionally, create an interface that defines the methods for the class, including the setters and getters for the attributes added by this element.
  2. Create a new class that extends the CBBlockImpl interface, and if you created an interface in step one, implement the interface.
  3. In the constructor of the model element, call the method setType(type), where type is a unique type string denoting the model element as registered using the com.ibm.rational.test.lt.models.behavior.protocol extension point.
  4. Implement the getters and setters of attributes for this model element class.
    Note: The setter must set the value attributes of the primitive data types into the underlying model using one of the overloaded setProperty() methods based on the type of attribute.
  5. To set attributes of complex types, override the addReference() method.

Results

While the test is loading, the getter (at least initially) gets the value of the attribute from the underlying model by using one of the overloaded getProperty() methods, based on the type of the property for primitive attributes.

You can define the model element to store the value of the attributes in local attributes. However, the guideline is that the getter should get it first from the underlying model and the setter should store it in the underlying model.