refactor fallouthandler 35/99335/1
authorBoslet, Cory <cory.boslet@att.com>
Mon, 9 Dec 2019 13:49:08 +0000 (08:49 -0500)
committerBenjamin, Max (mb388a) <mb388a@att.com>
Mon, 9 Dec 2019 13:49:09 +0000 (08:49 -0500)
Created a new update method to allow accessibility from groovy
Ignore test that do not function in groovy.
Fixed typo and bug in request db client class
Fixed failing junits for falloouthandler
Add the request factory to the rest template so that patch works
updated check payload keyword to check response

Issue-ID: SO-2555
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: Iebfea31b659a02069bd6c59c09f025fdc6a99843

adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java
adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy
bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn
bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn
bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcessTest.groovy
bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/FalloutHandlerTest.groovy
mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java

index f4a9f71..110fc6c 100644 (file)
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,6 +31,7 @@ import org.onap.so.db.request.beans.ResourceOperationStatus;
 /**
  * MSO Request DB Adapter Web Service
  */
+@Deprecated
 @WebService(name = "RequestsDbAdapter", targetNamespace = "http://org.onap.so/requestsdb")
 public interface MsoRequestsDbAdapter {
 
index 23fa040..085a255 100644 (file)
@@ -10,9 +10,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -45,6 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Component;
 
+@Deprecated
 @WebService(serviceName = "RequestsDbAdapter",
         endpointInterface = "org.onap.so.adapters.requestsdb.MsoRequestsDbAdapter",
         targetNamespace = "http://org.onap.so/requestsdb")
@@ -183,7 +184,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
 
     /**
      * update operation status <br>
-     * 
+     *
      * @param serviceId
      * @param operationId
      * @param operationType
@@ -253,7 +254,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
 
     /**
      * init the operation status of all the resources <br>
-     * 
+     *
      * @param serviceId the service Id
      * @param operationId the operation Id
      * @param operationType the operationType
@@ -284,7 +285,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
 
     /**
      * get resource operation status <br>
-     * 
+     *
      * @param serviceId
      * @param operationId
      * @param resourceTemplateUUID
@@ -304,7 +305,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
 
     /**
      * update resource operation status <br>
-     * 
+     *
      * @param serviceId
      * @param operationId
      * @param resourceTemplateUUID
@@ -340,7 +341,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
 
     /**
      * update service operation status when a operation resource status updated <br>
-     * 
+     *
      * @param operStatus the resource operation status
      * @since ONAP Amsterdam Release
      */
index 7e12807..841fe9f 100644 (file)
@@ -9,9 +9,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,295 +25,98 @@ package org.onap.so.bpmn.common.scripts
 import org.onap.so.logger.LoggingAnchor
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.db.request.beans.InfraActiveRequests
+import org.onap.so.db.request.client.RequestsDbClient
 import org.onap.so.logger.ErrorCode
 import org.onap.so.logger.MessageEnum
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
+import org.onap.so.bpmn.core.UrnPropertiesReader;
 
 public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
-    private static final Logger logger = LoggerFactory.getLogger( CompleteMsoProcess.class);
-
-       String Prefix="CMSO_"
-       ExceptionUtil exceptionUtil = new ExceptionUtil()
-
-       // Complete MSO Request processing
-       public initializeProcessVariables(DelegateExecution execution){
-
-               def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')'
-               logger.trace('Entered ' + method)
-               try {
-
-                       /* Initialize all the process request variables in this block */
-                       execution.setVariable("prefix",Prefix)
-                       execution.setVariable("CMSO_request_id","")
-                       execution.setVariable("CMSO_notification-url","")
-                       execution.setVariable("CMSO_mso-bpel-name","")
-                       execution.setVariable("CMSO_request_action","")
-                       execution.setVariable("CMSO_notification-url-Ok", false)
-                       execution.setVariable("CMSO_request_id-Ok", false)
-
-                       //updateRequest Adapter process variables
-                       execution.setVariable("CMSO_updateRequestResponse", "")
-                       execution.setVariable("CMSO_updateRequestResponseCode", "")
-                       execution.setVariable("CMSO_updateFinalNotifyAckStatusFailedPayload", "")
-
-                       //Set DB adapter variables here
-                       execution.setVariable("CMSO_updateDBStatusToSuccessPayload", "")
-                       execution.setVariable("CMSO_updateInfraRequestDBPayload", "")
-                       execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", "")
-
-                       //Auth variables
-                       execution.setVariable("BasicAuthHeaderValue","")
-
-                       //Response variables
-                       execution.setVariable("CompletionHandlerResponse","")
-                       execution.setVariable("CMSO_ErrorResponse", null)
-                       execution.setVariable("CMSO_ResponseCode", "")
-
-                       setSuccessIndicator(execution, false)
-
-               } catch (BpmnError e) {
-                       throw e;
-               } catch (Exception e) {
-                       logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
-                                       ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
-               }
-
-       }
-
-       public void preProcessRequest (DelegateExecution execution) {
-
-               initializeProcessVariables(execution)
-               def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
-               //              logger.trace("Started CompleteMsoProcess preProcessRequest Method ");
-               logger.trace('Entered ' + method)
-
-               setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled'))
-
-               try {
-                       def xml = execution.getVariable("CompleteMsoProcessRequest")
-
-                       logger.debug("CompleteMsoProcess Request: " + xml)
-                       logger.debug("Incoming Request is: "+ xml)
-
-                       //mso-bpel-name from the incoming request
-                       def msoBpelName = utils.getNodeText(xml,"mso-bpel-name")
-                       execution.setVariable("CMSO_mso-bpel-name",msoBpelName)
-
-                       //Check the incoming request type
-                       //Incoming request can be ACTIVE_REQUESTS (request-information node) or  INFRA_ACTIVE_REQUESTS (request-info node)
-                       if (utils.nodeExists(xml, "request-information")) {
-                               execution.setVariable("CMSO_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS
-                       }
-
-                       //Check for rehome indicator
-                       def rehomeIndicator = utils.getNodeText(xml,"rehomeDone")
-                       execution.setVariable("rehomeDone", rehomeIndicator)
-
-                       //Check notification-url for the incoming request type
-                       //ACTIVE_REQUESTS may have notificationurl node
-                       //INFRA_ACTIVE_REQUESTS notificationurl node does not exist
-                       def notificationurl = ""
-                       if (utils.nodeExists(xml, "notification-url")) {
-                               notificationurl = utils.getNodeText(xml,"notification-url")
-                               if(notificationurl != null && !notificationurl.isEmpty()) {
-                                       execution.setVariable("CMSO_notification-url-Ok", true)
-                                       execution.setVariable("CMSO_notification-url",notificationurl)
-                               }
-                       }
-
-                       //Check request_id for the incoming request type
-                       //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not)
-                       //For ACTIVE_REQUESTS payload request-id is NOT optional
-                       def request_id = ""
-                       if (utils.nodeExists(xml, "request-id")) {
-                               execution.setVariable("CMSO_request_id",utils.getNodeText(xml,"request-id"))
-                       }
-
-
-                       // INFRA_ACTIVE_REQUESTS         have "action" element ... mandatory
-                       // ACTIVE_REQUEST have "request-action" ... mandatory
-                       if (utils.nodeExists(xml, "request-action")) {
-                               execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"request-action"))
-                       } else if (utils.nodeExists(xml, "action")) {
-                               execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"action"))
-                       }
-
-                       //Check source for the incoming request type
-                       //For INFRA_ACTIVE_REQUESTS payload source IS optional
-                       //For ACTIVE_REQUESTS payload source is NOT optional
-                       def source = ""
-                       if (utils.nodeExists(xml, "source")) {
-                               execution.setVariable("CMSO_source",utils.getNodeText(xml,"source"))
-                       }
-
-                       logger.trace("--> " + execution.getVariable(""))
-                       logger.trace("--> " + execution.getVariable(""))
-
-                       // set the DHV/Service Instantiation values if specified in the request
-                       execution.setVariable("CMSO_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText(xml, "is-srv-inst-req"))))
-                       logger.trace("--> " + execution.getVariable(""))
-                       execution.setVariable("CMSO_is_json_content", String.valueOf("JSON".equals(utils.getNodeText(xml, "resp-content-type"))))
-                       logger.trace("--> " + execution.getVariable(""))
-                       execution.setVariable("CMSO_service_inst_id", utils.getNodeText(xml, "service-instance-id"))
-                       logger.trace("--> " + execution.getVariable(""))
-                       execution.setVariable("CMSO_start_time", utils.getNodeText(xml, "start-time"))
-                       logger.trace("--> " + execution.getVariable(""))
-                       // this variable is used by the camunda flow to set the Content-Type for the async response
-                       if (execution.getVariable("CMSO_is_srv_inst_req").equals("true") &&
-                               execution.getVariable("CMSO_is_json_content").equals("true")) {
-                               execution.setVariable("CMSO_content_type", "application/json")
-                       } else {
-                               execution.setVariable("CMSO_content_type", "text/xml")
-                       }
-
-                       logger.trace('Exited ' + method)
-               } catch (BpmnError e) {
-                       throw e;
-               } catch (Exception e) {
-                       logger.debug("Exception Occured During PreProcessRequest: " + e);
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
-               }
-       }
-
-       public void setUpdateDBstatustoSuccessPayload (DelegateExecution execution){
-
-               def method = getClass().getSimpleName() + '.setUpdateDBstatustoSuccessPayload(' +'execution=' + execution.getId() +')'
-               logger.trace('Entered ' + method)
-
-               try {
-
-                       def xml = execution.getVariable("CompleteMsoProcessRequest")
-
-                       //Get statusMessage if exists
-                       def statusMessage
-                       if(utils.nodeExists(xml, "status-message")){
-                               statusMessage = utils.getNodeText(xml, "status-message")
-                       }else{
-                               statusMessage = "Resource Completed Successfully"
-                       }
-
-                       //Get instance Id if exist
-                       String idXml = ""
-                       if(utils.nodeExists(xml, "vnfId")){
-                               idXml = utils.getNodeXml(xml, "vnfId")
-                       }else if(utils.nodeExists(xml, "networkId")){
-                               idXml = utils.getNodeXml(xml, "networkId")
-                       }else if(utils.nodeExists(xml, "configurationId")){
-                               idXml = utils.getNodeXml(xml, "configurationId")
-                       }else if(utils.nodeExists(xml, "serviceInstanceId")){
-                               idXml = utils.getNodeXml(xml, "serviceInstanceId")
-                       }else if(utils.nodeExists(xml, "vfModuleId")){
-                               idXml = utils.getNodeXml(xml, "vfModuleId")
-                       }else if(utils.nodeExists(xml, "volumeGroupId")){
-                               idXml = utils.getNodeXml(xml, "volumeGroupId")
-                       }else{
-                               idXml = ""
-                       }
-                       idXml = utils.removeXmlPreamble(idXml)
-                       idXml = utils.removeXmlNamespaces(idXml)
-                       logger.debug("Incoming Instance Id Xml: " + idXml)
-
-                       String payload = """
-                                               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb">
-                                                  <soapenv:Header/>
-                                                  <soapenv:Body>
-                                                     <req:updateInfraRequest>
-                                                        <requestId>${MsoUtils.xmlEscape(execution.getVariable("CMSO_request_id"))}</requestId>
-                                                        <lastModifiedBy>${MsoUtils.xmlEscape(execution.getVariable("CMSO_mso-bpel-name"))}</lastModifiedBy>
-                                                        <statusMessage>${MsoUtils.xmlEscape(statusMessage)}</statusMessage>
-                                                        <requestStatus>COMPLETE</requestStatus>
-                                                                <progress>100</progress>
-                                                                ${idXml}
-                                                     </req:updateInfraRequest>
-                                                  </soapenv:Body>
-                                               </soapenv:Envelope>"""
-
-                       execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", payload)
-                       logger.debug("Outgoing Update Mso Request Payload is: " + payload)
-                       logger.debug("setUpdateDBstatustoSuccessPayload: " + payload)
-
-               } catch (BpmnError e) {
-                       throw e;
-               } catch (Exception e) {
-                       logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                                       'Caught exception in ' + method, "BPMN",
-                                       ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
-               }
-               logger.trace('Exited ' + method)
-       }
-
-       public void buildDataError (DelegateExecution execution, String message) {
-
-               def method = getClass().getSimpleName() + '.buildDataError(' +'execution=' + execution.getId() +')'
-               logger.trace('Entered ' + method)
-               try {
-
-                       String msoCompletionResponse = """
-                       <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
-                          <sdncadapterworkflow:out>BPEL ${execution.getVariable("CMSO_mso-bpel-name")} FAILED</sdncadapterworkflow:out>
-                       </sdncadapterworkflow:MsoCompletionResponse>
-                       """.trim()
-
-                       // Format Response
-                       def xmlMsoCompletionResponse = utils.formatXml(msoCompletionResponse)
-                       String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim()
-                       logger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
-                       execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString)
-                       logger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompletionHandlerResponse"))
-
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 500, message)
-
-               } catch (BpmnError e) {
-                       logger.debug("Rethrowing MSOWorkflowException")
-                       throw e;
-               } catch (Exception e) {
-                       logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                                       'Caught exception in ' + method, "BPMN",
-                                       ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
-               }
-
-       }
-
-       public void postProcessResponse (DelegateExecution execution) {
-
-                               def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')'
-                               logger.trace('Entered ' + method)
-               //              logger.trace("Started CompleteMsoProcess PostProcessRequest Method ");
-                               try {
-
-                                       String msoCompletionResponse = """
-                       <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://ecomp.com/mso/workflow/schema/v1">
-                          <sdncadapterworkflow:out>BPEL ${execution.getVariable("CMSO_mso-bpel-name")} completed</sdncadapterworkflow:out>
-                       </sdncadapterworkflow:MsoCompletionResponse>
-                       """.trim()
-
-                                       // Format Response
-                                       def xmlMsoCompletionResponse = utils.formatXML(msoCompletionResponse)
-                                       String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim()
-                                       // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
-                                       execution.setVariable("WorkflowResponse", buildMsoCompletionResponseAsString)
-                                       logger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
-                                       execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString)
-                                       execution.setVariable("CMSO_ResponseCode", "200")
-
-                                       setSuccessIndicator(execution, true)
-
-                                       logger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompleteMsoProcessResponse"))
-
-                                       logger.trace('Exited ' + method)
-                               } catch (BpmnError e) {
-                                       throw e;
-                               } catch (Exception e) {
-                                       logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                                                       'Caught exception in ' + method, "BPMN",
-                                                       ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
-                               }
-       }
-
+    private static final Logger logger = LoggerFactory.getLogger(CompleteMsoProcess.class);
+
+    String Prefix="CMSO_"
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+    public void preProcessRequest (DelegateExecution execution) {
+        try {
+            def xml = execution.getVariable("CompleteMsoProcessRequest")
+
+            logger.debug("CompleteMsoProcess Request: " + xml)
+            logger.debug("Incoming Request is: "+ xml)
+
+            //mso-bpel-name from the incoming request
+            def msoBpelName = utils.getNodeText(xml,"mso-bpel-name")
+            execution.setVariable("CMSO_mso-bpel-name",msoBpelName)
+
+            if (utils.nodeExists(xml, "request-information")) {
+                throw new BpmnError("500", "FalloutHandler subflow does not support this request type.")
+            }
+
+            def request_id = ""
+            if (utils.nodeExists(xml, "request-id")) {
+                execution.setVariable("CMSO_request_id",utils.getNodeText(xml,"request-id"))
+            }
+
+        } catch (BpmnError e) {
+            throw e;
+        } catch (Exception e) {
+            logger.debug("Exception Occured During PreProcessRequest: " + e);
+            exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in preprocess")
+        }
+    }
+
+    public void updateInfraRequestDB (DelegateExecution execution){
+        try {
+
+            def xml = execution.getVariable("CompleteMsoProcessRequest")
+
+            //Get statusMessage if exists
+            def statusMessage
+            if(utils.nodeExists(xml, "status-message")){
+                statusMessage = utils.getNodeText(xml, "status-message")
+            }else{
+                statusMessage = "Resource Completed Successfully"
+            }
+
+            RequestsDbClient dbClient = getDbClient()
+
+            InfraActiveRequests infraRequest = dbClient.getInfraActiveRequests(execution.getVariable("CMSO_request_id"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.endpoint"))
+            if(infraRequest == null){
+                infraRequest = new InfraActiveRequests();
+                infraRequest.setRequestId(execution.getVariable("CMSO_request_id"))
+            }
+            infraRequest.setLastModifiedBy("BPMN")
+            infraRequest.setStatusMessage(statusMessage)
+            infraRequest.setRequestStatus("COMPLETED")
+            infraRequest.setProgress(100)
+
+            if(utils.nodeExists(xml, "vnfId")){
+                infraRequest.setVnfId(utils.getNodeText(xml, "vnfId"))
+            }else if(utils.nodeExists(xml, "networkId")){
+                infraRequest.setNetworkId(utils.getNodeText(xml, "networkId"))
+            }else if(utils.nodeExists(xml, "configurationId")){
+                infraRequest.setConfigurationId(utils.getNodeText(xml, "configurationId"))
+            }else if(utils.nodeExists(xml, "serviceInstanceId")){
+                infraRequest.setServiceInstanceId(utils.getNodeText(xml, "serviceInstanceId"))
+            }else if(utils.nodeExists(xml, "vfModuleId")){
+                infraRequest.setVfModuleId(utils.getNodeText(xml, "vfModuleId"))
+            }else if(utils.nodeExists(xml, "volumeGroupId")){
+                infraRequest.setVolumeGroupId(utils.getNodeText(xml, "volumeGroupId"))
+
+            }
+
+            dbClient.updateInfraActiveRequests(infraRequest, UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.endpoint"))
+
+        } catch (Exception e) {
+            logger.error("Internal error while updating request db", e);
+            exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in update infra request db")
+        }
+    }
+
+    protected RequestsDbClient getDbClient(){
+        return new RequestsDbClient()
+    }
 
 }
index ed84975..8306f33 100644 (file)
@@ -9,9 +9,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,376 +24,134 @@ package org.onap.so.bpmn.common.scripts
 
 import org.onap.so.logger.LoggingAnchor
 import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.db.request.beans.InfraActiveRequests
+import org.onap.so.db.request.client.RequestsDbClient
 import org.onap.so.logger.ErrorCode
-
+import org.onap.so.bpmn.core.UrnPropertiesReader;
 import java.text.SimpleDateFormat
 
 import org.apache.commons.lang3.*
+import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.so.logger.MessageEnum
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
 public class FalloutHandler extends AbstractServiceTaskProcessor {
-    private static final Logger logger = LoggerFactory.getLogger( FalloutHandler.class);
-
-       String Prefix="FH_"
-       ExceptionUtil exceptionUtil = new ExceptionUtil()
-
-       public initializeProcessVariables(DelegateExecution execution){
-               def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')'
-               logger.trace('Entered ' + method)
-
-               try {
-                       execution.setVariable("prefix",Prefix)
-
-                       //These variables are form the input Message to the BPMN
-                       execution.setVariable("FH_request_id","")
-                       execution.setVariable("FH_request_action","")
-                       execution.setVariable("FH_notification-url","")
-                       execution.setVariable("FH_mso-bpel-name","")
-                       execution.setVariable("FH_ErrorCode", "")
-                       execution.setVariable("FH_ErrorMessage", "")
-
-                       execution.setVariable("FH_notification-url-Ok", false)
-                       execution.setVariable("FH_request_id-Ok", false)
-
-                       //These variables are for Get Mso Aai Password Adapter
-                       execution.setVariable("FH_deliveryStatus", true)
-       
-                       //update Response Status to pending ...Adapter variables
-                       execution.setVariable("FH_updateResponseStatusPayload", null)
-                       execution.setVariable("FH_updateResponseStatusResponse", null)
-       
-                       //update Request Gamma ...Adapter variables
-                       execution.setVariable("FH_updateRequestGammaPayload", "")
-                       execution.setVariable("FH_updateRequestGammaResponse", null)
-                       execution.setVariable("FH_updateRequestGammaResponseCode", null)
-       
-                       //update Request Infra ...Adapter variables
-                       execution.setVariable("FH_updateRequestInfraPayload", "")
-                       execution.setVariable("FH_updateRequestInfraResponse", null)
-                       execution.setVariable("FH_updateRequestInfraResponseCode", null)
-       
-                       //assign True to success variable
-                       execution.setVariable("FH_success", true)
-       
-                       //Set notify status to Failed variable
-                       execution.setVariable("FH_NOTIFY_STATUS", "SUCCESS")
-       
-                       //Set DB update variable
-                       execution.setVariable("FH_updateRequestPayload", "")
-                       execution.setVariable("FH_updateRequestResponse", null)
-                       execution.setVariable("FH_updateRequestResponseCode", null)
-       
-                       //Auth variables
-                       execution.setVariable("BasicAuthHeaderValue","")
-
-                       //Parameter list
-                       execution.setVariable("FH_parameterList",  "")
-
-                       //Response variables
-                       execution.setVariable("FalloutHandlerResponse","")
-                       execution.setVariable("FH_ErrorResponse", null)
-                       execution.setVariable("FH_ResponseCode", "")
-
-               } catch (Exception e) {
-                       logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                                       'Caught exception in ' + method, "BPMN",
-                                       ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
-               //      exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
-               }
-       }
-
-       public void preProcessRequest (DelegateExecution execution) {
-               def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
-               logger.trace('Entered ' + method)
-
-               // Initialize flow variables
-               initializeProcessVariables(execution)
-               setSuccessIndicator(execution, false)
-
-               setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled'))
-
-               try {
-                       def xml = execution.getVariable("FalloutHandlerRequest")
-                       logger.debug(" XML --> " + xml)
-                       logger.debug("FalloutHandler request: " + xml)
-
-                       //Check the incoming request type
-                       //Incoming request can be ACTIVE_REQUESTS (request-information node) or  INFRA_ACTIVE_REQUESTS (request-info node)
-                       if (utils.nodeExists(xml, "request-information")) {
-                               execution.setVariable("FH_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS
-                       }
-
-                       //Check notification-url for the incoming request type
-                       //ACTIVE_REQUESTS may have notificationurl node
-                       //INFRA_ACTIVE_REQUESTS notificationurl node does not exist
-                       def notificationurl = ""
-                       if (utils.nodeExists(xml, "notification-url")) {
-                               notificationurl = utils.getNodeText(xml,"notification-url")
-                               if(notificationurl != null && !notificationurl.isEmpty()) {
-                                       logger.debug("********** Incoming notification Url is: " + notificationurl);
-                                       execution.setVariable("FH_notification-url-Ok", true)
-                                       execution.setVariable("FH_notification-url",notificationurl)
-                               }
-                       }
-       
-                       //Check request_id for the incoming request type
-                       //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not)
-                       //For ACTIVE_REQUESTS payload request-id is NOT optional
-                       def request_id = ""
-                       if (utils.nodeExists(xml, "request-id")) {
-                               execution.setVariable("FH_request_id",utils.getNodeText(xml,"request-id"))
-                       }
-                       logger.debug("FH_request_id: " + execution.getVariable("FH_request_id"))
-
-                       // INFRA_ACTIVE_REQUESTS         have "action" element ... mandatory
-                       // ACTIVE_REQUEST have "request-action" ... mandatory
-                       if (utils.nodeExists(xml, "request-action")) {
-                               execution.setVariable("FH_request_action",utils.getNodeText(xml,"request-action"))
-                       } else if (utils.nodeExists(xml, "action")) {
-                               execution.setVariable("FH_request_action",utils.getNodeText(xml,"action"))
-                       }
-
-
-                       //Check source for the incoming request type
-                       //For INFRA_ACTIVE_REQUESTS payload source IS optional
-                       //For ACTIVE_REQUESTS payload source is NOT optional
-                       def source = ""
-                       if (utils.nodeExists(xml, "source")) {
-                               execution.setVariable("FH_source",utils.getNodeText(xml,"source"))
-                       }
-
-                       //Check if ErrorCode node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above.
-                       def errorCode = ""
-                       if (utils.nodeExists(xml, "ErrorCode")) {
-                               errorCode = utils.getNodeText(xml,"ErrorCode")
-                               if(errorCode != null && !errorCode.isEmpty()) {
-                                       execution.setVariable("FH_ErrorCode", errorCode)
-                               }
-                       }
-                       logger.debug("FH_ErrorCode: " + errorCode)
-
-                       //Check if ErrorMessage node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above.
-                       def errorMessage = ""
-                       if (utils.nodeExists(xml, "ErrorMessage")) {
-                               errorCode = utils.getNodeText(xml,"ErrorMessage")
-                               if(errorCode != null && !errorCode.isEmpty()) {
-                                       errorCode = errorCode
-                                       execution.setVariable("FH_ErrorMessage", errorCode)
-                               }
-                       }
-
-                       //Check for Parameter List
-                       if (utils.nodeExists(xml, "parameter-list")) {
-                               def parameterList = utils.getNodeXml(xml, "parameter-list", false)
-                               execution.setVariable("FH_parameterList", parameterList)
-                       }
-
-                       logger.trace("--> " + execution.getVariable(""))
-                       logger.debug("FH_request_id-OK --> " + execution.getVariable("FH_request_id-Ok"))
-
-                       // set the DHV/Service Instantiation values if specified in the request
-                       execution.setVariable("FH_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText(xml, "is-srv-inst-req"))))
-                       logger.trace("--> " + execution.getVariable(""))
-                       execution.setVariable("FH_is_json_content", String.valueOf("JSON".equals(utils.getNodeText(xml, "resp-content-type"))))
-                       logger.trace("--> " + execution.getVariable(""))
-                       execution.setVariable("FH_service_inst_id", utils.getNodeText(xml, "service-instance-id"))
-                       logger.trace("--> " + execution.getVariable(""))
-                       execution.setVariable("FH_start_time", utils.getNodeText(xml, "start-time"))
-                       logger.trace("--> " + execution.getVariable(""))
-                       // this variable is used by the camunda flow to set the Content-Type for the async response
-                       if (execution.getVariable("FH_is_srv_inst_req").equals("true") &&
-                               execution.getVariable("FH_is_json_content").equals("true")) {
-                               execution.setVariable("FH_content_type", "application/json")
-                       } else {
-                               execution.setVariable("FH_content_type", "text/xml")
-                       }
-               } catch (Exception e) {
-                       logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                                       'Caught exception in ' + method, "BPMN",
-                                       ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
-               //      exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
-               }
-
-               logger.debug("OUTOF --> Initialize Variables Fallout Handler #########");
-       }
-
-       public String updateRequestPayload (DelegateExecution execution){
-               def method = getClass().getSimpleName() + '.updateRequestPayload(' +'execution=' + execution.getId() +')'
-               logger.trace('Entered ' + method)
-
-               try {
-                       String payload = """
-                                       <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb">
-                                       <soapenv:Header/>
-                                       <soapenv:Body>
-                                               <req:updateRequest>
-                                                       <requestId>${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))}</requestId>
-                                                       <lastModifiedBy>BPEL</lastModifiedBy>
-                                                       <finalErrorMessage>${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorMessage"))}</finalErrorMessage>
-                                                       <finalErrorCode>${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorCode"))}</finalErrorCode>
-                                                       <status>FAILED</status>
-                                                       <responseStatus>${MsoUtils.xmlEscape(execution.getVariable("FH_NOTIFY_STATUS"))}</responseStatus>
-                                               </req:updateRequest>
-                                       </soapenv:Body>
-                                       </soapenv:Envelope>
-                               """
-
-                       logger.debug("updateRequestPayload: " + payload)
-                       execution.setVariable("FH_updateRequestPayload", payload)
-                       return execution.getVariable("FH_updateRequestPayload")
-               } catch (Exception e) {
-                       logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                                       'Caught exception in ' + method, "BPMN",
-                                       ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
-               //      exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
-               }
-       }
-
-       public String updateRequestInfraPayload (DelegateExecution execution){
-               def method = getClass().getSimpleName() + '.updateRequestInfraPayload(' +'execution=' + execution.getId() +')'
-               logger.trace('Entered ' + method)
-       
-               try {
-                       String payload = """
-                                       <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb">
-                                       <soapenv:Header/>
-                                       <soapenv:Body>
-                                               <req:updateInfraRequest>
-                                                       <requestId>${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))}</requestId>
-                                                       <lastModifiedBy>BPEL</lastModifiedBy>
-                                                       <statusMessage>${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorMessage"))}</statusMessage>
-                                                       <requestStatus>FAILED</requestStatus>
-                                                       <progress>100</progress>
-                                               </req:updateInfraRequest>
-                                       </soapenv:Body>
-                                       </soapenv:Envelope>
-                               """
-       
-                       execution.setVariable("FH_updateRequestInfraPayload", payload)
-                       logger.debug("updateRequestInfraPayload: " + payload)
-                       return execution.getVariable("FH_updateRequestInfraPayload")
-               } catch (Exception e) {
-                       logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                                       'Caught exception in ' + method, "BPMN",
-                                       ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
-               //      exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
-               }
-       }
-
-       public String updateRequestGammaPayload (DelegateExecution execution){
-               def method = getClass().getSimpleName() + '.updateRequestGammaPayload(' +'execution=' + execution.getId() +')'
-               logger.trace('Entered ' + method)
-
-               try {
-                       String payload = """
-                                       <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="${UrnPropertiesReader.getVariable("mso.default.adapter.namespace", execution)}/requestsdb">
-                                       <soapenv:Header/>
-                                       <soapenv:Body>
-                                               <req:updateRequest>
-                                                       <requestId>${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))}</requestId>
-                                                       <lastModifiedBy>BPEL</lastModifiedBy>
-                                                       <finalErrorMessage>${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorMessage"))}</finalErrorMessage>
-                                                       <finalErrorCode>${MsoUtils.xmlEscape(execution.getVariable("FH_ErrorCode"))}</finalErrorCode>
-                                                       <status>FAILED</status>
-                                               </req:updateRequest>
-                                       </soapenv:Body>
-                                       </soapenv:Envelope>
-                               """
-
-                       execution.setVariable("FH_updateRequestGammaPayload", payload)
-                       logger.debug("updateRequestGammaPayload: " + payload)
-                       return execution.getVariable("FH_updateRequestGammaPayload")
-               } catch (Exception e) {
-                       logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                                       'Caught exception in ' + method, "BPMN",
-                                       ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
-               //      exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
-               }
-       }
-
-       public String updateResponseStatusPayload (DelegateExecution execution){
-               def method = getClass().getSimpleName() + '.updateResponseStatusPayload(' +'execution=' + execution.getId() +')'
-               logger.trace('Entered ' + method)
-
-               try {
-                       String payload = """
-                                       <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb">
-                                       <soapenv:Header/>
-                                       <soapenv:Body>
-                                               <req:updateResponseStatus>
-                                                       <requestId>${MsoUtils.xmlEscape(execution.getVariable("FH_request_id"))}</requestId>
-                                                       <lastModifiedBy>BPEL</lastModifiedBy>
-                                                       <responseStatus>SENDING_FINAL_NOTIFY</responseStatus>
-                                               </req:updateResponseStatus>
-                                       </soapenv:Body>
-                                       </soapenv:Envelope>
-                               """
-
-                       execution.setVariable("FH_updateResponseStatusPayload", payload)
-                       logger.debug("updateResponseStatusPayload: " + payload)
-                       return execution.getVariable("FH_updateResponseStatusPayload")
-               } catch (Exception e) {
-                       logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                                       'Caught exception in ' + method, "BPMN",
-                                       ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
-               //      exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
-               }
-       }
-
-       public void buildDBWorkflowException(DelegateExecution execution, String responseCodeVariable) {
-               def method = getClass().getSimpleName() + '.buildDBWorkflowException(' +
-                       'execution=' + execution.getId() +
-                       ', responseCodeVariable=' + responseCodeVariable + ')'
-               logger.trace('Entered ' + method)
-
-               try {
-                       def responseCode = execution.getVariable(responseCodeVariable)
-                       // If the HTTP response code was null, it means a connection fault occurred (a java exception)
-                       def errorMessage = responseCode == null ? "Could not connect to DB Adapter" : "DB Adapter returned ${responseCode} response"
-                       def errorCode = responseCode == null ? 7000 : 7020
-               //      exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage)
-               } catch (Exception e) {
-                       logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                                       'Caught exception in ' + method, "BPMN",
-                                       ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
-               //      exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
-               }
-       }
-
-       /**
-        * Used to create a workflow response in success and failure cases.
-        */
-       public void postProcessResponse (DelegateExecution execution) {
-               def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')'
-               logger.trace('Entered ' + method)
-
-               try {
-                       Boolean success = (Boolean) execution.getVariable("FH_success")
-                       String out = success ? "Fallout Handler Succeeded" : "Fallout Handler Failed";
-
-                       String falloutHandlerResponse = """
+    private static final Logger logger = LoggerFactory.getLogger(FalloutHandler.class);
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+
+    public void preProcessRequest (DelegateExecution execution) {
+        def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
+        logger.trace('Entered ' + method)
+
+        execution.setVariable("FH_success", true)
+
+        try {
+            def xml = execution.getVariable("FalloutHandlerRequest")
+            logger.debug("FalloutHandler request: " + xml)
+
+            if (utils.nodeExists(xml, "request-information")) {
+                throw new BpmnError("500", "FalloutHandler subflow does not support this request type.")
+            }
+
+            //Check request_id for the incoming request type
+            //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not)
+            //For ACTIVE_REQUESTS payload request-id is NOT optional
+            def request_id = ""
+            if (utils.nodeExists(xml, "request-id")) {
+                execution.setVariable("FH_request_id",utils.getNodeText(xml,"request-id"))
+            }
+            logger.debug("FH_request_id: " + execution.getVariable("FH_request_id"))
+
+            //Check if ErrorCode node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above.
+            def errorCode = "500"
+            if (utils.nodeExists(xml, "ErrorCode")) {
+                if(errorCode != null && !errorCode.isEmpty()) {
+                    errorCode = utils.getNodeText(xml,"ErrorCode")
+                }
+            }
+            execution.setVariable("FH_ErrorCode", errorCode)
+
+            //Check if ErrorMessage node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above.
+            String errorMessage = "Internal Error occured in MSO, unable to determine error message"
+            if (utils.nodeExists(xml, "ErrorMessage")) {
+                if(errorCode != null && !errorCode.isEmpty()) {
+                    errorMessage = utils.getNodeText(xml,"ErrorMessage")
+                }
+            }
+            execution.setVariable("FH_ErrorMessage", errorMessage)
+
+            //Check for Parameter List
+            if (utils.nodeExists(xml, "parameter-list")) {
+                def parameterList = utils.getNodeXml(xml, "parameter-list", false)
+                execution.setVariable("FH_parameterList", parameterList)
+            }
+
+
+        } catch (Exception e) {
+            logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+                    'Caught exception in ' + method, "BPMN",
+                    ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+            // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
+        }
+
+    }
+
+    public String updateInfraRequestDB(DelegateExecution execution){
+        try {
+            RequestsDbClient client = getDbClient()
+            InfraActiveRequests infraRequest = client.getInfraActiveRequests(execution.getVariable("FH_request_id"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.endpoint"))
+            if(infraRequest == null){
+                infraRequest = new InfraActiveRequests();
+                infraRequest.setRequestId(execution.getVariable("CMSO_request_id"))
+            }
+            infraRequest.setLastModifiedBy("BPMN")
+            infraRequest.setStatusMessage(MsoUtils.xmlEscape(execution.getVariable("FH_ErrorMessage")))
+            infraRequest.setRequestStatus("FAILED")
+            infraRequest.setProgress(100)
+            client.updateInfraActiveRequests(infraRequest, UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.endpoint"))
+        } catch (Exception e) {
+            execution.setVariable("FH_success", false)
+            logger.error("Exception Occured while updating infra request db", e)
+        }
+    }
+
+    /**
+     * Used to create a workflow response in success and failure cases.
+     */
+    public void postProcessResponse (DelegateExecution execution) {
+        def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')'
+        logger.trace('Entered ' + method)
+
+        try {
+            Boolean success = (Boolean) execution.getVariable("FH_success")
+            String out = success ? "Fallout Handler Succeeded" : "Fallout Handler Failed";
+
+            String falloutHandlerResponse = """
                                        <workflow:FalloutHandlerResponse xmlns:workflow="http://org.onap/so/workflow/schema/v1">
                                           <workflow:out>${MsoUtils.xmlEscape(out)}</workflow:out>
                                        </workflow:FalloutHandlerResponse>
                                """
 
-                       falloutHandlerResponse = utils.formatXml(falloutHandlerResponse)
-                       logger.debug("FalloutHandler Response: " + falloutHandlerResponse);
+            falloutHandlerResponse = utils.formatXml(falloutHandlerResponse)
+
+            execution.setVariable("FalloutHandlerResponse", falloutHandlerResponse)
+            execution.setVariable("WorkflowResponse", falloutHandlerResponse)
+            execution.setVariable("FH_ResponseCode", success ? "200" : "500")
+            setSuccessIndicator(execution, success)
 
-                       execution.setVariable("FalloutHandlerResponse", falloutHandlerResponse)
-                       execution.setVariable("WorkflowResponse", falloutHandlerResponse)
-                       execution.setVariable("FH_ResponseCode", success ? "200" : "500")
-                       setSuccessIndicator(execution, success)
+            logger.debug("FalloutHandlerResponse =\n" + falloutHandlerResponse)
+        } catch (Exception e) {
+            logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+                    'Caught exception in ' + method, "BPMN",
+                    ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+        }
+    }
 
-                       logger.debug("FalloutHandlerResponse =\n" + falloutHandlerResponse)
-               } catch (Exception e) {
-                       // Do NOT throw WorkflowException!
-                       logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                                       'Caught exception in ' + method, "BPMN",
-                                       ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
-               }
-       }
+    protected RequestsDbClient getDbClient(){
+        return new RequestsDbClient()
+    }
 }
index 63c867f..72bed98 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
   <bpmn2:process id="CompleteMsoProcess" name="CompleteMsoProcess" isExecutable="true">
     <bpmn2:scriptTask id="preProcessRequest" name="Pre-Process Request" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming>
@@ -10,8 +10,8 @@ preProcessRequestData.preProcessRequest(execution)
 
 ]]></bpmn2:script>
     </bpmn2:scriptTask>
-    <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="preProcessRequest" targetRef="ExclusiveGateway_1r258d4" />
-    <bpmn2:startEvent id="StartEvent_1" name="Start With message">
+    <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="preProcessRequest" targetRef="ScriptTask_3" />
+    <bpmn2:startEvent id="StartEvent_1">
       <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing>
       <bpmn2:messageEventDefinition id="MessageEventDefinition_1" messageRef="Message_2" />
     </bpmn2:startEvent>
@@ -34,136 +34,18 @@ preProcessRequestData.preProcessRequest(execution)
       </bpmn2:startEvent>
       <bpmn2:sequenceFlow id="SequenceFlow_1i1h3il" sourceRef="startEventExceptionCompleteMSO" targetRef="endEventExceptionCompleteMSO" />
     </bpmn2:subProcess>
-    <bpmn2:endEvent id="EndEvent_4">
-      <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
-      <bpmn2:errorEventDefinition id="ErrorEventDefinition_5" errorRef="Error_3" />
-    </bpmn2:endEvent>
-    <bpmn2:scriptTask id="ScriptTask_3" name="Prepare Infra&#10;&#10;Update DB Request" scriptFormat="groovy">
-      <bpmn2:incoming>SequenceFlow_127i45q</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
+    <bpmn2:scriptTask id="ScriptTask_3" name="&#10;MSO&#10;Update&#10;(infra active req)&#10;" scriptFormat="groovy">
+      <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
+      <bpmn2:outgoing>SequenceFlow_1oes9qv</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.*
 def completeMsoProcess = new CompleteMsoProcess()
-completeMsoProcess.setUpdateDBstatustoSuccessPayload(execution)]]></bpmn2:script>
-    </bpmn2:scriptTask>
-    <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="ScriptTask_3" targetRef="updateInfraRequest" />
-    <bpmn2:serviceTask id="updateInfraRequest" name="Update Infra DB status to SUCCESS">
-      <bpmn2:extensionElements>
-        <camunda:connector>
-          <camunda:inputOutput>
-            <camunda:inputParameter name="url"><![CDATA[${UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)}]]></camunda:inputParameter>
-            <camunda:inputParameter name="payload"><![CDATA[${execution.getVariable("CMSO_setUpdateDBstatustoSuccessPayload")}]]></camunda:inputParameter>
-            <camunda:inputParameter name="headers">
-              <camunda:map>
-                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
-                <camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry>
-                <camunda:entry key="X-ONAP-RequestID">#{CMSO_request_id}</camunda:entry>
-              </camunda:map>
-            </camunda:inputParameter>
-            <camunda:inputParameter name="method">POST</camunda:inputParameter>
-            <camunda:outputParameter name="CMSO_updateRequestResponse"><![CDATA[${statusCode == null || statusCode == 204 ? "" : response}]]></camunda:outputParameter>
-            <camunda:outputParameter name="CMSO_updateRequestResponseCode">${statusCode}</camunda:outputParameter>
-          </camunda:inputOutput>
-          <camunda:connectorId>soap-http-connector</camunda:connectorId>
-        </camunda:connector>
-      </bpmn2:extensionElements>
-      <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
-    </bpmn2:serviceTask>
-    <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="updateInfraRequest" targetRef="ExclusiveGateway_7" />
-    <bpmn2:scriptTask id="BuildErrorMessage" name="Build Error Message" scriptFormat="groovy">
-      <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
-      <bpmn2:incoming>SequenceFlow_0mipf25</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
-      <bpmn2:script><![CDATA[//println "INSIDE --> Build Error Message @@@@"
-//println "CMSO_updateRequestResponse IS --> " + execution.getVariable("CMSO_updateRequestResponse")
-import org.onap.so.bpmn.common.scripts.*
-def buildDataErrorMessage = new CompleteMsoProcess()
-buildDataErrorMessage.buildDataError(execution, "Complete MSO  -- Update DB status to SUCCESS -- Failed")]]></bpmn2:script>
+completeMsoProcess.updateInfraRequestDB(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
-    <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="BuildErrorMessage" targetRef="EndEvent_4" />
-    <bpmn2:exclusiveGateway id="ExclusiveGateway_7" default="SequenceFlow_1">
-      <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
-      <bpmn2:outgoing>SequenceFlow_03z8rch</bpmn2:outgoing>
-    </bpmn2:exclusiveGateway>
-    <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="ExclusiveGateway_7" targetRef="BuildErrorMessage" />
-    <bpmn2:boundaryEvent id="BoundaryEvent_7" name="" attachedToRef="updateInfraRequest">
-      <bpmn2:outgoing>SequenceFlow_0mipf25</bpmn2:outgoing>
-      <bpmn2:errorEventDefinition id="_ErrorEventDefinition_84" errorRef="Error_1" camunda:errorCodeVariable="gJavaErrorCode" camunda:errorMessageVariable="gJavaErrorMessage" />
-    </bpmn2:boundaryEvent>
     <bpmn2:endEvent id="EndEvent_1">
-      <bpmn2:incoming>SequenceFlow_1pzb94j</bpmn2:incoming>
+      <bpmn2:incoming>SequenceFlow_1oes9qv</bpmn2:incoming>
       <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_2" />
     </bpmn2:endEvent>
-    <bpmn2:sequenceFlow id="SequenceFlow_0mipf25" name="Connect Fault" sourceRef="BoundaryEvent_7" targetRef="BuildErrorMessage" />
-    <bpmn2:callActivity id="CallActivity_101qf6x" name="Call Notification Service" calledElement="${UrnPropertiesReader.getVariable(&#34;mso.workflow.notification.name&#34;, execution)}">
-      <bpmn2:extensionElements>
-        <camunda:in source="mso-request-id" target="mso-request-id" />
-        <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
-        <camunda:in variables="all" />
-        <camunda:out variables="all" />
-        <camunda:in businessKey="#{execution.processBusinessKey}" />
-      </bpmn2:extensionElements>
-      <bpmn2:incoming>SequenceFlow_81</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_13qdn1s</bpmn2:outgoing>
-    </bpmn2:callActivity>
-    <bpmn2:sequenceFlow id="SequenceFlow_13qdn1s" sourceRef="CallActivity_101qf6x" targetRef="ParallelGateway_7" />
-    <bpmn2:exclusiveGateway id="ExclusiveGateway_3" name="Active Request?" default="SequenceFlow_1dptl35">
-      <bpmn2:incoming>SequenceFlow_067veaf</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_81</bpmn2:outgoing>
-      <bpmn2:outgoing>SequenceFlow_1dptl35</bpmn2:outgoing>
-    </bpmn2:exclusiveGateway>
-    <bpmn2:exclusiveGateway id="ParallelGateway_7">
-      <bpmn2:incoming>SequenceFlow_1dptl35</bpmn2:incoming>
-      <bpmn2:incoming>SequenceFlow_13qdn1s</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_1hpvwyt</bpmn2:outgoing>
-    </bpmn2:exclusiveGateway>
-    <bpmn2:sequenceFlow id="SequenceFlow_81" name="Yes" sourceRef="ExclusiveGateway_3" targetRef="CallActivity_101qf6x">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CMSO_notification-url-Ok") ==true || execution.getVariable("CMSO_request_id-Ok") ==true}]]></bpmn2:conditionExpression>
-    </bpmn2:sequenceFlow>
-    <bpmn2:sequenceFlow id="SequenceFlow_1dptl35" sourceRef="ExclusiveGateway_3" targetRef="ParallelGateway_7" />
-    <bpmn2:parallelGateway id="ExclusiveGateway_1r258d4">
-      <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_067veaf</bpmn2:outgoing>
-      <bpmn2:outgoing>SequenceFlow_0xe5zck</bpmn2:outgoing>
-    </bpmn2:parallelGateway>
-    <bpmn2:parallelGateway id="ExclusiveGateway_019d74x">
-      <bpmn2:incoming>SequenceFlow_12he9a1</bpmn2:incoming>
-      <bpmn2:incoming>SequenceFlow_1hpvwyt</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_1g8ig3h</bpmn2:outgoing>
-    </bpmn2:parallelGateway>
-    <bpmn2:sequenceFlow id="SequenceFlow_1g8ig3h" sourceRef="ExclusiveGateway_019d74x" targetRef="ScriptTask_0vyk0lo" />
-    <bpmn2:sequenceFlow id="SequenceFlow_067veaf" sourceRef="ExclusiveGateway_1r258d4" targetRef="ExclusiveGateway_3" />
-    <bpmn2:exclusiveGateway id="ExclusiveGateway_08yqzk9" name="Infra Check Check" default="SequenceFlow_1ffkc0n">
-      <bpmn2:incoming>SequenceFlow_0xe5zck</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_127i45q</bpmn2:outgoing>
-      <bpmn2:outgoing>SequenceFlow_1ffkc0n</bpmn2:outgoing>
-    </bpmn2:exclusiveGateway>
-    <bpmn2:sequenceFlow id="SequenceFlow_0xe5zck" sourceRef="ExclusiveGateway_1r258d4" targetRef="ExclusiveGateway_08yqzk9" />
-    <bpmn2:sequenceFlow id="SequenceFlow_127i45q" sourceRef="ExclusiveGateway_08yqzk9" targetRef="ScriptTask_3">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CMSO_request_id-Ok") ==false}]]></bpmn2:conditionExpression>
-    </bpmn2:sequenceFlow>
-    <bpmn2:exclusiveGateway id="ExclusiveGateway_1utv1g8">
-      <bpmn2:incoming>SequenceFlow_03z8rch</bpmn2:incoming>
-      <bpmn2:incoming>SequenceFlow_1ffkc0n</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_12he9a1</bpmn2:outgoing>
-    </bpmn2:exclusiveGateway>
-    <bpmn2:sequenceFlow id="SequenceFlow_03z8rch" sourceRef="ExclusiveGateway_7" targetRef="ExclusiveGateway_1utv1g8">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CMSO_updateRequestResponseCode")==200}]]></bpmn2:conditionExpression>
-    </bpmn2:sequenceFlow>
-    <bpmn2:sequenceFlow id="SequenceFlow_1ffkc0n" sourceRef="ExclusiveGateway_08yqzk9" targetRef="ExclusiveGateway_1utv1g8" />
-    <bpmn2:sequenceFlow id="SequenceFlow_12he9a1" sourceRef="ExclusiveGateway_1utv1g8" targetRef="ExclusiveGateway_019d74x" />
-    <bpmn2:sequenceFlow id="SequenceFlow_1hpvwyt" sourceRef="ParallelGateway_7" targetRef="ExclusiveGateway_019d74x" />
-    <bpmn2:scriptTask id="ScriptTask_0vyk0lo" name="Prepare Response" scriptFormat="groovy">
-      <bpmn2:incoming>SequenceFlow_1g8ig3h</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_1pzb94j</bpmn2:outgoing>
-      <bpmn2:script><![CDATA[println "INSIDE --> Complete MSO Process Done SUCCESSFULLY"
-import org.onap.so.bpmn.common.scripts.*
-def postProcessResponseData = new CompleteMsoProcess()
-postProcessResponseData.postProcessResponse(execution)
-println "CompleteMsoProcess Response -->" + "\n" + execution.getVariable("CompletionHandlerResponse")]]></bpmn2:script>
-    </bpmn2:scriptTask>
-    <bpmn2:sequenceFlow id="SequenceFlow_1pzb94j" sourceRef="ScriptTask_0vyk0lo" targetRef="EndEvent_1" />
+    <bpmn2:sequenceFlow id="SequenceFlow_1oes9qv" sourceRef="ScriptTask_3" targetRef="EndEvent_1" />
   </bpmn2:process>
   <bpmn2:message id="Message_2" name="CompleteMsoProcessRequest" />
   <bpmn2:error id="Error_3" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
@@ -171,254 +53,64 @@ println "CompleteMsoProcess Response -->" + "\n" + execution.getVariable("Comple
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CompleteMsoProcess">
       <bpmndi:BPMNShape id="_BPMNShape_StartEvent_41" bpmnElement="StartEvent_1">
-        <dc:Bounds x="67" y="297" width="36" height="36" />
+        <dc:Bounds x="103" y="156" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="94" y="338" width="49" height="25" />
+          <dc:Bounds x="131" y="197" width="47" height="24" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_34" bpmnElement="preProcessRequest">
-        <dc:Bounds x="167" y="275" width="100" height="80" />
+        <dc:Bounds x="293" y="134" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_34" targetElement="ParallelGateway_1domt5l_di">
-        <di:waypoint xsi:type="dc:Point" x="267" y="316" />
-        <di:waypoint xsi:type="dc:Point" x="322" y="316" />
+      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_34" targetElement="_BPMNShape_ScriptTask_88">
+        <di:waypoint xsi:type="dc:Point" x="393" y="174" />
+        <di:waypoint xsi:type="dc:Point" x="440" y="174" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="295" y="301" width="0" height="0" />
+          <dc:Bounds x="371.5" y="159" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_18" sourceElement="_BPMNShape_StartEvent_41" targetElement="_BPMNShape_ScriptTask_34">
-        <di:waypoint xsi:type="dc:Point" x="103" y="315" />
-        <di:waypoint xsi:type="dc:Point" x="167" y="315" />
+        <di:waypoint xsi:type="dc:Point" x="139" y="174" />
+        <di:waypoint xsi:type="dc:Point" x="293" y="174" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="135" y="300" width="0" height="0" />
+          <dc:Bounds x="171" y="159" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_51" bpmnElement="updateInfraRequest">
-        <dc:Bounds x="657" y="451" width="100" height="80" />
-      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="_BPMNShape_SubProcess_13" bpmnElement="subProcessExceptionCompleteMSO" isExpanded="true">
-        <dc:Bounds x="171" y="709" width="427" height="169" />
+        <dc:Bounds x="208" y="407" width="427" height="169" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="_BPMNShape_EndEvent_110" bpmnElement="endEventExceptionCompleteMSO">
-        <dc:Bounds x="471" y="776" width="36" height="36" />
+        <dc:Bounds x="508" y="474" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="489" y="817" width="0" height="0" />
+          <dc:Bounds x="481" y="515" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="_BPMNShape_StartEvent_51" bpmnElement="startEventExceptionCompleteMSO">
-        <dc:Bounds x="219" y="776" width="36" height="36" />
+        <dc:Bounds x="256" y="474" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="237" y="817" width="0" height="0" />
+          <dc:Bounds x="229" y="515" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_63" bpmnElement="ExclusiveGateway_7" isMarkerVisible="true">
-        <dc:Bounds x="816" y="465" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="841" y="520" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_51" targetElement="_BPMNShape_ExclusiveGateway_63">
-        <di:waypoint xsi:type="dc:Point" x="757" y="491" />
-        <di:waypoint xsi:type="dc:Point" x="816" y="490" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="942" y="534" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="_BPMNShape_EndEvent_111" bpmnElement="EndEvent_4">
-        <dc:Bounds x="953" y="578" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="971" y="619" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_76" bpmnElement="BuildErrorMessage">
-        <dc:Bounds x="792" y="556" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_ExclusiveGateway_63" targetElement="_BPMNShape_ScriptTask_76">
-        <di:waypoint xsi:type="dc:Point" x="841" y="515" />
-        <di:waypoint xsi:type="dc:Point" x="842" y="556" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="886" y="342" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_76" targetElement="_BPMNShape_EndEvent_111">
-        <di:waypoint xsi:type="dc:Point" x="892" y="596" />
-        <di:waypoint xsi:type="dc:Point" x="953" y="596" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="923" y="596" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="_BPMNShape_EndEvent_128" bpmnElement="EndEvent_1">
-        <dc:Bounds x="1270" y="297" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1288" y="338" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_29" bpmnElement="BoundaryEvent_7">
-        <dc:Bounds x="686" y="513" width="36" height="36" />
+        <dc:Bounds x="699" y="156" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="979" y="395" width="0" height="0" />
+          <dc:Bounds x="672" y="197" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_88" bpmnElement="ScriptTask_3">
-        <dc:Bounds x="506" y="451" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_88" targetElement="_BPMNShape_ScriptTask_51">
-        <di:waypoint xsi:type="dc:Point" x="606" y="491" />
-        <di:waypoint xsi:type="dc:Point" x="657" y="491" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="626" y="515" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0mipf25_di" bpmnElement="SequenceFlow_0mipf25">
-        <di:waypoint xsi:type="dc:Point" x="704" y="549" />
-        <di:waypoint xsi:type="dc:Point" x="704" y="596" />
-        <di:waypoint xsi:type="dc:Point" x="792" y="596" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="623" y="563" width="68" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="CallActivity_101qf6x_di" bpmnElement="CallActivity_101qf6x">
-        <dc:Bounds x="633" y="186" width="100" height="80" />
+        <dc:Bounds x="440" y="134" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_13qdn1s_di" bpmnElement="SequenceFlow_13qdn1s">
-        <di:waypoint xsi:type="dc:Point" x="733" y="226" />
-        <di:waypoint xsi:type="dc:Point" x="888" y="226" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="811" y="211" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1i1h3il_di" bpmnElement="SequenceFlow_1i1h3il">
-        <di:waypoint xsi:type="dc:Point" x="255" y="794" />
-        <di:waypoint xsi:type="dc:Point" x="471" y="794" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="363" y="779" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_60" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true">
-        <dc:Bounds x="394" y="201" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="326" y="196" width="80" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_9" bpmnElement="ParallelGateway_7" isMarkerVisible="true">
-        <dc:Bounds x="888" y="201" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="913" y="256" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_82" bpmnElement="SequenceFlow_81">
-        <di:waypoint xsi:type="dc:Point" x="444" y="226" />
-        <di:waypoint xsi:type="dc:Point" x="633" y="226" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="552" y="234" width="18" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1dptl35_di" bpmnElement="SequenceFlow_1dptl35">
-        <di:waypoint xsi:type="dc:Point" x="419" y="251" />
-        <di:waypoint xsi:type="dc:Point" x="419" y="333" />
-        <di:waypoint xsi:type="dc:Point" x="913" y="333" />
-        <di:waypoint xsi:type="dc:Point" x="913" y="251" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="448" y="273" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ParallelGateway_1domt5l_di" bpmnElement="ExclusiveGateway_1r258d4">
-        <dc:Bounds x="322" y="291" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="347" y="341" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ParallelGateway_04tefv6_di" bpmnElement="ExclusiveGateway_019d74x">
-        <dc:Bounds x="999" y="290" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1024" y="340" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1g8ig3h_di" bpmnElement="SequenceFlow_1g8ig3h">
-        <di:waypoint xsi:type="dc:Point" x="1049" y="315" />
-        <di:waypoint xsi:type="dc:Point" x="1104" y="315" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1077" y="300" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_067veaf_di" bpmnElement="SequenceFlow_067veaf">
-        <di:waypoint xsi:type="dc:Point" x="347" y="291" />
-        <di:waypoint xsi:type="dc:Point" x="347" y="226" />
-        <di:waypoint xsi:type="dc:Point" x="394" y="226" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="362" y="258.5" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ExclusiveGateway_08yqzk9_di" bpmnElement="ExclusiveGateway_08yqzk9" isMarkerVisible="true">
-        <dc:Bounds x="394" y="466" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="390" y="516" width="57" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0xe5zck_di" bpmnElement="SequenceFlow_0xe5zck">
-        <di:waypoint xsi:type="dc:Point" x="347" y="341" />
-        <di:waypoint xsi:type="dc:Point" x="347" y="491" />
-        <di:waypoint xsi:type="dc:Point" x="394" y="491" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="362" y="416" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_127i45q_di" bpmnElement="SequenceFlow_127i45q">
-        <di:waypoint xsi:type="dc:Point" x="444" y="491" />
-        <di:waypoint xsi:type="dc:Point" x="473" y="491" />
-        <di:waypoint xsi:type="dc:Point" x="473" y="491" />
-        <di:waypoint xsi:type="dc:Point" x="506" y="491" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="488" y="491" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ExclusiveGateway_1utv1g8_di" bpmnElement="ExclusiveGateway_1utv1g8" isMarkerVisible="true">
-        <dc:Bounds x="999" y="391" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1024" y="441" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_03z8rch_di" bpmnElement="SequenceFlow_03z8rch">
-        <di:waypoint xsi:type="dc:Point" x="866" y="490" />
-        <di:waypoint xsi:type="dc:Point" x="1024" y="490" />
-        <di:waypoint xsi:type="dc:Point" x="1024" y="441" />
+        <di:waypoint xsi:type="dc:Point" x="292" y="492" />
+        <di:waypoint xsi:type="dc:Point" x="508" y="492" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="945" y="475" width="0" height="0" />
+          <dc:Bounds x="355" y="477" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ffkc0n_di" bpmnElement="SequenceFlow_1ffkc0n">
-        <di:waypoint xsi:type="dc:Point" x="419" y="466" />
-        <di:waypoint xsi:type="dc:Point" x="419" y="416" />
-        <di:waypoint xsi:type="dc:Point" x="999" y="416" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="434" y="441" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_12he9a1_di" bpmnElement="SequenceFlow_12he9a1">
-        <di:waypoint xsi:type="dc:Point" x="1024" y="391" />
-        <di:waypoint xsi:type="dc:Point" x="1024" y="367" />
-        <di:waypoint xsi:type="dc:Point" x="1024" y="367" />
-        <di:waypoint xsi:type="dc:Point" x="1024" y="340" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1039" y="367" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1hpvwyt_di" bpmnElement="SequenceFlow_1hpvwyt">
-        <di:waypoint xsi:type="dc:Point" x="938" y="226" />
-        <di:waypoint xsi:type="dc:Point" x="1024" y="226" />
-        <di:waypoint xsi:type="dc:Point" x="1024" y="290" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="981" y="211" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_0vyk0lo_di" bpmnElement="ScriptTask_0vyk0lo">
-        <dc:Bounds x="1104" y="275" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1pzb94j_di" bpmnElement="SequenceFlow_1pzb94j">
-        <di:waypoint xsi:type="dc:Point" x="1204" y="315" />
-        <di:waypoint xsi:type="dc:Point" x="1270" y="315" />
+      <bpmndi:BPMNEdge id="SequenceFlow_1oes9qv_di" bpmnElement="SequenceFlow_1oes9qv">
+        <di:waypoint xsi:type="dc:Point" x="540" y="174" />
+        <di:waypoint xsi:type="dc:Point" x="699" y="174" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1237" y="290" width="0" height="0" />
+          <dc:Bounds x="619.5" y="153" width="0" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
index 6914e75..0c7a8ac 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_3SPHsLr9EeWak-hhutJWuQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_3SPHsLr9EeWak-hhutJWuQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
   <bpmn2:process id="FalloutHandler" name="Fallout Handler" isExecutable="true">
-    <bpmn2:parallelGateway id="ParallelGateway_1">
-      <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
-      <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing>
-    </bpmn2:parallelGateway>
-    <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="ParallelGateway_1" targetRef="ExclusiveGateway_1" />
-    <bpmn2:sequenceFlow id="SequenceFlow_24" name="" sourceRef="ParallelGateway_1" targetRef="ExclusiveGateway_6" />
-    <bpmn2:exclusiveGateway id="ExclusiveGateway_1" name="Notification URL exists?" default="SequenceFlow_23">
-      <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
-      <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing>
-    </bpmn2:exclusiveGateway>
-    <bpmn2:sequenceFlow id="SequenceFlow_3" name="yes" sourceRef="ExclusiveGateway_1" targetRef="Task_0ixuwt5">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("FH_notification-url-Ok") ==true}]]></bpmn2:conditionExpression>
-    </bpmn2:sequenceFlow>
-    <bpmn2:sequenceFlow id="SequenceFlow_23" name="no" sourceRef="ExclusiveGateway_1" targetRef="ParallelGateway_4" />
     <bpmn2:scriptTask id="ScriptTask_8" name="Pre-Process Request" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing>
+      <bpmn2:outgoing>SequenceFlow_1kx7ea5</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.*
 def preProcessRequestData = new FalloutHandler()
 preProcessRequestData.preProcessRequest(execution)
 
 ]]></bpmn2:script>
     </bpmn2:scriptTask>
-    <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="ScriptTask_8" targetRef="ParallelGateway_1" />
-    <bpmn2:startEvent id="StartEvent_1" name="Start">
+    <bpmn2:startEvent id="StartEvent_1">
       <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
     </bpmn2:startEvent>
     <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="StartEvent_1" targetRef="ScriptTask_8" />
-    <bpmn2:parallelGateway id="ParallelGateway_6">
-      <bpmn2:incoming>SequenceFlow_37</bpmn2:incoming>
-      <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
-    </bpmn2:parallelGateway>
-    <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="ParallelGateway_6" targetRef="ScriptTask_2" />
     <bpmn2:scriptTask id="ScriptTask_2" name="Post Process Response" scriptFormat="groovy">
-      <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
+      <bpmn2:incoming>SequenceFlow_1u8shdz</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.*
 def falloutHandler = new FalloutHandler()
 falloutHandler.postProcessResponse(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="ScriptTask_2" targetRef="EndEvent_6" />
-    <bpmn2:exclusiveGateway id="ParallelGateway_4">
-      <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming>
-      <bpmn2:incoming>SequenceFlow_0m7gwor</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing>
-    </bpmn2:exclusiveGateway>
-    <bpmn2:sequenceFlow id="SequenceFlow_38" name="" sourceRef="ParallelGateway_4" targetRef="ParallelGateway_6" />
-    <bpmn2:exclusiveGateway id="ExclusiveGateway_6" default="SequenceFlow_26">
-      <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_25</bpmn2:outgoing>
-      <bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing>
-    </bpmn2:exclusiveGateway>
-    <bpmn2:sequenceFlow id="SequenceFlow_25" name="" sourceRef="ExclusiveGateway_6" targetRef="ServiceTask_3">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("FH_request_id-Ok") ==true}]]></bpmn2:conditionExpression>
-    </bpmn2:sequenceFlow>
-    <bpmn2:sequenceFlow id="SequenceFlow_26" name="" sourceRef="ExclusiveGateway_6" targetRef="ServiceTask_2" />
-    <bpmn2:serviceTask id="ServiceTask_3" name="Update Request Gamma">
-      <bpmn2:extensionElements>
-        <camunda:connector>
-          <camunda:inputOutput>
-            <camunda:inputParameter name="url"><![CDATA[${UrnPropertiesReader.getVariable("mso.adapters.db.att-endpoint", execution)}]]></camunda:inputParameter>
-            <camunda:inputParameter name="method">POST</camunda:inputParameter>
-            <camunda:inputParameter name="headers">
-              <camunda:map>
-                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
-                <camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry>
-                <camunda:entry key="X-ONAP-RequestID">#{FH_request_id}</camunda:entry>
-              </camunda:map>
-            </camunda:inputParameter>
-            <camunda:inputParameter name="payload">
-              <camunda:script scriptFormat="groovy"><![CDATA[//println"INSIDE --> update Request Gamma"
-import org.onap.so.bpmn.common.scripts.*
-def updateRequestGamma= new FalloutHandler()
-return updateRequestGamma.updateRequestGammaPayload(execution)]]></camunda:script>
-            </camunda:inputParameter>
-            <camunda:outputParameter name="FH_updateRequestGammaResponse"><![CDATA[${statusCode == null || statusCode == 204 ? "" : response}]]></camunda:outputParameter>
-            <camunda:outputParameter name="FH_updateRequestGammaResponseCode">${statusCode}</camunda:outputParameter>
-          </camunda:inputOutput>
-          <camunda:connectorId>soap-http-connector</camunda:connectorId>
-        </camunda:connector>
-      </bpmn2:extensionElements>
-      <bpmn2:incoming>SequenceFlow_25</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_29</bpmn2:outgoing>
-    </bpmn2:serviceTask>
-    <bpmn2:sequenceFlow id="SequenceFlow_29" name="" sourceRef="ServiceTask_3" targetRef="ExclusiveGateway_7" />
-    <bpmn2:boundaryEvent id="BoundaryEvent_2" name="Connect Fault" attachedToRef="ServiceTask_3">
-      <bpmn2:outgoing>SequenceFlow_72</bpmn2:outgoing>
-      <bpmn2:errorEventDefinition id="_ErrorEventDefinition_89" errorRef="Error_2" />
-    </bpmn2:boundaryEvent>
-    <bpmn2:exclusiveGateway id="ParallelGateway_5">
-      <bpmn2:incoming>SequenceFlow_35</bpmn2:incoming>
-      <bpmn2:incoming>SequenceFlow_36</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_37</bpmn2:outgoing>
-    </bpmn2:exclusiveGateway>
-    <bpmn2:sequenceFlow id="SequenceFlow_37" name="" sourceRef="ParallelGateway_5" targetRef="ParallelGateway_6" />
-    <bpmn2:endEvent id="EndEvent_6" name="Normal End">
+    <bpmn2:endEvent id="EndEvent_6">
       <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
     </bpmn2:endEvent>
-    <bpmn2:sequenceFlow id="SequenceFlow_72" name="" sourceRef="BoundaryEvent_2" targetRef="ScriptTask_6" />
-    <bpmn2:scriptTask id="ScriptTask_6" name="Build Workflow Exception" scriptFormat="groovy">
-      <bpmn2:incoming>SequenceFlow_72</bpmn2:incoming>
-      <bpmn2:incoming>SequenceFlow_31</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_79</bpmn2:outgoing>
+    <bpmn2:scriptTask id="ScriptTask_6" name="&#10;MSO&#10;Update&#10;(infra active req)&#10;" scriptFormat="groovy">
+      <bpmn2:incoming>SequenceFlow_1kx7ea5</bpmn2:incoming>
+      <bpmn2:outgoing>SequenceFlow_1u8shdz</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.*
 def falloutHandler = new FalloutHandler()
-falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestGammaResponseCode")]]></bpmn2:script>
+falloutHandler.updateInfraRequestDB(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
-    <bpmn2:sequenceFlow id="SequenceFlow_79" name="" sourceRef="ScriptTask_6" targetRef="EndEvent_13" />
-    <bpmn2:exclusiveGateway id="ExclusiveGateway_7" name="Update Success?" default="SequenceFlow_31">
-      <bpmn2:incoming>SequenceFlow_29</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_31</bpmn2:outgoing>
-      <bpmn2:outgoing>SequenceFlow_35</bpmn2:outgoing>
-    </bpmn2:exclusiveGateway>
-    <bpmn2:sequenceFlow id="SequenceFlow_31" name="" sourceRef="ExclusiveGateway_7" targetRef="ScriptTask_6" />
-    <bpmn2:sequenceFlow id="SequenceFlow_35" name="" sourceRef="ExclusiveGateway_7" targetRef="ParallelGateway_5">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("FH_updateRequestGammaResponseCode")==200}]]></bpmn2:conditionExpression>
-    </bpmn2:sequenceFlow>
-    <bpmn2:scriptTask id="ScriptTask_7" name="Build Workflow Exception" scriptFormat="groovy">
-      <bpmn2:incoming>SequenceFlow_32</bpmn2:incoming>
-      <bpmn2:incoming>SequenceFlow_80</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_73</bpmn2:outgoing>
-      <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.*
-def falloutHandler = new FalloutHandler()
-falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestInfraResponseCode")]]></bpmn2:script>
-    </bpmn2:scriptTask>
-    <bpmn2:sequenceFlow id="SequenceFlow_73" name="" sourceRef="ScriptTask_7" targetRef="EndEvent_14" />
-    <bpmn2:serviceTask id="ServiceTask_2" name="Update Request Infra">
-      <bpmn2:extensionElements>
-        <camunda:connector>
-          <camunda:inputOutput>
-            <camunda:inputParameter name="url"><![CDATA[${UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)}]]></camunda:inputParameter>
-            <camunda:inputParameter name="method">POST</camunda:inputParameter>
-            <camunda:inputParameter name="headers">
-              <camunda:map>
-                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
-                <camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry>
-                <camunda:entry key="X-ONAP-RequestID">#{FH_request_id}</camunda:entry>
-              </camunda:map>
-            </camunda:inputParameter>
-            <camunda:inputParameter name="payload">
-              <camunda:script scriptFormat="groovy"><![CDATA[//println"INSIDE --> update Request Infra"
-import org.onap.so.bpmn.common.scripts.*
-def updateRequestInfra= new FalloutHandler()
-return updateRequestInfra.updateRequestInfraPayload(execution)]]></camunda:script>
-            </camunda:inputParameter>
-            <camunda:outputParameter name="FH_updateRequestInfraResponse"><![CDATA[${statusCode == null || statusCode == 204 ? "" : response}]]></camunda:outputParameter>
-            <camunda:outputParameter name="FH_updateRequestInfraResponseCode">${statusCode}</camunda:outputParameter>
-          </camunda:inputOutput>
-          <camunda:connectorId>soap-http-connector</camunda:connectorId>
-        </camunda:connector>
-      </bpmn2:extensionElements>
-      <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_30</bpmn2:outgoing>
-    </bpmn2:serviceTask>
-    <bpmn2:sequenceFlow id="SequenceFlow_30" name="" sourceRef="ServiceTask_2" targetRef="ExclusiveGateway_8" />
-    <bpmn2:exclusiveGateway id="ExclusiveGateway_8" name="Update Success?" default="SequenceFlow_32">
-      <bpmn2:incoming>SequenceFlow_30</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_32</bpmn2:outgoing>
-      <bpmn2:outgoing>SequenceFlow_36</bpmn2:outgoing>
-    </bpmn2:exclusiveGateway>
-    <bpmn2:sequenceFlow id="SequenceFlow_32" name="" sourceRef="ExclusiveGateway_8" targetRef="ScriptTask_7" />
-    <bpmn2:sequenceFlow id="SequenceFlow_36" name="" sourceRef="ExclusiveGateway_8" targetRef="ParallelGateway_5">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("FH_updateRequestInfraResponseCode")==200}]]></bpmn2:conditionExpression>
-    </bpmn2:sequenceFlow>
-    <bpmn2:boundaryEvent id="BoundaryEvent_3" name="Connect Fault" attachedToRef="ServiceTask_2">
-      <bpmn2:outgoing>SequenceFlow_80</bpmn2:outgoing>
-      <bpmn2:errorEventDefinition id="_ErrorEventDefinition_90" errorRef="Error_2" camunda:errorCodeVariable="gJavaErrorCode" camunda:errorMessageVariable="gJavaErrorMessage" />
-    </bpmn2:boundaryEvent>
-    <bpmn2:sequenceFlow id="SequenceFlow_80" name="" sourceRef="BoundaryEvent_3" targetRef="ScriptTask_7" />
     <bpmn2:subProcess id="SubProcess_1" name="Event Handler" triggeredByEvent="true">
       <bpmn2:scriptTask id="ScriptTask_4" name="Handle Event" scriptFormat="groovy">
         <bpmn2:incoming>SequenceFlow_1ko8ggw</bpmn2:incoming>
@@ -200,345 +59,94 @@ execution.setVariable("FH_WorkflowException", wfe)]]></bpmn2:script>
       <bpmn2:sequenceFlow id="SequenceFlow_1ko8ggw" sourceRef="StartEvent_2" targetRef="ScriptTask_4" />
       <bpmn2:sequenceFlow id="SequenceFlow_1pm9r7h" sourceRef="ScriptTask_4" targetRef="EndEvent_2" />
     </bpmn2:subProcess>
-    <bpmn2:endEvent id="EndEvent_14">
-      <bpmn2:incoming>SequenceFlow_73</bpmn2:incoming>
-      <bpmn2:terminateEventDefinition />
-    </bpmn2:endEvent>
-    <bpmn2:endEvent id="EndEvent_13">
-      <bpmn2:incoming>SequenceFlow_79</bpmn2:incoming>
-      <bpmn2:terminateEventDefinition />
-    </bpmn2:endEvent>
-    <bpmn2:sequenceFlow id="SequenceFlow_0m7gwor" sourceRef="Task_0ixuwt5" targetRef="ParallelGateway_4" />
-    <bpmn2:callActivity id="Task_0ixuwt5" name="Call Notification Service" calledElement="${UrnPropertiesReader.getVariable(&#34;mso.workflow.notification.name&#34;, execution)}">
-      <bpmn2:extensionElements>
-        <camunda:in source="mso-request-id" target="mso-request-id" />
-        <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
-        <camunda:in variables="all" />
-        <camunda:out variables="all" />
-      </bpmn2:extensionElements>
-      <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
-      <bpmn2:outgoing>SequenceFlow_0m7gwor</bpmn2:outgoing>
-    </bpmn2:callActivity>
+    <bpmn2:sequenceFlow id="SequenceFlow_1kx7ea5" sourceRef="ScriptTask_8" targetRef="ScriptTask_6" />
+    <bpmn2:sequenceFlow id="SequenceFlow_1u8shdz" sourceRef="ScriptTask_6" targetRef="ScriptTask_2" />
   </bpmn2:process>
   <bpmn2:error id="Error_1" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmn2:error id="Error_2" name="Java Lang Exception" errorCode="java.lang.Exception" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="FalloutHandler">
       <bpmndi:BPMNShape id="_BPMNShape_StartEvent_52" bpmnElement="StartEvent_1">
-        <dc:Bounds x="139" y="263" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="145" y="300" width="23" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_12" bpmnElement="ParallelGateway_1">
-        <dc:Bounds x="342" y="255" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="367" y="310" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_74" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
-        <dc:Bounds x="415" y="107" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="315" y="89" width="81" height="24" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ParallelGateway_12" targetElement="_BPMNShape_ExclusiveGateway_74">
-        <di:waypoint xsi:type="dc:Point" x="367" y="255" />
-        <di:waypoint xsi:type="dc:Point" x="367" y="132" />
-        <di:waypoint xsi:type="dc:Point" x="415" y="132" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="438" y="212" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ExclusiveGateway_74" targetElement="CallActivity_0jz0w0k_di">
-        <di:waypoint xsi:type="dc:Point" x="440" y="107" />
-        <di:waypoint xsi:type="dc:Point" x="440" y="65" />
-        <di:waypoint xsi:type="dc:Point" x="553" y="65" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="475" y="70" width="18" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_15" bpmnElement="ParallelGateway_4" isMarkerVisible="true">
-        <dc:Bounds x="742" y="107" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="767" y="162" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_23" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_74" targetElement="_BPMNShape_ParallelGateway_15">
-        <di:waypoint xsi:type="dc:Point" x="440" y="157" />
-        <di:waypoint xsi:type="dc:Point" x="441" y="198" />
-        <di:waypoint xsi:type="dc:Point" x="767" y="198" />
-        <di:waypoint xsi:type="dc:Point" x="767" y="157" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="452" y="173" width="12" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_79" bpmnElement="ExclusiveGateway_6" isMarkerVisible="true">
-        <dc:Bounds x="412" y="468" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="437" y="523" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_24" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_ParallelGateway_12" targetElement="_BPMNShape_ExclusiveGateway_79">
-        <di:waypoint xsi:type="dc:Point" x="367" y="305" />
-        <di:waypoint xsi:type="dc:Point" x="367" y="493" />
-        <di:waypoint xsi:type="dc:Point" x="412" y="493" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="415" y="445" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_25" sourceElement="_BPMNShape_ExclusiveGateway_79" targetElement="_BPMNShape_ServiceTask_90">
-        <di:waypoint xsi:type="dc:Point" x="437" y="468" />
-        <di:waypoint xsi:type="dc:Point" x="437" y="402" />
-        <di:waypoint xsi:type="dc:Point" x="492" y="402" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="437" y="444" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_26" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_ExclusiveGateway_79" targetElement="_BPMNShape_ServiceTask_91">
-        <di:waypoint xsi:type="dc:Point" x="437" y="518" />
-        <di:waypoint xsi:type="dc:Point" x="437" y="650" />
-        <di:waypoint xsi:type="dc:Point" x="488" y="650" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="437" y="596" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="_BPMNShape_ServiceTask_90" bpmnElement="ServiceTask_3">
-        <dc:Bounds x="492" y="362" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="_BPMNShape_ServiceTask_91" bpmnElement="ServiceTask_2">
-        <dc:Bounds x="488" y="610" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_80" bpmnElement="ExclusiveGateway_7" isMarkerVisible="true">
-        <dc:Bounds x="675" y="376" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="657" y="431" width="87" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_29" sourceElement="_BPMNShape_ServiceTask_90" targetElement="_BPMNShape_ExclusiveGateway_80">
-        <di:waypoint xsi:type="dc:Point" x="592" y="402" />
-        <di:waypoint xsi:type="dc:Point" x="675" y="401" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="632" y="404" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_81" bpmnElement="ExclusiveGateway_8" isMarkerVisible="true">
-        <dc:Bounds x="674" y="625" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="656" y="680" width="87" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_30" bpmnElement="SequenceFlow_30" sourceElement="_BPMNShape_ServiceTask_91" targetElement="_BPMNShape_ExclusiveGateway_81">
-        <di:waypoint xsi:type="dc:Point" x="588" y="650" />
-        <di:waypoint xsi:type="dc:Point" x="626" y="650" />
-        <di:waypoint xsi:type="dc:Point" x="626" y="649" />
-        <di:waypoint xsi:type="dc:Point" x="674" y="650" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="636" y="651" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_31" bpmnElement="SequenceFlow_31" sourceElement="_BPMNShape_ExclusiveGateway_80" targetElement="_BPMNShape_ScriptTask_252">
-        <di:waypoint xsi:type="dc:Point" x="700" y="376" />
-        <di:waypoint xsi:type="dc:Point" x="701" y="324" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="707" y="351" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_32" bpmnElement="SequenceFlow_32" sourceElement="_BPMNShape_ExclusiveGateway_81" targetElement="_BPMNShape_ScriptTask_253">
-        <di:waypoint xsi:type="dc:Point" x="699" y="625" />
-        <di:waypoint xsi:type="dc:Point" x="699" y="608" />
-        <di:waypoint xsi:type="dc:Point" x="699" y="577" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="709" y="657" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_16" bpmnElement="ParallelGateway_5" isMarkerVisible="true">
-        <dc:Bounds x="853" y="468" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="878" y="523" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_35" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ExclusiveGateway_80" targetElement="_BPMNShape_ParallelGateway_16">
-        <di:waypoint xsi:type="dc:Point" x="725" y="401" />
-        <di:waypoint xsi:type="dc:Point" x="878" y="401" />
-        <di:waypoint xsi:type="dc:Point" x="878" y="468" />
+        <dc:Bounds x="128" y="162" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="762" y="392" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_36" bpmnElement="SequenceFlow_36" sourceElement="_BPMNShape_ExclusiveGateway_81" targetElement="_BPMNShape_ParallelGateway_16">
-        <di:waypoint xsi:type="dc:Point" x="724" y="650" />
-        <di:waypoint xsi:type="dc:Point" x="878" y="650" />
-        <di:waypoint xsi:type="dc:Point" x="878" y="518" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="878" y="574" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_17" bpmnElement="ParallelGateway_6">
-        <dc:Bounds x="957" y="254" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="982" y="309" width="0" height="0" />
+          <dc:Bounds x="134" y="199" width="24" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_37" bpmnElement="SequenceFlow_37" sourceElement="_BPMNShape_ParallelGateway_16" targetElement="_BPMNShape_ParallelGateway_17">
-        <di:waypoint xsi:type="dc:Point" x="903" y="493" />
-        <di:waypoint xsi:type="dc:Point" x="982" y="493" />
-        <di:waypoint xsi:type="dc:Point" x="982" y="304" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="943" y="478" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_38" sourceElement="_BPMNShape_ParallelGateway_15" targetElement="_BPMNShape_ParallelGateway_17">
-        <di:waypoint xsi:type="dc:Point" x="792" y="132" />
-        <di:waypoint xsi:type="dc:Point" x="982" y="132" />
-        <di:waypoint xsi:type="dc:Point" x="982" y="254" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="887" y="117" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_StartEvent_52" targetElement="_BPMNShape_ScriptTask_99">
-        <di:waypoint xsi:type="dc:Point" x="175" y="281" />
-        <di:waypoint xsi:type="dc:Point" x="211" y="281" />
+        <di:waypoint xsi:type="dc:Point" x="164" y="180" />
+        <di:waypoint xsi:type="dc:Point" x="279" y="180" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="193" y="281" width="0" height="0" />
+          <dc:Bounds x="176.5" y="165" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_99" bpmnElement="ScriptTask_8">
-        <dc:Bounds x="211" y="241" width="100" height="80" />
+        <dc:Bounds x="279" y="140" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="_BPMNShape_SubProcess_14" bpmnElement="SubProcess_1" isExpanded="true">
-        <dc:Bounds x="146" y="759" width="329" height="167" />
+        <dc:Bounds x="220" y="365" width="329" height="167" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_100" bpmnElement="ScriptTask_4">
-        <dc:Bounds x="259" y="803" width="100" height="80" />
+        <dc:Bounds x="333" y="409" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="_BPMNShape_StartEvent_54" bpmnElement="StartEvent_2">
-        <dc:Bounds x="175" y="825" width="36" height="36" />
+        <dc:Bounds x="249" y="431" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="193" y="869" width="0" height="0" />
+          <dc:Bounds x="222" y="475" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_101" bpmnElement="ScriptTask_2">
-        <dc:Bounds x="1054" y="240" width="100" height="80" />
+        <dc:Bounds x="589" y="140" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ParallelGateway_17" targetElement="_BPMNShape_ScriptTask_101">
-        <di:waypoint xsi:type="dc:Point" x="1007" y="279" />
-        <di:waypoint xsi:type="dc:Point" x="1054" y="280" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1177" y="280" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_99" targetElement="_BPMNShape_ParallelGateway_12">
-        <di:waypoint xsi:type="dc:Point" x="311" y="281" />
-        <di:waypoint xsi:type="dc:Point" x="342" y="280" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="327" y="281" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="_BPMNShape_EndEvent_129" bpmnElement="EndEvent_6">
-        <dc:Bounds x="1188" y="262" width="36" height="36" />
+        <dc:Bounds x="856" y="162" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1177" y="303" width="57" height="12" />
+          <dc:Bounds x="845" y="203" width="57" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_101" targetElement="_BPMNShape_EndEvent_129">
-        <di:waypoint xsi:type="dc:Point" x="1154" y="280" />
-        <di:waypoint xsi:type="dc:Point" x="1188" y="280" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1171" y="280" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_31" bpmnElement="BoundaryEvent_2">
-        <dc:Bounds x="525" y="344" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="563" y="300" width="68" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_32" bpmnElement="BoundaryEvent_3">
-        <dc:Bounds x="521" y="592" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="563" y="554" width="68" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_72" bpmnElement="SequenceFlow_72" sourceElement="_BPMNShape_BoundaryEvent_31" targetElement="_BPMNShape_ScriptTask_252">
-        <di:waypoint xsi:type="dc:Point" x="543" y="344" />
-        <di:waypoint xsi:type="dc:Point" x="543" y="284" />
-        <di:waypoint xsi:type="dc:Point" x="651" y="284" />
+        <di:waypoint xsi:type="dc:Point" x="689" y="180" />
+        <di:waypoint xsi:type="dc:Point" x="856" y="180" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="543" y="326" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_73" bpmnElement="SequenceFlow_73" sourceElement="_BPMNShape_ScriptTask_253">
-        <di:waypoint xsi:type="dc:Point" x="750" y="537" />
-        <di:waypoint xsi:type="dc:Point" x="790" y="537" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="770" y="522" width="0" height="0" />
+          <dc:Bounds x="727.5" y="165" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_252" bpmnElement="ScriptTask_6">
-        <dc:Bounds x="651" y="244" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_253" bpmnElement="ScriptTask_7">
-        <dc:Bounds x="650" y="497" width="100" height="80" />
+        <dc:Bounds x="431" y="141" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_79" bpmnElement="SequenceFlow_79" sourceElement="_BPMNShape_ScriptTask_252">
-        <di:waypoint xsi:type="dc:Point" x="751" y="284" />
-        <di:waypoint xsi:type="dc:Point" x="793" y="284" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="772" y="269" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_80" bpmnElement="SequenceFlow_80" sourceElement="_BPMNShape_BoundaryEvent_32" targetElement="_BPMNShape_ScriptTask_253">
-        <di:waypoint xsi:type="dc:Point" x="539" y="592" />
-        <di:waypoint xsi:type="dc:Point" x="539" y="537" />
-        <di:waypoint xsi:type="dc:Point" x="650" y="537" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="567" y="537" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="EndEvent_0b9vn2u_di" bpmnElement="EndEvent_2">
-        <dc:Bounds x="403" y="825" width="36" height="36" />
+        <dc:Bounds x="477" y="431" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="399" y="869" width="47" height="12" />
+          <dc:Bounds x="473" y="475" width="47" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="EndEvent_1fmpj5u_di" bpmnElement="EndEvent_14">
-        <dc:Bounds x="790" y="519" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="808" y="560" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="EndEvent_0w1puhf_di" bpmnElement="EndEvent_13">
-        <dc:Bounds x="793" y="266" width="36" height="36" />
+      <bpmndi:BPMNEdge id="SequenceFlow_1ko8ggw_di" bpmnElement="SequenceFlow_1ko8ggw">
+        <di:waypoint xsi:type="dc:Point" x="285" y="449" />
+        <di:waypoint xsi:type="dc:Point" x="333" y="449" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="811" y="307" width="0" height="0" />
+          <dc:Bounds x="264" y="424" width="90" height="0" />
         </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0m7gwor_di" bpmnElement="SequenceFlow_0m7gwor">
-        <di:waypoint xsi:type="dc:Point" x="654" y="65" />
-        <di:waypoint xsi:type="dc:Point" x="767" y="65" />
-        <di:waypoint xsi:type="dc:Point" x="767" y="107" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1pm9r7h_di" bpmnElement="SequenceFlow_1pm9r7h">
+        <di:waypoint xsi:type="dc:Point" x="433" y="449" />
+        <di:waypoint xsi:type="dc:Point" x="477" y="449" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="711" y="50" width="0" height="0" />
+          <dc:Bounds x="410" y="424" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ko8ggw_di" bpmnElement="SequenceFlow_1ko8ggw">
-        <di:waypoint xsi:type="dc:Point" x="211" y="843" />
-        <di:waypoint xsi:type="dc:Point" x="259" y="843" />
+      <bpmndi:BPMNEdge id="SequenceFlow_1kx7ea5_di" bpmnElement="SequenceFlow_1kx7ea5">
+        <di:waypoint xsi:type="dc:Point" x="379" y="180" />
+        <di:waypoint xsi:type="dc:Point" x="431" y="181" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="235" y="818" width="0" height="0" />
+          <dc:Bounds x="405" y="159.5" width="0" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1pm9r7h_di" bpmnElement="SequenceFlow_1pm9r7h">
-        <di:waypoint xsi:type="dc:Point" x="359" y="843" />
-        <di:waypoint xsi:type="dc:Point" x="403" y="843" />
+      <bpmndi:BPMNEdge id="SequenceFlow_1u8shdz_di" bpmnElement="SequenceFlow_1u8shdz">
+        <di:waypoint xsi:type="dc:Point" x="531" y="181" />
+        <di:waypoint xsi:type="dc:Point" x="589" y="180" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="381" y="818" width="0" height="0" />
+          <dc:Bounds x="560" y="159.5" width="0" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="CallActivity_0jz0w0k_di" bpmnElement="Task_0ixuwt5">
-        <dc:Bounds x="554" y="25" width="100" height="80" />
-      </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn2:definitions>
index 99c351c..119159f 100644 (file)
@@ -1,22 +1,22 @@
-/*- 
- * ============LICENSE_START======================================================= 
- * ONAP - SO 
- * ================================================================================ 
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. 
- * ================================================================================ 
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
- * ============LICENSE_END========================================================= 
- */ 
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
 
 package org.onap.so.bpmn.common.scripts
 
@@ -24,13 +24,17 @@ import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
 import org.junit.Before
+import org.junit.Ignore
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.mockito.ArgumentCaptor
+import org.mockito.Mock
 import org.mockito.MockitoAnnotations
+import org.mockito.Spy
 import org.mockito.runners.MockitoJUnitRunner
 import org.onap.so.bpmn.core.WorkflowException
-
+import org.onap.so.db.request.beans.InfraActiveRequests
+import org.onap.so.db.request.client.RequestsDbClient
 import static org.assertj.core.api.Assertions.assertThat
 import static org.assertj.core.api.Assertions.assertThatThrownBy
 import static org.mockito.ArgumentMatchers.eq
@@ -38,27 +42,20 @@ import static org.mockito.Mockito.*
 
 @RunWith(MockitoJUnitRunner.class)
 class CompleteMsoProcessTest {
-       @Before
-       public void init() {
-               MockitoAnnotations.initMocks(this)
-       }
-
-       private String completeMsoProcessRequest = """
-                               <sdncadapterworkflow:MsoCompletionRequest xmlns:ns="http://org.onap/so/request/types/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
-                                               <ns:request-information>
-                                                       <ns:request-id>uCPE1020_STUW105_5002</ns:request-id>
-                                                       <ns:request-action>Layer3ServiceActivateRequest</ns:request-action>                             
-                                                       <ns:request-sub-action>COMPLETE</ns:request-sub-action>
-                                                       <ns:source>OMX</ns:source>
-                                                       <ns:notification-url>http://localhost:28090/CCD/StatusNotification</ns:notification-url>                                
-                                                       <ns:order-number>10205000</ns:order-number>                             
-                                                       <ns:order-version>1</ns:order-version>
-                                               </ns:request-information>                               
-                                               <sdncadapterworkflow:mso-bpel-name>UCPELayer3ServiceActivateV1</sdncadapterworkflow:mso-bpel-name>
-                               </sdncadapterworkflow:MsoCompletionRequest>
-               """
-       
-               private String completeMsoNetworkProcessRequest = """
+
+    @Mock
+    RequestsDbClient requestsDbClient;
+
+    @Spy
+    CompleteMsoProcess completeMsoProcess;
+
+
+    @Before
+    public void init() {
+        MockitoAnnotations.initMocks(this)
+    }
+
+    private String completeMsoNetworkProcessRequest = """
                                        <aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
                                                                xmlns:ns="http://org.onap/so/request/types/v1">
                                                <request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
@@ -71,104 +68,39 @@ class CompleteMsoProcessTest {
                                                <aetgt:mso-bpel-name>BPMN Network action: CREATE</aetgt:mso-bpel-name>
                                        </aetgt:MsoCompletionRequest>"""
 
-       @Test
-       public void testPreProcessRequest() {
-
-               ExecutionEntity mockExecution = mock(ExecutionEntity.class)
-               when(mockExecution.getVariable("CompleteMsoProcessRequest")).thenReturn(completeMsoProcessRequest)
-               when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C");
-               when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7");
-
-               CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess()
-               completeMsoProcess.preProcessRequest(mockExecution)
-
-               /* Initialize all the process request variables in this block */
-               verify(mockExecution).setVariable("prefix","CMSO_")
-               //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","")
-               verify(mockExecution).setVariable("CMSO_request_id","")
-               verify(mockExecution).setVariable("CMSO_notification-url","")
-               verify(mockExecution).setVariable("CMSO_mso-bpel-name","")
-               verify(mockExecution).setVariable("CMSO_request_action","")
-
-               verify(mockExecution).setVariable("CMSO_notification-url-Ok", false)
-               verify(mockExecution).setVariable("CMSO_request_id-Ok", false)
-
-               //updateRequest Adapter process variables
-               verify(mockExecution).setVariable("CMSO_updateRequestResponse", "")
-               verify(mockExecution).setVariable("CMSO_updateRequestResponseCode", "")
-               verify(mockExecution).setVariable("CMSO_updateFinalNotifyAckStatusFailedPayload", "")
-
-               //Set DB adapter variables here
-               verify(mockExecution).setVariable("CMSO_updateDBStatusToSuccessPayload", "")
-               verify(mockExecution).setVariable("CMSO_updateInfraRequestDBPayload", "")
-               verify(mockExecution).setVariable("CMSO_setUpdateDBstatustoSuccessPayload", "")
-
-               //Auth variables
-               verify(mockExecution).setVariable("BasicAuthHeaderValue","")
-
-               //Response variables
-               verify(mockExecution).setVariable("CompletionHandlerResponse","")
-               verify(mockExecution).setVariable("CMSO_ErrorResponse", null)
-               verify(mockExecution).setVariable("CMSO_ResponseCode", "")
-
-               verify(mockExecution).setVariable("CMSO_notification-url-Ok",true)
-               verify(mockExecution).setVariable("CMSO_request_id-Ok",true)
-               verify(mockExecution).setVariable("CMSO_notification-url","http://localhost:28090/CCD/StatusNotification")
-               verify(mockExecution).setVariable("CMSO_request_id","uCPE1020_STUW105_5002")
-               verify(mockExecution).setVariable("CMSO_request_action","Layer3ServiceActivateRequest")
-               verify(mockExecution).setVariable("CMSO_source","OMX")
-
-       }
-
-       private String setUpdateDBstatustoSuccessPayload = """
-                                               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb">
-                                                  <soapenv:Header/>
-                                                  <soapenv:Body>
-                                                     <req:updateInfraRequest>
-                                                        <requestId>testReqId</requestId>
-                                                        <lastModifiedBy>BPEL</lastModifiedBy>
-                                                        <statusMessage>Resource Completed Successfully</statusMessage>
-                                                        <requestStatus>COMPLETE</requestStatus>
-                                                                <progress>100</progress>
-                                                                <networkId>bd631913-cfc6-488b-ba22-6b98504f703d</networkId>
-                                                     </req:updateInfraRequest>
-                                                  </soapenv:Body>
-                                               </soapenv:Envelope>"""
-
-       @Test
-       public void testsetUpdateDBstatustoSuccessPayload(){
-
-               ExecutionEntity mockExecution = mock(ExecutionEntity.class)
-               when(mockExecution.getVariable("CMSO_request_id")).thenReturn("testReqId")
-               when(mockExecution.getVariable("CMSO_mso-bpel-name")).thenReturn("BPEL")
-               when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC");
-               when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7");
-               when(mockExecution.getVariable("CompleteMsoProcessRequest")).thenReturn(completeMsoNetworkProcessRequest);
-               
-               CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess()
-               completeMsoProcess.setUpdateDBstatustoSuccessPayload(mockExecution)
-
-               verify(mockExecution).setVariable("CMSO_setUpdateDBstatustoSuccessPayload",setUpdateDBstatustoSuccessPayload)
-       }
-
-       private String msoCompletionResponse = """onse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
-   <sdncadapterworkflow:out>BPEL BPEL-NAME FAILED</sdncadapterworkflow:out>
-</sdncadapterworkflow:MsoCompletionResponse>"""
-
-
-       @Test
-       void postProcessResponse_successful() {
-               DelegateExecution mockExecution = mock(DelegateExecution.class)
-               when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
-               when(mockExecution.getVariable("CMSO_mso-bpel-name")).thenReturn("mso-bpel-test")
-               new CompleteMsoProcess().postProcessResponse(mockExecution)
-
-               String expectedResponse = "<sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow=\"http://ecomp.com/mso/workflow/schema/v1\">\n" +
-                               "  <sdncadapterworkflow:out>BPEL mso-bpel-test completed</sdncadapterworkflow:out>\n" +
-                               "</sdncadapterworkflow:MsoCompletionResponse>"
-
-               verify(mockExecution).setVariable("WorkflowResponse", expectedResponse)
-               verify(mockExecution).setVariable("CompleteMsoProcessResponse", expectedResponse)
-               verify(mockExecution).setVariable("CMSO_ResponseCode", "200")
-       }
+    @Test
+    public void testPreProcessRequest() {
+
+        ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+        when(mockExecution.getVariable("CompleteMsoProcessRequest")).thenReturn(completeMsoNetworkProcessRequest)
+
+        completeMsoProcess.preProcessRequest(mockExecution)
+
+        verify(mockExecution).setVariable("CMSO_request_id", "bd631913-cfc6-488b-ba22-6b98504f703d")
+    }
+
+
+    @Test
+    public void testUpdateInfraRequestDB(){
+
+        ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+        when(mockExecution.getVariable("CMSO_request_id")).thenReturn("testReqId")
+        when(mockExecution.getVariable("CompleteMsoProcessRequest")).thenReturn(completeMsoNetworkProcessRequest);
+        when(completeMsoProcess.getDbClient()).thenReturn(requestsDbClient)
+        completeMsoProcess.updateInfraRequestDB(mockExecution)
+
+        InfraActiveRequests request = new InfraActiveRequests()
+        request.setRequestId("testReqId")
+
+        completeMsoProcess.updateInfraRequestDB(mockExecution)
+
+        request.setRequestStatus("COMPLETED")
+        request.setStatusMessage("Resource Completed Successfully")
+        request.setProgress(100)
+        request.setLastModifiedBy("BPMN")
+        request.setNetworkId("bd631913-cfc6-488b-ba22-6b98504f703d")
+
+
+        verify(requestsDbClient, times(2)).updateInfraActiveRequests(request, null, null)
+    }
 }
\ No newline at end of file
index 25f62a6..6cae293 100644 (file)
@@ -1,22 +1,22 @@
-/*- 
- * ============LICENSE_START======================================================= 
- * ONAP - SO 
- * ================================================================================ 
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. 
- * ================================================================================ 
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
- * ============LICENSE_END========================================================= 
- */ 
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
 
 package org.onap.so.bpmn.common.scripts
 
@@ -29,31 +29,41 @@ import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.mockito.ArgumentCaptor;
+import org.mockito.Mock
 import org.mockito.MockitoAnnotations
+import org.mockito.Spy
 import org.mockito.runners.MockitoJUnitRunner
 import org.onap.so.bpmn.common.scripts.MsoUtils;
+import org.onap.so.db.request.beans.InfraActiveRequests
+import org.onap.so.db.request.client.RequestsDbClient
 import org.onap.so.bpmn.common.scripts.FalloutHandler;
 
 @RunWith(MockitoJUnitRunner.class)
 class FalloutHandlerTest {
-       
-       public MsoUtils utils = new MsoUtils()
-       
-       @Before
-       public void init() {
-               MockitoAnnotations.initMocks(this)
-       }
 
-       private String falloutHandlerRequest = """
+    public MsoUtils utils = new MsoUtils()
+
+    @Spy
+    FalloutHandler falloutHandler = new FalloutHandler()
+
+    @Mock
+    RequestsDbClient requestsDbClient;
+
+    @Before
+    public void init() {
+        MockitoAnnotations.initMocks(this)
+    }
+
+    private String falloutHandlerRequest = """
                                <sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" xmlns:ns7="http://org.onap/so/request/types/v1">
-                                               <ns7:request-information>
+                                               <ns7:request-info>
                                                        <ns7:request-id>uCPE1020_STUW105_5002</ns7:request-id>
                                                        <ns7:request-action>Layer3ServiceActivateRequest</ns7:request-action>
                                                        <ns7:request-sub-action>CANCEL</ns7:request-sub-action>
                                                        <ns7:source>OMX</ns7:source>
                                                        <ns7:order-number>10205000</ns7:order-number>
                                                        <ns7:order-version>1</ns7:order-version>
-                                               </ns7:request-information>
+                                               </ns7:request-info>
                                                <sdncadapterworkflow:WorkflowException>
                                                        <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>
                                                        <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>
@@ -62,251 +72,64 @@ class FalloutHandlerTest {
                                </sdncadapterworkflow:FalloutHandlerRequest>
                """
 
-       private String falloutHandlerResponse = """<workflow:FalloutHandlerResponse xmlns:workflow="http://org.onap/so/workflow/schema/v1">
+    private String falloutHandlerResponse = """<workflow:FalloutHandlerResponse xmlns:workflow="http://org.onap/so/workflow/schema/v1">
   <workflow:out>Fallout Handler Failed</workflow:out>
 </workflow:FalloutHandlerResponse>"""
 
-       @Test
-       public void testPreProcessRequest() {
-
-               ExecutionEntity mockExecution = mock(ExecutionEntity.class)
-
-               when(mockExecution.getVariable("FalloutHandlerRequest")).thenReturn(falloutHandlerRequest)
-               when(mockExecution.getVariable("mso.adapters.db.auth")).thenReturn("5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C");
-               when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7");
-
-               FalloutHandler falloutHandler = new FalloutHandler()
-               falloutHandler.preProcessRequest(mockExecution)
-
-               /* Initialize all the process request variables in this block */
-               verify(mockExecution).setVariable("prefix","FH_")
-               //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","")
+    @Test
+    public void testPreProcessRequest() {
 
-               //These variables are form the input Message to the BPMN
-               verify(mockExecution).setVariable("FH_request_id","")
-               verify(mockExecution).setVariable("FH_request_action","")
-               verify(mockExecution).setVariable("FH_notification-url","")
-               verify(mockExecution).setVariable("FH_mso-bpel-name","")
-               verify(mockExecution).setVariable("FH_ErrorCode", "")
-               verify(mockExecution).setVariable("FH_ErrorMessage", "")
+        ExecutionEntity mockExecution = mock(ExecutionEntity.class)
 
-               verify(mockExecution).setVariable("FH_notification-url-Ok", false)
-               verify(mockExecution).setVariable("FH_request_id-Ok", false)
+        when(mockExecution.getVariable("FalloutHandlerRequest")).thenReturn(falloutHandlerRequest)
 
-               //These variables are for Get Mso Aai Password Adapter
-               verify(mockExecution).setVariable("FH_deliveryStatus", true)
+        falloutHandler.preProcessRequest(mockExecution)
 
-               //update Response Status to pending ...Adapter variables
-               verify(mockExecution).setVariable("FH_updateResponseStatusPayload", null)
-               verify(mockExecution).setVariable("FH_updateResponseStatusResponse", null)
+        verify(mockExecution).setVariable("FH_success", true)
+        verify(mockExecution).setVariable("FH_request_id","uCPE1020_STUW105_5002")
+        verify(mockExecution).setVariable("FH_ErrorCode","Some Error Code - Fallout Handler")
+        verify(mockExecution).setVariable("FH_ErrorMessage","Some Error Message - Fallout Handler")
+    }
 
-               //update Request Gamma ...Adapter variables
-               verify(mockExecution).setVariable("FH_updateRequestGammaPayload", "")
-               verify(mockExecution).setVariable("FH_updateRequestGammaResponse", null)
-               verify(mockExecution).setVariable("FH_updateRequestGammaResponseCode", null)
+    @Test
+    public void testpostProcessResponse(){
 
-               //update Request Infra ...Adapter variables
-               verify(mockExecution).setVariable("FH_updateRequestInfraPayload", "")
-               verify(mockExecution).setVariable("FH_updateRequestInfraResponse", null)
-               verify(mockExecution).setVariable("FH_updateRequestInfraResponseCode", null)
+        ExecutionEntity mockExecution = mock(ExecutionEntity.class)
 
-               //assign False to success variable
-               verify(mockExecution).setVariable("FH_success", true)
+        when(mockExecution.getVariable("FH_success")).thenReturn(false)
 
-               //Set notify status to Failed variable
-               verify(mockExecution).setVariable("FH_NOTIFY_STATUS", "SUCCESS")
+        falloutHandler.postProcessResponse(mockExecution)
 
-               //Set DB update variable
-               verify(mockExecution).setVariable("FH_updateRequestPayload", "")
-               verify(mockExecution).setVariable("FH_updateRequestResponse", null)
-               verify(mockExecution).setVariable("FH_updateRequestResponseCode", null)
+        // Capture the arguments to setVariable
+        ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
+        ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
 
-               //Auth variables
-               verify(mockExecution).setVariable("BasicAuthHeaderValue","")
+        verify(mockExecution, times(4)).setVariable(captor1.capture(), captor2.capture())
+        List<String> arg2List = captor2.getAllValues()
+        String payloadResponseActual = arg2List.get(1)
 
-               //Response variables
-               verify(mockExecution).setVariable("FalloutHandlerResponse","")
-               verify(mockExecution).setVariable("FH_ErrorResponse", null)
-               verify(mockExecution).setVariable("FH_ResponseCode", "")
+        assertEquals(falloutHandlerResponse.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", ""))
 
-               verify(mockExecution).setVariable("FH_request_id-Ok",true)
-               verify(mockExecution).setVariable("FH_request_id","uCPE1020_STUW105_5002")
-               verify(mockExecution).setVariable("FH_request_action","Layer3ServiceActivateRequest")
-               verify(mockExecution).setVariable("FH_source","OMX")
-               verify(mockExecution).setVariable("FH_ErrorCode","Some Error Code - Fallout Handler")
-               verify(mockExecution).setVariable("FH_ErrorMessage","Some Error Message - Fallout Handler")
+        verify(mockExecution).setVariable("FH_ResponseCode","500")
+    }
 
-       }
 
-       @Test
-       public void testpostProcessResponse(){
+    @Test
+    public void testUpdateInfraRequestDB(){
 
-               ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+        ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+        when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId")
+        when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage")
+        when(falloutHandler.getDbClient()).thenReturn(requestsDbClient)
 
-               when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
-               when(mockExecution.getVariable("FH_success")).thenReturn(false)
-
-               FalloutHandler falloutHandler = new FalloutHandler()
-               falloutHandler.postProcessResponse(mockExecution)
-
-               // Capture the arguments to setVariable
-               ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
-               ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
-               
-               verify(mockExecution, times(4)).setVariable(captor1.capture(), captor2.capture())
-               List<String> arg2List = captor2.getAllValues()
-               String payloadResponseActual = arg2List.get(1)
-               
-               assertEquals(falloutHandlerResponse.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", ""))
-               
-               verify(mockExecution).setVariable("FH_ResponseCode","500")
-       }
-
-       private String updateRequestPayload = """
-                       <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb">
-                       <soapenv:Header/>
-                       <soapenv:Body>
-                          <req:updateRequest>
-                                 <requestId>testReqId</requestId>
-                                 <lastModifiedBy>BPEL</lastModifiedBy>
-                                 <finalErrorMessage>ErrorMessage</finalErrorMessage>
-                                 <finalErrorCode>ErrorCode</finalErrorCode>
-                                 <status>FAILED</status>
-                                 <responseStatus>NotifyStatus</responseStatus>
-                          </req:updateRequest>
-                       </soapenv:Body>
-                </soapenv:Envelope>
-               """
-       
-               @Test
-               public void testupdateRequestPayload(){
-       
-                       ExecutionEntity mockExecution = mock(ExecutionEntity.class)
-                       when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId")
-                       when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage")
-                       when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode")
-                       when(mockExecution.getVariable("FH_NOTIFY_STATUS")).thenReturn("NotifyStatus")
-       
-                       FalloutHandler falloutHandler = new FalloutHandler()
-                       falloutHandler.updateRequestPayload(mockExecution)
-                       
-                       // Capture the arguments to setVariable
-                       ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
-                       ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
-                       
-                       verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture())
-                       List<String> arg2List = captor2.getAllValues()
-                       String payloadRequestActual = arg2List.get(0)
-                       
-                       assertEquals(updateRequestPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", ""))
-               }
-               
-               private String updateRequestInfraPayload = """
-                                                       <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb">
-                                                          <soapenv:Header/>
-                                                          <soapenv:Body>
-                                                             <req:updateInfraRequest>
-                                                                <requestId>testReqId</requestId>
-                                                                <lastModifiedBy>BPEL</lastModifiedBy>
-                                                                        <statusMessage>ErrorMessage</statusMessage>
-                                                                        <requestStatus>FAILED</requestStatus>
-                                                                        <progress>100</progress>
-                                                             </req:updateInfraRequest>
-                                                          </soapenv:Body>
-                                                       </soapenv:Envelope>
-                       """
-               
-                       @Test
-                       public void testupdateRequestInfraPayload(){
-               
-                               ExecutionEntity mockExecution = mock(ExecutionEntity.class)
-                               when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId")
-                               when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage")
-               
-                               FalloutHandler falloutHandler = new FalloutHandler()
-                               falloutHandler.updateRequestInfraPayload(mockExecution)
-                               
-                               // Capture the arguments to setVariable
-                               ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
-                               ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
-                               
-                               verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture())
-                               List<String> arg2List = captor2.getAllValues()
-                               String payloadRequestActual = arg2List.get(0)
-               
-                               assertEquals(updateRequestInfraPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", ""))
-                       }
-                       
-                       private String updateRequestGammaPayload = """
-                       <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb">
-                       <soapenv:Header/>
-                       <soapenv:Body>
-                          <req:updateRequest>
-                                 <requestId>testReqId</requestId>
-                                 <lastModifiedBy>BPEL</lastModifiedBy>
-                                 <finalErrorMessage>ErrorMessage</finalErrorMessage>
-                                 <finalErrorCode>ErrorCode</finalErrorCode>
-                                 <status>FAILED</status>
-                          </req:updateRequest>
-                       </soapenv:Body>
-                </soapenv:Envelope>
-               """
-                       
-               @Test
-               public void testupdateRequestGammaPayload(){
-       
-                       ExecutionEntity mockExecution = mock(ExecutionEntity.class)
-                       when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId")
-                       when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage")
-                       when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode")
-                       when(mockExecution.getVariable("mso.default.adapter.namespace")).thenReturn("http://org.onap.so");
-
-                       FalloutHandler falloutHandler = new FalloutHandler()
-                       falloutHandler.updateRequestGammaPayload(mockExecution)
-       
-                       // Capture the arguments to setVariable
-                       ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
-                       ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
-                       
-                       verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture())
-                       List<String> arg2List = captor2.getAllValues()
-                       String payloadRequestActual = arg2List.get(0)
-                       
-                       assertEquals(updateRequestGammaPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", ""))
-               }
-       
-               
-               String updateResponseStatusPayload = """
-                       <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb">
-                       <soapenv:Header/>
-                       <soapenv:Body>
-                          <req:updateResponseStatus>
-                                 <requestId>testReqId</requestId>
-                                 <lastModifiedBy>BPEL</lastModifiedBy>
-                                 <responseStatus>SENDING_FINAL_NOTIFY</responseStatus>
-                          </req:updateResponseStatus>
-                       </soapenv:Body>
-                </soapenv:Envelope>
-               """
-               
-               @Test
-               public void testupdateResponseStatusPayload(){
-       
-                       ExecutionEntity mockExecution = mock(ExecutionEntity.class)
-                       when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId")
+        falloutHandler.updateInfraRequestDB(mockExecution)
 
-                       FalloutHandler falloutHandler = new FalloutHandler()
-                       falloutHandler.updateResponseStatusPayload(mockExecution)
-                       
-                       // Capture the arguments to setVariable
-                       ArgumentCaptor<String> captor1 = ArgumentCaptor.forClass(String.class);
-                       ArgumentCaptor<String> captor2 = ArgumentCaptor.forClass(String.class);
-                       
-                       verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture())
-                       List<String> arg2List = captor2.getAllValues()
-                       String payloadResponseActual = arg2List.get(0)
-       
-                       assertEquals(updateResponseStatusPayload.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", ""))
-               }
+        InfraActiveRequests infraRequest = new InfraActiveRequests();
+        infraRequest.setLastModifiedBy("BPMN")
+        infraRequest.setStatusMessage("ErrorMessage")
+        infraRequest.setRequestStatus("FAILED")
+        infraRequest.setProgress(100)
 
+        verify(requestsDbClient, times(1)).updateInfraActiveRequests(infraRequest, null, null)
+    }
 }
\ No newline at end of file
index 655ae60..334eb73 100644 (file)
@@ -371,6 +371,41 @@ public class RequestsDbClient {
                 String.class);
     }
 
+    public InfraActiveRequests getInfraActiveRequests(String requestId, String basicAuth, String host) {
+        RestTemplate template = new RestTemplate();
+        HttpHeaders headers = new HttpHeaders();
+        headers.set(HttpHeaders.AUTHORIZATION, basicAuth);
+        headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
+        headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
+        URI uri = getUri(host + "/infraActiveRequests/" + requestId);
+        try {
+            InfraActiveRequests infraActiveRequests = template
+                    .exchange(uri, HttpMethod.GET, new HttpEntity<>(headers), InfraActiveRequests.class).getBody();
+            if (infraActiveRequests != null) {
+                infraActiveRequests.setRequestId(requestId);
+            }
+            return infraActiveRequests;
+        } catch (HttpClientErrorException e) {
+            if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+                return null;
+            }
+            throw e;
+        }
+    }
+
+    public void updateInfraActiveRequests(InfraActiveRequests request, String basicAuth, String host) {
+        RestTemplate template = new RestTemplate();
+        template.getInterceptors().add(new SOSpringClientFilter());
+        template.getInterceptors().add(new SpringClientPayloadFilter());
+        HttpHeaders headers = new HttpHeaders();
+        headers.set(HttpHeaders.AUTHORIZATION, basicAuth);
+        headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
+        headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
+        URI uri = getUri(host + "/infraActiveRequests/" + request.getRequestId());
+        HttpEntity<InfraActiveRequests> entity = new HttpEntity<>(request, headers);
+        template.put(uri, entity);
+    }
+
     protected URI getUri(String uri) {
         return URI.create(uri);
     }