IBM Rational Functional Tester
Version 8.1.1000
IBM Rational Functional Tester Proxy SDK Reference

Project Version 2.3

com.rational.test.ft.domain.java
Class JavaProxy

java.lang.Object   extended by com.rational.test.ft.sys.RegisteredObject       extended by com.rational.test.ft.domain.ProxyTestObject
          extended by com.rational.test.ft.domain.java.JavaProxy
All Implemented Interfaces:
IChannelObject, IDataDriven, IProxyBase, IPropertyFilter
Direct Known Subclasses:
JavaGuiProxy, SwtProxy

public class JavaProxy
extends ProxyTestObject
implements IPropertyFilter

The Java object proxy's base class, which all Java proxies must extend. The abstract ProxyTestObject base class defines the non-GUI object properties required to implement a proxy object. This abstract class extends that definition with the additional properties needed for a Java object.

This class further contains the default implementation of various base class methods that proxy implementations may need to extend or override.

Since:
1.0

Field Summary
protected static com.rational.test.ft.util.FtDebug debug
           
protected  java.lang.String uniqueId
           
 
Fields inherited from class com.rational.test.ft.domain.ProxyTestObject
BROWSERTABTESTOBJECT_CLASSNAME, BROWSERTESTOBJECT_CLASSNAME, COLORDIALOGTESTOBJECT_CLASSNAME, CROSSDOMAINCONTAINER_CLASSNAME, DOCUMENTTESTOBJECT_CLASSNAME, DOMAINTESTOBJECT_CLASSNAME, ECLIPSETOPLEVELTESTOBJECT_CLASSNAME, EMBEDDEDBROWSERTESTOBJECT_CLASSNAME, FILEDIALOGTESTOBJECT_CLASSNAME, FRAMESUBITEMTESTOBJECT_CLASSNAME, FRAMETESTOBJECT_CLASSNAME, GEFEDITPARTTESTOBJECT_CLASSNAME, GUISUBITEMTESTOBJECT_CLASSNAME, GUITESTOBJECT_CLASSNAME, INTERNALFRAMETESTOBJECT_CLASSNAME, MESSAGEBOXTESTOBJECT_CLASSNAME, PALETTEGUISUBITEMTESTOBJECT_CLASSNAME, PROCESSTESTOBJECT_CLASSNAME, SCROLLSUBITEMTESTOBJECT_CLASSNAME, SCROLLTESTOBJECT_CLASSNAME, SELECTGUISUBITEMTESTOBJECT_CLASSNAME, SELECTSCROLLGUISUBITEMTESTOBJECT_CLASSNAME, SHELLTESTOBJECT_CLASSNAME, STATELESSGUISUBITEMTESTOBJECT_CLASSNAME, SUBITEMTESTOBJECT_CLASSNAME, TABITEMTESTOBJECT_CLASSNAME, TESTOBJECT_CLASSNAME, TEXTGUISUBITEMTESTOBJECT_CLASSNAME, TEXTGUITESTOBJECT_CLASSNAME, TEXTSCROLLTESTOBJECT_CLASSNAME, TEXTSELECTGUISUBITEMTESTOBJECT_CLASSNAME, TOGGLEGUITESTOBJECT_CLASSNAME, TOGGLETESTOBJECT_CLASSNAME, TOPLEVELSUBITEMTESTOBJECT_CLASSNAME, TOPLEVELTESTOBJECT_CLASSNAME, TRACKBARTESTOBJECT_CLASSNAME, vomClippedRectangle
 
Fields inherited from class com.rational.test.ft.sys.RegisteredObject
theTestObject
 
Fields inherited from interface com.rational.test.ft.domain.IDataDriven
INCLUDE_ALL, INCLUDE_JUSTOBJECT, INCLUDE_SIBLINGS
 
Constructor Summary
JavaProxy(java.lang.Object theObjectInTheSUT)
          Sets the SUT object as a member variable for the proxy.
 
Method Summary
protected  void addMappableChildrenToVector(java.util.Enumeration children, java.util.Vector v)
           
 void addRecognitionProperty(java.lang.String property, java.lang.Object value, int weight)
          Defines an additional recognition property that this proxy should utilize.
 boolean allowProperty(java.lang.String property)
          Returns true if the property is allowed.
 void childConstructed(ProxyTestObject child)
          Inform the parent when child proxies are constructed so additional recognition properties can be added when needed.
protected  java.lang.Object getAddedRecognitionPropertyValue(java.lang.String propertyName)
          Returns the value associated with an added recognition property.
 ProxyTestObject[] getChildren()
          Uses getChildren to implement.
 java.util.Enumeration getChildrenEnumeration()
          Always returns null because object relationships are not understood at this level of abstaction.
 java.lang.String getDescriptiveName()
          Returns a name that can be used to describe the associated UI object in a script.
 java.util.Enumeration getImmediateChildren()
          Returns an enumeration of proxies for the immediate children of this object.
 java.lang.Object getIndexer(java.lang.String name, java.lang.Object[] indexes)
          Gets the value of an indexed property
 com.rational.test.ft.value.IndexerInfo[] getIndexers()
          Gets information about a TestObject's indexed properties
 ProxyTestObject[] getMappableChildren()
          Uses getChildren to implement.
 ProxyTestObject getMappableParent()
          Returns null always because object relationships are not understood at this level of abstaction.
 com.rational.test.ft.value.MethodInfo[] getMethods()
          Returns an array of MethodInfos
 com.rational.test.ft.sys.MethodSpecification getMethodSpecForPoint(java.awt.Point pt)
          Returns a MethodSpecification for a method that returns a java.awt.Point for the specified coordinates.
 java.util.Hashtable getNonValueProperties()
          Returns the properties that are not supported because the value is a reference to another object.
 ProxyTestObject[] getOwnedObjects()
          Always returns null because object relationships are not understood at this level of abstaction.
 ProxyTestObject getOwner()
          Always returns null because object relationships are not understood at this level of abstaction.
 ProxyTestObject getParent()
          Returns null always because object relationships are not understood at this level of abstaction.
 java.lang.Object getParentObject()
          Returns null always because object relationships are not understood at this level of abstaction.
 java.util.Hashtable getProperties()
          Returns a complete set of properties for the associated test object.
 java.lang.Object getProperty(java.lang.String propertyName)
          Gets the value for a specific property.
 java.util.Hashtable getRecognitionProperties()
          Returns an enumeration of properties used to uniquely identify the associated test object in the SUT.
 int getRecognitionPropertyWeight(java.lang.String propertyName)
          Returns an indication of how useful this property is for recognition.
 java.lang.String getRole()
          Returns a brief type name that describes the role this object plays in the UI.
 java.util.Hashtable getStandardProperties()
          For Java, the definition for standard properties is the same as getProperties().
 java.util.Hashtable getTestDataTypes()
          Returns a hashtable of data type descriptions of the verification point data available with the associated object in the SUT.
 TestDomainImplementation getTestDomain()
          Return the TestDomainImplementation that this proxy object is associated with.
 java.lang.String getTestObjectClassName()
          The default GUI test object classname is returned.
 ProxyTestObject getTopMappableParent()
          Returns a proxy object for the top parent of this object.
 ProxyTestObject getTopParent()
          Returns a proxy object for the top parent of this object.
 java.lang.String getUniqueId()
          Returns a unique string for the associated object.
protected  ProxyTestObject getVisualClippableParent()
          Return the clippable parent for the control
 boolean hasAddedRecognitionProperties()
          Returns true if recocnition properties have been added to this proxy from an external source through the addRecognitionProperty method.
 boolean isRecognitionProperty(java.lang.String propName)
          This function is overloaded at componentProxy level
 void processMouseEvent(IMouseActionInfo action)
          At this level of the Java proxy abstraction, this method is null.
 void setIndexer(java.lang.String name, java.lang.Object[] indexes, java.lang.Object val)
          Sets the value of an indexed property
 void setProperty(java.lang.String propertyName, java.lang.Object value)
          Sets the value for a specific property.
 boolean shouldBeMapped()
          Returns false; by default only GUI test objects are mapped.
 
Methods inherited from class com.rational.test.ft.domain.ProxyTestObject
addDataDrivableCommands, baseClassMatch, canTakeVP, equals, findChildrenWithProperties, findChildrenWithPropertiesAndInvoke, getChannel, getChildren, getDataDrivableCommand, getDataDrivableCommands, getField, getIgnorableProperties, getMappableChildren, getMappableParent, getObjectClassName, getObjectCustomClassName, getOwnedObjects, getParent, getProxy, getScriptCommandAnchor, getScriptCommandFlags, getTestData, getVisualClippedRectangle, getVisualMappableChildren, getVisualTopParent, getVOMSpecificProperty, hasSpecialFrameState, isClassIndexConsidered, isSameObject, isValidObject, ping, suppressKeyAction, updateTestData
 
Methods inherited from class com.rational.test.ft.sys.RegisteredObject
addProxyReference, dereference, getObject, getRegisteredId, getTransactionId, isReferenced, isReleaseRequired, register, registerTransiently, release, toString, unregister
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

debug

protected static com.rational.test.ft.util.FtDebug debug

uniqueId

protected transient java.lang.String uniqueId
Constructor Detail

JavaProxy

public JavaProxy(java.lang.Object theObjectInTheSUT)
Sets the SUT object as a member variable for the proxy. All interactions with the supplied object are performed through this class.

Method Detail

getTestObjectClassName

public java.lang.String getTestObjectClassName()
The default GUI test object classname is returned. More specific test objects are returned by more constrained proxy classes. This level of support is always required.

Specified by:
getTestObjectClassName in interface IProxyBase
Specified by:
getTestObjectClassName in class ProxyTestObject
Returns:
The default test object class full name.

getTestDomain

public final TestDomainImplementation getTestDomain()
Return the TestDomainImplementation that this proxy object is associated with. This method should not be overriden.

Specified by:
getTestDomain in interface IProxyBase
Specified by:
getTestDomain in class ProxyTestObject
Returns:
The associated TestDomainImplementation.

getDescriptiveName

public java.lang.String getDescriptiveName()
Returns a name that can be used to describe the associated UI object in a script. This name may be further adjusted to become unique to the script, but it acts as the base for the name used in the script. Only characters used in Java identifiers should be returned (alphabetic, numeric, or underscore characters). Non-identifier characters cause script compilation failures. An example of what to return is "OKButton" for a java.awt.Button with the text "OK" on it.

Specified by:
getDescriptiveName in class ProxyTestObject
Returns:
A descriptive object name.

getUniqueId

public java.lang.String getUniqueId()
Returns a unique string for the associated object. This string needs to be identical for each call to this method for the same instance of the UI object. This value must also be as unique as possible.

Specified by:
getUniqueId in class ProxyTestObject
Returns:
Return a unique and repeatable identifier for the object being evaluated.

getRole

public java.lang.String getRole()
Description copied from class: ProxyTestObject
Returns a brief type name that describes the role this object plays in the UI. For instance a java.awt.Button might return button. There are suggested role constants in the TestObjectRole class. However, proxies are not limited to these constants.

The role is used for several purposes by the test infrastructure. First, the role can be used in the construction of object names in scripts, augmenting the name returned by getDescriptiveName(). The role is also used in the UI to decorate nodes in the map with icons that help users quickly associate the nodes with the roles they play in the system under test.

Overrides:
getRole in class ProxyTestObject
Returns:
A brief type name that describes the role this object plays in the UI.

shouldBeMapped

public boolean shouldBeMapped()
Returns false; by default only GUI test objects are mapped. This method should be overriden by proxies that do not contain interesting persistent information. Objects that the script may want to persistently interact with should always return true.

Specified by:
shouldBeMapped in class ProxyTestObject
Returns:
false, unless overriden in a super class.

getParent

public ProxyTestObject getParent()
Returns null always because object relationships are not understood at this level of abstaction.

Specified by:
getParent in class ProxyTestObject
Returns:
null, no known parent.

getParentObject

public java.lang.Object getParentObject()
Returns null always because object relationships are not understood at this level of abstaction.

Returns:
null, no known parent.

childConstructed

public void childConstructed(ProxyTestObject child)
Inform the parent when child proxies are constructed so additional recognition properties can be added when needed. By default nothing happens in this method.

Parameters:
child - The child proxy that was just constructed.

getMappableParent

public ProxyTestObject getMappableParent()
Returns null always because object relationships are not understood at this level of abstaction.

Specified by:
getMappableParent in class ProxyTestObject
Returns:
null, no known parent.

getTopParent

public ProxyTestObject getTopParent()
Returns a proxy object for the top parent of this object. Returns itself if this object has no parent.

Specified by:
getTopParent in class ProxyTestObject
Returns:
The proxy for the top parent test object or itself for a top-level object.

getTopMappableParent

public ProxyTestObject getTopMappableParent()
Returns a proxy object for the top parent of this object. Returns itself if this object has no parent.

Specified by:
getTopMappableParent in class ProxyTestObject
Returns:
The proxy for the top parent test object or itself for a top-level object.

getChildrenEnumeration

public java.util.Enumeration getChildrenEnumeration()
Always returns null because object relationships are not understood at this level of abstaction.

Returns:
null, no known children.

getImmediateChildren

public java.util.Enumeration getImmediateChildren()
Returns an enumeration of proxies for the immediate children of this object.

Returns:
The child proxies relative to this proxy.

getChildren

public ProxyTestObject[] getChildren()
Uses getChildren to implement.

Specified by:
getChildren in class ProxyTestObject
Returns:
null, if no known children.

getMappableChildren

public ProxyTestObject[] getMappableChildren()
Uses getChildren to implement.

Specified by:
getMappableChildren in class ProxyTestObject
Returns:
null, if no known children.

addMappableChildrenToVector

protected void addMappableChildrenToVector(java.util.Enumeration children,                                            java.util.Vector v)

getOwner

public ProxyTestObject getOwner()
Always returns null because object relationships are not understood at this level of abstaction.

Specified by:
getOwner in class ProxyTestObject
Returns:
null, no known parent.

getOwnedObjects

public ProxyTestObject[] getOwnedObjects()
Always returns null because object relationships are not understood at this level of abstaction.

Specified by:
getOwnedObjects in class ProxyTestObject
Returns:
null, no known parent.

processMouseEvent

public void processMouseEvent(IMouseActionInfo action)
At this level of the Java proxy abstraction, this method is null. GUI objects that can interact with the mouse should be implemented with JavaGuiProxy level support.

Specified by:
processMouseEvent in class ProxyTestObject
Parameters:
action - The event cache and other mouse state information for this mouse action.
See Also:
IMouseActionInfo, MethodSpecification

getMethodSpecForPoint

public com.rational.test.ft.sys.MethodSpecification getMethodSpecForPoint(java.awt.Point pt)
Returns a MethodSpecification for a method that returns a java.awt.Point for the specified coordinates. By default, a method specification for IGraphical.getScreenPoint is returned. However, if a proxy can fin

Specified by:
getMethodSpecForPoint in class ProxyTestObject
Parameters:
action - The event cache and other mouse state information for this mouse action.
See Also:
MethodSpecification

getRecognitionProperties

public java.util.Hashtable getRecognitionProperties()
Returns an enumeration of properties used to uniquely identify the associated test object in the SUT. Examples of excellent recognition properties are the programmatic name or a persistent description. Less interesting are the visible text on a button or label, the tooltip text, or possibly the foreground color. Uninteresting properties are the transient properties like hasFocus or isShowing type properties.

Specified by:
getRecognitionProperties in class ProxyTestObject
Returns:
An enumeration of recognition properties. The returned objects are of class TestObjectProperty.
See Also:
ProxyTestObject.getRecognitionPropertyWeight(String), ProxyTestObject.getProperty(String), ProxyTestObject.addRecognitionProperty(String,Object,int)

isRecognitionProperty

public boolean isRecognitionProperty(java.lang.String propName)
This function is overloaded at componentProxy level

Parameters:
propName -
Returns:

getRecognitionPropertyWeight

public int getRecognitionPropertyWeight(java.lang.String propertyName)
Returns an indication of how useful this property is for recognition. A value of 0 indicates not useful at all, and a value of 100 indicates that the property is extremely useful for recognition.

Specified by:
getRecognitionPropertyWeight in class ProxyTestObject
Parameters:
propertyName - The name of the recognition property to return a weight value for.
See Also:
ProxyTestObject.getRecognitionProperties()

addRecognitionProperty

public void addRecognitionProperty(java.lang.String property,                                    java.lang.Object value,                                    int weight)
Defines an additional recognition property that this proxy should utilize. Properties defined outside a proxy must always be attached to the proxy when it is created. This may be problematic in some domains, and these properties must be ignored if appropriate proxy caching is not being performed. Properties added to a proxy should be returned through the getRecognitionProperties method.

Specified by:
addRecognitionProperty in class ProxyTestObject
Parameters:
property - The recognition property name. Care should be taken to avoid conflicts with existing property names.
value - The value of the added recognition property.
weight - The weight associated with this recognition property. This value should be returned when the getRecognitionPropertyWeight method is called.
See Also:
getRecognitionProperties(), getRecognitionPropertyWeight(String), getProperty(String)

getAddedRecognitionPropertyValue

protected java.lang.Object getAddedRecognitionPropertyValue(java.lang.String propertyName)
Returns the value associated with an added recognition property. This method exists for quick lookup of recognition properties added to this proxy's recognition property set.

Parameters:
propertyName - The name of the added recognition property to look for.
Returns:
The value associated with the specified recognition property or null if the property does not exist.

hasAddedRecognitionProperties

public boolean hasAddedRecognitionProperties()
Returns true if recocnition properties have been added to this proxy from an external source through the addRecognitionProperty method.

Specified by:
hasAddedRecognitionProperties in class ProxyTestObject
Returns:
true if recocnition properties have been added to this proxy from an external source through the addRecognitionProperty method.
See Also:
addRecognitionProperty(String,Object,int)

getProperties

public java.util.Hashtable getProperties()
Description copied from class: ProxyTestObject
Returns a complete set of properties for the associated test object. The meaning of a property is specific to the test domain and the test object. Typically, this is a set of name/value pairs that describe the test object and its active state. Properties such as font, colors, and coordinate information are typically associated with a GUI test object. Associated data and state information can also be returned, depending on the test object.

This method does not return properties whose values are references to objects. The method ProxyTestObject.getNonValueProperties() returns information about such properties.

Specified by:
getProperties in class ProxyTestObject
Returns:
The set of known properties associated with a test object.
See Also:
ProxyTestObject.getProperty(String), ProxyTestObject.setProperty(String,Object), ProxyTestObject.getStandardProperties(), ProxyTestObject.getNonValueProperties()

getStandardProperties

public java.util.Hashtable getStandardProperties()
For Java, the definition for standard properties is the same as getProperties().

Specified by:
getStandardProperties in class ProxyTestObject
Returns:
The full set of Java properties.
See Also:
getProperties()

getNonValueProperties

public java.util.Hashtable getNonValueProperties()
Description copied from class: ProxyTestObject
Returns the properties that are not supported because the value is a reference to another object. These properties can still be accessed using getProperty(). If such a property is returned to the test script, it is manifested as a TestObject containing a reference to the object in the SUT. The test script should call the TestObject method unregister() to release the object.

When an object is unregistered, the release() method that all ProxyTestObjects inherit from RegisteredObject is called.

Specified by:
getNonValueProperties in class ProxyTestObject
Returns:
The set of properties that are not available.
See Also:
ProxyTestObject.getProperties(), ProxyTestObject.getStandardProperties(), ProxyTestObject.getProperty(String), ProxyTestObject.setProperty(String,Object)

allowProperty

public boolean allowProperty(java.lang.String property)
Description copied from interface: IPropertyFilter
Returns true if the property is allowed.

Specified by:
allowProperty in interface IPropertyFilter
Returns:
true if the property is allowed.

getMethods

public com.rational.test.ft.value.MethodInfo[] getMethods()
Returns an array of MethodInfos

Specified by:
getMethods in class ProxyTestObject
Returns:
An array containing method signatures for all methods accessible against the associated test object.
See Also:
ProxyTestObject.getProperties(), ProxyTestObject.getStandardProperties(), ProxyTestObject.getNonValueProperties()

getProperty

public java.lang.Object getProperty(java.lang.String propertyName)
Gets the value for a specific property.

Specified by:
getProperty in class ProxyTestObject
Parameters:
propertyName - The name of the property to fetch.
Returns:
The active value of the specified property for the associated test object.
See Also:
ProxyTestObject.getProperties(), ProxyTestObject.setProperty(String,Object), ProxyTestObject.getRecognitionProperties(), ProxyTestObject.addRecognitionProperty(String,Object,int)

setProperty

public void setProperty(java.lang.String propertyName,                         java.lang.Object value)
Sets the value for a specific property.

Specified by:
setProperty in class ProxyTestObject
Parameters:
propertyName - The name of the property to redefine. This name is the same as that returned by getProperties().
See Also:
ProxyTestObject.getProperties(), ProxyTestObject.getProperty(String)

getIndexer

public java.lang.Object getIndexer(java.lang.String name,                                    java.lang.Object[] indexes)
Gets the value of an indexed property

Specified by:
getIndexer in class ProxyTestObject
Parameters:
name - the name of the indexer
indexes - the indexes to get the value of

getIndexers

public com.rational.test.ft.value.IndexerInfo[] getIndexers()
Gets information about a TestObject's indexed properties

Specified by:
getIndexers in class ProxyTestObject
See Also:
IndexerInfo

setIndexer

public void setIndexer(java.lang.String name,                        java.lang.Object[] indexes,                        java.lang.Object val)
Sets the value of an indexed property

Specified by:
setIndexer in class ProxyTestObject
Parameters:
name - the name of the indexer
indexes - the indexes to set the value of

getTestDataTypes

public java.util.Hashtable getTestDataTypes()
Returns a hashtable of data type descriptions of the verification point data available with the associated object in the SUT. The hashtable keys are String objects that are used as the VP type in the associated test data. The type is a simple value that is different from the other type values associated with this object under test. The type keys map to a verbose description of the test data. This is reasonable for presentation to a user.

Specified by:
getTestDataTypes in class ProxyTestObject
Returns:
An hashtable of type/description pairs used to describe the verification data available from this proxy.
See Also:
ProxyTestObject.getTestData(String), ITestData

getVisualClippableParent

protected ProxyTestObject getVisualClippableParent()
Return the clippable parent for the control

Overrides:
getVisualClippableParent in class ProxyTestObject
Returns:
ProxyTestObject of the control