From e628d4da23a6961dfce0689ef599ec3e4df685e6 Mon Sep 17 00:00:00 2001 From: Lukasz Muszkieta Date: Wed, 21 Oct 2020 19:15:14 +0200 Subject: pnf service instantiation fix - IndexOutOfBoundsException Issue-ID: SO-3322 Signed-off-by: Lukasz Muszkieta Change-Id: I6c978cbe788281eac25fa7be6f4ff24c4bff9810 Signed-off-by: Lukasz Muszkieta --- .../onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java | 6 +++++- .../so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'bpmn') diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index d9ad245e76..7c4f735577 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -30,6 +30,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.Optional; @@ -1663,8 +1664,11 @@ public class WorkflowAction { execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow()); } List flows = northBoundRequest.getOrchestrationFlowList(); - if (flows == null) + if (flows == null) { flows = new ArrayList<>(); + } else { + flows.sort(Comparator.comparingInt(OrchestrationFlow::getSequenceNumber)); + } for (OrchestrationFlow flow : flows) { if (!flow.getFlowName().contains("BB") && !flow.getFlowName().contains("Activity")) { List macroQueryFlows = diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index 53d1bea1f2..50ff074866 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -3110,9 +3110,11 @@ public class WorkflowActionTest extends BaseTaskTest { private List createFlowList(String... flowNames) { List result = new ArrayList<>(); + int sequenceNumber = 1; for (String flowName : flowNames) { OrchestrationFlow orchFlow = new OrchestrationFlow(); orchFlow.setFlowName(flowName); + orchFlow.setSequenceNumber(sequenceNumber++); result.add(orchFlow); } return result; -- cgit 1.2.3-korg