restore not NULL verification 31/118731/2
authorMNUSHKIN, DMITRY <dmitry.mnushkin@att.com>
Tue, 2 Mar 2021 21:38:29 +0000 (16:38 -0500)
committerBenjamin, Max (mb388a) <mb388a@att.com>
Thu, 4 Mar 2021 15:13:43 +0000 (10:13 -0500)
restore not NULL verification on user params
include test file missed in commit

Issue-ID: SO-3564
Signed-off-by: AT&T Open Source <g22940@att.com>
Change-Id: I2ad7cff33081b1ccc5369cfc54dccf0eab1f6fbf
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
bpmn/so-bpmn-tasks/src/test/resources/__files/VfModuleCreateWithFabricNoParams.json [new file with mode: 0644]

index f5955d6..d1da38f 100644 (file)
@@ -204,8 +204,10 @@ public class WorkflowAction {
             }
             // If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified,
             // enable it.
-            List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams();
-            if (sIRequest.getRequestDetails().getRequestParameters() != null && userParams != null) {
+            if (sIRequest.getRequestDetails().getRequestParameters() != null
+                    && sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
+                List<Map<String, Object>> userParams =
+                        sIRequest.getRequestDetails().getRequestParameters().getUserParams();
                 for (Map<String, Object> params : userParams) {
                     if (params.containsKey(HOMINGSOLUTION)) {
                         execution.setVariable(HOMING, !"none".equals(params.get(HOMINGSOLUTION)));
index 100c32f..d0cd4b0 100644 (file)
@@ -111,6 +111,7 @@ public class WorkflowActionTest extends BaseTaskTest {
     private static final String MACRO_ASSIGN_JSON = "Macro/ServiceMacroAssign.json";
     private static final String MACRO_ASSIGN_NO_CLOUD_JSON = "Macro/ServiceMacroAssignNoCloud.json";
     private static final String VF_MODULE_CREATE_WITH_FABRIC_JSON = "VfModuleCreateWithFabric.json";
+    private static final String VF_MODULE_CREATE_WITH_FABRIC_NO_PARAMS_JSON = "VfModuleCreateWithFabricNoParams.json";
     private static final String VF_MODULE_REPLACE_REBUILD_VOLUME_GROUPS_JSON =
             "VfModuleReplaceRebuildVolumeGroups.json";
     private static final String MACRO_CREATE_NETWORK_COLLECTION_JSON = "Macro/CreateNetworkCollection.json";
@@ -1492,6 +1493,27 @@ public class WorkflowActionTest extends BaseTaskTest {
                 "DeactivateVfModuleBB", "DeleteVfModuleBB", "UnassignVfModuleBB");
     }
 
+    @Test
+    public void selectExecutionListALaCarteNoRequestParametersTest() throws Exception {
+        String gAction = "createInstance";
+        String resource = "VfModule";
+        String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_NO_PARAMS_JSON);
+        initExecution(gAction, bpmnRequest, true);
+        execution.setVariable("requestUri",
+                "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
+
+        NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+        List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB",
+                "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB");
+        northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+        when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+                true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+        workflowAction.selectExecutionList(execution);
+        List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+        assertEqualsBulkFlowName(ebbs, "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB");
+    }
+
     @Test
     public void getConfigBuildingBlocksNoVfModuleFabricDeleteTest() throws Exception {
         String gAction = "deleteInstance";
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModuleCreateWithFabricNoParams.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModuleCreateWithFabricNoParams.json
new file mode 100644 (file)
index 0000000..33b7eee
--- /dev/null
@@ -0,0 +1,62 @@
+{
+    "requestDetails": {
+        "modelInfo": {
+            "modelCustomizationName": "model-cust-name",
+            "modelInvariantId": "db86e4a6-c027-452e-a559-3a23b3128367",
+            "modelType": "vfModule",
+            "modelName": "test-model-name",
+            "modelVersion": "1",
+            "modelCustomizationUuid": "9a6d01fd-19a7-490a-9800-460830a12e0b",
+            "modelVersionId": "14c8f313-fb0f-4cf6-8caf-c7cce8137b60",
+            "modelCustomizationId": "9a6d01fd-19a7-490a-9800-460830a12e0b",
+            "modelUuid": "14c8f313-fb0f-4cf6-8caf-c7cce8137b60",
+            "modelInvariantUuid": "db86e4a6-c027-452e-a559-3a23b3128367",
+            "modelInstanceName": "test-model-instance-name"
+        },
+        "requestInfo": {
+            "source": "VID",
+            "instanceName": "instanceName",
+            "suppressRollback": false,
+            "requestorId": "user"
+        },
+        "relatedInstanceList": [
+            {
+                "relatedInstance": {
+                    "instanceId": "f647e3ef-6d2e-4cd3-bff4-8df4634208de",
+                    "modelInfo": {
+                        "modelInvariantId": "86adb376-5303-441a-b50e-96c0cd643b0f",
+                        "modelType": "service",
+                        "modelName": "model-name",
+                        "modelVersion": "1.0",
+                        "modelVersionId": "599e21ed-803d-4d1f-83df-20005339b83f",
+                        "modelUuid": "599e21ed-803d-4d1f-83df-20005339b83f",
+                        "modelInvariantUuid": "86adb376-5303-441a-b50e-96c0cd643b0f"
+                    }
+                }
+            },
+            {
+                "relatedInstance": {
+                    "instanceId": "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d",
+                    "modelInfo": {
+                        "modelCustomizationName": "modle-cust-name",
+                        "modelInvariantId": "5cca9285-4ed4-4e11-a609-921ed3344811",
+                        "modelType": "vnf",
+                        "modelName": "modle-name",
+                        "modelVersion": "1.0",
+                        "modelCustomizationUuid": "fc25201d-36d6-43a3-8d39-fdae88e526ae",
+                        "modelVersionId": "7cae703a-b20d-481a-863a-b862236c00f7",
+                        "modelCustomizationId": "fc25201d-36d6-43a3-8d39-fdae88e526ae",
+                        "modelUuid": "7cae703a-b20d-481a-863a-b862236c00f7",
+                        "modelInvariantUuid": "5cca9285-4ed4-4e11-a609-921ed3344811",
+                        "modelInstanceName": "model-inst-name"
+                    }
+                }
+            }
+        ],
+        "cloudConfiguration": {
+            "tenantId": "872f331350c54e59991a8de2cbffb40c",
+            "cloudOwner": "my-custom-cloud-owner",
+            "lcpCloudRegionId": "cloud-region"
+        }
+    }
+}
\ No newline at end of file