public class RDDGUIUtilities extends DDGUIUtilities
Modifier and Type | Field and Description |
---|---|
(package private) RGuiClassData |
classdata |
appmaps, DEBUG_MESSAGE, FAILED_MESSAGE, FAILED_OK_MESSAGE, GENERIC_MESSAGE, log, PASSED_MESSAGE, trdata, WARNING_MESSAGE, WARNING_OK_MESSAGE
staf
Constructor and Description |
---|
RDDGUIUtilities()
The default, JavaBean-happy constructor.
|
RDDGUIUtilities(STAFHelper helper,
Script script,
LogUtilities log)
Constructor providing the STAFHelper and Script needed by the instance for
proper operation.
|
RDDGUIUtilities(STAFHelper helper,
Script script,
RTestRecordData data,
LogUtilities log)
Constructor providing the STAFHelper, Script, and RTestRecordData needed by the
instance for proper operation.
|
Modifier and Type | Method and Description |
---|---|
void |
clearAllAppMapCaches()
clear all known local App Maps' caches.
|
void |
clearAppMapCache(java.lang.String mapname)
clear a single local App Map cache of all old references.
|
java.util.List |
extractListItems(java.lang.Object obj,
java.lang.String countProp,
java.lang.String itemProp)
Purpose: extract a list of items from a TestObject. |
Tree |
extractMenuBarItems(java.lang.Object obj)
required implementation for superclass
|
Tree |
extractMenuItems(java.lang.Object obj)
required implementation for superclass
|
java.lang.Object |
findPropertyMatchedChild(java.lang.Object testobject,
java.lang.String property,
java.lang.String bench,
boolean exactMatch)
Attempt to locate a child object based on a matching property value.
|
static GuiTestObject |
getGuiTestObject(TestObject obj)
Cast TestObject to GuiTestObject or create new GuiTestObject(ob).
|
static java.lang.String |
getHtmlDocTitle(TestObject obj) |
static TestObject |
getHtmlDocumentObject(TestObject obj) |
java.lang.String |
getListItem(java.lang.Object obj,
int i,
java.lang.String itemProp)
Purpose: get a list item from a TestObject. |
static TestObject |
getMappedTestObject(SpyMappedTestObject spy)
Create appropriate TestObject from SpyMappedTestObject
|
TopLevelTestObject |
getParentTestObject(TestObject obj)
Attempt to retrieve either a TopLevelTestObject or BrowserTestObject, based on if it
is a browser or not.
|
Script |
getScript() |
TestObject |
getTestObject(java.lang.String mapname,
java.lang.String windowName,
java.lang.String childName)
Attempt to retrieve a TestObject using the named references; this version
calls the other version, passing 'false' to param 'ignoreCache'
|
TestObject |
getTestObject(java.lang.String mapname,
java.lang.String windowName,
java.lang.String childName,
boolean ignoreCache)
Attempt to retrieve a TestObject using the named references; this version
calls the other version, passing 'false' to param 'ignoreCache', and passing
null to 'gather'
|
TestObject |
getTestObject(java.lang.String mapname,
java.lang.String windowName,
java.lang.String childName,
boolean ignoreCache,
java.util.List gather)
Attempt to retrieve a TestObject using the named references.
|
TestObject |
getTestObject(java.lang.String mapname,
java.lang.String windowName,
java.lang.String childName,
boolean ignoreCache,
java.lang.String nameString)
Attempt to retrieve a TestObject using the named references.
|
protected void |
listAllProperties(TestObject obj,
java.lang.String str) |
void |
listMapElements()
Purpose: list Map elements Side Effects: Assumptions: none |
protected void |
listMethods(TestObject obj) |
protected void |
listNonValueProperties(TestObject obj) |
protected void |
listProperties(TestObject obj) |
void |
listTopLevelObjects()
Purpose: list Map elements Side Effects: Assumptions: none |
boolean |
registerAppMap(java.lang.String mapname,
java.lang.String mapfile)
Register an AppMap for use.
|
int |
setActiveWindow(java.lang.String mapName,
java.lang.String windowName,
java.lang.String compName)
"Activate" the specified component's topmost parent.
|
void |
setScript(Script script)
A one-time setting of the Script (RationalTestScript) to be used by this instance.
|
int |
waitForObject(java.lang.String mapName,
java.lang.String windowName,
java.lang.String compName,
long secTimeout)
Wait up to a maximum timeout value for the specified component to "exist".
|
createAppMapInstance, getAppMap, getLogUtilities, getTestRecordData, isAppMapRegistered, openAppMap, registerAppMap, setLogUtilities, setTestRecordData
getSTAFHelper, setSTAFHelper
RGuiClassData classdata
public RDDGUIUtilities()
public RDDGUIUtilities(STAFHelper helper, Script script, LogUtilities log)
helper
- The STAFHelper for performing STAF requests.script
- The Script (RationalTestScript) needed for RobotJ functions.public RDDGUIUtilities(STAFHelper helper, Script script, RTestRecordData data, LogUtilities log)
helper
- The STAFHelper for performing STAF requests.script
- The Script (RationalTestScript) needed for RobotJ functions.data
- The RTestRecordData needed for getting and updated TestRecordData.public void setScript(Script script)
public Script getScript()
public boolean registerAppMap(java.lang.String mapname, java.lang.String mapfile)
registerAppMap
in class DDGUIUtilities
mapname
- the name of the map to register/open. This will be
the same name used by the SAFSMAPS service to identify
the AppMap.
mapfile
- the filename of the file in the event we have to open it.
This can be a relative or fullpath filename depending on
how the SAFSMAPS service was configured. If mapfile is null,
the underlying routines will attempt to use mapname as the
mapfile filename.
public void clearAppMapCache(java.lang.String mapname)
clearAppMapCache
in class DDGUIUtilities
mapname
- of the App Map to clearScript.localUnregisterAll()
public void clearAllAppMapCaches()
clearAllAppMapCaches
in class DDGUIUtilities
Script.localUnregisterAll()
public TopLevelTestObject getParentTestObject(TestObject obj)
obj
- a TestObject
public TestObject getTestObject(java.lang.String mapname, java.lang.String windowName, java.lang.String childName)
First we see if the object is already cached in the TestRecordData.
Then we will see if it is already cached in our internal AppMap storage.
Then we will attempt to locate the object in the available RobotJ Object Map.
If not in any of these places, we will then attempt to locate the object by traversing the TestObject hierarchy in all supported test domains. The routine will require recognition strings retrieved from the external SAFSMAPS AppMap to identify parent and child components during this search.
The mapname is expected to already be open and registered prior to this call. If it is not, we will make an attempt to open/register the AppMap using the mapname provided. However, success on this is dependent on how the SAFSMAPS service was configured at launch and the extent of path information available in mapname.
mapname
- the name of the stored AppMap
windowName
- the name of the parent object to retrieve. This
cannot be null as we always look for a parent object
prior to walking the tree to look for its child.
childName
- the name of the child object to find. If the parent
object is actually the item of interest, then provide
windowName as the childName as well.
public TestObject getTestObject(java.lang.String mapname, java.lang.String windowName, java.lang.String childName, boolean ignoreCache)
First we see if the object is already cached in the TestRecordData.
Then we will see if it is already cached in our internal AppMap storage.
Then we will attempt to locate the object in the available RobotJ Object Map.
If not in any of these places, we will then attempt to locate the object by traversing the TestObject hierarchy in all supported test domains. The routine will require recognition strings retrieved from the external SAFSMAPS AppMap to identify parent and child components during this search.
The mapname is expected to already be open and registered prior to this call. If it is not, we will make an attempt to open/register the AppMap using the mapname provided. However, success on this is dependent on how the SAFSMAPS service was configured at launch and the extent of path information available in mapname.
mapname
- the name of the stored AppMap
windowName
- the name of the parent object to retrieve. This
cannot be null as we always look for a parent object
prior to walking the tree to look for its child.
childName
- the name of the child object to find. If the parent
object is actually the item of interest, then provide
windowName as the childName as well.ignoreCache
- will ignore the cached TestObject, and refind it if true.
public TestObject getTestObject(java.lang.String mapname, java.lang.String windowName, java.lang.String childName, boolean ignoreCache, java.util.List gather)
First we see if the object is already cached in the TestRecordData.
Then we will see if it is already cached in our internal AppMap storage.
Then we will attempt to locate the object in the available RobotJ Object Map.
If not in any of these places, we will then attempt to locate the object by traversing the TestObject hierarchy in all supported test domains. The routine will require recognition strings retrieved from the external SAFSMAPS AppMap to identify parent and child components during this search.
The mapname is expected to already be open and registered prior to this call. If it is not, we will make an attempt to open/register the AppMap using the mapname provided. However, success on this is dependent on how the SAFSMAPS service was configured at launch and the extent of path information available in mapname.
mapname
- the name of the stored AppMap
windowName
- the name of the parent object to retrieve. This
cannot be null as we always look for a parent object
prior to walking the tree to look for its child.
childName
- the name of the child object to find. If the parent
object is actually the item of interest, then provide
windowName as the childName as well.
ignoreCache
- will ignore the cached TestObject, and refind it if true.
gather,
- List containing names matched, if null, then match first name
public TestObject getTestObject(java.lang.String mapname, java.lang.String windowName, java.lang.String childName, boolean ignoreCache, java.lang.String nameString)
First we see if the object is already cached in the TestRecordData.
Then we will see if it is already cached in our internal AppMap storage.
Then we will attempt to locate the object in the available RobotJ Object Map.
If not in any of these places, we will then attempt to locate the object by traversing the TestObject hierarchy in all supported test domains. The routine will require recognition strings retrieved from the external SAFSMAPS AppMap to identify parent and child components during this search.
The mapname is expected to already be open and registered prior to this call. If it is not, we will make an attempt to open/register the AppMap using the mapname provided. However, success on this is dependent on how the SAFSMAPS service was configured at launch and the extent of path information available in mapname.
mapname
- the name of the stored AppMap
windowName
- the name of the parent object to retrieve. This
cannot be null as we always look for a parent object
prior to walking the tree to look for its child.
childName
- the name of the child object to find. If the parent
object is actually the item of interest, then provide
windowName as the childName as well.
ignoreCache
- will ignore the cached TestObject, and refind it if true.
nameString,
- name of the actual component, (childName should end in Name=*)
public int waitForObject(java.lang.String mapName, java.lang.String windowName, java.lang.String compName, long secTimeout) throws SAFSObjectNotFoundException
waitForObject
in class DDGUIUtilities
mapName
- 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.secTimeout
- maximum wait in secondsSAFSObjectNotFoundException
- if the component or its parent cannot be found.localWaitForObject(String, String, String, long, boolean)
public java.lang.Object findPropertyMatchedChild(java.lang.Object testobject, java.lang.String property, java.lang.String bench, boolean exactMatch) throws SAFSObjectNotFoundException
Uses StringUtils.isCaseContainsMatch
findPropertyMatchedChild
in class DDGUIUtilities
testobject
- -- the object whose children will be evaluated. This is expected to be
castable to a TestObject instance.
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.SAFSObjectNotFoundException
- if no matching child object is found.
StringUtils.isCaseContainsMatch(String,String,boolean)
public int setActiveWindow(java.lang.String mapName, java.lang.String windowName, java.lang.String compName) throws SAFSObjectNotFoundException
setActiveWindow
in class DDGUIUtilities
mapName
- 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.SAFSObjectNotFoundException
- if the component or its parent cannot be found.public void listMapElements()
script,
- Object (Script)public void listTopLevelObjects()
script,
- Object (Script)public java.util.List extractListItems(java.lang.Object obj, java.lang.String countProp, java.lang.String itemProp) throws SAFSException
for(int i=0; i GuiTestObject item = (GuiTestObject)
((GuiSubitemTestObject)obj).getSubitem(script.localAtIndex(i));
result.add(item.getProperty(itemProp));
}
This is the pseudo code for String items:
for(int i=0; i String item = (String)
((GuiSubitemTestObject)obj).getSubitem(script.localAtIndex(i));
result.add(item);
}
extractListItems
in class DDGUIUtilities
obj,
- Object (actually of type GuiSubitemTestObject)countProp,
- String, the property which will contain an Integer count of itemsitemProp,
- String, the property which will containSAFSException
public java.lang.String getListItem(java.lang.Object obj, int i, java.lang.String itemProp) throws SAFSException
GuiTestObject item = (GuiTestObject)
((GuiSubitemTestObject)obj).getSubitem(script.localAtIndex(i));
result.add(item.getProperty(itemProp));
This is the pseudo code for String items:
String item = (String)
((GuiSubitemTestObject)obj).getSubitem(script.localAtIndex(i));
result.add(item);
getListItem
in class DDGUIUtilities
obj,
- Object (actually of type GuiSubitemTestObject)i,
- int, index into objectitemProp,
- String, the property which will containSAFSException
public Tree extractMenuBarItems(java.lang.Object obj) throws SAFSException
extractMenuBarItems
in class DDGUIUtilities
SAFSException
public Tree extractMenuItems(java.lang.Object obj) throws SAFSException
extractMenuItems
in class DDGUIUtilities
SAFSException
protected void listAllProperties(TestObject obj, java.lang.String str)
protected void listProperties(TestObject obj)
protected void listNonValueProperties(TestObject obj)
protected void listMethods(TestObject obj)
public static TestObject getHtmlDocumentObject(TestObject obj)
obj
- descendant TestObject in an Html.HtmlDocumentpublic static java.lang.String getHtmlDocTitle(TestObject obj)
obj
- TestObject expected to support 'title' or '.title' propertiespublic static GuiTestObject getGuiTestObject(TestObject obj)
obj
- TestObject expected to be cast or created as GuiTestObject.public static TestObject getMappedTestObject(SpyMappedTestObject spy)
SpyMappedTestObject
- - SpyMappedTestObjectCopyright © SAS Institute. All Rights Reserved.