public class Utilities
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static java.lang.String |
FILE_COLON_STRING |
Constructor and Description |
---|
Utilities() |
Modifier and Type | Method and Description |
---|---|
static void |
autoConfigure(java.lang.String className,
JSAFSConfiguredClassStore store)
This is where auto-configuration and execution of JSAFS-specific tests will generally
occur.
|
(package private) static void |
debug(java.lang.String message) |
(package private) static void |
executeAnnotatedMethods(java.util.Hashtable<java.lang.Integer,java.util.Hashtable<java.lang.reflect.Method,java.lang.Object>> annotatedMehods,
boolean ascending)
Execute methods stored in a hashtable according to the method's order.
|
static java.util.List<java.lang.Class<?>> |
getPackageClasses(java.lang.String classname,
java.util.List<java.lang.Class<?>> cList,
java.util.List<java.lang.String> exclusions)
Given a full classname (not a package name) find the parent package
and attempt to locate all classes in that package and all sub-packages.
|
static void |
injectRuntimeDataAwareClasses(java.lang.Object classInstance,
java.util.ArrayList<java.lang.String> altPackageNames,
RuntimeDataInterface dataInterface)
Look for classes (like AppMapGenerated classes) that may want access to a RuntimeDataInterface.
|
static final java.lang.String FILE_COLON_STRING
static void debug(java.lang.String message)
public static java.util.List<java.lang.Class<?>> getPackageClasses(java.lang.String classname, java.util.List<java.lang.Class<?>> cList, java.util.List<java.lang.String> exclusions)
The routine will be creating a static copy of each Class, so the classes will go through their initial static initialization if this has not already happened.
classname
- -- the full name of the class to interrogate.
Ex: my.test.package.MyTestcList
- -- the current List of classes to append to.exclusions
- -- a List of package names (not classnames) to be excluded from the search.
Ex: my.test.package.otherstuff#getPackageClasses(Package, List, List)
public static void injectRuntimeDataAwareClasses(java.lang.Object classInstance, java.util.ArrayList<java.lang.String> altPackageNames, RuntimeDataInterface dataInterface)
EXPERIMENTAL
It is IMPORTANT to note that this Dependency Injection model will create a temporary and non-cached instance of the RuntimeDataAware Class solely for the purpose of invoking the setRuntimeDataInterface instance Method. In order for subsequent instances to make use of the RuntimeDataInterface object it is necessary that any and all instances should store it in a shared (static) field.
This is NOT part of the normal autoConfigure(String, JSAFSConfiguredClassStore)
process.
That process is separate and independent and may happen in addition to this function.
classInstance
- -- The class instance--usually the Main class for the test--to use to seek
associated packages and classes containing RuntimeDataAware classes.altPackageNames
- -- list of associated package names to search for RuntimeDataAware classes.dataInterface
- -- the RuntimeDataInterface to pass along to RuntimeDataAware classes.AppMapGenerator
,
RuntimeDataAware
,
RuntimeDataInterface
,
RuntimeDataAware.setRuntimeDataInterface(RuntimeDataInterface)
public static void autoConfigure(java.lang.String className, JSAFSConfiguredClassStore store)
The Class initialized from the className is checked for the AutoConfigureJSAFS annotation to see if additional class packages and sub-packages should be included or excluded from the configuration and execution.
The routine will identify and instantiate all the classes in the package and all sub-packages relative the inclusion list. Those Classes and Methods within the Classes containing JSAFS annotations for configuration or execution will be configured and prepared for execution--including the proper sorting of execution order, if any.
All successfully instantiated Object instances are stored for post-test availability.
After all preparations are complete, any Methods tagged for execution are executed in the order as defined by associated annotations.
className
- -- Initially, the name of the class that is requesting the automatic
configuration and execution. For example, the Runner Class will call into here with
the name of the class that invoked Runner.autorun().store
- -- the JSAFSConfiguredClassStore that will maintain references to
instantiated object instances for later use by the user, if needed.Runner.autorun(String[])
,
Runner.getConfiguredClassInstance(String)
static void executeAnnotatedMethods(java.util.Hashtable<java.lang.Integer,java.util.Hashtable<java.lang.reflect.Method,java.lang.Object>> annotatedMehods, boolean ascending)
annotatedMehods
- Hashtableascending,
- boolean, True to execute methods in ascending order; False in descending order.Copyright © SAS Institute. All Rights Reserved.