summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN
diff options
context:
space:
mode:
authorByung-Woo Jun <byung-woo.jun@ericsson.com>2018-11-28 13:25:26 +0000
committerGerrit Code Review <gerrit@onap.org>2018-11-28 13:25:26 +0000
commit8f4b6779d3caf7dd510e95f962b7d8f380a0f82b (patch)
treee2737245dbf4aa8019a1b7cc086107781d5d93d6 /bpmn/MSOCommonBPMN
parent8bc174515ba421f2163b74788454bda9bcb885b5 (diff)
parente5aae68146ed7311698358a50da39d8aa2198c7b (diff)
Merge "Correct the http client auth issue" into casablanca
Diffstat (limited to 'bpmn/MSOCommonBPMN')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
index b4851ee7a4..5e05637bca 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
@@ -47,6 +47,9 @@ import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.client.HttpClient;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.onap.so.rest.APIResponse;
+import org.onap.so.rest.RESTClient;
+import org.onap.so.rest.RESTConfig;
import org.onap.so.utils.TargetEntity;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -261,10 +264,20 @@ public class ResourceRequestBuilder {
private static String getCsarFromUuid(String uuid) throws Exception {
String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint");
- HttpClient client = new HttpClient(UriBuilder.fromUri(catalogEndPoint).path(SERVICE_URL_TOSCA_CSAR).queryParam("serviceModelUuid", uuid).build().toURL(), "application/json", TargetEntity.CATALOG_DB);
-
- Response response = client.get();
- String value = response.readEntity(String.class);
+
+ RESTClient restClient = new RESTClient(new RESTConfig(
+ UriBuilder.fromUri(catalogEndPoint)
+ .path(SERVICE_URL_TOSCA_CSAR)
+ .queryParam("serviceModelUuid", uuid)
+ .build().toURL().toString()
+ ));
+
+ restClient.addHeader("Accept", "application/json");
+ restClient.addAuthorizationHeader(UrnPropertiesReader.getVariable("mso.db.auth"));
+
+ APIResponse apiResponse = restClient.httpGet();
+
+ String value = apiResponse.getResponseBodyAsString();
HashMap<String, String> map = new Gson().fromJson(value, new TypeToken<HashMap<String, String>>() {}.getType());