Class SelfTestSubsystem

  • All Implemented Interfaces:
    ISubsystem, ISelfTestSubsystem

    public class SelfTestSubsystem
    extends java.lang.Object
    implements ISelfTestSubsystem
    This class implements a container for self tests.

    Version:
    $Revision$, $Date$
    Author:
    mharmsen, thomask
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void audit​(LogEvent event)  
      void deregisterSelfTestAtStartup​(java.lang.String instanceName)
      Deregister an individual self test on the instances list AND on the "startup" list (note that the specified self test will be removed from each list).
      void deregisterSelfTestOnDemand​(java.lang.String instanceName)
      Deregister an individual self test on the instances list AND on the "on demand" list (note that the specified self test will be removed from each list).
      void disableSelfTestAtStartup​(java.lang.String instanceName)
      Disable the specified self test at server startup.
      void disableSelfTestOnDemand​(java.lang.String instanceName)
      Disable the specified self test from being able to be executed on demand.
      void enableSelfTestAtStartup​(java.lang.String instanceName, boolean isCritical)
      Enable the specified self test at server startup.
      void enableSelfTestOnDemand​(java.lang.String instanceName, boolean isCritical)
      Enable the specified self test to be executed on demand.
      IConfigStore getConfigStore()
      Returns the root configuration storage of this subsystem.
      java.lang.String getId()
      This method retrieves the name of this subsystem.
      ISelfTest getSelfTest​(java.lang.String instanceName)
      Retrieve an individual self test from the instances list given its instance name.
      ILogEventListener getSelfTestLogger()
      Returns the ILogEventListener of this subsystem.
      java.util.Collection<java.lang.String> getSelfTestNames()  
      void init​(IConfigStore config)
      This method initializes this subsystem.
      boolean isSelfTestCriticalAtStartup​(java.lang.String instanceName)
      Determine if failure of the specified self test is fatal to server startup.
      boolean isSelfTestCriticalOnDemand​(java.lang.String instanceName)
      Determine if failure of the specified self test is fatal when it is executed on demand.
      boolean isSelfTestEnabledAtStartup​(java.lang.String instanceName)
      Determine if the specified self test is executed automatically at server startup.
      boolean isSelfTestEnabledOnDemand​(java.lang.String instanceName)
      Determine if the specified self test is enabled to be executed on demand.
      java.lang.String[] listSelfTestsEnabledAtStartup()
      List the instance names of all the self tests enabled to run at server startup (in execution order); may return null.
      java.lang.String[] listSelfTestsEnabledOnDemand()
      List the instance names of all the self tests enabled to run on demand (in execution order); may return null.
      void log​(int level, java.lang.String msg)  
      void log​(ILogEventListener logger, java.lang.String msg)
      This method represents the log interface for the self test subsystem.
      void registerSelfTestAtStartup​(java.lang.String instanceName, boolean isCritical, ISelfTest instance)
      Register an individual self test on the instances list AND on the "startup" list (note that the specified self test will be appended to the end of each list).
      void registerSelfTestOnDemand​(java.lang.String instanceName, boolean isCritical, ISelfTest instance)
      Register an individual self test on the instances list AND on the "on demand" list (note that the specified self test will be appended to the end of each list).
      void runSelfTest​(java.lang.String instanceName)
      Execute a self test.
      void runSelfTestsAtStartup()
      Execute all self tests specified to be run at server startup.
      void runSelfTestsOnDemand()
      Execute all self tests specified to be run on demand.
      void setId​(java.lang.String id)
      This method sets information specific to this subsystem.
      void shutdown()
      Stops this subsystem.
      void startup()
      Notifies this subsystem if owner is in running mode.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        public static org.slf4j.Logger logger
      • mSelfTestInstances

        public java.util.Hashtable<java.lang.String,​ISelfTest> mSelfTestInstances
    • Constructor Detail

      • SelfTestSubsystem

        public SelfTestSubsystem()
    • Method Detail

      • audit

        protected void audit​(LogEvent event)
      • listSelfTestsEnabledOnDemand

        public java.lang.String[] listSelfTestsEnabledOnDemand()
        List the instance names of all the self tests enabled to run on demand (in execution order); may return null.

        Specified by:
        listSelfTestsEnabledOnDemand in interface ISelfTestSubsystem
        Returns:
        list of self test instance names run on demand
      • enableSelfTestOnDemand

        public void enableSelfTestOnDemand​(java.lang.String instanceName,
                                           boolean isCritical)
                                    throws EInvalidSelfTestException,
                                           EMissingSelfTestException
        Enable the specified self test to be executed on demand.

        Parameters:
        instanceName - instance name of self test
        isCritical - isCritical is either a critical failure (true) or a non-critical failure (false)
        Throws:
        EInvalidSelfTestException - subsystem has invalid name/value
        EMissingSelfTestException - subsystem has missing name/value
      • disableSelfTestOnDemand

        public void disableSelfTestOnDemand​(java.lang.String instanceName)
                                     throws EMissingSelfTestException
        Disable the specified self test from being able to be executed on demand.

        Parameters:
        instanceName - instance name of self test
        Throws:
        EMissingSelfTestException - subsystem has missing name
      • isSelfTestEnabledOnDemand

        public boolean isSelfTestEnabledOnDemand​(java.lang.String instanceName)
                                          throws EMissingSelfTestException
        Determine if the specified self test is enabled to be executed on demand.

        Specified by:
        isSelfTestEnabledOnDemand in interface ISelfTestSubsystem
        Parameters:
        instanceName - instance name of self test
        Returns:
        true if the specified self test is enabled on demand
        Throws:
        EMissingSelfTestException - subsystem has missing name
      • isSelfTestCriticalOnDemand

        public boolean isSelfTestCriticalOnDemand​(java.lang.String instanceName)
                                           throws EMissingSelfTestException
        Determine if failure of the specified self test is fatal when it is executed on demand.

        Specified by:
        isSelfTestCriticalOnDemand in interface ISelfTestSubsystem
        Parameters:
        instanceName - instance name of self test
        Returns:
        true if failure of the specified self test is fatal when it is executed on demand
        Throws:
        EMissingSelfTestException - subsystem has missing name
      • runSelfTest

        public void runSelfTest​(java.lang.String instanceName)
                         throws java.lang.Exception
        Description copied from interface: ISelfTestSubsystem
        Execute a self test.
        Specified by:
        runSelfTest in interface ISelfTestSubsystem
        Throws:
        java.lang.Exception - self test exception
      • listSelfTestsEnabledAtStartup

        public java.lang.String[] listSelfTestsEnabledAtStartup()
        List the instance names of all the self tests enabled to run at server startup (in execution order); may return null.

        Specified by:
        listSelfTestsEnabledAtStartup in interface ISelfTestSubsystem
        Returns:
        list of self test instance names run at server startup
      • enableSelfTestAtStartup

        public void enableSelfTestAtStartup​(java.lang.String instanceName,
                                            boolean isCritical)
                                     throws EInvalidSelfTestException,
                                            EMissingSelfTestException
        Enable the specified self test at server startup.

        Parameters:
        instanceName - instance name of self test
        isCritical - isCritical is either a critical failure (true) or a non-critical failure (false)
        Throws:
        EInvalidSelfTestException - subsystem has invalid name/value
        EMissingSelfTestException - subsystem has missing name/value
      • disableSelfTestAtStartup

        public void disableSelfTestAtStartup​(java.lang.String instanceName)
                                      throws EMissingSelfTestException
        Disable the specified self test at server startup.

        Parameters:
        instanceName - instance name of self test
        Throws:
        EMissingSelfTestException - subsystem has missing name
      • isSelfTestEnabledAtStartup

        public boolean isSelfTestEnabledAtStartup​(java.lang.String instanceName)
                                           throws EMissingSelfTestException
        Determine if the specified self test is executed automatically at server startup.

        Specified by:
        isSelfTestEnabledAtStartup in interface ISelfTestSubsystem
        Parameters:
        instanceName - instance name of self test
        Returns:
        true if the specified self test is executed at server startup
        Throws:
        EMissingSelfTestException - subsystem has missing name
      • isSelfTestCriticalAtStartup

        public boolean isSelfTestCriticalAtStartup​(java.lang.String instanceName)
                                            throws EMissingSelfTestException
        Determine if failure of the specified self test is fatal to server startup.

        Specified by:
        isSelfTestCriticalAtStartup in interface ISelfTestSubsystem
        Parameters:
        instanceName - instance name of self test
        Returns:
        true if failure of the specified self test is fatal to server startup
        Throws:
        EMissingSelfTestException - subsystem has missing name
      • runSelfTestsAtStartup

        public void runSelfTestsAtStartup()
                                   throws java.lang.Exception
        Execute all self tests specified to be run at server startup.

        • signed.audit LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION used when self tests are run at server startup
        Specified by:
        runSelfTestsAtStartup in interface ISelfTestSubsystem
        Throws:
        EMissingSelfTestException - subsystem has missing name
        java.lang.Exception - self test exception
      • log

        public void log​(int level,
                        java.lang.String msg)
      • getSelfTest

        public ISelfTest getSelfTest​(java.lang.String instanceName)
        Retrieve an individual self test from the instances list given its instance name. This method may return null.

        Specified by:
        getSelfTest in interface ISelfTestSubsystem
        Parameters:
        instanceName - instance name of self test
        Returns:
        individual self test
      • log

        public void log​(ILogEventListener logger,
                        java.lang.String msg)
        This method represents the log interface for the self test subsystem.

        Specified by:
        log in interface ISelfTestSubsystem
        Parameters:
        logger - log event listener
        msg - self test log message
      • deregisterSelfTestOnDemand

        public void deregisterSelfTestOnDemand​(java.lang.String instanceName)
                                        throws EMissingSelfTestException
        Deregister an individual self test on the instances list AND on the "on demand" list (note that the specified self test will be removed from each list).

        Parameters:
        instanceName - instance name of self test
        Throws:
        EMissingSelfTestException - subsystem has missing name
      • deregisterSelfTestAtStartup

        public void deregisterSelfTestAtStartup​(java.lang.String instanceName)
                                         throws EMissingSelfTestException
        Deregister an individual self test on the instances list AND on the "startup" list (note that the specified self test will be removed from each list).

        Parameters:
        instanceName - instance name of self test
        Throws:
        EMissingSelfTestException - subsystem has missing name
      • getId

        public java.lang.String getId()
        This method retrieves the name of this subsystem. This method may return null.

        Specified by:
        getId in interface ISubsystem
        Returns:
        identification of this subsystem
      • setId

        public void setId​(java.lang.String id)
                   throws EBaseException
        This method sets information specific to this subsystem.

        Specified by:
        setId in interface ISubsystem
        Parameters:
        id - identification of this subsystem
        Throws:
        EBaseException - base CMS exception
      • shutdown

        public void shutdown()
        Stops this subsystem. The owner may call shutdown anytime after initialization.

        Specified by:
        shutdown in interface ISubsystem
      • getConfigStore

        public IConfigStore getConfigStore()
        Returns the root configuration storage of this subsystem. This method may return null.

        Specified by:
        getConfigStore in interface ISubsystem
        Returns:
        configuration store of this subsystem