summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java')
-rw-r--r--pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java879
1 files changed, 361 insertions, 518 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java b/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java
index 209be47d..5a8c61b2 100644
--- a/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java
+++ b/pki/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java
@@ -20,7 +20,6 @@
package com.netscape.cmscore.selftests;
-
///////////////////////
// import statements //
///////////////////////
@@ -49,7 +48,6 @@ import com.netscape.certsrv.selftests.ESelfTestException;
import com.netscape.certsrv.selftests.ISelfTest;
import com.netscape.certsrv.selftests.ISelfTestSubsystem;
-
//////////////////////
// class definition //
//////////////////////
@@ -62,23 +60,18 @@ import com.netscape.certsrv.selftests.ISelfTestSubsystem;
* @author thomask
* @version $Revision$, $Date$
*/
-public class SelfTestSubsystem
- implements ISelfTestSubsystem {
- ////////////////////////
+public class SelfTestSubsystem implements ISelfTestSubsystem {
+ // //////////////////////
// default parameters //
- ////////////////////////
-
+ // //////////////////////
-
- ///////////////////////
+ // /////////////////////
// helper parameters //
- ///////////////////////
-
+ // /////////////////////
-
- //////////////////////////////////
+ // ////////////////////////////////
// SelfTestSubsystem parameters //
- //////////////////////////////////
+ // ////////////////////////////////
private ISubsystem mOwner = null;
private IConfigStore mConfig = null;
@@ -92,34 +85,31 @@ public class SelfTestSubsystem
public Vector mOnDemandOrder = new Vector();
public Vector mStartupOrder = new Vector();
- ///////////////////////////
+ // /////////////////////////
// ISubsystem parameters //
- ///////////////////////////
+ // /////////////////////////
private static final String LIST_DELIMITER = ",";
private static final String ELEMENT_DELIMITER = ":";
private static final String CRITICAL = "critical";
- private static final String LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION =
- "LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION_2";
+ private static final String LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION = "LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION_2";
- /////////////////////
+ // ///////////////////
// default methods //
- /////////////////////
-
-
+ // ///////////////////
- ////////////////////
+ // //////////////////
// helper methods //
- ////////////////////
+ // //////////////////
/**
* Signed Audit Log
- *
+ *
* This helper method is called to store messages to the signed audit log.
* <P>
- *
+ *
* @param msg signed audit log message
*/
private void audit(String msg) {
@@ -130,11 +120,8 @@ public class SelfTestSubsystem
return;
}
- mSignedAuditLogger.log(ILogger.EV_SIGNED_AUDIT,
- null,
- ILogger.S_SIGNED_AUDIT,
- ILogger.LL_SECURITY,
- msg);
+ mSignedAuditLogger.log(ILogger.EV_SIGNED_AUDIT, null,
+ ILogger.S_SIGNED_AUDIT, ILogger.LL_SECURITY, msg);
}
/**
@@ -142,13 +129,12 @@ public class SelfTestSubsystem
* substore name prepended in front of the plugin/parameter name). This
* method may return null.
* <P>
- *
+ *
* @param instancePrefix full name of configuration store
* @param instanceName instance name of self test
* @return fullname of this self test plugin
*/
- private String getFullName(String instancePrefix,
- String instanceName) {
+ private String getFullName(String instancePrefix, String instanceName) {
String instanceFullName = null;
// strip preceding/trailing whitespace
@@ -160,13 +146,9 @@ public class SelfTestSubsystem
instanceName = instanceName.trim();
}
- if ((instancePrefix != null) &&
- (instancePrefix != "")) {
- if ((instanceName != null) &&
- (instanceName != "")) {
- instanceFullName = instancePrefix
- + "."
- + instanceName;
+ if ((instancePrefix != null) && (instancePrefix != "")) {
+ if ((instanceName != null) && (instanceName != "")) {
+ instanceFullName = instancePrefix + "." + instanceName;
}
} else {
instanceFullName = instanceName;
@@ -176,16 +158,16 @@ public class SelfTestSubsystem
}
/**
- * This helper method checks to see if an instance name/value
- * pair exists for the corresponding ordered list element.
+ * This helper method checks to see if an instance name/value pair exists
+ * for the corresponding ordered list element.
* <P>
- *
+ *
* @param element owner of this subsystem
* @param instanceName instance name of self test
* @exception EMissingSelfTestException subsystem has missing name/value
*/
private void checkInstance(SelfTestOrderedInstance element)
- throws EInvalidSelfTestException, EMissingSelfTestException {
+ throws EInvalidSelfTestException, EMissingSelfTestException {
String instanceFullName = null;
String instanceName = null;
String instanceValue = null;
@@ -196,12 +178,10 @@ public class SelfTestSubsystem
instanceName = element.getSelfTestName();
if (instanceName != null) {
instanceName = instanceName.trim();
- instanceFullName = getFullName(mPrefix,
- instanceName);
+ instanceFullName = getFullName(mPrefix, instanceName);
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
@@ -210,17 +190,14 @@ public class SelfTestSubsystem
// extract the self test plugin value(s)
instanceValue = instanceConfig.getString(instanceName);
- if ((instanceValue == null) ||
- (instanceValue.equals(""))) {
+ if ((instanceValue == null) || (instanceValue.equals(""))) {
// self test plugin instance property name exists,
// but it contains no value(s)
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_MISSING_VALUES",
instanceFullName));
- throw new
- EMissingSelfTestException(instanceFullName,
+ throw new EMissingSelfTestException(instanceFullName,
instanceValue);
} else {
instanceValue = instanceValue.trim();
@@ -229,27 +206,24 @@ public class SelfTestSubsystem
} catch (EPropertyNotFound e) {
// self test plugin instance property name is not present
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME",
- instanceFullName));
+ CMS.getLogMessage(
+ "CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME",
+ instanceFullName));
throw new EMissingSelfTestException(instanceFullName);
} catch (EBaseException e) {
// self test plugin instance EBaseException
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_THREW_EBASEEXCEPTION",
- instanceFullName,
- instanceValue));
+ instanceFullName, instanceValue));
- throw new EInvalidSelfTestException(instanceFullName,
- instanceValue);
+ throw new EInvalidSelfTestException(instanceFullName, instanceValue);
}
}
- ///////////////////////////////
+ // /////////////////////////////
// SelfTestSubsystem methods //
- ///////////////////////////////
+ // /////////////////////////////
//
// methods associated with the list of on demand self tests
@@ -259,7 +233,7 @@ public class SelfTestSubsystem
* List the instance names of all the self tests enabled to run on demand
* (in execution order); may return null.
* <P>
- *
+ *
* @return list of self test instance names run on demand
*/
public String[] listSelfTestsEnabledOnDemand() {
@@ -271,7 +245,7 @@ public class SelfTestSubsystem
mList = new String[numElements];
} else {
return null;
- }
+ }
// loop through all self test plugin instances
// specified to be executed on demand
@@ -280,8 +254,8 @@ public class SelfTestSubsystem
int i = 0;
while (instances.hasMoreElements()) {
- SelfTestOrderedInstance instance = (SelfTestOrderedInstance)
- instances.nextElement();
+ SelfTestOrderedInstance instance = (SelfTestOrderedInstance) instances
+ .nextElement();
mList[i] = instance.getSelfTestName();
if (mList[i] != null) {
@@ -296,24 +270,22 @@ public class SelfTestSubsystem
/**
* Enable the specified self test to be executed on demand.
* <P>
- *
+ *
* @param instanceName instance name of self test
- * @param isCritical isCritical is either a critical failure (true) or
- * a non-critical failure (false)
+ * @param isCritical isCritical is either a critical failure (true) or a
+ * non-critical failure (false)
* @exception EInvalidSelfTestException subsystem has invalid name/value
* @exception EMissingSelfTestException subsystem has missing name/value
*/
- public void enableSelfTestOnDemand(String instanceName,
- boolean isCritical)
- throws EInvalidSelfTestException, EMissingSelfTestException {
+ public void enableSelfTestOnDemand(String instanceName, boolean isCritical)
+ throws EInvalidSelfTestException, EMissingSelfTestException {
// strip preceding/trailing whitespace
// from passed-in String parameters
if (instanceName != null) {
instanceName = instanceName.trim();
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
@@ -323,8 +295,8 @@ public class SelfTestSubsystem
Enumeration instances = mOnDemandOrder.elements();
while (instances.hasMoreElements()) {
- SelfTestOrderedInstance instance = (SelfTestOrderedInstance)
- instances.nextElement();
+ SelfTestOrderedInstance instance = (SelfTestOrderedInstance) instances
+ .nextElement();
if (instanceName.equals(instance.getSelfTestName())) {
instance.setSelfTestCriticalMode(isCritical);
@@ -336,9 +308,7 @@ public class SelfTestSubsystem
String elementName = null;
if (isCritical) {
- elementName = instanceName
- + ELEMENT_DELIMITER
- + CRITICAL;
+ elementName = instanceName + ELEMENT_DELIMITER + CRITICAL;
} else {
elementName = instanceName;
}
@@ -347,8 +317,8 @@ public class SelfTestSubsystem
element = new SelfTestOrderedInstance(elementName);
- // SANITY CHECK: find the corresponding instance property
- // name for this self test plugin
+ // SANITY CHECK: find the corresponding instance property
+ // name for this self test plugin
checkInstance(element);
// store this self test plugin in on-demand order
@@ -358,24 +328,22 @@ public class SelfTestSubsystem
/**
* Disable the specified self test from being able to be executed on demand.
* <P>
- *
+ *
* @param instanceName instance name of self test
* @exception EMissingSelfTestException subsystem has missing name
*/
public void disableSelfTestOnDemand(String instanceName)
- throws EMissingSelfTestException {
+ throws EMissingSelfTestException {
String instanceFullName = null;
// strip preceding/trailing whitespace
// from passed-in String parameters
if (instanceName != null) {
instanceName = instanceName.trim();
- instanceFullName = getFullName(mPrefix,
- instanceName);
+ instanceFullName = getFullName(mPrefix, instanceName);
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
@@ -385,8 +353,8 @@ public class SelfTestSubsystem
Enumeration instances = mOnDemandOrder.elements();
while (instances.hasMoreElements()) {
- SelfTestOrderedInstance instance = (SelfTestOrderedInstance)
- instances.nextElement();
+ SelfTestOrderedInstance instance = (SelfTestOrderedInstance) instances
+ .nextElement();
if (instanceName.equals(instance.getSelfTestName())) {
mOnDemandOrder.remove(instance);
@@ -395,10 +363,8 @@ public class SelfTestSubsystem
}
// self test plugin instance property name is not present
- log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME",
- instanceFullName));
+ log(mLogger, CMS.getLogMessage(
+ "CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME", instanceFullName));
throw new EMissingSelfTestException(instanceFullName);
}
@@ -406,21 +372,20 @@ public class SelfTestSubsystem
/**
* Determine if the specified self test is enabled to be executed on demand.
* <P>
- *
+ *
* @param instanceName instance name of self test
* @return true if the specified self test is enabled on demand
* @exception EMissingSelfTestException subsystem has missing name
*/
public boolean isSelfTestEnabledOnDemand(String instanceName)
- throws EMissingSelfTestException {
+ throws EMissingSelfTestException {
// strip preceding/trailing whitespace
// from passed-in String parameters
if (instanceName != null) {
instanceName = instanceName.trim();
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
@@ -430,8 +395,8 @@ public class SelfTestSubsystem
Enumeration instances = mOnDemandOrder.elements();
while (instances.hasMoreElements()) {
- SelfTestOrderedInstance instance = (SelfTestOrderedInstance)
- instances.nextElement();
+ SelfTestOrderedInstance instance = (SelfTestOrderedInstance) instances
+ .nextElement();
if (instanceName.equals(instance.getSelfTestName())) {
return true;
@@ -442,29 +407,27 @@ public class SelfTestSubsystem
}
/**
- * Determine if failure of the specified self test is fatal when
- * it is executed on demand.
+ * Determine if failure of the specified self test is fatal when it is
+ * executed on demand.
* <P>
- *
+ *
* @param instanceName instance name of self test
- * @return true if failure of the specified self test is fatal when
- * it is executed on demand
+ * @return true if failure of the specified self test is fatal when it is
+ * executed on demand
* @exception EMissingSelfTestException subsystem has missing name
*/
public boolean isSelfTestCriticalOnDemand(String instanceName)
- throws EMissingSelfTestException {
+ throws EMissingSelfTestException {
String instanceFullName = null;
// strip preceding/trailing whitespace
// from passed-in String parameters
if (instanceName != null) {
instanceName = instanceName.trim();
- instanceFullName = getFullName(mPrefix,
- instanceName);
+ instanceFullName = getFullName(mPrefix, instanceName);
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
@@ -474,8 +437,8 @@ public class SelfTestSubsystem
Enumeration instances = mOnDemandOrder.elements();
while (instances.hasMoreElements()) {
- SelfTestOrderedInstance instance = (SelfTestOrderedInstance)
- instances.nextElement();
+ SelfTestOrderedInstance instance = (SelfTestOrderedInstance) instances
+ .nextElement();
if (instanceName.equals(instance.getSelfTestName())) {
if (instance.isSelfTestCritical()) {
@@ -487,10 +450,8 @@ public class SelfTestSubsystem
}
// self test plugin instance property name is not present
- log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME",
- instanceFullName));
+ log(mLogger, CMS.getLogMessage(
+ "CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME", instanceFullName));
throw new EMissingSelfTestException(instanceFullName);
}
@@ -498,15 +459,15 @@ public class SelfTestSubsystem
/**
* Execute all self tests specified to be run on demand.
* <P>
- *
+ *
* @exception EMissingSelfTestException subsystem has missing name
* @exception ESelfTestException self test exception
*/
- public void runSelfTestsOnDemand()
- throws EMissingSelfTestException, ESelfTestException {
+ public void runSelfTestsOnDemand() throws EMissingSelfTestException,
+ ESelfTestException {
if (CMS.debugOn()) {
CMS.debug("SelfTestSubsystem::runSelfTestsOnDemand():"
- + " ENTERING . . .");
+ + " ENTERING . . .");
}
// loop through all self test plugin instances
@@ -514,42 +475,38 @@ public class SelfTestSubsystem
Enumeration instances = mOnDemandOrder.elements();
while (instances.hasMoreElements()) {
- SelfTestOrderedInstance instance = (SelfTestOrderedInstance)
- instances.nextElement();
+ SelfTestOrderedInstance instance = (SelfTestOrderedInstance) instances
+ .nextElement();
String instanceFullName = null;
String instanceName = instance.getSelfTestName();
if (instanceName != null) {
instanceName = instanceName.trim();
- instanceFullName = getFullName(mPrefix,
- instanceName);
+ instanceFullName = getFullName(mPrefix, instanceName);
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
if (mSelfTestInstances.containsKey(instanceName)) {
- ISelfTest test = (ISelfTest)
- mSelfTestInstances.get(instanceName);
+ ISelfTest test = (ISelfTest) mSelfTestInstances
+ .get(instanceName);
try {
if (CMS.debugOn()) {
CMS.debug("SelfTestSubsystem::runSelfTestsOnDemand():"
- + " running \""
- + test.getSelfTestName()
- + "\"");
+ + " running \"" + test.getSelfTestName()
+ + "\"");
}
test.runSelfTest(mLogger);
} catch (ESelfTestException e) {
// Check to see if the self test was critical:
if (isSelfTestCriticalOnDemand(instanceName)) {
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_RUN_ON_DEMAND_FAILED",
instanceFullName));
@@ -561,8 +518,7 @@ public class SelfTestSubsystem
}
} else {
// self test plugin instance property name is not present
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME",
instanceFullName));
@@ -572,7 +528,7 @@ public class SelfTestSubsystem
if (CMS.debugOn()) {
CMS.debug("SelfTestSubsystem::runSelfTestsOnDemand():"
- + " EXITING.");
+ + " EXITING.");
}
}
@@ -581,10 +537,10 @@ public class SelfTestSubsystem
//
/**
- * List the instance names of all the self tests enabled to run
- * at server startup (in execution order); may return null.
+ * List the instance names of all the self tests enabled to run at server
+ * startup (in execution order); may return null.
* <P>
- *
+ *
* @return list of self test instance names run at server startup
*/
public String[] listSelfTestsEnabledAtStartup() {
@@ -596,7 +552,7 @@ public class SelfTestSubsystem
mList = new String[numElements];
} else {
return null;
- }
+ }
// loop through all self test plugin instances
// specified to be executed at server startup
@@ -605,8 +561,8 @@ public class SelfTestSubsystem
int i = 0;
while (instances.hasMoreElements()) {
- SelfTestOrderedInstance instance = (SelfTestOrderedInstance)
- instances.nextElement();
+ SelfTestOrderedInstance instance = (SelfTestOrderedInstance) instances
+ .nextElement();
mList[i] = instance.getSelfTestName();
if (mList[i] != null) {
@@ -621,24 +577,22 @@ public class SelfTestSubsystem
/**
* Enable the specified self test at server startup.
* <P>
- *
+ *
* @param instanceName instance name of self test
- * @param isCritical isCritical is either a critical failure (true) or
- * a non-critical failure (false)
+ * @param isCritical isCritical is either a critical failure (true) or a
+ * non-critical failure (false)
* @exception EInvalidSelfTestException subsystem has invalid name/value
* @exception EMissingSelfTestException subsystem has missing name/value
*/
- public void enableSelfTestAtStartup(String instanceName,
- boolean isCritical)
- throws EInvalidSelfTestException, EMissingSelfTestException {
+ public void enableSelfTestAtStartup(String instanceName, boolean isCritical)
+ throws EInvalidSelfTestException, EMissingSelfTestException {
// strip preceding/trailing whitespace
// from passed-in String parameters
if (instanceName != null) {
instanceName = instanceName.trim();
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
@@ -648,8 +602,8 @@ public class SelfTestSubsystem
Enumeration instances = mStartupOrder.elements();
while (instances.hasMoreElements()) {
- SelfTestOrderedInstance instance = (SelfTestOrderedInstance)
- instances.nextElement();
+ SelfTestOrderedInstance instance = (SelfTestOrderedInstance) instances
+ .nextElement();
if (instanceName.equals(instance.getSelfTestName())) {
instance.setSelfTestCriticalMode(isCritical);
@@ -661,9 +615,7 @@ public class SelfTestSubsystem
String elementName = null;
if (isCritical) {
- elementName = instanceName
- + ELEMENT_DELIMITER
- + CRITICAL;
+ elementName = instanceName + ELEMENT_DELIMITER + CRITICAL;
} else {
elementName = instanceName;
}
@@ -672,8 +624,8 @@ public class SelfTestSubsystem
element = new SelfTestOrderedInstance(elementName);
- // SANITY CHECK: find the corresponding instance property
- // name for this self test plugin
+ // SANITY CHECK: find the corresponding instance property
+ // name for this self test plugin
checkInstance(element);
// store this self test plugin in startup order
@@ -683,24 +635,22 @@ public class SelfTestSubsystem
/**
* Disable the specified self test at server startup.
* <P>
- *
+ *
* @param instanceName instance name of self test
* @exception EMissingSelfTestException subsystem has missing name
*/
public void disableSelfTestAtStartup(String instanceName)
- throws EMissingSelfTestException {
+ throws EMissingSelfTestException {
String instanceFullName = null;
// strip preceding/trailing whitespace
// from passed-in String parameters
if (instanceName != null) {
instanceName = instanceName.trim();
- instanceFullName = getFullName(mPrefix,
- instanceName);
+ instanceFullName = getFullName(mPrefix, instanceName);
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
@@ -710,8 +660,8 @@ public class SelfTestSubsystem
Enumeration instances = mStartupOrder.elements();
while (instances.hasMoreElements()) {
- SelfTestOrderedInstance instance = (SelfTestOrderedInstance)
- instances.nextElement();
+ SelfTestOrderedInstance instance = (SelfTestOrderedInstance) instances
+ .nextElement();
if (instanceName.equals(instance.getSelfTestName())) {
mStartupOrder.remove(instance);
@@ -720,33 +670,30 @@ public class SelfTestSubsystem
}
// self test plugin instance property name is not present
- log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME",
- instanceFullName));
+ log(mLogger, CMS.getLogMessage(
+ "CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME", instanceFullName));
throw new EMissingSelfTestException(instanceFullName);
}
/**
- * Determine if the specified self test is executed automatically
- * at server startup.
+ * Determine if the specified self test is executed automatically at server
+ * startup.
* <P>
- *
+ *
* @param instanceName instance name of self test
* @return true if the specified self test is executed at server startup
* @exception EMissingSelfTestException subsystem has missing name
*/
public boolean isSelfTestEnabledAtStartup(String instanceName)
- throws EMissingSelfTestException {
+ throws EMissingSelfTestException {
// strip preceding/trailing whitespace
// from passed-in String parameters
if (instanceName != null) {
instanceName = instanceName.trim();
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
@@ -756,8 +703,8 @@ public class SelfTestSubsystem
Enumeration instances = mStartupOrder.elements();
while (instances.hasMoreElements()) {
- SelfTestOrderedInstance instance = (SelfTestOrderedInstance)
- instances.nextElement();
+ SelfTestOrderedInstance instance = (SelfTestOrderedInstance) instances
+ .nextElement();
if (instanceName.equals(instance.getSelfTestName())) {
return true;
@@ -768,29 +715,27 @@ public class SelfTestSubsystem
}
/**
- * Determine if failure of the specified self test is fatal to
- * server startup.
+ * Determine if failure of the specified self test is fatal to server
+ * startup.
* <P>
- *
+ *
* @param instanceName instance name of self test
- * @return true if failure of the specified self test is fatal to
- * server startup
+ * @return true if failure of the specified self test is fatal to server
+ * startup
* @exception EMissingSelfTestException subsystem has missing name
*/
public boolean isSelfTestCriticalAtStartup(String instanceName)
- throws EMissingSelfTestException {
+ throws EMissingSelfTestException {
String instanceFullName = null;
// strip preceding/trailing whitespace
// from passed-in String parameters
if (instanceName != null) {
instanceName = instanceName.trim();
- instanceFullName = getFullName(mPrefix,
- instanceName);
+ instanceFullName = getFullName(mPrefix, instanceName);
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
@@ -800,8 +745,8 @@ public class SelfTestSubsystem
Enumeration instances = mStartupOrder.elements();
while (instances.hasMoreElements()) {
- SelfTestOrderedInstance instance = (SelfTestOrderedInstance)
- instances.nextElement();
+ SelfTestOrderedInstance instance = (SelfTestOrderedInstance) instances
+ .nextElement();
if (instanceName.equals(instance.getSelfTestName())) {
if (instance.isSelfTestCritical()) {
@@ -813,10 +758,8 @@ public class SelfTestSubsystem
}
// self test plugin instance property name is not present
- log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME",
- instanceFullName));
+ log(mLogger, CMS.getLogMessage(
+ "CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME", instanceFullName));
throw new EMissingSelfTestException(instanceFullName);
}
@@ -824,16 +767,17 @@ public class SelfTestSubsystem
/**
* Execute all self tests specified to be run at server startup.
* <P>
- *
+ *
* <ul>
* <li>signed.audit LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION used when self
* tests are run at server startup
* </ul>
+ *
* @exception EMissingSelfTestException subsystem has missing name
* @exception ESelfTestException self test exception
*/
- public void runSelfTestsAtStartup()
- throws EMissingSelfTestException, ESelfTestException {
+ public void runSelfTestsAtStartup() throws EMissingSelfTestException,
+ ESelfTestException {
String auditMessage = null;
// ensure that any low-level exceptions are reported
@@ -841,7 +785,7 @@ public class SelfTestSubsystem
try {
if (CMS.debugOn()) {
CMS.debug("SelfTestSubsystem::runSelfTestsAtStartup():"
- + " ENTERING . . .");
+ + " ENTERING . . .");
}
// loop through all self test plugin instances
@@ -849,26 +793,23 @@ public class SelfTestSubsystem
Enumeration instances = mStartupOrder.elements();
while (instances.hasMoreElements()) {
- SelfTestOrderedInstance instance = (SelfTestOrderedInstance)
- instances.nextElement();
+ SelfTestOrderedInstance instance = (SelfTestOrderedInstance) instances
+ .nextElement();
String instanceFullName = null;
String instanceName = instance.getSelfTestName();
if (instanceName != null) {
instanceName = instanceName.trim();
- instanceFullName = getFullName(mPrefix,
- instanceName);
+ instanceFullName = getFullName(mPrefix, instanceName);
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
// store a message in the signed audit log file
auditMessage = CMS.getLogMessage(
- LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION,
- ILogger.SYSTEM_UID,
- ILogger.FAILURE);
+ LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION,
+ ILogger.SYSTEM_UID, ILogger.FAILURE);
audit(auditMessage);
@@ -876,31 +817,29 @@ public class SelfTestSubsystem
}
if (mSelfTestInstances.containsKey(instanceName)) {
- ISelfTest test = (ISelfTest)
- mSelfTestInstances.get(instanceName);
+ ISelfTest test = (ISelfTest) mSelfTestInstances
+ .get(instanceName);
try {
if (CMS.debugOn()) {
CMS.debug("SelfTestSubsystem::runSelfTestsAtStartup():"
- + " running \""
- + test.getSelfTestName()
- + "\"");
+ + " running \""
+ + test.getSelfTestName()
+ + "\"");
}
test.runSelfTest(mLogger);
} catch (ESelfTestException e) {
// Check to see if the self test was critical:
if (isSelfTestCriticalAtStartup(instanceName)) {
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_RUN_AT_STARTUP_FAILED",
instanceFullName));
// store a message in the signed audit log file
auditMessage = CMS.getLogMessage(
- LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION,
- ILogger.SYSTEM_UID,
- ILogger.FAILURE);
+ LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION,
+ ILogger.SYSTEM_UID, ILogger.FAILURE);
audit(auditMessage);
@@ -912,16 +851,14 @@ public class SelfTestSubsystem
}
} else {
// self test plugin instance property name is not present
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME",
instanceFullName));
// store a message in the signed audit log file
auditMessage = CMS.getLogMessage(
- LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION,
- ILogger.SYSTEM_UID,
- ILogger.FAILURE);
+ LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION,
+ ILogger.SYSTEM_UID, ILogger.FAILURE);
audit(auditMessage);
@@ -931,22 +868,20 @@ public class SelfTestSubsystem
// store a message in the signed audit log file
auditMessage = CMS.getLogMessage(
- LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION,
- ILogger.SYSTEM_UID,
- ILogger.SUCCESS);
+ LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION,
+ ILogger.SYSTEM_UID, ILogger.SUCCESS);
audit(auditMessage);
if (CMS.debugOn()) {
CMS.debug("SelfTestSubsystem::runSelfTestsAtStartup():"
- + " EXITING.");
+ + " EXITING.");
}
} catch (EMissingSelfTestException eAudit1) {
// store a message in the signed audit log file
auditMessage = CMS.getLogMessage(
- LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION,
- ILogger.SYSTEM_UID,
- ILogger.FAILURE);
+ LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION,
+ ILogger.SYSTEM_UID, ILogger.FAILURE);
audit(auditMessage);
@@ -955,9 +890,8 @@ public class SelfTestSubsystem
} catch (ESelfTestException eAudit2) {
// store a message in the signed audit log file
auditMessage = CMS.getLogMessage(
- LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION,
- ILogger.SYSTEM_UID,
- ILogger.FAILURE);
+ LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION,
+ ILogger.SYSTEM_UID, ILogger.FAILURE);
audit(auditMessage);
@@ -974,10 +908,10 @@ public class SelfTestSubsystem
//
/**
- * Retrieve an individual self test from the instances list
- * given its instance name. This method may return null.
+ * Retrieve an individual self test from the instances list given its
+ * instance name. This method may return null.
* <P>
- *
+ *
* @param instanceName instance name of self test
* @return individual self test
*/
@@ -1009,10 +943,10 @@ public class SelfTestSubsystem
//
/**
- * Returns the ILogEventListener of this subsystem.
- * This method may return null.
+ * Returns the ILogEventListener of this subsystem. This method may return
+ * null.
* <P>
- *
+ *
* @return ILogEventListener of this subsystem
*/
public ILogEventListener getSelfTestLogger() {
@@ -1022,7 +956,7 @@ public class SelfTestSubsystem
/**
* This method represents the log interface for the self test subsystem.
* <P>
- *
+ *
* @param logger log event listener
* @param msg self test log message
*/
@@ -1038,43 +972,35 @@ public class SelfTestSubsystem
ev.setLevel(ILogger.LL_INFO);
try {
logger.log(ev);
- } catch( ELogException le ) {
+ } catch (ELogException le) {
// log the message to the "transactions" log
- mErrorLogger.log(ILogger.EV_AUDIT,
- null,
- ILogger.S_OTHER,
- ILogger.LL_INFO,
- msg + " - " + le.toString() );
+ mErrorLogger.log(ILogger.EV_AUDIT, null, ILogger.S_OTHER,
+ ILogger.LL_INFO, msg + " - " + le.toString());
}
} else {
// log the message to the "transactions" log
- mErrorLogger.log(ILogger.EV_AUDIT,
- null,
- ILogger.S_OTHER,
- ILogger.LL_INFO,
- msg);
+ mErrorLogger.log(ILogger.EV_AUDIT, null, ILogger.S_OTHER,
+ ILogger.LL_INFO, msg);
}
}
/**
- * 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).
+ * 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).
* <P>
- *
+ *
* @param instanceName instance name of self test
- * @param isCritical isCritical is either a critical failure (true) or
- * a non-critical failure (false)
+ * @param isCritical isCritical is either a critical failure (true) or a
+ * non-critical failure (false)
* @param instance individual self test
* @exception EDuplicateSelfTestException subsystem has duplicate name
* @exception EInvalidSelfTestException subsystem has invalid name/value
* @exception EMissingSelfTestException subsystem has missing name/value
*/
public void registerSelfTestOnDemand(String instanceName,
- boolean isCritical,
- ISelfTest instance)
- throws EDuplicateSelfTestException,
- EInvalidSelfTestException,
+ boolean isCritical, ISelfTest instance)
+ throws EDuplicateSelfTestException, EInvalidSelfTestException,
EMissingSelfTestException {
String instanceFullName = null;
@@ -1082,20 +1008,17 @@ public class SelfTestSubsystem
// from passed-in String parameters
if (instanceName != null) {
instanceName = instanceName.trim();
- instanceFullName = getFullName(mPrefix,
- instanceName);
+ instanceFullName = getFullName(mPrefix, instanceName);
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
if (mSelfTestInstances.containsKey(instanceName)) {
// self test plugin instance property name is a duplicate
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_DUPLICATE_NAME",
instanceFullName));
@@ -1110,28 +1033,26 @@ public class SelfTestSubsystem
}
/**
- * 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).
+ * 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).
* <P>
- *
+ *
* @param instanceName instance name of self test
* @exception EMissingSelfTestException subsystem has missing name
*/
public void deregisterSelfTestOnDemand(String instanceName)
- throws EMissingSelfTestException {
+ throws EMissingSelfTestException {
String instanceFullName = null;
// strip preceding/trailing whitespace
// from passed-in String parameters
if (instanceName != null) {
instanceName = instanceName.trim();
- instanceFullName = getFullName(mPrefix,
- instanceName);
+ instanceFullName = getFullName(mPrefix, instanceName);
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
@@ -1142,9 +1063,9 @@ public class SelfTestSubsystem
if (test == null) {
// self test plugin instance property name is not present
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME",
- instanceFullName));
+ CMS.getLogMessage(
+ "CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME",
+ instanceFullName));
throw new EMissingSelfTestException(instanceFullName);
} else {
@@ -1157,24 +1078,22 @@ public class SelfTestSubsystem
}
/**
- * 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).
+ * 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).
* <P>
- *
+ *
* @param instanceName instance name of self test
- * @param isCritical isCritical is either a critical failure (true) or
- * a non-critical failure (false)
+ * @param isCritical isCritical is either a critical failure (true) or a
+ * non-critical failure (false)
* @param instance individual self test
* @exception EDuplicateSelfTestException subsystem has duplicate name
* @exception EInvalidSelfTestException subsystem has invalid name/value
* @exception EMissingSelfTestException subsystem has missing name/value
*/
public void registerSelfTestAtStartup(String instanceName,
- boolean isCritical,
- ISelfTest instance)
- throws EDuplicateSelfTestException,
- EInvalidSelfTestException,
+ boolean isCritical, ISelfTest instance)
+ throws EDuplicateSelfTestException, EInvalidSelfTestException,
EMissingSelfTestException {
String instanceFullName = null;
@@ -1182,20 +1101,17 @@ public class SelfTestSubsystem
// from passed-in String parameters
if (instanceName != null) {
instanceName = instanceName.trim();
- instanceFullName = getFullName(mPrefix,
- instanceName);
+ instanceFullName = getFullName(mPrefix, instanceName);
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
if (mSelfTestInstances.containsKey(instanceName)) {
// self test plugin instance property name is a duplicate
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_DUPLICATE_NAME",
instanceFullName));
@@ -1210,28 +1126,26 @@ public class SelfTestSubsystem
}
/**
- * 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).
+ * 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).
* <P>
- *
+ *
* @param instanceName instance name of self test
* @exception EMissingSelfTestException subsystem has missing name
*/
public void deregisterSelfTestAtStartup(String instanceName)
- throws EMissingSelfTestException {
+ throws EMissingSelfTestException {
String instanceFullName = null;
// strip preceding/trailing whitespace
// from passed-in String parameters
if (instanceName != null) {
instanceName = instanceName.trim();
- instanceFullName = getFullName(mPrefix,
- instanceName);
+ instanceFullName = getFullName(mPrefix, instanceName);
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
@@ -1242,9 +1156,9 @@ public class SelfTestSubsystem
if (test == null) {
// self test plugin instance property name is not present
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME",
- instanceFullName));
+ CMS.getLogMessage(
+ "CMSCORE_SELFTESTS_PROPERTY_MISSING_NAME",
+ instanceFullName));
throw new EMissingSelfTestException(instanceFullName);
} else {
@@ -1256,15 +1170,15 @@ public class SelfTestSubsystem
disableSelfTestAtStartup(instanceName);
}
- ////////////////////////
+ // //////////////////////
// ISubsystem methods //
- ////////////////////////
+ // //////////////////////
/**
- * This method retrieves the name of this subsystem. This method
- * may return null.
+ * This method retrieves the name of this subsystem. This method may return
+ * null.
* <P>
- *
+ *
* @return identification of this subsystem
*/
public String getId() {
@@ -1274,20 +1188,18 @@ public class SelfTestSubsystem
/**
* This method sets information specific to this subsystem.
* <P>
- *
+ *
* @param id identification of this subsystem
* @exception EBaseException base CMS exception
*/
- public void setId(String id)
- throws EBaseException {
+ public void setId(String id) throws EBaseException {
// strip preceding/trailing whitespace
// from passed-in String parameters
if (id != null) {
id = id.trim();
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EBaseException("id is null");
}
@@ -1298,45 +1210,43 @@ public class SelfTestSubsystem
/**
* This method initializes this subsystem.
* <P>
- *
+ *
* @param owner owner of this subsystem
* @param config configuration store
* @exception EBaseException base CMS exception
*/
public void init(ISubsystem owner, IConfigStore config)
- throws EBaseException {
+ throws EBaseException {
if (CMS.debugOn()) {
- CMS.debug("SelfTestSubsystem::init():"
- + " ENTERING . . .");
+ CMS.debug("SelfTestSubsystem::init():" + " ENTERING . . .");
}
- if( config == null ) {
- CMS.debug( "SelfTestSubsystem::init() - config is null!" );
- throw new EBaseException( "config is null" );
+ if (config == null) {
+ CMS.debug("SelfTestSubsystem::init() - config is null!");
+ throw new EBaseException("config is null");
}
mOwner = owner;
mConfig = config;
- if ((mConfig != null) &&
- (mConfig.getName() != null) &&
- (mConfig.getName() != "")) {
+ if ((mConfig != null) && (mConfig.getName() != null)
+ && (mConfig.getName() != "")) {
mRootPrefix = mConfig.getName().trim();
}
int loadStatus = 0;
- // NOTE: Obviously, we must load the self test logger parameters
- // first, since the "selftests.log" log file does not
- // exist until this is accomplished!!!
+ // NOTE: Obviously, we must load the self test logger parameters
+ // first, since the "selftests.log" log file does not
+ // exist until this is accomplished!!!
- ////////////////////////////////////
+ // //////////////////////////////////
// loggerPropertyName=loggerValue //
- ////////////////////////////////////
+ // //////////////////////////////////
if (CMS.debugOn()) {
CMS.debug("SelfTestSubsystem::init():"
- + " loading self test logger parameters");
+ + " loading self test logger parameters");
}
String loggerPrefix = null;
@@ -1348,20 +1258,17 @@ public class SelfTestSubsystem
String loggerPath = PROP_CONTAINER + "." + PROP_LOGGER;
IConfigStore loggerConfig = mConfig.getSubStore(loggerPath);
- if ((loggerConfig != null) &&
- (loggerConfig.getName() != null) &&
- (loggerConfig.getName() != "")) {
+ if ((loggerConfig != null) && (loggerConfig.getName() != null)
+ && (loggerConfig.getName() != "")) {
loggerPrefix = loggerConfig.getName().trim();
} else {
- // NOTE: These messages can only be logged to the "transactions"
- // log, since the "selftests.log" will not exist!
+ // NOTE: These messages can only be logged to the "transactions"
+ // log, since the "selftests.log" will not exist!
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_INITIALIZATION_NOTIFICATION"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_INITIALIZATION_NOTIFICATION"));
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
@@ -1372,8 +1279,7 @@ public class SelfTestSubsystem
loadStatus++;
try {
- loggerFullName = getFullName(loggerPrefix,
- loggerName);
+ loggerFullName = getFullName(loggerPrefix, loggerName);
// retrieve the associated logger class
loggerValue = loggerConfig.getString(loggerName);
@@ -1383,34 +1289,29 @@ public class SelfTestSubsystem
// self test plugin instance property name exists,
// but it contains no value(s)
- // NOTE: This message can only be logged to the
- // "transactions" log, since the "selftests.log"
- // will not exist!
- log(mLogger,
- CMS.getLogMessage(
+ // NOTE: This message can only be logged to the
+ // "transactions" log, since the "selftests.log"
+ // will not exist!
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_MISSING_VALUES",
loggerFullName));
- throw new
- EMissingSelfTestException(loggerFullName,
+ throw new EMissingSelfTestException(loggerFullName,
loggerValue);
}
Object o = Class.forName(loggerValue).newInstance();
if (!(o instanceof ILogEventListener)) {
- // NOTE: These messages can only be logged to the
- // "transactions" log, since the "selftests.log"
- // will not exist!
+ // NOTE: These messages can only be logged to the
+ // "transactions" log, since the "selftests.log"
+ // will not exist!
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_INITIALIZATION_NOTIFICATION"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_INITIALIZATION_NOTIFICATION"));
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_INVALID_INSTANCE",
- loggerFullName,
- loggerValue));
+ loggerFullName, loggerValue));
throw new EInvalidSelfTestException(loggerFullName,
loggerValue);
@@ -1422,86 +1323,72 @@ public class SelfTestSubsystem
} catch (EBaseException e) {
// self test property name EBaseException
- // NOTE: These messages can only be logged to the
- // "transactions" log, since the "selftests.log"
- // will not exist!
+ // NOTE: These messages can only be logged to the
+ // "transactions" log, since the "selftests.log"
+ // will not exist!
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_INITIALIZATION_NOTIFICATION"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_INITIALIZATION_NOTIFICATION"));
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_THREW_EBASEEXCEPTION",
- loggerFullName,
- loggerValue));
+ loggerFullName, loggerValue));
- throw new EInvalidSelfTestException(loggerFullName,
- loggerValue);
+ throw new EInvalidSelfTestException(loggerFullName, loggerValue);
} catch (Exception e) {
- // NOTE: These messages can only be logged to the
- // "transactions" log, since the "selftests.log"
- // will not exist!
+ // NOTE: These messages can only be logged to the
+ // "transactions" log, since the "selftests.log"
+ // will not exist!
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_INITIALIZATION_NOTIFICATION"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_INITIALIZATION_NOTIFICATION"));
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_THREW_EXCEPTION",
- loggerFullName,
- loggerValue));
+ loggerFullName, loggerValue));
CMS.debugStackTrace();
- throw new EInvalidSelfTestException(loggerFullName,
- loggerValue);
+ throw new EInvalidSelfTestException(loggerFullName, loggerValue);
}
}
// Barring any exceptions thrown above, we begin logging messages
// to either the "transactions" log, or the "selftests.log" log.
if (loadStatus == 0) {
- // NOTE: These messages can only be logged to the
- // "transactions" log, since the "selftests.log"
- // will not exist!
+ // NOTE: These messages can only be logged to the
+ // "transactions" log, since the "selftests.log"
+ // will not exist!
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_INITIALIZATION_NOTIFICATION"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_INITIALIZATION_NOTIFICATION"));
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_DONT_LOAD_LOGGER_PARAMETERS"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_DONT_LOAD_LOGGER_PARAMETERS"));
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_INITIALIZATION_NOTIFICATION"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_INITIALIZATION_NOTIFICATION"));
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_LOAD_LOGGER_PARAMETERS"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_LOAD_LOGGER_PARAMETERS"));
}
- ////////////////////////////////////////
+ // //////////////////////////////////////
// instancePropertyName=instanceValue //
- ////////////////////////////////////////
+ // //////////////////////////////////////
if (CMS.debugOn()) {
CMS.debug("SelfTestSubsystem::init():"
- + " loading self test plugins");
+ + " loading self test plugins");
}
// compose self test plugins instance property prefix
String instancePath = PROP_CONTAINER + "." + PROP_INSTANCE;
IConfigStore instanceConfig = mConfig.getSubStore(instancePath);
- if ((instanceConfig != null) &&
- (instanceConfig.getName() != null) &&
- (instanceConfig.getName() != "")) {
+ if ((instanceConfig != null) && (instanceConfig.getName() != null)
+ && (instanceConfig.getName() != "")) {
mPrefix = instanceConfig.getName().trim();
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
@@ -1510,12 +1397,11 @@ public class SelfTestSubsystem
if (instances.hasMoreElements()) {
loadStatus++;
-
- log(mLogger,
- CMS.getLogMessage("CMSCORE_SELFTESTS_LOAD_PLUGINS"));
+
+ log(mLogger, CMS.getLogMessage("CMSCORE_SELFTESTS_LOAD_PLUGINS"));
} else {
log(mLogger,
- CMS.getLogMessage("CMSCORE_SELFTESTS_DONT_LOAD_PLUGINS"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_DONT_LOAD_PLUGINS"));
}
// load all self test plugin instances
@@ -1529,20 +1415,17 @@ public class SelfTestSubsystem
instanceName = (String) instances.nextElement();
if (instanceName != null) {
instanceName = instanceName.trim();
- instanceFullName = getFullName(mPrefix,
- instanceName);
+ instanceFullName = getFullName(mPrefix, instanceName);
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL"));
throw new EMissingSelfTestException();
}
if (mSelfTestInstances.containsKey(instanceName)) {
// self test plugin instance property name is a duplicate
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_DUPLICATE_NAME",
instanceFullName));
@@ -1557,22 +1440,18 @@ public class SelfTestSubsystem
} else {
// self test plugin instance property name exists,
// but it contains no value(s)
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_MISSING_VALUES",
instanceFullName));
- throw new
- EMissingSelfTestException(instanceFullName,
+ throw new EMissingSelfTestException(instanceFullName,
instanceValue);
}
} catch (EBaseException e) {
// self test property name EBaseException
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_THREW_EBASEEXCEPTION",
- instanceFullName,
- instanceValue));
+ instanceFullName, instanceValue));
throw new EInvalidSelfTestException(instanceFullName,
instanceValue);
@@ -1585,21 +1464,17 @@ public class SelfTestSubsystem
o = Class.forName(instanceValue).newInstance();
if (!(o instanceof ISelfTest)) {
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_INVALID_INSTANCE",
- instanceFullName,
- instanceValue));
+ instanceFullName, instanceValue));
throw new EInvalidSelfTestException(instanceFullName,
instanceValue);
}
} catch (Exception e) {
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_THREW_EXCEPTION",
- instanceFullName,
- instanceValue));
+ instanceFullName, instanceValue));
CMS.debugStackTrace();
@@ -1614,12 +1489,11 @@ public class SelfTestSubsystem
if (CMS.debugOn()) {
CMS.debug("SelfTestSubsystem::init():"
- + " loading self test plugin parameters");
+ + " loading self test plugin parameters");
}
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_LOAD_PLUGIN_PARAMETERS"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_LOAD_PLUGIN_PARAMETERS"));
}
ISelfTest test = (ISelfTest) o;
@@ -1629,45 +1503,38 @@ public class SelfTestSubsystem
// store this self test plugin instance
mSelfTestInstances.put(instanceName, test);
} catch (EDuplicateSelfTestException e) {
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PLUGIN_DUPLICATE_PARAMETER",
- instanceFullName,
- e.getInstanceParameter()));
+ instanceFullName, e.getInstanceParameter()));
throw e;
} catch (EMissingSelfTestException e) {
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PLUGIN_MISSING_PARAMETER",
- instanceFullName,
- e.getInstanceParameter()));
+ instanceFullName, e.getInstanceParameter()));
throw e;
} catch (EInvalidSelfTestException e) {
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PLUGIN_INVALID_PARAMETER",
- instanceFullName,
- e.getInstanceParameter()));
+ instanceFullName, e.getInstanceParameter()));
throw e;
}
}
- //////////////////////////////////////////////////////////
+ // ////////////////////////////////////////////////////////
// onDemandOrderPropertyName=onDemandOrderValue1, . . . //
- //////////////////////////////////////////////////////////
+ // ////////////////////////////////////////////////////////
if (CMS.debugOn()) {
CMS.debug("SelfTestSubsystem::init():"
- + " loading on demand self tests");
+ + " loading on demand self tests");
}
// compose self test plugins on-demand ordering property name
- String onDemandOrderName = PROP_CONTAINER + "."
- + PROP_ORDER + "."
- + PROP_ON_DEMAND;
+ String onDemandOrderName = PROP_CONTAINER + "." + PROP_ORDER + "."
+ + PROP_ON_DEMAND;
String onDemandOrderFullName = getFullName(mRootPrefix,
onDemandOrderName);
String onDemandOrderValues = null;
@@ -1683,23 +1550,21 @@ public class SelfTestSubsystem
loadStatus++;
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_LOAD_PLUGINS_ON_DEMAND"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_LOAD_PLUGINS_ON_DEMAND"));
- if ((onDemandOrderValues == null) ||
- (onDemandOrderValues.equals(""))) {
+ if ((onDemandOrderValues == null)
+ || (onDemandOrderValues.equals(""))) {
// self test plugins on-demand ordering property name
// exists, but it contains no values, which means that
// no self tests are configured to run on-demand
- if( ( onDemandOrderFullName != null ) &&
- ( !onDemandOrderFullName.equals( "" ) ) ) {
- log(mLogger,
- CMS.getLogMessage(
+ if ((onDemandOrderFullName != null)
+ && (!onDemandOrderFullName.equals(""))) {
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_MISSING_ON_DEMAND_VALUES",
onDemandOrderFullName));
}
- throw new EBaseException( "onDemandOrderValues is null "
- + "or empty" );
+ throw new EBaseException("onDemandOrderValues is null "
+ + "or empty");
}
StringTokenizer tokens = new StringTokenizer(onDemandOrderValues,
@@ -1709,11 +1574,10 @@ public class SelfTestSubsystem
// create a new element in the on-demand ordered list
SelfTestOrderedInstance element;
- element = new SelfTestOrderedInstance(
- tokens.nextToken().trim());
+ element = new SelfTestOrderedInstance(tokens.nextToken().trim());
- // SANITY CHECK: find the corresponding instance property
- // name for this self test plugin
+ // SANITY CHECK: find the corresponding instance property
+ // name for this self test plugin
checkInstance(element);
// store this self test plugin in on-demand order
@@ -1726,37 +1590,32 @@ public class SelfTestSubsystem
// presently, we merely log this fact
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_DONT_LOAD_PLUGINS_ON_DEMAND"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_DONT_LOAD_PLUGINS_ON_DEMAND"));
// throw new EMissingSelfTestException( onDemandOrderFullName );
} catch (EBaseException e) {
// self test property name EBaseException
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_THREW_EBASEEXCEPTION",
- onDemandOrderFullName,
- onDemandOrderValues));
+ onDemandOrderFullName, onDemandOrderValues));
throw new EInvalidSelfTestException(onDemandOrderFullName,
onDemandOrderValues);
}
- ////////////////////////////////////////////////////////
+ // //////////////////////////////////////////////////////
// startupOrderPropertyName=startupOrderValue1, . . . //
- ////////////////////////////////////////////////////////
+ // //////////////////////////////////////////////////////
if (CMS.debugOn()) {
CMS.debug("SelfTestSubsystem::init():"
- + " loading startup self tests");
+ + " loading startup self tests");
}
// compose self test plugins startup ordering property name
- String startupOrderName = PROP_CONTAINER + "."
- + PROP_ORDER + "."
- + PROP_STARTUP;
- String startupOrderFullName = getFullName(mRootPrefix,
- startupOrderName);
+ String startupOrderName = PROP_CONTAINER + "." + PROP_ORDER + "."
+ + PROP_STARTUP;
+ String startupOrderFullName = getFullName(mRootPrefix, startupOrderName);
String startupOrderValues = null;
try {
@@ -1770,18 +1629,15 @@ public class SelfTestSubsystem
loadStatus++;
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_LOAD_PLUGINS_AT_STARTUP"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_LOAD_PLUGINS_AT_STARTUP"));
- if ((startupOrderValues == null) ||
- (startupOrderValues.equals(""))) {
+ if ((startupOrderValues == null) || (startupOrderValues.equals(""))) {
// self test plugins startup ordering property name
// exists, but it contains no values, which means that
// no self tests are configured to run at server startup
- if( ( startupOrderFullName != null ) &&
- ( !startupOrderFullName.equals( "" ) ) ) {
- log(mLogger,
- CMS.getLogMessage(
+ if ((startupOrderFullName != null)
+ && (!startupOrderFullName.equals(""))) {
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_MISSING_STARTUP_VALUES",
startupOrderFullName));
}
@@ -1794,11 +1650,10 @@ public class SelfTestSubsystem
// create a new element in the startup ordered list
SelfTestOrderedInstance element;
- element = new SelfTestOrderedInstance(
- tokens.nextToken().trim());
+ element = new SelfTestOrderedInstance(tokens.nextToken().trim());
- // SANITY CHECK: find the corresponding instance property
- // name for this self test plugin
+ // SANITY CHECK: find the corresponding instance property
+ // name for this self test plugin
checkInstance(element);
// store this self test plugin in startup order
@@ -1811,17 +1666,14 @@ public class SelfTestSubsystem
// presently, we merely log this fact
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_DONT_LOAD_PLUGINS_AT_STARTUP"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_DONT_LOAD_PLUGINS_AT_STARTUP"));
// throw new EMissingSelfTestException( startupOrderFullName );
} catch (EBaseException e) {
// self test property name EBaseException
- log(mLogger,
- CMS.getLogMessage(
+ log(mLogger, CMS.getLogMessage(
"CMSCORE_SELFTESTS_PROPERTY_THREW_EBASEEXCEPTION",
- startupOrderFullName,
- startupOrderValues));
+ startupOrderFullName, startupOrderValues));
throw new EInvalidSelfTestException(startupOrderFullName,
startupOrderValues);
@@ -1830,28 +1682,23 @@ public class SelfTestSubsystem
// notify user whether or not self test plugins have been loaded
if (loadStatus == 0) {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PLUGINS_NONE_LOADED"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_PLUGINS_NONE_LOADED"));
} else {
- log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_PLUGINS_LOADED"));
+ log(mLogger, CMS.getLogMessage("CMSCORE_SELFTESTS_PLUGINS_LOADED"));
}
if (CMS.debugOn()) {
- CMS.debug("SelfTestSubsystem::init():"
- + " EXITING.");
+ CMS.debug("SelfTestSubsystem::init():" + " EXITING.");
}
}
/**
* Notifies this subsystem if owner is in running mode.
* <P>
- *
+ *
* @exception EBaseException base CMS exception
*/
- public void startup()
- throws EBaseException {
+ public void startup() throws EBaseException {
// loop through all self test plugin instances
Enumeration instances = mSelfTestInstances.elements();
@@ -1868,8 +1715,7 @@ public class SelfTestSubsystem
if (selftests.hasMoreElements()) {
// log that execution of startup self tests has begun
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_RUN_AT_STARTUP"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_RUN_AT_STARTUP"));
// execute all startup self tests
runSelfTestsAtStartup();
@@ -1877,24 +1723,22 @@ public class SelfTestSubsystem
// log that execution of all "critical" startup self tests
// has completed "successfully"
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_RUN_AT_STARTUP_SUCCEEDED"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_RUN_AT_STARTUP_SUCCEEDED"));
} else {
log(mLogger,
- CMS.getLogMessage(
- "CMSCORE_SELFTESTS_NOT_RUN_AT_STARTUP"));
+ CMS.getLogMessage("CMSCORE_SELFTESTS_NOT_RUN_AT_STARTUP"));
}
}
}
/**
- * Stops this subsystem. The owner may call shutdown
- * anytime after initialization.
+ * Stops this subsystem. The owner may call shutdown anytime after
+ * initialization.
* <P>
*/
public void shutdown() {
// reverse order of all self test plugin instances
- Collection collection = mSelfTestInstances.values();
+ Collection collection = mSelfTestInstances.values();
Vector list = new Vector(collection);
Collections.reverse(list);
@@ -1910,14 +1754,13 @@ public class SelfTestSubsystem
}
/**
- * Returns the root configuration storage of this subsystem.
- * This method may return null.
+ * Returns the root configuration storage of this subsystem. This method may
+ * return null.
* <P>
- *
+ *
* @return configuration store of this subsystem
*/
public IConfigStore getConfigStore() {
return mConfig;
}
}
-