public abstract class DefaultDriver extends AbstractDriver
AbstractDriver.processTest()
.
We use String-based Interface objects for inter-API communication.
The driver monitors SAFSVARS variable 'SAFS_DRIVER_CONTROL'. If this variable is set to 'SHUTDOWN_HOOK' then the driver will initiate a shutdown.
The driver will provide a Frame monitor allowing the user to initiate such a shutdown.
(Carl Nagle) DEC 10, 2008 Fixed LogMode problems affecting XML Logging
(LeiWang)APR 20, 2010 Modify method initializePresetVariables(): Read the OCR settings from INI file,
then set them to STAF Variables.
(LeiWang)JUL 13, 2010 Modify method initializePresetVariables(): Read the IBT settings from INI file,
then set to ImageUtils
(JunwuMa)SEP 27, 2010 Added initialization for step retry working with SAFSMonitorFrame.
Oct 26, 2010 (Carl Nagle) Refactored to support separate misc config initialization
Jul 08, 2011 (Carl Nagle) Add support for PREFERRED_ENGINES_OVERRIDE
SEP 12, 2013 (Carl Nagle) Add Daemon threads for SAFSMonitor shutdown.
OCT 09, 2016 (Lei Wang) Modified validateTestParameters(): handle 'DndReleaseDelay'.
UniqueStringID
,
UniqueStringLogInfo
Modifier and Type | Field and Description |
---|---|
protected UniqueStringLogInfo |
cycleLog |
protected StacksInterface |
cycleStack |
protected CaseInsensitiveHashtable |
engineObjects
Stores ALL instanced EngineInterface objects in classname=engine format.
|
protected java.util.Vector |
enginePreference
Stores only active 'preferred' engine class names in preferred order.
|
protected java.util.Vector |
engines
Stores ALL instanced EngineInterface objects in instanced order.
|
protected SAFSMonitorFrame |
safsmonitor |
protected SAFSSTATUS |
status |
protected UniqueStringLogInfo |
stepLog |
protected StacksInterface |
stepStack |
protected UniqueStringLogInfo |
suiteLog |
protected StacksInterface |
suiteStack |
boolean |
useSAFSMonitor
If true, the SAFS Monitor window can be
used to control test execution--allowing the tester to interactively PAUSE the test, STEP through
portions of the test, or force a premature SHUTDOWN (Abort) of the test--including any running SAFS
Engines.
|
autoitcomponent, benchSource, configInfo, core, counterInfo, counts, cycleflowcontrol, cycleLinkedFac, cycleLogMode, cycleLogName, cycleSeparator, cycleSuffix, datapoolSource, debug, difSource, driverConfigPath, driverName, driverRootDir, exitCycle, exitSuite, expressionsOn, input, ipcommands, locator, logLevel, logs, logsSource, maps, millisBetweenRecords, perTableFlowControl, projectConfigPath, projectRootDir, statuscounts, stepflowcontrol, stepLinkedFac, stepLogMode, stepLogName, stepSeparator, stepSuffix, suiteflowcontrol, suiteLinkedFac, suiteLogMode, suiteLogName, suiteSeparator, suiteSuffix, testLevel, testName, testSource, tidcommands, tidcomponent, vars, verifySource
DRIVER_CONTROL_POF_VAR, DRIVER_CONTROL_POW_VAR, DRIVER_CONTROL_VAR
Constructor and Description |
---|
DefaultDriver() |
Modifier and Type | Method and Description |
---|---|
void |
clearEnginePreferences() |
protected void |
closeTestLogs()
Close logs initialized with openTestLogs.
|
void |
endEnginePreference(java.lang.String key) |
protected EngineInterface |
getEngineInterface(java.lang.String itemName)
Locate an EngineInterface given the engine priority string as defined in the
documented Configuration File standard for SAFS_ENGINES.
|
java.util.ListIterator |
getEnginePreferences() |
java.util.ListIterator |
getEngines() |
protected java.lang.String |
getFullEngineClass(java.lang.String key)
used internally or by subclasses to find the validity of an engine name.
|
protected GenericToolsInterface |
getGenericInterface(java.lang.String configSection,
java.lang.String defaultInterface) |
protected java.lang.String |
getLogID(java.lang.String testlevel)
Returns the logid based on the current testLevel.
|
EngineInterface |
getPreferredEngine(java.lang.String key)
Retrieve a running
EngineInterface engineObject by stored classname. |
protected int |
getPreferredEngineIndex(java.lang.String key)
used internally to find the index of an engine marked as "preferred"
|
protected java.lang.String |
getTestLevelSeparator(java.lang.String testlevel)
Returns the separator based on the current testLevel.
|
boolean |
hasEnginePreferences() |
protected void |
initializeMiscConfigInfo()
Initialize other miscellaneous config info from INI files.
|
protected void |
initializePresetVariables()
Initialize any preset SAFS variables such as known project directories, etc.
|
protected void |
initializeRuntimeEngines()
Instantiate and initialize any EngineInterface classes (up to 10)listed in the
SAFS_ENGINE section of the Configuration Source.
|
protected void |
initializeRuntimeInterface()
Initialize all the Driver/Engine interfaces as specified by the config files or
driver defaults (Status is a SAFSSTATUS object directly instanced).
|
protected UniqueStringLogInfo |
initLog(java.lang.String logname,
long logmodes,
java.lang.String loglevel)
Initialize a log and set the loglevel via the LogsInterface.
|
protected void |
insertConfigureInterfaceSource(ConfigureInterface source)
Initialize or insert a ConfigureInterface at the start of the search order.
|
boolean |
isPreferredEngine(EngineInterface engine) |
boolean |
isPreferredEngine(java.lang.String key) |
boolean |
isUseSAFSMonitor() |
protected void |
launchSAFSMonitor()
Only launches if there is already not one running from another process.
|
protected void |
openTestLogs()
Instantiate unique logs.
|
protected long |
parseLogMode(java.lang.String value)
parse a configuration file logmode entry for valid text or numeric values.
|
void |
run()
Bootstrap a newly instanced driver.
|
void |
setUseSAFSMonitor(boolean useSAFSMonitor) |
protected void |
shutdownRuntimeEngines()
shutdown any engines started with initializeRuntimeEngines()
|
protected void |
shutdownRuntimeInterface()
shutdown interfaces started with initializeRuntimeInterfaces()
(Carl Nagle) 2013.09.23 Change the order of shutdown to be reverse of initialization.
|
void |
startEnginePreference(java.lang.String key) |
protected void |
validateLogParameters()
Verify the existence of sufficient test information.
|
protected void |
validateTestParameters()
Verify the existence of sufficient test information.
|
addConfigureInterfaceSource, addStatusCounts, getAutoItComponentSupport, getBenchDir, getConfigureInterface, getConfigureLocator, getCoreInterface, getCountersInterface, getCycleLogMode, getCycleLogName, getCycleSeparator, getCycleSuffix, getDatapoolDir, getDebugInterface, getDifDir, getDriverName, getDriverRootDir, getFlowControlInterface, getInputInterface, getIPDriverCommands, getLogLevel, getLogsDir, getLogsInterface, getMapsInterface, getMillisBetweenRecords, getParameterValue, getProjectDirectoryInfo, getProjectRootDir, getRootDirectoryInfo, getRootVerifyDir, getStatusInterface, getStepLogMode, getStepLogName, getStepSeparator, getStepSuffix, getSuiteLogMode, getSuiteLogName, getSuiteSeparator, getSuiteSuffix, getTestDir, getTestLevel, getTestName, getTIDDriverCommands, getTIDGUIlessComponentSupport, getVarsInterface, incrementGeneralStatus, incrementTestStatus, isExitCycle, isExitSuite, isExpressionsEnabled, isModifiedConfig, isModifiedRoot, isPerTableFlowControl, logMessage, processEmbeddedVariable, processTest, resetModifiedProperties, setBenchDir, setDatapoolDir, setDifDir, setExitCycle, setExitSuite, setExpressionsEnabled, setLogsDir, setMillisBetweenRecords, setPerTableFlowControl, setProjectRootDir, setRootVerifyDir, setTestDir, validateRootConfigureParameters
protected SAFSMonitorFrame safsmonitor
protected SAFSSTATUS status
protected StacksInterface cycleStack
protected StacksInterface suiteStack
protected StacksInterface stepStack
public boolean useSAFSMonitor
To ignore the default SAFS Monitor integration, the developer can set this value to 'false'.
The default setting is 'true'.
protected java.util.Vector engines
protected java.util.Vector enginePreference
protected CaseInsensitiveHashtable engineObjects
CaseInsensitiveHashtable
protected UniqueStringLogInfo cycleLog
protected UniqueStringLogInfo suiteLog
protected UniqueStringLogInfo stepLog
public boolean isUseSAFSMonitor()
public void setUseSAFSMonitor(boolean useSAFSMonitor)
public java.util.ListIterator getEngines()
DriverInterface.getEngines()
public java.util.ListIterator getEnginePreferences()
DriverInterface.getEnginePreferences()
protected int getPreferredEngineIndex(java.lang.String key)
protected java.lang.String getFullEngineClass(java.lang.String key) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public EngineInterface getPreferredEngine(java.lang.String key) throws java.lang.IllegalArgumentException
EngineInterface
engineObject by stored classname.key
- full classname or simple classname of engine to retrieve.
For example, "SAFSROBOTJ" will successfully get "org.safs.tools.engines.SAFSROBOTJ"
if it is running.java.lang.IllegalArgumentException
getFullEngineClass(String)
,
DriverInterface.getPreferredEngine(String)
,
engineObjects
public boolean hasEnginePreferences()
DriverInterface.hasEnginePreferences()
public void startEnginePreference(java.lang.String key) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
DriverInterface.startEnginePreference(String)
public void endEnginePreference(java.lang.String key) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
DriverInterface.endEnginePreference(String)
public void clearEnginePreferences()
DriverInterface.clearEnginePreferences()
public boolean isPreferredEngine(java.lang.String key) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
DriverInterface.isPreferredEngine(String)
public boolean isPreferredEngine(EngineInterface engine) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
DriverInterface.isPreferredEngine(EngineInterface)
protected EngineInterface getEngineInterface(java.lang.String itemName)
protected void insertConfigureInterfaceSource(ConfigureInterface source)
protected void validateTestParameters()
protected long parseLogMode(java.lang.String value)
protected void validateLogParameters()
protected GenericToolsInterface getGenericInterface(java.lang.String configSection, java.lang.String defaultInterface) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
protected void initializeRuntimeInterface()
protected void initializeRuntimeEngines()
This driver passes itself--a DriverInterface object--to each instanced engine.
protected void initializePresetVariables()
Known preset variables are:
protected void initializeMiscConfigInfo()
Currently processed values:
protected UniqueStringLogInfo initLog(java.lang.String logname, long logmodes, java.lang.String loglevel)
protected void openTestLogs()
protected void closeTestLogs()
protected void shutdownRuntimeEngines()
protected void shutdownRuntimeInterface()
protected java.lang.String getTestLevelSeparator(java.lang.String testlevel)
protected java.lang.String getLogID(java.lang.String testlevel)
protected void launchSAFSMonitor()
public void run()
The model for overall driver operation is that any command-line arguments or configuration file arguments that prevent normal execution will generate an IllegalArgumentException. Those IllegalArgumentExceptions are caught here and sent to stderr output. We then return immediately from this function.
AbstractDriver.validateRootConfigureParameters(boolean)
validateTestParameters()
validateLogParameters()
initializeRuntimeInterface()
launchSAFSMonitor()
initializePresetVariables()
initializeMiscConfigInfo()
initializeRuntimeEngines()
openTestLogs()
AbstractDriver.processTest()
closeTestLogs()
shutdownRuntimeEngines()
shutdownRuntimeInterface()
SAFSMonitorFrame.dispose()
SAFSDRIVER.main(String[])
Copyright © SAS Institute. All Rights Reserved.