aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test/java/org/onap
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@orange.com>2021-07-06 17:35:37 +0200
committerLukasz Rajewski <lukasz.rajewski@orange.com>2021-07-11 23:21:09 +0200
commitab1c20465e36ed1b645e2ad5dba502c8430a6b88 (patch)
tree1fb74235904922cc06270c5ae91ce5972f7b3d51 /bpmn/so-bpmn-tasks/src/test/java/org/onap
parent6d6fde75df5837c67a0e098eda59a60bc6923041 (diff)
Fix macro flow resource blocks processing order
Change-Id: I9941cf15d65b5c463126d99e03aa4eb0c2e8c183 Issue-ID: SO-3705 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java/org/onap')
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilderTest.java172
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ResourceTest.java72
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java169
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoaderTest.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java21
5 files changed, 416 insertions, 53 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilderTest.java
index cc3da9952a..61b5740238 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilderTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilderTest.java
@@ -10,6 +10,8 @@
* ================================================================================
* Modifications Copyright (c) 2020 Tech Mahindra
* ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
* 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
@@ -29,8 +31,10 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
import org.junit.Test;
import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -59,7 +63,7 @@ public class ExecuteBuildingBlockBuilderTest {
String cvnfModuleCustomizationId = "2b1a3c";
String vnfCustomizationId = "zz12aa";
- Resource resource = new Resource(WorkflowType.SERVICE, "123", true);
+ Resource resource = new Resource(WorkflowType.SERVICE, "123", true, null);
resource.setCvnfModuleCustomizationId(vfModuleCustomizationId);
resource.setCvnfModuleCustomizationId(cvnfModuleCustomizationId);
@@ -73,4 +77,170 @@ public class ExecuteBuildingBlockBuilderTest {
assertEquals(vnfCustomizationId, confResourceKeys.getVnfResourceCustomizationUUID());
}
+
+ private Resource getResource(List<Resource> resources, ExecuteBuildingBlock block) {
+ Resource res =
+ resources.stream().filter(resource -> resource.getResourceId() == block.getBuildingBlock().getKey())
+ .findAny().orElse(null);
+ return res;
+ }
+
+ private void buildExecuteBuildingBlockListOrderOfVnf(int vnfCount, boolean addPnf, boolean priorities) {
+ WorkflowResourceIds wfIds = new WorkflowResourceIds();
+ wfIds.setServiceInstanceId("1");
+ List<Resource> resources = new ArrayList<>();
+ Resource r1 = new Resource(WorkflowType.SERVICE, "1", false, null);
+ resources.add(r1);
+ for (int i = 0; i < vnfCount; i++) {
+ Resource r2 = new Resource(WorkflowType.VNF, Integer.toString(2 + i * 3), false, r1);
+ Resource r3 = new Resource(WorkflowType.VFMODULE, Integer.toString(3 + i * 3), false, r2);
+ Resource r4 = new Resource(WorkflowType.VFMODULE, Integer.toString(4 + i * 3), false, r2);
+ r4.setBaseVfModule(true);
+ resources.add(r2);
+ resources.add(r3);
+ resources.add(r4);
+ if (priorities) {
+ r2.setProcessingPriority(vnfCount - i);
+ r3.setProcessingPriority(1);
+ r4.setProcessingPriority(2);
+ }
+ }
+ if (addPnf) {
+ Resource r5 = new Resource(WorkflowType.PNF, Integer.toString(5 + (vnfCount - 1) * 3), false, r1);
+ resources.add(r5);
+ }
+
+ OrchestrationFlow f1 = new OrchestrationFlow();
+ f1.setFlowName("AssignServiceInstanceBB");
+ OrchestrationFlow f2 = new OrchestrationFlow();
+ f2.setFlowName("AssignVnfBB");
+ OrchestrationFlow f3 = new OrchestrationFlow();
+ f3.setFlowName("AssignVfModuleBB");
+ OrchestrationFlow f4 = new OrchestrationFlow();
+ f4.setFlowName("ControllerExecutionBB");
+ f4.setBpmnAction("config-assign");
+ f4.setBpmnScope("vnf");
+ OrchestrationFlow f5 = new OrchestrationFlow();
+ f5.setFlowName("AssignPnfBB");
+ OrchestrationFlow f6 = new OrchestrationFlow();
+ f6.setFlowName("WaitForPnfReadyBB");
+ OrchestrationFlow f7 = new OrchestrationFlow();
+ f7.setFlowName("ControllerExecutionBB");
+ f7.setBpmnAction("config-assign");
+ f7.setBpmnScope("pnf");
+ OrchestrationFlow f8 = new OrchestrationFlow();
+ f8.setFlowName("ControllerExecutionBB");
+ f8.setBpmnAction("config-deploy");
+ f8.setBpmnScope("pnf");
+ OrchestrationFlow f9 = new OrchestrationFlow();
+ f9.setFlowName("ActivatePnfBB");
+ OrchestrationFlow f10 = new OrchestrationFlow();
+ f10.setFlowName("CreateVfModuleBB");
+ OrchestrationFlow f11 = new OrchestrationFlow();
+ f11.setFlowName("ActivateVfModuleBB");
+ OrchestrationFlow f12 = new OrchestrationFlow();
+ f12.setFlowName("ControllerExecutionBB");
+ f12.setBpmnAction("config-deploy");
+ f12.setBpmnScope("vnf");
+ OrchestrationFlow f13 = new OrchestrationFlow();
+ f13.setFlowName("ActivateVnfBB");
+ OrchestrationFlow f14 = new OrchestrationFlow();
+ f14.setFlowName("ActivateServiceInstanceBB");
+
+ List<OrchestrationFlow> flows = Arrays.asList(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14);
+ for (int i = 0; i < flows.size(); i++) {
+ OrchestrationFlow flow = flows.get(i);
+ flow.setId(i + 1);
+ flow.setSequenceNumber(i + 1);
+ flow.setFlowVersion(1.0);
+ flow.setAction("Service-Macro-Create");
+ }
+
+ List<ExecuteBuildingBlock> flowsToExecute = executeBBBuilder.buildExecuteBuildingBlockList(flows, resources,
+ "1", "1", "1", WorkflowActionConstants.CREATE_INSTANCE, "type", wfIds, null, false);
+
+ for (ExecuteBuildingBlock block : flowsToExecute) {
+ String name = block.getBuildingBlock().getBpmnFlowName();
+ if (name.equals("ControllerExecutionBB"))
+ name += " [" + block.getBuildingBlock().getBpmnScope() + ", " + block.getBuildingBlock().getBpmnAction()
+ + "]";
+ System.out.println(name);
+ }
+ assertNotNull(flowsToExecute);
+ assertEquals((addPnf ? 7 : 2) + vnfCount * 4L + vnfCount * 2L * 3, flowsToExecute.size());
+
+ for (ExecuteBuildingBlock block : flowsToExecute)
+ assertNotNull(getResource(resources, block));
+
+ if (priorities) {
+ if (vnfCount > 1)
+ assertEquals("5", getResource(resources, flowsToExecute.get(1)).getResourceId());
+ else
+ assertEquals("3", getResource(resources, flowsToExecute.get(2)).getResourceId());
+ } else {
+ if (vnfCount > 1)
+ assertEquals("2", getResource(resources, flowsToExecute.get(1)).getResourceId());
+ else
+ assertEquals("4", getResource(resources, flowsToExecute.get(2)).getResourceId());
+ }
+
+ // AssignVfModuleBB
+ assertEquals(f3.getFlowName(), flowsToExecute.get(2).getBuildingBlock().getBpmnFlowName());
+ // ControllerExecutionBB
+ assertEquals(f4.getFlowName(), flowsToExecute.get(4).getBuildingBlock().getBpmnFlowName());
+ if (vnfCount > 1) {
+ // AssignVnfBB
+ if (addPnf)
+ assertEquals(f2.getFlowName(), flowsToExecute.get(5).getBuildingBlock().getBpmnFlowName());
+ else
+ assertEquals(f2.getFlowName(), flowsToExecute.get(11).getBuildingBlock().getBpmnFlowName());
+ }
+ int pnfOffset = -5;
+ if (addPnf) {
+ pnfOffset = (vnfCount - 1) * 4;
+ // AssignPnfBB
+ assertEquals(f5.getFlowName(), flowsToExecute.get(5 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+ // WaitForPnfReadyBB
+ assertEquals(f6.getFlowName(), flowsToExecute.get(6 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+ // ControllerExecutionBB
+ assertEquals(f7.getFlowName(), flowsToExecute.get(7 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+ // ControllerExecutionBB
+ assertEquals(f8.getFlowName(), flowsToExecute.get(8 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+ // ActivatePnfBB
+ assertEquals(f9.getFlowName(), flowsToExecute.get(9 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+ }
+ // CreateVfModuleBB
+ assertEquals(f10.getFlowName(), flowsToExecute.get(10 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+ // ActivateVfModuleBB
+ assertEquals(f11.getFlowName(), flowsToExecute.get(11 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+ // ControllerExecutionBB
+ assertEquals(f12.getFlowName(), flowsToExecute.get(14 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+ // ActivateVnfBB
+ assertEquals(f13.getFlowName(), flowsToExecute.get(15 + pnfOffset).getBuildingBlock().getBpmnFlowName());
+ }
+
+ @Test
+ public void buildExecuteBuildingBlockListSortByBaseVfModuleTest() {
+ buildExecuteBuildingBlockListOrderOfVnf(1, false, false);
+ }
+
+ @Test
+ public void buildExecuteBuildingBlockListSortByPriorityTest() {
+ buildExecuteBuildingBlockListOrderOfVnf(1, false, true);
+ }
+
+ @Test
+ public void buildExecuteBuildingBlockListGroupByResourceTypeAndSortByPriorityTest() {
+ buildExecuteBuildingBlockListOrderOfVnf(2, false, true);
+ }
+
+ @Test
+ public void buildExecuteBuildingBlockListGroupByResourceTypeTest() {
+ buildExecuteBuildingBlockListOrderOfVnf(2, false, false);
+ }
+
+ @Test
+ public void buildExecuteBuildingBlockListGroupByResourceTypeVnfAndPnfTest() {
+ buildExecuteBuildingBlockListOrderOfVnf(2, true, false);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ResourceTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ResourceTest.java
index 5e3afa16ac..cd98792938 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ResourceTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ResourceTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
* 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
@@ -30,26 +32,84 @@ public class ResourceTest {
@Test
public void testBaseFirstComparator() {
- Resource r1 = new Resource(null, "1", false);
- Resource r2 = new Resource(null, "2", false);
+ Resource r1 = new Resource(null, "1", false, null);
+ Resource r2 = new Resource(null, "2", false, null);
+ r2.setBaseVfModule(true);
+
+ List<Resource> sorted =
+ Arrays.asList(r1, r2).stream().sorted(Resource.sortByPriorityAsc).collect(Collectors.toList());
+
+ assertEquals("2", sorted.get(0).getResourceId());
+ }
+
+ @Test
+ public void testPriorityAscComparator() {
+ Resource r1 = new Resource(null, "1", false, null);
+ Resource r2 = new Resource(null, "2", false, null);
+ Resource r3 = new Resource(null, "3", false, null);
+ Resource r4 = new Resource(null, "4", false, null);
+ r1.setProcessingPriority(4);
r2.setBaseVfModule(true);
+ r3.setProcessingPriority(2);
+ r4.setProcessingPriority(1);
List<Resource> sorted =
- Arrays.asList(r1, r2).stream().sorted(Resource.sortBaseFirst).collect(Collectors.toList());
+ Arrays.asList(r1, r2, r3, r4).stream().sorted(Resource.sortByPriorityAsc).collect(Collectors.toList());
assertEquals("2", sorted.get(0).getResourceId());
+ assertEquals("4", sorted.get(1).getResourceId());
+ assertEquals("3", sorted.get(2).getResourceId());
}
@Test
public void testBaseLastComparator() {
- Resource r1 = new Resource(null, "1", false);
- Resource r2 = new Resource(null, "2", false);
+ Resource r1 = new Resource(null, "1", false, null);
+ Resource r2 = new Resource(null, "2", false, null);
r1.setBaseVfModule(true);
List<Resource> sorted =
- Arrays.asList(r1, r2).stream().sorted(Resource.sortBaseLast).collect(Collectors.toList());
+ Arrays.asList(r1, r2).stream().sorted(Resource.sortByPriorityDesc).collect(Collectors.toList());
assertEquals("1", sorted.get(1).getResourceId());
}
+ @Test
+ public void testPriorityDescComparator() {
+ Resource r1 = new Resource(null, "1", false, null);
+ Resource r2 = new Resource(null, "2", false, null);
+ Resource r3 = new Resource(null, "3", false, null);
+ Resource r4 = new Resource(null, "4", false, null);
+ r1.setProcessingPriority(4);
+ r2.setBaseVfModule(true);
+ r3.setProcessingPriority(2);
+ r4.setProcessingPriority(1);
+
+ List<Resource> sorted =
+ Arrays.asList(r1, r2, r3, r4).stream().sorted(Resource.sortByPriorityDesc).collect(Collectors.toList());
+
+ assertEquals("1", sorted.get(0).getResourceId());
+ assertEquals("3", sorted.get(1).getResourceId());
+ assertEquals("4", sorted.get(2).getResourceId());
+ }
+
+ @Test
+ public void testPriorityReplaceBase() {
+ Resource r1 = new Resource(null, "1", false, null);
+ Resource r2 = new Resource(null, "2", false, null);
+ Resource r3 = new Resource(null, "3", false, null);
+ Resource r4 = new Resource(null, "4", false, null);
+ r1.setProcessingPriority(4);
+ r2.setBaseVfModule(true);
+ r2.setProcessingPriority(6);
+ r3.setProcessingPriority(2);
+ r4.setProcessingPriority(1);
+
+ List<Resource> sorted =
+ Arrays.asList(r1, r2, r3, r4).stream().sorted(Resource.sortByPriorityAsc).collect(Collectors.toList());
+
+ assertEquals("4", sorted.get(0).getResourceId());
+ assertEquals("3", sorted.get(1).getResourceId());
+ assertEquals("1", sorted.get(2).getResourceId());
+ }
+
}
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 10e6ed4895..e52d2dfecf 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
@@ -8,6 +8,8 @@
* ================================================================================
* Modifications Copyright (c) 2020 Nokia
* ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
* 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
@@ -115,6 +117,7 @@ public class WorkflowActionTest extends BaseTaskTest {
"VfModuleReplaceRebuildVolumeGroups.json";
private static final String MACRO_CREATE_NETWORK_COLLECTION_JSON = "Macro/CreateNetworkCollection.json";
private static final String MACRO_VNF_MACRO_REPLACE_JSON = "Macro/VnfMacroReplace.json";
+ private static final String MACRO_CREATE_JSON = "Macro/ServiceMacroAssignVnfAndPnf.json";
@Mock
protected Environment environment;
@@ -298,7 +301,7 @@ public class WorkflowActionTest extends BaseTaskTest {
vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), anyString()))
- .thenReturn(prepareListWithResources());
+ .thenReturn(prepareListWithResources(false, false));
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"))
@@ -349,7 +352,7 @@ public class WorkflowActionTest extends BaseTaskTest {
vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), anyString()))
- .thenReturn(prepareListWithResources());
+ .thenReturn(prepareListWithResources(false, false));
when(environment.getProperty("org.onap.so.cloud-owner")).thenReturn("att-aic");
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
false, "att-aic")).thenReturn(northBoundRequest);
@@ -406,13 +409,13 @@ public class WorkflowActionTest extends BaseTaskTest {
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB",
- "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB",
+ "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB",
"ActivateServiceInstanceBB");
assertEquals("volumeGroup0", ebbs.get(0).getWorkflowResourceIds().getVolumeGroupId());
assertEquals("volumeGroup0", ebbs.get(1).getWorkflowResourceIds().getVolumeGroupId());
assertEquals("testVfModuleId1", ebbs.get(2).getWorkflowResourceIds().getVfModuleId());
- assertEquals("testVfModuleId2", ebbs.get(3).getWorkflowResourceIds().getVfModuleId());
- assertEquals("testVfModuleId1", ebbs.get(4).getWorkflowResourceIds().getVfModuleId());
+ assertEquals("testVfModuleId1", ebbs.get(3).getWorkflowResourceIds().getVfModuleId());
+ assertEquals("testVfModuleId2", ebbs.get(4).getWorkflowResourceIds().getVfModuleId());
assertEquals("testVfModuleId2", ebbs.get(5).getWorkflowResourceIds().getVfModuleId());
assertEquals("vnf0", ebbs.get(6).getWorkflowResourceIds().getVnfId());
assertEquals("si0", ebbs.get(7).getWorkflowResourceIds().getServiceInstanceId());
@@ -624,7 +627,7 @@ public class WorkflowActionTest extends BaseTaskTest {
vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), anyString()))
- .thenReturn(prepareListWithResources());
+ .thenReturn(prepareListWithResources(false, false));
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"))
@@ -638,8 +641,8 @@ public class WorkflowActionTest extends BaseTaskTest {
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignVnfBB", "AssignVolumeGroupBB",
"AssignVfModuleBB", "AssignVfModuleBB", "AssignVfModuleBB", "CreateVolumeGroupBB",
- "ActivateVolumeGroupBB", "CreateVfModuleBB", "CreateVfModuleBB", "CreateVfModuleBB",
- "ActivateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB",
+ "ActivateVolumeGroupBB", "CreateVfModuleBB", "ActivateVfModuleBB", "CreateVfModuleBB",
+ "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB",
"ActivateServiceInstanceBB");
assertEquals(3, ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
@@ -663,6 +666,92 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void selectExecutionListServiceMacroCreateWithUserParamsAndPriorities() throws Exception {
+ String gAction = "createInstance";
+ String resource = "Service";
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_CREATE_JSON);
+ initExecution(gAction, bpmnRequest, false);
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
+ "AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "AssignPnfBB",
+ "WaitForPnfReadyBB", "ActivatePnfBB", "CreateNetworkBB", "ActivateNetworkBB", "CreateVolumeGroupBB",
+ "ActivateVolumeGroupBB", "CreateVfModuleBB", "ActivateVfModuleBB", "AssignFabricConfigurationBB",
+ "ActivateFabricConfigurationBB", "ActivateVnfBB", "ActivateNetworkCollectionBB",
+ "ActivateServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ Service service = new Service();
+ service.setModelUUID("3c40d244-808e-42ca-b09a-256d83d19d0a");
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
+ HeatEnvironment volumeHeatEnv = new HeatEnvironment();
+ vfModuleCustomization.setVolumeHeatEnv(volumeHeatEnv);
+ org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
+ HeatTemplate volumeHeatTemplate = new HeatTemplate();
+ vfModule.setVolumeHeatTemplate(volumeHeatTemplate);
+ vfModuleCustomization.setVfModule(vfModule);
+
+ VfModuleCustomization vfModuleCustomization2 = new VfModuleCustomization();
+ vfModuleCustomization2.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
+ HeatEnvironment heatEnvironment = new HeatEnvironment();
+ vfModuleCustomization2.setHeatEnvironment(heatEnvironment);
+ org.onap.so.db.catalog.beans.VfModule vfModule2 = new org.onap.so.db.catalog.beans.VfModule();
+ HeatTemplate moduleHeatTemplate = new HeatTemplate();
+ vfModule2.setModuleHeatTemplate(moduleHeatTemplate);
+ vfModuleCustomization2.setVfModule(vfModule2);
+
+ VfModuleCustomization vfModuleCustomization3 = vfModuleCustomization2;
+ vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
+
+ when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), anyString()))
+ .thenReturn(prepareListWithResources(true, true));
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"))
+ .thenReturn(vfModuleCustomization);
+ when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"))
+ .thenReturn(vfModuleCustomization2);
+ when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969"))
+ .thenReturn(vfModuleCustomization3);
+ when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignVnfBB", "AssignVolumeGroupBB",
+ "AssignVfModuleBB", "AssignVfModuleBB", "AssignVfModuleBB", "AssignPnfBB", "WaitForPnfReadyBB",
+ "ActivatePnfBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB",
+ "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "CreateVfModuleBB",
+ "ActivateVfModuleBB", "ActivateVnfBB", "ActivateServiceInstanceBB");
+
+ assertEquals(3, ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
+ int randomUUIDLength = UUID.randomUUID().toString().length();
+ assertEquals(randomUUIDLength, ebbs.get(1).getWorkflowResourceIds().getVnfId().length());
+ assertEquals(randomUUIDLength, ebbs.get(2).getWorkflowResourceIds().getVolumeGroupId().length());
+ assertEquals(randomUUIDLength, ebbs.get(3).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(4).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(5).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals("72d9d1cd-f46d-447a-abdb-451d6fb05fa8", ebbs.get(3).getBuildingBlock().getKey());
+ assertEquals("da4d4327-fb7d-4311-ac7a-be7ba60cf969", ebbs.get(4).getBuildingBlock().getKey());
+ assertEquals("3c40d244-808e-42ca-b09a-256d83d19d0a", ebbs.get(5).getBuildingBlock().getKey());
+ assertEquals(randomUUIDLength, ebbs.get(6).getWorkflowResourceIds().getPnfId().length());
+ assertEquals(randomUUIDLength, ebbs.get(7).getWorkflowResourceIds().getPnfId().length());
+ assertEquals(randomUUIDLength, ebbs.get(8).getWorkflowResourceIds().getPnfId().length());
+ assertEquals(randomUUIDLength, ebbs.get(9).getWorkflowResourceIds().getVolumeGroupId().length());
+ assertEquals(randomUUIDLength, ebbs.get(10).getWorkflowResourceIds().getVolumeGroupId().length());
+ assertEquals(randomUUIDLength, ebbs.get(11).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(12).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(13).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(14).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(15).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(16).getWorkflowResourceIds().getVfModuleId().length());
+ assertEquals(randomUUIDLength, ebbs.get(17).getWorkflowResourceIds().getVnfId().length());
+ assertEquals(3, ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
+ assertEquals(true, execution.getVariable("homing"));
+ }
+
+ @Test
public void selectExecutionListServiceMacroDeleteTest() throws Exception {
String gAction = "deleteInstance";
String resource = "Service";
@@ -708,7 +797,7 @@ public class WorkflowActionTest extends BaseTaskTest {
false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs, "DeactivateVfModuleBB", "DeactivateVfModuleBB", "DeleteVfModuleBB",
+ assertEqualsBulkFlowName(ebbs, "DeactivateVfModuleBB", "DeleteVfModuleBB", "DeactivateVfModuleBB",
"DeleteVfModuleBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB",
"DeactivatePnfBB", "DeactivateServiceInstanceBB", "UnassignVfModuleBB", "UnassignVfModuleBB",
"UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignServiceInstanceBB");
@@ -879,8 +968,8 @@ public class WorkflowActionTest extends BaseTaskTest {
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "AAICheckVnfInMaintBB", "AAISetVnfInMaintBB", "DeactivateVfModuleBB",
- "DeactivateVfModuleBB", "DeleteVfModuleBB", "DeleteVfModuleBB", "DeactivateVnfBB", "CreateVfModuleBB",
- "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB", "SDNOVnfHealthCheckBB",
+ "DeleteVfModuleBB", "DeactivateVfModuleBB", "DeleteVfModuleBB", "DeactivateVnfBB", "CreateVfModuleBB",
+ "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB", "SDNOVnfHealthCheckBB",
"AAIUnsetVnfInMaintBB");
}
@@ -940,12 +1029,13 @@ public class WorkflowActionTest extends BaseTaskTest {
false, "cloud-owner")).thenReturn(northBoundRequest);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs, "AAICheckVnfInMaintBB", "AAISetVnfInMaintBB", "DeactivateFabricConfigurationBB",
- "UnassignFabricConfigurationBB", "DeactivateVfModuleBB", "DeactivateVfModuleBB", "DeleteVfModuleBB",
- "DeleteVfModuleBB", "DeactivateVnfBB", "ChangeModelVfModuleBB", "ChangeModelVfModuleBB",
- "CreateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB",
- "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ChangeModelVnfBB", "ActivateVnfBB",
- "ChangeModelServiceInstanceBB", "SDNOVnfHealthCheckBB", "AAIUnsetVnfInMaintBB");
+ assertEqualsBulkFlowName(ebbs, "AAICheckVnfInMaintBB", "AAISetVnfInMaintBB", "DeactivateVfModuleBB",
+ "DeleteVfModuleBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB",
+ "DeactivateVfModuleBB", "DeleteVfModuleBB", "DeactivateVnfBB", "ChangeModelVfModuleBB",
+ "CreateVfModuleBB", "ActivateVfModuleBB", "ChangeModelVfModuleBB", "CreateVfModuleBB",
+ "ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB",
+ "ChangeModelVnfBB", "ActivateVnfBB", "ChangeModelServiceInstanceBB", "SDNOVnfHealthCheckBB",
+ "AAIUnsetVnfInMaintBB");
for (ExecuteBuildingBlock executeBuildingBlock : ebbs) {
assertEquals("123", executeBuildingBlock.getWorkflowResourceIds().getServiceInstanceId());
}
@@ -1540,7 +1630,7 @@ public class WorkflowActionTest extends BaseTaskTest {
String vnfType = "vnfType";
String key = "00d15ebb-c80e-43c1-80f0-90c40dde70b0";
String resourceId = "d1d35800-783d-42d3-82f6-d654c5054a6e";
- Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+ Resource resourceKey = new Resource(resourceType, key, aLaCarte, null);
WorkflowResourceIds workflowResourceIds = SPY_workflowAction.populateResourceIdsFromApiHandler(execution);
thrown.expect(AAIEntityNotFoundException.class);
@@ -1592,7 +1682,7 @@ public class WorkflowActionTest extends BaseTaskTest {
String vnfType = "vnfType";
String key = "00d15ebb-c80e-43c1-80f0-90c40dde70b0";
String resourceId = "d1d35800-783d-42d3-82f6-d654c5054a6e";
- Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+ Resource resourceKey = new Resource(resourceType, key, aLaCarte, null);
WorkflowResourceIds workflowResourceIds = SPY_workflowAction.populateResourceIdsFromApiHandler(execution);
List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
@@ -1667,7 +1757,7 @@ public class WorkflowActionTest extends BaseTaskTest {
String vnfType = "vnfType";
String key = "00d15ebb-c80e-43c1-80f0-90c40dde70b0";
String resourceId = "d1d35800-783d-42d3-82f6-d654c5054a6e";
- Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+ Resource resourceKey = new Resource(resourceType, key, aLaCarte, null);
WorkflowResourceIds workflowResourceIds = SPY_workflowAction.populateResourceIdsFromApiHandler(execution);
List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
@@ -1948,10 +2038,10 @@ public class WorkflowActionTest extends BaseTaskTest {
String uri6 = "/v6/serviceInstances/123/vnfs/1234/someAction";
String uri7 = "/v6/serviceInstances/123/vnfs/1234/vfModules/5678/replace";
String uri8 = "/v6/serviceInstances/123/vnfs/1234/vfModules/scaleOut";
- Resource expected1 = new Resource(WorkflowType.SERVICE, "123", true);
- Resource expected2 = new Resource(WorkflowType.VNF, "1234", false);
- Resource expected3 = new Resource(WorkflowType.VNF, "1234", false);
- Resource expected4 = new Resource(WorkflowType.VFMODULE, "5678", false);
+ Resource expected1 = new Resource(WorkflowType.SERVICE, "123", true, null);
+ Resource expected2 = new Resource(WorkflowType.VNF, "1234", false, expected1);
+ Resource expected3 = new Resource(WorkflowType.VNF, "1234", false, expected1);
+ Resource expected4 = new Resource(WorkflowType.VFMODULE, "5678", false, expected2);
Resource result = workflowAction.extractResourceIdAndTypeFromUri(uri);
assertEquals(expected1.getResourceId(), result.getResourceId());
assertEquals(expected1.getResourceType(), result.getResourceType());
@@ -2091,14 +2181,31 @@ public class WorkflowActionTest extends BaseTaskTest {
return new String(Files.readAllBytes(Paths.get("src/test/resources/__files/" + fileName)));
}
- private List<Resource> prepareListWithResources() {
+ private List<Resource> prepareListWithResources(boolean addPnf, boolean addPriorites) {
List<Resource> resourceList = new ArrayList<>();
- resourceList.add(new Resource(WorkflowType.SERVICE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false));
- resourceList.add(new Resource(WorkflowType.VNF, "ab153b6e-c364-44c0-bef6-1f2982117f04", false));
- resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", false));
- resourceList.add(new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false));
- resourceList.add(new Resource(WorkflowType.VFMODULE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false));
- resourceList.add(new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false));
+ Resource r1 = new Resource(WorkflowType.SERVICE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false, null);
+ resourceList.add(r1);
+ Resource r2 = new Resource(WorkflowType.VNF, "ab153b6e-c364-44c0-bef6-1f2982117f04", false, r1);
+ resourceList.add(r2);
+ Resource r3 = new Resource(WorkflowType.VOLUMEGROUP, "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", false, r2);
+ resourceList.add(r3);
+ Resource r4 = new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false, r2);
+ resourceList.add(r4);
+ Resource r5 = new Resource(WorkflowType.VFMODULE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false, r2);
+ resourceList.add(r5);
+ Resource r6 = new Resource(WorkflowType.VFMODULE, "da4d4327-fb7d-4311-ac7a-be7ba60cf969", false, r2);
+ resourceList.add(r6);
+ if (addPnf) {
+ Resource r7 = new Resource(WorkflowType.PNF, "aa153b6e-c364-44c0-bef6-1f2982117f04", false, r1);
+ resourceList.add(r7);
+ }
+ if (addPriorites) {
+ r3.setProcessingPriority(2);
+ r4.setProcessingPriority(1);
+ r5.setProcessingPriority(4);
+ r5.setBaseVfModule(true);
+ r6.setProcessingPriority(3);
+ }
return resourceList;
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoaderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoaderTest.java
index a5ecf364a6..7a26422eb9 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoaderTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoaderTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (c) 2020 Nokia
* ================================================================================
+ * Modifications Copyright (c) 2021 Orange
+ * ================================================================================
* 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
@@ -171,10 +173,10 @@ public class ServiceEBBLoaderTest extends BaseTaskTest {
@Test
public void foundRelatedTest() {
List<Resource> resourceList = new ArrayList<>();
- resourceList.add(new Resource(WorkflowType.PNF, "model customization id", false));
- resourceList.add(new Resource(WorkflowType.VNF, "model customization id", false));
- resourceList.add(new Resource(WorkflowType.NETWORK, "model customization id", false));
- resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, "model customization id", false));
+ resourceList.add(new Resource(WorkflowType.PNF, "model customization id", false, null));
+ resourceList.add(new Resource(WorkflowType.VNF, "model customization id", false, null));
+ resourceList.add(new Resource(WorkflowType.NETWORK, "model customization id", false, null));
+ resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, "model customization id", false, null));
assertTrue(serviceEBBLoader.foundRelated(resourceList));
}
@@ -182,10 +184,10 @@ public class ServiceEBBLoaderTest extends BaseTaskTest {
@Test
public void containsWorkflowTypeTest() {
List<Resource> resourceList = new ArrayList<>();
- resourceList.add(new Resource(WorkflowType.PNF, "resource id", false));
- resourceList.add(new Resource(WorkflowType.VNF, "model customization id", false));
- resourceList.add(new Resource(WorkflowType.NETWORK, "model customization id", false));
- resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, "model customization id", false));
+ resourceList.add(new Resource(WorkflowType.PNF, "resource id", false, null));
+ resourceList.add(new Resource(WorkflowType.VNF, "model customization id", false, null));
+ resourceList.add(new Resource(WorkflowType.NETWORK, "model customization id", false, null));
+ resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, "model customization id", false, null));
assertTrue(serviceEBBLoader.containsWorkflowType(resourceList, WorkflowType.PNF));
assertTrue(serviceEBBLoader.containsWorkflowType(resourceList, WorkflowType.VNF));
@@ -280,7 +282,8 @@ public class ServiceEBBLoaderTest extends BaseTaskTest {
doReturn(aaiLocalNetwork).when(mockBbInputSetupUtils).getAAIL3Network("localNetworkInstanceId");
- serviceEBBLoader.traverseVrfConfiguration(aaiResourceIds, resource, service, relatedVpnBinding,
+ Resource serviceResource = new Resource(WorkflowType.SERVICE, "1", false, null);
+ serviceEBBLoader.traverseVrfConfiguration(aaiResourceIds, resource, serviceResource, service, relatedVpnBinding,
relatedLocalNetwork);
assertEquals(resource.size(), 1);
assertEquals(aaiResourceIds.size(), 0);
@@ -346,12 +349,14 @@ public class ServiceEBBLoaderTest extends BaseTaskTest {
private List<Resource> prepareListWithResources() {
List<Resource> resourceList = new ArrayList<>();
- resourceList.add(new Resource(WorkflowType.SERVICE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false));
- resourceList.add(new Resource(WorkflowType.VNF, "ab153b6e-c364-44c0-bef6-1f2982117f04", false));
- resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", false));
- resourceList.add(new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false));
- resourceList.add(new Resource(WorkflowType.VFMODULE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false));
- resourceList.add(new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false));
+ Resource r1 = new Resource(WorkflowType.SERVICE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false, null);
+ resourceList.add(r1);
+ Resource r2 = new Resource(WorkflowType.VNF, "ab153b6e-c364-44c0-bef6-1f2982117f04", false, r1);
+ resourceList.add(r2);
+ resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", false, r2));
+ resourceList.add(new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false, r2));
+ resourceList.add(new Resource(WorkflowType.VFMODULE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false, r2));
+ resourceList.add(new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false, r2));
return resourceList;
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
index 9f4bd97ac6..58fee86ade 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
@@ -59,6 +59,7 @@ import static org.mockito.Mockito.mock;
public class UserParamsServiceTraversalTest extends BaseTaskTest {
private static final String MACRO_ASSIGN_JSON = "Macro/ServiceMacroAssign.json";
+ private static final String MACRO_CREATE_JSON = "Macro/ServiceMacroAssignVnfAndPnf.json";
private static final String MACRO_ASSIGN_PNF_JSON = "Macro/ServiceMacroAssignPnf.json";
private static final String NETWORK_COLLECTION_JSON = "Macro/CreateNetworkCollection.json";
private static final String MACRO_CREATE_WITHOUT_RESOURCES_JSON = "Macro/ServiceMacroCreateWithoutResources.json";
@@ -114,6 +115,26 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
}
@Test
+ public void getResourceListFromUserParamsForVnfsWithPriorities() throws Exception {
+ initExecution(requestAction, readBpmnRequestFromFile(MACRO_CREATE_JSON), false);
+ Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient)
+ .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
+ Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(),
+ anyString(), anyString());
+
+ List<Resource> resourceListFromUserParams = userParamsServiceTraversal.getResourceListFromUserParams(execution,
+ getUserParams(), serviceInstanceId, requestAction);
+ List<WorkflowType> expected = List.of(WorkflowType.SERVICE, WorkflowType.VNF, WorkflowType.VOLUMEGROUP,
+ WorkflowType.VFMODULE, WorkflowType.CONFIGURATION, WorkflowType.PNF);
+ List<WorkflowType> result =
+ resourceListFromUserParams.stream().map(Resource::getResourceType).collect(Collectors.toList());
+
+ assertEquals(6, resourceListFromUserParams.size());
+ assertThat(expected, is(result));
+ assertEquals(2, resourceListFromUserParams.get(1).getChildren().get(1).getProcessingPriority());
+ }
+
+ @Test
public void getResourceListFromUserParamsForPnfs() throws Exception {
initExecution(requestAction, readBpmnRequestFromFile(MACRO_ASSIGN_PNF_JSON), false);
Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient)