Fix for SONAR critical issues
Issue-Id : SO-117
Change-Id: Icdc64605b475e20af7e871135af327f7d0e38792
Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml
index 24c881d..89e5ce2 100644
--- a/bpmn/MSOCommonBPMN/pom.xml
+++ b/bpmn/MSOCommonBPMN/pom.xml
@@ -359,6 +359,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.openecomp.so</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0</version>
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java
index 5394ba9..e938a25 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +22,10 @@
package org.openecomp.mso.bpmn.common.util;
import java.security.GeneralSecurityException;
+import org.openecomp.mso.logger.MsoLogger;
public class CryptoHandler implements ICryptoHandler {
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
private static String msoKey = "aa3871669d893c7fb8abbcda31b88b4f";
//private static String msoAaiPwd = "mso0206";
@@ -32,6 +35,7 @@
try {
return CryptoUtils.decrypt(msoAaiEncryptedPwd, msoKey);
} catch (GeneralSecurityException e) {
+ LOGGER.debug("GeneralSecurityException :",e);
return null;
}
}
@@ -41,6 +45,7 @@
try {
return CryptoUtils.encrypt(plainMsoPwd, msoKey);
} catch (GeneralSecurityException e) {
+ LOGGER.debug("GeneralSecurityException :",e);
return null;
}
}
@@ -50,6 +55,7 @@
try {
return CryptoUtils.decrypt(encryptedPwd, msoKey);
} catch (GeneralSecurityException e) {
+ LOGGER.debug("GeneralSecurityException :",e);
return null;
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java
index 49e42ac..a4a8859 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java
@@ -76,6 +76,7 @@
logCallbackSuccess(method, startTime);
return new CallbackSuccess();
} catch (Exception e) {
+ LOGGER.debug("Exception :",e);
String msg = "Caught " + e.getClass().getSimpleName()
+ " processing " + messageEventName + " with " + correlationVariable
+ " = '" + correlationValue + "'";
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java
index 7db4e76..7a53721 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -183,8 +184,7 @@
workflowResponse.setMessageCode(500);
return Response.status(500).entity(workflowResponse).build();
} catch (Exception ex) {
- msoLogger.debug(LOGMARKER + "Exception in startProcessInstance by key");
- ex.printStackTrace();
+ msoLogger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex);
workflowResponse.setMessage("Fail" );
workflowResponse.setResponse("Error occurred while executing the process: " + ex.getMessage());
if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId());
@@ -258,6 +258,7 @@
try {
return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ;
} catch (Exception e) {
+ msoLogger.debug("Exception :",e);
return true;
}
}
@@ -601,7 +602,7 @@
+ processKey
+ " with response: "
+ response.getResponse());
-
+ msoLogger.debug("Exception :",ex);
}
msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java
index aba43eb..74bb59c 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java
@@ -5,12 +5,14 @@
import java.sql.PreparedStatement;
import java.sql.SQLException;
+import org.openecomp.mso.logger.MsoLogger;
+
/**
* Sets up the unit test (H2) database for Camunda.
*/
public class CamundaDBSetup {
private static boolean isDBConfigured = false;
-
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
public static synchronized void configure() throws SQLException {
if (isDBConfigured) {
return;
@@ -66,13 +68,13 @@
isDBConfigured = true;
} catch (SQLException e) {
System.out.println("CamundaDBSetup caught " + e.getClass().getSimpleName());
- e.printStackTrace();
+ LOGGER.debug("SQLException :",e);
} finally {
if (stmt != null) {
try {
stmt.close();
} catch (Exception e) {
- // Ignore
+ LOGGER.debug("Exception :",e);
}
}
@@ -80,7 +82,7 @@
try {
connection.close();
} catch (Exception e) {
- // Ignore
+ LOGGER.debug("Exception :",e);
}
}
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java
index eb1cd51..55f6221 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -200,6 +201,7 @@
UUID uuid = UUID.fromString(id);
return uuid.toString().equalsIgnoreCase(id);
} catch (IllegalArgumentException iae) {
+ msoLogger.debug("IllegalArgumentException :",iae);
return false;
}
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java
index 9d3af1c..70f67a5 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -167,7 +168,7 @@
fileWatcherThread.join(waitInSeconds * 1000);
} catch (InterruptedException e) {
LOGGER.debug("FileWatcherThread " + System.identityHashCode(fileWatcherThread)
- + " shutdown did not occur within " + waitInSeconds + " seconds");
+ + " shutdown did not occur within " + waitInSeconds + " seconds",e);
}
LOGGER.debug("Finished shutting down FileWatcherThread " + System.identityHashCode(fileWatcherThread));
@@ -257,7 +258,7 @@
reader.close();
LOGGER.debug("Closed " + fileName);
} catch (Exception e) {
- // Ignore
+ LOGGER.debug("Exception :",e);
}
}
}
@@ -351,12 +352,14 @@
}
}
} catch (InterruptedException e) {
+ LOGGER.debug("InterruptedException :",e);
break;
} catch (ClosedWatchServiceException e) {
LOGGER.info(
MessageEnum.BPMN_GENERAL_INFO,
"BPMN",
"FileWatcherThread shut down because the watch service was closed");
+ LOGGER.debug("ClosedWatchServiceException :",e);
break;
} catch (Exception e) {
LOGGER.error(
@@ -379,7 +382,7 @@
watchService.close();
} catch (IOException e) {
LOGGER.debug("FileWatcherThread caught " + e.getClass().getSimpleName()
- + " while closing the watch service");
+ + " while closing the watch service",e);
}
LOGGER.info(MessageEnum.BPMN_GENERAL_INFO, "BPMN",
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java
index f58efe7..ecdc1bf 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java
@@ -11,6 +11,8 @@
import java.util.Map;
import java.util.Properties;
+import org.openecomp.mso.logger.MsoLogger;
+
import org.openecomp.mso.bpmn.core.PropertyConfiguration;
/**
@@ -22,6 +24,8 @@
private static Path bpmnPropertiesPath = null;
private static Path bpmnUrnPropertiesPath = null;
private static boolean modifiedConfiguration = false;
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
/**
* Ensures that the the PropertyConfiguration is initialized and that the
@@ -232,7 +236,7 @@
try {
fileReader.close();
} catch (IOException e) {
- // Ignore
+ LOGGER.debug("Exception :",e);
}
}
@@ -240,7 +244,7 @@
try {
outputStream.close();
} catch (IOException e) {
- // Ignore
+ LOGGER.debug("Exception :",e);
}
}
}
@@ -279,7 +283,7 @@
try {
fileReader.close();
} catch (IOException e) {
- // Ignore
+ LOGGER.debug("Exception :",e);
}
}
@@ -287,7 +291,7 @@
try {
outputStream.close();
} catch (IOException e) {
- // Ignore
+ LOGGER.debug("Exception :",e);
}
}
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java
index 10e52d1..dc87304 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java
@@ -16,7 +16,7 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-
+import org.openecomp.mso.logger.MsoLogger;
//import org.codehaus.jackson.map.SerializationConfig.Feature;
@@ -29,6 +29,7 @@
@JsonInclude(Include.NON_NULL)
public abstract class JsonWrapper implements Serializable {
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
@JsonInclude(Include.NON_NULL)
public String toJsonString(){
@@ -54,7 +55,7 @@
// }
} catch (Exception e){
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
return jsonString;
}
@@ -72,17 +73,13 @@
try {
json = new JSONObject(mapper.writeValueAsString(this));
} catch (JsonGenerationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
} catch (JsonMappingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
} catch (JSONException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
} catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
return json;
}
@@ -95,14 +92,11 @@
try {
jsonString = mapper.writeValueAsString(list);
} catch (JsonGenerationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
} catch (JsonMappingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
} catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
return jsonString;
}
@@ -120,7 +114,7 @@
jsonString = ow.writeValueAsString(this);
} catch (Exception e){
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
return jsonString;
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java
index 32c4776..738ec49 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/DecomposeJsonUtil.java
@@ -14,8 +14,10 @@
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.openecomp.mso.logger.MsoLogger;
+
public class DecomposeJsonUtil implements Serializable {
-
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
/**
*
*/
@@ -40,14 +42,11 @@
try {
serviceDecomposition = om.readValue(jsonString, ServiceDecomposition.class);
} catch (JsonParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("JsonParseException :",e);
} catch (JsonMappingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("JsonMappingException :",e);
} catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("IOException :",e);
}
return serviceDecomposition;
@@ -72,14 +71,11 @@
try {
vnfResource = om.readValue(jsonString, VnfResource.class);
} catch (JsonParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("JsonParseException :",e);
} catch (JsonMappingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("JsonMappingException :",e);
} catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("IOException :",e);
}
return vnfResource;
}
@@ -103,14 +99,11 @@
try {
networkResource = om.readValue(jsonString, NetworkResource.class);
} catch (JsonParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
} catch (JsonMappingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
} catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
return networkResource;
}
@@ -134,14 +127,11 @@
try {
allottedResource = om.readValue(jsonString, AllottedResource.class);
} catch (JsonParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
} catch (JsonMappingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
} catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
return allottedResource;
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
index f7f6264..54a5732 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -67,7 +68,7 @@
return jsonObj.toString(MSOJsonIndentFactor);
}
} catch (Exception e){
- msoLogger.debug("xml2json(): unable to parse xml and convert to json. Exception was: " + e.toString());
+ msoLogger.debug("xml2json(): unable to parse xml and convert to json. Exception was: " + e.toString(), e);
return null;
}
}
@@ -106,7 +107,7 @@
return toXMLString(jsonObj, null);
}
} catch (Exception e){
- msoLogger.debug("json2xml(): unable to parse json and convert to xml. Exception was: " + e.toString());
+ msoLogger.debug("json2xml(): unable to parse json and convert to xml. Exception was: " + e.toString(), e);
return null;
}
}
@@ -264,7 +265,7 @@
JSONObject jsonObj = new JSONObject(jsonStr);
return jsonObj.toString(MSOJsonIndentFactor);
} catch (Exception e){
- msoLogger.debug("prettyJson(): unable to parse/format json input. Exception was: " + e.toString());
+ msoLogger.debug("prettyJson(): unable to parse/format json input. Exception was: " + e.toString(), e);
return null;
}
}
@@ -334,7 +335,7 @@
}
}
} catch (Exception e) {
- msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString());
+ msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e);
}
return null;
}
@@ -363,7 +364,7 @@
}
}
} catch (Exception e) {
- msoLogger.debug("getJsonNodeValue(): unable to parse json to retrieve node for field=" + keys + ". Exception was: " + e.toString());
+ msoLogger.debug("getJsonNodeValue(): unable to parse json to retrieve node for field=" + keys + ". Exception was: " + e.toString(), e);
}
return null;
}
@@ -395,7 +396,7 @@
}
}
} catch (Exception e) {
- msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString());
+ msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e);
}
return 0;
}
@@ -424,7 +425,7 @@
}
}
} catch (Exception e) {
- msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString());
+ msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e);
}
return false;
}
@@ -500,9 +501,9 @@
}
} catch (JSONException je) {
// JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("getJsonParamValue(): caught JSONException attempting to retrieve param value for keys:" + keys + ", name=" + name);
+ msoLogger.debug("getJsonParamValue(): caught JSONException attempting to retrieve param value for keys:" + keys + ", name=" + name, je);
} catch (Exception e) {
- msoLogger.debug("getJsonParamValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString());
+ msoLogger.debug("getJsonParamValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(), e);
}
return null;
}
@@ -523,7 +524,7 @@
return getJsonValueForKey(jsonObj, key);
}
} catch (Exception e) {
- msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString());
+ msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(), e);
}
return null;
}
@@ -567,10 +568,10 @@
}
} catch (JSONException je) {
// JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("getJsonValueForKey(): caught JSONException attempting to retrieve value for key=" + key);
+ msoLogger.debug("getJsonValueForKey(): caught JSONException attempting to retrieve value for key=" + key, je);
keyValue = null;
} catch (Exception e) {
- msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString());
+ msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(), e);
}
return keyValue;
}
@@ -610,10 +611,10 @@
}
} catch (JSONException je) {
// JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("getJsonValueForKey(): caught JSONException attempting to retrieve value for key=" + key);
+ msoLogger.debug("getJsonValueForKey(): caught JSONException attempting to retrieve value for key=" + key, je);
keyValue = null;
} catch (Exception e) {
- msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString());
+ msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e);
}
return keyValue;
}
@@ -653,10 +654,10 @@
}
} catch (JSONException je) {
// JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("getJsonBooleanValueForKey(): caught JSONException attempting to retrieve value for key=" + key);
+ msoLogger.debug("getJsonBooleanValueForKey(): caught JSONException attempting to retrieve value for key=" + key,je);
keyValue = null;
} catch (Exception e) {
- msoLogger.debug("getJsonBooleanValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString());
+ msoLogger.debug("getJsonBooleanValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString(),e);
}
return keyValue;
}
@@ -800,9 +801,9 @@
} catch (JSONException je) {
// JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("getJsonRawValue(): caught JSONException attempting to retrieve raw value for key=" + keyStr);
+ msoLogger.debug("getJsonRawValue(): caught JSONException attempting to retrieve raw value for key=" + keyStr,je);
} catch (Exception e) {
- msoLogger.debug("getJsonRawValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString());
+ msoLogger.debug("getJsonRawValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString(),e);
}
return null;
}
@@ -842,10 +843,10 @@
} catch (JSONException je) {
// JSONObject::get() throws this exception if one of the specified keys is not found
- msoLogger.debug("putJsonValue(): caught JSONException attempting to retrieve value for key=" + keyStr);
+ msoLogger.debug("putJsonValue(): caught JSONException attempting to retrieve value for key=" + keyStr,je);
return null;
} catch (Exception e) {
- msoLogger.debug("putJsonValue(): unable to parse json to put value for key=" + keys + ". Exception was: " + e.toString());
+ msoLogger.debug("putJsonValue(): unable to parse json to put value for key=" + keys + ". Exception was: " + e.toString(),e);
}
return null;
}
@@ -961,7 +962,7 @@
return true;
}
} catch (Exception e) {
- msoLogger.debug("jsonElementExist(): unable to determine if json element exist. Exception is: " + e.toString());
+ msoLogger.debug("jsonElementExist(): unable to determine if json element exist. Exception is: " + e.toString(),e);
}
return true;
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java
index 8898f27..ac514b9 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java
@@ -15,12 +15,15 @@
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.SerializationFeature;
+import org.openecomp.mso.logger.MsoLogger;
+
@JsonInclude(Include.NON_NULL)
public abstract class JsonWrapper implements Serializable {
private static final long serialVersionUID = 8633550139273639875L;
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
@JsonInclude(Include.NON_NULL)
public String toJsonString(){
@@ -45,7 +48,7 @@
// }
} catch (Exception e){
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
return jsonString;
}
@@ -63,17 +66,13 @@
try {
json = new JSONObject(mapper.writeValueAsString(this));
} catch (JsonGenerationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
} catch (JsonMappingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
} catch (JSONException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
} catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
return json;
}
@@ -86,14 +85,11 @@
try {
jsonString = mapper.writeValueAsString(list);
} catch (JsonGenerationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
} catch (JsonMappingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
} catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
return jsonString;
}
@@ -111,7 +107,7 @@
jsonString = ow.writeValueAsString(this);
} catch (Exception e){
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
return jsonString;
}
diff --git a/bpmn/MSOMockServer/pom.xml b/bpmn/MSOMockServer/pom.xml
index 34f7a23..500535d 100644
--- a/bpmn/MSOMockServer/pom.xml
+++ b/bpmn/MSOMockServer/pom.xml
@@ -76,6 +76,11 @@
</exclusions>
</dependency>
<dependency>
+ <groupId>org.openecomp.so</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0</version>
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java
index 33a65e6..1f17a8b 100644
--- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java
+++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java
@@ -2,7 +2,8 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
+import org.openecomp.mso.logger.MsoLogger;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.common.FileSource;
@@ -29,6 +31,7 @@
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+import org.openecomp.mso.logger.MsoLogger;
/**
*
* Simulates SDNC Adapter Callback response
@@ -36,6 +39,7 @@
*/
public class SDNCAdapterMockTransformer extends ResponseTransformer {
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
private String callbackResponse;
private String requestId;
@@ -121,8 +125,7 @@
//Delay sending callback response
sleep(delay);
} catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
+ LOGGER.debug("Exception :",e1);
}
System.out.println("Sending callback response:" + callbackUrl);
ClientRequest request = new ClientRequest(callbackUrl);
@@ -132,8 +135,7 @@
ClientResponse result = request.post();
//System.err.println("Successfully posted callback:" + result.getStatus());
} catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
index 673ac00..b782c05 100644
--- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
+++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
@@ -2,7 +2,8 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,8 +30,12 @@
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+import org.openecomp.mso.logger.MsoLogger;
+
public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseTransformer {
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
private String callbackResponse;
private String requestId;
@@ -110,7 +115,7 @@
sleep(delay);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
- e1.printStackTrace();
+ LOGGER.debug("Exception :",e1);
}
System.out.println("Sending callback response to url: " + callbackUrl);
ClientRequest request = new ClientRequest(callbackUrl);
@@ -122,7 +127,7 @@
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("catch error in - request.post() ");
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java
index 1e32077..ebedca8 100644
--- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java
+++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java
@@ -6,6 +6,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +28,7 @@
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
+import org.openecomp.mso.logger.MsoLogger;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.common.FileSource;
@@ -34,12 +36,15 @@
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+import org.openecomp.mso.logger.MsoLogger;
/**
* Please describe the VnfAdapterCreateMockTransformer.java class
*
*/
public class VnfAdapterCreateMockTransformer extends ResponseTransformer {
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
private String notifyCallbackResponse;
private String ackResponse;
@@ -71,6 +76,7 @@
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/vnfCreateSimResponse.xml'");
responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
@@ -124,7 +130,7 @@
sleep(delay);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
- e1.printStackTrace();
+ LOGGER.debug("Exception :",e1);
}
System.out.println("Sending callback response to url: " + callbackUrl);
ClientRequest request = new ClientRequest(callbackUrl);
@@ -138,7 +144,7 @@
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("catch error in - request.post() ");
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java
index 553aed6..b2c25fc 100644
--- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java
+++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java
@@ -6,6 +6,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,19 +26,20 @@
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
+import org.openecomp.mso.logger.MsoLogger;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.common.FileSource;
import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-
/**
* Please describe the VnfAdapterCreateMockTransformer.java class
*
*/
public class VnfAdapterDeleteMockTransformer extends ResponseTransformer {
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
private String notifyCallbackResponse;
private String ackResponse;
@@ -72,6 +74,7 @@
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'");
responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
@@ -125,7 +128,7 @@
sleep(delay);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
- e1.printStackTrace();
+ LOGGER.debug("Exception :",e1);
}
System.out.println("Sending callback response to url: " + callbackUrl);
ClientRequest request = new ClientRequest(callbackUrl);
@@ -138,7 +141,7 @@
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("catch error in - request.post() ");
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java
index c1d27d5..5aae339 100644
--- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java
+++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java
@@ -2,7 +2,8 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +26,7 @@
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
+import org.openecomp.mso.logger.MsoLogger;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.common.FileSource;
@@ -32,6 +34,7 @@
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+import org.openecomp.mso.logger.MsoLogger;
/**
* Please describe the VnfAdapterQueryMockTransformer.java class
*
@@ -40,6 +43,8 @@
public class VnfAdapterQueryMockTransformer extends ResponseTransformer{
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
private String notifyCallbackResponse;
private String ackResponse;
private String messageId;
@@ -84,6 +89,7 @@
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'");
responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
@@ -139,8 +145,7 @@
//Delay sending callback response
sleep(delay);
} catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
+ LOGGER.debug("Exception :",e1);
}
ClientRequest request = new ClientRequest(callbackUrl);
request.body("text/xml", payLoad);
@@ -149,8 +154,7 @@
ClientResponse result = request.post();
//System.err.println("Successfully posted callback:" + result.getStatus());
} catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java
index 5207fa0..45a67de 100644
--- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java
+++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java
@@ -5,7 +5,8 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,12 +33,15 @@
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+import org.openecomp.mso.logger.MsoLogger;
/**
* Please describe the VnfAdapterCreateMockTransformer.java class
*
*/
public class VnfAdapterRollbackMockTransformer extends ResponseTransformer {
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
private String notifyCallbackResponse;
private String ackResponse;
private String messageId;
@@ -74,6 +78,7 @@
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'");
responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
@@ -125,8 +130,7 @@
//Delay sending callback response
sleep(delay);
} catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
+ LOGGER.debug("Exception :",e1);
}
System.out.println("Sending callback response to url: " + callbackUrl);
ClientRequest request = new ClientRequest(callbackUrl);
@@ -137,9 +141,8 @@
System.out.println("Successfully posted callback? Status: " + result.getStatus());
//System.err.println("Successfully posted callback:" + result.getStatus());
} catch (Exception e) {
- // TODO Auto-generated catch block
System.out.println("catch error in - request.post() ");
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
}
diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java
index e84e57c..d67ffcd 100644
--- a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java
+++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java
@@ -5,7 +5,8 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +26,7 @@
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
+import org.openecomp.mso.logger.MsoLogger;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.common.FileSource;
@@ -32,12 +34,15 @@
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
+import org.openecomp.mso.logger.MsoLogger;
/**
* Please describe the VnfAdapterUpdateMockTransformer.java class
*
*/
public class VnfAdapterUpdateMockTransformer extends ResponseTransformer {
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
private String notifyCallbackResponse;
private String requestId;
private String ackResponse;
@@ -74,6 +79,7 @@
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'");
responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
@@ -125,8 +131,7 @@
//Delay sending callback response
sleep(delay);
} catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
+ LOGGER.debug("Exception :", e1);
}
System.out.println("Sending callback response to url: " + callbackUrl);
ClientRequest request = new ClientRequest(callbackUrl);
@@ -137,9 +142,8 @@
System.out.println("Successfully posted callback? Status: " + result.getStatus());
//System.err.println("Successfully posted callback:" + result.getStatus());
} catch (Exception e) {
- // TODO Auto-generated catch block
System.out.println("catch error in - request.post() ");
- e.printStackTrace();
+ LOGGER.debug("Exception :",e);
}
}
diff --git a/bpmn/MSORESTClient/pom.xml b/bpmn/MSORESTClient/pom.xml
index b042a9e..1bcb3b7 100644
--- a/bpmn/MSORESTClient/pom.xml
+++ b/bpmn/MSORESTClient/pom.xml
@@ -35,6 +35,11 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.openecomp.so</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
<finalName>MSORESTClient</finalName>
diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java
index 259f3d4..6504615 100644
--- a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java
+++ b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,6 +55,7 @@
import org.apache.http.message.AbstractHttpMessage;
import org.apache.http.util.EntityUtils;
+import org.openecomp.mso.logger.MsoLogger;
/**
* Client used to send RESTFul requests.
* <p>
@@ -82,6 +84,8 @@
* @since 1.0
*/
public class RESTClient {
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
private final String proxyHost;
private final int proxyPort;
@@ -166,8 +170,7 @@
}
}
} catch (UnsupportedEncodingException e) {
- // should not occur
- e.printStackTrace();
+ LOGGER.debug("Exception :", e);
}
return sb.toString();
}
@@ -197,6 +200,7 @@
clientBuilder = HttpClientBuilder.create().setConnectionManager(
manager);
} catch (Exception ex) {
+ LOGGER.debug("Exception :", ex);
throw new RESTException(ex.getMessage());
}
clientBuilder.disableRedirectHandling();