diff options
Diffstat (limited to 'openecomp-be/lib')
44 files changed, 215 insertions, 345 deletions
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatConstants.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatConstants.java index 31c0b6e437..1e917ea4cd 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatConstants.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatConstants.java @@ -16,6 +16,7 @@ package org.openecomp.sdc.heat.services; + public class HeatConstants { public static final String GET_ATTR_FROM_RESOURCE_GROUP_PREFIX = "resource."; public static final String RESOURCE_GROUP_INDEX_VAR_DEFAULT_VALUE = "%index%"; diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/ActionConstants.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/ActionConstants.java index 25cd06d3ce..1823b752c8 100644 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/ActionConstants.java +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/ActionConstants.java @@ -21,6 +21,8 @@ package org.openecomp.sdc.action; +import org.onap.logging.ref.slf4j.ONAPLogConstants; + public class ActionConstants { // @@ -73,21 +75,21 @@ public class ActionConstants { public static final String ARTIFACT_METADATA_ATTR_UUID = "ARTIFACT_UUID"; public static final String ARTIFACT_METADATA_ATTR_NAME = "ARTIFACT_NAME"; - public static final String REQUEST_ID = "uuid"; + public static final String REQUEST_ID = ONAPLogConstants.MDCs.REQUEST_ID; public static final String SERVICE_INSTANCE_ID = "serviceInstanceID"; - public static final String PARTNER_NAME = "userId"; - public static final String SERVICE_NAME = "ServiceName"; - public static final String INSTANCE_UUID = "InstanceUUID"; + public static final String PARTNER_NAME = ONAPLogConstants.MDCs.PARTNER_NAME; + public static final String SERVICE_NAME = ONAPLogConstants.MDCs.SERVICE_NAME; + public static final String INSTANCE_UUID = ONAPLogConstants.MDCs.INSTANCE_UUID; public static final String REMOTE_HOST = "RemoteHost"; - public static final String CLIENT_IP = "ClientIP"; + public static final String CLIENT_IP = ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS; public static final String CATEGORY_LOG_LEVEL = "level"; - public static final String STATUS_CODE = "StatusCode"; - public static final String RESPONSE_CODE = "ResponseCode"; - public static final String RESPONSE_DESCRIPTION = "ResponseDescription"; + public static final String STATUS_CODE = ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE; + public static final String RESPONSE_CODE = ONAPLogConstants.MDCs.RESPONSE_CODE; + public static final String RESPONSE_DESCRIPTION = ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION; public static final String ELAPSED_TIME = "ElapsedTime"; - public static final String BEGIN_TIMESTAMP = "BeginTimestamp"; - public static final String TARGET_SERVICE_NAME = "TargetServiceName"; - public static final String TARGET_ENTITY = "TargetEntity"; + public static final String BEGIN_TIMESTAMP = ONAPLogConstants.MDCs.ENTRY_TIMESTAMP; + public static final String TARGET_SERVICE_NAME = ONAPLogConstants.MDCs.TARGET_SERVICE_NAME; + public static final String TARGET_ENTITY = ONAPLogConstants.MDCs.TARGET_ENTITY; public static final String TARGET_ENTITY_API = "API"; public static final String TARGET_ENTITY_DB = "DB"; public static final String END_TIMESTAMP = "EndTimestamp"; diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/logging/StatusCode.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/logging/StatusCode.java deleted file mode 100644 index b0d5bab12b..0000000000 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/logging/StatusCode.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 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========================================================= - */ - -package org.openecomp.sdc.action.logging; - -public enum StatusCode { - COMPLETE, - ERROR -} diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/util/ActionUtil.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/util/ActionUtil.java index 5d91a599a9..2fba053b2d 100644 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/util/ActionUtil.java +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/util/ActionUtil.java @@ -20,8 +20,8 @@ package org.openecomp.sdc.action.util; +import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus; import org.openecomp.sdc.action.logging.CategoryLogLevel; -import org.openecomp.sdc.action.logging.StatusCode; import org.openecomp.sdc.action.types.ActionLogResponseCode; import org.openecomp.sdc.action.types.ActionSubOperation; import org.slf4j.MDC; @@ -93,15 +93,15 @@ public class ActionUtil { * * @param statusCode Response code for the current operation */ - public static void actionLogPostProcessor(StatusCode statusCode) { + public static void actionLogPostProcessor(ResponseStatus statusCode) { actionLogPostProcessor(statusCode, false); } - public static void actionLogPostProcessor(StatusCode statusCode, boolean isServiceMetricLog) { + public static void actionLogPostProcessor(ResponseStatus statusCode, boolean isServiceMetricLog) { actionLogPostProcessor(statusCode, null, isServiceMetricLog); } - public static void actionLogPostProcessor(StatusCode statusCode, String responseCode, + public static void actionLogPostProcessor(ResponseStatus statusCode, String responseCode, boolean isServiceMetricLog) { actionLogPostProcessor(statusCode, responseCode, null, isServiceMetricLog); } @@ -114,7 +114,7 @@ public class ActionUtil { * @param responseDescription the response description * @param isServiceMetricLog the is service metric log */ - public static void actionLogPostProcessor(StatusCode statusCode, String responseCode, + public static void actionLogPostProcessor(ResponseStatus statusCode, String responseCode, String responseDescription, boolean isServiceMetricLog) { MDC.put(STATUS_CODE, statusCode.name()); diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoImpl.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoImpl.java index efac856788..f9e0b00ff8 100644 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoImpl.java @@ -32,7 +32,6 @@ import org.openecomp.sdc.action.dao.ActionArtifactDao; import org.openecomp.sdc.action.dao.types.ActionArtifactEntity; import org.openecomp.sdc.action.errors.ActionException; import org.openecomp.sdc.action.logging.CategoryLogLevel; -import org.openecomp.sdc.action.logging.StatusCode; import org.openecomp.sdc.action.types.ActionArtifact; import org.openecomp.sdc.action.types.ActionSubOperation; import org.openecomp.sdc.action.util.ActionUtil; @@ -42,6 +41,8 @@ import org.openecomp.sdc.logging.api.LoggerFactory; import java.util.Collection; import java.util.List; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.ERROR; import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY_DB; import static org.openecomp.sdc.action.errors.ActionErrorConstants.*; @@ -77,7 +78,7 @@ public class ActionArtifactDaoImpl extends CassandraBaseDao<ActionArtifactEntity try { ActionUtil.actionLogPreProcessor(ActionSubOperation.CREATE_ACTION_ARTIFACT, TARGET_ENTITY_DB); this.create(data.toEntity()); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); + ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false); log.metrics(""); } catch (NoHostAvailableException noHostAvailableException) { logGenericException(noHostAvailableException); @@ -96,7 +97,7 @@ public class ActionArtifactDaoImpl extends CassandraBaseDao<ActionArtifactEntity .actionLogPreProcessor(ActionSubOperation.GET_ARTIFACT_BY_ARTIFACTUUID, TARGET_ENTITY_DB); Result<ActionArtifactEntity> result = null; result = accessor.getArtifactByUuId(effectiveVersion, artifactUuId); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); + ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false); log.metrics(""); List<ActionArtifactEntity> artifactEntities = result.all(); if (artifactEntities != null && !artifactEntities.isEmpty()) { @@ -118,7 +119,7 @@ public class ActionArtifactDaoImpl extends CassandraBaseDao<ActionArtifactEntity try { ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION_ARTIFACT, TARGET_ENTITY_DB); this.update(data.toEntity()); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); + ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false); log.metrics(""); } catch (NoHostAvailableException noHostAvailableException) { logGenericException(noHostAvailableException); @@ -129,7 +130,7 @@ public class ActionArtifactDaoImpl extends CassandraBaseDao<ActionArtifactEntity } private void logGenericException(Exception exception) { - ActionUtil.actionLogPostProcessor(StatusCode.ERROR, ACTION_QUERY_FAILURE_CODE, + ActionUtil.actionLogPostProcessor(ERROR, ACTION_QUERY_FAILURE_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG, false); log.metrics(""); ActionUtil.actionErrorLogProcessor(CategoryLogLevel.FATAL, ACTION_QUERY_FAILURE_CODE, diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java index 4562606339..f22fa08ee3 100644 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java @@ -19,6 +19,8 @@ package org.openecomp.sdc.action.dao.impl; import static com.datastax.driver.core.querybuilder.QueryBuilder.eq; import static com.datastax.driver.core.querybuilder.QueryBuilder.in; import static com.datastax.driver.core.querybuilder.QueryBuilder.set; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.ERROR; import static org.openecomp.core.nosqldb.impl.cassandra.CassandraSessionFactory.getSession; import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_CATEGORY; import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_MODEL; @@ -69,7 +71,6 @@ import org.openecomp.sdc.action.dao.types.ActionEntity; import org.openecomp.sdc.action.dao.types.OpenEcompComponentEntity; import org.openecomp.sdc.action.errors.ActionException; import org.openecomp.sdc.action.logging.CategoryLogLevel; -import org.openecomp.sdc.action.logging.StatusCode; import org.openecomp.sdc.action.types.Action; import org.openecomp.sdc.action.types.ActionStatus; import org.openecomp.sdc.action.types.ActionSubOperation; @@ -127,7 +128,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act try { ActionUtil.actionLogPreProcessor(ActionSubOperation.CREATE_ACTION_ENTITY, TARGET_ENTITY_DB); this.create(action.toEntity()); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); + ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false); log.metrics(""); return action; } catch (NoHostAvailableException exception) { @@ -142,7 +143,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act log.debug(" entering updateAction with actionUUID= " + action.getActionUuId()); ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION, TARGET_ENTITY_DB); this.update(action.toEntity()); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); + ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false); log.metrics(""); log.debug(" exit updateAction with actionUUID= " + action.getActionUuId()); return action; @@ -159,7 +160,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB); VersionInfoDeletedEntity activeVersionEntity = versionInfoDeletedDao .get(new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId)); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); + ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false); log.metrics(""); Version activeVersion = activeVersionEntity.getActiveVersion(); @@ -170,7 +171,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act .and(in(VERSION, activeVersion)); ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_NAME_BY_ACTIONINVID, TARGET_ENTITY_DB); ResultSet results = getSession().execute(getNameFromInvUuId); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); + ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false); log.metrics(""); if (!results.isExhausted()) { @@ -196,37 +197,37 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act case FILTER_TYPE_VENDOR: ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_VENDOR, TARGET_ENTITY_DB); result = accessor.getActionsByVendor(filterId); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE); + ActionUtil.actionLogPostProcessor(COMPLETE); log.metrics(""); break; case FILTER_TYPE_CATEGORY: ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_CATEGORY, TARGET_ENTITY_DB); result = accessor.getActionsByCategory(filterId); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE); + ActionUtil.actionLogPostProcessor(COMPLETE); log.metrics(""); break; case FILTER_TYPE_MODEL: ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_MODEL, TARGET_ENTITY_DB); result = accessor.getActionsByModel(filterId); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE); + ActionUtil.actionLogPostProcessor(COMPLETE); log.metrics(""); break; case FILTER_TYPE_OPEN_ECOMP_COMPONENT: ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_COMPONENT, TARGET_ENTITY_DB); result = accessor.getActionsByOpenEcompComponent(filterId); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE); + ActionUtil.actionLogPostProcessor(COMPLETE); log.metrics(""); break; case FILTER_TYPE_NONE: ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ALL_ACTIONS, TARGET_ENTITY_DB); result = accessor.getAllActions(); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE); + ActionUtil.actionLogPostProcessor(COMPLETE); log.metrics(""); break; case FILTER_TYPE_NAME: ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONINVID_BY_NAME, TARGET_ENTITY_DB); result = accessor.getInvIdByName(filterId); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE); + ActionUtil.actionLogPostProcessor(COMPLETE); log.metrics(""); List<ActionEntity> actionEntities = result.all(); if (actionEntities != null && !actionEntities.isEmpty()) { @@ -262,7 +263,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act log.debug(" entering getActionsByActionUuId with actionUUID= " + actionUuId); ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONUUID, TARGET_ENTITY_DB); Result<ActionEntity> result = accessor.actionInvariantUuId(actionUuId); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); + ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false); log.metrics(""); if (result != null) { log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId); @@ -287,7 +288,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act log.debug(" entering getOpenEcompComponents "); ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_OPEN_ECOMP_COMPONENTS_ENTITY, TARGET_ENTITY_DB); result = accessor.getOpenEcompComponents(); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); + ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false); log.metrics(""); if (result != null) { openEcompComponents.addAll(result.all() @@ -342,7 +343,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act } MDC.put(TARGET_ENTITY, TARGET_ENTITY_DB); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); + ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false); log.metrics(""); log.debug("Found " + viewableVersions + " viewable version for action with actionInvariantUuId " @@ -353,7 +354,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID, TARGET_ENTITY_DB); Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId, new ArrayList<>(viewableVersions)); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); + ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false); log.metrics(""); if (result != null) { actions.addAll(result.all() @@ -377,7 +378,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act Action action = null; VersionInfoEntity versionInfoEntity = versionInfoDao .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId)); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); + ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false); log.metrics(""); if (versionInfoEntity != null) { if (versionInfoEntity.getCandidate() != null) { @@ -391,7 +392,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act TARGET_ENTITY_DB); Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId, new ArrayList<>(versions)); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); + ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false); log.metrics(""); if (result != null) { ActionEntity actionEntity = result.one(); @@ -411,7 +412,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act } private void logGenericException(Exception exception) { - ActionUtil.actionLogPostProcessor(StatusCode.ERROR, ACTION_QUERY_FAILURE_CODE, + ActionUtil.actionLogPostProcessor(ERROR, ACTION_QUERY_FAILURE_CODE, ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG, false); log.metrics(""); ActionUtil.actionErrorLogProcessor(CategoryLogLevel.FATAL, ACTION_QUERY_FAILURE_CODE, ACTION_QUERY_FAILURE_MSG); @@ -444,7 +445,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act .where(eq("actioninvariantuuid", actionInvariantUuId)) .and(in(VERSION, versions)); getSession().execute(updateStatusStatement); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); + ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false); log.metrics(""); // Update the status in the data field of action table updateStatusInActionData(actionInvariantUuId, versions, ActionStatus.Deleted); @@ -494,7 +495,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act .from("dox", ACTION) .where(eq("name", name)); ResultSet results = getSession().execute(statement); - ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false); + ActionUtil.actionLogPostProcessor(COMPLETE, null, "", false); log.metrics(""); List<Version> versionList = new ArrayList<>(); diff --git a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/test/data/priorexecution.json b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/test/data/priorexecution.json index f8e1db85df..ca2fb415e2 100644 --- a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/test/data/priorexecution.json +++ b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/test/data/priorexecution.json @@ -14,7 +14,7 @@ "results": { "hello": "world" }, - "status": "COMPLETED", + "status": "COMPLETE", "startTime": 1550780567585, "endTime": 1550780567585 } diff --git a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/test/java/org/openecomp/core/externaltesting/api/ExecutionRequestTest.java b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/test/java/org/openecomp/core/externaltesting/api/ExecutionRequestTest.java index 541f636841..5c3e9695db 100644 --- a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/test/java/org/openecomp/core/externaltesting/api/ExecutionRequestTest.java +++ b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/src/test/java/org/openecomp/core/externaltesting/api/ExecutionRequestTest.java @@ -86,7 +86,7 @@ public class ExecutionRequestTest { Assert.assertTrue(UUID.fromString(rsp.getExecutionId()).getLeastSignificantBits() != 0); Assert.assertEquals("parameters", 6, rsp.getParameters().size()); Assert.assertNotNull(rsp.getResults()); - Assert.assertEquals("COMPLETED", rsp.getStatus()); + Assert.assertEquals("COMPLETE", rsp.getStatus()); Assert.assertNotNull(rsp.getStartTime()); Assert.assertNotNull(rsp.getEndTime()); diff --git a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-impl/src/test/data/priorexecution.json b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-impl/src/test/data/priorexecution.json index ca01d3676a..4b7bc6cf90 100644 --- a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-impl/src/test/data/priorexecution.json +++ b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-impl/src/test/data/priorexecution.json @@ -15,7 +15,7 @@ "results": { "this is": "a fake result" }, - "status": "COMPLETED", + "status": "COMPLETE", "startTime": "2019-03-08T21:43:10.527", "endTime": "2019-03-08T21:43:10.617" } diff --git a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-impl/src/test/java/org/openecomp/core/externaltesting/impl/ExternalTestingManagerImplTest.java b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-impl/src/test/java/org/openecomp/core/externaltesting/impl/ExternalTestingManagerImplTest.java index c429709182..4f9631250d 100644 --- a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-impl/src/test/java/org/openecomp/core/externaltesting/impl/ExternalTestingManagerImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-impl/src/test/java/org/openecomp/core/externaltesting/impl/ExternalTestingManagerImplTest.java @@ -320,7 +320,7 @@ public class ExternalTestingManagerImplTest { // send a request for a prior execution. VtpTestExecutionResponse execRsp = m.getExecution("repository", "execId"); - Assert.assertEquals("COMPLETED", execRsp.getStatus()); + Assert.assertEquals("COMPLETE", execRsp.getStatus()); } @Test diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/pom.xml b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/pom.xml index b14ece7012..bd680aff7f 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/pom.xml @@ -44,6 +44,11 @@ <version>${powermock.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <scope>compile</scope> + </dependency> </dependencies> </project> diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/AuditData.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/AuditData.java index b7c4e0d78f..090f680aa7 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/AuditData.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/AuditData.java @@ -16,6 +16,9 @@ package org.openecomp.sdc.logging.api; +import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus; +import lombok.Getter; + /** * Builder to populate <i>audit</i> data. This includes only data known to an application, and not otherwise available * to the logging framework. As opposed, for example, to local runtime, host address, etc. @@ -23,13 +26,14 @@ package org.openecomp.sdc.logging.api; * @author KATYR, evitaliy * @since February 15, 2018 */ +@Getter public class AuditData { // don't inherit from MetricsData because it has a very different meaning private final long startTime; private final long endTime; - private final StatusCode statusCode; + private final ResponseStatus statusCode; private final String responseCode; private final String responseDescription; private final String clientIpAddress; @@ -43,60 +47,6 @@ public class AuditData { this.clientIpAddress = builder.clientIpAddress; } - /** - * Begin timestamp of an API invocation. - * - * @return timestamp - */ - public long getStartTime() { - return startTime; - } - - /** - * End timestamp of an API invocation. - * - * @return timestamp - */ - public long getEndTime() { - return endTime; - } - - /** - * Result status of an API invocation. - * - * @return protocol and application agnostic status code - */ - public StatusCode getStatusCode() { - return statusCode; - } - - /** - * Application/protocol specific response status of an API invocation. - * - * @return response code - */ - public String getResponseCode() { - return responseCode; - } - - /** - * Application/protocol specific response in a human-friendly way. - * - * @return human-friendly response description - */ - public String getResponseDescription() { - return responseDescription; - } - - /** - * IP address of the invoking client when available. - * - * @return IP address - */ - public String getClientIpAddress() { - return clientIpAddress; - } - @Override public String toString() { return "AuditData{startTime=" + startTime + ", endTime=" + endTime + ", statusCode=" + statusCode @@ -115,7 +65,7 @@ public class AuditData { private long startTime; private long endTime; - private StatusCode statusCode; + private ResponseStatus statusCode; private String responseCode; private String responseDescription; private String clientIpAddress; @@ -151,7 +101,7 @@ public class AuditData { * @param statusCode invocation status success/failure * @return this builder for fluent API */ - public AuditDataBuilder statusCode(final StatusCode statusCode) { + public AuditDataBuilder statusCode(final ResponseStatus statusCode) { this.statusCode = statusCode; return this; } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/Logger.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/Logger.java index ed028e34d5..6fbd25a134 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/Logger.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/Logger.java @@ -43,7 +43,9 @@ public interface Logger { boolean isAuditEnabled(); - void audit(AuditData data); + void auditEntry(AuditData data); + + void auditExit(AuditData data); boolean isDebugEnabled(); diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggerFactory.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggerFactory.java index 96debb56b0..6ef57761d8 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggerFactory.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/LoggerFactory.java @@ -83,7 +83,12 @@ public class LoggerFactory { } @Override - public void audit(AuditData data) { + public void auditEntry(AuditData data) { + // no-op + } + + @Override + public void auditExit(AuditData data) { // no-op } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/MetricsData.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/MetricsData.java index c44ab42efa..2fef96d2bb 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/MetricsData.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/MetricsData.java @@ -16,6 +16,9 @@ package org.openecomp.sdc.logging.api; +import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus; +import lombok.Getter; + /** * Builder to populate <i>metrics</i> data. This includes only data known to an application, and not otherwise available * to the logging framework. @@ -23,13 +26,14 @@ package org.openecomp.sdc.logging.api; * @author evitaliy * @since 26 Mar 2018 */ +@Getter public class MetricsData { // don't inherit from AuditData because it has a very different meaning private final long startTime; private final long endTime; - private final StatusCode statusCode; + private final ResponseStatus statusCode; private final String responseCode; private final String responseDescription; private final String clientIpAddress; @@ -47,78 +51,6 @@ public class MetricsData { this.targetVirtualEntity = builder.targetVirtualEntity; } - /** - * Begin timestamp of an API invocation. - * - * @return timestamp - */ - public long getStartTime() { - return startTime; - } - - /** - * End timestamp of an API invocation. - * - * @return timestamp - */ - public long getEndTime() { - return endTime; - } - - /** - * Result status of an API invocation. - * - * @return protocol and application agnostic status code - */ - public StatusCode getStatusCode() { - return statusCode; - } - - /** - * Application/protocol specific response status of an API invocation. - * - * @return response code - */ - public String getResponseCode() { - return responseCode; - } - - /** - * Application/protocol specific response in a human-friendly way. - * - * @return human-friendly response description - */ - public String getResponseDescription() { - return responseDescription; - } - - /** - * IP address of the invoking client when available. - * - * @return IP address - */ - public String getClientIpAddress() { - return clientIpAddress; - } - - /** - * External entity invoked by the local system. - * - * @return identifier of an external entity (system, component, sub-component) - */ - public String getTargetEntity() { - return targetEntity; - } - - /** - * External API invoked by the local system. - * - * @return name of an external API - */ - public String getTargetVirtualEntity() { - return targetVirtualEntity; - } - @Override public String toString() { return "AuditData{startTime=" + startTime + ", endTime=" + endTime + ", statusCode=" + statusCode @@ -137,7 +69,7 @@ public class MetricsData { private long startTime; private long endTime; - private StatusCode statusCode; + private ResponseStatus statusCode; private String responseCode; private String responseDescription; private String clientIpAddress; @@ -175,7 +107,7 @@ public class MetricsData { * @param statusCode invocation status success/failure * @return this builder for fluent API */ - public MetricsDataBuilder statusCode(final StatusCode statusCode) { + public MetricsDataBuilder statusCode(final ResponseStatus statusCode) { this.statusCode = statusCode; return this; } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/StatusCode.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/StatusCode.java deleted file mode 100644 index dd8bd57dcc..0000000000 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/api/StatusCode.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * 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. - */ - -package org.openecomp.sdc.logging.api; - -/** - * Protocol-agnostic status codes to indicate the result status (success, failure) of an API invocation. - * - * @author EVITALIY - * @since 04 Mar 18 - */ -public enum StatusCode { - COMPLETE, ERROR -} diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/AuditTracker.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/AuditTracker.java index af9b5061fd..2aeacf1ad5 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/AuditTracker.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/AuditTracker.java @@ -22,6 +22,8 @@ import org.openecomp.sdc.logging.api.AuditData; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE; + /** * Tracks and logs audit information when a request is being processed. An instance of this class cannot be reused, and * the pre- and post-request methods must be called only once. @@ -62,6 +64,10 @@ public class AuditTracker implements Tracker { this.started = System.currentTimeMillis(); this.clientIpAddress = request.getRemoteAddr(); + AuditData auditData = AuditData.builder().startTime(started).endTime(started).statusCode(COMPLETE) + .clientIpAddress(clientIpAddress) + .build(); + logger.auditEntry(auditData); } @Override @@ -80,6 +86,6 @@ public class AuditTracker implements Tracker { .responseCode(Integer.toString(result.getStatus())) .responseDescription(result.getStatusPhrase()).clientIpAddress(clientIpAddress) .build(); - logger.audit(auditData); + logger.auditExit(auditData); } } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/ContextTracker.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/ContextTracker.java index 2334f373bc..2aa5a83818 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/ContextTracker.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/ContextTracker.java @@ -54,8 +54,9 @@ public class ContextTracker implements Tracker { String requestId = requestIdHeaders.getAny(request::getHeader).orElse(UUID.randomUUID().toString()); ContextData.ContextDataBuilder contextBuilder = ContextData.builder().serviceName(serviceName).requestId(requestId); + String partnerName = partnerNameHeaders.getAny(request::getHeader).orElse("UNKNOWN"); + contextBuilder.partnerName(partnerName); - partnerNameHeaders.getAny(request::getHeader).ifPresent(contextBuilder::partnerName); LoggingContext.put(contextBuilder.build()); } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/RequestProcessingResult.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/RequestProcessingResult.java index d3625ed303..ff77ef8a93 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/RequestProcessingResult.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/RequestProcessingResult.java @@ -16,7 +16,7 @@ package org.openecomp.sdc.logging.servlet; -import org.openecomp.sdc.logging.api.StatusCode; +import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus; /** * Interpretation of request processing results. @@ -38,7 +38,7 @@ public interface RequestProcessingResult { * * @return on of pre-defined status codes */ - StatusCode getStatusCode(); + ResponseStatus getStatusCode(); /** * Human-friendly description of the numeric status. diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/jaxrs/LoggingResponseFilter.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/jaxrs/LoggingResponseFilter.java index fa9e815db8..b0ae88ccaa 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/jaxrs/LoggingResponseFilter.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/servlet/jaxrs/LoggingResponseFilter.java @@ -18,8 +18,7 @@ package org.openecomp.sdc.logging.servlet.jaxrs; import static javax.ws.rs.core.Response.Status.Family.REDIRECTION; import static javax.ws.rs.core.Response.Status.Family.SUCCESSFUL; -import static org.openecomp.sdc.logging.api.StatusCode.COMPLETE; -import static org.openecomp.sdc.logging.api.StatusCode.ERROR; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.*; import static org.openecomp.sdc.logging.servlet.jaxrs.LoggingRequestFilter.LOGGING_TRACKER_KEY; import javax.ws.rs.container.ContainerRequestContext; @@ -27,9 +26,10 @@ import javax.ws.rs.container.ContainerResponseContext; import javax.ws.rs.container.ContainerResponseFilter; import javax.ws.rs.core.Response; import javax.ws.rs.ext.Provider; + +import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.api.StatusCode; import org.openecomp.sdc.logging.servlet.RequestProcessingResult; import org.openecomp.sdc.logging.servlet.Tracker; @@ -82,7 +82,7 @@ public class LoggingResponseFilter implements ContainerResponseFilter { } @Override - public StatusCode getStatusCode() { + public ResponseStatus getStatusCode() { Response.Status.Family family = statusInfo.getFamily(); return family.equals(SUCCESSFUL) || family.equals(REDIRECTION) ? COMPLETE : ERROR; } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/AuditDataTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/AuditDataTest.java index 98da27dcc5..b4e2d96348 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/AuditDataTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/AuditDataTest.java @@ -18,6 +18,7 @@ package org.openecomp.sdc.logging.api; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE; import org.junit.Test; @@ -38,7 +39,7 @@ public class AuditDataTest { final String responseDescription = "Response-Description"; final String ipAddress = "DUMMY.IP.ADDRESS"; - AuditData data = AuditData.builder().startTime(start).endTime(end).statusCode(StatusCode.COMPLETE) + AuditData data = AuditData.builder().startTime(start).endTime(end).statusCode(COMPLETE) .responseCode(responseCode).responseDescription(responseDescription) .clientIpAddress(ipAddress).build(); @@ -47,7 +48,7 @@ public class AuditDataTest { assertEquals(start, data.getStartTime()); assertEquals(responseCode, data.getResponseCode()); assertEquals(responseDescription, data.getResponseDescription()); - assertEquals(StatusCode.COMPLETE, data.getStatusCode()); + assertEquals(COMPLETE, data.getStatusCode()); } @Test diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/LoggerFactoryTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/LoggerFactoryTest.java index 6f860af60a..e6998f35e8 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/LoggerFactoryTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/LoggerFactoryTest.java @@ -71,7 +71,7 @@ public class LoggerFactoryTest { logger.warn(""); logger.info(""); logger.debug(""); - logger.audit(null); + logger.auditExit(null); logger.metrics(MetricsData.builder().build()); } } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/MetricsDataTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/MetricsDataTest.java index 43f913ecab..9c9aa81bc7 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/MetricsDataTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/MetricsDataTest.java @@ -18,6 +18,7 @@ package org.openecomp.sdc.logging.api; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE; import org.junit.Test; @@ -40,7 +41,7 @@ public class MetricsDataTest { final String targetEntity = "Metrics-Target-Entity"; final String targetVirtualEntity = "Metrics-Target-Virtual-Entity"; - MetricsData data = MetricsData.builder().startTime(start).endTime(end).statusCode(StatusCode.COMPLETE) + MetricsData data = MetricsData.builder().startTime(start).endTime(end).statusCode(COMPLETE) .responseCode(responseCode).responseDescription(responseDescription) .clientIpAddress(ipAddress).targetEntity(targetEntity) .targetVirtualEntity(targetVirtualEntity).build(); @@ -50,7 +51,7 @@ public class MetricsDataTest { assertEquals(start, data.getStartTime()); assertEquals(responseCode, data.getResponseCode()); assertEquals(responseDescription, data.getResponseDescription()); - assertEquals(StatusCode.COMPLETE, data.getStatusCode()); + assertEquals(COMPLETE, data.getStatusCode()); assertEquals(targetEntity, data.getTargetEntity()); assertEquals(targetVirtualEntity, data.getTargetVirtualEntity()); diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/AuditTrackerTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/AuditTrackerTest.java index 1bd13a9dfd..36c0957069 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/AuditTrackerTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/AuditTrackerTest.java @@ -27,9 +27,9 @@ import static org.mockito.Mockito.when; import javax.servlet.http.HttpServletRequest; import org.junit.Test; import org.mockito.ArgumentCaptor; +import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus; import org.openecomp.sdc.logging.api.AuditData; import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.StatusCode; /** * Test initialization and of audit tracker and log invocation. @@ -73,7 +73,7 @@ public class AuditTrackerTest { tracker.preRequest(mock(HttpServletRequest.class)); tracker.postRequest(mock(RequestProcessingResult.class)); - verify(logger, never()).audit(any(AuditData.class)); + verify(logger, never()).auditExit(any(AuditData.class)); } @Test @@ -87,7 +87,7 @@ public class AuditTrackerTest { tracker.postRequest(mock(RequestProcessingResult.class)); ArgumentCaptor<AuditData> auditDataCaptor = ArgumentCaptor.forClass(AuditData.class); - verify(logger).audit(auditDataCaptor.capture()); + verify(logger).auditExit(auditDataCaptor.capture()); assertTrue(auditDataCaptor.getValue().getEndTime() > 0); } @@ -104,7 +104,7 @@ public class AuditTrackerTest { tracker.postRequest(result); ArgumentCaptor<AuditData> auditDataCaptor = ArgumentCaptor.forClass(AuditData.class); - verify(logger).audit(auditDataCaptor.capture()); + verify(logger).auditExit(auditDataCaptor.capture()); AuditData capturedAuditData = auditDataCaptor.getValue(); assertEquals(Integer.toString(result.getStatus()), capturedAuditData.getResponseCode()); @@ -127,7 +127,7 @@ public class AuditTrackerTest { tracker.postRequest(mock(RequestProcessingResult.class)); ArgumentCaptor<AuditData> auditDataCaptor = ArgumentCaptor.forClass(AuditData.class); - verify(logger).audit(auditDataCaptor.capture()); + verify(logger).auditExit(auditDataCaptor.capture()); AuditData capturedAuditData = auditDataCaptor.getValue(); assertEquals(address, capturedAuditData.getClientIpAddress()); @@ -141,8 +141,8 @@ public class AuditTrackerTest { } @Override - public StatusCode getStatusCode() { - return StatusCode.ERROR; + public ResponseStatus getStatusCode() { + return ResponseStatus.ERROR; } @Override diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/ContextTrackerTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/ContextTrackerTest.java index 59c690d763..f1066c447b 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/ContextTrackerTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/ContextTrackerTest.java @@ -119,7 +119,7 @@ public class ContextTrackerTest { } @Test - public void partnerNameAbsentWhenNotGiven() { + public void partnerNameIsUnknownWhenNotGiven() { mockStatic(LoggingContext.class); @@ -131,7 +131,7 @@ public class ContextTrackerTest { LoggingContext.put(contextDataCaptor.capture()); - assertNull(contextDataCaptor.getValue().getPartnerName()); + assertEquals(contextDataCaptor.getValue().getPartnerName(), "UNKNOWN"); } @Test diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/logback/EventTypeDiscriminator.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/logback/EventTypeDiscriminator.java index b6f8cfa8ff..aa4657f83e 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/logback/EventTypeDiscriminator.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/logback/EventTypeDiscriminator.java @@ -95,7 +95,7 @@ public class EventTypeDiscriminator extends AbstractDiscriminator<ILoggingEvent> final Marker marker = event.getMarker(); if (marker != null) { - if (marker.contains(Markers.AUDIT)) { + if (marker.contains(Markers.ENTRY) || marker.contains(Markers.EXIT)){ return AUDIT; } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/AuditField.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/AuditField.java index 3e44a34722..c4e780fa8f 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/AuditField.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/AuditField.java @@ -16,6 +16,8 @@ package org.openecomp.sdc.logging.slf4j; +import org.onap.logging.ref.slf4j.ONAPLogConstants; + /** * MDC fields that represent audit data. * @@ -24,13 +26,13 @@ package org.openecomp.sdc.logging.slf4j; */ enum AuditField implements MDCField { - BEGIN_TIMESTAMP("BeginTimestamp"), + BEGIN_TIMESTAMP(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP), END_TIMESTAMP("EndTimestamp"), ELAPSED_TIME("ElapsedTime"), - STATUS_CODE("StatusCode"), - RESPONSE_CODE("ResponseCode"), - RESPONSE_DESCRIPTION("ResponseDescription"), - CLIENT_IP_ADDRESS("ClientIpAddress"); + STATUS_CODE(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE), + RESPONSE_CODE(ONAPLogConstants.MDCs.RESPONSE_CODE), + RESPONSE_DESCRIPTION(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION), + CLIENT_IP_ADDRESS(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS); private final String key; diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/ContextField.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/ContextField.java index cce5f44863..87aa0e3a32 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/ContextField.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/ContextField.java @@ -16,6 +16,8 @@ package org.openecomp.sdc.logging.slf4j; +import org.onap.logging.ref.slf4j.ONAPLogConstants; + /** * MDC fields that represent context data. * @@ -24,11 +26,11 @@ package org.openecomp.sdc.logging.slf4j; */ enum ContextField implements MDCField { - REQUEST_ID("RequestId"), - SERVICE_NAME("ServiceName"), - PARTNER_NAME("PartnerName"), - INSTANCE_ID("InstanceId"), - SERVER("Server"), + REQUEST_ID(ONAPLogConstants.MDCs.REQUEST_ID), + SERVICE_NAME(ONAPLogConstants.MDCs.SERVICE_NAME), + PARTNER_NAME(ONAPLogConstants.MDCs.PARTNER_NAME), + INSTANCE_ID(ONAPLogConstants.MDCs.INSTANCE_UUID), + SERVER(ONAPLogConstants.MDCs.SERVER_FQDN), SERVER_IP_ADDRESS("ServerIpAddress"); private final String key; diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/Markers.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/Markers.java index 17439da161..3d9bbcfa53 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/Markers.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/Markers.java @@ -16,6 +16,7 @@ package org.openecomp.sdc.logging.slf4j; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.Marker; import org.slf4j.MarkerFactory; @@ -41,7 +42,9 @@ import org.slf4j.MarkerFactory; */ public class Markers { - public static final Marker AUDIT = MarkerFactory.getMarker("AUDIT"); + public static final Marker ENTRY = MarkerFactory.getMarker(ONAPLogConstants.Markers.ENTRY.getName()); + public static final Marker EXIT = MarkerFactory.getMarker(ONAPLogConstants.Markers.EXIT.getName()); + public static final Marker METRICS = MarkerFactory.getMarker("METRICS"); private Markers() { diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/MetricsField.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/MetricsField.java index fda0c8b683..c4e8e143af 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/MetricsField.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/MetricsField.java @@ -16,6 +16,8 @@ package org.openecomp.sdc.logging.slf4j; +import org.onap.logging.ref.slf4j.ONAPLogConstants; + /** * DC fields that represent metrics data. * @@ -24,15 +26,15 @@ package org.openecomp.sdc.logging.slf4j; */ public enum MetricsField implements MDCField { - BEGIN_TIMESTAMP("BeginTimestamp"), + BEGIN_TIMESTAMP(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP), END_TIMESTAMP("EndTimestamp"), ELAPSED_TIME("ElapsedTime"), - STATUS_CODE("StatusCode"), - RESPONSE_CODE("ResponseCode"), - RESPONSE_DESCRIPTION("ResponseDescription"), - CLIENT_IP_ADDRESS("ClientIpAddress"), + STATUS_CODE(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE), + RESPONSE_CODE(ONAPLogConstants.MDCs.RESPONSE_CODE), + RESPONSE_DESCRIPTION(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION), + CLIENT_IP_ADDRESS(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS), TARGET_VIRTUAL_ENTITY("TargetVirtualEntity"), - TARGET_ENTITY("TargetEntity"); + TARGET_ENTITY(ONAPLogConstants.MDCs.TARGET_ENTITY); private final String key; diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/RequestContextProvider.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/RequestContextProvider.java index 40684cc132..70e3dd6479 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/RequestContextProvider.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/RequestContextProvider.java @@ -40,9 +40,9 @@ class RequestContextProvider implements ContextProvider { static ContextData to(Map<ContextField, String> values) { return ContextData.builder() - .requestId(values.get(ContextField.REQUEST_ID)) - .serviceName(values.get(ContextField.SERVICE_NAME)) - .partnerName(values.get(ContextField.PARTNER_NAME)).build(); + .requestId(values.get(ContextField.REQUEST_ID)) + .serviceName(values.get(ContextField.SERVICE_NAME)) + .partnerName(values.get(ContextField.PARTNER_NAME)).build(); } @Override @@ -58,7 +58,6 @@ class RequestContextProvider implements ContextProvider { } private void putIfNotNull(Map<ContextField, String> values, ContextField field, String value) { - if (value != null) { values.put(field, value); } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/SLF4JLoggerWrapper.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/SLF4JLoggerWrapper.java index fbb5fbf1f2..f85a6bbe95 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/SLF4JLoggerWrapper.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/main/java/org/openecomp/sdc/logging/slf4j/SLF4JLoggerWrapper.java @@ -114,11 +114,11 @@ class SLF4JLoggerWrapper implements Logger { @Override public boolean isAuditEnabled() { - return logger.isInfoEnabled(Markers.AUDIT); + return logger.isInfoEnabled(Markers.EXIT); } @Override - public void audit(AuditData data) { + public void auditEntry(AuditData data) { if (data == null) { return; // not failing if null @@ -126,7 +126,23 @@ class SLF4JLoggerWrapper implements Logger { try { putAuditOnMdc(data); - logger.info(Markers.AUDIT, ""); + logger.info(Markers.ENTRY, ""); + } finally { + clearAuditFromMdc(); + } + } + + + @Override + public void auditExit(AuditData data) { + + if (data == null) { + return; // not failing if null + } + + try { + putAuditOnMdc(data); + logger.info(Markers.EXIT, ""); } finally { clearAuditFromMdc(); } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/RoutingTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/RoutingTest.java index 7be90264d6..d2e75b1ac1 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/RoutingTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/RoutingTest.java @@ -113,7 +113,7 @@ public class RoutingTest { @Test public void testAudit() { String msg = "This is a test audit"; - logger.info(Markers.AUDIT, msg); + logger.info(Markers.EXIT, msg); TestAppender appender = result.get(AUDIT); Assert.assertTrue(appender.contains( (event) -> Level.INFO.equals(event.getLevel()) && msg.equals(event.getFormattedMessage()))); diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/logback/EventTypeDiscriminatorTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/logback/EventTypeDiscriminatorTest.java index 2a71f72063..2001e16264 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/logback/EventTypeDiscriminatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/logback/EventTypeDiscriminatorTest.java @@ -79,7 +79,7 @@ public class EventTypeDiscriminatorTest { EventTypeDiscriminator discriminator = new EventTypeDiscriminator(); LoggingEvent event = new LoggingEvent(); event.setLevel(Level.ERROR); - event.setMarker(Markers.AUDIT); + event.setMarker(Markers.EXIT); assertEquals(ERROR, discriminator.getDiscriminatingValue(event)); } @@ -97,7 +97,7 @@ public class EventTypeDiscriminatorTest { EventTypeDiscriminator discriminator = new EventTypeDiscriminator(); LoggingEvent event = new LoggingEvent(); event.setLevel(Level.WARN); - event.setMarker(Markers.AUDIT); + event.setMarker(Markers.EXIT); assertEquals(ERROR, discriminator.getDiscriminatingValue(event)); } @@ -115,7 +115,7 @@ public class EventTypeDiscriminatorTest { EventTypeDiscriminator discriminator = new EventTypeDiscriminator(); LoggingEvent event = new LoggingEvent(); event.setLevel(Level.DEBUG); - event.setMarker(Markers.AUDIT); + event.setMarker(Markers.EXIT); assertEquals(DEBUG, discriminator.getDiscriminatingValue(event)); } @@ -133,7 +133,7 @@ public class EventTypeDiscriminatorTest { EventTypeDiscriminator discriminator = new EventTypeDiscriminator(); LoggingEvent event = new LoggingEvent(); event.setLevel(Level.TRACE); - event.setMarker(Markers.AUDIT); + event.setMarker(Markers.EXIT); assertEquals(DEBUG, discriminator.getDiscriminatingValue(event)); } @@ -196,7 +196,7 @@ public class EventTypeDiscriminatorTest { EventTypeDiscriminator discriminator = new EventTypeDiscriminator(); LoggingEvent event = new LoggingEvent(); event.setLevel(Level.INFO); - event.setMarker(Markers.AUDIT); + event.setMarker(Markers.EXIT); assertEquals("Audit", discriminator.getDiscriminatingValue(event)); } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/LoggingContextTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/LoggingContextTest.java index 1e7cfe834f..9ecd5567e0 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/LoggingContextTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/LoggingContextTest.java @@ -147,7 +147,7 @@ public class LoggingContextTest { String random = UUID.randomUUID().toString(); ContextData context = ContextData.builder().serviceName(random).build(); LoggingContext.put(context); - assertEquals(context, LoggingContext.get()); + assertEquals(context.getServiceName(), LoggingContext.get().getServiceName()); } @Test @@ -156,7 +156,7 @@ public class LoggingContextTest { String random = UUID.randomUUID().toString(); ContextData context = ContextData.builder().requestId(random).build(); LoggingContext.put(context); - assertEquals(context, LoggingContext.get()); + assertEquals(context.getRequestId(), LoggingContext.get().getRequestId()); } @Test @@ -165,7 +165,7 @@ public class LoggingContextTest { String random = UUID.randomUUID().toString(); ContextData context = ContextData.builder().partnerName(random).build(); LoggingContext.put(context); - assertEquals(context, LoggingContext.get()); + assertEquals(context.getPartnerName(), LoggingContext.get().getPartnerName()); } } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/RequestContextProviderTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/RequestContextProviderTest.java index c4c1677637..e0f8e40e4b 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/RequestContextProviderTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/RequestContextProviderTest.java @@ -16,16 +16,14 @@ package org.openecomp.sdc.logging.slf4j; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - import java.util.Collections; import java.util.EnumMap; import java.util.Map; import org.junit.Test; import org.openecomp.sdc.logging.api.ContextData; +import static org.junit.Assert.*; + /** * Unit-test retrieving values from client-provided request data. * diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/SLF4JLoggerWrapperTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/SLF4JLoggerWrapperTest.java index c8ee347a8b..2b98fc898f 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/SLF4JLoggerWrapperTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/src/test/java/org/openecomp/sdc/logging/slf4j/SLF4JLoggerWrapperTest.java @@ -19,6 +19,7 @@ package org.openecomp.sdc.logging.slf4j; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; @@ -28,7 +29,6 @@ import java.util.Map; import org.junit.Test; import org.openecomp.sdc.logging.api.AuditData; import org.openecomp.sdc.logging.api.MetricsData; -import org.openecomp.sdc.logging.api.StatusCode; import org.slf4j.Logger; import org.slf4j.MDC; import org.slf4j.Marker; @@ -44,7 +44,7 @@ public class SLF4JLoggerWrapperTest { @Test public void auditDoesNotFailWhenInputNull() { - new SLF4JLoggerWrapper(this.getClass()).audit(null); + new SLF4JLoggerWrapper(this.getClass()).auditExit(null); } @Test @@ -56,7 +56,7 @@ public class SLF4JLoggerWrapperTest { public void auditBeginTimeAvailableWhenPassed() { SpyLogger spy = createSpy(); long start = System.currentTimeMillis(); - new SLF4JLoggerWrapper(spy).audit(AuditData.builder().startTime(start).build()); + new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().startTime(start).build()); assertNotNull(spy.mdc().get(AuditField.BEGIN_TIMESTAMP.asKey())); } @@ -72,7 +72,7 @@ public class SLF4JLoggerWrapperTest { public void auditEndTimeAvailableWhenPassed() { SpyLogger spy = createSpy(); long end = System.currentTimeMillis(); - new SLF4JLoggerWrapper(spy).audit(AuditData.builder().endTime(end).build()); + new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().endTime(end).build()); assertNotNull(spy.mdc().get(AuditField.END_TIMESTAMP.asKey())); } @@ -88,7 +88,7 @@ public class SLF4JLoggerWrapperTest { public void auditElapsedTimeAvailableWhenPassed() { SpyLogger spy = createSpy(); long start = System.currentTimeMillis(); - new SLF4JLoggerWrapper(spy).audit(AuditData.builder() + new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder() .startTime(start).endTime(start + 777).build()); assertEquals("777", spy.mdc().get(AuditField.ELAPSED_TIME.asKey())); } @@ -105,21 +105,21 @@ public class SLF4JLoggerWrapperTest { @Test public void auditStatusCodeAvailableWhenPassed() { SpyLogger spy = createSpy(); - new SLF4JLoggerWrapper(spy).audit(AuditData.builder().statusCode(StatusCode.COMPLETE).build()); - assertEquals(StatusCode.COMPLETE.name(), spy.mdc().get(AuditField.STATUS_CODE.asKey())); + new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().statusCode(COMPLETE).build()); + assertEquals(COMPLETE.name(), spy.mdc().get(AuditField.STATUS_CODE.asKey())); } @Test public void metricsStatusCodeAvailableWhenPassed() { SpyLogger spy = createSpy(); - new SLF4JLoggerWrapper(spy).metrics(MetricsData.builder().statusCode(StatusCode.COMPLETE).build()); - assertEquals(StatusCode.COMPLETE.name(), spy.mdc().get(MetricsField.STATUS_CODE.asKey())); + new SLF4JLoggerWrapper(spy).metrics(MetricsData.builder().statusCode(COMPLETE).build()); + assertEquals(COMPLETE.name(), spy.mdc().get(MetricsField.STATUS_CODE.asKey())); } @Test public void auditStatusCodeEmptyWhenNotPassed() { SpyLogger spy = createSpy(); - new SLF4JLoggerWrapper(spy).audit(AuditData.builder().build()); + new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().build()); assertNull(spy.mdc().get(AuditField.STATUS_CODE.asKey())); } @@ -134,7 +134,7 @@ public class SLF4JLoggerWrapperTest { public void auditResponseCodeAvailableWhenPassed() { final String responseCode = "AuditSpyResponse"; SpyLogger spy = createSpy(); - new SLF4JLoggerWrapper(spy).audit(AuditData.builder().responseCode(responseCode).build()); + new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().responseCode(responseCode).build()); assertEquals(responseCode, spy.mdc().get(AuditField.RESPONSE_CODE.asKey())); } @@ -149,7 +149,7 @@ public class SLF4JLoggerWrapperTest { @Test public void auditResponseCodeEmptyWhenNotPassed() { SpyLogger spy = createSpy(); - new SLF4JLoggerWrapper(spy).audit(AuditData.builder().build()); + new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().build()); assertNull(spy.mdc().get(AuditField.RESPONSE_CODE.asKey())); } @@ -164,7 +164,7 @@ public class SLF4JLoggerWrapperTest { public void auditResponseDescriptionAvailableWhenPassed() { final String responseDescription = "AuditSpyDescription"; SpyLogger spy = createSpy(); - new SLF4JLoggerWrapper(spy).audit(AuditData.builder().responseDescription(responseDescription).build()); + new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().responseDescription(responseDescription).build()); assertEquals(responseDescription, spy.mdc().get(AuditField.RESPONSE_DESCRIPTION.asKey())); } @@ -179,7 +179,7 @@ public class SLF4JLoggerWrapperTest { @Test public void auditResponseDescriptionEmptyWhenNotPassed() { SpyLogger spy = createSpy(); - new SLF4JLoggerWrapper(spy).audit(AuditData.builder().build()); + new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().build()); assertNull(spy.mdc().get(AuditField.RESPONSE_DESCRIPTION.asKey())); } @@ -194,7 +194,7 @@ public class SLF4JLoggerWrapperTest { public void auditClientIpAddressAvailableWhenPassed() { final String ipAddress = "10.56.20.20"; SpyLogger spy = createSpy(); - new SLF4JLoggerWrapper(spy).audit(AuditData.builder().clientIpAddress(ipAddress).build()); + new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().clientIpAddress(ipAddress).build()); assertEquals(ipAddress, spy.mdc().get(AuditField.CLIENT_IP_ADDRESS.asKey())); } @@ -209,7 +209,7 @@ public class SLF4JLoggerWrapperTest { @Test public void auditClientIpAddressEmptyWhenNotPassed() { SpyLogger spy = createSpy(); - new SLF4JLoggerWrapper(spy).audit(AuditData.builder().build()); + new SLF4JLoggerWrapper(spy).auditExit(AuditData.builder().build()); assertNull(spy.mdc().get(AuditField.CLIENT_IP_ADDRESS.asKey())); } @@ -294,7 +294,7 @@ public class SLF4JLoggerWrapperTest { } private boolean isAuditMethod(Method method, Object[] args) { - return isSpecialLogMethod(method, args, Markers.AUDIT); + return isSpecialLogMethod(method, args, Markers.EXIT); } private boolean isSpecialLogMethod(Method method, Object[] args, Marker marker) { diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/main/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptor.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/main/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptor.java index 7ee942a180..393a061987 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/main/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptor.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/main/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptor.java @@ -16,17 +16,17 @@ package org.openecomp.sdc.logging.servlet.spring; -import static org.openecomp.sdc.logging.api.StatusCode.COMPLETE; -import static org.openecomp.sdc.logging.api.StatusCode.ERROR; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.*; import static org.springframework.http.HttpStatus.Series.REDIRECTION; import static org.springframework.http.HttpStatus.Series.SUCCESSFUL; import java.util.Objects; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.api.StatusCode; import org.openecomp.sdc.logging.servlet.AuditTracker; import org.openecomp.sdc.logging.servlet.CombinedTracker; import org.openecomp.sdc.logging.servlet.ContextTracker; @@ -120,7 +120,7 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter { } @Override - public StatusCode getStatusCode() { + public ResponseStatus getStatusCode() { return statusInfo.getStatusCode(); } @@ -154,7 +154,7 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter { return reasonPhrase; } - private StatusCode getStatusCode() { + private ResponseStatus getStatusCode() { return series.equals(SUCCESSFUL) || series.equals(REDIRECTION) ? COMPLETE : ERROR; } } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/test/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptorTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/test/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptorTest.java index 406f8b6dbd..86a4318ec9 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/test/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptorTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-spring/src/test/java/org/openecomp/sdc/logging/servlet/spring/LoggingInterceptorTest.java @@ -22,13 +22,12 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.openecomp.sdc.logging.api.StatusCode.COMPLETE; -import static org.openecomp.sdc.logging.api.StatusCode.ERROR; import static org.openecomp.sdc.logging.servlet.spring.LoggingInterceptor.LOGGING_TRACKER_KEY; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Test; +import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus; import org.openecomp.sdc.logging.servlet.HttpHeader; import org.openecomp.sdc.logging.servlet.RequestProcessingResult; import org.openecomp.sdc.logging.servlet.Tracker; @@ -80,7 +79,7 @@ public class LoggingInterceptorTest { final int status = 101; LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status); assertEquals(status, result.getStatus()); - assertEquals(ERROR, result.getStatusCode()); + assertEquals(ResponseStatus.ERROR, result.getStatusCode()); } @Test @@ -88,7 +87,7 @@ public class LoggingInterceptorTest { final int status = 404; LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status); assertEquals(status, result.getStatus()); - assertEquals(ERROR, result.getStatusCode()); + assertEquals(ResponseStatus.ERROR, result.getStatusCode()); } @Test @@ -96,7 +95,7 @@ public class LoggingInterceptorTest { final int status = 503; LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status); assertEquals(status, result.getStatus()); - assertEquals(ERROR, result.getStatusCode()); + assertEquals(ResponseStatus.ERROR, result.getStatusCode()); } @Test @@ -104,7 +103,7 @@ public class LoggingInterceptorTest { final int status = 204; LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status); assertEquals(status, result.getStatus()); - assertEquals(COMPLETE, result.getStatusCode()); + assertEquals(ResponseStatus.COMPLETE, result.getStatusCode()); } @Test @@ -112,7 +111,7 @@ public class LoggingInterceptorTest { final int status = 307; LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status); assertEquals(status, result.getStatus()); - assertEquals(COMPLETE, result.getStatusCode()); + assertEquals(ResponseStatus.COMPLETE, result.getStatusCode()); } @Test @@ -120,7 +119,7 @@ public class LoggingInterceptorTest { final int status = 133; LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status); assertEquals(status, result.getStatus()); - assertEquals(ERROR, result.getStatusCode()); + assertEquals(ResponseStatus.ERROR, result.getStatusCode()); } @Test @@ -128,7 +127,7 @@ public class LoggingInterceptorTest { final int status = 485; LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status); assertEquals(status, result.getStatus()); - assertEquals(ERROR, result.getStatusCode()); + assertEquals(ResponseStatus.ERROR, result.getStatusCode()); } @Test @@ -136,7 +135,7 @@ public class LoggingInterceptorTest { final int status = 547; LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status); assertEquals(status, result.getStatus()); - assertEquals(ERROR, result.getStatusCode()); + assertEquals(ResponseStatus.ERROR, result.getStatusCode()); } @Test @@ -144,7 +143,7 @@ public class LoggingInterceptorTest { final int status = 277; LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status); assertEquals(status, result.getStatus()); - assertEquals(COMPLETE, result.getStatusCode()); + assertEquals(ResponseStatus.COMPLETE, result.getStatusCode()); } @Test @@ -152,6 +151,6 @@ public class LoggingInterceptorTest { final int status = 364; LoggingInterceptor.ServletResponseResult result = new LoggingInterceptor.ServletResponseResult(status); assertEquals(status, result.getStatus()); - assertEquals(COMPLETE, result.getStatusCode()); + assertEquals(ResponseStatus.COMPLETE, result.getStatusCode()); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java index 78c01cfdfc..b3d346177b 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java @@ -58,7 +58,7 @@ public class NeutronPortNamingConventionValidator implements ResourceValidator { if (MapUtils.isEmpty(heatOrchestrationTemplate.getResources())) { return; } - String[] regexList = new String[]{".*_net_id", ".*_net_name", ".*_net_fqdn"}; + String[] regexList = {".*_net_id", ".*_net_name", ".*_net_fqdn"}; heatOrchestrationTemplate .getResources() @@ -97,9 +97,9 @@ public class NeutronPortNamingConventionValidator implements ResourceValidator { private void checkNeutronPortFixedIpsName(String fileName, Map.Entry<String, Resource> resourceEntry, GlobalValidationContext globalContext) { - String[] regexList = - new String[]{"[^_]+_[^_]+_ips", "[^_]+_[^_]+_v6_ips", "[^_]+_[^_]+_ip_(\\d+)", - "[^_]+_[^_]+_v6_ip_(\\d+)"}; + String[] regexList = {"[^_]+_[^_]+_ips", "[^_]+_[^_]+_v6_ips", "[^_]+_[^_]+_ip_(\\d+)", + "[^_]+_[^_]+_v6_ip_(\\d+)", "[^_]+_[^_]+_[^_]+_ips", "[^_]+_[^_]+_[^_]+_v6_ips", + "[^_]+_[^_]+_[^_]+_ip_(\\d+)", "[^_]+_[^_]+_[^_]+_v6_ip_(\\d+)"}; if (MapUtils.isEmpty(resourceEntry.getValue().getProperties())) { return; @@ -128,13 +128,9 @@ public class NeutronPortNamingConventionValidator implements ResourceValidator { String fixedIpsName = ValidationUtil .getWantedNameFromPropertyValueGetParam(fixedIpsEntry.getValue()); - if (nonNull(fixedIpsName) && !ValidationUtil - .evalPattern(fixedIpsName, regexList)) { - globalContext.addMessage( - fileName, - ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters( - ERROR_CODE_NNP1, - Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES.getErrorMessage(), + + if (nonNull(fixedIpsName) && !ValidationUtil.evalPattern(fixedIpsName, regexList)) { + globalContext.addMessage(fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters(ERROR_CODE_NNP1, Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES.getErrorMessage(), "Port", "Fixed_IPS", fixedIpsName, resourceEntry.getKey())); } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java index 4f640dff29..b1a8fe254d 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java @@ -192,15 +192,15 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal }else if (network instanceof List){ role = getNetworkRole((String)((List) network).get(0)); } - if (role != null && uniqueResourcePortNetworkRole.containsKey(role)) { + if (role != null && (uniqueResourcePortNetworkRole.containsKey(role))) { globalValidationContext.addMessage( fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters( ERROR_CODE_NNS12, Messages.RESOURCE_CONNECTED_TO_TWO_EXTERNAL_NETWORKS_WITH_SAME_ROLE - .getErrorMessage(), resourceId, role)); + .getErrorMessage(), role, resourceId)); } else { - uniqueResourcePortNetworkRole.put(role, portResourceId); + uniqueResourcePortNetworkRole.put(role, resourceId); } } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java index de047b8fee..00f95ef383 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java @@ -64,7 +64,7 @@ public class NeutronPortNamingConventionValidatorTest { PATH + "negativeFixedIP/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); - Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 4); + Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 3); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), "WARNING: [NNP1]: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_net_v6_ip_a], Resource ID [port_resource_0]. As a result, VF/VFC Profile may miss this information"); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(1).getMessage(), @@ -72,9 +72,6 @@ public class NeutronPortNamingConventionValidatorTest { Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(2).getMessage(), "WARNING: [NNP1]: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_net_ipz], Resource ID [port_resource_2]. As a result, VF/VFC Profile may miss this information"); - - Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(3).getMessage(), - "WARNING: [NNP1]: Port 'Fixed_IPS' Parameter Name not aligned with Guidelines, Parameter Name [pcrf_net_v0_ip_3], Resource ID [port_resource_2]. As a result, VF/VFC Profile may miss this information"); } @Test diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java index 759b376b97..01750c5f54 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java @@ -118,7 +118,7 @@ public class NovaServerNamingConventionGuideLineValidatorTest { Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), - "WARNING: [NNS12]: A resource is connected twice to the same network role, Network Role [FSB2], Resource ID [Internal1]"); + "WARNING: [NNS12]: A resource is connected twice to the same network role, Network Role [Internal1], Resource ID [FSB2]"); } @Test diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaConstants.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaConstants.java index 14b216a040..ea9a6cde04 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaConstants.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaConstants.java @@ -17,6 +17,7 @@ package org.openecomp.sdc.tosca.services; + public class ToscaConstants { //TOSCA Requirement Ids |