diff options
author | r.bogacki <r.bogacki@samsung.com> | 2019-02-27 15:26:33 +0100 |
---|---|---|
committer | Robert Bogacki <r.bogacki@samsung.com> | 2019-02-27 14:31:39 +0000 |
commit | 8a380079ea293d7e730f766af3064358d84b1052 (patch) | |
tree | 051c104f678db0a5b8eb243ae7feb969b0d12291 | |
parent | a96380d2d7ccc93e808ab0c7f4a047095878e254 (diff) |
Removed MsoLogger from 'MSOCommonBPMN'
Removed MsoLogger from adapters ('MSOCommonBPMN')
Replaced MsoLogger with plain slf4j.
Refactored login output.
Fixed imports.
Change-Id: I5e1ed5e438c19be9a9cfd2decae06c706fd1a92a
Issue-ID: LOG-631
Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
25 files changed, 307 insertions, 259 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java index 1157750312..2dbf2feaf7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -36,6 +38,8 @@ import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.CryptoUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -53,6 +57,8 @@ import org.springframework.stereotype.Component; @Component public class BpmnRestClient { + private static Logger logger = LoggerFactory.getLogger(BpmnRestClient.class); + public static final String DEFAULT_BPEL_AUTH = "admin:admin"; public static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; @@ -64,7 +70,6 @@ public class BpmnRestClient { private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; @Autowired private UrnPropertiesReader urnPropertiesReader; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BpmnRestClient.class); private static boolean noProperties = true; @@ -101,7 +106,7 @@ public class BpmnRestClient { RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(recipeTimeout).setConnectTimeout(recipeTimeout).setConnectionRequestTimeout(recipeTimeout).build(); post.setConfig(requestConfig); - msoLogger.debug("call the bpmn, url:" + recipeUri); + logger.debug("call the bpmn, url: {}", recipeUri); String jsonReq = wrapResourceRequest(requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, requestDetails, recipeParamXsd); StringEntity input = new StringEntity(jsonReq); @@ -177,10 +182,10 @@ public class BpmnRestClient { recipeRequest.setResourceInput(resourceInput); recipeRequest.setRecipeTimeout(recipeTimeoutInput); jsonReq = recipeRequest.toString(); - msoLogger.trace("request body is " + jsonReq); + logger.trace("request body is {}", jsonReq); } catch(Exception e) { - msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapVIDRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", - e); + logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest", + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); } return jsonReq; } @@ -198,7 +203,7 @@ public class BpmnRestClient { try { return CryptoUtils.decrypt(prop, urnPropertiesReader.getVariable(encryptionKey)); } catch(GeneralSecurityException e) { - msoLogger.debug("Security exception", e); + logger.debug("Security exception", e); } return defaultValue; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java index f574288a67..2119b2dfa8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -20,7 +22,6 @@ package org.onap.so.bpmn.common.recipe; import org.onap.so.bpmn.core.domain.ModelInfo; -import org.onap.so.logger.MsoLogger; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -28,6 +29,8 @@ import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * the inputs for the resource recipe @@ -42,7 +45,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; @JsonRootName("variables") public class ResourceInput { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, ResourceInput.class); + private static Logger logger = LoggerFactory.getLogger(ResourceInput.class); @JsonProperty("resourceInstanceName") private String resourceInstanceName; @@ -307,8 +310,8 @@ public class ResourceInput { String jsonStr = ""; try { jsonStr = mapper.writeValueAsString(this); - } catch(JsonProcessingException e) { - msoLogger.error("JsonProcessingException", e); + } catch (JsonProcessingException e) { + logger.error("JsonProcessingException", e); } return jsonStr; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java index 4c6edfa099..d1e26582a3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -20,14 +22,14 @@ package org.onap.so.bpmn.common.recipe; -import org.onap.so.logger.MsoLogger; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonRootName; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * java object of the resource recipe , it @@ -37,7 +39,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; @JsonRootName("variables") public class ResourceRecipeRequest { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, ResourceRecipeRequest.class); + private static Logger logger = LoggerFactory.getLogger(ResourceRecipeRequest.class); @JsonProperty("resourceInput") private BpmnParam resourceInput; @@ -145,15 +147,14 @@ public class ResourceRecipeRequest { @Override public String toString() { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - String jsonStr = "ResourceRecipeRequest"; - try { - jsonStr = mapper.writeValueAsString(this); - } catch(JsonProcessingException e) { - msoLogger.error("JsonProcessingException", e); - } + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + String jsonStr = "ResourceRecipeRequest"; + try { + jsonStr = mapper.writeValueAsString(this); + } catch (JsonProcessingException e) { + logger.error("JsonProcessingException", e); + } return jsonStr; } - } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index 750f25532c..03f56b31f6 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -38,7 +38,6 @@ import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.fasterxml.jackson.core.JsonProcessingException; @@ -46,6 +45,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ResourceRequestBuilder { @@ -53,7 +54,7 @@ public class ResourceRequestBuilder { private static String SERVICE_URL_SERVICE_INSTANCE = "/v2/serviceResources"; - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ResourceRequestBuilder.class); + private static Logger logger = LoggerFactory.getLogger(ResourceRequestBuilder.class); static JsonUtils jsonUtil = new JsonUtils(); @@ -74,7 +75,7 @@ public class ResourceRequestBuilder { } } } catch (Exception e) { - LOGGER.error("not able to retrieve service order."); + logger.error("not able to retrieve service order."); } return resourceSequence; } @@ -161,7 +162,7 @@ public class ResourceRequestBuilder { } } catch (Exception e) { - LOGGER.error("not able to retrieve service instance"); + logger.error("not able to retrieve service instance"); } return new HashMap(); } @@ -227,8 +228,8 @@ public class ResourceRequestBuilder { mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); try { return mapper.readValue(jsonstr, type); - } catch(IOException e) { - LOGGER.error("fail to unMarshal json" + e.getMessage ()); + } catch (IOException e) { + logger.error("fail to unMarshal json {}", e.getMessage()); } return null; } @@ -239,8 +240,8 @@ public class ResourceRequestBuilder { String jsonStr = null; try { jsonStr = mapper.writeValueAsString(srcObj); - } catch(JsonProcessingException e) { - LOGGER.error("SdcToscaParserException", e); + } catch (JsonProcessingException e) { + logger.error("SdcToscaParserException", e); } return jsonStr; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java index 093dac39c3..0fd0d9297d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -25,10 +27,11 @@ import java.security.GeneralSecurityException; import java.util.Properties; import org.onap.so.utils.CryptoUtils; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class CryptoHandler implements ICryptoHandler { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CryptoHandler.class); + private static final Logger logger = LoggerFactory.getLogger(CryptoHandler.class); private static final String GENERAL_SECURITY_EXCEPTION_PREFIX = "GeneralSecurityException :"; private static final String MSO_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; private static final String PROPERTY_KEY = "mso.AaiEncrypted.Pwd"; @@ -40,7 +43,7 @@ public class CryptoHandler implements ICryptoHandler { keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("urn.properties")); return CryptoUtils.decrypt((String) keyProp.get(PROPERTY_KEY), MSO_KEY); } catch (GeneralSecurityException | IOException e) { - LOGGER.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); + logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); return null; } } @@ -51,7 +54,7 @@ public class CryptoHandler implements ICryptoHandler { try { return CryptoUtils.encrypt(plainMsoPwd, MSO_KEY); } catch (GeneralSecurityException e) { - LOGGER.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); + logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); return null; } } @@ -61,7 +64,7 @@ public class CryptoHandler implements ICryptoHandler { try { return CryptoUtils.decrypt(encryptedPwd, MSO_KEY); } catch (GeneralSecurityException e) { - LOGGER.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); + logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); return null; } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java index df7b57f3a3..6b178bd215 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018. Intel Corp. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -24,16 +26,14 @@ import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.HomingInstance; import org.onap.so.db.catalog.client.CatalogDbClient; -import org.onap.so.logger.MsoLogger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import java.util.Arrays; import java.util.Optional; public class OofInfraUtils { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OofInfraUtils.class); + private static final Logger logger = LoggerFactory.getLogger(OofInfraUtils.class); /** * This method creates a cloudsite in catalog database. @@ -53,16 +53,16 @@ public class OofInfraUtils { getCloudsite = Optional.ofNullable(client.getCloudSite(cloudSite.getId(), endpoint + "/cloudSite/")).orElse(new CloudSite()); if (!cloudSite.getId().equals(getCloudsite.getId())) { client.postCloudSite(cloudSite); - LOGGER.debug("Did not findd cloudsite : " + cloudSite.getId()); - LOGGER.debug("Will create cloudSite: " + cloudSite.toString()); + logger.debug("Did not findd cloudsite : {}", cloudSite.getId()); + logger.debug("Will create cloudSite: {}", cloudSite.toString()); } else { - LOGGER.debug("Found cloudsite : " + cloudSite.getId()); - LOGGER.debug("Will not create cloudSite: " + cloudSite.toString()); + logger.debug("Found cloudsite : {}", cloudSite.getId()); + logger.debug("Will not create cloudSite: {}", cloudSite.toString()); } } catch (Exception e) { - LOGGER.debug("Error looking up or creating cloudsite : " + cloudSite.getId()); - LOGGER.debug("CloudSite Lookup/Creation Error: " + e); + logger.debug("Error looking up or creating cloudsite : {}", cloudSite.getId()); + logger.debug("CloudSite Lookup/Creation Error: " + e); } @@ -83,8 +83,8 @@ public class OofInfraUtils { try { client.postHomingInstance(homingInstance); } catch (Exception exception) { - LOGGER.debug("Could not create HomingInstance : " + homingInstance.getServiceInstanceId()); - LOGGER.debug("HomingInstance Creation Error: " + exception); + logger.debug("Could not create HomingInstance : {}", homingInstance.getServiceInstanceId()); + logger.debug("HomingInstance Creation Error: {}", exception); } } @@ -104,8 +104,8 @@ public class OofInfraUtils { try { return client.getHomingInstance(serviceInstanceId, endpoint + "/homingInstance/"); } catch (Exception exception) { - LOGGER.debug("Could not get HomingInstance for serviceInstanceId : " + serviceInstanceId); - LOGGER.debug("Get HomingInstance Error: " + exception); + logger.debug("Could not get HomingInstance for serviceInstanceId : {}", serviceInstanceId); + logger.debug("Get HomingInstance Error: {}", exception); } return null; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java index eb7290b685..db7f1da10f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java @@ -5,6 +5,8 @@ package org.onap.so.bpmn.common.workflow.context; * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -26,6 +28,8 @@ import java.util.concurrent.TimeUnit; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; /** @@ -37,7 +41,7 @@ import org.springframework.stereotype.Component; @Component public class WorkflowContextHolder { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,WorkflowContextHolder.class); + private static Logger logger = LoggerFactory.getLogger(WorkflowContextHolder.class); private static final String logMarker = "[WORKFLOW-CONTEXT-HOLDER]"; private static WorkflowContextHolder instance = null; @@ -67,14 +71,12 @@ public class WorkflowContextHolder { } public void put(WorkflowContext context) { - msoLogger.debug(logMarker + " Adding context to the queue: " - + context.getRequestId()); + logger.debug("{} Adding context to the queue: {}", logMarker, context.getRequestId()); responseQueue.put(context); } public void remove(WorkflowContext context) { - msoLogger.debug(logMarker + " Removing context from the queue: " - + context.getRequestId()); + logger.debug("{} Removing context from the queue: {}", logMarker, context.getRequestId()); responseQueue.remove(context); } @@ -120,18 +122,20 @@ public class WorkflowContextHolder { try { WorkflowContext requestObject = responseQueue.take(); MsoLogger.setLogContext(requestObject.getRequestId(), null); - msoLogger.debug("Time remaining for request id: " + requestObject.getRequestId() + ":" + requestObject.getDelay(TimeUnit.MILLISECONDS)); - msoLogger.debug("Preparing timeout response for " + requestObject.getProcessKey() + ":" + ":" + requestObject.getRequestId()); + logger.debug("Time remaining for request id: {}:{}", requestObject.getRequestId(), requestObject + .getDelay + (TimeUnit.MILLISECONDS)); + logger.debug("Preparing timeout response for {}:{}", requestObject.getProcessKey(), requestObject + .getRequestId()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Exception e) { - msoLogger.debug("WorkflowContextHolder timeout thread caught exception: " + e); - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, "Error in WorkflowContextHolder timeout thread"); - + logger.debug("WorkflowContextHolder timeout thread caught exception: ", e); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread"); } } - msoLogger.debug("WorkflowContextHolder timeout thread interrupted, quitting"); + logger.debug("WorkflowContextHolder timeout thread interrupted, quitting"); } } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java index 1e390701df..3761d26d0b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -25,20 +27,20 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import org.onap.so.logger.MsoLogger; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @JsonRootName(value = "requestParameters") @JsonInclude(Include.NON_DEFAULT) public class RequestParameters implements Serializable { - private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, RequestParameters.class); + private static final Logger logger = LoggerFactory.getLogger(RequestParameters.class); private static final long serialVersionUID = -5979049912538894930L; @JsonProperty("subscriptionServiceType") @@ -122,7 +124,7 @@ public class RequestParameters implements Serializable { try{ json = ow.writeValueAsString(this); }catch (Exception e){ - log.error("Unable to convert Sniro Manager Request to string", e); + logger.error("Unable to convert Sniro Manager Request to string", e); } return json; } @@ -133,4 +135,4 @@ public class RequestParameters implements Serializable { + subscriptionServiceType + ", userParams=" + userParams + ", aLaCarte=" + aLaCarte + "]"; } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index fbff0620a3..fb3094665e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -75,7 +77,6 @@ import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.request.beans.InfraActiveRequests; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; @@ -87,17 +88,18 @@ import org.onap.so.serviceinstancebeans.RequestParameters; import org.onap.so.serviceinstancebeans.Resources; import org.onap.so.serviceinstancebeans.VfModules; import org.onap.so.serviceinstancebeans.Vnfs; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @Component("BBInputSetup") public class BBInputSetup implements JavaDelegate { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BBInputSetup.class); + private static final Logger logger = LoggerFactory.getLogger(BBInputSetup.class); private static final String FLOW_VAR_NAME = "flowToBeCalled"; private static final String LOOKUP_KEY_MAP_VAR_NAME = "lookupKeyMap"; private static final String GBB_INPUT_VAR_NAME = "gBBInput"; @@ -157,7 +159,7 @@ public class BBInputSetup implements JavaDelegate { outputBB = this.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, resourceId, vnfType); ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); - msoLogger.debug("GeneralBB: " + mapper.writeValueAsString(outputBB)); + logger.debug("GeneralBB: " + mapper.writeValueAsString(outputBB)); setHomingFlag(outputBB, homing, lookupKeyMap); @@ -170,7 +172,7 @@ public class BBInputSetup implements JavaDelegate { execution.setVariable("RetryCount", 1); execution.setVariable("handlingCode", "Success"); } catch (Exception e) { - msoLogger.error(e); + logger.error("Exception occurred", e); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e.getMessage()); } } @@ -244,8 +246,8 @@ public class BBInputSetup implements JavaDelegate { resourceId, vnfType); return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); } else { - msoLogger.debug("Related Service Instance from AAI: " + aaiServiceInstance); - msoLogger.debug("Related Service Instance Model Info from AAI: " + service); + logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance); + logger.debug("Related Service Instance Model Info from AAI: {}", service); throw new Exception("Could not find relevant information for related Service Instance"); } } @@ -419,7 +421,7 @@ public class BBInputSetup implements JavaDelegate { mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); } } else { - msoLogger.debug("Related VNF instance Id not found: " + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); throw new Exception("Could not find relevant information for related VNF"); } } @@ -526,7 +528,7 @@ public class BBInputSetup implements JavaDelegate { mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); } } else { - msoLogger.debug("Related VNF instance Id not found: " + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); throw new Exception("Could not find relevant information for related VNF"); } } @@ -968,10 +970,10 @@ public class BBInputSetup implements JavaDelegate { this.populateL3Network(null, networkModelInfo, service, bbName, serviceInstance, lookupKeyMap, networkId, null); } else { - msoLogger.debug("Could not find a network customization with key: " + key); + logger.debug("Could not find a network customization with key: {}", key); } } else { - msoLogger.debug("Orchestrating on Collection Network Resource Customization"); + logger.debug("Orchestrating on Collection Network Resource Customization"); CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key); L3Network l3Network = getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId, collectionNetworkResourceCust, serviceInstance); NetworkResourceCustomization networkResourceCustomization = @@ -1039,8 +1041,8 @@ public class BBInputSetup implements JavaDelegate { serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service)); gBB = populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); } else { - msoLogger.debug("Related Service Instance from AAI: " + aaiServiceInstance); - msoLogger.debug("Related Service Instance Model Info from AAI: " + service); + logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance); + logger.debug("Related Service Instance Model Info from AAI: {}", service); throw new Exception("Could not find relevant information for related Service Instance"); } ServiceInstance serviceInstance = gBB.getServiceInstance(); @@ -1212,7 +1214,7 @@ public class BBInputSetup implements JavaDelegate { if(configurationCust != null) { this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys()); } else { - msoLogger.debug("Could not find a configuration customization with key: " + key); + logger.debug("Could not find a configuration customization with key: {}", key); } } return gBB; @@ -1276,7 +1278,7 @@ public class BBInputSetup implements JavaDelegate { org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration); return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); } else { - msoLogger.debug("Could not find any cloud configuration for this request."); + logger.debug("Could not find any cloud configuration for this request."); return null; } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 641f7f557c..d6597ecb1a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -78,9 +80,10 @@ import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestDetails; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component("BBInputSetupMapperLayer") @@ -88,8 +91,7 @@ public class BBInputSetupMapperLayer { private static final String USER_PARAM_NAME_KEY = "name"; private static final String USER_PARAM_VALUE_KEY = "value"; - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - BBInputSetupMapperLayer.class); + private static final Logger logger = LoggerFactory.getLogger(BBInputSetupMapperLayer.class); private ModelMapper modelMapper = new ModelMapper(); @@ -490,4 +492,4 @@ public class BBInputSetupMapperLayer { CollectionNetworkResourceCustomization collectionNetworkResourceCust) { return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class); } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index 4617fc4710..b3b4559f1d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -55,9 +57,10 @@ import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestDetails; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -68,7 +71,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; @Component("BBInputSetupUtils") public class BBInputSetupUtils { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BBInputSetupUtils.class); + private static final Logger logger = LoggerFactory.getLogger(BBInputSetupUtils.class); private ObjectMapper objectMapper = new ObjectMapper(); private static final String REQUEST_ERROR = "Could not find request."; @@ -86,7 +89,7 @@ public class BBInputSetupUtils { request.setVnfId(vnfId); this.requestsDbClient.updateInfraActiveRequests(request); } else { - msoLogger.debug(REQUEST_ERROR); + logger.debug(REQUEST_ERROR); } } @@ -95,7 +98,7 @@ public class BBInputSetupUtils { request.setVfModuleId(vfModuleId); this.requestsDbClient.updateInfraActiveRequests(request); } else { - msoLogger.debug(REQUEST_ERROR); + logger.debug(REQUEST_ERROR); } } @@ -104,7 +107,7 @@ public class BBInputSetupUtils { request.setVolumeGroupId(volumeGroupId); this.requestsDbClient.updateInfraActiveRequests(request); } else { - msoLogger.debug(REQUEST_ERROR); + logger.debug(REQUEST_ERROR); } } @@ -113,7 +116,7 @@ public class BBInputSetupUtils { request.setNetworkId(networkId); this.requestsDbClient.updateInfraActiveRequests(request); } else { - msoLogger.debug(REQUEST_ERROR); + logger.debug(REQUEST_ERROR); } } @@ -226,7 +229,7 @@ public class BBInputSetupUtils { customer.getServiceSubscription().getServiceType()) .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO)) .orElseGet(() -> { - msoLogger.debug("No Service Instance matched by name"); + logger.debug("No Service Instance matched by name"); return null; }); } @@ -254,7 +257,7 @@ public class BBInputSetupUtils { AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, globalCustomerId, serviceType) .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO)) .orElseGet(() -> { - msoLogger.debug("No Service Instance matched by name"); + logger.debug("No Service Instance matched by name"); return null; }); } @@ -299,7 +302,7 @@ public class BBInputSetupUtils { return this.injectionHelper.getAaiClient().get(Configuration.class, AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId).depth(Depth.ONE)) .orElseGet(() -> { - msoLogger.debug("No Configuration matched by id"); + logger.debug("No Configuration matched by id"); return null; }); } @@ -309,7 +312,7 @@ public class BBInputSetupUtils { return this.injectionHelper.getAaiClient().get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)) .orElseGet(() -> { - msoLogger.debug("No Generic Vnf matched by id"); + logger.debug("No Generic Vnf matched by id"); return null; }); } @@ -318,7 +321,7 @@ public class BBInputSetupUtils { return this.injectionHelper.getAaiClient().get(VolumeGroup.class, AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwnerId, cloudRegionId, volumeGroupId).depth(Depth.ONE)) .orElseGet(() -> { - msoLogger.debug("No Generic Vnf matched by id"); + logger.debug("No Generic Vnf matched by id"); return null; }); } @@ -327,7 +330,7 @@ public class BBInputSetupUtils { return this.injectionHelper.getAaiClient().get(VfModule.class, AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE)) .orElseGet(() -> { - msoLogger.debug("No Generic Vnf matched by id"); + logger.debug("No Generic Vnf matched by id"); return null; }); } @@ -337,7 +340,7 @@ public class BBInputSetupUtils { return this.injectionHelper.getAaiClient().get(L3Network.class, AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE)) .orElseGet(() -> { - msoLogger.debug("No Generic Vnf matched by id"); + logger.debug("No Generic Vnf matched by id"); return null; }); @@ -349,7 +352,7 @@ public class BBInputSetupUtils { Optional<L3Networks> networks = injectionHelper.getAaiClient().get(L3Networks.class, uri); L3Network network = null; if (!networks.isPresent()) { - msoLogger.debug("No Networks matched by name"); + logger.debug("No Networks matched by name"); return Optional.empty(); } else { if (networks.get().getL3Network().size() > 1) { @@ -367,7 +370,7 @@ public class BBInputSetupUtils { Optional<GenericVnfs> vnfs = injectionHelper.getAaiClient().get(GenericVnfs.class, uri); GenericVnf vnf = null; if (!vnfs.isPresent()) { - msoLogger.debug("No Vnfs matched by name"); + logger.debug("No Vnfs matched by name"); return Optional.empty(); } else { if (vnfs.get().getGenericVnf().size() > 1) { @@ -385,7 +388,7 @@ public class BBInputSetupUtils { Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri); VolumeGroup volumeGroup = null; if (!volumeGroups.isPresent()) { - msoLogger.debug("No VolumeGroups matched by name"); + logger.debug("No VolumeGroups matched by name"); return Optional.empty(); } else { if (volumeGroups.get().getVolumeGroup().size() > 1) { @@ -403,7 +406,7 @@ public class BBInputSetupUtils { Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri); VolumeGroup volumeGroup = null; if (!volumeGroups.isPresent()) { - msoLogger.debug("No VolumeGroups matched by name"); + logger.debug("No VolumeGroups matched by name"); return Optional.empty(); } else { if (volumeGroups.get().getVolumeGroup().size() > 1) { @@ -414,4 +417,4 @@ public class BBInputSetupUtils { return Optional.of(volumeGroup); } } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java index d7d1fecd1a..7fcc613913 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -31,7 +33,8 @@ import org.onap.so.client.aai.AAICommonObjectMapperProvider; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -40,7 +43,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; @Component public class CloudInfoFromAAI { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CloudInfoFromAAI.class); + private static final Logger logger = LoggerFactory.getLogger(CloudInfoFromAAI.class); @Autowired private BBInputSetupUtils bbInputSetupUtils; @@ -63,13 +66,13 @@ public class CloudInfoFromAAI { new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiL3Network)); relationshipsOp = getRelationshipsFromWrapper(networkWrapper); } else { - msoLogger.debug("BBInputSetup could not find a cloud region or tenant, since there are no resources under the SI."); + logger.debug("BBInputSetup could not find a cloud region or tenant, since there are no resources under the SI."); return Optional.empty(); } if (relationshipsOp.isPresent()) { return getRelatedCloudRegionAndTenant(relationshipsOp.get()); } else { - msoLogger.debug("BBInputSetup could not find a cloud region or tenant"); + logger.debug("BBInputSetup could not find a cloud region or tenant"); return Optional.empty(); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java index ee7999f995..054198fd9a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -33,7 +35,8 @@ import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @@ -41,8 +44,7 @@ import org.springframework.stereotype.Component; @Component public class ExecuteBuildingBlockRainyDay { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - ExecuteBuildingBlockRainyDay.class); + private static final Logger logger = LoggerFactory.getLogger(ExecuteBuildingBlockRainyDay.class); public static final String HANDLING_CODE = "handlingCode"; @Autowired @@ -65,7 +67,7 @@ public class ExecuteBuildingBlockRainyDay { String RetryDuration = "PT" + retryTimeToWait + "S"; execution.setVariable("RetryDuration", RetryDuration); } catch (Exception e) { - msoLogger.error(e); + logger.error("Exception occurred", e); throw new BpmnError("Unknown error incrementing retry counter"); } } @@ -125,7 +127,7 @@ public class ExecuteBuildingBlockRainyDay { // Extract error data to be returned to WorkflowAction execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage()); } catch (Exception e) { - msoLogger.error("No WorkflowException Found",e); + logger.error("No WorkflowException Found",e); } RainyDayHandlerStatus rainyDayHandlerStatus; rainyDayHandlerStatus = catalogDbClient @@ -163,25 +165,25 @@ public class ExecuteBuildingBlockRainyDay { request.setRetryStatusMessage("Retries have been exhausted."); requestDbclient.updateInfraActiveRequests(request); } catch (Exception ex) { - msoLogger.error("Failed to update Request Db Infra Active Requests with Retry Status",ex); + logger.error("Failed to update Request Db Infra Active Requests with Retry Status",ex); } } if (handlingCode.equals("RollbackToAssigned") && !aLaCarte) { handlingCode = "Rollback"; } } - msoLogger.debug("RainyDayHandler Status Code is: " + handlingCode); + logger.debug("RainyDayHandler Status Code is: {}", handlingCode); execution.setVariable(HANDLING_CODE, handlingCode); } catch (Exception e) { String code = this.environment.getProperty(defaultCode); - msoLogger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = "+ code, e); + logger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = {}", code, e); execution.setVariable(HANDLING_CODE, code); } try{ int envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries)); execution.setVariable("maxRetries", envMaxRetries); } catch (Exception ex) { - msoLogger.error("Could not read maxRetries from config file. Setting max to 5 retries"); + logger.error("Could not read maxRetries from config file. Setting max to 5 retries"); execution.setVariable("maxRetries", 5); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java index a212668fec..79f4a07974 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -33,7 +35,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.client.exception.BBObjectNotFoundException; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import com.google.common.base.CaseFormat; @@ -41,7 +44,7 @@ import com.google.common.base.CaseFormat; @Component public class ExtractPojosForBB { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExtractPojosForBB.class); + private static final Logger logger = LoggerFactory.getLogger(ExtractPojosForBB.class); public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value) throws BBObjectNotFoundException { @@ -93,7 +96,8 @@ public class ExtractPojosForBB { } catch (BBObjectNotFoundException e) { // re-throw parent object not found throw e; } catch (Exception e) { // convert all other exceptions to object not found - msoLogger.warnSimple("BBObjectNotFoundException in ExtractPojosForBB", "BBObject " + key + " was not found in gBBInput using reference value: " + value); + logger.warn("BBObjectNotFoundException in ExtractPojosForBB", "BBObject " + key + " was not found in " + + "gBBInput using reference value: " + value); throw new BBObjectNotFoundException(key, value); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java index af7c608fee..cbedefe7eb 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -27,7 +29,8 @@ import org.onap.so.client.avpn.dmaap.beans.AsyncRequestStatus; import org.onap.so.client.avpn.dmaap.beans.InstanceReferences; import org.onap.so.client.avpn.dmaap.beans.RequestStatus; import org.onap.so.client.exception.MapperException; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -37,7 +40,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Component public class DmaapPropertiesClient { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DmaapPropertiesClient.class); + private static final Logger logger = LoggerFactory.getLogger(DmaapPropertiesClient.class); @Autowired private Provider<GlobalDmaapPublisher> dmaapPublisher; @@ -62,7 +65,7 @@ public class DmaapPropertiesClient { try { return new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(dmaapBean); } catch (JsonProcessingException e) { - msoLogger.error(e); + logger.error("Exception occurred", e); throw new MapperException(e.getMessage()); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index 459ef66e5b..d43218c584 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -27,16 +29,18 @@ import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component public class ExceptionBuilder { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExceptionBuilder.class); + private static final Logger logger = LoggerFactory.getLogger(ExceptionBuilder.class); public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception) { String msg = "Exception in %s.%s "; try{ - msoLogger.error(exception); + logger.error("Exception occurred", exception); String errorVariable = "Error%s%s"; @@ -50,11 +54,12 @@ public class ExceptionBuilder { } } - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, msg.toString()); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex){ //log trace, allow process to complete gracefully - msoLogger.error(ex); + logger.error("Exception occurred", ex); } if (exception.getMessage() != null) @@ -65,7 +70,7 @@ public class ExceptionBuilder { public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception) { String msg = "Exception in %s.%s "; try{ - msoLogger.error(exception); + logger.error("Exception occurred", exception); String errorVariable = "Error%s%s"; @@ -78,11 +83,12 @@ public class ExceptionBuilder { break; } } - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, msg.toString()); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString()); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex){ //log trace, allow process to complete gracefully - msoLogger.error(ex); + logger.error("Exception occurred", ex); } if (exception.getMessage() != null) @@ -98,13 +104,13 @@ public class ExceptionBuilder { public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { String processKey = getProcessKey(execution); - msoLogger.info("Building a WorkflowException for Subflow"); + logger.info("Building a WorkflowException for Subflow"); WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("WorkflowException", exception); execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); - msoLogger.info("Outgoing WorkflowException is " + exception); - msoLogger.info("Throwing MSOWorkflowException"); + logger.info("Outgoing WorkflowException is {}", exception); + logger.info("Throwing MSOWorkflowException"); throw new BpmnError("MSOWorkflowException"); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java index a513acc952..63e5ccbbf3 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -27,7 +29,8 @@ import org.camunda.bpm.application.PostDeploy; import org.camunda.bpm.application.PreUndeploy; import org.camunda.bpm.application.ProcessApplicationInfo; import org.camunda.bpm.engine.ProcessEngine; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -49,8 +52,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)}) public class MSOCommonApplication { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - MSOCommonApplication.class); + private static final Logger logger = LoggerFactory.getLogger(MSOCommonApplication.class); @Value("${mso.async.core-pool-size}") private int corePoolSize; @@ -78,20 +80,11 @@ public class MSOCommonApplication { @PostDeploy public void postDeploy(ProcessEngine processEngineInstance) { - long startTime = System.currentTimeMillis(); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Post deployment complete..."); } @PreUndeploy public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo, List<ProcessEngine> processEngines) { - long startTime = System.currentTimeMillis(); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Pre Undeploy complete..."); - } @Bean @@ -105,4 +98,4 @@ public class MSOCommonApplication { executor.initialize(); return executor; } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/FileUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/FileUtil.java index b6acdf7adb..6a3668b175 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/FileUtil.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/FileUtil.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -22,7 +24,8 @@ package org.onap.so.bpmn.mock; import java.io.IOException; import java.io.InputStream; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -35,7 +38,7 @@ import org.onap.so.logger.MsoLogger; */ public class FileUtil { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, FileUtil.class); + private static final Logger logger = LoggerFactory.getLogger(FileUtil.class); /** * Read the specified resource file and return the contents as a String. @@ -58,7 +61,7 @@ public class FileUtil { return ""; } } catch (IOException e) { - LOGGER.debug("Exception:", e); + logger.debug("Exception:", e); return ""; } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java index f129164b4c..11788be76e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -24,7 +26,6 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -33,6 +34,8 @@ import com.github.tomakehurst.wiremock.extension.Parameters; import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -41,7 +44,7 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; */ public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterMockTransformer.class); + private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterMockTransformer.class); private String callbackResponse; private String requestId; @@ -74,7 +77,7 @@ public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer { String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>")); callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - System.out.println("callbackResponse:" + callbackResponse); + logger.info("callbackResponse:" + callbackResponse); if (this.requestId != null) { callbackResponse = callbackResponse.replace(this.requestId, requestId); @@ -90,7 +93,7 @@ public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer { } //Kick off callback thread - System.out.println("callback Url:" + callbackUrl + ":delay:" + delay); + logger.info("callback Url:" + callbackUrl + ":delay:" + delay); CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay); calbackResponseThread.start(); @@ -128,16 +131,16 @@ public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer { //Delay sending callback response sleep(delay); } catch (InterruptedException e1) { - LOGGER.debug("Exception :",e1); + logger.debug("Exception :", e1); } - LOGGER.debug("Sending callback response:" + callbackUrl); + logger.debug("Sending callback response:" + callbackUrl); try { HttpClient client = new HttpClientFactory().newTextXmlClient( UriBuilder.fromUri(callbackUrl).build().toURL(), TargetEntity.SDNC_ADAPTER); client.post(payLoad); } catch (Exception e) { - LOGGER.debug("Exception :",e); + logger.debug("Exception :", e); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java index 832caae803..344c3b521d 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -25,7 +27,6 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -34,10 +35,12 @@ import com.github.tomakehurst.wiremock.extension.Parameters; import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterNetworkTopologyMockTransformer.class); + private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterNetworkTopologyMockTransformer.class); private String callbackResponse; private String requestId; @@ -61,22 +64,22 @@ public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitio String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>")); String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>")); - System.out.println("request callbackUrl : " + callbackUrl); - System.out.println("request requestId : " + requestId); - - System.out.println("file path/name : " + responseDefinition.getBodyFileName()); + logger.info("request callbackUrl : " + callbackUrl); + logger.info("request requestId : " + requestId); + + logger.info("file path/name : " + responseDefinition.getBodyFileName()); callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); // extract Response responseRequestId String responseRequestId = callbackResponse.substring(callbackResponse.indexOf("<RequestId>")+11, callbackResponse.indexOf("</RequestId>")); - System.out.println("response requestId: " + responseRequestId); - System.out.println("callbackResponse (before): " + callbackResponse); + logger.info("response requestId: " + responseRequestId); + logger.info("callbackResponse (before): " + callbackResponse); callbackResponse = callbackResponse.replace(responseRequestId, requestId); if (this.requestId != null) { callbackResponse = callbackResponse.replace(this.requestId, requestId); } else { callbackResponse = callbackResponse.replace(responseRequestId, requestId); } - System.out.println("callbackResponse (after):" + callbackResponse); + logger.info("callbackResponse (after):" + callbackResponse); Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay"); int delay = 300; @@ -85,7 +88,7 @@ public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitio } //Kick off callback thread - System.out.println("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay); + logger.info("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay); CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay); calbackResponseThread.start(); @@ -119,19 +122,18 @@ public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitio sleep(delay); } catch (InterruptedException e1) { // TODO Auto-generated catch block - LOGGER.debug("Exception :",e1); + logger.debug("Exception :", e1); } - LOGGER.debug("Sending callback response to url: " + callbackUrl); + logger.debug("Sending callback response to url: {}", callbackUrl); try { - HttpClient client = new HttpClientFactory().newTextXmlClient( - UriBuilder.fromUri(callbackUrl).build().toURL(), - TargetEntity.SDNC_ADAPTER); + HttpClient client = new HttpClientFactory() + .newTextXmlClient(UriBuilder.fromUri(callbackUrl).build().toURL(), TargetEntity.SDNC_ADAPTER); Response response = client.post(payLoad); - LOGGER.debug("Successfully posted callback? Status: " + response.getStatus()); + logger.debug("Successfully posted callback? Status: {}", response.getStatus()); } catch (Exception e) { // TODO Auto-generated catch block - LOGGER.debug("catch error in - request.post() "); - LOGGER.debug("Exception :",e); + logger.debug("catch error in - request.post() "); + logger.debug("Exception :", e); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java index 107a70d1d0..362d9508d3 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -25,7 +27,6 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -34,6 +35,8 @@ import com.github.tomakehurst.wiremock.extension.Parameters; import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Please describe the VnfAdapterCreateMockTransformer.java class @@ -41,7 +44,7 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; */ public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterCreateMockTransformer.class); + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateMockTransformer.class); private String notifyCallbackResponse; private String ackResponse; @@ -74,17 +77,17 @@ public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransform responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>")); updatedResponse = ackResponse.replace(responseMessageId, messageId); } catch (Exception ex) { - LOGGER.debug("Exception :",ex); + logger.debug("Exception :",ex); System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfCreateSimResponse.xml'"); responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>")); updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); } - System.out.println("response (mock) messageId : " + responseMessageId); - System.out.println("request (replacement) messageId: " + messageId); + logger.info("response (mock) messageId : {}", responseMessageId); + logger.info("request (replacement) messageId: {}", messageId); - System.out.println("vnf Response (before):" + notifyCallbackResponse); - System.out.println("vnf Response (after):" + updatedResponse); + logger.info("vnf Response (before): {}", notifyCallbackResponse); + logger.info("vnf Response (after): {}", updatedResponse); Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); int delay = 300; @@ -93,7 +96,7 @@ public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransform } //Kick off callback thread - System.out.println("VnfAdapterCreateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + logger.info("VnfAdapterCreateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay); CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); callbackResponseThread.start(); @@ -128,20 +131,19 @@ public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransform sleep(delay); } catch (InterruptedException e1) { // TODO Auto-generated catch block - LOGGER.debug("Exception :",e1); + logger.debug("Exception :",e1); } - LOGGER.debug("Sending callback response to url: " + callbackUrl); + logger.debug("Sending callback response to url: {}", callbackUrl); try { HttpClient client = new HttpClientFactory().newTextXmlClient( UriBuilder.fromUri(callbackUrl).build().toURL(), TargetEntity.VNF_ADAPTER); Response response = client.post(payLoad); - LOGGER.debug("Successfully posted callback? Status: " + response.getStatus()); - //System.err.println("Successfully posted callback:" + result.getStatus()); + logger.debug("Successfully posted callback? Status: {}", response.getStatus()); } catch (Exception e) { // TODO Auto-generated catch block - LOGGER.debug("catch error in - request.post() "); - LOGGER.debug("Exception :",e); + logger.debug("catch error in - request.post() "); + logger.debug("Exception :", e); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java index cf0f966414..b67f3dcedd 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -24,7 +26,6 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -33,6 +34,8 @@ import com.github.tomakehurst.wiremock.extension.Parameters; import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Please describe the VnfAdapterCreateMockTransformer.java class @@ -40,7 +43,7 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; */ public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterDeleteMockTransformer.class); + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteMockTransformer.class); private String notifyCallbackResponse; private String ackResponse; @@ -58,8 +61,6 @@ public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransform public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, FileSource fileSource, Parameters parameters) { - // System.err.println("notifyCallbackResponse:" + notifyCallbackResponse); - String requestBody = request.getBodyAsString(); String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>")); @@ -69,23 +70,23 @@ public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransform try { // try supplied response file (if any) - System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName()); ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); notifyCallbackResponse = ackResponse; responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>")); updatedResponse = ackResponse.replace(responseMessageId, messageId); } catch (Exception ex) { - LOGGER.debug("Exception :",ex); - System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'"); + logger.debug("Exception :",ex); + logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'"); responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>")); updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); } - System.out.println("response (mock) messageId : " + responseMessageId); - System.out.println("request (replacement) messageId: " + messageId); + logger.info("response (mock) messageId : {}", responseMessageId); + logger.info("request (replacement) messageId: {}", messageId); - System.out.println("vnf Response (before):" + notifyCallbackResponse); - System.out.println("vnf Response (after):" + updatedResponse); + logger.info("vnf Response (before):{}", notifyCallbackResponse); + logger.info("vnf Response (after):{}", updatedResponse); Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); int delay = 300; @@ -94,7 +95,7 @@ public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransform } //Kick off callback thread - System.out.println("VnfAdapterDeleteMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + logger.info("VnfAdapterDeleteMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay); CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); callbackResponseThread.start(); @@ -129,7 +130,7 @@ public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransform sleep(delay); } catch (InterruptedException e1) { // TODO Auto-generated catch block - LOGGER.debug("Exception :",e1); + logger.debug("Exception :",e1); } try { @@ -139,8 +140,8 @@ public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransform client.post(payLoad); } catch (Exception e) { // TODO Auto-generated catch block - System.out.println("catch error in - request.post() "); - LOGGER.debug("Exception :",e); + logger.info("catch error in - request.post() "); + logger.debug("Exception :",e); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java index 5eaa4e75b0..48ced35810 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -25,7 +27,6 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -34,6 +35,8 @@ import com.github.tomakehurst.wiremock.extension.Parameters; import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Please describe the VnfAdapterQueryMockTransformer.java class @@ -43,7 +46,8 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransformer{ - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterQueryMockTransformer.class); + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterQueryMockTransformer + .class); private String notifyCallbackResponse; private String ackResponse; @@ -70,36 +74,29 @@ public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransforme String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>")); String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>")); - // String updatedResponse = notifyCallbackResponse.replace("b1a82ce6-7f5c-45fd-9273-acaf88fc2137", messageId); - + String responseMessageId = ""; String updatedResponse = ""; - - // if (ackResponse == null) { - //System.err.println("file:" + responseDefinition.getBodyFileName()); - // ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - //} - try { // try supplied response file (if any) - System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName()); ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); notifyCallbackResponse = ackResponse; responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>")); updatedResponse = ackResponse.replace(responseMessageId, messageId); } catch (Exception ex) { - LOGGER.debug("Exception :",ex); - System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'"); + logger.debug("Exception :",ex); + logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'"); responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>")); updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); } - - System.out.println("response (mock) messageId : " + responseMessageId); - System.out.println("request (replacement) messageId: " + messageId); - - System.out.println("vnf Response (before):" + notifyCallbackResponse); - System.out.println("vnf Response (after):" + updatedResponse); + + logger.info("response (mock) messageId : {}", responseMessageId); + logger.info("request (replacement) messageId: {}", messageId); + + logger.info("vnf Response (before):{}", notifyCallbackResponse); + logger.info("vnf Response (after):{}", updatedResponse); Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); @@ -109,12 +106,9 @@ public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransforme } //Kick off callback thread - - //System.out.println("notficationUrl" + notficationUrl); - //System.out.println("updatedResponse" + updatedResponse); - System.out.println("VnfAdapterQueryMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + logger.info("VnfAdapterQueryMockTransformer notficationUrl: {}:delay: {}", notficationUrl, delay); CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); - System.out.println("Inside Callback" ); + logger.info("Inside Callback" ); callbackResponseThread.start(); return ResponseDefinitionBuilder @@ -145,7 +139,7 @@ public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransforme //Delay sending callback response sleep(delay); } catch (InterruptedException e1) { - LOGGER.debug("Exception :",e1); + logger.debug("Exception :",e1); } try { @@ -154,7 +148,7 @@ public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransforme TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { - LOGGER.debug("Exception :",e); + logger.debug("Exception :",e); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java index 06f2fb7d5f..edf05422d1 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -24,7 +26,6 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -33,6 +34,8 @@ import com.github.tomakehurst.wiremock.extension.Parameters; import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Please describe the VnfAdapterCreateMockTransformer.java class @@ -40,7 +43,7 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; */ public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterRollbackMockTransformer.class); + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterRollbackMockTransformer.class); private String notifyCallbackResponse; private String ackResponse; @@ -72,23 +75,23 @@ public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransfo try { // try supplied response file (if any) - System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName()); ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); notifyCallbackResponse = ackResponse; responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>")); updatedResponse = ackResponse.replace(responseMessageId, messageId); } catch (Exception ex) { - LOGGER.debug("Exception :",ex); - System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'"); + logger.debug("Exception :",ex); + logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'"); responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>")); updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); } - - System.out.println("response (mock) messageId : " + responseMessageId); - System.out.println("request (replacement) messageId: " + messageId); - - System.out.println("vnf Response (before):" + notifyCallbackResponse); - System.out.println("vnf Response (after):" + updatedResponse); + + logger.info("response (mock) messageId : {}", responseMessageId); + logger.info("request (replacement) messageId: {}", messageId); + + logger.info("vnf Response (before):{}", notifyCallbackResponse); + logger.info("vnf Response (after):{}", updatedResponse); Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); int delay = 300; @@ -97,7 +100,7 @@ public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransfo } //Kick off callback thread - System.out.println("VnfAdapterRollbackMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + logger.info("VnfAdapterRollbackMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay); CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); callbackResponseThread.start(); @@ -130,7 +133,7 @@ public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransfo //Delay sending callback response sleep(delay); } catch (InterruptedException e1) { - LOGGER.debug("Exception :",e1); + logger.debug("Exception :",e1); } try { @@ -139,8 +142,8 @@ public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransfo TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { - System.out.println("catch error in - request.post() "); - LOGGER.debug("Exception :",e); + logger.info("catch error in - request.post() "); + logger.debug("Exception :", e); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java index 9e60e87644..5693877574 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -24,7 +26,6 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -33,6 +34,8 @@ import com.github.tomakehurst.wiremock.extension.Parameters; import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; import com.github.tomakehurst.wiremock.http.Request; import com.github.tomakehurst.wiremock.http.ResponseDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Please describe the VnfAdapterUpdateMockTransformer.java class @@ -40,7 +43,7 @@ import com.github.tomakehurst.wiremock.http.ResponseDefinition; */ public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransformer { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterUpdateMockTransformer.class); + private static final Logger logger = LoggerFactory.getLogger(VnfAdapterUpdateMockTransformer.class); private String notifyCallbackResponse; private String requestId; @@ -72,23 +75,23 @@ public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransform try { // try supplied response file (if any) - System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName()); ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); notifyCallbackResponse = ackResponse; responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>")); updatedResponse = ackResponse.replace(responseMessageId, messageId); } catch (Exception ex) { - LOGGER.debug("Exception :",ex); - System.out.println(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'"); + logger.debug("Exception :",ex); + logger.info(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'"); responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>")); updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); } - - System.out.println("response (mock) messageId : " + responseMessageId); - System.out.println("request (replacement) messageId: " + messageId); - - System.out.println("vnf Response (before):" + notifyCallbackResponse); - System.out.println("vnf Response (after):" + updatedResponse); + + logger.info("response (mock) messageId : {}", responseMessageId); + logger.info("request (replacement) messageId: {}", messageId); + + logger.info("vnf Response (before):{}", notifyCallbackResponse); + logger.info("vnf Response (after):{}", updatedResponse); Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); int delay = 300; @@ -97,7 +100,7 @@ public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransform } //Kick off callback thread - System.out.println("VnfAdapterUpdateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + logger.info("VnfAdapterUpdateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay); CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); callbackResponseThread.start(); @@ -130,7 +133,7 @@ public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransform //Delay sending callback response sleep(delay); } catch (InterruptedException e1) { - LOGGER.debug("Exception :", e1); + logger.debug("Exception :", e1); } try { @@ -139,8 +142,8 @@ public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransform TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { - System.out.println("catch error in - request.post() "); - LOGGER.debug("Exception :",e); + logger.info("catch error in - request.post() "); + logger.debug("Exception :", e); } } |