summaryrefslogtreecommitdiffstats
path: root/bpmn/mso-infrastructure-bpmn
diff options
context:
space:
mode:
authorKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>2018-12-07 14:11:47 -0500
committerKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>2018-12-07 14:13:03 -0500
commitc45553d2e9bd80b842b46656fff86e357f959bf1 (patch)
treeb9e0bc4badf94f8340f34f055f024983d2b72302 /bpmn/mso-infrastructure-bpmn
parent3b56cf0c1763c45b7673a087107c5e1553dd4f40 (diff)
fixed headers for traceability
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>
Diffstat (limited to 'bpmn/mso-infrastructure-bpmn')
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
index 335f3468a7..4e45aafc9e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
@@ -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