summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/ONAPLoggingContext.java218
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/ONAPLoggingUtils.java62
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/eelf/Configuration.java38
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/eelf/DroolsPDPMDCInfo.java4
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java145
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventData.java47
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfo.java19
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandler.java6
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/eelf/MDCInfo.java5
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/eelf/MessageCodes.java228
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java2825
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/EelfLogger.java929
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/FlexLogger.java589
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger.java383
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java912
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/LoggerType.java8
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/PropertyUtil.java667
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/SystemOutLogger.java957
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/nsa/LoggingContext.java69
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/nsa/LoggingContextFactory.java44
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/nsa/SharedLoggingContext.java24
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java45
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/Slf4jLoggingContext.java80
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/nsa/package-info.java5
-rw-r--r--common-logging/src/main/resources/org/onap/policy/common/logging/eelf/Resources.properties14
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/DroolsPDPMDCInfoTest.java26
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/ErrorCodeMapTest.java12
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventDataTest.java287
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandlerTest.java194
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoTest.java198
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/PolicyLoggerTest.java129
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/EelfLoggerTest.java47
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java42
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/Logger4JTest.java19
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/PropertyUtilTest.java61
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/SystemOutLoggerTest.java98
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/util/TestUtils.java28
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/AdministrativeStateException.java29
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/AllSeemsWellException.java33
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/ForwardProgressException.java29
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java3814
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorException.java44
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorProperties.java72
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorPropertiesException.java29
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/StandbyStatusException.java53
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java74
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/StateElement.java250
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java1835
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java1620
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransitionException.java29
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdmin.java370
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminException.java26
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminMBean.java41
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/JmxAgentConnection.java171
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java184
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java217
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java226
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java215
-rw-r--r--integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java277
-rw-r--r--integrity-monitor/src/test/java/org/onap/policy/common/im/ExceptionsTest.java80
-rw-r--r--integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java1722
-rw-r--r--integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java513
-rw-r--r--integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementEntityTest.java193
-rw-r--r--integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java4
-rw-r--r--integrity-monitor/src/test/java/org/onap/policy/common/im/StateTransitionTest.java3341
-rw-r--r--integrity-monitor/src/test/java/org/onap/policy/common/im/exceptions/EntityRetrievalExceptionTest.java1
66 files changed, 12737 insertions, 12219 deletions
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/ONAPLoggingContext.java b/common-logging/src/main/java/org/onap/policy/common/logging/ONAPLoggingContext.java
index 883b3a1e..92bc6236 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/ONAPLoggingContext.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/ONAPLoggingContext.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,35 +24,37 @@ import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.Instant;
import java.util.Date;
+
import org.onap.policy.common.logging.nsa.LoggingContextFactory;
import org.onap.policy.common.logging.nsa.SharedLoggingContext;
import org.slf4j.MDC;
/**
- * A facade over the org.onap.policy.common.logging.nsa.SharedLoggingContext interface/implementation that makes it
- * more convenient to use. SharedLoggingContext builds on the SLF4J/log4j Mapped Diagnostic Context (MDC)
- * feature, which provides a hashmap-based context for data items that need to be logged, where the
- * hashmap is kept in ThreadLocal storage. The data items can be referenced in the log4j configuration
- * using the EnhancedPatternLayout appender layout class, and the notation "%X{key}" in the ConversionPattern
- * string, where "key" is one of the keys in the MDC hashmap (which is determined by what hashmap entries the
- * application code creates). Example:
- * log4j.appender.auditAppender.layout=org.apache.log4j.EnhancedPatternLayout
- * log4j.appender.auditAppender.layout.ConversionPattern=%d|%X{requestId}|%X{serviceInstanceId}|...|%m%n
+ * A facade over the org.onap.policy.common.logging.nsa.SharedLoggingContext
+ * interface/implementation that makes it more convenient to use. SharedLoggingContext builds on the
+ * SLF4J/log4j Mapped Diagnostic Context (MDC) feature, which provides a hashmap-based context for
+ * data items that need to be logged, where the hashmap is kept in ThreadLocal storage. The data
+ * items can be referenced in the log4j configuration using the EnhancedPatternLayout appender
+ * layout class, and the notation "%X{key}" in the ConversionPattern string, where "key" is one of
+ * the keys in the MDC hashmap (which is determined by what hashmap entries the application code
+ * creates). Example: log4j.appender.auditAppender.layout=org.apache.log4j.EnhancedPatternLayout
+ * log4j.appender.auditAppender.layout.ConversionPattern=%d|%X{requestId}|%X{serviceInstanceId}|...|%m%n
* where "requestId" and "serviceInstanceId" are entries in the MDC hashmap.
- *
- * The notable functionality the SharedLoggingContext adds over MDC is that it maintains its own copy
- * of the MDC data items in a hashmap (not in ThreadLocal storage), which allows more control of the data.
- * The ONAPLoggingContext constructor that takes another ONAPLoggingContext object as a parameter makes
- * use of this feature. For example if there is a thread pulling requests from a queue for processing, it
- * can keep a base logging context with data that is common to all requests, and for each request, create a
- * new logging context with that base context as a parameter; this will create a new logging context with
- * those initial values and none of the request-specific values from the previous request such as a request ID.
-
- * The setter methods in this class set corresponding items in the SharedLoggingContext/MDC hashmaps.
- * These items correspond to the fields defined in the "ONAP platform application logging guidelines"
- * document. In addition, there is a pair of convenience functions, transactionStarted() and
- * transactionEnded(), that can be called at the beginning and end of transaction processing to calculate
- * the duration of the transaction and record that value in the "timer" item.
+ *
+ * <p>The notable functionality the SharedLoggingContext adds over MDC is that it maintains its own
+ * copy of the MDC data items in a hashmap (not in ThreadLocal storage), which allows more control
+ * of the data. The ONAPLoggingContext constructor that takes another ONAPLoggingContext object as a
+ * parameter makes use of this feature. For example if there is a thread pulling requests from a
+ * queue for processing, it can keep a base logging context with data that is common to all
+ * requests, and for each request, create a new logging context with that base context as a
+ * parameter; this will create a new logging context with those initial values and none of the
+ * request-specific values from the previous request such as a request ID.
+ *
+ * <p>The setter methods in this class set corresponding items in the SharedLoggingContext/MDC
+ * hashmaps. These items correspond to the fields defined in the "ONAP platform application logging
+ * guidelines" document. In addition, there is a pair of convenience functions, transactionStarted()
+ * and transactionEnded(), that can be called at the beginning and end of transaction processing to
+ * calculate the duration of the transaction and record that value in the "timer" item.
*
*/
public class ONAPLoggingContext {
@@ -101,13 +103,13 @@ public class ONAPLoggingContext {
}
/**
- * Create a new ONAPLoggingContext initially populated with the values
- * in the given base context. This can be used for example in a servlet
- * where each incoming request may be processed by a separate thread, but
- * there may be some logging data items that will be unchanging and common
- * to all the threads. That constant data can be populated in a base
- * context, and then each request handler creates new context passing that
- * base context to populate the common data in the new one.
+ * Create a new ONAPLoggingContext initially populated with the values in the given base
+ * context. This can be used for example in a servlet where each incoming request may be
+ * processed by a separate thread, but there may be some logging data items that will be
+ * unchanging and common to all the threads. That constant data can be populated in a base
+ * context, and then each request handler creates new context passing that base context to
+ * populate the common data in the new one.
+ *
* @param baseContext onap logging context
*/
public ONAPLoggingContext(ONAPLoggingContext baseContext) {
@@ -128,9 +130,8 @@ public class ONAPLoggingContext {
}
/**
- * Indicate the start of transaction processing. The current system time
- * will be recorded for use by <code>transactionEnded()</code> to calculate
- * the duration of the transaction.
+ * Indicate the start of transaction processing. The current system time will be recorded for
+ * use by <code>transactionEnded()</code> to calculate the duration of the transaction.
*/
public void transactionStarted() {
transactionStartTime = Instant.now();
@@ -138,9 +139,9 @@ public class ONAPLoggingContext {
}
/**
- * Indicate the end of transaction processing. The difference between the
- * current system time and the time recorded by <code>transactionStarted()</code>
- * will be recorded in the data item with key "TransactionElapsedTime".
+ * Indicate the end of transaction processing. The difference between the current system time
+ * and the time recorded by <code>transactionStarted()</code> will be recorded in the data item
+ * with key "TransactionElapsedTime".
*/
public void transactionEnded() {
Instant transactionEndTime = Instant.now();
@@ -149,9 +150,8 @@ public class ONAPLoggingContext {
}
/**
- * Indicate the start of metric processing. The current system time
- * will be recorded for use by <code>metricEnded()</code> to calculate
- * the duration of the metric.
+ * Indicate the start of metric processing. The current system time will be recorded for use by
+ * <code>metricEnded()</code> to calculate the duration of the metric.
*/
public void metricStarted() {
metricStartTime = Instant.now();
@@ -159,9 +159,9 @@ public class ONAPLoggingContext {
}
/**
- * Indicate the end of metric processing. The difference between the
- * current system time and the time recorded by <code>metricStarted()</code>
- * will be recorded in the data item with key "MetricElapsedTime".
+ * Indicate the end of metric processing. The difference between the current system time and the
+ * time recorded by <code>metricStarted()</code> will be recorded in the data item with key
+ * "MetricElapsedTime".
*/
public void metricEnded() {
Instant metricEndTime = Instant.now();
@@ -170,7 +170,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "requestId"
+ * Set the value for the data item with key "requestId".
*
* @param id request identifier
*/
@@ -179,7 +179,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "requestId"
+ * Get the value for the data item with key "requestId".
+ *
* @return current value, or empty string if not set
*/
public String getRequestID() {
@@ -187,7 +188,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "serviceInstanceId"
+ * Set the value for the data item with key "serviceInstanceId".
*
* @param id service identifier
*/
@@ -196,7 +197,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "serviceInstanceId"
+ * Get the value for the data item with key "serviceInstanceId".
+ *
* @return current value, or empty string if not set
*/
public String getServiceInstanceID() {
@@ -204,9 +206,8 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "threadId".
- * An alternative to using this item is to use the
- * %t conversion character in the appender's conversion string.
+ * Set the value for the data item with key "threadId". An alternative to using this item is to
+ * use the %t conversion character in the appender's conversion string.
*
* @param id thread identifier
*/
@@ -215,7 +216,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "threadId"
+ * Get the value for the data item with key "threadId".
+ *
* @return current value, or empty string if not set
*/
public String getThreadID() {
@@ -223,7 +225,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "serverName"
+ * Set the value for the data item with key "serverName".
*
* @param name server name
*/
@@ -232,7 +234,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "serverName"
+ * Get the value for the data item with key "serverName".
+ *
* @return current value, or empty string if not set
*/
public String getServerName() {
@@ -240,7 +243,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "serviceName"
+ * Set the value for the data item with key "serviceName".
*
* @param name service name
*/
@@ -249,7 +252,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "serviceName"
+ * Get the value for the data item with key "serviceName".
+ *
* @return current value, or empty string if not set
*/
public String getServiceName() {
@@ -257,7 +261,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "partnerName"
+ * Set the value for the data item with key "partnerName".
*
* @param name partner name
*/
@@ -266,7 +270,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "partnerName"
+ * Get the value for the data item with key "partnerName".
+ *
* @return current value, or empty string if not set
*/
public String getPartnerName() {
@@ -274,7 +279,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "statusCode"
+ * Set the value for the data item with key "statusCode".
*
* @param name status code
*/
@@ -283,7 +288,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "statusCode"
+ * Get the value for the data item with key "statusCode".
+ *
* @return current value, or empty string if not set
*/
public String getStatusCode() {
@@ -291,7 +297,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "targetEntity"
+ * Set the value for the data item with key "targetEntity".
*
* @param name target entity
*/
@@ -300,7 +306,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "targetEntity"
+ * Get the value for the data item with key "targetEntity".
+ *
* @return current value, or empty string if not set
*/
public String getTargetEntity() {
@@ -308,7 +315,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "targetServiceName"
+ * Set the value for the data item with key "targetServiceName".
*
* @param name target service name
*/
@@ -317,7 +324,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "targetServiceName"
+ * Get the value for the data item with key "targetServiceName".
+ *
* @return current value, or empty string if not set
*/
public String getTargetServiceName() {
@@ -325,7 +333,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "instanceUuid"
+ * Set the value for the data item with key "instanceUuid".
*
* @param uuid instance uuid
*/
@@ -334,7 +342,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "instanceUuid"
+ * Get the value for the data item with key "instanceUuid".
+ *
* @return current value, or empty string if not set
*/
public String getInstanceUUID() {
@@ -342,7 +351,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "severity"
+ * Set the value for the data item with key "severity".
*
* @param severity severity
*/
@@ -351,7 +360,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "severity"
+ * Get the value for the data item with key "severity".
+ *
* @return current value, or empty string if not set
*/
public String getSeverity() {
@@ -359,7 +369,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "serverIp"
+ * Set the value for the data item with key "serverIp".
*
* @param serverIP server ip address
*/
@@ -368,7 +378,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "serverIp"
+ * Get the value for the data item with key "serverIp".
+ *
* @return current value, or empty string if not set
*/
public String getServerIPAddress() {
@@ -376,7 +387,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "server"
+ * Set the value for the data item with key "server".
*
* @param server server
*/
@@ -385,7 +396,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "server"
+ * Get the value for the data item with key "server".
+ *
* @return current value, or empty string if not set
*/
public String getServer() {
@@ -393,7 +405,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "clientIp"
+ * Set the value for the data item with key "clientIp".
*
* @param clientIP client ip address
*/
@@ -402,7 +414,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "clientIp"
+ * Get the value for the data item with key "clientIp".
+ *
* @return current value, or empty string if not set
*/
public String getClientIPAddress() {
@@ -410,13 +423,11 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "classname".
- * Use of this item is not recommended (unless it is used to
- * indicate something other than the Java classname) since
- * it would be unwieldy to maintain a correct value across
- * calls to/returns from methods in other classes.
- * Use of the PatternLayout %c conversion character in the
- * conversion string will give a more reliable value.
+ * Set the value for the data item with key "classname". Use of this item is not recommended
+ * (unless it is used to indicate something other than the Java classname) since it would be
+ * unwieldy to maintain a correct value across calls to/returns from methods in other classes.
+ * Use of the PatternLayout %c conversion character in the conversion string will give a more
+ * reliable value.
*
* @param classname class name
*/
@@ -425,7 +436,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "classname"
+ * Get the value for the data item with key "classname".
+ *
* @return current value, or empty string if not set
*/
public String getClassname() {
@@ -433,7 +445,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "TransactionBeginTimestamp"
+ * Set the value for the data item with key "TransactionBeginTimestamp".
*
* @param transactionStartTime transaction start time
*/
@@ -443,7 +455,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "TransactionBeginTimestamp"
+ * Get the value for the data item with key "TransactionBeginTimestamp".
+ *
* @return current value, or 0 if not set
*/
public long getTransactionBeginTimestamp() {
@@ -451,7 +464,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "TransactionEndTimestamp"
+ * Set the value for the data item with key "TransactionEndTimestamp".
*
* @param transactionEndTime transaction end time
*/
@@ -461,7 +474,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "TransactionEndTimestamp"
+ * Get the value for the data item with key "TransactionEndTimestamp".
+ *
* @return current value, or 0 if not set
*/
public long getTransactionEndTimestamp() {
@@ -469,12 +483,10 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "TransactionElapsedTime".
- * An alternative to calling this method directly is to call
- * <code>transactionStarted()</code> at the start of transaction
- * processing and <code>transactionEnded()</code> at the end,
- * which will compute the time difference in milliseconds
- * and store the result as the "ns" value.
+ * Set the value for the data item with key "TransactionElapsedTime". An alternative to calling
+ * this method directly is to call <code>transactionStarted()</code> at the start of transaction
+ * processing and <code>transactionEnded()</code> at the end, which will compute the time
+ * difference in milliseconds and store the result as the "ns" value.
*
* @param transactionEndTime transaction end time
*/
@@ -485,7 +497,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "TransactionElapsedTime"
+ * Get the value for the data item with key "TransactionElapsedTime".
+ *
* @return current value, or 0 if not set
*/
public long getTransactionElapsedTime() {
@@ -493,7 +506,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "MetricBeginTimestamp"
+ * Set the value for the data item with key "MetricBeginTimestamp".
*
* @param metricStartTime metric start time
*/
@@ -503,7 +516,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "MetricBeginTimestamp"
+ * Get the value for the data item with key "MetricBeginTimestamp".
+ *
* @return current value, or 0 if not set
*/
public long getMetricBeginTimestamp() {
@@ -511,7 +525,7 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "MetricEndTimestamp"
+ * Set the value for the data item with key "MetricEndTimestamp".
*
* @param metricEndTime metric end time
*/
@@ -521,7 +535,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "MetricEndTimestamp"
+ * Get the value for the data item with key "MetricEndTimestamp".
+ *
* @return current value, or 0 if not set
*/
public long getMetricEndTimestamp() {
@@ -529,11 +544,9 @@ public class ONAPLoggingContext {
}
/**
- * Set the value for the data item with key "MetricElapsedTime".
- * An alternative to calling this method directly is to call
- * <code>metricStarted()</code> at the start of metric
- * processing and <code>metricEnded()</code> at the end,
- * which will compute the time difference in milliseconds
+ * Set the value for the data item with key "MetricElapsedTime". An alternative to calling this
+ * method directly is to call <code>metricStarted()</code> at the start of metric processing and
+ * <code>metricEnded()</code> at the end, which will compute the time difference in milliseconds
* and store the result as the "ns" value.
*
* @param metricEndTime metric end time
@@ -545,7 +558,8 @@ public class ONAPLoggingContext {
}
/**
- * Get the value for the data item with key "MetricElapsedTime"
+ * Get the value for the data item with key "MetricElapsedTime".
+ *
* @return current value, or 0 if not set
*/
public long getMetricElapsedTime() {
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/ONAPLoggingUtils.java b/common-logging/src/main/java/org/onap/policy/common/logging/ONAPLoggingUtils.java
index e0778ea3..0983ed6f 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/ONAPLoggingUtils.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/ONAPLoggingUtils.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,33 +24,39 @@ import javax.servlet.http.HttpServletRequest;
public class ONAPLoggingUtils {
- private ONAPLoggingUtils() {};
-
- public static ONAPLoggingContext getLoggingContextForRequest(HttpServletRequest request,
- ONAPLoggingContext baseContext)
- {
- ONAPLoggingContext requestContext = new ONAPLoggingContext(baseContext);
- if (request.getLocalAddr() != null) { // may be null in junit tests
- requestContext.setServerIPAddress(request.getLocalAddr());
- }
- // get client IP address as leftmost address in X-Forwarded-For header if present,
- // otherwise from remote address in the request
- String forwarded = request.getHeader("X-Forwarded-For");
- if (forwarded != null && forwarded.trim().length() > 0) {
- forwarded = forwarded.trim().split(",")[0];
- requestContext.setClientIPAddress(forwarded);
- } else if (request.getRemoteAddr() != null) { // may be null in junit tests
- requestContext.setClientIPAddress(request.getRemoteAddr());
- }
- // RequestID
- // This needs to be renamed to ONAP when the other components in ONAP
- // rename to this.
- String requestId = request.getHeader("X-ECOMP-RequestID");
- if (requestId != null && requestId.trim().length() > 0) {
- requestContext.setRequestID(requestId);
- }
- return requestContext;
- }
+ private ONAPLoggingUtils() {}
+
+ /**
+ * Get the ONAPLoggingContext for a request.
+ *
+ * @param request the request
+ * @param baseContext the context to supply to the ONAPLoggingContext
+ * @return the ONAPLoggingContext
+ */
+ public static ONAPLoggingContext getLoggingContextForRequest(HttpServletRequest request,
+ ONAPLoggingContext baseContext) {
+ ONAPLoggingContext requestContext = new ONAPLoggingContext(baseContext);
+ if (request.getLocalAddr() != null) { // may be null in junit tests
+ requestContext.setServerIPAddress(request.getLocalAddr());
+ }
+ // get client IP address as leftmost address in X-Forwarded-For header if present,
+ // otherwise from remote address in the request
+ String forwarded = request.getHeader("X-Forwarded-For");
+ if (forwarded != null && forwarded.trim().length() > 0) {
+ forwarded = forwarded.trim().split(",")[0];
+ requestContext.setClientIPAddress(forwarded);
+ } else if (request.getRemoteAddr() != null) { // may be null in junit tests
+ requestContext.setClientIPAddress(request.getRemoteAddr());
+ }
+ // RequestID
+ // This needs to be renamed to ONAP when the other components in ONAP
+ // rename to this.
+ String requestId = request.getHeader("X-ECOMP-RequestID");
+ if (requestId != null && requestId.trim().length() > 0) {
+ requestContext.setRequestID(requestId);
+ }
+ return requestContext;
+ }
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/Configuration.java b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/Configuration.java
index 9d550c35..0752b188 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/Configuration.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/Configuration.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,77 +24,59 @@ package org.onap.policy.common.logging.eelf;
public interface Configuration extends com.att.eelf.configuration.Configuration {
/**
- * The Date-time of the start of a transaction
+ * The Date-time of the start of a transaction.
*/
String BEGIN_TIME_STAMP = "BeginTimestamp";
/**
- * The Date-time of the end of transaction
+ * The Date-time of the end of transaction.
*/
String END_TIME_STAMP = "EndTimestamp";
/**
- * Externally advertised API invoked by clients of this component
+ * Externally advertised API invoked by clients of this component.
*/
String SERVICE_NAME = "ServiceName";
/**
- * Client or user invoking the API
+ * Client or user invoking the API.
*/
String PARTNER_NAME = "PartnerName";
- /**
- * Target Entity
- */
String TARGET_ENTITY = "TargetEntity";
- /**
- * Target service name
- */
String TARGET_SERVICE_NAME = "TargetServiceName";
/**
- * High level success or failure (COMPLETE or ERROR)
+ * High level success or failure (COMPLETE or ERROR).
*/
String STATUS_CODE = "StatusCode";
/**
- * Application specific response code
+ * Application specific response code.
*/
String RESPONSE_CODE = "ResponseCode";
/**
- * Human readable description of the application specific response code
+ * Human readable description of the application specific response code.
*/
String RESPONSE_DESCRIPTION = "ResponseDescription";
/**
- * Externally advertised API invoked by clients of this component
+ * Externally advertised API invoked by clients of this component.
*/
String ELAPSED_TIME = "ElapsedTime";
/**
- * High level failure (ERROR)
+ * High level failure (ERROR).
*/
String ERROR_CATEGORY = "ErrorCategory";
- /**
- * Error Code
- */
String ERROR_CODE = "ErrorCode";
- /**
- * Error Description
- */
String ERROR_DESCRIPTION = "ErrorDescription";
- /**
- * Class name
- */
String CLASS_NAME = "ClassName";
- /**
- * Server name
- */
String SERVER_NAME = "ServerName";
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/DroolsPDPMDCInfo.java b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/DroolsPDPMDCInfo.java
index ae4cc929..0c6c13ba 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/DroolsPDPMDCInfo.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/DroolsPDPMDCInfo.java
@@ -41,7 +41,9 @@ public class DroolsPDPMDCInfo implements MDCInfo {
}
/**
- * @return the instance of ConcurrentHashMap
+ * Get the MMDC Info
+ *
+ * @return the instance of ConcurrentHashMap.
*/
@Override
public ConcurrentMap<String, String> getMDCInfo() {
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java
index 845c5caf..4ae4068c 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java
@@ -23,85 +23,98 @@ package org.onap.policy.common.logging.eelf;
import java.util.EnumMap;
/**
- *
- * ErrorCodeMap contains a HashMap of ErrorCodeInfo (error code and error description)
- *
+ * ErrorCodeMap contains a HashMap of ErrorCodeInfo (error code and error description).
*/
public class ErrorCodeMap {
private static final EnumMap<MessageCodes, ErrorCodeInfo> hm = new EnumMap<>(MessageCodes.class);
-
+
private static final String ERROR_PERMISSIONS = "POLICY-100E";
- private static final String ERROR_PERMISSIONS_DESCRIPTION = "This is a Permissions Error. Please check the error message for detail information";
-
- private static final String ERROR_SCHEMA_INVALID = "POLICY-400E";
- private static final String ERROR_SCHEMA_INVALID_DESCRIPTION = "This is an Invalid Schema Error. Please check the error message for detail information";
-
+ private static final String ERROR_PERMISSIONS_DESCRIPTION =
+ "This is a Permissions Error. Please check the error message for detail information";
+
+ private static final String ERROR_SCHEMA_INVALID = "POLICY-400E";
+ private static final String ERROR_SCHEMA_INVALID_DESCRIPTION =
+ "This is an Invalid Schema Error. Please check the error message for detail information";
+
private static final String UPDATE_ERROR = "POLICY-502E";
- private static final String UPDATE_ERROR_DESCRIPTION = "This is an updating error. Please check the error message for detail information";
-
- private static final String EXCEPTION_ERROR_CODE = "POLICY-503E";
- private static final String EXCEPTION_ERROR_DESCRIPTION = "This is an exception error message during the process. Please check the error message for detail information";
-
- private static final String MISS_PROPERTY_ERROR = "POLICY-504E";
- private static final String MISS_PROPERTY_ERROR_DESCRIPTION = "This is an error of missing properties. Please check the error message for detail information";
-
+ private static final String UPDATE_ERROR_DESCRIPTION =
+ "This is an updating error. Please check the error message for detail information";
+
+ private static final String EXCEPTION_ERROR_CODE = "POLICY-503E";
+ private static final String EXCEPTION_ERROR_DESCRIPTION =
+ "This is an exception error message during the process. Please check the error message for detail "
+ + "information";
+
+ private static final String MISS_PROPERTY_ERROR = "POLICY-504E";
+ private static final String MISS_PROPERTY_ERROR_DESCRIPTION =
+ "This is an error of missing properties. Please check the error message for detail information";
+
private static final String GENERAL_ERROR_CODE = "POLICY-515E";
- private static final String GENERAL_ERROR_DESCRIPTION = "This is a general error message during the process. Please check the error message for detail information";
-
+ private static final String GENERAL_ERROR_DESCRIPTION =
+ "This is a general error message during the process. Please check the error message for detail information";
+
private static final String ERROR_SYSTEM_ERROR = "POLICY-516E";
- private static final String ERROR_SYSTEM_ERROR_DESCRIPTION = "This is a System Error. Please check the error message for detail information";
-
- private static final String ERROR_DATA_ISSUE = "POLICY-517E";
- private static final String ERROR_DATA_ISSUE_DESCRIPTION = "This is a Data Issue Error. Please check the error message for detail information";
-
- private static final String ERROR_PROCESS_FLOW = "POLICY-518E";
- private static final String ERROR_PROCESS_FLOW_DESCRIPTION = "This is a Process Flow Error. Please check the error message for detail information";
-
- private static final String ERROR_UNKNOWN = "POLICY-519E";
- private static final String ERROR_UNKNOWN_DESCRIPTION = "This is an Unknown Error. Please check the error message for detail information";
-
- private static final String ERROR_AUDIT = "POLICY-520E";
- private static final String ERROR_AUDIT_DESCRIPTION = "This is an audit Error. Please check the error message for detail information";
-
+ private static final String ERROR_SYSTEM_ERROR_DESCRIPTION =
+ "This is a System Error. Please check the error message for detail information";
+
+ private static final String ERROR_DATA_ISSUE = "POLICY-517E";
+ private static final String ERROR_DATA_ISSUE_DESCRIPTION =
+ "This is a Data Issue Error. Please check the error message for detail information";
+
+ private static final String ERROR_PROCESS_FLOW = "POLICY-518E";
+ private static final String ERROR_PROCESS_FLOW_DESCRIPTION =
+ "This is a Process Flow Error. Please check the error message for detail information";
+
+ private static final String ERROR_UNKNOWN = "POLICY-519E";
+ private static final String ERROR_UNKNOWN_DESCRIPTION =
+ "This is an Unknown Error. Please check the error message for detail information";
+
+ private static final String ERROR_AUDIT = "POLICY-520E";
+ private static final String ERROR_AUDIT_DESCRIPTION =
+ "This is an audit Error. Please check the error message for detail information";
+
static {
- hm.put(MessageCodes.EXCEPTION_ERROR, new ErrorCodeInfo(EXCEPTION_ERROR_CODE, EXCEPTION_ERROR_DESCRIPTION));
- hm.put(MessageCodes.GENERAL_ERROR, new ErrorCodeInfo(GENERAL_ERROR_CODE, GENERAL_ERROR_DESCRIPTION));
- hm.put(MessageCodes.MISS_PROPERTY_ERROR, new ErrorCodeInfo(MISS_PROPERTY_ERROR, MISS_PROPERTY_ERROR_DESCRIPTION));
- hm.put(MessageCodes.UPDATE_ERROR, new ErrorCodeInfo(UPDATE_ERROR, UPDATE_ERROR_DESCRIPTION));
- hm.put(MessageCodes.ERROR_SYSTEM_ERROR, new ErrorCodeInfo(ERROR_SYSTEM_ERROR, ERROR_SYSTEM_ERROR_DESCRIPTION));
- hm.put(MessageCodes.ERROR_DATA_ISSUE, new ErrorCodeInfo(ERROR_DATA_ISSUE, ERROR_DATA_ISSUE_DESCRIPTION));
- hm.put(MessageCodes.ERROR_PERMISSIONS, new ErrorCodeInfo(ERROR_PERMISSIONS, ERROR_PERMISSIONS_DESCRIPTION));
- hm.put(MessageCodes.ERROR_DATA_ISSUE, new ErrorCodeInfo(ERROR_DATA_ISSUE, ERROR_DATA_ISSUE_DESCRIPTION));
- hm.put(MessageCodes.ERROR_PROCESS_FLOW, new ErrorCodeInfo(ERROR_PROCESS_FLOW, ERROR_PROCESS_FLOW_DESCRIPTION));
- hm.put(MessageCodes.ERROR_SCHEMA_INVALID, new ErrorCodeInfo(ERROR_SCHEMA_INVALID, ERROR_SCHEMA_INVALID_DESCRIPTION));
- hm.put(MessageCodes.ERROR_UNKNOWN, new ErrorCodeInfo(ERROR_UNKNOWN, ERROR_UNKNOWN_DESCRIPTION));
- hm.put(MessageCodes.ERROR_AUDIT, new ErrorCodeInfo(ERROR_AUDIT, ERROR_AUDIT_DESCRIPTION));
+ hm.put(MessageCodes.EXCEPTION_ERROR, new ErrorCodeInfo(EXCEPTION_ERROR_CODE, EXCEPTION_ERROR_DESCRIPTION));
+ hm.put(MessageCodes.GENERAL_ERROR, new ErrorCodeInfo(GENERAL_ERROR_CODE, GENERAL_ERROR_DESCRIPTION));
+ hm.put(MessageCodes.MISS_PROPERTY_ERROR,
+ new ErrorCodeInfo(MISS_PROPERTY_ERROR, MISS_PROPERTY_ERROR_DESCRIPTION));
+ hm.put(MessageCodes.UPDATE_ERROR, new ErrorCodeInfo(UPDATE_ERROR, UPDATE_ERROR_DESCRIPTION));
+ hm.put(MessageCodes.ERROR_SYSTEM_ERROR, new ErrorCodeInfo(ERROR_SYSTEM_ERROR, ERROR_SYSTEM_ERROR_DESCRIPTION));
+ hm.put(MessageCodes.ERROR_DATA_ISSUE, new ErrorCodeInfo(ERROR_DATA_ISSUE, ERROR_DATA_ISSUE_DESCRIPTION));
+ hm.put(MessageCodes.ERROR_PERMISSIONS, new ErrorCodeInfo(ERROR_PERMISSIONS, ERROR_PERMISSIONS_DESCRIPTION));
+ hm.put(MessageCodes.ERROR_DATA_ISSUE, new ErrorCodeInfo(ERROR_DATA_ISSUE, ERROR_DATA_ISSUE_DESCRIPTION));
+ hm.put(MessageCodes.ERROR_PROCESS_FLOW, new ErrorCodeInfo(ERROR_PROCESS_FLOW, ERROR_PROCESS_FLOW_DESCRIPTION));
+ hm.put(MessageCodes.ERROR_SCHEMA_INVALID,
+ new ErrorCodeInfo(ERROR_SCHEMA_INVALID, ERROR_SCHEMA_INVALID_DESCRIPTION));
+ hm.put(MessageCodes.ERROR_UNKNOWN, new ErrorCodeInfo(ERROR_UNKNOWN, ERROR_UNKNOWN_DESCRIPTION));
+ hm.put(MessageCodes.ERROR_AUDIT, new ErrorCodeInfo(ERROR_AUDIT, ERROR_AUDIT_DESCRIPTION));
}
+
private ErrorCodeMap() {}
-
+
public static ErrorCodeInfo getErrorCodeInfo(MessageCodes messageCode) {
return hm.get(messageCode);
}
-
+
static class ErrorCodeInfo {
-
- private String errorCode;
- private String errorDesc;
-
- public ErrorCodeInfo(String errorCode, String errorDesc){
- this.errorCode = errorCode;
- this.errorDesc = errorDesc;
- }
-
- public String getErrorCode() {
- return errorCode;
- }
-
- public String getErrorDesc() {
- return errorDesc;
- }
-
- }
-
+
+ private String errorCode;
+ private String errorDesc;
+
+ public ErrorCodeInfo(String errorCode, String errorDesc) {
+ this.errorCode = errorCode;
+ this.errorDesc = errorDesc;
+ }
+
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ public String getErrorDesc() {
+ return errorDesc;
+ }
+
+ }
+
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventData.java b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventData.java
index 037a144d..a8d90ad7 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventData.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventData.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,35 +23,40 @@ package org.onap.policy.common.logging.eelf;
import java.time.Instant;
/**
- *
* EventData can be used for logging a rule event.
- *
*/
public class EventData {
- private String requestID = null;
+ private String requestId = null;
private Instant startTime = null;
private Instant endTime = null;
- //Default constructor takes no arguments.
- //Is empty because instance variables are assigned
- //their default values upon declaration.
- public EventData() {
- //See above comments for the reason this constructor is empty
+ // Default constructor takes no arguments.
+ // Is empty because instance variables are assigned
+ // their default values upon declaration.
+ public EventData() {
+ // See above comments for the reason this constructor is empty
}
- public EventData(String requestID, Instant startTime, Instant endTime) {
- this.requestID = requestID;
+ /**
+ * Create an instance.
+ *
+ * @param requestId the request ID
+ * @param startTime the start time
+ * @param endTime the end time
+ */
+ public EventData(String requestId, Instant startTime, Instant endTime) {
+ this.requestId = requestId;
this.startTime = startTime;
this.endTime = endTime;
}
public String getRequestID() {
- return requestID;
+ return requestId;
}
- public void setRequestID(String requestID) {
- this.requestID = requestID;
+ public void setRequestID(String requestId) {
+ this.requestId = requestId;
}
public Instant getStartTime() {
@@ -72,14 +77,14 @@ public class EventData {
@Override
public String toString() {
- return requestID + " Starting Time : " + this.startTime + " Ending Time : " + this.endTime;
+ return requestId + " Starting Time : " + this.startTime + " Ending Time : " + this.endTime;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((requestID == null) ? 0 : requestID.hashCode());
+ result = prime * result + ((requestId == null) ? 0 : requestId.hashCode());
return result;
}
@@ -92,18 +97,18 @@ public class EventData {
return false;
}
if (obj instanceof String) {
- String requestId = (String) obj;
- return requestID != null && requestID.equals(requestId);
+ String otherRequestId = (String) obj;
+ return requestId != null && requestId.equals(otherRequestId);
}
if (getClass() != obj.getClass()) {
return false;
}
EventData other = (EventData) obj;
- if (requestID == null) {
- if (other.requestID != null) {
+ if (requestId == null) {
+ if (other.requestId != null) {
return false;
}
- } else if (!requestID.equals(other.requestID)) {
+ } else if (!requestId.equals(other.requestId)) {
return false;
}
return true;
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfo.java b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfo.java
index 077a5a70..46401e9e 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfo.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfo.java
@@ -30,17 +30,22 @@ public class EventTrackInfo {
private final ConcurrentMap<String, EventData> eventInfo;
+ /**
+ * Construct an instance.
+ */
public EventTrackInfo() {
/*
- * An initial capacity of 16 ensures the number of elements before resizing happens
- * Load factor of 0,9 ensures a dense packaging inside ConcurrentHashMap which will optimize memory use
- * Concurrency Level set to 1 will ensure that only one shard is created and maintained
+ * An initial capacity of 16 ensures the number of elements before resizing happens Load
+ * factor of 0,9 ensures a dense packaging inside ConcurrentHashMap which will optimize
+ * memory use Concurrency Level set to 1 will ensure that only one shard is created and
+ * maintained
*/
eventInfo = new ConcurrentHashMap<>(16, 0.9f, 1);
}
/**
- * Returns an instance of EventData associated to this requestID
+ * Returns an instance of EventData associated to this requestID.
+ *
* @param requestID request id
* @return EventData
*/
@@ -50,6 +55,7 @@ public class EventTrackInfo {
/**
* Stores an EventData object in a ConcurrentHashMap using its requestID as key.
+ *
* @param event event data
*/
public void storeEventData(EventData event) {
@@ -59,7 +65,7 @@ public class EventTrackInfo {
if (id == null || id.isEmpty()) {
return;
}
- //in case override the start time, check the original event was already stored or not
+ // in case override the start time, check the original event was already stored or not
if (!eventInfo.containsKey(id)) {
eventInfo.put(id, event);
}
@@ -68,6 +74,7 @@ public class EventTrackInfo {
/**
* Removes an EventData object from a ConcurrentHashMap using the eventId as key.
+ *
* @param eventId event id
*/
public void remove(String eventId) {
@@ -77,7 +84,7 @@ public class EventTrackInfo {
}
/**
- * Returns a ConcurrentHashMap of EventData
+ * Returns a ConcurrentHashMap of EventData.
*/
public ConcurrentMap<String, EventData> getEventInfo() {
return eventInfo;
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandler.java b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandler.java
index a79ab521..5f97c365 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandler.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandler.java
@@ -28,9 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
- *
- * EventTrackInfoHandler is the handler of clean up all expired event objects
- *
+ * EventTrackInfoHandler is the handler of clean up all expired event objects.
*/
public class EventTrackInfoHandler extends TimerTask {
@@ -47,7 +45,7 @@ public class EventTrackInfoHandler extends TimerTask {
}
/**
- * Removes all expired event objects from the ConcurrentHashMap of EventData
+ * Removes all expired event objects from the ConcurrentHashMap of EventData.
*/
private void cleanUp() {
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/MDCInfo.java b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/MDCInfo.java
index f49b34a7..f7832271 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/MDCInfo.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/MDCInfo.java
@@ -23,15 +23,14 @@ package org.onap.policy.common.logging.eelf;
import java.util.concurrent.ConcurrentMap;
/**
- *
- * Interface needs to be implemented by DroolsPDPMDCInfo
- *
+ * Interface needs to be implemented by DroolsPDPMDCInfo.
*/
@FunctionalInterface
public interface MDCInfo {
/**
* Returns MDC info.
+ *
* @return MDC info
*/
ConcurrentMap<String, String> getMDCInfo();
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/MessageCodes.java b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/MessageCodes.java
index 3bfce0b5..ab5712ff 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/MessageCodes.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/MessageCodes.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,140 +24,142 @@ import com.att.eelf.i18n.EELFResolvableErrorEnum;
import com.att.eelf.i18n.EELFResourceManager;
/**
- *
- * MessageCodes contains all the messagge codes for EELF logging messages
- *
+ * MessageCodes contains all the messagge codes for EELF logging messages.
*/
public enum MessageCodes implements EELFResolvableErrorEnum {
- // Below is a list of Error Messages taken from com.att.research.xacml.api XACMLErrorConstants
- // found under: policy-engine\XACML\src\main\java\com\att\research\xacml\api\XACMLErrorConstants.java
-
- ERROR_PERMISSIONS,
-
- ERROR_SYSTEM_ERROR,
-
- ERROR_DATA_ISSUE,
-
- ERROR_SCHEMA_INVALID,
-
- ERROR_PROCESS_FLOW,
-
- ERROR_UNKNOWN,
-
- ERROR_AUDIT,
-
- // Above is a list of Error Messages taken from com.att.research.xacml.api XACMLErrorConstants
- // found under: policy-engine\XACML\src\main\java\com\att\research\xacml\api\XACMLErrorConstants.java
-
- //----------------------5000-5099 Business/Flow Processing Related --------------------/
-
- BAD_TYPE_WARNING,
-
- GENERAL_INFO,
-
- GENERAL_WARNING,
-
- MISS_PROPERTY_ERROR,
-
- EXCEPTION_ERROR,
-
- MISS_PROPERTY_INFO,
-
- RULE_AUDIT_EXEC_INFO,
-
- RULE_AUDIT_BEGIN_INFO,
-
- RULE_AUDIT_END_INFO,
-
- RULE_AUDIT_START_END_INFO,
-
- RULE_METRICS_INFO,
-
- UEB_AUDIT_EXEC_INFO,
-
- UEB_AUDIT_BEGIN_INFO,
-
- UEB_AUDIT_END_INFO,
-
- UPDATE_ERROR,
-
- GENERAL_ERROR,
-
- //----------------------New enums should be added above this line ------------------------------------------------------------------/
-
- //--------------------- The enums below are old code. They should not be used since 1607 release and eventually will be removed -----/
- /**
- * Application message which requires no arguments
+ // Below is a list of Error Messages taken from com.att.research.xacml.api XACMLErrorConstants
+ // found under:
+ // policy-engine\XACML\src\main\java\com\att\research\xacml\api\XACMLErrorConstants.java
+
+ ERROR_PERMISSIONS,
+
+ ERROR_SYSTEM_ERROR,
+
+ ERROR_DATA_ISSUE,
+
+ ERROR_SCHEMA_INVALID,
+
+ ERROR_PROCESS_FLOW,
+
+ ERROR_UNKNOWN,
+
+ ERROR_AUDIT,
+
+ // Above is a list of Error Messages taken from com.att.research.xacml.api XACMLErrorConstants
+ // found under:
+ // policy-engine\XACML\src\main\java\com\att\research\xacml\api\XACMLErrorConstants.java
+
+ // ----------------------5000-5099 Business/Flow Processing Related --------------------/
+
+ BAD_TYPE_WARNING,
+
+ GENERAL_INFO,
+
+ GENERAL_WARNING,
+
+ MISS_PROPERTY_ERROR,
+
+ EXCEPTION_ERROR,
+
+ MISS_PROPERTY_INFO,
+
+ RULE_AUDIT_EXEC_INFO,
+
+ RULE_AUDIT_BEGIN_INFO,
+
+ RULE_AUDIT_END_INFO,
+
+ RULE_AUDIT_START_END_INFO,
+
+ RULE_METRICS_INFO,
+
+ UEB_AUDIT_EXEC_INFO,
+
+ UEB_AUDIT_BEGIN_INFO,
+
+ UEB_AUDIT_END_INFO,
+
+ UPDATE_ERROR,
+
+ GENERAL_ERROR,
+
+ // ----------------------New enums should be added above this line
+ // ------------------------------------------------------------------/
+
+ // --------------------- The enums below are old code. They should not be used since 1607
+ // release and eventually will be removed -----/
+ /**
+ * Application message which requires no arguments.
*/
- MESSAGE_SAMPLE_NOARGS,
-
- /**
- * Application message which requires one argument {0}
+ MESSAGE_SAMPLE_NOARGS,
+
+ /**
+ * Application message which requires one argument {0}.
*/
- MESSAGE_SAMPLE_ONEARGUMENT,
-
- /**
- * Audit message which requires one argument {0}
- */
- AUDIT_MESSAGE_ONEARGUMENT,
-
- /**
- * Error message which requires one argument {0}
+ MESSAGE_SAMPLE_ONEARGUMENT,
+
+ /**
+ * Audit message which requires one argument {0}.
*/
- ERROR_MESSAGE_ONEARGUMENT,
-
- /**
- * Metrics message which requires one argument {0}
+ AUDIT_MESSAGE_ONEARGUMENT,
+
+ /**
+ * Error message which requires one argument {0}.
*/
- METRICS_MESSAGE_ONEARGUMENT,
-
- /**
- * Debug message which requires one argument {0}
+ ERROR_MESSAGE_ONEARGUMENT,
+
+ /**
+ * Metrics message which requires one argument {0}.
*/
- DEBUG_MESSAGE_ONEARGUMENT,
-
+ METRICS_MESSAGE_ONEARGUMENT,
+
/**
- * Application message which requires two argument {0} and another argument {1}
+ * Debug message which requires one argument {0}.
*/
- MESSAGE_SAMPLE_TWOARGUMENTS,
-
- /**
- * Sample error exception
+ DEBUG_MESSAGE_ONEARGUMENT,
+
+ /**
+ * Application message which requires two argument {0} and another argument {1}.
+ */
+ MESSAGE_SAMPLE_TWOARGUMENTS,
+
+ /**
+ * Sample error exception.
*/
MESSAGE_SAMPLE_EXCEPTION,
-
- /**
- * Sample warning message
+
+ /**
+ * Sample warning message.
*/
- MESSAGE_WARNING_SAMPLE,
-
- /**
- * Sample exception in method {0}
+ MESSAGE_WARNING_SAMPLE,
+
+ /**
+ * Sample exception in method {0}.
*/
- MESSAGE_SAMPLE_EXCEPTION_ONEARGUMENT,
-
- /**
- * Sample trace message
+ MESSAGE_SAMPLE_EXCEPTION_ONEARGUMENT,
+
+ /**
+ * Sample trace message.
*/
- MESSAGE_TRACE_SAMPLE,
-
- /**
- * Sample error message
+ MESSAGE_TRACE_SAMPLE,
+
+ /**
+ * Sample error message.
*/
- MESSAGE_ERROR_SAMPLE;
-
-
+ MESSAGE_ERROR_SAMPLE;
+
+
/**
- * Static initializer to ensure the resource bundles for this class are loaded...
- * Here this application loads messages from three bundles
+ * Static initializer to ensure the resource bundles for this class are loaded... Here this
+ * application loads messages from three bundles.
*/
static {
EELFResourceManager.loadMessageBundle("org/onap/policy/common/logging/eelf/Resources");
String id = EELFResourceManager.getIdentifier(RULE_AUDIT_EXEC_INFO);
String value = EELFResourceManager.getMessage(RULE_AUDIT_EXEC_INFO);
-
+
PolicyLogger.info("*********************** Rule audit id: " + id);
PolicyLogger.info("*********************** Rule audit value: " + value);
-
+
}
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java
index 3d351722..e3a7ab3f 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java
@@ -20,9 +20,28 @@
package org.onap.policy.common.logging.eelf;
-import static org.onap.policy.common.logging.eelf.Configuration.*;
+import static com.att.eelf.configuration.Configuration.MDC_ALERT_SEVERITY;
+import static com.att.eelf.configuration.Configuration.MDC_INSTANCE_UUID;
+import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
+import static com.att.eelf.configuration.Configuration.MDC_REMOTE_HOST;
+import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN;
+import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS;
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_INSTANCE_ID;
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
+import static org.onap.policy.common.logging.eelf.Configuration.BEGIN_TIME_STAMP;
+import static org.onap.policy.common.logging.eelf.Configuration.ELAPSED_TIME;
+import static org.onap.policy.common.logging.eelf.Configuration.END_TIME_STAMP;
+import static org.onap.policy.common.logging.eelf.Configuration.ERROR_CATEGORY;
+import static org.onap.policy.common.logging.eelf.Configuration.ERROR_CODE;
+import static org.onap.policy.common.logging.eelf.Configuration.ERROR_DESCRIPTION;
+import static org.onap.policy.common.logging.eelf.Configuration.PARTNER_NAME;
+import static org.onap.policy.common.logging.eelf.Configuration.RESPONSE_CODE;
+import static org.onap.policy.common.logging.eelf.Configuration.RESPONSE_DESCRIPTION;
+import static org.onap.policy.common.logging.eelf.Configuration.SERVER_NAME;
+import static org.onap.policy.common.logging.eelf.Configuration.STATUS_CODE;
+import static org.onap.policy.common.logging.eelf.Configuration.TARGET_ENTITY;
+import static org.onap.policy.common.logging.eelf.Configuration.TARGET_SERVICE_NAME;
-import org.onap.policy.common.logging.flexlogger.LoggerType;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFLogger.Level;
import com.att.eelf.configuration.EELFManager;
@@ -42,1391 +61,1445 @@ import java.util.TimerTask;
import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
+import org.onap.policy.common.logging.flexlogger.LoggerType;
import org.slf4j.MDC;
/**
- *
- * PolicyLogger contains all the static methods for EELF logging
- *
+ * PolicyLogger contains all the static methods for EELF logging.
*/
public class PolicyLogger {
- private static EELFLogger errorLogger = EELFManager.getInstance()
- .getErrorLogger();
-
- private static EELFLogger metricsLogger = EELFManager.getInstance()
- .getMetricsLogger();
-
- private static EELFLogger auditLogger = EELFManager.getInstance()
- .getAuditLogger();
-
- private static EELFLogger debugLogger = EELFManager.getInstance()
- .getDebugLogger();
-
- private static final String POLICY_LOGGER = "PolicyLogger";
-
- private static EventTrackInfo eventTracker = new EventTrackInfo();
-
- private static String hostName = null;
- private static String hostAddress = null;
- private static String component = null;
-
- private static TimerTask ttrcker = null;
- private static boolean isEventTrackerRunning = false;
- private static Timer timer = null;
-
- //Default:Timer initial delay and the delay between in milliseconds before task is to be execute
- private static int timerDelayTime = 1000;
-
- //Default:Timer scheduleAtFixedRate period - time in milliseconds between successive task executions
- private static int checkInterval = 30 * 1000;
-
- //Default:longest time an event info can be stored in the concurrentHashMap for logging - in seconds
- static int expiredTime = 60*60*1000*24; //one day
-
- //Default:the size of the concurrentHashMap which stores the event starting time - when its size reaches this limit, the Timer get executed
- private static int concurrentHashMapLimit = 5000;
-
- //Default:the size of the concurrentHashMap which stores the event starting time - when its size drops to this point, stop the Timer
- private static int stopCheckPoint = 2500;
-
- private static boolean isOverrideLogbackLevel = false;
-
- private static Level debugLevel = Level.INFO;
- private static Level auditLevel = Level.INFO;
- private static Level metricsLevel = Level.INFO;
- private static Level errorLevel = Level.ERROR;
- private static String classNameProp = "ClassName";
-
- private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS+00:00";
- private static final String COMPLETE_STATUS = "COMPLETE";
- private static final String ERROR_CATEGORY_VALUE = "ERROR";
-
- static{
- if (hostName == null || hostAddress == null) {
- try {
- hostName = InetAddress.getLocalHost().getHostName();
- hostAddress = InetAddress.getLocalHost().getHostAddress();
- } catch (UnknownHostException e) {
- PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, POLICY_LOGGER, "UnknownHostException");
- }
- }
- }
-
- public static Level getDebugLevel() {
- return debugLevel;
- }
-
- public static synchronized void setDebugLevel(Level level) {
- debugLevel = level;
- }
-
- public static Level getAuditLevel() {
- return auditLevel;
- }
-
- public static synchronized void setAuditLevel(Level level) {
- auditLevel = level;
- }
-
- public static Level getMetricsLevel() {
- return metricsLevel;
- }
-
- public static synchronized void setMetricsLevel(Level level) {
- metricsLevel = level;
- }
-
- public static Level getErrorLevel() {
- return errorLevel;
- }
-
- public static synchronized void setErrorLevel(Level level) {
- errorLevel = level;
- }
-
- public static String getClassname() {
- return classNameProp;
- }
-
- public static synchronized void setClassname(String name) {
- classNameProp = name;
- }
-
- /**
- * Populates MDC info
- * @param transId
- * @return String
- */
- public static String postMDCInfoForEvent(String transId) {
- MDC.clear();
-
- String transactionId = transId;
-
- if(transactionId == null || transactionId.isEmpty()){
- transactionId = UUID.randomUUID().toString();
- }
-
- if("DROOLS".equalsIgnoreCase(component)){
- MDC.put(TARGET_ENTITY, "POLICY");
- MDC.put(TARGET_SERVICE_NAME, "drools evaluate rule");
- return postMDCInfoForEvent(transactionId, new DroolsPDPMDCInfo());
- } else {
- // For Xacml
- MDC.put(TARGET_ENTITY, "POLICY");
- MDC.put(TARGET_SERVICE_NAME, "PE Process");
- }
-
- MDC.put(MDC_REMOTE_HOST, "");
- MDC.put(MDC_KEY_REQUEST_ID, transactionId);
- MDC.put(MDC_SERVICE_NAME, "Policy.xacmlPdp");
- MDC.put(MDC_SERVICE_INSTANCE_ID, "Policy.xacmlPdp.event");
- try {
- MDC.put(MDC_SERVER_FQDN, hostName);
- MDC.put(MDC_SERVER_IP_ADDRESS, hostAddress);
- } catch (Exception e) {
- errorLogger.error(MessageCodes.EXCEPTION_ERROR, e, POLICY_LOGGER);
- }
- Instant startTime = Instant.now();
- Instant endTime = Instant.now();
- long ns = Duration.between(startTime, endTime).toMillis(); // use millisecond as default and remove unit from log
-
- MDC.put(MDC_INSTANCE_UUID, "");
- MDC.put(MDC_ALERT_SEVERITY, "");
-
- SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
-
- String formatedTime = sdf.format(Date.from(startTime));
- MDC.put(BEGIN_TIME_STAMP, formatedTime );
-
- //set default values for these required fields below, they can be overridden
- formatedTime = sdf.format(Date.from(endTime));
- MDC.put(END_TIME_STAMP, formatedTime);
- MDC.put(ELAPSED_TIME, Long.toString(ns));
-
- MDC.put(PARTNER_NAME, "N/A");
-
- MDC.put(STATUS_CODE, COMPLETE_STATUS);
- MDC.put(RESPONSE_CODE, "N/A");
- MDC.put(RESPONSE_DESCRIPTION, "N/A");
-
-
- return transactionId;
-
- }
-
- /**
- * Populate MDC Info using the passed in mdcInfo
- * @param transId
- * @param mdcInfo
- * @return String
- */
- private static String postMDCInfoForEvent(String transId, MDCInfo mdcInfo ) {
-
- MDC.put(MDC_KEY_REQUEST_ID, transId);
- if(mdcInfo != null && mdcInfo.getMDCInfo() != null && !mdcInfo.getMDCInfo().isEmpty()){
-
- ConcurrentMap<String, String> mdcMap = mdcInfo.getMDCInfo();
- Iterator<String> keyIterator = mdcMap.keySet().iterator();
- String key;
-
- while(keyIterator.hasNext()){
- key = keyIterator.next();
- MDC.put(key, mdcMap.get(key));
- }
- }
-
- try {
- MDC.put(MDC_SERVER_FQDN, hostName);
- MDC.put(MDC_SERVER_IP_ADDRESS, hostAddress);
- } catch (Exception e) {
- errorLogger.error(MessageCodes.EXCEPTION_ERROR, e, POLICY_LOGGER);
- }
- Instant startTime = Instant.now();
- Instant endTime = Instant.now();
- long ns = Duration.between(startTime, endTime).toMillis(); // use millisecond as default and remove unit from log
-
- SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
-
- String formatedTime = sdf.format(Date.from(startTime));
- MDC.put(BEGIN_TIME_STAMP, formatedTime );
-
- //set default values for these required fields below, they can be overridden
- formatedTime = sdf.format(Date.from(endTime));
- MDC.put(END_TIME_STAMP, formatedTime);
- MDC.put(ELAPSED_TIME, Long.toString(ns));
-
- return transId;
- }
-
- /**
- * Set Timestamps for start, end and duration of logging a transaction
- */
- private static void seTimeStamps(){
-
- Instant startTime = Instant.now();
- Instant endTime = Instant.now();
- long ns = Duration.between(startTime, endTime).toMillis();
-
- MDC.put(MDC_INSTANCE_UUID, "");
- MDC.put(MDC_ALERT_SEVERITY, "");
-
- SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
-
- String formatedTime = sdf.format(Date.from(startTime));
- MDC.put(BEGIN_TIME_STAMP, formatedTime );
-
- //set default values for these required fields below, they can be overridden
- formatedTime = sdf.format(Date.from(endTime));
- MDC.put(END_TIME_STAMP, formatedTime);
- MDC.put(ELAPSED_TIME, Long.toString(ns));
-
- MDC.put(PARTNER_NAME, "N/A");
-
- MDC.put(STATUS_CODE, COMPLETE_STATUS);
- MDC.put(RESPONSE_CODE, "N/A");
- MDC.put(RESPONSE_DESCRIPTION, "N/A");
-
- }
-
- /**
- * Sets transaction Id to MDC
- * @param transId
- */
- public static void setTransId(String transId){
-
- MDC.put(MDC_KEY_REQUEST_ID, transId);
- }
-
- /**
- * Returns current transaction Id used in MDC
- * @return transId
- */
- public static String getTransId(){
-
- return MDC.get(MDC_KEY_REQUEST_ID);
- }
-
- /**
- * Sets transaction Id to MDC
- * @param o
- */
- public static void postMDCInfoForEvent(Object o){
- postMDCInfoForEvent(""+o);
- }
-
- /**
- * Resets transaction Id in MDC for the rule triggered by this event
- * @param transactionId
- * @return String
- */
- public static String postMDCInfoForTriggeredRule(String transId) {
-
- String transactionId = transId;
-
- MDC.clear();
-
- if(transactionId == null || transactionId.isEmpty()){
- transactionId = UUID.randomUUID().toString();
- }
- MDC.put(MDC_REMOTE_HOST, "");
- MDC.put(MDC_KEY_REQUEST_ID, transactionId);
- MDC.put(MDC_SERVICE_NAME, "Policy.droolsPdp");
- MDC.put(MDC_SERVICE_INSTANCE_ID, "");
- try {
- MDC.put(MDC_SERVER_FQDN, hostName);
- MDC.put(MDC_SERVER_IP_ADDRESS, hostAddress);
- } catch (Exception e) {
- errorLogger.error(MessageCodes.EXCEPTION_ERROR, e, POLICY_LOGGER);
- }
- MDC.put(MDC_INSTANCE_UUID, "");
- MDC.put(MDC_ALERT_SEVERITY, "");
- MDC.put(STATUS_CODE, COMPLETE_STATUS);
-
- return transactionId;
-
- }
-
- /**
- * Resets transaction Id in MDC for the rule triggered by this event
- * @param o
- */
- public static void postMDCUUIDForTriggeredRule(Object o) {
-
- postMDCInfoForTriggeredRule("" + o);
-
- }
-
- // ************************************************************************************************
- /**
- * Records the Info event with String [] arguments
- * @param msg
- * @param className
- * @param arguments
- */
- public static void info(MessageCodes msg, String className, String... arguments) {
- MDC.put(classNameProp, className);
- debugLogger.info(msg, arguments);
- }
-
- /**
- * Records only one String message with its class name
- * @param className
- * @param arg0
- */
- public static void info( String className, String arg0) {
- MDC.put(classNameProp, className);
- debugLogger.info(MessageCodes.GENERAL_INFO, arg0);
- }
-
-
- /**
- * Records only one String message
- * @param arg0
- */
- public static void info(Object arg0) {
- MDC.put(classNameProp, "");
- debugLogger.info(MessageCodes.GENERAL_INFO, String.valueOf(arg0));
- }
-
- /**
- * Records a message with passed in message code, Throwable object, a list of string values
- * @param msg
- * @param arg0
- * @param arguments
- */
- public static void info(MessageCodes msg, Throwable arg0,
- String... arguments) {
- MDC.put(classNameProp, "");
- String arguments2 = getNormalizedStackTrace(arg0, arguments);
- debugLogger.info(msg, arguments2);
- }
-
- /**
- * Records a message with passed in message code, class name, Throwable object, a list of string values
- * @param msg
- * @param className
- * @param arg0
- * @param arguments
- */
- public static void info(MessageCodes msg, String className, Throwable arg0,
- String... arguments) {
- MDC.put(classNameProp, className);
- String arguments2 = getNormalizedStackTrace(arg0, arguments);
- debugLogger.info(msg, arguments2);
- }
-
- /**
- * Records only one String message with its class name
- * @param arg0 log message
- * @param className class name
- */
- public static void warn( String className, String arg0) {
- MDC.put(classNameProp, className);
- debugLogger.warn(MessageCodes.GENERAL_INFO, arg0);
- }
-
- /**
- * Records only one String message
- * @param arg0
- */
- public static void warn(Object arg0) {
- MDC.put(classNameProp, "");
- debugLogger.warn(MessageCodes.GENERAL_WARNING, "" + arg0);
- }
-
- /**
- * Records only one String message without its class name passed in
- * @param arg0
- */
- public static void warn(String arg0) {
- MDC.put(classNameProp, "");
- debugLogger.warn(MessageCodes.GENERAL_WARNING, arg0);
- }
-
- /**
- * Records a message with passed in message code, class name and a list of string values
- * @param msg
- * @param className
- * @param arguments
- */
- public static void warn(MessageCodes msg, String className, String... arguments) {
- MDC.put(classNameProp, className);
- debugLogger.warn(msg, arguments);
- }
-
- /**
- * Records a message with passed in message code, Throwable object, a list of string values
- * @param msg
- * @param arg0
- * @param arguments
- */
- public static void warn(MessageCodes msg, Throwable arg0,
- String... arguments) {
- MDC.put(classNameProp, "");
- String arguments2 = getNormalizedStackTrace(arg0, arguments);
- debugLogger.warn(msg, arguments2);
- }
-
- /**
- * Records a message with passed in message code, Throwable object, a list of string values
- * @param msg
- * @param className
- * @param arg0
- * @param arguments
- */
- public static void warn(MessageCodes msg, String className, Throwable arg0,
- String... arguments) {
- MDC.put(classNameProp, className);
- String arguments2 = getNormalizedStackTrace(arg0, arguments);
- debugLogger.warn(msg, arguments2);
- }
-
- /**
- * Records only one String message with its class name
- * @param className class name
- * @param arg0 log message
- */
- public static void error( String className, String arg0) {
- MDC.put(classNameProp, className);
- if(ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null){
- MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
- MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
-
- }
- errorLogger.error(MessageCodes.GENERAL_ERROR, arg0);
- }
-
- /**
- * Records only one String message
- * @param arg0
- */
- public static void error(String arg0) {
- MDC.put(classNameProp, "");
- MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
-
- if(ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null){
- MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
- MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
-
- }
- errorLogger.error(MessageCodes.GENERAL_ERROR, arg0);
- }
-
- /**
- * Records only one String message
- * @param arg0
- */
- public static void error(Object arg0) {
- MDC.put(classNameProp, "");
- MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
-
- if(ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null){
- MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
- MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
-
- }
- errorLogger.error(MessageCodes.GENERAL_ERROR, "" + arg0);
- }
-
- /**
- * Records a message with passed in message code, Throwable object, a list of string values
- * @param msg
- * @param arg0
- * @param arguments
- */
- public static void error(MessageCodes msg, Throwable arg0,
- String... arguments) {
- MDC.put(classNameProp, "");
- MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
-
- if(ErrorCodeMap.getErrorCodeInfo(msg) != null){
- MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(msg).getErrorCode());
- MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(msg).getErrorDesc());
-
- }
- String arguments2 = getNormalizedStackTrace(arg0, arguments);
- errorLogger.error(msg, arguments2);
- }
-
- /**
- * Records a message with passed in message code, class name, Throwable object, a list of string values
- * @param msg
- * @param className
- * @param arg0
- * @param arguments
- */
- public static void error(MessageCodes msg, String className, Throwable arg0,
- String... arguments) {
- MDC.put(classNameProp, className);
- MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
-
- if(ErrorCodeMap.getErrorCodeInfo(msg) != null){
- MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(msg).getErrorCode());
- MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(msg).getErrorDesc());
-
- }
- String arguments2 = getNormalizedStackTrace(arg0, arguments);
- errorLogger.error(msg, arguments2);
- }
-
- /**
- * Records a message with passed in message code and a list of string values
- * @param msg
- * @param arguments
- */
- public static void error(MessageCodes msg, String... arguments) {
- MDC.put(classNameProp, "");
- MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
-
- if(ErrorCodeMap.getErrorCodeInfo(msg) != null){
- MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(msg).getErrorCode());
- MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(msg).getErrorDesc());
-
- }
- errorLogger.error(msg, arguments);
- }
-
- /**
- * Records a message with passed in message code and a list of string values
- * @param msg
- * @param arguments
- */
- public static void debug(MessageCodes msg, String... arguments) {
- MDC.put(classNameProp, "");
- debugLogger.debug(msg, arguments);
- }
-
- /**
- * Records only one String message with its class name
- * @param className
- * @param arg0
- */
- public static void debug( String className, String arg0) {
- MDC.put(classNameProp, className);
- debugLogger.debug(MessageCodes.GENERAL_INFO, arg0);
- }
-
- /**
- * Records only one String message
- * @param arg0
- */
- public static void debug(String arg0) {
- MDC.put(classNameProp, "");
- debugLogger.debug(arg0);
- }
-
- /**
- * Records only one String message
- * @param arg0
- */
- public static void debug(Object arg0) {
-
- MDC.put(classNameProp, "");
- debugLogger.debug("" + arg0);
- }
-
- /**
- * Records only one String message with its class name
- * @param className
- * @param arg0
- */
- public static void audit(String className, Object arg0) {
- MDC.put(STATUS_CODE, COMPLETE_STATUS);
- MDC.put(classNameProp, className);
- auditLogger.info("" + arg0);
- }
-
- /**
- * Records only one String message
- * @param arg0
- */
- public static void audit(Object arg0) {
- MDC.put(STATUS_CODE, COMPLETE_STATUS);
- MDC.put(classNameProp, "");
- auditLogger.info("" + arg0);
- }
-
- /**
- * Records a message with passed in message code, hrowable object, a list of string values
- * @param msg
- * @param arg0
- * @param arguments
- */
- public static void debug(MessageCodes msg, Throwable arg0,
- String... arguments) {
- MDC.put(classNameProp, "");
- String arguments2 = getNormalizedStackTrace(arg0, arguments);
- debugLogger.debug(msg, arguments2);
- }
-
- /**
- * Records a message with passed in message code, class name, Throwable object, a list of string values
- * @param msg
- * @param className
- * @param arg0
- * @param arguments
- */
- public static void debug(MessageCodes msg, String className, Throwable arg0,
- String... arguments) {
- MDC.put(classNameProp, className);
- String arguments2 = getNormalizedStackTrace(arg0, arguments);
- debugLogger.debug(msg, arguments2);
- }
- /**
- * returns true for enabled, false for not enabled
- */
- public static boolean isDebugEnabled(){
-
- return debugLogger.isDebugEnabled();
- }
-
- /**
- * returns true for enabled, false for not enabled
- */
- public static boolean isErrorEnabled(){
-
- return errorLogger.isErrorEnabled();
- }
-
- /**
- * returns true for enabled, false for not enabled
- */
- public static boolean isWarnEnabled(){
-
- return debugLogger.isWarnEnabled();
- }
-
- /**
- * returns true for enabled, false for not enabled
- */
- public static boolean isInfoEnabled1(){
-
- return debugLogger.isInfoEnabled();
- }
-
- /**
- * returns true for enabled, false for not enabled
- */
- public static boolean isAuditEnabled(){
-
- return debugLogger.isInfoEnabled();
- }
-
- /**
- * returns true for enabled, false for not enabled
- */
- public static boolean isInfoEnabled(){
-
- return debugLogger.isInfoEnabled();
- }
-
- /**
- * Records only one String message with its class name
- * @param className
- * @param arg0
- */
- public static void trace( String className, String arg0) {
- MDC.put(classNameProp, className);
- debugLogger.trace(MessageCodes.GENERAL_INFO, arg0);
- }
-
- /**
- * Records only one String message
- * @param arg0
- */
- public static void trace(Object arg0){
-
- MDC.put(classNameProp, "");
- debugLogger.trace(""+arg0);
- }
- /**
- * Records the starting time of the event with its request Id as the key
- * @param eventId
- */
- public static void recordAuditEventStart(String eventId) {
-
- MDC.put(STATUS_CODE, COMPLETE_STATUS);
- postMDCInfoForEvent(eventId);
-
- if(eventTracker == null){
- eventTracker = new EventTrackInfo();
- }
- EventData event = new EventData();
- event.setRequestID(eventId);
- event.setStartTime(Instant.now());
- eventTracker.storeEventData(event);
- MDC.put(MDC_KEY_REQUEST_ID, eventId);
- debugLogger.info("CONCURRENTHASHMAP_LIMIT : " + concurrentHashMapLimit);
- //--- Tracking the size of the concurrentHashMap, if it is above limit, keep EventTrack Timer running
- int size = eventTracker.getEventInfo().size();
-
- debugLogger.info("EventInfo concurrentHashMap Size : " + size + " on " + new Date());
- debugLogger.info("isEventTrackerRunning : " + isEventTrackerRunning);
-
- if( size >= concurrentHashMapLimit){
-
-
- if(!isEventTrackerRunning){
-
- startCleanUp();
- isEventTrackerRunning = true;
- }
-
- }else if( size <= stopCheckPoint && isEventTrackerRunning){
-
- stopCleanUp();
- }
- }
-
- /**
- * Records the starting time of the event with its request Id as the key
- * @param eventId
- */
- public static void recordAuditEventStart(UUID eventId) {
-
- if(eventId == null){
- return;
- }
-
- if(eventTracker == null){
- eventTracker = new EventTrackInfo();
- }
-
- recordAuditEventStart(eventId.toString());
-
- }
-
- /**
- * Records the ending time of the event with its request Id as the key
- * @param eventId
- * @param rule
- */
- public static void recordAuditEventEnd(String eventId, String rule) {
-
- if(eventTracker == null){
- return;
- }
- if(eventId == null){
- return;
- }
-
- creatAuditEventTrackingRecord(eventId, rule, "");
-
- }
-
- /**
- * Records the ending time of the event with its request Id as the key
- * @param eventId
- * @param rule
- * @param policyVersion
- */
- public static void recordAuditEventEnd(String eventId, String rule , String policyVersion) {
-
- if(eventTracker == null){
- return;
- }
- if(eventId == null){
- return;
- }
-
- creatAuditEventTrackingRecord(eventId, rule, policyVersion);
-
- }
-
- /**
- * Records the ending time of the event with its request Id as the key
- * @param eventId
- * @param rule
- * @param policyVersion
- */
- public static void recordAuditEventEnd(UUID eventId, String rule, String policyVersion) {
-
- if(eventId == null){
- return;
- }
-
- recordAuditEventEnd(eventId.toString(), rule, policyVersion);
-
- }
-
-
- /**
- * Records the ending time of the event with its request Id as the key
- * @param eventId
- * @param rule
- */
- public static void recordAuditEventEnd(UUID eventId, String rule) {
-
- if(eventId == null){
- return;
- }
-
- recordAuditEventEnd(eventId.toString(), rule);
-
- }
-
- /**
- * Records the ending time of the event with its request Id as the key
- * @param eventId
- * @param rule
- * @param policyVersion
- */
- public static void creatAuditEventTrackingRecord(String eventId, String rule, String policyVersion) {
-
- if(eventTracker == null){
- return;
- }
-
- EventData event = eventTracker.getEventDataByRequestID(eventId);
-
- if(event != null){
- Instant endTime = event.getEndTime();
- if(endTime == null){
- endTime = Instant.now();
- }
- MDC.put(STATUS_CODE, COMPLETE_STATUS);
- recordAuditEventStartToEnd(eventId, rule, event.getStartTime(), endTime, policyVersion);
- }
- }
-
- /**
- * Records the ending time of the event with its request Id as the key
- * @param eventId
- * @param rule
- */
- public static void creatAuditEventTrackingRecord(UUID eventId, String rule) {
-
- if(eventId == null){
- return;
- }
-
- if(eventTracker == null){
- return;
- }
-
- EventData event = eventTracker.getEventDataByRequestID(eventId.toString());
-
- if(event != null){
- Instant endTime = event.getEndTime();
- if(endTime == null){
- endTime = Instant.now();
- }
-
- recordAuditEventStartToEnd(eventId.toString(), rule, event.getStartTime(), endTime, "N/A");
- }
- }
-
- public static EventTrackInfo getEventTracker() {
- return eventTracker;
- }
-
- /**
- * Records the audit with an event starting and ending times
- * @param eventId
- * @param rule
- * @param startTime
- * @param endTime
- * @param policyVersion
- */
- public static void recordAuditEventStartToEnd(String eventId, String rule, Instant startTime, Instant endTime, String policyVersion) {
-
- if(startTime == null || endTime == null){
- return;
- }
- String serviceName = MDC.get(MDC_SERVICE_NAME);
- if(eventId != null && !eventId.isEmpty()){
- MDC.put(MDC_KEY_REQUEST_ID, eventId);
- }
-
- SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
-
- String formatedTime = sdf.format(Date.from(startTime));
- MDC.put(BEGIN_TIME_STAMP, formatedTime );
-
- //set default values for these required fields below, they can be overridden
- formatedTime = sdf.format(Date.from(endTime));
- MDC.put(END_TIME_STAMP, formatedTime);
-
- MDC.put(RESPONSE_CODE, "N/A");
- MDC.put(RESPONSE_DESCRIPTION, "N/A");
-
- long ns = Duration.between(startTime, endTime).toMillis();
-
- MDC.put(ELAPSED_TIME, Long.toString(ns));
-
- auditLogger.info(MessageCodes.RULE_AUDIT_START_END_INFO,
- serviceName, rule, startTime.toString(), endTime.toString(), Long.toString(ns), policyVersion);
-
- //--- remove the record from the concurrentHashMap
- if(eventTracker != null && eventTracker.getEventDataByRequestID(eventId) != null){
-
- eventTracker.remove(eventId);
- debugLogger.info("eventTracker.remove(" + eventId + ")");
-
- }
- }
-
- /**
- * Records the metrics with an event Id and log message
- * @param eventId
- * @param arg1
- */
- public static void recordMetricEvent(String eventId, String arg1) {
-
- seTimeStamps();
-
- String serviceName = MDC.get(MDC_SERVICE_NAME);
- MDC.put(MDC_KEY_REQUEST_ID, eventId);
- metricsLogger.info(MessageCodes.RULE_AUDIT_END_INFO,
- serviceName, arg1);
-
- }
-
- /**
- * Records the metrics with an event Id, class name and log message
- * @param eventId
- * @param className
- * @param arg1
- */
- public static void recordMetricEvent(String eventId, String className,String arg1) {
-
- seTimeStamps();
-
- MDC.put(classNameProp, className);
- String serviceName = MDC.get(MDC_SERVICE_NAME);
- MDC.put(MDC_KEY_REQUEST_ID, eventId);
- metricsLogger.info(MessageCodes.RULE_AUDIT_END_INFO,
- serviceName, arg1);
- }
-
- /**
- * Records the metrics with an event Id and log message
- * @param eventId
- * @param arg1
- */
- public static void recordMetricEvent(UUID eventId, String arg1) {
-
- if(eventId == null){
- return;
- }
- String serviceName = MDC.get(MDC_SERVICE_NAME);
- MDC.put(MDC_KEY_REQUEST_ID, eventId.toString());
- metricsLogger.info(MessageCodes.RULE_AUDIT_END_INFO,
- serviceName, arg1);
- }
-
- /**
- * Records a String message for metrics logs
- * @param arg0
- */
- public static void recordMetricEvent(String arg0) {
- seTimeStamps();
- String serviceName = MDC.get(MDC_SERVICE_NAME);
- metricsLogger.info(MessageCodes.RULE_METRICS_INFO,
- serviceName, arg0);
- }
-
-
- /**
- * Records the metrics event with a String message
- * @param arg0
- */
- public static void metrics(String arg0) {
- String serviceName = MDC.get(MDC_SERVICE_NAME);
- metricsLogger.info(MessageCodes.RULE_METRICS_INFO,
- serviceName, arg0);
- }
-
- /**
- * Records the metrics event with a class name and a String message
- * @param arg0
- */
- public static void metrics(String className, Object arg0) {
- seTimeStamps();
- MDC.put(classNameProp, className);
- String serviceName = MDC.get(MDC_SERVICE_NAME);
- metricsLogger.info(MessageCodes.RULE_METRICS_INFO,
- serviceName, ""+arg0);
- }
-
- /**
- * Records the metrics event with a String message
- * @param arg0
- */
- public static void metrics(Object arg0) {
- seTimeStamps();
- MDC.put(classNameProp, "");
- String serviceName = MDC.get(MDC_SERVICE_NAME);
- metricsLogger.info(MessageCodes.RULE_METRICS_INFO,
- serviceName, ""+arg0);
- }
-
- /**
- * Records the metrics event with a String message
- * @param arg0
- */
- public static void metricsPrintln(String arg0) {
- MDC.clear();
- metricsLogger.info(arg0);
- }
-
- /**
- * Removes all the return lines from the printStackTrace
- * @param t
- * @param arguments
- */
- private static String getNormalizedStackTrace (Throwable t, String...arguments) {
+ private static EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger();
+
+ private static EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
+
+ private static EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
+
+ private static EELFLogger debugLogger = EELFManager.getInstance().getDebugLogger();
+
+ private static final String POLICY_LOGGER = "PolicyLogger";
+
+ private static EventTrackInfo eventTracker = new EventTrackInfo();
+
+ private static String hostName = null;
+ private static String hostAddress = null;
+ private static String component = null;
+
+ private static TimerTask ttrcker = null;
+ private static boolean isEventTrackerRunning = false;
+ private static Timer timer = null;
+
+ // Default:Timer initial delay and the delay between in milliseconds before task is to be
+ // execute
+ private static int timerDelayTime = 1000;
+
+ // Default:Timer scheduleAtFixedRate period - time in milliseconds between successive task
+ // executions
+ private static int checkInterval = 30 * 1000;
+
+ // Default:longest time an event info can be stored in the concurrentHashMap for logging - in
+ // seconds
+ static int expiredTime = 60 * 60 * 1000 * 24; // one day
+
+ // Default:the size of the concurrentHashMap which stores the event starting time - when its
+ // size reaches this limit, the Timer get executed
+ private static int concurrentHashMapLimit = 5000;
+
+ // Default:the size of the concurrentHashMap which stores the event starting time - when its
+ // size drops to this point, stop the Timer
+ private static int stopCheckPoint = 2500;
+
+ private static boolean isOverrideLogbackLevel = false;
+
+ private static Level debugLevel = Level.INFO;
+ private static Level auditLevel = Level.INFO;
+ private static Level metricsLevel = Level.INFO;
+ private static Level errorLevel = Level.ERROR;
+ private static String classNameProp = "ClassName";
+
+ private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS+00:00";
+ private static final String COMPLETE_STATUS = "COMPLETE";
+ private static final String ERROR_CATEGORY_VALUE = "ERROR";
+
+ static {
+ if (hostName == null || hostAddress == null) {
+ try {
+ hostName = InetAddress.getLocalHost().getHostName();
+ hostAddress = InetAddress.getLocalHost().getHostAddress();
+ } catch (UnknownHostException e) {
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, POLICY_LOGGER, "UnknownHostException");
+ }
+ }
+ }
+
+ public static Level getDebugLevel() {
+ return debugLevel;
+ }
+
+ public static synchronized void setDebugLevel(Level level) {
+ debugLevel = level;
+ }
+
+ /**
+ * Sets Debug Level.
+ */
+ public static void setDebugLevel(String newDebugLevel) {
+
+ if (isOverrideLogbackLevel) {
+ PolicyLogger.debugLevel = Level.valueOf(newDebugLevel);
+ debugLogger.setLevel(debugLevel);
+ }
+
+ }
+
+ public static Level getAuditLevel() {
+ return auditLevel;
+ }
+
+ public static synchronized void setAuditLevel(Level level) {
+ auditLevel = level;
+ }
+
+ /**
+ * Sets Audit OFF or ON.
+ */
+ public static void setAuditLevel(String newAuditLevel) {
+
+ if (isOverrideLogbackLevel) {
+ if ("OFF".equalsIgnoreCase(newAuditLevel)) {
+ PolicyLogger.auditLevel = Level.OFF;
+ auditLogger.setLevel(auditLevel);
+ } else {
+ // --- set default value
+ auditLogger.setLevel(Level.INFO);
+ PolicyLogger.auditLevel = Level.INFO;
+ }
+ }
+ }
+
+ public static Level getMetricsLevel() {
+ return metricsLevel;
+ }
+
+ public static synchronized void setMetricsLevel(Level level) {
+ metricsLevel = level;
+ }
+
+ /**
+ * Sets Metrics OFF or ON.
+ */
+ public static void setMetricsLevel(String newMetricsLevel) {
+
+ if (isOverrideLogbackLevel) {
+ if ("OFF".equalsIgnoreCase(newMetricsLevel)) {
+ PolicyLogger.metricsLevel = Level.OFF;
+ metricsLogger.setLevel(metricsLevel);
+ } else {
+ // --- set default value
+ metricsLogger.setLevel(Level.INFO);
+ PolicyLogger.metricsLevel = Level.INFO;
+ }
+ }
+
+ }
+
+ public static Level getErrorLevel() {
+ return errorLevel;
+ }
+
+ public static synchronized void setErrorLevel(Level level) {
+ errorLevel = level;
+ }
+
+ /**
+ * Sets Error OFF or ON.
+ */
+ public static void setErrorLevel(String newErrorLevel) {
+
+ if (isOverrideLogbackLevel) {
+ if ("OFF".equalsIgnoreCase(newErrorLevel)) {
+ PolicyLogger.errorLevel = Level.OFF;
+ errorLogger.setLevel(errorLevel);
+ } else {
+ // --- set default value
+ errorLogger.setLevel(Level.ERROR);
+ PolicyLogger.errorLevel = Level.ERROR;
+ }
+ }
+ }
+
+ public static String getClassname() {
+ return classNameProp;
+ }
+
+ public static synchronized void setClassname(String name) {
+ classNameProp = name;
+ }
+
+ /**
+ * Populates MDC info.
+ *
+ * @param transId the transaction ID
+ * @return String
+ */
+ public static String postMDCInfoForEvent(String transId) {
+ MDC.clear();
+
+ String transactionId = transId;
+
+ if (transactionId == null || transactionId.isEmpty()) {
+ transactionId = UUID.randomUUID().toString();
+ }
+
+ if ("DROOLS".equalsIgnoreCase(component)) {
+ MDC.put(TARGET_ENTITY, "POLICY");
+ MDC.put(TARGET_SERVICE_NAME, "drools evaluate rule");
+ return postMDCInfoForEvent(transactionId, new DroolsPDPMDCInfo());
+ } else {
+ // For Xacml
+ MDC.put(TARGET_ENTITY, "POLICY");
+ MDC.put(TARGET_SERVICE_NAME, "PE Process");
+ }
+
+ MDC.put(MDC_REMOTE_HOST, "");
+ MDC.put(MDC_KEY_REQUEST_ID, transactionId);
+ MDC.put(MDC_SERVICE_NAME, "Policy.xacmlPdp");
+ MDC.put(MDC_SERVICE_INSTANCE_ID, "Policy.xacmlPdp.event");
+ try {
+ MDC.put(MDC_SERVER_FQDN, hostName);
+ MDC.put(MDC_SERVER_IP_ADDRESS, hostAddress);
+ } catch (Exception e) {
+ errorLogger.error(MessageCodes.EXCEPTION_ERROR, e, POLICY_LOGGER);
+ }
+
+ MDC.put(MDC_INSTANCE_UUID, "");
+ MDC.put(MDC_ALERT_SEVERITY, "");
+
+ SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
+
+ Instant startTime = Instant.now();
+ Instant endTime = Instant.now();
+
+ String formatedTime = sdf.format(Date.from(startTime));
+ MDC.put(BEGIN_TIME_STAMP, formatedTime);
+
+ // set default values for these required fields below, they can be overridden
+ formatedTime = sdf.format(Date.from(endTime));
+ MDC.put(END_TIME_STAMP, formatedTime);
+ MDC.put(ELAPSED_TIME, Long.toString(Duration.between(startTime, endTime).toMillis()));
+
+ MDC.put(PARTNER_NAME, "N/A");
+
+ MDC.put(STATUS_CODE, COMPLETE_STATUS);
+ MDC.put(RESPONSE_CODE, "N/A");
+ MDC.put(RESPONSE_DESCRIPTION, "N/A");
+
+
+ return transactionId;
+
+ }
+
+ /**
+ * Populate MDC Info using the passed in mdcInfo.
+ *
+ * @param transId the transaction ID
+ * @param mdcInfo the MDC info
+ * @return String
+ */
+ private static String postMDCInfoForEvent(String transId, MDCInfo mdcInfo) {
+
+ MDC.put(MDC_KEY_REQUEST_ID, transId);
+ if (mdcInfo != null && mdcInfo.getMDCInfo() != null && !mdcInfo.getMDCInfo().isEmpty()) {
+
+ ConcurrentMap<String, String> mdcMap = mdcInfo.getMDCInfo();
+ Iterator<String> keyIterator = mdcMap.keySet().iterator();
+ String key;
+
+ while (keyIterator.hasNext()) {
+ key = keyIterator.next();
+ MDC.put(key, mdcMap.get(key));
+ }
+ }
+
+ try {
+ MDC.put(MDC_SERVER_FQDN, hostName);
+ MDC.put(MDC_SERVER_IP_ADDRESS, hostAddress);
+ } catch (Exception e) {
+ errorLogger.error(MessageCodes.EXCEPTION_ERROR, e, POLICY_LOGGER);
+ }
+ Instant startTime = Instant.now();
+ Instant endTime = Instant.now();
+
+ SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
+
+ String formatedTime = sdf.format(Date.from(startTime));
+ MDC.put(BEGIN_TIME_STAMP, formatedTime);
+
+ // set default values for these required fields below, they can be overridden
+ formatedTime = sdf.format(Date.from(endTime));
+ MDC.put(END_TIME_STAMP, formatedTime);
+ MDC.put(ELAPSED_TIME, Long.toString(Duration.between(startTime, endTime).toMillis()));
+
+ return transId;
+ }
+
+ /**
+ * Sets transaction Id to MDC.
+ *
+ * @param eventObject event object
+ */
+ public static void postMDCInfoForEvent(Object eventObject) {
+ postMDCInfoForEvent("" + eventObject);
+ }
+
+ /**
+ * Set Timestamps for start, end and duration of logging a transaction.
+ */
+ private static void seTimeStamps() {
+
+ MDC.put(MDC_INSTANCE_UUID, "");
+ MDC.put(MDC_ALERT_SEVERITY, "");
+
+ SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
+
+ Instant startTime = Instant.now();
+ Instant endTime = Instant.now();
+
+ String formatedTime = sdf.format(Date.from(startTime));
+ MDC.put(BEGIN_TIME_STAMP, formatedTime);
+
+ // set default values for these required fields below, they can be overridden
+ formatedTime = sdf.format(Date.from(endTime));
+ MDC.put(END_TIME_STAMP, formatedTime);
+ MDC.put(ELAPSED_TIME, Long.toString(Duration.between(startTime, endTime).toMillis()));
+
+ MDC.put(PARTNER_NAME, "N/A");
+
+ MDC.put(STATUS_CODE, COMPLETE_STATUS);
+ MDC.put(RESPONSE_CODE, "N/A");
+ MDC.put(RESPONSE_DESCRIPTION, "N/A");
+
+ }
+
+ /**
+ * Sets transaction Id to MDC.
+ *
+ * @param transId the transaction ID
+ */
+ public static void setTransId(String transId) {
+
+ MDC.put(MDC_KEY_REQUEST_ID, transId);
+ }
+
+ /**
+ * Returns current transaction Id used in MDC.
+ *
+ * @return transId
+ */
+ public static String getTransId() {
+
+ return MDC.get(MDC_KEY_REQUEST_ID);
+ }
+
+ /**
+ * Resets transaction Id in MDC for the rule triggered by this event.
+ *
+ * @param transId the transaction ID
+ * @return String
+ */
+ public static String postMDCInfoForTriggeredRule(String transId) {
+
+ String transactionId = transId;
+
+ MDC.clear();
+
+ if (transactionId == null || transactionId.isEmpty()) {
+ transactionId = UUID.randomUUID().toString();
+ }
+ MDC.put(MDC_REMOTE_HOST, "");
+ MDC.put(MDC_KEY_REQUEST_ID, transactionId);
+ MDC.put(MDC_SERVICE_NAME, "Policy.droolsPdp");
+ MDC.put(MDC_SERVICE_INSTANCE_ID, "");
+ try {
+ MDC.put(MDC_SERVER_FQDN, hostName);
+ MDC.put(MDC_SERVER_IP_ADDRESS, hostAddress);
+ } catch (Exception e) {
+ errorLogger.error(MessageCodes.EXCEPTION_ERROR, e, POLICY_LOGGER);
+ }
+ MDC.put(MDC_INSTANCE_UUID, "");
+ MDC.put(MDC_ALERT_SEVERITY, "");
+ MDC.put(STATUS_CODE, COMPLETE_STATUS);
+
+ return transactionId;
+
+ }
+
+ /**
+ * Resets transaction Id in MDC for the rule triggered by this event.
+ *
+ * @param obj object
+ */
+ public static void postMDCUUIDForTriggeredRule(Object obj) {
+
+ postMDCInfoForTriggeredRule("" + obj);
+
+ }
+
+ // ************************************************************************************************
+ /**
+ * Records the Info event with String [] arguments.
+ *
+ * @param msg the message code
+ * @param className the class name
+ * @param arguments the messages
+ */
+ public static void info(MessageCodes msg, String className, String... arguments) {
+ MDC.put(classNameProp, className);
+ debugLogger.info(msg, arguments);
+ }
+
+ /**
+ * Records only one String message with its class name.
+ *
+ * @param className the class name
+ * @param arg0 the message
+ */
+ public static void info(String className, String arg0) {
+ MDC.put(classNameProp, className);
+ debugLogger.info(MessageCodes.GENERAL_INFO, arg0);
+ }
+
+
+ /**
+ * Records only one String message.
+ *
+ * @param arg0 the message
+ */
+ public static void info(Object arg0) {
+ MDC.put(classNameProp, "");
+ debugLogger.info(MessageCodes.GENERAL_INFO, String.valueOf(arg0));
+ }
+
+ /**
+ * Records a message with passed in message code, Throwable object, a list of string values.
+ *
+ * @param msg the message code
+ * @param arg0 the throwable
+ * @param arguments the messages
+ */
+ public static void info(MessageCodes msg, Throwable arg0, String... arguments) {
+ MDC.put(classNameProp, "");
+ String arguments2 = getNormalizedStackTrace(arg0, arguments);
+ debugLogger.info(msg, arguments2);
+ }
+
+ /**
+ * Records a message with passed in message code, class name, Throwable object, a list of string
+ * values.
+ *
+ * @param msg the message code
+ * @param className the class name
+ * @param arg0 the throwable
+ * @param arguments the messages
+ */
+ public static void info(MessageCodes msg, String className, Throwable arg0, String... arguments) {
+ MDC.put(classNameProp, className);
+ String arguments2 = getNormalizedStackTrace(arg0, arguments);
+ debugLogger.info(msg, arguments2);
+ }
+
+ /**
+ * Records only one String message with its class name.
+ *
+ * @param arg0 log message
+ * @param className class name
+ */
+ public static void warn(String className, String arg0) {
+ MDC.put(classNameProp, className);
+ debugLogger.warn(MessageCodes.GENERAL_INFO, arg0);
+ }
+
+ /**
+ * Records only one String message.
+ *
+ * @param arg0 the message
+ */
+ public static void warn(Object arg0) {
+ MDC.put(classNameProp, "");
+ debugLogger.warn(MessageCodes.GENERAL_WARNING, "" + arg0);
+ }
+
+ /**
+ * Records only one String message without its class name passed in.
+ *
+ * @param arg0 the message
+ */
+ public static void warn(String arg0) {
+ MDC.put(classNameProp, "");
+ debugLogger.warn(MessageCodes.GENERAL_WARNING, arg0);
+ }
+
+ /**
+ * Records a message with passed in message code, class name and a list of string values.
+ *
+ * @param msg the message code
+ * @param className the class name
+ * @param arguments the messages
+ */
+ public static void warn(MessageCodes msg, String className, String... arguments) {
+ MDC.put(classNameProp, className);
+ debugLogger.warn(msg, arguments);
+ }
+
+ /**
+ * Records a message with passed in message code, Throwable object, a list of string values.
+ *
+ * @param msg the message code
+ * @param arg0 the throwable
+ * @param arguments the messages
+ */
+ public static void warn(MessageCodes msg, Throwable arg0, String... arguments) {
+ MDC.put(classNameProp, "");
+ String arguments2 = getNormalizedStackTrace(arg0, arguments);
+ debugLogger.warn(msg, arguments2);
+ }
+
+ /**
+ * Records a message with passed in message code, Throwable object, a list of string values.
+ *
+ * @param msg the message code
+ * @param className the class name
+ * @param arg0 the throwable
+ * @param arguments the messages
+ */
+ public static void warn(MessageCodes msg, String className, Throwable arg0, String... arguments) {
+ MDC.put(classNameProp, className);
+ String arguments2 = getNormalizedStackTrace(arg0, arguments);
+ debugLogger.warn(msg, arguments2);
+ }
+
+ /**
+ * Records only one String message with its class name.
+ *
+ * @param className class name
+ * @param arg0 log message
+ */
+ public static void error(String className, String arg0) {
+ MDC.put(classNameProp, className);
+ if (ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null) {
+ MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
+ MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
+
+ }
+ errorLogger.error(MessageCodes.GENERAL_ERROR, arg0);
+ }
+
+ /**
+ * Records only one String message.
+ *
+ * @param arg0 the message
+ */
+ public static void error(String arg0) {
+ MDC.put(classNameProp, "");
+ MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
+
+ if (ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null) {
+ MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
+ MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
+
+ }
+ errorLogger.error(MessageCodes.GENERAL_ERROR, arg0);
+ }
+
+ /**
+ * Records only one String message.
+ *
+ * @param arg0 the message
+ */
+ public static void error(Object arg0) {
+ MDC.put(classNameProp, "");
+ MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
+
+ if (ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null) {
+ MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
+ MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
+
+ }
+ errorLogger.error(MessageCodes.GENERAL_ERROR, "" + arg0);
+ }
+
+ /**
+ * Records a message with passed in message code, Throwable object, a list of string values.
+ *
+ * @param msg the message code
+ * @param arg0 the throwable
+ * @param arguments the messages
+ */
+ public static void error(MessageCodes msg, Throwable arg0, String... arguments) {
+ MDC.put(classNameProp, "");
+ MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
+
+ if (ErrorCodeMap.getErrorCodeInfo(msg) != null) {
+ MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(msg).getErrorCode());
+ MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(msg).getErrorDesc());
+
+ }
+ String arguments2 = getNormalizedStackTrace(arg0, arguments);
+ errorLogger.error(msg, arguments2);
+ }
+
+ /**
+ * Records a message with passed in message code, class name, Throwable object, a list of string
+ * values.
+ *
+ * @param msg the message code
+ * @param className the class name
+ * @param arg0 the throwable
+ * @param arguments the messages
+ */
+ public static void error(MessageCodes msg, String className, Throwable arg0, String... arguments) {
+ MDC.put(classNameProp, className);
+ MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
+
+ if (ErrorCodeMap.getErrorCodeInfo(msg) != null) {
+ MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(msg).getErrorCode());
+ MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(msg).getErrorDesc());
+
+ }
+ String arguments2 = getNormalizedStackTrace(arg0, arguments);
+ errorLogger.error(msg, arguments2);
+ }
+
+ /**
+ * Records a message with passed in message code and a list of string values.
+ *
+ * @param msg the message code
+ * @param arguments the messages
+ */
+ public static void error(MessageCodes msg, String... arguments) {
+ MDC.put(classNameProp, "");
+ MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
+
+ if (ErrorCodeMap.getErrorCodeInfo(msg) != null) {
+ MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(msg).getErrorCode());
+ MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(msg).getErrorDesc());
+
+ }
+ errorLogger.error(msg, arguments);
+ }
+
+ /**
+ * Records a message with passed in message code and a list of string values.
+ *
+ * @param msg the message code
+ * @param arguments the messages
+ */
+ public static void debug(MessageCodes msg, String... arguments) {
+ MDC.put(classNameProp, "");
+ debugLogger.debug(msg, arguments);
+ }
+
+ /**
+ * Records only one String message with its class name.
+ *
+ * @param className the class name
+ * @param arg0 the message
+ */
+ public static void debug(String className, String arg0) {
+ MDC.put(classNameProp, className);
+ debugLogger.debug(MessageCodes.GENERAL_INFO, arg0);
+ }
+
+ /**
+ * Records only one String message.
+ *
+ * @param arg0 the message
+ */
+ public static void debug(String arg0) {
+ MDC.put(classNameProp, "");
+ debugLogger.debug(arg0);
+ }
+
+ /**
+ * Records only one String message.
+ *
+ * @param arg0 the message
+ */
+ public static void debug(Object arg0) {
+
+ MDC.put(classNameProp, "");
+ debugLogger.debug("" + arg0);
+ }
+
+ /**
+ * Records a message with passed in message code, hrowable object, a list of string values.
+ *
+ * @param msg the message code
+ * @param arg0 the throwable
+ * @param arguments the messages
+ */
+ public static void debug(MessageCodes msg, Throwable arg0, String... arguments) {
+ MDC.put(classNameProp, "");
+ String arguments2 = getNormalizedStackTrace(arg0, arguments);
+ debugLogger.debug(msg, arguments2);
+ }
+
+ /**
+ * Records a message with passed in message code, class name, Throwable object, a list of
+ * string. values
+ *
+ * @param msg the message code
+ * @param className the class name
+ * @param arg0 the throwable
+ * @param arguments the messages
+ */
+ public static void debug(MessageCodes msg, String className, Throwable arg0, String... arguments) {
+ MDC.put(classNameProp, className);
+ String arguments2 = getNormalizedStackTrace(arg0, arguments);
+ debugLogger.debug(msg, arguments2);
+ }
+
+ /**
+ * Records only one String message with its class name.
+ *
+ * @param className the class name
+ * @param arg0 the message
+ */
+ public static void audit(String className, Object arg0) {
+ MDC.put(STATUS_CODE, COMPLETE_STATUS);
+ MDC.put(classNameProp, className);
+ auditLogger.info("" + arg0);
+ }
+
+ /**
+ * Records only one String message.
+ *
+ * @param arg0 the message
+ */
+ public static void audit(Object arg0) {
+ MDC.put(STATUS_CODE, COMPLETE_STATUS);
+ MDC.put(classNameProp, "");
+ auditLogger.info("" + arg0);
+ }
+
+ /**
+ * returns true for enabled, false for not enabled.
+ */
+ public static boolean isDebugEnabled() {
+
+ return debugLogger.isDebugEnabled();
+ }
+
+ /**
+ * returns true for enabled, false for not enabled.
+ */
+ public static boolean isErrorEnabled() {
+
+ return errorLogger.isErrorEnabled();
+ }
+
+ /**
+ * returns true for enabled, false for not enabled.
+ */
+ public static boolean isWarnEnabled() {
+
+ return debugLogger.isWarnEnabled();
+ }
+
+ /**
+ * returns true for enabled, false for not enabled.
+ */
+ public static boolean isInfoEnabled1() {
+
+ return debugLogger.isInfoEnabled();
+ }
+
+ /**
+ * returns true for enabled, false for not enabled.
+ */
+ public static boolean isAuditEnabled() {
+
+ return debugLogger.isInfoEnabled();
+ }
+
+ /**
+ * returns true for enabled, false for not enabled.
+ */
+ public static boolean isInfoEnabled() {
+
+ return debugLogger.isInfoEnabled();
+ }
+
+ /**
+ * Records only one String message with its class name.
+ *
+ * @param className the class name
+ * @param arg0 the message
+ */
+ public static void trace(String className, String arg0) {
+ MDC.put(classNameProp, className);
+ debugLogger.trace(MessageCodes.GENERAL_INFO, arg0);
+ }
+
+ /**
+ * Records only one String message.
+ *
+ * @param arg0 the message
+ */
+ public static void trace(Object arg0) {
+
+ MDC.put(classNameProp, "");
+ debugLogger.trace("" + arg0);
+ }
+
+ /**
+ * Records the starting time of the event with its request Id as the key.
+ *
+ * @param eventId the event ID
+ */
+ public static void recordAuditEventStart(String eventId) {
+
+ MDC.put(STATUS_CODE, COMPLETE_STATUS);
+ postMDCInfoForEvent(eventId);
+
+ if (eventTracker == null) {
+ eventTracker = new EventTrackInfo();
+ }
+ EventData event = new EventData();
+ event.setRequestID(eventId);
+ event.setStartTime(Instant.now());
+ eventTracker.storeEventData(event);
+ MDC.put(MDC_KEY_REQUEST_ID, eventId);
+ debugLogger.info("CONCURRENTHASHMAP_LIMIT : " + concurrentHashMapLimit);
+ // --- Tracking the size of the concurrentHashMap, if it is above limit, keep EventTrack
+ // Timer running
+ int size = eventTracker.getEventInfo().size();
+
+ debugLogger.info("EventInfo concurrentHashMap Size : " + size + " on " + new Date());
+ debugLogger.info("isEventTrackerRunning : " + isEventTrackerRunning);
+
+ if (size >= concurrentHashMapLimit) {
+
+
+ if (!isEventTrackerRunning) {
+
+ startCleanUp();
+ isEventTrackerRunning = true;
+ }
+
+ } else if (size <= stopCheckPoint && isEventTrackerRunning) {
+
+ stopCleanUp();
+ }
+ }
+
+ /**
+ * Records the starting time of the event with its request Id as the key.
+ *
+ * @param eventId the event ID
+ */
+ public static void recordAuditEventStart(UUID eventId) {
+
+ if (eventId == null) {
+ return;
+ }
+
+ if (eventTracker == null) {
+ eventTracker = new EventTrackInfo();
+ }
+
+ recordAuditEventStart(eventId.toString());
+
+ }
+
+ /**
+ * Records the ending time of the event with its request Id as the key.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ */
+ public static void recordAuditEventEnd(String eventId, String rule) {
+
+ if (eventTracker == null) {
+ return;
+ }
+ if (eventId == null) {
+ return;
+ }
+
+ creatAuditEventTrackingRecord(eventId, rule, "");
+
+ }
+
+ /**
+ * Records the ending time of the event with its request Id as the key.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ * @param policyVersion the policy version
+ */
+ public static void recordAuditEventEnd(String eventId, String rule, String policyVersion) {
+
+ if (eventTracker == null) {
+ return;
+ }
+ if (eventId == null) {
+ return;
+ }
+
+ creatAuditEventTrackingRecord(eventId, rule, policyVersion);
+
+ }
+
+ /**
+ * Records the ending time of the event with its request Id as the key.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ * @param policyVersion the policy version
+ */
+ public static void recordAuditEventEnd(UUID eventId, String rule, String policyVersion) {
+
+ if (eventId == null) {
+ return;
+ }
+
+ recordAuditEventEnd(eventId.toString(), rule, policyVersion);
+
+ }
+
+
+ /**
+ * Records the ending time of the event with its request Id as the key.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ */
+ public static void recordAuditEventEnd(UUID eventId, String rule) {
+
+ if (eventId == null) {
+ return;
+ }
+
+ recordAuditEventEnd(eventId.toString(), rule);
+
+ }
+
+ /**
+ * Records the ending time of the event with its request Id as the key.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ * @param policyVersion the policy version
+ */
+ public static void creatAuditEventTrackingRecord(String eventId, String rule, String policyVersion) {
+
+ if (eventTracker == null) {
+ return;
+ }
+
+ EventData event = eventTracker.getEventDataByRequestID(eventId);
+
+ if (event != null) {
+ Instant endTime = event.getEndTime();
+ if (endTime == null) {
+ endTime = Instant.now();
+ }
+ MDC.put(STATUS_CODE, COMPLETE_STATUS);
+ recordAuditEventStartToEnd(eventId, rule, event.getStartTime(), endTime, policyVersion);
+ }
+ }
+
+ /**
+ * Records the ending time of the event with its request Id as the key.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ */
+ public static void creatAuditEventTrackingRecord(UUID eventId, String rule) {
+
+ if (eventId == null) {
+ return;
+ }
+
+ if (eventTracker == null) {
+ return;
+ }
+
+ EventData event = eventTracker.getEventDataByRequestID(eventId.toString());
+
+ if (event != null) {
+ Instant endTime = event.getEndTime();
+ if (endTime == null) {
+ endTime = Instant.now();
+ }
+
+ recordAuditEventStartToEnd(eventId.toString(), rule, event.getStartTime(), endTime, "N/A");
+ }
+ }
+
+ public static EventTrackInfo getEventTracker() {
+ return eventTracker;
+ }
+
+ /**
+ * Records the audit with an event starting and ending times.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ * @param startTime the start time
+ * @param endTime the end time
+ * @param policyVersion the policy version
+ */
+ public static void recordAuditEventStartToEnd(String eventId, String rule, Instant startTime, Instant endTime,
+ String policyVersion) {
+
+ if (startTime == null || endTime == null) {
+ return;
+ }
+ if (eventId != null && !eventId.isEmpty()) {
+ MDC.put(MDC_KEY_REQUEST_ID, eventId);
+ }
+
+ SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
+
+ String formatedTime = sdf.format(Date.from(startTime));
+ MDC.put(BEGIN_TIME_STAMP, formatedTime);
+
+ // set default values for these required fields below, they can be overridden
+ formatedTime = sdf.format(Date.from(endTime));
+ MDC.put(END_TIME_STAMP, formatedTime);
+
+ MDC.put(RESPONSE_CODE, "N/A");
+ MDC.put(RESPONSE_DESCRIPTION, "N/A");
+
+ long ns = Duration.between(startTime, endTime).toMillis();
+
+ MDC.put(ELAPSED_TIME, Long.toString(ns));
+
+ auditLogger.info(MessageCodes.RULE_AUDIT_START_END_INFO, MDC.get(MDC_SERVICE_NAME), rule, startTime.toString(),
+ endTime.toString(), Long.toString(ns), policyVersion);
+
+ // --- remove the record from the concurrentHashMap
+ if (eventTracker != null && eventTracker.getEventDataByRequestID(eventId) != null) {
+
+ eventTracker.remove(eventId);
+ debugLogger.info("eventTracker.remove(" + eventId + ")");
+
+ }
+ }
+
+ /**
+ * Records the metrics with an event Id and log message.
+ *
+ * @param eventId the event ID
+ * @param arg1 the message
+ */
+ public static void recordMetricEvent(String eventId, String arg1) {
+
+ seTimeStamps();
+
+ String serviceName = MDC.get(MDC_SERVICE_NAME);
+ MDC.put(MDC_KEY_REQUEST_ID, eventId);
+ metricsLogger.info(MessageCodes.RULE_AUDIT_END_INFO, serviceName, arg1);
+
+ }
+
+ /**
+ * Records the metrics with an event Id, class name and log message.
+ *
+ * @param eventId the event ID
+ * @param className the class name
+ * @param arg1 the message
+ */
+ public static void recordMetricEvent(String eventId, String className, String arg1) {
+
+ seTimeStamps();
+
+ MDC.put(classNameProp, className);
+ String serviceName = MDC.get(MDC_SERVICE_NAME);
+ MDC.put(MDC_KEY_REQUEST_ID, eventId);
+ metricsLogger.info(MessageCodes.RULE_AUDIT_END_INFO, serviceName, arg1);
+ }
+
+ /**
+ * Records the metrics with an event Id and log message.
+ *
+ * @param eventId the event ID
+ * @param arg1 the message
+ */
+ public static void recordMetricEvent(UUID eventId, String arg1) {
+
+ if (eventId == null) {
+ return;
+ }
+ String serviceName = MDC.get(MDC_SERVICE_NAME);
+ MDC.put(MDC_KEY_REQUEST_ID, eventId.toString());
+ metricsLogger.info(MessageCodes.RULE_AUDIT_END_INFO, serviceName, arg1);
+ }
+
+ /**
+ * Records a String message for metrics logs.
+ *
+ * @param arg0 the message
+ */
+ public static void recordMetricEvent(String arg0) {
+ seTimeStamps();
+ String serviceName = MDC.get(MDC_SERVICE_NAME);
+ metricsLogger.info(MessageCodes.RULE_METRICS_INFO, serviceName, arg0);
+ }
+
+
+ /**
+ * Records the metrics event with a String message.
+ *
+ * @param arg0 the message
+ */
+ public static void metrics(String arg0) {
+ String serviceName = MDC.get(MDC_SERVICE_NAME);
+ metricsLogger.info(MessageCodes.RULE_METRICS_INFO, serviceName, arg0);
+ }
+
+ /**
+ * Records the metrics event with a class name and a String message.
+ *
+ * @param arg0 the message
+ */
+ public static void metrics(String className, Object arg0) {
+ seTimeStamps();
+ MDC.put(classNameProp, className);
+ String serviceName = MDC.get(MDC_SERVICE_NAME);
+ metricsLogger.info(MessageCodes.RULE_METRICS_INFO, serviceName, "" + arg0);
+ }
+
+ /**
+ * Records the metrics event with a String message.
+ *
+ * @param arg0 the message
+ */
+ public static void metrics(Object arg0) {
+ seTimeStamps();
+ MDC.put(classNameProp, "");
+ String serviceName = MDC.get(MDC_SERVICE_NAME);
+ metricsLogger.info(MessageCodes.RULE_METRICS_INFO, serviceName, "" + arg0);
+ }
+
+ /**
+ * Records the metrics event with a String message.
+ *
+ * @param arg0 the message
+ */
+ public static void metricsPrintln(String arg0) {
+ MDC.clear();
+ metricsLogger.info(arg0);
+ }
+
+ /**
+ * Removes all the return lines from the printStackTrace.
+ *
+ * @param throwable the throwable
+ * @param arguments the messages
+ */
+ private static String getNormalizedStackTrace(Throwable throwable, String... arguments) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
- t.printStackTrace(pw);
- String newStValue = sw.toString().replace ('|', '!').replace ("\n", " - ");
+ throwable.printStackTrace(pw);
+ String newStValue = sw.toString().replace('|', '!').replace("\n", " - ");
int curSize = arguments == null ? 0 : arguments.length;
StringBuilder newArgument = new StringBuilder();
- for(int i=0; i<curSize; i++) {
- newArgument.append(arguments[i]);
- newArgument.append(":");
+ for (int i = 0; i < curSize; i++) {
+ newArgument.append(arguments[i]);
+ newArgument.append(":");
+ }
+ newArgument.append(newStValue);
+ return newArgument.toString();
+ }
+
+ /**
+ * Starts the process of cleaning up the ConcurrentHashMap of EventData.
+ */
+ private static void startCleanUp() {
+
+ if (!isEventTrackerRunning) {
+ ttrcker = new EventTrackInfoHandler();
+ timer = new Timer(true);
+ timer.scheduleAtFixedRate(ttrcker, timerDelayTime, checkInterval);
+ debugLogger.info("EventTrackInfoHandler begins! : " + new Date());
+ } else {
+ debugLogger.info("Timer is still running : " + new Date());
+
+ }
+ }
+
+
+ /**
+ * Stops the process of cleaning up the ConcurrentHashMap of EventData.
+ */
+ private static void stopCleanUp() {
+
+ if (isEventTrackerRunning && timer != null) {
+ timer.cancel();
+ timer.purge();
+ debugLogger.info("Timer stopped: " + new Date());
+ } else {
+ debugLogger.info("Timer was already stopped : " + new Date());
+
}
- newArgument.append(newStValue);
- return newArgument.toString();
- }
-
- /**
- * Starts the process of cleaning up the ConcurrentHashMap of EventData
- */
- private static void startCleanUp(){
-
- if(!isEventTrackerRunning) {
- ttrcker = new EventTrackInfoHandler();
- timer = new Timer(true);
- timer.scheduleAtFixedRate(ttrcker, timerDelayTime, checkInterval);
- debugLogger.info("EventTrackInfoHandler begins! : " + new Date());
- }else{
- debugLogger.info("Timer is still running : " + new Date());
-
- }
- }
-
-
- /**
- * Stops the process of cleaning up the ConcurrentHashMap of EventData
- */
- private static void stopCleanUp(){
-
- if(isEventTrackerRunning && timer != null){
- timer.cancel();
- timer.purge();
- debugLogger.info("Timer stopped: " + new Date());
- }else{
- debugLogger.info("Timer was already stopped : " + new Date());
-
- }
- isEventTrackerRunning = false;
-
- }
-
- /**
- * Loads all the attributes from policyLogger.properties file
- */
- public static LoggerType init(Properties properties) {
-
- Properties loggerProperties;
- if (properties != null) {
- loggerProperties = properties;
- } else {
- System.err.println("PolicyLogger cannot find its configuration - continue");
- loggerProperties = new Properties();
- }
-
- LoggerType loggerType = LoggerType.EELF;
-
- // fetch and verify definitions of some properties
- try{
-
- int timerDelayTimeProp = Integer.parseInt(loggerProperties.getProperty("timer.delay.time", Integer.toString(1000)));
- int checkIntervalProp = Integer.parseInt(loggerProperties.getProperty("check.interval", Integer.toString(30000)));
- int expiredDateProp = Integer.parseInt(loggerProperties.getProperty("event.expired.time", Integer.toString(86400)));
- int concurrentHashMapLimitProp = Integer.parseInt(loggerProperties.getProperty("concurrentHashMap.limit", Integer.toString(5000)));
- int stopCheckPointProp = Integer.parseInt(loggerProperties.getProperty("stop.check.point", Integer.toString(2500)));
- String loggerTypeProp = loggerProperties.getProperty("logger.type",loggerType.toString());
-
- String debugLevelProp = loggerProperties.getProperty("debugLogger.level","INFO");
- String metricsLevelProp = loggerProperties.getProperty("metricsLogger.level","ON");
- String auditLevelProp = loggerProperties.getProperty("audit.level","ON");
- String errorLevelProp = loggerProperties.getProperty("error.level","ON");
- component = loggerProperties.getProperty("policy.component","DROOLS");
- String overrideLogbackLevel = loggerProperties.getProperty("override.logback.level.setup");
-
- if(overrideLogbackLevel != null && !overrideLogbackLevel.isEmpty()) {
- if("TRUE".equalsIgnoreCase(overrideLogbackLevel)){
- isOverrideLogbackLevel = true;
- }else{
- isOverrideLogbackLevel = false;
- }
- }
-
-
- if (debugLevelProp != null && !debugLevelProp.isEmpty()){
-
- PolicyLogger.setDebugLevel(Level.valueOf(debugLevelProp));
-
- }
- //Only check if it is to turn off or not
- if (errorLevelProp != null && errorLevelProp.equalsIgnoreCase(Level.OFF.toString())){
-
- PolicyLogger.setErrorLevel(Level.valueOf(errorLevelProp));
-
- }
- //Only check if it is to turn off or not
- if (metricsLevelProp != null && metricsLevelProp.equalsIgnoreCase(Level.OFF.toString())){
-
- PolicyLogger.setMetricsLevel(Level.valueOf(metricsLevelProp));
-
- }
- //Only check if it is to turn off or not
- if (auditLevelProp != null && auditLevelProp.equalsIgnoreCase(Level.OFF.toString())){
-
- PolicyLogger.setAuditLevel(Level.valueOf(auditLevelProp));
-
- }
-
- if(isOverrideLogbackLevel){
-
- debugLogger.setLevel(debugLevel);
- metricsLogger.setLevel(metricsLevel);
- auditLogger.setLevel(auditLevel);
- errorLogger.setLevel(errorLevel);
-
+ isEventTrackerRunning = false;
+
+ }
+
+ /**
+ * Loads all the attributes from policyLogger.properties file
+ */
+ public static LoggerType init(Properties properties) {
+
+ Properties loggerProperties;
+ if (properties != null) {
+ loggerProperties = properties;
+ } else {
+ System.err.println("PolicyLogger cannot find its configuration - continue");
+ loggerProperties = new Properties();
+ }
+
+ LoggerType loggerType = LoggerType.EELF;
+
+ // fetch and verify definitions of some properties
+ try {
+
+ final int timerDelayTimeProp =
+ Integer.parseInt(loggerProperties.getProperty("timer.delay.time", Integer.toString(1000)));
+ final int checkIntervalProp =
+ Integer.parseInt(loggerProperties.getProperty("check.interval", Integer.toString(30000)));
+ final int expiredDateProp =
+ Integer.parseInt(loggerProperties.getProperty("event.expired.time", Integer.toString(86400)));
+ final int concurrentHashMapLimitProp =
+ Integer.parseInt(loggerProperties.getProperty("concurrentHashMap.limit", Integer.toString(5000)));
+ final int stopCheckPointProp =
+ Integer.parseInt(loggerProperties.getProperty("stop.check.point", Integer.toString(2500)));
+ final String loggerTypeProp = loggerProperties.getProperty("logger.type", loggerType.toString());
+
+ final String debugLevelProp = loggerProperties.getProperty("debugLogger.level", "INFO");
+ final String metricsLevelProp = loggerProperties.getProperty("metricsLogger.level", "ON");
+ final String auditLevelProp = loggerProperties.getProperty("audit.level", "ON");
+ final String errorLevelProp = loggerProperties.getProperty("error.level", "ON");
+ component = loggerProperties.getProperty("policy.component", "DROOLS");
+ final String overrideLogbackLevel = loggerProperties.getProperty("override.logback.level.setup");
+
+ if (overrideLogbackLevel != null && !overrideLogbackLevel.isEmpty()) {
+ if ("TRUE".equalsIgnoreCase(overrideLogbackLevel)) {
+ isOverrideLogbackLevel = true;
+ } else {
+ isOverrideLogbackLevel = false;
+ }
+ }
+
+
+ if (debugLevelProp != null && !debugLevelProp.isEmpty()) {
+
+ PolicyLogger.setDebugLevel(Level.valueOf(debugLevelProp));
+
+ }
+ // Only check if it is to turn off or not
+ if (errorLevelProp != null && errorLevelProp.equalsIgnoreCase(Level.OFF.toString())) {
+
+ PolicyLogger.setErrorLevel(Level.valueOf(errorLevelProp));
+
+ }
+ // Only check if it is to turn off or not
+ if (metricsLevelProp != null && metricsLevelProp.equalsIgnoreCase(Level.OFF.toString())) {
+
+ PolicyLogger.setMetricsLevel(Level.valueOf(metricsLevelProp));
+
+ }
+ // Only check if it is to turn off or not
+ if (auditLevelProp != null && auditLevelProp.equalsIgnoreCase(Level.OFF.toString())) {
+
+ PolicyLogger.setAuditLevel(Level.valueOf(auditLevelProp));
+
+ }
+
+ if (isOverrideLogbackLevel) {
+
+ debugLogger.setLevel(debugLevel);
+ metricsLogger.setLevel(metricsLevel);
+ auditLogger.setLevel(auditLevel);
+ errorLogger.setLevel(errorLevel);
+
}
- isEventTrackerRunning = false;
-
- debugLogger.info("timerDelayTime value: " + timerDelayTimeProp);
-
- debugLogger.info("checkInterval value: " + checkIntervalProp);
-
- debugLogger.info("expiredDate value: " + expiredDateProp);
-
- debugLogger.info("concurrentHashMapLimit value: " + concurrentHashMapLimitProp);
-
- debugLogger.info("loggerType value: " + loggerTypeProp);
-
- debugLogger.info("debugLogger level: " + debugLevelProp);
-
- debugLogger.info("component: " + component);
-
- if (timerDelayTimeProp > 0){
-
- timerDelayTime = timerDelayTimeProp;
-
- }else {
- MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
- if(ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null){
- MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
- MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
-
- }
- errorLogger.error("failed to get the timer.delay.time, so use its default value: " + timerDelayTime);
- }
-
- if (checkIntervalProp > 0){
-
- checkInterval = checkIntervalProp;
-
- }else {
- MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
- if(ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null){
- MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
- MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
-
- }
- errorLogger.error("failed to get the check.interval, so use its default value: " + checkInterval);
- }
-
- if (expiredDateProp > 0){
-
- expiredTime = expiredDateProp;
-
- }else {
- MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
-
- if(ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null){
- MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
- MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
-
- }
- errorLogger.error("failed to get the event.expired.time, so use its default value: " + expiredTime);
- }
-
- if (concurrentHashMapLimitProp > 0){
-
- concurrentHashMapLimit = concurrentHashMapLimitProp;
-
- }else {
- MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
- if(ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null){
- MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
- MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
-
- }
- errorLogger.error("failed to get the concurrentHashMap.limit, so use its default value: " + concurrentHashMapLimit);
- }
-
- if (stopCheckPointProp > 0){
-
- stopCheckPoint = stopCheckPointProp;
-
- }else {
- MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
- if(ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null){
- MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
- MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
-
- }
- errorLogger.error("failed to get the stop.check.point, so use its default value: " + stopCheckPoint);
- }
-
- if (loggerTypeProp != null){
-
- if ("EELF".equalsIgnoreCase(loggerTypeProp)){
-
- loggerType = LoggerType.EELF;
-
- }else if ("LOG4J".equalsIgnoreCase(loggerTypeProp)){
-
- loggerType = LoggerType.LOG4J;
-
- }else if ("SYSTEMOUT".equalsIgnoreCase(loggerTypeProp)){
-
- loggerType = LoggerType.SYSTEMOUT;
-
- }
-
- }
-
- if (debugLevelProp != null && !debugLevelProp.isEmpty()){
-
- debugLevel = Level.valueOf(debugLevelProp);
-
- }
- //Only check if it is to turn off or not
- if (errorLevelProp != null && errorLevelProp.equalsIgnoreCase(Level.OFF.toString())){
-
- errorLevel = Level.valueOf(errorLevelProp);
-
- }
- //Only check if it is to turn off or not
- if (metricsLevelProp != null && metricsLevelProp.equalsIgnoreCase(Level.OFF.toString())){
-
- metricsLevel = Level.valueOf(metricsLevelProp);
-
- }
- //Only check if it is to turn off or not
- if (auditLevelProp != null && auditLevelProp.equalsIgnoreCase(Level.OFF.toString())){
-
- auditLevel = Level.valueOf(auditLevelProp);
-
- }
-
- }catch(Exception e){
- MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
-
- if(ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null){
- MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
- MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
-
- }
- errorLogger.error("failed to get the policyLogger.properties, so use their default values",e);
- }
-
- return loggerType;
-
- }
-
- /**
- * Sets Debug Level
- */
- public static void setDebugLevel(String newDebugLevel){
-
- if(isOverrideLogbackLevel){
- PolicyLogger.debugLevel = Level.valueOf(newDebugLevel);
- debugLogger.setLevel(debugLevel);
- }
-
- }
-
- /**
- * Sets Error OFF or ON
- */
- public static void setErrorLevel(String newErrorLevel){
-
- if(isOverrideLogbackLevel){
- if("OFF".equalsIgnoreCase(newErrorLevel)){
- PolicyLogger.errorLevel = Level.OFF;
- errorLogger.setLevel(errorLevel);
- }else{
- //--- set default value
- errorLogger.setLevel(Level.ERROR);
- PolicyLogger.errorLevel = Level.ERROR;
- }
- }
- }
-
- /**
- * Sets Metrics OFF or ON
- */
- public static void setMetricsLevel(String newMetricsLevel){
-
- if(isOverrideLogbackLevel){
- if("OFF".equalsIgnoreCase(newMetricsLevel)){
- PolicyLogger.metricsLevel = Level.OFF;
- metricsLogger.setLevel(metricsLevel);
- }else {
- //--- set default value
- metricsLogger.setLevel(Level.INFO);
- PolicyLogger.metricsLevel = Level.INFO;
- }
- }
-
- }
-
- /**
- * Sets Audit OFF or ON
- */
- public static void setAuditLevel(String newAuditLevel){
-
- if(isOverrideLogbackLevel){
- if("OFF".equalsIgnoreCase(newAuditLevel)){
- PolicyLogger.auditLevel = Level.OFF;
- auditLogger.setLevel(auditLevel);
- }else {
- //--- set default value
- auditLogger.setLevel(Level.INFO);
- PolicyLogger.auditLevel = Level.INFO;
- }
- }
- }
-
- /**
- * Returns true for overriding logback levels; returns false for not
- */
- public static boolean isOverrideLogbackLevel(){
-
- return isOverrideLogbackLevel;
- }
-
- /**
- * Sets true for overriding logback levels; sets false for not
- */
- public static void setOverrideLogbackLevel(boolean odl){
-
- isOverrideLogbackLevel = odl;
-
- }
- /**
- * Sets server information to MDC
- */
- public static void setServerInfo(String serverHost, String serverPort){
- MDC.put(SERVER_NAME, serverHost+":"+serverPort);
- }
+ isEventTrackerRunning = false;
+
+ debugLogger.info("timerDelayTime value: " + timerDelayTimeProp);
+
+ debugLogger.info("checkInterval value: " + checkIntervalProp);
+
+ debugLogger.info("expiredDate value: " + expiredDateProp);
+
+ debugLogger.info("concurrentHashMapLimit value: " + concurrentHashMapLimitProp);
+
+ debugLogger.info("loggerType value: " + loggerTypeProp);
+
+ debugLogger.info("debugLogger level: " + debugLevelProp);
+
+ debugLogger.info("component: " + component);
+
+ if (timerDelayTimeProp > 0) {
+
+ timerDelayTime = timerDelayTimeProp;
+
+ } else {
+ MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
+ if (ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null) {
+ MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
+ MDC.put(ERROR_DESCRIPTION,
+ ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
+
+ }
+ errorLogger.error("failed to get the timer.delay.time, so use its default value: " + timerDelayTime);
+ }
+
+ if (checkIntervalProp > 0) {
+
+ checkInterval = checkIntervalProp;
+
+ } else {
+ MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
+ if (ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null) {
+ MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
+ MDC.put(ERROR_DESCRIPTION,
+ ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
+
+ }
+ errorLogger.error("failed to get the check.interval, so use its default value: " + checkInterval);
+ }
+
+ if (expiredDateProp > 0) {
+
+ expiredTime = expiredDateProp;
+
+ } else {
+ MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
+
+ if (ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null) {
+ MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
+ MDC.put(ERROR_DESCRIPTION,
+ ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
+
+ }
+ errorLogger.error("failed to get the event.expired.time, so use its default value: " + expiredTime);
+ }
+
+ if (concurrentHashMapLimitProp > 0) {
+
+ concurrentHashMapLimit = concurrentHashMapLimitProp;
+
+ } else {
+ MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
+ if (ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null) {
+ MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
+ MDC.put(ERROR_DESCRIPTION,
+ ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
+
+ }
+ errorLogger.error("failed to get the concurrentHashMap.limit, so use its default value: "
+ + concurrentHashMapLimit);
+ }
+
+ if (stopCheckPointProp > 0) {
+
+ stopCheckPoint = stopCheckPointProp;
+
+ } else {
+ MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
+ if (ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null) {
+ MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
+ MDC.put(ERROR_DESCRIPTION,
+ ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
+
+ }
+ errorLogger.error("failed to get the stop.check.point, so use its default value: " + stopCheckPoint);
+ }
+
+ if (loggerTypeProp != null) {
+
+ if ("EELF".equalsIgnoreCase(loggerTypeProp)) {
+
+ loggerType = LoggerType.EELF;
+
+ } else if ("LOG4J".equalsIgnoreCase(loggerTypeProp)) {
+
+ loggerType = LoggerType.LOG4J;
+
+ } else if ("SYSTEMOUT".equalsIgnoreCase(loggerTypeProp)) {
+
+ loggerType = LoggerType.SYSTEMOUT;
+
+ }
+
+ }
+
+ if (debugLevelProp != null && !debugLevelProp.isEmpty()) {
+
+ debugLevel = Level.valueOf(debugLevelProp);
+
+ }
+ // Only check if it is to turn off or not
+ if (errorLevelProp != null && errorLevelProp.equalsIgnoreCase(Level.OFF.toString())) {
+
+ errorLevel = Level.valueOf(errorLevelProp);
+
+ }
+ // Only check if it is to turn off or not
+ if (metricsLevelProp != null && metricsLevelProp.equalsIgnoreCase(Level.OFF.toString())) {
+
+ metricsLevel = Level.valueOf(metricsLevelProp);
+
+ }
+ // Only check if it is to turn off or not
+ if (auditLevelProp != null && auditLevelProp.equalsIgnoreCase(Level.OFF.toString())) {
+
+ auditLevel = Level.valueOf(auditLevelProp);
+
+ }
+
+ } catch (Exception e) {
+ MDC.put(ERROR_CATEGORY, ERROR_CATEGORY_VALUE);
+
+ if (ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR) != null) {
+ MDC.put(ERROR_CODE, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorCode());
+ MDC.put(ERROR_DESCRIPTION, ErrorCodeMap.getErrorCodeInfo(MessageCodes.GENERAL_ERROR).getErrorDesc());
+
+ }
+ errorLogger.error("failed to get the policyLogger.properties, so use their default values", e);
+ }
+
+ return loggerType;
+
+ }
+
+
+ /**
+ * Returns true for overriding logback levels; returns false for not.
+ */
+ public static boolean isOverrideLogbackLevel() {
+
+ return isOverrideLogbackLevel;
+ }
+
+ /**
+ * Sets true for overriding logback levels; sets false for not.
+ */
+ public static void setOverrideLogbackLevel(boolean odl) {
+
+ isOverrideLogbackLevel = odl;
+
+ }
+
+ /**
+ * Sets server information to MDC.
+ */
+ public static void setServerInfo(String serverHost, String serverPort) {
+ MDC.put(SERVER_NAME, serverHost + ":" + serverPort);
+ }
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/EelfLogger.java b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/EelfLogger.java
index 07ef5626..e0c4144b 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/EelfLogger.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/EelfLogger.java
@@ -20,461 +20,498 @@
package org.onap.policy.common.logging.flexlogger;
+import com.att.eelf.configuration.EELFLogger.Level;
+
import java.io.Serializable;
import java.util.UUID;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
-import com.att.eelf.configuration.EELFLogger.Level;
/**
- *
- * EelfLogger implements all the methods of interface Logger by calling PolicyLogger methods
- *
+ * EelfLogger implements all the methods of interface Logger by calling PolicyLogger methods.
*/
public class EelfLogger implements Logger, Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 5385586713941277192L;
- private String className = "";
+
+ private static final long serialVersionUID = 5385586713941277192L;
+ private String className = "";
private String transId = UUID.randomUUID().toString();
-
- /**
- * Constructor
- * @param clazz
- */
- public EelfLogger(Class<?> clazz) {
- if(clazz != null){
- className = clazz.getName();
- }
- PolicyLogger.postMDCInfoForEvent(null);
- }
-
- /**
- * Constructor
- * @param s
- */
- public EelfLogger(String s) {
- if(s != null){
- className = s;
- }
- PolicyLogger.postMDCInfoForEvent(null);
- }
-
- /**
- * Constructor
- * @param clazz
- * @param isNewTransaction
- */
- public EelfLogger(Class<?> clazz, boolean isNewTransaction) {
- if(clazz != null){
- className = clazz.getName();
- }
- if(isNewTransaction){
- transId = PolicyLogger.postMDCInfoForEvent(null);
- }else{
- transId = PolicyLogger.getTransId();
- }
- }
-
- /**
- * Constructor
- * @param s
- * @param isNewTransaction
- */
- public EelfLogger(String s, boolean isNewTransaction) {
- if(s != null){
- className = s;
- }
- if(isNewTransaction){
- transId = PolicyLogger.postMDCInfoForEvent(null);
- }else{
- transId = PolicyLogger.getTransId();
- }
- }
-
- /**
- * Constructor
- * @param clazz
- * @param transId
- */
- public EelfLogger(Class<?> clazz, String transId) {
- if(clazz != null){
- className = clazz.getName();
- }
- PolicyLogger.postMDCInfoForEvent(transId);
- this.transId = transId;
- }
-
- /**
- * Constructor
- * @param s
- * @param transId
- */
- public EelfLogger(String s, String transId) {
- if(s != null){
- className = s;
- }
- PolicyLogger.postMDCInfoForEvent(transId);
- this.transId = transId;
- }
-
- /**
- * Sets transaction Id for logging
- * @param transId
- */
- @Override
- public void setTransId(String transId){
-
- PolicyLogger.setTransId(transId);
- this.transId = transId;
- }
-
- /**
- * Returns transaction Id for logging
- */
- @Override
- public String getTransId(){
- return transId;
- }
-
- /**
- * Records a message
- * @param message
- */
- @Override
- public void debug(Object message) {
- PolicyLogger.debug(className, ""+message);
- }
-
- /**
- * Records an error message
- * @param message
- */
- @Override
- public void error(Object message) {
- PolicyLogger.error(className, ""+message);
- }
-
- /**
- * Records a message
- * @param message
- */
- @Override
- public void info(Object message) {
- PolicyLogger.info(className, ""+message);
- }
-
- /**
- * Records a message
- * @param message
- */
- @Override
- public void warn(Object message) {
- PolicyLogger.warn(className, ""+message);
- }
-
- /**
- * Records a message
- * @param message
- */
- @Override
- public void trace(Object message) {
- PolicyLogger.trace(className, ""+message);
- }
-
- /**
- * Returns true for debug enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isDebugEnabled(){
- return PolicyLogger.isDebugEnabled();
- }
-
- /**
- * Returns true for info enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isInfoEnabled(){
- return PolicyLogger.isInfoEnabled();
- }
-
- /**
- * Returns true for warn enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isWarnEnabled(){
- return PolicyLogger.isWarnEnabled();
- }
-
- /**
- * Returns true for error enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isErrorEnabled(){
- return PolicyLogger.isErrorEnabled();
- }
-
- /**
- * Returns true for audit enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isAuditEnabled(){
- return(PolicyLogger.getAuditLevel() != Level.OFF);
- }
-
- /**
- * Returns true for metrics enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isMetricsEnabled(){
- return(PolicyLogger.getMetricsLevel() != Level.OFF);
- }
-
- /**
- * Returns true for trace enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isTraceEnabled(){
- return PolicyLogger.isDebugEnabled();
- }
-
- /**
- * Records an audit message
- * @param arg0
- */
- @Override
- public void audit(Object arg0) {
- PolicyLogger.audit(className, ""+ arg0);
- }
-
- /**
- * Records a message
- * @param message
- * @param t
- */
- @Override
- public void debug(Object message, Throwable t) {
- PolicyLogger.debug(MessageCodes.GENERAL_INFO, t, message.toString());
- }
-
- /**
- * Records an error message
- * @param message
- * @param t
- */
- @Override
- public void error(Object message, Throwable t) {
- PolicyLogger.error(MessageCodes.ERROR_UNKNOWN, t, message.toString());
- }
-
- /**
- * Records a message
- * @param message
- * @param t
- */
- @Override
- public void info(Object message, Throwable t) {
- PolicyLogger.info(MessageCodes.GENERAL_INFO, t, message.toString());
- }
-
- /**
- * Records a message
- * @param message
- * @param t
- */
- @Override
- public void warn(Object message, Throwable t) {
- PolicyLogger.warn(MessageCodes.GENERAL_WARNING, t, message.toString());
- }
-
- /**
- * Records a message
- * @param message
- * @param t
- */
- @Override
- public void trace(Object message, Throwable t) {
- PolicyLogger.trace(message);
- }
-
- /**
- * Records an audit message
- * @param arg0
- * @param t
- */
- @Override
- public void audit(Object arg0, Throwable t) {
- PolicyLogger.audit(arg0);
- }
-
- /**
- * Records an audit message
- * @param eventId
- */
- @Override
- public void recordAuditEventStart(String eventId) {
- PolicyLogger.recordAuditEventStart(eventId);
- }
-
- /**
- * Records an audit message
- * @param eventId
- */
- @Override
- public void recordAuditEventStart(UUID eventId) {
- PolicyLogger.recordAuditEventStart(eventId);
- }
-
- /**
- * Records an audit message
- * @param eventId
- * @param rule
- * @param policyVersion
- */
- @Override
- public void recordAuditEventEnd(String eventId, String rule, String policyVersion) {
- PolicyLogger.recordAuditEventEnd(eventId, rule, policyVersion);
- }
-
- /**
- * Records an audit message
- * @param eventId
- * @param rule
- * @param policyVersion
- */
- @Override
- public void recordAuditEventEnd(UUID eventId, String rule, String policyVersion) {
- PolicyLogger.recordAuditEventEnd(eventId, rule, policyVersion);
- }
-
- /**
- * Records an audit message
- * @param eventId
- * @param rule
- */
- @Override
- public void recordAuditEventEnd(String eventId, String rule) {
- PolicyLogger.recordAuditEventEnd(eventId, rule);
- }
-
- /**
- * Records an audit message
- * @param eventId
- * @param rule
- */
- @Override
- public void recordAuditEventEnd(UUID eventId, String rule) {
- PolicyLogger.recordAuditEventEnd(eventId, rule);
- }
-
- /**
- * Records a metrics message
- * @param eventId
- * @param arg1
- */
- @Override
- public void recordMetricEvent(String eventId, String arg1) {
- PolicyLogger.recordMetricEvent(eventId, arg1);
- }
-
- /**
- * Records a metrics message
- * @param eventId
- * @param arg1
- */
- @Override
- public void recordMetricEvent(UUID eventId, String arg1) {
- PolicyLogger.recordMetricEvent(eventId, arg1);
- }
-
- /**
- * Records a metrics message
- * @param arg0
- */
- @Override
- public void metrics(Object arg0) {
- PolicyLogger.metrics(className, arg0);
- }
-
- /**
- * Records an error message
- * @param msg
- * @param arg0
- * @param arguments
- */
- @Override
- public void error(MessageCodes msg, Throwable arg0, String... arguments){
- PolicyLogger.error(msg, className, arg0, arguments);
- }
-
- /**
- * Records an error message
- * @param msg
- * @param arguments
- */
- @Override
- public void error(MessageCodes msg, String... arguments){
- PolicyLogger.error(msg, arguments);
- }
-
- /**
- * Populates MDC Info
- * @param transId
- */
- @Override
- public String postMDCInfoForEvent(String transId) {
- return PolicyLogger.postMDCInfoForEvent(transId);
-
- }
-
- /**
- * Records a message
- * @param msg
- * @param arguments
- */
- @Override
- public void warn(MessageCodes msg, String... arguments){
- PolicyLogger.warn(msg, className, arguments);
- }
-
- /**
- * Records a message
- * @param msg
- * @param arg0
- * @param arguments
- */
- @Override
- public void warn(MessageCodes msg, Throwable arg0, String... arguments){
- PolicyLogger.warn(msg, className, arg0, arguments);
- }
-
- /**
- * Populates MDC Info for the rule triggered
- * @param transId
- */
- @Override
- public void postMDCInfoForTriggeredRule(String transId){
- PolicyLogger.postMDCInfoForTriggeredRule(transId);
- }
-
- /**
- * Populates MDC Info
- * @param o
- */
- @Override
- public void postMDCInfoForEvent(Object o){
- PolicyLogger.postMDCInfoForEvent(o);
- }
+
+ /**
+ * Constructor.
+ *
+ * @param clazz the class
+ */
+ public EelfLogger(Class<?> clazz) {
+ if (clazz != null) {
+ className = clazz.getName();
+ }
+ PolicyLogger.postMDCInfoForEvent(null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param className the class name
+ */
+ public EelfLogger(String className) {
+ if (className != null) {
+ this.className = className;
+ }
+ PolicyLogger.postMDCInfoForEvent(null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param clazz the class
+ * @param isNewTransaction is a new transaction
+ */
+ public EelfLogger(Class<?> clazz, boolean isNewTransaction) {
+ if (clazz != null) {
+ className = clazz.getName();
+ }
+ if (isNewTransaction) {
+ transId = PolicyLogger.postMDCInfoForEvent(null);
+ } else {
+ transId = PolicyLogger.getTransId();
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param className the class name
+ * @param isNewTransaction is a new transaction
+ */
+ public EelfLogger(String className, boolean isNewTransaction) {
+ if (className != null) {
+ this.className = className;
+ }
+ if (isNewTransaction) {
+ transId = PolicyLogger.postMDCInfoForEvent(null);
+ } else {
+ transId = PolicyLogger.getTransId();
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param clazz the class
+ * @param transId the transaction ID
+ */
+ public EelfLogger(Class<?> clazz, String transId) {
+ if (clazz != null) {
+ className = clazz.getName();
+ }
+ PolicyLogger.postMDCInfoForEvent(transId);
+ this.transId = transId;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param className the class name
+ * @param transId the transaction ID
+ */
+ public EelfLogger(String className, String transId) {
+ if (className != null) {
+ this.className = className;
+ }
+ PolicyLogger.postMDCInfoForEvent(transId);
+ this.transId = transId;
+ }
+
+ /**
+ * Sets transaction Id for logging.
+ *
+ * @param transId the transaction ID
+ */
+ @Override
+ public void setTransId(String transId) {
+
+ PolicyLogger.setTransId(transId);
+ this.transId = transId;
+ }
+
+ /**
+ * Returns transaction Id for logging.
+ */
+ @Override
+ public String getTransId() {
+ return transId;
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void debug(Object message) {
+ PolicyLogger.debug(className, "" + message);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void debug(Object message, Throwable throwable) {
+ PolicyLogger.debug(MessageCodes.GENERAL_INFO, throwable, message.toString());
+ }
+
+ /**
+ * Records an error message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void error(Object message) {
+ PolicyLogger.error(className, "" + message);
+ }
+
+ /**
+ * Records an error message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void error(Object message, Throwable throwable) {
+ PolicyLogger.error(MessageCodes.ERROR_UNKNOWN, throwable, message.toString());
+ }
+
+ /**
+ * Records an error message.
+ *
+ * @param msg the message code
+ * @param throwable the throwable
+ * @param arguments the messages
+ */
+ @Override
+ public void error(MessageCodes msg, Throwable throwable, String... arguments) {
+ PolicyLogger.error(msg, className, throwable, arguments);
+ }
+
+ /**
+ * Records an error message.
+ *
+ * @param msg the message code
+ * @param arguments the messages
+ */
+ @Override
+ public void error(MessageCodes msg, String... arguments) {
+ PolicyLogger.error(msg, arguments);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void info(Object message) {
+ PolicyLogger.info(className, "" + message);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void info(Object message, Throwable throwable) {
+ PolicyLogger.info(MessageCodes.GENERAL_INFO, throwable, message.toString());
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void warn(Object message) {
+ PolicyLogger.warn(className, "" + message);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void warn(Object message, Throwable throwable) {
+ PolicyLogger.warn(MessageCodes.GENERAL_WARNING, throwable, message.toString());
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param msg the message codes
+ * @param arguments the messages
+ */
+ @Override
+ public void warn(MessageCodes msg, String... arguments) {
+ PolicyLogger.warn(msg, className, arguments);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param msg the message
+ * @param throwable the throwable
+ * @param arguments the messages
+ */
+ @Override
+ public void warn(MessageCodes msg, Throwable throwable, String... arguments) {
+ PolicyLogger.warn(msg, className, throwable, arguments);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void trace(Object message) {
+ PolicyLogger.trace(className, "" + message);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void trace(Object message, Throwable throwable) {
+ PolicyLogger.trace(message);
+ }
+
+ /**
+ * Returns true for debug enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isDebugEnabled() {
+ return PolicyLogger.isDebugEnabled();
+ }
+
+ /**
+ * Returns true for info enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isInfoEnabled() {
+ return PolicyLogger.isInfoEnabled();
+ }
+
+ /**
+ * Returns true for warn enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isWarnEnabled() {
+ return PolicyLogger.isWarnEnabled();
+ }
+
+ /**
+ * Returns true for error enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isErrorEnabled() {
+ return PolicyLogger.isErrorEnabled();
+ }
+
+ /**
+ * Returns true for audit enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isAuditEnabled() {
+ return (PolicyLogger.getAuditLevel() != Level.OFF);
+ }
+
+ /**
+ * Returns true for metrics enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isMetricsEnabled() {
+ return (PolicyLogger.getMetricsLevel() != Level.OFF);
+ }
+
+ /**
+ * Returns true for trace enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isTraceEnabled() {
+ return PolicyLogger.isDebugEnabled();
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param arg0 the message
+ */
+ @Override
+ public void audit(Object arg0) {
+ PolicyLogger.audit(className, "" + arg0);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void audit(Object message, Throwable throwable) {
+ PolicyLogger.audit(message);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ */
+ @Override
+ public void recordAuditEventStart(String eventId) {
+ PolicyLogger.recordAuditEventStart(eventId);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ */
+ @Override
+ public void recordAuditEventStart(UUID eventId) {
+ PolicyLogger.recordAuditEventStart(eventId);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ * @param policyVersion the policy cersion
+ */
+ @Override
+ public void recordAuditEventEnd(String eventId, String rule, String policyVersion) {
+ PolicyLogger.recordAuditEventEnd(eventId, rule, policyVersion);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ * @param policyVersion the policy version
+ */
+ @Override
+ public void recordAuditEventEnd(UUID eventId, String rule, String policyVersion) {
+ PolicyLogger.recordAuditEventEnd(eventId, rule, policyVersion);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ */
+ @Override
+ public void recordAuditEventEnd(String eventId, String rule) {
+ PolicyLogger.recordAuditEventEnd(eventId, rule);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ */
+ @Override
+ public void recordAuditEventEnd(UUID eventId, String rule) {
+ PolicyLogger.recordAuditEventEnd(eventId, rule);
+ }
+
+ /**
+ * Records a metrics message.
+ *
+ * @param eventId the event ID
+ * @param message the message
+ */
+ @Override
+ public void recordMetricEvent(String eventId, String message) {
+ PolicyLogger.recordMetricEvent(eventId, message);
+ }
+
+ /**
+ * Records a metrics message.
+ *
+ * @param eventId the event ID
+ * @param message the message
+ */
+ @Override
+ public void recordMetricEvent(UUID eventId, String message) {
+ PolicyLogger.recordMetricEvent(eventId, message);
+ }
+
+ /**
+ * Records a metrics message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void metrics(Object message) {
+ PolicyLogger.metrics(className, message);
+ }
+
+ /**
+ * Populates MDC Info.
+ *
+ * @param transId the transaction ID
+ */
+ @Override
+ public String postMDCInfoForEvent(String transId) {
+ return PolicyLogger.postMDCInfoForEvent(transId);
+ }
+
+ /**
+ * Populates MDC Info.
+ *
+ * @param obj the object
+ */
+ @Override
+ public void postMDCInfoForEvent(Object obj) {
+ PolicyLogger.postMDCInfoForEvent(obj);
+ }
+
+ /**
+ * Populates MDC Info for the rule triggered.
+ *
+ * @param transId the transaction ID
+ */
+ @Override
+ public void postMDCInfoForTriggeredRule(String transId) {
+ PolicyLogger.postMDCInfoForTriggeredRule(transId);
+ }
+
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/FlexLogger.java b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/FlexLogger.java
index 9723755e..90240a77 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/FlexLogger.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/FlexLogger.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,300 +32,305 @@ import org.onap.policy.common.logging.eelf.PolicyLogger;
import org.onap.policy.common.logging.flexlogger.PropertyUtil.Listener;
/**
- *
- * FlexLogger acts as factory to generate instances of Logger based on logger type
- *
+ * FlexLogger acts as factory to generate instances of Logger based on logger type.
*/
-public class FlexLogger extends SecurityManager{
+public class FlexLogger extends SecurityManager {
- private static final String GET_LOGGER_PREFIX = "FlexLogger:getLogger : loggerType = ";
- private static LoggerType loggerType = LoggerType.EELF;
+ private static final String GET_LOGGER_PREFIX = "FlexLogger:getLogger : loggerType = ";
+ private static LoggerType loggerType = LoggerType.EELF;
private static ConcurrentHashMap<String, Logger4J> logger4JMap = new ConcurrentHashMap<>();
private static ConcurrentHashMap<String, EelfLogger> eelfLoggerMap = new ConcurrentHashMap<>();
private static ConcurrentHashMap<String, SystemOutLogger> systemOutMap = new ConcurrentHashMap<>();
- //--- init logger first
- static {
- loggerType = initlogger();
- }
-
- /**
- * Returns an instance of Logger
- * @param clazz
- */
- public static Logger getLogger(Class<?> clazz) {
- Logger logger = null;
- System.out.println(GET_LOGGER_PREFIX + loggerType);
- switch (loggerType) {
-
- case EELF:
- logger = getEelfLogger(clazz, false);
- break;
- case LOG4J:
- logger = getLog4JLogger();
- break;
- case SYSTEMOUT:
- logger = getSystemOutLogger();
- break;
- }
-
- return logger;
-
- }
-
- /**
- * Returns an instance of Logger
- * @param s
- */
- public static Logger getLogger(String s) {
- Logger logger = null;
- System.out.println(GET_LOGGER_PREFIX + loggerType);
- switch (loggerType) {
-
- case EELF:
- logger = getEelfLogger(null,false);
- break;
- case LOG4J:
- logger = getLog4JLogger(s);
- break;
- case SYSTEMOUT:
- logger = getSystemOutLogger();
- break;
- }
-
- return logger;
-
- }
-
- /**
- * Returns an instance of Logger
- * @param clazz
- * @param isNewTransaction
- */
- public static Logger getLogger(Class<?> clazz, boolean isNewTransaction) {
- Logger logger = null;
- System.out.println(GET_LOGGER_PREFIX + loggerType);
- switch (loggerType) {
-
- case EELF:
- logger = getEelfLogger(clazz, isNewTransaction);
- break;
- case LOG4J:
- logger = getLog4JLogger();
- break;
- case SYSTEMOUT:
- logger = getSystemOutLogger();
- break;
- }
-
- return logger;
-
- }
-
- /**
- * Returns an instance of Logger
- * @param s
- * @param isNewTransaction
- */
- public static Logger getLogger(String s, boolean isNewTransaction) {
- Logger logger = null;
- System.out.println(GET_LOGGER_PREFIX + loggerType);
- switch (loggerType) {
-
- case EELF:
- logger = getEelfLogger(null, isNewTransaction);
- break;
- case LOG4J:
- logger = getLog4JLogger(s);
- break;
- case SYSTEMOUT:
- logger = getSystemOutLogger();
- break;
- }
-
- return logger;
- }
-
- /**
- * Returns the calling class name
- */
- public String getClassName(){
- System.out.println("getClassContext()[3].getName() " + getClassContext()[3].getName());
- return getClassContext()[3].getName();
- }
-
- /**
- * Returns an instance of Logger4J
- * @param clazz
- */
- private static Logger4J getLog4JLogger(){
- String className = new FlexLogger().getClassName();
-
- if(!logger4JMap.containsKey(className)){
- //for 1610 release use the default debug.log for log4j
- Logger4J logger = new Logger4J("debugLogger", className);
- logger4JMap.put(className, logger);
- }
-
- return logger4JMap.get(className);
- }
-
- /**
- * Returns an instance of Logger4J
- * @param s
- */
- private static Logger4J getLog4JLogger(String s){
- String className = new FlexLogger().getClassName();
-
- if(!logger4JMap.containsKey(className)){
- Logger4J logger = new Logger4J(s, className);
- logger4JMap.put(className, logger);
- }
-
- return logger4JMap.get(className);
- }
-
- /**
- * Returns an instance of EelfLogger
- * @param clazz
- * @param isNewTransaction
- */
- private static EelfLogger getEelfLogger(Class<?> clazz, boolean isNewTransaction){
-
- String className;
- EelfLogger logger;
- if(clazz != null){
- className = clazz.getName();
- }else{
- className = new FlexLogger().getClassName();
- }
-
- if(!eelfLoggerMap.containsKey(className)){
- logger = new EelfLogger(clazz, isNewTransaction);
- eelfLoggerMap.put(className, logger);
- }else{
- logger = eelfLoggerMap.get(className);
- if(logger == null){
- logger = new EelfLogger(clazz, isNewTransaction);
- eelfLoggerMap.put(className, logger);
- }
- //installl already created but it is new transaction
- if(isNewTransaction){
- String transId = PolicyLogger.postMDCInfoForEvent(null);
- logger.setTransId(transId);
- }
- }
- System.out.println("eelfLoggerMap size : " + eelfLoggerMap.size() + " class name: " + className);
- return logger;
- }
-
- /**
- * Returns an instance of SystemOutLogger
- * @param clazz
- */
- private static SystemOutLogger getSystemOutLogger(){
-
- String className = new FlexLogger().getClassName();
-
- if(!systemOutMap.containsKey(className)){
- SystemOutLogger logger = new SystemOutLogger(className);
- systemOutMap.put(className, logger);
- }
-
- return systemOutMap.get(className);
- }
-
- /**
- * loads the logger properties
- */
- private static LoggerType initlogger() {
- LoggerType loggerType = LoggerType.EELF;
- String overrideLogbackLevel = "FALSE";
- String loggerTypeString = "";
- Properties properties = null;
-
- try {
- properties = PropertyUtil.getProperties("config/policyLogger.properties");
- System.out.println("FlexLogger:properties => " + properties);
-
- if(properties != null) {
- overrideLogbackLevel = properties.getProperty("override.logback.level.setup");
- System.out.println("FlexLogger:overrideLogbackLevel => " + overrideLogbackLevel);
- loggerTypeString = properties.getProperty("logger.type");
- if (loggerTypeString != null){
- if ("EELF".equalsIgnoreCase(loggerTypeString)){
- loggerType = LoggerType.EELF;
- if ("TRUE".equalsIgnoreCase(overrideLogbackLevel)) {
- System.out.println("FlexLogger: start listener.");
- properties = PropertyUtil.getProperties
- ("config/policyLogger.properties",
- new PropertiesCallBack("FlexLogger-CallBack"));
- }
- }else if ("LOG4J".equalsIgnoreCase(loggerTypeString)){
- loggerType = LoggerType.LOG4J;
- }else if ("SYSTEMOUT".equalsIgnoreCase(loggerTypeString)){
- loggerType = LoggerType.SYSTEMOUT;
- }
-
- System.out.println("FlexLogger.logger_Type value: " + loggerTypeString);
- }
- }
- } catch (IOException e1) {
- System.out.println("initlogger" + e1);
- } finally {
- // OK to pass no properties (null)
- loggerType = PolicyLogger.init(properties);
- }
-
- return loggerType;
- }
-
- /**
- * PropertiesCallBack is listening any updates on the policyLogger.properties
- */
- public static class PropertiesCallBack implements Listener {
- String name;
-
- public PropertiesCallBack(String name) {
- this.name = name;
- }
-
- /**
- * This method will be called automatically if he policyLogger.properties got updated
- */
- @Override
- public void propertiesChanged(Properties properties,
- Set<String> changedKeys) {
-
- String debugLevel = properties.getProperty("debugLogger.level");
- String metricsLevel = properties.getProperty("metricsLogger.level");
- String auditLevel = properties.getProperty("audit.level");
- String errorLevel = properties.getProperty("error.level");
-
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS+00:00");
- Instant startTime = Instant.now();
- String formatedTime = sdf.format(Date.from(startTime));
- System.out.println("FlexLogger.propertiesChanged : called at time : " + formatedTime);
- System.out.println("FlexLogger.propertiesChanged : debugLevel : " + debugLevel);
-
- if (changedKeys != null) {
-
- if (changedKeys.contains("debugLogger.level")) {
- PolicyLogger.setDebugLevel(debugLevel);
- }
-
- if (changedKeys.contains("metricsLogger.level")) {
- PolicyLogger.setMetricsLevel(metricsLevel);
- }
-
- if (changedKeys.contains("error.level")) {
- PolicyLogger.setErrorLevel(errorLevel);
- }
-
- if (changedKeys.contains("audit.level")) {
- PolicyLogger.setAuditLevel(auditLevel);
- }
- }
- }
- }
-
+
+ // --- init logger first
+ static {
+ loggerType = initlogger();
+ }
+
+ /**
+ * Returns an instance of Logger.
+ *
+ * @param clazz the class
+ */
+ public static Logger getLogger(Class<?> clazz) {
+ Logger logger = null;
+ System.out.println(GET_LOGGER_PREFIX + loggerType);
+ switch (loggerType) {
+
+ case EELF:
+ logger = getEelfLogger(clazz, false);
+ break;
+ case LOG4J:
+ logger = getLog4JLogger();
+ break;
+ case SYSTEMOUT:
+ default:
+ logger = getSystemOutLogger();
+ break;
+ }
+
+ return logger;
+
+ }
+
+ /**
+ * Returns an instance of Logger.
+ *
+ * @param name the name of the logger
+ */
+ public static Logger getLogger(String name) {
+ Logger logger = null;
+ System.out.println(GET_LOGGER_PREFIX + loggerType);
+ switch (loggerType) {
+
+ case EELF:
+ logger = getEelfLogger(null, false);
+ break;
+ case LOG4J:
+ logger = getLog4JLogger(name);
+ break;
+ case SYSTEMOUT:
+ default:
+ logger = getSystemOutLogger();
+ break;
+ }
+
+ return logger;
+
+ }
+
+ /**
+ * Returns an instance of Logger.
+ *
+ * @param clazz the class
+ * @param isNewTransaction is a new transaction
+ */
+ public static Logger getLogger(Class<?> clazz, boolean isNewTransaction) {
+ Logger logger = null;
+ System.out.println(GET_LOGGER_PREFIX + loggerType);
+ switch (loggerType) {
+
+ case EELF:
+ logger = getEelfLogger(clazz, isNewTransaction);
+ break;
+ case LOG4J:
+ logger = getLog4JLogger();
+ break;
+ case SYSTEMOUT:
+ default:
+ logger = getSystemOutLogger();
+ break;
+ }
+
+ return logger;
+
+ }
+
+ /**
+ * Returns an instance of Logger.
+ *
+ * @param name the name of the logger
+ * @param isNewTransaction is a new transaction
+ */
+ public static Logger getLogger(String name, boolean isNewTransaction) {
+ Logger logger = null;
+ System.out.println(GET_LOGGER_PREFIX + loggerType);
+ switch (loggerType) {
+
+ case EELF:
+ logger = getEelfLogger(null, isNewTransaction);
+ break;
+ case LOG4J:
+ logger = getLog4JLogger(name);
+ break;
+ case SYSTEMOUT:
+ default:
+ logger = getSystemOutLogger();
+ break;
+ }
+
+ return logger;
+ }
+
+ /**
+ * Returns the calling class name.
+ */
+ public String getClassName() {
+ System.out.println("getClassContext()[3].getName() " + getClassContext()[3].getName());
+ return getClassContext()[3].getName();
+ }
+
+ /**
+ * Returns an instance of Logger4J.
+ */
+ private static Logger4J getLog4JLogger() {
+ String className = new FlexLogger().getClassName();
+
+ if (!logger4JMap.containsKey(className)) {
+ // for 1610 release use the default debug.log for log4j
+ Logger4J logger = new Logger4J("debugLogger", className);
+ logger4JMap.put(className, logger);
+ }
+
+ return logger4JMap.get(className);
+ }
+
+ /**
+ * Returns an instance of Logger4J.
+ *
+ * @param name the name of the logger
+ */
+ private static Logger4J getLog4JLogger(String name) {
+ String className = new FlexLogger().getClassName();
+
+ if (!logger4JMap.containsKey(className)) {
+ Logger4J logger = new Logger4J(name, className);
+ logger4JMap.put(className, logger);
+ }
+
+ return logger4JMap.get(className);
+ }
+
+ /**
+ * Returns an instance of EelfLogger.
+ *
+ * @param clazz the class
+ * @param isNewTransaction is a new transaction
+ */
+ private static EelfLogger getEelfLogger(Class<?> clazz, boolean isNewTransaction) {
+
+ String className;
+ EelfLogger logger;
+ if (clazz != null) {
+ className = clazz.getName();
+ } else {
+ className = new FlexLogger().getClassName();
+ }
+
+ if (!eelfLoggerMap.containsKey(className)) {
+ logger = new EelfLogger(clazz, isNewTransaction);
+ eelfLoggerMap.put(className, logger);
+ } else {
+ logger = eelfLoggerMap.get(className);
+ if (logger == null) {
+ logger = new EelfLogger(clazz, isNewTransaction);
+ eelfLoggerMap.put(className, logger);
+ }
+ // installl already created but it is new transaction
+ if (isNewTransaction) {
+ String transId = PolicyLogger.postMDCInfoForEvent(null);
+ logger.setTransId(transId);
+ }
+ }
+ System.out.println("eelfLoggerMap size : " + eelfLoggerMap.size() + " class name: " + className);
+ return logger;
+ }
+
+ /**
+ * Returns an instance of SystemOutLogger.
+ */
+ private static SystemOutLogger getSystemOutLogger() {
+
+ String className = new FlexLogger().getClassName();
+
+ if (!systemOutMap.containsKey(className)) {
+ SystemOutLogger logger = new SystemOutLogger(className);
+ systemOutMap.put(className, logger);
+ }
+
+ return systemOutMap.get(className);
+ }
+
+ /**
+ * loads the logger properties.
+ */
+ private static LoggerType initlogger() {
+ LoggerType loggerType = LoggerType.EELF;
+ String overrideLogbackLevel = "FALSE";
+ String loggerTypeString = "";
+ Properties properties = null;
+
+ try {
+ properties = PropertyUtil.getProperties("config/policyLogger.properties");
+ System.out.println("FlexLogger:properties => " + properties);
+
+ if (properties != null) {
+ overrideLogbackLevel = properties.getProperty("override.logback.level.setup");
+ System.out.println("FlexLogger:overrideLogbackLevel => " + overrideLogbackLevel);
+ loggerTypeString = properties.getProperty("logger.type");
+ if (loggerTypeString != null) {
+ if ("EELF".equalsIgnoreCase(loggerTypeString)) {
+ loggerType = LoggerType.EELF;
+ if ("TRUE".equalsIgnoreCase(overrideLogbackLevel)) {
+ System.out.println("FlexLogger: start listener.");
+ properties = PropertyUtil.getProperties("config/policyLogger.properties",
+ new PropertiesCallBack("FlexLogger-CallBack"));
+ }
+ } else if ("LOG4J".equalsIgnoreCase(loggerTypeString)) {
+ loggerType = LoggerType.LOG4J;
+ } else if ("SYSTEMOUT".equalsIgnoreCase(loggerTypeString)) {
+ loggerType = LoggerType.SYSTEMOUT;
+ }
+
+ System.out.println("FlexLogger.logger_Type value: " + loggerTypeString);
+ }
+ }
+ } catch (IOException e1) {
+ System.out.println("initlogger" + e1);
+ } finally {
+ // OK to pass no properties (null)
+ loggerType = PolicyLogger.init(properties);
+ }
+
+ return loggerType;
+ }
+
+ /**
+ * PropertiesCallBack is listening any updates on the policyLogger.properties
+ */
+ public static class PropertiesCallBack implements Listener {
+ String name;
+
+ public PropertiesCallBack(String name) {
+ this.name = name;
+ }
+
+ /**
+ * This method will be called automatically if he policyLogger.properties got updated
+ */
+ @Override
+ public void propertiesChanged(Properties properties, Set<String> changedKeys) {
+
+ String debugLevel = properties.getProperty("debugLogger.level");
+ String metricsLevel = properties.getProperty("metricsLogger.level");
+ String auditLevel = properties.getProperty("audit.level");
+ String errorLevel = properties.getProperty("error.level");
+
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS+00:00");
+ Instant startTime = Instant.now();
+ String formatedTime = sdf.format(Date.from(startTime));
+ System.out.println("FlexLogger.propertiesChanged : called at time : " + formatedTime);
+ System.out.println("FlexLogger.propertiesChanged : debugLevel : " + debugLevel);
+
+ if (changedKeys != null) {
+
+ if (changedKeys.contains("debugLogger.level")) {
+ PolicyLogger.setDebugLevel(debugLevel);
+ }
+
+ if (changedKeys.contains("metricsLogger.level")) {
+ PolicyLogger.setMetricsLevel(metricsLevel);
+ }
+
+ if (changedKeys.contains("error.level")) {
+ PolicyLogger.setErrorLevel(errorLevel);
+ }
+
+ if (changedKeys.contains("audit.level")) {
+ PolicyLogger.setAuditLevel(auditLevel);
+ }
+ }
+ }
+ }
+
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger.java b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger.java
index d3113d31..f74aca14 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,197 +25,196 @@ import java.util.UUID;
import org.onap.policy.common.logging.eelf.MessageCodes;
/**
- *
- * Interface Logger - implemented by Logger4J, EelfLogger and SystemOutLogger
+ * Interface Logger - implemented by Logger4J, EelfLogger and SystemOutLogger.
*
*/
-public interface Logger {
-
- /**
- * Prints messages with the level.DEBUG
- */
- public void debug(Object message);
-
- /**
- * Prints messages with the level.ERROR
- */
- public void error(Object message);
-
- /**
- * Prints messages with the level.ERROR
- */
- public void error(MessageCodes msg, Throwable arg0, String... arguments);
-
- /**
- * Prints messages with the level.INFO
- */
- public void info(Object message);
-
- /**
- * Prints messages with the level.WARN
- */
- public void warn(Object message);
-
- /**
- * Prints messages with the level.TRACE
- */
- public void trace(Object message);
-
- /**
- * Prints messages in audit log with the level.INFO
- */
- public void audit(Object arg0);
-
- /**
- * Prints messages with the level.DEBUG
- */
- public void debug(Object message, Throwable t);
-
- /**
- * Prints messages with the level.ERROR
- */
- public void error(Object message, Throwable t);
-
- /**
- * Prints messages with the level.INFO
- */
- public void info(Object message, Throwable t);
-
- /**
- * Prints messages with the level.WARN
- */
- public void warn(Object message, Throwable t);
-
- /**
- * Prints messages with the level.TRACE
- */
- public void trace(Object message, Throwable t);
-
- /**
- * Prints messages in audit log with the level.INFO
- */
- public void audit(Object arg0, Throwable t);
-
- /**
- * Records event Id in audit log with the level.INFO
- */
- public void recordAuditEventStart(String eventId);
-
- /**
- * Records the starting time of the event with its request Id as the key
- */
- public void recordAuditEventStart(UUID eventId);
-
- /**
- * Records the ending time of the event with its request Id as the key
- */
- public void recordAuditEventEnd(String eventId, String rule, String policyVersion );
-
- /**
- * Records the ending time of the event with its request Id as the key
- */
- public void recordAuditEventEnd(UUID eventId, String rule, String policyVersion);
-
- /**
- * Records the ending time of the event with its request Id as the key
- */
- public void recordAuditEventEnd(String eventId, String rule);
-
- /**
- * Records the ending time of the event with its request Id as the key
- */
- public void recordAuditEventEnd(UUID eventId, String rule);
-
-
- /**
- * Records the Metrics with event Id and log message
- */
- public void recordMetricEvent(String eventId, String arg1);
-
- /**
- * Records the Metrics with event Id and log message
- */
- public void recordMetricEvent(UUID eventId, String arg1);
-
- /**
- * Records the Metrics log message
- */
- public void metrics(Object arg0);
-
- /**
- * Returns a boolean value, true for debug logging enabled, false for not enabled
- */
- public boolean isDebugEnabled();
-
- /**
- * Returns a boolean value, true for error logging enabled, false for not enabled
- */
- public boolean isErrorEnabled();
-
- /**
- * Returns a boolean value, true for warn logging enabled, false for not enabled
- */
- public boolean isWarnEnabled();
-
- /**
- * Returns a boolean value, true for info logging enabled, false for not enabled
- */
- public boolean isInfoEnabled();
-
- /**
- * Returns a boolean value, true for error logging enabled, false for not enabled
- */
- public boolean isAuditEnabled();
-
- /**
- * Returns a boolean value, true for warn logging enabled, false for not enabled
- */
- public boolean isMetricsEnabled();
-
- /**
- * Returns a boolean value, true for trace logging enabled, false for not enabled
- */
- public boolean isTraceEnabled();
-
-
- /**
- * Populates MDC info
- */
- public String postMDCInfoForEvent(String transId);
-
- /**
- * Prints messages with the level.WARN
- */
- public void warn(MessageCodes msg, String... arguments) ;
-
- /**
- * Prints messages with the level.WARN
- */
- public void warn(MessageCodes msg, Throwable arg0, String... arguments) ;
-
- /**
- * Prints messages with the level.ERROR
- */
- public void error(MessageCodes msg, String... arguments) ;
-
- /**
- * Sets transaction Id
- */
- public void setTransId(String transId);
-
- /**
- * Returns transaction Id
- */
- String getTransId();
-
- /**
- * Populates MDC Info for the rule triggered
- */
- public void postMDCInfoForTriggeredRule(String transId);
-
- /**
- * Populates MDC Info
- */
- public void postMDCInfoForEvent(Object o);
-
+public interface Logger {
+
+ /**
+ * Prints messages with the level.DEBUG
+ */
+ public void debug(Object message);
+
+ /**
+ * Prints messages with the level.DEBUG
+ */
+ public void debug(Object message, Throwable throwable);
+
+ /**
+ * Prints messages with the level.ERROR
+ */
+ public void error(Object message);
+
+ /**
+ * Prints messages with the level.ERROR
+ */
+ public void error(Object message, Throwable throwable);
+
+ /**
+ * Prints messages with the level.ERROR
+ */
+ public void error(MessageCodes msg, String... arguments);
+
+ /**
+ * Prints messages with the level.ERROR
+ */
+ public void error(MessageCodes msg, Throwable arg0, String... arguments);
+
+ /**
+ * Prints messages with the level.INFO
+ */
+ public void info(Object message);
+
+ /**
+ * Prints messages with the level.INFO
+ */
+ public void info(Object message, Throwable throwable);
+
+ /**
+ * Prints messages with the level.WARN
+ */
+ public void warn(Object message);
+
+ /**
+ * Prints messages with the level.WARN
+ */
+ public void warn(Object message, Throwable throwable);
+
+ /**
+ * Prints messages with the level.WARN
+ */
+ public void warn(MessageCodes msg, String... arguments);
+
+ /**
+ * Prints messages with the level.WARN
+ */
+ public void warn(MessageCodes msg, Throwable arg0, String... arguments);
+
+ /**
+ * Prints messages with the level.TRACE
+ */
+ public void trace(Object message);
+
+ /**
+ * Prints messages with the level.TRACE
+ */
+ public void trace(Object message, Throwable throwable);
+
+ /**
+ * Prints messages in audit log with the level.INFO
+ */
+ public void audit(Object arg0);
+
+ /**
+ * Prints messages in audit log with the level.INFO
+ */
+ public void audit(Object arg0, Throwable throwable);
+
+ /**
+ * Records event Id in audit log with the level.INFO
+ */
+ public void recordAuditEventStart(String eventId);
+
+ /**
+ * Records the starting time of the event with its request Id as the key.
+ */
+ public void recordAuditEventStart(UUID eventId);
+
+ /**
+ * Records the ending time of the event with its request Id as the key.
+ */
+ public void recordAuditEventEnd(String eventId, String rule, String policyVersion);
+
+ /**
+ * Records the ending time of the event with its request Id as the key.
+ */
+ public void recordAuditEventEnd(UUID eventId, String rule, String policyVersion);
+
+ /**
+ * Records the ending time of the event with its request Id as the key.
+ */
+ public void recordAuditEventEnd(String eventId, String rule);
+
+ /**
+ * Records the ending time of the event with its request Id as the key.
+ */
+ public void recordAuditEventEnd(UUID eventId, String rule);
+
+
+ /**
+ * Records the Metrics with event Id and log message.
+ */
+ public void recordMetricEvent(String eventId, String arg1);
+
+ /**
+ * Records the Metrics with event Id and log message.
+ */
+ public void recordMetricEvent(UUID eventId, String arg1);
+
+ /**
+ * Records the Metrics log message.
+ */
+ public void metrics(Object arg0);
+
+ /**
+ * Returns a boolean value, true for debug logging enabled, false for not enabled.
+ */
+ public boolean isDebugEnabled();
+
+ /**
+ * Returns a boolean value, true for error logging enabled, false for not enabled.
+ */
+ public boolean isErrorEnabled();
+
+ /**
+ * Returns a boolean value, true for warn logging enabled, false for not enabled.
+ */
+ public boolean isWarnEnabled();
+
+ /**
+ * Returns a boolean value, true for info logging enabled, false for not enabled.
+ */
+ public boolean isInfoEnabled();
+
+ /**
+ * Returns a boolean value, true for error logging enabled, false for not enabled.
+ */
+ public boolean isAuditEnabled();
+
+ /**
+ * Returns a boolean value, true for warn logging enabled, false for not enabled.
+ */
+ public boolean isMetricsEnabled();
+
+ /**
+ * Returns a boolean value, true for trace logging enabled, false for not enabled.
+ */
+ public boolean isTraceEnabled();
+
+
+ /**
+ * Populates MDC info.
+ */
+ public String postMDCInfoForEvent(String transId);
+
+ /**
+ * Populates MDC Info.
+ */
+ public void postMDCInfoForEvent(Object obj);
+
+ /**
+ * Sets transaction Id.
+ */
+ public void setTransId(String transId);
+
+ /**
+ * Returns transaction Id.
+ */
+ String getTransId();
+
+ /**
+ * Populates MDC Info for the rule triggered.
+ */
+ public void postMDCInfoForTriggeredRule(String transId);
+
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java
index 555620f2..88d3800a 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger4J.java
@@ -20,6 +20,8 @@
package org.onap.policy.common.logging.flexlogger;
+import com.att.eelf.configuration.EELFLogger.Level;
+
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -29,454 +31,482 @@ import java.util.UUID;
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
-
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
-import com.att.eelf.configuration.EELFLogger.Level;
/**
- *
* Logger4J implements all the methods of interface Logger by calling org.apache.log4j.Logger
- *
*/
public class Logger4J implements org.onap.policy.common.logging.flexlogger.Logger, Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 3183729429888828471L;
- private Logger log = null;
+
+ private static final long serialVersionUID = 3183729429888828471L;
+ private Logger log = null;
private String methodName = "";
private String className = "";
- private String transId = UUID.randomUUID().toString();
-
- /**
- * Constructor
- * @param clazz
- */
- public Logger4J (Class<?> clazz){
- System.out.println("create instance of Logger4J");
- if(clazz != null){
- log = Logger.getLogger(clazz);
- className = clazz.getName();
- }
- }
-
- /**
- * Constructor
- * @param s
- * @param className
- */
- public Logger4J (String s, String className){
- System.out.println("create instance of Logger4J");
- if(s != null){
- log = Logger.getLogger(s);
- }
- this.className = className;
- }
-
- /**
- * Sets transaction Id
- */
- @Override
- public void setTransId(String transId){
- log.info(transId);
- this.transId = transId;
- }
-
- /**
- * Returns transaction Id
- */
- @Override
- public String getTransId(){
- return transId;
- }
-
- /**
- * Records a message
- * @param message
- */
- @Override
- public void debug(Object message) {
- if(isDebugEnabled()){
- log.debug(transId + "|" + message);
- }
- }
-
- /**
- * Records an error message
- * @param message
- */
- @Override
- public void error(Object message) {
- log.error( transId + "|" + className +"|" + message);
- }
-
- /**
- * Records a message
- * @param message
- */
- @Override
- public void info(Object message) {
- log.info( transId + "|" + className +"|" + message);
- }
-
- /**
- * Records a message
- * @param message
- */
- @Override
- public void warn(Object message) {
- log.warn( transId + "|" + className +"|" + message);
- }
-
- /**
- * Records a message
- * @param message
- */
- @Override
- public void trace(Object message) {
- log.trace(transId + "|"+ className +"|" + message);
- }
-
- /**
- * Returns true for debug enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isDebugEnabled(){
- return log.isDebugEnabled();
- }
-
- /**
- * Returns true for error enabled, or false for not
- * @return boolean
- */
- @SuppressWarnings("deprecation")
- @Override
- public boolean isErrorEnabled(){
- return log.isEnabledFor(Priority.ERROR);
- }
-
- /**
- * Returns true for info enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isInfoEnabled(){
- return log.isInfoEnabled();
- }
-
- /**
- * Returns true for warn enabled, or false for not
- * @return boolean
- */
- @SuppressWarnings("deprecation")
- @Override
- public boolean isWarnEnabled(){
- //return log4j value
- return log.isEnabledFor(Priority.WARN);
- }
-
- /**
- * Returns true for audit enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isAuditEnabled(){
- return(PolicyLogger.getAuditLevel() != Level.OFF);
- }
-
- /**
- * Returns true for metrics enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isMetricsEnabled(){
- return(PolicyLogger.getMetricsLevel() != Level.OFF);
- }
-
- /**
- * Records an audit message
- * @param arg0
- */
- @Override
- public void audit(Object arg0) {
- log.info(className +"|" +arg0);
- }
-
- /**
- * Records an audit message
- * @param eventId
- */
- @Override
- public void recordAuditEventStart(String eventId) {
- log.info(className +"|recordAuditEventStart with eventId " + eventId);
- }
-
- /**
- * Records an audit message
- * @param eventId
- */
- @Override
- public void recordAuditEventStart(UUID eventId) {
- if(eventId != null){
- recordAuditEventStart(eventId.toString());
- }
- }
-
- /**
- * Records an audit message
- * @param eventId
- * @param rule
- * @param policyVersion
- */
- @Override
- public void recordAuditEventEnd(String eventId, String rule, String policyVersion) {
- log.info(className +"|"+ eventId + ":" + rule);
- }
-
- /**
- * Records an audit message
- * @param eventId
- * @param rule
- * @param policyVersion
- */
- @Override
- public void recordAuditEventEnd(UUID eventId, String rule, String policyVersion) {
- if(eventId != null){
- recordAuditEventEnd(eventId.toString(), rule, policyVersion);
- }else{
- recordAuditEventEnd(eventId, rule, policyVersion);
- }
- }
-
- /**
- * Records an audit message
- * @param eventId
- * @param rule
- */
- @Override
- public void recordAuditEventEnd(String eventId, String rule) {
- log.info(className +"|" +eventId + ":" + rule);
- }
-
- /**
- * Records an audit message
- * @param eventId
- * @param rule
- */
- @Override
- public void recordAuditEventEnd(UUID eventId, String rule) {
- if(eventId != null){
- recordAuditEventEnd(eventId.toString(), rule);
- }else{
- recordAuditEventEnd(eventId, rule);
- }
- }
-
- /**
- * Records a metrics message
- * @param eventId
- * @param arg1
- */
- @Override
- public void recordMetricEvent(String eventId, String arg1) {
- log.info(className +"|" +eventId + ":" + arg1);
-
- }
-
- /**
- * Records a metrics message
- * @param eventId
- * @param arg1
- */
- @Override
- public void recordMetricEvent(UUID eventId, String arg1) {
- if(eventId != null){
- recordMetricEvent(eventId.toString(), arg1);
- }else{
- recordMetricEvent(eventId, arg1);
- }
- }
-
- /**
- * Records a metrics message
- * @param arg0
- */
- @Override
- public void metrics(Object arg0) {
- log.info(arg0);
- }
-
- /**
- * Records an error message
- * @param msg
- * @param arg0
- * @param arguments
- */
- @Override
- public void error(MessageCodes msg, Throwable arg0, String... arguments){
- log.error(transId + "|" + className +"|" + "MessageCodes :" + msg + Arrays.asList(arguments));
-
- }
-
- /**
- * Records an error message
- * @param msg
- * @param arguments
- */
- @Override
- public void error(MessageCodes msg, String... arguments){
- log.error(transId + "|" + className +"|" + "MessageCode:" + msg + Arrays.asList(arguments));
- }
-
- /**
- * Returns transaction Id
- * @param transId
- */
- @Override
- public String postMDCInfoForEvent(String transId) {
- String transactionId = transId;
- if(transactionId == null || transactionId.isEmpty()){
- transactionId = UUID.randomUUID().toString();
- }
-
- return transactionId;
- }
-
- /**
- * Records a message
- * @param msg
- * @param arguments
- */
- @Override
- public void warn(MessageCodes msg, String... arguments){
- log.warn(className +"|" +"MessageCodes:" + msg + Arrays.asList(arguments));
- }
-
- /**
- * Records a message
- * @param msg
- * @param arg0
- * @param arguments
- */
- @Override
- public void warn(MessageCodes msg, Throwable arg0, String... arguments){
- log.warn(className +"|" +"MessageCodes:" + msg + Arrays.asList(arguments));
- }
-
- /**
- * Records a message
- * @param message
- * @param t
- */
- @Override
- public void debug(Object message, Throwable t) {
- log.debug(message, t);
- }
-
- /**
- * Records an error message
- * @param message
- * @param t
- */
- @Override
- public void error(Object message, Throwable t) {
- log.error(message, t);
- }
-
- /**
- * Records a message
- * @param message
- * @param t
- */
- @Override
- public void info(Object message, Throwable t) {
- log.info(message, t);
- }
-
- /**
- * Records a message
- * @param message
- * @param t
- */
- @Override
- public void warn(Object message, Throwable t) {
- log.warn(message, t);
- }
-
- /**
- * Records a message
- * @param message
- * @param t
- */
- @Override
- public void trace(Object message, Throwable t) {
- log.trace(message, t);
- }
-
- /**
- * Records an audit message
- * @param arg0
- * @param t
- */
-
- @Override
- public void audit(Object arg0, Throwable t) {
- log.info(arg0, t);
- }
-
- /**
- * Returns true for trace enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isTraceEnabled() {
- return log.isTraceEnabled();
- }
-
- /**
- * Records transaction Id
- * @param transId
- */
- @Override
- public void postMDCInfoForTriggeredRule(String transId){
- log.info(transId);
- }
-
- /**
- * Records transaction Id
- * @param o
- */
- @Override
- public void postMDCInfoForEvent(Object o){
- log.info(o);
- }
-
- /* ============================================================ */
-
- /*
- * Support for 'Serializable' --
- * the default rules don't work for the 'log' field
- */
-
- private void writeObject(ObjectOutputStream out) throws IOException {
- // write out 'methodName', 'className', 'transId' strings
- out.writeObject(methodName);
- out.writeObject(className);
- out.writeObject(transId);
- }
-
- private void readObject(ObjectInputStream in)
- throws IOException, ClassNotFoundException {
-
- // read in 'methodName', 'className', 'transId' strings
- methodName = (String)(in.readObject());
- className = (String)(in.readObject());
- transId = (String)(in.readObject());
-
- // look up associated logger
- log = Logger.getLogger(className);
- }
+ private String transId = UUID.randomUUID().toString();
+
+ /**
+ * Constructor.
+ *
+ * @param clazz the class
+ */
+ public Logger4J(Class<?> clazz) {
+ System.out.println("create instance of Logger4J");
+ if (clazz != null) {
+ log = Logger.getLogger(clazz);
+ className = clazz.getName();
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param name the name of the logger
+ * @param className the name of the class
+ */
+ public Logger4J(String name, String className) {
+ System.out.println("create instance of Logger4J");
+ if (name != null) {
+ log = Logger.getLogger(name);
+ }
+ this.className = className;
+ }
+
+ /**
+ * Sets transaction Id.
+ */
+ @Override
+ public void setTransId(String transId) {
+ log.info(transId);
+ this.transId = transId;
+ }
+
+ /**
+ * Returns transaction Id.
+ */
+ @Override
+ public String getTransId() {
+ return transId;
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void debug(Object message) {
+ if (isDebugEnabled()) {
+ log.debug(transId + "|" + message);
+ }
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void debug(Object message, Throwable throwable) {
+ log.debug(message, throwable);
+ }
+
+ /**
+ * Records an error message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void error(Object message) {
+ log.error(transId + "|" + className + "|" + message);
+ }
+
+ /**
+ * Records an error message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void error(Object message, Throwable throwable) {
+ log.error(message, throwable);
+ }
+
+ /**
+ * Records an error message.
+ *
+ * @param msg the message code
+ * @param throwable the throwable
+ * @param arguments the messages
+ */
+ @Override
+ public void error(MessageCodes msg, Throwable throwable, String... arguments) {
+ log.error(transId + "|" + className + "|" + "MessageCodes :" + msg + Arrays.asList(arguments));
+
+ }
+
+ /**
+ * Records an error message.
+ *
+ * @param msg the message code
+ * @param arguments the messages
+ */
+ @Override
+ public void error(MessageCodes msg, String... arguments) {
+ log.error(transId + "|" + className + "|" + "MessageCode:" + msg + Arrays.asList(arguments));
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void info(Object message) {
+ log.info(transId + "|" + className + "|" + message);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void info(Object message, Throwable throwable) {
+ log.info(message, throwable);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void warn(Object message) {
+ log.warn(transId + "|" + className + "|" + message);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void warn(Object message, Throwable throwable) {
+ log.warn(message, throwable);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param msg the message code
+ * @param arguments the messages
+ */
+ @Override
+ public void warn(MessageCodes msg, String... arguments) {
+ log.warn(className + "|" + "MessageCodes:" + msg + Arrays.asList(arguments));
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param msg the message code
+ * @param throwable the throwable
+ * @param arguments the messages
+ */
+ @Override
+ public void warn(MessageCodes msg, Throwable throwable, String... arguments) {
+ log.warn(className + "|" + "MessageCodes:" + msg + Arrays.asList(arguments));
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void trace(Object message) {
+ log.trace(transId + "|" + className + "|" + message);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void trace(Object message, Throwable throwable) {
+ log.trace(message, throwable);
+ }
+
+ /**
+ * Returns true for debug enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isDebugEnabled() {
+ return log.isDebugEnabled();
+ }
+
+ /**
+ * Returns true for error enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @SuppressWarnings("deprecation")
+ @Override
+ public boolean isErrorEnabled() {
+ return log.isEnabledFor(Priority.ERROR);
+ }
+
+ /**
+ * Returns true for info enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isInfoEnabled() {
+ return log.isInfoEnabled();
+ }
+
+ /**
+ * Returns true for warn enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @SuppressWarnings("deprecation")
+ @Override
+ public boolean isWarnEnabled() {
+ // return log4j value
+ return log.isEnabledFor(Priority.WARN);
+ }
+
+ /**
+ * Returns true for audit enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isAuditEnabled() {
+ return (PolicyLogger.getAuditLevel() != Level.OFF);
+ }
+
+ /**
+ * Returns true for metrics enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isMetricsEnabled() {
+ return (PolicyLogger.getMetricsLevel() != Level.OFF);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void audit(Object message) {
+ log.info(className + "|" + message);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+
+ @Override
+ public void audit(Object message, Throwable throwable) {
+ log.info(message, throwable);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ */
+ @Override
+ public void recordAuditEventStart(String eventId) {
+ log.info(className + "|recordAuditEventStart with eventId " + eventId);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ */
+ @Override
+ public void recordAuditEventStart(UUID eventId) {
+ if (eventId != null) {
+ recordAuditEventStart(eventId.toString());
+ }
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ * @param policyVersion the policy version
+ */
+ @Override
+ public void recordAuditEventEnd(String eventId, String rule, String policyVersion) {
+ log.info(className + "|" + eventId + ":" + rule);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ * @param policyVersion the policy version
+ */
+ @Override
+ public void recordAuditEventEnd(UUID eventId, String rule, String policyVersion) {
+ if (eventId != null) {
+ recordAuditEventEnd(eventId.toString(), rule, policyVersion);
+ } else {
+ recordAuditEventEnd(eventId, rule, policyVersion);
+ }
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ */
+ @Override
+ public void recordAuditEventEnd(String eventId, String rule) {
+ log.info(className + "|" + eventId + ":" + rule);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ */
+ @Override
+ public void recordAuditEventEnd(UUID eventId, String rule) {
+ if (eventId != null) {
+ recordAuditEventEnd(eventId.toString(), rule);
+ } else {
+ recordAuditEventEnd(eventId, rule);
+ }
+ }
+
+ /**
+ * Records a metrics message.
+ *
+ * @param eventId the event ID
+ * @param message the message
+ */
+ @Override
+ public void recordMetricEvent(String eventId, String message) {
+ log.info(className + "|" + eventId + ":" + message);
+
+ }
+
+ /**
+ * Records a metrics message.
+ *
+ * @param eventId the event ID
+ * @param message the message
+ */
+ @Override
+ public void recordMetricEvent(UUID eventId, String message) {
+ if (eventId != null) {
+ recordMetricEvent(eventId.toString(), message);
+ } else {
+ recordMetricEvent(eventId, message);
+ }
+ }
+
+ /**
+ * Records a metrics message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void metrics(Object message) {
+ log.info(message);
+ }
+
+ /**
+ * Returns transaction Id.
+ *
+ * @param transId the transaction ID
+ */
+ @Override
+ public String postMDCInfoForEvent(String transId) {
+ String transactionId = transId;
+ if (transactionId == null || transactionId.isEmpty()) {
+ transactionId = UUID.randomUUID().toString();
+ }
+
+ return transactionId;
+ }
+
+ /**
+ * Records transaction Id.
+ *
+ * @param message the message
+ */
+ @Override
+ public void postMDCInfoForEvent(Object message) {
+ log.info(message);
+ }
+
+ /**
+ * Returns true for trace enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isTraceEnabled() {
+ return log.isTraceEnabled();
+ }
+
+ /**
+ * Records transaction Id.
+ *
+ * @param transId the transaction ID
+ */
+ @Override
+ public void postMDCInfoForTriggeredRule(String transId) {
+ log.info(transId);
+ }
+
+ /* ============================================================ */
+
+ /*
+ * Support for 'Serializable' -- the default rules don't work for the 'log' field
+ */
+
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ // write out 'methodName', 'className', 'transId' strings
+ out.writeObject(methodName);
+ out.writeObject(className);
+ out.writeObject(transId);
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+
+ // read in 'methodName', 'className', 'transId' strings
+ methodName = (String) (in.readObject());
+ className = (String) (in.readObject());
+ transId = (String) (in.readObject());
+
+ // look up associated logger
+ log = Logger.getLogger(className);
+ }
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/LoggerType.java b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/LoggerType.java
index ed2029e6..8bf0dd78 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/LoggerType.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/LoggerType.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,10 +21,8 @@
package org.onap.policy.common.logging.flexlogger;
/**
- *
- * Logger types
- *
+ * Logger types.
*/
public enum LoggerType {
- EELF, LOG4J, SYSTEMOUT
+ EELF, LOG4J, SYSTEMOUT
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/PropertyUtil.java b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/PropertyUtil.java
index 86d119ea..54e06411 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/PropertyUtil.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/PropertyUtil.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,360 +32,313 @@ import java.util.Timer;
import java.util.TimerTask;
/**
- * This class provides utilities to read properties from a properties
- * file, and optionally get notifications of future changes
+ * This class provides utilities to read properties from a properties file, and optionally get
+ * notifications of future changes.
*/
-public class PropertyUtil
-{
-
- // timer thread used for polling for property file changes
- private static Timer timer = null;
-
- // this table maps canonical file into a 'ListenerRegistration' instance
- private static HashMap<File, ListenerRegistration> registrations =
- new HashMap<>();
-
- /**
- * Read in a properties file
- * @param file the properties file
- * @return a Properties object, containing the associated properties
- * @throws IOException - subclass 'FileNotFoundException' if the file
- * does not exist or can't be opened, and 'IOException' if there is
- * a problem loading the properties file.
- */
- public static Properties getProperties(File file) throws IOException
- {
- // create an InputStream (may throw a FileNotFoundException)
- FileInputStream fis = new FileInputStream(file);
- try
- {
- // create the properties instance
- Properties rval = new Properties();
-
- // load properties (may throw an IOException)
- rval.load(fis);
- return rval;
- }
- finally
- {
- // close input stream
- fis.close();
- }
- }
-
- /**
- * Read in a properties file
- * @param fileName the properties file
- * @return a Properties object, containing the associated properties
- * @throws IOException - subclass 'FileNotFoundException' if the file
- * does not exist or can't be opened, and 'IOException' if there is
- * a problem loading the properties file.
- */
- public static Properties getProperties(String fileName) throws IOException
- {
- return getProperties(new File(fileName));
- }
-
- /* ============================================================ */
-
- /**
- * This is the callback interface, used for sending notifications of
- * changes in the properties file.
- */
- @FunctionalInterface
- public interface Listener
- {
- /**
- * Notification of a properties file change
- * @param properties the new properties
- * @param the set of property names that have changed, including
- * additions and removals
- */
- void propertiesChanged(Properties properties, Set<String> changedKeys);
- }
-
- /**
- * This is an internal class - one instance of this exists for each
- * property file that is being monitored. Note that multiple listeners
- * can be registered for the same file.
- */
- private static class ListenerRegistration
- {
- // the canonical path of the file being monitored
- File file;
-
- // the most recent value of 'file.lastModified()'
- long lastModified;
-
- // the most recent set of properties
- Properties properties;
-
- // the set of listeners monitoring this file
- LinkedList<Listener> listeners;
-
- // the 'TimerTask' instance, used for periodic polling
- TimerTask timerTask;
-
- /**
- * Constructor - create a 'ListenerRegistration' instance for this
- * file, but with no listeners
- */
- ListenerRegistration(File file) throws IOException
- {
- this.file = file;
-
- // The initial value of 'lastModified' is set to 0 to ensure that we
- // correctly handle the case where the file is modified within the
- // same second that polling begins.
- lastModified = 0;
-
- // fetch current properties
- properties = getProperties(file);
-
- // no listeners yet
- listeners = new LinkedList<>();
-
- // add to static table, so this instance can be shared
- registrations.put(file, this);
-
- if (timer == null)
- {
- // still need to create a timer thread
- synchronized(PropertyUtil.class)
- {
- // an additional check is added inside the 'synchronized' block,
- // just in case someone beat us to it
- if (timer == null)
- {
- timer = new Timer("PropertyUtil-Timer", true);
- }
- }
- }
-
- // create and schedule the timer task, so this is periodically polled
- timerTask = new TimerTask()
- {
- @Override
- public void run()
- {
- try
- {
- poll();
- }
- catch (Exception e)
- {
- System.err.println(e);
- }
- }
- };
- timer.schedule(timerTask, 10000L, 10000L);
- }
-
- /**
- * Add a listener to the notification list
- * @param listener this is the listener to add to the list
- * @return the properties at the moment the listener was added to the list
- */
- synchronized Properties addListener(Listener listener)
- {
- listeners.add(listener);
- return (Properties)properties.clone();
- }
-
- /**
- * Remove a listener from the notification list
- * @param listener this is the listener to remove
- */
- synchronized void removeListener(Listener listener)
- {
- listeners.remove(listener);
-
- // See if we need to remove this 'ListenerRegistration' instance
- // from the table. The 'synchronized' block is needed in case
- // another listener is being added at about the same time that this
- // one is being removed.
- synchronized(registrations)
- {
- if (listeners.isEmpty())
- {
- timerTask.cancel();
- registrations.remove(file);
- }
- }
- }
-
- /**
- * This method is periodically called to check for property list updates
- * @throws IOException if there is an error in reading the properties file
- */
- synchronized void poll() throws IOException
- {
- long timestamp = file.lastModified();
- if (timestamp != lastModified)
- {
- // update the record, and send out the notifications
- lastModified = timestamp;
-
- // Save old set, and initial set of changed properties.
- Properties oldProperties = properties;
- HashSet<String> changedProperties =
- new HashSet<>(oldProperties.stringPropertyNames());
-
- // Fetch the list of listeners that we will potentially notify,
- // and the new properties. Note that this is in a 'synchronized'
- // block to ensure that all listeners receiving notifications
- // actually have a newer list of properties than the one
- // returned on the initial 'getProperties' call.
- properties = getProperties(file);
-
- Set<String> newPropertyNames = properties.stringPropertyNames();
- changedProperties.addAll(newPropertyNames);
-
- // At this point, 'changedProperties' is the union of all properties
- // in both the old and new properties files. Iterate through all
- // of the entries in the new properties file - if the entry
- // matches the one in the old file, remove it from
- // 'changedProperties'.
- for (String name : newPropertyNames)
- {
- if (properties.getProperty(name).equals
- (oldProperties.getProperty(name)))
- {
- // Apparently, any property that exists must be of type
- // 'String', and can't be null. For this reason, we don't
- // need to worry about the case where
- // 'properties.getProperty(name)' returns 'null'. Note that
- // 'oldProperties.getProperty(name)' may be 'null' if the
- // old property does not exist.
- changedProperties.remove(name);
- }
- }
-
- // 'changedProperties' should be correct at this point
- if (!changedProperties.isEmpty())
- {
- // there were changes - notify everyone in 'listeners'
- for (final Listener notify : listeners)
- {
- // Copy 'properties' and 'changedProperties', so it doesn't
- // cause problems if the recipient makes changes.
- final Properties tmpProperties =
- (Properties)(properties.clone());
- final HashSet<String> tmpChangedProperties =
- new HashSet<>(changedProperties);
-
- // Do the notification in a separate thread, so blocking
- // won't cause any problems.
- new Thread()
- {
- @Override
- public void run()
- {
- notify.propertiesChanged
- (tmpProperties, tmpChangedProperties);
- }
- }.start();
- }
- }
- }
- }
- }
-
- /**
- * Read in a properties file, and register for update notifications.
- * NOTE: it is possible that the first callback will occur while this
- * method is still in progress. To avoid this problem, use 'synchronized'
- * blocks around this invocation and in the callback -- that will ensure
- * that the processing of the initial properties complete before any
- * updates are processed.
- *
- * @param file the properties file
- * @param notify if not null, this is a callback interface that is used for
- * notifications of changes
- * @return a Properties object, containing the associated properties
- * @throws IOException - subclass 'FileNotFoundException' if the file
- * does not exist or can't be opened, and 'IOException' if there is
- * a problem loading the properties file.
- */
- public static Properties getProperties(File file, Listener listener)
- throws IOException
- {
- if (listener == null)
- {
- // no listener specified -- just fetch the properties
- return getProperties(file);
- }
-
- // Convert the file to a canonical form in order to avoid the situation
- // where different names refer to the same file.
- File tempFile = file.getCanonicalFile();
-
- // See if there is an existing registration. The 'synchronized' block
- // is needed to handle the case where a new listener is added at about
- // the same time that another one is being removed.
- synchronized(registrations)
- {
- ListenerRegistration reg = registrations.get(tempFile);
- if (reg == null)
- {
- // a new registration is needed
- reg = new ListenerRegistration(tempFile);
- }
- return reg.addListener(listener);
- }
- }
-
- /**
- * Read in a properties file, and register for update notifications.
- * NOTE: it is possible that the first callback will occur while this
- * method is still in progress. To avoid this problem, use 'synchronized'
- * blocks around this invocation and in the callback -- that will ensure
- * that the processing of the initial properties complete before any
- * updates are processed.
- *
- * @param fileName the properties file
- * @param notify if not null, this is a callback interface that is used for
- * notifications of changes
- * @return a Properties object, containing the associated properties
- * @throws IOException - subclass 'FileNotFoundException' if the file
- * does not exist or can't be opened, and 'IOException' if there is
- * a problem loading the properties file.
- */
- public static Properties getProperties(String fileName, Listener listener)
- throws IOException
- {
- return getProperties(new File(fileName), listener);
- }
-
- /**
- * Stop listenening for updates
- * @param file the properties file
- * @param notify if not null, this is a callback interface that was used for
- * notifications of changes
- * @throws IOException
- */
- public static void stopListening(File file, Listener listener) throws IOException
- {
- if (listener != null)
- {
- ListenerRegistration reg = registrations.get(file.getCanonicalFile());
- if (reg != null)
- {
- reg.removeListener(listener);
- }
- }
- }
-
- /**
- * Stop listenening for updates
- * @param fileName the properties file
- * @param notify if not null, this is a callback interface that was used for
- * notifications of changes
- * @throws IOException
- */
- public static void stopListening(String fileName, Listener listener) throws IOException
- {
- stopListening(new File(fileName), listener);
- }
-
-}
+public class PropertyUtil {
+
+ // timer thread used for polling for property file changes
+ private static Timer timer = null;
+
+ // this table maps canonical file into a 'ListenerRegistration' instance
+ private static HashMap<File, ListenerRegistration> registrations = new HashMap<>();
+
+ /**
+ * Read in a properties file
+ *
+ * @param file the properties file
+ * @return a Properties object, containing the associated properties
+ * @throws IOException - subclass 'FileNotFoundException' if the file does not exist or can't be
+ * opened, and 'IOException' if there is a problem loading the properties file.
+ */
+ public static Properties getProperties(File file) throws IOException {
+ // create an InputStream (may throw a FileNotFoundException)
+ FileInputStream fis = new FileInputStream(file);
+ try {
+ // create the properties instance
+ Properties rval = new Properties();
+
+ // load properties (may throw an IOException)
+ rval.load(fis);
+ return rval;
+ } finally {
+ // close input stream
+ fis.close();
+ }
+ }
+
+ /**
+ * Read in a properties file
+ *
+ * @param fileName the properties file
+ * @return a Properties object, containing the associated properties
+ * @throws IOException - subclass 'FileNotFoundException' if the file does not exist or can't be
+ * opened, and 'IOException' if there is a problem loading the properties file.
+ */
+ public static Properties getProperties(String fileName) throws IOException {
+ return getProperties(new File(fileName));
+ }
+
+ /* ============================================================ */
+
+ /**
+ * This is the callback interface, used for sending notifications of changes in the properties
+ * file.
+ */
+ @FunctionalInterface
+ public interface Listener {
+ /**
+ * Notification of a properties file change.
+ *
+ * @param properties the new properties
+ * @param changedKeys the set of property names that have changed, including additions and
+ * removals
+ */
+ void propertiesChanged(Properties properties, Set<String> changedKeys);
+ }
+
+ /**
+ * This is an internal class - one instance of this exists for each property file that is being
+ * monitored. Note that multiple listeners can be registered for the same file.
+ */
+ private static class ListenerRegistration {
+ // the canonical path of the file being monitored
+ File file;
+
+ // the most recent value of 'file.lastModified()'
+ long lastModified;
+
+ // the most recent set of properties
+ Properties properties;
+
+ // the set of listeners monitoring this file
+ LinkedList<Listener> listeners;
+
+ // the 'TimerTask' instance, used for periodic polling
+ TimerTask timerTask;
+
+ /**
+ * Constructor - create a 'ListenerRegistration' instance for this file, but with no
+ * listeners.
+ */
+ ListenerRegistration(File file) throws IOException {
+ this.file = file;
+
+ // The initial value of 'lastModified' is set to 0 to ensure that we
+ // correctly handle the case where the file is modified within the
+ // same second that polling begins.
+ lastModified = 0;
+
+ // fetch current properties
+ properties = getProperties(file);
+
+ // no listeners yet
+ listeners = new LinkedList<>();
+
+ // add to static table, so this instance can be shared
+ registrations.put(file, this);
+
+ if (timer == null) {
+ // still need to create a timer thread
+ synchronized (PropertyUtil.class) {
+ // an additional check is added inside the 'synchronized' block,
+ // just in case someone beat us to it
+ if (timer == null) {
+ timer = new Timer("PropertyUtil-Timer", true);
+ }
+ }
+ }
+
+ // create and schedule the timer task, so this is periodically polled
+ timerTask = new TimerTask() {
+ @Override
+ public void run() {
+ try {
+ poll();
+ } catch (Exception e) {
+ System.err.println(e);
+ }
+ }
+ };
+ timer.schedule(timerTask, 10000L, 10000L);
+ }
+
+ /**
+ * Add a listener to the notification list.
+ *
+ * @param listener this is the listener to add to the list
+ * @return the properties at the moment the listener was added to the list
+ */
+ synchronized Properties addListener(Listener listener) {
+ listeners.add(listener);
+ return (Properties) properties.clone();
+ }
+
+ /**
+ * Remove a listener from the notification list.
+ *
+ * @param listener this is the listener to remove
+ */
+ synchronized void removeListener(Listener listener) {
+ listeners.remove(listener);
+
+ // See if we need to remove this 'ListenerRegistration' instance
+ // from the table. The 'synchronized' block is needed in case
+ // another listener is being added at about the same time that this
+ // one is being removed.
+ synchronized (registrations) {
+ if (listeners.isEmpty()) {
+ timerTask.cancel();
+ registrations.remove(file);
+ }
+ }
+ }
+
+ /**
+ * This method is periodically called to check for property list updates.
+ *
+ * @throws IOException if there is an error in reading the properties file
+ */
+ synchronized void poll() throws IOException {
+ long timestamp = file.lastModified();
+ if (timestamp != lastModified) {
+ // update the record, and send out the notifications
+ lastModified = timestamp;
+
+ // Save old set, and initial set of changed properties.
+ Properties oldProperties = properties;
+ HashSet<String> changedProperties = new HashSet<>(oldProperties.stringPropertyNames());
+
+ // Fetch the list of listeners that we will potentially notify,
+ // and the new properties. Note that this is in a 'synchronized'
+ // block to ensure that all listeners receiving notifications
+ // actually have a newer list of properties than the one
+ // returned on the initial 'getProperties' call.
+ properties = getProperties(file);
+
+ Set<String> newPropertyNames = properties.stringPropertyNames();
+ changedProperties.addAll(newPropertyNames);
+
+ // At this point, 'changedProperties' is the union of all properties
+ // in both the old and new properties files. Iterate through all
+ // of the entries in the new properties file - if the entry
+ // matches the one in the old file, remove it from
+ // 'changedProperties'.
+ for (String name : newPropertyNames) {
+ if (properties.getProperty(name).equals(oldProperties.getProperty(name))) {
+ // Apparently, any property that exists must be of type
+ // 'String', and can't be null. For this reason, we don't
+ // need to worry about the case where
+ // 'properties.getProperty(name)' returns 'null'. Note that
+ // 'oldProperties.getProperty(name)' may be 'null' if the
+ // old property does not exist.
+ changedProperties.remove(name);
+ }
+ }
+
+ // 'changedProperties' should be correct at this point
+ if (!changedProperties.isEmpty()) {
+ // there were changes - notify everyone in 'listeners'
+ for (final Listener notify : listeners) {
+ // Copy 'properties' and 'changedProperties', so it doesn't
+ // cause problems if the recipient makes changes.
+ final Properties tmpProperties = (Properties) (properties.clone());
+ final HashSet<String> tmpChangedProperties = new HashSet<>(changedProperties);
+
+ // Do the notification in a separate thread, so blocking
+ // won't cause any problems.
+ new Thread() {
+ @Override
+ public void run() {
+ notify.propertiesChanged(tmpProperties, tmpChangedProperties);
+ }
+ }.start();
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Read in a properties file, and register for update notifications. NOTE: it is possible that
+ * the first callback will occur while this method is still in progress. To avoid this problem,
+ * use 'synchronized' blocks around this invocation and in the callback -- that will ensure that
+ * the processing of the initial properties complete before any updates are processed.
+ *
+ * @param file the properties file
+ * @param listener notify if not null, this is a callback interface that is used for
+ * notifications of changes
+ * @return a Properties object, containing the associated properties
+ * @throws IOException - subclass 'FileNotFoundException' if the file does not exist or can't be
+ * opened, and 'IOException' if there is a problem loading the properties file.
+ */
+ public static Properties getProperties(File file, Listener listener) throws IOException {
+ if (listener == null) {
+ // no listener specified -- just fetch the properties
+ return getProperties(file);
+ }
+
+ // Convert the file to a canonical form in order to avoid the situation
+ // where different names refer to the same file.
+ File tempFile = file.getCanonicalFile();
+
+ // See if there is an existing registration. The 'synchronized' block
+ // is needed to handle the case where a new listener is added at about
+ // the same time that another one is being removed.
+ synchronized (registrations) {
+ ListenerRegistration reg = registrations.get(tempFile);
+ if (reg == null) {
+ // a new registration is needed
+ reg = new ListenerRegistration(tempFile);
+ }
+ return reg.addListener(listener);
+ }
+ }
+
+ /**
+ * Read in a properties file, and register for update notifications. NOTE: it is possible that
+ * the first callback will occur while this method is still in progress. To avoid this problem,
+ * use 'synchronized' blocks around this invocation and in the callback -- that will ensure that
+ * the processing of the initial properties complete before any updates are processed.
+ *
+ * @param fileName the properties file
+ * @param listener notify if not null, this is a callback interface that is used for
+ * notifications of changes
+ * @return a Properties object, containing the associated properties
+ * @throws IOException - subclass 'FileNotFoundException' if the file does not exist or can't be
+ * opened, and 'IOException' if there is a problem loading the properties file.
+ */
+ public static Properties getProperties(String fileName, Listener listener) throws IOException {
+ return getProperties(new File(fileName), listener);
+ }
+
+ /**
+ * Stop listenening for updates.
+ *
+ * @param file the properties file
+ * @param listener notify if not null, this is a callback interface that was used for
+ * notifications of changes
+ * @throws IOException If an I/O error occurs
+ */
+ public static void stopListening(File file, Listener listener) throws IOException {
+ if (listener != null) {
+ ListenerRegistration reg = registrations.get(file.getCanonicalFile());
+ if (reg != null) {
+ reg.removeListener(listener);
+ }
+ }
+ }
+
+ /**
+ * Stop listenening for updates.
+ *
+ * @param fileName the properties file
+ * @param listener notify if not null, this is a callback interface that was used for
+ * notifications of changes
+ * @throws IOException If an I/O error occurs
+ */
+ public static void stopListening(String fileName, Listener listener) throws IOException {
+ stopListening(new File(fileName), listener);
+ }
+
+}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/SystemOutLogger.java b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/SystemOutLogger.java
index 825799b9..70ad08ae 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/SystemOutLogger.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/SystemOutLogger.java
@@ -20,485 +20,510 @@
package org.onap.policy.common.logging.flexlogger;
+import com.att.eelf.configuration.EELFLogger.Level;
+
import java.io.Serializable;
import java.util.Arrays;
import java.util.UUID;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
-import com.att.eelf.configuration.EELFLogger.Level;
/**
- *
* SystemOutLogger implements all the methods of interface Logger by calling System.out.println
- *
*/
public class SystemOutLogger implements Logger, Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 4956408061058933929L;
- private String className = "";
- private boolean isDebugEnabled = true;
- private boolean isInfoEnabled = true;
- private boolean isWarnEnabled = true;
- private boolean isErrorEnabled = true;
- private boolean isAuditEnabled = true;
- private boolean isMetricsEnabled = true;
- private String transId = UUID.randomUUID().toString();
-
- /**
- * Constructor
- * @param clazz
- */
- public SystemOutLogger (Class<?> clazz){
- System.out.println("create instance of SystemOutLogger");
- if(clazz != null){
- className = clazz.getName();
- }
+
+ private static final long serialVersionUID = 4956408061058933929L;
+ private String className = "";
+ private boolean isDebugEnabled = true;
+ private boolean isInfoEnabled = true;
+ private boolean isWarnEnabled = true;
+ private boolean isErrorEnabled = true;
+ private boolean isAuditEnabled = true;
+ private boolean isMetricsEnabled = true;
+ private String transId = UUID.randomUUID().toString();
+
+ /**
+ * Constructor.
+ *
+ * @param clazz the class
+ */
+ public SystemOutLogger(Class<?> clazz) {
+ System.out.println("create instance of SystemOutLogger");
+ if (clazz != null) {
+ className = clazz.getName();
+ }
initLevel();
- }
-
+ }
+
/**
- * Constructor
- * @param s
+ * Constructor.
+ *
+ * @param className the class name
*/
- public SystemOutLogger (String s){
- System.out.println("create instance of SystemOutLogger");
- if(s != null){
- className = s;
- }
+ public SystemOutLogger(String className) {
+ System.out.println("create instance of SystemOutLogger");
+ if (className != null) {
+ this.className = className;
+ }
initLevel();
- }
-
- /**
- * Sets logging levels
- */
- private void initLevel(){
-
- if(PolicyLogger.getDebugLevel() == Level.DEBUG){
- isDebugEnabled = true;
- isInfoEnabled = true;
- isWarnEnabled = true;
- }else{
- isDebugEnabled = false;
- }
-
- if(PolicyLogger.getDebugLevel() == Level.INFO){
- isInfoEnabled = true;
- isWarnEnabled = true;
- isDebugEnabled = false;
- }
-
- if(PolicyLogger.getDebugLevel() == Level.OFF){
- isInfoEnabled = false;
- isWarnEnabled = false;
- isDebugEnabled = false;
- }
-
- if(PolicyLogger.getErrorLevel() == Level.OFF){
- isErrorEnabled = false;
- }
-
- if(PolicyLogger.getAuditLevel() == Level.OFF){
- isAuditEnabled = false;
- }
-
- if(PolicyLogger.getMetricsLevel() == Level.OFF){
- isMetricsEnabled = false;
- }
- }
-
- /**
- * Sets transaction Id
- */
- @Override
- public void setTransId(String transId){
-
- System.out.println(transId);
- this.transId = transId;
- }
-
- /**
- * Returns transaction Id
- */
- @Override
- public String getTransId(){
-
- return transId;
- }
-
- /**
- * Records a message
- * @param message
- */
- @Override
- public void debug(Object message) {
-
- System.out.println(transId + "|" + className+" : "+message);
- }
-
- /**
- * Records an error message
- * @param message
- */
- @Override
- public void error(Object message) {
-
- System.out.println(transId + "|" + className+" : "+message);
- }
-
- /**
- * Records a message
- * @param message
- */
- @Override
- public void info(Object message) {
-
- System.out.println(transId + "|" + className+" : "+message);
-
- }
-
- /**
- * Records a message
- * @param message
- */
- @Override
- public void warn(Object message) {
-
- System.out.println(transId + "|" + className+" : "+message);
- }
-
- /**
- * Records a message
- * @param message
- */
- @Override
- public void trace(Object message) {
-
- System.out.println(transId + "|" + className+" : "+message);
- }
-
- /**
- * Returns true for debug enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isDebugEnabled(){
-
- return isDebugEnabled;
- }
-
- /**
- * Returns true for warn enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isWarnEnabled(){
-
- return isWarnEnabled;
- }
-
- /**
- * Returns true for info enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isInfoEnabled(){
-
- return isInfoEnabled;
- }
-
- /**
- * Returns true for error enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isErrorEnabled(){
-
- return isErrorEnabled;
- }
-
- /**
- * Returns true for audit enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isAuditEnabled(){
-
- return isAuditEnabled;
- }
-
- /**
- * Returns true for metrics enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isMetricsEnabled(){
-
- return isMetricsEnabled;
- }
-
- /**
- * Records an audit message
- * @param arg0
- */
- @Override
- public void audit(Object arg0) {
-
- System.out.println(transId + "|" +className+" : "+arg0);
- }
-
- /**
- * Records an audit message
- * @param eventId
- */
- @Override
- public void recordAuditEventStart(String eventId) {
-
- System.out.println(transId + "|" +className+" : "+eventId);
-
- }
-
- /**
- * Records an audit message
- * @param eventId
- */
- @Override
- public void recordAuditEventStart(UUID eventId) {
-
- System.out.println(eventId);
- }
-
- /**
- * Records an audit message
- * @param eventId
- * @param rule
- * @param policyVersion
- */
- @Override
- public void recordAuditEventEnd(String eventId, String rule, String policyVersion) {
-
- System.out.println(className+" : "+eventId + ":" + rule + ":" + policyVersion);
- }
-
- /**
- * Records an audit message
- * @param eventId
- * @param rule
- * @param policyVersion
- */
- @Override
- public void recordAuditEventEnd(UUID eventId, String rule, String policyVersion) {
-
- System.out.println(className+" : "+eventId + ":" + rule + ":" + policyVersion);
- }
-
- /**
- * Records an audit message
- * @param eventId
- * @param rule
- */
- @Override
- public void recordAuditEventEnd(String eventId, String rule) {
-
- System.out.println(className+" : "+eventId + ":" + rule);
- }
-
- /**
- * Records an audit message
- * @param eventId
- * @param rule
- */
- @Override
- public void recordAuditEventEnd(UUID eventId, String rule) {
-
- System.out.println(className+" : "+eventId + ":" + rule);
- }
-
- /**
- * Records a metrics message
- * @param eventId
- * @param arg1
- */
- @Override
- public void recordMetricEvent(String eventId, String arg1) {
-
- System.out.println(className+" : "+"eventId:" + eventId + "message:" + arg1);
-
- }
-
- /**
- * Records a metrics message
- * @param eventId
- * @param arg1
- */
- @Override
- public void recordMetricEvent(UUID eventId, String arg1) {
-
- System.out.println(className+" : "+eventId + ":" + arg1);
- }
-
- /**
- * Records a metrics message
- * @param arg0
- */
- @Override
- public void metrics(Object arg0) {
-
- System.out.println(className+" : "+arg0);
- }
-
- /**
- * Records an error message
- * @param msg
- * @param arg0
- * @param arguments
- */
- @Override
- public void error(MessageCodes msg, Throwable arg0, String... arguments){
-
- System.out.println(className+" : "+"MessageCodes :" + msg + Arrays.asList(arguments));
-
- }
-
- /**
- * Records an error message
- * @param msg
- * @param arguments
- */
- @Override
- public void error(MessageCodes msg, String... arguments){
-
- System.out.println(transId + "|" + className+" : "+"MessageCode:" + msg + Arrays.asList(arguments));
- }
-
- /**
- * Returns transaction Id
- * @param transId
- */
- @Override
- public String postMDCInfoForEvent(String transId) {
-
- String transactionId = transId;
- if(transactionId == null || transactionId.isEmpty()){
- transactionId = UUID.randomUUID().toString();
- }
-
- return transactionId;
- }
-
- /**
- * Records a message
- * @param msg
- * @param arguments
- */
- @Override
- public void warn(MessageCodes msg, String... arguments){
-
- System.out.println(transId + "|" + className+" : "+"MessageCodes:" + msg + Arrays.asList(arguments));
- }
-
- /**
- * Records a message
- * @param msg
- * @param arg0
- * @param arguments
- */
- @Override
- public void warn(MessageCodes msg, Throwable arg0, String... arguments){
-
- System.out.println(transId + "|" + className+" : "+"MessageCodes:" + msg + Arrays.asList(arguments));
-
- }
-
- /**
- * Records a message
- * @param message
- * @param t
- */
- @Override
- public void debug(Object message, Throwable t) {
- System.out.println(transId + "|" + className+" : "+ message + ":" + t);
- }
-
- /**
- * Records an error message
- * @param message
- * @param t
- */
- @Override
- public void error(Object message, Throwable t) {
- System.out.println(transId + "|" + className+" : "+ message + ":" + t);
- }
-
- /**
- * Records a message
- * @param message
- * @param t
- */
- @Override
- public void info(Object message, Throwable t) {
- System.out.println(transId + "|" + className+" : "+ message + ":" + t);
- }
-
- /**
- * Records a message
- * @param message
- * @param t
- */
- @Override
- public void warn(Object message, Throwable t) {
- System.out.println(transId + "|" + className+" : "+ message + ":" + t);
- }
-
- /**
- * Records a message
- * @param message
- * @param t
- */
- @Override
- public void trace(Object message, Throwable t) {
- System.out.println(transId + "|" + className+" : "+ message + ":" + t);
- }
-
- /**
- * Records an audit message
- * @param arg0
- * @param t
- */
- @Override
- public void audit(Object arg0, Throwable t) {
- System.out.println(transId + "|" + className+" : "+ arg0 + ":" + t);
- }
-
- /**
- * Returns true for trace enabled, or false for not
- * @return boolean
- */
- @Override
- public boolean isTraceEnabled() {
- // default
- return false;
- }
-
- /**
- * Records transaction Id
- * @param transId
- */
- @Override
- public void postMDCInfoForTriggeredRule(String transId){
-
- System.out.println(transId);
- }
-
- /**
- * Records transaction Id
- * @param o
- */
- @Override
- public void postMDCInfoForEvent(Object o){
- System.out.println(o);
- }
+ }
+
+ /**
+ * Sets logging levels.
+ */
+ private void initLevel() {
+
+ if (PolicyLogger.getDebugLevel() == Level.DEBUG) {
+ isDebugEnabled = true;
+ isInfoEnabled = true;
+ isWarnEnabled = true;
+ } else {
+ isDebugEnabled = false;
+ }
+
+ if (PolicyLogger.getDebugLevel() == Level.INFO) {
+ isInfoEnabled = true;
+ isWarnEnabled = true;
+ isDebugEnabled = false;
+ }
+
+ if (PolicyLogger.getDebugLevel() == Level.OFF) {
+ isInfoEnabled = false;
+ isWarnEnabled = false;
+ isDebugEnabled = false;
+ }
+
+ if (PolicyLogger.getErrorLevel() == Level.OFF) {
+ isErrorEnabled = false;
+ }
+
+ if (PolicyLogger.getAuditLevel() == Level.OFF) {
+ isAuditEnabled = false;
+ }
+
+ if (PolicyLogger.getMetricsLevel() == Level.OFF) {
+ isMetricsEnabled = false;
+ }
+ }
+
+ /**
+ * Sets transaction Id.
+ */
+ @Override
+ public void setTransId(String transId) {
+
+ System.out.println(transId);
+ this.transId = transId;
+ }
+
+ /**
+ * Returns transaction Id.
+ */
+ @Override
+ public String getTransId() {
+
+ return transId;
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void debug(Object message) {
+
+ System.out.println(transId + "|" + className + " : " + message);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void debug(Object message, Throwable throwable) {
+ System.out.println(transId + "|" + className + " : " + message + ":" + throwable);
+ }
+
+ /**
+ * Records an error message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void error(Object message) {
+
+ System.out.println(transId + "|" + className + " : " + message);
+ }
+
+ /**
+ * Records an error message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void error(Object message, Throwable throwable) {
+ System.out.println(transId + "|" + className + " : " + message + ":" + throwable);
+ }
+
+ /**
+ * Records an error message.
+ *
+ * @param msg the message code
+ * @param throwable the throwable
+ * @param arguments the messages
+ */
+ @Override
+ public void error(MessageCodes msg, Throwable throwable, String... arguments) {
+ System.out.println(className + " : " + "MessageCodes :" + msg + Arrays.asList(arguments));
+ }
+
+ /**
+ * Records an error message.
+ *
+ * @param msg the message code
+ * @param arguments the messages
+ */
+ @Override
+ public void error(MessageCodes msg, String... arguments) {
+
+ System.out.println(transId + "|" + className + " : " + "MessageCode:" + msg + Arrays.asList(arguments));
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void info(Object message) {
+ System.out.println(transId + "|" + className + " : " + message);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void info(Object message, Throwable throwable) {
+ System.out.println(transId + "|" + className + " : " + message + ":" + throwable);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void warn(Object message) {
+ System.out.println(transId + "|" + className + " : " + message);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void warn(Object message, Throwable throwable) {
+ System.out.println(transId + "|" + className + " : " + message + ":" + throwable);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param msg the message code
+ * @param arguments the messages
+ */
+ @Override
+ public void warn(MessageCodes msg, String... arguments) {
+
+ System.out.println(transId + "|" + className + " : " + "MessageCodes:" + msg + Arrays.asList(arguments));
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param msg the message code
+ * @param throwable the throwable
+ * @param arguments the messages
+ */
+ @Override
+ public void warn(MessageCodes msg, Throwable throwable, String... arguments) {
+
+ System.out.println(transId + "|" + className + " : " + "MessageCodes:" + msg + Arrays.asList(arguments));
+
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void trace(Object message) {
+ System.out.println(transId + "|" + className + " : " + message);
+ }
+
+ /**
+ * Records a message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void trace(Object message, Throwable throwable) {
+ System.out.println(transId + "|" + className + " : " + message + ":" + throwable);
+ }
+
+ /**
+ * Returns true for debug enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isDebugEnabled() {
+ return isDebugEnabled;
+ }
+
+ /**
+ * Returns true for warn enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isWarnEnabled() {
+ return isWarnEnabled;
+ }
+
+ /**
+ * Returns true for info enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isInfoEnabled() {
+ return isInfoEnabled;
+ }
+
+ /**
+ * Returns true for error enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isErrorEnabled() {
+ return isErrorEnabled;
+ }
+
+ /**
+ * Returns true for audit enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isAuditEnabled() {
+
+ return isAuditEnabled;
+ }
+
+ /**
+ * Returns true for metrics enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isMetricsEnabled() {
+
+ return isMetricsEnabled;
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void audit(Object message) {
+
+ System.out.println(transId + "|" + className + " : " + message);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ @Override
+ public void audit(Object message, Throwable throwable) {
+ System.out.println(transId + "|" + className + " : " + message + ":" + throwable);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ */
+ @Override
+ public void recordAuditEventStart(String eventId) {
+
+ System.out.println(transId + "|" + className + " : " + eventId);
+
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ */
+ @Override
+ public void recordAuditEventStart(UUID eventId) {
+
+ System.out.println(eventId);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ * @param policyVersion the policy version
+ */
+ @Override
+ public void recordAuditEventEnd(String eventId, String rule, String policyVersion) {
+
+ System.out.println(className + " : " + eventId + ":" + rule + ":" + policyVersion);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ * @param policyVersion the policy version
+ */
+ @Override
+ public void recordAuditEventEnd(UUID eventId, String rule, String policyVersion) {
+
+ System.out.println(className + " : " + eventId + ":" + rule + ":" + policyVersion);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ */
+ @Override
+ public void recordAuditEventEnd(String eventId, String rule) {
+
+ System.out.println(className + " : " + eventId + ":" + rule);
+ }
+
+ /**
+ * Records an audit message.
+ *
+ * @param eventId the event ID
+ * @param rule the rule
+ */
+ @Override
+ public void recordAuditEventEnd(UUID eventId, String rule) {
+
+ System.out.println(className + " : " + eventId + ":" + rule);
+ }
+
+ /**
+ * Records a metrics message.
+ *
+ * @param eventId the event ID
+ * @param message the message
+ */
+ @Override
+ public void recordMetricEvent(String eventId, String message) {
+
+ System.out.println(className + " : " + "eventId:" + eventId + "message:" + message);
+
+ }
+
+ /**
+ * Records a metrics message.
+ *
+ * @param eventId the event ID
+ * @param message the message
+ */
+ @Override
+ public void recordMetricEvent(UUID eventId, String message) {
+
+ System.out.println(className + " : " + eventId + ":" + message);
+ }
+
+ /**
+ * Records a metrics message.
+ *
+ * @param message the message
+ */
+ @Override
+ public void metrics(Object message) {
+
+ System.out.println(className + " : " + message);
+ }
+
+ /**
+ * Returns transaction Id.
+ *
+ * @param transId the transaction ID
+ */
+ @Override
+ public String postMDCInfoForEvent(String transId) {
+
+ String transactionId = transId;
+ if (transactionId == null || transactionId.isEmpty()) {
+ transactionId = UUID.randomUUID().toString();
+ }
+
+ return transactionId;
+ }
+
+ /**
+ * Records transaction Id.
+ *
+ * @param message the message
+ */
+ @Override
+ public void postMDCInfoForEvent(Object message) {
+ System.out.println(message);
+ }
+
+
+ /**
+ * Returns true for trace enabled, or false for not.
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean isTraceEnabled() {
+ // default
+ return false;
+ }
+
+ /**
+ * Records transaction Id.
+ *
+ * @param transId the transaction ID
+ */
+ @Override
+ public void postMDCInfoForTriggeredRule(String transId) {
+
+ System.out.println(transId);
+ }
+
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/LoggingContext.java b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/LoggingContext.java
index 0786febd..a8dde087 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/LoggingContext.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/LoggingContext.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,41 +21,44 @@
package org.onap.policy.common.logging.nsa;
/**
- * An interface for providing data into the underlying logging context. Systems should use
- * this interface rather than log system specific MDC solutions in order to reduce dependencies.
+ * An interface for providing data into the underlying logging context. Systems should use this
+ * interface rather than log system specific MDC solutions in order to reduce dependencies.
*
- * A LoggingContext is specific to the calling thread.
+ * <p>A LoggingContext is specific to the calling thread.
*
*/
-public interface LoggingContext
-{
- /**
- * Put a key/value pair into the logging context, replacing an entry with the same key.
- * @param key
- * @param value
- */
- void put ( String key, String value );
+public interface LoggingContext {
+ /**
+ * Put a key/value pair into the logging context, replacing an entry with the same key.
+ *
+ * @param key the key
+ * @param value the value
+ */
+ void put(String key, String value);
- /**
- * Put a key/value pair into the logging context, replacing an entry with the same key.
- * @param key
- * @param value
- */
- void put ( String key, long value );
+ /**
+ * Put a key/value pair into the logging context, replacing an entry with the same key.
+ *
+ * @param key the key
+ * @param value the value
+ */
+ void put(String key, long value);
- /**
- * Get a string value, returning the default value if the value is missing.
- * @param key
- * @param defaultValue
- * @return a string value
- */
- String get ( String key, String defaultValue );
-
- /**
- * Get a long value, returning the default value if the value is missing or not a long.
- * @param key
- * @param defaultValue
- * @return a long value
- */
- long get ( String key, long defaultValue );
+ /**
+ * Get a string value, returning the default value if the value is missing.
+ *
+ * @param key the key
+ * @param defaultValue the default value
+ * @return a string value
+ */
+ String get(String key, String defaultValue);
+
+ /**
+ * Get a long value, returning the default value if the value is missing or not a long.
+ *
+ * @param key the key
+ * @param defaultValue the default value
+ * @return a long value
+ */
+ long get(String key, long defaultValue);
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/LoggingContextFactory.java b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/LoggingContextFactory.java
index b2ad76ca..85600671 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/LoggingContextFactory.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/LoggingContextFactory.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,37 +20,31 @@
package org.onap.policy.common.logging.nsa;
-
import org.onap.policy.common.logging.nsa.impl.SharedContext;
import org.onap.policy.common.logging.nsa.impl.Slf4jLoggingContext;
/**
- * A factory for setting up a LoggingContext
+ * A factory for setting up a LoggingContext.
*
*/
-public class LoggingContextFactory
-{
- public static class Builder
- {
+public class LoggingContextFactory {
+ public static class Builder {
+
+ private LoggingContext baseContext = null;
+ private boolean forShared = false;
- private LoggingContext fBase = null;
- private boolean fShared = false;
-
- public Builder withBaseContext ( LoggingContext lc )
- {
- fBase = lc;
- return this;
- }
+ public Builder withBaseContext(LoggingContext lc) {
+ baseContext = lc;
+ return this;
+ }
- public Builder forSharing ()
- {
- fShared = true;
- return this;
- }
+ public Builder forSharing() {
+ forShared = true;
+ return this;
+ }
- public LoggingContext build ()
- {
- return fShared ? new SharedContext ( fBase ) : new Slf4jLoggingContext ( fBase );
- }
- }
+ public LoggingContext build() {
+ return forShared ? new SharedContext(baseContext) : new Slf4jLoggingContext(baseContext);
+ }
+ }
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/SharedLoggingContext.java b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/SharedLoggingContext.java
index af0cc393..1d844fa0 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/SharedLoggingContext.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/SharedLoggingContext.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,17 +21,17 @@
package org.onap.policy.common.logging.nsa;
/**
- * A logging context must be thread-specific. Contexts that implement SharedLoggingContext
- * are expected to be shared across threads, and they have to be able to populate another
- * logging context with their data.
+ * A logging context must be thread-specific. Contexts that implement SharedLoggingContext are
+ * expected to be shared across threads, and they have to be able to populate another logging
+ * context with their data.
*
*/
-public interface SharedLoggingContext extends LoggingContext
-{
- /**
- * Copy this context's data to the given context. This must work across threads so that
- * a base context can be shared in another thread.
- * @param lc
- */
- void transferTo ( SharedLoggingContext lc );
+public interface SharedLoggingContext extends LoggingContext {
+ /**
+ * Copy this context's data to the given context. This must work across threads so that a base
+ * context can be shared in another thread.
+ *
+ * @param lc the shared logging context
+ */
+ void transferTo(SharedLoggingContext lc);
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java
index 97f61699..e5f5e65b 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,32 +27,27 @@ import org.onap.policy.common.logging.nsa.LoggingContext;
import org.onap.policy.common.logging.nsa.SharedLoggingContext;
/**
- * A shared logging context for SLF4J
+ * A shared logging context for SLF4J.
*
*/
-public class SharedContext extends Slf4jLoggingContext implements SharedLoggingContext
-{
- private final HashMap<String,String> fMap;
-
- public SharedContext ( LoggingContext base )
- {
- super ( base );
- fMap = new HashMap<> ();
- }
+public class SharedContext extends Slf4jLoggingContext implements SharedLoggingContext {
+ private final HashMap<String, String> contextMap;
- @Override
- public void put ( String key, String value )
- {
- super.put ( key, value );
- fMap.put ( key, value );
- }
+ public SharedContext(LoggingContext base) {
+ super(base);
+ contextMap = new HashMap<>();
+ }
- @Override
- public void transferTo ( SharedLoggingContext lc )
- {
- for ( Entry<String,String> e : fMap.entrySet () )
- {
- lc.put ( e.getKey(), e.getValue() );
- }
- }
+ @Override
+ public void put(String key, String value) {
+ super.put(key, value);
+ contextMap.put(key, value);
+ }
+
+ @Override
+ public void transferTo(SharedLoggingContext lc) {
+ for (Entry<String, String> e : contextMap.entrySet()) {
+ lc.put(e.getKey(), e.getValue());
+ }
+ }
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/Slf4jLoggingContext.java b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/Slf4jLoggingContext.java
index 628d4b9e..80bb2383 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/Slf4jLoggingContext.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/Slf4jLoggingContext.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,54 +20,42 @@
package org.onap.policy.common.logging.nsa.impl;
-import org.slf4j.MDC;
-
import org.onap.policy.common.logging.nsa.LoggingContext;
+import org.slf4j.MDC;
/**
- * A logging context for SLF4J
+ * A logging context for SLF4J.
*
*/
-public class Slf4jLoggingContext implements LoggingContext
-{
- public Slf4jLoggingContext ( LoggingContext base )
- {
- }
-
- @Override
- public void put ( String key, String value )
- {
- MDC.put ( key, value );
- }
-
- @Override
- public void put ( String key, long value )
- {
- put ( key, Long.toString(value));
- }
-
- @Override
- public String get ( String key, String defaultValue )
- {
- String result = MDC.get ( key );
- if ( result == null )
- {
- result = defaultValue;
- }
- return result;
- }
-
- @Override
- public long get ( String key, long defaultValue )
- {
- final String str = get ( key, Long.toString(defaultValue));
- try
- {
- return Long.parseLong ( str );
- }
- catch ( NumberFormatException x )
- {
- return defaultValue;
- }
- }
+public class Slf4jLoggingContext implements LoggingContext {
+ public Slf4jLoggingContext(LoggingContext base) {}
+
+ @Override
+ public void put(String key, String value) {
+ MDC.put(key, value);
+ }
+
+ @Override
+ public void put(String key, long value) {
+ put(key, Long.toString(value));
+ }
+
+ @Override
+ public String get(String key, String defaultValue) {
+ String result = MDC.get(key);
+ if (result == null) {
+ result = defaultValue;
+ }
+ return result;
+ }
+
+ @Override
+ public long get(String key, long defaultValue) {
+ final String str = get(key, Long.toString(defaultValue));
+ try {
+ return Long.parseLong(str);
+ } catch (NumberFormatException x) {
+ return defaultValue;
+ }
+ }
}
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/package-info.java b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/package-info.java
index 6f58bb0f..76554c49 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/package-info.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/package-info.java
@@ -19,9 +19,10 @@
*/
/**
- * This package provides a logging context infrastructure and a corresponding
- * implementation based on the SLF4J/Log4j "MDC" (Mapped Diagnostic Context) feature.
+ * This package provides a logging context infrastructure and a corresponding implementation based
+ * on the SLF4J/Log4j "MDC" (Mapped Diagnostic Context) feature.
*
*/
+
package org.onap.policy.common.logging.nsa;
diff --git a/common-logging/src/main/resources/org/onap/policy/common/logging/eelf/Resources.properties b/common-logging/src/main/resources/org/onap/policy/common/logging/eelf/Resources.properties
index b41dbb26..b344fac1 100644
--- a/common-logging/src/main/resources/org/onap/policy/common/logging/eelf/Resources.properties
+++ b/common-logging/src/main/resources/org/onap/policy/common/logging/eelf/Resources.properties
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# ONAP-Logging
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -32,12 +32,12 @@
#
######
#Error code classification category
-#100-199 Permission/Security Related
-#200-299 Availability/Timeout Related
-#300-399 Data Access/Integrity Related
-#400-499 Schema Interface type/validation Related
-#500-599 Business/Flow Processing Related
-#900-999 Unknown errors
+#100-199 Permission/Security Related
+#200-299 Availability/Timeout Related
+#300-399 Data Access/Integrity Related
+#400-499 Schema Interface type/validation Related
+#500-599 Business/Flow Processing Related
+#900-999 Unknown errors
#
#{classification} description
# I = Information
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/DroolsPDPMDCInfoTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/DroolsPDPMDCInfoTest.java
index 1be10dae..3dd62e69 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/DroolsPDPMDCInfoTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/DroolsPDPMDCInfoTest.java
@@ -20,24 +20,22 @@
package org.onap.policy.common.logging.eelf;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import org.junit.Test;
-/**
- *
- */
public class DroolsPDPMDCInfoTest {
- /**
- * Test method for {@link org.onap.policy.common.logging.eelf.DroolsPDPMDCInfo#getMDCInfo()}.
- */
- @Test
- public void testGetMDCInfo() {
- DroolsPDPMDCInfo di = new DroolsPDPMDCInfo();
-
- assertNotNull(di.getMDCInfo());
- assertEquals("Policy.droolsPdp", di.getMDCInfo().get(Configuration.MDC_SERVICE_NAME));
- }
+ /**
+ * Test method for {@link org.onap.policy.common.logging.eelf.DroolsPDPMDCInfo#getMDCInfo()}.
+ */
+ @Test
+ public void testGetMDCInfo() {
+ DroolsPDPMDCInfo di = new DroolsPDPMDCInfo();
+
+ assertNotNull(di.getMDCInfo());
+ assertEquals("Policy.droolsPdp", di.getMDCInfo().get(Configuration.MDC_SERVICE_NAME));
+ }
}
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/ErrorCodeMapTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/ErrorCodeMapTest.java
index ed4c879f..781be600 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/ErrorCodeMapTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/ErrorCodeMapTest.java
@@ -17,9 +17,12 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.common.logging.eelf;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.junit.Test;
import org.onap.policy.common.logging.eelf.ErrorCodeMap.ErrorCodeInfo;
@@ -40,17 +43,18 @@ public class ErrorCodeMapTest {
assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.ERROR_UNKNOWN));
assertNotNull(ErrorCodeMap.getErrorCodeInfo(MessageCodes.ERROR_AUDIT));
}
-
+
@Test
public void testErrorCodeInfoGetErrorCode() {
ErrorCodeInfo errorCodeInfo = ErrorCodeMap.getErrorCodeInfo(MessageCodes.EXCEPTION_ERROR);
assertEquals("POLICY-503E", errorCodeInfo.getErrorCode());
}
-
+
@Test
public void testErrorCodeInfoGetErrorDesc() {
ErrorCodeInfo errorCodeInfo = ErrorCodeMap.getErrorCodeInfo(MessageCodes.EXCEPTION_ERROR);
- assertEquals("This is an exception error message during the process. Please check the error message for detail information", errorCodeInfo.getErrorDesc());
+ assertEquals("This is an exception error message during the process. Please check the error message for detail "
+ + "information", errorCodeInfo.getErrorDesc());
}
}
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventDataTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventDataTest.java
index edd57ee1..f7aa733a 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventDataTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventDataTest.java
@@ -20,155 +20,154 @@
package org.onap.policy.common.logging.eelf;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import java.time.Instant;
import org.junit.Test;
-/**
- *
- */
public class EventDataTest {
- private static final Instant istart = Instant.ofEpochMilli(100000l);
- private static final Instant iend = Instant.ofEpochMilli(200000l);
-
- /**
- * Test method for {@link EventData#EventData()}.
- */
- @Test
- public void testEventData() {
- EventData d = new EventData();
-
- assertNull(d.getEndTime());
- assertNull(d.getRequestID());
- assertNull(d.getStartTime());
- }
-
- /**
- * Test method for {@link EventData#EventData(String, Instant, Instant)}.
- */
- @Test
- public void testEventDataStringInstantInstant() {
- EventData d = new EventData("myreq", istart, iend);
-
- assertEquals("myreq", d.getRequestID());
- assertEquals(istart, d.getStartTime());
- assertEquals(iend, d.getEndTime());
- }
-
- /**
- * Test method for {@link EventData#getRequestID()} and
- * {@link EventData#setRequestID(String)}.
- */
- @Test
- public void testGetSetRequestID() {
- EventData d = new EventData();
- assertNull(d.getRequestID());
-
- d.setRequestID("abc");
- assertEquals("abc", d.getRequestID());
-
- d.setRequestID("def");
- assertEquals("def", d.getRequestID());
- }
-
- /**
- * Test method for {@link EventData#getStartTime()} and
- * {@link EventData#setStartTime(Instant)}.
- */
- @Test
- public void testGetSetStartTime() {
- EventData d = new EventData();
- assertNull(d.getStartTime());
-
- d.setStartTime(istart);
- assertEquals(istart, d.getStartTime());
-
- d.setStartTime(iend);
- assertEquals(iend, d.getStartTime());
-
- // setting end-time should not effect start-time
- d.setEndTime(istart);
- assertEquals(iend, d.getStartTime());
- }
-
- /**
- * Test method for {@link EventData#getEndTime()} and
- * {@link EventData#setEndTime(Instant)}.
- */
- @Test
- public void testGetSetEndTime() {
- EventData d = new EventData();
- assertNull(d.getEndTime());
-
- d.setEndTime(iend);
- assertEquals(iend, d.getEndTime());
-
- d.setEndTime(istart);
- assertEquals(istart, d.getEndTime());
-
- // setting start-time should not effect end-time
- d.setStartTime(iend);
- assertEquals(istart, d.getEndTime());
- }
-
- /**
- * Test method for {@link EventData#toString()}.
- */
- @Test
- public void testToString() {
- EventData d = new EventData("myreq", istart, iend);
- assertEquals("myreq Starting Time : 1970-01-01T00:01:40Z Ending Time : 1970-01-01T00:03:20Z", d.toString());
- }
-
- /**
- * Test method for {@link EventData#hashCode()}.
- */
- @Test
- public void testHashCode() {
- int hc1 = new EventData("abc", istart, iend).hashCode();
-
- assertNotEquals(hc1, new EventData("abd", istart, iend).hashCode());
- assertEquals(hc1, new EventData("abc", iend, istart).hashCode());
- }
-
- /**
- * Test method for {@link EventData#equals(Object)}.
- */
- @Test
- public void testEqualsObject() {
- EventData d1 = new EventData("abc", istart, iend);
- EventData d2 = new EventData("abd", istart, iend);
- EventData d3 = new EventData("abc", iend, istart);
-
- // same object
- assertTrue(d1.equals(d1));
-
- // compare with null
- assertFalse(d1.equals(null));
-
- // compare with request id
- assertTrue(d1.equals("abc"));
- assertFalse(d1.equals("abd"));
-
- // compare with int - different class type
- assertFalse(d1.equals(10));
-
- // "this" has null request id
- assertFalse(new EventData().equals(d1));
-
- // both null
- assertTrue(new EventData().equals(new EventData()));
-
- // this request id is not null, other is null
- assertFalse(d1.equals(new EventData()));
-
- // neither null, same
- assertTrue(d1.equals(d3));
-
- // neither null, diff
- assertFalse(d1.equals(d2));
- }
+ private static final Instant istart = Instant.ofEpochMilli(100000L);
+ private static final Instant iend = Instant.ofEpochMilli(200000L);
+
+ /**
+ * Test method for {@link EventData#EventData()}.
+ */
+ @Test
+ public void testEventData() {
+ EventData eventData = new EventData();
+
+ assertNull(eventData.getEndTime());
+ assertNull(eventData.getRequestID());
+ assertNull(eventData.getStartTime());
+ }
+
+ /**
+ * Test method for {@link EventData#EventData(String, Instant, Instant)}.
+ */
+ @Test
+ public void testEventDataStringInstantInstant() {
+ EventData eventData = new EventData("myreq", istart, iend);
+
+ assertEquals("myreq", eventData.getRequestID());
+ assertEquals(istart, eventData.getStartTime());
+ assertEquals(iend, eventData.getEndTime());
+ }
+
+ /**
+ * Test method for {@link EventData#getRequestID()} and {@link EventData#setRequestID(String)}.
+ */
+ @Test
+ public void testGetSetRequestId() {
+ EventData eventData = new EventData();
+ assertNull(eventData.getRequestID());
+
+ eventData.setRequestID("abc");
+ assertEquals("abc", eventData.getRequestID());
+
+ eventData.setRequestID("def");
+ assertEquals("def", eventData.getRequestID());
+ }
+
+ /**
+ * Test method for {@link EventData#getStartTime()} and {@link EventData#setStartTime(Instant)}.
+ */
+ @Test
+ public void testGetSetStartTime() {
+ EventData eventData = new EventData();
+ assertNull(eventData.getStartTime());
+
+ eventData.setStartTime(istart);
+ assertEquals(istart, eventData.getStartTime());
+
+ eventData.setStartTime(iend);
+ assertEquals(iend, eventData.getStartTime());
+
+ // setting end-time should not effect start-time
+ eventData.setEndTime(istart);
+ assertEquals(iend, eventData.getStartTime());
+ }
+
+ /**
+ * Test method for {@link EventData#getEndTime()} and {@link EventData#setEndTime(Instant)}.
+ */
+ @Test
+ public void testGetSetEndTime() {
+ EventData eventData = new EventData();
+ assertNull(eventData.getEndTime());
+
+ eventData.setEndTime(iend);
+ assertEquals(iend, eventData.getEndTime());
+
+ eventData.setEndTime(istart);
+ assertEquals(istart, eventData.getEndTime());
+
+ // setting start-time should not effect end-time
+ eventData.setStartTime(iend);
+ assertEquals(istart, eventData.getEndTime());
+ }
+
+ /**
+ * Test method for {@link EventData#toString()}.
+ */
+ @Test
+ public void testToString() {
+ EventData eventData = new EventData("myreq", istart, iend);
+ assertEquals("myreq Starting Time : 1970-01-01T00:01:40Z Ending Time : 1970-01-01T00:03:20Z",
+ eventData.toString());
+ }
+
+ /**
+ * Test method for {@link EventData#hashCode()}.
+ */
+ @Test
+ public void testHashCode() {
+ int hc1 = new EventData("abc", istart, iend).hashCode();
+
+ assertNotEquals(hc1, new EventData("abd", istart, iend).hashCode());
+ assertEquals(hc1, new EventData("abc", iend, istart).hashCode());
+ }
+
+ /**
+ * Test method for {@link EventData#equals(Object)}.
+ */
+ @Test
+ public void testEqualsObject() {
+ final EventData d1 = new EventData("abc", istart, iend);
+ final EventData d2 = new EventData("abd", istart, iend);
+ final EventData d3 = new EventData("abc", iend, istart);
+
+ // same object
+ assertTrue(d1.equals(d1));
+
+ // compare with null
+ assertFalse(d1.equals(null));
+
+ // compare with request id
+ assertTrue(d1.equals("abc"));
+ assertFalse(d1.equals("abd"));
+
+ // compare with int - different class type
+ assertFalse(d1.equals(10));
+
+ // "this" has null request id
+ assertFalse(new EventData().equals(d1));
+
+ // both null
+ assertTrue(new EventData().equals(new EventData()));
+
+ // this request id is not null, other is null
+ assertFalse(d1.equals(new EventData()));
+
+ // neither null, same
+ assertTrue(d1.equals(d3));
+
+ // neither null, diff
+ assertFalse(d1.equals(d2));
+ }
}
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandlerTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandlerTest.java
index 68fd52de..d1d5983d 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandlerTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandlerTest.java
@@ -20,7 +20,7 @@
package org.onap.policy.common.logging.eelf;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
import java.time.Instant;
import java.util.concurrent.ConcurrentMap;
@@ -29,102 +29,102 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-/**
- *
- */
public class EventTrackInfoHandlerTest {
-
- private static final Instant inow = Instant.now();
- private static final Instant iexpired = Instant.ofEpochMilli(10000l);
-
- private static final EventData data1 = new EventData("abc", inow, inow);
- private static final EventData data2 = new EventData("def", inow, inow);
-
- private static EventTrackInfo tracker;
- private static ConcurrentMap<String, EventData> info;
-
- private EventTrackInfoHandler hdlr;
-
- @BeforeClass
- public static void setUpBeforeClass() {
- tracker = PolicyLogger.getEventTracker();
- info = tracker.getEventInfo();
- }
-
- @Before
- public void setUp() {
- info.clear();
-
- hdlr = new EventTrackInfoHandler();
- }
-
- @Test
- public void testNoEvents() {
- hdlr.run();
- assertEquals(0, info.size());
- }
-
- @Test
- public void testNothingExpired() {
- tracker.storeEventData(data1);
- tracker.storeEventData(data2);
-
- hdlr.run();
- assertEquals(2, info.size());
- }
-
- @Test
- public void testSomeExpired() {
- // not expired
- tracker.storeEventData(data1);
- tracker.storeEventData(data2);
-
- // start time is expired
- tracker.storeEventData(new EventData("expiredA", iexpired, inow));
- tracker.storeEventData(new EventData("expiredB", iexpired, inow));
-
- // end time is expired, but that has no impact - these should be retained
- EventData oka = new EventData("okA", inow, iexpired);
- EventData okb = new EventData("okB", inow, iexpired);
-
- tracker.storeEventData(oka);
- tracker.storeEventData(okb);
-
- hdlr.run();
- assertEquals(4, info.size());
-
- assertEquals(data1, info.get("abc"));
- assertEquals(data2, info.get("def"));
- assertEquals(oka, info.get("okA"));
- assertEquals(okb, info.get("okB"));
- }
-
- @Test
- public void testMultipleRuns() {
-
- hdlr.run();
- assertEquals(0, info.size());
-
- // not expired
- tracker.storeEventData(data1);
- tracker.storeEventData(data2);
-
- hdlr.run();
- assertEquals(2, info.size());
-
- // start time is expired
- tracker.storeEventData(new EventData("expiredA", iexpired, inow));
- tracker.storeEventData(new EventData("expiredB", iexpired, inow));
-
- // end time is expired, but that has no impact - these should be retained
- tracker.storeEventData(new EventData("okA", inow, iexpired));
- tracker.storeEventData(new EventData("okB", inow, iexpired));
-
- hdlr.run();
- assertEquals(4, info.size());
-
- hdlr.run();
- assertEquals(4, info.size());
- }
+
+ private static final Instant inow = Instant.now();
+ private static final Instant iexpired = Instant.ofEpochMilli(10000L);
+
+ private static final EventData data1 = new EventData("abc", inow, inow);
+ private static final EventData data2 = new EventData("def", inow, inow);
+
+ private static EventTrackInfo tracker;
+ private static ConcurrentMap<String, EventData> info;
+
+ private EventTrackInfoHandler hdlr;
+
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ tracker = PolicyLogger.getEventTracker();
+ info = tracker.getEventInfo();
+ }
+
+ /**
+ * Perform set up for test cases.
+ */
+ @Before
+ public void setUp() {
+ info.clear();
+
+ hdlr = new EventTrackInfoHandler();
+ }
+
+ @Test
+ public void testNoEvents() {
+ hdlr.run();
+ assertEquals(0, info.size());
+ }
+
+ @Test
+ public void testNothingExpired() {
+ tracker.storeEventData(data1);
+ tracker.storeEventData(data2);
+
+ hdlr.run();
+ assertEquals(2, info.size());
+ }
+
+ @Test
+ public void testSomeExpired() {
+ // not expired
+ tracker.storeEventData(data1);
+ tracker.storeEventData(data2);
+
+ // start time is expired
+ tracker.storeEventData(new EventData("expiredA", iexpired, inow));
+ tracker.storeEventData(new EventData("expiredB", iexpired, inow));
+
+ // end time is expired, but that has no impact - these should be retained
+ EventData oka = new EventData("okA", inow, iexpired);
+ EventData okb = new EventData("okB", inow, iexpired);
+
+ tracker.storeEventData(oka);
+ tracker.storeEventData(okb);
+
+ hdlr.run();
+ assertEquals(4, info.size());
+
+ assertEquals(data1, info.get("abc"));
+ assertEquals(data2, info.get("def"));
+ assertEquals(oka, info.get("okA"));
+ assertEquals(okb, info.get("okB"));
+ }
+
+ @Test
+ public void testMultipleRuns() {
+
+ hdlr.run();
+ assertEquals(0, info.size());
+
+ // not expired
+ tracker.storeEventData(data1);
+ tracker.storeEventData(data2);
+
+ hdlr.run();
+ assertEquals(2, info.size());
+
+ // start time is expired
+ tracker.storeEventData(new EventData("expiredA", iexpired, inow));
+ tracker.storeEventData(new EventData("expiredB", iexpired, inow));
+
+ // end time is expired, but that has no impact - these should be retained
+ tracker.storeEventData(new EventData("okA", inow, iexpired));
+ tracker.storeEventData(new EventData("okB", inow, iexpired));
+
+ hdlr.run();
+ assertEquals(4, info.size());
+
+ hdlr.run();
+ assertEquals(4, info.size());
+ }
}
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoTest.java
index 3690bc5c..7dc8fddc 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoTest.java
@@ -20,111 +20,111 @@
package org.onap.policy.common.logging.eelf;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import java.time.Instant;
import org.junit.Before;
import org.junit.Test;
-/**
- *
- */
public class EventTrackInfoTest {
-
- private static final Instant istart = Instant.ofEpochMilli(100000l);
- private static final Instant iend = Instant.ofEpochMilli(200000l);
-
- private static final EventData data1 = new EventData("abc", istart, iend);
- private static final EventData data2 = new EventData("def", iend, istart);
-
- private EventTrackInfo info;
-
- @Before
- public void setUp() {
- info = new EventTrackInfo();
-
- }
-
- /**
- * Test method for {@link EventTrackInfo#EventTrackInfo()}.
- */
- @Test
- public void testEventTrackInfo() {
- assertNotNull(info.getEventInfo());
- }
-
- /**
- * Test method for {@link EventTrackInfo#getEventDataByRequestID(String)}.
- */
- @Test
- public void testGetEventDataByRequestID() {
- info.storeEventData(data1);
- info.storeEventData(data2);
-
- assertTrue(data1 == info.getEventDataByRequestID("abc"));
- assertTrue(data2 == info.getEventDataByRequestID("def"));
- assertNull(info.getEventDataByRequestID("hello"));
- }
-
- /**
- * Test method for {@link EventTrackInfo#storeEventData(EventData)}.
- */
- @Test
- public void testStoreEventData() {
- // should ignore null
- info.storeEventData(null);
- assertTrue(info.getEventInfo().isEmpty());
-
- // should ignore if request id is null or empty
- info.storeEventData(new EventData());
- info.storeEventData(new EventData("", istart, iend));
- assertTrue(info.getEventInfo().isEmpty());
-
- info.storeEventData(data1);
- info.storeEventData(data2);
- assertEquals(2, info.getEventInfo().size());
-
- // look-up by request id
- assertTrue(data1 == info.getEventDataByRequestID("abc"));
- assertTrue(data2 == info.getEventDataByRequestID("def"));
-
- // doesn't replace existing value
- info.storeEventData(new EventData("abc", iend, istart));
- assertEquals(2, info.getEventInfo().size());
- assertTrue(data1 == info.getEventDataByRequestID("abc"));
- assertTrue(data2 == info.getEventDataByRequestID("def"));
- }
-
- /**
- * Test method for {@link EventTrackInfo#remove(String)}.
- */
- @Test
- public void testRemove() {
- info.storeEventData(data1);
- info.storeEventData(data2);
-
- info.remove("abc");
-
- // ensure only that item was removed
- assertEquals(1, info.getEventInfo().size());
-
- // look-up by request id
- assertNull(info.getEventDataByRequestID("abc"));
- assertTrue(data2 == info.getEventDataByRequestID("def"));
- }
-
- /**
- * Test method for {@link EventTrackInfo#getEventInfo()}.
- */
- @Test
- public void testGetEventInfo() {
- info.storeEventData(data1);
- info.storeEventData(data2);
-
- assertEquals(2, info.getEventInfo().size());
- assertTrue(data1 == info.getEventInfo().get("abc"));
- assertTrue(data2 == info.getEventInfo().get("def"));
- }
+
+ private static final Instant istart = Instant.ofEpochMilli(100000L);
+ private static final Instant iend = Instant.ofEpochMilli(200000L);
+
+ private static final EventData data1 = new EventData("abc", istart, iend);
+ private static final EventData data2 = new EventData("def", iend, istart);
+
+ private EventTrackInfo info;
+
+ @Before
+ public void setUp() {
+ info = new EventTrackInfo();
+
+ }
+
+ /**
+ * Test method for {@link EventTrackInfo#EventTrackInfo()}.
+ */
+ @Test
+ public void testEventTrackInfo() {
+ assertNotNull(info.getEventInfo());
+ }
+
+ /**
+ * Test method for {@link EventTrackInfo#getEventDataByRequestID(String)}.
+ */
+ @Test
+ public void testGetEventDataByRequestID() {
+ info.storeEventData(data1);
+ info.storeEventData(data2);
+
+ assertTrue(data1 == info.getEventDataByRequestID("abc"));
+ assertTrue(data2 == info.getEventDataByRequestID("def"));
+ assertNull(info.getEventDataByRequestID("hello"));
+ }
+
+ /**
+ * Test method for {@link EventTrackInfo#storeEventData(EventData)}.
+ */
+ @Test
+ public void testStoreEventData() {
+ // should ignore null
+ info.storeEventData(null);
+ assertTrue(info.getEventInfo().isEmpty());
+
+ // should ignore if request id is null or empty
+ info.storeEventData(new EventData());
+ info.storeEventData(new EventData("", istart, iend));
+ assertTrue(info.getEventInfo().isEmpty());
+
+ info.storeEventData(data1);
+ info.storeEventData(data2);
+ assertEquals(2, info.getEventInfo().size());
+
+ // look-up by request id
+ assertTrue(data1 == info.getEventDataByRequestID("abc"));
+ assertTrue(data2 == info.getEventDataByRequestID("def"));
+
+ // doesn't replace existing value
+ info.storeEventData(new EventData("abc", iend, istart));
+ assertEquals(2, info.getEventInfo().size());
+ assertTrue(data1 == info.getEventDataByRequestID("abc"));
+ assertTrue(data2 == info.getEventDataByRequestID("def"));
+ }
+
+ /**
+ * Test method for {@link EventTrackInfo#remove(String)}.
+ */
+ @Test
+ public void testRemove() {
+ info.storeEventData(data1);
+ info.storeEventData(data2);
+
+ info.remove("abc");
+
+ // ensure only that item was removed
+ assertEquals(1, info.getEventInfo().size());
+
+ // look-up by request id
+ assertNull(info.getEventDataByRequestID("abc"));
+ assertTrue(data2 == info.getEventDataByRequestID("def"));
+ }
+
+ /**
+ * Test method for {@link EventTrackInfo#getEventInfo()}.
+ */
+ @Test
+ public void testGetEventInfo() {
+ info.storeEventData(data1);
+ info.storeEventData(data2);
+
+ assertEquals(2, info.getEventInfo().size());
+ assertTrue(data1 == info.getEventInfo().get("abc"));
+ assertTrue(data2 == info.getEventInfo().get("def"));
+ }
}
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/PolicyLoggerTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/PolicyLoggerTest.java
index 18361ac1..8d6b6d68 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/PolicyLoggerTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/PolicyLoggerTest.java
@@ -17,6 +17,8 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
+
package org.onap.policy.common.logging.eelf;
import static com.att.eelf.configuration.Configuration.MDC_ALERT_SEVERITY;
@@ -27,27 +29,37 @@ import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN;
import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS;
import static com.att.eelf.configuration.Configuration.MDC_SERVICE_INSTANCE_ID;
import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import static org.onap.policy.common.logging.eelf.Configuration.PARTNER_NAME;
import static org.onap.policy.common.logging.eelf.Configuration.RESPONSE_CODE;
import static org.onap.policy.common.logging.eelf.Configuration.RESPONSE_DESCRIPTION;
import static org.onap.policy.common.logging.eelf.Configuration.SERVER_NAME;
import static org.onap.policy.common.logging.eelf.Configuration.STATUS_CODE;
-import static org.onap.policy.common.logging.util.TestUtils.*;
+import static org.onap.policy.common.logging.util.TestUtils.overrideStaticField;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFLogger.Level;
+
import java.time.Instant;
import java.util.Properties;
import java.util.UUID;
+
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.slf4j.MDC;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFLogger.Level;
public class PolicyLoggerTest {
-
+
+ /**
+ * Perform set up for test cases.
+ */
@Before
- public void setUp(){
+ public void setUp() {
Properties properties = new Properties();
properties.setProperty("policy.component", "XACML");
PolicyLogger.init(properties);
@@ -72,9 +84,9 @@ public class PolicyLoggerTest {
@Test
public void testSetAndGetMetricsLevelLevel() {
PolicyLogger.setMetricsLevel(Level.INFO);
- assertEquals(Level.INFO, PolicyLogger.getMetricsLevel());
+ assertEquals(Level.INFO, PolicyLogger.getMetricsLevel());
PolicyLogger.setMetricsLevel(Level.DEBUG);
- assertEquals(Level.DEBUG, PolicyLogger.getMetricsLevel());
+ assertEquals(Level.DEBUG, PolicyLogger.getMetricsLevel());
}
@Test
@@ -95,7 +107,7 @@ public class PolicyLoggerTest {
@Test
public void testPostMDCInfoForEventString() {
PolicyLogger.postMDCInfoForEvent("transactionId");
-
+
assertEquals("", MDC.get(MDC_REMOTE_HOST));
assertEquals("transactionId", MDC.get(MDC_KEY_REQUEST_ID));
assertEquals("Policy.xacmlPdp", MDC.get(MDC_SERVICE_NAME));
@@ -107,15 +119,15 @@ public class PolicyLoggerTest {
assertEquals("N/A", MDC.get(RESPONSE_CODE));
assertEquals("N/A", MDC.get(RESPONSE_DESCRIPTION));
}
-
+
@Test
public void testPostMDCInfoForEventStringDrools() {
Properties properties = new Properties();
properties.setProperty("policy.component", "DROOLS");
PolicyLogger.init(properties);
-
+
PolicyLogger.postMDCInfoForEvent("transactionId");
-
+
assertEquals("transactionId", MDC.get(MDC_KEY_REQUEST_ID));
assertEquals("Policy.droolsPdp", MDC.get(MDC_SERVICE_NAME));
assertEquals("Policy.droolsPdp.event", MDC.get(MDC_SERVICE_INSTANCE_ID));
@@ -130,7 +142,7 @@ public class PolicyLoggerTest {
@Test
public void testPostMDCInfoForEventObject() {
PolicyLogger.postMDCInfoForEvent(1);
-
+
assertEquals("", MDC.get(MDC_REMOTE_HOST));
assertEquals("1", MDC.get(MDC_KEY_REQUEST_ID));
assertEquals("Policy.xacmlPdp", MDC.get(MDC_SERVICE_NAME));
@@ -146,7 +158,7 @@ public class PolicyLoggerTest {
@Test
public void testPostMDCInfoForTriggeredRule() {
PolicyLogger.postMDCInfoForTriggeredRule("transactionId");
-
+
assertEquals("", MDC.get(MDC_REMOTE_HOST));
assertEquals("transactionId", MDC.get(MDC_KEY_REQUEST_ID));
assertEquals("Policy.droolsPdp", MDC.get(MDC_SERVICE_NAME));
@@ -161,7 +173,7 @@ public class PolicyLoggerTest {
@Test
public void testPostMDCUUIDForTriggeredRule() {
PolicyLogger.postMDCUUIDForTriggeredRule(1);
-
+
assertEquals("", MDC.get(MDC_REMOTE_HOST));
assertEquals("1", MDC.get(MDC_KEY_REQUEST_ID));
assertEquals("Policy.droolsPdp", MDC.get(MDC_SERVICE_NAME));
@@ -187,7 +199,7 @@ public class PolicyLoggerTest {
overrideStaticField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.info("str1", "str2");
Mockito.verify(mockLogger).info(MessageCodes.GENERAL_INFO, "str2");
- }
+ }
@Test
public void testInfoObject() {
@@ -202,17 +214,20 @@ public class PolicyLoggerTest {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.info(MessageCodes.ERROR_DATA_ISSUE, new NullPointerException(), "str1", "str2");
- Mockito.verify(mockLogger).info((MessageCodes)Mockito.any(), Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
+ Mockito.verify(mockLogger).info((MessageCodes) Mockito.any(),
+ Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
}
@Test
public void testInfoMessageCodesStringThrowableStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "debugLogger", mockLogger);
- PolicyLogger.info(MessageCodes.ERROR_DATA_ISSUE, "PolicyLoggerTest", new NullPointerException(), "str1", "str2");
- Mockito.verify(mockLogger).info((MessageCodes)Mockito.any(), Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
+ PolicyLogger.info(MessageCodes.ERROR_DATA_ISSUE, "PolicyLoggerTest", new NullPointerException(), "str1",
+ "str2");
+ Mockito.verify(mockLogger).info((MessageCodes) Mockito.any(),
+ Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
}
-
+
@Test
public void testWarnMessageCodesStringStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
@@ -227,7 +242,7 @@ public class PolicyLoggerTest {
overrideStaticField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.warn("str1", "str2");
Mockito.verify(mockLogger).warn(MessageCodes.GENERAL_INFO, "str2");
- }
+ }
@Test
public void testWarnObject() {
@@ -242,15 +257,18 @@ public class PolicyLoggerTest {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.warn(MessageCodes.ERROR_DATA_ISSUE, new NullPointerException(), "str1", "str2");
- Mockito.verify(mockLogger).warn((MessageCodes)Mockito.any(), Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
+ Mockito.verify(mockLogger).warn((MessageCodes) Mockito.any(),
+ Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
}
@Test
public void testWarnMessageCodesStringThrowableStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "debugLogger", mockLogger);
- PolicyLogger.warn(MessageCodes.ERROR_DATA_ISSUE, "PolicyLoggerTest", new NullPointerException(), "str1", "str2");
- Mockito.verify(mockLogger).warn((MessageCodes)Mockito.any(), Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
+ PolicyLogger.warn(MessageCodes.ERROR_DATA_ISSUE, "PolicyLoggerTest", new NullPointerException(), "str1",
+ "str2");
+ Mockito.verify(mockLogger).warn((MessageCodes) Mockito.any(),
+ Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
}
@Test
@@ -268,7 +286,8 @@ public class PolicyLoggerTest {
PolicyLogger.error("str1", "str2");
Mockito.verify(mockLogger).error(MessageCodes.GENERAL_ERROR, "str2");
assertEquals("POLICY-515E", MDC.get("ErrorCode"));
- assertEquals("This is a general error message during the process. Please check the error message for detail information", MDC.get("ErrorDescription"));
+ assertEquals("This is a general error message during the process. Please check the error message for detail "
+ + "information", MDC.get("ErrorDescription"));
}
@Test
@@ -279,7 +298,8 @@ public class PolicyLoggerTest {
Mockito.verify(mockLogger).error(MessageCodes.GENERAL_ERROR, "str1");
assertEquals("ERROR", MDC.get("ErrorCategory"));
assertEquals("POLICY-515E", MDC.get("ErrorCode"));
- assertEquals("This is a general error message during the process. Please check the error message for detail information", MDC.get("ErrorDescription"));
+ assertEquals("This is a general error message during the process. Please check the error message for detail "
+ + "information", MDC.get("ErrorDescription"));
}
@Test
@@ -290,7 +310,8 @@ public class PolicyLoggerTest {
Mockito.verify(mockLogger).error(MessageCodes.GENERAL_ERROR, "1");
assertEquals("ERROR", MDC.get("ErrorCategory"));
assertEquals("POLICY-515E", MDC.get("ErrorCode"));
- assertEquals("This is a general error message during the process. Please check the error message for detail information", MDC.get("ErrorDescription"));
+ assertEquals("This is a general error message during the process. Please check the error message for detail "
+ + "information", MDC.get("ErrorDescription"));
}
@Test
@@ -298,15 +319,18 @@ public class PolicyLoggerTest {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "errorLogger", mockLogger);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, new NullPointerException(), "str1", "str2");
- Mockito.verify(mockLogger).error((MessageCodes)Mockito.any(), Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
+ Mockito.verify(mockLogger).error((MessageCodes) Mockito.any(),
+ Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
}
@Test
public void testErrorMessageCodesStringThrowableStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "errorLogger", mockLogger);
- PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, "PolicyLoggerTest", new NullPointerException(), "str1", "str2");
- Mockito.verify(mockLogger).error((MessageCodes)Mockito.any(), Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, "PolicyLoggerTest", new NullPointerException(), "str1",
+ "str2");
+ Mockito.verify(mockLogger).error((MessageCodes) Mockito.any(),
+ Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
}
@Test
@@ -374,15 +398,18 @@ public class PolicyLoggerTest {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "debugLogger", mockLogger);
PolicyLogger.debug(MessageCodes.ERROR_DATA_ISSUE, new NullPointerException(), "str1", "str2");
- Mockito.verify(mockLogger).debug((MessageCodes)Mockito.any(), Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
+ Mockito.verify(mockLogger).debug((MessageCodes) Mockito.any(),
+ Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
}
@Test
public void testDebugMessageCodesStringThrowableStringArray() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "debugLogger", mockLogger);
- PolicyLogger.debug(MessageCodes.ERROR_DATA_ISSUE, "PolicyLoggerTest", new NullPointerException(), "str1", "str2");
- Mockito.verify(mockLogger).debug((MessageCodes)Mockito.any(), Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
+ PolicyLogger.debug(MessageCodes.ERROR_DATA_ISSUE, "PolicyLoggerTest", new NullPointerException(), "str1",
+ "str2");
+ Mockito.verify(mockLogger).debug((MessageCodes) Mockito.any(),
+ Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
}
@Test
@@ -411,7 +438,7 @@ public class PolicyLoggerTest {
assertFalse(PolicyLogger.isWarnEnabled());
assertTrue(PolicyLogger.isWarnEnabled());
}
-
+
@Test
public void testIsInfoEnabled1() {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
@@ -459,7 +486,7 @@ public class PolicyLoggerTest {
public void testRecordAuditEventStartAndEnd() {
PolicyLogger.recordAuditEventStart("eventId");
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
-
+
PolicyLogger.recordAuditEventEnd("eventId", "rule");
assertNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
}
@@ -479,7 +506,7 @@ public class PolicyLoggerTest {
public void testRecordAuditEventEndStringStringString() {
PolicyLogger.recordAuditEventStart("eventId");
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
-
+
PolicyLogger.recordAuditEventEnd("eventId", "rule", "policyVersion");
assertNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
}
@@ -499,7 +526,7 @@ public class PolicyLoggerTest {
public void testCreatAuditEventTrackingRecordStringStringString() {
PolicyLogger.recordAuditEventStart("eventId");
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
-
+
PolicyLogger.creatAuditEventTrackingRecord("eventId", "rule", "policyVersion");
assertNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
}
@@ -511,7 +538,7 @@ public class PolicyLoggerTest {
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get(uuid.toString()));
PolicyLogger.creatAuditEventTrackingRecord(uuid, "rule");
- assertNull(PolicyLogger.getEventTracker().getEventInfo().get(uuid.toString()));
+ assertNull(PolicyLogger.getEventTracker().getEventInfo().get(uuid.toString()));
}
@Test
@@ -544,7 +571,8 @@ public class PolicyLoggerTest {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "metricsLogger", mockLogger);
PolicyLogger.recordMetricEvent("eventId");
- Mockito.verify(mockLogger).info(Mockito.eq(MessageCodes.RULE_METRICS_INFO), Mockito.anyString(), Mockito.eq("eventId"));
+ Mockito.verify(mockLogger).info(Mockito.eq(MessageCodes.RULE_METRICS_INFO), Mockito.anyString(),
+ Mockito.eq("eventId"));
}
@Test
@@ -552,7 +580,8 @@ public class PolicyLoggerTest {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "metricsLogger", mockLogger);
PolicyLogger.metrics("str1");
- Mockito.verify(mockLogger).info(Mockito.eq(MessageCodes.RULE_METRICS_INFO), Mockito.anyString(), Mockito.eq("str1"));
+ Mockito.verify(mockLogger).info(Mockito.eq(MessageCodes.RULE_METRICS_INFO), Mockito.anyString(),
+ Mockito.eq("str1"));
}
@Test
@@ -560,7 +589,8 @@ public class PolicyLoggerTest {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "metricsLogger", mockLogger);
PolicyLogger.metrics("PolicyLoggerTest", 1);
- Mockito.verify(mockLogger).info(Mockito.eq(MessageCodes.RULE_METRICS_INFO), Mockito.anyString(), Mockito.eq("1"));
+ Mockito.verify(mockLogger).info(Mockito.eq(MessageCodes.RULE_METRICS_INFO), Mockito.anyString(),
+ Mockito.eq("1"));
}
@Test
@@ -568,7 +598,8 @@ public class PolicyLoggerTest {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "metricsLogger", mockLogger);
PolicyLogger.metrics(1);
- Mockito.verify(mockLogger).info(Mockito.eq(MessageCodes.RULE_METRICS_INFO), Mockito.anyString(), Mockito.eq("1"));
+ Mockito.verify(mockLogger).info(Mockito.eq(MessageCodes.RULE_METRICS_INFO), Mockito.anyString(),
+ Mockito.eq("1"));
}
@Test
@@ -583,7 +614,7 @@ public class PolicyLoggerTest {
public void testInitNullProperties() {
PolicyLogger.init(null);
}
-
+
@Test
public void testInit() {
Properties properties = new Properties();
@@ -597,24 +628,24 @@ public class PolicyLoggerTest {
properties.setProperty("concurrentHashMap.limit", "0");
properties.setProperty("stop.check.point", "0");
properties.setProperty("logger.property", "LOG4J");
-
+
PolicyLogger.init(properties);
}
-
+
@Test
public void testSetDebugLevelString() {
PolicyLogger.setOverrideLogbackLevel(true);
PolicyLogger.setDebugLevel("TRACE");
assertEquals(Level.TRACE, PolicyLogger.getDebugLevel());
}
-
+
@Test
public void testSetErrorLevelStringOff() {
PolicyLogger.setOverrideLogbackLevel(true);
PolicyLogger.setErrorLevel("OFF");
assertEquals(Level.OFF, PolicyLogger.getErrorLevel());
}
-
+
@Test
public void testSetErrorLevelStringOther() {
PolicyLogger.setOverrideLogbackLevel(true);
@@ -628,7 +659,7 @@ public class PolicyLoggerTest {
PolicyLogger.setMetricsLevel("OFF");
assertEquals(Level.OFF, PolicyLogger.getMetricsLevel());
}
-
+
@Test
public void testSetMetricsLevelStringOther() {
PolicyLogger.setOverrideLogbackLevel(true);
@@ -642,7 +673,7 @@ public class PolicyLoggerTest {
PolicyLogger.setAuditLevel("OFF");
assertEquals(Level.OFF, PolicyLogger.getAuditLevel());
}
-
+
@Test
public void testSetAuditLevelStringOther() {
PolicyLogger.setOverrideLogbackLevel(true);
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/EelfLoggerTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/EelfLoggerTest.java
index 6d6399b2..a7e835ce 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/EelfLoggerTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/EelfLoggerTest.java
@@ -17,21 +17,29 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.common.logging.flexlogger;
import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import static org.onap.policy.common.logging.util.TestUtils.overrideStaticField;
+
+import com.att.eelf.configuration.EELFLogger;
+
import java.util.UUID;
+
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
import org.slf4j.MDC;
-import com.att.eelf.configuration.EELFLogger;
public class EelfLoggerTest {
-
+
EelfLogger eelfLogger = new EelfLogger("EelfLoggerTest", "transactionId");
@Test
@@ -72,7 +80,7 @@ public class EelfLoggerTest {
public void testEelfLoggerStringString() {
new EelfLogger("EelfLoggerTest", "transactionId");
assertEquals("transactionId", PolicyLogger.getTransId());
- }
+ }
@Test
public void testSetAndGetTransId() {
@@ -128,7 +136,7 @@ public class EelfLoggerTest {
Mockito.when(mockLogger.isDebugEnabled()).thenReturn(false).thenReturn(true);
assertFalse(eelfLogger.isDebugEnabled());
assertTrue(eelfLogger.isDebugEnabled());
-
+
}
@Test
@@ -193,7 +201,8 @@ public class EelfLoggerTest {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "debugLogger", mockLogger);
eelfLogger.debug("message", new NullPointerException());
- Mockito.verify(mockLogger).debug((MessageCodes)Mockito.any(), Mockito.startsWith("message:java.lang.NullPointerException"));
+ Mockito.verify(mockLogger).debug((MessageCodes) Mockito.any(),
+ Mockito.startsWith("message:java.lang.NullPointerException"));
}
@Test
@@ -201,7 +210,8 @@ public class EelfLoggerTest {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "errorLogger", mockLogger);
eelfLogger.error("message", new NullPointerException());
- Mockito.verify(mockLogger).error((MessageCodes)Mockito.any(), Mockito.startsWith("message:java.lang.NullPointerException"));
+ Mockito.verify(mockLogger).error((MessageCodes) Mockito.any(),
+ Mockito.startsWith("message:java.lang.NullPointerException"));
eelfLogger.error("message", new NullPointerException());
}
@@ -210,7 +220,8 @@ public class EelfLoggerTest {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "debugLogger", mockLogger);
eelfLogger.info("message", new NullPointerException());
- Mockito.verify(mockLogger).info((MessageCodes)Mockito.any(), Mockito.startsWith("message:java.lang.NullPointerException"));
+ Mockito.verify(mockLogger).info((MessageCodes) Mockito.any(),
+ Mockito.startsWith("message:java.lang.NullPointerException"));
}
@Test
@@ -218,7 +229,8 @@ public class EelfLoggerTest {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "debugLogger", mockLogger);
eelfLogger.warn("message", new NullPointerException());
- Mockito.verify(mockLogger).warn((MessageCodes)Mockito.any(), Mockito.startsWith("message:java.lang.NullPointerException"));
+ Mockito.verify(mockLogger).warn((MessageCodes) Mockito.any(),
+ Mockito.startsWith("message:java.lang.NullPointerException"));
}
@Test
@@ -254,7 +266,7 @@ public class EelfLoggerTest {
public void testRecordAuditEventEndStringStringString() {
eelfLogger.recordAuditEventStart("eventId");
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
-
+
eelfLogger.recordAuditEventEnd("eventId", "rule", "policyVersion");
assertNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
}
@@ -273,7 +285,7 @@ public class EelfLoggerTest {
public void testRecordAuditEventEndStringString() {
eelfLogger.recordAuditEventStart("eventId");
assertNotNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
-
+
eelfLogger.recordAuditEventEnd("eventId", "rule");
assertNull(PolicyLogger.getEventTracker().getEventInfo().get("eventId"));
}
@@ -306,7 +318,8 @@ public class EelfLoggerTest {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "metricsLogger", mockLogger);
eelfLogger.metrics(1);
- Mockito.verify(mockLogger).info(Mockito.eq(MessageCodes.RULE_METRICS_INFO), Mockito.anyString(), Mockito.eq("1"));
+ Mockito.verify(mockLogger).info(Mockito.eq(MessageCodes.RULE_METRICS_INFO), Mockito.anyString(),
+ Mockito.eq("1"));
}
@Test
@@ -314,7 +327,8 @@ public class EelfLoggerTest {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "errorLogger", mockLogger);
eelfLogger.error(MessageCodes.GENERAL_ERROR, new NullPointerException(), "str1", "str2");
- Mockito.verify(mockLogger).error((MessageCodes)Mockito.any(), Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
+ Mockito.verify(mockLogger).error((MessageCodes) Mockito.any(),
+ Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
}
@Test
@@ -323,7 +337,7 @@ public class EelfLoggerTest {
overrideStaticField(PolicyLogger.class, "errorLogger", mockLogger);
eelfLogger.error(MessageCodes.GENERAL_ERROR, "str1", "str2");
Mockito.verify(mockLogger).error(MessageCodes.GENERAL_ERROR, "str1", "str2");
-
+
}
@Test
@@ -345,8 +359,9 @@ public class EelfLoggerTest {
EELFLogger mockLogger = Mockito.mock(EELFLogger.class);
overrideStaticField(PolicyLogger.class, "debugLogger", mockLogger);
eelfLogger.warn(MessageCodes.GENERAL_ERROR, new NullPointerException(), "str1", "str2");
- Mockito.verify(mockLogger).warn((MessageCodes)Mockito.any(), Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
-
+ Mockito.verify(mockLogger).warn((MessageCodes) Mockito.any(),
+ Mockito.startsWith("str1:str2:java.lang.NullPointerException"));
+
}
@Test
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java
index af7edcab..57afc9f7 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java
@@ -17,13 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.common.logging.flexlogger;
-import static org.junit.Assert.*;
-import static org.onap.policy.common.logging.util.TestUtils.*;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertSame;
+import static org.onap.policy.common.logging.util.TestUtils.overrideStaticField;
+
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
+
import org.junit.Test;
import org.onap.policy.common.logging.flexlogger.FlexLogger.PropertiesCallBack;
@@ -32,81 +36,81 @@ public class FlexLoggerTest {
@Test
public void testGetLoggerClassOfQEelf() {
overrideStaticField(FlexLogger.class, "loggerType", LoggerType.EELF);
- Logger logger = FlexLogger.getLogger((Class)null);
- assertSame(logger, FlexLogger.getLogger((Class)null));
- assertNotEquals(logger, FlexLogger.getLogger(String.class));
+ Logger logger = FlexLogger.getLogger((Class) null);
+ assertSame(logger, FlexLogger.getLogger((Class) null));
+ assertNotEquals(logger, FlexLogger.getLogger(String.class));
}
-
+
@Test
public void testGetLoggerClassOfQLog4j() {
overrideStaticField(FlexLogger.class, "loggerType", LoggerType.LOG4J);
Logger logger = FlexLogger.getLogger(this.getClass());
assertSame(logger, FlexLogger.getLogger(this.getClass()));
}
-
+
@Test
public void testGetLoggerClassOfQSystemOut() {
overrideStaticField(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT);
Logger logger = FlexLogger.getLogger(this.getClass());
assertSame(logger, FlexLogger.getLogger(this.getClass()));
}
-
+
@Test
public void testGetLoggerStringEelf() {
overrideStaticField(FlexLogger.class, "loggerType", LoggerType.EELF);
Logger logger = FlexLogger.getLogger("str1");
assertSame(logger, FlexLogger.getLogger("str1"));
}
-
+
@Test
public void testGetLoggerStringLog4j() {
overrideStaticField(FlexLogger.class, "loggerType", LoggerType.LOG4J);
Logger logger = FlexLogger.getLogger("str1");
assertSame(logger, FlexLogger.getLogger("str1"));
}
-
+
@Test
public void testGetLoggerStringSystemOut() {
overrideStaticField(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT);
Logger logger = FlexLogger.getLogger("str1");
assertSame(logger, FlexLogger.getLogger("str1"));
}
-
+
@Test
public void testGetLoggerClassOfQBooleanEelf() {
overrideStaticField(FlexLogger.class, "loggerType", LoggerType.EELF);
Logger logger = FlexLogger.getLogger(this.getClass(), true);
assertSame(logger, FlexLogger.getLogger(this.getClass(), true));
}
-
+
@Test
public void testGetLoggerClassOfQBooleanLog4j() {
overrideStaticField(FlexLogger.class, "loggerType", LoggerType.LOG4J);
Logger logger = FlexLogger.getLogger(this.getClass(), true);
assertSame(logger, FlexLogger.getLogger(this.getClass(), true));
}
-
+
@Test
public void testGetLoggerClassOfQBooleanSystemOut() {
overrideStaticField(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT);
Logger logger = FlexLogger.getLogger(this.getClass(), true);
assertSame(logger, FlexLogger.getLogger(this.getClass(), true));
}
-
+
@Test
public void testGetLoggerStringBooleanEelf() {
overrideStaticField(FlexLogger.class, "loggerType", LoggerType.EELF);
Logger logger = FlexLogger.getLogger("str1", true);
assertSame(logger, FlexLogger.getLogger("str1", true));
}
-
+
@Test
public void testGetLoggerStringBooleanLog4j() {
overrideStaticField(FlexLogger.class, "loggerType", LoggerType.LOG4J);
Logger logger = FlexLogger.getLogger("str1", true);
assertSame(logger, FlexLogger.getLogger("str1", true));
}
-
+
@Test
public void testGetLoggerStringBooleanSystemOut() {
overrideStaticField(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT);
@@ -118,15 +122,15 @@ public class FlexLoggerTest {
public void testGetClassName() {
assertNotEquals("FlexLogger", new FlexLogger().getClassName());
}
-
+
@Test
- public void testPropertiesCallBack() throws IOException{
- PropertiesCallBack propertiesCallBack = new PropertiesCallBack("name");
+ public void testPropertiesCallBack() throws IOException {
Set<String> changedKeys = new HashSet<>();
changedKeys.add("debugLogger.level");
changedKeys.add("metricsLogger.level");
changedKeys.add("error.level");
changedKeys.add("audit.level");
+ PropertiesCallBack propertiesCallBack = new PropertiesCallBack("name");
propertiesCallBack.propertiesChanged(PropertyUtil.getProperties("config/policyLogger.properties"), changedKeys);
}
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/Logger4JTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/Logger4JTest.java
index 3650b18a..852e7f1b 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/Logger4JTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/Logger4JTest.java
@@ -17,10 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.common.logging.flexlogger;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.util.UUID;
+
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
import org.junit.Test;
@@ -29,7 +36,7 @@ import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.util.TestUtils;
public class Logger4JTest {
-
+
private Logger4J logger4J = new Logger4J("str1", "Logger4JTest");
@Test
@@ -215,7 +222,8 @@ public class Logger4JTest {
TestUtils.overrideField(Logger4J.class, logger4J, "log", logger);
logger4J.setTransId("transactionId");
logger4J.error(MessageCodes.GENERAL_ERROR, new NullPointerException(), "str1", "str2");
- Mockito.verify(logger).error("transactionId|Logger4JTest|MessageCodes :" + MessageCodes.GENERAL_ERROR + "[str1, str2]");
+ Mockito.verify(logger)
+ .error("transactionId|Logger4JTest|MessageCodes :" + MessageCodes.GENERAL_ERROR + "[str1, str2]");
}
@Test
@@ -224,7 +232,8 @@ public class Logger4JTest {
TestUtils.overrideField(Logger4J.class, logger4J, "log", logger);
logger4J.setTransId("transactionId");
logger4J.error(MessageCodes.GENERAL_ERROR, "str1", "str2");
- Mockito.verify(logger).error("transactionId|Logger4JTest|MessageCode:" + MessageCodes.GENERAL_ERROR + "[str1, str2]");
+ Mockito.verify(logger)
+ .error("transactionId|Logger4JTest|MessageCode:" + MessageCodes.GENERAL_ERROR + "[str1, str2]");
}
@Test
@@ -232,7 +241,7 @@ public class Logger4JTest {
String returnedTransactionId = logger4J.postMDCInfoForEvent("transactionId");
assertEquals("transactionId", returnedTransactionId);
}
-
+
@Test
public void testPostMDCInfoForEventEmptyString() {
String returnedTransactionId = logger4J.postMDCInfoForEvent("");
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/PropertyUtilTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/PropertyUtilTest.java
index b4fd5362..d97df4ce 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/PropertyUtilTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/PropertyUtilTest.java
@@ -17,98 +17,105 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.common.logging.flexlogger;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.common.logging.flexlogger.PropertyUtil.Listener;
public class PropertyUtilTest {
-
+
private static final File FILE = new File("target/test.properties");
private TestListener testListener = new TestListener();
-
+
+ /**
+ * Perform test case set up.
+ */
@Before
- public void setUp() throws IOException{
+ public void setUp() throws IOException {
FileOutputStream fileOutputStream = new FileOutputStream(FILE);
Properties properties = new Properties();
properties.put("testProperty", "testValue");
properties.store(fileOutputStream, "");
fileOutputStream.close();
}
-
+
@After
- public void tearDown() throws IOException{
+ public void tearDown() throws IOException {
PropertyUtil.stopListening(FILE, testListener);
FILE.delete();
- }
-
+ }
+
@Test
- public void testGetProperties() throws IOException{
+ public void testGetProperties() throws IOException {
FileOutputStream fileOutputStream = new FileOutputStream(FILE);
Properties properties = new Properties();
properties.put("testProperty", "testValue");
properties.store(fileOutputStream, "");
fileOutputStream.close();
-
+
Properties readProperties = PropertyUtil.getProperties(FILE, testListener);
assertEquals("testValue", readProperties.getProperty("testProperty"));
}
-
+
@Test
- public void testPropertiesChanged() throws IOException, InterruptedException{
+ public void testPropertiesChanged() throws IOException, InterruptedException {
PropertyUtil.getProperties(FILE, testListener);
-
+
FileOutputStream fileOutputStream = new FileOutputStream(FILE);
Properties newProperties = new Properties();
newProperties.put("testProperty", "testValueNew");
newProperties.store(fileOutputStream, "");
-
+
assertTrue(testListener.isPropertiesChangedInvoked());
-
+
}
-
+
@Test
- public void testStopListening() throws IOException{
+ public void testStopListening() throws IOException {
FileOutputStream fileOutputStream = new FileOutputStream(FILE);
Properties properties = new Properties();
properties.put("testProperty", "testValue");
properties.store(fileOutputStream, "");
-
+
Properties readProperties = PropertyUtil.getProperties(FILE, testListener);
assertEquals("testValue", readProperties.getProperty("testProperty"));
-
+
PropertyUtil.stopListening(FILE, testListener);
-
+
properties.put("testProperty", "testValueNew");
properties.store(fileOutputStream, "");
fileOutputStream.close();
readProperties = PropertyUtil.getProperties(FILE, testListener);
- // If stopListening did not remove the listener, the properties file will not be re-read until poll expires and
+ // If stopListening did not remove the listener, the properties file will not be re-read
+ // until poll expires and
// hence "testValue" will be returned here instead of "testNewValue"
- assertEquals("testValueNew", readProperties.getProperty("testProperty"));
+ assertEquals("testValueNew", readProperties.getProperty("testProperty"));
}
-
+
private class TestListener implements Listener {
-
+
boolean propertiesChangedInvoked = false;
@Override
public void propertiesChanged(Properties properties, Set<String> changedKeys) {
propertiesChangedInvoked = true;
}
-
- public boolean isPropertiesChangedInvoked() throws InterruptedException{
- for (int i =0; i<20; i++){
- if (propertiesChangedInvoked){
+
+ public boolean isPropertiesChangedInvoked() throws InterruptedException {
+ for (int i = 0; i < 20; i++) {
+ if (propertiesChangedInvoked) {
return true;
}
Thread.sleep(1000);
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/SystemOutLoggerTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/SystemOutLoggerTest.java
index ceec3cce..cd16a3fd 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/SystemOutLoggerTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/SystemOutLoggerTest.java
@@ -17,19 +17,25 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.common.logging.flexlogger;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import com.att.eelf.configuration.EELFLogger.Level;
+
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.UUID;
+
import org.junit.Test;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
-import com.att.eelf.configuration.EELFLogger.Level;
public class SystemOutLoggerTest {
-
+
SystemOutLogger systemOutLogger = new SystemOutLogger("SystemOutLoggerTest");
@Test
@@ -48,7 +54,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
systemOutLogger.setTransId("transactionId");
System.setOut(ps);
systemOutLogger.debug("message");
@@ -64,7 +70,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
systemOutLogger.setTransId("transactionId");
System.setOut(ps);
systemOutLogger.error("message");
@@ -80,7 +86,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
systemOutLogger.setTransId("transactionId");
System.setOut(ps);
systemOutLogger.info("message");
@@ -96,7 +102,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
systemOutLogger.setTransId("transactionId");
System.setOut(ps);
systemOutLogger.warn("message");
@@ -112,7 +118,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
systemOutLogger.setTransId("transactionId");
System.setOut(ps);
systemOutLogger.trace("message");
@@ -188,7 +194,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
systemOutLogger.setTransId("transactionId");
System.setOut(ps);
systemOutLogger.audit("message");
@@ -204,7 +210,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
systemOutLogger.setTransId("transactionId");
System.setOut(ps);
systemOutLogger.recordAuditEventStart("eventId");
@@ -220,7 +226,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
UUID uuid = UUID.randomUUID();
System.setOut(ps);
systemOutLogger.recordAuditEventStart(uuid);
@@ -236,7 +242,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.recordAuditEventEnd("eventId", "rule", "policyVersion");
assertTrue(baos.toString().contains("SystemOutLoggerTest : eventId:rule:policyVersion"));
@@ -251,7 +257,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
UUID uuid = UUID.randomUUID();
System.setOut(ps);
systemOutLogger.recordAuditEventEnd(uuid, "rule", "policyVersion");
@@ -267,7 +273,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.recordAuditEventEnd("eventId", "rule");
assertTrue(baos.toString().contains("SystemOutLoggerTest : eventId:rule"));
@@ -282,7 +288,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
UUID uuid = UUID.randomUUID();
System.setOut(ps);
systemOutLogger.recordAuditEventEnd(uuid, "rule");
@@ -298,7 +304,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.recordMetricEvent("eventId", "rule");
assertTrue(baos.toString(), baos.toString().contains("SystemOutLoggerTest : eventId:eventIdmessage:rule"));
@@ -313,7 +319,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
UUID uuid = UUID.randomUUID();
System.setOut(ps);
systemOutLogger.recordMetricEvent(uuid, "str1");
@@ -329,7 +335,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.metrics("message");
assertTrue(baos.toString().contains("SystemOutLoggerTest : message"));
@@ -344,10 +350,11 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.error(MessageCodes.ERROR_DATA_ISSUE, new NullPointerException(), "str1", "str2");
- assertTrue(baos.toString().contains("SystemOutLoggerTest : MessageCodes :" + MessageCodes.ERROR_DATA_ISSUE + "[str1, str2]"));
+ assertTrue(baos.toString()
+ .contains("SystemOutLoggerTest : MessageCodes :" + MessageCodes.ERROR_DATA_ISSUE + "[str1, str2]"));
} finally {
System.out.flush();
System.setOut(old);
@@ -359,11 +366,12 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.setTransId("transactionId");
systemOutLogger.error(MessageCodes.ERROR_DATA_ISSUE, "str1", "str2");
- assertTrue(baos.toString().contains("transactionId|SystemOutLoggerTest : MessageCode:" + MessageCodes.ERROR_DATA_ISSUE + "[str1, str2]"));
+ assertTrue(baos.toString().contains("transactionId|SystemOutLoggerTest : MessageCode:"
+ + MessageCodes.ERROR_DATA_ISSUE + "[str1, str2]"));
} finally {
System.out.flush();
System.setOut(old);
@@ -380,11 +388,12 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.setTransId("transactionId");
systemOutLogger.warn(MessageCodes.ERROR_DATA_ISSUE, "str1", "str2");
- assertTrue(baos.toString().contains("transactionId|SystemOutLoggerTest : MessageCodes:" + MessageCodes.ERROR_DATA_ISSUE + "[str1, str2]"));
+ assertTrue(baos.toString().contains("transactionId|SystemOutLoggerTest : MessageCodes:"
+ + MessageCodes.ERROR_DATA_ISSUE + "[str1, str2]"));
} finally {
System.out.flush();
System.setOut(old);
@@ -396,11 +405,12 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.setTransId("transactionId");
systemOutLogger.warn(MessageCodes.ERROR_DATA_ISSUE, new NullPointerException(), "str1", "str2");
- assertTrue(baos.toString().contains("transactionId|SystemOutLoggerTest : MessageCodes:" + MessageCodes.ERROR_DATA_ISSUE + "[str1, str2]"));
+ assertTrue(baos.toString().contains("transactionId|SystemOutLoggerTest : MessageCodes:"
+ + MessageCodes.ERROR_DATA_ISSUE + "[str1, str2]"));
} finally {
System.out.flush();
System.setOut(old);
@@ -412,15 +422,16 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.setTransId("transactionId");
systemOutLogger.debug(1, new NullPointerException());
- assertTrue(baos.toString(), baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
+ assertTrue(baos.toString(),
+ baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
} finally {
System.out.flush();
System.setOut(old);
- }
+ }
}
@Test
@@ -428,11 +439,12 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.setTransId("transactionId");
systemOutLogger.error(1, new NullPointerException());
- assertTrue(baos.toString(), baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
+ assertTrue(baos.toString(),
+ baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
} finally {
System.out.flush();
System.setOut(old);
@@ -444,11 +456,12 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.setTransId("transactionId");
systemOutLogger.info(1, new NullPointerException());
- assertTrue(baos.toString(), baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
+ assertTrue(baos.toString(),
+ baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
} finally {
System.out.flush();
System.setOut(old);
@@ -460,11 +473,12 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.setTransId("transactionId");
systemOutLogger.warn(1, new NullPointerException());
- assertTrue(baos.toString(), baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
+ assertTrue(baos.toString(),
+ baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
} finally {
System.out.flush();
System.setOut(old);
@@ -476,11 +490,12 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.setTransId("transactionId");
systemOutLogger.trace(1, new NullPointerException());
- assertTrue(baos.toString(), baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
+ assertTrue(baos.toString(),
+ baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
} finally {
System.out.flush();
System.setOut(old);
@@ -492,11 +507,12 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.setTransId("transactionId");
systemOutLogger.audit(1, new NullPointerException());
- assertTrue(baos.toString(), baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
+ assertTrue(baos.toString(),
+ baos.toString().contains("transactionId|SystemOutLoggerTest : 1:java.lang.NullPointerException"));
} finally {
System.out.flush();
System.setOut(old);
@@ -513,7 +529,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.postMDCInfoForTriggeredRule("transactionId");
assertTrue(baos.toString(), baos.toString().contains("transactionId"));
@@ -528,7 +544,7 @@ public class SystemOutLoggerTest {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
- try{
+ try {
System.setOut(ps);
systemOutLogger.postMDCInfoForEvent(1);
assertTrue(baos.toString(), baos.toString().contains("1"));
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/util/TestUtils.java b/common-logging/src/test/java/org/onap/policy/common/logging/util/TestUtils.java
index 17eee02a..94bfbb74 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/util/TestUtils.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/util/TestUtils.java
@@ -17,15 +17,27 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
+
package org.onap.policy.common.logging.util;
import static org.junit.Assert.fail;
+
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
public class TestUtils {
-
- public static void overrideField(@SuppressWarnings("rawtypes") final Class clazz, final Object object, final String fieldName, final Object newValue) {
+
+ /**
+ * Override a field.
+ *
+ * @param clazz the class the field belongs to
+ * @param object the instance of the class
+ * @param fieldName the name of the field
+ * @param newValue the value to set the field to
+ */
+ public static void overrideField(@SuppressWarnings("rawtypes") final Class clazz, final Object object,
+ final String fieldName, final Object newValue) {
try {
final Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
@@ -38,8 +50,16 @@ public class TestUtils {
fail(e.toString());
}
}
-
- public static void overrideStaticField(@SuppressWarnings("rawtypes") final Class clazz, final String fieldName, final Object newValue) {
+
+ /**
+ * Override a static field.
+ *
+ * @param clazz the class the field belongs to
+ * @param fieldName the name of the field
+ * @param newValue the value to set the field to
+ */
+ public static void overrideStaticField(@SuppressWarnings("rawtypes") final Class clazz, final String fieldName,
+ final Object newValue) {
try {
final Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/AdministrativeStateException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/AdministrativeStateException.java
index 600d8601..14e0f0a8 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/AdministrativeStateException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/AdministrativeStateException.java
@@ -21,18 +21,21 @@
package org.onap.policy.common.im;
public class AdministrativeStateException extends IntegrityMonitorException {
- private static final long serialVersionUID = 1L;
- public AdministrativeStateException() {
- super();
- }
- public AdministrativeStateException(String message) {
- super(message);
- }
+ private static final long serialVersionUID = 1L;
- public AdministrativeStateException(Throwable cause) {
- super(cause);
- }
- public AdministrativeStateException(String message, Throwable cause) {
- super(message, cause);
- }
+ public AdministrativeStateException() {
+ super();
+ }
+
+ public AdministrativeStateException(String message) {
+ super(message);
+ }
+
+ public AdministrativeStateException(Throwable cause) {
+ super(cause);
+ }
+
+ public AdministrativeStateException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/AllSeemsWellException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/AllSeemsWellException.java
index 588a4d61..1583a9d5 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/AllSeemsWellException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/AllSeemsWellException.java
@@ -21,25 +21,22 @@
package org.onap.policy.common.im;
public class AllSeemsWellException extends IntegrityMonitorException {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public AllSeemsWellException(){
- super();
- }
+ private static final long serialVersionUID = 1L;
- public AllSeemsWellException(String msg) {
- super(msg);
- }
-
- public AllSeemsWellException(String msg, Exception cause) {
- super(msg, cause);
- }
+ public AllSeemsWellException() {
+ super();
+ }
- public AllSeemsWellException(Exception cause) {
- super(cause);
- }
+ public AllSeemsWellException(String msg) {
+ super(msg);
+ }
+
+ public AllSeemsWellException(String msg, Exception cause) {
+ super(msg, cause);
+ }
+
+ public AllSeemsWellException(Exception cause) {
+ super(cause);
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/ForwardProgressException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/ForwardProgressException.java
index 5825c3a0..a72fe9e2 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/ForwardProgressException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/ForwardProgressException.java
@@ -21,18 +21,21 @@
package org.onap.policy.common.im;
public class ForwardProgressException extends IntegrityMonitorException {
- private static final long serialVersionUID = 1L;
- public ForwardProgressException() {
- super();
- }
- public ForwardProgressException(String message) {
- super(message);
- }
+ private static final long serialVersionUID = 1L;
- public ForwardProgressException(Throwable cause) {
- super(cause);
- }
- public ForwardProgressException(String message, Throwable cause) {
- super(message, cause);
- }
+ public ForwardProgressException() {
+ super();
+ }
+
+ public ForwardProgressException(String message) {
+ super(message);
+ }
+
+ public ForwardProgressException(Throwable cause) {
+ super(cause);
+ }
+
+ public ForwardProgressException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
index 880d39f5..c32a2213 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
@@ -54,1917 +54,1919 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * IntegrityMonitor Main class for monitoring the integrity of a resource and
- * managing its state. State management follows the X.731 ITU standard.
+ * IntegrityMonitor Main class for monitoring the integrity of a resource and managing its state.
+ * State management follows the X.731 ITU standard.
*/
public class IntegrityMonitor {
- private static final Logger logger = LoggerFactory.getLogger(IntegrityMonitor.class.getName());
+ private static final Logger logger = LoggerFactory.getLogger(IntegrityMonitor.class.getName());
- // only allow one instance of IntegrityMonitor
- private static IntegrityMonitor instance = null;
+ // only allow one instance of IntegrityMonitor
+ private static IntegrityMonitor instance = null;
- private static String resourceName = null;
- boolean alarmExists = false;
+ private static String resourceName = null;
+ boolean alarmExists = false;
- /*
- * Error message that is written by the dependencyCheck() method. It is made
- * available externally through the evaluateSanity() method.
- */
- private String dependencyCheckErrorMsg = "";
+ /*
+ * Error message that is written by the dependencyCheck() method. It is made available
+ * externally through the evaluateSanity() method.
+ */
+ private String dependencyCheckErrorMsg = "";
- // The entity manager factory for JPA access
- private EntityManagerFactory emf;
- private EntityManager em;
+ // The entity manager factory for JPA access
+ private EntityManagerFactory emf;
+ private EntityManager em;
- // Persistence Unit for JPA
- public static final String PERSISTENCE_UNIT = "operationalPU";
-
- private static String persistenceUnit = PERSISTENCE_UNIT;
-
- private static final long CYCLE_INTERVAL_MILLIS = 1000l;
-
- private static long cycleIntervalMillis = CYCLE_INTERVAL_MILLIS;
-
- /**
- * Units used for intervals extracted from the properties, which are
- * typically given in seconds.
- */
- private static TimeUnit propertyUnits = TimeUnit.SECONDS;
-
- private StateManagement stateManager = null;
-
- private FPManager fpManager = null;
-
- // The forward progress counter is incremented as the
- // process being monitored makes forward progress
- private int fpCounter = 0;
- private int lastFpCounter = 0;
-
- // elapsed time since last FP counter check
- private long elapsedTime = 0;
-
- // elapsed time since last test transaction check
- private long elapsedTestTransTime = 0;
-
- // elapsed time since last write Fpc check
- private long elapsedWriteFpcTime = 0;
-
- // last dependency health check time. Initialize so that the periodic check
- // starts after 60 seconds.
- // This allows time for dependents to come up.
- private long lastDependencyCheckTime = System.currentTimeMillis();
-
- // Time of the last state audit. It is initialized at the time of the IM
- // construction
- private Date lastStateAuditTime = new Date();
-
- // Interval between state audits in ms. We leave it turned off by default so
- // that it will only
- // be run on the nodes which we want doing the audit. In particular, we only
- // want it to run
- // on the droolspdps
- private static long stateAuditIntervalMs = 0L;
-
- // the number of cycles since 'fpCounter' was last changed
- private int missedCycles = 0;
-
- // forward progress monitoring interval
- private static long monitorIntervalMs = 1000L * IntegrityMonitorProperties.DEFAULT_MONITOR_INTERVAL;
- // The number of periods the counter fails to increment before an alarm is
- // raised.
- private static int failedCounterThreshold = IntegrityMonitorProperties.DEFAULT_FAILED_COUNTER_THRESHOLD;
- // test transaction interval
- private static long testTransIntervalMs = 1000L * IntegrityMonitorProperties.DEFAULT_TEST_INTERVAL;
- // write Fpc to DB interval
- private static long writeFpcIntervalMs = 1000L * IntegrityMonitorProperties.DEFAULT_WRITE_FPC_INTERVAL;
- // check the health of dependencies
- private static long checkDependencyIntervalMs = 1000L
- * IntegrityMonitorProperties.DEFAULT_CHECK_DEPENDENCY_INTERVAL;
-
- // A lead subsystem will have dependency groups with resource names in the
- // properties file.
- // For non-lead subsystems, the dependency_group property will be absent.
- private static String[] depGroups = null;
-
- private static boolean isUnitTesting = false;
-
- // can turn on health checking of dependents via jmx test() call by setting
- // this property to true
- private static boolean testViaJmx = false;
-
- private static String jmxFqdn = null;
-
- // this is the max interval allowed without any forward progress
- // counter updates
- private static long maxFpcUpdateIntervalMs = 1000L * IntegrityMonitorProperties.DEFAULT_MAX_FPC_UPDATE_INTERVAL;
-
- // Node types
- private enum NodeType {
- PDP_XACML, PDP_DROOLS, PAP, PAP_ADMIN, LOGPARSER, BRMS_GATEWAY, ASTRA_GATEWAY, ELK_SERVER, PYPDP
-
- }
-
- private static String siteName;
- private static String nodeType;
- private Date refreshStateAuditLastRunDate;
- private static long refreshStateAuditIntervalMs = 600000; // run it once per
- // 10 minutes
-
- // lock objects
- private final Object evaluateSanityLock = new Object();
- private final Object fpMonitorCycleLock = new Object();
- private final Object dependencyCheckLock = new Object();
- private final Object testTransactionLock = new Object();
- private final Object startTransactionLock = new Object();
- private final Object endTransactionLock = new Object();
- private final Object checkTestTransactionLock = new Object();
- private final Object checkWriteFpcLock = new Object();
- private static final Object getInstanceLock = new Object();
- private final Object refreshStateAuditLock = new Object();
- private final Object imFlushLock = new Object();
-
- private Map<String, String> allSeemsWellMap;
- private Map<String, String> allNotWellMap;
-
- /**
- * IntegrityMonitor constructor. It is invoked from the getInstance() method
- * in this class or from the constructor of a child or sub-class. A class
- * can extend the IntegrityMonitor class if there is a need to override any
- * of the base methods (ex. subsystemTest()). Only one instance is allowed
- * to be created per resource name.
- *
- * @param resourceName
- * The resource name of the resource
- * @param properties
- * a set of properties passed in from the resource
- * @throws IntegrityMonitorException
- * if any errors are encountered in the constructor
- */
- protected IntegrityMonitor(String resourceName, Properties properties) throws IntegrityMonitorException {
-
- this(resourceName, properties, null);
- }
-
- /**
- * IntegrityMonitor constructor. It is invoked from the getInstance() method
- * in this class or from the constructor of a child or sub-class. A class
- * can extend the IntegrityMonitor class if there is a need to override any
- * of the base methods (ex. subsystemTest()). Only one instance is allowed
- * to be created per resource name.
- *
- * @param resourceName
- * The resource name of the resource
- * @param properties
- * a set of properties passed in from the resource
- * @param queue
- * queue to use to control the FPManager thread, or {@code null}
- * @throws IntegrityMonitorException
- * if any errors are encountered in the constructor
- */
- protected IntegrityMonitor(String resourceName, Properties properties, BlockingQueue<CountDownLatch> queue)
- throws IntegrityMonitorException {
-
- // singleton check since this constructor can be called from a child or
- // sub-class
- if (instance != null) {
- String msg = "IM object exists and only one instance allowed";
- logger.error("{}", msg);
- throw new IntegrityMonitorException("IntegrityMonitor constructor exception: " + msg);
- }
- instance = this;
-
- IntegrityMonitor.resourceName = resourceName;
-
- /*
- * Validate that the properties file contains all the needed properties.
- * Throws an IntegrityMonitorPropertiesException
- */
- validateProperties(properties);
-
- // construct jmx url
- String jmxUrl = getJmxUrl();
-
- //
- // Create the entity manager factory
- //
- emf = Persistence.createEntityManagerFactory(persistenceUnit, properties);
- //
- // Did it get created?
- //
- if (emf == null) {
- logger.error("Error creating IM entity manager factory with persistence unit: {}", persistenceUnit);
- throw new IntegrityMonitorException("Unable to create IM Entity Manager Factory");
- }
-
- // add entry to forward progress and resource registration tables in DB
-
- // Start a transaction
- em = emf.createEntityManager();
- EntityTransaction et = em.getTransaction();
-
- et.begin();
-
- try {
- // if ForwardProgress entry exists for resourceName, update it. If
- // not found, create a new entry
- Query fquery = em.createQuery("Select f from ForwardProgressEntity f where f.resourceName=:rn");
- fquery.setParameter("rn", resourceName);
-
- @SuppressWarnings("rawtypes")
- List fpList = fquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
- ForwardProgressEntity fpx = null;
- if (!fpList.isEmpty()) {
- // ignores multiple results
- fpx = (ForwardProgressEntity) fpList.get(0);
- // refresh the object from DB in case cached data was returned
- em.refresh(fpx);
- if (logger.isDebugEnabled()) {
- logger.debug("Resource {} exists and will be updated - old fpc= {}, lastUpdated= {}", resourceName,
- fpx.getFpcCount(), fpx.getLastUpdated());
- }
- fpx.setFpcCount(fpCounter);
- } else {
- // Create a forward progress object
- logger.debug("Adding resource {} to ForwardProgress table", resourceName);
- fpx = new ForwardProgressEntity();
- }
- // update/set columns in entry
- fpx.setResourceName(resourceName);
- em.persist(fpx);
- // flush to the DB
- synchronized (imFlushLock) {
- em.flush();
- }
-
- // if ResourceRegistration entry exists for resourceName, update it.
- // If not found, create a new entry
- Query rquery = em.createQuery("Select r from ResourceRegistrationEntity r where r.resourceName=:rn");
- rquery.setParameter("rn", resourceName);
-
- @SuppressWarnings("rawtypes")
- List rrList = rquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
- ResourceRegistrationEntity rrx = null;
- if (!rrList.isEmpty()) {
- // ignores multiple results
- rrx = (ResourceRegistrationEntity) rrList.get(0);
- // refresh the object from DB in case cached data was returned
- em.refresh(rrx);
- if (logger.isDebugEnabled()) {
- logger.debug("Resource {} exists and will be updated - old url= {}, createdDate={}", resourceName,
- rrx.getResourceUrl(), rrx.getCreatedDate());
- }
- rrx.setLastUpdated(new Date());
- } else {
- // register resource by adding entry to table in DB
- logger.debug("Adding resource {} to ResourceRegistration table", resourceName);
- rrx = new ResourceRegistrationEntity();
- }
- // update/set columns in entry
- rrx.setResourceName(resourceName);
- rrx.setResourceUrl(jmxUrl);
- rrx.setNodeType(nodeType);
- rrx.setSite(siteName);
- em.persist(rrx);
- // flush to the DB
- synchronized (imFlushLock) {
- et.commit();
- }
-
- } catch (Exception e) {
- logger.error("IntegrityMonitor constructor DB table update failed with exception: ", e);
- try {
- if (et.isActive()) {
- synchronized (imFlushLock) {
- et.rollback();
- }
- }
- } catch (Exception e1) {
- logger.error("IntegrityMonitor constructor threw exception: ", e1);
- }
- throw e;
- }
-
- try {
- // create instance of StateMangement class and pass emf to it
- stateManager = new StateManagement(emf, resourceName);
-
- /**
- * Initialize the state and status attributes. This will maintain any
- * Administrative state value but will set the operational state =
- * enabled, availability status = null, standby status = null. The
- * integrity monitor will set the operational state via the FPManager
- * and the owning application must set the standby status by calling
- * promote/demote on the StateManager.
- */
- stateManager.initializeState();
-
- } catch(StateManagementException e) {
- throw new IntegrityMonitorException(e);
- }
-
- // create management bean
- try {
- new ComponentAdmin(resourceName, this, stateManager);
- } catch (Exception e) {
- logger.error("ComponentAdmin constructor exception: {}", e.toString(), e);
- }
-
- fpManager = new FPManager(queue);
-
- }
-
- /**
- * Get an instance of IntegrityMonitor for a given resource name. It creates
- * one if it does not exist. Only one instance is allowed to be created per
- * resource name.
- *
- * @param resourceName
- * The resource name of the resource
- * @param properties
- * a set of properties passed in from the resource
- * @return The new instance of IntegrityMonitor
- * @throws IntegrityMonitorException
- * if unable to create jmx url or the constructor returns an
- * exception
- */
- public static IntegrityMonitor getInstance(String resourceName, Properties properties) throws IntegrityMonitorException {
- return getInstance(resourceName, properties, null);
- }
-
- /**
- * Get an instance of IntegrityMonitor for a given resource name. It creates
- * one if it does not exist. Only one instance is allowed to be created per
- * resource name.
- *
- * @param resourceName
- * The resource name of the resource
- * @param properties
- * a set of properties passed in from the resource
- * @param queue
- * queue to use to control the FPManager thread, or {@code null}
- * @return The new instance of IntegrityMonitor
- * @throws IntegrityMonitorException
- * if unable to create jmx url or the constructor returns an
- * exception
- */
- protected static IntegrityMonitor getInstance(String resourceName, Properties properties,
- BlockingQueue<CountDownLatch> queue) throws IntegrityMonitorException {
-
- synchronized (getInstanceLock) {
- logger.debug("getInstance() called - resourceName= {}", resourceName);
- if (resourceName == null || resourceName.isEmpty() || properties == null) {
- logger.error("Error: getIntegrityMonitorInstance() called with invalid input");
- return null;
- }
-
- if (instance == null) {
- logger.debug("Creating new instance of IntegrityMonitor");
- instance = new IntegrityMonitor(resourceName, properties, queue);
- }
- return instance;
- }
- }
-
- public static IntegrityMonitor getInstance() throws IntegrityMonitorException {
- logger.debug("getInstance() called");
- if (instance == null) {
- String msg = "No IntegrityMonitor instance exists."
- + " Please use the method IntegrityMonitor.getInstance(String resourceName, Properties properties)";
- throw new IntegrityMonitorPropertiesException(msg);
- } else {
- return instance;
- }
- }
-
- /*
- * This is a facility used by JUnit testing to destroy the IntegrityMonitor
- * instance before creating a new one. It waits a bit to allow the FPManager
- * to fully exit.
- */
- public static void deleteInstance() throws IntegrityMonitorException {
- logger.debug("deleteInstance() called");
- synchronized (getInstanceLock) {
- if (isUnitTesting() && instance != null && instance.getFPManager() != null) {
- FPManager fpm = instance.getFPManager();
-
- // Stop the FPManager thread
- fpm.stopAndExit();
-
- try {
- // Make sure it has exited
- fpm.join(2000L);
- } catch (InterruptedException e) {
- logger.error("deleteInstance: Interrupted while waiting for FPManaager to fully exit", e);
- Thread.currentThread().interrupt();
- }
-
- if (fpm.isAlive()) {
- logger.error("IntegrityMonitor.deleteInstance() Failed to kill FPManager thread");
- throw new IntegrityMonitorException(
- "IntegrityMonitor.deleteInstance() Failed to kill FPManager thread");
- }
-
- instance = null;
- }
- }
- logger.debug("deleteInstance() exit");
- }
-
- private FPManager getFPManager() {
- return fpManager;
- }
-
- private static String getJmxUrl() throws IntegrityMonitorException {
-
- // get the jmx remote port and construct the JMX URL
- Properties systemProps = System.getProperties();
- String jmxPort = systemProps.getProperty("com.sun.management.jmxremote.port");
- String jmxErrMsg;
- if (jmxPort == null) {
- jmxErrMsg = "System property com.sun.management.jmxremote.port for JMX remote port is not set";
- logger.error("{}", jmxErrMsg);
- throw new IntegrityMonitorException("getJmxUrl exception: " + jmxErrMsg);
- }
-
- int port = 0;
- try {
- port = Integer.parseInt(jmxPort);
- } catch (NumberFormatException e) {
- jmxErrMsg = "JMX remote port is not a valid integer value - " + jmxPort;
- logger.error("{}", jmxErrMsg);
- throw new IntegrityMonitorException("getJmxUrl exception: " + jmxErrMsg);
- }
-
- try {
- if (jmxFqdn == null) {
- jmxFqdn = InetAddress.getLocalHost().getCanonicalHostName(); // get
- // FQDN
- // of
- // this
- // host
- }
- } catch (Exception e) {
- String msg = "getJmxUrl could not get hostname";
- logger.error("{}", msg, e);
- throw new IntegrityMonitorException("getJmxUrl Exception: " + msg);
- }
- if (jmxFqdn == null) {
- String msg = "getJmxUrl encountered null hostname";
- logger.error("{}", msg);
- throw new IntegrityMonitorException("getJmxUrl error: " + msg);
- }
-
- // assemble the jmx url
- String jmxUrl = "service:jmx:rmi:///jndi/rmi://" + jmxFqdn + ":" + port + "/jmxrmi";
-
- logger.debug("IntegerityMonitor - jmx url={}", jmxUrl);
-
- return jmxUrl;
- }
-
- /**
- * evaluateSanity() is designed to be called by an external entity to
- * evealuate the sanity of the node. It checks the operational and
- * administrative states and the standby status. If the operational state is
- * disabled, it will include the dependencyCheckErrorMsg which includes
- * information about any dependency (node) which has failed.
- */
- public void evaluateSanity() throws IntegrityMonitorException {
- logger.debug("evaluateSanity called ....");
- synchronized (evaluateSanityLock) {
-
- String errorMsg = dependencyCheckErrorMsg;
- logger.debug("evaluateSanity dependencyCheckErrorMsg = {}", errorMsg);
- // check op state and throw exception if disabled
- if ((stateManager.getOpState() != null) && stateManager.getOpState().equals(StateManagement.DISABLED)) {
- String msg = "Resource " + resourceName + " operation state is disabled. " + errorMsg;
- logger.debug("{}", msg);
- throw new IntegrityMonitorException(msg);
- }
-
- // check admin state and throw exception if locked
- if ((stateManager.getAdminState() != null) && stateManager.getAdminState().equals(StateManagement.LOCKED)) {
- String msg = "Resource " + resourceName + " is administratively locked";
- logger.debug("{}", msg);
- throw new AdministrativeStateException("IntegrityMonitor Admin State Exception: " + msg);
- }
- // check standby state and throw exception if cold standby
- if ((stateManager.getStandbyStatus() != null)
- && stateManager.getStandbyStatus().equals(StateManagement.COLD_STANDBY)) {
- String msg = "Resource " + resourceName + " is cold standby";
- logger.debug("{}", msg);
- throw new StandbyStatusException("IntegrityMonitor Standby Status Exception: " + msg);
- }
-
- }
-
- }
-
- /*
- * This method checks the forward progress counter and the state of a
- * dependency. If the dependency is unavailable or failed, an error message
- * is created which is checked when evaluateSanity interface is called. If
- * the error message is set then the evaluateSanity will return an error.
- */
- public String stateCheck(String dep) {
- logger.debug("checking state of dependent resource: {}", dep);
- String errorMsg = null;
- ForwardProgressEntity forwardProgressEntity = null;
- StateManagementEntity stateManagementEntity = null;
-
- // Start a transaction
- EntityTransaction et = em.getTransaction();
- et.begin();
-
- try {
- Query query = em.createQuery("Select p from ForwardProgressEntity p where p.resourceName=:resource");
- query.setParameter("resource", dep);
-
- @SuppressWarnings("rawtypes")
- List fpList = query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
-
- if (!fpList.isEmpty()) {
- // exists
- forwardProgressEntity = (ForwardProgressEntity) fpList.get(0);
- // refresh the object from DB in case cached data was returned
- em.refresh(forwardProgressEntity);
- logger.debug("Found entry in ForwardProgressEntity table for dependent Resource={}", dep);
- } else {
- errorMsg = dep + ": resource not found in ForwardProgressEntity database table";
- logger.error("{}", errorMsg);
- }
- synchronized (imFlushLock) {
- et.commit();
- }
- } catch (Exception ex) {
- // log an error
- errorMsg = dep + ": ForwardProgressEntity DB operation failed with exception: ";
- logger.error("{}", errorMsg, ex);
- synchronized (imFlushLock) {
- if (et.isActive()) {
- et.rollback();
- }
- }
- }
-
- if (errorMsg == null) {
- // Start a transaction
- et = em.getTransaction();
- et.begin();
- try {
- // query if StateManagement entry exists for dependent resource
- Query query = em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource");
- query.setParameter("resource", dep);
-
- @SuppressWarnings("rawtypes")
- List smList = query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
- if (!smList.isEmpty()) {
- // exist
- stateManagementEntity = (StateManagementEntity) smList.get(0);
- // refresh the object from DB in case cached data was
- // returned
- em.refresh(stateManagementEntity);
- logger.debug("Found entry in StateManagementEntity table for dependent Resource={}", dep);
- } else {
- errorMsg = dep + ": resource not found in state management entity database table";
- logger.error("{}", errorMsg);
- }
-
- synchronized (imFlushLock) {
- et.commit();
- }
- } catch (Exception e) {
- // log an error
- errorMsg = dep + ": StateManagementEntity DB read failed with exception: ";
- logger.error("{}", errorMsg, e);
- synchronized (imFlushLock) {
- if (et.isActive()) {
- et.rollback();
- }
- }
- }
- }
-
- // verify that the ForwardProgress is current (check last_updated)
- if (errorMsg == null) {
- if (forwardProgressEntity != null && stateManagementEntity != null) {
- Date date = new Date();
- long diffMs = date.getTime() - forwardProgressEntity.getLastUpdated().getTime();
- logger.debug("IntegrityMonitor.stateCheck(): diffMs = {}", diffMs);
-
- // Threshold for a stale entry
- long staleMs = maxFpcUpdateIntervalMs;
- logger.debug("IntegrityMonitor.stateCheck(): staleMs = {}", staleMs);
-
- if (diffMs > staleMs) {
- // ForwardProgress is stale. Disable it
- try {
- if (!stateManagementEntity.getOpState().equals(StateManagement.DISABLED)) {
- logger.debug("IntegrityMonitor.stateCheck(): Changing OpStat = disabled for {}", dep);
- stateManager.disableFailed(dep);
- }
- } catch (Exception e) {
- String msg = "IntegrityMonitor.stateCheck(): Failed to diableFail dependent resource = " + dep
- + "; " + e.getMessage();
- logger.error("{}", msg, e);
- }
- }
- } else {
-
- if (forwardProgressEntity == null) {
- String msg = "IntegrityMonitor.stateCheck(): Failed to diableFail dependent resource = " + dep
- + "; " + " forwardProgressEntity == null.";
- logger.error("{}", msg);
- }
-
- else {
- String msg = "IntegrityMonitor.stateCheck(): Failed to diableFail dependent resource = " + dep
- + "; " + " stateManagementEntity == null.";
- logger.error("{}", msg);
- }
- }
- }
-
- // check operation, admin and standby states of dependent resource
- if (errorMsg == null) {
- if (stateManagementEntity != null) {
- if ((stateManager.getAdminState() != null)
- && stateManagementEntity.getAdminState().equals(StateManagement.LOCKED)) {
- errorMsg = dep + ": resource is administratively locked";
- logger.error("{}", errorMsg);
- } else if ((stateManager.getOpState() != null)
- && stateManagementEntity.getOpState().equals(StateManagement.DISABLED)) {
- errorMsg = dep + ": resource is operationally disabled";
- logger.error("{}", errorMsg);
- } else if ((stateManager.getStandbyStatus() != null)
- && stateManagementEntity.getStandbyStatus().equals(StateManagement.COLD_STANDBY)) {
- errorMsg = dep + ": resource is cold standby";
- logger.error("{}", errorMsg);
- }
- } else {
- errorMsg = dep + ": could not check standy state of resource. stateManagementEntity == null.";
- logger.error("{}", errorMsg);
- }
- }
-
- String returnMsg = "IntegrityMonitor.stateCheck(): returned error_msg: " + errorMsg;
- logger.debug("{}", returnMsg);
- return errorMsg;
- }
-
- private String fpCheck(String dep) {
- logger.debug("checking forward progress count of dependent resource: {}", dep);
-
- String errorMsg = null;
-
- // check FPC count - a changing FPC count indicates the resource JVM is
- // running
-
- // Start a transaction
- EntityTransaction et = em.getTransaction();
- et.begin();
- try {
- Query fquery = em.createQuery("Select f from ForwardProgressEntity f where f.resourceName=:rn");
- fquery.setParameter("rn", dep);
-
- @SuppressWarnings("rawtypes")
- List fpList = fquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
- ForwardProgressEntity fpx;
- if (!fpList.isEmpty()) {
- // ignores multiple results
- fpx = (ForwardProgressEntity) fpList.get(0);
- // refresh the object from DB in case cached data was returned
- em.refresh(fpx);
- if (logger.isDebugEnabled()) {
- logger.debug("Dependent resource {} - fpc= {}, lastUpdated={}", dep, fpx.getFpcCount(),
- fpx.getLastUpdated());
- }
- long currTime = System.currentTimeMillis();
- // if dependent resource FPC has not been updated, consider it
- // an error
- if ((currTime - fpx.getLastUpdated().getTime()) > maxFpcUpdateIntervalMs) {
- errorMsg = dep + ": FP count has not been updated in the last " + maxFpcUpdateIntervalMs + "ms";
- logger.error("{}", errorMsg);
- try {
- // create instance of StateMangement class for dependent
- StateManagement depStateManager = new StateManagement(emf, dep);
- if (!depStateManager.getOpState().equals(StateManagement.DISABLED)) {
- logger.debug(
- "Forward progress not detected for dependent resource {}. Setting dependent's state to disable failed.",
- dep);
- depStateManager.disableFailed();
- }
- } catch (Exception e) {
- // ignore errors
- logger.error("Update dependent state failed with exception: ", e);
- }
- }
- } else {
- // resource entry not found in FPC table
- errorMsg = dep + ": resource not found in ForwardProgressEntity table in the DB";
- logger.error("{}", errorMsg);
- }
- synchronized (imFlushLock) {
- et.commit();
- }
- } catch (Exception e) {
- // log an error and continue
- errorMsg = dep + ": ForwardProgressEntity DB read failed with exception: ";
- logger.error("{}", errorMsg, e);
- synchronized (imFlushLock) {
- if (et.isActive()) {
- et.rollback();
- }
- }
- }
-
- return errorMsg;
- }
-
- public List<ForwardProgressEntity> getAllForwardProgressEntity() {
- logger.debug("getAllForwardProgressEntity: entry");
- ArrayList<ForwardProgressEntity> fpList = new ArrayList<>();
- // Start a transaction
- EntityTransaction et = em.getTransaction();
- et.begin();
- try {
- Query fquery = em.createQuery("Select e from ForwardProgressEntity e");
- @SuppressWarnings("rawtypes")
- List myList = fquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
- synchronized (imFlushLock) {
- et.commit();
- }
- logger.debug("getAllForwardProgressEntity: myList.size(): {}", myList.size());
- if (!myList.isEmpty()) {
- for (int i = 0; i < myList.size(); i++) {
- if (logger.isDebugEnabled()) {
- logger.debug("getAllForwardProgressEntity: myList.get({}).getResourceName(): {}", i,
- ((ForwardProgressEntity) myList.get(i)).getResourceName());
- }
- fpList.add((ForwardProgressEntity) myList.get(i));
- }
- }
- synchronized (imFlushLock) {
- if (et.isActive()) {
- et.commit();
- }
- }
- } catch (Exception e) {
- // log an error and continue
- String msg = "getAllForwardProgessEntity DB read failed with exception: ";
- logger.error("{}", msg, e);
- synchronized (imFlushLock) {
- if (et.isActive()) {
- et.rollback();
- }
- }
- }
- return fpList;
- }
-
- private String jmxCheck(String dep) {
- logger.debug("checking health of dependent by calling test() via JMX on resource: {}", dep);
-
- String errorMsg = null;
-
- // get the JMX URL from the database
- String jmxUrl = null;
- // Start a transaction
- EntityTransaction et = em.getTransaction();
- et.begin();
- try {
- // query if ResourceRegistration entry exists for resourceName
- Query rquery = em.createQuery("Select r from ResourceRegistrationEntity r where r.resourceName=:rn");
- rquery.setParameter("rn", dep);
-
- @SuppressWarnings("rawtypes")
- List rrList = rquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
- ResourceRegistrationEntity rrx = null;
-
- if (!rrList.isEmpty()) {
- // ignores multiple results
- rrx = (ResourceRegistrationEntity) rrList.get(0);
- // refresh the object from DB in case cached data was returned
- em.refresh(rrx);
- jmxUrl = rrx.getResourceUrl();
- if (logger.isDebugEnabled()) {
- logger.debug("Dependent Resource={}, url={}, createdDate={}", dep, jmxUrl, rrx.getCreatedDate());
- }
- } else {
- errorMsg = dep + ": resource not found in ResourceRegistrationEntity table in the DB";
- logger.error("{}", errorMsg);
- }
-
- synchronized (imFlushLock) {
- et.commit();
- }
- } catch (Exception e) {
- errorMsg = dep + ": ResourceRegistrationEntity DB read failed with exception: ";
- logger.error("{}", errorMsg, e);
- synchronized (imFlushLock) {
- if (et.isActive()) {
- et.rollback();
- }
- }
- }
-
- if (jmxUrl != null) {
- JmxAgentConnection jmxAgentConnection = null;
- try {
- jmxAgentConnection = new JmxAgentConnection(jmxUrl);
- MBeanServerConnection mbeanServer = jmxAgentConnection.getMBeanConnection();
- ComponentAdminMBean admin = JMX.newMXBeanProxy(mbeanServer, ComponentAdmin.getObjectName(dep),
- ComponentAdminMBean.class);
-
- // invoke the test method via the jmx proxy
- admin.test();
- logger.debug("Dependent resource {} sanity test passed", dep);
- } catch (Exception e) {
- errorMsg = dep + ": resource sanity test failed with exception: ";
- logger.error("{}", errorMsg, e);
- } finally {
- // close the JMX connector
- if (jmxAgentConnection != null) {
- jmxAgentConnection.disconnect();
- }
- }
- }
-
- return errorMsg;
- }
-
- public String dependencyCheck() {
- logger.debug("dependencyCheck: entry");
- synchronized (dependencyCheckLock) {
-
- // Start with the error message empty
- String errorMsg = "";
- boolean dependencyFailure = false;
-
- /*
- * Before we check dependency groups we need to check subsystemTest.
- */
- try {
- // Test any subsystems that are not covered under the dependency
- // relationship
- subsystemTest();
- } catch (Exception e) {
- logger.error("IntegrityMonitor threw exception", e);
- dependencyFailure = true;
- // This indicates a subsystemTest failure
- try {
- if (logger.isDebugEnabled()) {
- logger.debug(
- "{}: There has been a subsystemTest failure with error:{} Updating this resource's state to disableDependency",
- resourceName, e.getMessage());
- }
- // Capture the subsystemTest failure info
- if (!errorMsg.isEmpty()) {
- errorMsg = errorMsg.concat(",");
- }
- errorMsg = errorMsg.concat(resourceName + ": " + e.getMessage());
- this.stateManager.disableDependency();
- } catch (Exception ex) {
- logger.error("IntegrityMonitor threw exception.", ex);
- if (!errorMsg.isEmpty()) {
- errorMsg = errorMsg.concat(",");
- }
- errorMsg = errorMsg.concat("\n" + resourceName
- + ": Failed to disable dependency after subsystemTest failure due to: " + ex.getMessage());
- }
- }
-
- // Check the sanity of dependents for lead subcomponents
- if (depGroups != null && depGroups.length > 0) {
- // check state of resources in dependency groups
- for (String group : depGroups) {
- group = group.trim();
- if (group.isEmpty()) {
- // ignore empty group
- continue;
- }
- String[] dependencies = group.split(",");
- if (logger.isDebugEnabled()) {
- logger.debug("group dependencies = {}", Arrays.toString(dependencies));
- }
- int realDepCount = 0;
- int failDepCount = 0;
- for (String dep : dependencies) {
- dep = dep.trim();
- if (dep.isEmpty()) {
- // ignore empty dependency
- continue;
- }
- realDepCount++; // this is a valid dependency whose
- // state is tracked
- String failMsg = fpCheck(dep); // if a resource is
- // down, its FP count
- // will not be
- // incremented
- if (failMsg == null) {
- if (testViaJmx) {
- failMsg = jmxCheck(dep);
- } else {
- failMsg = stateCheck(dep);
- }
- }
- if (failMsg != null) {
- failDepCount++;
- if (!errorMsg.isEmpty()) {
- errorMsg = errorMsg.concat(", ");
- }
- errorMsg = errorMsg.concat(failMsg);
- }
- } // end for (String dep : dependencies)
-
- // if all dependencies in a group are failed, set this
- // resource's state to disable dependency
- if ((realDepCount > 0) && (failDepCount == realDepCount)) {
- dependencyFailure = true;
- try {
- logger.debug(
- "All dependents in group {} have failed their health check. Updating this resource's state to disableDependency",
- group);
- if (stateManager.getAvailStatus() == null || !((stateManager.getAvailStatus())
- .equals(StateManagement.DEPENDENCY)
- || (stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY_FAILED))) {
- // Note: redundant calls are made by
- // refreshStateAudit
- this.stateManager.disableDependency();
- }
- } catch (Exception e) {
- logger.error("IntegrityMonitor threw exception.", e);
- if (!errorMsg.isEmpty()) {
- errorMsg = errorMsg.concat(",");
- }
- errorMsg = errorMsg.concat(resourceName + ": Failed to disable dependency");
- break; // break out on failure and skip checking
- // other groups
- }
- }
- // check the next group
-
- } // end for (String group : depGroups)
-
- /*
- * We have checked all the dependency groups. If all are ok and
- * subsystemTest passed, dependencyFailure == false
- */
- if (!dependencyFailure) {
- try {
- logger.debug(
- "All dependency groups have at least one viable member. Updating this resource's state to enableNoDependency");
- if (stateManager.getAvailStatus() != null
- && ((stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY)
- || (stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY_FAILED))) {
- // Note: redundant calls are made by
- // refreshStateAudit
- this.stateManager.enableNoDependency();
- } // The refreshStateAudit will catch the case where it
- // is disabled but availStatus != failed
- } catch (Exception e) {
- logger.error("IntegrityMonitor threw exception.", e);
- if (!errorMsg.isEmpty()) {
- errorMsg = errorMsg.concat(",");
- }
- errorMsg = errorMsg.concat(resourceName + ": Failed to enable no dependency");
- }
- }
- } else if (!dependencyFailure) {
- /*
- * This is put here to clean up when no dependency group should
- * exist, but one was erroneously added which caused the state
- * to be disabled/dependency/coldstandby and later removed. We
- * saw this happen in the lab, but is not very likely in a
- * production environment...but you never know.
- */
- try {
- logger.debug("There are no dependents. Updating this resource's state to enableNoDependency");
- if (stateManager.getAvailStatus() != null
- && ((stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY)
- || (stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY_FAILED))) {
- // Note: redundant calls are made by refreshStateAudit
- this.stateManager.enableNoDependency();
- } // The refreshStateAudit will catch the case where it is
- // disabled but availStatus != failed
- } catch (Exception e) {
- logger.error("IntegrityMonitor threw exception.", e);
- if (!errorMsg.isEmpty()) {
- errorMsg = errorMsg.concat(",");
- }
- errorMsg = errorMsg.concat(resourceName + ": Failed to enable no dependency");
- }
- }
-
- if (!errorMsg.isEmpty()) {
- logger.error("Sanity failure detected in a dependent resource: {}", errorMsg);
-
- }
-
- dependencyCheckErrorMsg = errorMsg;
- lastDependencyCheckTime = System.currentTimeMillis();
- logger.debug("dependencyCheck: exit");
- return errorMsg;
- }
- }
-
- /**
- * Execute a test transaction. It is called when the test transaction timer
- * fires. It could be overridden to provide additional test functionality.
- * If overridden, the overriding method must invoke startTransaction() and
- * endTransaction() and check if the allNotWellMap is empty.
- */
- public void testTransaction() {
- synchronized (testTransactionLock) {
- logger.debug("testTransaction: entry");
- //
- // startTransaction() not required for testTransaction
- //
-
- // end transaction - increments local FP counter
- endTransaction();
- }
- }
-
- /**
- * Additional testing for subsystems that do not have a /test interface (for
- * ex. 3rd party processes like elk). This method would be overridden by the
- * subsystem.
- */
- public void subsystemTest() throws IntegrityMonitorException {
- // Testing provided by subsystem
- logger.debug("IntegrityMonitor subsystemTest() OK");
- }
-
- /**
- * Checks admin state and resets transaction timer. Called by application at
- * the start of a transaction.
- *
- * @throws AdministrativeStateException
- * throws admin state exception if resource is locked
- * @throws StandbyStatusException
- */
- public void startTransaction() throws IntegrityMonitorException {
-
- synchronized (startTransactionLock) {
- // check admin state and throw exception if locked
- if ((stateManager.getAdminState() != null) && stateManager.getAdminState().equals(StateManagement.LOCKED)) {
- String msg = "Resource " + resourceName + " is administratively locked";
-
- throw new AdministrativeStateException("IntegrityMonitor Admin State Exception: " + msg);
- }
- // check standby state and throw exception if locked
-
- if ((stateManager.getStandbyStatus() != null)
- && (stateManager.getStandbyStatus().equals(StateManagement.HOT_STANDBY)
- || stateManager.getStandbyStatus().equals(StateManagement.COLD_STANDBY))) {
- String msg = "Resource " + resourceName + " is standby";
-
- throw new StandbyStatusException("IntegrityMonitor Standby Status Exception: " + msg);
- }
-
- // reset transactionTimer so it will not fire
- elapsedTestTransTime = 0;
- }
- }
-
- /**
- * Increment the local forward progress counter. Called by application at
- * the end of each transaction (successful or not).
- */
- public void endTransaction() {
- synchronized (endTransactionLock) {
- if (getAllNotWellMap() != null) {
- if (!(getAllNotWellMap().isEmpty())) {
- /*
- * An entity has reported that it is not well. We must not
- * allow the the forward progress counter to advance.
- */
- String msg = "allNotWellMap:";
- for (Entry<String, String> entry : allNotWellMap.entrySet()) {
- msg = msg.concat("\nkey = " + entry.getKey() + " msg = " + entry.getValue());
- }
- logger.error("endTransaction: allNotWellMap is NOT EMPTY. Not advancing forward"
- + "progress counter. \n{}\n", msg);
- return;
- } else {
- if (logger.isDebugEnabled()) {
- if (getAllSeemsWellMap() != null) {
- if (!(getAllSeemsWellMap().isEmpty())) {
- String msg = "allSeemsWellMap:";
- for (Entry<String, String> entry : allSeemsWellMap.entrySet()) {
- msg = msg.concat("\nkey = " + entry.getKey() + " msg = " + entry.getValue());
- }
- logger.debug(
- "endTransaction: allNotWellMap IS EMPTY and allSeemsWellMap is NOT EMPTY. Advancing forward"
- + "progress counter. \n{}\n",
- msg);
- }
- }
- }
- }
- }
- // increment local FPC
- fpCounter++;
- }
- }
-
- // update FP count in DB with local FP count
- private void writeFpc() throws IntegrityMonitorException {
-
- // Start a transaction
- EntityTransaction et = em.getTransaction();
-
- if (!et.isActive()) {
- et.begin();
- }
-
- try {
- // query if ForwardProgress entry exists for resourceName
- Query fquery = em.createQuery("Select f from ForwardProgressEntity f where f.resourceName=:rn");
- fquery.setParameter("rn", resourceName);
-
- @SuppressWarnings("rawtypes")
- List fpList = fquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
- ForwardProgressEntity fpx;
- if (!fpList.isEmpty()) {
- // ignores multiple results
- fpx = (ForwardProgressEntity) fpList.get(0);
- // refresh the object from DB in case cached data was returned
- em.refresh(fpx);
- if (logger.isDebugEnabled()) {
- logger.debug("Updating FP entry: Resource={}, fpcCount={}, lastUpdated={}, new fpcCount={}",
- resourceName, fpx.getFpcCount(), fpx.getLastUpdated(), fpCounter);
- }
- fpx.setFpcCount(fpCounter);
- em.persist(fpx);
- // flush to the DB and commit
- synchronized (imFlushLock) {
- et.commit();
- }
- } else {
- // Error - FP entry does not exist
- String msg = "FP entry not found in database for resource " + resourceName;
- throw new IntegrityMonitorException(msg);
- }
- } catch (Exception e) {
- try {
- synchronized (imFlushLock) {
- if (et.isActive()) {
- et.rollback();
- }
- }
- } catch (Exception e1) {
- logger.error("IntegrityMonitor threw exception.", e1);
- }
- logger.error("writeFpc DB table commit failed with exception: {}", e);
- throw e;
- }
- }
-
- // retrieve state manager reference
- public final StateManagement getStateManager() {
- return this.stateManager;
- }
-
- /**
- * Read and validate properties
- *
- * @throws IntegrityMonitorPropertiesException
- */
- private static void validateProperties(Properties prop) throws IntegrityMonitorPropertiesException {
-
- if (prop.getProperty(IntegrityMonitorProperties.DB_DRIVER) == null) {
- String msg = IntegrityMonitorProperties.DB_DRIVER + " property is null";
- logger.error("{}", msg);
- throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
- }
-
- if (prop.getProperty(IntegrityMonitorProperties.DB_URL) == null) {
- String msg = IntegrityMonitorProperties.DB_URL + " property is null";
- logger.error("{}", msg);
- throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
- }
-
- if (prop.getProperty(IntegrityMonitorProperties.DB_USER) == null) {
- String msg = IntegrityMonitorProperties.DB_USER + " property is null";
- logger.error("{}", msg);
- throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
- }
-
- if (prop.getProperty(IntegrityMonitorProperties.DB_PWD) == null) {
- String msg = IntegrityMonitorProperties.DB_PWD + " property is null";
- logger.error("{}", msg);
- throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
- }
-
- if (prop.getProperty(IntegrityMonitorProperties.FP_MONITOR_INTERVAL) != null) {
- try {
- monitorIntervalMs = toMillis(
- Integer.parseInt(prop.getProperty(IntegrityMonitorProperties.FP_MONITOR_INTERVAL).trim()));
- } catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.FP_MONITOR_INTERVAL, e);
- }
- }
-
- if (prop.getProperty(IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD) != null) {
- try {
- failedCounterThreshold = Integer
- .parseInt(prop.getProperty(IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD).trim());
- } catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD, e);
- }
- }
-
- if (prop.getProperty(IntegrityMonitorProperties.TEST_TRANS_INTERVAL) != null) {
- try {
- testTransIntervalMs = toMillis(
- Integer.parseInt(prop.getProperty(IntegrityMonitorProperties.TEST_TRANS_INTERVAL).trim()));
- } catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.TEST_TRANS_INTERVAL, e);
- }
- }
-
- if (prop.getProperty(IntegrityMonitorProperties.WRITE_FPC_INTERVAL) != null) {
- try {
- writeFpcIntervalMs = toMillis(
- Integer.parseInt(prop.getProperty(IntegrityMonitorProperties.WRITE_FPC_INTERVAL).trim()));
- } catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.WRITE_FPC_INTERVAL, e);
- }
- }
-
- if (prop.getProperty(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL) != null) {
- try {
- checkDependencyIntervalMs = toMillis(Integer
- .parseInt(prop.getProperty(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL).trim()));
- } catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, e);
- }
- }
-
- // dependency_groups are a semi-colon separated list of groups
- // each group is a comma separated list of resource names
- // For ex. dependency_groups = site_1.pap_1,site_1.pap_2 ; site_1.pdp_1,
- // site_1.pdp_2
- if (prop.getProperty(IntegrityMonitorProperties.DEPENDENCY_GROUPS) != null) {
- try {
- depGroups = prop.getProperty(IntegrityMonitorProperties.DEPENDENCY_GROUPS).split(";");
- if (logger.isDebugEnabled()) {
- logger.debug("dependency groups property = {}", Arrays.toString(depGroups));
- }
- } catch (Exception e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.DEPENDENCY_GROUPS, e);
- }
- }
-
- siteName = prop.getProperty(IntegrityMonitorProperties.SITE_NAME);
- if (siteName == null) {
- String msg = IntegrityMonitorProperties.SITE_NAME + " property is null";
- logger.error("{}", msg);
- throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
- } else {
- siteName = siteName.trim();
- }
-
- nodeType = prop.getProperty(IntegrityMonitorProperties.NODE_TYPE);
- if (nodeType == null) {
- String msg = IntegrityMonitorProperties.NODE_TYPE + " property is null";
- logger.error("{}", msg);
- throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
- } else {
- nodeType = nodeType.trim();
- if (!isNodeTypeEnum(nodeType)) {
- String msg = IntegrityMonitorProperties.NODE_TYPE + " property " + nodeType + " is invalid";
- logger.error("{}", msg);
- throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
- }
- }
-
- if (prop.getProperty(IntegrityMonitorProperties.TEST_VIA_JMX) != null) {
- String jmxTest = prop.getProperty(IntegrityMonitorProperties.TEST_VIA_JMX).trim();
- testViaJmx = Boolean.parseBoolean(jmxTest);
- }
-
- if (prop.getProperty(IntegrityMonitorProperties.JMX_FQDN) != null) {
- jmxFqdn = prop.getProperty(IntegrityMonitorProperties.JMX_FQDN).trim();
- if (jmxFqdn.isEmpty()) {
- jmxFqdn = null;
- }
- }
-
- if (prop.getProperty(IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL) != null) {
- try {
- maxFpcUpdateIntervalMs = toMillis(
- Integer.parseInt(prop.getProperty(IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL).trim()));
- } catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL, e);
- }
- }
-
- if (prop.getProperty(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS) != null) {
- try {
- stateAuditIntervalMs = Long
- .parseLong(prop.getProperty(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS));
- } catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, e);
- }
- }
-
- if (prop.getProperty(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS) != null) {
- try {
- refreshStateAuditIntervalMs = Long
- .parseLong(prop.getProperty(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS));
- } catch (NumberFormatException e) {
- logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS,
- e);
- }
- }
-
- logger.debug("IntegrityMonitor.validateProperties(): Property values \n" + "maxFpcUpdateIntervalMs = {}\n",
- maxFpcUpdateIntervalMs);
-
- return;
- }
-
- public static void updateProperties(Properties newprop) {
- if (isUnitTesting()) {
- try {
- validateProperties(newprop);
- } catch (IntegrityMonitorPropertiesException e) {
- logger.error("IntegrityMonitor threw exception.", e);
- }
- } else {
- logger.debug("Update integrity monitor properties not allowed");
- }
- }
-
- private static boolean isNodeTypeEnum(String nodeType) {
- String upper = nodeType.toUpperCase();
- for (NodeType n : NodeType.values()) {
- if (n.toString().equals(upper)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Look for "Forward Progress" -- if the 'FPMonitor' is stalled for too
- * long, the operational state is changed to 'Disabled', and an alarm is
- * set. The state is restored when forward progress continues.
- */
- private void fpMonitorCycle() {
- logger.debug("fpMonitorCycle(): entry");
- synchronized (fpMonitorCycleLock) {
- // monitoring interval checks
- if (monitorIntervalMs <= 0) {
- logger.debug("fpMonitorCycle(): disabled");
- elapsedTime = 0;
- return; // monitoring is disabled
- }
-
- elapsedTime = elapsedTime + cycleIntervalMillis;
- if (elapsedTime < monitorIntervalMs) {
- return; // monitoring interval not reached
- }
-
- elapsedTime = 0; // reset elapsed time
-
- try {
- if (fpCounter == lastFpCounter) {
- // no forward progress
- missedCycles += 1;
- if (missedCycles >= failedCounterThreshold && !alarmExists) {
- logger.debug("Forward progress not detected for resource {}. Setting state to disable failed.",
- resourceName);
- if (!(stateManager.getOpState()).equals(StateManagement.DISABLED)) {
- // Note: The refreshStateAudit will make redundant
- // calls
- stateManager.disableFailed();
- } // The refreshStateAudit will catch the case where
- // opStat = disabled and availState !
- // failed/dependency.failed
- alarmExists = true;
- }
- } else {
- // forward progress has occurred
- lastFpCounter = fpCounter;
- missedCycles = 0;
- // set op state to enabled
- logger.debug("Forward progress detected for resource {}. Setting state to enable not failed.",
- resourceName);
- if (!(stateManager.getOpState()).equals(StateManagement.ENABLED)) {
- // Note: The refreshStateAudit will make redundant calls
- stateManager.enableNotFailed();
- } // The refreshStateAudit will catch the case where
- // opState=enabled and availStatus != null
- alarmExists = false;
- }
- } catch (Exception e) {
- // log error
- logger.error("FP Monitor encountered error. ", e);
- }
- }
- logger.debug("fpMonitorCycle(): exit");
- }
-
- /**
- * Look for "Forward Progress" on other nodes. If they are not making
- * forward progress, check their operational state. If it is not disabled,
- * then disable them.
- */
- private void stateAudit() {
- logger.debug("IntegrityMonitor.stateAudit(): entry");
- if (stateAuditIntervalMs <= 0) {
- logger.debug("IntegrityMonitor.stateAudit(): disabled");
- return; // stateAudit is disabled
- }
-
- // Only run from nodes that are operational
- if (stateManager.getOpState().equals(StateManagement.DISABLED)) {
- logger.debug("IntegrityMonitor.stateAudit(): DISABLED. returning");
- return;
- }
- if (stateManager.getAdminState().equals(StateManagement.LOCKED)) {
- logger.debug("IntegrityMonitor.stateAudit(): LOCKED. returning");
- return;
- }
- if (!stateManager.getStandbyStatus().equals(StateManagement.NULL_VALUE)
- && stateManager.getStandbyStatus() != null) {
- if (!stateManager.getStandbyStatus().equals(StateManagement.PROVIDING_SERVICE)) {
- logger.debug("IntegrityMonitor.stateAudit(): NOT PROVIDING_SERVICE. returning");
- return;
- }
- }
-
- Date date = new Date();
- long timeSinceLastStateAudit = date.getTime() - lastStateAuditTime.getTime();
- if (timeSinceLastStateAudit < stateAuditIntervalMs) {
- logger.debug("IntegrityMonitor.stateAudit(): Not time to run. returning");
- return;
- }
-
- executeStateAudit();
-
- lastStateAuditTime = date;
-
- logger.debug("IntegrityMonitor.stateAudit(): exit");
- }// end stateAudit()
-
- public void executeStateAudit() {
- logger.debug("IntegrityMonitor.executeStateAudit(): entry");
- Date date = new Date();
-
- // Get all entries in the forwardprogressentity table
- List<ForwardProgressEntity> fpList = getAllForwardProgressEntity();
-
- // Check if each forwardprogressentity entry is current
- for (ForwardProgressEntity fpe : fpList) {
- // If the this is my ForwardProgressEntity, continue
- if (fpe.getResourceName().equals(IntegrityMonitor.resourceName)) {
- continue;
- }
- // Make sure you are not getting a cached version
- em.refresh(fpe);
- long diffMs = date.getTime() - fpe.getLastUpdated().getTime();
- if (logger.isDebugEnabled()) {
- logger.debug("IntegrityMonitor.executeStateAudit(): resource = {}, diffMs = {}", fpe.getResourceName(),
- diffMs);
- }
-
- // Threshold for a stale entry
- long staleMs = maxFpcUpdateIntervalMs;
- if (logger.isDebugEnabled()) {
- logger.debug("IntegrityMonitor.executeStateAudit(): resource = {}, staleMs = {}", fpe.getResourceName(),
- staleMs);
- }
-
- if (diffMs > staleMs) {
- // ForwardProgress is stale. Disable it
- // Start a transaction
- logger.debug("IntegrityMonitor.executeStateAudit(): resource = {}, FPC is stale. Disabling it");
- EntityTransaction et = em.getTransaction();
- et.begin();
- StateManagementEntity sme = null;
- try {
- // query if StateManagement entry exists for fpe resource
- Query query = em
- .createQuery("Select p from StateManagementEntity p where p.resourceName=:resource");
- query.setParameter("resource", fpe.getResourceName());
-
- @SuppressWarnings("rawtypes")
- List smList = query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT)
- .getResultList();
- if (!smList.isEmpty()) {
- // exists
- sme = (StateManagementEntity) smList.get(0);
- // refresh the object from DB in case cached data was
- // returned
- em.refresh(sme);
- if (logger.isDebugEnabled()) {
- logger.debug(
- "IntegrityMonitor.executeStateAudit(): Found entry in StateManagementEntity table for Resource={}",
- sme.getResourceName());
- }
- } else {
- String msg = "IntegrityMonitor.executeStateAudit(): " + fpe.getResourceName()
- + ": resource not found in state management entity database table";
- logger.error("{}", msg);
- }
- synchronized (imFlushLock) {
- et.commit();
- }
- } catch (Exception e) {
- // log an error
- logger.error(
- "IntegrityMonitor.executeStateAudit(): {}: StateManagementEntity DB read failed with exception: ",
- fpe.getResourceName(), e);
- synchronized (imFlushLock) {
- if (et.isActive()) {
- et.rollback();
- }
- }
- }
-
- if (sme != null && !sme.getOpState().equals(StateManagement.DISABLED)) {
- if (logger.isDebugEnabled()) {
- logger.debug("IntegrityMonitor.executeStateAudit(): Changing OpStat = disabled for {}",
- sme.getResourceName());
- }
- try {
- stateManager.disableFailed(sme.getResourceName());
- } catch (Exception e) {
- String msg = "IntegrityMonitor.executeStateAudit(): Failed to disable " + sme.getResourceName();
- logger.error("{}", msg, e);
- }
- }
- } // end if(diffMs > staleMs)
- } // end for(ForwardProgressEntity fpe : fpList)
- logger.debug("IntegrityMonitor.executeStateAudit(): exit");
- }
-
- /**
- * Execute a test transaction when test transaction interval has elapsed.
- */
- private void checkTestTransaction() {
- logger.debug("checkTestTransaction(): entry");
- synchronized (checkTestTransactionLock) {
-
- // test transaction timer checks
- if (testTransIntervalMs <= 0) {
- logger.debug("checkTestTransaction(): disabled");
- elapsedTestTransTime = 0;
- return; // test transaction is disabled
- }
-
- elapsedTestTransTime = elapsedTestTransTime + cycleIntervalMillis;
- if (elapsedTestTransTime < testTransIntervalMs) {
- return; // test transaction interval not reached
- }
-
- elapsedTestTransTime = 0; // reset elapsed time
-
- // execute test transaction
- testTransaction();
- }
- logger.debug("checkTestTransaction(): exit");
- }
-
- /**
- * Updates Fpc counter in database when write Fpc interval has elapsed.
- */
- private void checkWriteFpc() {
- logger.debug("checkWriteFpc(): entry");
- synchronized (checkWriteFpcLock) {
-
- // test transaction timer checks
- if (writeFpcIntervalMs <= 0) {
- logger.debug("checkWriteFpc(): disabled");
- elapsedWriteFpcTime = 0;
- return; // write Fpc is disabled
- }
-
- elapsedWriteFpcTime = elapsedWriteFpcTime + cycleIntervalMillis;
- if (elapsedWriteFpcTime < writeFpcIntervalMs) {
- return; // write Fpc interval not reached
- }
-
- elapsedWriteFpcTime = 0; // reset elapsed time
-
- // write Fpc to database
- try {
- writeFpc();
- } catch (Exception e) {
- logger.error("IntegrityMonitor threw exception.", e);
- }
- }
- logger.debug("checkWriteFpc(): exit");
- }
-
- /**
- * Execute a dependency health check periodically which also updates this
- * resource's state.
- */
- private void checkDependentHealth() {
- logger.debug("checkDependentHealth: entry");
- if (checkDependencyIntervalMs <= 0) {
- logger.debug("checkDependentHealth: disabled");
- return; // dependency monitoring is disabled
- }
-
- long currTime = System.currentTimeMillis();
- logger.debug("checkDependentHealth currTime - lastDependencyCheckTime = {}",
- currTime - lastDependencyCheckTime);
- if ((currTime - lastDependencyCheckTime) > checkDependencyIntervalMs) {
- // execute dependency check and update this resource's state
-
- dependencyCheck();
- }
- logger.debug("checkDependentHealth: exit");
- }
-
- /*
- * This is a simple refresh audit which is periodically run to assure that
- * the states and status attributes are aligned and notifications are sent
- * to any listeners. It is possible for state/status to get out of synch and
- * notified systems to be out of synch due to database corruption (manual or
- * otherwise) or because a node became isolated.
- *
- * When the operation (lock/unlock) is called, it will cause a re-evaluation
- * of the state and send a notification to all registered observers.
- */
- private void refreshStateAudit() {
- logger.debug("refreshStateAudit(): entry");
- if (refreshStateAuditIntervalMs <= 0) {
- // The audit is disabled
- logger.debug("refreshStateAudit(): disabled");
- return;
- }
- executeRefreshStateAudit();
- logger.debug("refreshStateAudit(): exit");
- }
-
- public void executeRefreshStateAudit() {
- logger.debug("executeRefreshStateAudit(): entry");
- synchronized (refreshStateAuditLock) {
- logger.debug("refreshStateAudit: entry");
- Date now = new Date();
- long nowMs = now.getTime();
- long lastTimeMs = refreshStateAuditLastRunDate.getTime();
- logger.debug("refreshStateAudit: ms since last run = {}", nowMs - lastTimeMs);
-
- if ((nowMs - lastTimeMs) > refreshStateAuditIntervalMs) {
- String adminState = stateManager.getAdminState();
- logger.debug("refreshStateAudit: adminState = {}", adminState);
- if (adminState.equals(StateManagement.LOCKED)) {
- try {
- logger.debug("refreshStateAudit: calling lock()");
- stateManager.lock();
- } catch (Exception e) {
- logger.error("refreshStateAudit: caught unexpected exception from stateManager.lock(): ", e);
- }
- } else {// unlocked
- try {
- logger.debug("refreshStateAudit: calling unlock()");
- stateManager.unlock();
- } catch (Exception e) {
- logger.error("refreshStateAudit: caught unexpected exception from stateManager.unlock(): ", e);
- }
- }
- refreshStateAuditLastRunDate = new Date();
- logger.debug("refreshStateAudit: exit");
- }
- }
- logger.debug("executeRefreshStateAudit(): exit");
- }
-
- /**
- * The following nested class periodically performs the forward progress
- * check, checks dependencies, does a refresh state audit and runs the
- * stateAudit.
- */
- class FPManager extends Thread {
- private final CountDownLatch stopper = new CountDownLatch(1);
-
- private BlockingQueue<CountDownLatch> queue;
- private CountDownLatch progressLatch = null;
-
- // Constructor - start FP manager thread
- FPManager(BlockingQueue<CountDownLatch> queue) {
- this.queue = queue;
- // set now as the last time the refreshStateAudit ran
- IntegrityMonitor.this.refreshStateAuditLastRunDate = new Date();
- // start thread
- this.start();
- }
-
- @Override
- public void run() {
- logger.debug("FPManager thread running");
-
- try {
- getLatch();
- decrementLatch();
-
- while (!stopper.await(cycleIntervalMillis, TimeUnit.MILLISECONDS)) {
- getLatch();
- IntegrityMonitor.this.runOnce();
- decrementLatch();
- }
-
- } catch (InterruptedException e) {
- logger.debug("IntegrityMonitor threw exception.", e);
- Thread.currentThread().interrupt();
- }
- }
-
- public void stopAndExit() {
- stopper.countDown();
- this.interrupt();
- }
-
- /**
- * Gets the next latch from the queue.
- *
- * @throws InterruptedException
- *
- */
- private void getLatch() throws InterruptedException {
- if (queue != null) {
- progressLatch = queue.take();
- }
- }
-
- /**
- * Decrements the current latch.
- */
- private void decrementLatch() {
- if (progressLatch != null) {
- progressLatch.countDown();
- }
- }
-
- }
-
- private void runOnce() {
- try {
- logger.debug("FPManager calling fpMonitorCycle()");
- // check forward progress timer
- fpMonitorCycle();
-
- logger.debug("FPManager calling checkTestTransaction()");
- // check test transaction timer
- checkTestTransaction();
-
- logger.debug("FPManager calling checkWriteFpc()");
- // check write Fpc timer
- checkWriteFpc();
-
- logger.debug("FPManager calling checkDependentHealth()");
- // check dependency health
- checkDependentHealth();
-
- logger.debug("FPManager calling refreshStateAudit()");
- // check if it is time to run the refreshStateAudit
- refreshStateAudit();
-
- logger.debug("FPManager calling stateAudit()");
- // check if it is time to run the stateAudit
- stateAudit();
-
- } catch (Exception e) {
- logger.error("Ignore FPManager thread processing timer(s) exception: ", e);
- }
- }
-
- public void allSeemsWell(@NotNull String key, @NotNull Boolean asw, @NotNull String msg)
- throws AllSeemsWellException {
-
- logger.debug("allSeemsWell entry: key = {}, asw = {}, msg = {}", key, asw, msg);
- if (key == null || key.isEmpty()) {
- logger.error("allSeemsWell: 'key' has no visible content");
- throw new IllegalArgumentException("allSeemsWell: 'key' has no visible content");
- }
- if (asw == null) {
- logger.error("allSeemsWell: 'asw' is null");
- throw new IllegalArgumentException("allSeemsWell: 'asw' is null");
- }
- if (msg == null || msg.isEmpty()) {
- logger.error("allSeemsWell: 'msg' has no visible content");
- throw new IllegalArgumentException("allSeemsWell: 'msg' has no visible content");
- }
-
- if (allSeemsWellMap == null) {
- allSeemsWellMap = new HashMap<>();
- }
-
- if (allNotWellMap == null) {
- allNotWellMap = new HashMap<>();
- }
-
- if (asw) {
- logger.info("allSeemsWell: ALL SEEMS WELL: key = {}, msg = {}", key, msg);
- try {
- allSeemsWellMap.put(key, msg);
- } catch (Exception e) {
- String exceptMsg = "allSeemsWell: encountered an exception with allSeemsWellMap.put(" + key + "," + msg
- + ")";
- logger.error(exceptMsg);
- throw new AllSeemsWellException(exceptMsg, e);
- }
-
- try {
- allNotWellMap.remove(key);
- } catch (Exception e) {
- String exceptMsg = "allSeemsWell: encountered an exception with allNotWellMap.delete(" + key + ")";
- logger.error(exceptMsg);
- throw new AllSeemsWellException(exceptMsg, e);
- }
-
- } else {
- logger.error("allSeemsWell: ALL NOT WELL: key = {}, msg = {}", key, msg);
- try {
- allSeemsWellMap.remove(key);
- } catch (Exception e) {
- String exceptMsg = "allSeemsWell: encountered an exception with allSeemsWellMap.remove(" + key + ")";
- logger.error(exceptMsg);
- throw new AllSeemsWellException(exceptMsg, e);
- }
-
- try {
- allNotWellMap.put(key, msg);
- } catch (Exception e) {
- String exceptMsg = "allSeemsWell: encountered an exception with allNotWellMap.put(" + key + msg + ")";
- logger.error(exceptMsg);
- throw new AllSeemsWellException(exceptMsg, e);
- }
- }
-
- if (logger.isDebugEnabled()) {
- for (Entry<String, String> entry : allSeemsWellMap.entrySet()) {
- logger.debug("allSeemsWellMap: key = {} msg = {}", entry.getKey(), entry.getValue());
- }
- for (Entry<String, String> entry : allNotWellMap.entrySet()) {
- logger.debug("allNotWellMap: key = {} msg = {}", entry.getKey(), entry.getValue());
- }
- logger.debug("allSeemsWell exit");
- }
- }
-
- /**
- * Converts the given value to milliseconds using the current
- * {@link #propertyUnits}.
- *
- * @param value
- * value to be converted, or -1
- * @return the value, in milliseconds, or -1
- */
- private static long toMillis(long value) {
- return (value < 0 ? -1 : propertyUnits.toMillis(value));
- }
-
- public Map<String, String> getAllSeemsWellMap() {
- return allSeemsWellMap;
- }
-
- public Map<String, String> getAllNotWellMap() {
- return allNotWellMap;
- }
-
- /*
- * The remaining methods are used by JUnit tests.
- */
-
- public static boolean isUnitTesting() {
- return isUnitTesting;
- }
-
- public static void setUnitTesting(boolean isUnitTesting) {
- IntegrityMonitor.isUnitTesting = isUnitTesting;
- }
-
- protected static TimeUnit getPropertyUnits() {
- return propertyUnits;
- }
-
- protected static void setPropertyUnits(TimeUnit propertyUnits) {
- IntegrityMonitor.propertyUnits = propertyUnits;
- }
-
- protected static long getCycleIntervalMillis() {
- return cycleIntervalMillis;
- }
-
- protected static void setCycleIntervalMillis(long cycleIntervalMillis) {
- IntegrityMonitor.cycleIntervalMillis = cycleIntervalMillis;
- }
-
- protected static String getPersistenceUnit() {
- return persistenceUnit;
- }
-
- protected static void setPersistenceUnit(String persistenceUnit) {
- IntegrityMonitor.persistenceUnit = persistenceUnit;
- }
+ // Persistence Unit for JPA
+ public static final String PERSISTENCE_UNIT = "operationalPU";
+
+ private static String persistenceUnit = PERSISTENCE_UNIT;
+
+ private static final long CYCLE_INTERVAL_MILLIS = 1000L;
+
+ private static long cycleIntervalMillis = CYCLE_INTERVAL_MILLIS;
+
+ /**
+ * Units used for intervals extracted from the properties, which are typically given in seconds.
+ */
+ private static TimeUnit propertyUnits = TimeUnit.SECONDS;
+
+ private StateManagement stateManager = null;
+
+ private FpManager fpManager = null;
+
+ // The forward progress counter is incremented as the
+ // process being monitored makes forward progress
+ private int fpCounter = 0;
+ private int lastFpCounter = 0;
+
+ // elapsed time since last FP counter check
+ private long elapsedTime = 0;
+
+ // elapsed time since last test transaction check
+ private long elapsedTestTransTime = 0;
+
+ // elapsed time since last write Fpc check
+ private long elapsedWriteFpcTime = 0;
+
+ // last dependency health check time. Initialize so that the periodic check
+ // starts after 60 seconds.
+ // This allows time for dependents to come up.
+ private long lastDependencyCheckTime = System.currentTimeMillis();
+
+ // Time of the last state audit. It is initialized at the time of the IM
+ // construction
+ private Date lastStateAuditTime = new Date();
+
+ // Interval between state audits in ms. We leave it turned off by default so
+ // that it will only
+ // be run on the nodes which we want doing the audit. In particular, we only
+ // want it to run
+ // on the droolspdps
+ private static long stateAuditIntervalMs = 0L;
+
+ // the number of cycles since 'fpCounter' was last changed
+ private int missedCycles = 0;
+
+ // forward progress monitoring interval
+ private static long monitorIntervalMs = 1000L * IntegrityMonitorProperties.DEFAULT_MONITOR_INTERVAL;
+ // The number of periods the counter fails to increment before an alarm is
+ // raised.
+ private static int failedCounterThreshold = IntegrityMonitorProperties.DEFAULT_FAILED_COUNTER_THRESHOLD;
+ // test transaction interval
+ private static long testTransIntervalMs = 1000L * IntegrityMonitorProperties.DEFAULT_TEST_INTERVAL;
+ // write Fpc to DB interval
+ private static long writeFpcIntervalMs = 1000L * IntegrityMonitorProperties.DEFAULT_WRITE_FPC_INTERVAL;
+ // check the health of dependencies
+ private static long checkDependencyIntervalMs =
+ 1000L * IntegrityMonitorProperties.DEFAULT_CHECK_DEPENDENCY_INTERVAL;
+
+ // A lead subsystem will have dependency groups with resource names in the
+ // properties file.
+ // For non-lead subsystems, the dependency_group property will be absent.
+ private static String[] depGroups = null;
+
+ private static boolean isUnitTesting = false;
+
+ // can turn on health checking of dependents via jmx test() call by setting
+ // this property to true
+ private static boolean testViaJmx = false;
+
+ private static String jmxFqdn = null;
+
+ // this is the max interval allowed without any forward progress
+ // counter updates
+ private static long maxFpcUpdateIntervalMs = 1000L * IntegrityMonitorProperties.DEFAULT_MAX_FPC_UPDATE_INTERVAL;
+
+ // Node types
+ private enum NodeType {
+ PDP_XACML, PDP_DROOLS, PAP, PAP_ADMIN, LOGPARSER, BRMS_GATEWAY, ASTRA_GATEWAY, ELK_SERVER, PYPDP
+
+ }
+
+ private static String siteName;
+ private static String nodeType;
+ private Date refreshStateAuditLastRunDate;
+ private static long refreshStateAuditIntervalMs = 600000; // run it once per 10 minutes
+
+ // lock objects
+ private final Object evaluateSanityLock = new Object();
+ private final Object fpMonitorCycleLock = new Object();
+ private final Object dependencyCheckLock = new Object();
+ private final Object testTransactionLock = new Object();
+ private final Object startTransactionLock = new Object();
+ private final Object endTransactionLock = new Object();
+ private final Object checkTestTransactionLock = new Object();
+ private final Object checkWriteFpcLock = new Object();
+ private static final Object getInstanceLock = new Object();
+ private final Object refreshStateAuditLock = new Object();
+ private final Object imFlushLock = new Object();
+
+ private Map<String, String> allSeemsWellMap;
+ private Map<String, String> allNotWellMap;
+
+ /**
+ * IntegrityMonitor constructor. It is invoked from the getInstance() method in this class or
+ * from the constructor of a child or sub-class. A class can extend the IntegrityMonitor class
+ * if there is a need to override any of the base methods (ex. subsystemTest()). Only one
+ * instance is allowed to be created per resource name.
+ *
+ * @param resourceName The resource name of the resource
+ * @param properties a set of properties passed in from the resource
+ * @throws IntegrityMonitorException if any errors are encountered in the constructor
+ */
+ protected IntegrityMonitor(String resourceName, Properties properties) throws IntegrityMonitorException {
+
+ this(resourceName, properties, null);
+ }
+
+ /**
+ * IntegrityMonitor constructor. It is invoked from the getInstance() method in this class or
+ * from the constructor of a child or sub-class. A class can extend the IntegrityMonitor class
+ * if there is a need to override any of the base methods (ex. subsystemTest()). Only one
+ * instance is allowed to be created per resource name.
+ *
+ * @param resourceName The resource name of the resource
+ * @param properties a set of properties passed in from the resource
+ * @param queue queue to use to control the FPManager thread, or {@code null}
+ * @throws IntegrityMonitorException if any errors are encountered in the constructor
+ */
+ protected IntegrityMonitor(String resourceName, Properties properties, BlockingQueue<CountDownLatch> queue)
+ throws IntegrityMonitorException {
+
+ // singleton check since this constructor can be called from a child or
+ // sub-class
+ if (instance != null) {
+ String msg = "IM object exists and only one instance allowed";
+ logger.error("{}", msg);
+ throw new IntegrityMonitorException("IntegrityMonitor constructor exception: " + msg);
+ }
+ instance = this;
+
+ IntegrityMonitor.resourceName = resourceName;
+
+ /*
+ * Validate that the properties file contains all the needed properties. Throws an
+ * IntegrityMonitorPropertiesException
+ */
+ validateProperties(properties);
+
+ // construct jmx url
+ String jmxUrl = getJmxUrl();
+
+ //
+ // Create the entity manager factory
+ //
+ emf = Persistence.createEntityManagerFactory(persistenceUnit, properties);
+ //
+ // Did it get created?
+ //
+ if (emf == null) {
+ logger.error("Error creating IM entity manager factory with persistence unit: {}", persistenceUnit);
+ throw new IntegrityMonitorException("Unable to create IM Entity Manager Factory");
+ }
+
+ // add entry to forward progress and resource registration tables in DB
+
+ // Start a transaction
+ em = emf.createEntityManager();
+ EntityTransaction et = em.getTransaction();
+
+ et.begin();
+
+ try {
+ // if ForwardProgress entry exists for resourceName, update it. If
+ // not found, create a new entry
+ Query fquery = em.createQuery("Select f from ForwardProgressEntity f where f.resourceName=:rn");
+ fquery.setParameter("rn", resourceName);
+
+ @SuppressWarnings("rawtypes")
+ List fpList = fquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ ForwardProgressEntity fpx = null;
+ if (!fpList.isEmpty()) {
+ // ignores multiple results
+ fpx = (ForwardProgressEntity) fpList.get(0);
+ // refresh the object from DB in case cached data was returned
+ em.refresh(fpx);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Resource {} exists and will be updated - old fpc= {}, lastUpdated= {}", resourceName,
+ fpx.getFpcCount(), fpx.getLastUpdated());
+ }
+ fpx.setFpcCount(fpCounter);
+ } else {
+ // Create a forward progress object
+ logger.debug("Adding resource {} to ForwardProgress table", resourceName);
+ fpx = new ForwardProgressEntity();
+ }
+ // update/set columns in entry
+ fpx.setResourceName(resourceName);
+ em.persist(fpx);
+ // flush to the DB
+ synchronized (imFlushLock) {
+ em.flush();
+ }
+
+ // if ResourceRegistration entry exists for resourceName, update it.
+ // If not found, create a new entry
+ Query rquery = em.createQuery("Select r from ResourceRegistrationEntity r where r.resourceName=:rn");
+ rquery.setParameter("rn", resourceName);
+
+ @SuppressWarnings("rawtypes")
+ List rrList = rquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ ResourceRegistrationEntity rrx = null;
+ if (!rrList.isEmpty()) {
+ // ignores multiple results
+ rrx = (ResourceRegistrationEntity) rrList.get(0);
+ // refresh the object from DB in case cached data was returned
+ em.refresh(rrx);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Resource {} exists and will be updated - old url= {}, createdDate={}", resourceName,
+ rrx.getResourceUrl(), rrx.getCreatedDate());
+ }
+ rrx.setLastUpdated(new Date());
+ } else {
+ // register resource by adding entry to table in DB
+ logger.debug("Adding resource {} to ResourceRegistration table", resourceName);
+ rrx = new ResourceRegistrationEntity();
+ }
+ // update/set columns in entry
+ rrx.setResourceName(resourceName);
+ rrx.setResourceUrl(jmxUrl);
+ rrx.setNodeType(nodeType);
+ rrx.setSite(siteName);
+ em.persist(rrx);
+ // flush to the DB
+ synchronized (imFlushLock) {
+ et.commit();
+ }
+
+ } catch (Exception e) {
+ logger.error("IntegrityMonitor constructor DB table update failed with exception: ", e);
+ try {
+ if (et.isActive()) {
+ synchronized (imFlushLock) {
+ et.rollback();
+ }
+ }
+ } catch (Exception e1) {
+ logger.error("IntegrityMonitor constructor threw exception: ", e1);
+ }
+ throw e;
+ }
+
+ try {
+ // create instance of StateMangement class and pass emf to it
+ stateManager = new StateManagement(emf, resourceName);
+
+ /**
+ * Initialize the state and status attributes. This will maintain any Administrative
+ * state value but will set the operational state = enabled, availability status = null,
+ * standby status = null. The integrity monitor will set the operational state via the
+ * FPManager and the owning application must set the standby status by calling
+ * promote/demote on the StateManager.
+ */
+ stateManager.initializeState();
+
+ } catch (StateManagementException e) {
+ throw new IntegrityMonitorException(e);
+ }
+
+ // create management bean
+ try {
+ new ComponentAdmin(resourceName, this, stateManager);
+ } catch (Exception e) {
+ logger.error("ComponentAdmin constructor exception: {}", e.toString(), e);
+ }
+
+ fpManager = new FpManager(queue);
+
+ }
+
+ /**
+ * Get an instance of IntegrityMonitor for a given resource name. It creates one if it does not
+ * exist. Only one instance is allowed to be created per resource name.
+ *
+ * @param resourceName The resource name of the resource
+ * @param properties a set of properties passed in from the resource
+ * @return The new instance of IntegrityMonitor
+ * @throws IntegrityMonitorException if unable to create jmx url or the constructor returns an
+ * exception
+ */
+ public static IntegrityMonitor getInstance(String resourceName, Properties properties)
+ throws IntegrityMonitorException {
+ return getInstance(resourceName, properties, null);
+ }
+
+ /**
+ * Get an instance of IntegrityMonitor for a given resource name. It creates one if it does not
+ * exist. Only one instance is allowed to be created per resource name.
+ *
+ * @param resourceName The resource name of the resource
+ * @param properties a set of properties passed in from the resource
+ * @param queue queue to use to control the FPManager thread, or {@code null}
+ * @return The new instance of IntegrityMonitor
+ * @throws IntegrityMonitorException if unable to create jmx url or the constructor returns an
+ * exception
+ */
+ protected static IntegrityMonitor getInstance(String resourceName, Properties properties,
+ BlockingQueue<CountDownLatch> queue) throws IntegrityMonitorException {
+
+ synchronized (getInstanceLock) {
+ logger.debug("getInstance() called - resourceName= {}", resourceName);
+ if (resourceName == null || resourceName.isEmpty() || properties == null) {
+ logger.error("Error: getIntegrityMonitorInstance() called with invalid input");
+ return null;
+ }
+
+ if (instance == null) {
+ logger.debug("Creating new instance of IntegrityMonitor");
+ instance = new IntegrityMonitor(resourceName, properties, queue);
+ }
+ return instance;
+ }
+ }
+
+ /**
+ * Get the single instance.
+ *
+ * @return the instance
+ * @throws IntegrityMonitorException if no instance exists
+ */
+ public static IntegrityMonitor getInstance() throws IntegrityMonitorException {
+ logger.debug("getInstance() called");
+ if (instance == null) {
+ String msg = "No IntegrityMonitor instance exists."
+ + " Please use the method IntegrityMonitor.getInstance(String resourceName, Properties properties)";
+ throw new IntegrityMonitorPropertiesException(msg);
+ } else {
+ return instance;
+ }
+ }
+
+ /**
+ * This is a facility used by JUnit testing to destroy the IntegrityMonitor instance before
+ * creating a new one. It waits a bit to allow the FPManager to fully exit.
+ */
+ public static void deleteInstance() throws IntegrityMonitorException {
+ logger.debug("deleteInstance() called");
+ synchronized (getInstanceLock) {
+ if (isUnitTesting() && instance != null && instance.getFpManager() != null) {
+ FpManager fpm = instance.getFpManager();
+
+ // Stop the FPManager thread
+ fpm.stopAndExit();
+
+ try {
+ // Make sure it has exited
+ fpm.join(2000L);
+ } catch (InterruptedException e) {
+ logger.error("deleteInstance: Interrupted while waiting for FPManaager to fully exit", e);
+ Thread.currentThread().interrupt();
+ }
+
+ if (fpm.isAlive()) {
+ logger.error("IntegrityMonitor.deleteInstance() Failed to kill FPManager thread");
+ throw new IntegrityMonitorException(
+ "IntegrityMonitor.deleteInstance() Failed to kill FPManager thread");
+ }
+
+ instance = null;
+ }
+ }
+ logger.debug("deleteInstance() exit");
+ }
+
+ private FpManager getFpManager() {
+ return fpManager;
+ }
+
+ private static String getJmxUrl() throws IntegrityMonitorException {
+
+ // get the jmx remote port and construct the JMX URL
+ Properties systemProps = System.getProperties();
+ String jmxPort = systemProps.getProperty("com.sun.management.jmxremote.port");
+ String jmxErrMsg;
+ if (jmxPort == null) {
+ jmxErrMsg = "System property com.sun.management.jmxremote.port for JMX remote port is not set";
+ logger.error("{}", jmxErrMsg);
+ throw new IntegrityMonitorException("getJmxUrl exception: " + jmxErrMsg);
+ }
+
+ int port = 0;
+ try {
+ port = Integer.parseInt(jmxPort);
+ } catch (NumberFormatException e) {
+ jmxErrMsg = "JMX remote port is not a valid integer value - " + jmxPort;
+ logger.error("{}", jmxErrMsg);
+ throw new IntegrityMonitorException("getJmxUrl exception: " + jmxErrMsg);
+ }
+
+ try {
+ if (jmxFqdn == null) {
+ // get FQDN of this host
+ jmxFqdn = InetAddress.getLocalHost().getCanonicalHostName();
+ }
+ } catch (Exception e) {
+ String msg = "getJmxUrl could not get hostname";
+ logger.error("{}", msg, e);
+ throw new IntegrityMonitorException("getJmxUrl Exception: " + msg);
+ }
+ if (jmxFqdn == null) {
+ String msg = "getJmxUrl encountered null hostname";
+ logger.error("{}", msg);
+ throw new IntegrityMonitorException("getJmxUrl error: " + msg);
+ }
+
+ // assemble the jmx url
+ String jmxUrl = "service:jmx:rmi:///jndi/rmi://" + jmxFqdn + ":" + port + "/jmxrmi";
+
+ logger.debug("IntegerityMonitor - jmx url={}", jmxUrl);
+
+ return jmxUrl;
+ }
+
+ /**
+ * evaluateSanity() is designed to be called by an external entity to evealuate the sanity of
+ * the node. It checks the operational and administrative states and the standby status. If the
+ * operational state is disabled, it will include the dependencyCheckErrorMsg which includes
+ * information about any dependency (node) which has failed.
+ */
+ public void evaluateSanity() throws IntegrityMonitorException {
+ logger.debug("evaluateSanity called ....");
+ synchronized (evaluateSanityLock) {
+
+ String errorMsg = dependencyCheckErrorMsg;
+ logger.debug("evaluateSanity dependencyCheckErrorMsg = {}", errorMsg);
+ // check op state and throw exception if disabled
+ if ((stateManager.getOpState() != null) && stateManager.getOpState().equals(StateManagement.DISABLED)) {
+ String msg = "Resource " + resourceName + " operation state is disabled. " + errorMsg;
+ logger.debug("{}", msg);
+ throw new IntegrityMonitorException(msg);
+ }
+
+ // check admin state and throw exception if locked
+ if ((stateManager.getAdminState() != null) && stateManager.getAdminState().equals(StateManagement.LOCKED)) {
+ String msg = "Resource " + resourceName + " is administratively locked";
+ logger.debug("{}", msg);
+ throw new AdministrativeStateException("IntegrityMonitor Admin State Exception: " + msg);
+ }
+ // check standby state and throw exception if cold standby
+ if ((stateManager.getStandbyStatus() != null)
+ && stateManager.getStandbyStatus().equals(StateManagement.COLD_STANDBY)) {
+ String msg = "Resource " + resourceName + " is cold standby";
+ logger.debug("{}", msg);
+ throw new StandbyStatusException("IntegrityMonitor Standby Status Exception: " + msg);
+ }
+
+ }
+
+ }
+
+ /**
+ * This method checks the forward progress counter and the state of a dependency. If the
+ * dependency is unavailable or failed, an error message is created which is checked when
+ * evaluateSanity interface is called. If the error message is set then the evaluateSanity will
+ * return an error.
+ *
+ * @param dep the dependency
+ */
+ public String stateCheck(String dep) {
+ logger.debug("checking state of dependent resource: {}", dep);
+ String errorMsg = null;
+ ForwardProgressEntity forwardProgressEntity = null;
+ StateManagementEntity stateManagementEntity = null;
+
+ // Start a transaction
+ EntityTransaction et = em.getTransaction();
+ et.begin();
+
+ try {
+ Query query = em.createQuery("Select p from ForwardProgressEntity p where p.resourceName=:resource");
+ query.setParameter("resource", dep);
+
+ @SuppressWarnings("rawtypes")
+ List fpList = query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+
+ if (!fpList.isEmpty()) {
+ // exists
+ forwardProgressEntity = (ForwardProgressEntity) fpList.get(0);
+ // refresh the object from DB in case cached data was returned
+ em.refresh(forwardProgressEntity);
+ logger.debug("Found entry in ForwardProgressEntity table for dependent Resource={}", dep);
+ } else {
+ errorMsg = dep + ": resource not found in ForwardProgressEntity database table";
+ logger.error("{}", errorMsg);
+ }
+ synchronized (imFlushLock) {
+ et.commit();
+ }
+ } catch (Exception ex) {
+ // log an error
+ errorMsg = dep + ": ForwardProgressEntity DB operation failed with exception: ";
+ logger.error("{}", errorMsg, ex);
+ synchronized (imFlushLock) {
+ if (et.isActive()) {
+ et.rollback();
+ }
+ }
+ }
+
+ if (errorMsg == null) {
+ // Start a transaction
+ et = em.getTransaction();
+ et.begin();
+ try {
+ // query if StateManagement entry exists for dependent resource
+ Query query = em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource");
+ query.setParameter("resource", dep);
+
+ @SuppressWarnings("rawtypes")
+ List smList = query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ if (!smList.isEmpty()) {
+ // exist
+ stateManagementEntity = (StateManagementEntity) smList.get(0);
+ // refresh the object from DB in case cached data was
+ // returned
+ em.refresh(stateManagementEntity);
+ logger.debug("Found entry in StateManagementEntity table for dependent Resource={}", dep);
+ } else {
+ errorMsg = dep + ": resource not found in state management entity database table";
+ logger.error("{}", errorMsg);
+ }
+
+ synchronized (imFlushLock) {
+ et.commit();
+ }
+ } catch (Exception e) {
+ // log an error
+ errorMsg = dep + ": StateManagementEntity DB read failed with exception: ";
+ logger.error("{}", errorMsg, e);
+ synchronized (imFlushLock) {
+ if (et.isActive()) {
+ et.rollback();
+ }
+ }
+ }
+ }
+
+ // verify that the ForwardProgress is current (check last_updated)
+ if (errorMsg == null) {
+ if (forwardProgressEntity != null && stateManagementEntity != null) {
+ Date date = new Date();
+ long diffMs = date.getTime() - forwardProgressEntity.getLastUpdated().getTime();
+ logger.debug("IntegrityMonitor.stateCheck(): diffMs = {}", diffMs);
+
+ // Threshold for a stale entry
+ long staleMs = maxFpcUpdateIntervalMs;
+ logger.debug("IntegrityMonitor.stateCheck(): staleMs = {}", staleMs);
+
+ if (diffMs > staleMs) {
+ // ForwardProgress is stale. Disable it
+ try {
+ if (!stateManagementEntity.getOpState().equals(StateManagement.DISABLED)) {
+ logger.debug("IntegrityMonitor.stateCheck(): Changing OpStat = disabled for {}", dep);
+ stateManager.disableFailed(dep);
+ }
+ } catch (Exception e) {
+ String msg = "IntegrityMonitor.stateCheck(): Failed to diableFail dependent resource = " + dep
+ + "; " + e.getMessage();
+ logger.error("{}", msg, e);
+ }
+ }
+ } else {
+
+ if (forwardProgressEntity == null) {
+ String msg = "IntegrityMonitor.stateCheck(): Failed to diableFail dependent resource = " + dep
+ + "; " + " forwardProgressEntity == null.";
+ logger.error("{}", msg);
+ }
+
+ else {
+ String msg = "IntegrityMonitor.stateCheck(): Failed to diableFail dependent resource = " + dep
+ + "; " + " stateManagementEntity == null.";
+ logger.error("{}", msg);
+ }
+ }
+ }
+
+ // check operation, admin and standby states of dependent resource
+ if (errorMsg == null) {
+ if (stateManagementEntity != null) {
+ if ((stateManager.getAdminState() != null)
+ && stateManagementEntity.getAdminState().equals(StateManagement.LOCKED)) {
+ errorMsg = dep + ": resource is administratively locked";
+ logger.error("{}", errorMsg);
+ } else if ((stateManager.getOpState() != null)
+ && stateManagementEntity.getOpState().equals(StateManagement.DISABLED)) {
+ errorMsg = dep + ": resource is operationally disabled";
+ logger.error("{}", errorMsg);
+ } else if ((stateManager.getStandbyStatus() != null)
+ && stateManagementEntity.getStandbyStatus().equals(StateManagement.COLD_STANDBY)) {
+ errorMsg = dep + ": resource is cold standby";
+ logger.error("{}", errorMsg);
+ }
+ } else {
+ errorMsg = dep + ": could not check standy state of resource. stateManagementEntity == null.";
+ logger.error("{}", errorMsg);
+ }
+ }
+
+ String returnMsg = "IntegrityMonitor.stateCheck(): returned error_msg: " + errorMsg;
+ logger.debug("{}", returnMsg);
+ return errorMsg;
+ }
+
+ private String fpCheck(String dep) {
+ logger.debug("checking forward progress count of dependent resource: {}", dep);
+
+ String errorMsg = null;
+
+ // check FPC count - a changing FPC count indicates the resource JVM is
+ // running
+
+ // Start a transaction
+ EntityTransaction et = em.getTransaction();
+ et.begin();
+ try {
+ Query fquery = em.createQuery("Select f from ForwardProgressEntity f where f.resourceName=:rn");
+ fquery.setParameter("rn", dep);
+
+ @SuppressWarnings("rawtypes")
+ List fpList = fquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ ForwardProgressEntity fpx;
+ if (!fpList.isEmpty()) {
+ // ignores multiple results
+ fpx = (ForwardProgressEntity) fpList.get(0);
+ // refresh the object from DB in case cached data was returned
+ em.refresh(fpx);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Dependent resource {} - fpc= {}, lastUpdated={}", dep, fpx.getFpcCount(),
+ fpx.getLastUpdated());
+ }
+ long currTime = System.currentTimeMillis();
+ // if dependent resource FPC has not been updated, consider it
+ // an error
+ if ((currTime - fpx.getLastUpdated().getTime()) > maxFpcUpdateIntervalMs) {
+ errorMsg = dep + ": FP count has not been updated in the last " + maxFpcUpdateIntervalMs + "ms";
+ logger.error("{}", errorMsg);
+ try {
+ // create instance of StateMangement class for dependent
+ StateManagement depStateManager = new StateManagement(emf, dep);
+ if (!depStateManager.getOpState().equals(StateManagement.DISABLED)) {
+ logger.debug("Forward progress not detected for dependent resource {}. Setting dependent's "
+ + "state to disable failed.", dep);
+ depStateManager.disableFailed();
+ }
+ } catch (Exception e) {
+ // ignore errors
+ logger.error("Update dependent state failed with exception: ", e);
+ }
+ }
+ } else {
+ // resource entry not found in FPC table
+ errorMsg = dep + ": resource not found in ForwardProgressEntity table in the DB";
+ logger.error("{}", errorMsg);
+ }
+ synchronized (imFlushLock) {
+ et.commit();
+ }
+ } catch (Exception e) {
+ // log an error and continue
+ errorMsg = dep + ": ForwardProgressEntity DB read failed with exception: ";
+ logger.error("{}", errorMsg, e);
+ synchronized (imFlushLock) {
+ if (et.isActive()) {
+ et.rollback();
+ }
+ }
+ }
+
+ return errorMsg;
+ }
+
+ /**
+ * Get all forward progress entities.
+ *
+ * @return list of all forward progress entities
+ */
+ public List<ForwardProgressEntity> getAllForwardProgressEntity() {
+ logger.debug("getAllForwardProgressEntity: entry");
+ ArrayList<ForwardProgressEntity> fpList = new ArrayList<>();
+ // Start a transaction
+ EntityTransaction et = em.getTransaction();
+ et.begin();
+ try {
+ Query fquery = em.createQuery("Select e from ForwardProgressEntity e");
+ @SuppressWarnings("rawtypes")
+ List myList = fquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ synchronized (imFlushLock) {
+ et.commit();
+ }
+ logger.debug("getAllForwardProgressEntity: myList.size(): {}", myList.size());
+ if (!myList.isEmpty()) {
+ for (int i = 0; i < myList.size(); i++) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getAllForwardProgressEntity: myList.get({}).getResourceName(): {}", i,
+ ((ForwardProgressEntity) myList.get(i)).getResourceName());
+ }
+ fpList.add((ForwardProgressEntity) myList.get(i));
+ }
+ }
+ synchronized (imFlushLock) {
+ if (et.isActive()) {
+ et.commit();
+ }
+ }
+ } catch (Exception e) {
+ // log an error and continue
+ String msg = "getAllForwardProgessEntity DB read failed with exception: ";
+ logger.error("{}", msg, e);
+ synchronized (imFlushLock) {
+ if (et.isActive()) {
+ et.rollback();
+ }
+ }
+ }
+ return fpList;
+ }
+
+ private String jmxCheck(String dep) {
+ logger.debug("checking health of dependent by calling test() via JMX on resource: {}", dep);
+
+ String errorMsg = null;
+
+ // get the JMX URL from the database
+ String jmxUrl = null;
+ // Start a transaction
+ EntityTransaction et = em.getTransaction();
+ et.begin();
+ try {
+ // query if ResourceRegistration entry exists for resourceName
+ Query rquery = em.createQuery("Select r from ResourceRegistrationEntity r where r.resourceName=:rn");
+ rquery.setParameter("rn", dep);
+
+ @SuppressWarnings("rawtypes")
+ List rrList = rquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ ResourceRegistrationEntity rrx = null;
+
+ if (!rrList.isEmpty()) {
+ // ignores multiple results
+ rrx = (ResourceRegistrationEntity) rrList.get(0);
+ // refresh the object from DB in case cached data was returned
+ em.refresh(rrx);
+ jmxUrl = rrx.getResourceUrl();
+ if (logger.isDebugEnabled()) {
+ logger.debug("Dependent Resource={}, url={}, createdDate={}", dep, jmxUrl, rrx.getCreatedDate());
+ }
+ } else {
+ errorMsg = dep + ": resource not found in ResourceRegistrationEntity table in the DB";
+ logger.error("{}", errorMsg);
+ }
+
+ synchronized (imFlushLock) {
+ et.commit();
+ }
+ } catch (Exception e) {
+ errorMsg = dep + ": ResourceRegistrationEntity DB read failed with exception: ";
+ logger.error("{}", errorMsg, e);
+ synchronized (imFlushLock) {
+ if (et.isActive()) {
+ et.rollback();
+ }
+ }
+ }
+
+ if (jmxUrl != null) {
+ JmxAgentConnection jmxAgentConnection = null;
+ try {
+ jmxAgentConnection = new JmxAgentConnection(jmxUrl);
+ MBeanServerConnection mbeanServer = jmxAgentConnection.getMBeanConnection();
+ ComponentAdminMBean admin =
+ JMX.newMXBeanProxy(mbeanServer, ComponentAdmin.getObjectName(dep), ComponentAdminMBean.class);
+
+ // invoke the test method via the jmx proxy
+ admin.test();
+ logger.debug("Dependent resource {} sanity test passed", dep);
+ } catch (Exception e) {
+ errorMsg = dep + ": resource sanity test failed with exception: ";
+ logger.error("{}", errorMsg, e);
+ } finally {
+ // close the JMX connector
+ if (jmxAgentConnection != null) {
+ jmxAgentConnection.disconnect();
+ }
+ }
+ }
+
+ return errorMsg;
+ }
+
+ /**
+ * Perform a dependency check.
+ *
+ * @return an error message detailing any issues found
+ */
+ public String dependencyCheck() {
+ logger.debug("dependencyCheck: entry");
+ synchronized (dependencyCheckLock) {
+
+ // Start with the error message empty
+ String errorMsg = "";
+ boolean dependencyFailure = false;
+
+ /*
+ * Before we check dependency groups we need to check subsystemTest.
+ */
+ try {
+ // Test any subsystems that are not covered under the dependency
+ // relationship
+ subsystemTest();
+ } catch (Exception e) {
+ logger.error("IntegrityMonitor threw exception", e);
+ dependencyFailure = true;
+ // This indicates a subsystemTest failure
+ try {
+ if (logger.isDebugEnabled()) {
+ logger.debug(
+ "{}: There has been a subsystemTest failure with error:{} Updating this resource's "
+ + "state to disableDependency",
+ resourceName, e.getMessage());
+ }
+ // Capture the subsystemTest failure info
+ if (!errorMsg.isEmpty()) {
+ errorMsg = errorMsg.concat(",");
+ }
+ errorMsg = errorMsg.concat(resourceName + ": " + e.getMessage());
+ this.stateManager.disableDependency();
+ } catch (Exception ex) {
+ logger.error("IntegrityMonitor threw exception.", ex);
+ if (!errorMsg.isEmpty()) {
+ errorMsg = errorMsg.concat(",");
+ }
+ errorMsg = errorMsg.concat("\n" + resourceName
+ + ": Failed to disable dependency after subsystemTest failure due to: " + ex.getMessage());
+ }
+ }
+
+ // Check the sanity of dependents for lead subcomponents
+ if (depGroups != null && depGroups.length > 0) {
+ // check state of resources in dependency groups
+ for (String group : depGroups) {
+ group = group.trim();
+ if (group.isEmpty()) {
+ // ignore empty group
+ continue;
+ }
+ String[] dependencies = group.split(",");
+ if (logger.isDebugEnabled()) {
+ logger.debug("group dependencies = {}", Arrays.toString(dependencies));
+ }
+ int realDepCount = 0;
+ int failDepCount = 0;
+ for (String dep : dependencies) {
+ dep = dep.trim();
+ if (dep.isEmpty()) {
+ // ignore empty dependency
+ continue;
+ }
+ realDepCount++; // this is a valid dependency whose state is tracked
+ // if a resource is down, its FP count will not be incremented
+ String failMsg = fpCheck(dep);
+ if (failMsg == null) {
+ if (testViaJmx) {
+ failMsg = jmxCheck(dep);
+ } else {
+ failMsg = stateCheck(dep);
+ }
+ }
+ if (failMsg != null) {
+ failDepCount++;
+ if (!errorMsg.isEmpty()) {
+ errorMsg = errorMsg.concat(", ");
+ }
+ errorMsg = errorMsg.concat(failMsg);
+ }
+ } // end for (String dep : dependencies)
+
+ // if all dependencies in a group are failed, set this
+ // resource's state to disable dependency
+ if ((realDepCount > 0) && (failDepCount == realDepCount)) {
+ dependencyFailure = true;
+ try {
+ logger.debug("All dependents in group {} have failed their health check. Updating this "
+ + "resource's state to disableDependency", group);
+ if (stateManager.getAvailStatus() == null || !((stateManager.getAvailStatus())
+ .equals(StateManagement.DEPENDENCY)
+ || (stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY_FAILED))) {
+ // Note: redundant calls are made by
+ // refreshStateAudit
+ this.stateManager.disableDependency();
+ }
+ } catch (Exception e) {
+ logger.error("IntegrityMonitor threw exception.", e);
+ if (!errorMsg.isEmpty()) {
+ errorMsg = errorMsg.concat(",");
+ }
+ errorMsg = errorMsg.concat(resourceName + ": Failed to disable dependency");
+ break; // break out on failure and skip checking other groups
+ }
+ }
+ // check the next group
+
+ } // end for (String group : depGroups)
+
+ /*
+ * We have checked all the dependency groups. If all are ok and subsystemTest
+ * passed, dependencyFailure == false
+ */
+ if (!dependencyFailure) {
+ try {
+ logger.debug(
+ "All dependency groups have at least one viable member. Updating this resource's state"
+ + " to enableNoDependency");
+ if (stateManager.getAvailStatus() != null
+ && ((stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY)
+ || (stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY_FAILED))) {
+ // Note: redundant calls are made by
+ // refreshStateAudit
+ this.stateManager.enableNoDependency();
+ }
+ // The refreshStateAudit will catch the case where it is disabled but
+ // availStatus != failed
+ } catch (Exception e) {
+ logger.error("IntegrityMonitor threw exception.", e);
+ if (!errorMsg.isEmpty()) {
+ errorMsg = errorMsg.concat(",");
+ }
+ errorMsg = errorMsg.concat(resourceName + ": Failed to enable no dependency");
+ }
+ }
+ } else if (!dependencyFailure) {
+ /*
+ * This is put here to clean up when no dependency group should exist, but one was
+ * erroneously added which caused the state to be disabled/dependency/coldstandby
+ * and later removed. We saw this happen in the lab, but is not very likely in a
+ * production environment...but you never know.
+ */
+ try {
+ logger.debug("There are no dependents. Updating this resource's state to enableNoDependency");
+ if (stateManager.getAvailStatus() != null
+ && ((stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY)
+ || (stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY_FAILED))) {
+ // Note: redundant calls are made by refreshStateAudit
+ this.stateManager.enableNoDependency();
+ }
+ // The refreshStateAudit will catch the case where it is disabled but
+ // availStatus != failed
+ } catch (Exception e) {
+ logger.error("IntegrityMonitor threw exception.", e);
+ if (!errorMsg.isEmpty()) {
+ errorMsg = errorMsg.concat(",");
+ }
+ errorMsg = errorMsg.concat(resourceName + ": Failed to enable no dependency");
+ }
+ }
+
+ if (!errorMsg.isEmpty()) {
+ logger.error("Sanity failure detected in a dependent resource: {}", errorMsg);
+
+ }
+
+ dependencyCheckErrorMsg = errorMsg;
+ lastDependencyCheckTime = System.currentTimeMillis();
+ logger.debug("dependencyCheck: exit");
+ return errorMsg;
+ }
+ }
+
+ /**
+ * Execute a test transaction. It is called when the test transaction timer fires. It could be
+ * overridden to provide additional test functionality. If overridden, the overriding method
+ * must invoke startTransaction() and endTransaction() and check if the allNotWellMap is empty.
+ */
+ public void testTransaction() {
+ synchronized (testTransactionLock) {
+ logger.debug("testTransaction: entry");
+ //
+ // startTransaction() not required for testTransaction
+ //
+
+ // end transaction - increments local FP counter
+ endTransaction();
+ }
+ }
+
+ /**
+ * Additional testing for subsystems that do not have a /test interface (for ex. 3rd party
+ * processes like elk). This method would be overridden by the subsystem.
+ */
+ public void subsystemTest() throws IntegrityMonitorException {
+ // Testing provided by subsystem
+ logger.debug("IntegrityMonitor subsystemTest() OK");
+ }
+
+ /**
+ * Checks admin state and resets transaction timer. Called by application at the start of a
+ * transaction.
+ *
+ * @throws AdministrativeStateException throws admin state exception if resource is locked
+ * @throws StandbyStatusException if resource is in standby
+ */
+ public void startTransaction() throws AdministrativeStateException, StandbyStatusException {
+
+ synchronized (startTransactionLock) {
+ // check admin state and throw exception if locked
+ if ((stateManager.getAdminState() != null) && stateManager.getAdminState().equals(StateManagement.LOCKED)) {
+ String msg = "Resource " + resourceName + " is administratively locked";
+
+ throw new AdministrativeStateException("IntegrityMonitor Admin State Exception: " + msg);
+ }
+ // check standby state and throw exception if locked
+
+ if ((stateManager.getStandbyStatus() != null)
+ && (stateManager.getStandbyStatus().equals(StateManagement.HOT_STANDBY)
+ || stateManager.getStandbyStatus().equals(StateManagement.COLD_STANDBY))) {
+ String msg = "Resource " + resourceName + " is standby";
+
+ throw new StandbyStatusException("IntegrityMonitor Standby Status Exception: " + msg);
+ }
+
+ // reset transactionTimer so it will not fire
+ elapsedTestTransTime = 0;
+ }
+ }
+
+ /**
+ * Increment the local forward progress counter. Called by application at the end of each
+ * transaction (successful or not).
+ */
+ public void endTransaction() {
+ synchronized (endTransactionLock) {
+ if (getAllNotWellMap() != null) {
+ if (!(getAllNotWellMap().isEmpty())) {
+ /*
+ * An entity has reported that it is not well. We must not allow the the forward
+ * progress counter to advance.
+ */
+ String msg = "allNotWellMap:";
+ for (Entry<String, String> entry : allNotWellMap.entrySet()) {
+ msg = msg.concat("\nkey = " + entry.getKey() + " msg = " + entry.getValue());
+ }
+ logger.error("endTransaction: allNotWellMap is NOT EMPTY. Not advancing forward"
+ + "progress counter. \n{}\n", msg);
+ return;
+ } else {
+ if (logger.isDebugEnabled()) {
+ if (getAllSeemsWellMap() != null) {
+ if (!(getAllSeemsWellMap().isEmpty())) {
+ String msg = "allSeemsWellMap:";
+ for (Entry<String, String> entry : allSeemsWellMap.entrySet()) {
+ msg = msg.concat("\nkey = " + entry.getKey() + " msg = " + entry.getValue());
+ }
+ logger.debug(
+ "endTransaction: allNotWellMap IS EMPTY and allSeemsWellMap is NOT EMPTY. "
+ + "Advancing forward progress counter. \n{}\n",
+ msg);
+ }
+ }
+ }
+ }
+ }
+ // increment local FPC
+ fpCounter++;
+ }
+ }
+
+ // update FP count in DB with local FP count
+ private void writeFpc() throws IntegrityMonitorException {
+
+ // Start a transaction
+ EntityTransaction et = em.getTransaction();
+
+ if (!et.isActive()) {
+ et.begin();
+ }
+
+ try {
+ // query if ForwardProgress entry exists for resourceName
+ Query fquery = em.createQuery("Select f from ForwardProgressEntity f where f.resourceName=:rn");
+ fquery.setParameter("rn", resourceName);
+
+ @SuppressWarnings("rawtypes")
+ List fpList = fquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ ForwardProgressEntity fpx;
+ if (!fpList.isEmpty()) {
+ // ignores multiple results
+ fpx = (ForwardProgressEntity) fpList.get(0);
+ // refresh the object from DB in case cached data was returned
+ em.refresh(fpx);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Updating FP entry: Resource={}, fpcCount={}, lastUpdated={}, new fpcCount={}",
+ resourceName, fpx.getFpcCount(), fpx.getLastUpdated(), fpCounter);
+ }
+ fpx.setFpcCount(fpCounter);
+ em.persist(fpx);
+ // flush to the DB and commit
+ synchronized (imFlushLock) {
+ et.commit();
+ }
+ } else {
+ // Error - FP entry does not exist
+ String msg = "FP entry not found in database for resource " + resourceName;
+ throw new IntegrityMonitorException(msg);
+ }
+ } catch (Exception e) {
+ try {
+ synchronized (imFlushLock) {
+ if (et.isActive()) {
+ et.rollback();
+ }
+ }
+ } catch (Exception e1) {
+ logger.error("IntegrityMonitor threw exception.", e1);
+ }
+ logger.error("writeFpc DB table commit failed with exception: {}", e);
+ throw e;
+ }
+ }
+
+ // retrieve state manager reference
+ public final StateManagement getStateManager() {
+ return this.stateManager;
+ }
+
+ /**
+ * Read and validate properties.
+ *
+ * @throws IntegrityMonitorPropertiesException if a property is invalid
+ */
+ private static void validateProperties(Properties prop) throws IntegrityMonitorPropertiesException {
+
+ if (prop.getProperty(IntegrityMonitorProperties.DB_DRIVER) == null) {
+ String msg = IntegrityMonitorProperties.DB_DRIVER + " property is null";
+ logger.error("{}", msg);
+ throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
+ }
+
+ if (prop.getProperty(IntegrityMonitorProperties.DB_URL) == null) {
+ String msg = IntegrityMonitorProperties.DB_URL + " property is null";
+ logger.error("{}", msg);
+ throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
+ }
+
+ if (prop.getProperty(IntegrityMonitorProperties.DB_USER) == null) {
+ String msg = IntegrityMonitorProperties.DB_USER + " property is null";
+ logger.error("{}", msg);
+ throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
+ }
+
+ if (prop.getProperty(IntegrityMonitorProperties.DB_PWD) == null) {
+ String msg = IntegrityMonitorProperties.DB_PWD + " property is null";
+ logger.error("{}", msg);
+ throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
+ }
+
+ if (prop.getProperty(IntegrityMonitorProperties.FP_MONITOR_INTERVAL) != null) {
+ try {
+ monitorIntervalMs = toMillis(
+ Integer.parseInt(prop.getProperty(IntegrityMonitorProperties.FP_MONITOR_INTERVAL).trim()));
+ } catch (NumberFormatException e) {
+ logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.FP_MONITOR_INTERVAL, e);
+ }
+ }
+
+ if (prop.getProperty(IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD) != null) {
+ try {
+ failedCounterThreshold =
+ Integer.parseInt(prop.getProperty(IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD).trim());
+ } catch (NumberFormatException e) {
+ logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD, e);
+ }
+ }
+
+ if (prop.getProperty(IntegrityMonitorProperties.TEST_TRANS_INTERVAL) != null) {
+ try {
+ testTransIntervalMs = toMillis(
+ Integer.parseInt(prop.getProperty(IntegrityMonitorProperties.TEST_TRANS_INTERVAL).trim()));
+ } catch (NumberFormatException e) {
+ logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.TEST_TRANS_INTERVAL, e);
+ }
+ }
+
+ if (prop.getProperty(IntegrityMonitorProperties.WRITE_FPC_INTERVAL) != null) {
+ try {
+ writeFpcIntervalMs = toMillis(
+ Integer.parseInt(prop.getProperty(IntegrityMonitorProperties.WRITE_FPC_INTERVAL).trim()));
+ } catch (NumberFormatException e) {
+ logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.WRITE_FPC_INTERVAL, e);
+ }
+ }
+
+ if (prop.getProperty(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL) != null) {
+ try {
+ checkDependencyIntervalMs = toMillis(Integer
+ .parseInt(prop.getProperty(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL).trim()));
+ } catch (NumberFormatException e) {
+ logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, e);
+ }
+ }
+
+ // dependency_groups are a semi-colon separated list of groups
+ // each group is a comma separated list of resource names
+ // For ex. dependency_groups = site_1.pap_1,site_1.pap_2 ; site_1.pdp_1,
+ // site_1.pdp_2
+ if (prop.getProperty(IntegrityMonitorProperties.DEPENDENCY_GROUPS) != null) {
+ try {
+ depGroups = prop.getProperty(IntegrityMonitorProperties.DEPENDENCY_GROUPS).split(";");
+ if (logger.isDebugEnabled()) {
+ logger.debug("dependency groups property = {}", Arrays.toString(depGroups));
+ }
+ } catch (Exception e) {
+ logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.DEPENDENCY_GROUPS, e);
+ }
+ }
+
+ siteName = prop.getProperty(IntegrityMonitorProperties.SITE_NAME);
+ if (siteName == null) {
+ String msg = IntegrityMonitorProperties.SITE_NAME + " property is null";
+ logger.error("{}", msg);
+ throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
+ } else {
+ siteName = siteName.trim();
+ }
+
+ nodeType = prop.getProperty(IntegrityMonitorProperties.NODE_TYPE);
+ if (nodeType == null) {
+ String msg = IntegrityMonitorProperties.NODE_TYPE + " property is null";
+ logger.error("{}", msg);
+ throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
+ } else {
+ nodeType = nodeType.trim();
+ if (!isNodeTypeEnum(nodeType)) {
+ String msg = IntegrityMonitorProperties.NODE_TYPE + " property " + nodeType + " is invalid";
+ logger.error("{}", msg);
+ throw new IntegrityMonitorPropertiesException("IntegrityMonitor Property Exception: " + msg);
+ }
+ }
+
+ if (prop.getProperty(IntegrityMonitorProperties.TEST_VIA_JMX) != null) {
+ String jmxTest = prop.getProperty(IntegrityMonitorProperties.TEST_VIA_JMX).trim();
+ testViaJmx = Boolean.parseBoolean(jmxTest);
+ }
+
+ if (prop.getProperty(IntegrityMonitorProperties.JMX_FQDN) != null) {
+ jmxFqdn = prop.getProperty(IntegrityMonitorProperties.JMX_FQDN).trim();
+ if (jmxFqdn.isEmpty()) {
+ jmxFqdn = null;
+ }
+ }
+
+ if (prop.getProperty(IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL) != null) {
+ try {
+ maxFpcUpdateIntervalMs = toMillis(
+ Integer.parseInt(prop.getProperty(IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL).trim()));
+ } catch (NumberFormatException e) {
+ logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL, e);
+ }
+ }
+
+ if (prop.getProperty(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS) != null) {
+ try {
+ stateAuditIntervalMs =
+ Long.parseLong(prop.getProperty(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS));
+ } catch (NumberFormatException e) {
+ logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, e);
+ }
+ }
+
+ if (prop.getProperty(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS) != null) {
+ try {
+ refreshStateAuditIntervalMs =
+ Long.parseLong(prop.getProperty(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS));
+ } catch (NumberFormatException e) {
+ logger.warn("Ignored invalid property: {}", IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS,
+ e);
+ }
+ }
+
+ logger.debug("IntegrityMonitor.validateProperties(): Property values \n" + "maxFpcUpdateIntervalMs = {}\n",
+ maxFpcUpdateIntervalMs);
+
+ return;
+ }
+
+ /**
+ * Update properties.
+ *
+ * @param newprop the new properties
+ */
+ public static void updateProperties(Properties newprop) {
+ if (isUnitTesting()) {
+ try {
+ validateProperties(newprop);
+ } catch (IntegrityMonitorPropertiesException e) {
+ logger.error("IntegrityMonitor threw exception.", e);
+ }
+ } else {
+ logger.debug("Update integrity monitor properties not allowed");
+ }
+ }
+
+ private static boolean isNodeTypeEnum(String nodeType) {
+ String upper = nodeType.toUpperCase();
+ for (NodeType n : NodeType.values()) {
+ if (n.toString().equals(upper)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Look for "Forward Progress" -- if the 'FPMonitor' is stalled for too long, the operational
+ * state is changed to 'Disabled', and an alarm is set. The state is restored when forward
+ * progress continues.
+ */
+ private void fpMonitorCycle() {
+ logger.debug("fpMonitorCycle(): entry");
+ synchronized (fpMonitorCycleLock) {
+ // monitoring interval checks
+ if (monitorIntervalMs <= 0) {
+ logger.debug("fpMonitorCycle(): disabled");
+ elapsedTime = 0;
+ return; // monitoring is disabled
+ }
+
+ elapsedTime = elapsedTime + cycleIntervalMillis;
+ if (elapsedTime < monitorIntervalMs) {
+ return; // monitoring interval not reached
+ }
+
+ elapsedTime = 0; // reset elapsed time
+
+ try {
+ if (fpCounter == lastFpCounter) {
+ // no forward progress
+ missedCycles += 1;
+ if (missedCycles >= failedCounterThreshold && !alarmExists) {
+ logger.debug("Forward progress not detected for resource {}. Setting state to disable failed.",
+ resourceName);
+ if (!(stateManager.getOpState()).equals(StateManagement.DISABLED)) {
+ // Note: The refreshStateAudit will make redundant
+ // calls
+ stateManager.disableFailed();
+ }
+ // The refreshStateAudit will catch the case where opStat = disabled and
+ // availState ! failed/dependency.failed
+ alarmExists = true;
+ }
+ } else {
+ // forward progress has occurred
+ lastFpCounter = fpCounter;
+ missedCycles = 0;
+ // set op state to enabled
+ logger.debug("Forward progress detected for resource {}. Setting state to enable not failed.",
+ resourceName);
+ if (!(stateManager.getOpState()).equals(StateManagement.ENABLED)) {
+ // Note: The refreshStateAudit will make redundant calls
+ stateManager.enableNotFailed();
+ }
+ // The refreshStateAudit will catch the case where opState=enabled and
+ // availStatus != null
+ alarmExists = false;
+ }
+ } catch (Exception e) {
+ // log error
+ logger.error("FP Monitor encountered error. ", e);
+ }
+ }
+ logger.debug("fpMonitorCycle(): exit");
+ }
+
+ /**
+ * Look for "Forward Progress" on other nodes. If they are not making forward progress, check
+ * their operational state. If it is not disabled, then disable them.
+ */
+ private void stateAudit() {
+ logger.debug("IntegrityMonitor.stateAudit(): entry");
+ if (stateAuditIntervalMs <= 0) {
+ logger.debug("IntegrityMonitor.stateAudit(): disabled");
+ return; // stateAudit is disabled
+ }
+
+ // Only run from nodes that are operational
+ if (stateManager.getOpState().equals(StateManagement.DISABLED)) {
+ logger.debug("IntegrityMonitor.stateAudit(): DISABLED. returning");
+ return;
+ }
+ if (stateManager.getAdminState().equals(StateManagement.LOCKED)) {
+ logger.debug("IntegrityMonitor.stateAudit(): LOCKED. returning");
+ return;
+ }
+ if (!stateManager.getStandbyStatus().equals(StateManagement.NULL_VALUE)
+ && stateManager.getStandbyStatus() != null) {
+ if (!stateManager.getStandbyStatus().equals(StateManagement.PROVIDING_SERVICE)) {
+ logger.debug("IntegrityMonitor.stateAudit(): NOT PROVIDING_SERVICE. returning");
+ return;
+ }
+ }
+
+ Date date = new Date();
+ long timeSinceLastStateAudit = date.getTime() - lastStateAuditTime.getTime();
+ if (timeSinceLastStateAudit < stateAuditIntervalMs) {
+ logger.debug("IntegrityMonitor.stateAudit(): Not time to run. returning");
+ return;
+ }
+
+ executeStateAudit();
+
+ lastStateAuditTime = date;
+
+ logger.debug("IntegrityMonitor.stateAudit(): exit");
+ }
+
+ /**
+ * Execute state audit.
+ */
+ public void executeStateAudit() {
+ logger.debug("IntegrityMonitor.executeStateAudit(): entry");
+ Date date = new Date();
+
+ // Get all entries in the forwardprogressentity table
+ List<ForwardProgressEntity> fpList = getAllForwardProgressEntity();
+
+ // Check if each forwardprogressentity entry is current
+ for (ForwardProgressEntity fpe : fpList) {
+ // If the this is my ForwardProgressEntity, continue
+ if (fpe.getResourceName().equals(IntegrityMonitor.resourceName)) {
+ continue;
+ }
+ // Make sure you are not getting a cached version
+ em.refresh(fpe);
+ long diffMs = date.getTime() - fpe.getLastUpdated().getTime();
+ if (logger.isDebugEnabled()) {
+ logger.debug("IntegrityMonitor.executeStateAudit(): resource = {}, diffMs = {}", fpe.getResourceName(),
+ diffMs);
+ }
+
+ // Threshold for a stale entry
+ long staleMs = maxFpcUpdateIntervalMs;
+ if (logger.isDebugEnabled()) {
+ logger.debug("IntegrityMonitor.executeStateAudit(): resource = {}, staleMs = {}", fpe.getResourceName(),
+ staleMs);
+ }
+
+ if (diffMs > staleMs) {
+ // ForwardProgress is stale. Disable it
+ // Start a transaction
+ logger.debug("IntegrityMonitor.executeStateAudit(): resource = {}, FPC is stale. Disabling it");
+ EntityTransaction et = em.getTransaction();
+ et.begin();
+ StateManagementEntity sme = null;
+ try {
+ // query if StateManagement entry exists for fpe resource
+ Query query =
+ em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource");
+ query.setParameter("resource", fpe.getResourceName());
+
+ @SuppressWarnings("rawtypes")
+ List smList =
+ query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ if (!smList.isEmpty()) {
+ // exists
+ sme = (StateManagementEntity) smList.get(0);
+ // refresh the object from DB in case cached data was
+ // returned
+ em.refresh(sme);
+ if (logger.isDebugEnabled()) {
+ logger.debug(
+ "IntegrityMonitor.executeStateAudit(): Found entry in StateManagementEntity table "
+ + "for Resource={}",
+ sme.getResourceName());
+ }
+ } else {
+ String msg = "IntegrityMonitor.executeStateAudit(): " + fpe.getResourceName()
+ + ": resource not found in state management entity database table";
+ logger.error("{}", msg);
+ }
+ synchronized (imFlushLock) {
+ et.commit();
+ }
+ } catch (Exception e) {
+ // log an error
+ logger.error("IntegrityMonitor.executeStateAudit(): {}: StateManagementEntity DB read failed with "
+ + "exception: ", fpe.getResourceName(), e);
+ synchronized (imFlushLock) {
+ if (et.isActive()) {
+ et.rollback();
+ }
+ }
+ }
+
+ if (sme != null && !sme.getOpState().equals(StateManagement.DISABLED)) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("IntegrityMonitor.executeStateAudit(): Changing OpStat = disabled for {}",
+ sme.getResourceName());
+ }
+ try {
+ stateManager.disableFailed(sme.getResourceName());
+ } catch (Exception e) {
+ String msg = "IntegrityMonitor.executeStateAudit(): Failed to disable " + sme.getResourceName();
+ logger.error("{}", msg, e);
+ }
+ }
+ } // end if(diffMs > staleMs)
+ } // end for(ForwardProgressEntity fpe : fpList)
+ logger.debug("IntegrityMonitor.executeStateAudit(): exit");
+ }
+
+ /**
+ * Execute a test transaction when test transaction interval has elapsed.
+ */
+ private void checkTestTransaction() {
+ logger.debug("checkTestTransaction(): entry");
+ synchronized (checkTestTransactionLock) {
+
+ // test transaction timer checks
+ if (testTransIntervalMs <= 0) {
+ logger.debug("checkTestTransaction(): disabled");
+ elapsedTestTransTime = 0;
+ return; // test transaction is disabled
+ }
+
+ elapsedTestTransTime = elapsedTestTransTime + cycleIntervalMillis;
+ if (elapsedTestTransTime < testTransIntervalMs) {
+ return; // test transaction interval not reached
+ }
+
+ elapsedTestTransTime = 0; // reset elapsed time
+
+ // execute test transaction
+ testTransaction();
+ }
+ logger.debug("checkTestTransaction(): exit");
+ }
+
+ /**
+ * Updates Fpc counter in database when write Fpc interval has elapsed.
+ */
+ private void checkWriteFpc() {
+ logger.debug("checkWriteFpc(): entry");
+ synchronized (checkWriteFpcLock) {
+
+ // test transaction timer checks
+ if (writeFpcIntervalMs <= 0) {
+ logger.debug("checkWriteFpc(): disabled");
+ elapsedWriteFpcTime = 0;
+ return; // write Fpc is disabled
+ }
+
+ elapsedWriteFpcTime = elapsedWriteFpcTime + cycleIntervalMillis;
+ if (elapsedWriteFpcTime < writeFpcIntervalMs) {
+ return; // write Fpc interval not reached
+ }
+
+ elapsedWriteFpcTime = 0; // reset elapsed time
+
+ // write Fpc to database
+ try {
+ writeFpc();
+ } catch (Exception e) {
+ logger.error("IntegrityMonitor threw exception.", e);
+ }
+ }
+ logger.debug("checkWriteFpc(): exit");
+ }
+
+ /**
+ * Execute a dependency health check periodically which also updates this resource's state.
+ */
+ private void checkDependentHealth() {
+ logger.debug("checkDependentHealth: entry");
+ if (checkDependencyIntervalMs <= 0) {
+ logger.debug("checkDependentHealth: disabled");
+ return; // dependency monitoring is disabled
+ }
+
+ long currTime = System.currentTimeMillis();
+ logger.debug("checkDependentHealth currTime - lastDependencyCheckTime = {}",
+ currTime - lastDependencyCheckTime);
+ if ((currTime - lastDependencyCheckTime) > checkDependencyIntervalMs) {
+ // execute dependency check and update this resource's state
+
+ dependencyCheck();
+ }
+ logger.debug("checkDependentHealth: exit");
+ }
+
+ /*
+ * This is a simple refresh audit which is periodically run to assure that the states and status
+ * attributes are aligned and notifications are sent to any listeners. It is possible for
+ * state/status to get out of synch and notified systems to be out of synch due to database
+ * corruption (manual or otherwise) or because a node became isolated.
+ *
+ * When the operation (lock/unlock) is called, it will cause a re-evaluation of the state and
+ * send a notification to all registered observers.
+ */
+ private void refreshStateAudit() {
+ logger.debug("refreshStateAudit(): entry");
+ if (refreshStateAuditIntervalMs <= 0) {
+ // The audit is disabled
+ logger.debug("refreshStateAudit(): disabled");
+ return;
+ }
+ executeRefreshStateAudit();
+ logger.debug("refreshStateAudit(): exit");
+ }
+
+ /**
+ * Execute refresh state audit.
+ */
+ public void executeRefreshStateAudit() {
+ logger.debug("executeRefreshStateAudit(): entry");
+ synchronized (refreshStateAuditLock) {
+ logger.debug("refreshStateAudit: entry");
+ Date now = new Date();
+ long nowMs = now.getTime();
+ long lastTimeMs = refreshStateAuditLastRunDate.getTime();
+ logger.debug("refreshStateAudit: ms since last run = {}", nowMs - lastTimeMs);
+
+ if ((nowMs - lastTimeMs) > refreshStateAuditIntervalMs) {
+ String adminState = stateManager.getAdminState();
+ logger.debug("refreshStateAudit: adminState = {}", adminState);
+ if (adminState.equals(StateManagement.LOCKED)) {
+ try {
+ logger.debug("refreshStateAudit: calling lock()");
+ stateManager.lock();
+ } catch (Exception e) {
+ logger.error("refreshStateAudit: caught unexpected exception from stateManager.lock(): ", e);
+ }
+ } else { // unlocked
+ try {
+ logger.debug("refreshStateAudit: calling unlock()");
+ stateManager.unlock();
+ } catch (Exception e) {
+ logger.error("refreshStateAudit: caught unexpected exception from stateManager.unlock(): ", e);
+ }
+ }
+ refreshStateAuditLastRunDate = new Date();
+ logger.debug("refreshStateAudit: exit");
+ }
+ }
+ logger.debug("executeRefreshStateAudit(): exit");
+ }
+
+ /**
+ * The following nested class periodically performs the forward progress check, checks
+ * dependencies, does a refresh state audit and runs the stateAudit.
+ */
+ class FpManager extends Thread {
+ private final CountDownLatch stopper = new CountDownLatch(1);
+
+ private BlockingQueue<CountDownLatch> queue;
+ private CountDownLatch progressLatch = null;
+
+ // Constructor - start FP manager thread
+ FpManager(BlockingQueue<CountDownLatch> queue) {
+ this.queue = queue;
+ // set now as the last time the refreshStateAudit ran
+ IntegrityMonitor.this.refreshStateAuditLastRunDate = new Date();
+ // start thread
+ this.start();
+ }
+
+ @Override
+ public void run() {
+ logger.debug("FPManager thread running");
+
+ try {
+ getLatch();
+ decrementLatch();
+
+ while (!stopper.await(cycleIntervalMillis, TimeUnit.MILLISECONDS)) {
+ getLatch();
+ IntegrityMonitor.this.runOnce();
+ decrementLatch();
+ }
+
+ } catch (InterruptedException e) {
+ logger.debug("IntegrityMonitor threw exception.", e);
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ public void stopAndExit() {
+ stopper.countDown();
+ this.interrupt();
+ }
+
+ /**
+ * Gets the next latch from the queue.
+ *
+ * @throws InterruptedException
+ *
+ */
+ private void getLatch() throws InterruptedException {
+ if (queue != null) {
+ progressLatch = queue.take();
+ }
+ }
+
+ /**
+ * Decrements the current latch.
+ */
+ private void decrementLatch() {
+ if (progressLatch != null) {
+ progressLatch.countDown();
+ }
+ }
+
+ }
+
+ private void runOnce() {
+ try {
+ logger.debug("FPManager calling fpMonitorCycle()");
+ // check forward progress timer
+ fpMonitorCycle();
+
+ logger.debug("FPManager calling checkTestTransaction()");
+ // check test transaction timer
+ checkTestTransaction();
+
+ logger.debug("FPManager calling checkWriteFpc()");
+ // check write Fpc timer
+ checkWriteFpc();
+
+ logger.debug("FPManager calling checkDependentHealth()");
+ // check dependency health
+ checkDependentHealth();
+
+ logger.debug("FPManager calling refreshStateAudit()");
+ // check if it is time to run the refreshStateAudit
+ refreshStateAudit();
+
+ logger.debug("FPManager calling stateAudit()");
+ // check if it is time to run the stateAudit
+ stateAudit();
+
+ } catch (Exception e) {
+ logger.error("Ignore FPManager thread processing timer(s) exception: ", e);
+ }
+ }
+
+ /**
+ * Set all seems well or not well for the specified key.
+ *
+ * @param key the key
+ * @param asw <code>true</code> if all seems well for the key, <code>false</code> if all seems
+ * not well for the key
+ * @param msg message to add for the key
+ * @throws AllSeemsWellException if an error occurs
+ */
+ public void allSeemsWell(@NotNull String key, @NotNull Boolean asw, @NotNull String msg)
+ throws AllSeemsWellException {
+
+ logger.debug("allSeemsWell entry: key = {}, asw = {}, msg = {}", key, asw, msg);
+ if (key == null || key.isEmpty()) {
+ logger.error("allSeemsWell: 'key' has no visible content");
+ throw new IllegalArgumentException("allSeemsWell: 'key' has no visible content");
+ }
+ if (asw == null) {
+ logger.error("allSeemsWell: 'asw' is null");
+ throw new IllegalArgumentException("allSeemsWell: 'asw' is null");
+ }
+ if (msg == null || msg.isEmpty()) {
+ logger.error("allSeemsWell: 'msg' has no visible content");
+ throw new IllegalArgumentException("allSeemsWell: 'msg' has no visible content");
+ }
+
+ if (allSeemsWellMap == null) {
+ allSeemsWellMap = new HashMap<>();
+ }
+
+ if (allNotWellMap == null) {
+ allNotWellMap = new HashMap<>();
+ }
+
+ if (asw) {
+ logger.info("allSeemsWell: ALL SEEMS WELL: key = {}, msg = {}", key, msg);
+ try {
+ allSeemsWellMap.put(key, msg);
+ } catch (Exception e) {
+ String exceptMsg =
+ "allSeemsWell: encountered an exception with allSeemsWellMap.put(" + key + "," + msg + ")";
+ logger.error(exceptMsg);
+ throw new AllSeemsWellException(exceptMsg, e);
+ }
+
+ try {
+ allNotWellMap.remove(key);
+ } catch (Exception e) {
+ String exceptMsg = "allSeemsWell: encountered an exception with allNotWellMap.delete(" + key + ")";
+ logger.error(exceptMsg);
+ throw new AllSeemsWellException(exceptMsg, e);
+ }
+
+ } else {
+ logger.error("allSeemsWell: ALL NOT WELL: key = {}, msg = {}", key, msg);
+ try {
+ allSeemsWellMap.remove(key);
+ } catch (Exception e) {
+ String exceptMsg = "allSeemsWell: encountered an exception with allSeemsWellMap.remove(" + key + ")";
+ logger.error(exceptMsg);
+ throw new AllSeemsWellException(exceptMsg, e);
+ }
+
+ try {
+ allNotWellMap.put(key, msg);
+ } catch (Exception e) {
+ String exceptMsg = "allSeemsWell: encountered an exception with allNotWellMap.put(" + key + msg + ")";
+ logger.error(exceptMsg);
+ throw new AllSeemsWellException(exceptMsg, e);
+ }
+ }
+
+ if (logger.isDebugEnabled()) {
+ for (Entry<String, String> entry : allSeemsWellMap.entrySet()) {
+ logger.debug("allSeemsWellMap: key = {} msg = {}", entry.getKey(), entry.getValue());
+ }
+ for (Entry<String, String> entry : allNotWellMap.entrySet()) {
+ logger.debug("allNotWellMap: key = {} msg = {}", entry.getKey(), entry.getValue());
+ }
+ logger.debug("allSeemsWell exit");
+ }
+ }
+
+ /**
+ * Converts the given value to milliseconds using the current {@link #propertyUnits}.
+ *
+ * @param value value to be converted, or -1
+ * @return the value, in milliseconds, or -1
+ */
+ private static long toMillis(long value) {
+ return (value < 0 ? -1 : propertyUnits.toMillis(value));
+ }
+
+ public Map<String, String> getAllSeemsWellMap() {
+ return allSeemsWellMap;
+ }
+
+ public Map<String, String> getAllNotWellMap() {
+ return allNotWellMap;
+ }
+
+ /*
+ * The remaining methods are used by JUnit tests.
+ */
+
+ public static boolean isUnitTesting() {
+ return isUnitTesting;
+ }
+
+ public static void setUnitTesting(boolean isUnitTesting) {
+ IntegrityMonitor.isUnitTesting = isUnitTesting;
+ }
+
+ protected static TimeUnit getPropertyUnits() {
+ return propertyUnits;
+ }
+
+ protected static void setPropertyUnits(TimeUnit propertyUnits) {
+ IntegrityMonitor.propertyUnits = propertyUnits;
+ }
+
+ protected static long getCycleIntervalMillis() {
+ return cycleIntervalMillis;
+ }
+
+ protected static void setCycleIntervalMillis(long cycleIntervalMillis) {
+ IntegrityMonitor.cycleIntervalMillis = cycleIntervalMillis;
+ }
+
+ protected static String getPersistenceUnit() {
+ return persistenceUnit;
+ }
+
+ protected static void setPersistenceUnit(String persistenceUnit) {
+ IntegrityMonitor.persistenceUnit = persistenceUnit;
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorException.java
index f01be279..6e1d0c00 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorException.java
@@ -20,26 +20,28 @@
package org.onap.policy.common.im;
-public class IntegrityMonitorException extends Exception{
- private static final long serialVersionUID = 1L;
- public IntegrityMonitorException() {
- super();
- }
- public IntegrityMonitorException(String message) {
- super(message);
- }
-
- public IntegrityMonitorException(Throwable cause) {
- super(cause);
- }
- public IntegrityMonitorException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public IntegrityMonitorException(String message, Throwable cause,
- boolean enableSuppression, boolean writableStackTrace)
- {
- super(message, cause, enableSuppression, writableStackTrace);
- }
+public class IntegrityMonitorException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public IntegrityMonitorException() {
+ super();
+ }
+
+ public IntegrityMonitorException(String message) {
+ super(message);
+ }
+
+ public IntegrityMonitorException(Throwable cause) {
+ super(cause);
+ }
+
+ public IntegrityMonitorException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public IntegrityMonitorException(String message, Throwable cause, boolean enableSuppression,
+ boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorProperties.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorProperties.java
index b495db71..8589170d 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorProperties.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorProperties.java
@@ -22,40 +22,40 @@ package org.onap.policy.common.im;
public class IntegrityMonitorProperties {
- private IntegrityMonitorProperties() {}
-
- public static final String DB_DRIVER = "javax.persistence.jdbc.driver";
- public static final String DB_URL = "javax.persistence.jdbc.url";
- public static final String DB_USER = "javax.persistence.jdbc.user";
- public static final String DB_PWD = "javax.persistence.jdbc.password";
-
- // intervals specified are in seconds
- public static final int DEFAULT_MONITOR_INTERVAL = 30;
- public static final int DEFAULT_FAILED_COUNTER_THRESHOLD = 3;
- public static final int DEFAULT_TEST_INTERVAL = 10;
- public static final int DEFAULT_WRITE_FPC_INTERVAL = 5;
- public static final int DEFAULT_MAX_FPC_UPDATE_INTERVAL = 120;
- public static final int DEFAULT_CHECK_DEPENDENCY_INTERVAL = 10;
-
- public static final String FP_MONITOR_INTERVAL = "fp_monitor_interval";
- public static final String FAILED_COUNTER_THRESHOLD = "failed_counter_threshold";
- public static final String TEST_TRANS_INTERVAL = "test_trans_interval";
- public static final String WRITE_FPC_INTERVAL = "write_fpc_interval";
- public static final String CHECK_DEPENDENCY_INTERVAL = "check_dependency_interval";
-
- public static final String DEPENDENCY_GROUPS = "dependency_groups";
- public static final String SITE_NAME = "site_name";
- public static final String NODE_TYPE = "node_type";
-
- public static final String TEST_VIA_JMX = "test_via_jmx";
- public static final String JMX_FQDN = "jmx_fqdn";
- public static final String MAX_FPC_UPDATE_INTERVAL = "max_fpc_update_interval";
- public static final String STATE_AUDIT_INTERVAL_MS = "state_audit_interval_ms";
- public static final String REFRESH_STATE_AUDIT_INTERVAL_MS = "refresh_state_audit_interval_ms";
-
- // AllSeemsWell types
- public static final Boolean ALLNOTWELL=Boolean.FALSE;
- public static final Boolean ALLSEEMSWELL=Boolean.TRUE;
-
-
+ private IntegrityMonitorProperties() {}
+
+ public static final String DB_DRIVER = "javax.persistence.jdbc.driver";
+ public static final String DB_URL = "javax.persistence.jdbc.url";
+ public static final String DB_USER = "javax.persistence.jdbc.user";
+ public static final String DB_PWD = "javax.persistence.jdbc.password";
+
+ // intervals specified are in seconds
+ public static final int DEFAULT_MONITOR_INTERVAL = 30;
+ public static final int DEFAULT_FAILED_COUNTER_THRESHOLD = 3;
+ public static final int DEFAULT_TEST_INTERVAL = 10;
+ public static final int DEFAULT_WRITE_FPC_INTERVAL = 5;
+ public static final int DEFAULT_MAX_FPC_UPDATE_INTERVAL = 120;
+ public static final int DEFAULT_CHECK_DEPENDENCY_INTERVAL = 10;
+
+ public static final String FP_MONITOR_INTERVAL = "fp_monitor_interval";
+ public static final String FAILED_COUNTER_THRESHOLD = "failed_counter_threshold";
+ public static final String TEST_TRANS_INTERVAL = "test_trans_interval";
+ public static final String WRITE_FPC_INTERVAL = "write_fpc_interval";
+ public static final String CHECK_DEPENDENCY_INTERVAL = "check_dependency_interval";
+
+ public static final String DEPENDENCY_GROUPS = "dependency_groups";
+ public static final String SITE_NAME = "site_name";
+ public static final String NODE_TYPE = "node_type";
+
+ public static final String TEST_VIA_JMX = "test_via_jmx";
+ public static final String JMX_FQDN = "jmx_fqdn";
+ public static final String MAX_FPC_UPDATE_INTERVAL = "max_fpc_update_interval";
+ public static final String STATE_AUDIT_INTERVAL_MS = "state_audit_interval_ms";
+ public static final String REFRESH_STATE_AUDIT_INTERVAL_MS = "refresh_state_audit_interval_ms";
+
+ // AllSeemsWell types
+ public static final Boolean ALLNOTWELL = Boolean.FALSE;
+ public static final Boolean ALLSEEMSWELL = Boolean.TRUE;
+
+
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorPropertiesException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorPropertiesException.java
index 0d73e8b4..d3533f10 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorPropertiesException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorPropertiesException.java
@@ -21,18 +21,21 @@
package org.onap.policy.common.im;
public class IntegrityMonitorPropertiesException extends IntegrityMonitorException {
- private static final long serialVersionUID = 1L;
- public IntegrityMonitorPropertiesException() {
- super();
- }
- public IntegrityMonitorPropertiesException(String message) {
- super(message);
- }
+ private static final long serialVersionUID = 1L;
- public IntegrityMonitorPropertiesException(Throwable cause) {
- super(cause);
- }
- public IntegrityMonitorPropertiesException(String message, Throwable cause) {
- super(message, cause);
- }
+ public IntegrityMonitorPropertiesException() {
+ super();
+ }
+
+ public IntegrityMonitorPropertiesException(String message) {
+ super(message);
+ }
+
+ public IntegrityMonitorPropertiesException(Throwable cause) {
+ super(cause);
+ }
+
+ public IntegrityMonitorPropertiesException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StandbyStatusException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StandbyStatusException.java
index 3d27a4c6..352df386 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StandbyStatusException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StandbyStatusException.java
@@ -21,34 +21,27 @@
package org.onap.policy.common.im;
public class StandbyStatusException extends IntegrityMonitorException {
- /**
- *
- */
- private static final long serialVersionUID = -5262512285108747134L;
-
- public StandbyStatusException()
- {
- super();
- }
-
- public StandbyStatusException(String message)
- {
- super(message);
- }
-
- public StandbyStatusException(Throwable cause)
- {
- super(cause);
- }
-
- public StandbyStatusException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public StandbyStatusException(String message, Throwable cause,
- boolean enableSuppression, boolean writableStackTrace)
- {
- super(message, cause, enableSuppression, writableStackTrace);
- }
+
+ private static final long serialVersionUID = -5262512285108747134L;
+
+ public StandbyStatusException() {
+ super();
+ }
+
+ public StandbyStatusException(String message) {
+ super(message);
+ }
+
+ public StandbyStatusException(Throwable cause) {
+ super(cause);
+ }
+
+ public StandbyStatusException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public StandbyStatusException(String message, Throwable cause, boolean enableSuppression,
+ boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java
index 0d4bd029..a678319f 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java
@@ -19,9 +19,10 @@
*/
package org.onap.policy.common.im;
-
-import java.util.Observable;
-import java.util.Observer;
+
+import java.util.Observable;
+import java.util.Observer;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/*
@@ -39,41 +40,42 @@ import org.slf4j.LoggerFactory;
-
/**
- *
- * StateChangeNotifier class implements the Observer pattern and is used to distribute
- * state change notifications to any entity that registers a derived class with an
- * instance of the StateManagement class.
+ * StateChangeNotifier class implements the Observer pattern and is used to distribute state change
+ * notifications to any entity that registers a derived class with an instance of the
+ * StateManagement class.
*
*/
-public class StateChangeNotifier implements Observer {
- private static final Logger logger = LoggerFactory.getLogger(StateChangeNotifier.class);
- //The observable class
- StateManagement stateManagement;
-
- // A string argument passed by the observable class when
- // Observable:notifyObservers(Object arg) is called
- String message;
-
- @Override
- public void update(Observable o, Object arg) {
- this.stateManagement = (StateManagement) o;
- this.message = (String) arg;
- handleStateChange();
- }
-
- public void handleStateChange() {
- if(logger.isDebugEnabled()){
- logger.debug("handleStateChange, message: {}", this.message);
- }
- }
+public class StateChangeNotifier implements Observer {
+ private static final Logger logger = LoggerFactory.getLogger(StateChangeNotifier.class);
+ // The observable class
+ StateManagement stateManagement;
+
+ // A string argument passed by the observable class when
+ // Observable:notifyObservers(Object arg) is called
+ String message;
+
+ @Override
+ public void update(Observable observable, Object arg) {
+ this.stateManagement = (StateManagement) observable;
+ this.message = (String) arg;
+ handleStateChange();
+ }
+
+ /**
+ * Handle state change.
+ */
+ public void handleStateChange() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("handleStateChange, message: {}", this.message);
+ }
+ }
- public StateManagement getStateManagement() {
- return stateManagement;
- }
+ public StateManagement getStateManagement() {
+ return stateManagement;
+ }
- public String getMessage() {
- return message;
- }
-} \ No newline at end of file
+ public String getMessage() {
+ return message;
+ }
+}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateElement.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateElement.java
index fd5afc6a..030a0371 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateElement.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateElement.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,145 +20,119 @@
package org.onap.policy.common.im;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class StateElement {
- private static final Logger logger = LoggerFactory.getLogger(StateElement.class);
-
- String adminState = null;
- String opState = null;
- String availStatus = null;
- String standbyStatus = null;
- String actionName = null;
- String endingAdminState = null;
- String endingOpState = null;
- String endingAvailStatus = null;
- String endingStandbyStatus = null;
- String exception = null;
-
- public StateElement()
- {
- // Empty constructor
- }
-
- public String getAdminState()
- {
- return this.adminState;
- }
-
- public void setAdminState(String adminState)
- {
- this.adminState = adminState;
- }
-
- public String getOpState()
- {
- return this.opState;
- }
-
- public void setOpState(String opState)
- {
- this.opState = opState;
- }
-
- public String getAvailStatus()
- {
- return this.availStatus;
- }
-
- public void setAvailStatus(String availStatus)
- {
- this.availStatus = availStatus;
- }
-
- public String getStandbyStatus()
- {
- return this.standbyStatus;
- }
-
- public void setStandbyStatus(String standbyStatus)
- {
- this.standbyStatus = standbyStatus;
- }
-
- public String getActionName()
- {
- return this.actionName;
- }
-
- public void setActionName(String actionName)
- {
- this.actionName = actionName;
- }
-
- public String getEndingAdminState()
- {
- return this.endingAdminState;
- }
-
- public void setEndingAdminState(String endingAdminState)
- {
- this.endingAdminState = endingAdminState;
- }
-
- public String getEndingOpState()
- {
- return this.endingOpState;
- }
-
- public void setEndingOpState(String endingOpState)
- {
- this.endingOpState = endingOpState;
- }
-
- public String getEndingAvailStatus()
- {
- return this.endingAvailStatus;
- }
-
- public void setEndingAvailStatus(String endingAvailStatus)
- {
- this.endingAvailStatus = endingAvailStatus;
- }
-
- public String getEndingStandbyStatus()
- {
- return this.endingStandbyStatus;
- }
-
- public void setEndingStandbyStatus(String endingStandbyStatus)
- {
- this.endingStandbyStatus = endingStandbyStatus;
- }
-
- public String getException()
- {
- return this.exception;
- }
-
- public void setException(String exception)
- {
- this.exception = exception;
- }
-
- public void displayStateElement()
- {
- if(logger.isDebugEnabled()){
- logger.debug("adminState=[{}], opState=[{}], availStatus=[{}], standbyStatus=[{}], " +
- "actionName=[{}], endingAdminState=[{}], endingOpState=[{}], " +
- "endingAvailStatus=[{}], endingStandbyStatus=[{}], exception=[{}]",
- getAdminState(),
- getOpState(),
- getAvailStatus(),
- getStandbyStatus(),
- getActionName(),
- getEndingAdminState(),
- getEndingOpState(),
- getEndingAvailStatus(),
- getEndingStandbyStatus(),
- getException());
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(StateElement.class);
+
+ String adminState = null;
+ String opState = null;
+ String availStatus = null;
+ String standbyStatus = null;
+ String actionName = null;
+ String endingAdminState = null;
+ String endingOpState = null;
+ String endingAvailStatus = null;
+ String endingStandbyStatus = null;
+ String exception = null;
+
+ public StateElement() {
+ // Empty constructor
+ }
+
+ public String getAdminState() {
+ return this.adminState;
+ }
+
+ public void setAdminState(String adminState) {
+ this.adminState = adminState;
+ }
+
+ public String getOpState() {
+ return this.opState;
+ }
+
+ public void setOpState(String opState) {
+ this.opState = opState;
+ }
+
+ public String getAvailStatus() {
+ return this.availStatus;
+ }
+
+ public void setAvailStatus(String availStatus) {
+ this.availStatus = availStatus;
+ }
+
+ public String getStandbyStatus() {
+ return this.standbyStatus;
+ }
+
+ public void setStandbyStatus(String standbyStatus) {
+ this.standbyStatus = standbyStatus;
+ }
+
+ public String getActionName() {
+ return this.actionName;
+ }
+
+ public void setActionName(String actionName) {
+ this.actionName = actionName;
+ }
+
+ public String getEndingAdminState() {
+ return this.endingAdminState;
+ }
+
+ public void setEndingAdminState(String endingAdminState) {
+ this.endingAdminState = endingAdminState;
+ }
+
+ public String getEndingOpState() {
+ return this.endingOpState;
+ }
+
+ public void setEndingOpState(String endingOpState) {
+ this.endingOpState = endingOpState;
+ }
+
+ public String getEndingAvailStatus() {
+ return this.endingAvailStatus;
+ }
+
+ public void setEndingAvailStatus(String endingAvailStatus) {
+ this.endingAvailStatus = endingAvailStatus;
+ }
+
+ public String getEndingStandbyStatus() {
+ return this.endingStandbyStatus;
+ }
+
+ public void setEndingStandbyStatus(String endingStandbyStatus) {
+ this.endingStandbyStatus = endingStandbyStatus;
+ }
+
+ public String getException() {
+ return this.exception;
+ }
+
+ public void setException(String exception) {
+ this.exception = exception;
+ }
+
+ /**
+ * Display the state element.
+ */
+ public void displayStateElement() {
+ if (logger.isDebugEnabled()) {
+ logger.debug(
+ "adminState=[{}], opState=[{}], availStatus=[{}], standbyStatus=[{}], "
+ + "actionName=[{}], endingAdminState=[{}], endingOpState=[{}], "
+ + "endingAvailStatus=[{}], endingStandbyStatus=[{}], exception=[{}]",
+ getAdminState(), getOpState(), getAvailStatus(), getStandbyStatus(), getActionName(),
+ getEndingAdminState(), getEndingOpState(), getEndingAvailStatus(), getEndingStandbyStatus(),
+ getException());
+ }
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java
index 5cafd876..dbb278e7 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java
@@ -23,927 +23,952 @@ package org.onap.policy.common.im;
import java.util.Date;
import java.util.List;
import java.util.Observable;
+
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.FlushModeType;
import javax.persistence.LockModeType;
import javax.persistence.TypedQuery;
+
import org.onap.policy.common.im.exceptions.EntityRetrievalException;
import org.onap.policy.common.im.jpa.StateManagementEntity;
import org.onap.policy.common.utils.jpa.EntityMgrCloser;
import org.onap.policy.common.utils.jpa.EntityTransCloser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
/**
- *
- * StateManagement class handles all state changes per the Telecom standard X.731.
- * It extends the Observable class and, thus, has an interface to register
- * instances of the StateChangeNotifier/Observer class. When any state change
- * occurs, the registered observers are notified.
+ * StateManagement class handles all state changes per the Telecom standard X.731. It extends the
+ * Observable class and, thus, has an interface to register instances of the
+ * StateChangeNotifier/Observer class. When any state change occurs, the registered observers are
+ * notified.
*
*/
public class StateManagement extends Observable {
- private static final String RESOURCE_NAME = "resource";
- private static final String GET_STATE_MANAGEMENT_ENTITY_QUERY =
+ private static final String RESOURCE_NAME = "resource";
+ private static final String GET_STATE_MANAGEMENT_ENTITY_QUERY =
"Select p from StateManagementEntity p where p.resourceName=:" + RESOURCE_NAME;
- private static final Logger logger = LoggerFactory.getLogger(StateManagement.class);
- public static final String LOCKED = "locked";
- public static final String UNLOCKED = "unlocked";
- public static final String ENABLED = "enabled";
- public static final String DISABLED = "disabled";
- public static final String ENABLE_NOT_FAILED = "enableNotFailed";
- public static final String DISABLE_FAILED = "disableFailed";
- public static final String FAILED = "failed";
- public static final String DEPENDENCY = "dependency";
- public static final String DEPENDENCY_FAILED = "dependency,failed";
- public static final String DISABLE_DEPENDENCY = "disableDependency";
- public static final String ENABLE_NO_DEPENDENCY = "enableNoDependency";
- public static final String NULL_VALUE = "null";
- public static final String LOCK = "lock";
- public static final String UNLOCK = "unlock";
- public static final String PROMOTE = "promote";
- public static final String DEMOTE = "demote";
- public static final String HOT_STANDBY = "hotstandby";
- public static final String COLD_STANDBY = "coldstandby";
- public static final String PROVIDING_SERVICE = "providingservice";
-
- public static final String ADMIN_STATE = "adminState";
- public static final String OPERATION_STATE = "opState";
- public static final String AVAILABLE_STATUS= "availStatus";
- public static final String STANDBY_STATUS = "standbyStatus";
-
- private String resourceName = null;
- private String adminState = null;
- private String opState = null;
- private String availStatus = null;
- private String standbyStatus = null;
- private final EntityManagerFactory emf;
- private StateTransition st = null;
-
- /*
- * Guarantees single-threadedness of all actions. Only one action can execute
- * at a time. That avoids race conditions between actions being called
- * from different places.
- *
- * Some actions can take significant time to complete and, if another conflicting
- * action is called during its execution, it could put the system in an inconsistent
- * state. This very thing happened when demote was called and the active/standby
- * algorithm, seeing the state attempted to promote the PDP-D.
- *
- */
- private static final Object SYNCLOCK = new Object();
- private static final Object FLUSHLOCK = new Object();
-
- /**
- * StateManagement constructor
- * @param entityManagerFactory
- * @param resourceName
- * @throws StateManagementException
- */
- public StateManagement(final EntityManagerFactory entityManagerFactory, final String resourceName) throws StateManagementException
- {
- emf = entityManagerFactory;
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement: constructor, resourceName: {}", resourceName);
- }
-
- final EntityManager em = emf.createEntityManager();
- try(EntityMgrCloser emc = new EntityMgrCloser(em);
- MyTransaction et = new MyTransaction(em)) {
-
- this.resourceName = resourceName;
- if(logger.isDebugEnabled()){
- logger.debug("resourceName = {}", this.resourceName);
- }
-
-
- try {
- //Create a StateManagementEntity object
- if(logger.isDebugEnabled()){
- logger.debug("findStateManagementEntity for {}", this.resourceName);
- }
- final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
-
- //persist the administrative state
- if(logger.isDebugEnabled()){
- logger.debug("Persist adminstrative state, resourceName = {}", this.resourceName);
- }
- em.persist(sm);
+ private static final Logger logger = LoggerFactory.getLogger(StateManagement.class);
+ public static final String LOCKED = "locked";
+ public static final String UNLOCKED = "unlocked";
+ public static final String ENABLED = "enabled";
+ public static final String DISABLED = "disabled";
+ public static final String ENABLE_NOT_FAILED = "enableNotFailed";
+ public static final String DISABLE_FAILED = "disableFailed";
+ public static final String FAILED = "failed";
+ public static final String DEPENDENCY = "dependency";
+ public static final String DEPENDENCY_FAILED = "dependency,failed";
+ public static final String DISABLE_DEPENDENCY = "disableDependency";
+ public static final String ENABLE_NO_DEPENDENCY = "enableNoDependency";
+ public static final String NULL_VALUE = "null";
+ public static final String LOCK = "lock";
+ public static final String UNLOCK = "unlock";
+ public static final String PROMOTE = "promote";
+ public static final String DEMOTE = "demote";
+ public static final String HOT_STANDBY = "hotstandby";
+ public static final String COLD_STANDBY = "coldstandby";
+ public static final String PROVIDING_SERVICE = "providingservice";
+
+ public static final String ADMIN_STATE = "adminState";
+ public static final String OPERATION_STATE = "opState";
+ public static final String AVAILABLE_STATUS = "availStatus";
+ public static final String STANDBY_STATUS = "standbyStatus";
+
+ private String resourceName = null;
+ private String adminState = null;
+ private String opState = null;
+ private String availStatus = null;
+ private String standbyStatus = null;
+ private final EntityManagerFactory emf;
+ private StateTransition st = null;
+
+ /*
+ * Guarantees single-threadedness of all actions. Only one action can execute at a time. That
+ * avoids race conditions between actions being called from different places.
+ *
+ * Some actions can take significant time to complete and, if another conflicting action is
+ * called during its execution, it could put the system in an inconsistent state. This very
+ * thing happened when demote was called and the active/standby algorithm, seeing the state
+ * attempted to promote the PDP-D.
+ *
+ */
+ private static final Object SYNCLOCK = new Object();
+ private static final Object FLUSHLOCK = new Object();
+
+ /**
+ * StateManagement constructor.
+ *
+ * @param entityManagerFactory the entity manager factory
+ * @param resourceName the resource name
+ * @throws StateManagementException if an error occurs
+ */
+ public StateManagement(final EntityManagerFactory entityManagerFactory, final String resourceName)
+ throws StateManagementException {
+ emf = entityManagerFactory;
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement: constructor, resourceName: {}", resourceName);
+ }
+
+ final EntityManager em = emf.createEntityManager();
+ try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
+
+ this.resourceName = resourceName;
+ if (logger.isDebugEnabled()) {
+ logger.debug("resourceName = {}", this.resourceName);
+ }
+
+
+ try {
+ // Create a StateManagementEntity object
+ if (logger.isDebugEnabled()) {
+ logger.debug("findStateManagementEntity for {}", this.resourceName);
+ }
+ final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
+
+ // persist the administrative state
+ if (logger.isDebugEnabled()) {
+ logger.debug("Persist adminstrative state, resourceName = {}", this.resourceName);
+ }
+ em.persist(sm);
+ et.commit();
+
+ // Load the StateTransition hash table
+ st = new StateTransition();
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement: constructor end, resourceName: {}", this.resourceName);
+ }
+ } catch (final Exception ex) {
+ logger.error("StateManagement: constructor caught unexpected exception: ", ex);
+ throw new StateManagementException("StateManagement: Exception: " + ex.toString(), ex);
+ }
+ }
+ }
+
+ /**
+ * initializeState() is called when it is necessary to set the StateManagement to a known
+ * initial state. It preserves the Administrative State since it must persist across node
+ * reboots. Starting from this state, the IntegrityMonitory will determine the Operational State
+ * and the owning application will set the StandbyStatus.
+ */
+ public void initializeState() throws StateManagementException {
+ synchronized (SYNCLOCK) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("\nStateManagement: SYNCLOCK initializeState() operation for resourceName = {}\n",
+ this.resourceName);
+ logger.debug("StateManagement: initializeState() operation started, resourceName = {}",
+ this.resourceName);
+ }
+ final EntityManager em = emf.createEntityManager();
+
+ try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("findStateManagementEntity for {}", this.resourceName);
+ }
+ final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
+ // set state
+ sm.setAdminState(sm.getAdminState()); // preserve the Admin state
+ sm.setOpState(StateManagement.ENABLED);
+ sm.setAvailStatus(StateManagement.NULL_VALUE);
+ sm.setStandbyStatus(StateManagement.NULL_VALUE);
+
+ em.persist(sm);
+ et.commit();
+ setChanged();
+ notifyObservers(ADMIN_STATE);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement: initializeState() operation completed, resourceName = {}",
+ this.resourceName);
+ }
+ } catch (final Exception ex) {
+ logger.error("StateManagement.initializeState() caught unexpected exception: ", ex);
+ throw new StateManagementException("StateManagement.initializeState() Exception: " + ex);
+ }
+ }
+ }
+
+ /**
+ * lock() changes the administrative state to locked.
+ *
+ * @throws StateManagementException if an error occurs
+ */
+ public void lock() throws StateManagementException {
+ synchronized (SYNCLOCK) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("\nStateManagement: SYNCLOCK lock() operation for resourceName = {}\n", this.resourceName);
+ logger.debug("StateManagement: lock() operation started, resourceName = {}", this.resourceName);
+ }
+ final EntityManager em = emf.createEntityManager();
+
+ try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("findStateManagementEntity for {}", this.resourceName);
+ }
+ final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
+
+ final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
+ sm.getAvailStatus(), sm.getStandbyStatus(), LOCK);
+
+ sm.setAdminState(stateElement.getEndingAdminState());
+ sm.setOpState(stateElement.getEndingOpState());
+ sm.setAvailStatus(stateElement.getEndingAvailStatus());
+ sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
+
+ em.persist(sm);
+ et.commit();
+ setChanged();
+ notifyObservers(ADMIN_STATE);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement: lock() operation completed, resourceName = {}", this.resourceName);
+ }
+ } catch (final Exception ex) {
+ logger.error("StateManagement.lock() caught unexpected exception: ", ex);
+ throw new StateManagementException("StateManagement.lock() Exception: " + ex.toString());
+ }
+ }
+ }
+
+ /**
+ * unlock() changes the administrative state to unlocked.
+ *
+ * @throws StateManagementException if an error occurs
+ */
+ public void unlock() throws StateManagementException {
+ synchronized (SYNCLOCK) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("\nStateManagement: SYNCLOCK unlock() operation for resourceName = {}\n",
+ this.resourceName);
+ logger.debug("StateManagement: unlock() operation started, resourceName = {}", this.resourceName);
+ }
+ final EntityManager em = emf.createEntityManager();
+
+ try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("findStateManagementEntity for {}", this.resourceName);
+ }
+ final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
+ final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
+ sm.getAvailStatus(), sm.getStandbyStatus(), UNLOCK);
+ // set transition state
+ sm.setAdminState(stateElement.getEndingAdminState());
+ sm.setOpState(stateElement.getEndingOpState());
+ sm.setAvailStatus(stateElement.getEndingAvailStatus());
+ sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
+
+ em.persist(sm);
+ et.commit();
+ setChanged();
+ notifyObservers(ADMIN_STATE);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement: unlock() operation completed, resourceName = {}", this.resourceName);
+ }
+ } catch (final Exception ex) {
+ logger.error("StateManagement.unlock() caught unexpected exception: ", ex);
+ throw new StateManagementException("StateManagement.unlock() Exception: " + ex);
+ }
+ }
+ }
+
+ /**
+ * enableNotFailed() removes the "failed" availability status and changes the operational state
+ * to enabled if no dependency is also failed.
+ *
+ * @throws StateManagementException if an error occurs
+ */
+ public void enableNotFailed() throws StateManagementException {
+ synchronized (SYNCLOCK) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("\nStateManagement: SYNCLOCK enabledNotFailed() operation for resourceName = {}\n",
+ this.resourceName);
+ logger.debug("StateManagement: enableNotFailed() operation started, resourceName = {}",
+ this.resourceName);
+ }
+ final EntityManager em = emf.createEntityManager();
+
+ try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("findStateManagementEntity for {}", this.resourceName);
+ }
+ final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
+ final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
+ sm.getAvailStatus(), sm.getStandbyStatus(), ENABLE_NOT_FAILED);
+ // set transition state
+ sm.setAdminState(stateElement.getEndingAdminState());
+ sm.setOpState(stateElement.getEndingOpState());
+ sm.setAvailStatus(stateElement.getEndingAvailStatus());
+ sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
+
+ em.persist(sm);
+ et.commit();
+
+ setChanged();
+ notifyObservers(OPERATION_STATE);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement enableNotFailed() operation completed, resourceName = {}",
+ this.resourceName);
+ }
+ } catch (final Exception ex) {
+ logger.error("StateManagement.enableNotFailed() caught unexpected exception: ", ex);
+ throw new StateManagementException("StateManagement.enableNotFailed() Exception: " + ex);
+ }
+ }
+ }
+
+ /**
+ * disableFailed() changes the operational state to disabled and adds availability status of
+ * "failed".
+ *
+ * @throws StateManagementException if an error occurs
+ */
+ public void disableFailed() throws StateManagementException {
+ synchronized (SYNCLOCK) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("\nStateManagement: SYNCLOCK disabledFailed() operation for resourceName = {}\n",
+ this.resourceName);
+ logger.debug("StateManagement: disableFailed() operation started, resourceName = {}",
+ this.resourceName);
+ }
+ final EntityManager em = emf.createEntityManager();
+
+ try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("findStateManagementEntity for {}", this.resourceName);
+ }
+ final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
+ final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
+ sm.getAvailStatus(), sm.getStandbyStatus(), DISABLE_FAILED);
+ // set transition state
+ sm.setAdminState(stateElement.getEndingAdminState());
+ sm.setOpState(stateElement.getEndingOpState());
+ sm.setAvailStatus(stateElement.getEndingAvailStatus());
+ sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
+
+ em.persist(sm);
+ et.commit();
+ setChanged();
+ notifyObservers(OPERATION_STATE);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement: disableFailed() operation completed, resourceName = {}",
+ this.resourceName);
+ }
+ } catch (final Exception ex) {
+ logger.error("StateManagement.disableFailed() caught unexpected exception: ", ex);
+ throw new StateManagementException("StateManagement.disableFailed() Exception: " + ex);
+ }
+ }
+ }
+
+ /**
+ * This version of disableFailed is to be used to manipulate the state of a remote resource in
+ * the event that remote resource has failed but its state is still showing that it is viable.
+ *
+ * @throws StateManagementException if an error occurs
+ */
+ public void disableFailed(final String otherResourceName) throws StateManagementException {
+ synchronized (SYNCLOCK) {
+ if (otherResourceName == null) {
+ logger.error("\nStateManagement: SYNCLOCK disableFailed(otherResourceName) operation: resourceName is "
+ + "NULL.\n");
+ return;
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("\nStateManagement: SYNCLOCK disabledFailed(otherResourceName) operation for resourceName "
+ + "= {}\n", otherResourceName);
+ logger.debug("StateManagement: disableFailed(otherResourceName) operation started, resourceName = {}",
+ otherResourceName);
+ }
+ final EntityManager em = emf.createEntityManager();
+
+ try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("findStateManagementEntity for " + otherResourceName);
+ }
+ final StateManagementEntity sm = findStateManagementEntity(em, otherResourceName);
+ final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
+ sm.getAvailStatus(), sm.getStandbyStatus(), DISABLE_FAILED);
+ // set transition state
+ sm.setAdminState(stateElement.getEndingAdminState());
+ sm.setOpState(stateElement.getEndingOpState());
+ sm.setAvailStatus(stateElement.getEndingAvailStatus());
+ sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
+
+ em.persist(sm);
+ et.commit();
+ setChanged();
+ notifyObservers(OPERATION_STATE);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug(
+ "StateManagement: disableFailed(otherResourceName) operation completed, resourceName = {}",
+ otherResourceName);
+ }
+ } catch (final Exception ex) {
+ logger.error("StateManagement.disableFailed(otherResourceName) caught unexpected exception: ", ex);
+ throw new StateManagementException("StateManagement.disableFailed(otherResourceName) Exception: " + ex);
+ }
+ }
+ }
+
+ /**
+ * disableDependency() changes operational state to disabled and adds availability status of
+ * "dependency".
+ *
+ * @throws StateManagementException if an error occurs
+ */
+ public void disableDependency() throws StateManagementException {
+ synchronized (SYNCLOCK) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("\nStateManagement: SYNCLOCK disableDependency() operation for resourceName = {}\n",
+ this.resourceName);
+ logger.debug("StateManagement: disableDependency() operation started, resourceName = {}",
+ this.resourceName);
+ }
+ final EntityManager em = emf.createEntityManager();
+
+ try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("findStateManagementEntity for {}", this.resourceName);
+ }
+ final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
+ final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
+ sm.getAvailStatus(), sm.getStandbyStatus(), DISABLE_DEPENDENCY);
+ // set transition state
+ sm.setAdminState(stateElement.getEndingAdminState());
+ sm.setOpState(stateElement.getEndingOpState());
+ sm.setAvailStatus(stateElement.getEndingAvailStatus());
+ sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
+
+ em.persist(sm);
+ et.commit();
+ setChanged();
+ notifyObservers(OPERATION_STATE);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement: disableDependency() operation completed, resourceName = {}",
+ this.resourceName);
+ }
+ } catch (final Exception ex) {
+ logger.error("StateManagement.disableDependency() caught unexpected exception: ", ex);
+ throw new StateManagementException("StateManagement.disableDependency() Exception: " + ex);
+ }
+ }
+ }
+
+ /**
+ * enableNoDependency() removes the availability status of "dependency " and will change the
+ * operational state to enabled if not otherwise failed.
+ *
+ * @throws StateManagementException if an error occurs
+ */
+ public void enableNoDependency() throws StateManagementException {
+ synchronized (SYNCLOCK) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("\nStateManagement: SYNCLOCK enableNoDependency() operation for resourceName = {}\n",
+ this.resourceName);
+ logger.debug("StateManagement: enableNoDependency() operation started, resourceName = {}",
+ this.resourceName);
+ }
+ final EntityManager em = emf.createEntityManager();
+
+ try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("findStateManagementEntity for {}", this.resourceName);
+ }
+ final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
+ final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
+ sm.getAvailStatus(), sm.getStandbyStatus(), ENABLE_NO_DEPENDENCY);
+ // set transition state
+ sm.setAdminState(stateElement.getEndingAdminState());
+ sm.setOpState(stateElement.getEndingOpState());
+ sm.setAvailStatus(stateElement.getEndingAvailStatus());
+ sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
+
+ em.persist(sm);
+ et.commit();
+ setChanged();
+ notifyObservers(OPERATION_STATE);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement: enableNoDependency() operation completed, resourceName = {}",
+ this.resourceName);
+ }
+ } catch (final Exception ex) {
+ logger.error("StateManagement.enableNoDependency() caught unexpected exception: ", ex);
+ throw new StateManagementException("StateManagement.enableNoDependency() Exception: " + ex);
+ }
+ }
+ }
+
+ /**
+ * promote() changes the standby status to providingservice if not otherwise failed.
+ *
+ * @throws StandbyStatusException if the status fails to change
+ * @throws StateManagementException if an error occurs when promoting the status
+ */
+ public void promote() throws StandbyStatusException, StateManagementException {
+ synchronized (SYNCLOCK) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("\nStateManagement: SYNCLOCK promote() operation for resourceName = {}\n",
+ this.resourceName);
+ logger.debug("StateManagement: promote() operation started, resourceName = {}", this.resourceName);
+ }
+
+ StateManagementEntity sm;
+
+ final EntityManager em = emf.createEntityManager();
+
+ try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("findStateManagementEntity for {}", this.resourceName);
+ }
+ sm = findStateManagementEntity(em, this.resourceName);
+ final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
+ sm.getAvailStatus(), sm.getStandbyStatus(), PROMOTE);
+ // set transition state
+ sm.setAdminState(stateElement.getEndingAdminState());
+ sm.setOpState(stateElement.getEndingOpState());
+ sm.setAvailStatus(stateElement.getEndingAvailStatus());
+ sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
+
+ em.persist(sm);
+ et.commit();
+ setChanged();
+ notifyObservers(STANDBY_STATUS);
+ } catch (final Exception ex) {
+ logger.error("StateManagement.promote() caught unexpected exception: ", ex);
+ throw new StateManagementException("StateManagement.promote() Exception: " + ex);
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement: promote() operation completed, resourceName = ", this.resourceName);
+ }
+ if (sm.getStandbyStatus().equals(StateManagement.COLD_STANDBY)) {
+ final String msg =
+ "Failure to promote " + this.resourceName + " StandbyStatus = " + StateManagement.COLD_STANDBY;
+ throw new StandbyStatusException(msg);
+ }
+ }
+ }
+
+ /**
+ * demote() changes standbystatus to hotstandby or, if failed, coldstandby.
+ *
+ * @throws StateManagementException if an error occurs
+ */
+ public void demote() throws StateManagementException {
+ synchronized (SYNCLOCK) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("\nStateManagement: SYNCLOCK demote() operation for resourceName = \n", this.resourceName);
+ logger.debug("StateManagement: demote() operation started, resourceName = {}", this.resourceName);
+ }
+ final EntityManager em = emf.createEntityManager();
+
+ try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("findStateManagementEntity for {}", this.resourceName);
+ }
+ final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
+ final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
+ sm.getAvailStatus(), sm.getStandbyStatus(), DEMOTE);
+ // set transition state
+ sm.setAdminState(stateElement.getEndingAdminState());
+ sm.setOpState(stateElement.getEndingOpState());
+ sm.setAvailStatus(stateElement.getEndingAvailStatus());
+ sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
+
+ em.persist(sm);
+ et.commit();
+ setChanged();
+ notifyObservers(STANDBY_STATUS);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement: demote() operation completed, resourceName = {}", this.resourceName);
+ }
+ } catch (final Exception ex) {
+ logger.error("StateManagement.demote() caught unexpected exception: ", ex);
+ throw new StateManagementException("StateManagement.demote() Exception: " + ex);
+ }
+ }
+ }
+
+ /**
+ * Only used for a remote resource. It will not notify observers. It is used only in cases where
+ * the remote resource has failed is such a way that it cannot update its own states. In
+ * particular this is observed by PDP-D DroolsPdpsElectionHandler when it is trying to determine
+ * which PDP-D should be designated as the lead.
+ *
+ * @param otherResourceName the resouce name
+ * @throws StateManagementException if an error occurs
+ */
+ public void demote(final String otherResourceName) throws StateManagementException {
+ synchronized (SYNCLOCK) {
+ if (otherResourceName == null) {
+ logger.error(
+ "\nStateManagement: SYNCLOCK demote(otherResourceName) operation: resourceName is NULL.\n");
+ return;
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("\nStateManagement: SYNCLOCK demote(otherResourceName) operation for resourceName = {}\n",
+ otherResourceName);
+ }
+ final EntityManager em = emf.createEntityManager();
+
+ try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement: SYNCLOCK demote(otherResourceName) findStateManagementEntity for {}",
+ otherResourceName);
+ }
+ final StateManagementEntity sm = findStateManagementEntity(em, otherResourceName);
+ final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
+ sm.getAvailStatus(), sm.getStandbyStatus(), DEMOTE);
+ // set transition state
+ sm.setAdminState(stateElement.getEndingAdminState());
+ sm.setOpState(stateElement.getEndingOpState());
+ sm.setAvailStatus(stateElement.getEndingAvailStatus());
+ sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
+
+ em.persist(sm);
+ et.commit();
+ // We don't notify observers because this is assumed to be a remote resource
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement: demote(otherResourceName) operation completed, resourceName = {}",
+ otherResourceName);
+ }
+ } catch (final Exception ex) {
+ logger.error("StateManagement.demote(otherResourceName) caught unexpected exception: ", ex);
+ throw new StateManagementException("StateManagement.demote(otherResourceName) Exception: " + ex);
+ }
+ }
+ }
+
+ /**
+ * Get the administration state.
+ *
+ * @return the administration state
+ */
+ public String getAdminState() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement(6/1/16): getAdminState for resourceName {}", this.resourceName);
+ }
+
+ final EntityManager em = emf.createEntityManager();
+ try (final EntityMgrCloser emc = new EntityMgrCloser(em)) {
+ final TypedQuery<StateManagementEntity> query =
+ em.createQuery(GET_STATE_MANAGEMENT_ENTITY_QUERY, StateManagementEntity.class);
+
+ query.setParameter(RESOURCE_NAME, this.resourceName);
+
+ // Just test that we are retrieving the right object
+ final List<StateManagementEntity> resourceList =
+ query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ if (!resourceList.isEmpty()) {
+ // exist
+ final StateManagementEntity stateManagementEntity = resourceList.get(0);
+ // refresh the object from DB in case cached data was returned
+ em.refresh(stateManagementEntity);
+ this.adminState = stateManagementEntity.getAdminState();
+ } else {
+ this.adminState = null;
+ }
+ } catch (final Exception ex) {
+ logger.error("StateManagement: getAdminState exception: {}", ex.toString(), ex);
+ }
+
+ return this.adminState;
+ }
+
+ /**
+ * Get the operational state.
+ *
+ * @return the operational state
+ */
+ public String getOpState() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement(6/1/16): getOpState for resourceName {}", this.resourceName);
+ }
+
+ final EntityManager em = emf.createEntityManager();
+ try (EntityMgrCloser emc = new EntityMgrCloser(em)) {
+ final TypedQuery<StateManagementEntity> query =
+ em.createQuery(GET_STATE_MANAGEMENT_ENTITY_QUERY, StateManagementEntity.class);
+
+ query.setParameter(RESOURCE_NAME, this.resourceName);
+
+ // Just test that we are retrieving the right object
+ final List<StateManagementEntity> resourceList =
+ query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ if (!resourceList.isEmpty()) {
+ // exist
+ final StateManagementEntity stateManagementEntity = resourceList.get(0);
+ // refresh the object from DB in case cached data was returned
+ em.refresh(stateManagementEntity);
+ this.opState = stateManagementEntity.getOpState();
+ } else {
+ this.opState = null;
+ }
+ } catch (final Exception ex) {
+ logger.error("StateManagement: getOpState exception: {}", ex.toString(), ex);
+ }
+
+ return this.opState;
+ }
+
+ /**
+ * Get the availability status.
+ *
+ * @return the availability status
+ */
+ public String getAvailStatus() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement(6/1/16): getAvailStatus for resourceName {}", this.resourceName);
+ }
+
+ final EntityManager em = emf.createEntityManager();
+ try (EntityMgrCloser emc = new EntityMgrCloser(em)) {
+ final TypedQuery<StateManagementEntity> query =
+ em.createQuery(GET_STATE_MANAGEMENT_ENTITY_QUERY, StateManagementEntity.class);
+
+ query.setParameter(RESOURCE_NAME, this.resourceName);
+
+ // Just test that we are retrieving the right object
+ final List<StateManagementEntity> resourceList =
+ query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ if (!resourceList.isEmpty()) {
+ // exist
+ final StateManagementEntity stateManagementEntity = resourceList.get(0);
+ // refresh the object from DB in case cached data was returned
+ em.refresh(stateManagementEntity);
+ this.availStatus = stateManagementEntity.getAvailStatus();
+ } else {
+ this.availStatus = null;
+ }
+ } catch (final Exception ex) {
+ logger.error("StateManagement: getAvailStatus exception: {}", ex.toString(), ex);
+ }
+
+ return this.availStatus;
+ }
+
+ /**
+ * Get the standy status.
+ *
+ * @return the standby status
+ */
+ public String getStandbyStatus() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement(6/1/16): getStandbyStatus for resourceName {}", this.resourceName);
+ }
+
+ final EntityManager em = emf.createEntityManager();
+ try (EntityMgrCloser emc = new EntityMgrCloser(em)) {
+ final TypedQuery<StateManagementEntity> query =
+ em.createQuery(GET_STATE_MANAGEMENT_ENTITY_QUERY, StateManagementEntity.class);
+
+ query.setParameter(RESOURCE_NAME, this.resourceName);
+
+ // Just test that we are retrieving the right object
+ final List<StateManagementEntity> resourceList =
+ query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ if (!resourceList.isEmpty()) {
+ // exist
+ final StateManagementEntity stateManagementEntity = resourceList.get(0);
+ // refresh the object from DB in case cached data was returned
+ em.refresh(stateManagementEntity);
+ this.standbyStatus = stateManagementEntity.getStandbyStatus();
+ } else {
+ this.standbyStatus = null;
+ }
+ } catch (final Exception ex) {
+ logger.error("StateManagement: getStandbyStatus exception: {}", ex.toString(), ex);
+ }
+
+ return this.standbyStatus;
+ }
+
+ /**
+ * Get the standbystatus of a particular resource.
+ *
+ * @param otherResourceName the resource
+ * @return the standby status
+ */
+ public String getStandbyStatus(final String otherResourceName) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement: getStandbyStatus: Entering, resourceName='{}'", otherResourceName);
+ }
+
+ String tempStandbyStatus = null;
+
+ // The transaction is required for the LockModeType
+ final EntityManager em = emf.createEntityManager();
+
+ try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
+
+ final TypedQuery<StateManagementEntity> stateManagementListQuery =
+ em.createQuery(GET_STATE_MANAGEMENT_ENTITY_QUERY, StateManagementEntity.class);
+ stateManagementListQuery.setParameter(RESOURCE_NAME, otherResourceName);
+ final List<StateManagementEntity> stateManagementList = stateManagementListQuery
+ .setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ if (!stateManagementList.isEmpty()) {
+ final StateManagementEntity stateManagementEntity = stateManagementList.get(0);
+ // refresh the object from DB in case cached data was returned
+ em.refresh(stateManagementEntity);
+ tempStandbyStatus = stateManagementEntity.getStandbyStatus();
+ if (logger.isDebugEnabled()) {
+ logger.debug("getStandbyStatus: resourceName ={} has standbyStatus={}", otherResourceName,
+ tempStandbyStatus);
+ }
+ } else {
+ logger.error("getStandbyStatus: resourceName ={} not found in statemanagemententity table",
+ otherResourceName);
+ }
+
et.commit();
-
- //Load the StateTransition hash table
- st = new StateTransition();
-
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement: constructor end, resourceName: {}", this.resourceName);
- }
- } catch(final Exception ex) {
- logger.error("StateManagement: constructor caught unexpected exception: ", ex);
- throw new StateManagementException("StateManagement: Exception: " + ex.toString(), ex);
- }
- }
- }
-
- /**
- * initializeState() is called when it is necessary to set the StateManagement to a known initial state.
- * It preserves the Administrative State since it must persist across node reboots.
- * Starting from this state, the IntegrityMonitory will determine the Operational State and the
- * owning application will set the StandbyStatus.
- */
- public void initializeState() throws StateManagementException
- {
- synchronized (SYNCLOCK){
- if(logger.isDebugEnabled()){
- logger.debug("\nStateManagement: SYNCLOCK initializeState() operation for resourceName = {}\n", this.resourceName);
- logger.debug("StateManagement: initializeState() operation started, resourceName = {}", this.resourceName);
- }
- final EntityManager em = emf.createEntityManager();
-
- try(EntityMgrCloser emc = new EntityMgrCloser(em);
- MyTransaction et = new MyTransaction(em)) {
-
- if(logger.isDebugEnabled()){
- logger.debug("findStateManagementEntity for {}", this.resourceName);
- }
- final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
- // set state
- sm.setAdminState(sm.getAdminState()); //preserve the Admin state
- sm.setOpState(StateManagement.ENABLED);
- sm.setAvailStatus(StateManagement.NULL_VALUE);
- sm.setStandbyStatus(StateManagement.NULL_VALUE);
-
- em.persist(sm);
- et.commit();
- setChanged();
- notifyObservers(ADMIN_STATE);
-
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement: initializeState() operation completed, resourceName = {}", this.resourceName);
- }
- } catch(final Exception ex) {
- logger.error("StateManagement.initializeState() caught unexpected exception: ", ex);
- throw new StateManagementException("StateManagement.initializeState() Exception: " + ex);
- }
- }
- }
-
- /**
- * lock() changes the administrative state to locked.
- * @throws StateManagementException
- */
- public void lock() throws StateManagementException
- {
- synchronized (SYNCLOCK){
- if(logger.isDebugEnabled()){
- logger.debug("\nStateManagement: SYNCLOCK lock() operation for resourceName = {}\n", this.resourceName);
- logger.debug("StateManagement: lock() operation started, resourceName = {}", this.resourceName);
- }
- final EntityManager em = emf.createEntityManager();
-
- try(EntityMgrCloser emc = new EntityMgrCloser(em);
- MyTransaction et = new MyTransaction(em)) {
-
- if(logger.isDebugEnabled()){
- logger.debug("findStateManagementEntity for {}", this.resourceName);
- }
- final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
-
- final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
- sm.getAvailStatus(), sm.getStandbyStatus(), LOCK);
-
- sm.setAdminState(stateElement.getEndingAdminState());
- sm.setOpState(stateElement.getEndingOpState());
- sm.setAvailStatus(stateElement.getEndingAvailStatus());
- sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
-
- em.persist(sm);
- et.commit();
- setChanged();
- notifyObservers(ADMIN_STATE);
-
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement: lock() operation completed, resourceName = {}", this.resourceName);
- }
- } catch(final Exception ex) {
- logger.error("StateManagement.lock() caught unexpected exception: ", ex);
- throw new StateManagementException("StateManagement.lock() Exception: " + ex.toString());
- }
- }
- }
-
- /**
- * unlock() changes the administrative state to unlocked.
- * @throws StateManagementException
- */
- public void unlock() throws StateManagementException
- {
- synchronized (SYNCLOCK){
- if(logger.isDebugEnabled()){
- logger.debug("\nStateManagement: SYNCLOCK unlock() operation for resourceName = {}\n", this.resourceName);
- logger.debug("StateManagement: unlock() operation started, resourceName = {}", this.resourceName);
- }
- final EntityManager em = emf.createEntityManager();
-
- try(EntityMgrCloser emc = new EntityMgrCloser(em);
- MyTransaction et = new MyTransaction(em)) {
-
- if(logger.isDebugEnabled()){
- logger.debug("findStateManagementEntity for {}", this.resourceName);
- }
- final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
- final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
- sm.getAvailStatus(), sm.getStandbyStatus(), UNLOCK);
- // set transition state
- sm.setAdminState(stateElement.getEndingAdminState());
- sm.setOpState(stateElement.getEndingOpState());
- sm.setAvailStatus(stateElement.getEndingAvailStatus());
- sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
-
- em.persist(sm);
- et.commit();
- setChanged();
- notifyObservers(ADMIN_STATE);
-
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement: unlock() operation completed, resourceName = {}", this.resourceName);
- }
- } catch(final Exception ex) {
- logger.error("StateManagement.unlock() caught unexpected exception: ", ex);
- throw new StateManagementException("StateManagement.unlock() Exception: " + ex);
- }
- }
- }
-
- /**
- * enableNotFailed() removes the "failed" availability status and changes the operational
- * state to enabled if no dependency is also failed.
- * @throws StateManagementException
- */
- public void enableNotFailed() throws StateManagementException
- {
- synchronized (SYNCLOCK){
- if(logger.isDebugEnabled()){
- logger.debug("\nStateManagement: SYNCLOCK enabledNotFailed() operation for resourceName = {}\n", this.resourceName);
- logger.debug("StateManagement: enableNotFailed() operation started, resourceName = {}", this.resourceName);
- }
- final EntityManager em = emf.createEntityManager();
-
- try(EntityMgrCloser emc = new EntityMgrCloser(em);
- MyTransaction et = new MyTransaction(em)) {
-
- if(logger.isDebugEnabled()){
- logger.debug("findStateManagementEntity for {}", this.resourceName);
- }
- final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
- final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
- sm.getAvailStatus(), sm.getStandbyStatus(), ENABLE_NOT_FAILED);
- // set transition state
- sm.setAdminState(stateElement.getEndingAdminState());
- sm.setOpState(stateElement.getEndingOpState());
- sm.setAvailStatus(stateElement.getEndingAvailStatus());
- sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
-
- em.persist(sm);
- et.commit();
-
- setChanged();
- notifyObservers(OPERATION_STATE);
-
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement enableNotFailed() operation completed, resourceName = {}", this.resourceName);
- }
- } catch(final Exception ex) {
- logger.error("StateManagement.enableNotFailed() caught unexpected exception: ", ex);
- throw new StateManagementException("StateManagement.enableNotFailed() Exception: " + ex);
- }
- }
- }
-
- /**
- * disableFailed() changes the operational state to disabled and adds availability status of "failed"
- * @throws StateManagementException
- */
- public void disableFailed() throws StateManagementException
- {
- synchronized (SYNCLOCK){
- if(logger.isDebugEnabled()){
- logger.debug("\nStateManagement: SYNCLOCK disabledFailed() operation for resourceName = {}\n", this.resourceName);
- logger.debug("StateManagement: disableFailed() operation started, resourceName = {}", this.resourceName);
- }
- final EntityManager em = emf.createEntityManager();
-
- try(EntityMgrCloser emc = new EntityMgrCloser(em);
- MyTransaction et = new MyTransaction(em)) {
-
- if(logger.isDebugEnabled()){
- logger.debug("findStateManagementEntity for {}", this.resourceName);
- }
- final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
- final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
- sm.getAvailStatus(), sm.getStandbyStatus(), DISABLE_FAILED);
- // set transition state
- sm.setAdminState(stateElement.getEndingAdminState());
- sm.setOpState(stateElement.getEndingOpState());
- sm.setAvailStatus(stateElement.getEndingAvailStatus());
- sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
-
- em.persist(sm);
- et.commit();
- setChanged();
- notifyObservers(OPERATION_STATE);
-
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement: disableFailed() operation completed, resourceName = {}", this.resourceName);
- }
- } catch(final Exception ex) {
- logger.error("StateManagement.disableFailed() caught unexpected exception: ", ex);
- throw new StateManagementException("StateManagement.disableFailed() Exception: " + ex);
- }
- }
- }
- /**
- * This version of disableFailed is to be used to manipulate the state of a remote resource in the event
- * that remote resource has failed but its state is still showing that it is viable.
- * @throws StateManagementException
- */
- public void disableFailed(final String otherResourceName) throws StateManagementException
- {
- synchronized (SYNCLOCK){
- if(otherResourceName == null){
- logger.error("\nStateManagement: SYNCLOCK disableFailed(otherResourceName) operation: resourceName is NULL.\n");
- return;
- }
- if(logger.isDebugEnabled()){
- logger.debug("\nStateManagement: SYNCLOCK disabledFailed(otherResourceName) operation for resourceName = {}\n",
- otherResourceName);
- logger.debug("StateManagement: disableFailed(otherResourceName) operation started, resourceName = {}",
- otherResourceName);
- }
- final EntityManager em = emf.createEntityManager();
-
- try(EntityMgrCloser emc = new EntityMgrCloser(em);
- MyTransaction et = new MyTransaction(em)) {
-
- if(logger.isDebugEnabled()){
- logger.debug("findStateManagementEntity for " + otherResourceName);
- }
- final StateManagementEntity sm = findStateManagementEntity(em, otherResourceName);
- final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
- sm.getAvailStatus(), sm.getStandbyStatus(), DISABLE_FAILED);
- // set transition state
- sm.setAdminState(stateElement.getEndingAdminState());
- sm.setOpState(stateElement.getEndingOpState());
- sm.setAvailStatus(stateElement.getEndingAvailStatus());
- sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
-
- em.persist(sm);
- et.commit();
- setChanged();
- notifyObservers(OPERATION_STATE);
-
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement: disableFailed(otherResourceName) operation completed, resourceName = {}",
- otherResourceName);
- }
- } catch(final Exception ex) {
- logger.error("StateManagement.disableFailed(otherResourceName) caught unexpected exception: ", ex);
- throw new StateManagementException("StateManagement.disableFailed(otherResourceName) Exception: " + ex);
- }
- }
- }
-
- /**
- * disableDependency() changes operational state to disabled and adds availability status of "dependency"
- * @throws StateManagementException
- */
- public void disableDependency() throws StateManagementException
- {
- synchronized (SYNCLOCK){
- if(logger.isDebugEnabled()){
- logger.debug("\nStateManagement: SYNCLOCK disableDependency() operation for resourceName = {}\n", this.resourceName);
- logger.debug("StateManagement: disableDependency() operation started, resourceName = {}", this.resourceName);
- }
- final EntityManager em = emf.createEntityManager();
-
- try(EntityMgrCloser emc = new EntityMgrCloser(em);
- MyTransaction et = new MyTransaction(em)) {
-
- if(logger.isDebugEnabled()){
- logger.debug("findStateManagementEntity for {}", this.resourceName);
- }
- final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
- final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
- sm.getAvailStatus(), sm.getStandbyStatus(), DISABLE_DEPENDENCY);
- // set transition state
- sm.setAdminState(stateElement.getEndingAdminState());
- sm.setOpState(stateElement.getEndingOpState());
- sm.setAvailStatus(stateElement.getEndingAvailStatus());
- sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
-
- em.persist(sm);
- et.commit();
- setChanged();
- notifyObservers(OPERATION_STATE);
-
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement: disableDependency() operation completed, resourceName = {}", this.resourceName);
- }
- } catch(final Exception ex) {
- logger.error("StateManagement.disableDependency() caught unexpected exception: ", ex);
- throw new StateManagementException("StateManagement.disableDependency() Exception: " + ex);
- }
- }
- }
-
- /**
- * enableNoDependency() removes the availability status of "dependency " and will change the
- * operational state to enabled if not otherwise failed.
- * @throws StateManagementException
- */
- public void enableNoDependency() throws StateManagementException
- {
- synchronized (SYNCLOCK){
- if(logger.isDebugEnabled()){
- logger.debug("\nStateManagement: SYNCLOCK enableNoDependency() operation for resourceName = {}\n", this.resourceName);
- logger.debug("StateManagement: enableNoDependency() operation started, resourceName = {}", this.resourceName);
- }
- final EntityManager em = emf.createEntityManager();
-
- try(EntityMgrCloser emc = new EntityMgrCloser(em);
- MyTransaction et = new MyTransaction(em)) {
-
- if(logger.isDebugEnabled()){
- logger.debug("findStateManagementEntity for {}", this.resourceName);
- }
- final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
- final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
- sm.getAvailStatus(), sm.getStandbyStatus(), ENABLE_NO_DEPENDENCY);
- // set transition state
- sm.setAdminState(stateElement.getEndingAdminState());
- sm.setOpState(stateElement.getEndingOpState());
- sm.setAvailStatus(stateElement.getEndingAvailStatus());
- sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
-
- em.persist(sm);
- et.commit();
- setChanged();
- notifyObservers(OPERATION_STATE);
-
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement: enableNoDependency() operation completed, resourceName = {}", this.resourceName);
- }
- } catch(final Exception ex) {
- logger.error("StateManagement.enableNoDependency() caught unexpected exception: ", ex);
- throw new StateManagementException("StateManagement.enableNoDependency() Exception: " + ex);
- }
- }
- }
-
- /**
- * promote() changes the standby status to providingservice if not otherwise failed.
- * @throws StandbyStatusException
- * @throws StateManagementException
- */
- public void promote() throws IntegrityMonitorException
- {
- synchronized (SYNCLOCK){
- if(logger.isDebugEnabled()){
- logger.debug("\nStateManagement: SYNCLOCK promote() operation for resourceName = {}\n", this.resourceName);
- logger.debug("StateManagement: promote() operation started, resourceName = {}", this.resourceName);
- }
-
- StateManagementEntity sm;
-
- final EntityManager em = emf.createEntityManager();
-
- try(EntityMgrCloser emc = new EntityMgrCloser(em);
- MyTransaction et = new MyTransaction(em)) {
-
- if(logger.isDebugEnabled()){
- logger.debug("findStateManagementEntity for {}", this.resourceName);
- }
- sm = findStateManagementEntity(em, this.resourceName);
- final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
- sm.getAvailStatus(), sm.getStandbyStatus(), PROMOTE);
- // set transition state
- sm.setAdminState(stateElement.getEndingAdminState());
- sm.setOpState(stateElement.getEndingOpState());
- sm.setAvailStatus(stateElement.getEndingAvailStatus());
- sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
-
- em.persist(sm);
- et.commit();
- setChanged();
- notifyObservers(STANDBY_STATUS);
- }catch(final Exception ex){
- logger.error("StateManagement.promote() caught unexpected exception: ", ex);
- throw new StateManagementException("StateManagement.promote() Exception: " + ex);
- }
-
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement: promote() operation completed, resourceName = ", this.resourceName);
- }
- if (sm.getStandbyStatus().equals(StateManagement.COLD_STANDBY)){
- final String msg = "Failure to promote " + this.resourceName + " StandbyStatus = " + StateManagement.COLD_STANDBY;
- throw new StandbyStatusException(msg);
- }
- }
- }
-
- /**
- * demote() changes standbystatus to hotstandby or, if failed, coldstandby
- * @throws StateManagementException
- */
- public void demote() throws StateManagementException
- {
- synchronized (SYNCLOCK){
- if(logger.isDebugEnabled()){
- logger.debug("\nStateManagement: SYNCLOCK demote() operation for resourceName = \n", this.resourceName);
- logger.debug("StateManagement: demote() operation started, resourceName = {}", this.resourceName);
- }
- final EntityManager em = emf.createEntityManager();
-
- try(EntityMgrCloser emc = new EntityMgrCloser(em);
- MyTransaction et = new MyTransaction(em)) {
-
- if(logger.isDebugEnabled()){
- logger.debug("findStateManagementEntity for {}", this.resourceName);
- }
- final StateManagementEntity sm = findStateManagementEntity(em, this.resourceName);
- final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
- sm.getAvailStatus(), sm.getStandbyStatus(), DEMOTE);
- // set transition state
- sm.setAdminState(stateElement.getEndingAdminState());
- sm.setOpState(stateElement.getEndingOpState());
- sm.setAvailStatus(stateElement.getEndingAvailStatus());
- sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
-
- em.persist(sm);
- et.commit();
- setChanged();
- notifyObservers(STANDBY_STATUS);
-
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement: demote() operation completed, resourceName = {}", this.resourceName);
- }
- } catch(final Exception ex) {
- logger.error("StateManagement.demote() caught unexpected exception: ", ex);
- throw new StateManagementException("StateManagement.demote() Exception: " + ex);
- }
- }
- }
-
- /**
- *
- * Only used for a remote resource. It will not notify observers. It is used only in cases where
- * the remote resource has failed is such a way that it cannot update its own states. In particular
- * this is observed by PDP-D DroolsPdpsElectionHandler when it is trying to determine which PDP-D should
- * be designated as the lead.
- * @param otherResourceName
- * @throws StateManagementException
- */
- public void demote(final String otherResourceName) throws StateManagementException
- {
- synchronized (SYNCLOCK){
- if(otherResourceName==null){
- logger.error("\nStateManagement: SYNCLOCK demote(otherResourceName) operation: resourceName is NULL.\n");
- return;
- }
- if(logger.isDebugEnabled()){
- logger.debug("\nStateManagement: SYNCLOCK demote(otherResourceName) operation for resourceName = {}\n", otherResourceName);
- }
- final EntityManager em = emf.createEntityManager();
-
- try(EntityMgrCloser emc = new EntityMgrCloser(em);
- MyTransaction et = new MyTransaction(em)) {
-
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement: SYNCLOCK demote(otherResourceName) findStateManagementEntity for {}", otherResourceName);
- }
- final StateManagementEntity sm = findStateManagementEntity(em, otherResourceName);
- final StateElement stateElement = st.getEndingState(sm.getAdminState(), sm.getOpState(),
- sm.getAvailStatus(), sm.getStandbyStatus(), DEMOTE);
- // set transition state
- sm.setAdminState(stateElement.getEndingAdminState());
- sm.setOpState(stateElement.getEndingOpState());
- sm.setAvailStatus(stateElement.getEndingAvailStatus());
- sm.setStandbyStatus(stateElement.getEndingStandbyStatus());
-
- em.persist(sm);
- et.commit();
- //We don't notify observers because this is assumed to be a remote resource
-
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement: demote(otherResourceName) operation completed, resourceName = {}", otherResourceName);
- }
- } catch(final Exception ex) {
- logger.error("StateManagement.demote(otherResourceName) caught unexpected exception: ", ex);
- throw new StateManagementException("StateManagement.demote(otherResourceName) Exception: " + ex);
- }
- }
- }
-
- /**
- * @return
- */
-public String getAdminState()
- {
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement(6/1/16): getAdminState for resourceName {}", this.resourceName);
- }
-
- final EntityManager em = emf.createEntityManager();
- try(final EntityMgrCloser emc = new EntityMgrCloser(em)) {
- final TypedQuery<StateManagementEntity> query = em.createQuery(GET_STATE_MANAGEMENT_ENTITY_QUERY, StateManagementEntity.class);
-
- query.setParameter(RESOURCE_NAME, this.resourceName);
-
- //Just test that we are retrieving the right object
- final
- List<StateManagementEntity> resourceList = query.setLockMode(
- LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
- if (!resourceList.isEmpty()) {
- // exist
- final StateManagementEntity stateManagementEntity = resourceList.get(0);
- // refresh the object from DB in case cached data was returned
- em.refresh(stateManagementEntity);
- this.adminState = stateManagementEntity.getAdminState();
- } else {
- this.adminState = null;
- }
- } catch(final Exception ex) {
- logger.error("StateManagement: getAdminState exception: {}", ex.toString(), ex);
- }
-
- return this.adminState;
- }
-
- /**
- * @return
- */
-public String getOpState()
- {
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement(6/1/16): getOpState for resourceName {}", this.resourceName);
- }
-
- final EntityManager em = emf.createEntityManager();
- try(EntityMgrCloser emc = new EntityMgrCloser(em)) {
- final TypedQuery<StateManagementEntity> query = em.createQuery(GET_STATE_MANAGEMENT_ENTITY_QUERY, StateManagementEntity.class);
-
- query.setParameter(RESOURCE_NAME, this.resourceName);
-
- //Just test that we are retrieving the right object
- final
- List<StateManagementEntity> resourceList = query.setLockMode(
- LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
- if (!resourceList.isEmpty()) {
- // exist
- final StateManagementEntity stateManagementEntity = resourceList.get(0);
- // refresh the object from DB in case cached data was returned
- em.refresh(stateManagementEntity);
- this.opState = stateManagementEntity.getOpState();
- } else {
- this.opState = null;
- }
- } catch(final Exception ex) {
- logger.error("StateManagement: getOpState exception: {}", ex.toString(), ex);
- }
-
- return this.opState;
- }
-
- /**
- * @return
- */
- public String getAvailStatus()
- {
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement(6/1/16): getAvailStatus for resourceName {}", this.resourceName);
- }
-
- final EntityManager em = emf.createEntityManager();
- try(EntityMgrCloser emc = new EntityMgrCloser(em)) {
- final TypedQuery<StateManagementEntity> query = em.createQuery(GET_STATE_MANAGEMENT_ENTITY_QUERY, StateManagementEntity.class);
-
- query.setParameter(RESOURCE_NAME, this.resourceName);
-
- //Just test that we are retrieving the right object
- final
- List<StateManagementEntity> resourceList = query.setLockMode(
- LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
- if (!resourceList.isEmpty()) {
- // exist
- final StateManagementEntity stateManagementEntity = resourceList.get(0);
- // refresh the object from DB in case cached data was returned
- em.refresh(stateManagementEntity);
- this.availStatus = stateManagementEntity.getAvailStatus();
- } else {
- this.availStatus = null;
- }
- } catch(final Exception ex) {
- logger.error("StateManagement: getAvailStatus exception: {}", ex.toString(), ex);
- }
-
- return this.availStatus;
- }
-
- /**
- * @return
- */
- public String getStandbyStatus()
- {
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement(6/1/16): getStandbyStatus for resourceName {}", this.resourceName);
- }
-
- final EntityManager em = emf.createEntityManager();
- try(EntityMgrCloser emc = new EntityMgrCloser(em)) {
- final TypedQuery<StateManagementEntity> query = em.createQuery(GET_STATE_MANAGEMENT_ENTITY_QUERY, StateManagementEntity.class);
-
- query.setParameter(RESOURCE_NAME, this.resourceName);
-
- //Just test that we are retrieving the right object
- final
- List<StateManagementEntity> resourceList = query.setLockMode(
- LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
- if (!resourceList.isEmpty()) {
- // exist
- final StateManagementEntity stateManagementEntity = resourceList.get(0);
- // refresh the object from DB in case cached data was returned
- em.refresh(stateManagementEntity);
- this.standbyStatus = stateManagementEntity.getStandbyStatus();
- } else {
- this.standbyStatus = null;
- }
- } catch(final Exception ex) {
- logger.error("StateManagement: getStandbyStatus exception: {}", ex.toString(), ex);
- }
-
- return this.standbyStatus;
- }
-
- /**
- * Find a StateManagementEntity
- * @param em
- * @param otherResourceName
- * @return
- */
- private static StateManagementEntity findStateManagementEntity(final EntityManager em, final String otherResourceName)
- {
- if(logger.isDebugEnabled()){
- logger.debug("StateManagementEntity: findStateManagementEntity: Entry");
- }
- try {
- final TypedQuery<StateManagementEntity> query =
- em.createQuery(GET_STATE_MANAGEMENT_ENTITY_QUERY, StateManagementEntity.class);
-
- query.setParameter(RESOURCE_NAME, otherResourceName);
-
- //Just test that we are retrieving the right object
- final
- List<StateManagementEntity> resourceList = query.setLockMode(
- LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
- if (!resourceList.isEmpty()) {
- // exist
- final StateManagementEntity stateManagementEntity = resourceList.get(0);
- // refresh the object from DB in case cached data was returned
- em.refresh(stateManagementEntity);
- stateManagementEntity.setModifiedDate(new Date());
- return stateManagementEntity;
- } else {
- // not exist - create one
- final StateManagementEntity stateManagementEntity = new StateManagementEntity();
- stateManagementEntity.setResourceName(otherResourceName);
- stateManagementEntity.setAdminState(UNLOCKED);
- stateManagementEntity.setOpState(ENABLED);
- stateManagementEntity.setAvailStatus(NULL_VALUE);
- stateManagementEntity.setStandbyStatus(NULL_VALUE); // default
- return stateManagementEntity;
- }
- } catch(final Exception ex) {
- final String message = "findStateManagementEntity exception";
- logger.error("{}: {}", message, ex.toString(), ex);
- throw new EntityRetrievalException(message, ex);
- }
- }
-
- /**
- * Get the standbystatus of a particular resource
- * @param otherResourceName
- * @return
- */
- public String getStandbyStatus(final String otherResourceName) {
-
- if (logger.isDebugEnabled()) {
- logger.debug("StateManagement: getStandbyStatus: Entering, resourceName='{}'", otherResourceName);
- }
-
- String tempStandbyStatus = null;
-
- // The transaction is required for the LockModeType
- final EntityManager em = emf.createEntityManager();
-
- try(EntityMgrCloser emc = new EntityMgrCloser(em);
- MyTransaction et = new MyTransaction(em)) {
-
- final TypedQuery<StateManagementEntity> stateManagementListQuery = em
- .createQuery(GET_STATE_MANAGEMENT_ENTITY_QUERY, StateManagementEntity.class);
- stateManagementListQuery.setParameter(RESOURCE_NAME, otherResourceName);
- final List<StateManagementEntity> stateManagementList = stateManagementListQuery.setLockMode(
- LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
- if (!stateManagementList.isEmpty()) {
- final StateManagementEntity stateManagementEntity = stateManagementList.get(0);
- // refresh the object from DB in case cached data was returned
- em.refresh(stateManagementEntity);
- tempStandbyStatus = stateManagementEntity.getStandbyStatus();
- if (logger.isDebugEnabled()) {
- logger.debug("getStandbyStatus: resourceName ={} has standbyStatus={}", otherResourceName, tempStandbyStatus);
- }
- } else {
- logger.error("getStandbyStatus: resourceName ={} not found in statemanagemententity table", otherResourceName);
- }
-
- et.commit();
- } catch (final Exception e) {
- logger.error("getStandbyStatus: Caught Exception attempting to get statemanagemententity record, message='{}'", e.getMessage(), e);
- }
- if (logger.isDebugEnabled()) {
- logger.debug("getStandbyStatus: Returning standbyStatus={}", tempStandbyStatus);
- }
-
- return tempStandbyStatus;
- }
-
- /**
- * Clean up all the StateManagementEntities
- */
- public void deleteAllStateManagementEntities() {
-
- if(logger.isDebugEnabled()){
- logger.debug("StateManagement: deleteAllStateManagementEntities: Entering");
- }
-
- /*
- * Start transaction
- */
- final EntityManager em = emf.createEntityManager();
-
- try(EntityMgrCloser emc = new EntityMgrCloser(em);
- MyTransaction et = new MyTransaction(em)) {
- final TypedQuery<StateManagementEntity> stateManagementEntityListQuery = em
- .createQuery("SELECT p FROM StateManagementEntity p", StateManagementEntity.class);
- final
- List<StateManagementEntity> stateManagementEntityList = stateManagementEntityListQuery.setLockMode(
- LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
- if(logger.isDebugEnabled()){
- logger.debug("deleteAllStateManagementEntities: Deleting {} StateManagementEntity records", stateManagementEntityList.size());
- }
- for (final StateManagementEntity stateManagementEntity : stateManagementEntityList) {
- if(logger.isDebugEnabled()){
- logger.debug("deleteAllStateManagementEntities: Deleting statemanagemententity with resourceName={} and standbyStatus={}",
- stateManagementEntity.getResourceName(),
- stateManagementEntity.getStandbyStatus());
- }
- em.remove(stateManagementEntity);
- }
-
- et.commit();
- }catch(final Exception ex){
- logger.error("StateManagement.deleteAllStateManagementEntities() caught Exception: ", ex);
- }
- if(logger.isDebugEnabled()){
- logger.debug("deleteAllStateManagementEntities: Exiting");
- }
- }
-
- private static class MyTransaction extends EntityTransCloser {
-
- /**
- * @param em
- */
- public MyTransaction(final EntityManager em) {
- super(em.getTransaction());
- }
-
- @Override
- public void commit() {
- synchronized(FLUSHLOCK){
- if(getTransation().isActive()){
- super.commit();
- }
- }
- }
-
- @Override
- public void rollback() {
- synchronized(FLUSHLOCK){
- if(getTransation().isActive()){
- super.rollback();
- }
- }
- }
-
- }
+ } catch (final Exception e) {
+ logger.error(
+ "getStandbyStatus: Caught Exception attempting to get statemanagemententity record, message='{}'",
+ e.getMessage(), e);
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("getStandbyStatus: Returning standbyStatus={}", tempStandbyStatus);
+ }
+
+ return tempStandbyStatus;
+ }
+
+ /**
+ * Find a StateManagementEntity.
+ *
+ * @param em the entity manager
+ * @param otherResourceName the resource name
+ * @return the StateManagementEntity
+ */
+ private static StateManagementEntity findStateManagementEntity(final EntityManager em,
+ final String otherResourceName) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagementEntity: findStateManagementEntity: Entry");
+ }
+ try {
+ final TypedQuery<StateManagementEntity> query =
+ em.createQuery(GET_STATE_MANAGEMENT_ENTITY_QUERY, StateManagementEntity.class);
+
+ query.setParameter(RESOURCE_NAME, otherResourceName);
+
+ // Just test that we are retrieving the right object
+ final List<StateManagementEntity> resourceList =
+ query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ if (!resourceList.isEmpty()) {
+ // exist
+ final StateManagementEntity stateManagementEntity = resourceList.get(0);
+ // refresh the object from DB in case cached data was returned
+ em.refresh(stateManagementEntity);
+ stateManagementEntity.setModifiedDate(new Date());
+ return stateManagementEntity;
+ } else {
+ // not exist - create one
+ final StateManagementEntity stateManagementEntity = new StateManagementEntity();
+ stateManagementEntity.setResourceName(otherResourceName);
+ stateManagementEntity.setAdminState(UNLOCKED);
+ stateManagementEntity.setOpState(ENABLED);
+ stateManagementEntity.setAvailStatus(NULL_VALUE);
+ stateManagementEntity.setStandbyStatus(NULL_VALUE); // default
+ return stateManagementEntity;
+ }
+ } catch (final Exception ex) {
+ final String message = "findStateManagementEntity exception";
+ logger.error("{}: {}", message, ex.toString(), ex);
+ throw new EntityRetrievalException(message, ex);
+ }
+ }
+
+ /**
+ * Clean up all the StateManagementEntities.
+ */
+ public void deleteAllStateManagementEntities() {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateManagement: deleteAllStateManagementEntities: Entering");
+ }
+
+ /*
+ * Start transaction
+ */
+ final EntityManager em = emf.createEntityManager();
+
+ try (EntityMgrCloser emc = new EntityMgrCloser(em); MyTransaction et = new MyTransaction(em)) {
+ final TypedQuery<StateManagementEntity> stateManagementEntityListQuery =
+ em.createQuery("SELECT p FROM StateManagementEntity p", StateManagementEntity.class);
+ final List<StateManagementEntity> stateManagementEntityList = stateManagementEntityListQuery
+ .setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ if (logger.isDebugEnabled()) {
+ logger.debug("deleteAllStateManagementEntities: Deleting {} StateManagementEntity records",
+ stateManagementEntityList.size());
+ }
+ for (final StateManagementEntity stateManagementEntity : stateManagementEntityList) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(
+ "deleteAllStateManagementEntities: Deleting statemanagemententity with resourceName={} and"
+ + " standbyStatus={}",
+ stateManagementEntity.getResourceName(), stateManagementEntity.getStandbyStatus());
+ }
+ em.remove(stateManagementEntity);
+ }
+
+ et.commit();
+ } catch (final Exception ex) {
+ logger.error("StateManagement.deleteAllStateManagementEntities() caught Exception: ", ex);
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("deleteAllStateManagementEntities: Exiting");
+ }
+ }
+
+ private static class MyTransaction extends EntityTransCloser {
+
+ /**
+ * Create an instance.
+ *
+ * @param em the entity manager
+ */
+ public MyTransaction(final EntityManager em) {
+ super(em.getTransaction());
+ }
+
+ @Override
+ public void commit() {
+ synchronized (FLUSHLOCK) {
+ if (getTransation().isActive()) {
+ super.commit();
+ }
+ }
+ }
+
+ @Override
+ public void rollback() {
+ synchronized (FLUSHLOCK) {
+ if (getTransation().isActive()) {
+ super.rollback();
+ }
+ }
+ }
+
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java
index 99c092d0..6ff869f4 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java
@@ -20,11 +20,11 @@
package org.onap.policy.common.im;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
-
-import org.onap.policy.common.im.StateElement;
-import org.onap.policy.common.im.StateManagement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -32,712 +32,914 @@ import org.slf4j.LoggerFactory;
* The StateTransition class coordinates all state transitions.
*/
public class StateTransition {
- private static final Logger logger = LoggerFactory.getLogger(StateTransition.class);
-
- public static final String ADMIN_STATE = "adminState";
- public static final String OPERATION_STATE = "opState";
- public static final String AVAILABLE_STATUS= "availStatus";
- public static final String STANDBY_STATUS = "standbyStatus";
- public static final String ACTOIN_NAME = "actionName";
-
- private HashMap<String, String> StateTable = new HashMap<>();
-
- /**
- * StateTransition constructor
- * @throws StateTransitionException
- */
- public StateTransition() throws StateTransitionException
- {
- if(logger.isDebugEnabled()){
- logger.debug("StateTransition constructor");
- }
+ private static final Logger logger = LoggerFactory.getLogger(StateTransition.class);
+
+ public static final String ADMIN_STATE = "adminState";
+ public static final String OPERATION_STATE = "opState";
+ public static final String AVAILABLE_STATUS = "availStatus";
+ public static final String STANDBY_STATUS = "standbyStatus";
+ public static final String ACTOIN_NAME = "actionName";
+
+ private HashMap<String, String> stateTable = new HashMap<>();
+
+ /**
+ * StateTransition constructor.
+ *
+ * @throws StateTransitionException if an error occurs
+ */
+ public StateTransition() throws StateTransitionException {
+ if (logger.isDebugEnabled()) {
+ logger.debug("StateTransition constructor");
+ }
+
+ try {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Load StateTable started");
+ }
+
+ setupStateTable();
+ } catch (Exception ex) {
+ logger.error("StateTransition threw exception.", ex);
+ throw new StateTransitionException("StateTransition Exception: " + ex.toString());
+ }
+ }
+
+ /**
+ * Calculates the state transition and returns the end state.
+ *
+ * @param adminState the administration state
+ * @param opState the operational state
+ * @param availStatus the availability status
+ * @param standbyStatus the standby status
+ * @param actionName the action name
+ * @return the StateEement
+ * @throws StateTransitionException if an error occurs
+ */
+ public StateElement getEndingState(String adminState, String opState, String availStatus, String standbyStatus,
+ String actionName) throws StateTransitionException {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getEndingState");
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("adminState=[{}], opState=[{}], availStatus=[{}], standbyStatus=[{}], actionName[{}]",
+ adminState, opState, availStatus, standbyStatus, actionName);
+ }
+ if (availStatus == null) {
+ availStatus = "null";
+ }
+ if (standbyStatus == null) {
+ standbyStatus = "null";
+ }
+ if (adminState == null || opState == null || actionName == null) {
+ throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=["
+ + adminState + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=["
+ + standbyStatus + "], actionName=[" + actionName + "]");
+ } else if (!(adminState.equals(StateManagement.LOCKED) || adminState.equals(StateManagement.UNLOCKED))) {
+ throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=["
+ + adminState + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=["
+ + standbyStatus + "], actionName=[" + actionName + "]");
+ } else if (!(opState.equals(StateManagement.ENABLED) || opState.equals(StateManagement.DISABLED))) {
+ throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=["
+ + adminState + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=["
+ + standbyStatus + "], actionName=[" + actionName + "]");
+ } else if (!(standbyStatus.equals(StateManagement.NULL_VALUE)
+ || standbyStatus.equals(StateManagement.COLD_STANDBY)
+ || standbyStatus.equals(StateManagement.HOT_STANDBY)
+ || standbyStatus.equals(StateManagement.PROVIDING_SERVICE))) {
+ throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=["
+ + adminState + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=["
+ + standbyStatus + "], actionName=[" + actionName + "]");
+ } else if (!(availStatus.equals(StateManagement.NULL_VALUE) || availStatus.equals(StateManagement.DEPENDENCY)
+ || availStatus.equals(StateManagement.DEPENDENCY_FAILED)
+ || availStatus.equals(StateManagement.FAILED))) {
+ throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=["
+ + adminState + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=["
+ + standbyStatus + "], actionName=[" + actionName + "]");
+ } else if (!(actionName.equals(StateManagement.DEMOTE) || actionName.equals(StateManagement.DISABLE_DEPENDENCY)
+ || actionName.equals(StateManagement.DISABLE_FAILED)
+ || actionName.equals(StateManagement.ENABLE_NO_DEPENDENCY)
+ || actionName.equals(StateManagement.ENABLE_NOT_FAILED) || actionName.equals(StateManagement.LOCK)
+ || actionName.equals(StateManagement.PROMOTE) || actionName.equals(StateManagement.UNLOCK))) {
+ throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=["
+ + adminState + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=["
+ + standbyStatus + "], actionName=[" + actionName + "]");
+ }
+
+ StateElement stateElement = new StateElement();
+ try {
+ // dependency,failed is stored as dependency.failed in StateTable
+ String availStatus2 = availStatus;
+ if (availStatus2 != null) {
+ availStatus2 = availStatus.replace(",", ".");
+ }
+ String key = adminState + "," + opState + "," + availStatus2 + "," + standbyStatus + "," + actionName;
+ if (logger.isDebugEnabled()) {
+ logger.debug("Ending State search key: {}", key);
+ }
+ String value = stateTable.get(key);
+
+ if (value != null) {
+ try {
+ String[] parts = value.split(",", 5);
+ stateElement.setEndingAdminState(parts[0].trim());
+ stateElement.setEndingOpState(parts[1].trim());
+ stateElement.setEndingAvailStatus(parts[2].trim().replace(".", ","));
+ stateElement.setEndingStandbyStatus(parts[3].trim());
+ stateElement.setException(parts[4].trim());
+ stateElement.setAdminState(adminState);
+ stateElement.setOpState(opState);
+ stateElement.setAvailStatus(availStatus);
+ stateElement.setStandbyStatus(standbyStatus);
+ stateElement.setActionName(actionName);
+
+ stateElement.displayStateElement();
+ } catch (Exception ex) {
+ logger.error("String split exception: {}", ex.toString(), ex);
+ }
+
+ } else {
+ String msg = "Ending state not found, adminState=[" + adminState + "], opState=[" + opState
+ + "], availStatus=[" + availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=["
+ + actionName + "]";
+ logger.error("{}", msg);
+ throw new StateTransitionException(msg);
+ }
+ } catch (Exception ex) {
+ logger.error("StateTransition threw exception.", ex);
+ throw new StateTransitionException("Exception: " + ex.toString() + ", adminState=[" + adminState
+ + "], opState=[" + opState + "], availStatus=[" + availStatus + "], standbyStatus=[" + standbyStatus
+ + "], actionName=[" + actionName + "]");
+ }
+
+ return stateElement;
+ }
+
+ /**
+ * Adding State Transition info into HashMap. It includes all state/status and action
+ * combinations key : adminState,opState,availStatus,standbyStatus,actionName value:
+ * endingAdminState,endingOpState,endingAvailStatus,endingStandbyStatus,exception Note : Use
+ * period instead of comma as seperator when store multi-value endingStandbyStatus (convert to
+ * comma during retrieval)
+ *
+ * <p>Note on illegal state/status combinations: This table has many state/status combinations
+ * that should never occur. However, they *may* occur due to corruption or manual manipulation
+ * of the DB. So, in each case of an illegal combination, the state/status is first corrected
+ * before applying the action. It is assumed that the administrative and operational states are
+ * always correct. Second, if the availability status is in "agreement" with the operational
+ * state, it is assumed correct. If it is null and the operational state is disabled, the
+ * availability status is left null until a disabledfailed or disableddependency action is
+ * received. Or, if a enableNotFailed or enableNoDependency is received while the availability
+ * status is null, it will remain null, but the Operational state will change to enabled.
+ *
+ * <p>If the standby status is not in agreement with the administrative and/or operational
+ * states, it is brought into agreement. For example, if the administrative state is locked and
+ * the standby status is providingservice, the standby status is changed to coldstandby.
+ *
+ * <p>After bringing the states/status attributes into agreement, *then* the action is applied
+ * to them. For example, if the administrative state is locked, the operational state is
+ * enabled, the availability status is null, the standby status is providingservice and the
+ * action is unlock, the standby status is changed to coldstandby and then the unlock action is
+ * applied. This will change the final state/status to administrative state = unlocked,
+ * operational state = disabled, availability status = null and standby status = hotstandby.
+ *
+ * <p>Note on standby status: If the starting state of standby status is null and either a
+ * promote or demote action is made, the assumption is that standbystatus is supported and
+ * therefore, the standby status will be changed to providingservice, hotstandby or coldstandby
+ * - depending on the value of the administrative and operational states. If an attempt to
+ * promote is made when the administrative state is locked or operational state is disabled, a
+ * StandbyStatusException will be thrown since promotion (state transition) is not possible. If
+ * the standby status is coldstandby and a transition occurs on the administrative or
+ * operational state such that they are unlocked and enabled, the standby status is
+ * automatically transitioned to hotstandby since it is only those two states that can hold the
+ * statndby status in the coldstandby value.
+ */
- try {
- if(logger.isDebugEnabled()){
- logger.debug("Load StateTable started");
- }
-
- setupStateTable();
- } catch(Exception ex) {
- logger.error("StateTransition threw exception.", ex);
- throw new StateTransitionException("StateTransition Exception: " + ex.toString());
- }
- }
-
- /**
- * Calculates the state transition and returns the end state
- * @param adminState
- * @param opState
- * @param availStatus
- * @param standbyStatus
- * @param actionName
- * @return
- * @throws StateTransitionException
- */
- public StateElement getEndingState(String adminState, String opState, String availStatus,
- String standbyStatus, String actionName) throws StateTransitionException
- {
- if(logger.isDebugEnabled()){
- logger.debug("getEndingState");
- }
- if(logger.isDebugEnabled()){
- logger.debug("adminState=[{}], opState=[{}], availStatus=[{}], standbyStatus=[{}], actionName[{}]",
- adminState,
- opState,
- availStatus,
- standbyStatus,
- actionName);
- }
- if(availStatus==null){
- availStatus="null";
- }
- if(standbyStatus==null){
- standbyStatus="null";
- }
- if(adminState==null || opState==null || actionName==null){
- throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=[" + adminState + "], opState=[" + opState + "], availStatus=[" +
- availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=[" + actionName + "]");
- }else if(!(adminState.equals(StateManagement.LOCKED) || adminState.equals(StateManagement.UNLOCKED))){
- throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=[" + adminState + "], opState=[" + opState + "], availStatus=[" +
- availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=[" + actionName + "]");
- }else if(!(opState.equals(StateManagement.ENABLED) || opState.equals(StateManagement.DISABLED))){
- throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=[" + adminState + "], opState=[" + opState + "], availStatus=[" +
- availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=[" + actionName + "]");
- }else if(!(standbyStatus.equals(StateManagement.NULL_VALUE) ||
- standbyStatus.equals(StateManagement.COLD_STANDBY) ||
- standbyStatus.equals(StateManagement.HOT_STANDBY) ||
- standbyStatus.equals(StateManagement.PROVIDING_SERVICE))){
- throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=[" + adminState + "], opState=[" + opState + "], availStatus=[" +
- availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=[" + actionName + "]");
- }else if(!(availStatus.equals(StateManagement.NULL_VALUE) ||
- availStatus.equals(StateManagement.DEPENDENCY) ||
- availStatus.equals(StateManagement.DEPENDENCY_FAILED) ||
- availStatus.equals(StateManagement.FAILED))){
- throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=[" + adminState + "], opState=[" + opState + "], availStatus=[" +
- availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=[" + actionName + "]");
- }
- else if(!(actionName.equals(StateManagement.DEMOTE) ||
- actionName.equals(StateManagement.DISABLE_DEPENDENCY) ||
- actionName.equals(StateManagement.DISABLE_FAILED) ||
- actionName.equals(StateManagement.ENABLE_NO_DEPENDENCY) ||
- actionName.equals(StateManagement.ENABLE_NOT_FAILED) ||
- actionName.equals(StateManagement.LOCK) ||
- actionName.equals(StateManagement.PROMOTE) ||
- actionName.equals(StateManagement.UNLOCK))){
- throw new StateTransitionException("Exception:StateTransition unable to process state: adminState=[" + adminState + "], opState=[" + opState + "], availStatus=[" +
- availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=[" + actionName + "]");
- }
+ private void setupStateTable() {
+ stateTable.put("unlocked,enabled,null,null,lock", "locked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,null,null,unlock", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,null,null,disableFailed", "unlocked,disabled,failed,null,");
+ stateTable.put("unlocked,enabled,null,null,enableNotFailed", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,null,null,disableDependency", "unlocked,disabled,dependency,null,");
+ stateTable.put("unlocked,enabled,null,null,enableNoDependency", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,null,null,promote", "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,null,null,demote", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,null,coldstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("unlocked,enabled,null,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,null,coldstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,enabled,null,coldstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,null,coldstandby,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,enabled,null,coldstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,null,coldstandby,promote", "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,null,coldstandby,demote", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,null,hotstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("unlocked,enabled,null,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,null,hotstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,enabled,null,hotstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,null,hotstandby,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,enabled,null,hotstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,null,hotstandby,promote", "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,null,hotstandby,demote", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,null,providingservice,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("unlocked,enabled,null,providingservice,unlock", "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,null,providingservice,disableFailed", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,enabled,null,providingservice,enableNotFailed",
+ "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,null,providingservice,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,enabled,null,providingservice,enableNoDependency",
+ "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,null,providingservice,promote", "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,null,providingservice,demote", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,failed,null,lock", "locked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,failed,null,unlock", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,failed,null,disableFailed", "unlocked,disabled,failed,null,");
+ stateTable.put("unlocked,enabled,failed,null,enableNotFailed", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,failed,null,disableDependency", "unlocked,disabled,dependency,null,");
+ stateTable.put("unlocked,enabled,failed,null,enableNoDependency", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,failed,null,promote", "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,failed,null,demote", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,failed,coldstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("unlocked,enabled,failed,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,failed,coldstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,enabled,failed,coldstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,failed,coldstandby,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,enabled,failed,coldstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,failed,coldstandby,promote", "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,failed,coldstandby,demote", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,failed,hotstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("unlocked,enabled,failed,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,failed,hotstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,enabled,failed,hotstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,failed,hotstandby,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,enabled,failed,hotstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,failed,hotstandby,promote", "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,failed,hotstandby,demote", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,failed,providingservice,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("unlocked,enabled,failed,providingservice,unlock", "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,failed,providingservice,disableFailed",
+ "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,enabled,failed,providingservice,enableNotFailed",
+ "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,failed,providingservice,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,enabled,failed,providingservice,enableNoDependency",
+ "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,failed,providingservice,promote", "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,failed,providingservice,demote", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency,null,lock", "locked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,dependency,null,unlock", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,dependency,null,disableFailed", "unlocked,disabled,failed,null,");
+ stateTable.put("unlocked,enabled,dependency,null,enableNotFailed", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,dependency,null,disableDependency", "unlocked,disabled,dependency,null,");
+ stateTable.put("unlocked,enabled,dependency,null,enableNoDependency", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,dependency,null,promote", "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,dependency,null,demote", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency,coldstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency,coldstandby,disableFailed",
+ "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency,coldstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency,coldstandby,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency,coldstandby,enableNoDependency",
+ "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency,coldstandby,promote", "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,dependency,coldstandby,demote", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency,hotstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency,hotstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency,hotstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency,hotstandby,disableDependency",
+ "unlocked,disabled,dependency,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency,hotstandby,enableNoDependency",
+ "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency,hotstandby,promote", "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,dependency,hotstandby,demote", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency,providingservice,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency,providingservice,unlock",
+ "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,dependency,providingservice,disableFailed",
+ "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency,providingservice,enableNotFailed",
+ "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,dependency,providingservice,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency,providingservice,enableNoDependency",
+ "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,dependency,providingservice,promote",
+ "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,dependency,providingservice,demote", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,null,lock", "locked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,dependency.failed,null,unlock", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,dependency.failed,null,disableFailed", "unlocked,disabled,failed,null,");
+ stateTable.put("unlocked,enabled,dependency.failed,null,enableNotFailed", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,dependency.failed,null,disableDependency",
+ "unlocked,disabled,dependency,null,");
+ stateTable.put("unlocked,enabled,dependency.failed,null,enableNoDependency", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,enabled,dependency.failed,null,promote", "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,dependency.failed,null,demote", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,coldstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,coldstandby,disableFailed",
+ "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,coldstandby,enableNotFailed",
+ "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,coldstandby,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,coldstandby,enableNoDependency",
+ "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,coldstandby,promote",
+ "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,dependency.failed,coldstandby,demote", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,hotstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,hotstandby,disableFailed",
+ "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,hotstandby,enableNotFailed",
+ "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,hotstandby,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,hotstandby,enableNoDependency",
+ "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,hotstandby,promote",
+ "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,dependency.failed,hotstandby,demote", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,providingservice,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,providingservice,unlock",
+ "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,dependency.failed,providingservice,disableFailed",
+ "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,providingservice,enableNotFailed",
+ "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,dependency.failed,providingservice,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,enabled,dependency.failed,providingservice,enableNoDependency",
+ "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,dependency.failed,providingservice,promote",
+ "unlocked,enabled,null,providingservice,");
+ stateTable.put("unlocked,enabled,dependency.failed,providingservice,demote",
+ "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,disabled,null,null,lock", "locked,disabled,null,null,");
+ stateTable.put("unlocked,disabled,null,null,unlock", "unlocked,disabled,null,null,");
+ stateTable.put("unlocked,disabled,null,null,disableFailed", "unlocked,disabled,failed,null,");
+ stateTable.put("unlocked,disabled,null,null,enableNotFailed", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,disabled,null,null,disableDependency", "unlocked,disabled,dependency,null,");
+ stateTable.put("unlocked,disabled,null,null,enableNoDependency", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,disabled,null,null,promote",
+ "unlocked,disabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,null,null,demote", "unlocked,disabled,null,coldstandby,");
+ stateTable.put("unlocked,disabled,null,coldstandby,lock", "locked,disabled,null,coldstandby,");
+ stateTable.put("unlocked,disabled,null,coldstandby,unlock", "unlocked,disabled,null,coldstandby,");
+ stateTable.put("unlocked,disabled,null,coldstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,null,coldstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,disabled,null,coldstandby,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,null,coldstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,disabled,null,coldstandby,promote",
+ "unlocked,disabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,null,coldstandby,demote", "unlocked,disabled,null,coldstandby,");
+ stateTable.put("unlocked,disabled,null,hotstandby,lock", "locked,disabled,null,coldstandby,");
+ stateTable.put("unlocked,disabled,null,hotstandby,unlock", "unlocked,disabled,null,coldstandby,");
+ stateTable.put("unlocked,disabled,null,hotstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,null,hotstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,disabled,null,hotstandby,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,null,hotstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,disabled,null,hotstandby,promote",
+ "unlocked,disabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,null,hotstandby,demote", "unlocked,disabled,null,coldstandby,");
+ stateTable.put("unlocked,disabled,null,providingservice,lock", "locked,disabled,null,coldstandby,");
+ stateTable.put("unlocked,disabled,null,providingservice,unlock", "unlocked,disabled,null,coldstandby,");
+ stateTable.put("unlocked,disabled,null,providingservice,disableFailed",
+ "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,null,providingservice,enableNotFailed", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,disabled,null,providingservice,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,null,providingservice,enableNoDependency",
+ "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,disabled,null,providingservice,promote",
+ "unlocked,disabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,null,providingservice,demote", "unlocked,disabled,null,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,null,lock", "locked,disabled,failed,null,");
+ stateTable.put("unlocked,disabled,failed,null,unlock", "unlocked,disabled,failed,null,");
+ stateTable.put("unlocked,disabled,failed,null,disableFailed", "unlocked,disabled,failed,null,");
+ stateTable.put("unlocked,disabled,failed,null,enableNotFailed", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,disabled,failed,null,disableDependency", "unlocked,disabled,dependency.failed,null,");
+ stateTable.put("unlocked,disabled,failed,null,enableNoDependency", "unlocked,disabled,failed,null,");
+ stateTable.put("unlocked,disabled,failed,null,promote",
+ "unlocked,disabled,failed,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,failed,null,demote", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,coldstandby,lock", "locked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,coldstandby,unlock", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,coldstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,coldstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,disabled,failed,coldstandby,disableDependency",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,coldstandby,enableNoDependency",
+ "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,coldstandby,promote",
+ "unlocked,disabled,failed,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,failed,coldstandby,demote", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,hotstandby,lock", "locked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,hotstandby,unlock", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,hotstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,hotstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,disabled,failed,hotstandby,disableDependency",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,hotstandby,enableNoDependency",
+ "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,hotstandby,promote",
+ "unlocked,disabled,failed,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,failed,hotstandby,demote", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,providingservice,lock", "locked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,providingservice,unlock", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,providingservice,disableFailed",
+ "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,providingservice,enableNotFailed",
+ "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,disabled,failed,providingservice,disableDependency",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,providingservice,enableNoDependency",
+ "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,failed,providingservice,promote",
+ "unlocked,disabled,failed,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,failed,providingservice,demote", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,null,lock", "locked,disabled,dependency,null,");
+ stateTable.put("unlocked,disabled,dependency,null,unlock", "unlocked,disabled,dependency,null,");
+ stateTable.put("unlocked,disabled,dependency,null,disableFailed", "unlocked,disabled,dependency.failed,null,");
+ stateTable.put("unlocked,disabled,dependency,null,enableNotFailed", "unlocked,disabled,dependency,null,");
+ stateTable.put("unlocked,disabled,dependency,null,disableDependency", "unlocked,disabled,dependency,null,");
+ stateTable.put("unlocked,disabled,dependency,null,enableNoDependency", "unlocked,enabled,null,null,");
+ stateTable.put("unlocked,disabled,dependency,null,promote",
+ "unlocked,disabled,dependency,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,dependency,null,demote", "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,coldstandby,lock", "locked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,coldstandby,unlock", "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,coldstandby,disableFailed",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,coldstandby,enableNotFailed",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,coldstandby,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,coldstandby,enableNoDependency",
+ "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,disabled,dependency,coldstandby,promote",
+ "unlocked,disabled,dependency,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,dependency,coldstandby,demote", "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,hotstandby,lock", "locked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,hotstandby,unlock", "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,hotstandby,disableFailed",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,hotstandby,enableNotFailed",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,hotstandby,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,hotstandby,enableNoDependency",
+ "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,disabled,dependency,hotstandby,promote",
+ "unlocked,disabled,dependency,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,dependency,hotstandby,demote", "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,providingservice,lock", "locked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,providingservice,unlock",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,providingservice,disableFailed",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,providingservice,enableNotFailed",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,providingservice,disableDependency",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency,providingservice,enableNoDependency",
+ "unlocked,enabled,null,hotstandby,");
+ stateTable.put("unlocked,disabled,dependency,providingservice,promote",
+ "unlocked,disabled,dependency,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,dependency,providingservice,demote",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,null,lock", "locked,disabled,dependency.failed,null,");
+ stateTable.put("unlocked,disabled,dependency.failed,null,unlock", "unlocked,disabled,dependency.failed,null,");
+ stateTable.put("unlocked,disabled,dependency.failed,null,disableFailed",
+ "unlocked,disabled,dependency.failed,null,");
+ stateTable.put("unlocked,disabled,dependency.failed,null,enableNotFailed",
+ "unlocked,disabled,dependency,null,");
+ stateTable.put("unlocked,disabled,dependency.failed,null,disableDependency",
+ "unlocked,disabled,dependency.failed,null,");
+ stateTable.put("unlocked,disabled,dependency.failed,null,enableNoDependency", "unlocked,disabled,failed,null,");
+ stateTable.put("unlocked,disabled,dependency.failed,null,promote",
+ "unlocked,disabled,dependency.failed,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,dependency.failed,null,demote",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,coldstandby,lock",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,coldstandby,unlock",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,coldstandby,disableFailed",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,coldstandby,enableNotFailed",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,coldstandby,disableDependency",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,coldstandby,enableNoDependency",
+ "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,coldstandby,promote",
+ "unlocked,disabled,dependency.failed,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,dependency.failed,coldstandby,demote",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,hotstandby,lock",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,hotstandby,unlock",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,hotstandby,disableFailed",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,hotstandby,enableNotFailed",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,hotstandby,disableDependency",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,hotstandby,enableNoDependency",
+ "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,hotstandby,promote",
+ "unlocked,disabled,dependency.failed,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,dependency.failed,hotstandby,demote",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,providingservice,lock",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,providingservice,unlock",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,providingservice,disableFailed",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,providingservice,enableNotFailed",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,providingservice,disableDependency",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,providingservice,enableNoDependency",
+ "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("unlocked,disabled,dependency.failed,providingservice,promote",
+ "unlocked,disabled,dependency.failed,coldstandby,StandbyStatusException");
+ stateTable.put("unlocked,disabled,dependency.failed,providingservice,demote",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,enabled,null,null,lock", "locked,enabled,null,null,");
+ stateTable.put("locked,enabled,null,null,unlock", "unlocked,enabled,null,null,");
+ stateTable.put("locked,enabled,null,null,disableFailed", "locked,disabled,failed,null,");
+ stateTable.put("locked,enabled,null,null,enableNotFailed", "locked,enabled,null,null,");
+ stateTable.put("locked,enabled,null,null,disableDependency", "locked,disabled,dependency,null,");
+ stateTable.put("locked,enabled,null,null,enableNoDependency", "locked,enabled,null,null,");
+ stateTable.put("locked,enabled,null,null,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,enabled,null,null,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,null,coldstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,null,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("locked,enabled,null,coldstandby,disableFailed", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,enabled,null,coldstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,null,coldstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,enabled,null,coldstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,null,coldstandby,promote",
+ "locked,enabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,enabled,null,coldstandby,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,null,hotstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,null,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("locked,enabled,null,hotstandby,disableFailed", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,enabled,null,hotstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,null,hotstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,enabled,null,hotstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,null,hotstandby,promote",
+ "locked,enabled,null,coldstandby,StandbyStateException");
+ stateTable.put("locked,enabled,null,hotstandby,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,null,providingservice,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,null,providingservice,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("locked,enabled,null,providingservice,disableFailed", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,enabled,null,providingservice,enableNotFailed", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,null,providingservice,disableDependency",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,enabled,null,providingservice,enableNoDependency", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,null,providingservice,promote",
+ "locked,enabled,null,coldstandby,StandbyStateException");
+ stateTable.put("locked,enabled,null,providingservice,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,failed,null,lock", "locked,enabled,null,null,");
+ stateTable.put("locked,enabled,failed,null,unlock", "unlocked,enabled,null,null,");
+ stateTable.put("locked,enabled,failed,null,disableFailed", "locked,disabled,failed,null,");
+ stateTable.put("locked,enabled,failed,null,enableNotFailed", "locked,enabled,null,null,");
+ stateTable.put("locked,enabled,failed,null,disableDependency", "locked,disabled,dependency,null,");
+ stateTable.put("locked,enabled,failed,null,enableNoDependency", "locked,enabled,null,null,");
+ stateTable.put("locked,enabled,failed,null,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,enabled,failed,null,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,failed,coldstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,failed,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("locked,enabled,failed,coldstandby,disableFailed", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,enabled,failed,coldstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,failed,coldstandby,disableDependency",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,enabled,failed,coldstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,failed,coldstandby,promote",
+ "locked,enabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,enabled,failed,coldstandby,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,failed,hotstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,failed,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("locked,enabled,failed,hotstandby,disableFailed", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,enabled,failed,hotstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,failed,hotstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,enabled,failed,hotstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,failed,hotstandby,promote",
+ "locked,enabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,enabled,failed,hotstandby,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,failed,providingservice,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,failed,providingservice,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("locked,enabled,failed,providingservice,disableFailed", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,enabled,failed,providingservice,enableNotFailed", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,failed,providingservice,disableDependency",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,enabled,failed,providingservice,enableNoDependency", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,failed,providingservice,promote",
+ "locked,enabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,enabled,failed,providingservice,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency,null,lock", "locked,enabled,null,null,");
+ stateTable.put("locked,enabled,dependency,null,unlock", "unlocked,enabled,null,null,");
+ stateTable.put("locked,enabled,dependency,null,disableFailed", "locked,disabled,failed,null,");
+ stateTable.put("locked,enabled,dependency,null,enableNotFailed", "locked,enabled,null,null,");
+ stateTable.put("locked,enabled,dependency,null,disableDependency", "locked,disabled,dependency,null,");
+ stateTable.put("locked,enabled,dependency,null,enableNoDependency", "locked,enabled,null,null,");
+ stateTable.put("locked,enabled,dependency,null,promote",
+ "locked,enabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,enabled,dependency,null,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency,coldstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("locked,enabled,dependency,coldstandby,disableFailed", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,enabled,dependency,coldstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency,coldstandby,disableDependency",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,enabled,dependency,coldstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency,coldstandby,promote",
+ "locked,enabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,enabled,dependency,coldstandby,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency,hotstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("locked,enabled,dependency,hotstandby,disableFailed", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,enabled,dependency,hotstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency,hotstandby,disableDependency",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,enabled,dependency,hotstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency,hotstandby,promote",
+ "locked,enabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,enabled,dependency,hotstandby,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency,providingservice,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency,providingservice,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("locked,enabled,dependency,providingservice,disableFailed",
+ "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,enabled,dependency,providingservice,enableNotFailed",
+ "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency,providingservice,disableDependency",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,enabled,dependency,providingservice,enableNoDependency",
+ "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency,providingservice,promote",
+ "locked,enabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,enabled,dependency,providingservice,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,null,lock", "locked,enabled,null,null,");
+ stateTable.put("locked,enabled,dependency.failed,null,unlock", "unlocked,enabled,null,null,");
+ stateTable.put("locked,enabled,dependency.failed,null,disableFailed", "locked,disabled,failed,null,");
+ stateTable.put("locked,enabled,dependency.failed,null,enableNotFailed", "locked,enabled,null,null,");
+ stateTable.put("locked,enabled,dependency.failed,null,disableDependency", "locked,disabled,dependency,null,");
+ stateTable.put("locked,enabled,dependency.failed,null,enableNoDependency", "locked,enabled,null,null,");
+ stateTable.put("locked,enabled,dependency.failed,null,promote",
+ "locked,enabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,enabled,dependency.failed,null,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,coldstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("locked,enabled,dependency.failed,coldstandby,disableFailed",
+ "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,coldstandby,enableNotFailed",
+ "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,coldstandby,disableDependency",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,coldstandby,enableNoDependency",
+ "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,coldstandby,promote",
+ "locked,enabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,enabled,dependency.failed,coldstandby,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,hotstandby,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("locked,enabled,dependency.failed,hotstandby,disableFailed",
+ "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,hotstandby,enableNotFailed",
+ "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,hotstandby,disableDependency",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,hotstandby,enableNoDependency",
+ "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,hotstandby,promote",
+ "locked,enabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,enabled,dependency.failed,hotstandby,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,providingservice,lock", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,providingservice,unlock", "unlocked,enabled,null,hotstandby,");
+ stateTable.put("locked,enabled,dependency.failed,providingservice,disableFailed",
+ "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,providingservice,enableNotFailed",
+ "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,providingservice,disableDependency",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,providingservice,enableNoDependency",
+ "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,enabled,dependency.failed,providingservice,promote",
+ "locked,enabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,enabled,dependency.failed,providingservice,demote", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,null,lock", "locked,disabled,null,null,");
+ stateTable.put("locked,disabled,null,null,unlock", "unlocked,disabled,null,null,");
+ stateTable.put("locked,disabled,null,null,disableFailed", "locked,disabled,failed,null,");
+ stateTable.put("locked,disabled,null,null,enableNotFailed", "locked,enabled,null,null,");
+ stateTable.put("locked,disabled,null,null,disableDependency", "locked,disabled,dependency,null,");
+ stateTable.put("locked,disabled,null,null,enableNoDependency", "locked,enabled,null,null,");
+ stateTable.put("locked,disabled,null,null,promote", "locked,disabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,null,null,demote", "locked,disabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,coldstandby,lock", "locked,disabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,coldstandby,unlock", "unlocked,disabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,coldstandby,disableFailed", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,null,coldstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,coldstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,null,coldstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,coldstandby,promote",
+ "locked,disabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,null,coldstandby,demote", "locked,disabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,hotstandby,lock", "locked,disabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,hotstandby,unlock", "unlocked,disabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,hotstandby,disableFailed", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,null,hotstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,hotstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,null,hotstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,hotstandby,promote",
+ "locked,disabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,null,hotstandby,demote", "locked,disabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,providingservice,lock", "locked,disabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,providingservice,unlock", "unlocked,disabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,providingservice,disableFailed", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,null,providingservice,enableNotFailed", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,providingservice,disableDependency",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,null,providingservice,enableNoDependency", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,disabled,null,providingservice,promote",
+ "locked,disabled,null,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,null,providingservice,demote", "locked,disabled,null,coldstandby,");
+ stateTable.put("locked,disabled,failed,null,lock", "locked,disabled,failed,null,");
+ stateTable.put("locked,disabled,failed,null,unlock", "unlocked,disabled,failed,null,");
+ stateTable.put("locked,disabled,failed,null,disableFailed", "locked,disabled,failed,null,");
+ stateTable.put("locked,disabled,failed,null,enableNotFailed", "locked,enabled,null,null,");
+ stateTable.put("locked,disabled,failed,null,disableDependency", "locked,disabled,dependency.failed,null,");
+ stateTable.put("locked,disabled,failed,null,enableNoDependency", "locked,disabled,failed,null,");
+ stateTable.put("locked,disabled,failed,null,promote",
+ "locked,disabled,failed,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,failed,null,demote", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,coldstandby,lock", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,coldstandby,unlock", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,coldstandby,disableFailed", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,coldstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,disabled,failed,coldstandby,disableDependency",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,coldstandby,enableNoDependency", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,coldstandby,promote",
+ "locked,disabled,failed,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,failed,coldstandby,demote", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,hotstandby,lock", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,hotstandby,unlock", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,hotstandby,disableFailed", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,hotstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,disabled,failed,hotstandby,disableDependency",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,hotstandby,enableNoDependency", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,hotstandby,promote",
+ "locked,disabled,failed,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,failed,hotstandby,demote", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,providingservice,lock", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,providingservice,unlock", "unlocked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,providingservice,disableFailed", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,providingservice,enableNotFailed", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,disabled,failed,providingservice,disableDependency",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,providingservice,enableNoDependency",
+ "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,failed,providingservice,promote",
+ "locked,disabled,failed,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,failed,providingservice,demote", "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency,null,lock", "locked,disabled,dependency,null,");
+ stateTable.put("locked,disabled,dependency,null,unlock", "unlocked,disabled,dependency,null,");
+ stateTable.put("locked,disabled,dependency,null,disableFailed", "locked,disabled,dependency.failed,null,");
+ stateTable.put("locked,disabled,dependency,null,enableNotFailed", "locked,disabled,dependency,null,");
+ stateTable.put("locked,disabled,dependency,null,disableDependency", "locked,disabled,dependency,null,");
+ stateTable.put("locked,disabled,dependency,null,enableNoDependency", "locked,enabled,null,null,");
+ stateTable.put("locked,disabled,dependency,null,promote",
+ "locked,disabled,dependency,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,dependency,null,demote", "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency,coldstandby,lock", "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency,coldstandby,unlock", "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency,coldstandby,disableFailed",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency,coldstandby,enableNotFailed",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency,coldstandby,disableDependency",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency,coldstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,disabled,dependency,coldstandby,promote",
+ "locked,disabled,dependency,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,dependency,coldstandby,demote", "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency,hotstandby,lock", "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency,hotstandby,unlock", "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency,hotstandby,disableFailed",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency,hotstandby,enableNotFailed",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency,hotstandby,disableDependency",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency,hotstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,disabled,dependency,hotstandby,promote",
+ "locked,disabled,dependency,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,dependency,hotstandby,demote", "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency,providingservice,lock", "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency,providingservice,unlock",
+ "unlocked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency,providingservice,disableFailed",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency,providingservice,enableNotFailed",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency,providingservice,disableDependency",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency,providingservice,enableNoDependency",
+ "locked,enabled,null,coldstandby,");
+ stateTable.put("locked,disabled,dependency,providingservice,promote",
+ "locked,disabled,dependency,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,dependency,providingservice,demote", "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,null,lock", "locked,disabled,dependency.failed,null,");
+ stateTable.put("locked,disabled,dependency.failed,null,unlock", "unlocked,disabled,dependency.failed,null,");
+ stateTable.put("locked,disabled,dependency.failed,null,disableFailed",
+ "locked,disabled,dependency.failed,null,");
+ stateTable.put("locked,disabled,dependency.failed,null,enableNotFailed", "locked,disabled,dependency,null,");
+ stateTable.put("locked,disabled,dependency.failed,null,disableDependency",
+ "locked,disabled,dependency.failed,null,");
+ stateTable.put("locked,disabled,dependency.failed,null,enableNoDependency", "locked,disabled,failed,null,");
+ stateTable.put("locked,disabled,dependency.failed,null,promote",
+ "locked,disabled,dependency.failed,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,dependency.failed,null,demote",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,coldstandby,lock",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,coldstandby,unlock",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,coldstandby,disableFailed",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,coldstandby,enableNotFailed",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,coldstandby,disableDependency",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,coldstandby,enableNoDependency",
+ "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,coldstandby,promote",
+ "locked,disabled,dependency.failed,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,dependency.failed,coldstandby,demote",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,hotstandby,lock",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,hotstandby,unlock",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,hotstandby,disableFailed",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,hotstandby,enableNotFailed",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,hotstandby,disableDependency",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,hotstandby,enableNoDependency",
+ "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,hotstandby,promote",
+ "locked,disabled,dependency.failed,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,dependency.failed,hotstandby,demote",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,providingservice,lock",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,providingservice,unlock",
+ "unlocked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,providingservice,disableFailed",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,providingservice,enableNotFailed",
+ "locked,disabled,dependency,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,providingservice,disableDependency",
+ "locked,disabled,dependency.failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,providingservice,enableNoDependency",
+ "locked,disabled,failed,coldstandby,");
+ stateTable.put("locked,disabled,dependency.failed,providingservice,promote",
+ "locked,disabled,dependency.failed,coldstandby,StandbyStatusException");
+ stateTable.put("locked,disabled,dependency.failed,providingservice,demote",
+ "locked,disabled,dependency.failed,coldstandby,");
+ }
- StateElement stateElement = new StateElement();
- try {
- // dependency,failed is stored as dependency.failed in StateTable
- String availStatus2 = availStatus;
- if (availStatus2 != null) {
- availStatus2 = availStatus.replace(",", ".");
- }
- String key = adminState + "," + opState + "," + availStatus2 + "," + standbyStatus + "," + actionName;
- if(logger.isDebugEnabled()){
- logger.debug("Ending State search key: {}", key);
- }
- String value = StateTable.get(key);
-
- if (value != null) {
- try {
- String[] parts = value.split(",", 5);
- stateElement.setEndingAdminState(parts[0].trim());
- stateElement.setEndingOpState(parts[1].trim());
- stateElement.setEndingAvailStatus(parts[2].trim().replace(".", ","));
- stateElement.setEndingStandbyStatus(parts[3].trim());
- stateElement.setException(parts[4].trim());
- stateElement.setAdminState(adminState);
- stateElement.setOpState(opState);
- stateElement.setAvailStatus(availStatus);
- stateElement.setStandbyStatus(standbyStatus);
- stateElement.setActionName(actionName);
-
- stateElement.displayStateElement();
- } catch(Exception ex) {
- logger.error("String split exception: {}", ex.toString(), ex);
- }
-
- } else {
- String msg = "Ending state not found, adminState=[" + adminState + "], opState=[" + opState + "], availStatus=[" +
- availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=[" + actionName + "]";
- logger.error("{}", msg);
- throw new StateTransitionException(msg);
- }
- } catch (Exception ex) {
- logger.error("StateTransition threw exception.", ex);
- throw new StateTransitionException("Exception: " + ex.toString() + ", adminState=[" + adminState + "], opState=[" + opState + "], availStatus=[" +
- availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=[" + actionName + "]");
- }
+ /**
+ * Display the state table.
+ */
+ public void displayStateTable() {
+ Set<?> set = stateTable.entrySet();
+ Iterator<?> iter = set.iterator();
- return stateElement;
- }
-
- /**
- * Adding State Transition info into HashMap. It includes all state/status and action combinations
- * key : adminState,opState,availStatus,standbyStatus,actionName
- * value: endingAdminState,endingOpState,endingAvailStatus,endingStandbyStatus,exception
- * Note : Use period instead of comma as seperator when store multi-value endingStandbyStatus (convert to
- * comma during retrieval)
- *
- * Note on illegal state/status combinations: This table has many state/status combinations that should never occur.
- * However, they *may* occur due to corruption or manual manipulation of the DB. So, in each case of an illegal
- * combination, the state/status is first corrected before applying the action. It is assumed that the administrative
- * and operational states are always correct. Second, if the availability status is in "agreement" with the operational
- * state, it is assumed correct. If it is null and the operational state is disabled, the availability status
- * is left null until a disabledfailed or disableddependency action is received. Or, if a enableNotFailed or
- * enableNoDependency is received while the availability status is null, it will remain null, but the Operational state
- * will change to enabled.
- *
- * If the standby status is not in agreement with the administrative and/or operational states, it is brought into
- * agreement. For example, if the administrative state is locked and the standby status is providingservice, the
- * standby status is changed to coldstandby.
- *
- * After bringing the states/status attributes into agreement, *then* the action is applied to them. For example, if
- * the administrative state is locked, the operational state is enabled, the availability status is null, the standby
- * status is providingservice and the action is unlock, the standby status is changed to coldstandby and then the
- * unlock action is applied. This will change the final state/status to administrative state = unlocked, operational
- * state = disabled, availability status = null and standby status = hotstandby.
- *
- * Note on standby status: If the starting state of standby status is null and either a promote or demote action is
- * made, the assumption is that standbystatus is supported and therefore, the standby status will be changed to
- * providingservice, hotstandby or coldstandby - depending on the value of the administrative and operational states.
- * If an attempt to promote is made when the administrative state is locked or operational state is disabled,
- * a StandbyStatusException will be thrown since promotion (state transition) is not possible. If the standby status
- * is coldstandby and a transition occurs on the administrative or operational state such that they are unlocked and
- * enabled, the standby status is automatically transitioned to hotstandby since it is only those two states that can
- * hold the statndby status in the coldstandby value.
- */
-
- private void setupStateTable()
- {
- StateTable.put("unlocked,enabled,null,null,lock", "locked,enabled,null,null,");
- StateTable.put("unlocked,enabled,null,null,unlock", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,enabled,null,null,disableFailed", "unlocked,disabled,failed,null,");
- StateTable.put("unlocked,enabled,null,null,enableNotFailed", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,enabled,null,null,disableDependency", "unlocked,disabled,dependency,null,");
- StateTable.put("unlocked,enabled,null,null,enableNoDependency", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,enabled,null,null,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,null,null,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,null,coldstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("unlocked,enabled,null,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,null,coldstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,enabled,null,coldstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,null,coldstandby,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,enabled,null,coldstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,null,coldstandby,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,null,coldstandby,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,null,hotstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("unlocked,enabled,null,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,null,hotstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,enabled,null,hotstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,null,hotstandby,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,enabled,null,hotstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,null,hotstandby,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,null,hotstandby,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,null,providingservice,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("unlocked,enabled,null,providingservice,unlock", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,null,providingservice,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,enabled,null,providingservice,enableNotFailed", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,null,providingservice,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,enabled,null,providingservice,enableNoDependency", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,null,providingservice,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,null,providingservice,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,failed,null,lock", "locked,enabled,null,null,");
- StateTable.put("unlocked,enabled,failed,null,unlock", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,enabled,failed,null,disableFailed", "unlocked,disabled,failed,null,");
- StateTable.put("unlocked,enabled,failed,null,enableNotFailed", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,enabled,failed,null,disableDependency", "unlocked,disabled,dependency,null,");
- StateTable.put("unlocked,enabled,failed,null,enableNoDependency", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,enabled,failed,null,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,failed,null,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,failed,coldstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("unlocked,enabled,failed,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,failed,coldstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,enabled,failed,coldstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,failed,coldstandby,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,enabled,failed,coldstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,failed,coldstandby,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,failed,coldstandby,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,failed,hotstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("unlocked,enabled,failed,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,failed,hotstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,enabled,failed,hotstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,failed,hotstandby,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,enabled,failed,hotstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,failed,hotstandby,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,failed,hotstandby,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,failed,providingservice,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("unlocked,enabled,failed,providingservice,unlock", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,failed,providingservice,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,enabled,failed,providingservice,enableNotFailed", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,failed,providingservice,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,enabled,failed,providingservice,enableNoDependency", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,failed,providingservice,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,failed,providingservice,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency,null,lock", "locked,enabled,null,null,");
- StateTable.put("unlocked,enabled,dependency,null,unlock", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,enabled,dependency,null,disableFailed", "unlocked,disabled,failed,null,");
- StateTable.put("unlocked,enabled,dependency,null,enableNotFailed", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,enabled,dependency,null,disableDependency", "unlocked,disabled,dependency,null,");
- StateTable.put("unlocked,enabled,dependency,null,enableNoDependency", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,enabled,dependency,null,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,dependency,null,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency,coldstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("unlocked,enabled,dependency,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency,coldstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,enabled,dependency,coldstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency,coldstandby,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,enabled,dependency,coldstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency,coldstandby,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,dependency,coldstandby,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency,hotstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("unlocked,enabled,dependency,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency,hotstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,enabled,dependency,hotstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency,hotstandby,disableDependency", "unlocked,disabled,dependency,hotstandby,");
- StateTable.put("unlocked,enabled,dependency,hotstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency,hotstandby,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,dependency,hotstandby,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency,providingservice,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("unlocked,enabled,dependency,providingservice,unlock", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,dependency,providingservice,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,enabled,dependency,providingservice,enableNotFailed", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,dependency,providingservice,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,enabled,dependency,providingservice,enableNoDependency", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,dependency,providingservice,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,dependency,providingservice,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,null,lock", "locked,enabled,null,null,");
- StateTable.put("unlocked,enabled,dependency.failed,null,unlock", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,enabled,dependency.failed,null,disableFailed", "unlocked,disabled,failed,null,");
- StateTable.put("unlocked,enabled,dependency.failed,null,enableNotFailed", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,enabled,dependency.failed,null,disableDependency", "unlocked,disabled,dependency,null,");
- StateTable.put("unlocked,enabled,dependency.failed,null,enableNoDependency", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,enabled,dependency.failed,null,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,dependency.failed,null,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,coldstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,coldstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,coldstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,coldstandby,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,coldstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,coldstandby,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,dependency.failed,coldstandby,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,hotstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,hotstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,hotstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,hotstandby,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,hotstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,hotstandby,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,dependency.failed,hotstandby,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,providingservice,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,providingservice,unlock", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,dependency.failed,providingservice,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,providingservice,enableNotFailed", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,dependency.failed,providingservice,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,enabled,dependency.failed,providingservice,enableNoDependency", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,dependency.failed,providingservice,promote", "unlocked,enabled,null,providingservice,");
- StateTable.put("unlocked,enabled,dependency.failed,providingservice,demote", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,disabled,null,null,lock", "locked,disabled,null,null,");
- StateTable.put("unlocked,disabled,null,null,unlock", "unlocked,disabled,null,null,");
- StateTable.put("unlocked,disabled,null,null,disableFailed", "unlocked,disabled,failed,null,");
- StateTable.put("unlocked,disabled,null,null,enableNotFailed", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,disabled,null,null,disableDependency", "unlocked,disabled,dependency,null,");
- StateTable.put("unlocked,disabled,null,null,enableNoDependency", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,disabled,null,null,promote", "unlocked,disabled,null,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,null,null,demote", "unlocked,disabled,null,coldstandby,");
- StateTable.put("unlocked,disabled,null,coldstandby,lock", "locked,disabled,null,coldstandby,");
- StateTable.put("unlocked,disabled,null,coldstandby,unlock", "unlocked,disabled,null,coldstandby,");
- StateTable.put("unlocked,disabled,null,coldstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,null,coldstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,disabled,null,coldstandby,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,null,coldstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,disabled,null,coldstandby,promote", "unlocked,disabled,null,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,null,coldstandby,demote", "unlocked,disabled,null,coldstandby,");
- StateTable.put("unlocked,disabled,null,hotstandby,lock", "locked,disabled,null,coldstandby,");
- StateTable.put("unlocked,disabled,null,hotstandby,unlock", "unlocked,disabled,null,coldstandby,");
- StateTable.put("unlocked,disabled,null,hotstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,null,hotstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,disabled,null,hotstandby,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,null,hotstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,disabled,null,hotstandby,promote", "unlocked,disabled,null,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,null,hotstandby,demote", "unlocked,disabled,null,coldstandby,");
- StateTable.put("unlocked,disabled,null,providingservice,lock", "locked,disabled,null,coldstandby,");
- StateTable.put("unlocked,disabled,null,providingservice,unlock", "unlocked,disabled,null,coldstandby,");
- StateTable.put("unlocked,disabled,null,providingservice,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,null,providingservice,enableNotFailed", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,disabled,null,providingservice,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,null,providingservice,enableNoDependency", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,disabled,null,providingservice,promote", "unlocked,disabled,null,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,null,providingservice,demote", "unlocked,disabled,null,coldstandby,");
- StateTable.put("unlocked,disabled,failed,null,lock", "locked,disabled,failed,null,");
- StateTable.put("unlocked,disabled,failed,null,unlock", "unlocked,disabled,failed,null,");
- StateTable.put("unlocked,disabled,failed,null,disableFailed", "unlocked,disabled,failed,null,");
- StateTable.put("unlocked,disabled,failed,null,enableNotFailed", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,disabled,failed,null,disableDependency", "unlocked,disabled,dependency.failed,null,");
- StateTable.put("unlocked,disabled,failed,null,enableNoDependency", "unlocked,disabled,failed,null,");
- StateTable.put("unlocked,disabled,failed,null,promote", "unlocked,disabled,failed,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,failed,null,demote", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,coldstandby,lock", "locked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,coldstandby,unlock", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,coldstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,coldstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,disabled,failed,coldstandby,disableDependency", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,coldstandby,enableNoDependency", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,coldstandby,promote", "unlocked,disabled,failed,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,failed,coldstandby,demote", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,hotstandby,lock", "locked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,hotstandby,unlock", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,hotstandby,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,hotstandby,enableNotFailed", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,disabled,failed,hotstandby,disableDependency", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,hotstandby,enableNoDependency", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,hotstandby,promote", "unlocked,disabled,failed,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,failed,hotstandby,demote", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,providingservice,lock", "locked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,providingservice,unlock", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,providingservice,disableFailed", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,providingservice,enableNotFailed", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,disabled,failed,providingservice,disableDependency", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,providingservice,enableNoDependency", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,failed,providingservice,promote", "unlocked,disabled,failed,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,failed,providingservice,demote", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,null,lock", "locked,disabled,dependency,null,");
- StateTable.put("unlocked,disabled,dependency,null,unlock", "unlocked,disabled,dependency,null,");
- StateTable.put("unlocked,disabled,dependency,null,disableFailed", "unlocked,disabled,dependency.failed,null,");
- StateTable.put("unlocked,disabled,dependency,null,enableNotFailed", "unlocked,disabled,dependency,null,");
- StateTable.put("unlocked,disabled,dependency,null,disableDependency", "unlocked,disabled,dependency,null,");
- StateTable.put("unlocked,disabled,dependency,null,enableNoDependency", "unlocked,enabled,null,null,");
- StateTable.put("unlocked,disabled,dependency,null,promote", "unlocked,disabled,dependency,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,dependency,null,demote", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,coldstandby,lock", "locked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,coldstandby,unlock", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,coldstandby,disableFailed", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,coldstandby,enableNotFailed", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,coldstandby,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,coldstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,disabled,dependency,coldstandby,promote", "unlocked,disabled,dependency,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,dependency,coldstandby,demote", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,hotstandby,lock", "locked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,hotstandby,unlock", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,hotstandby,disableFailed", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,hotstandby,enableNotFailed", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,hotstandby,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,hotstandby,enableNoDependency", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,disabled,dependency,hotstandby,promote", "unlocked,disabled,dependency,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,dependency,hotstandby,demote", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,providingservice,lock", "locked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,providingservice,unlock", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,providingservice,disableFailed", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,providingservice,enableNotFailed", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,providingservice,disableDependency", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency,providingservice,enableNoDependency", "unlocked,enabled,null,hotstandby,");
- StateTable.put("unlocked,disabled,dependency,providingservice,promote", "unlocked,disabled,dependency,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,dependency,providingservice,demote", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,null,lock", "locked,disabled,dependency.failed,null,");
- StateTable.put("unlocked,disabled,dependency.failed,null,unlock", "unlocked,disabled,dependency.failed,null,");
- StateTable.put("unlocked,disabled,dependency.failed,null,disableFailed", "unlocked,disabled,dependency.failed,null,");
- StateTable.put("unlocked,disabled,dependency.failed,null,enableNotFailed", "unlocked,disabled,dependency,null,");
- StateTable.put("unlocked,disabled,dependency.failed,null,disableDependency", "unlocked,disabled,dependency.failed,null,");
- StateTable.put("unlocked,disabled,dependency.failed,null,enableNoDependency", "unlocked,disabled,failed,null,");
- StateTable.put("unlocked,disabled,dependency.failed,null,promote", "unlocked,disabled,dependency.failed,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,dependency.failed,null,demote", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,coldstandby,lock", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,coldstandby,unlock", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,coldstandby,disableFailed", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,coldstandby,enableNotFailed", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,coldstandby,disableDependency", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,coldstandby,enableNoDependency", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,coldstandby,promote", "unlocked,disabled,dependency.failed,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,dependency.failed,coldstandby,demote", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,hotstandby,lock", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,hotstandby,unlock", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,hotstandby,disableFailed", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,hotstandby,enableNotFailed", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,hotstandby,disableDependency", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,hotstandby,enableNoDependency", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,hotstandby,promote", "unlocked,disabled,dependency.failed,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,dependency.failed,hotstandby,demote", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,providingservice,lock", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,providingservice,unlock", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,providingservice,disableFailed", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,providingservice,enableNotFailed", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,providingservice,disableDependency", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,providingservice,enableNoDependency", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("unlocked,disabled,dependency.failed,providingservice,promote", "unlocked,disabled,dependency.failed,coldstandby,StandbyStatusException");
- StateTable.put("unlocked,disabled,dependency.failed,providingservice,demote", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,enabled,null,null,lock", "locked,enabled,null,null,");
- StateTable.put("locked,enabled,null,null,unlock", "unlocked,enabled,null,null,");
- StateTable.put("locked,enabled,null,null,disableFailed", "locked,disabled,failed,null,");
- StateTable.put("locked,enabled,null,null,enableNotFailed", "locked,enabled,null,null,");
- StateTable.put("locked,enabled,null,null,disableDependency", "locked,disabled,dependency,null,");
- StateTable.put("locked,enabled,null,null,enableNoDependency", "locked,enabled,null,null,");
- StateTable.put("locked,enabled,null,null,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,enabled,null,null,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,null,coldstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,null,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("locked,enabled,null,coldstandby,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,enabled,null,coldstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,null,coldstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,enabled,null,coldstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,null,coldstandby,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,enabled,null,coldstandby,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,null,hotstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,null,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("locked,enabled,null,hotstandby,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,enabled,null,hotstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,null,hotstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,enabled,null,hotstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,null,hotstandby,promote", "locked,enabled,null,coldstandby,StandbyStateException");
- StateTable.put("locked,enabled,null,hotstandby,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,null,providingservice,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,null,providingservice,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("locked,enabled,null,providingservice,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,enabled,null,providingservice,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,null,providingservice,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,enabled,null,providingservice,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,null,providingservice,promote", "locked,enabled,null,coldstandby,StandbyStateException");
- StateTable.put("locked,enabled,null,providingservice,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,failed,null,lock", "locked,enabled,null,null,");
- StateTable.put("locked,enabled,failed,null,unlock", "unlocked,enabled,null,null,");
- StateTable.put("locked,enabled,failed,null,disableFailed", "locked,disabled,failed,null,");
- StateTable.put("locked,enabled,failed,null,enableNotFailed", "locked,enabled,null,null,");
- StateTable.put("locked,enabled,failed,null,disableDependency", "locked,disabled,dependency,null,");
- StateTable.put("locked,enabled,failed,null,enableNoDependency", "locked,enabled,null,null,");
- StateTable.put("locked,enabled,failed,null,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,enabled,failed,null,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,failed,coldstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,failed,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("locked,enabled,failed,coldstandby,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,enabled,failed,coldstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,failed,coldstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,enabled,failed,coldstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,failed,coldstandby,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,enabled,failed,coldstandby,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,failed,hotstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,failed,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("locked,enabled,failed,hotstandby,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,enabled,failed,hotstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,failed,hotstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,enabled,failed,hotstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,failed,hotstandby,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,enabled,failed,hotstandby,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,failed,providingservice,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,failed,providingservice,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("locked,enabled,failed,providingservice,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,enabled,failed,providingservice,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,failed,providingservice,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,enabled,failed,providingservice,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,failed,providingservice,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,enabled,failed,providingservice,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency,null,lock", "locked,enabled,null,null,");
- StateTable.put("locked,enabled,dependency,null,unlock", "unlocked,enabled,null,null,");
- StateTable.put("locked,enabled,dependency,null,disableFailed", "locked,disabled,failed,null,");
- StateTable.put("locked,enabled,dependency,null,enableNotFailed", "locked,enabled,null,null,");
- StateTable.put("locked,enabled,dependency,null,disableDependency", "locked,disabled,dependency,null,");
- StateTable.put("locked,enabled,dependency,null,enableNoDependency", "locked,enabled,null,null,");
- StateTable.put("locked,enabled,dependency,null,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,enabled,dependency,null,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency,coldstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("locked,enabled,dependency,coldstandby,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,enabled,dependency,coldstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency,coldstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,enabled,dependency,coldstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency,coldstandby,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,enabled,dependency,coldstandby,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency,hotstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("locked,enabled,dependency,hotstandby,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,enabled,dependency,hotstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency,hotstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,enabled,dependency,hotstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency,hotstandby,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,enabled,dependency,hotstandby,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency,providingservice,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency,providingservice,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("locked,enabled,dependency,providingservice,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,enabled,dependency,providingservice,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency,providingservice,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,enabled,dependency,providingservice,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency,providingservice,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,enabled,dependency,providingservice,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,null,lock", "locked,enabled,null,null,");
- StateTable.put("locked,enabled,dependency.failed,null,unlock", "unlocked,enabled,null,null,");
- StateTable.put("locked,enabled,dependency.failed,null,disableFailed", "locked,disabled,failed,null,");
- StateTable.put("locked,enabled,dependency.failed,null,enableNotFailed", "locked,enabled,null,null,");
- StateTable.put("locked,enabled,dependency.failed,null,disableDependency", "locked,disabled,dependency,null,");
- StateTable.put("locked,enabled,dependency.failed,null,enableNoDependency", "locked,enabled,null,null,");
- StateTable.put("locked,enabled,dependency.failed,null,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,enabled,dependency.failed,null,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,coldstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,coldstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("locked,enabled,dependency.failed,coldstandby,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,coldstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,coldstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,coldstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,coldstandby,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,enabled,dependency.failed,coldstandby,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,hotstandby,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,hotstandby,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("locked,enabled,dependency.failed,hotstandby,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,hotstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,hotstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,hotstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,hotstandby,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,enabled,dependency.failed,hotstandby,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,providingservice,lock", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,providingservice,unlock", "unlocked,enabled,null,hotstandby,");
- StateTable.put("locked,enabled,dependency.failed,providingservice,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,providingservice,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,providingservice,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,providingservice,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,enabled,dependency.failed,providingservice,promote", "locked,enabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,enabled,dependency.failed,providingservice,demote", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,null,lock", "locked,disabled,null,null,");
- StateTable.put("locked,disabled,null,null,unlock", "unlocked,disabled,null,null,");
- StateTable.put("locked,disabled,null,null,disableFailed", "locked,disabled,failed,null,");
- StateTable.put("locked,disabled,null,null,enableNotFailed", "locked,enabled,null,null,");
- StateTable.put("locked,disabled,null,null,disableDependency", "locked,disabled,dependency,null,");
- StateTable.put("locked,disabled,null,null,enableNoDependency", "locked,enabled,null,null,");
- StateTable.put("locked,disabled,null,null,promote", "locked,disabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,null,null,demote", "locked,disabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,coldstandby,lock", "locked,disabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,coldstandby,unlock", "unlocked,disabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,coldstandby,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,null,coldstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,coldstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,null,coldstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,coldstandby,promote", "locked,disabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,null,coldstandby,demote", "locked,disabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,hotstandby,lock", "locked,disabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,hotstandby,unlock", "unlocked,disabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,hotstandby,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,null,hotstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,hotstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,null,hotstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,hotstandby,promote", "locked,disabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,null,hotstandby,demote", "locked,disabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,providingservice,lock", "locked,disabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,providingservice,unlock", "unlocked,disabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,providingservice,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,null,providingservice,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,providingservice,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,null,providingservice,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,disabled,null,providingservice,promote", "locked,disabled,null,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,null,providingservice,demote", "locked,disabled,null,coldstandby,");
- StateTable.put("locked,disabled,failed,null,lock", "locked,disabled,failed,null,");
- StateTable.put("locked,disabled,failed,null,unlock", "unlocked,disabled,failed,null,");
- StateTable.put("locked,disabled,failed,null,disableFailed", "locked,disabled,failed,null,");
- StateTable.put("locked,disabled,failed,null,enableNotFailed", "locked,enabled,null,null,");
- StateTable.put("locked,disabled,failed,null,disableDependency", "locked,disabled,dependency.failed,null,");
- StateTable.put("locked,disabled,failed,null,enableNoDependency", "locked,disabled,failed,null,");
- StateTable.put("locked,disabled,failed,null,promote", "locked,disabled,failed,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,failed,null,demote", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,failed,coldstandby,lock", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,failed,coldstandby,unlock", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,failed,coldstandby,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,failed,coldstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,disabled,failed,coldstandby,disableDependency", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,failed,coldstandby,enableNoDependency", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,failed,coldstandby,promote", "locked,disabled,failed,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,failed,coldstandby,demote", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,failed,hotstandby,lock", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,failed,hotstandby,unlock", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,failed,hotstandby,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,failed,hotstandby,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,disabled,failed,hotstandby,disableDependency", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,failed,hotstandby,enableNoDependency", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,failed,hotstandby,promote", "locked,disabled,failed,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,failed,hotstandby,demote", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,failed,providingservice,lock", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,failed,providingservice,unlock", "unlocked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,failed,providingservice,disableFailed", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,failed,providingservice,enableNotFailed", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,disabled,failed,providingservice,disableDependency", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,failed,providingservice,enableNoDependency", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,failed,providingservice,promote", "locked,disabled,failed,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,failed,providingservice,demote", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,dependency,null,lock", "locked,disabled,dependency,null,");
- StateTable.put("locked,disabled,dependency,null,unlock", "unlocked,disabled,dependency,null,");
- StateTable.put("locked,disabled,dependency,null,disableFailed", "locked,disabled,dependency.failed,null,");
- StateTable.put("locked,disabled,dependency,null,enableNotFailed", "locked,disabled,dependency,null,");
- StateTable.put("locked,disabled,dependency,null,disableDependency", "locked,disabled,dependency,null,");
- StateTable.put("locked,disabled,dependency,null,enableNoDependency", "locked,enabled,null,null,");
- StateTable.put("locked,disabled,dependency,null,promote", "locked,disabled,dependency,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,dependency,null,demote", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency,coldstandby,lock", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency,coldstandby,unlock", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency,coldstandby,disableFailed", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency,coldstandby,enableNotFailed", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency,coldstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency,coldstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,disabled,dependency,coldstandby,promote", "locked,disabled,dependency,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,dependency,coldstandby,demote", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency,hotstandby,lock", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency,hotstandby,unlock", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency,hotstandby,disableFailed", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency,hotstandby,enableNotFailed", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency,hotstandby,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency,hotstandby,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,disabled,dependency,hotstandby,promote", "locked,disabled,dependency,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,dependency,hotstandby,demote", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency,providingservice,lock", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency,providingservice,unlock", "unlocked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency,providingservice,disableFailed", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency,providingservice,enableNotFailed", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency,providingservice,disableDependency", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency,providingservice,enableNoDependency", "locked,enabled,null,coldstandby,");
- StateTable.put("locked,disabled,dependency,providingservice,promote", "locked,disabled,dependency,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,dependency,providingservice,demote", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,null,lock", "locked,disabled,dependency.failed,null,");
- StateTable.put("locked,disabled,dependency.failed,null,unlock", "unlocked,disabled,dependency.failed,null,");
- StateTable.put("locked,disabled,dependency.failed,null,disableFailed", "locked,disabled,dependency.failed,null,");
- StateTable.put("locked,disabled,dependency.failed,null,enableNotFailed", "locked,disabled,dependency,null,");
- StateTable.put("locked,disabled,dependency.failed,null,disableDependency", "locked,disabled,dependency.failed,null,");
- StateTable.put("locked,disabled,dependency.failed,null,enableNoDependency", "locked,disabled,failed,null,");
- StateTable.put("locked,disabled,dependency.failed,null,promote", "locked,disabled,dependency.failed,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,dependency.failed,null,demote", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,coldstandby,lock", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,coldstandby,unlock", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,coldstandby,disableFailed", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,coldstandby,enableNotFailed", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,coldstandby,disableDependency", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,coldstandby,enableNoDependency", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,coldstandby,promote", "locked,disabled,dependency.failed,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,dependency.failed,coldstandby,demote", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,hotstandby,lock", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,hotstandby,unlock", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,hotstandby,disableFailed", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,hotstandby,enableNotFailed", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,hotstandby,disableDependency", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,hotstandby,enableNoDependency", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,hotstandby,promote", "locked,disabled,dependency.failed,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,dependency.failed,hotstandby,demote", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,providingservice,lock", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,providingservice,unlock", "unlocked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,providingservice,disableFailed", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,providingservice,enableNotFailed", "locked,disabled,dependency,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,providingservice,disableDependency", "locked,disabled,dependency.failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,providingservice,enableNoDependency", "locked,disabled,failed,coldstandby,");
- StateTable.put("locked,disabled,dependency.failed,providingservice,promote", "locked,disabled,dependency.failed,coldstandby,StandbyStatusException");
- StateTable.put("locked,disabled,dependency.failed,providingservice,demote", "locked,disabled,dependency.failed,coldstandby,");
- }
-
- public void displayStateTable()
- {
- Set<?> set = StateTable.entrySet();
- Iterator<?> iter = set.iterator();
-
- while(iter.hasNext()) {
- Map.Entry<?, ?> me = (Map.Entry<?, ?>)iter.next();
- String key = (String)me.getKey() + ((String)me.getValue()).replace(".", ",");
- if(logger.isDebugEnabled()){
- logger.debug("{}", key);
- }
- }
- }
+ while (iter.hasNext()) {
+ Map.Entry<?, ?> me = (Map.Entry<?, ?>) iter.next();
+ String key = (String) me.getKey() + ((String) me.getValue()).replace(".", ",");
+ if (logger.isDebugEnabled()) {
+ logger.debug("{}", key);
+ }
+ }
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransitionException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransitionException.java
index 74998427..0f4ea2fd 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransitionException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransitionException.java
@@ -21,19 +21,22 @@
package org.onap.policy.common.im;
public class StateTransitionException extends IntegrityMonitorException {
- private static final long serialVersionUID = 1L;
- public StateTransitionException() {
- super();
- }
- public StateTransitionException(String message) {
- super(message);
- }
+ private static final long serialVersionUID = 1L;
- public StateTransitionException(Throwable cause) {
- super(cause);
- }
- public StateTransitionException(String message, Throwable cause) {
- super(message, cause);
- }
+ public StateTransitionException() {
+ super();
+ }
+
+ public StateTransitionException(String message) {
+ super(message);
+ }
+
+ public StateTransitionException(Throwable cause) {
+ super(cause);
+ }
+
+ public StateTransitionException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdmin.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdmin.java
index eb1d9f8b..bd7ed7b5 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdmin.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdmin.java
@@ -32,197 +32,197 @@ import javax.management.MalformedObjectNameException;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import org.onap.policy.common.im.IntegrityMonitor;
import org.onap.policy.common.im.IntegrityMonitorException;
import org.onap.policy.common.im.StateManagement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Base class for component MBeans.
*/
public class ComponentAdmin implements ComponentAdminMBean {
- private static final String STATE_MANAGER = "stateManager";
-
- private static final Logger logger = LoggerFactory.getLogger(ComponentAdmin.class.getName());
-
- private final String name;
- private MBeanServer registeredMBeanServer;
- private ObjectName registeredObjectName;
- private IntegrityMonitor integrityMonitor = null;
- private StateManagement stateManager = null;
-
- /**
- * Constructor.
- * @param name the MBean name
- * @param integrityMonitor
- * @param stateManager
- * @throws ComponentAdminException
- */
- public ComponentAdmin(String name, IntegrityMonitor integrityMonitor, StateManagement stateManager) throws ComponentAdminException {
- if ((name == null) || (integrityMonitor == null) || (stateManager == null)) {
- logger.error("Error: ComponentAdmin constructor called with invalid input");
- throw new ComponentAdminException("null input");
- }
-
- this.name = "ONAP_POLICY_COMP:name=" + name;
- this.integrityMonitor = integrityMonitor;
- this.stateManager = stateManager;
-
- try {
- register();
- } catch (ComponentAdminException e) {
- logger.debug("Failed to register ComponentAdmin MBean");
- throw e;
- }
- }
-
- /**
- * Registers with the MBean server.
- * @throws ComponentAdminException a JMX exception
- */
- public synchronized void register() throws ComponentAdminException {
-
- try {
- logger.debug("Registering {} MBean", name);
-
- MBeanServer mbeanServer = findMBeanServer();
-
- if (mbeanServer == null) {
- return;
- }
-
- ObjectName objectName = new ObjectName(name);
-
- if (mbeanServer.isRegistered(objectName)) {
- logger.debug("Unregistering a previously registered {} MBean", name);
- mbeanServer.unregisterMBean(objectName);
- }
-
- mbeanServer.registerMBean(this, objectName);
- registeredMBeanServer = mbeanServer;
- registeredObjectName = objectName;
-
- } catch (MalformedObjectNameException | MBeanRegistrationException | InstanceNotFoundException | InstanceAlreadyExistsException | NotCompliantMBeanException e) {
- throw new ComponentAdminException(e);
- }
- }
-
- /**
- * Checks if this MBean is registered with the MBeanServer.
- * @return true if this MBean is registered with the MBeanServer.
- */
- public boolean isRegistered() {
- return registeredObjectName != null;
- }
-
- /**
- * Unregisters with the MBean server.
- * @throws ComponentAdminException a JMX exception
- */
- public synchronized void unregister() throws ComponentAdminException {
-
- if (registeredObjectName == null) {
- return;
- }
-
-
- try {
- registeredMBeanServer.unregisterMBean(registeredObjectName);
-
- } catch (MBeanRegistrationException | InstanceNotFoundException e) {
- throw new ComponentAdminException(e);
- }
-
- registeredMBeanServer = null;
- registeredObjectName = null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return ComponentAdmin.class.getSimpleName() + "[" + name + "]";
- }
-
- /**
- * Finds the MBeanServer.
- * @return the MBeanServer, or null if it is not found
- */
- public static MBeanServer findMBeanServer() {
- ArrayList<MBeanServer> mbeanServers =
- MBeanServerFactory.findMBeanServer(null);
-
- Iterator<MBeanServer> iter = mbeanServers.iterator();
- MBeanServer mbeanServer;
-
- while (iter.hasNext()) {
- mbeanServer = iter.next();
- if ("DefaultDomain".equals(mbeanServer.getDefaultDomain())) {
- return mbeanServer;
- }
- }
-
- return null;
- }
-
- /**
- * Creates the MBeanServer (intended for unit testing only).
- * @return the MBeanServer
- */
- public static MBeanServer createMBeanServer() {
- return MBeanServerFactory.createMBeanServer("DefaultDomain");
- }
-
- /**
- * Get the MBean object name for the specified feature name.
- * @param componentName component name
- * @return the object name
- * @throws MalformedObjectNameException a JMX exception
- */
- public static ObjectName getObjectName(String componentName)
- throws MalformedObjectNameException {
- return new ObjectName("ONAP_POLICY_COMP:name=" + componentName);
- }
-
- @Override
- public void test() throws IntegrityMonitorException {
- // Call evaluateSanity on IntegrityMonitor to run the test
- logger.debug("test() called...");
- if (integrityMonitor != null) {
- integrityMonitor.evaluateSanity();
- }
- else {
- logger.error("Unable to invoke test() - state manager instance is null");
- throw new ComponentAdminException(STATE_MANAGER);
- }
-
- }
-
- @Override
- public void lock() throws IntegrityMonitorException {
- logger.debug("lock() called...");
- if (stateManager != null) {
- stateManager.lock();
- }
- else {
- logger.error("Unable to invoke lock() - state manager instance is null");
- throw new ComponentAdminException(STATE_MANAGER);
- }
- }
-
- @Override
- public void unlock() throws IntegrityMonitorException {
- logger.debug("unlock() called...");
- if (stateManager != null) {
- stateManager.unlock();
- }
- else {
- logger.error("Unable to invoke unlock() - state manager instance is null");
- throw new ComponentAdminException(STATE_MANAGER);
- }
-
- }
+ private static final String STATE_MANAGER = "stateManager";
+
+ private static final Logger logger = LoggerFactory.getLogger(ComponentAdmin.class.getName());
+
+ private final String name;
+ private MBeanServer registeredMBeanServer;
+ private ObjectName registeredObjectName;
+ private IntegrityMonitor integrityMonitor = null;
+ private StateManagement stateManager = null;
+
+ /**
+ * Constructor.
+ *
+ * @param name the MBean name
+ * @param integrityMonitor the integrity monitor
+ * @param stateManager the state manager
+ * @throws ComponentAdminException if an error occurs
+ */
+ public ComponentAdmin(String name, IntegrityMonitor integrityMonitor, StateManagement stateManager)
+ throws ComponentAdminException {
+ if ((name == null) || (integrityMonitor == null) || (stateManager == null)) {
+ logger.error("Error: ComponentAdmin constructor called with invalid input");
+ throw new ComponentAdminException("null input");
+ }
+
+ this.name = "ONAP_POLICY_COMP:name=" + name;
+ this.integrityMonitor = integrityMonitor;
+ this.stateManager = stateManager;
+
+ try {
+ register();
+ } catch (ComponentAdminException e) {
+ logger.debug("Failed to register ComponentAdmin MBean");
+ throw e;
+ }
+ }
+
+ /**
+ * Registers with the MBean server.
+ *
+ * @throws ComponentAdminException a JMX exception
+ */
+ public synchronized void register() throws ComponentAdminException {
+
+ try {
+ logger.debug("Registering {} MBean", name);
+
+ MBeanServer mbeanServer = findMBeanServer();
+
+ if (mbeanServer == null) {
+ return;
+ }
+
+ ObjectName objectName = new ObjectName(name);
+
+ if (mbeanServer.isRegistered(objectName)) {
+ logger.debug("Unregistering a previously registered {} MBean", name);
+ mbeanServer.unregisterMBean(objectName);
+ }
+
+ mbeanServer.registerMBean(this, objectName);
+ registeredMBeanServer = mbeanServer;
+ registeredObjectName = objectName;
+
+ } catch (MalformedObjectNameException | MBeanRegistrationException | InstanceNotFoundException
+ | InstanceAlreadyExistsException | NotCompliantMBeanException e) {
+ throw new ComponentAdminException(e);
+ }
+ }
+
+ /**
+ * Checks if this MBean is registered with the MBeanServer.
+ *
+ * @return true if this MBean is registered with the MBeanServer.
+ */
+ public boolean isRegistered() {
+ return registeredObjectName != null;
+ }
+
+ /**
+ * Unregisters with the MBean server.
+ *
+ * @throws ComponentAdminException a JMX exception
+ */
+ public synchronized void unregister() throws ComponentAdminException {
+
+ if (registeredObjectName == null) {
+ return;
+ }
+
+
+ try {
+ registeredMBeanServer.unregisterMBean(registeredObjectName);
+
+ } catch (MBeanRegistrationException | InstanceNotFoundException e) {
+ throw new ComponentAdminException(e);
+ }
+
+ registeredMBeanServer = null;
+ registeredObjectName = null;
+ }
+
+ @Override
+ public String toString() {
+ return ComponentAdmin.class.getSimpleName() + "[" + name + "]";
+ }
+
+ /**
+ * Finds the MBeanServer.
+ *
+ * @return the MBeanServer, or null if it is not found
+ */
+ public static MBeanServer findMBeanServer() {
+ ArrayList<MBeanServer> mbeanServers = MBeanServerFactory.findMBeanServer(null);
+
+ Iterator<MBeanServer> iter = mbeanServers.iterator();
+ MBeanServer mbeanServer;
+
+ while (iter.hasNext()) {
+ mbeanServer = iter.next();
+ if ("DefaultDomain".equals(mbeanServer.getDefaultDomain())) {
+ return mbeanServer;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Creates the MBeanServer (intended for unit testing only).
+ *
+ * @return the MBeanServer
+ */
+ public static MBeanServer createMBeanServer() {
+ return MBeanServerFactory.createMBeanServer("DefaultDomain");
+ }
+
+ /**
+ * Get the MBean object name for the specified feature name.
+ *
+ * @param componentName component name
+ * @return the object name
+ * @throws MalformedObjectNameException a JMX exception
+ */
+ public static ObjectName getObjectName(String componentName) throws MalformedObjectNameException {
+ return new ObjectName("ONAP_POLICY_COMP:name=" + componentName);
+ }
+
+ @Override
+ public void test() throws IntegrityMonitorException {
+ // Call evaluateSanity on IntegrityMonitor to run the test
+ logger.debug("test() called...");
+ if (integrityMonitor != null) {
+ integrityMonitor.evaluateSanity();
+ } else {
+ logger.error("Unable to invoke test() - state manager instance is null");
+ throw new ComponentAdminException(STATE_MANAGER);
+ }
+
+ }
+
+ @Override
+ public void lock() throws IntegrityMonitorException {
+ logger.debug("lock() called...");
+ if (stateManager != null) {
+ stateManager.lock();
+ } else {
+ logger.error("Unable to invoke lock() - state manager instance is null");
+ throw new ComponentAdminException(STATE_MANAGER);
+ }
+ }
+
+ @Override
+ public void unlock() throws IntegrityMonitorException {
+ logger.debug("unlock() called...");
+ if (stateManager != null) {
+ stateManager.unlock();
+ } else {
+ logger.error("Unable to invoke unlock() - state manager instance is null");
+ throw new ComponentAdminException(STATE_MANAGER);
+ }
+
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminException.java
index 5ada6da0..dcc4da0a 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminException.java
@@ -23,22 +23,22 @@ package org.onap.policy.common.im.jmx;
import org.onap.policy.common.im.IntegrityMonitorException;
public class ComponentAdminException extends IntegrityMonitorException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public ComponentAdminException() {
- super();
- }
+ public ComponentAdminException() {
+ super();
+ }
- public ComponentAdminException(String message) {
- super(message);
- }
+ public ComponentAdminException(String message) {
+ super(message);
+ }
- public ComponentAdminException(Throwable cause) {
- super(cause);
- }
+ public ComponentAdminException(Throwable cause) {
+ super(cause);
+ }
- public ComponentAdminException(String message, Throwable cause) {
- super(message, cause);
- }
+ public ComponentAdminException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminMBean.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminMBean.java
index 2c011935..3276cf63 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminMBean.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminMBean.java
@@ -26,27 +26,24 @@ import org.onap.policy.common.im.IntegrityMonitorException;
* Provides operations to test health, lock and unlock components.
*/
public interface ComponentAdminMBean {
- /**
- * Test health of component.
- *
- * @throws IntegrityMonitorException
- * if the component fails the health check
- */
- void test() throws IntegrityMonitorException;
+ /**
+ * Test health of component.
+ *
+ * @throws IntegrityMonitorException if the component fails the health check
+ */
+ void test() throws IntegrityMonitorException;
- /**
- * Administratively lock component.
- *
- * @throws IntegrityMonitorException
- * if the component lock fails
- */
- void lock() throws IntegrityMonitorException;
-
- /**
- * Administratively unlock component.
- *
- * @throws IntegrityMonitorException
- * if the component unlock fails
- */
- void unlock() throws IntegrityMonitorException;
+ /**
+ * Administratively lock component.
+ *
+ * @throws IntegrityMonitorException if the component lock fails
+ */
+ void lock() throws IntegrityMonitorException;
+
+ /**
+ * Administratively unlock component.
+ *
+ * @throws IntegrityMonitorException if the component unlock fails
+ */
+ void unlock() throws IntegrityMonitorException;
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/JmxAgentConnection.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/JmxAgentConnection.java
index c9a2ce80..b71751f0 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/JmxAgentConnection.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/JmxAgentConnection.java
@@ -18,9 +18,6 @@
* ============LICENSE_END=========================================================
*/
-/**
- *
- */
package org.onap.policy.common.im.jmx;
import java.io.IOException;
@@ -43,93 +40,89 @@ import org.onap.policy.common.logging.flexlogger.Logger;
* Class to create a JMX RMI connection to the JmxAgent.
*/
public final class JmxAgentConnection {
-
+
private static final Logger logger = FlexLogger.getLogger(JmxAgentConnection.class);
- private static final String DEFAULT_HOST = "localhost";
- private static final String DEFAULT_PORT = "9996";
-
- private String host;
- private String port;
- private JMXConnector connector;
- private String jmxUrl = null;
-
- /**
- * Set up the host/port from the properties. Use defaults if missing from the properties.
- * @param properties the properties used to look for host and port
- */
- public JmxAgentConnection() {
- host = DEFAULT_HOST;
- port = DEFAULT_PORT;
- }
-
- public JmxAgentConnection(String url) {
- jmxUrl = url;
- }
-
- /**
- * Generate jmxAgent url.
- * service:jmx:rmi:///jndi/rmi://host.domain:9999/jmxAgent
- *
- * @param host
- * host.domain
- * @param port
- * 9999
- * @return jmxAgent url.
- */
- private static String jmxAgentUrl(String host, String port) {
-
- return "service:jmx:rmi:///jndi/rmi://" + host + ":" + port
- + "/jmxrmi";
- }
-
- /**
- * Get a connection to the jmxAgent MBeanServer.
- * @return the connection
- * @throws IntegrityMonitorException on error
- */
- public MBeanServerConnection getMBeanConnection() throws IntegrityMonitorException {
-
- try {
- JMXServiceURL url;
- if (jmxUrl == null) {
- url = new JMXServiceURL(jmxAgentUrl(host, port));
- }
- else {
- url = new JMXServiceURL(jmxUrl);
- }
- Map<String, Object> env = new HashMap<>();
-
- connector = JMXConnectorFactory.newJMXConnector(url, env);
- connector.connect();
- connector.addConnectionNotificationListener(
- new NotificationListener() {
-
- @Override
- public void handleNotification(
- Notification notification, Object handback) {
- if (notification.getType().equals(
- JMXConnectionNotification.FAILED)) {
- // handle disconnect
- disconnect();
- }
- }
- }, null, null);
-
- return connector.getMBeanServerConnection();
-
- } catch (IOException e) {
- throw new IntegrityMonitorException(e);
- }
- }
-
- /**
- * Disconnect.
- */
- public void disconnect() {
- if (connector != null) {
- try { connector.close(); } catch (IOException e) { logger.debug(e); }
- }
- }
+ private static final String DEFAULT_HOST = "localhost";
+ private static final String DEFAULT_PORT = "9996";
+
+ private String host;
+ private String port;
+ private JMXConnector connector;
+ private String jmxUrl = null;
+
+ /**
+ * Set up the host/port from the properties. Use defaults if missing from the properties.
+ */
+ public JmxAgentConnection() {
+ host = DEFAULT_HOST;
+ port = DEFAULT_PORT;
+ }
+
+ public JmxAgentConnection(String url) {
+ jmxUrl = url;
+ }
+
+ /**
+ * Generate jmxAgent url. service:jmx:rmi:///jndi/rmi://host.domain:9999/jmxAgent
+ *
+ * @param host host.domain
+ * @param port 9999
+ * @return jmxAgent url.
+ */
+ private static String jmxAgentUrl(String host, String port) {
+
+ return "service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/jmxrmi";
+ }
+
+ /**
+ * Get a connection to the jmxAgent MBeanServer.
+ *
+ * @return the connection
+ * @throws IntegrityMonitorException on error
+ */
+ public MBeanServerConnection getMBeanConnection() throws IntegrityMonitorException {
+
+ try {
+ JMXServiceURL url;
+ if (jmxUrl == null) {
+ url = new JMXServiceURL(jmxAgentUrl(host, port));
+ } else {
+ url = new JMXServiceURL(jmxUrl);
+ }
+ Map<String, Object> env = new HashMap<>();
+
+ connector = JMXConnectorFactory.newJMXConnector(url, env);
+ connector.connect();
+ connector.addConnectionNotificationListener(new NotificationListener() {
+
+ @Override
+ public void handleNotification(Notification notification, Object handback) {
+ if (notification.getType().equals(JMXConnectionNotification.FAILED)) {
+ // handle disconnect
+ disconnect();
+ }
+ }
+ }, null, null);
+
+ return connector.getMBeanServerConnection();
+
+ } catch (IOException e) {
+ throw new IntegrityMonitorException(e);
+ }
+ }
+
+ /**
+ * Disconnect.
+ */
+ public void disconnect() {
+ if (connector != null) {
+ try {
+ connector.close();
+ } catch (IOException e) {
+ logger.debug(e);
+ }
+ }
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java
index 2ef3fa8a..24f36c56 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java
@@ -40,92 +40,104 @@ import javax.persistence.TemporalType;
*/
@Entity
-@Table(name="ForwardProgressEntity")
-@NamedQueries({
- @NamedQuery(name=" ForwardProgressEntity.findAll", query="SELECT e FROM ForwardProgressEntity e "),
- @NamedQuery(name="ForwardProgressEntity.deleteAll", query="DELETE FROM ForwardProgressEntity WHERE 1=1")
-})
-//@SequenceGenerator(name="seqForwardProgress", initialValue=1, allocationSize=1)
+@Table(name = "ForwardProgressEntity")
+@NamedQueries({@NamedQuery(name = " ForwardProgressEntity.findAll", query = "SELECT e FROM ForwardProgressEntity e "),
+ @NamedQuery(name = "ForwardProgressEntity.deleteAll", query = "DELETE FROM ForwardProgressEntity WHERE 1=1")})
+// @SequenceGenerator(name="seqForwardProgress", initialValue=1, allocationSize=1)
public class ForwardProgressEntity implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Id
- //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqForwardProgress")
- @GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="forwardProgressId")
- private long forwardProgressId;
-
- @Column(name="resourceName", nullable=false, length=100, unique=true)
- private String resourceName;
-
- @Column(name="fpc_count", nullable=false)
- private long fpcCount;
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="created_date", updatable=false)
- private Date created_date;
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="last_updated")
- private Date lastUpdated;
-
- public ForwardProgressEntity() {
- //default constructor
- }
-
- @PrePersist
- public void prePersist() {
- Date date = new Date();
- this.created_date = date;
- this.lastUpdated = date;
- this.fpcCount = 0;
- }
-
- @PreUpdate
- public void preUpdate() {
- this.lastUpdated = new Date();
- }
-
- /**
- * @return the Id
- */
- public long getForwardProgressId() {
- return forwardProgressId;
- }
-
- public String getResourceName() {
- return this.resourceName;
- }
- public void setResourceName(String resourceName) {
- this.resourceName = resourceName;
- }
-
- /**
- * @return the fpcCount
- */
- public long getFpcCount() {
- return fpcCount;
- }
-
- /**
- * @param fpcCount the fpcCount to set
- */
- public void setFpcCount(long fpcCount) {
- this.fpcCount = fpcCount;
- }
-
- /**
- * @return the lastUpdated
- */
- public Date getLastUpdated() {
- return lastUpdated;
- }
-
- /**
- * @param lastUpdated the lastUpdated to set
- */
- public void setLastUpdated(Date lastUpdated) {
- this.lastUpdated = lastUpdated;
- }
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqForwardProgress")
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "forwardProgressId")
+ private long forwardProgressId;
+
+ @Column(name = "resourceName", nullable = false, length = 100, unique = true)
+ private String resourceName;
+
+ @Column(name = "fpc_count", nullable = false)
+ private long fpcCount;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "created_date", updatable = false)
+ private Date createdDate;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "last_updated")
+ private Date lastUpdated;
+
+ public ForwardProgressEntity() {
+ // default constructor
+ }
+
+ /**
+ * PrePersist callback method.
+ */
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.lastUpdated = date;
+ this.fpcCount = 0;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.lastUpdated = new Date();
+ }
+
+ /**
+ * Get the forward progress Id.
+ *
+ * @return the Id
+ */
+ public long getForwardProgressId() {
+ return forwardProgressId;
+ }
+
+ public String getResourceName() {
+ return this.resourceName;
+ }
+
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ /**
+ * Get the fpcCount.
+ *
+ * @return the fpcCount
+ */
+ public long getFpcCount() {
+ return fpcCount;
+ }
+
+ /**
+ * Set the fpcCount.
+ *
+ * @param fpcCount the fpcCount to set
+ */
+ public void setFpcCount(long fpcCount) {
+ this.fpcCount = fpcCount;
+ }
+
+ /**
+ * Get the lastUpdated.
+ *
+ * @return the lastUpdated
+ */
+ public Date getLastUpdated() {
+ return lastUpdated;
+ }
+
+ /**
+ * Set the lastUpdated.
+ *
+ * @param lastUpdated the lastUpdated to set
+ */
+ public void setLastUpdated(Date lastUpdated) {
+ this.lastUpdated = lastUpdated;
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java
index 454bf7e1..6fb1446e 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,105 +37,122 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
-@Table(name="ImTestEntity")
-@NamedQueries({
- @NamedQuery(name=" ImTestEntity.findAll", query="SELECT e FROM ImTestEntity e "),
- @NamedQuery(name="ImTestEntity.deleteAll", query="DELETE FROM ImTestEntity WHERE 1=1")
-})
-//@SequenceGenerator(name="seqImTest", initialValue=1, allocationSize=1)
+@Table(name = "ImTestEntity")
+@NamedQueries({@NamedQuery(name = " ImTestEntity.findAll", query = "SELECT e FROM ImTestEntity e "),
+ @NamedQuery(name = "ImTestEntity.deleteAll", query = "DELETE FROM ImTestEntity WHERE 1=1")})
+// @SequenceGenerator(name="seqImTest", initialValue=1, allocationSize=1)
public class ImTestEntity implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Id
- //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqImTest")
- @GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="ImTestId")
- private long imTestId;
-
- @Column(name="created_by", nullable=false, length=255)
- private String createdBy = "guest";
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="created_date", updatable=false)
- private Date createdDate;
-
- @Column(name="modified_by", nullable=false, length=255)
- private String modifiedBy = "guest";
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="modified_date", nullable=false)
- private Date modifiedDate;
-
- public ImTestEntity() {
- //default constructor
- }
-
- @PrePersist
- public void prePersist() {
- Date date = new Date();
- this.createdDate = date;
- this.modifiedDate = date;
- }
-
- @PreUpdate
- public void preUpdate() {
- this.modifiedDate = new Date();
- }
-
- /**
- * @return the Id
- */
- public long getImTestId() {
- return imTestId;
- }
-
- /**
- * @return the createdBy
- */
- public String getCreatedBy() {
- return createdBy;
- }
-
- /**
- * @param createdBy the createdBy to set
- */
- public void setCreatedBy(String createdBy) {
- this.createdBy = createdBy;
- }
-
- /**
- * @return the modifiedBy
- */
- public String getModifiedBy() {
- return modifiedBy;
- }
-
- /**
- * @param modifiedBy the modifiedBy to set
- */
- public void setModifiedBy(String modifiedBy) {
- this.modifiedBy = modifiedBy;
- }
-
- /**
- * @return the modifiedDate
- */
- public Date getModifiedDate() {
- return modifiedDate;
- }
-
- /**
- * @param modifiedDate the modifiedDate to set
- */
- public void setModifiedDate(Date modifiedDate) {
- this.modifiedDate = modifiedDate;
- }
-
- /**
- * @return the createdDate
- */
- public Date getCreatedDate() {
- return createdDate;
- }
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqImTest")
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "ImTestId")
+ private long imTestId;
+
+ @Column(name = "created_by", nullable = false, length = 255)
+ private String createdBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "created_date", updatable = false)
+ private Date createdDate;
+
+ @Column(name = "modified_by", nullable = false, length = 255)
+ private String modifiedBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "modified_date", nullable = false)
+ private Date modifiedDate;
+
+ public ImTestEntity() {
+ // default constructor
+ }
+
+ /**
+ * PrePersist callback method.
+ */
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ }
+
+ /**
+ * Get the Im test Id.
+ *
+ * @return the Id
+ */
+ public long getImTestId() {
+ return imTestId;
+ }
+
+ /**
+ * Get the createdBy.
+ *
+ * @return the createdBy
+ */
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ /**
+ * Set the createdBy.
+ *
+ * @param createdBy the createdBy to set
+ */
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ /**
+ * Get the modifiedBy.
+ *
+ * @return the modifiedBy
+ */
+ public String getModifiedBy() {
+ return modifiedBy;
+ }
+
+ /**
+ * Set the ModifiedBy.
+ *
+ * @param modifiedBy the modifiedBy to set
+ */
+ public void setModifiedBy(String modifiedBy) {
+ this.modifiedBy = modifiedBy;
+ }
+
+ /**
+ * Get the modifiedDate.
+ *
+ * @return the modifiedDate
+ */
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+
+ /**
+ * Set the modifiedDate.
+ *
+ * @param modifiedDate the modifiedDate to set
+ */
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+ /**
+ * Get the createdDate.
+ *
+ * @return the createdDate
+ */
+ public Date getCreatedDate() {
+ return createdDate;
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java
index bd2ba8ab..cfbf020f 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,111 +40,127 @@ import javax.persistence.TemporalType;
*/
@Entity
-@Table(name="ResourceRegistrationEntity")
+@Table(name = "ResourceRegistrationEntity")
@NamedQueries({
- @NamedQuery(name=" ResourceRegistrationEntity.findAll", query="SELECT e FROM ResourceRegistrationEntity e "),
- @NamedQuery(name="ResourceRegistrationEntity.deleteAll", query="DELETE FROM ResourceRegistrationEntity WHERE 1=1")
-})
-//@SequenceGenerator(name="seqResourceRegistration", initialValue=1, allocationSize=1)
+ @NamedQuery(name = " ResourceRegistrationEntity.findAll",
+ query = "SELECT e FROM ResourceRegistrationEntity e "),
+ @NamedQuery(name = "ResourceRegistrationEntity.deleteAll",
+ query = "DELETE FROM ResourceRegistrationEntity WHERE 1=1")})
+// @SequenceGenerator(name="seqResourceRegistration", initialValue=1, allocationSize=1)
public class ResourceRegistrationEntity implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Id
- //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqResourceRegistration")
- @GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="ResourceRegistrationId")
- private long resourceRegistrationId;
-
- @Column(name="resourceName", nullable=false, length=100, unique=true)
- private String resourceName;
-
- @Column(name="resourceUrl", nullable=false, length=255, unique=true)
- private String resourceUrl;
-
- @Column(name="site", nullable=true, length=50)
- private String site;
-
- @Column(name="nodeType", nullable=true, length=50)
- private String nodeType;
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="created_date", updatable=false)
- private Date createdDate;
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="last_updated")
- private Date lastUpdated;
-
- public ResourceRegistrationEntity() {
- //default constructor
- }
-
- @PrePersist
- public void prePersist() {
- Date date = new Date();
- this.createdDate = date;
- this.lastUpdated = date;
- }
-
- @PreUpdate
- public void preUpdate() {
- this.lastUpdated = new Date();
- }
-
- /**
- * @return the Id
- */
- public long getResourceRegistrationId() {
- return resourceRegistrationId;
- }
-
- public String getResourceName() {
- return this.resourceName;
- }
- public void setResourceName(String resourceName) {
- this.resourceName = resourceName;
- }
-
- public String getResourceUrl() {
- return this.resourceUrl;
- }
- public void setResourceUrl(String resourceUrl) {
- this.resourceUrl = resourceUrl;
- }
-
- public String getSite() {
- return this.site;
- }
- public void setSite(String site) {
- this.site = site;
- }
-
- public String getNodeType() {
- return this.nodeType;
- }
- public void setNodeType(String nodeType) {
- this.nodeType = nodeType;
- }
-
- /**
- * @return the createdDate
- */
- public Date getCreatedDate() {
- return createdDate;
- }
-
- /**
- * @return the lastUpdated
- */
- public Date getLastUpdated() {
- return lastUpdated;
- }
-
- /**
- * @param lastUpdated the lastUpdated to set
- */
- public void setLastUpdated(Date lastUpdated) {
- this.lastUpdated = lastUpdated;
- }
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqResourceRegistration")
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "ResourceRegistrationId")
+ private long resourceRegistrationId;
+
+ @Column(name = "resourceName", nullable = false, length = 100, unique = true)
+ private String resourceName;
+
+ @Column(name = "resourceUrl", nullable = false, length = 255, unique = true)
+ private String resourceUrl;
+
+ @Column(name = "site", nullable = true, length = 50)
+ private String site;
+
+ @Column(name = "nodeType", nullable = true, length = 50)
+ private String nodeType;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "created_date", updatable = false)
+ private Date createdDate;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "last_updated")
+ private Date lastUpdated;
+
+ public ResourceRegistrationEntity() {
+ // default constructor
+ }
+
+ /**
+ * PrePersist callback method.
+ */
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.lastUpdated = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.lastUpdated = new Date();
+ }
+
+ /**
+ * Get the resource registration Id.
+ *
+ * @return the Id
+ */
+ public long getResourceRegistrationId() {
+ return resourceRegistrationId;
+ }
+
+ public String getResourceName() {
+ return this.resourceName;
+ }
+
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ public String getResourceUrl() {
+ return this.resourceUrl;
+ }
+
+ public void setResourceUrl(String resourceUrl) {
+ this.resourceUrl = resourceUrl;
+ }
+
+ public String getSite() {
+ return this.site;
+ }
+
+ public void setSite(String site) {
+ this.site = site;
+ }
+
+ public String getNodeType() {
+ return this.nodeType;
+ }
+
+ public void setNodeType(String nodeType) {
+ this.nodeType = nodeType;
+ }
+
+ /**
+ * Get the createdDate.
+ *
+ * @return the createdDate
+ */
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ /**
+ * Get the lastUpdated.
+ *
+ * @return the lastUpdated
+ */
+ public Date getLastUpdated() {
+ return lastUpdated;
+ }
+
+ /**
+ * Set the lastUpdated.
+ *
+ * @param lastUpdated the lastUpdated to set
+ */
+ public void setLastUpdated(Date lastUpdated) {
+ this.lastUpdated = lastUpdated;
+ }
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java
index e177939d..0e96e558 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,108 +36,117 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
-@Table(name="StateManagementEntity")
-@NamedQuery(name="StateManagementEntity.findAll", query="SELECT e FROM StateManagementEntity e")
-//@SequenceGenerator(name="seqSM", initialValue=1, allocationSize=1)
+@Table(name = "StateManagementEntity")
+@NamedQuery(name = "StateManagementEntity.findAll", query = "SELECT e FROM StateManagementEntity e")
+// @SequenceGenerator(name="seqSM", initialValue=1, allocationSize=1)
public class StateManagementEntity implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Id
- //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqSM")
- @GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="id")
- private long id;
-
- @Column(name="resourceName", nullable=false, length=100, unique=true)
- private String resourceName;
-
- @Column(name="adminState", nullable=false, length=20)
- private String adminState;
-
- @Column(name="opState", nullable=false, length=20)
- private String opState;
-
- @Column(name="availStatus", nullable=false, length=20)
- private String availStatus;
-
- @Column(name="standbyStatus", nullable=false, length=20)
- private String standbyStatus;
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="created_Date", updatable=false)
- private Date created_Date;
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="modifiedDate", nullable=false)
- private Date modifiedDate;
-
- @PrePersist
- public void prePersist() {
- this.created_Date = new Date();
- this.modifiedDate = new Date();
- }
-
- @PreUpdate
- public void preUpdate() {
- this.modifiedDate = new Date();
- }
-
- public StateManagementEntity() {
- //default constructor
- }
-
- public String getResourceName() {
- return this.resourceName;
- }
- public void setResourceName(String resourceName) {
- this.resourceName = resourceName;
- }
-
- public String getAdminState() {
- return this.adminState;
- }
-
- public void setAdminState(String adminState) {
- this.adminState = adminState;
- }
- public String getOpState() {
- return this.opState;
- }
-
- public void setOpState(String opState) {
- this.opState = opState;
-
- }
- public String getAvailStatus() {
- return this.availStatus;
- }
-
- public void setAvailStatus(String availStatus) {
- this.availStatus = availStatus;
- }
- public String getStandbyStatus() {
- return this.standbyStatus;
- }
-
- public void setStandbyStatus(String standbyStatus) {
- this.standbyStatus = standbyStatus;
- }
-
- public void setModifiedDate(Date modifiedDate) {
- this.modifiedDate = modifiedDate;
- }
-
- public static StateManagementEntity clone(StateManagementEntity sm)
- {
- StateManagementEntity newSM = new StateManagementEntity();
- newSM.setResourceName(sm.getResourceName());
- newSM.setAdminState(sm.getResourceName());
- newSM.setOpState(sm.getOpState());
- newSM.setAdminState(sm.getAdminState());
- newSM.setAvailStatus(sm.getAvailStatus());
- newSM.setStandbyStatus(sm.getStandbyStatus());
-
- return newSM;
- }
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqSM")
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "id")
+ private long id;
+
+ @Column(name = "resourceName", nullable = false, length = 100, unique = true)
+ private String resourceName;
+
+ @Column(name = "adminState", nullable = false, length = 20)
+ private String adminState;
+
+ @Column(name = "opState", nullable = false, length = 20)
+ private String opState;
+
+ @Column(name = "availStatus", nullable = false, length = 20)
+ private String availStatus;
+
+ @Column(name = "standbyStatus", nullable = false, length = 20)
+ private String standbyStatus;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "created_Date", updatable = false)
+ private Date createdDate;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "modifiedDate", nullable = false)
+ private Date modifiedDate;
+
+ @PrePersist
+ public void prePersist() {
+ this.createdDate = new Date();
+ this.modifiedDate = new Date();
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ }
+
+ public StateManagementEntity() {
+ // default constructor
+ }
+
+ public String getResourceName() {
+ return this.resourceName;
+ }
+
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ public String getAdminState() {
+ return this.adminState;
+ }
+
+ public void setAdminState(String adminState) {
+ this.adminState = adminState;
+ }
+
+ public String getOpState() {
+ return this.opState;
+ }
+
+ public void setOpState(String opState) {
+ this.opState = opState;
+
+ }
+
+ public String getAvailStatus() {
+ return this.availStatus;
+ }
+
+ public void setAvailStatus(String availStatus) {
+ this.availStatus = availStatus;
+ }
+
+ public String getStandbyStatus() {
+ return this.standbyStatus;
+ }
+
+ public void setStandbyStatus(String standbyStatus) {
+ this.standbyStatus = standbyStatus;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+ /**
+ * Clone a StateManagementEntity.
+ *
+ * @param sm the StateManagementEntity to clone
+ * @return a new StateManagementEntity
+ */
+ public static StateManagementEntity clone(StateManagementEntity sm) {
+ StateManagementEntity newStateManagementEntity = new StateManagementEntity();
+ newStateManagementEntity.setResourceName(sm.getResourceName());
+ newStateManagementEntity.setAdminState(sm.getResourceName());
+ newStateManagementEntity.setOpState(sm.getOpState());
+ newStateManagementEntity.setAdminState(sm.getAdminState());
+ newStateManagementEntity.setAvailStatus(sm.getAvailStatus());
+ newStateManagementEntity.setStandbyStatus(sm.getStandbyStatus());
+
+ return newStateManagementEntity;
+ }
}
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java
index 967ca739..806c404c 100644
--- a/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java
+++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java
@@ -35,139 +35,148 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AllSeemsWellTest extends IntegrityMonitorTestBase {
- private static Logger logger = LoggerFactory.getLogger(AllSeemsWellTest.class);
-
- private static final long STATE_CYCLE_MS = 3 * CYCLE_INTERVAL_MS;
-
- private static Properties myProp;
- private static String resourceName;
-
- @BeforeClass
- public static void setUpClass() throws Exception {
- IntegrityMonitorTestBase.setUpBeforeClass(DEFAULT_DB_URL_PREFIX + AllSeemsWellTest.class.getSimpleName());
-
- resourceName = IntegrityMonitorTestBase.siteName + "." + IntegrityMonitorTestBase.nodeType;
- }
-
- @AfterClass
- public static void tearDownClass() throws Exception {
- IntegrityMonitorTestBase.tearDownAfterClass();
- }
-
- @Before
- public void setUp() {
- super.setUpTest();
-
- myProp = makeProperties();
-
- }
-
- @After
- public void tearDown() {
- super.tearDownTest();
- }
-
- // Ignore
- @Test
- public void testAllSeemsWell() throws Exception {
- logger.debug("\nIntegrityMonitorTest: Entering testAllSeemsWell\n\n");
-
- // parameters are passed via a properties file
- myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "");
- myProp.put(IntegrityMonitorProperties.TEST_VIA_JMX, "false");
- myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
- myProp.put(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, "-1");
- myProp.put(IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD, "1");
- myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "5");
- myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "1");
- myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "1");
-
- IntegrityMonitor.updateProperties(myProp);
- /*
- * The monitorInterval is 5 and the failedCounterThreshold is 1 A
- * forward progress will be stale after 5 seconds.
- */
-
- IntegrityMonitor im = IntegrityMonitor.getInstance(resourceName, myProp);
-
- StateManagement sm = im.getStateManager();
-
- // Give it time to set the states in the DB
- Thread.sleep(STATE_CYCLE_MS);
-
- // Check the state
- logger.debug(
- "\n\ntestAllSeemsWell starting im state \nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
-
- assertEquals(StateManagement.ENABLED, sm.getOpState());
-
- // Indicate a failure
- im.allSeemsWell(this.getClass().getName(), IntegrityMonitorProperties.ALLNOTWELL,
- "'AllSeemsWellTest - ALLNOTWELL'");
-
- // Wait for the state to change due to ALLNOTWELL
- Thread.sleep(STATE_CYCLE_MS);
- // Check the state
- logger.debug(
- "\n\ntestAllSeemsWell after ALLNOTWELL: im state \nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
-
- // assertEquals(StateManagement.DISABLED, sm.getOpState());
-
- Map<String, String> allNotWellMap = im.getAllNotWellMap();
- for (String key : allNotWellMap.keySet()) {
- logger.debug("AllSeemsWellTest: allNotWellMap: key = {} msg = {}", key, allNotWellMap.get(key));
- }
- // assertEquals(1, allNotWellMap.size());
-
- Map<String, String> allSeemsWellMap = im.getAllSeemsWellMap();
- // assertTrue(allSeemsWellMap.isEmpty());
-
- // Return to normal
- im.allSeemsWell(this.getClass().getName(), IntegrityMonitorProperties.ALLSEEMSWELL,
- "'AllSeemsWellTest - ALLSEEMSWELL'");
-
- // Wait for the state to change due to ALLNOTWELL
- Thread.sleep(STATE_CYCLE_MS);
- // Check the state
- logger.debug(
- "\n\ntestAllSeemsWell after ALLSEEMSWELL: im state \nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
-
- // assertEquals(StateManagement.ENABLED, sm.getOpState());
-
- allNotWellMap = im.getAllNotWellMap();
- assertTrue(allNotWellMap.isEmpty());
-
- allSeemsWellMap = im.getAllSeemsWellMap();
- assertEquals(1, allSeemsWellMap.size());
- for (String key : allSeemsWellMap.keySet()) {
- logger.debug("AllSeemsWellTest: allSeemsWellMap: key = {} msg = {}", key, allSeemsWellMap.get(key));
- }
-
- // Check for null parameters
- assertException(im, imx -> {
- imx.allSeemsWell(null, IntegrityMonitorProperties.ALLSEEMSWELL, "'AllSeemsWellTest - ALLSEEMSWELL'");
- });
-
- assertException(im, imx -> {
- im.allSeemsWell("", IntegrityMonitorProperties.ALLSEEMSWELL, "'AllSeemsWellTest - ALLSEEMSWELL'");
- });
-
- assertException(im, imx -> {
- im.allSeemsWell(this.getClass().getName(), null, "'AllSeemsWellTest - ALLSEEMSWELL'");
- });
-
- assertException(im, imx -> {
- im.allSeemsWell(this.getClass().getName(), IntegrityMonitorProperties.ALLSEEMSWELL, null);
- });
-
- assertException(im, imx -> {
- im.allSeemsWell(this.getClass().getName(), IntegrityMonitorProperties.ALLSEEMSWELL, "");
- });
-
- logger.debug("\n\ntestAllSeemsWell: Exit\n\n");
- }
+ private static Logger logger = LoggerFactory.getLogger(AllSeemsWellTest.class);
+
+ private static final long STATE_CYCLE_MS = 3 * CYCLE_INTERVAL_MS;
+
+ private static Properties myProp;
+ private static String resourceName;
+
+ /**
+ * Set up for test class.
+ */
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ IntegrityMonitorTestBase.setUpBeforeClass(DEFAULT_DB_URL_PREFIX + AllSeemsWellTest.class.getSimpleName());
+
+ resourceName = IntegrityMonitorTestBase.siteName + "." + IntegrityMonitorTestBase.nodeType;
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ IntegrityMonitorTestBase.tearDownAfterClass();
+ }
+
+ /**
+ * Set up for test cases.
+ */
+ @Before
+ public void setUp() {
+ super.setUpTest();
+
+ myProp = makeProperties();
+
+ }
+
+ @After
+ public void tearDown() {
+ super.tearDownTest();
+ }
+
+ // Ignore
+ @Test
+ public void testAllSeemsWell() throws Exception {
+ logger.debug("\nIntegrityMonitorTest: Entering testAllSeemsWell\n\n");
+
+ // parameters are passed via a properties file
+ myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "");
+ myProp.put(IntegrityMonitorProperties.TEST_VIA_JMX, "false");
+ myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
+ myProp.put(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, "-1");
+ myProp.put(IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD, "1");
+ myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "5");
+ myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "1");
+ myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "1");
+
+ IntegrityMonitor.updateProperties(myProp);
+ /*
+ * The monitorInterval is 5 and the failedCounterThreshold is 1 A forward progress will be
+ * stale after 5 seconds.
+ */
+
+ IntegrityMonitor im = IntegrityMonitor.getInstance(resourceName, myProp);
+
+ StateManagement sm = im.getStateManager();
+
+ // Give it time to set the states in the DB
+ Thread.sleep(STATE_CYCLE_MS);
+
+ // Check the state
+ logger.debug(
+ "\n\ntestAllSeemsWell starting im state \nAdminState = {}\nOpState() = {}\nAvailStatus = {}\n"
+ + "StandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+
+ assertEquals(StateManagement.ENABLED, sm.getOpState());
+
+ // Indicate a failure
+ im.allSeemsWell(this.getClass().getName(), IntegrityMonitorProperties.ALLNOTWELL,
+ "'AllSeemsWellTest - ALLNOTWELL'");
+
+ // Wait for the state to change due to ALLNOTWELL
+ Thread.sleep(STATE_CYCLE_MS);
+ // Check the state
+ logger.debug(
+ "\n\ntestAllSeemsWell after ALLNOTWELL: im state \nAdminState = {}\nOpState() = {}\nAvailStatus = "
+ + "{}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+
+ // assertEquals(StateManagement.DISABLED, sm.getOpState());
+
+ Map<String, String> allNotWellMap = im.getAllNotWellMap();
+ for (String key : allNotWellMap.keySet()) {
+ logger.debug("AllSeemsWellTest: allNotWellMap: key = {} msg = {}", key, allNotWellMap.get(key));
+ }
+ // assertEquals(1, allNotWellMap.size());
+
+ im.getAllSeemsWellMap();
+ // assertTrue(allSeemsWellMap.isEmpty());
+
+ // Return to normal
+ im.allSeemsWell(this.getClass().getName(), IntegrityMonitorProperties.ALLSEEMSWELL,
+ "'AllSeemsWellTest - ALLSEEMSWELL'");
+
+ // Wait for the state to change due to ALLNOTWELL
+ Thread.sleep(STATE_CYCLE_MS);
+ // Check the state
+ logger.debug(
+ "\n\ntestAllSeemsWell after ALLSEEMSWELL: im state \nAdminState = {}\nOpState() = {}\nAvailStatus = "
+ + "{}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+
+ // assertEquals(StateManagement.ENABLED, sm.getOpState());
+
+ allNotWellMap = im.getAllNotWellMap();
+ assertTrue(allNotWellMap.isEmpty());
+
+ Map<String, String> allSeemsWellMap = im.getAllSeemsWellMap();
+ assertEquals(1, allSeemsWellMap.size());
+ for (String key : allSeemsWellMap.keySet()) {
+ logger.debug("AllSeemsWellTest: allSeemsWellMap: key = {} msg = {}", key, allSeemsWellMap.get(key));
+ }
+
+ // Check for null parameters
+ assertException(im, imx -> {
+ imx.allSeemsWell(null, IntegrityMonitorProperties.ALLSEEMSWELL, "'AllSeemsWellTest - ALLSEEMSWELL'");
+ });
+
+ assertException(im, imx -> {
+ im.allSeemsWell("", IntegrityMonitorProperties.ALLSEEMSWELL, "'AllSeemsWellTest - ALLSEEMSWELL'");
+ });
+
+ assertException(im, imx -> {
+ im.allSeemsWell(this.getClass().getName(), null, "'AllSeemsWellTest - ALLSEEMSWELL'");
+ });
+
+ assertException(im, imx -> {
+ im.allSeemsWell(this.getClass().getName(), IntegrityMonitorProperties.ALLSEEMSWELL, null);
+ });
+
+ assertException(im, imx -> {
+ im.allSeemsWell(this.getClass().getName(), IntegrityMonitorProperties.ALLSEEMSWELL, "");
+ });
+
+ logger.debug("\n\ntestAllSeemsWell: Exit\n\n");
+ }
}
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/ExceptionsTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/ExceptionsTest.java
index 90de7c66..f3cb1eff 100644
--- a/integrity-monitor/src/test/java/org/onap/policy/common/im/ExceptionsTest.java
+++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/ExceptionsTest.java
@@ -23,14 +23,6 @@ package org.onap.policy.common.im;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.onap.policy.common.im.AdministrativeStateException;
-import org.onap.policy.common.im.AllSeemsWellException;
-import org.onap.policy.common.im.ForwardProgressException;
-import org.onap.policy.common.im.IntegrityMonitorException;
-import org.onap.policy.common.im.IntegrityMonitorPropertiesException;
-import org.onap.policy.common.im.StandbyStatusException;
-import org.onap.policy.common.im.StateManagementException;
-import org.onap.policy.common.im.StateTransitionException;
import org.onap.policy.common.im.jmx.ComponentAdminException;
import org.onap.policy.common.utils.test.ExceptionsTester;
@@ -39,48 +31,48 @@ import org.onap.policy.common.utils.test.ExceptionsTester;
*/
public class ExceptionsTest extends ExceptionsTester {
- @Test
- public void testStateTransitionException() throws Exception {
- assertEquals(4, test(StateTransitionException.class));
- }
+ @Test
+ public void testStateTransitionException() throws Exception {
+ assertEquals(4, test(StateTransitionException.class));
+ }
- @Test
- public void testStateManagementException() throws Exception {
- assertEquals(4, test(StateManagementException.class));
- }
+ @Test
+ public void testStateManagementException() throws Exception {
+ assertEquals(4, test(StateManagementException.class));
+ }
- @Test
- public void testStandbyStatusException() throws Exception {
- assertEquals(5, test(StandbyStatusException.class));
- }
+ @Test
+ public void testStandbyStatusException() throws Exception {
+ assertEquals(5, test(StandbyStatusException.class));
+ }
- @Test
- public void testIntegrityMonitorPropertiesException() throws Exception {
- assertEquals(4, test(IntegrityMonitorPropertiesException.class));
- }
+ @Test
+ public void testIntegrityMonitorPropertiesException() throws Exception {
+ assertEquals(4, test(IntegrityMonitorPropertiesException.class));
+ }
- @Test
- public void testIntegrityMonitorException() throws Exception {
- assertEquals(5, test(IntegrityMonitorException.class));
- }
+ @Test
+ public void testIntegrityMonitorException() throws Exception {
+ assertEquals(5, test(IntegrityMonitorException.class));
+ }
- @Test
- public void testForwardProgressException() throws Exception {
- assertEquals(4, test(ForwardProgressException.class));
- }
+ @Test
+ public void testForwardProgressException() throws Exception {
+ assertEquals(4, test(ForwardProgressException.class));
+ }
- @Test
- public void testAllSeemsWellException() throws Exception {
- assertEquals(4, test(AllSeemsWellException.class));
- }
+ @Test
+ public void testAllSeemsWellException() throws Exception {
+ assertEquals(4, test(AllSeemsWellException.class));
+ }
- @Test
- public void testAdministrativeStateException() throws Exception {
- assertEquals(4, test(AdministrativeStateException.class));
- }
+ @Test
+ public void testAdministrativeStateException() throws Exception {
+ assertEquals(4, test(AdministrativeStateException.class));
+ }
- @Test
- public void testComponentAdminException() throws Exception {
- assertEquals(4, test(ComponentAdminException.class));
- }
+ @Test
+ public void testComponentAdminException() throws Exception {
+ assertEquals(4, test(ComponentAdminException.class));
+ }
}
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java
index 3704b07d..7f1e5516 100644
--- a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java
+++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java
@@ -51,857 +51,873 @@ import org.slf4j.LoggerFactory;
* tasks.
*/
public class IntegrityMonitorTest extends IntegrityMonitorTestBase {
- private static Logger logger = LoggerFactory.getLogger(IntegrityMonitorTest.class);
-
- private static Properties myProp;
- private static EntityTransaction et;
- private static String resourceName;
-
- private BlockingQueue<CountDownLatch> queue;
-
- @BeforeClass
- public static void setUpClass() throws Exception {
- IntegrityMonitorTestBase.setUpBeforeClass(DEFAULT_DB_URL_PREFIX + IntegrityMonitorTest.class.getSimpleName());
-
- resourceName = IntegrityMonitorTestBase.siteName + "." + IntegrityMonitorTestBase.nodeType;
- }
-
- @AfterClass
- public static void tearDownClass() throws Exception {
- IntegrityMonitorTestBase.tearDownAfterClass();
- }
-
- @Before
- public void setUp() throws Exception {
- super.setUpTest();
-
- myProp = makeProperties();
- et = null;
- }
-
- @After
- public void tearDown() throws Exception {
- if (et != null && et.isActive()) {
- try {
- et.rollback();
-
- } catch (RuntimeException e) {
- logger.error("cannot rollback transaction", e);
- }
- }
-
- super.tearDownTest();
- }
-
- /*
- * The following test verifies the following test cases: New Install New
- * Install - Bad Dependency data Recovery from bad dependency data Lock Lock
- * restart Unlock Unlock restart
- */
- @Test
- public void testSanityJmx() throws Exception {
- logger.debug("\nIntegrityMonitorTest: Entering testSanityJmx\n\n");
-
- String dependent = "group1_logparser";
-
- // parameters are passed via a properties file
- myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, dependent);
- myProp.put(IntegrityMonitorProperties.TEST_VIA_JMX, "true");
- // Disable the integrity monitor so it will not interfere
- myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "-1");
- // Disable the refresh state audit
- myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
- // Disable the state audit
- myProp.put(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, "-1");
- // Disable the test transaction
- myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "-1");
- // Disable the write FPC
- myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "-1");
- // Speed up the check
- myProp.put(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, "1");
- // Fail dependencies after three seconds
- myProp.put(IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL, "3");
-
- IntegrityMonitor im = makeMonitor(resourceName, myProp);
- logger.debug(
- "\n\ntestSanityJmx starting im state \nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- im.getStateManager().getAdminState(), im.getStateManager().getOpState(),
- im.getStateManager().getAvailStatus(), im.getStateManager().getStandbyStatus());
- // add an entry to Resource registration table in the DB for the
- // dependent resource
-
- et = em.getTransaction();
- et.begin();
- Query rquery = em.createQuery("Select r from ResourceRegistrationEntity r where r.resourceName=:rn");
- rquery.setParameter("rn", dependent);
-
- @SuppressWarnings("rawtypes")
- List rrList = rquery.getResultList();
- ResourceRegistrationEntity rrx = null;
- if (rrList.isEmpty()) {
- // register resource by adding entry to table in DB
- logger.debug("Adding resource {} to ResourceRegistration table", dependent);
- rrx = new ResourceRegistrationEntity();
- // set columns in entry
- rrx.setResourceName(dependent);
- rrx.setResourceUrl("service:jmx:somewhere:9999");
- rrx.setNodeType("logparser");
- rrx.setSite("siteA");
- }
- em.persist(rrx);
- // flush to the DB
- em.flush();
-
- // commit transaction
- et.commit();
-
- // wait for the FPManager to check dependency health
- waitStep();
-
- assertException(im, imx -> {
- imx.evaluateSanity();
- });
-
- // undo dependency groups and jmx test properties settings
- myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "");
- myProp.put(IntegrityMonitorProperties.TEST_VIA_JMX, "false");
- IntegrityMonitor.updateProperties(myProp);
-
- logger.debug("\ntestSantityJmx ending properties: {}", myProp);
-
- // We know at this point that the IM is disable-dependency. We want to
- // be
- // sure it will recover from this condition since the properties were
- // updated.
-
- logger.debug(
- "\n\ntestSanityJmx ending im state\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- im.getStateManager().getAdminState(), im.getStateManager().getOpState(),
- im.getStateManager().getAvailStatus(), im.getStateManager().getStandbyStatus());
-
- logger.debug("\ntestSanityJmx restarting the IntegrityMonitor");
- // Create a new instance. It should recover from the disabled-dependency
- // condition
- im = makeMonitor(resourceName, myProp);
-
- logger.debug(
- "\n\ntestSanityJmx state after creating new im\n"
- + "AdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- im.getStateManager().getAdminState(), im.getStateManager().getOpState(),
- im.getStateManager().getAvailStatus(), im.getStateManager().getStandbyStatus());
-
- // Verify the state
- assertEquals(StateManagement.UNLOCKED, im.getStateManager().getAdminState());
- assertEquals(StateManagement.ENABLED, im.getStateManager().getOpState());
- assertEquals(StateManagement.NULL_VALUE, im.getStateManager().getAvailStatus());
- assertEquals(StateManagement.NULL_VALUE, im.getStateManager().getStandbyStatus());
-
- // Test state manager via the IntegrityMonitor
- StateManagement sm = im.getStateManager();
-
- // Verify lock state
- sm.lock();
- logger.debug("\n\nsm.lock()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
- assertEquals(StateManagement.LOCKED, sm.getAdminState());
-
- // Verify lock persists across a restart
- logger.debug("\ntestSanityJmx restarting the IntegrityMonitor");
- // Create a new instance. It should come up with the admin state locked
- im = makeMonitor(resourceName, myProp);
- sm = im.getStateManager();
- logger.debug(
- "\n\ntestSanityJmx restart with AdminState=locked"
- + "\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
- assertEquals(StateManagement.LOCKED, sm.getAdminState());
-
- // Verify unlock
- sm.unlock();
- logger.debug(
- "\n\ntestSanityJmx sm.unlock\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
- assertEquals(StateManagement.UNLOCKED, sm.getAdminState());
-
- // Verify unlock restart
- logger.debug("\ntestSanityJmx restarting the IntegrityMonitor");
- // Create a new instance. It should come up with the admin state locked
- im = makeMonitor(resourceName, myProp);
- sm = im.getStateManager();
- logger.debug(
- "\n\ntestSanityJmx restart with AdminState=unlocked\n"
- + "AdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
-
- assertEquals(StateManagement.UNLOCKED, sm.getAdminState());
-
- logger.debug("\n\ntestSanityJmx: Exit\n\n");
- }
-
- @Test
- public void testIM() throws Exception {
- logger.debug("\nIntegrityMonitorTest: Entering testIM\n\n");
-
- // Disable the integrity monitor so it will not interfere
- myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "-1");
- // Disable dependency checking
- myProp.put(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, "-1");
- // Disable the refresh state audit
- myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
- // Disable the state audit
- myProp.put(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, "-1");
- // Disable the test transaction
- myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "-1");
- // Disable writing the FPC
- myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "-1");
-
- IntegrityMonitor im = makeMonitor(resourceName, myProp);
-
- logger.debug("\n\nim initial state: \nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- im.getStateManager().getAdminState(), im.getStateManager().getOpState(),
- im.getStateManager().getAvailStatus(), im.getStateManager().getStandbyStatus());
-
- waitStep();
-
- // test evaluate sanity
- assertNoException(im, imx -> {
- imx.evaluateSanity();
- });
-
- // Test startTransaction - should work since it is unlocked
- assertNoException(im, imx -> {
- imx.startTransaction();
- });
-
- // Test state manager via the IntegrityMonitor
- StateManagement sm = im.getStateManager();
-
- sm.lock();
-
- logger.debug("\n\nsm.lock()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
-
- assertEquals(StateManagement.LOCKED, sm.getAdminState());
-
- // test startTransaction. It should fail since it is locked
- assertException(im, imx -> {
- imx.startTransaction();
- });
-
- sm.unlock();
- logger.debug("\n\nsm.unlock()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
- assertEquals(StateManagement.UNLOCKED, sm.getAdminState());
-
- // test startTransaction. It should succeed
- assertNoException(im, imx -> {
- imx.startTransaction();
- });
-
- sm.disableDependency();
- logger.debug(
- "\n\nsm.disableDependency()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
-
- assertEquals(StateManagement.DISABLED, sm.getOpState());
- assertEquals(StateManagement.DEPENDENCY, sm.getAvailStatus());
-
- // test startTransaction. It should succeed since standby status is null
- // and unlocked
- assertNoException(im, imx -> {
- imx.startTransaction();
- });
-
- sm.enableNoDependency();
-
- logger.debug(
- "\n\nsm.enableNoDependency()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
- assertEquals(StateManagement.ENABLED, sm.getOpState());
- // test startTransaction. It should succeed since standby status is null
- // and unlocked
- assertNoException(im, imx -> {
- imx.startTransaction();
- });
-
- sm.disableFailed();
- logger.debug("\n\nsm.disableFailed()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
-
- assertEquals(StateManagement.DISABLED, sm.getOpState());
- assertEquals(StateManagement.FAILED, sm.getAvailStatus());
- // test startTransaction. It should succeed since standby status is null
- // and unlocked
- assertNoException(im, imx -> {
- imx.startTransaction();
- });
-
- sm.enableNotFailed();
-
- logger.debug(
- "\n\nsm.enabledNotFailed()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
-
- assertEquals(StateManagement.ENABLED, sm.getOpState());
- // test startTransaction. It should succeed since standby status is null
- // and unlocked
- assertNoException(im, imx -> {
- imx.startTransaction();
- });
-
- sm.demote();
-
- logger.debug("\n\nsm.demote()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
-
- assertEquals(StateManagement.HOT_STANDBY, sm.getStandbyStatus());
-
- // test startTransaction. It should fail since it is standby
- assertException(im, imx -> {
- imx.startTransaction();
- });
-
- sm.promote();
-
- logger.debug("\n\nsm.promote()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
-
- assertEquals(StateManagement.PROVIDING_SERVICE, sm.getStandbyStatus());
-
- // test startTransaction. It should succeed since it is providing
- // service
- assertNoException(im, imx -> {
- imx.startTransaction();
- });
-
- // Test the multi-valued availability status
- sm.disableDependency();
- sm.disableFailed();
-
- logger.debug(
- "\n\nsm.disableDependency(), sm.disableFailed\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
-
- assertEquals(StateManagement.DEPENDENCY_FAILED, sm.getAvailStatus());
-
- // Test startTransaction. Should fail since standby status is cold
- // standby
- assertException(im, imx -> {
- imx.startTransaction();
- });
-
- sm.enableNoDependency();
-
- logger.debug(
- "\n\nsm.enableNoDependency()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
- assertEquals(StateManagement.FAILED, sm.getAvailStatus());
- // Test startTransaction. Should fail since standby status is cold
- // standby
- assertException(im, imx -> {
- imx.startTransaction();
- });
-
- sm.disableDependency();
- sm.enableNotFailed();
-
- logger.debug(
- "\n\nsm.disableDependency(),sm.enableNotFailed()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
-
- assertEquals(StateManagement.DEPENDENCY, sm.getAvailStatus());
- // Test startTransaction. Should fail since standby status is cold
- // standby
- assertException(im, imx -> {
- imx.startTransaction();
- });
-
- sm.enableNoDependency();
- logger.debug(
- "\n\nsm.enableNoDependency()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
- sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
- assertEquals(StateManagement.ENABLED, sm.getOpState());
- // test startTransaction. It should fail since standby status is hot
- // standby
- assertException(im, imx -> {
- imx.startTransaction();
- });
-
- logger.debug("\n\ntestIM: Exit\n\n");
- }
-
- @Test
- public void testSanityState() throws Exception {
- logger.debug("\nIntegrityMonitorTest: Entering testSanityState\n\n");
-
- // parameters are passed via a properties file
- myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "group1_dep1,group1_dep2; group2_dep1");
- // Disable the integrity monitor so it will not interfere
- myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "-1");
- // Disable the refresh state audit
- myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
- // Disable dependency checking so it does not interfere
- myProp.put(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, "-1");
- // Disable the state audit
- myProp.put(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, "-1");
- // Disable the test transaction
- myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "-1");
- // Disable writing the FPC
- myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "-1");
- // Max interval for use in deciding if a FPC entry is stale in seconds
- myProp.put(IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL, "120");
-
- IntegrityMonitor im = makeMonitor(resourceName, myProp);
-
- waitStep();
-
- // Add a group1 dependent resources to put an entry in the forward
- // progress table
- ForwardProgressEntity fpe = new ForwardProgressEntity();
- ForwardProgressEntity fpe2 = new ForwardProgressEntity();
- fpe.setFpcCount(0);
- fpe.setResourceName("group1_dep1");
- fpe2.setFpcCount(0);
- fpe2.setResourceName("group1_dep2");
- et = em.getTransaction();
- et.begin();
- em.persist(fpe);
- em.persist(fpe2);
- em.flush();
- et.commit();
-
- // Add a group2 dependent resource to the StateManagementEntity DB table
- // and set its admin state to locked
- // Expect sanity test to fail.
- StateManagement stateManager = new StateManagement(emf, "group2_dep1");
- stateManager.lock();
-
- new StateManagement(emf, "group1_dep1");
- new StateManagement(emf, "group1_dep2");
-
- // Call the dependency check directly instead of waiting for FPManager
- // to do it.
- logger.debug("\n\nIntegrityMonitor.testSanityState: calling im.dependencyCheck()\n\n");
- im.dependencyCheck();
- assertException(im, imx -> {
- imx.evaluateSanity();
- });
-
- logger.debug("\n\ntestSanityState: Exit\n\n");
- }
-
- @Test
- public void testRefreshStateAudit() throws Exception {
- logger.debug("\nIntegrityMonitorTest: testRefreshStateAudit Enter\n\n");
-
- // parameters are passed via a properties file
- myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "");
- myProp.put(IntegrityMonitorProperties.TEST_VIA_JMX, "false");
- // Disable the integrity monitor so it will not interfere
- myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "-1");
- // Disable the refresh state audit
- myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
- // Disable dependency checking so it does not interfere
- myProp.put(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, "-1");
- // Disable the state audit
- myProp.put(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, "-1");
- // Disable the test transaction
- myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "-1");
- // Disable writing the FPC
- myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "-1");
-
- IntegrityMonitor im = makeMonitor(resourceName, myProp);
-
- waitStep();
-
- // the state here is unlocked, enabled, null, null
- StateManagementEntity sme = null;
-
- Query query = em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource");
-
- query.setParameter("resource", resourceName);
-
- // Just test that we are retrieving the right object
- @SuppressWarnings("rawtypes")
- List resourceList = query.getResultList();
- if (!resourceList.isEmpty()) {
- // exist
- sme = (StateManagementEntity) resourceList.get(0);
- em.refresh(sme);
-
- logger.debug(
- "??? -- Retrieve StateManagementEntity from database --\nsme.getResourceName() = {}\n"
- + "sme.getAdminState() = {}\nsme.getOpState() = {}\nsme.getAvailStatus() = {}\nsme.getStandbyStatus() = {}",
- sme.getResourceName(), sme.getAdminState(), sme.getOpState(), sme.getAvailStatus(),
- sme.getStandbyStatus());
-
- assertEquals(StateManagement.UNLOCKED, sme.getAdminState());
- assertEquals(StateManagement.ENABLED, sme.getOpState());
- assertEquals(StateManagement.NULL_VALUE, sme.getAvailStatus());
- assertEquals(StateManagement.NULL_VALUE, sme.getStandbyStatus());
- logger.debug("--");
- } else {
- logger.debug("Record not found, resourceName: " + resourceName);
- fail("missing record");
- }
-
- et = em.getTransaction();
- et.begin();
-
- sme.setStandbyStatus(StateManagement.COLD_STANDBY);
- em.persist(sme);
- em.flush();
- et.commit();
-
- // Run the refreshStateAudit
- im.executeRefreshStateAudit();
-
- // The refreshStateAudit should run and change the state to
- // unlocked,enabled,null,hotstandby
- StateManagementEntity sme1 = null;
-
- Query query1 = em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource");
-
- query1.setParameter("resource", resourceName);
-
- @SuppressWarnings("rawtypes")
- List resourceList1 = query1.getResultList();
- if (!resourceList1.isEmpty()) {
- // exist
- sme1 = (StateManagementEntity) resourceList1.get(0);
- em.refresh(sme1);
- logger.debug(
- "??? -- Retrieve StateManagementEntity from database --\nsme1.getResourceName() = {}\n"
- + "sme1.getAdminState() = {}\nsme1.getOpState() = {}\nsme1.getAvailStatus() = {}\nsme1.getStandbyStatus() = {}",
- sme1.getResourceName(), sme1.getAdminState(), sme1.getOpState(), sme1.getAvailStatus(),
- sme1.getStandbyStatus());
-
- assertEquals(StateManagement.UNLOCKED, sme1.getAdminState());
- assertEquals(StateManagement.ENABLED, sme1.getOpState());
- assertEquals(StateManagement.NULL_VALUE, sme1.getAvailStatus());
- assertEquals(StateManagement.HOT_STANDBY, sme1.getStandbyStatus());
- logger.debug("--");
- } else {
- logger.debug("Record not found, resourceName: " + resourceName);
- fail("record not found");
- }
-
- logger.debug("\nIntegrityMonitorTest: testRefreshStateAudit Exit\n\n");
- }
-
- @Test
- public void testStateCheck() throws Exception {
- logger.debug("\nIntegrityMonitorTest: Entering testStateCheck\n\n");
-
- // parameters are passed via a properties file
- myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "group1_dep1");
- myProp.put(IntegrityMonitorProperties.TEST_VIA_JMX, "false");
- myProp.put(IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD, "1");
- /*
- * The monitorInterval is set to 10 and the failedCounterThreshold is 1
- * because stateCheck() uses the faileCounterThreshold * monitorInterval
- * to determine if an entry is stale, it will be stale after 10 seconds.
- */
- myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "5");
- /*
- * We accelerate the test transaction and write FPC intervals because we
- * don't want there to be any chance of a FPC failure because of the
- * short monitor interval
- */
- myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "1");
- myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "2");
- // Disable the refresh state audit
- myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
- // The maximum time in seconds to determine that a FPC entry is stale
- myProp.put(IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL, "5");
- myProp.put(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, "5");
-
- IntegrityMonitor im = makeMonitor(resourceName, myProp);
-
- // Note: do ***NOT*** do waitStep() here
-
- // Add a group1 dependent resources to put an entry in the forward
- // progress table
- // This sets lastUpdated to the current time
- ForwardProgressEntity fpe = new ForwardProgressEntity();
- fpe.setFpcCount(0);
- fpe.setResourceName("group1_dep1");
- et = em.getTransaction();
- et.begin();
- em.persist(fpe);
- em.flush();
- et.commit();
-
- new StateManagement(emf, "group1_dep1");
-
- assertNoException(im, imx -> {
- imx.evaluateSanity();
- });
-
- // wait for FPManager to perform dependency health check. Once that's
- // done,
- // it should now be stale and the sanity check should fail
- waitStep();
-
- assertException(im, imx -> {
- imx.evaluateSanity();
- });
-
- logger.debug("\n\ntestStateCheck: Exit\n\n");
- }
-
- @Test
- public void testGetAllForwardProgressEntity() throws Exception {
- logger.debug("\nIntegrityMonitorTest: Entering testGetAllForwardProgressEntity\n\n");
- // parameters are passed via a properties file
- myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "");
- myProp.put(IntegrityMonitorProperties.TEST_VIA_JMX, "false");
- // Disable the integrity monitor so it will not interfere
- myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "-1");
- // Disable the refresh state audit
- myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
- // Disable dependency checking so it does not interfere
- myProp.put(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, "-1");
- // Disable the state audit
- myProp.put(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, "-1");
- // Disable the test transaction
- myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "-1");
- // Disable writing the FPC
- myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "-1");
-
- IntegrityMonitor im = makeMonitor(resourceName, myProp);
- waitStep();
-
- logger.debug("\nIntegrityMonitorTest: Creating ForwardProgressEntity entries\n\n");
- // Add resource entries in the forward progress table
- ForwardProgressEntity fpe = new ForwardProgressEntity();
- ForwardProgressEntity fpe2 = new ForwardProgressEntity();
- ForwardProgressEntity fpe3 = new ForwardProgressEntity();
- fpe.setFpcCount(0);
- fpe.setResourceName("siteA_pap2");
- fpe2.setFpcCount(0);
- fpe2.setResourceName("siteB_pap1");
- fpe3.setFpcCount(0);
- fpe3.setResourceName("siteB_pap2");
- et = em.getTransaction();
- et.begin();
- em.persist(fpe);
- em.persist(fpe2);
- em.persist(fpe3);
- em.flush();
- et.commit();
-
- logger.debug(
- "\nIntegrityMonitorTest:testGetAllForwardProgressEntity Calling im.getAllForwardProgressEntity()\n\n");
- List<ForwardProgressEntity> fpeList = im.getAllForwardProgressEntity();
-
- assertEquals(4, fpeList.size());
-
- logger.debug("\nIntegrityMonitorTest: Exit testGetAllForwardProgressEntity\n\n");
- }
-
- @Test
- public void testStateAudit() throws Exception {
- logger.debug("\nIntegrityMonitorTest: Entering testStateAudit\n\n");
-
- // parameters are passed via a properties file
-
- // No Dependency Groups
- myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "");
- // Don't use JMX
- myProp.put(IntegrityMonitorProperties.TEST_VIA_JMX, "false");
- // Disable the internal sanity monitoring.
- myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "-1");
- // Disable the dependency monitoring.
- myProp.put(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, "-1");
- // Disable the refresh state audit
- myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
- // Disable the test transaction
- myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "-1");
- // Disable the write FPC
- myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "-1");
- // Disable the State Audit we will call it directly
- myProp.put(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, "-1");
- // Max interval for use in deciding if a FPC entry is stale in seconds
- myProp.put(IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL, "120");
-
- IntegrityMonitor im = makeMonitor(resourceName, myProp);
- waitStep();
-
- logger.debug("\nIntegrityMonitorTest: Creating ForwardProgressEntity entries\n\n");
- // Add resources to put an entry in the forward progress table
- Date staleDate = new Date(0);
- ForwardProgressEntity fpe1 = new ForwardProgressEntity();
- ForwardProgressEntity fpe2 = new ForwardProgressEntity();
- ForwardProgressEntity fpe3 = new ForwardProgressEntity();
- fpe1.setFpcCount(0);
- fpe1.setResourceName("siteA_pap2");
- fpe2.setFpcCount(0);
- fpe2.setResourceName("siteB_pap1");
- fpe3.setFpcCount(0);
- fpe3.setResourceName("siteB_pap2");
- logger.debug("\nIntegrityMonitorTest: Creating StateManagementEntity entries\n\n");
- StateManagementEntity sme1 = new StateManagementEntity();
- StateManagementEntity sme2 = new StateManagementEntity();
- StateManagementEntity sme3 = new StateManagementEntity();
- sme1.setResourceName("siteA_pap2");
- sme1.setAdminState(StateManagement.UNLOCKED);
- sme1.setOpState(StateManagement.ENABLED);
- sme1.setAvailStatus(StateManagement.NULL_VALUE);
- sme1.setStandbyStatus(StateManagement.NULL_VALUE);
- sme2.setResourceName("siteB_pap1");
- sme2.setAdminState(StateManagement.UNLOCKED);
- sme2.setOpState(StateManagement.ENABLED);
- sme2.setAvailStatus(StateManagement.NULL_VALUE);
- sme2.setStandbyStatus(StateManagement.NULL_VALUE);
- sme3.setResourceName("siteB_pap2");
- sme3.setAdminState(StateManagement.UNLOCKED);
- sme3.setOpState(StateManagement.ENABLED);
- sme3.setAvailStatus(StateManagement.NULL_VALUE);
- sme3.setStandbyStatus(StateManagement.NULL_VALUE);
- et = em.getTransaction();
- et.begin();
- em.persist(fpe1);
- em.persist(fpe2);
- em.persist(fpe3);
- em.persist(sme1);
- em.persist(sme2);
- em.persist(sme3);
- em.flush();
- et.commit();
-
- Query updateQuery = em.createQuery(
- "UPDATE ForwardProgressEntity f " + "SET f.lastUpdated = :newDate " + "WHERE f.resourceName=:resource");
- updateQuery.setParameter("newDate", staleDate, TemporalType.TIMESTAMP);
- updateQuery.setParameter("resource", fpe1.getResourceName());
-
- et = em.getTransaction();
- et.begin();
- updateQuery.executeUpdate();
- et.commit();
-
- logger.debug("\nIntegrityMonitorTest:testStateAudit Calling im.getAllForwardProgressEntity()\n\n");
- List<ForwardProgressEntity> fpeList = im.getAllForwardProgressEntity();
-
- logger.debug("\n\n");
- logger.debug("IntegrityMonitorTest:testStateAudit:ForwardProgressEntity entries");
- for (ForwardProgressEntity myFpe : fpeList) {
- logger.debug("\n ResourceName: {}" + "\n LastUpdated: {}", myFpe.getResourceName(),
- myFpe.getLastUpdated());
- }
- logger.debug("\n\n");
-
- logger.debug("\nIntegrityMonitorTest:testStateAudit getting list of StateManagementEntity entries\n\n");
- Query query = em.createQuery("SELECT s FROM StateManagementEntity s");
- List<?> smeList = query.getResultList();
-
- logger.debug("\n\n");
- logger.debug("IntegrityMonitorTest:testStateAudit:StateManagementEntity entries");
- for (Object mySme : smeList) {
- StateManagementEntity tmpSme = (StateManagementEntity) mySme;
- em.refresh(tmpSme);
- logger.debug(
- "\n ResourceName: {}" + "\n AdminState: {}" + "\n OpState: {}"
- + "\n AvailStatus: {}" + "\n StandbyStatus: {}",
- tmpSme.getResourceName(), tmpSme.getAdminState(), tmpSme.getOpState(), tmpSme.getAvailStatus(),
- tmpSme.getStandbyStatus());
- }
- logger.debug("\n\n");
-
- em.refresh(sme1);
- assertEquals(StateManagement.ENABLED, sme1.getOpState());
-
- logger.debug("IntegrityMonitorTest:testStateAudit: calling stateAudit()");
- im.executeStateAudit();
- logger.debug("IntegrityMonitorTest:testStateAudit: call to stateAudit() complete");
-
- logger.debug("\nIntegrityMonitorTest:testStateAudit getting list of StateManagementEntity entries\n\n");
- smeList = query.getResultList();
-
- logger.debug("\n\n");
- logger.debug("IntegrityMonitorTest:testStateAudit:StateManagementEntity entries");
- for (Object mySme : smeList) {
- StateManagementEntity tmpSme = (StateManagementEntity) mySme;
- em.refresh(tmpSme);
- logger.debug(
- "\n ResourceName: {}" + "\n AdminState: {}" + "\n OpState: {}"
- + "\n AvailStatus: {}" + "\n StandbyStatus: {}",
- tmpSme.getResourceName(), tmpSme.getAdminState(), tmpSme.getOpState(), tmpSme.getAvailStatus(),
- tmpSme.getStandbyStatus());
- }
- logger.debug("\n\n");
-
- em.refresh(sme1);
- assertEquals(StateManagement.DISABLED, sme1.getOpState());
-
- // Now let's add sme2 to the mix
- updateQuery = em.createQuery(
- "UPDATE ForwardProgressEntity f " + "SET f.lastUpdated = :newDate " + "WHERE f.resourceName=:resource");
- updateQuery.setParameter("newDate", staleDate, TemporalType.TIMESTAMP);
- updateQuery.setParameter("resource", fpe2.getResourceName());
-
- et = em.getTransaction();
- et.begin();
- updateQuery.executeUpdate();
- et.commit();
-
- // Give it a chance to write the DB and run the audit
- logger.debug("IntegrityMonitorTest:testStateAudit: (restart4) Running State Audit");
- waitStep();
- im.executeStateAudit();
- waitStep();
- logger.debug("IntegrityMonitorTest:testStateAudit: (restart4) State Audit complete");
-
- // Now check its state
- logger.debug(
- "\nIntegrityMonitorTest:testStateAudit (restart4) getting list of StateManagementEntity entries\n\n");
- smeList = query.getResultList();
-
- logger.debug("\n\n");
- logger.debug("IntegrityMonitorTest:testStateAudit:StateManagementEntity (restart4) entries");
- for (Object mySme : smeList) {
- StateManagementEntity tmpSme = (StateManagementEntity) mySme;
- em.refresh(tmpSme);
-
- logger.debug(
- "\n (restart4) ResourceName: {}" + "\n AdminState: {}" + "\n OpState: {}"
- + "\n AvailStatus: {}" + "\n StandbyStatus: {}",
- tmpSme.getResourceName(), tmpSme.getAdminState(), tmpSme.getOpState(), tmpSme.getAvailStatus(),
- tmpSme.getStandbyStatus());
- }
- logger.debug("\n\n");
-
- em.refresh(sme1);
- assertEquals(StateManagement.DISABLED, sme1.getOpState());
-
- em.refresh(sme2);
- assertEquals(StateManagement.DISABLED, sme2.getOpState());
-
- logger.debug("\nIntegrityMonitorTest: Exit testStateAudit\n\n");
- System.out.println("\n\ntestStateAudit: Exit\n\n");
- }
-
- private IntegrityMonitor makeMonitor(String resourceName, Properties myProp) throws Exception {
- IntegrityMonitor.deleteInstance();
-
- queue = new LinkedBlockingQueue<>();
-
- IntegrityMonitor im = IntegrityMonitor.getInstance(resourceName, myProp, queue);
-
- // wait for the monitor thread to start
- waitStep();
-
- return im;
- }
-
- /**
- * Waits for the FPManager to complete another cycle.
- *
- * @throws InterruptedException
- */
- private void waitStep() throws InterruptedException {
- CountDownLatch latch = new CountDownLatch(1);
- queue.offer(latch);
- waitLatch(latch);
- }
+ private static Logger logger = LoggerFactory.getLogger(IntegrityMonitorTest.class);
+
+ private static Properties myProp;
+ private static EntityTransaction et;
+ private static String resourceName;
+
+ private BlockingQueue<CountDownLatch> queue;
+
+ /**
+ * Set up for test class.
+ */
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ IntegrityMonitorTestBase.setUpBeforeClass(DEFAULT_DB_URL_PREFIX + IntegrityMonitorTest.class.getSimpleName());
+
+ resourceName = IntegrityMonitorTestBase.siteName + "." + IntegrityMonitorTestBase.nodeType;
+ }
+
+ /**
+ * Tear down after test class.
+ */
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ IntegrityMonitorTestBase.tearDownAfterClass();
+ }
+
+ /**
+ * Set up for test cases.
+ */
+ @Before
+ public void setUp() throws Exception {
+ super.setUpTest();
+
+ myProp = makeProperties();
+ et = null;
+ }
+
+ /**
+ * Tear down after test cases.
+ */
+ @After
+ public void tearDown() throws Exception {
+ if (et != null && et.isActive()) {
+ try {
+ et.rollback();
+
+ } catch (RuntimeException e) {
+ logger.error("cannot rollback transaction", e);
+ }
+ }
+
+ super.tearDownTest();
+ }
+
+ /*
+ * The following test verifies the following test cases: New Install New Install - Bad
+ * Dependency data Recovery from bad dependency data Lock Lock restart Unlock Unlock restart
+ */
+ @Test
+ public void testSanityJmx() throws Exception {
+ logger.debug("\nIntegrityMonitorTest: Entering testSanityJmx\n\n");
+
+ String dependent = "group1_logparser";
+
+ // parameters are passed via a properties file
+ myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, dependent);
+ myProp.put(IntegrityMonitorProperties.TEST_VIA_JMX, "true");
+ // Disable the integrity monitor so it will not interfere
+ myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "-1");
+ // Disable the refresh state audit
+ myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
+ // Disable the state audit
+ myProp.put(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, "-1");
+ // Disable the test transaction
+ myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "-1");
+ // Disable the write FPC
+ myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "-1");
+ // Speed up the check
+ myProp.put(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, "1");
+ // Fail dependencies after three seconds
+ myProp.put(IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL, "3");
+
+ IntegrityMonitor im = makeMonitor(resourceName, myProp);
+ logger.debug(
+ "\n\ntestSanityJmx starting im state \nAdminState = {}\nOpState() = {}\nAvailStatus = {}\n"
+ + "StandbyStatus = {}\n",
+ im.getStateManager().getAdminState(), im.getStateManager().getOpState(),
+ im.getStateManager().getAvailStatus(), im.getStateManager().getStandbyStatus());
+ // add an entry to Resource registration table in the DB for the
+ // dependent resource
+
+ et = em.getTransaction();
+ et.begin();
+ Query rquery = em.createQuery("Select r from ResourceRegistrationEntity r where r.resourceName=:rn");
+ rquery.setParameter("rn", dependent);
+
+ @SuppressWarnings("rawtypes")
+ List rrList = rquery.getResultList();
+ ResourceRegistrationEntity rrx = null;
+ if (rrList.isEmpty()) {
+ // register resource by adding entry to table in DB
+ logger.debug("Adding resource {} to ResourceRegistration table", dependent);
+ rrx = new ResourceRegistrationEntity();
+ // set columns in entry
+ rrx.setResourceName(dependent);
+ rrx.setResourceUrl("service:jmx:somewhere:9999");
+ rrx.setNodeType("logparser");
+ rrx.setSite("siteA");
+ }
+ em.persist(rrx);
+ // flush to the DB
+ em.flush();
+
+ // commit transaction
+ et.commit();
+
+ // wait for the FPManager to check dependency health
+ waitStep();
+
+ assertException(im, imx -> {
+ imx.evaluateSanity();
+ });
+
+ // undo dependency groups and jmx test properties settings
+ myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "");
+ myProp.put(IntegrityMonitorProperties.TEST_VIA_JMX, "false");
+ IntegrityMonitor.updateProperties(myProp);
+
+ logger.debug("\ntestSantityJmx ending properties: {}", myProp);
+
+ // We know at this point that the IM is disable-dependency. We want to
+ // be
+ // sure it will recover from this condition since the properties were
+ // updated.
+
+ logger.debug(
+ "\n\ntestSanityJmx ending im state\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\n"
+ + "StandbyStatus = {}\n",
+ im.getStateManager().getAdminState(), im.getStateManager().getOpState(),
+ im.getStateManager().getAvailStatus(), im.getStateManager().getStandbyStatus());
+
+ logger.debug("\ntestSanityJmx restarting the IntegrityMonitor");
+ // Create a new instance. It should recover from the disabled-dependency
+ // condition
+ im = makeMonitor(resourceName, myProp);
+
+ logger.debug(
+ "\n\ntestSanityJmx state after creating new im\n"
+ + "AdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ im.getStateManager().getAdminState(), im.getStateManager().getOpState(),
+ im.getStateManager().getAvailStatus(), im.getStateManager().getStandbyStatus());
+
+ // Verify the state
+ assertEquals(StateManagement.UNLOCKED, im.getStateManager().getAdminState());
+ assertEquals(StateManagement.ENABLED, im.getStateManager().getOpState());
+ assertEquals(StateManagement.NULL_VALUE, im.getStateManager().getAvailStatus());
+ assertEquals(StateManagement.NULL_VALUE, im.getStateManager().getStandbyStatus());
+
+ // Test state manager via the IntegrityMonitor
+ StateManagement sm = im.getStateManager();
+
+ // Verify lock state
+ sm.lock();
+ logger.debug("\n\nsm.lock()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+ assertEquals(StateManagement.LOCKED, sm.getAdminState());
+
+ // Verify lock persists across a restart
+ logger.debug("\ntestSanityJmx restarting the IntegrityMonitor");
+ // Create a new instance. It should come up with the admin state locked
+ im = makeMonitor(resourceName, myProp);
+ sm = im.getStateManager();
+ logger.debug(
+ "\n\ntestSanityJmx restart with AdminState=locked"
+ + "\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+ assertEquals(StateManagement.LOCKED, sm.getAdminState());
+
+ // Verify unlock
+ sm.unlock();
+ logger.debug(
+ "\n\ntestSanityJmx sm.unlock\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+ assertEquals(StateManagement.UNLOCKED, sm.getAdminState());
+
+ // Verify unlock restart
+ logger.debug("\ntestSanityJmx restarting the IntegrityMonitor");
+ // Create a new instance. It should come up with the admin state locked
+ im = makeMonitor(resourceName, myProp);
+ sm = im.getStateManager();
+ logger.debug(
+ "\n\ntestSanityJmx restart with AdminState=unlocked\n"
+ + "AdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+
+ assertEquals(StateManagement.UNLOCKED, sm.getAdminState());
+
+ logger.debug("\n\ntestSanityJmx: Exit\n\n");
+ }
+
+ @Test
+ public void testIm() throws Exception {
+ logger.debug("\nIntegrityMonitorTest: Entering testIM\n\n");
+
+ // Disable the integrity monitor so it will not interfere
+ myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "-1");
+ // Disable dependency checking
+ myProp.put(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, "-1");
+ // Disable the refresh state audit
+ myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
+ // Disable the state audit
+ myProp.put(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, "-1");
+ // Disable the test transaction
+ myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "-1");
+ // Disable writing the FPC
+ myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "-1");
+
+ IntegrityMonitor im = makeMonitor(resourceName, myProp);
+
+ logger.debug("\n\nim initial state: \nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ im.getStateManager().getAdminState(), im.getStateManager().getOpState(),
+ im.getStateManager().getAvailStatus(), im.getStateManager().getStandbyStatus());
+
+ waitStep();
+
+ // test evaluate sanity
+ assertNoException(im, imx -> {
+ imx.evaluateSanity();
+ });
+
+ // Test startTransaction - should work since it is unlocked
+ assertNoException(im, imx -> {
+ imx.startTransaction();
+ });
+
+ // Test state manager via the IntegrityMonitor
+ StateManagement sm = im.getStateManager();
+
+ sm.lock();
+
+ logger.debug("\n\nsm.lock()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+
+ assertEquals(StateManagement.LOCKED, sm.getAdminState());
+
+ // test startTransaction. It should fail since it is locked
+ assertException(im, imx -> {
+ imx.startTransaction();
+ });
+
+ sm.unlock();
+ logger.debug("\n\nsm.unlock()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+ assertEquals(StateManagement.UNLOCKED, sm.getAdminState());
+
+ // test startTransaction. It should succeed
+ assertNoException(im, imx -> {
+ imx.startTransaction();
+ });
+
+ sm.disableDependency();
+ logger.debug(
+ "\n\nsm.disableDependency()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+
+ assertEquals(StateManagement.DISABLED, sm.getOpState());
+ assertEquals(StateManagement.DEPENDENCY, sm.getAvailStatus());
+
+ // test startTransaction. It should succeed since standby status is null
+ // and unlocked
+ assertNoException(im, imx -> {
+ imx.startTransaction();
+ });
+
+ sm.enableNoDependency();
+
+ logger.debug(
+ "\n\nsm.enableNoDependency()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+ assertEquals(StateManagement.ENABLED, sm.getOpState());
+ // test startTransaction. It should succeed since standby status is null
+ // and unlocked
+ assertNoException(im, imx -> {
+ imx.startTransaction();
+ });
+
+ sm.disableFailed();
+ logger.debug("\n\nsm.disableFailed()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+
+ assertEquals(StateManagement.DISABLED, sm.getOpState());
+ assertEquals(StateManagement.FAILED, sm.getAvailStatus());
+ // test startTransaction. It should succeed since standby status is null
+ // and unlocked
+ assertNoException(im, imx -> {
+ imx.startTransaction();
+ });
+
+ sm.enableNotFailed();
+
+ logger.debug(
+ "\n\nsm.enabledNotFailed()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+
+ assertEquals(StateManagement.ENABLED, sm.getOpState());
+ // test startTransaction. It should succeed since standby status is null
+ // and unlocked
+ assertNoException(im, imx -> {
+ imx.startTransaction();
+ });
+
+ sm.demote();
+
+ logger.debug("\n\nsm.demote()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+
+ assertEquals(StateManagement.HOT_STANDBY, sm.getStandbyStatus());
+
+ // test startTransaction. It should fail since it is standby
+ assertException(im, imx -> {
+ imx.startTransaction();
+ });
+
+ sm.promote();
+
+ logger.debug("\n\nsm.promote()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+
+ assertEquals(StateManagement.PROVIDING_SERVICE, sm.getStandbyStatus());
+
+ // test startTransaction. It should succeed since it is providing
+ // service
+ assertNoException(im, imx -> {
+ imx.startTransaction();
+ });
+
+ // Test the multi-valued availability status
+ sm.disableDependency();
+ sm.disableFailed();
+
+ logger.debug(
+ "\n\nsm.disableDependency(), sm.disableFailed\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\n"
+ + "StandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+
+ assertEquals(StateManagement.DEPENDENCY_FAILED, sm.getAvailStatus());
+
+ // Test startTransaction. Should fail since standby status is cold
+ // standby
+ assertException(im, imx -> {
+ imx.startTransaction();
+ });
+
+ sm.enableNoDependency();
+
+ logger.debug(
+ "\n\nsm.enableNoDependency()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+ assertEquals(StateManagement.FAILED, sm.getAvailStatus());
+ // Test startTransaction. Should fail since standby status is cold
+ // standby
+ assertException(im, imx -> {
+ imx.startTransaction();
+ });
+
+ sm.disableDependency();
+ sm.enableNotFailed();
+
+ logger.debug(
+ "\n\nsm.disableDependency(),sm.enableNotFailed()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\n"
+ + "StandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+
+ assertEquals(StateManagement.DEPENDENCY, sm.getAvailStatus());
+ // Test startTransaction. Should fail since standby status is cold
+ // standby
+ assertException(im, imx -> {
+ imx.startTransaction();
+ });
+
+ sm.enableNoDependency();
+ logger.debug(
+ "\n\nsm.enableNoDependency()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
+ sm.getAdminState(), sm.getOpState(), sm.getAvailStatus(), sm.getStandbyStatus());
+ assertEquals(StateManagement.ENABLED, sm.getOpState());
+ // test startTransaction. It should fail since standby status is hot
+ // standby
+ assertException(im, imx -> {
+ imx.startTransaction();
+ });
+
+ logger.debug("\n\ntestIM: Exit\n\n");
+ }
+
+ @Test
+ public void testSanityState() throws Exception {
+ logger.debug("\nIntegrityMonitorTest: Entering testSanityState\n\n");
+
+ // parameters are passed via a properties file
+ myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "group1_dep1,group1_dep2; group2_dep1");
+ // Disable the integrity monitor so it will not interfere
+ myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "-1");
+ // Disable the refresh state audit
+ myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
+ // Disable dependency checking so it does not interfere
+ myProp.put(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, "-1");
+ // Disable the state audit
+ myProp.put(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, "-1");
+ // Disable the test transaction
+ myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "-1");
+ // Disable writing the FPC
+ myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "-1");
+ // Max interval for use in deciding if a FPC entry is stale in seconds
+ myProp.put(IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL, "120");
+
+ final IntegrityMonitor im = makeMonitor(resourceName, myProp);
+
+ waitStep();
+
+ // Add a group1 dependent resources to put an entry in the forward
+ // progress table
+ ForwardProgressEntity fpe = new ForwardProgressEntity();
+ ForwardProgressEntity fpe2 = new ForwardProgressEntity();
+ fpe.setFpcCount(0);
+ fpe.setResourceName("group1_dep1");
+ fpe2.setFpcCount(0);
+ fpe2.setResourceName("group1_dep2");
+ et = em.getTransaction();
+ et.begin();
+ em.persist(fpe);
+ em.persist(fpe2);
+ em.flush();
+ et.commit();
+
+ // Add a group2 dependent resource to the StateManagementEntity DB table
+ // and set its admin state to locked
+ // Expect sanity test to fail.
+ StateManagement stateManager = new StateManagement(emf, "group2_dep1");
+ stateManager.lock();
+
+ new StateManagement(emf, "group1_dep1");
+ new StateManagement(emf, "group1_dep2");
+
+ // Call the dependency check directly instead of waiting for FPManager
+ // to do it.
+ logger.debug("\n\nIntegrityMonitor.testSanityState: calling im.dependencyCheck()\n\n");
+ im.dependencyCheck();
+ assertException(im, imx -> {
+ imx.evaluateSanity();
+ });
+
+ logger.debug("\n\ntestSanityState: Exit\n\n");
+ }
+
+ @Test
+ public void testRefreshStateAudit() throws Exception {
+ logger.debug("\nIntegrityMonitorTest: testRefreshStateAudit Enter\n\n");
+
+ // parameters are passed via a properties file
+ myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "");
+ myProp.put(IntegrityMonitorProperties.TEST_VIA_JMX, "false");
+ // Disable the integrity monitor so it will not interfere
+ myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "-1");
+ // Disable the refresh state audit
+ myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
+ // Disable dependency checking so it does not interfere
+ myProp.put(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, "-1");
+ // Disable the state audit
+ myProp.put(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, "-1");
+ // Disable the test transaction
+ myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "-1");
+ // Disable writing the FPC
+ myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "-1");
+
+ final IntegrityMonitor im = makeMonitor(resourceName, myProp);
+
+ waitStep();
+
+ // the state here is unlocked, enabled, null, null
+ StateManagementEntity sme = null;
+
+ Query query = em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource");
+
+ query.setParameter("resource", resourceName);
+
+ // Just test that we are retrieving the right object
+ @SuppressWarnings("rawtypes")
+ List resourceList = query.getResultList();
+ if (!resourceList.isEmpty()) {
+ // exist
+ sme = (StateManagementEntity) resourceList.get(0);
+ em.refresh(sme);
+
+ logger.debug(
+ "??? -- Retrieve StateManagementEntity from database --\nsme.getResourceName() = {}\n"
+ + "sme.getAdminState() = {}\nsme.getOpState() = {}\nsme.getAvailStatus() = {}\n"
+ + "sme.getStandbyStatus() = {}",
+ sme.getResourceName(), sme.getAdminState(), sme.getOpState(), sme.getAvailStatus(),
+ sme.getStandbyStatus());
+
+ assertEquals(StateManagement.UNLOCKED, sme.getAdminState());
+ assertEquals(StateManagement.ENABLED, sme.getOpState());
+ assertEquals(StateManagement.NULL_VALUE, sme.getAvailStatus());
+ assertEquals(StateManagement.NULL_VALUE, sme.getStandbyStatus());
+ logger.debug("--");
+ } else {
+ logger.debug("Record not found, resourceName: " + resourceName);
+ fail("missing record");
+ }
+
+ et = em.getTransaction();
+ et.begin();
+
+ sme.setStandbyStatus(StateManagement.COLD_STANDBY);
+ em.persist(sme);
+ em.flush();
+ et.commit();
+
+ // Run the refreshStateAudit
+ im.executeRefreshStateAudit();
+
+ // The refreshStateAudit should run and change the state to
+ // unlocked,enabled,null,hotstandby
+ StateManagementEntity sme1 = null;
+
+ Query query1 = em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource");
+
+ query1.setParameter("resource", resourceName);
+
+ @SuppressWarnings("rawtypes")
+ List resourceList1 = query1.getResultList();
+ if (!resourceList1.isEmpty()) {
+ // exist
+ sme1 = (StateManagementEntity) resourceList1.get(0);
+ em.refresh(sme1);
+ logger.debug(
+ "??? -- Retrieve StateManagementEntity from database --\nsme1.getResourceName() = {}\n"
+ + "sme1.getAdminState() = {}\nsme1.getOpState() = {}\nsme1.getAvailStatus() = {}\n"
+ + "sme1.getStandbyStatus() = {}",
+ sme1.getResourceName(), sme1.getAdminState(), sme1.getOpState(), sme1.getAvailStatus(),
+ sme1.getStandbyStatus());
+
+ assertEquals(StateManagement.UNLOCKED, sme1.getAdminState());
+ assertEquals(StateManagement.ENABLED, sme1.getOpState());
+ assertEquals(StateManagement.NULL_VALUE, sme1.getAvailStatus());
+ assertEquals(StateManagement.HOT_STANDBY, sme1.getStandbyStatus());
+ logger.debug("--");
+ } else {
+ logger.debug("Record not found, resourceName: " + resourceName);
+ fail("record not found");
+ }
+
+ logger.debug("\nIntegrityMonitorTest: testRefreshStateAudit Exit\n\n");
+ }
+
+ @Test
+ public void testStateCheck() throws Exception {
+ logger.debug("\nIntegrityMonitorTest: Entering testStateCheck\n\n");
+
+ // parameters are passed via a properties file
+ myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "group1_dep1");
+ myProp.put(IntegrityMonitorProperties.TEST_VIA_JMX, "false");
+ myProp.put(IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD, "1");
+ /*
+ * The monitorInterval is set to 10 and the failedCounterThreshold is 1 because stateCheck()
+ * uses the faileCounterThreshold * monitorInterval to determine if an entry is stale, it
+ * will be stale after 10 seconds.
+ */
+ myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "5");
+ /*
+ * We accelerate the test transaction and write FPC intervals because we don't want there to
+ * be any chance of a FPC failure because of the short monitor interval
+ */
+ myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "1");
+ myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "2");
+ // Disable the refresh state audit
+ myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
+ // The maximum time in seconds to determine that a FPC entry is stale
+ myProp.put(IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL, "5");
+ myProp.put(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, "5");
+
+ IntegrityMonitor im = makeMonitor(resourceName, myProp);
+
+ // Note: do ***NOT*** do waitStep() here
+
+ // Add a group1 dependent resources to put an entry in the forward
+ // progress table
+ // This sets lastUpdated to the current time
+ ForwardProgressEntity fpe = new ForwardProgressEntity();
+ fpe.setFpcCount(0);
+ fpe.setResourceName("group1_dep1");
+ et = em.getTransaction();
+ et.begin();
+ em.persist(fpe);
+ em.flush();
+ et.commit();
+
+ new StateManagement(emf, "group1_dep1");
+
+ assertNoException(im, imx -> {
+ imx.evaluateSanity();
+ });
+
+ // wait for FPManager to perform dependency health check. Once that's
+ // done,
+ // it should now be stale and the sanity check should fail
+ waitStep();
+
+ assertException(im, imx -> {
+ imx.evaluateSanity();
+ });
+
+ logger.debug("\n\ntestStateCheck: Exit\n\n");
+ }
+
+ @Test
+ public void testGetAllForwardProgressEntity() throws Exception {
+ logger.debug("\nIntegrityMonitorTest: Entering testGetAllForwardProgressEntity\n\n");
+ // parameters are passed via a properties file
+ myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "");
+ myProp.put(IntegrityMonitorProperties.TEST_VIA_JMX, "false");
+ // Disable the integrity monitor so it will not interfere
+ myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "-1");
+ // Disable the refresh state audit
+ myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
+ // Disable dependency checking so it does not interfere
+ myProp.put(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, "-1");
+ // Disable the state audit
+ myProp.put(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, "-1");
+ // Disable the test transaction
+ myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "-1");
+ // Disable writing the FPC
+ myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "-1");
+
+ final IntegrityMonitor im = makeMonitor(resourceName, myProp);
+ waitStep();
+
+ logger.debug("\nIntegrityMonitorTest: Creating ForwardProgressEntity entries\n\n");
+ // Add resource entries in the forward progress table
+ final ForwardProgressEntity fpe = new ForwardProgressEntity();
+ final ForwardProgressEntity fpe2 = new ForwardProgressEntity();
+ final ForwardProgressEntity fpe3 = new ForwardProgressEntity();
+ fpe.setFpcCount(0);
+ fpe.setResourceName("siteA_pap2");
+ fpe2.setFpcCount(0);
+ fpe2.setResourceName("siteB_pap1");
+ fpe3.setFpcCount(0);
+ fpe3.setResourceName("siteB_pap2");
+ et = em.getTransaction();
+ et.begin();
+ em.persist(fpe);
+ em.persist(fpe2);
+ em.persist(fpe3);
+ em.flush();
+ et.commit();
+
+ logger.debug(
+ "\nIntegrityMonitorTest:testGetAllForwardProgressEntity Calling im.getAllForwardProgressEntity()\n\n");
+ List<ForwardProgressEntity> fpeList = im.getAllForwardProgressEntity();
+
+ assertEquals(4, fpeList.size());
+
+ logger.debug("\nIntegrityMonitorTest: Exit testGetAllForwardProgressEntity\n\n");
+ }
+
+ @Test
+ public void testStateAudit() throws Exception {
+ logger.debug("\nIntegrityMonitorTest: Entering testStateAudit\n\n");
+
+ // parameters are passed via a properties file
+
+ // No Dependency Groups
+ myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "");
+ // Don't use JMX
+ myProp.put(IntegrityMonitorProperties.TEST_VIA_JMX, "false");
+ // Disable the internal sanity monitoring.
+ myProp.put(IntegrityMonitorProperties.FP_MONITOR_INTERVAL, "-1");
+ // Disable the dependency monitoring.
+ myProp.put(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, "-1");
+ // Disable the refresh state audit
+ myProp.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, "-1");
+ // Disable the test transaction
+ myProp.put(IntegrityMonitorProperties.TEST_TRANS_INTERVAL, "-1");
+ // Disable the write FPC
+ myProp.put(IntegrityMonitorProperties.WRITE_FPC_INTERVAL, "-1");
+ // Disable the State Audit we will call it directly
+ myProp.put(IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, "-1");
+ // Max interval for use in deciding if a FPC entry is stale in seconds
+ myProp.put(IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL, "120");
+
+ final IntegrityMonitor im = makeMonitor(resourceName, myProp);
+ waitStep();
+
+ logger.debug("\nIntegrityMonitorTest: Creating ForwardProgressEntity entries\n\n");
+ // Add resources to put an entry in the forward progress table
+ final Date staleDate = new Date(0);
+ final ForwardProgressEntity fpe1 = new ForwardProgressEntity();
+ final ForwardProgressEntity fpe2 = new ForwardProgressEntity();
+ final ForwardProgressEntity fpe3 = new ForwardProgressEntity();
+ fpe1.setFpcCount(0);
+ fpe1.setResourceName("siteA_pap2");
+ fpe2.setFpcCount(0);
+ fpe2.setResourceName("siteB_pap1");
+ fpe3.setFpcCount(0);
+ fpe3.setResourceName("siteB_pap2");
+ logger.debug("\nIntegrityMonitorTest: Creating StateManagementEntity entries\n\n");
+ final StateManagementEntity sme1 = new StateManagementEntity();
+ final StateManagementEntity sme2 = new StateManagementEntity();
+ final StateManagementEntity sme3 = new StateManagementEntity();
+ sme1.setResourceName("siteA_pap2");
+ sme1.setAdminState(StateManagement.UNLOCKED);
+ sme1.setOpState(StateManagement.ENABLED);
+ sme1.setAvailStatus(StateManagement.NULL_VALUE);
+ sme1.setStandbyStatus(StateManagement.NULL_VALUE);
+ sme2.setResourceName("siteB_pap1");
+ sme2.setAdminState(StateManagement.UNLOCKED);
+ sme2.setOpState(StateManagement.ENABLED);
+ sme2.setAvailStatus(StateManagement.NULL_VALUE);
+ sme2.setStandbyStatus(StateManagement.NULL_VALUE);
+ sme3.setResourceName("siteB_pap2");
+ sme3.setAdminState(StateManagement.UNLOCKED);
+ sme3.setOpState(StateManagement.ENABLED);
+ sme3.setAvailStatus(StateManagement.NULL_VALUE);
+ sme3.setStandbyStatus(StateManagement.NULL_VALUE);
+ et = em.getTransaction();
+ et.begin();
+ em.persist(fpe1);
+ em.persist(fpe2);
+ em.persist(fpe3);
+ em.persist(sme1);
+ em.persist(sme2);
+ em.persist(sme3);
+ em.flush();
+ et.commit();
+
+ Query updateQuery = em.createQuery(
+ "UPDATE ForwardProgressEntity f " + "SET f.lastUpdated = :newDate " + "WHERE f.resourceName=:resource");
+ updateQuery.setParameter("newDate", staleDate, TemporalType.TIMESTAMP);
+ updateQuery.setParameter("resource", fpe1.getResourceName());
+
+ et = em.getTransaction();
+ et.begin();
+ updateQuery.executeUpdate();
+ et.commit();
+
+ logger.debug("\nIntegrityMonitorTest:testStateAudit Calling im.getAllForwardProgressEntity()\n\n");
+ List<ForwardProgressEntity> fpeList = im.getAllForwardProgressEntity();
+
+ logger.debug("\n\n");
+ logger.debug("IntegrityMonitorTest:testStateAudit:ForwardProgressEntity entries");
+ for (ForwardProgressEntity myFpe : fpeList) {
+ logger.debug("\n ResourceName: {}" + "\n LastUpdated: {}", myFpe.getResourceName(),
+ myFpe.getLastUpdated());
+ }
+ logger.debug("\n\n");
+
+ logger.debug("\nIntegrityMonitorTest:testStateAudit getting list of StateManagementEntity entries\n\n");
+ Query query = em.createQuery("SELECT s FROM StateManagementEntity s");
+ List<?> smeList = query.getResultList();
+
+ logger.debug("\n\n");
+ logger.debug("IntegrityMonitorTest:testStateAudit:StateManagementEntity entries");
+ for (Object mySme : smeList) {
+ StateManagementEntity tmpSme = (StateManagementEntity) mySme;
+ em.refresh(tmpSme);
+ logger.debug(
+ "\n ResourceName: {}" + "\n AdminState: {}" + "\n OpState: {}"
+ + "\n AvailStatus: {}" + "\n StandbyStatus: {}",
+ tmpSme.getResourceName(), tmpSme.getAdminState(), tmpSme.getOpState(), tmpSme.getAvailStatus(),
+ tmpSme.getStandbyStatus());
+ }
+ logger.debug("\n\n");
+
+ em.refresh(sme1);
+ assertEquals(StateManagement.ENABLED, sme1.getOpState());
+
+ logger.debug("IntegrityMonitorTest:testStateAudit: calling stateAudit()");
+ im.executeStateAudit();
+ logger.debug("IntegrityMonitorTest:testStateAudit: call to stateAudit() complete");
+
+ logger.debug("\nIntegrityMonitorTest:testStateAudit getting list of StateManagementEntity entries\n\n");
+ smeList = query.getResultList();
+
+ logger.debug("\n\n");
+ logger.debug("IntegrityMonitorTest:testStateAudit:StateManagementEntity entries");
+ for (Object mySme : smeList) {
+ StateManagementEntity tmpSme = (StateManagementEntity) mySme;
+ em.refresh(tmpSme);
+ logger.debug(
+ "\n ResourceName: {}" + "\n AdminState: {}" + "\n OpState: {}"
+ + "\n AvailStatus: {}" + "\n StandbyStatus: {}",
+ tmpSme.getResourceName(), tmpSme.getAdminState(), tmpSme.getOpState(), tmpSme.getAvailStatus(),
+ tmpSme.getStandbyStatus());
+ }
+ logger.debug("\n\n");
+
+ em.refresh(sme1);
+ assertEquals(StateManagement.DISABLED, sme1.getOpState());
+
+ // Now let's add sme2 to the mix
+ updateQuery = em.createQuery(
+ "UPDATE ForwardProgressEntity f " + "SET f.lastUpdated = :newDate " + "WHERE f.resourceName=:resource");
+ updateQuery.setParameter("newDate", staleDate, TemporalType.TIMESTAMP);
+ updateQuery.setParameter("resource", fpe2.getResourceName());
+
+ et = em.getTransaction();
+ et.begin();
+ updateQuery.executeUpdate();
+ et.commit();
+
+ // Give it a chance to write the DB and run the audit
+ logger.debug("IntegrityMonitorTest:testStateAudit: (restart4) Running State Audit");
+ waitStep();
+ im.executeStateAudit();
+ waitStep();
+ logger.debug("IntegrityMonitorTest:testStateAudit: (restart4) State Audit complete");
+
+ // Now check its state
+ logger.debug(
+ "\nIntegrityMonitorTest:testStateAudit (restart4) getting list of StateManagementEntity entries\n\n");
+ smeList = query.getResultList();
+
+ logger.debug("\n\n");
+ logger.debug("IntegrityMonitorTest:testStateAudit:StateManagementEntity (restart4) entries");
+ for (Object mySme : smeList) {
+ StateManagementEntity tmpSme = (StateManagementEntity) mySme;
+ em.refresh(tmpSme);
+
+ logger.debug(
+ "\n (restart4) ResourceName: {}" + "\n AdminState: {}" + "\n OpState: {}"
+ + "\n AvailStatus: {}" + "\n StandbyStatus: {}",
+ tmpSme.getResourceName(), tmpSme.getAdminState(), tmpSme.getOpState(), tmpSme.getAvailStatus(),
+ tmpSme.getStandbyStatus());
+ }
+ logger.debug("\n\n");
+
+ em.refresh(sme1);
+ assertEquals(StateManagement.DISABLED, sme1.getOpState());
+
+ em.refresh(sme2);
+ assertEquals(StateManagement.DISABLED, sme2.getOpState());
+
+ logger.debug("\nIntegrityMonitorTest: Exit testStateAudit\n\n");
+ System.out.println("\n\ntestStateAudit: Exit\n\n");
+ }
+
+ private IntegrityMonitor makeMonitor(String resourceName, Properties myProp) throws Exception {
+ IntegrityMonitor.deleteInstance();
+
+ queue = new LinkedBlockingQueue<>();
+
+ IntegrityMonitor im = IntegrityMonitor.getInstance(resourceName, myProp, queue);
+
+ // wait for the monitor thread to start
+ waitStep();
+
+ return im;
+ }
+
+ /**
+ * Waits for the FPManager to complete another cycle.
+ *
+ * @throws InterruptedException if the thread is interrupted
+ */
+ private void waitStep() throws InterruptedException {
+ CountDownLatch latch = new CountDownLatch(1);
+ queue.offer(latch);
+ waitLatch(latch);
+ }
}
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java
index 84d0b51a..0c8259b7 100644
--- a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java
+++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java
@@ -39,268 +39,257 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * All JUnits are designed to run in the local development environment where
- * they have write privileges and can execute time-sensitive tasks.
- * <p/>
- * Many of the test verification steps are performed by scanning for items
- * written to the log file. Rather than actually scan the log file, an
- * {@link ExtractAppender} is used to monitor events that are logged and extract
- * relevant items. In order to attach the appender to the debug log, it assumes
- * that the debug log is a <i>logback</i> Logger configured per EELF.
- * <p/>
- * These tests use a temporary, in-memory DB, which is dropped once the tests
- * complete.
+ * All JUnits are designed to run in the local development environment where they have write
+ * privileges and can execute time-sensitive tasks. <p/> Many of the test verification steps are
+ * performed by scanning for items written to the log file. Rather than actually scan the log file,
+ * an {@link ExtractAppender} is used to monitor events that are logged and extract relevant items.
+ * In order to attach the appender to the debug log, it assumes that the debug log is a
+ * <i>logback</i> Logger configured per EELF. <p/> These tests use a temporary, in-memory DB, which
+ * is dropped once the tests complete.
*/
public class IntegrityMonitorTestBase {
- private static Logger logger = LoggerFactory.getLogger(IntegrityMonitorTestBase.class);
-
- /**
- * Directory containing the slf4j log files.
- */
- private static final String SLF4J_LOG_DIR = "logs";
-
- private static final String JMX_PORT_PROP = "com.sun.management.jmxremote.port";
-
- /**
- * Max time, in milliseconds, to wait for a latch to be triggered.
- */
- protected static final long WAIT_MS = 5000l;
-
- /**
- * Milliseconds that monitor should sleep between cycles.
- */
- protected static final long CYCLE_INTERVAL_MS = 2l;
-
- public static final String DEFAULT_DB_URL_PREFIX = "jdbc:h2:mem:";
-
- protected static final String dbDriver = "org.h2.Driver";
- protected static final String dbUser = "testu";
- protected static final String dbPwd = "testp";
- protected static final String siteName = "SiteA";
- protected static final String nodeType = "pap";
-
- // will be defined by the test *Classes*
- protected static String dbUrl;
-
- /**
- * Persistence unit.
- */
- protected static final String PERSISTENCE_UNIT = "schemaPU";
-
- /**
- * Properties to be used in all tests.
- */
- protected static Properties properties;
-
- /**
- * Entity manager factory pointing to the in-memory DB for A_SEQ_PU.
- */
- protected static EntityManagerFactory emf;
-
- /**
- * Entity manager factory pointing to the in-memory DB associated with emf.
- */
- protected static EntityManager em;
-
- /**
- * Saved JMX port from system properties, to be restored once all tests
- * complete.
- */
- private static Object savedJmxPort;
-
- /**
- * Saved IM persistence unit, to be restored once all tests complete.
- */
- private static String savedPU;
-
- /**
- * Saved monitor cycle interval, to be restored once all tests complete.
- */
- private static long savedCycleIntervalMillis;
-
- /**
- * Saved property time units, to be restored once all tests complete.
- */
- private static TimeUnit savedPropertyUnits;
-
- /**
- * Saves current configuration information and then sets new values.
- *
- * @param dbDriver
- * the name of the DB Driver class
- * @param dbUrl
- * the URL to the DB
- * @throws IOException
- * @throws Exception
- */
- protected static void setUpBeforeClass(String dbUrl) throws IOException {
- logger.info("setup");
-
- Properties systemProps = System.getProperties();
-
- // truncate the logs
- new FileOutputStream(SLF4J_LOG_DIR + "/audit.log").close();
- new FileOutputStream(SLF4J_LOG_DIR + "/debug.log").close();
- new FileOutputStream(SLF4J_LOG_DIR + "/error.log").close();
- new FileOutputStream(SLF4J_LOG_DIR + "/metrics.log").close();
-
- IntegrityMonitorTestBase.dbUrl = dbUrl;
-
- // save data that we have to restore at the end of the test
- savedJmxPort = systemProps.get(JMX_PORT_PROP);
- savedPU = IntegrityMonitor.getPersistenceUnit();
- savedCycleIntervalMillis = IntegrityMonitor.getCycleIntervalMillis();
- savedPropertyUnits = IntegrityMonitor.getPropertyUnits();
-
- systemProps.put(JMX_PORT_PROP, "9797");
-
- IntegrityMonitor.setPersistenceUnit(PERSISTENCE_UNIT);
- IntegrityMonitor.setCycleIntervalMillis(CYCLE_INTERVAL_MS);
- IntegrityMonitor.setPropertyUnits(TimeUnit.MILLISECONDS);
-
- IntegrityMonitor.setUnitTesting(true);
-
- properties = new Properties();
- properties.put(IntegrityMonitorProperties.DB_DRIVER, dbDriver);
- properties.put(IntegrityMonitorProperties.DB_URL, dbUrl);
- properties.put(IntegrityMonitorProperties.DB_USER, dbUser);
- properties.put(IntegrityMonitorProperties.DB_PWD, dbPwd);
- properties.put(IntegrityMonitorProperties.SITE_NAME, siteName);
- properties.put(IntegrityMonitorProperties.NODE_TYPE, nodeType);
- properties.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS,
- String.valueOf(100L * CYCLE_INTERVAL_MS));
-
- emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT, makeProperties());
-
- // keep this open so the in-memory DB stays around until all tests are
- // done
- em = emf.createEntityManager();
-
- stopMonitor();
- }
-
- /**
- * Restores the configuration to what it was before the test.
- */
- protected static void tearDownAfterClass() {
- Properties systemProps = System.getProperties();
- if (savedJmxPort == null) {
- systemProps.remove(JMX_PORT_PROP);
-
- } else {
- systemProps.put(JMX_PORT_PROP, savedJmxPort);
- }
-
- IntegrityMonitor.setPersistenceUnit(savedPU);
- IntegrityMonitor.setCycleIntervalMillis(savedCycleIntervalMillis);
- IntegrityMonitor.setPropertyUnits(savedPropertyUnits);
-
- IntegrityMonitor.setUnitTesting(false);
-
- // this should result in the in-memory DB being deleted
- em.close();
- emf.close();
- }
-
- /**
- * Sets up for a test, which includes deleting all records from the
- * IntegrityAuditEntity table.
- */
- protected void setUpTest() {
-
- // Clean up the DB
- try (EntityTransCloser et = new EntityTransCloser(em.getTransaction())) {
-
- em.createQuery("Delete from StateManagementEntity").executeUpdate();
- em.createQuery("Delete from ForwardProgressEntity").executeUpdate();
- em.createQuery("Delete from ResourceRegistrationEntity").executeUpdate();
-
- // commit transaction
- et.commit();
- }
- }
-
- /**
- * Cleans up after a test, removing any ExtractAppenders from the logger and
- * stopping any AuditThreads.
- */
- protected void tearDownTest() {
- stopMonitor();
- }
-
- /**
- * Stops the IntegrityMonitor instance.
- */
- private static void stopMonitor() {
- try {
- IntegrityMonitor.deleteInstance();
-
- } catch (IntegrityMonitorException e) {
- // no need to log, as exception was already logged
- }
- }
-
- /**
- * Makes a new Property set that's a clone of {@link #properties}.
- *
- * @return a new Property set containing all of a copy of all of the
- * {@link #properties}
- */
- protected static Properties makeProperties() {
- Properties props = new Properties();
- props.putAll(properties);
- return props;
- }
-
- /**
- * Waits for a latch to reach zero.
- *
- * @param latch
- * @throws InterruptedException
- * @throws AssertionError
- * if the latch did not reach zero in the allotted time
- */
- protected void waitLatch(CountDownLatch latch) throws InterruptedException {
- assertTrue(latch.await(WAIT_MS, TimeUnit.SECONDS));
- }
-
- /**
- * Applies a function on an object, expecting it to succeed. Catches any
- * exceptions thrown by the function.
- *
- * @param arg
- * @param func
- * @throws AssertionError
- */
- protected <T> void assertNoException(T arg, VoidFunction<T> func) {
- try {
- func.apply(arg);
-
- } catch (Exception e) {
- System.out.println("startTransaction exception: " + e);
- fail("action failed");
- }
- }
-
- /**
- * Applies a function on an object, expecting it to fail. Catches any
- * exceptions thrown by the function.
- *
- * @param arg
- * @param func
- * @throws AssertionError
- */
- protected <T> void assertException(T arg, VoidFunction<T> func) {
- try {
- func.apply(arg);
- fail("missing exception");
- } catch (Exception e) {
- System.out.println("action found expected exception: " + e);
- }
- }
-
- @FunctionalInterface
- protected static interface VoidFunction<T> {
- public void apply(T arg) throws Exception;
- }
+ private static Logger logger = LoggerFactory.getLogger(IntegrityMonitorTestBase.class);
+
+ /**
+ * Directory containing the slf4j log files.
+ */
+ private static final String SLF4J_LOG_DIR = "logs";
+
+ private static final String JMX_PORT_PROP = "com.sun.management.jmxremote.port";
+
+ /**
+ * Max time, in milliseconds, to wait for a latch to be triggered.
+ */
+ protected static final long WAIT_MS = 5000L;
+
+ /**
+ * Milliseconds that monitor should sleep between cycles.
+ */
+ protected static final long CYCLE_INTERVAL_MS = 2L;
+
+ public static final String DEFAULT_DB_URL_PREFIX = "jdbc:h2:mem:";
+
+ protected static final String dbDriver = "org.h2.Driver";
+ protected static final String dbUser = "testu";
+ protected static final String dbPwd = "testp";
+ protected static final String siteName = "SiteA";
+ protected static final String nodeType = "pap";
+
+ // will be defined by the test *Classes*
+ protected static String dbUrl;
+
+ /**
+ * Persistence unit.
+ */
+ protected static final String PERSISTENCE_UNIT = "schemaPU";
+
+ /**
+ * Properties to be used in all tests.
+ */
+ protected static Properties properties;
+
+ /**
+ * Entity manager factory pointing to the in-memory DB for A_SEQ_PU.
+ */
+ protected static EntityManagerFactory emf;
+
+ /**
+ * Entity manager factory pointing to the in-memory DB associated with emf.
+ */
+ protected static EntityManager em;
+
+ /**
+ * Saved JMX port from system properties, to be restored once all tests complete.
+ */
+ private static Object savedJmxPort;
+
+ /**
+ * Saved IM persistence unit, to be restored once all tests complete.
+ */
+ private static String savedPU;
+
+ /**
+ * Saved monitor cycle interval, to be restored once all tests complete.
+ */
+ private static long savedCycleIntervalMillis;
+
+ /**
+ * Saved property time units, to be restored once all tests complete.
+ */
+ private static TimeUnit savedPropertyUnits;
+
+ /**
+ * Saves current configuration information and then sets new values.
+ *
+ * @param dbDriver the name of the DB Driver class
+ * @param dbUrl the URL to the DB
+ * @throws IOException if an IO error occurs
+ */
+ protected static void setUpBeforeClass(String dbUrl) throws IOException {
+ logger.info("setup");
+
+ final Properties systemProps = System.getProperties();
+
+ // truncate the logs
+ new FileOutputStream(SLF4J_LOG_DIR + "/audit.log").close();
+ new FileOutputStream(SLF4J_LOG_DIR + "/debug.log").close();
+ new FileOutputStream(SLF4J_LOG_DIR + "/error.log").close();
+ new FileOutputStream(SLF4J_LOG_DIR + "/metrics.log").close();
+
+ IntegrityMonitorTestBase.dbUrl = dbUrl;
+
+ // save data that we have to restore at the end of the test
+ savedJmxPort = systemProps.get(JMX_PORT_PROP);
+ savedPU = IntegrityMonitor.getPersistenceUnit();
+ savedCycleIntervalMillis = IntegrityMonitor.getCycleIntervalMillis();
+ savedPropertyUnits = IntegrityMonitor.getPropertyUnits();
+
+ systemProps.put(JMX_PORT_PROP, "9797");
+
+ IntegrityMonitor.setPersistenceUnit(PERSISTENCE_UNIT);
+ IntegrityMonitor.setCycleIntervalMillis(CYCLE_INTERVAL_MS);
+ IntegrityMonitor.setPropertyUnits(TimeUnit.MILLISECONDS);
+
+ IntegrityMonitor.setUnitTesting(true);
+
+ properties = new Properties();
+ properties.put(IntegrityMonitorProperties.DB_DRIVER, dbDriver);
+ properties.put(IntegrityMonitorProperties.DB_URL, dbUrl);
+ properties.put(IntegrityMonitorProperties.DB_USER, dbUser);
+ properties.put(IntegrityMonitorProperties.DB_PWD, dbPwd);
+ properties.put(IntegrityMonitorProperties.SITE_NAME, siteName);
+ properties.put(IntegrityMonitorProperties.NODE_TYPE, nodeType);
+ properties.put(IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS,
+ String.valueOf(100L * CYCLE_INTERVAL_MS));
+
+ emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT, makeProperties());
+
+ // keep this open so the in-memory DB stays around until all tests are
+ // done
+ em = emf.createEntityManager();
+
+ stopMonitor();
+ }
+
+ /**
+ * Restores the configuration to what it was before the test.
+ */
+ protected static void tearDownAfterClass() {
+ Properties systemProps = System.getProperties();
+ if (savedJmxPort == null) {
+ systemProps.remove(JMX_PORT_PROP);
+
+ } else {
+ systemProps.put(JMX_PORT_PROP, savedJmxPort);
+ }
+
+ IntegrityMonitor.setPersistenceUnit(savedPU);
+ IntegrityMonitor.setCycleIntervalMillis(savedCycleIntervalMillis);
+ IntegrityMonitor.setPropertyUnits(savedPropertyUnits);
+
+ IntegrityMonitor.setUnitTesting(false);
+
+ // this should result in the in-memory DB being deleted
+ em.close();
+ emf.close();
+ }
+
+ /**
+ * Sets up for a test, which includes deleting all records from the IntegrityAuditEntity table.
+ */
+ protected void setUpTest() {
+
+ // Clean up the DB
+ try (EntityTransCloser et = new EntityTransCloser(em.getTransaction())) {
+
+ em.createQuery("Delete from StateManagementEntity").executeUpdate();
+ em.createQuery("Delete from ForwardProgressEntity").executeUpdate();
+ em.createQuery("Delete from ResourceRegistrationEntity").executeUpdate();
+
+ // commit transaction
+ et.commit();
+ }
+ }
+
+ /**
+ * Cleans up after a test, removing any ExtractAppenders from the logger and stopping any
+ * AuditThreads.
+ */
+ protected void tearDownTest() {
+ stopMonitor();
+ }
+
+ /**
+ * Stops the IntegrityMonitor instance.
+ */
+ private static void stopMonitor() {
+ try {
+ IntegrityMonitor.deleteInstance();
+
+ } catch (IntegrityMonitorException e) {
+ // no need to log, as exception was already logged
+ }
+ }
+
+ /**
+ * Makes a new Property set that's a clone of {@link #properties}.
+ *
+ * @return a new Property set containing all of a copy of all of the {@link #properties}
+ */
+ protected static Properties makeProperties() {
+ Properties props = new Properties();
+ props.putAll(properties);
+ return props;
+ }
+
+ /**
+ * Waits for a latch to reach zero.
+ *
+ * @param latch the latch
+ * @throws InterruptedException if the thread is interrupted
+ * @throws AssertionError if the latch did not reach zero in the allotted time
+ */
+ protected void waitLatch(CountDownLatch latch) throws InterruptedException {
+ assertTrue(latch.await(WAIT_MS, TimeUnit.SECONDS));
+ }
+
+ /**
+ * Applies a function on an object, expecting it to succeed. Catches any exceptions thrown by
+ * the function.
+ *
+ * @param arg the object to apply the function on
+ * @param func the function
+ * @throws AssertionError if an exception is thrown by the function
+ */
+ protected <T> void assertNoException(T arg, VoidFunction<T> func) {
+ try {
+ func.apply(arg);
+
+ } catch (Exception e) {
+ System.out.println("startTransaction exception: " + e);
+ fail("action failed");
+ }
+ }
+
+ /**
+ * Applies a function on an object, expecting it to fail. Catches any exceptions thrown by the
+ * function.
+ *
+ * @param arg the object to apply the function on
+ * @param func the function
+ * @throws AssertionError if no exception is thrown by the function
+ */
+ protected <T> void assertException(T arg, VoidFunction<T> func) {
+ try {
+ func.apply(arg);
+ fail("missing exception");
+ } catch (Exception e) {
+ System.out.println("action found expected exception: " + e);
+ }
+ }
+
+ @FunctionalInterface
+ protected static interface VoidFunction<T> {
+ public void apply(T arg) throws Exception;
+ }
}
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementEntityTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementEntityTest.java
index 44faa58f..d098af99 100644
--- a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementEntityTest.java
+++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementEntityTest.java
@@ -37,94 +37,107 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class StateManagementEntityTest extends IntegrityMonitorTestBase {
- private static Logger logger = LoggerFactory.getLogger(StateManagementEntityTest.class);
-
- @BeforeClass
- public static void setUpClass() throws Exception {
- IntegrityMonitorTestBase.setUpBeforeClass(DEFAULT_DB_URL_PREFIX + StateManagementEntityTest.class.getSimpleName());
-
- }
-
- @AfterClass
- public static void tearDownClass() throws Exception {
- IntegrityMonitorTestBase.tearDownAfterClass();
- }
-
- @Before
- public void setUp() {
- super.setUpTest();
- }
-
- @After
- public void tearDown() {
- super.tearDownTest();
- }
-
- @Test
- public void testJPA() throws Exception {
- logger.debug("\n??? logger.infor StateManagementEntityTest: Entering\n\n");
-
- //Define the resourceName for the StateManagement constructor
- String resourceName = "test_resource1";
-
- //
- logger.debug("Create StateManagementEntity, resourceName: {}", resourceName);
- logger.debug("??? instantiate StateManagementEntity object");
- StateManagementEntity sme = new StateManagementEntity();
-
- logger.debug("??? setResourceName : {}", resourceName);
- sme.setResourceName(resourceName);
- logger.debug("??? getResourceName : {}", sme.getResourceName());
-
- sme.setAdminState(StateManagement.UNLOCKED);
- assertEquals(StateManagement.UNLOCKED, sme.getAdminState());
-
- sme.setOpState(StateManagement.ENABLED);
- assertEquals(StateManagement.ENABLED, sme.getOpState());
-
- sme.setAvailStatus(StateManagement.NULL_VALUE);
- assertEquals(StateManagement.NULL_VALUE, sme.getAvailStatus());
-
- sme.setStandbyStatus(StateManagement.COLD_STANDBY);
- assertEquals(StateManagement.COLD_STANDBY, sme.getStandbyStatus());
-
- try(EntityTransCloser et = new EntityTransCloser(em.getTransaction())) {
- logger.debug("??? before persist");
- em.persist(sme);
- logger.debug("??? after persist");
-
- em.flush();
- logger.debug("??? after flush");
-
- et.commit();
- logger.debug("??? after commit");
- }
-
- try {
- Query query = em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource");
-
- query.setParameter("resource", resourceName);
-
- //Just test that we are retrieving the right object
- @SuppressWarnings("rawtypes")
- List resourceList = query.getResultList();
- if (!resourceList.isEmpty()) {
- // exist
- StateManagementEntity sme2 = (StateManagementEntity) resourceList.get(0);
-
- assertEquals(sme.getResourceName(), sme2.getResourceName());
- assertEquals(sme.getAdminState(), sme2.getAdminState());
- assertEquals(sme.getOpState(), sme2.getOpState());
- assertEquals(sme.getAvailStatus(), sme2.getAvailStatus());
- assertEquals(sme.getStandbyStatus(), sme2.getStandbyStatus());
- logger.debug("--");
- } else {
- logger.debug("Record not found, resourceName: {}", resourceName);
- }
- } catch(Exception ex) {
- logger.error("Exception on select query: " + ex.toString());
- }
-
- logger.debug("\n\nJpaTest: Exit\n\n");
- }
+ private static Logger logger = LoggerFactory.getLogger(StateManagementEntityTest.class);
+
+ /**
+ * Set up for the test class.
+ */
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ IntegrityMonitorTestBase
+ .setUpBeforeClass(DEFAULT_DB_URL_PREFIX + StateManagementEntityTest.class.getSimpleName());
+
+ }
+
+ /**
+ * Tear down after the test class.
+ */
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ IntegrityMonitorTestBase.tearDownAfterClass();
+ }
+
+ /**
+ * Set up for the test cases.
+ */
+ @Before
+ public void setUp() {
+ super.setUpTest();
+ }
+
+ /**
+ * Tear down after the test cases.
+ */
+ @After
+ public void tearDown() {
+ super.tearDownTest();
+ }
+
+ @Test
+ public void testJpa() throws Exception {
+ logger.debug("\n??? logger.infor StateManagementEntityTest: Entering\n\n");
+
+ // Define the resourceName for the StateManagement constructor
+ String resourceName = "test_resource1";
+
+ //
+ logger.debug("Create StateManagementEntity, resourceName: {}", resourceName);
+ logger.debug("??? instantiate StateManagementEntity object");
+ StateManagementEntity sme = new StateManagementEntity();
+
+ logger.debug("??? setResourceName : {}", resourceName);
+ sme.setResourceName(resourceName);
+ logger.debug("??? getResourceName : {}", sme.getResourceName());
+
+ sme.setAdminState(StateManagement.UNLOCKED);
+ assertEquals(StateManagement.UNLOCKED, sme.getAdminState());
+
+ sme.setOpState(StateManagement.ENABLED);
+ assertEquals(StateManagement.ENABLED, sme.getOpState());
+
+ sme.setAvailStatus(StateManagement.NULL_VALUE);
+ assertEquals(StateManagement.NULL_VALUE, sme.getAvailStatus());
+
+ sme.setStandbyStatus(StateManagement.COLD_STANDBY);
+ assertEquals(StateManagement.COLD_STANDBY, sme.getStandbyStatus());
+
+ try (EntityTransCloser et = new EntityTransCloser(em.getTransaction())) {
+ logger.debug("??? before persist");
+ em.persist(sme);
+ logger.debug("??? after persist");
+
+ em.flush();
+ logger.debug("??? after flush");
+
+ et.commit();
+ logger.debug("??? after commit");
+ }
+
+ try {
+ Query query = em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource");
+
+ query.setParameter("resource", resourceName);
+
+ // Just test that we are retrieving the right object
+ @SuppressWarnings("rawtypes")
+ List resourceList = query.getResultList();
+ if (!resourceList.isEmpty()) {
+ // exist
+ StateManagementEntity sme2 = (StateManagementEntity) resourceList.get(0);
+
+ assertEquals(sme.getResourceName(), sme2.getResourceName());
+ assertEquals(sme.getAdminState(), sme2.getAdminState());
+ assertEquals(sme.getOpState(), sme2.getOpState());
+ assertEquals(sme.getAvailStatus(), sme2.getAvailStatus());
+ assertEquals(sme.getStandbyStatus(), sme2.getStandbyStatus());
+ logger.debug("--");
+ } else {
+ logger.debug("Record not found, resourceName: {}", resourceName);
+ }
+ } catch (Exception ex) {
+ logger.error("Exception on select query: " + ex.toString());
+ }
+
+ logger.debug("\n\nJpaTest: Exit\n\n");
+ }
}
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java
index 377fed91..1d0d34ea 100644
--- a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java
+++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java
@@ -26,12 +26,14 @@ import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.PersistenceException;
import javax.persistence.QueryTimeoutException;
import javax.persistence.TypedQuery;
+
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -226,7 +228,7 @@ public class StateManagementTest extends IntegrityMonitorTestBase {
@Test(expected = StateManagementException.class)
@SuppressWarnings("unchecked")
- public void test_StateManagementInitialization_ThrowStateManagementException_ifEntityManagerCreateQuerythrowsAnyException()
+ public void test_StateManagementInitialization_ThrowException_ifEntityManagerCreateQuerythrowsAnyException()
throws Exception {
final EntityManager mockedEm = getMockedEntityManager();
final EntityManagerFactory mockedEmf = getMockedEntityManagerFactory(mockedEm);
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateTransitionTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateTransitionTest.java
index 177a4489..ff7cc3bd 100644
--- a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateTransitionTest.java
+++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateTransitionTest.java
@@ -29,2132 +29,2143 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
/*
* All JUnits are designed to run in the local development environment
* where they have write privileges and can execute time-sensitive
* tasks.
*/
public class StateTransitionTest {
- private static Logger logger = LoggerFactory.getLogger(StateTransitionTest.class);
-
- @BeforeClass
- public static void setUpClass() throws Exception {
-
- }
-
- @AfterClass
- public static void tearDownClass() throws Exception {
- }
-
- @Before
- public void setUp() throws Exception {
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void test() throws Exception {
- logger.info("\n\nlogger.infor StateTransitionTest: Entering\n\n");
- try {
- logger.info("??? create a new StateTransition");
- StateTransition st = new StateTransition();
-
- StateElement se = null;
- try {
- // bad test case
- se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "lock");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 1");
- se = st.getEndingState("unlocked", "enabled", "null", "null", "lock");
- assertEquals("null,locked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 2");
- se = st.getEndingState("unlocked", "enabled", "null", "null", "unlock");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 3");
- se = st.getEndingState("unlocked", "enabled", "null", "null", "disableFailed");
- assertEquals("null,unlocked,disabled,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 4");
- se = st.getEndingState("unlocked", "enabled", "null", "null", "enableNotFailed");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 5");
- se = st.getEndingState("unlocked", "enabled", "null", "null", "disableDependency");
- assertEquals("null,unlocked,disabled,dependency,", makeString(se));
-
- logger.info("??? StateTransition testcase 6");
- se = st.getEndingState("unlocked", "enabled", "null", "null", "enableNoDependency");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 7");
- se = st.getEndingState("unlocked", "enabled", "null", "null", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 8");
- se = st.getEndingState("unlocked", "enabled", "null", "null", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 9");
- se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 10");
- se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 11");
- se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 12");
- se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "enableNotFailed");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 13");
- se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
-
- logger.info("??? StateTransition testcase 14");
- se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "enableNoDependency");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 15");
- se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 16");
- se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 17");
- se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 18");
- se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 19");
- se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 20");
- se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "enableNotFailed");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 21");
- se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
-
- logger.info("??? StateTransition testcase 22");
- se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "enableNoDependency");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 23");
- se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 24");
- se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 25");
- se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 26");
- se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "unlock");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 27");
- se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 28");
- se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "enableNotFailed");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 29");
- se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
-
- logger.info("??? StateTransition testcase 30");
- se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "enableNoDependency");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
-
- logger.info("??? StateTransition testcase 31");
- se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ private static Logger logger = LoggerFactory.getLogger(StateTransitionTest.class);
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {}
+
+ @Before
+ public void setUp() throws Exception {}
+
+ @After
+ public void tearDown() throws Exception {}
- logger.info("??? StateTransition testcase 32");
- se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ @Test
+ public void test() throws Exception {
+ logger.info("\n\nlogger.infor StateTransitionTest: Entering\n\n");
+ try {
+ logger.info("??? create a new StateTransition");
+ StateTransition st = new StateTransition();
- logger.info("??? StateTransition testcase 33");
- se = st.getEndingState("unlocked", "enabled", "failed", "null", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ StateElement se = null;
+ try {
+ // bad test case
+ se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "lock");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 34");
- se = st.getEndingState("unlocked", "enabled", "failed", "null", "unlock");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 1");
+ se = st.getEndingState("unlocked", "enabled", "null", "null", "lock");
+ assertEquals("null,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 35");
- se = st.getEndingState("unlocked", "enabled", "failed", "null", "disableFailed");
- assertEquals("null,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 2");
+ se = st.getEndingState("unlocked", "enabled", "null", "null", "unlock");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 36");
- se = st.getEndingState("unlocked", "enabled", "failed", "null", "enableNotFailed");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 3");
+ se = st.getEndingState("unlocked", "enabled", "null", "null", "disableFailed");
+ assertEquals("null,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 37");
- se = st.getEndingState("unlocked", "enabled", "failed", "null", "disableDependency");
- assertEquals("null,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 4");
+ se = st.getEndingState("unlocked", "enabled", "null", "null", "enableNotFailed");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 38");
- se = st.getEndingState("unlocked", "enabled", "failed", "null", "enableNoDependency");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 5");
+ se = st.getEndingState("unlocked", "enabled", "null", "null", "disableDependency");
+ assertEquals("null,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 39");
- se = st.getEndingState("unlocked", "enabled", "failed", "null", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 6");
+ se = st.getEndingState("unlocked", "enabled", "null", "null", "enableNoDependency");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 40");
- se = st.getEndingState("unlocked", "enabled", "failed", "null", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 7");
+ se = st.getEndingState("unlocked", "enabled", "null", "null", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 41");
- se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 8");
+ se = st.getEndingState("unlocked", "enabled", "null", "null", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 42");
- se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 9");
+ se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 43");
- se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 10");
+ se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 44");
- se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "enableNotFailed");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 11");
+ se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 45");
- se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 12");
+ se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "enableNotFailed");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 46");
- se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "enableNoDependency");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 13");
+ se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 47");
- se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 14");
+ se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "enableNoDependency");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 48");
- se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 15");
+ se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 49");
- se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 16");
+ se = st.getEndingState("unlocked", "enabled", "null", "coldstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 50");
- se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 17");
+ se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 51");
- se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 18");
+ se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 52");
- se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "enableNotFailed");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 19");
+ se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 53");
- se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 20");
+ se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "enableNotFailed");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 54");
- se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "enableNoDependency");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 21");
+ se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 55");
- se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 22");
+ se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "enableNoDependency");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+
+ logger.info("??? StateTransition testcase 23");
+ se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 56");
- se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 24");
+ se = st.getEndingState("unlocked", "enabled", "null", "hotstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 57");
- se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 25");
+ se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 58");
- se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "unlock");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 26");
+ se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "unlock");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 59");
- se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 27");
+ se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 60");
- se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "enableNotFailed");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 28");
+ se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "enableNotFailed");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 61");
- se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 29");
+ se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 62");
- se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "enableNoDependency");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 30");
+ se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "enableNoDependency");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 63");
- se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 31");
+ se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 64");
- se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 32");
+ se = st.getEndingState("unlocked", "enabled", "null", "providingservice", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 65");
- se = st.getEndingState("unlocked", "enabled", "dependency", "null", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 33");
+ se = st.getEndingState("unlocked", "enabled", "failed", "null", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 66");
- se = st.getEndingState("unlocked", "enabled", "dependency", "null", "unlock");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 34");
+ se = st.getEndingState("unlocked", "enabled", "failed", "null", "unlock");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 67");
- se = st.getEndingState("unlocked", "enabled", "dependency", "null", "disableFailed");
- assertEquals("null,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 35");
+ se = st.getEndingState("unlocked", "enabled", "failed", "null", "disableFailed");
+ assertEquals("null,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 68");
- se = st.getEndingState("unlocked", "enabled", "dependency", "null", "enableNotFailed");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 36");
+ se = st.getEndingState("unlocked", "enabled", "failed", "null", "enableNotFailed");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 69");
- se = st.getEndingState("unlocked", "enabled", "dependency", "null", "disableDependency");
- assertEquals("null,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 37");
+ se = st.getEndingState("unlocked", "enabled", "failed", "null", "disableDependency");
+ assertEquals("null,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 70");
- se = st.getEndingState("unlocked", "enabled", "dependency", "null", "enableNoDependency");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 38");
+ se = st.getEndingState("unlocked", "enabled", "failed", "null", "enableNoDependency");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 71");
- se = st.getEndingState("unlocked", "enabled", "dependency", "null", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 39");
+ se = st.getEndingState("unlocked", "enabled", "failed", "null", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 72");
- se = st.getEndingState("unlocked", "enabled", "dependency", "null", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 40");
+ se = st.getEndingState("unlocked", "enabled", "failed", "null", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 73");
- se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 41");
+ se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 74");
- se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 42");
+ se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 75");
- se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 43");
+ se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 76");
- se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "enableNotFailed");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 44");
+ se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "enableNotFailed");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 77");
- se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 45");
+ se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 78");
- se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "enableNoDependency");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 46");
+ se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "enableNoDependency");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 79");
- se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 47");
+ se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 80");
- se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 48");
+ se = st.getEndingState("unlocked", "enabled", "failed", "coldstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 81");
- se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 49");
+ se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 82");
- se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 50");
+ se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 83");
- se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 51");
+ se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 84");
- se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "enableNotFailed");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 52");
+ se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "enableNotFailed");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 85");
- se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "disableDependency");
- assertEquals("hotstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 53");
+ se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 86");
- se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "enableNoDependency");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 54");
+ se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "enableNoDependency");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 87");
- se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 55");
+ se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 88");
- se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 56");
+ se = st.getEndingState("unlocked", "enabled", "failed", "hotstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 89");
- se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 57");
+ se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 90");
- se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "unlock");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 58");
+ se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "unlock");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 91");
- se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 59");
+ se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 92");
- se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "enableNotFailed");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 60");
+ se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "enableNotFailed");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 93");
- se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 61");
+ se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 94");
- se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "enableNoDependency");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 62");
+ se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "enableNoDependency");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 95");
- se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 63");
+ se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 96");
- se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 64");
+ se = st.getEndingState("unlocked", "enabled", "failed", "providingservice", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 97");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 65");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "null", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 98");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "unlock");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 66");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "null", "unlock");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 99");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "disableFailed");
- assertEquals("null,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 67");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "null", "disableFailed");
+ assertEquals("null,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 100");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "enableNotFailed");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 68");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "null", "enableNotFailed");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 101");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "disableDependency");
- assertEquals("null,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 69");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "null", "disableDependency");
+ assertEquals("null,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 102");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "enableNoDependency");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 70");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "null", "enableNoDependency");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 103");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 71");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "null", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 104");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 72");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "null", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 105");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 73");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 106");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 74");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 107");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 75");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 108");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "enableNotFailed");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 76");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "enableNotFailed");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 109");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 77");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 110");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "enableNoDependency");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 78");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "enableNoDependency");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 111");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 79");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 112");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 80");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "coldstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 113");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 81");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 114");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 82");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 115");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 83");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 116");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "enableNotFailed");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 84");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "enableNotFailed");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 117");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 85");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "disableDependency");
+ assertEquals("hotstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 118");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "enableNoDependency");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 86");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "enableNoDependency");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 119");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 87");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 120");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 88");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "hotstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 121");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 89");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 122");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice", "unlock");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 90");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "unlock");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 123");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 91");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 124");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice", "enableNotFailed");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 92");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "enableNotFailed");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 125");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 93");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 126");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice", "enableNoDependency");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 94");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "enableNoDependency");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 127");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice", "promote");
- assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 95");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 128");
- se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice", "demote");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 96");
+ se = st.getEndingState("unlocked", "enabled", "dependency", "providingservice", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 129");
- se = st.getEndingState("unlocked", "disabled", "null", "null", "demote");
- assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 97");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 130");
- se = st.getEndingState("unlocked", "disabled", "null", "null", "unlock");
- assertEquals("null,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 98");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "unlock");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 131");
- se = st.getEndingState("unlocked", "disabled", "null", "null", "disableFailed");
- assertEquals("null,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 99");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "disableFailed");
+ assertEquals("null,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 132");
- se = st.getEndingState("unlocked", "disabled", "null", "null", "enableNotFailed");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 100");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "enableNotFailed");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 133");
- se = st.getEndingState("unlocked", "disabled", "null", "null", "disableDependency");
- assertEquals("null,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 101");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "disableDependency");
+ assertEquals("null,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 134");
- se = st.getEndingState("unlocked", "disabled", "null", "null", "enableNoDependency");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 102");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "enableNoDependency");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 135");
- se = st.getEndingState("unlocked", "disabled", "null", "null", "promote");
- assertEquals("coldstandby,unlocked,disabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 103");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 136");
- se = st.getEndingState("unlocked", "disabled", "null", "null", "demote");
- assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 104");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "null", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 137");
- se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 105");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 138");
- se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 106");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 139");
- se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 107");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 140");
- se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "enableNotFailed");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 108");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "enableNotFailed");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 141");
- se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 109");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 142");
- se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "enableNoDependency");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 110");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "enableNoDependency");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 143");
- se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "promote");
- assertEquals("coldstandby,unlocked,disabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 111");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 144");
- se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 112");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "coldstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 145");
- se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 113");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 146");
- se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 114");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 147");
- se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 115");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 148");
- se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "enableNotFailed");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 116");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "enableNotFailed");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 149");
- se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 117");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 150");
- se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "enableNoDependency");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 118");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "enableNoDependency");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 151");
- se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "promote");
- assertEquals("coldstandby,unlocked,disabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 119");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 152");
- se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 120");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "hotstandby", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 153");
- se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "demote");
- assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 121");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 154");
- se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "unlock");
- assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 122");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice", "unlock");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 155");
- se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 123");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 156");
- se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "enableNotFailed");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 124");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice",
+ "enableNotFailed");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
+
+ logger.info("??? StateTransition testcase 125");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice",
+ "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+
+ logger.info("??? StateTransition testcase 126");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice",
+ "enableNoDependency");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 157");
- se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 127");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice", "promote");
+ assertEquals("providingservice,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 158");
- se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "enableNoDependency");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 128");
+ se = st.getEndingState("unlocked", "enabled", "dependency,failed", "providingservice", "demote");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 159");
- se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "promote");
- assertEquals("coldstandby,unlocked,disabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 129");
+ se = st.getEndingState("unlocked", "disabled", "null", "null", "demote");
+ assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 160");
- se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "demote");
- assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 130");
+ se = st.getEndingState("unlocked", "disabled", "null", "null", "unlock");
+ assertEquals("null,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 161");
- se = st.getEndingState("unlocked", "disabled", "failed", "null", "demote");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 131");
+ se = st.getEndingState("unlocked", "disabled", "null", "null", "disableFailed");
+ assertEquals("null,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 162");
- se = st.getEndingState("unlocked", "disabled", "failed", "null", "unlock");
- assertEquals("null,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 132");
+ se = st.getEndingState("unlocked", "disabled", "null", "null", "enableNotFailed");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 163");
- se = st.getEndingState("unlocked", "disabled", "failed", "null", "disableFailed");
- assertEquals("null,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 133");
+ se = st.getEndingState("unlocked", "disabled", "null", "null", "disableDependency");
+ assertEquals("null,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 164");
- se = st.getEndingState("unlocked", "disabled", "failed", "null", "enableNotFailed");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 134");
+ se = st.getEndingState("unlocked", "disabled", "null", "null", "enableNoDependency");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 165");
- se = st.getEndingState("unlocked", "disabled", "failed", "null", "disableDependency");
- assertEquals("null,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 135");
+ se = st.getEndingState("unlocked", "disabled", "null", "null", "promote");
+ assertEquals("coldstandby,unlocked,disabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 166");
- se = st.getEndingState("unlocked", "disabled", "failed", "null", "enableNoDependency");
- assertEquals("null,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 136");
+ se = st.getEndingState("unlocked", "disabled", "null", "null", "demote");
+ assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 167");
- se = st.getEndingState("unlocked", "disabled", "failed", "null", "promote");
- assertEquals("coldstandby,unlocked,disabled,failed,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 137");
+ se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 168");
- se = st.getEndingState("unlocked", "disabled", "failed", "null", "demote");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 138");
+ se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 169");
- se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 139");
+ se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 170");
- se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 140");
+ se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "enableNotFailed");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 171");
- se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 141");
+ se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 172");
- se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "enableNotFailed");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 142");
+ se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "enableNoDependency");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 173");
- se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 143");
+ se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "promote");
+ assertEquals("coldstandby,unlocked,disabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 174");
- se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "enableNoDependency");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 144");
+ se = st.getEndingState("unlocked", "disabled", "null", "coldstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 175");
- se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "promote");
- assertEquals("coldstandby,unlocked,disabled,failed,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 145");
+ se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 176");
- se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 146");
+ se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 177");
- se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 147");
+ se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 178");
- se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 148");
+ se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "enableNotFailed");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 179");
- se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 149");
+ se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 180");
- se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "enableNotFailed");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 150");
+ se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "enableNoDependency");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 181");
- se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 151");
+ se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "promote");
+ assertEquals("coldstandby,unlocked,disabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 182");
- se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "enableNoDependency");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 152");
+ se = st.getEndingState("unlocked", "disabled", "null", "hotstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 183");
- se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "promote");
- assertEquals("coldstandby,unlocked,disabled,failed,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 153");
+ se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "demote");
+ assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 184");
- se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 154");
+ se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 185");
- se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "demote");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 155");
+ se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 186");
- se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "unlock");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 156");
+ se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "enableNotFailed");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 187");
- se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 157");
+ se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 188");
- se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "enableNotFailed");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 158");
+ se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "enableNoDependency");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 189");
- se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 159");
+ se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "promote");
+ assertEquals("coldstandby,unlocked,disabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 190");
- se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "enableNoDependency");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 160");
+ se = st.getEndingState("unlocked", "disabled", "null", "providingservice", "demote");
+ assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 191");
- se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "promote");
- assertEquals("coldstandby,unlocked,disabled,failed,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 161");
+ se = st.getEndingState("unlocked", "disabled", "failed", "null", "demote");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 192");
- se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "demote");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 162");
+ se = st.getEndingState("unlocked", "disabled", "failed", "null", "unlock");
+ assertEquals("null,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 193");
- se = st.getEndingState("unlocked", "disabled", "dependency", "null", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 163");
+ se = st.getEndingState("unlocked", "disabled", "failed", "null", "disableFailed");
+ assertEquals("null,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 194");
- se = st.getEndingState("unlocked", "disabled", "dependency", "null", "unlock");
- assertEquals("null,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 164");
+ se = st.getEndingState("unlocked", "disabled", "failed", "null", "enableNotFailed");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 195");
- se = st.getEndingState("unlocked", "disabled", "dependency", "null", "disableFailed");
- assertEquals("null,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 165");
+ se = st.getEndingState("unlocked", "disabled", "failed", "null", "disableDependency");
+ assertEquals("null,unlocked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 196");
- se = st.getEndingState("unlocked", "disabled", "dependency", "null", "enableNotFailed");
- assertEquals("null,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 166");
+ se = st.getEndingState("unlocked", "disabled", "failed", "null", "enableNoDependency");
+ assertEquals("null,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 197");
- se = st.getEndingState("unlocked", "disabled", "dependency", "null", "disableDependency");
- assertEquals("null,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 167");
+ se = st.getEndingState("unlocked", "disabled", "failed", "null", "promote");
+ assertEquals("coldstandby,unlocked,disabled,failed,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 198");
- se = st.getEndingState("unlocked", "disabled", "dependency", "null", "enableNoDependency");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 168");
+ se = st.getEndingState("unlocked", "disabled", "failed", "null", "demote");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 199");
- se = st.getEndingState("unlocked", "disabled", "dependency", "null", "promote");
- assertEquals("coldstandby,unlocked,disabled,dependency,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 169");
+ se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 200");
- se = st.getEndingState("unlocked", "disabled", "dependency", "null", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 170");
+ se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 201");
- se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 171");
+ se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 202");
- se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 172");
+ se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "enableNotFailed");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 203");
- se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 173");
+ se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 204");
- se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "enableNotFailed");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 174");
+ se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "enableNoDependency");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 205");
- se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 175");
+ se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "promote");
+ assertEquals("coldstandby,unlocked,disabled,failed,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 206");
- se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "enableNoDependency");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 176");
+ se = st.getEndingState("unlocked", "disabled", "failed", "coldstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 207");
- se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "promote");
- assertEquals("coldstandby,unlocked,disabled,dependency,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 177");
+ se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 208");
- se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 178");
+ se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 209");
- se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 179");
+ se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 210");
- se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 180");
+ se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "enableNotFailed");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 211");
- se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 181");
+ se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 212");
- se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "enableNotFailed");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 182");
+ se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "enableNoDependency");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 213");
- se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 183");
+ se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "promote");
+ assertEquals("coldstandby,unlocked,disabled,failed,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 214");
- se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "enableNoDependency");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 184");
+ se = st.getEndingState("unlocked", "disabled", "failed", "hotstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 215");
- se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "promote");
- assertEquals("coldstandby,unlocked,disabled,dependency,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 185");
+ se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "demote");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 216");
- se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 186");
+ se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 217");
- se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 187");
+ se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 218");
- se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "unlock");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 188");
+ se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "enableNotFailed");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 219");
- se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 189");
+ se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 220");
- se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "enableNotFailed");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 190");
+ se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "enableNoDependency");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 221");
- se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 191");
+ se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "promote");
+ assertEquals("coldstandby,unlocked,disabled,failed,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 222");
- se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "enableNoDependency");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 192");
+ se = st.getEndingState("unlocked", "disabled", "failed", "providingservice", "demote");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 223");
- se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "promote");
- assertEquals("coldstandby,unlocked,disabled,dependency,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 193");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "null", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 224");
- se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 194");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "null", "unlock");
+ assertEquals("null,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 225");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 195");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "null", "disableFailed");
+ assertEquals("null,unlocked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 226");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "unlock");
- assertEquals("null,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 196");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "null", "enableNotFailed");
+ assertEquals("null,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 227");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "disableFailed");
- assertEquals("null,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 197");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "null", "disableDependency");
+ assertEquals("null,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 228");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "enableNotFailed");
- assertEquals("null,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 198");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "null", "enableNoDependency");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 229");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "disableDependency");
- assertEquals("null,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 199");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "null", "promote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 230");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "enableNoDependency");
- assertEquals("null,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 200");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "null", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 231");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "promote");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 201");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 232");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 202");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 233");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 203");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 234");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 204");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "enableNotFailed");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 235");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 205");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 236");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby", "enableNotFailed");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 206");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "enableNoDependency");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 237");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 207");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "promote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 238");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby", "enableNoDependency");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 208");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "coldstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 239");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby", "promote");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 209");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 240");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 210");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 241");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 211");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 242");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 212");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "enableNotFailed");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 243");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 213");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 244");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "enableNotFailed");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 214");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "enableNoDependency");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 245");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 215");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "promote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 246");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "enableNoDependency");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 216");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "hotstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 247");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "promote");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 217");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 248");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 218");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 249");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 219");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 250");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice", "unlock");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 220");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "enableNotFailed");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 251");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice", "disableFailed");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 221");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 252");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice", "enableNotFailed");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 222");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "enableNoDependency");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 253");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice", "disableDependency");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 223");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "promote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 254");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice", "enableNoDependency");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 224");
+ se = st.getEndingState("unlocked", "disabled", "dependency", "providingservice", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 255");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice", "promote");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 225");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 256");
- se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice", "demote");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 226");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "unlock");
+ assertEquals("null,unlocked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 257");
- se = st.getEndingState("locked", "enabled", "null", "null", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 227");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "disableFailed");
+ assertEquals("null,unlocked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 258");
- se = st.getEndingState("locked", "enabled", "null", "null", "unlock");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 228");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "enableNotFailed");
+ assertEquals("null,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 259");
- se = st.getEndingState("locked", "enabled", "null", "null", "disableFailed");
- assertEquals("null,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 229");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "disableDependency");
+ assertEquals("null,unlocked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 260");
- se = st.getEndingState("locked", "enabled", "null", "null", "enableNotFailed");
- assertEquals("null,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 230");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "enableNoDependency");
+ assertEquals("null,unlocked,disabled,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 231");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "promote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,StandbyStatusException", makeString(se));
+
+ logger.info("??? StateTransition testcase 232");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "null", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 233");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 234");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 235");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 236");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby", "enableNotFailed");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+
+ logger.info("??? StateTransition testcase 237");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 238");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby",
+ "enableNoDependency");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 239");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby", "promote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,StandbyStatusException", makeString(se));
+
+ logger.info("??? StateTransition testcase 240");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "coldstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 241");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 242");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 243");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 244");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "enableNotFailed");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+
+ logger.info("??? StateTransition testcase 245");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 246");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "enableNoDependency");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 247");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "promote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,StandbyStatusException", makeString(se));
+
+ logger.info("??? StateTransition testcase 248");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "hotstandby", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 249");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 250");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 251");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice",
+ "disableFailed");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 252");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice",
+ "enableNotFailed");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+
+ logger.info("??? StateTransition testcase 253");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice",
+ "disableDependency");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 254");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice",
+ "enableNoDependency");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 255");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice", "promote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,StandbyStatusException", makeString(se));
+
+ logger.info("??? StateTransition testcase 256");
+ se = st.getEndingState("unlocked", "disabled", "dependency,failed", "providingservice", "demote");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 257");
+ se = st.getEndingState("locked", "enabled", "null", "null", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+
+ logger.info("??? StateTransition testcase 258");
+ se = st.getEndingState("locked", "enabled", "null", "null", "unlock");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
+
+ logger.info("??? StateTransition testcase 259");
+ se = st.getEndingState("locked", "enabled", "null", "null", "disableFailed");
+ assertEquals("null,locked,disabled,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 260");
+ se = st.getEndingState("locked", "enabled", "null", "null", "enableNotFailed");
+ assertEquals("null,locked,enabled,null,", makeString(se));
+
+ logger.info("??? StateTransition testcase 261");
+ se = st.getEndingState("locked", "enabled", "null", "null", "disableDependency");
+ assertEquals("null,locked,disabled,dependency,", makeString(se));
+
+ logger.info("??? StateTransition testcase 262");
+ se = st.getEndingState("locked", "enabled", "null", "null", "enableNoDependency");
+ assertEquals("null,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 261");
- se = st.getEndingState("locked", "enabled", "null", "null", "disableDependency");
- assertEquals("null,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 263");
+ se = st.getEndingState("locked", "enabled", "null", "null", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 262");
- se = st.getEndingState("locked", "enabled", "null", "null", "enableNoDependency");
- assertEquals("null,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 264");
+ se = st.getEndingState("locked", "enabled", "null", "null", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 263");
- se = st.getEndingState("locked", "enabled", "null", "null", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 265");
+ se = st.getEndingState("locked", "enabled", "null", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 264");
- se = st.getEndingState("locked", "enabled", "null", "null", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 266");
+ se = st.getEndingState("locked", "enabled", "null", "coldstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 265");
- se = st.getEndingState("locked", "enabled", "null", "coldstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 267");
+ se = st.getEndingState("locked", "enabled", "null", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 266");
- se = st.getEndingState("locked", "enabled", "null", "coldstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 268");
+ se = st.getEndingState("locked", "enabled", "null", "coldstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 267");
- se = st.getEndingState("locked", "enabled", "null", "coldstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 269");
+ se = st.getEndingState("locked", "enabled", "null", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 268");
- se = st.getEndingState("locked", "enabled", "null", "coldstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 270");
+ se = st.getEndingState("locked", "enabled", "null", "coldstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 269");
- se = st.getEndingState("locked", "enabled", "null", "coldstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 271");
+ se = st.getEndingState("locked", "enabled", "null", "coldstandby", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 270");
- se = st.getEndingState("locked", "enabled", "null", "coldstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 272");
+ se = st.getEndingState("locked", "enabled", "null", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 271");
- se = st.getEndingState("locked", "enabled", "null", "coldstandby", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 273");
+ se = st.getEndingState("locked", "enabled", "null", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 272");
- se = st.getEndingState("locked", "enabled", "null", "coldstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 274");
+ se = st.getEndingState("locked", "enabled", "null", "hotstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 273");
- se = st.getEndingState("locked", "enabled", "null", "hotstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 275");
+ se = st.getEndingState("locked", "enabled", "null", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 274");
- se = st.getEndingState("locked", "enabled", "null", "hotstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 276");
+ se = st.getEndingState("locked", "enabled", "null", "hotstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 275");
- se = st.getEndingState("locked", "enabled", "null", "hotstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 277");
+ se = st.getEndingState("locked", "enabled", "null", "hotstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 276");
- se = st.getEndingState("locked", "enabled", "null", "hotstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 278");
+ se = st.getEndingState("locked", "enabled", "null", "hotstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 277");
- se = st.getEndingState("locked", "enabled", "null", "hotstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 279");
+ se = st.getEndingState("locked", "enabled", "null", "hotstandby", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStateException", makeString(se));
- logger.info("??? StateTransition testcase 278");
- se = st.getEndingState("locked", "enabled", "null", "hotstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 280");
+ se = st.getEndingState("locked", "enabled", "null", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 279");
- se = st.getEndingState("locked", "enabled", "null", "hotstandby", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStateException", makeString(se));
+ logger.info("??? StateTransition testcase 281");
+ se = st.getEndingState("locked", "enabled", "null", "providingservice", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 280");
- se = st.getEndingState("locked", "enabled", "null", "hotstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 282");
+ se = st.getEndingState("locked", "enabled", "null", "providingservice", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 281");
- se = st.getEndingState("locked", "enabled", "null", "providingservice", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 283");
+ se = st.getEndingState("locked", "enabled", "null", "providingservice", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 282");
- se = st.getEndingState("locked", "enabled", "null", "providingservice", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 284");
+ se = st.getEndingState("locked", "enabled", "null", "providingservice", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 283");
- se = st.getEndingState("locked", "enabled", "null", "providingservice", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 285");
+ se = st.getEndingState("locked", "enabled", "null", "providingservice", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 284");
- se = st.getEndingState("locked", "enabled", "null", "providingservice", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 286");
+ se = st.getEndingState("locked", "enabled", "null", "providingservice", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 285");
- se = st.getEndingState("locked", "enabled", "null", "providingservice", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 287");
+ se = st.getEndingState("locked", "enabled", "null", "providingservice", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStateException", makeString(se));
- logger.info("??? StateTransition testcase 286");
- se = st.getEndingState("locked", "enabled", "null", "providingservice", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 288");
+ se = st.getEndingState("locked", "enabled", "null", "providingservice", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 287");
- se = st.getEndingState("locked", "enabled", "null", "providingservice", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStateException", makeString(se));
+ logger.info("??? StateTransition testcase 289");
+ se = st.getEndingState("locked", "enabled", "failed", "null", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 288");
- se = st.getEndingState("locked", "enabled", "null", "providingservice", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 290");
+ se = st.getEndingState("locked", "enabled", "failed", "null", "unlock");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 289");
- se = st.getEndingState("locked", "enabled", "failed", "null", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 291");
+ se = st.getEndingState("locked", "enabled", "failed", "null", "disableFailed");
+ assertEquals("null,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 290");
- se = st.getEndingState("locked", "enabled", "failed", "null", "unlock");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 292");
+ se = st.getEndingState("locked", "enabled", "failed", "null", "enableNotFailed");
+ assertEquals("null,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 291");
- se = st.getEndingState("locked", "enabled", "failed", "null", "disableFailed");
- assertEquals("null,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 293");
+ se = st.getEndingState("locked", "enabled", "failed", "null", "disableDependency");
+ assertEquals("null,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 292");
- se = st.getEndingState("locked", "enabled", "failed", "null", "enableNotFailed");
- assertEquals("null,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 294");
+ se = st.getEndingState("locked", "enabled", "failed", "null", "enableNoDependency");
+ assertEquals("null,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 293");
- se = st.getEndingState("locked", "enabled", "failed", "null", "disableDependency");
- assertEquals("null,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 295");
+ se = st.getEndingState("locked", "enabled", "failed", "null", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 294");
- se = st.getEndingState("locked", "enabled", "failed", "null", "enableNoDependency");
- assertEquals("null,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 296");
+ se = st.getEndingState("locked", "enabled", "failed", "null", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 295");
- se = st.getEndingState("locked", "enabled", "failed", "null", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 297");
+ se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 296");
- se = st.getEndingState("locked", "enabled", "failed", "null", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 298");
+ se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 297");
- se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 299");
+ se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 298");
- se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 300");
+ se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 299");
- se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 301");
+ se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 300");
- se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 302");
+ se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 301");
- se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 303");
+ se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 302");
- se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 304");
+ se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 303");
- se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 305");
+ se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 304");
- se = st.getEndingState("locked", "enabled", "failed", "coldstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 306");
+ se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 305");
- se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 307");
+ se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 306");
- se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 308");
+ se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 307");
- se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 309");
+ se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 308");
- se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 310");
+ se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 309");
- se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 311");
+ se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 310");
- se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 312");
+ se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 311");
- se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 313");
+ se = st.getEndingState("locked", "enabled", "failed", "providingservice", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 312");
- se = st.getEndingState("locked", "enabled", "failed", "hotstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 314");
+ se = st.getEndingState("locked", "enabled", "failed", "providingservice", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 313");
- se = st.getEndingState("locked", "enabled", "failed", "providingservice", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 315");
+ se = st.getEndingState("locked", "enabled", "failed", "providingservice", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 314");
- se = st.getEndingState("locked", "enabled", "failed", "providingservice", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 316");
+ se = st.getEndingState("locked", "enabled", "failed", "providingservice", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 315");
- se = st.getEndingState("locked", "enabled", "failed", "providingservice", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 317");
+ se = st.getEndingState("locked", "enabled", "failed", "providingservice", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 316");
- se = st.getEndingState("locked", "enabled", "failed", "providingservice", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 318");
+ se = st.getEndingState("locked", "enabled", "failed", "providingservice", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 317");
- se = st.getEndingState("locked", "enabled", "failed", "providingservice", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 319");
+ se = st.getEndingState("locked", "enabled", "failed", "providingservice", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 318");
- se = st.getEndingState("locked", "enabled", "failed", "providingservice", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 320");
+ se = st.getEndingState("locked", "enabled", "failed", "providingservice", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 319");
- se = st.getEndingState("locked", "enabled", "failed", "providingservice", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 321");
+ se = st.getEndingState("locked", "enabled", "dependency", "null", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 320");
- se = st.getEndingState("locked", "enabled", "failed", "providingservice", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 322");
+ se = st.getEndingState("locked", "enabled", "dependency", "null", "unlock");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 321");
- se = st.getEndingState("locked", "enabled", "dependency", "null", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 323");
+ se = st.getEndingState("locked", "enabled", "dependency", "null", "disableFailed");
+ assertEquals("null,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 322");
- se = st.getEndingState("locked", "enabled", "dependency", "null", "unlock");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 324");
+ se = st.getEndingState("locked", "enabled", "dependency", "null", "enableNotFailed");
+ assertEquals("null,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 323");
- se = st.getEndingState("locked", "enabled", "dependency", "null", "disableFailed");
- assertEquals("null,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 325");
+ se = st.getEndingState("locked", "enabled", "dependency", "null", "disableDependency");
+ assertEquals("null,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 324");
- se = st.getEndingState("locked", "enabled", "dependency", "null", "enableNotFailed");
- assertEquals("null,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 326");
+ se = st.getEndingState("locked", "enabled", "dependency", "null", "enableNoDependency");
+ assertEquals("null,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 325");
- se = st.getEndingState("locked", "enabled", "dependency", "null", "disableDependency");
- assertEquals("null,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 327");
+ se = st.getEndingState("locked", "enabled", "dependency", "null", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 326");
- se = st.getEndingState("locked", "enabled", "dependency", "null", "enableNoDependency");
- assertEquals("null,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 328");
+ se = st.getEndingState("locked", "enabled", "dependency", "null", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 327");
- se = st.getEndingState("locked", "enabled", "dependency", "null", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 329");
+ se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 328");
- se = st.getEndingState("locked", "enabled", "dependency", "null", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 330");
+ se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 329");
- se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 331");
+ se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 330");
- se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 332");
+ se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 331");
- se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 333");
+ se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 332");
- se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 334");
+ se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 333");
- se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 335");
+ se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 334");
- se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 336");
+ se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 335");
- se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 337");
+ se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 336");
- se = st.getEndingState("locked", "enabled", "dependency", "coldstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 338");
+ se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 337");
- se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 339");
+ se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 338");
- se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 340");
+ se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 339");
- se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 341");
+ se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 340");
- se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 342");
+ se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 341");
- se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 343");
+ se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 342");
- se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 344");
+ se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 343");
- se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 345");
+ se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 344");
- se = st.getEndingState("locked", "enabled", "dependency", "hotstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 346");
+ se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 345");
- se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 347");
+ se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 346");
- se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 348");
+ se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 347");
- se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 349");
+ se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 348");
- se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 350");
+ se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 349");
- se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 351");
+ se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 350");
- se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 352");
+ se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 351");
- se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 353");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 352");
- se = st.getEndingState("locked", "enabled", "dependency", "providingservice", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 354");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "unlock");
+ assertEquals("null,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 353");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 355");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "disableFailed");
+ assertEquals("null,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 354");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "unlock");
- assertEquals("null,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 356");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "enableNotFailed");
+ assertEquals("null,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 355");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "disableFailed");
- assertEquals("null,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 357");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "disableDependency");
+ assertEquals("null,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 356");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "enableNotFailed");
- assertEquals("null,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 358");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "enableNoDependency");
+ assertEquals("null,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 357");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "disableDependency");
- assertEquals("null,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 359");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 358");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "enableNoDependency");
- assertEquals("null,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 360");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 359");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 361");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 360");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "null", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 362");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 361");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 363");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 362");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 364");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 363");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 365");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 364");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 366");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 365");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 367");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 366");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 368");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 367");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 369");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 368");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "coldstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 370");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 369");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 371");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 370");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 372");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 371");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 373");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 372");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 374");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 373");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 375");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 374");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 376");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 375");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 377");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 376");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "hotstandby", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 378");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice", "unlock");
+ assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 377");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 379");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 378");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice", "unlock");
- assertEquals("hotstandby,unlocked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 380");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 379");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 381");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice",
+ "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+
+ logger.info("??? StateTransition testcase 382");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice",
+ "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 380");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 383");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice", "promote");
+ assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 381");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 384");
+ se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice", "demote");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 382");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 385");
+ se = st.getEndingState("locked", "disabled", "null", "null", "demote");
+ assertEquals("coldstandby,locked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 383");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice", "promote");
- assertEquals("coldstandby,locked,enabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 386");
+ se = st.getEndingState("locked", "disabled", "null", "null", "unlock");
+ assertEquals("null,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 384");
- se = st.getEndingState("locked", "enabled", "dependency,failed", "providingservice", "demote");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 387");
+ se = st.getEndingState("locked", "disabled", "null", "null", "disableFailed");
+ assertEquals("null,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 385");
- se = st.getEndingState("locked", "disabled", "null", "null", "demote");
- assertEquals("coldstandby,locked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 388");
+ se = st.getEndingState("locked", "disabled", "null", "null", "enableNotFailed");
+ assertEquals("null,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 386");
- se = st.getEndingState("locked", "disabled", "null", "null", "unlock");
- assertEquals("null,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 389");
+ se = st.getEndingState("locked", "disabled", "null", "null", "disableDependency");
+ assertEquals("null,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 387");
- se = st.getEndingState("locked", "disabled", "null", "null", "disableFailed");
- assertEquals("null,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 390");
+ se = st.getEndingState("locked", "disabled", "null", "null", "enableNoDependency");
+ assertEquals("null,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 388");
- se = st.getEndingState("locked", "disabled", "null", "null", "enableNotFailed");
- assertEquals("null,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 391");
+ se = st.getEndingState("locked", "disabled", "null", "null", "promote");
+ assertEquals("coldstandby,locked,disabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 389");
- se = st.getEndingState("locked", "disabled", "null", "null", "disableDependency");
- assertEquals("null,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 392");
+ se = st.getEndingState("locked", "disabled", "null", "null", "demote");
+ assertEquals("coldstandby,locked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 390");
- se = st.getEndingState("locked", "disabled", "null", "null", "enableNoDependency");
- assertEquals("null,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 393");
+ se = st.getEndingState("locked", "disabled", "null", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 391");
- se = st.getEndingState("locked", "disabled", "null", "null", "promote");
- assertEquals("coldstandby,locked,disabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 394");
+ se = st.getEndingState("locked", "disabled", "null", "coldstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 392");
- se = st.getEndingState("locked", "disabled", "null", "null", "demote");
- assertEquals("coldstandby,locked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 395");
+ se = st.getEndingState("locked", "disabled", "null", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 393");
- se = st.getEndingState("locked", "disabled", "null", "coldstandby", "demote");
- assertEquals("coldstandby,locked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 396");
+ se = st.getEndingState("locked", "disabled", "null", "coldstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 394");
- se = st.getEndingState("locked", "disabled", "null", "coldstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 397");
+ se = st.getEndingState("locked", "disabled", "null", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 395");
- se = st.getEndingState("locked", "disabled", "null", "coldstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 398");
+ se = st.getEndingState("locked", "disabled", "null", "coldstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 396");
- se = st.getEndingState("locked", "disabled", "null", "coldstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 399");
+ se = st.getEndingState("locked", "disabled", "null", "coldstandby", "promote");
+ assertEquals("coldstandby,locked,disabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 397");
- se = st.getEndingState("locked", "disabled", "null", "coldstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 400");
+ se = st.getEndingState("locked", "disabled", "null", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 398");
- se = st.getEndingState("locked", "disabled", "null", "coldstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 401");
+ se = st.getEndingState("locked", "disabled", "null", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 399");
- se = st.getEndingState("locked", "disabled", "null", "coldstandby", "promote");
- assertEquals("coldstandby,locked,disabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 402");
+ se = st.getEndingState("locked", "disabled", "null", "hotstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 400");
- se = st.getEndingState("locked", "disabled", "null", "coldstandby", "demote");
- assertEquals("coldstandby,locked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 403");
+ se = st.getEndingState("locked", "disabled", "null", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 401");
- se = st.getEndingState("locked", "disabled", "null", "hotstandby", "demote");
- assertEquals("coldstandby,locked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 404");
+ se = st.getEndingState("locked", "disabled", "null", "hotstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 402");
- se = st.getEndingState("locked", "disabled", "null", "hotstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 405");
+ se = st.getEndingState("locked", "disabled", "null", "hotstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 403");
- se = st.getEndingState("locked", "disabled", "null", "hotstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 406");
+ se = st.getEndingState("locked", "disabled", "null", "hotstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 404");
- se = st.getEndingState("locked", "disabled", "null", "hotstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 407");
+ se = st.getEndingState("locked", "disabled", "null", "hotstandby", "promote");
+ assertEquals("coldstandby,locked,disabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 405");
- se = st.getEndingState("locked", "disabled", "null", "hotstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 408");
+ se = st.getEndingState("locked", "disabled", "null", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 406");
- se = st.getEndingState("locked", "disabled", "null", "hotstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 409");
+ se = st.getEndingState("locked", "disabled", "null", "providingservice", "demote");
+ assertEquals("coldstandby,locked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 407");
- se = st.getEndingState("locked", "disabled", "null", "hotstandby", "promote");
- assertEquals("coldstandby,locked,disabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 410");
+ se = st.getEndingState("locked", "disabled", "null", "providingservice", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 408");
- se = st.getEndingState("locked", "disabled", "null", "hotstandby", "demote");
- assertEquals("coldstandby,locked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 411");
+ se = st.getEndingState("locked", "disabled", "null", "providingservice", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 409");
- se = st.getEndingState("locked", "disabled", "null", "providingservice", "demote");
- assertEquals("coldstandby,locked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 412");
+ se = st.getEndingState("locked", "disabled", "null", "providingservice", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 410");
- se = st.getEndingState("locked", "disabled", "null", "providingservice", "unlock");
- assertEquals("coldstandby,unlocked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 413");
+ se = st.getEndingState("locked", "disabled", "null", "providingservice", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 411");
- se = st.getEndingState("locked", "disabled", "null", "providingservice", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 414");
+ se = st.getEndingState("locked", "disabled", "null", "providingservice", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 412");
- se = st.getEndingState("locked", "disabled", "null", "providingservice", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 415");
+ se = st.getEndingState("locked", "disabled", "null", "providingservice", "promote");
+ assertEquals("coldstandby,locked,disabled,null,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 413");
- se = st.getEndingState("locked", "disabled", "null", "providingservice", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 416");
+ se = st.getEndingState("locked", "disabled", "null", "providingservice", "demote");
+ assertEquals("coldstandby,locked,disabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 414");
- se = st.getEndingState("locked", "disabled", "null", "providingservice", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 417");
+ se = st.getEndingState("locked", "disabled", "failed", "null", "demote");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 415");
- se = st.getEndingState("locked", "disabled", "null", "providingservice", "promote");
- assertEquals("coldstandby,locked,disabled,null,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 418");
+ se = st.getEndingState("locked", "disabled", "failed", "null", "unlock");
+ assertEquals("null,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 416");
- se = st.getEndingState("locked", "disabled", "null", "providingservice", "demote");
- assertEquals("coldstandby,locked,disabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 419");
+ se = st.getEndingState("locked", "disabled", "failed", "null", "disableFailed");
+ assertEquals("null,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 417");
- se = st.getEndingState("locked", "disabled", "failed", "null", "demote");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 420");
+ se = st.getEndingState("locked", "disabled", "failed", "null", "enableNotFailed");
+ assertEquals("null,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 418");
- se = st.getEndingState("locked", "disabled", "failed", "null", "unlock");
- assertEquals("null,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 421");
+ se = st.getEndingState("locked", "disabled", "failed", "null", "disableDependency");
+ assertEquals("null,locked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 419");
- se = st.getEndingState("locked", "disabled", "failed", "null", "disableFailed");
- assertEquals("null,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 422");
+ se = st.getEndingState("locked", "disabled", "failed", "null", "enableNoDependency");
+ assertEquals("null,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 420");
- se = st.getEndingState("locked", "disabled", "failed", "null", "enableNotFailed");
- assertEquals("null,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 423");
+ se = st.getEndingState("locked", "disabled", "failed", "null", "promote");
+ assertEquals("coldstandby,locked,disabled,failed,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 421");
- se = st.getEndingState("locked", "disabled", "failed", "null", "disableDependency");
- assertEquals("null,locked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 424");
+ se = st.getEndingState("locked", "disabled", "failed", "null", "demote");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 422");
- se = st.getEndingState("locked", "disabled", "failed", "null", "enableNoDependency");
- assertEquals("null,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 425");
+ se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 423");
- se = st.getEndingState("locked", "disabled", "failed", "null", "promote");
- assertEquals("coldstandby,locked,disabled,failed,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 426");
+ se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 424");
- se = st.getEndingState("locked", "disabled", "failed", "null", "demote");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 427");
+ se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 425");
- se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "demote");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 428");
+ se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 426");
- se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 429");
+ se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 427");
- se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 430");
+ se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 428");
- se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 431");
+ se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "promote");
+ assertEquals("coldstandby,locked,disabled,failed,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 429");
- se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 432");
+ se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 430");
- se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 433");
+ se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 431");
- se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "promote");
- assertEquals("coldstandby,locked,disabled,failed,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 434");
+ se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 432");
- se = st.getEndingState("locked", "disabled", "failed", "coldstandby", "demote");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 435");
+ se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 433");
- se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "demote");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 436");
+ se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 434");
- se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 437");
+ se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 435");
- se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 438");
+ se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 436");
- se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 439");
+ se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "promote");
+ assertEquals("coldstandby,locked,disabled,failed,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 437");
- se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 440");
+ se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 438");
- se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 441");
+ se = st.getEndingState("locked", "disabled", "failed", "providingservice", "demote");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 439");
- se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "promote");
- assertEquals("coldstandby,locked,disabled,failed,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 442");
+ se = st.getEndingState("locked", "disabled", "failed", "providingservice", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 440");
- se = st.getEndingState("locked", "disabled", "failed", "hotstandby", "demote");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 443");
+ se = st.getEndingState("locked", "disabled", "failed", "providingservice", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 441");
- se = st.getEndingState("locked", "disabled", "failed", "providingservice", "demote");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 444");
+ se = st.getEndingState("locked", "disabled", "failed", "providingservice", "enableNotFailed");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 442");
- se = st.getEndingState("locked", "disabled", "failed", "providingservice", "unlock");
- assertEquals("coldstandby,unlocked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 445");
+ se = st.getEndingState("locked", "disabled", "failed", "providingservice", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 443");
- se = st.getEndingState("locked", "disabled", "failed", "providingservice", "disableFailed");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 446");
+ se = st.getEndingState("locked", "disabled", "failed", "providingservice", "enableNoDependency");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 444");
- se = st.getEndingState("locked", "disabled", "failed", "providingservice", "enableNotFailed");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 447");
+ se = st.getEndingState("locked", "disabled", "failed", "providingservice", "promote");
+ assertEquals("coldstandby,locked,disabled,failed,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 445");
- se = st.getEndingState("locked", "disabled", "failed", "providingservice", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 448");
+ se = st.getEndingState("locked", "disabled", "failed", "providingservice", "demote");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 446");
- se = st.getEndingState("locked", "disabled", "failed", "providingservice", "enableNoDependency");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 449");
+ se = st.getEndingState("locked", "disabled", "dependency", "null", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 447");
- se = st.getEndingState("locked", "disabled", "failed", "providingservice", "promote");
- assertEquals("coldstandby,locked,disabled,failed,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 450");
+ se = st.getEndingState("locked", "disabled", "dependency", "null", "unlock");
+ assertEquals("null,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 448");
- se = st.getEndingState("locked", "disabled", "failed", "providingservice", "demote");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 451");
+ se = st.getEndingState("locked", "disabled", "dependency", "null", "disableFailed");
+ assertEquals("null,locked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 449");
- se = st.getEndingState("locked", "disabled", "dependency", "null", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 452");
+ se = st.getEndingState("locked", "disabled", "dependency", "null", "enableNotFailed");
+ assertEquals("null,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 450");
- se = st.getEndingState("locked", "disabled", "dependency", "null", "unlock");
- assertEquals("null,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 453");
+ se = st.getEndingState("locked", "disabled", "dependency", "null", "disableDependency");
+ assertEquals("null,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 451");
- se = st.getEndingState("locked", "disabled", "dependency", "null", "disableFailed");
- assertEquals("null,locked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 454");
+ se = st.getEndingState("locked", "disabled", "dependency", "null", "enableNoDependency");
+ assertEquals("null,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 452");
- se = st.getEndingState("locked", "disabled", "dependency", "null", "enableNotFailed");
- assertEquals("null,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 455");
+ se = st.getEndingState("locked", "disabled", "dependency", "null", "promote");
+ assertEquals("coldstandby,locked,disabled,dependency,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 453");
- se = st.getEndingState("locked", "disabled", "dependency", "null", "disableDependency");
- assertEquals("null,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 456");
+ se = st.getEndingState("locked", "disabled", "dependency", "null", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 454");
- se = st.getEndingState("locked", "disabled", "dependency", "null", "enableNoDependency");
- assertEquals("null,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 457");
+ se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 455");
- se = st.getEndingState("locked", "disabled", "dependency", "null", "promote");
- assertEquals("coldstandby,locked,disabled,dependency,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 458");
+ se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 456");
- se = st.getEndingState("locked", "disabled", "dependency", "null", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 459");
+ se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 457");
- se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 460");
+ se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 458");
- se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 461");
+ se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 459");
- se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 462");
+ se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 460");
- se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 463");
+ se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "promote");
+ assertEquals("coldstandby,locked,disabled,dependency,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 461");
- se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 464");
+ se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 462");
- se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 465");
+ se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 463");
- se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "promote");
- assertEquals("coldstandby,locked,disabled,dependency,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 466");
+ se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 464");
- se = st.getEndingState("locked", "disabled", "dependency", "coldstandby", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 467");
+ se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 465");
- se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 468");
+ se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 466");
- se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 469");
+ se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 467");
- se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 470");
+ se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 468");
- se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 471");
+ se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "promote");
+ assertEquals("coldstandby,locked,disabled,dependency,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 469");
- se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 472");
+ se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 470");
- se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 473");
+ se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 471");
- se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "promote");
- assertEquals("coldstandby,locked,disabled,dependency,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 474");
+ se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 472");
- se = st.getEndingState("locked", "disabled", "dependency", "hotstandby", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 475");
+ se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 473");
- se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 476");
+ se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "enableNotFailed");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 474");
- se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "unlock");
- assertEquals("coldstandby,unlocked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 477");
+ se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 475");
- se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "disableFailed");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 478");
+ se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "enableNoDependency");
+ assertEquals("coldstandby,locked,enabled,null,", makeString(se));
- logger.info("??? StateTransition testcase 476");
- se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "enableNotFailed");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 479");
+ se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "promote");
+ assertEquals("coldstandby,locked,disabled,dependency,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 477");
- se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 480");
+ se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 478");
- se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "enableNoDependency");
- assertEquals("coldstandby,locked,enabled,null,", makeString(se));
+ logger.info("??? StateTransition testcase 481");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 479");
- se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "promote");
- assertEquals("coldstandby,locked,disabled,dependency,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 482");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "unlock");
+ assertEquals("null,unlocked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 480");
- se = st.getEndingState("locked", "disabled", "dependency", "providingservice", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 483");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "disableFailed");
+ assertEquals("null,locked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 481");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 484");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "enableNotFailed");
+ assertEquals("null,locked,disabled,dependency,", makeString(se));
- logger.info("??? StateTransition testcase 482");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "unlock");
- assertEquals("null,unlocked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 485");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "disableDependency");
+ assertEquals("null,locked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 483");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "disableFailed");
- assertEquals("null,locked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 486");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "enableNoDependency");
+ assertEquals("null,locked,disabled,failed,", makeString(se));
- logger.info("??? StateTransition testcase 484");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "enableNotFailed");
- assertEquals("null,locked,disabled,dependency,", makeString(se));
+ logger.info("??? StateTransition testcase 487");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "promote");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,StandbyStatusException", makeString(se));
- logger.info("??? StateTransition testcase 485");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "disableDependency");
- assertEquals("null,locked,disabled,dependency,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 488");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 486");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "enableNoDependency");
- assertEquals("null,locked,disabled,failed,", makeString(se));
+ logger.info("??? StateTransition testcase 489");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 487");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "promote");
- assertEquals("coldstandby,locked,disabled,dependency,failed,StandbyStatusException", makeString(se));
+ logger.info("??? StateTransition testcase 490");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 491");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
- logger.info("??? StateTransition testcase 488");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "null", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 489");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 490");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 491");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 492");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
-
- logger.info("??? StateTransition testcase 493");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 494");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 495");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "promote");
- assertEquals("coldstandby,locked,disabled,dependency,failed,StandbyStatusException", makeString(se));
-
- logger.info("??? StateTransition testcase 496");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 497");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 498");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "unlock");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 499");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "disableFailed");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 500");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "enableNotFailed");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
-
- logger.info("??? StateTransition testcase 501");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 502");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "enableNoDependency");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 503");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "promote");
- assertEquals("coldstandby,locked,disabled,dependency,failed,StandbyStatusException", makeString(se));
-
- logger.info("??? StateTransition testcase 504");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 505");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 506");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice", "unlock");
- assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 507");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice", "disableFailed");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 508");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice", "enableNotFailed");
- assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
-
- logger.info("??? StateTransition testcase 509");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice", "disableDependency");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 510");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice", "enableNoDependency");
- assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
-
- logger.info("??? StateTransition testcase 511");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice", "promote");
- assertEquals("coldstandby,locked,disabled,dependency,failed,StandbyStatusException", makeString(se));
-
- logger.info("??? StateTransition testcase 512");
- se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice", "demote");
- assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
-
- } catch (Exception ex) {
- logger.error("EndingState NOT found");
- throw new Exception("EndingState NOT found. " + ex);
- }
-
- } catch(Exception ex) {
- logger.error("Exception: {}" + ex.toString());
- throw new Exception("Failure getting ending state. " + ex );
- }
-
- logger.info("\n\nStateTransitionTest: Exit\n\n");
- }
-
- /**
- * Converts a state element to a comma-separated string.
- * @param se element to be converted
- * @return a string representing the element
- */
- private String makeString(StateElement se)
- {
- if(se == null) {
- return null;
- }
-
- StringBuilder b = new StringBuilder();
-
- String endingStandbyStatus = se.getEndingStandbyStatus();
- if (endingStandbyStatus != null) {
- b.append(endingStandbyStatus.replace(".", ","));
- b.append(',');
- }
-
- b.append(se.getEndingAdminState());
- b.append(',');
- b.append(se.getEndingOpState());
- b.append(',');
- b.append(se.getEndingAvailStatus());
- b.append(',');
- b.append(se.getException());
-
- return b.toString();
- }
+ logger.info("??? StateTransition testcase 492");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+
+ logger.info("??? StateTransition testcase 493");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 494");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 495");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "promote");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,StandbyStatusException", makeString(se));
+
+ logger.info("??? StateTransition testcase 496");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "coldstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 497");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 498");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 499");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 500");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "enableNotFailed");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+
+ logger.info("??? StateTransition testcase 501");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 502");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "enableNoDependency");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 503");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "promote");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,StandbyStatusException", makeString(se));
+
+ logger.info("??? StateTransition testcase 504");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "hotstandby", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 505");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 506");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice", "unlock");
+ assertEquals("coldstandby,unlocked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 507");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice", "disableFailed");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 508");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice",
+ "enableNotFailed");
+ assertEquals("coldstandby,locked,disabled,dependency,", makeString(se));
+
+ logger.info("??? StateTransition testcase 509");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice",
+ "disableDependency");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 510");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice",
+ "enableNoDependency");
+ assertEquals("coldstandby,locked,disabled,failed,", makeString(se));
+
+ logger.info("??? StateTransition testcase 511");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice", "promote");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,StandbyStatusException", makeString(se));
+
+ logger.info("??? StateTransition testcase 512");
+ se = st.getEndingState("locked", "disabled", "dependency,failed", "providingservice", "demote");
+ assertEquals("coldstandby,locked,disabled,dependency,failed,", makeString(se));
+
+ } catch (Exception ex) {
+ logger.error("EndingState NOT found");
+ throw new Exception("EndingState NOT found. " + ex);
+ }
+
+ } catch (Exception ex) {
+ logger.error("Exception: {}" + ex.toString());
+ throw new Exception("Failure getting ending state. " + ex);
+ }
+
+ logger.info("\n\nStateTransitionTest: Exit\n\n");
+ }
+
+ /**
+ * Converts a state element to a comma-separated string.
+ *
+ * @param se element to be converted
+ * @return a string representing the element
+ */
+ private String makeString(StateElement se) {
+ if (se == null) {
+ return null;
+ }
+
+ StringBuilder stringBuilder = new StringBuilder();
+
+ String endingStandbyStatus = se.getEndingStandbyStatus();
+ if (endingStandbyStatus != null) {
+ stringBuilder.append(endingStandbyStatus.replace(".", ","));
+ stringBuilder.append(',');
+ }
+
+ stringBuilder.append(se.getEndingAdminState());
+ stringBuilder.append(',');
+ stringBuilder.append(se.getEndingOpState());
+ stringBuilder.append(',');
+ stringBuilder.append(se.getEndingAvailStatus());
+ stringBuilder.append(',');
+ stringBuilder.append(se.getException());
+
+ return stringBuilder.toString();
+ }
}
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/exceptions/EntityRetrievalExceptionTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/exceptions/EntityRetrievalExceptionTest.java
index 8d948241..48ec3b86 100644
--- a/integrity-monitor/src/test/java/org/onap/policy/common/im/exceptions/EntityRetrievalExceptionTest.java
+++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/exceptions/EntityRetrievalExceptionTest.java
@@ -21,6 +21,7 @@
package org.onap.policy.common.im.exceptions;
import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
import org.onap.policy.common.utils.test.ExceptionsTester;