aboutsummaryrefslogtreecommitdiffstats
path: root/cloudify-client/src/main/java/org/onap
diff options
context:
space:
mode:
authorr.bogacki <r.bogacki@samsung.com>2019-02-27 13:09:08 +0100
committerr.bogacki <r.bogacki@samsung.com>2019-02-27 13:09:33 +0100
commitc686712949dd7200ad1b4d9c41f1deb298f40d49 (patch)
tree967dbcd11eaf6ffbbdc08282651eec5c450231b6 /cloudify-client/src/main/java/org/onap
parentdee52db16fa7d9ead3f98bfd18bfd1d747f3553b (diff)
Removed MsoLogger from 'cloudify-client'
Removed MsoLogger from adapters ('cloudify-client') Replaced MsoLogger with plain slf4j. Refactored login output. Fixed imports. Change-Id: I3d1f31a1ec8250772290383c23e65a0d5cc575a0 Issue-ID: LOG-631 Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
Diffstat (limited to 'cloudify-client/src/main/java/org/onap')
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java16
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java17
2 files changed, 20 insertions, 13 deletions
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java
index 2595ddcbcd..247afb3124 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.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
@@ -53,7 +55,6 @@ import org.onap.so.cloudify.base.client.CloudifyConnectException;
import org.onap.so.cloudify.base.client.CloudifyRequest;
import org.onap.so.cloudify.base.client.CloudifyResponse;
import org.onap.so.cloudify.base.client.CloudifyResponseException;
-import org.onap.so.logger.MsoLogger;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -61,13 +62,15 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class HttpClientConnector implements CloudifyClientConnector {
private static ObjectMapper DEFAULT_MAPPER;
private static ObjectMapper WRAPPED_MAPPER;
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, HttpClientConnector.class);
+ private static Logger logger = LoggerFactory.getLogger(HttpClientConnector.class);
static {
DEFAULT_MAPPER = new ObjectMapper();
@@ -141,7 +144,8 @@ public class HttpClientConnector implements CloudifyClientConnector {
String entityJson = mapper.writeValueAsString (request.entity().getEntity());
entity = new StringEntity(entityJson, ContentType.create(request.entity().getContentType()));
- LOGGER.debug ("Request JSON Body: " + entityJson.replaceAll("\"password\":\"[^\"]*\"", "\"password\":\"***\""));
+ logger.debug ("Request JSON Body: {}", entityJson.replaceAll("\"password\":\"[^\"]*\"",
+ "\"password\":\"***\""));
} catch (JsonProcessingException e) {
throw new HttpClientException ("Json processing error on request entity", e);
@@ -198,7 +202,7 @@ public class HttpClientConnector implements CloudifyClientConnector {
try {
httpResponse = httpClient.execute(httpRequest);
- LOGGER.debug ("Response status: " + httpResponse.getStatusLine().getStatusCode());
+ logger.debug ("Response status: {}", httpResponse.getStatusLine().getStatusCode());
httpClientResponse = new HttpClientResponse (httpResponse);
@@ -223,7 +227,7 @@ public class HttpClientConnector implements CloudifyClientConnector {
}
catch (Exception e) {
// Catchall for anything else, must throw as a RuntimeException
- LOGGER.error("Client exception", e);
+ logger.error("Client exception", e);
throw new RuntimeException("Unexpected client exception", e);
}
finally {
@@ -232,7 +236,7 @@ public class HttpClientConnector implements CloudifyClientConnector {
try {
httpResponse.close();
} catch (IOException e) {
- LOGGER.debug("Unable to close HTTP Response: " + e);
+ logger.debug("Unable to close HTTP Response: " + e);
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java
index 0c1743fc5f..b9e7851c98 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.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,8 @@ import org.apache.http.HttpResponse;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.onap.so.cloudify.base.client.CloudifyResponse;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -36,7 +39,7 @@ import java.util.Map;
public class HttpClientResponse implements CloudifyResponse {
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, HttpClientResponse.class);
+ private static Logger logger = LoggerFactory.getLogger(HttpClientResponse.class);
private HttpResponse response = null;
private String entityBody = null;
@@ -47,9 +50,9 @@ public class HttpClientResponse implements CloudifyResponse {
// Read the body so InputStream can be closed
if (response.getEntity() == null) {
- // No body
- LOGGER.debug ("No Response Body");
- return;
+ // No body
+ logger.debug("No Response Body");
+ return;
}
ByteArrayOutputStream responseBody = new ByteArrayOutputStream();
@@ -59,7 +62,7 @@ public class HttpClientResponse implements CloudifyResponse {
throw new HttpClientException ("Error Reading Response Body", e);
}
entityBody = responseBody.toString();
- LOGGER.debug (entityBody);
+ logger.debug(entityBody);
}
@@ -94,7 +97,7 @@ public class HttpClientResponse implements CloudifyResponse {
@Override
public Map<String, String> headers() {
- Map<String, String> headers = new HashMap<String, String>();
+ Map<String, String> headers = new HashMap<>();
Header responseHeaders[] = response.getAllHeaders();
for (Header h : responseHeaders) {