From eea9276879c723444c7eaf95ada94ce057d7f6ab Mon Sep 17 00:00:00 2001 From: Yulian Han Date: Thu, 29 Nov 2018 19:32:31 +0800 Subject: vfc adapter authentication bug fix update OperationStatus Based On ResourceStatus add Authorization header to get csar from db Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f064414 Issue-ID: SO-1256 Signed-off-by: Yulian Han --- .../org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bpmn/MSOCommonBPMN/src/main') 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 1989ca8cf9..c63d81cf4a 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 @@ -261,6 +261,9 @@ public class ResourceRequestBuilder { 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); + client.addAdditionalHeader("Accept", "application/json"); +// client.addBasicAuthHeader (UrnPropertiesReader.getVariable("mso.adapters.db.auth"), UrnPropertiesReader.getVariable("mso.msoKey")); + client.addAdditionalHeader("Authorization", UrnPropertiesReader.getVariable("mso.db.auth")); Response response = client.get(); String value = response.readEntity(String.class); @@ -271,7 +274,7 @@ public class ResourceRequestBuilder { File csarFile = new File(filePath); if(!csarFile.exists()) { - throw new Exception("csar file does not exist."); + throw new Exception("csar file does not exist in filePath:" + csarFile.getAbsolutePath()); } return csarFile.getAbsolutePath(); @@ -283,7 +286,7 @@ public class ResourceRequestBuilder { try { return mapper.readValue(jsonstr, type); } catch(IOException e) { - LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "fail to unMarshal json", e); + LOGGER.error("fail to unMarshal json" + e.getMessage ()); } return null; } -- cgit 1.2.3-korg