Model the behavior of a protocol extension

 

+

Search Tips   |   Advanced Search

 

To create a model element for protocol, extend the 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.

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 protocol.

The LTBM provides common constructs...

...that can be reused by protocol extensions. These constructs are included in various packages in the LTBM.

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 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.


Create a new model element

  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 extension point...

      com.ibm.rational.test.lt.models.behavior.protocol

  4. Implement the getters and setters of attributes for this model element class.

    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.


Related information

  • API references