From 3073f50c525e47b0f0c4343330a9456faabeae78 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 4 Dec 2019 10:24:58 +0000 Subject: Minor changes for new Eclipse checkstyle checks The laest Eclipse checkstyle version 8.26.0 does more thorough checking and identified a number of small issues in the apex-pdp codebase. This review fixes those issues. logging pattern in logback.xml files amended to be less than 120 characters. Test case added for checking parameter is valid. Issue-ID: POLICY-2204 Change-Id: Id7293e44b56c225afc6290e1c599603e9ebedb19 Signed-off-by: liamfallon --- .../src/test/resources/logback-test.xml | 279 ++++++++++++------ integrity-audit/src/test/resources/logback.xml | 323 ++++++++++++--------- .../src/test/resources/logger-test.expectedlog | 1 + .../src/test/resources/policyLogger.properties | 13 +- .../src/test/resources/xlogger-test.expectedlog | 1 + 5 files changed, 381 insertions(+), 236 deletions(-) create mode 100644 integrity-audit/src/test/resources/logger-test.expectedlog create mode 100644 integrity-audit/src/test/resources/xlogger-test.expectedlog (limited to 'integrity-audit/src/test/resources') diff --git a/integrity-audit/src/test/resources/logback-test.xml b/integrity-audit/src/test/resources/logback-test.xml index f4c656c7..e3867e79 100644 --- a/integrity-audit/src/test/resources/logback-test.xml +++ b/integrity-audit/src/test/resources/logback-test.xml @@ -20,40 +20,79 @@ - + - + - + - - + + - - - - + + + + - - - - + + + + + + + + + + + - - - ${defaultPattern} - - + + + ${defaultPattern} + + @@ -71,99 +110,149 @@ Policy engine events from other components, or it can be eliminated to record these events as part of the application root log. --> - - ${logDirectory}/${auditLogName}.log - - - ${defaultPattern} - - - - 256 - - - - - ${logDirectory}/${metricsLogName}.log - - - - ${defaultPattern} - - - - - - 256 - - - - - ${logDirectory}/${errorLogName}.log - - - ERROR - - - ${defaultPattern} - - - - - 256 - - - - - ${debugLogDirectory}/${debugLogName}.log - - - - DEBUG - - - ${defaultPattern} - - - - - 256 - - true - + + ${logDirectory}/${auditLogName}.log + + + ${defaultPattern} + + + + 256 + + + + + ${logDirectory}/${metricsLogName}.log + + + ${defaultPattern} + + + + + + 256 + + + + + ${logDirectory}/${errorLogName}.log + + + ERROR + + + ${defaultPattern} + + + + + 256 + + + + + ${debugLogDirectory}/${debugLogName}.log + + + DEBUG + + + ${defaultPattern} + + + + + 256 + + true + + + + + ${logDirectory}/logging-pattern-test.log + + + ${defaultPattern} + + - - - + + + - + - + - - - + + + - + - + - + - + + + + + + diff --git a/integrity-audit/src/test/resources/logback.xml b/integrity-audit/src/test/resources/logback.xml index 59d66a4e..8f493cff 100644 --- a/integrity-audit/src/test/resources/logback.xml +++ b/integrity-audit/src/test/resources/logback.xml @@ -20,40 +20,80 @@ - + - + - + - - + + - - - - + + + + - - - - + + + + + + + + + + + - - - ${defaultPattern} - - + + + ${defaultPattern} + + @@ -71,139 +111,152 @@ Policy engine events from other components, or it can be eliminated to record these events as part of the application root log. --> - - ${logDirectory}/${auditLogName}.log - - ${logDirectory}/${auditLogName}.%i.log.zip - - 1 - 9 - - - 5MB - - - ${defaultPattern} - - - - 256 - - - - - ${logDirectory}/${metricsLogName}.log - - ${logDirectory}/${metricsLogName}.%i.log.zip - - 1 - 9 - - - 5MB - - - - ${defaultPattern} - - - - - - 256 - - - - - ${logDirectory}/${errorLogName}.log - - ${logDirectory}/${errorLogName}.%i.log.zip - - 1 - 9 - - - ERROR - - - 5MB - - - ${defaultPattern} - - - - - 256 - - - - - ${debugLogDirectory}/${debugLogName}.log - - ${debugLogDirectory}/${debugLogName}.%i.log.zip - - 1 - 9 - - - - DEBUG - - - 5MB - - - ${defaultPattern} - - - - - 256 - - true - + + ${logDirectory}/${auditLogName}.log + + ${logDirectory}/${auditLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${defaultPattern} + + + + 256 + + + + + ${logDirectory}/${metricsLogName}.log + + ${logDirectory}/${metricsLogName}.%i.log.zip + + 1 + 9 + + + 5MB + + + ${defaultPattern} + + + + + + 256 + + + + + ${logDirectory}/${errorLogName}.log + + ${logDirectory}/${errorLogName}.%i.log.zip + + 1 + 9 + + + ERROR + + + 5MB + + + ${defaultPattern} + + + + + 256 + + + + + ${debugLogDirectory}/${debugLogName}.log + + ${debugLogDirectory}/${debugLogName}.%i.log.zip + + 1 + 9 + + + DEBUG + + + 5MB + + + ${defaultPattern} + + + + + 256 + + true + - - - + + + - + - + - - - + + + - + - + - + - + diff --git a/integrity-audit/src/test/resources/logger-test.expectedlog b/integrity-audit/src/test/resources/logger-test.expectedlog new file mode 100644 index 00000000..69df8f96 --- /dev/null +++ b/integrity-audit/src/test/resources/logger-test.expectedlog @@ -0,0 +1 @@ +2019-12-05T13:24:14.110Z|TheRequestId|TheServiceInstanceId|main|TheServerName|TheServiceName|TheInstanceUuid|INFO|TheSeverity|TheServerIpAddress|TheServer|TheClientIpAddress|org.onap.policy.common.ia.DefaultLoggingPatternTest||This is a test logging string for logger diff --git a/integrity-audit/src/test/resources/policyLogger.properties b/integrity-audit/src/test/resources/policyLogger.properties index cb5ef8d2..42cf1cfd 100644 --- a/integrity-audit/src/test/resources/policyLogger.properties +++ b/integrity-audit/src/test/resources/policyLogger.properties @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,10 +23,10 @@ timer.delay.time=1000 #Timer scheduleAtFixedRate period - time in milliseconds between successive task executions. check.interval= 30000 -#Longest time an event info can be stored in the concurrentHashMap for logging - in seconds. +#Longest time an event info can be stored in the concurrentHashMap for logging - in seconds. event.expired.time=86400 -#Size of the concurrentHashMap which stores the event starting time, etc - when its size reaches this limit, the Timer gets executed -#to remove all expired records from this concurrentHashMap. +#Size of the concurrentHashMap which stores the event starting time, etc - when its size reaches this limit, the Timer +# gets executed to remove all expired records from this concurrentHashMap. concurrentHashMap.limit=5000 #Size of the concurrentHashMap - when its size drops to this point, stop the Timer stop.check.point=2500 @@ -34,7 +34,8 @@ stop.check.point=2500 # set EELF for EELF logging format, set LOG4J for using log4j, set SYSTEMOUT for using system.out.println logger.type=EELF #################################### Set level for EELF or SYSTEMOUT logging ################################## -# Set level for debug file. Set DEBUG to enable .info, .warn and .debug; set INFO for enable .info and .warn; set OFF to disable all +# Set level for debug file. Set DEBUG to enable .info, .warn and .debug; set INFO for enable .info and .warn; set OFF to +# disable all debugLogger.level=DEBUG # Set level for metrics file. Set OFF to disable; set ON to enable metricsLogger.level=ON diff --git a/integrity-audit/src/test/resources/xlogger-test.expectedlog b/integrity-audit/src/test/resources/xlogger-test.expectedlog new file mode 100644 index 00000000..a9ad4992 --- /dev/null +++ b/integrity-audit/src/test/resources/xlogger-test.expectedlog @@ -0,0 +1 @@ +2019-12-05T13:24:14.110Z|TheRequestId|TheServiceInstanceId|main|TheServerName|TheServiceName|TheInstanceUuid|INFO|TheSeverity|TheServerIpAddress|TheServer|TheClientIpAddress|org.onap.policy.common.ia.DefaultLoggingPatternTest||This is a test logging string for xlogger -- cgit 1.2.3-korg