public class STAFProcessContainerDriver extends AbstractDriver
This class is intended to be used by STAFProcessContainer, but may be useful as a generic "driver" that can initialize and then shutdown tools needed by a SAFS-like Driver that is NOT necessarily running tests.
Sample Usage:
Command-line Options and Configuration File Options are linked below.
The default name of configuration files is "SAFSTID.INI". There is a hierarchy of configuration files that will be sought based on command-line parameters provided. This hierarchy is summarized in the Configuration File Options doc linked below and detailed below:
In general, you want to provide the bare minimum of command-line parameters and place all remaining info in one or more configuration files. The total of all command-line parameters and config file information must enable the driver to locate valid driver and project root directories, project subdirectories, and all other items necessary to find and configure tools. See the #initializeDriver() link below for all the neat things the driver will do during initialization!
An example invocation, providing the bare minimum command-line parameters:
Sample ProcessContainer.INI in c:\SAFSProject:
[SAFS_PROJECT] ProjectRoot="C:\safsproject" [SAFS_ENGINES] First=org.safs.tools.engines.SAFSSELENIUM [SAFS_SELENIUM] AUTOLAUNCH=TRUE;Sample SAFSTID.INI in c:\SAFSProject used by 2default:
[SAFS_DRIVER] DriverRoot="C:\safs" [SAFS_MAPS] AUTOLAUNCH=TRUE [SAFS_INPUT] AUTOLAUNCH=TRUE [SAFS_VARS] AUTOLAUNCH=TRUE [SAFS_LOGS] AUTOLAUNCH=TRUE
And that is enough for the driver to configure the environment.
Of course, more of the configuration parameters necessary for desired engines will have to be in those configuration files once the engines actually become available.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_STAF_PROCESS_CONTAINER_DRIVER
"STAFProcessContainerDriver"
|
protected java.lang.String |
driverConfigPath |
protected java.util.Hashtable |
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 ConfigureLocatorInterface |
locator |
protected java.lang.String |
projectConfigPath |
autoitcomponent, benchSource, configInfo, core, counterInfo, counts, cycleflowcontrol, cycleLinkedFac, cycleLogMode, cycleLogName, cycleSeparator, cycleSuffix, datapoolSource, debug, description, difSource, driverName, driverRootDir, embeddedEngines, exitCycle, exitSuite, expressionsOn, input, ipcommands, logLevel, logs, logsSource, maps, millisBetweenRecords, orderable, perTableFlowControl, productName, projectRootDir, safsDataServiceID, statuscounts, stepflowcontrol, stepLinkedFac, stepLogMode, stepLogName, stepSeparator, stepSuffix, suiteflowcontrol, suiteLinkedFac, suiteLogMode, suiteLogName, suiteSeparator, suiteSuffix, testLevel, testName, testSource, tidcommands, tidcomponent, vars, verifySource, version
DRIVER_CONTROL_POF_VAR, DRIVER_CONTROL_POW_VAR, DRIVER_CONTROL_VAR
Constructor and Description |
---|
STAFProcessContainerDriver()
Default Constructor used by STAFProcessContainer.
|
STAFProcessContainerDriver(java.lang.String drivername) |
Modifier and Type | Method and Description |
---|---|
protected void |
addConfigureInterfaceSource(ConfigureInterface source)
Initialize or append a ConfigureInterface to existing ones in the search order.
|
void |
clearEnginePreferences() |
void |
endEnginePreference(java.lang.String key) |
protected ConfigureLocatorInterface |
getConfigureLocator(java.lang.String locatorInfo)
Locate a ConfigureLocatorInterface given the locatorInfo, presumably
provided from command-line options.
|
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 to find the validity of an engine name
|
protected GenericToolsInterface |
getGenericInterface(java.lang.String configSection,
java.lang.String defaultInterface)
Attempts to dynamically create a newInstance of a GenericToolsInterface object.
|
EngineInterface |
getPreferredEngine(java.lang.String key) |
protected int |
getPreferredEngineIndex(java.lang.String key)
used internally to find the index of an engine marked as "preferred"
|
boolean |
hasEnginePreferences() |
void |
initializeDriver()
Bootstrap a newly instanced driver.
|
protected void |
initializePresetVariables()
Initialize any preset 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.
|
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) |
protected StatusInterface |
processTest()
We do nothing here but return a newly initialized (empty) StatusInfo object.
|
void |
shutdownDriver()
|
protected void |
shutdownRuntimeEngines()
shutdown any engines started with initializeRuntimeEngines()
|
protected void |
shutdownRuntimeInterface()
shutdown GenericToolsInterfaces started with initializeRuntimeInterfaces()
|
void |
startEnginePreference(java.lang.String key) |
addEmbeddedEngine, addStatusCounts, collectEngines, collectFramework, collectHistory, collectMachine, collectUser, connectSAFSDataService, disconnectSAFSDataService, getAutoItComponentSupport, getBenchDir, getConfigureInterface, getCoreInterface, getCountersInterface, getCycleLogMode, getCycleLogName, getCycleSeparator, getCycleSuffix, getDatapoolDir, getDebugInterface, getDescription, getDifDir, getDriverName, getDriverRootDir, getEmbeddedEngines, getFlowControlInterface, getInputInterface, getIPDriverCommands, getLogLevel, getLogsDir, getLogsInterface, getMapsInterface, getMillisBetweenRecords, getParameterValue, getProductName, getProjectDirectoryInfo, getProjectRootDir, getRootDirectoryInfo, getRootVerifyDir, getStatusInterface, getStepLogMode, getStepLogName, getStepSeparator, getStepSuffix, getSuiteLogMode, getSuiteLogName, getSuiteSeparator, getSuiteSuffix, getTestDir, getTestLevel, getTestName, getTIDDriverCommands, getTIDGUIlessComponentSupport, getVarsInterface, getVersion, incrementGeneralStatus, incrementTestStatus, isExitCycle, isExitSuite, isExpressionsEnabled, isModifiedConfig, isModifiedRoot, isPerTableFlowControl, logMessage, phoneHome, phoneHome, processEmbeddedVariable, resetModifiedProperties, setBenchDir, setDatapoolDir, setDescription, setDifDir, setExitCycle, setExitSuite, setExpressionsEnabled, setLogsDir, setMillisBetweenRecords, setPerTableFlowControl, setProductName, setProjectRootDir, setRootVerifyDir, setTestDir, setVersion, validateRootConfigureParameters
public static final java.lang.String DEFAULT_STAF_PROCESS_CONTAINER_DRIVER
protected ConfigureLocatorInterface locator
protected java.util.Vector engines
protected java.util.Vector enginePreference
protected java.util.Hashtable engineObjects
protected java.lang.String driverConfigPath
protected java.lang.String projectConfigPath
public STAFProcessContainerDriver()
Once instantiated, the user must still call initializeDriver() to commence complete initialization of the driver and configured tools for use.
Once the user is finished with all driver functionality and tools the user must call shutdownDriver() to shutdown all configured tools and the driver itself.
Sample Usage:
public STAFProcessContainerDriver(java.lang.String drivername)
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
java.lang.IllegalArgumentException
DriverInterface.getPreferredEngine(String)
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 ConfigureLocatorInterface getConfigureLocator(java.lang.String locatorInfo)
getConfigureLocator
in class AbstractDriver
java.lang.IllegalArgumentException
- if appropriate locator class cannot be
instantiated.protected void addConfigureInterfaceSource(ConfigureInterface source)
addConfigureInterfaceSource
in class AbstractDriver
protected void insertConfigureInterfaceSource(ConfigureInterface source)
protected GenericToolsInterface getGenericInterface(java.lang.String configSection, java.lang.String defaultInterface) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException
If no such section exists in config, or no "Item" value is found, then the routine will attempt to instantiate the defaultInterface provided.
String
- configSection -- Named section of configuration file(s) potentially
containing the Name=Value pair of Item=My.Full.Classname.String
- defaultInterface -- fully qualified classname of class to
instantiate if no config file information is found.java.lang.ClassNotFoundException,
- java.lang.IllegalAccessException, java.lang.InstantiationExceptionjava.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
Class.forName(String)
protected void initializeRuntimeInterface()
java.lang.IllegalArgumentException
- if problems arise during initialization.protected void initializeRuntimeEngines()
Also instantiates internal tools.engines.TIDDriverCommands in-process support.
This driver passes itself--a DriverInterface object--to each instanced engine.
org.safs.tools.engines.TIDDriverCommands(DriverInterface)
protected void initializePresetVariables()
Known preset variables are:
protected void shutdownRuntimeEngines()
protected void shutdownRuntimeInterface()
protected StatusInterface processTest()
processTest
in class AbstractDriver
AbstractDriver.processTest()
,
org.safs.tools.status.StatusInfo()
public void initializeDriver()
This routine must be overridden by subclasses if they wish to change default start-to-finish execution flow.
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 and then rethrown. Any Exception will invoke shutdownDriver(). We immediately return from this function.
#validateRootConfigureParameters()
initializeRuntimeInterface()
initializeRuntimeEngines()
java.lang.IllegalArgumentException
shutdownDriver()
public void shutdownDriver()
Copyright © SAS Institute. All Rights Reserved.