fixed headers for traceability 14/74414/1
authorKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>
Fri, 7 Dec 2018 19:11:47 +0000 (14:11 -0500)
committerKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>
Fri, 7 Dec 2018 19:13:03 +0000 (14:13 -0500)
Changed if condition and updated to get last element/instance in the
list.
Add block to handle when there is more than 1 process instance returned.
Update headers for traceability in logging

Change-Id: Ibb2cd0bf5ba7cd733371a204c0b61e418564df97
Issue-ID: SO-1301
Signed-off-by: Kalkere Ramesh, Sharan (sk720x) <sk720x@att.com>
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn
bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn
bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java

index d7fc6ac..0cefae5 100644 (file)
@@ -207,7 +207,10 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
 
                        URL url = new URL(sdncAdapterUrl);
 
-                       HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.SDNC_ADAPTER)
+                       HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.SDNC_ADAPTER)                      
+                       httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
+                       httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString())
+                       httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-SDNCAdapter")
                        httpClient.addAdditionalHeader("mso-request-id", execution.getVariable("mso-request-id"))
                        httpClient.addAdditionalHeader("mso-service-instance-id", execution.getVariable("mso-service-instance-id"))
                        httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue"))
index 13cc7f8..1452a9a 100644 (file)
@@ -29,6 +29,8 @@ import org.onap.so.client.HttpClient
 import org.onap.so.logger.MessageEnum
 import org.onap.so.logger.MsoLogger
 import org.onap.so.utils.TargetEntity
+import java.util.UUID
+
 
 
 
@@ -311,7 +313,10 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
 
                        HttpClient httpClient = new HttpClient(url, "application/xml", TargetEntity.VNF_ADAPTER)
                        httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue"))
-
+                       
+                       httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
+                       httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString())
+                       httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-VNFAdapter")
                        Response response;
 
                        if ("GET".equals(vnfAdapterMethod)) {
index 990863e..6914e75 100644 (file)
@@ -70,6 +70,7 @@ falloutHandler.postProcessResponse(execution)]]></bpmn2:script>
               <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">
index 2ae2ff7..91c3824 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="_l2hJ8CccEeW3d--PaFJMbg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.13.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="_l2hJ8CccEeW3d--PaFJMbg" 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:process id="sdncAdapter" name="SDNC Adapter" isExecutable="true">
     <bpmn2:exclusiveGateway id="isResponseOK" name="is Response Ok?" default="badSynchronousResponse">
       <bpmn2:incoming>SequenceFlow_15</bpmn2:incoming>
@@ -8,28 +8,29 @@
     </bpmn2:exclusiveGateway>
     <bpmn2:sequenceFlow id="badSynchronousResponse" name="Bad synchronous response" sourceRef="isResponseOK" targetRef="setBadResponse" />
     <bpmn2:sequenceFlow id="goodSynchronousResponse" name="Good synchronous response" sourceRef="isResponseOK" targetRef="resetCallbackRequest">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("SDNCA_ResponseCode")=='200'}</bpmn2:conditionExpression>
+      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("SDNCA_ResponseCode")=='200'}]]></bpmn2:conditionExpression>
     </bpmn2:sequenceFlow>
     <bpmn2:scriptTask id="setBadResponse" name="Set Bad Response&#10;&#10;Exception" scriptFormat="groovy">
       <bpmn2:incoming>badSynchronousResponse</bpmn2:incoming>
       <bpmn2:outgoing>Exception</bpmn2:outgoing>
-      <bpmn2:script>import org.onap.so.bpmn.common.scripts.*
+      <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.*
 
 int responseCode = execution.getVariable("SDNCA_ResponseCode")
 ExceptionUtil exceptionUtil = new ExceptionUtil()
-exceptionUtil.buildWorkflowException(execution, 7000, "Could not communicate with the SDNC Adapter" )</bpmn2:script>
+exceptionUtil.buildWorkflowException(execution, 7000, "Could not communicate with the SDNC Adapter" )]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:sequenceFlow id="Exception" name="Exception" sourceRef="setBadResponse" targetRef="badResponseEndFlow" />
     <bpmn2:serviceTask id="invokeSDNCAdapter" name="Invoke SDNC Adapter" camunda:asyncAfter="true" camunda:class="">
       <bpmn2:extensionElements>
         <camunda:connector>
           <camunda:inputOutput>
-            <camunda:inputParameter name="url">${execution.getVariable("mso.adapters.sdnc.endpoint")}</camunda:inputParameter>
+            <camunda:inputParameter name="url"><![CDATA[${execution.getVariable("mso.adapters.sdnc.endpoint")}]]></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">#{BasicAuthHeaderValue}</camunda:entry>
+                <camunda:entry key="X-ONAP-RequestID">#{mso-request-id}</camunda:entry>
               </camunda:map>
             </camunda:inputParameter>
             <camunda:inputParameter name="payload">${sdncAdapterRequest}</camunda:inputParameter>
@@ -65,20 +66,18 @@ exceptionUtil.buildWorkflowException(execution, 7000, "Could not communicate wit
       </bpmn2:extensionElements>
       <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
-      <bpmn2:script>import org.onap.so.bpmn.common.scripts.*
+      <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.*
 def sdnc= new SDNCAdapter()
-sdnc.preProcessRequest(execution)
-</bpmn2:script>
+sdnc.preProcessRequest(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:sequenceFlow id="SequenceFlow_8" sourceRef="processMessage" targetRef="invokeSDNCAdapter" />
     <bpmn2:scriptTask id="returnWorkflowResult" name="Return workflow result" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
       <bpmn2:incoming>SequenceFlow_11ah5pw</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
-      <bpmn2:script>import org.onap.so.bpmn.common.scripts.*
+      <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.*
 def sdnc= new SDNCAdapter()
-sdnc.postProcessResponse(execution)
-</bpmn2:script>
+sdnc.postProcessResponse(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:sequenceFlow id="SequenceFlow_14" sourceRef="returnWorkflowResult" targetRef="timeoutError" />
     <bpmn2:exclusiveGateway id="timeoutError" name="Did Timeout occur?" default="noTimeoutError">
@@ -88,7 +87,7 @@ sdnc.postProcessResponse(execution)
     </bpmn2:exclusiveGateway>
     <bpmn2:sequenceFlow id="noTimeoutError" name="No Timeout" sourceRef="timeoutError" targetRef="ExclusiveGateway_1" />
     <bpmn2:sequenceFlow id="SequenceFlow_19" name="Timeout" sourceRef="timeoutError" targetRef="endEventException">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("asynchronousResponseTimeout")==true}</bpmn2:conditionExpression>
+      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("asynchronousResponseTimeout")==true}]]></bpmn2:conditionExpression>
     </bpmn2:sequenceFlow>
     <bpmn2:subProcess id="SubProcess" name="Wait for asynchronous message" camunda:asyncAfter="true">
       <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
@@ -111,17 +110,17 @@ sdnc.postProcessResponse(execution)
     <bpmn2:scriptTask id="setTimeoutEx" name="Set Timeout&#10;and Stop Listening for Callback" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_0mzs1ze</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_11ah5pw</bpmn2:outgoing>
-      <bpmn2:script>import org.onap.so.bpmn.common.scripts.*
+      <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.*
 def sdnc= new SDNCAdapter()
-sdnc.setTimeout(execution)</bpmn2:script>
+sdnc.setTimeout(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:scriptTask id="resetCallbackRequest" name="Reset callback request and set timer value" scriptFormat="groovy">
       <bpmn2:incoming>goodSynchronousResponse</bpmn2:incoming>
       <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
-      <bpmn2:script>import org.onap.so.bpmn.common.scripts.*
+      <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.*
 def sdnc= new SDNCAdapter()
-sdnc.resetCallbackRequest(execution)</bpmn2:script>
+sdnc.resetCallbackRequest(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="resetCallbackRequest" targetRef="SubProcess" />
     <bpmn2:exclusiveGateway id="ExclusiveGateway_1" name="Check final indicator" default="Done">
@@ -131,14 +130,14 @@ sdnc.resetCallbackRequest(execution)</bpmn2:script>
     </bpmn2:exclusiveGateway>
     <bpmn2:sequenceFlow id="Done" name="Done" sourceRef="ExclusiveGateway_1" targetRef="ResetInterimNotificationFlag" />
     <bpmn2:sequenceFlow id="SequenceFlow_30" name="Not Done" sourceRef="ExclusiveGateway_1" targetRef="ParallelGateway_3">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("continueListening")==true}</bpmn2:conditionExpression>
+      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("continueListening")==true}]]></bpmn2:conditionExpression>
     </bpmn2:sequenceFlow>
     <bpmn2:scriptTask id="toggleSuccessIndicator" name="Toggle Success Indicator" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_1w1za5m</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_17</bpmn2:outgoing>
-      <bpmn2:script>import org.onap.so.bpmn.common.scripts.*
+      <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.*
 def sdnc= new SDNCAdapter()
-sdnc.toggleSuccessIndicator(execution)</bpmn2:script>
+sdnc.toggleSuccessIndicator(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:sequenceFlow id="SequenceFlow_17" name="" sourceRef="toggleSuccessIndicator" targetRef="endEventFlow" />
     <bpmn2:endEvent id="endEventFlow" name="End Event Flow">
@@ -168,9 +167,9 @@ sdnc.toggleSuccessIndicator(execution)</bpmn2:script>
       <bpmn2:scriptTask id="assignError" name="Assign Error" scriptFormat="groovy">
         <bpmn2:incoming>SequenceFlow_22</bpmn2:incoming>
         <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing>
-        <bpmn2:script>import org.onap.so.bpmn.common.scripts.*
+        <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.*
 def sdnc= new SDNCAdapter()
-sdnc.assignError(execution)</bpmn2:script>
+sdnc.assignError(execution)]]></bpmn2:script>
       </bpmn2:scriptTask>
       <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="assignError" targetRef="EndEvent_5" />
       <bpmn2:endEvent id="EndEvent_5">
@@ -183,7 +182,7 @@ sdnc.assignError(execution)</bpmn2:script>
       <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing>
     </bpmn2:exclusiveGateway>
     <bpmn2:sequenceFlow id="SequenceFlow_4" name="Yes" sourceRef="ExclusiveGateway_2" targetRef="SetInterimNotificationFlag">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("serviceConfigActivate")==true}</bpmn2:conditionExpression>
+      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("serviceConfigActivate")==true}]]></bpmn2:conditionExpression>
     </bpmn2:sequenceFlow>
     <bpmn2:sequenceFlow id="SequenceFlow_23" name="No" sourceRef="ExclusiveGateway_2" targetRef="EndEvent_1" />
     <bpmn2:endEvent id="EndEvent_1">
@@ -215,7 +214,7 @@ sdnc.assignError(execution)</bpmn2:script>
     <bpmn2:scriptTask id="SetInterimNotificationFlag" name="Set Interim Notification Flag" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_193cb6p</bpmn2:outgoing>
-      <bpmn2:script>execution.setVariable("SDNCA_InterimNotify", true)</bpmn2:script>
+      <bpmn2:script><![CDATA[execution.setVariable("SDNCA_InterimNotify", true)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:sequenceFlow id="SequenceFlow_193cb6p" sourceRef="SetInterimNotificationFlag" targetRef="CallActivity_11xgv33" />
     <bpmn2:endEvent id="EndEvent_18rq0b6">
@@ -225,7 +224,7 @@ sdnc.assignError(execution)</bpmn2:script>
     <bpmn2:scriptTask id="ResetInterimNotificationFlag" name="Reset Interim Notification Flag" scriptFormat="groovy">
       <bpmn2:incoming>Done</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_1w1za5m</bpmn2:outgoing>
-      <bpmn2:script>execution.setVariable("SDNCA_InterimNotify", false)</bpmn2:script>
+      <bpmn2:script><![CDATA[execution.setVariable("SDNCA_InterimNotify", false)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:sequenceFlow id="SequenceFlow_1w1za5m" sourceRef="ResetInterimNotificationFlag" targetRef="toggleSuccessIndicator" />
   </bpmn2:process>
@@ -264,23 +263,23 @@ sdnc.assignError(execution)</bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="badSynchronousResponse" sourceElement="_BPMNShape_ExclusiveGateway_29" targetElement="_BPMNShape_ScriptTask_24">
-        <di:waypoint x="544" y="153" />
-        <di:waypoint x="544" y="122" />
-        <di:waypoint x="600" y="122" />
+        <di:waypoint xsi:type="dc:Point" x="544" y="153" />
+        <di:waypoint xsi:type="dc:Point" x="544" y="122" />
+        <di:waypoint xsi:type="dc:Point" x="600" y="122" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="441" y="99" width="164" height="22" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_33" targetElement="_BPMNShape_ScriptTask_3">
-        <di:waypoint x="147" y="179" />
-        <di:waypoint x="194" y="179" />
+        <di:waypoint xsi:type="dc:Point" x="147" y="179" />
+        <di:waypoint xsi:type="dc:Point" x="194" y="179" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="171" y="179" width="0" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="goodSynchronousResponse" sourceElement="_BPMNShape_ExclusiveGateway_29" targetElement="_BPMNShape_ScriptTask_27">
-        <di:waypoint x="544" y="203" />
-        <di:waypoint x="544" y="246" />
+        <di:waypoint xsi:type="dc:Point" x="544" y="203" />
+        <di:waypoint xsi:type="dc:Point" x="544" y="246" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="459" y="208" width="172" height="22" />
         </bpmndi:BPMNLabel>
@@ -292,24 +291,24 @@ sdnc.assignError(execution)</bpmn2:script>
         <dc:Bounds x="194" y="139" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_3" targetElement="_BPMNShape_ServiceTask_62">
-        <di:waypoint x="294" y="179" />
-        <di:waypoint x="342" y="179" />
+        <di:waypoint xsi:type="dc:Point" x="294" y="179" />
+        <di:waypoint xsi:type="dc:Point" x="342" y="179" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="300" y="153" width="30" height="22" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ServiceTask_68" targetElement="_BPMNShape_ExclusiveGateway_53">
-        <di:waypoint x="1204" y="277" />
-        <di:waypoint x="1248" y="276" />
+        <di:waypoint xsi:type="dc:Point" x="1204" y="277" />
+        <di:waypoint xsi:type="dc:Point" x="1248" y="276" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1211" y="251" width="37" height="22" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_15" sourceElement="_BPMNShape_ServiceTask_62" targetElement="_BPMNShape_ExclusiveGateway_29">
-        <di:waypoint x="442" y="179" />
-        <di:waypoint x="480" y="179" />
-        <di:waypoint x="480" y="178" />
-        <di:waypoint x="519" y="178" />
+        <di:waypoint xsi:type="dc:Point" x="442" y="179" />
+        <di:waypoint xsi:type="dc:Point" x="480" y="179" />
+        <di:waypoint xsi:type="dc:Point" x="480" y="178" />
+        <di:waypoint xsi:type="dc:Point" x="519" y="178" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="468" y="153" width="37" height="22" />
         </bpmndi:BPMNLabel>
@@ -330,8 +329,8 @@ sdnc.assignError(execution)</bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_SubProcess_11">
-        <di:waypoint x="998" y="278" />
-        <di:waypoint x="1104" y="277" />
+        <di:waypoint xsi:type="dc:Point" x="998" y="278" />
+        <di:waypoint xsi:type="dc:Point" x="1104" y="277" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1051" y="262.5" width="0" height="0" />
         </bpmndi:BPMNLabel>
@@ -340,8 +339,8 @@ sdnc.assignError(execution)</bpmn2:script>
         <dc:Bounds x="600" y="82" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="Exception" sourceElement="_BPMNShape_ScriptTask_24" targetElement="_BPMNShape_EndEvent_65">
-        <di:waypoint x="700" y="122" />
-        <di:waypoint x="762" y="122" />
+        <di:waypoint xsi:type="dc:Point" x="700" y="122" />
+        <di:waypoint xsi:type="dc:Point" x="762" y="122" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="699" y="99" width="64" height="22" />
         </bpmndi:BPMNLabel>
@@ -350,8 +349,8 @@ sdnc.assignError(execution)</bpmn2:script>
         <dc:Bounds x="941" y="372" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_16" sourceElement="_BPMNShape_IntermediateCatchEvent_16">
-        <di:waypoint x="817" y="275" />
-        <di:waypoint x="926" y="275" />
+        <di:waypoint xsi:type="dc:Point" x="817" y="275" />
+        <di:waypoint xsi:type="dc:Point" x="926" y="275" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="872" y="260" width="0" height="0" />
         </bpmndi:BPMNLabel>
@@ -363,16 +362,16 @@ sdnc.assignError(execution)</bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="noTimeoutError" sourceElement="_BPMNShape_ExclusiveGateway_53" targetElement="_BPMNShape_ExclusiveGateway_54">
-        <di:waypoint x="1273" y="301" />
-        <di:waypoint x="1273" y="359" />
+        <di:waypoint xsi:type="dc:Point" x="1273" y="301" />
+        <di:waypoint xsi:type="dc:Point" x="1273" y="359" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1280" y="324" width="72" height="22" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_19" bpmnElement="SequenceFlow_19" sourceElement="_BPMNShape_ExclusiveGateway_53" targetElement="_BPMNShape_ScriptTask_25">
-        <di:waypoint x="1273" y="251" />
-        <di:waypoint x="1273" y="95" />
-        <di:waypoint x="1560" y="95" />
+        <di:waypoint xsi:type="dc:Point" x="1273" y="251" />
+        <di:waypoint xsi:type="dc:Point" x="1273" y="95" />
+        <di:waypoint xsi:type="dc:Point" x="1560" y="95" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1301" y="169.45283018867923" width="39" height="12" />
         </bpmndi:BPMNLabel>
@@ -384,8 +383,8 @@ sdnc.assignError(execution)</bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="Done" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ScriptTask_247">
-        <di:waypoint x="1298" y="384" />
-        <di:waypoint x="1386" y="385" />
+        <di:waypoint xsi:type="dc:Point" x="1298" y="384" />
+        <di:waypoint xsi:type="dc:Point" x="1386" y="385" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1322" y="384.219838851959" width="27" height="13" />
         </bpmndi:BPMNLabel>
@@ -394,17 +393,17 @@ sdnc.assignError(execution)</bpmn2:script>
         <dc:Bounds x="494" y="246" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_27" targetElement="_BPMNShape_SubProcess_11">
-        <di:waypoint x="594" y="286" />
-        <di:waypoint x="607" y="286" />
-        <di:waypoint x="607" y="275" />
-        <di:waypoint x="619" y="275" />
+        <di:waypoint xsi:type="dc:Point" x="594" y="286" />
+        <di:waypoint xsi:type="dc:Point" x="607" y="286" />
+        <di:waypoint xsi:type="dc:Point" x="607" y="275" />
+        <di:waypoint xsi:type="dc:Point" x="619" y="275" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="622" y="280.5" width="0" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_30" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ParallelGateway_14">
-        <di:waypoint x="1273" y="409" />
-        <di:waypoint x="1273" y="467" />
+        <di:waypoint xsi:type="dc:Point" x="1273" y="409" />
+        <di:waypoint xsi:type="dc:Point" x="1273" y="467" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1273" y="423" width="60" height="22" />
         </bpmndi:BPMNLabel>
@@ -416,8 +415,8 @@ sdnc.assignError(execution)</bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ExclusiveGateway_55" targetElement="CallActivity_11xgv33_di">
-        <di:waypoint x="1273" y="602" />
-        <di:waypoint x="1273" y="664" />
+        <di:waypoint xsi:type="dc:Point" x="1273" y="602" />
+        <di:waypoint xsi:type="dc:Point" x="1273" y="664" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1237" y="635.9906427957554" width="18" height="13" />
         </bpmndi:BPMNLabel>
@@ -429,8 +428,8 @@ sdnc.assignError(execution)</bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_28" bpmnElement="SequenceFlow_21" sourceElement="_BPMNShape_ParallelGateway_14">
-        <di:waypoint x="1272" y="516" />
-        <di:waypoint x="1273" y="552" />
+        <di:waypoint xsi:type="dc:Point" x="1272" y="516" />
+        <di:waypoint xsi:type="dc:Point" x="1273" y="552" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1273" y="519" width="0" height="0" />
         </bpmndi:BPMNLabel>
@@ -442,17 +441,17 @@ sdnc.assignError(execution)</bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_30" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_55" targetElement="_BPMNShape_EndEvent_96">
-        <di:waypoint x="1298" y="577" />
-        <di:waypoint x="1330" y="577" />
-        <di:waypoint x="1440" y="577" />
+        <di:waypoint xsi:type="dc:Point" x="1298" y="577" />
+        <di:waypoint xsi:type="dc:Point" x="1330" y="577" />
+        <di:waypoint xsi:type="dc:Point" x="1440" y="577" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1309" y="590.5" width="14" height="13" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_33" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_ParallelGateway_14" targetElement="_BPMNShape_ScriptTask_27">
-        <di:waypoint x="1248" y="492" />
-        <di:waypoint x="544" y="492" />
-        <di:waypoint x="544" y="326" />
+        <di:waypoint xsi:type="dc:Point" x="1248" y="492" />
+        <di:waypoint xsi:type="dc:Point" x="544" y="492" />
+        <di:waypoint xsi:type="dc:Point" x="544" y="326" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="782" y="467" width="73" height="48" />
         </bpmndi:BPMNLabel>
@@ -461,8 +460,8 @@ sdnc.assignError(execution)</bpmn2:script>
         <dc:Bounds x="1540" y="344" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_26" bpmnElement="SequenceFlow_17" sourceElement="_BPMNShape_ScriptTask_247" targetElement="_BPMNShape_EndEvent_64">
-        <di:waypoint x="1640" y="384" />
-        <di:waypoint x="1699" y="384" />
+        <di:waypoint xsi:type="dc:Point" x="1640" y="384" />
+        <di:waypoint xsi:type="dc:Point" x="1699" y="384" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1670" y="369" width="0" height="0" />
         </bpmndi:BPMNLabel>
@@ -486,22 +485,22 @@ sdnc.assignError(execution)</bpmn2:script>
         <dc:Bounds x="326" y="749" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_22" sourceElement="_BPMNShape_StartEvent_63" targetElement="_BPMNShape_ScriptTask_249">
-        <di:waypoint x="278" y="789" />
-        <di:waypoint x="326" y="789" />
+        <di:waypoint xsi:type="dc:Point" x="278" y="789" />
+        <di:waypoint xsi:type="dc:Point" x="326" y="789" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="263" y="789" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_34" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_ScriptTask_249" targetElement="_BPMNShape_EndEvent_213">
-        <di:waypoint x="426" y="789" />
-        <di:waypoint x="482" y="789" />
+        <di:waypoint xsi:type="dc:Point" x="426" y="789" />
+        <di:waypoint xsi:type="dc:Point" x="482" y="789" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="409" y="789" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1eciucn_di" bpmnElement="SequenceFlow_1eciucn">
-        <di:waypoint x="691" y="275" />
-        <di:waypoint x="781" y="275" />
+        <di:waypoint xsi:type="dc:Point" x="691" y="275" />
+        <di:waypoint xsi:type="dc:Point" x="781" y="275" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="736" y="260" width="0" height="0" />
         </bpmndi:BPMNLabel>
@@ -519,17 +518,17 @@ sdnc.assignError(execution)</bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0mzs1ze_di" bpmnElement="SequenceFlow_0mzs1ze">
-        <di:waypoint x="800" y="364" />
-        <di:waypoint x="800" y="412" />
-        <di:waypoint x="941" y="412" />
+        <di:waypoint xsi:type="dc:Point" x="800" y="364" />
+        <di:waypoint xsi:type="dc:Point" x="800" y="412" />
+        <di:waypoint xsi:type="dc:Point" x="941" y="412" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="815" y="388" width="0" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_11ah5pw_di" bpmnElement="SequenceFlow_11ah5pw">
-        <di:waypoint x="1041" y="412" />
-        <di:waypoint x="1154" y="412" />
-        <di:waypoint x="1154" y="317" />
+        <di:waypoint xsi:type="dc:Point" x="1041" y="412" />
+        <di:waypoint xsi:type="dc:Point" x="1154" y="412" />
+        <di:waypoint xsi:type="dc:Point" x="1154" y="317" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1098" y="397" width="0" height="0" />
         </bpmndi:BPMNLabel>
@@ -547,8 +546,8 @@ sdnc.assignError(execution)</bpmn2:script>
         <dc:Bounds x="1223" y="666" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_193cb6p_di" bpmnElement="SequenceFlow_193cb6p">
-        <di:waypoint x="1273" y="746" />
-        <di:waypoint x="1273" y="795" />
+        <di:waypoint xsi:type="dc:Point" x="1273" y="746" />
+        <di:waypoint xsi:type="dc:Point" x="1273" y="795" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1288" y="770.5" width="0" height="0" />
         </bpmndi:BPMNLabel>
@@ -560,8 +559,8 @@ sdnc.assignError(execution)</bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1em7gys_di" bpmnElement="SequenceFlow_1em7gys">
-        <di:waypoint x="1273" y="875" />
-        <di:waypoint x="1273" y="920" />
+        <di:waypoint xsi:type="dc:Point" x="1273" y="875" />
+        <di:waypoint xsi:type="dc:Point" x="1273" y="920" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1288" y="897.5" width="0" height="0" />
         </bpmndi:BPMNLabel>
@@ -570,8 +569,8 @@ sdnc.assignError(execution)</bpmn2:script>
         <dc:Bounds x="1386" y="345" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1w1za5m_di" bpmnElement="SequenceFlow_1w1za5m">
-        <di:waypoint x="1486" y="385" />
-        <di:waypoint x="1540" y="384" />
+        <di:waypoint xsi:type="dc:Point" x="1486" y="385" />
+        <di:waypoint xsi:type="dc:Point" x="1540" y="384" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="1513" y="369.5" width="0" height="0" />
         </bpmndi:BPMNLabel>
index 335f346..4e45aaf 100644 (file)
@@ -56,6 +56,7 @@ import org.camunda.bpm.engine.RuntimeService;
 import org.camunda.bpm.engine.history.HistoricProcessInstance;
 import org.camunda.bpm.engine.history.HistoricVariableInstance;
 import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.runtime.ProcessInstanceQuery;
 import org.camunda.bpm.engine.test.ProcessEngineRule;
 import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
 import org.custommonkey.xmlunit.DetailedDiff;
@@ -884,11 +885,20 @@ public abstract class WorkflowTest {
                                return null;
                        }
 
+                       ProcessInstanceQuery processInstanceQuery = null;
                        if (processInstance == null) {
-                               processInstance = runtimeService
+                               processInstanceQuery = runtimeService
                                        .createProcessInstanceQuery()
-                                       .processDefinitionKey(processKey)
-                                       .singleResult();
+                                       .processDefinitionKey(processKey);
+                       }
+
+                       if(processInstanceQuery.count() <= 1){
+                               processInstance = processInstanceQuery.singleResult();
+                       }else{
+                               //TODO There shouldnt be more than one in the list but seems to be happening, need to figure out why happening and best way to get correct one from list
+                               msoLogger.debug("Process Instance Query returned " + processInstanceQuery.count() + " instance. Getting the last instance in the list");
+                               List<ProcessInstance> processList = processInstanceQuery.list();
+                               processInstance = processList.get((processList.size() - 1));
                        }
 
                        if (processInstance != null) {
@@ -927,7 +937,7 @@ public abstract class WorkflowTest {
        protected boolean injectSDNCRestCallback(String contentType, String content, long timeout) {
                String sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV1",
                        "SDNCAResponse_CORRELATOR", timeout);
-               
+
                if (sdncRequestId == null) {
                        sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV2",
                                "SDNCAResponse_CORRELATOR", timeout);
@@ -1693,7 +1703,7 @@ public abstract class WorkflowTest {
 
        /**
         * Checks to see if the specified process is ended.
-        * 
+        *
         * @param processInstanceId the process Instance Id
         * @return true if the process is ended
         */
@@ -1705,7 +1715,7 @@ public abstract class WorkflowTest {
 
        /**
         * Checks to see if the specified process is ended.
-        * 
+        *
         * @author cb645j
         */
        //TODO combine into 1