diff options
author | Steve Smokowski <ss835w@att.com> | 2019-03-04 17:32:02 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-03-04 17:32:02 +0000 |
commit | 6fd28af38ec8f90445bbcb0e5fa2328f428da4a8 (patch) | |
tree | 64c9795203d24db696ce620b7474c9e5d35ebb08 /bpmn/MSOCommonBPMN/src | |
parent | 9cc8a412d9b80d403f477c211eec6870cff248d7 (diff) | |
parent | d7aebcd7399b5111b2ffac7755eb61eb58456c67 (diff) |
Merge "Remove restriction on mapping String values only"
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
6 files changed, 173 insertions, 27 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 81a504da4a..108fd66488 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -361,8 +361,8 @@ public class BBInputSetupMapperLayer { List<Map<String, Object>> userParams = requestParameters.getUserParams(); for (Map<String, Object> userParamsMap : userParams) { if ( userParamsMap.containsKey(USER_PARAM_NAME_KEY) && (userParamsMap.get(USER_PARAM_NAME_KEY) instanceof String) - && userParamsMap.containsKey(USER_PARAM_VALUE_KEY) && (userParamsMap.get(USER_PARAM_VALUE_KEY) instanceof String)) { - userParamsResult.put((String) userParamsMap.get(USER_PARAM_NAME_KEY), (String) userParamsMap.get(USER_PARAM_VALUE_KEY)); + && userParamsMap.containsKey(USER_PARAM_VALUE_KEY)) { + userParamsResult.put((String) userParamsMap.get(USER_PARAM_NAME_KEY), userParamsMap.get(USER_PARAM_VALUE_KEY)); } } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java index 753a354d95..3cb7b241dc 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -643,14 +643,16 @@ public class BBInputSetupMapperLayerTest { @Test public void testMapNameValueUserParams() throws IOException { RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class); - Map<String,Object> actual = bbInputSetupMapperLayer.mapNameValueUserParams(requestDetails.getRequestParameters()); + Map<String,Object> actual = bbInputSetupMapperLayer.mapNameValueUserParams(requestDetails.getRequestParameters()); + assertTrue(actual.containsKey("mns_vfw_protected_route_prefixes")); + assertTrue(actual.get("mns_vfw_protected_route_prefixes").toString().contains("interface_route_table_routes_route")); + assertTrue(actual.get("mns_vfw_protected_route_prefixes").toString().contains("1.1.1.1/32")); + assertTrue(actual.get("mns_vfw_protected_route_prefixes").toString().contains("0::1/128")); assertTrue(actual.containsKey("name1")); assertTrue(actual.containsValue("value1")); assertTrue(actual.get("name1").equals("value1")); - assertTrue(actual.containsKey("name2")); - assertTrue(actual.containsValue("value2")); - assertTrue(actual.get("name2").equals("value2")); + assertFalse(actual.containsKey("ignore")); assertFalse(actual.containsValue("ignore")); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index 56875d315b..cea8fc3cc2 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -776,7 +776,7 @@ public class BBInputSetupTest { @Test public void testPopulateGBBWithSIAndAdditionalInfo() throws Exception { - GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpectedWUserParamsInfo.json"), GeneralBuildingBlock.class); ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpectedWUserParamsInfo.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpectedWUserParamsInfo.json new file mode 100644 index 0000000000..5ac07c6546 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpectedWUserParamsInfo.json @@ -0,0 +1,132 @@ +{ + "requestContext": { + "product-family-id": "productFamilyId", + "source": "source", + "requestor-id": "requestorId", + "mso-request-id": "requestId", + "subscription-service-type": "subscriptionServiceType", + "user-params": { + + "mns_vfw_protected_route_prefixes": [ { + "interface_route_table_routes_route" : "1.1.1.1/32" + }, { + "interface_route_table_routes_route" : "0::1/128" + } ], + "name1": "value1" + }, + "action": "createInstance", + "callback-url": "callbackURL", + "requestParameters": { + "subscriptionServiceType": "subscriptionServiceType", + "userParams": [ + + { + "name" : "mns_vfw_protected_route_prefixes", + "value" : [ { + "interface_route_table_routes_route" : "1.1.1.1/32" + }, { + "interface_route_table_routes_route" : "0::1/128" + } ] + }, + { + "name": "name1", + "value": "value1" + }, + { + "ignore": "false", + "skip": "ignore" + } + ] + }, + "configurationParameters": [ + { + "availability-zone":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]", + "xtz-123":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]" + } + ] + }, + "orchContext": { + "is-rollback-enabled": false + }, + "cloudRegion": { + "lcp-cloud-region-id": "lcpCloudRegionId", + "cloud-owner": "test-owner-name", + "tenant-id": "tenantId", + "complex": "complexName" + }, + "userInput": null, + "customer": { + "global-customer-id": "globalCustomerId", + "subscriber-name": "subscriberName", + "subscriber-type": "subscriberType", + "service-subscription": { + "service-type": "subscriptionServiceType", + "service-instances": [ + { + "service-instance-id": "3655a595-05d1-433c-93c0-3afd6b572545", + "service-instance-name": "serviceInstanceName", + "orchestration-status": "PRECREATED", + "owning-entity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "project": { + "project-name": "projectName" + }, + "vnfs": [], + "allotted-resources": [], + "networks": [], + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "configurations": [], + "model-info-service-instance": { + "description": "description", + "created": null, + "model-name": "modelName", + "model-uuid": "modelUUID", + "model-invariant-uuid": "modelInvariantUUID", + "model-version": "modelVersion", + "service-type": "serviceType", + "service-role": "serviceRole", + "environment-context": "environmentContext", + "workload-context": "workloadContext" + } + } + ] + } + }, + "serviceInstance": { + "service-instance-id": "3655a595-05d1-433c-93c0-3afd6b572545", + "service-instance-name": "serviceInstanceName", + "orchestration-status": "PRECREATED", + "owning-entity": { + "owning-entity-id": "owningEntityId", + "owning-entity-name": "owningEntityName" + }, + "project": { + "project-name": "projectName" + }, + "vnfs": [], + "allotted-resources": [], + "networks": [], + "vhn-portal-url": null, + "service-instance-location-id": null, + "selflink": null, + "metadata": null, + "configurations": [], + "model-info-service-instance": { + "description": "description", + "created": null, + "model-name": "modelName", + "model-uuid": "modelUUID", + "model-invariant-uuid": "modelInvariantUUID", + "model-version": "modelVersion", + "service-type": "serviceType", + "service-role": "serviceRole", + "environment-context": "environmentContext", + "workload-context": "workloadContext" + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json index 906903e0b2..06b219df38 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json @@ -6,21 +6,31 @@ "action": null, "callback-url": "callbackURL", "user-params": { - "name1": "value1", - "name2": "value2" + + "mns_vfw_protected_route_prefixes": [ { + "interface_route_table_routes_route" : "1.1.1.1/32" + }, { + "interface_route_table_routes_route" : "0::1/128" + } ], + "name1": "value1" }, "requestParameters": { "subscriptionServiceType": "subscriptionServiceType", "userParams": [ + { + "name" : "mns_vfw_protected_route_prefixes", + "value" : [ { + "interface_route_table_routes_route" : "1.1.1.1/32" + }, { + "interface_route_table_routes_route" : "0::1/128" + } ] + }, + { "name": "name1", "value": "value1" }, { - "name": "name2", - "value": "value2" - }, - { "ignore": "false", "skip": "ignore" } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json index 9afbdd9150..7e28b44abd 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json @@ -9,20 +9,22 @@ "requestParameters": { "subscriptionServiceType": "subscriptionServiceType", "userParams": [ - { - "name": "name1", - "value": "value1" - }, - { - "name": "name2", - "value": "value2" - }, - { - "ignore": "false", - "skip": "ignore" - } - ] - + { + "name" : "mns_vfw_protected_route_prefixes", + "value" : [ { + "interface_route_table_routes_route" : "1.1.1.1/32" + }, { + "interface_route_table_routes_route" : "0::1/128" + } ] + }, + { + "name": "name1", + "value": "value1" + }, + { + "ignore": "false", + "skip": "ignore" + }] }, "configurationParameters": [ { |