org.safs.abbot
Class AbbotGUIUtilities

java.lang.Object
  extended by org.safs.STAFRequester
      extended by org.safs.DDGUIUtilities
          extended by org.safs.abbot.AbbotGUIUtilities

public class AbbotGUIUtilities
extends DDGUIUtilities

SAFS/Abbot-specific subclass of DDGUIUtilities. The primary feature is that the AbbotGUIUtilities uses the new SAFS RMI bridge to communicate with our own Java Proxies embedded in each JVM.

Since:
FEB 09, 2005 FEB 19, 2006 (Szucs) setting the component type of TestRecordData object in waitForObject( )

Field Summary
protected static AServerImpl server
          The RMI server used to control the RMI bridge that talks with the JVMAgents inserted into every "enabled" Java JVM launched.
 
Fields inherited from class org.safs.DDGUIUtilities
appmaps, DEBUG_MESSAGE, FAILED_MESSAGE, FAILED_OK_MESSAGE, GENERIC_MESSAGE, log, PASSED_MESSAGE, trdata, WARNING_MESSAGE, WARNING_OK_MESSAGE
 
Fields inherited from class org.safs.STAFRequester
staf
 
Constructor Summary
AbbotGUIUtilities()
          No-argument constructor.
AbbotGUIUtilities(STAFHelper helper, LogUtilities log)
          Constructor providing the STAFHelper and LogUtilities needed for proper operation.
AbbotGUIUtilities(STAFHelper helper, TestRecordData data, LogUtilities log)
          Constructor providing the STAFHelper, LogUtilities, and TestRecordData for proper operation.
 
Method Summary
 java.util.List extractListItems(java.lang.Object obj, java.lang.String countProp, java.lang.String itemProp)
          Extract items from a List or Array type of object.
 Tree extractMenuBarItems(java.lang.Object obj)
          Extract a menu hierarchy from a MenuBar pseudo-object reference.
 Tree extractMenuItems(java.lang.Object obj)
          Extract a menu hierarchy from a object.
 java.lang.Object findPropertyMatchedChild(java.lang.Object obj, java.lang.String property, java.lang.String bench, boolean exactMatch)
          Attempt to locate a child object based on a matching property value.
 java.lang.String getListItem(java.lang.Object obj, int i, java.lang.String itemProp)
          Get a single indexed item from a List or Array type of object.
static boolean hasLocalServer()
          true if our RMI server is a valid instanceof LocalServer.
 int setActiveWindow(java.lang.String appMapName, java.lang.String windowName, java.lang.String compName)
          Attempts to "activate" or give focus to the specified window/object via the remote AUT JVM proxies.
static void setLocalServer(LocalServer aserver)
          Set the RMI server to use.
 int waitForObject(java.lang.String appMapName, java.lang.String windowName, java.lang.String compName, long secTimeout)
          Uses the Application Map caching mechanism provided by the superclass.
 
Methods inherited from class org.safs.DDGUIUtilities
clearAllAppMapCaches, clearAppMapCache, createAppMapInstance, getAppMap, getLogUtilities, getTestRecordData, isAppMapRegistered, maximizeWindow, minimizeWindow, openAppMap, registerAppMap, registerAppMap, restoreWindow, setLogUtilities, setTestRecordData, setWindowFocus
 
Methods inherited from class org.safs.STAFRequester
getSTAFHelper, setSTAFHelper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

server

protected static AServerImpl server
The RMI server used to control the RMI bridge that talks with the JVMAgents inserted into every "enabled" Java JVM launched. The SAFS/Abbot engine uses an instanceof AServerImpl to talk with each JVMAgent.

See Also:
AServerImpl, JVMAgent
Constructor Detail

AbbotGUIUtilities

public AbbotGUIUtilities()
No-argument constructor. Simply calls super()

See Also:
DDGUIUtilities.DDGUIUtilities()

AbbotGUIUtilities

public AbbotGUIUtilities(STAFHelper helper,
                         LogUtilities log)
Constructor providing the STAFHelper and LogUtilities needed for proper operation.

Parameters:
helper - The STAFHelper for performing STAF requests.
log - the LogUtilities for logging.
See Also:
STAFHelper, LogUtilities

AbbotGUIUtilities

public AbbotGUIUtilities(STAFHelper helper,
                         TestRecordData data,
                         LogUtilities log)
Constructor providing the STAFHelper, LogUtilities, and TestRecordData for proper operation. The SAFS/Abbot engine generally uses an instanceof ATestRecordHelper for TestRecordData.

Parameters:
helper - The STAFHelper for performing STAF requests.
data - the TestRecordData generally an instanceof ATestRecordHelper.
log - the LogUtilities for logging.
See Also:
STAFHelper, ATestRecordHelper, LogUtilities
Method Detail

setLocalServer

public static void setLocalServer(LocalServer aserver)
Set the RMI server to use. Should be an instanceof AServerImpl.


hasLocalServer

public static boolean hasLocalServer()
true if our RMI server is a valid instanceof LocalServer.


waitForObject

public int waitForObject(java.lang.String appMapName,
                         java.lang.String windowName,
                         java.lang.String compName,
                         long secTimeout)
                  throws SAFSObjectNotFoundException
Uses the Application Map caching mechanism provided by the superclass. Retrieves cached references or recognition strings from the App Map and attempts to identify the matching component via the remote AUT JVM proxies.

Specified by:
waitForObject in class DDGUIUtilities
Parameters:
appMapName - the name/ID of the App Map currently in use.
windowName - the name/ID of the window as predefined in the App Map.
compName - the name/ID of the child component of the window as predefined in the App Map.
secTimeout - the number of seconds allowed to located the object before a SAFSObjectNotFoundException is thrown.
Returns:
0 on success. throw SAFSObjectNotFouncException if not successful.
Throws:
SAFSObjectNotFoundException - if specified parent or child cannot be found.
See Also:
DDGUIUtilities.waitForObject(String,String,String,long)

setActiveWindow

public int setActiveWindow(java.lang.String appMapName,
                           java.lang.String windowName,
                           java.lang.String compName)
                    throws SAFSObjectNotFoundException
Attempts to "activate" or give focus to the specified window/object via the remote AUT JVM proxies.

Specified by:
setActiveWindow in class DDGUIUtilities
Parameters:
appMapName - name of AppMap used to lookup component.
windowName - name of Window in AppMap.
compName - name of Window Component in AppMap. If the Window IS the desired Component, then both windowName and compName will be the same.
Returns:
0 on success.
Throws:
SAFSObjectNotFoundException - if the specified component cannot be found.
See Also:
DDGUIUtilities.setActiveWindow(String,String,String)

extractListItems

public java.util.List extractListItems(java.lang.Object obj,
                                       java.lang.String countProp,
                                       java.lang.String itemProp)
                                throws SAFSException
Extract items from a List or Array type of object.

Specified by:
extractListItems in class DDGUIUtilities
Parameters:
obj - AgentWindow reference to the remote component.
countProp - String property which will contain an Integer count of items available.
itemProp - String the property to retrieve from any non-String object received as a List Item. For example, if we were to receive a TreeNode object for each item in the List instead of a String we will then retrieve the value of the specified itemProp property from each TreeNode and use that as the List Item value.
Returns:
List
Throws:
SAFSException
See Also:
DDGUIUtilities.extractListItems(Object,String,String)

getListItem

public java.lang.String getListItem(java.lang.Object obj,
                                    int i,
                                    java.lang.String itemProp)
                             throws SAFSException
Get a single indexed item from a List or Array type of object.

Specified by:
getListItem in class DDGUIUtilities
Parameters:
obj - AgentWindow reference to the remote component.
i - int index into object list or array.
itemProp - String property which will contain the List or Array of items
Returns:
String
Throws:
SAFSException
See Also:
DDGUIUtilities.getListItem(Object,int,String), AgentWindow

extractMenuBarItems

public Tree extractMenuBarItems(java.lang.Object obj)
                         throws SAFSException
Extract a menu hierarchy from a MenuBar pseudo-object reference. Often this can be served by the extracMenuItems function. This is generally for JMenuBars.

Specified by:
extractMenuBarItems in class DDGUIUtilities
Parameters:
obj - AgentWindow reference to the remote component.
Returns:
org.safs.Tree
Throws:
SAFSException
See Also:
DDGUIUtilities.extractMenuBarItems(Object)

extractMenuItems

public Tree extractMenuItems(java.lang.Object obj)
                      throws SAFSException
Description copied from class: DDGUIUtilities
Extract a menu hierarchy from a object. This is generally for JPopupMenus, JMenus, and JMenuItems (JMenu is subclass of JMenuItem).

Specified by:
extractMenuItems in class DDGUIUtilities
Parameters:
obj - AgentWindow reference to the remote component.
Returns:
org.safs.Tree
Throws:
SAFSException
See Also:
DDGUIUtilities.extractMenuItems(Object)

findPropertyMatchedChild

public java.lang.Object findPropertyMatchedChild(java.lang.Object obj,
                                                 java.lang.String property,
                                                 java.lang.String bench,
                                                 boolean exactMatch)
                                          throws SAFSObjectNotFoundException
Attempt to locate a child object based on a matching property value. The check can require an exactMatch; or, a case-insensitive partial substring match if the exactMatch parameter is false.

Uses StringUtils.isCaseContainsMatch

Specified by:
findPropertyMatchedChild in class DDGUIUtilities
Parameters:
obj - AgentWindow reference to the remote component.

property - -- the property of each child that will be evaluated. The property is expected to be a Value Property that can successfully return a value cast as type String.

bench - -- the benchmark value for the property to be used in comparisons.

exactMatch - -- if true, an exact case-sensitive match of the bench value provided is required to signal a match.
if false, a case-insensitive partial substring match with the bench value is performed.

Returns:
Object, the first child object whose property value matches accordingly; or,
a SAFSObjectNotFoundException if not found.
Throws:
SAFSObjectNotFoundException
See Also:
DDGUIUtilities.findPropertyMatchedChild(Object,String,String,boolean)