summaryrefslogtreecommitdiffstats
path: root/prh-aai-client/src
diff options
context:
space:
mode:
authorpwielebs <piotr.wielebski@nokia.com>2018-04-24 10:07:41 +0200
committerpwielebs <piotr.wielebski@nokia.com>2018-04-24 10:09:36 +0200
commit74c5bf5b2f99043a8cb29aa8f2b9fde253b92e72 (patch)
tree1ddeb70f2943086c1196317ccf5dfc43cf301470 /prh-aai-client/src
parenta274374b520aad75c99cdce7f4f9ebc31ce74343 (diff)
Http clients refactoring
Change-Id: Ibed4b83fd508dd8666b76bdf590069d40dd3a363 Issue-ID: DCAEGEN2-451 Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'prh-aai-client/src')
-rw-r--r--prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIExtendedHttpClientImpl.java29
1 files changed, 13 insertions, 16 deletions
diff --git a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIExtendedHttpClientImpl.java b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIExtendedHttpClientImpl.java
index 2e6aa9e6..20ae8d0b 100644
--- a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIExtendedHttpClientImpl.java
+++ b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIExtendedHttpClientImpl.java
@@ -19,13 +19,6 @@
*/
package org.onap.dcaegen2.services.service;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.ResponseHandler;
@@ -43,9 +36,16 @@ import org.onap.dcaegen2.services.utils.HttpUtils;
import org.onap.dcaegen2.services.utils.RequestVerbs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.lang.NonNull;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Optional;
+
public class AAIExtendedHttpClientImpl implements AAIExtendedHttpClient {
Logger logger = LoggerFactory.getLogger(AAIExtendedHttpClientImpl.class);
@@ -55,7 +55,7 @@ public class AAIExtendedHttpClientImpl implements AAIExtendedHttpClient {
private final String aaiProtocol;
private final Integer aaiHostPortNumber;
- @Autowired
+
public AAIExtendedHttpClientImpl (AAIHttpClientConfiguration aaiHttpClientConfiguration) {
final AAIHttpClient aaiHttpClient = new AAIHttpClientImpl(aaiHttpClientConfiguration);
closeableHttpClient = aaiHttpClient.getAAIHttpClient();
@@ -76,14 +76,11 @@ public class AAIExtendedHttpClientImpl implements AAIExtendedHttpClient {
logger.error("Exception while executing HTTP request: {}", e);
}
- if (extendedDetails.isPresent()) {
- return extendedDetails;
- } else {
- return Optional.empty();
- }
+ return extendedDetails;
}
private URI createAAIExtendedURI(final String path, Map<String, String> queryParams) {
+
URI extendedURI = null;
final URIBuilder uriBuilder = new URIBuilder().setScheme(this.aaiProtocol).setHost(this.aaiHost)
@@ -96,8 +93,8 @@ public class AAIExtendedHttpClientImpl implements AAIExtendedHttpClient {
}
try {
- logger.info("Building extended URI");
extendedURI = uriBuilder.build();
+ logger.info("Building extended URI: {}", extendedURI);
} catch (URISyntaxException e) {
logger.error("Exception while building extended URI: {}", e);
}
@@ -151,7 +148,7 @@ public class AAIExtendedHttpClientImpl implements AAIExtendedHttpClient {
}
private Boolean isExtendedURINotNull(URI extendedURI) {
- return extendedURI != null ? true : false;
+ return extendedURI != null;
}
private Optional<StringEntity> createStringEntity(Optional<String> jsonBody) {