diff options
author | vasraz <vasyl.razinkov@est.tech> | 2020-04-02 10:26:08 +0100 |
---|---|---|
committer | Vasyl Razinkov <vasyl.razinkov@est.tech> | 2020-04-02 11:21:40 +0000 |
commit | aefe335ef35ffd318108fb667ce69e398f8d65bd (patch) | |
tree | 141b51dec82ec67c5acfbac6012ecb4b062ceb1a /common-app-logging/src/main | |
parent | 0968bd68620bbd22e7ab855c9252be4178953a3a (diff) |
Increase test coverage
Change-Id: I0c8ddfb32ae7abc6443007fc5cee72bec6da785b
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-2833
Diffstat (limited to 'common-app-logging/src/main')
11 files changed, 463 insertions, 282 deletions
diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerBase.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerBase.java index 4ee6039d32..5295c4ab58 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerBase.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerBase.java @@ -1,6 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2020 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * Modifications copyright (c) 2020 Nordix Foundation + * ================================================================================ + */ package org.openecomp.sdc.common.log.elements; import com.google.common.annotations.VisibleForTesting; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.openecomp.sdc.common.log.api.ILogFieldsHandler; @@ -13,22 +38,17 @@ import org.slf4j.Logger; import org.slf4j.Marker; import org.slf4j.MarkerFactory; -import javax.servlet.http.HttpServletRequest; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; - /** - * Created by mm288v on 12/27/2017. - * This class holds the common behavior of all Loger-Typed classes. - * The Concrete loggers shoudl derive from this one. + * Created by mm288v on 12/27/2017. This class holds the common behavior of all Loger-Typed classes. The Concrete + * loggers shoudl derive from this one. */ public abstract class LoggerBase implements ILogger { + + private static final String missingLogFieldsMsg = "mandatory parameters for ECOMP logging, missing fields: %s, original message: %s"; + protected final ILogFieldsHandler ecompLogFieldsHandler; private final Logger myLogger; private final Marker myMarker; - protected final ILogFieldsHandler ecompLogFieldsHandler; - private final static String missingLogFieldsMsg = "mandatory parameters for ECOMP logging, missing fields: %s, original message: %s"; LoggerBase(ILogFieldsHandler ecompLogFieldsHandler, Marker marker, Logger logger) { this.ecompLogFieldsHandler = ecompLogFieldsHandler; @@ -47,7 +67,7 @@ public abstract class LoggerBase implements ILogger { String transactionReId = httpRequest.getHeader(ConstantsLogging.X_TRANSACTION_ID_HEADER); String ecompRequestId = httpRequest.getHeader(ConstantsLogging.X_ECOMP_REQUEST_ID_HEADER); return Arrays.asList(onapRequestId, requestId, transactionReId, ecompRequestId).stream() - .filter(id -> !StringUtils.isEmpty(id)).findFirst().orElse(generateKeyRequestId()); + .filter(id -> !StringUtils.isEmpty(id)).findFirst().orElse(generateKeyRequestId()); } public static String getPartnerName(HttpServletRequest httpRequest) { @@ -55,7 +75,7 @@ public abstract class LoggerBase implements ILogger { String onapPartnerName = httpRequest.getHeader(ONAPLogConstants.Headers.PARTNER_NAME); String reqUri = httpRequest.getHeader(ConstantsLogging.USER_AGENT_HEADER); return Arrays.asList(userId, onapPartnerName, reqUri).stream() - .filter(pn-> !StringUtils.isEmpty(pn)).findFirst().orElse(ConstantsLogging.PartnerName_Unknown); + .filter(pn -> !StringUtils.isEmpty(pn)).findFirst().orElse(ConstantsLogging.PartnerName_Unknown); } protected void setKeyRequestIdIfNotSetYet() { @@ -69,8 +89,8 @@ public abstract class LoggerBase implements ILogger { String filedNameThatHasNotBeenInitialized = checkMandatoryFieldsExistInMDC(); if (myLogger.isDebugEnabled() && !"".equalsIgnoreCase(filedNameThatHasNotBeenInitialized)) { - myLogger.debug(MarkerFactory.getMarker(LogMarkers.DEBUG_MARKER.text()), - String.format(missingLogFieldsMsg, filedNameThatHasNotBeenInitialized, originMsg)); + myLogger.debug(MarkerFactory.getMarker(LogMarkers.DEBUG_MARKER.getText()), + String.format(missingLogFieldsMsg, filedNameThatHasNotBeenInitialized, originMsg)); } } @@ -105,10 +125,10 @@ public abstract class LoggerBase implements ILogger { } @Override - public void log(LogLevel logLevel, String message, Object...params) { + public void log(LogLevel logLevel, String message, Object... params) { validateMandatoryFields(message); - switch(logLevel) { + switch (logLevel) { case ERROR: case FATAL: //TODO check how to log "FATAL" word myLogger.error(myMarker, message, params); @@ -134,7 +154,7 @@ public abstract class LoggerBase implements ILogger { public void log(LogLevel logLevel, String message, Throwable throwable) { validateMandatoryFields(message); - switch(logLevel) { + switch (logLevel) { case ERROR: case FATAL: //TODO check how to log "FATAL" word myLogger.error(myMarker, createErrorMessage(message, throwable)); @@ -157,10 +177,10 @@ public abstract class LoggerBase implements ILogger { } @Override - public void log(Marker marker, LogLevel logLevel, String message, Object...params) { + public void log(Marker marker, LogLevel logLevel, String message, Object... params) { validateMandatoryFields(message); - switch(logLevel) { + switch (logLevel) { case ERROR: case FATAL: //TODO check how to log "FATAL" word myLogger.error(marker, message, params); diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerDebug.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerDebug.java index cebe7bac51..413bd91434 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerDebug.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerDebug.java @@ -1,5 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2020 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * Modifications copyright (c) 2020 Nordix Foundation + * ================================================================================ + */ package org.openecomp.sdc.common.log.elements; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.openecomp.sdc.common.log.api.ILogFieldsHandler; import org.openecomp.sdc.common.log.enums.LogLevel; @@ -7,16 +31,12 @@ import org.openecomp.sdc.common.log.enums.LogMarkers; import org.slf4j.Logger; import org.slf4j.MarkerFactory; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - public class LoggerDebug extends LoggerBase { private static ArrayList<String> mandatoryFields = new ArrayList<>(Arrays.asList(ONAPLogConstants.MDCs.REQUEST_ID)); LoggerDebug(ILogFieldsHandler ecompMdcWrapper, Logger logger) { - super(ecompMdcWrapper, MarkerFactory.getMarker(LogMarkers.DEBUG_MARKER.text()), logger); + super(ecompMdcWrapper, MarkerFactory.getMarker(LogMarkers.DEBUG_MARKER.getText()), logger); } @Override @@ -26,19 +46,19 @@ public class LoggerDebug extends LoggerBase { } @Override - public void log(LogLevel logLevel, String message, Object...params){ + public void log(LogLevel logLevel, String message, Object... params) { setKeyRequestIdIfNotSetYet(); super.log(logLevel, message, params); } @Override - public void log(LogLevel logLevel, String message, Throwable throwable){ + public void log(LogLevel logLevel, String message, Throwable throwable) { setKeyRequestIdIfNotSetYet(); super.log(logLevel, message, throwable); } @Override - public void log(LogLevel logLevel, String message){ + public void log(LogLevel logLevel, String message) { setKeyRequestIdIfNotSetYet(); super.log(logLevel, message); } diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerError.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerError.java index fbf610638b..347a60f9ea 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerError.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerError.java @@ -1,5 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2020 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * Modifications copyright (c) 2020 Nordix Foundation + * ================================================================================ + */ package org.openecomp.sdc.common.log.elements; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; import org.apache.commons.lang3.StringUtils; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.openecomp.sdc.common.log.api.ILogConfiguration; @@ -11,22 +36,17 @@ import org.openecomp.sdc.common.log.enums.LogMarkers; import org.slf4j.Logger; import org.slf4j.MarkerFactory; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - public class LoggerError extends LoggerBase { - private static ArrayList<String> mandatoryFields = new ArrayList<>(Arrays.asList( - ONAPLogConstants.MDCs.REQUEST_ID, - ONAPLogConstants.MDCs.SERVICE_NAME, - ILogConfiguration.MDC_ERROR_CATEGORY, - ILogConfiguration.MDC_ERROR_CODE)); public static final String defaultServiceName = "SDC catalog"; + private static ArrayList<String> mandatoryFields = new ArrayList<>(Arrays.asList( + ONAPLogConstants.MDCs.REQUEST_ID, + ONAPLogConstants.MDCs.SERVICE_NAME, + ILogConfiguration.MDC_ERROR_CATEGORY, + ILogConfiguration.MDC_ERROR_CODE)); LoggerError(ILogFieldsHandler ecompMdcWrapper, Logger logger) { - super(ecompMdcWrapper, MarkerFactory.getMarker(LogMarkers.ERROR_MARKER.text()), logger); + super(ecompMdcWrapper, MarkerFactory.getMarker(LogMarkers.ERROR_MARKER.getText()), logger); } @Override @@ -56,7 +76,7 @@ public class LoggerError extends LoggerBase { EcompLoggerErrorCode errorCodeEnum, String serviceName, String targetEntity, - String message, Object...params) { + String message, Object... params) { fillFieldsBeforeLogging(logLevel, errorCodeEnum, serviceName, targetEntity, null); super.log(logLevel, message, params); } @@ -66,13 +86,14 @@ public class LoggerError extends LoggerBase { String serviceName, ErrorLogOptionalData errorLogOptionalData, String description, - Object...params) { + Object... params) { fillFieldsBeforeLogging(logLevel, errorCodeEnum, serviceName, - errorLogOptionalData.getTargetEntity(), errorLogOptionalData.getTargetServiceName()); + errorLogOptionalData.getTargetEntity(), errorLogOptionalData.getTargetServiceName()); super.log(logLevel, description, params); } - private void fillFieldsBeforeLogging(LogLevel logLevel, EcompLoggerErrorCode errorCodeEnum, String serviceName, String targetEntity, String targetServiceName) { + private void fillFieldsBeforeLogging(LogLevel logLevel, EcompLoggerErrorCode errorCodeEnum, String serviceName, + String targetEntity, String targetServiceName) { clear(); ecompLogFieldsHandler.setErrorCode(errorCodeEnum.getErrorCode()); ecompLogFieldsHandler.setErrorCategory(logLevel.name()); @@ -98,8 +119,8 @@ public class LoggerError extends LoggerBase { public void log(LogLevel logLevel, EcompLoggerErrorCode errorCodeEnum, String serviceName, - String message, Object...params) { - log(logLevel, errorCodeEnum, serviceName, (String)null, message, params); + String message, Object... params) { + log(logLevel, errorCodeEnum, serviceName, (String) null, message, params); } public void log(LogLevel logLevel, @@ -110,8 +131,8 @@ public class LoggerError extends LoggerBase { } @Override - public void log(LogLevel logLevel, String message, Object...params) { - log(logLevel, EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR, defaultServiceName, (String)null, message, params); + public void log(LogLevel logLevel, String message, Object... params) { + log(logLevel, EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR, defaultServiceName, (String) null, message, params); } public void log(LogLevel logLevel, String message, Throwable throwable) { @@ -119,15 +140,15 @@ public class LoggerError extends LoggerBase { } public void log(LogLevel logLevel, String message) { - log(logLevel, EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR, defaultServiceName, (String)null, message); + log(logLevel, EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR, defaultServiceName, (String) null, message); } public void logInfo(LogLevel logLevel, String message, Object... params) { - log(logLevel, EcompLoggerErrorCode.SUCCESS, defaultServiceName, (String)null, message, params); + log(logLevel, EcompLoggerErrorCode.SUCCESS, defaultServiceName, (String) null, message, params); } private LogLevel convertFromSeverityErrorLevel(EcompErrorSeverity severityLevel) { - switch(severityLevel) { + switch (severityLevel) { case INFO: return LogLevel.INFO; case FATAL: diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerMetric.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerMetric.java index 8af85ea1a3..c23861f1ff 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerMetric.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerMetric.java @@ -1,5 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2020, Nordix Foundation. 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ package org.openecomp.sdc.common.log.elements; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.INSTANCE_UUID; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.INVOKE_TIMESTAMP; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.PARTNER_NAME; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.REQUEST_ID; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_CODE; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_SEVERITY; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.SERVER_FQDN; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.SERVICE_NAME; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.TARGET_ENTITY; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.TARGET_SERVICE_NAME; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_CLASS_NAME; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_ELAPSED_TIME; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_END_TIMESTAMP; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_OPT_FIELD1; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_OPT_FIELD2; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_OPT_FIELD3; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_OPT_FIELD4; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_PROCESS_KEY; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_REMOTE_HOST; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_SERVER_IP_ADDRESS; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_SERVICE_INSTANCE_ID; +import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_TARGET_VIRTUAL_ENTITY; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import javax.ws.rs.core.Response; import org.openecomp.sdc.common.log.api.ILogFieldsHandler; import org.openecomp.sdc.common.log.enums.LogLevel; import org.openecomp.sdc.common.log.enums.LogMarkers; @@ -7,48 +56,41 @@ import org.openecomp.sdc.common.log.enums.Severity; import org.slf4j.Logger; import org.slf4j.MarkerFactory; -import javax.ws.rs.core.Response; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.*; -import static org.openecomp.sdc.common.log.api.ILogConfiguration.*; - public class LoggerMetric extends LoggerBase { + private static ArrayList<String> mandatoryFields = new ArrayList<>(Arrays.asList( - INVOKE_TIMESTAMP, - MDC_END_TIMESTAMP, - REQUEST_ID, - SERVICE_NAME, - PARTNER_NAME, - RESPONSE_CODE, - MDC_SERVICE_INSTANCE_ID, - RESPONSE_DESCRIPTION, - MDC_ELAPSED_TIME, - TARGET_ENTITY, - MDC_SERVER_IP_ADDRESS, - SERVER_FQDN)); + INVOKE_TIMESTAMP, + MDC_END_TIMESTAMP, + REQUEST_ID, + SERVICE_NAME, + PARTNER_NAME, + RESPONSE_CODE, + MDC_SERVICE_INSTANCE_ID, + RESPONSE_DESCRIPTION, + MDC_ELAPSED_TIME, + TARGET_ENTITY, + MDC_SERVER_IP_ADDRESS, + SERVER_FQDN)); private static ArrayList<String> optionalFields = new ArrayList<>(Arrays.asList( - MDC_TARGET_VIRTUAL_ENTITY, - TARGET_ENTITY, - TARGET_SERVICE_NAME, - RESPONSE_STATUS_CODE, - INSTANCE_UUID, - RESPONSE_SEVERITY, - MDC_REMOTE_HOST, - CLIENT_IP_ADDRESS, - MDC_CLASS_NAME, - MDC_PROCESS_KEY, - MDC_OPT_FIELD1, - MDC_OPT_FIELD2, - MDC_OPT_FIELD3, - MDC_OPT_FIELD4)); + MDC_TARGET_VIRTUAL_ENTITY, + TARGET_ENTITY, + TARGET_SERVICE_NAME, + RESPONSE_STATUS_CODE, + INSTANCE_UUID, + RESPONSE_SEVERITY, + MDC_REMOTE_HOST, + CLIENT_IP_ADDRESS, + MDC_CLASS_NAME, + MDC_PROCESS_KEY, + MDC_OPT_FIELD1, + MDC_OPT_FIELD2, + MDC_OPT_FIELD3, + MDC_OPT_FIELD4)); LoggerMetric(ILogFieldsHandler ecompMdcWrapper, Logger logger) { - super(ecompMdcWrapper, MarkerFactory.getMarker(LogMarkers.METRIC_MARKER.text()), logger); + super(ecompMdcWrapper, MarkerFactory.getMarker(LogMarkers.METRIC_MARKER.getText()), logger); //put the remote host and FQDN values from another thread if they are set ecompMdcWrapper.setServerIPAddressInternally(); ecompMdcWrapper.setServerFQDNInternally(); @@ -59,7 +101,7 @@ public class LoggerMetric extends LoggerBase { LogLevel logLevel, Severity securityLevel, String message) { - log(statusInfo,className, logLevel, securityLevel, message); + log(statusInfo, className, logLevel, securityLevel, message); } @Override @@ -168,6 +210,4 @@ public class LoggerMetric extends LoggerBase { } - - } diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerSupportability.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerSupportability.java index b3b91b96be..6b9ef75b61 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerSupportability.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/elements/LoggerSupportability.java @@ -1,5 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2020 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * Modifications copyright (c) 2020 Nordix Foundation + * ================================================================================ + */ package org.openecomp.sdc.common.log.elements; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; import org.openecomp.sdc.common.log.api.ILogConfiguration; import org.openecomp.sdc.common.log.api.ILogFieldsHandler; import org.openecomp.sdc.common.log.enums.LogLevel; @@ -9,73 +35,77 @@ import org.openecomp.sdc.common.log.enums.StatusCode; import org.slf4j.Logger; import org.slf4j.MarkerFactory; -import java.util.*; - public class LoggerSupportability extends LoggerBase { - public LoggerSupportability(ILogFieldsHandler ecompLogFieldsHandler, Logger logger) { - super(ecompLogFieldsHandler, MarkerFactory.getMarker(LogMarkers.SUPPORTABILITY_MARKER.text()), - logger); - } - - public static LoggerSupportability getLogger(String className) { - return LoggerFactory.getMdcLogger(LoggerSupportability.class, - org.slf4j.LoggerFactory.getLogger(className)); - } - + private static ArrayList<String> mandatoryFields = new ArrayList<>(Arrays.asList( + ILogConfiguration.MDC_SUPPORTABLITY_ACTION, + ILogConfiguration.MDC_SUPPORTABLITY_CSAR_UUID, + ILogConfiguration.MDC_SUPPORTABLITY_CSAR_VERSION, + ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_NAME, + ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_UUID, + ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_VERSION, + ILogConfiguration.MDC_SUPPORTABLITY_STATUS_CODE)); - public void log(LoggerSupportabilityActions action, Map<String,String> componentMetaData,StatusCode statusCode, String message, Object...params) { - fillFieldsBeforeLogging(action,componentMetaData,statusCode); - super.log(LogLevel.INFO,message, params); - } + public LoggerSupportability(ILogFieldsHandler ecompLogFieldsHandler, Logger logger) { + super(ecompLogFieldsHandler, MarkerFactory.getMarker(LogMarkers.SUPPORTABILITY_MARKER.getText()), + logger); + } - public void log(LoggerSupportabilityActions action, StatusCode statusCode, String message, Object...params) { - log(action, null, statusCode, message, params); - } + public static LoggerSupportability getLogger(String className) { + return LoggerFactory.getMdcLogger(LoggerSupportability.class, + org.slf4j.LoggerFactory.getLogger(className)); + } - private static ArrayList<String> mandatoryFields = new ArrayList<>(Arrays.asList( - ILogConfiguration.MDC_SUPPORTABLITY_ACTION, - ILogConfiguration.MDC_SUPPORTABLITY_CSAR_UUID, - ILogConfiguration.MDC_SUPPORTABLITY_CSAR_VERSION, - ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_NAME, - ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_UUID, - ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_VERSION, - ILogConfiguration.MDC_SUPPORTABLITY_STATUS_CODE)); + public void log(LoggerSupportabilityActions action, Map<String, String> componentMetaData, StatusCode statusCode, + String message, Object... params) { + fillFieldsBeforeLogging(action, componentMetaData, statusCode); + super.log(LogLevel.INFO, message, params); + } - private void fillFieldsBeforeLogging(LoggerSupportabilityActions action, Map<String,String> componentMetaData,StatusCode statusCode) { - clear(); - if (componentMetaData!=null){ - ecompLogFieldsHandler.setSupportablityCsarUUID(componentMetaData.get(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_UUID)); - ecompLogFieldsHandler.setSupportablityCsarVersion(componentMetaData.get(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_VERSION)); - ecompLogFieldsHandler.setSupportablityComponentName(componentMetaData.get(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_NAME)); - ecompLogFieldsHandler.setSupportablityComponentUUID(componentMetaData.get(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_UUID)); - ecompLogFieldsHandler.setSupportablityComponentVersion(componentMetaData.get(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_VERSION)); + public void log(LoggerSupportabilityActions action, StatusCode statusCode, String message, Object... params) { + log(action, null, statusCode, message, params); } - ecompLogFieldsHandler.setSupportablityAction(action.getName()); - ecompLogFieldsHandler.setSupportablityStatusCode(statusCode.getStatusCodeEnum()); + + private void fillFieldsBeforeLogging(LoggerSupportabilityActions action, Map<String, String> componentMetaData, + StatusCode statusCode) { + clear(); + if (componentMetaData != null) { + ecompLogFieldsHandler + .setSupportablityCsarUUID(componentMetaData.get(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_UUID)); + ecompLogFieldsHandler + .setSupportablityCsarVersion(componentMetaData.get(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_VERSION)); + ecompLogFieldsHandler.setSupportablityComponentName( + componentMetaData.get(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_NAME)); + ecompLogFieldsHandler.setSupportablityComponentUUID( + componentMetaData.get(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_UUID)); + ecompLogFieldsHandler.setSupportablityComponentVersion( + componentMetaData.get(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_VERSION)); + } + ecompLogFieldsHandler.setSupportablityAction(action.getName()); + ecompLogFieldsHandler.setSupportablityStatusCode(statusCode.getStatusCode()); } - @Override - public LoggerSupportability clear(){ - LogFieldsMdcHandler.getInstance().removeSupportablityAction(); - LogFieldsMdcHandler.getInstance().removeSupportablityCsarUUID(); - LogFieldsMdcHandler.getInstance().removeSupportablityCsarVersion(); - LogFieldsMdcHandler.getInstance().removeSupportablityComponentName(); - LogFieldsMdcHandler.getInstance().removeSupportablityComponentUUID(); - LogFieldsMdcHandler.getInstance().removeSupportablityComponentVersion(); - LogFieldsMdcHandler.getInstance().removeSupportablityStatusCode(); - return this; - } + @Override + public LoggerSupportability clear() { + LogFieldsMdcHandler.getInstance().removeSupportablityAction(); + LogFieldsMdcHandler.getInstance().removeSupportablityCsarUUID(); + LogFieldsMdcHandler.getInstance().removeSupportablityCsarVersion(); + LogFieldsMdcHandler.getInstance().removeSupportablityComponentName(); + LogFieldsMdcHandler.getInstance().removeSupportablityComponentUUID(); + LogFieldsMdcHandler.getInstance().removeSupportablityComponentVersion(); + LogFieldsMdcHandler.getInstance().removeSupportablityStatusCode(); + return this; + } - @Override - public List<String> getMandatoryFields() { - return Collections.unmodifiableList(mandatoryFields); - } + @Override + public List<String> getMandatoryFields() { + return Collections.unmodifiableList(mandatoryFields); + } - @Override - public LoggerSupportability startTimer() { - return this; - } + @Override + public LoggerSupportability startTimer() { + return this; + } } diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/EcompLoggerErrorCode.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/EcompLoggerErrorCode.java index 780b24d0e5..736194de18 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/EcompLoggerErrorCode.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/EcompLoggerErrorCode.java @@ -2,30 +2,36 @@ * ============LICENSE_START======================================================= * SDC * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2020 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. * 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. * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= + * Modifications copyright (c) 2020 Nordix Foundation + * ================================================================================ */ package org.openecomp.sdc.common.log.enums; import java.util.Arrays; import java.util.Optional; +import lombok.AllArgsConstructor; +import lombok.Getter; /** * Created by dd4296 on 12/26/2017. */ +@Getter +@AllArgsConstructor public enum EcompLoggerErrorCode { SUCCESS(0), PERMISSION_ERROR(100), @@ -35,19 +41,12 @@ public enum EcompLoggerErrorCode { BUSINESS_PROCESS_ERROR(500), UNKNOWN_ERROR(900); - private int errorCode; - - EcompLoggerErrorCode(int errorCode) { - this.errorCode = errorCode; - } - - public int getErrorCode() { - return errorCode; - } + private final int errorCode; public static EcompLoggerErrorCode getByValue(String ecompErrorCode) { String errorPrefix = parseCode(ecompErrorCode); - Optional<EcompLoggerErrorCode> optionalCode = Arrays.stream(values()).filter(v->isCode(v, errorPrefix)).findFirst(); + Optional<EcompLoggerErrorCode> optionalCode = Arrays.stream(values()).filter(v -> isCode(v, errorPrefix)) + .findFirst(); return optionalCode.orElse(UNKNOWN_ERROR); } @@ -63,5 +62,4 @@ public enum EcompLoggerErrorCode { } } - } diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LogMarkers.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LogMarkers.java index 4f98c556e8..fc7dca29fd 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LogMarkers.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LogMarkers.java @@ -1,23 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2020 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * Modifications copyright (c) 2020 Nordix Foundation + * ================================================================================ + */ package org.openecomp.sdc.common.log.enums; +import lombok.AllArgsConstructor; +import lombok.Getter; + /** - * Created by mm288v on 12/27/2017. - * This enum reflects the Marker text in logback.xml file per each ecomp marker + * Created by mm288v on 12/27/2017. This enum reflects the Marker text in logback.xml file per each ecomp marker */ +@Getter +@AllArgsConstructor public enum LogMarkers { DEBUG_MARKER("DEBUG_MARKER"), ERROR_MARKER("ERROR_MARKER"), METRIC_MARKER("METRICS"), SUPPORTABILITY_MARKER("SUPPORTABILITY_MARKER"); - private String text; - - LogMarkers (String text){ - this.text = text; - } - - public String text(){ - return text; - } + private final String text; } diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LoggerSupportabilityActions.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LoggerSupportabilityActions.java index 95594a3469..93fddf5d2e 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LoggerSupportabilityActions.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/LoggerSupportabilityActions.java @@ -1,65 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2020 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * Modifications copyright (c) 2020 Nordix Foundation + * ================================================================================ + */ package org.openecomp.sdc.common.log.enums; -public enum LoggerSupportabilityActions { - IMPORT_CSAR("CREATE RESOURCE FROM CSAR"), - CREATE_RESOURCE_FROM_YAML("CREATE RESOURCE FROM YAML"), - CREATE_RI_AND_RELATIONS("CREATE RI AND RELATIONS"), - CREATE_NODES_AND_CVFCS("ADD NODES AND CVFCS"), - CREATE_ARTIFACTS("ADD ARTIFACTS"), - CREATE_SERVICE("CREATE SERVICE"), - CREATE_RESOURCE("CREATE RESOURCE"), - CREATE_PROPERTIES("ADD PROPERTIES"), - CREATE_INPUTS("ADD INPUTS"), - CREATE_POLICIES("ADD POLICIES"), - CREATE_RELATIONS("ADD RELATIONS"), - CREATE_CAPABILITY_REQUIREMENTS("CREATE CAPABILITY REQUIREMENTS"), - MERGE("MERGE"), - PROPERTY_ASSIGNMENT("PROPERTY ASSIGNMENT"), - CREATE_INSTANCE("CREATE INSTANCE"), - CREATE_RELATION("ADD RELATION"), - CREATE_GROUP_POLICY("ADD GROUP POLICY"), - CREATE_GROUPS("ADD GROUPS"), - UPDATE_PROPERTY_IN_GROUP_POLICY("UPDATE PROPERTY IN GROUP POLICY"), - UPDATE_CAPABILITY("UPDATE CAPABILITY"), - PROPERTY("ADD PROPERTY"), - UPLOAD_DOWNLOAD_ARTIFACT("UPLOAD/DOWNLOAD ARTIFACT"), - LIFECYCLE("LIFECYCLE"), - DISTRIBUTION("DISTRIBUTION"), - UPDATE_CATALOG("UPDATE CATALOG"), - ARCHIVE("ARCHIVE"), - TENANT_ISOLATION("TENANT ISOLATION"), - DOWNLOAD_ARTIFACTS("DOWNLOAD ARTIFACTS"), - UPDATE_HEAT("UPDATE HEAT"), - PARAMETERS("PARAMETERS"), - CHANGELIFECYCLESTATE("CHANGE LIFECYCLE STATE"), - VALIDATE_NAME("VALIDATE COMPONENT NAME"), - DELETE_COMPONENT_INSTANCE_ARTIFACT("DELETE COMPONENT INSTANCE ARTIFACT"), - DELETE_SERVICE("DELETE SERVICE"), - DELETE_RESOURCE("DELETE RESOURCE"), - UPDATE_RESOURCE("UPDATE RESOURCE"), - UPDATE_COMPONENT_INSTANCE("UPDATE COMPONENT INSTANCE"), - DELETE_COMPONENT_INSTANCE("DELETE COMPONENT INSTANCE"), - UPDATE_PROPERTIES("UPDATE PROPERTIES"), - RESTORE_FROM_ARCHIVE("RESTORE FROM ARCHIVE"), - UPDATE_INPUTS("UPDATE INPUTS"), - DELETE_INPUTS("DELETE INPUTS"), - ASSOCIATE_RI_TO_RI("ASSOCIATE RI TO RI"), - UN_ASSOCIATE_RI_TO_RI("UN ASSOCIATE RI TO RI"), - UPDATE_ARTIFACT("UPDATE ARTIFACT"), - GENERATE_CSAR("GENERATE CSAR"), - GENERATE_TOSCA("GENERATE TOSCA"), - UPDATE_GROUP_MEMBERS("UPDATE GROUP MEMBERS"), - UPDATE_INSTANCE_CAPABILITY_PROPERTY("UPDATE INSTANCE CAPABILITY PROPERTY"), - UPDATE_POLICY_TARGET("UPDATE POLICY TARGET"), - UPDATE_POLICIES_PROPERTIES("UPDATE POLICIES PROPERTIES"); - private String name; +import lombok.AllArgsConstructor; +import lombok.Getter; - LoggerSupportabilityActions(String name) { - this.name = name; - } +@Getter +@AllArgsConstructor +public enum LoggerSupportabilityActions { + IMPORT_CSAR("CREATE RESOURCE FROM CSAR"), + CREATE_RESOURCE_FROM_YAML("CREATE RESOURCE FROM YAML"), + CREATE_RI_AND_RELATIONS("CREATE RI AND RELATIONS"), + CREATE_NODES_AND_CVFCS("ADD NODES AND CVFCS"), + CREATE_ARTIFACTS("ADD ARTIFACTS"), + CREATE_SERVICE("CREATE SERVICE"), + CREATE_RESOURCE("CREATE RESOURCE"), + CREATE_PROPERTIES("ADD PROPERTIES"), + CREATE_INPUTS("ADD INPUTS"), + CREATE_POLICIES("ADD POLICIES"), + CREATE_RELATIONS("ADD RELATIONS"), + CREATE_CAPABILITY_REQUIREMENTS("CREATE CAPABILITY REQUIREMENTS"), + MERGE("MERGE"), + PROPERTY_ASSIGNMENT("PROPERTY ASSIGNMENT"), + CREATE_INSTANCE("CREATE INSTANCE"), + CREATE_RELATION("ADD RELATION"), + CREATE_GROUP_POLICY("ADD GROUP POLICY"), + CREATE_GROUPS("ADD GROUPS"), + UPDATE_PROPERTY_IN_GROUP_POLICY("UPDATE PROPERTY IN GROUP POLICY"), + UPDATE_CAPABILITY("UPDATE CAPABILITY"), + PROPERTY("ADD PROPERTY"), + UPLOAD_DOWNLOAD_ARTIFACT("UPLOAD/DOWNLOAD ARTIFACT"), + LIFECYCLE("LIFECYCLE"), + DISTRIBUTION("DISTRIBUTION"), + UPDATE_CATALOG("UPDATE CATALOG"), + ARCHIVE("ARCHIVE"), + TENANT_ISOLATION("TENANT ISOLATION"), + DOWNLOAD_ARTIFACTS("DOWNLOAD ARTIFACTS"), + UPDATE_HEAT("UPDATE HEAT"), + PARAMETERS("PARAMETERS"), + CHANGELIFECYCLESTATE("CHANGE LIFECYCLE STATE"), + VALIDATE_NAME("VALIDATE COMPONENT NAME"), + DELETE_COMPONENT_INSTANCE_ARTIFACT("DELETE COMPONENT INSTANCE ARTIFACT"), + DELETE_SERVICE("DELETE SERVICE"), + DELETE_RESOURCE("DELETE RESOURCE"), + UPDATE_RESOURCE("UPDATE RESOURCE"), + UPDATE_COMPONENT_INSTANCE("UPDATE COMPONENT INSTANCE"), + DELETE_COMPONENT_INSTANCE("DELETE COMPONENT INSTANCE"), + UPDATE_PROPERTIES("UPDATE PROPERTIES"), + RESTORE_FROM_ARCHIVE("RESTORE FROM ARCHIVE"), + UPDATE_INPUTS("UPDATE INPUTS"), + DELETE_INPUTS("DELETE INPUTS"), + ASSOCIATE_RI_TO_RI("ASSOCIATE RI TO RI"), + UN_ASSOCIATE_RI_TO_RI("UN ASSOCIATE RI TO RI"), + UPDATE_ARTIFACT("UPDATE ARTIFACT"), + GENERATE_CSAR("GENERATE CSAR"), + GENERATE_TOSCA("GENERATE TOSCA"), + UPDATE_GROUP_MEMBERS("UPDATE GROUP MEMBERS"), + UPDATE_INSTANCE_CAPABILITY_PROPERTY("UPDATE INSTANCE CAPABILITY PROPERTY"), + UPDATE_POLICY_TARGET("UPDATE POLICY TARGET"), + UPDATE_POLICIES_PROPERTIES("UPDATE POLICIES PROPERTIES"); - public String getName() { - return name; - } + private final String name; } diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/Severity.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/Severity.java index 15a6039f7f..78fe9761cf 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/Severity.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/Severity.java @@ -2,27 +2,34 @@ * ============LICENSE_START======================================================= * SDC * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2020 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. * 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. * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= + * Modifications copyright (c) 2020 Nordix Foundation + * ================================================================================ */ package org.openecomp.sdc.common.log.enums; +import lombok.AllArgsConstructor; +import lombok.Getter; + /** * Created by dd4296 on 12/14/2017. */ +@Getter +@AllArgsConstructor public enum Severity { OK(0), WARNING(1), @@ -30,14 +37,6 @@ public enum Severity { DOWN(3), UNREACHABLE(4); - int severityType; + private final int severityType; - Severity(int serveryType) { - this.severityType = serveryType; - } - - public int getSeverityType() { - return severityType; - } } - diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/StatusCode.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/StatusCode.java index 8ede6f9d6e..ba9497eb5d 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/StatusCode.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/enums/StatusCode.java @@ -1,18 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2020 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * Modifications copyright (c) 2020 Nordix Foundation + * ================================================================================ + */ package org.openecomp.sdc.common.log.enums; -public enum StatusCode { - ERROR("ERROR"), - STARTED("STARTED"), - COMPLETE("COMPLETE"), - INPROGRESS("INPROGRESS"); +import lombok.AllArgsConstructor; +import lombok.Getter; - String statusCode; +@Getter +@AllArgsConstructor +public enum StatusCode { + ERROR("ERROR"), + STARTED("STARTED"), + COMPLETE("COMPLETE"), + INPROGRESS("INPROGRESS"); - StatusCode(String statusCode) { - this.statusCode = statusCode; - } + private final String statusCode; - public String getStatusCodeEnum() { - return statusCode; - } } diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/utils/EcompLogErrorCode.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/utils/EcompLogErrorCode.java index ce33480ca2..1eaecca83b 100644 --- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/utils/EcompLogErrorCode.java +++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/utils/EcompLogErrorCode.java @@ -1,38 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2020 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. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * Modifications copyright (c) 2020 Nordix Foundation + * ================================================================================ + */ package org.openecomp.sdc.common.log.utils; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor public enum EcompLogErrorCode { E_399("Internal Invalid Object. Description: %s"), - E_210( - "Connection problem towards U-EB server. Reason: %s"); - - - String description; - String resolution; - - EcompLogErrorCode(String description, String resolution) { - this.description = description; - this.resolution = resolution; - } - - EcompLogErrorCode(String description) { - this.description = description; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getResolution() { - return resolution; - } + E_210("Connection problem towards U-EB server. Reason: %s"); - public void setResolution(String resolution) { - this.resolution = resolution; - } + private final String description; - } +} |