diff options
author | Steve Smokowski <ss835w@att.com> | 2019-04-01 13:18:19 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-01 13:18:19 +0000 |
commit | 5460204e37d824d363ea4557f70f5ac366ba3dcc (patch) | |
tree | 8df357418b6c64e2be8eec358abe5935e4b5567a /bpmn/so-bpmn-tasks/src/test/java | |
parent | 1b5fe9853582fecceeb0aeaa366c3c62593199e6 (diff) | |
parent | 19b9d85de87ab777b44f4355c001c597104ec0e1 (diff) |
Merge "Put MSOReqId in ReqInfo to SDNC, not sdncReqId"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java')
5 files changed, 72 insertions, 2 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java index 0ca80c75f7..302bb551c3 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java @@ -75,6 +75,7 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup { Assert.assertEquals("VLAN-NETWORK-RECEPTOR", genericInfo.getConfigurationInformation().getConfigurationType()); Assert.assertEquals("uuid",genericInfo.getSdncRequestHeader().getSvcRequestId()); Assert.assertEquals("http://localhost",genericInfo.getSdncRequestHeader().getSvcNotificationUrl()); + Assert.assertEquals("MsoRequestId",genericInfo.getRequestInformation().getRequestId()); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java index 6a14f8b567..1bfa78ad6d 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java @@ -23,6 +23,7 @@ package org.onap.so.client.sdnc.mapper; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import java.io.IOException; @@ -109,6 +110,7 @@ public class NetworkTopologyOperationRequestMapperTest { userParams.put("key1", "value1"); requestContext.setUserParams(userParams); requestContext.setProductFamilyId("productFamilyId"); + requestContext.setMsoRequestId("MsoRequestId"); network = new L3Network(); network.setNetworkId("TEST_NETWORK_ID"); @@ -138,8 +140,24 @@ public class NetworkTopologyOperationRequestMapperTest { assertThat(networkSDNCrequest, sameBeanAs(reqMapper1).ignoring("sdncRequestHeader.svcRequestId") .ignoring("requestInformation.requestId")); + assertEquals("MsoRequestId", networkSDNCrequest.getRequestInformation().getRequestId()); } + + @Test + public void createGenericResourceApiNetworkOperationInformationReqContextNullTest() throws Exception { + RequestContext rc = new RequestContext(); + rc.setMsoRequestId(null); + GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, + rc, cloudRegion); + assertNotNull(networkSDNCrequest.getRequestInformation().getRequestId()); + GenericResourceApiNetworkOperationInformation networkSDNCrequest2 = mapper.reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, + null, cloudRegion); + assertNotNull(networkSDNCrequest2.getRequestInformation().getRequestId()); + } + @Test public void reqMapperTest() throws Exception { @@ -175,7 +193,8 @@ public class NetworkTopologyOperationRequestMapperTest { assertThat(reqMapperUnassign, sameBeanAs(networkSDNCrequestUnassign).ignoring("sdncRequestHeader.svcRequestId") .ignoring("requestInformation.requestId")); - + assertEquals("MsoRequestId", networkSDNCrequestUnassign.getRequestInformation().getRequestId()); + } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java index 0bf06a0bb0..1919ef437b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java @@ -22,6 +22,8 @@ package org.onap.so.client.sdnc.mapper; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.nio.file.Files; import java.nio.file.Paths; @@ -80,10 +82,14 @@ public class ServiceTopologyOperationMapperTest { userParams.put("key1", "value1"); requestContext.setUserParams(userParams); requestContext.setProductFamilyId("productFamilyId"); + requestContext.setMsoRequestId("MsoRequestId"); GenericResourceApiServiceOperationInformation serviceOpInformation = mapper.reqMapper( SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, requestContext); + GenericResourceApiServiceOperationInformation serviceOpInformationNullReqContext = mapper.reqMapper( + SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, + null); String jsonToCompare = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json"))); @@ -92,5 +98,7 @@ public class ServiceTopologyOperationMapperTest { GenericResourceApiOnapmodelinformationOnapModelInformation.class); assertThat(reqMapper1, sameBeanAs(serviceOpInformation.getServiceInformation().getOnapModelInformation())); + assertEquals("MsoRequestId", serviceOpInformation.getRequestInformation().getRequestId()); + assertNotNull(serviceOpInformationNullReqContext.getRequestInformation().getRequestId()); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java index 282f23caa7..7fce8c48c8 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java @@ -23,6 +23,7 @@ package org.onap.so.client.sdnc.mapper; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import java.nio.file.Files; @@ -102,6 +103,7 @@ public class VfModuleTopologyOperationRequestMapperTest { RequestParameters requestParameters = new RequestParameters(); requestParameters.setUsePreload(true); requestContext.setRequestParameters(requestParameters); + requestContext.setMsoRequestId("MsoRequestId"); GenericVnf vnf = new GenericVnf(); vnf.setVnfId("testVnfId"); @@ -148,6 +150,7 @@ public class VfModuleTopologyOperationRequestMapperTest { assertThat(reqMapper1, sameBeanAs(vfModuleSDNCrequest).ignoring("sdncRequestHeader.svcRequestId") .ignoring("requestInformation.requestId")); + assertEquals("MsoRequestId", vfModuleSDNCrequest.getRequestInformation().getRequestId()); } @Test @@ -168,10 +171,13 @@ public class VfModuleTopologyOperationRequestMapperTest { VfModule vfModule = new VfModule(); vfModule.setVfModuleId("testVfModuleId"); vfModule.setVfModuleName("testVfModuleName"); + + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("MsoRequestId"); GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper( SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, - null, null, null); + null, requestContext, null); String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleOperationInformationUnassign.json"))); @@ -182,6 +188,35 @@ public class VfModuleTopologyOperationRequestMapperTest { assertThat(reqMapper1, sameBeanAs(vfModuleSDNCrequest).ignoring("sdncRequestHeader.svcRequestId") .ignoring("requestInformation.requestId")); + assertEquals("MsoRequestId", vfModuleSDNCrequest.getRequestInformation().getRequestId()); + } + + @Test + public void unassignGenericResourceApiVfModuleInformationNullMsoReqIdTest() throws Exception { + + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + + // prepare and set vnf instance + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("testVnfId"); + vnf.setVnfType("testVnfType"); + + // prepare and set vf module instance + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("testVfModuleId"); + vfModule.setVfModuleName("testVfModuleName"); + + RequestContext requestContext = new RequestContext(); + + GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, + null, requestContext, null); + + assertNotNull(vfModuleSDNCrequest.getRequestInformation().getRequestId()); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java index 229a8cf601..64b532fd07 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java @@ -21,6 +21,7 @@ package org.onap.so.client.sdnc.mapper; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import java.util.ArrayList; @@ -122,12 +123,16 @@ public class VnfTopologyOperationRequestMapperTest { userParams.put("key1", "value1"); requestContext.setUserParams(userParams); requestContext.setProductFamilyId("productFamilyId"); + requestContext.setMsoRequestId("MsoRequestId"); CloudRegion cloudRegion = new CloudRegion(); GenericResourceApiVnfOperationInformation vnfOpInformation = mapper.reqMapper( SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext,true); + GenericResourceApiVnfOperationInformation vnfOpInformationNullReqContext = mapper.reqMapper( + SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, + cloudRegion, null,true); assertNull(vnfOpInformation.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid()); assertEquals("vnfModelCustomizationUUID", vnfOpInformation.getVnfInformation().getOnapModelInformation().getModelCustomizationUuid()); @@ -136,5 +141,7 @@ public class VnfTopologyOperationRequestMapperTest { assertEquals("l3-network-ig-222", vnfOpInformation.getVnfRequestInput().getVnfNetworkInstanceGroupIds().get(1).getVnfNetworkInstanceGroupId()); assertEquals("entitlementPoolUuid", vnfOpInformation.getVnfRequestInput().getVnfInputParameters().getParam().get(1).getValue()); assertEquals("licenseKeyGroupUuid", vnfOpInformation.getVnfRequestInput().getVnfInputParameters().getParam().get(2).getValue()); + assertEquals("MsoRequestId", vnfOpInformation.getRequestInformation().getRequestId()); + assertNotNull(vnfOpInformationNullReqContext.getRequestInformation().getRequestId()); } } |