diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test')
2 files changed, 59 insertions, 0 deletions
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 1babac68ca..7e76e52959 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 @@ -23,6 +23,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -53,6 +54,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; @@ -653,4 +655,24 @@ public class BBInputSetupMapperLayerTest { assertFalse(actual.containsValue("ignore")); } + @Test + public void testMapRequestParameters() throws IOException { + RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class); + RequestParameters actual = bbInputSetupMapperLayer.mapRequestParameters(requestDetails.getRequestParameters()); + + assertEquals(actual.getUsePreload(), requestDetails.getRequestParameters().getUsePreload()); + assertEquals(actual.getSubscriptionServiceType(), requestDetails.getRequestParameters().getSubscriptionServiceType()); + assertEquals(actual.getPayload(), requestDetails.getRequestParameters().getPayload()); + } + + protected RequestParameters mapRequestParameters(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) { + RequestParameters requestParams = new RequestParameters(); + requestParams.setaLaCarte(requestParameters.getALaCarte()); + requestParams.setUsePreload(requestParameters.getUsePreload()); + requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType()); + requestParams.setUserParams(requestParameters.getUserParams()); + requestParams.setPayload(requestParameters.getPayload()); + return requestParams; + } + } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqParameters.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqParameters.json new file mode 100644 index 0000000000..788c27b3fe --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqParameters.json @@ -0,0 +1,37 @@ +{ + "requestInfo": { + "callbackUrl": "callbackURL", + "productFamilyId": "productFamilyId", + "source": "source", + "suppressRollback": false, + "requestorId": "requestorId" + }, + "requestParameters": { + "subscriptionServiceType": "subscriptionServiceType", + "aLaCarte": false, + "usePreload": false, + "payload": "string123", + "userParams": [ + { + "name": "name1", + "value": "value1" + }, + { + "name": "name2", + "value": "value2" + }, + { + "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]" + } + ] +} + |