summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/main/java/org/onap
diff options
context:
space:
mode:
authorseshukm <seshu.kumar.m@huawei.com>2018-11-28 20:06:29 +0800
committerseshukm <seshu.kumar.m@huawei.com>2018-11-28 20:08:21 +0800
commite5aae68146ed7311698358a50da39d8aa2198c7b (patch)
treefe55a8327e9bc912c768ec8224bcf018ba734aff /bpmn/MSOCommonBPMN/src/main/java/org/onap
parent52536a87de7addf8994f44692e84b918f62e2e14 (diff)
Correct the http client auth issue
Issue-ID: SO-1257 Change-Id: Iac3cf2cf594b9b3224b5741d8589c7d3b9c5e205 Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java/org/onap')
-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());