com.rational.test.ft.domain.java

Class JavaProxy

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


    public class JavaProxy
    extends com.rational.test.ft.domain.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.

    • Test Object interface:
      TestObject
    • Default Recognition Properties:
      PropertyUsage
      .classThe Java full class name of the test object.
      .classIndexThe zero-based index of the class relative to the immediate parent in the object map.

    Since:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      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, TIMEOUTTESTOBJECT_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

      Constructors 
      Constructor and Description
      JavaProxy(java.lang.Object theObjectInTheSUT)
      Sets the SUT object as a member variable for the proxy.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      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(com.rational.test.ft.domain.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.
      com.rational.test.ft.domain.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
      com.rational.test.ft.domain.ProxyTestObject[] getMappableChildren()
      Uses getChildren to implement.
      com.rational.test.ft.domain.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() 
      com.rational.test.ft.domain.ProxyTestObject[] getOwnedObjects()
      Always returns null because object relationships are not understood at this level of abstaction.
      com.rational.test.ft.domain.ProxyTestObject getOwner()
      Always returns null because object relationships are not understood at this level of abstaction.
      com.rational.test.ft.domain.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() 
      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() 
      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.
      com.rational.test.ft.domain.TestDomainImplementation getTestDomain()
      Return the TestDomainImplementation that this proxy object is associated with.
      java.lang.String getTestObjectClassName()
      The default GUI test object classname is returned.
      com.rational.test.ft.domain.ProxyTestObject getTopMappableParent()
      Returns a proxy object for the top parent of this object.
      com.rational.test.ft.domain.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 com.rational.test.ft.domain.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(com.rational.test.ft.domain.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, getElementWithFocus, 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 com.rational.test.ft.domain.IProxyBase
        Specified by:
        getTestObjectClassName in class com.rational.test.ft.domain.ProxyTestObject
        Returns:
        The default test object class full name.
      • getTestDomain

        public final com.rational.test.ft.domain.TestDomainImplementation getTestDomain()
        Return the TestDomainImplementation that this proxy object is associated with. This method should not be overriden.
        Specified by:
        getTestDomain in interface com.rational.test.ft.domain.IProxyBase
        Specified by:
        getTestDomain in class com.rational.test.ft.domain.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 com.rational.test.ft.domain.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 com.rational.test.ft.domain.ProxyTestObject
        Returns:
        Return a unique and repeatable identifier for the object being evaluated.
      • getRole

        public java.lang.String getRole()
        Overrides:
        getRole in class com.rational.test.ft.domain.ProxyTestObject
      • 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 com.rational.test.ft.domain.ProxyTestObject
        Returns:
        false, unless overriden in a super class.
      • getParent

        public com.rational.test.ft.domain.ProxyTestObject getParent()
        Returns null always because object relationships are not understood at this level of abstaction.
        Specified by:
        getParent in class com.rational.test.ft.domain.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(com.rational.test.ft.domain.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 com.rational.test.ft.domain.ProxyTestObject getMappableParent()
        Returns null always because object relationships are not understood at this level of abstaction.
        Specified by:
        getMappableParent in class com.rational.test.ft.domain.ProxyTestObject
        Returns:
        null, no known parent.
      • getTopParent

        public com.rational.test.ft.domain.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 com.rational.test.ft.domain.ProxyTestObject
        Returns:
        The proxy for the top parent test object or itself for a top-level object.
      • getTopMappableParent

        public com.rational.test.ft.domain.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 com.rational.test.ft.domain.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 com.rational.test.ft.domain.ProxyTestObject[] getChildren()
        Uses getChildren to implement.
        Specified by:
        getChildren in class com.rational.test.ft.domain.ProxyTestObject
        Returns:
        null, if no known children.
      • getMappableChildren

        public com.rational.test.ft.domain.ProxyTestObject[] getMappableChildren()
        Uses getChildren to implement.
        Specified by:
        getMappableChildren in class com.rational.test.ft.domain.ProxyTestObject
        Returns:
        null, if no known children.
      • addMappableChildrenToVector

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

        public com.rational.test.ft.domain.ProxyTestObject getOwner()
        Always returns null because object relationships are not understood at this level of abstaction.
        Specified by:
        getOwner in class com.rational.test.ft.domain.ProxyTestObject
        Returns:
        null, no known parent.
      • getOwnedObjects

        public com.rational.test.ft.domain.ProxyTestObject[] getOwnedObjects()
        Always returns null because object relationships are not understood at this level of abstaction.
        Specified by:
        getOwnedObjects in class com.rational.test.ft.domain.ProxyTestObject
        Returns:
        null, no known parent.
      • processMouseEvent

        public void processMouseEvent(com.rational.test.ft.domain.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 com.rational.test.ft.domain.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 com.rational.test.ft.domain.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 com.rational.test.ft.domain.ProxyTestObject
        Returns:
        An enumeration of recognition properties. The returned objects are of class TestObjectProperty.
      • 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 com.rational.test.ft.domain.ProxyTestObject
      • 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 com.rational.test.ft.domain.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 com.rational.test.ft.domain.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()
        Specified by:
        getProperties in class com.rational.test.ft.domain.ProxyTestObject
      • getStandardProperties

        public java.util.Hashtable getStandardProperties()
        For Java, the definition for standard properties is the same as getProperties().
        Specified by:
        getStandardProperties in class com.rational.test.ft.domain.ProxyTestObject
        Returns:
        The full set of Java properties.
        See Also:
        getProperties()
      • getNonValueProperties

        public java.util.Hashtable getNonValueProperties()
        Specified by:
        getNonValueProperties in class com.rational.test.ft.domain.ProxyTestObject
      • 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 com.rational.test.ft.domain.ProxyTestObject
      • getProperty

        public java.lang.Object getProperty(java.lang.String propertyName)
        Gets the value for a specific property.
        Specified by:
        getProperty in class com.rational.test.ft.domain.ProxyTestObject
      • setProperty

        public void setProperty(java.lang.String propertyName,
                                java.lang.Object value)
        Sets the value for a specific property.
        Specified by:
        setProperty in class com.rational.test.ft.domain.ProxyTestObject
      • 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 com.rational.test.ft.domain.ProxyTestObject
      • getIndexers

        public com.rational.test.ft.value.IndexerInfo[] getIndexers()
        Gets information about a TestObject's indexed properties
        Specified by:
        getIndexers in class com.rational.test.ft.domain.ProxyTestObject
      • 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 com.rational.test.ft.domain.ProxyTestObject
      • 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 com.rational.test.ft.domain.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 com.rational.test.ft.domain.ProxyTestObject getVisualClippableParent()
        Return the clippable parent for the control
        Overrides:
        getVisualClippableParent in class com.rational.test.ft.domain.ProxyTestObject
        Returns:
        ProxyTestObject of the control