Fix auth for catalog db 56/73156/3
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>
Thu, 15 Nov 2018 12:05:55 +0000 (17:35 +0530)
committersubhash kumar singh <subhash.kumar.singh@huawei.com>
Tue, 4 Dec 2018 12:09:10 +0000 (17:39 +0530)
Fix auth for catalog db.

Change-Id: Ic787993f608b7ddf74167f7859a519ca02b794ed
Issue-ID: SO-689
Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
common/src/main/java/org/onap/so/client/HttpClient.java

index 2fc1c3d..8c323af 100644 (file)
@@ -520,13 +520,20 @@ public class CatalogDbAdapterRest {
         try {
             if (smUuid != null && !"".equals(smUuid)) {
                 logger.debug("Query Csar by service model uuid: {}",smUuid);
-                ToscaCsar toscaCsar = toscaCsarRepo.findById(smUuid).orElseGet(() -> null);
-                if (toscaCsar != null) {
-                    QueryServiceCsar serviceCsar = new QueryServiceCsar(toscaCsar);
-                    entity = serviceCsar.JSON2(false, false);
+                Service service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(smUuid);
+
+                if (service != null) {
+                    ToscaCsar toscaCsar = service.getCsar();
+                    if (toscaCsar != null) {
+                        QueryServiceCsar serviceCsar = new QueryServiceCsar(toscaCsar);
+                        entity = serviceCsar.JSON2(false, false);
+                    } else {
+                        respStatus = HttpStatus.SC_NOT_FOUND;
+                    }
                 } else {
                     respStatus = HttpStatus.SC_NOT_FOUND;
                 }
+
             } else {
                 throw (new Exception("Incoming parameter is null or blank"));
             }
index 17f6c66..6084f57 100644 (file)
@@ -189,7 +189,7 @@ dcsi.postDecomposeService(execution)]]></bpmn:script>
             <camunda:inputParameter name="headers">
               <camunda:map>
                 <camunda:entry key="content-type">application/soap+xml</camunda:entry>
-                <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+                <camunda:entry key="Authorization">${UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth", execution)}</camunda:entry>
               </camunda:map>
             </camunda:inputParameter>
             <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter>
@@ -206,12 +206,12 @@ dcsi.postDecomposeService(execution)]]></bpmn:script>
     <bpmn:scriptTask id="ScriptTask_0f3tjbn" name="prepare update service operation status" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_0h5c1bd</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1ab3vex</bpmn:outgoing>
-      <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 execution.setVariable("progress", "100")
 execution.setVariable("result", "finished")
 execution.setVariable("operationContent", "No actual resoure in service instance")
 def csi= new DoDeleteE2EServiceInstance()
-csi.prepareUpdateServiceOperationStatus(execution)]]></bpmn:script>
+csi.prepareUpdateServiceOperationStatus(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0hrkmxb" name="End Delete Process">
       <bpmn:outgoing>SequenceFlow_0h5c1bd</bpmn:outgoing>
index 12f19ac..66e970a 100644 (file)
@@ -47,7 +47,6 @@ public class HttpClient extends RestClient {
 
        @Override
        protected void initializeHeaderMap(Map<String, String> headerMap) {
-
        }
 
        @Override