diff options
author | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2018-09-20 11:04:00 -0400 |
---|---|---|
committer | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2018-09-20 11:08:27 -0400 |
commit | c4347b25ddf03c4f8e25b9443e0e25be102d0ba6 (patch) | |
tree | 50602a362db32978814e185d84227634418215b1 /mso-api-handlers/mso-api-handler-common/src/main/java/org | |
parent | 19659e205ef636cec767e32a62cc549cf9156d5b (diff) |
Update Logging
Update logging to meet Casablanca Spec
Change-Id: I029d6c63765992d6f091d96e2b4c34c60d30c484
Issue-ID: SO-947
Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-common/src/main/java/org')
-rw-r--r-- | mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java index e9062effad..3ebad8b02c 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java @@ -24,6 +24,7 @@ package org.onap.so.apihandler.common; import java.io.IOException; +import java.util.UUID; import javax.xml.bind.DatatypeConverter; @@ -32,6 +33,7 @@ import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.apihandler.camundabeans.CamundaBooleanInput; import org.onap.so.apihandler.camundabeans.CamundaInput; import org.onap.so.apihandler.camundabeans.CamundaIntegerInput; @@ -39,6 +41,7 @@ import org.onap.so.apihandler.camundabeans.CamundaRequest; import org.onap.so.apihandler.camundabeans.CamundaVIDRequest; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.MDC; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -63,6 +66,22 @@ public class CamundaClient extends RequestClient{ StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); msoLogger.info("Camunda Request Content: " + jsonReq); + + + post.setEntity(input); + setupHeaders(post); + + HttpResponse response = client.execute(post); + msoLogger.debug("Response is: " + response); + + return response; + } + + + private void setupHeaders(HttpPost post) { + post.addHeader(ONAPLogConstants.Headers.REQUEST_ID, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)); + post.addHeader(ONAPLogConstants.Headers.INVOCATION_ID, UUID.randomUUID().toString()); + String encryptedCredentials = null; if(props!=null){ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH); @@ -73,12 +92,6 @@ public class CamundaClient extends RequestClient{ } } } - - post.setEntity(input); - HttpResponse response = client.execute(post); - msoLogger.debug("Response is: " + response); - - return response; } @Override @@ -86,10 +99,10 @@ public class CamundaClient extends RequestClient{ throws ClientProtocolException, IOException{ HttpPost post = new HttpPost(url); msoLogger.debug(CAMUNDA_URL_MESAGE + url); - //String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion); StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); + setupHeaders(post); String encryptedCredentials = null; if(props!=null){ @@ -102,6 +115,7 @@ public class CamundaClient extends RequestClient{ } } + post.setEntity(input); HttpResponse response = client.execute(post); msoLogger.debug("Response is: " + response); @@ -120,6 +134,9 @@ public class CamundaClient extends RequestClient{ StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); + + setupHeaders(post); + String encryptedCredentials = null; if(props!=null){ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH); |