Class SelfTestSubsystem

java.lang.Object
com.netscape.certsrv.base.Subsystem
com.netscape.cmscore.selftests.SelfTestSubsystem

public class SelfTestSubsystem extends Subsystem
This class implements a container for self tests.
Author:
mharmsen, thomask
  • Field Details

  • Constructor Details

    • SelfTestSubsystem

      public SelfTestSubsystem()
  • Method Details

    • getSelfTestNames

      public Collection<String> getSelfTestNames()
    • listSelfTestsEnabledOnDemand

      public String[] listSelfTestsEnabledOnDemand()
      List the instance names of all the self tests enabled to run on demand (in execution order); may return null.
      Returns:
      list of self test instance names run on demand
    • enableSelfTestOnDemand

      public void enableSelfTestOnDemand(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(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(String instanceName) throws EMissingSelfTestException
      Determine if the specified self test is enabled to be executed on demand.
      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(String instanceName) throws EMissingSelfTestException
      Determine if failure of the specified self test is fatal when it is executed on demand.
      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
    • runSelfTestsOnDemand

      public void runSelfTestsOnDemand() throws EMissingSelfTestException, ESelfTestException
      Execute all self tests specified to be run on demand.
      Throws:
      EMissingSelfTestException - subsystem has missing name
      ESelfTestException - self test exception
    • runSelfTest

      public void runSelfTest(String instanceName) throws Exception
      Execute a self test.
      Throws:
      Exception - self test exception
    • listSelfTestsEnabledAtStartup

      public String[] listSelfTestsEnabledAtStartup()
      List the instance names of all the self tests enabled to run at server startup (in execution order); may return null.
      Returns:
      list of self test instance names run at server startup
    • enableSelfTestAtStartup

      public void enableSelfTestAtStartup(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(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(String instanceName) throws EMissingSelfTestException
      Determine if the specified self test is executed automatically at server startup.
      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(String instanceName) throws EMissingSelfTestException
      Determine if failure of the specified self test is fatal to server startup.
      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 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
      Throws:
      EMissingSelfTestException - subsystem has missing name
      Exception - self test exception
    • log

      public void log(int level, String msg)
    • getSelfTest

      public SelfTest getSelfTest(String instanceName)
      Retrieve an individual self test from the instances list given its instance name. This method may return null.
      Parameters:
      instanceName - instance name of self test
      Returns:
      individual self test
    • getSelfTestLogger

      public LogEventListener getSelfTestLogger()
      Returns the LogEventListener of this subsystem. This method may return null.
      Returns:
      LogEventListener of this subsystem
    • log

      public void log(LogEventListener logger, String msg)
      This method represents the log interface for the self test subsystem.
      Parameters:
      logger - log event listener
      msg - self test log message
    • registerSelfTestOnDemand

      public void registerSelfTestOnDemand(String instanceName, boolean isCritical, SelfTest instance) throws EDuplicateSelfTestException, EInvalidSelfTestException, EMissingSelfTestException
      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).
      Parameters:
      instanceName - instance name of self test
      isCritical - isCritical is either a critical failure (true) or a non-critical failure (false)
      instance - individual self test
      Throws:
      EDuplicateSelfTestException - subsystem has duplicate name
      EInvalidSelfTestException - subsystem has invalid name/value
      EMissingSelfTestException - subsystem has missing name/value
    • deregisterSelfTestOnDemand

      public void deregisterSelfTestOnDemand(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
    • registerSelfTestAtStartup

      public void registerSelfTestAtStartup(String instanceName, boolean isCritical, SelfTest instance) throws EDuplicateSelfTestException, EInvalidSelfTestException, EMissingSelfTestException
      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).
      Parameters:
      instanceName - instance name of self test
      isCritical - isCritical is either a critical failure (true) or a non-critical failure (false)
      instance - individual self test
      Throws:
      EDuplicateSelfTestException - subsystem has duplicate name
      EInvalidSelfTestException - subsystem has invalid name/value
      EMissingSelfTestException - subsystem has missing name/value
    • deregisterSelfTestAtStartup

      public void deregisterSelfTestAtStartup(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 String getId()
      This method retrieves the name of this subsystem. This method may return null.

      Overrides:
      getId in class Subsystem
      Returns:
      identification of this subsystem
    • setId

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

      Overrides:
      setId in class Subsystem
      Parameters:
      id - identification of this subsystem
      Throws:
      EBaseException - base CMS exception
    • init

      public void init(ConfigStore config) throws Exception
      This method initializes this subsystem.
      Overrides:
      init in class Subsystem
      Parameters:
      config - Subsystem configuration
      Throws:
      Exception - base CMS exception
    • startup

      public void startup() throws EBaseException
      Notifies this subsystem if owner is in running mode.

      Overrides:
      startup in class Subsystem
      Throws:
      EBaseException - base CMS exception
    • shutdown

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

      Overrides:
      shutdown in class Subsystem
    • getConfigStore

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

      Overrides:
      getConfigStore in class Subsystem
      Returns:
      configuration store of this subsystem