summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-03-04 10:15:14 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-03-04 10:15:29 -0500
commitd7aebcd7399b5111b2ffac7755eb61eb58456c67 (patch)
treea766b9be270383777d30d455dba3666173dd0212 /bpmn
parent0f4371f47e72c413b2a28d3a0426bdac49f1291b (diff)
Remove restriction on mapping String values only
Correct the JUnits to address userParams non-String values Remove restriction on mapping of String values only for userParams in BB RequestContext. Change-Id: I8a0d30e61618c275301d62bf04c064bea56c1b4d Issue-ID: SO-1593 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpectedWUserParamsInfo.json132
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json22
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json30
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": [
{