Testing Java™ objects
You can import Plain Old Java™ Objects (POJOs) from JAR files into Rational® Integration Tester in order to parse and construct messages containing the serialized forms of those objects. You can construct and parse the Java™ objects and perform validation, but you cannot test the objects directly.
The objects to be added must be part of a JAR file that is added like a schema to the Rational® Integration Tester Schema Library in the Architecture School perspective.
Any classes in the JAR file that are public and implement the
java.io.Serializable
interface are made available as roots in the schema. Remember
the following things when you use a JAR file:
- If the JAR file has dependencies on other classes, those classes must be present in JAR files co-located with the JAR file from which the schema is being generated. Otherwise, the message formatter does not behave as expected.
- By default, bean properties and public fields can be fields within a root. If a bean property and a public field share a name, the property is used rather than the field.
- If, in addition to public fields, you need to include private fields from within a class,
specify one or more semicolon-separated class or package names for the
greenhat.schema.javaobject.privateFields
system property in the Rational® Integration Tester Library Manager. When you specify a package name, all subpackages are included. For example, to include all the classes in thecom.example.messaging.requests
andcom.example.messaging.replies
packages, place the following statement on a line by itself in the text box labeled JVM Arguments in the Library Manager:-Dgreenhat.schema.javaobject.privateFields=com.example.messaging
To prevent additional packages undercom.example.messaging
from being included, specify only the packages you want:-Dgreenhat.schema.javaobject.privateFields=com.example.messaging.requests;com.example.messaging.replies
You can also include specific classes only:-Dgreenhat.schema.javaobject.privateFields=com.example.messaging.requests.GetAccountDetails;com.example.messaging.replies.AccountDetails
The classes can then be selected in the normal way from the schema wizard (for example, when you apply the schema to a selected message). Remember these points:
- Lists and Sets are supported as fields, and each element can be either primitive type or one of the roots that are defined in the schema. Arrays and Maps are currently not supported.
- A Java™ object schema can be applied only to the following objects:
- Byte array fields. For example, you can apply a Java™ object root to a byte array field.
- Messages of type Bytes or Object, set within the message body when you use any of the JMS providers.