Changed the text xml client to always set the 66/106766/2
authorBoslet, Cory <cory.boslet@att.com>
Tue, 28 Apr 2020 19:23:02 +0000 (15:23 -0400)
committerBenjamin, Max (mb388a) <mb388a@att.com>
Tue, 28 Apr 2020 19:35:03 +0000 (15:35 -0400)
Changed the text xml client to always set the accept type to text xml.
Forgot to assign the accept type in rest client

Issue-ID: SO-2838
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: Ia86e53327c6e126fcee6a15b5cd3e5f5c4ec9390

common/src/main/java/org/onap/so/client/HttpClient.java
common/src/main/java/org/onap/so/client/HttpClientFactory.java
common/src/main/java/org/onap/so/client/RestClient.java

index 63a4b1c..eaeb0ab 100644 (file)
@@ -24,22 +24,27 @@ import java.net.URL;
 import java.util.Map;
 import java.util.Optional;
 import static org.apache.commons.lang3.StringUtils.*;
-import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.logging.filter.base.ONAPComponentsList;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class HttpClient extends RestClient {
 
     protected final Logger log = LoggerFactory.getLogger(HttpClient.class);
-    private ONAPComponents targetEntity;
+    private ONAPComponentsList targetEntity;
 
-    HttpClient(URL host, String contentType, ONAPComponents targetEntity) {
+    HttpClient(URL host, String contentType, ONAPComponentsList targetEntity) {
         super(host, contentType);
         this.targetEntity = targetEntity;
     }
 
+    HttpClient(URL host, String acceptType, String contentType, ONAPComponentsList targetEntity) {
+        super(host, acceptType, contentType);
+        this.targetEntity = targetEntity;
+    }
+
     @Override
-    public ONAPComponents getTargetEntity() {
+    public ONAPComponentsList getTargetEntity() {
         return targetEntity;
     }
 
index 3a8a9ee..84a8bb9 100644 (file)
@@ -21,19 +21,19 @@ package org.onap.so.client;
 
 import java.net.URL;
 import javax.ws.rs.core.MediaType;
-import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.logging.filter.base.ONAPComponentsList;
 
 public class HttpClientFactory {
 
-    public HttpClient newJsonClient(URL host, ONAPComponents targetEntity) {
+    public HttpClient newJsonClient(URL host, ONAPComponentsList targetEntity) {
         return new HttpClient(host, MediaType.APPLICATION_JSON, targetEntity);
     }
 
-    public HttpClient newXmlClient(URL host, ONAPComponents targetEntity) {
+    public HttpClient newXmlClient(URL host, ONAPComponentsList targetEntity) {
         return new HttpClient(host, MediaType.APPLICATION_XML, targetEntity);
     }
 
-    public HttpClient newTextXmlClient(URL host, ONAPComponents targetEntity) {
-        return new HttpClient(host, MediaType.TEXT_XML, targetEntity);
+    public HttpClient newTextXmlClient(URL host, ONAPComponentsList targetEntity) {
+        return new HttpClient(host, MediaType.TEXT_XML, MediaType.TEXT_XML, targetEntity);
     }
 }
index 30389de..ece1333 100644 (file)
@@ -104,6 +104,15 @@ public abstract class RestClient {
         this.props = new DefaultProperties(host);
     }
 
+    protected RestClient(URL host, String acceptType, String contentType) {
+        headerMap = new HashMap<>();
+        this.path = Optional.empty();
+        this.host = host;
+        this.accept = acceptType;
+        this.contentType = contentType;
+        this.props = new DefaultProperties(host);
+    }
+
     /**
      * Override method to return false to disable logging.
      *