diff options
author | Elena Kuleshov <evn@att.com> | 2019-05-20 11:45:55 -0400 |
---|---|---|
committer | Elena Kuleshov <evn@att.com> | 2019-05-20 13:51:39 -0400 |
commit | 969333e6374d3e2259ab5fbbdbcbb3f4c12a134e (patch) | |
tree | 3de3d2d89881fb82b7135c72841d4df3d79a836d | |
parent | b883a8c104a519e791c151654d88af30f71e04e9 (diff) |
Check for null requestInfo
Check for null requestInfo
Issue-ID: SO-1900
Signed-off-by: Kuleshov, Elena <evn@att.com>
Change-Id: I2a3eb7ddbee396b19bcc71a2f647b9cf90082ed4
3 files changed, 47 insertions, 1 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 177c918305..b90ae19ca6 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 @@ -378,7 +378,11 @@ public class BBInputSetupMapperLayer { protected OrchestrationContext mapOrchestrationContext(RequestDetails requestDetails) { OrchestrationContext context = new OrchestrationContext(); - context.setIsRollbackEnabled(!(requestDetails.getRequestInfo().getSuppressRollback())); + if (requestDetails.getRequestInfo() != null) { + context.setIsRollbackEnabled(!(requestDetails.getRequestInfo().getSuppressRollback())); + } else { + context.setIsRollbackEnabled(false); + } return context; } 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 e7afa9ec8b..39650a2142 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 @@ -571,6 +571,19 @@ public class BBInputSetupMapperLayerTest { } @Test + public void testMapOrchestrationContextNoRequestInfo() throws IOException { + OrchestrationContext expected = new OrchestrationContext(); + expected.setIsRollbackEnabled(false); + + RequestDetails requestDetails = mapper.readValue( + new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContextNoRequestInfo.json"), RequestDetails.class); + + OrchestrationContext actual = bbInputSetupMapperLayer.mapOrchestrationContext(requestDetails); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test public void testMapLocationContext() { CloudRegion expected = new CloudRegion(); expected.setCloudOwner("test-owner-name"); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContextNoRequestInfo.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContextNoRequestInfo.json new file mode 100644 index 0000000000..41f0fde834 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContextNoRequestInfo.json @@ -0,0 +1,29 @@ +{ + "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]" + } + ] +} + |