Interface IManager

All Known Implementing Classes:
AbstractGherkinManager, AbstractManager, OeconsolZosConsoleManagerImpl

public interface IManager

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 Details

    • extraBundles

      List<String> extraBundles(@NotNull @NotNull IFramework framework) throws ManagerException

      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 use
      allManagers - All Managers found in OSGi
      activeManagers - 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
    • doYouSupportSharedEnvironments

      boolean doYouSupportSharedEnvironments()
      The framework will check each manager during Shared Environment Build to see if they support shared environments. Those Managers that don't provision resources should return true. Those Managers provision resources that can't be reused in a shared environment should return false. AbsrtactManager will return false by default
      Returns:
      true if you support shared environments, or false if not
    • 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 OSGi
      activeManagers - 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

      boolean areYouProvisionalDependentOn(@NotNull @NotNull IManager otherManager)
      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

      String anyReasonTestClassShouldBeIgnored() throws ManagerException

      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

      void provisionGenerate() throws ManagerException, ResourceUnavailableException

      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 wrong
      ResourceUnavailableException - IF resources are unavailable for this run
    • provisionBuild

      void provisionBuild() throws ManagerException, ResourceUnavailableException

      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 environment
      ResourceUnavailableException
    • provisionStart

      void provisionStart() throws ManagerException, ResourceUnavailableException

      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 environment
      ResourceUnavailableException
    • startOfTestClass

      void startOfTestClass() throws ManagerException

      Called when we have instantiated the Test Class and ready to start running it.

      Throws:
      ManagerException - On the off chance something when wrong
    • fillAnnotatedFields

      void fillAnnotatedFields(Object instantiatedTestClass) throws ManagerException
      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

      void startOfTestMethod(@NotNull @NotNull GalasaMethod galasaMethod) throws ManagerException
      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 method
      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
    • 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 result
      finalException - 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 result
      finalException - 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.