Package com.netscape.cmscore.selftests
Class SelfTestSubsystem
- java.lang.Object
-
- com.netscape.cmscore.selftests.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
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.Logger
logger
java.util.Vector<SelfTestOrderedInstance>
mOnDemandOrder
java.util.Hashtable<java.lang.String,ISelfTest>
mSelfTestInstances
java.util.Vector<SelfTestOrderedInstance>
mStartupOrder
-
Fields inherited from interface com.netscape.certsrv.selftests.ISelfTestSubsystem
ID, PROP_CONTAINER, PROP_INSTANCE, PROP_LOGGER, PROP_LOGGER_CLASS, PROP_ON_DEMAND, PROP_ORDER, PROP_STARTUP
-
-
Constructor Summary
Constructors Constructor Description SelfTestSubsystem()
-
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.
-
-
-
Field Detail
-
logger
public static org.slf4j.Logger logger
-
mSelfTestInstances
public java.util.Hashtable<java.lang.String,ISelfTest> mSelfTestInstances
-
mOnDemandOrder
public java.util.Vector<SelfTestOrderedInstance> mOnDemandOrder
-
mStartupOrder
public java.util.Vector<SelfTestOrderedInstance> mStartupOrder
-
-
Method Detail
-
audit
protected void audit(LogEvent event)
-
getSelfTestNames
public java.util.Collection<java.lang.String> getSelfTestNames()
- Specified by:
getSelfTestNames
in interfaceISelfTestSubsystem
-
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 interfaceISelfTestSubsystem
- 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 testisCritical
- isCritical is either a critical failure (true) or a non-critical failure (false)- Throws:
EInvalidSelfTestException
- subsystem has invalid name/valueEMissingSelfTestException
- 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 interfaceISelfTestSubsystem
- 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 interfaceISelfTestSubsystem
- 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.- Specified by:
runSelfTestsOnDemand
in interfaceISelfTestSubsystem
- Throws:
EMissingSelfTestException
- subsystem has missing nameESelfTestException
- self test exception
-
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 interfaceISelfTestSubsystem
- 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 interfaceISelfTestSubsystem
- 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 testisCritical
- isCritical is either a critical failure (true) or a non-critical failure (false)- Throws:
EInvalidSelfTestException
- subsystem has invalid name/valueEMissingSelfTestException
- 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 interfaceISelfTestSubsystem
- 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 interfaceISelfTestSubsystem
- 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 interfaceISelfTestSubsystem
- Throws:
EMissingSelfTestException
- subsystem has missing namejava.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 interfaceISelfTestSubsystem
- Parameters:
instanceName
- instance name of self test- Returns:
- individual self test
-
getSelfTestLogger
public ILogEventListener getSelfTestLogger()
Returns the ILogEventListener of this subsystem. This method may return null.- Specified by:
getSelfTestLogger
in interfaceISelfTestSubsystem
- Returns:
- ILogEventListener of this subsystem
-
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 interfaceISelfTestSubsystem
- Parameters:
logger
- log event listenermsg
- self test log message
-
registerSelfTestOnDemand
public void registerSelfTestOnDemand(java.lang.String instanceName, boolean isCritical, ISelfTest 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 testisCritical
- isCritical is either a critical failure (true) or a non-critical failure (false)instance
- individual self test- Throws:
EDuplicateSelfTestException
- subsystem has duplicate nameEInvalidSelfTestException
- subsystem has invalid name/valueEMissingSelfTestException
- subsystem has missing name/value
-
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
-
registerSelfTestAtStartup
public void registerSelfTestAtStartup(java.lang.String instanceName, boolean isCritical, ISelfTest 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 testisCritical
- isCritical is either a critical failure (true) or a non-critical failure (false)instance
- individual self test- Throws:
EDuplicateSelfTestException
- subsystem has duplicate nameEInvalidSelfTestException
- subsystem has invalid name/valueEMissingSelfTestException
- subsystem has missing name/value
-
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 interfaceISubsystem
- 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 interfaceISubsystem
- Parameters:
id
- identification of this subsystem- Throws:
EBaseException
- base CMS exception
-
init
public void init(IConfigStore config) throws EBaseException
This method initializes this subsystem.- Specified by:
init
in interfaceISubsystem
- Parameters:
config
- configuration store- Throws:
EBaseException
- base CMS exception
-
startup
public void startup() throws EBaseException
Notifies this subsystem if owner is in running mode.- Specified by:
startup
in interfaceISubsystem
- Throws:
EBaseException
- base CMS exception
-
shutdown
public void shutdown()
Stops this subsystem. The owner may call shutdown anytime after initialization.- Specified by:
shutdown
in interfaceISubsystem
-
getConfigStore
public IConfigStore getConfigStore()
Returns the root configuration storage of this subsystem. This method may return null.- Specified by:
getConfigStore
in interfaceISubsystem
- Returns:
- configuration store of this subsystem
-
-