IBM Support

Inspecting Java Objects from ECMAScript in Rational Integration Tester

Question & Answer


Question

How can Java Object types in ECMAScript be discovered in IBM ational Integration Tester (RIT) and how have the underlying tags array been constructed?

Answer

Introduction

We have access to Java from ECMAScript within RIT. This includes the Java reflection API which gives us access to the underlying Java objects often used within the ECMAScript.

Looking at an object via reflection

Here are some ECMAScript functions for printing out the details of an object (or class) built along the lines detailed in how to use an ECMAScript function library in RIT.


Whilst it may be interesting to know the class names the RIT development team have used the real value in this output are the class names which come from publicly documented APIs such as the standard Java class library.

Inspecting the tags array

Given these ECMAScript functions we can take a look at the tags array.


Here (with the most significant items highlighted) are the results from RIT 8.6.0.3.


So knowing that the tags array implements Map<K,V> we can may use of a the details in the online Java 7 SDK documentation take a look at the first element of the array (or more accurately of the entry set).




So we can infer that the tags array is not an array at all but is based upon:


    java.util.Map< java.lang.String , java.lang.Object >

Since we are looking at the undocumented internals of the tags array it is always possible that those details will be changed in future releases. This information may be useful for debugging problems, but it would be wise not to write tests which rely upon this knowledge.

Putting the knowledge to use

Now that we know the underlying interface for the tags array we can construct an ECMAScript array to iterate over it and print out the current value of all the tags.



Which will output all the tag values:


Example Library

Library.js.txtLibrary.js.txt

[{"Product":{"code":"SSBLQQ","label":"IBM Rational Test Workbench"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Rational Integration Tester","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF016","label":"Linux"},{"code":"PF022","label":"OS X"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"8.0;8.5;8.6","Edition":"All Editions","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
11 July 2019

UID

swg21696476