Interface IManager
- All Known Implementing Classes:
AbstractGherkinManager
,AbstractManager
,OeconsolZosConsoleManagerImpl
This is the main interface used by the Framework to drive the Manager lifecycle.
For the Framework to find a Manager, the Manager must register this interface
as an OSGi Service Component, normally using the
Component
annotation.
-
Method Summary
Modifier and TypeMethodDescriptionShould the test class be run at all? Used to set the Test Class to Ignored.anyReasonTestMethodShouldBeIgnored
(@NotNull GalasaMethod galasaMethod) Should the Test Method be run at all? Used to set the Test Method to Ignored.boolean
areYouProvisionalDependentOn
(@NotNull IManager otherManager) Is this Manager dependent on the other Manager.boolean
The framework will check each manager during Shared Environment Build to see if they support shared environments.endOfTestClass
(@NotNull Result currentResult, Throwable currentException) Called when the Test Class has finishedendOfTestMethod
(@NotNull GalasaMethod galasaMethod, @NotNull Result currentResult, Throwable currentException) Called when the Test Method has finishedvoid
About to shutdown everythingextraBundles
(@NotNull IFramework framework) Gives the ability for the Manager to request additional bundles to be loaded dependent of CPS Properties.void
fillAnnotatedFields
(Object instantiatedTestClass) Fill/refill the annotated fields that belong to this Manager.void
initialise
(@NotNull IFramework framework, @NotNull List<IManager> allManagers, @NotNull List<IManager> activeManagers, @NotNull GalasaTest galasaTest) Initialise the Manager, if required.void
Can be used to perform Failure Analysis at this point and record the results in the RAS.void
Build everything that is needed for this Test Run.void
Discard the provisioned environment.void
Provision resource names, resource pools, settings etc, ready for building.void
Start the provisioned environment.void
Stop the provisioned environment.void
shutdown()
Gives the Managers the opportunity to close everything down like http clients etc.void
Called when we have instantiated the Test Class and ready to start running it.void
startOfTestMethod
(@NotNull GalasaMethod galasaMethod) Called when we are about to start the Test Method.void
testClassResult
(@NotNull String finalResult, Throwable finalException) Called once the Test Class result is resolved, can be used to emit the result to another server, for examplevoid
testMethodResult
(@NotNull String finalResult, Throwable finalException) Called once the Test Method result is resolved, can be used to emit the result to another server, for examplevoid
youAreRequired
(@NotNull List<IManager> allManagers, @NotNull List<IManager> activeManagers, @NotNull GalasaTest galasaTest) Called if another Manager requires this one.
-
Method Details
-
extraBundles
Gives the ability for the Manager to request additional bundles to be loaded dependent of CPS Properties. This can be used to load OSGi fragment bundles for implements of the TPI/SPI this Manager provides.
For example, the zOS Manager provides the zOS Batch Manager TPI. This TPI can be provided via various means, the default being zOS/MF, which is implemented by the zOS Batch zOSMF Manager. The zOS Manager can look at the CPS to determine which "fragment" should used to implement the the TPI
This method is called only once during the lifecycle and should not be dependent on what is in the Test Class
- Parameters:
framework
- Full initialised Framework- Returns:
- null for no extra bundles, or a
List
contain the symbolic names of the bundles to load - Throws:
ManagerException
-
initialise
void initialise(@NotNull @NotNull IFramework framework, @NotNull @NotNull List<IManager> allManagers, @NotNull @NotNull List<IManager> activeManagers, @NotNull @NotNull GalasaTest galasaTest) throws ManagerException Initialise the Manager, if required. The Manager should examine the testClass and see if this manager should participate in the Test Run lifecycle. If the Manager needs to take part, it should add itself to the activeManager. A Manager add itself only to the activeManagers.
If a Manager is dependent on another Manager, it should look for implementers in allManager and call the youAreRequired method of the other Manager. If the required Manager has not yet been initialised, it should flag the youAreRequired call for when the Manager is initialised
This will be the only time the testClass is passed to the Manager, so should be preserved
- Parameters:
framework
- A fully initialised Framework - preserve it for later useallManagers
- All Managers found in OSGiactiveManagers
- The Manager should add itself to this list if it is to be activated. Do not add other managers.galasaTest
- The Test class the framework will be running- Throws:
ManagerException
- If there is a problem initialising the Manager
-
youAreRequired
void youAreRequired(@NotNull @NotNull List<IManager> allManagers, @NotNull @NotNull List<IManager> activeManagers, @NotNull @NotNull GalasaTest galasaTest) throws ManagerException Called if another Manager requires this one. If this Manager has not been initialised yet, this call should be flagged until it the initialise method is called
If the Manager has previously been intialised, but believed it wasn't required, then it should drive the initialise routines now.
- Parameters:
allManagers
- All Managers found in OSGiactiveManagers
- The Manager should add itself to this list if it is to be activated. Do not add other managers.galasaTest
- The Test class the framework will be running- Throws:
ManagerException
-
areYouProvisionalDependentOn
Is this Manager dependent on the other Manager. Basically, return true if you require the other Manager at all during the provision* lifecycle methods.- Parameters:
otherManager
- The other Manager- Returns:
- true this Manager is provisionally dependent on the other Manager
-
anyReasonTestClassShouldBeIgnored
Should the test class be run at all? Used to set the Test Class to Ignored. Examples of use would be if the CICS TS Version is too low for the functionality this Test is testing
- Returns:
- - Return a descriptive text string for the reason the Test should be ignored
- Throws:
ManagerException
- - Just in case something goes wrong, eg CPS
-
provisionGenerate
Provision resource names, resource pools, settings etc, ready for building.
No building should occur during this process. Only resolution activities should occur so all managers indicate they have all the resources they require before attempting to build anything. If a manager is unable to acquire any resource, it should throw ResourceUnavailableException and the Test Run will be put into Waiting state for a later retry, if in Automation
- Throws:
ManagerException
- If anything goes wrongResourceUnavailableException
- IF resources are unavailable for this run
-
provisionBuild
Build everything that is needed for this Test Run. The Managers will be called in the order resolved by the areYouProvisionalDependentOn method.
If this method fails, the Test Run will fail with Environmental Failure, unless ResourceUnavailableException is thrown, where it is assumed it is a temporary condition and the run will be put into Waiting state if in Automation.
- Throws:
ManagerException
- If unable to build the environmentResourceUnavailableException
-
provisionStart
Start the provisioned environment. The Managers will be called in the order resolved by the areYouProvisionalDependentOn method.
If this method fails, the Test Run will fail with Environmental Failure, unless ResourceUnavailableException is thrown, where it is assumed it is a temporary condition and the run will be put into Waiting state if in Automation.
- Throws:
ManagerException
- If unable to start the environmentResourceUnavailableException
-
startOfTestClass
Called when we have instantiated the Test Class and ready to start running it.
- Throws:
ManagerException
- On the off chance something when wrong
-
fillAnnotatedFields
Fill/refill the annotated fields that belong to this Manager. This is called before the start of every Test Method just incase the tester decided to overwrite the field.- Parameters:
instantiatedTestClass
- The Instantiated Test class to fill- Throws:
ManagerException
- On the off chance something when wrong
-
anyReasonTestMethodShouldBeIgnored
String anyReasonTestMethodShouldBeIgnored(@NotNull @NotNull GalasaMethod galasaMethod) throws ManagerException Should the Test Method be run at all? Used to set the Test Method to Ignored. Examples of use would be if the CICS TS version is too low for the functionality this Test Method is testing
- Returns:
- - Return a descriptive text string for the reason the Test Method should be ignored
- Throws:
ManagerException
- - Just in case something goes wrong, eg CPS
-
startOfTestMethod
Called when we are about to start the Test Method.- Parameters:
galasaMethod
- The current executing method- Throws:
ManagerException
- On the off chance something when wrong
-
endOfTestMethod
Result endOfTestMethod(@NotNull @NotNull GalasaMethod galasaMethod, @NotNull @NotNull Result currentResult, Throwable currentException) throws ManagerException Called when the Test Method has finished
If the Manager would like to override the result, it can return the result it wishes to be used for the record
- Parameters:
galasaMethod
- The current test methodcurrentResult
- What the current result is, will not include what the other Managers wish it to be.currentException
- What the current Exception is- Returns:
- Override the test result, or null if ok
- Throws:
ManagerException
- If something went wrong
-
testMethodResult
void testMethodResult(@NotNull @NotNull String finalResult, Throwable finalException) throws ManagerException Called once the Test Method result is resolved, can be used to emit the result to another server, for example
- Parameters:
finalResult
- The final resolved resultfinalException
- The Exception- Throws:
ManagerException
- If something went wrong with recording the result
-
endOfTestClass
Result endOfTestClass(@NotNull @NotNull Result currentResult, Throwable currentException) throws ManagerException Called when the Test Class has finished
If the Manager would like to override the result, it can return the result it wishes to be used for the record
- Parameters:
currentResult
- What the current result is, will not include what the other Managers wish it to be.currentException
- What the current Exception is- Returns:
- Override the test result, or null if ok
- Throws:
ManagerException
- If something went wrong
-
testClassResult
void testClassResult(@NotNull @NotNull String finalResult, Throwable finalException) throws ManagerException Called once the Test Class result is resolved, can be used to emit the result to another server, for example
- Parameters:
finalResult
- The final resolved resultfinalException
- The Exception- Throws:
ManagerException
- If something went wrong with recording the result
-
provisionStop
void provisionStop()Stop the provisioned environment. Called in reverse provide dependent order.
Called after recording the Test Class result as failure here should not affect the Test result
-
provisionDiscard
void provisionDiscard()Discard the provisioned environment. Called in reverse provide dependent order.
The Manager is free to clean up resources at this point, if it is reasonably quick so that it doesn't slow the throughput of Tests through the automation system and can be executed under the Testers credentials if running locally.
-
performFailureAnalysis
void performFailureAnalysis()Can be used to perform Failure Analysis at this point and record the results in the RAS.
-
endOfTestRun
void endOfTestRun()About to shutdown everything
-
shutdown
void shutdown()Gives the Managers the opportunity to close everything down like http clients etc. Managers must not call other Managers in this method as they may have shutdown already. Calls to the Framework, CPS, RAS etc will be safe.
-