From 365d1c3f7db39eeec66437cf9f6c77bcce729819 Mon Sep 17 00:00:00 2001 From: noahs Date: Wed, 21 Mar 2018 15:27:23 +0200 Subject: Add unit-tests for mappers auto generated tests for mappers Change-Id: I4329aa2332e5db4bf5fcaab3481fb2f78a13044a Issue-ID: SDC-1156 Signed-off-by: noahs Signed-off-by: vempo --- .../MapChoiceOrOtherDtoToChoiceOrOtherTest.java | 52 +++++++ .../MapChoiceOrOtherToChoiceOrOtherDtoTest.java | 54 +++++++ ...ntPoolEntityToEntitlementPoolEntityDtoTest.java | 144 +++++++++++++++++ ...tPoolRequestDtoToEntitlementPoolEntityTest.java | 120 ++++++++++++++ ...GroupDescriptorDtoToFeatureGroupEntityTest.java | 75 +++++++++ ...GroupEntityToFeatureGroupDescriptorDtoTest.java | 75 +++++++++ ...tDescriptorDtoToLicenseAgreementEntityTest.java | 77 +++++++++ ...tEntityToLicenseAgreementDescriptorDtoTest.java | 78 ++++++++++ ...yGroupEntityToLicenseKeyGroupEntityDtoTest.java | 173 +++++++++++++++++++++ ...GroupRequestDtoToLicenseKeyGroupEntityTest.java | 140 +++++++++++++++++ .../rest/mapping/MapLimitEntityToLimitDtoTest.java | 128 +++++++++++++++ ...tiChoiceOrOtherDtoToMultiChoiceOrOtherTest.java | 57 +++++++ ...tiChoiceOrOtherToMultiChoiceOrOtherDtoTest.java | 54 +++++++ .../MapVendorLicenseModelEntityToDtoTest.java | 71 +++++++++ ...elRequestDtoToVendorLicenseModelEntityTest.java | 63 ++++++++ 15 files changed, 1361 insertions(+) create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherDtoToChoiceOrOtherTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherToChoiceOrOtherDtoTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementDescriptorDtoToLicenseAgreementEntityTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementEntityToLicenseAgreementDescriptorDtoTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDtoTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherDtoToMultiChoiceOrOtherTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherToMultiChoiceOrOtherDtoTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelEntityToDtoTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntityTest.java (limited to 'openecomp-be/api') diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherDtoToChoiceOrOtherTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherDtoToChoiceOrOtherTest.java new file mode 100644 index 0000000000..f4395bf23d --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherDtoToChoiceOrOtherTest.java @@ -0,0 +1,52 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import static org.testng.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; +import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto; + +public class MapChoiceOrOtherDtoToChoiceOrOtherTest { + + @Test + public void testChoice() { + ChoiceOrOtherDto source = new ChoiceOrOtherDto<>(); + ChoiceOrOther target = new ChoiceOrOther(); + MapChoiceOrOtherDtoToChoiceOrOther mapper = new MapChoiceOrOtherDtoToChoiceOrOther(); + TestEnum param = TestEnum.Yes; + source.setChoice(param); + mapper.doMapping(source, target); + assertEquals(target.getChoice(), param); + } + + @Test + public void testOther() { + ChoiceOrOtherDto source = new ChoiceOrOtherDto(); + ChoiceOrOther target = new ChoiceOrOther(); + MapChoiceOrOtherDtoToChoiceOrOther mapper = new MapChoiceOrOtherDtoToChoiceOrOther(); + String param = "47e3f467-1700-498f-b445-2ba8910253b2"; + source.setOther(param); + mapper.doMapping(source, target); + assertEquals(target.getOther(), param); + } + + enum TestEnum { + Yes + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherToChoiceOrOtherDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherToChoiceOrOtherDtoTest.java new file mode 100644 index 0000000000..fcb3701b90 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherToChoiceOrOtherDtoTest.java @@ -0,0 +1,54 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; + +import org.junit.Test; +import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; +import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto; + + +public class MapChoiceOrOtherToChoiceOrOtherDtoTest { + + @Test + public void testOther() { + ChoiceOrOther source = new ChoiceOrOther(); + ChoiceOrOtherDto target = new ChoiceOrOtherDto(); + MapChoiceOrOtherToChoiceOrOtherDto mapper = new MapChoiceOrOtherToChoiceOrOtherDto(); + String param = "768f875f-af54-4cd2-aaa7-75ee7a176031"; + source.setOther(param); + mapper.doMapping(source, target); + assertEquals(target.getOther(), param); + } + + @Test + public void testChoice() { + ChoiceOrOther source = new ChoiceOrOther(); + ChoiceOrOtherDto target = new ChoiceOrOtherDto(); + MapChoiceOrOtherToChoiceOrOtherDto mapper = new MapChoiceOrOtherToChoiceOrOtherDto(); + TestEnum param = TestEnum.Yes; + source.setChoice(param); + mapper.doMapping(source, target); + assertNotNull(source.getChoice()); + } + + enum TestEnum { + Yes + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java new file mode 100644 index 0000000000..0d03c19808 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java @@ -0,0 +1,144 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import static org.testng.Assert.assertEquals; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import org.junit.Test; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; +import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; +import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; +import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto; + + +public class MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest { + + @Test + public void testReferencingFeatureGroups() { + EntitlementPoolEntity source = new EntitlementPoolEntity(); + EntitlementPoolEntityDto target = new EntitlementPoolEntityDto(); + MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper = + new MapEntitlementPoolEntityToEntitlementPoolEntityDto(); + Set param = new HashSet<>(Collections.singletonList("a3ad0c7a-9f4c-44d2-8c0c-b4b47cd6d264")); + source.setReferencingFeatureGroups(param); + mapper.doMapping(source, target); + assertEquals(target.getReferencingFeatureGroups(), param); + } + + @Test + public void testDescription() { + EntitlementPoolEntity source = new EntitlementPoolEntity(); + EntitlementPoolEntityDto target = new EntitlementPoolEntityDto(); + MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper = + new MapEntitlementPoolEntityToEntitlementPoolEntityDto(); + String param = "58191782-5de2-4d42-b8ca-119707d38150"; + source.setDescription(param); + mapper.doMapping(source, target); + assertEquals(target.getDescription(), param); + } + + @Test + public void testIncrements() { + EntitlementPoolEntity source = new EntitlementPoolEntity(); + EntitlementPoolEntityDto target = new EntitlementPoolEntityDto(); + MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper = + new MapEntitlementPoolEntityToEntitlementPoolEntityDto(); + String param = "ea6b2eab-f959-41c2-9a09-2898eb5401be"; + source.setIncrements(param); + mapper.doMapping(source, target); + assertEquals(target.getIncrements(), param); + } + + @Test + public void testExpiryDate() { + EntitlementPoolEntity source = new EntitlementPoolEntity(); + EntitlementPoolEntityDto target = new EntitlementPoolEntityDto(); + MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper = + new MapEntitlementPoolEntityToEntitlementPoolEntityDto(); + String param = "7e27d6a4-78be-44df-b099-dd41317586ba"; + source.setExpiryDate(param); + mapper.doMapping(source, target); + assertEquals(target.getExpiryDate(), param); + } + + @Test + public void testId() { + EntitlementPoolEntity source = new EntitlementPoolEntity(); + EntitlementPoolEntityDto target = new EntitlementPoolEntityDto(); + MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper = + new MapEntitlementPoolEntityToEntitlementPoolEntityDto(); + String param = "e2163b3f-971e-4523-a5bc-0e6f7dd44e37"; + source.setId(param); + mapper.doMapping(source, target); + assertEquals(target.getId(), param); + } + + @Test + public void testThresholdValue() { + EntitlementPoolEntity source = new EntitlementPoolEntity(); + EntitlementPoolEntityDto target = new EntitlementPoolEntityDto(); + MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper = + new MapEntitlementPoolEntityToEntitlementPoolEntityDto(); + Integer param = 2146099790; + source.setThresholdValue(param); + mapper.doMapping(source, target); + assertEquals(target.getThresholdValue(), param); + } + + @Test + public void testName() { + EntitlementPoolEntity source = new EntitlementPoolEntity(); + EntitlementPoolEntityDto target = new EntitlementPoolEntityDto(); + MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper = + new MapEntitlementPoolEntityToEntitlementPoolEntityDto(); + mapper.doMapping(source, target); + assertEquals(target.getName(), source.getName()); + String param = "f8faa28a-435d-4cea-98ee-de7a46b52ec5"; + source.setName(param); + mapper.doMapping(source, target); + assertEquals(target.getName(), param); + } + + @Test + public void testOperationalScope() { + EntitlementPoolEntity source = new EntitlementPoolEntity(); + EntitlementPoolEntityDto target = new EntitlementPoolEntityDto(); + MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper = + new MapEntitlementPoolEntityToEntitlementPoolEntityDto(); + MultiChoiceOrOther param = new MultiChoiceOrOther<>(); + param.setChoices(new HashSet(Arrays.asList("a", "b"))); + source.setOperationalScope(param); + mapper.doMapping(source, target); + assertEquals(target.getOperationalScope().getChoices(), param.getChoices()); + } + + @Test + public void testStartDate() { + EntitlementPoolEntity source = new EntitlementPoolEntity(); + EntitlementPoolEntityDto target = new EntitlementPoolEntityDto(); + MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper = + new MapEntitlementPoolEntityToEntitlementPoolEntityDto(); + String param = "afeadea1-9fb7-4d2d-bcc3-3ef298ed1802"; + source.setStartDate(param); + mapper.doMapping(source, target); + assertEquals(target.getStartDate(), param); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java new file mode 100644 index 0000000000..86e94510bc --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java @@ -0,0 +1,120 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import static org.testng.Assert.assertEquals; + +import java.util.Collections; +import java.util.HashSet; +import org.junit.Test; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; +import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; +import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolRequestDto; +import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; + + +public class MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest { + + @Test + public void testExpiryDate() { + EntitlementPoolRequestDto source = new EntitlementPoolRequestDto(); + EntitlementPoolEntity target = new EntitlementPoolEntity(); + MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper = + new MapEntitlementPoolRequestDtoToEntitlementPoolEntity(); + String param = "2d9bd40d-9b86-4621-a0b3-015cc65ed29f"; + source.setExpiryDate(param); + mapper.doMapping(source, target); + assertEquals(target.getExpiryDate(), param); + } + + @Test + public void testName() { + EntitlementPoolRequestDto source = new EntitlementPoolRequestDto(); + EntitlementPoolEntity target = new EntitlementPoolEntity(); + MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper = + new MapEntitlementPoolRequestDtoToEntitlementPoolEntity(); + String param = "08c72f48-2cb6-4509-9983-5564c74c1bc8"; + source.setName(param); + mapper.doMapping(source, target); + assertEquals(target.getName(), param); + } + + @Test + public void testDescription() { + EntitlementPoolRequestDto source = new EntitlementPoolRequestDto(); + EntitlementPoolEntity target = new EntitlementPoolEntity(); + MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper = + new MapEntitlementPoolRequestDtoToEntitlementPoolEntity(); + String param = "b5161f7b-b5bc-4e98-b242-a8dc99aeab01"; + source.setDescription(param); + mapper.doMapping(source, target); + assertEquals(target.getDescription(), param); + } + + @Test + public void testThresholdValue() { + EntitlementPoolRequestDto source = new EntitlementPoolRequestDto(); + EntitlementPoolEntity target = new EntitlementPoolEntity(); + MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper = + new MapEntitlementPoolRequestDtoToEntitlementPoolEntity(); + Integer param = -767970235; + source.setThresholdValue(param); + mapper.doMapping(source, target); + assertEquals(target.getThresholdValue(), param); + } + + @Test + public void testIncrements() { + EntitlementPoolRequestDto source = new EntitlementPoolRequestDto(); + EntitlementPoolEntity target = new EntitlementPoolEntity(); + MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper = + new MapEntitlementPoolRequestDtoToEntitlementPoolEntity(); + String param = "3b760eff-6407-44b7-a1f2-2a87b432f094"; + source.setIncrements(param); + mapper.doMapping(source, target); + assertEquals(target.getIncrements(), param); + } + + @Test + public void testOperationalScope() { + EntitlementPoolRequestDto source = new EntitlementPoolRequestDto(); + EntitlementPoolEntity target = new EntitlementPoolEntity(); + MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper = + new MapEntitlementPoolRequestDtoToEntitlementPoolEntity(); + MultiChoiceOrOtherDto param = new MultiChoiceOrOtherDto<>(); + param.setChoices(new HashSet(Collections.singletonList(TestEnum.Yes))); + source.setOperationalScope(param); + mapper.doMapping(source, target); + assertEquals(target.getOperationalScope().getChoices(), param.getChoices()); + } + + @Test + public void testStartDate() { + EntitlementPoolRequestDto source = new EntitlementPoolRequestDto(); + EntitlementPoolEntity target = new EntitlementPoolEntity(); + MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper = + new MapEntitlementPoolRequestDtoToEntitlementPoolEntity(); + String param = "654f3536-9346-45fb-97f5-6dc24e517e31"; + source.setStartDate(param); + mapper.doMapping(source, target); + assertEquals(target.getStartDate(), param); + } + + enum TestEnum { + Yes + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.java new file mode 100644 index 0000000000..ea8c59b94c --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.java @@ -0,0 +1,75 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import static org.testng.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; +import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupDescriptorDto; + + +public class MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest { + + @Test + public void testName() { + FeatureGroupDescriptorDto source = new FeatureGroupDescriptorDto(); + FeatureGroupEntity target = new FeatureGroupEntity(); + MapFeatureGroupDescriptorDtoToFeatureGroupEntity mapper = + new MapFeatureGroupDescriptorDtoToFeatureGroupEntity(); + String param = "bf328e2e-8c77-440b-8485-d6a5a54e604a"; + source.setName(param); + mapper.doMapping(source, target); + assertEquals(target.getName(), param); + } + + @Test + public void testDescription() { + FeatureGroupDescriptorDto source = new FeatureGroupDescriptorDto(); + FeatureGroupEntity target = new FeatureGroupEntity(); + MapFeatureGroupDescriptorDtoToFeatureGroupEntity mapper = + new MapFeatureGroupDescriptorDtoToFeatureGroupEntity(); + String param = "6361dbd3-07e5-40db-bffc-00aaf0c1e16e"; + source.setDescription(param); + mapper.doMapping(source, target); + assertEquals(target.getDescription(), param); + } + + @Test + public void testManufacturerReferenceNumber() { + FeatureGroupDescriptorDto source = new FeatureGroupDescriptorDto(); + FeatureGroupEntity target = new FeatureGroupEntity(); + MapFeatureGroupDescriptorDtoToFeatureGroupEntity mapper = + new MapFeatureGroupDescriptorDtoToFeatureGroupEntity(); + String param = "6751e741-ffc2-4034-863b-f0083f62c033"; + source.setManufacturerReferenceNumber(param); + mapper.doMapping(source, target); + assertEquals(target.getManufacturerReferenceNumber(), param); + } + + @Test + public void testPartNumber() { + FeatureGroupDescriptorDto source = new FeatureGroupDescriptorDto(); + FeatureGroupEntity target = new FeatureGroupEntity(); + MapFeatureGroupDescriptorDtoToFeatureGroupEntity mapper = + new MapFeatureGroupDescriptorDtoToFeatureGroupEntity(); + String param = "4a99afe6-8493-42d3-92df-62c03dd1d55e"; + source.setPartNumber(param); + mapper.doMapping(source, target); + assertEquals(target.getPartNumber(), param); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.java new file mode 100644 index 0000000000..b575febac8 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.java @@ -0,0 +1,75 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import static org.testng.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; +import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupDescriptorDto; + + +public class MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest { + + @Test + public void testManufacturerReferenceNumber() { + FeatureGroupEntity source = new FeatureGroupEntity(); + FeatureGroupDescriptorDto target = new FeatureGroupDescriptorDto(); + MapFeatureGroupEntityToFeatureGroupDescriptorDto mapper = + new MapFeatureGroupEntityToFeatureGroupDescriptorDto(); + String param = "02402e1e-7092-485a-9574-46e2d49cca97"; + source.setManufacturerReferenceNumber(param); + mapper.doMapping(source, target); + assertEquals(target.getManufacturerReferenceNumber(), param); + } + + @Test + public void testDescription() { + FeatureGroupEntity source = new FeatureGroupEntity(); + FeatureGroupDescriptorDto target = new FeatureGroupDescriptorDto(); + MapFeatureGroupEntityToFeatureGroupDescriptorDto mapper = + new MapFeatureGroupEntityToFeatureGroupDescriptorDto(); + String param = "0173a1e0-f713-413c-854b-152d35228616"; + source.setDescription(param); + mapper.doMapping(source, target); + assertEquals(target.getDescription(), param); + } + + @Test + public void testName() { + FeatureGroupEntity source = new FeatureGroupEntity(); + FeatureGroupDescriptorDto target = new FeatureGroupDescriptorDto(); + MapFeatureGroupEntityToFeatureGroupDescriptorDto mapper = + new MapFeatureGroupEntityToFeatureGroupDescriptorDto(); + String param = "d0a3212d-06c6-455e-ab36-b1fd63eefeca"; + source.setName(param); + mapper.doMapping(source, target); + assertEquals(target.getName(), param); + } + + @Test + public void testPartNumber() { + FeatureGroupEntity source = new FeatureGroupEntity(); + FeatureGroupDescriptorDto target = new FeatureGroupDescriptorDto(); + MapFeatureGroupEntityToFeatureGroupDescriptorDto mapper = + new MapFeatureGroupEntityToFeatureGroupDescriptorDto(); + String param = "562265f0-abe0-44e9-9ee4-3cf2f5436ea9"; + source.setPartNumber(param); + mapper.doMapping(source, target); + assertEquals(target.getPartNumber(), param); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementDescriptorDtoToLicenseAgreementEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementDescriptorDtoToLicenseAgreementEntityTest.java new file mode 100644 index 0000000000..a47f60aac1 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementDescriptorDtoToLicenseAgreementEntityTest.java @@ -0,0 +1,77 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import static org.testng.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseTerm; +import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto; +import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementDescriptorDto; + + +public class MapLicenseAgreementDescriptorDtoToLicenseAgreementEntityTest { + + @Test + public void testName() { + LicenseAgreementDescriptorDto source = new LicenseAgreementDescriptorDto(); + LicenseAgreementEntity target = new LicenseAgreementEntity(); + MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity mapper = + new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity(); + String param = "62d9b3aa-1d06-453f-a412-62d8cba7164d"; + source.setName(param); + mapper.doMapping(source, target); + assertEquals(target.getName(), param); + } + + @Test + public void testDescription() { + LicenseAgreementDescriptorDto source = new LicenseAgreementDescriptorDto(); + LicenseAgreementEntity target = new LicenseAgreementEntity(); + MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity mapper = + new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity(); + String param = "3888dc1f-516b-4790-a5fe-73efadb2ba38"; + source.setDescription(param); + mapper.doMapping(source, target); + assertEquals(target.getDescription(), param); + } + + @Test + public void testRequirementsAndConstrains() { + LicenseAgreementDescriptorDto source = new LicenseAgreementDescriptorDto(); + LicenseAgreementEntity target = new LicenseAgreementEntity(); + MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity mapper = + new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity(); + String param = "be6df4d3-b534-4c62-b611-4ed5b67e72ab"; + source.setRequirementsAndConstrains(param); + mapper.doMapping(source, target); + assertEquals(target.getRequirementsAndConstrains(), param); + } + + @Test + public void testLicenseTerm() { + LicenseAgreementDescriptorDto source = new LicenseAgreementDescriptorDto(); + LicenseAgreementEntity target = new LicenseAgreementEntity(); + MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity mapper = + new MapLicenseAgreementDescriptorDtoToLicenseAgreementEntity(); + ChoiceOrOtherDto licenseTermChoiceOrOtherDto = new ChoiceOrOtherDto<>(); + source.setLicenseTerm(licenseTermChoiceOrOtherDto); + mapper.doMapping(source, target); + assertEquals(target.getLicenseTerm().getChoice(), licenseTermChoiceOrOtherDto.getChoice()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementEntityToLicenseAgreementDescriptorDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementEntityToLicenseAgreementDescriptorDtoTest.java new file mode 100644 index 0000000000..4717ff4cc7 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementEntityToLicenseAgreementDescriptorDtoTest.java @@ -0,0 +1,78 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import static org.testng.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseTerm; +import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementDescriptorDto; + + +public class MapLicenseAgreementEntityToLicenseAgreementDescriptorDtoTest { + + @Test + public void testLicenseTerm() { + LicenseAgreementEntity source = new LicenseAgreementEntity(); + LicenseAgreementDescriptorDto target = new LicenseAgreementDescriptorDto(); + MapLicenseAgreementEntityToLicenseAgreementDescriptorDto mapper = + new MapLicenseAgreementEntityToLicenseAgreementDescriptorDto(); + ChoiceOrOther licenseTermChoiceOrOther = new ChoiceOrOther<>(); + licenseTermChoiceOrOther.setChoice(LicenseTerm.Other); + source.setLicenseTerm(licenseTermChoiceOrOther); + mapper.doMapping(source, target); + assertEquals(target.getLicenseTerm().getChoice(), licenseTermChoiceOrOther.getChoice()); + } + + @Test + public void testName() { + LicenseAgreementEntity source = new LicenseAgreementEntity(); + LicenseAgreementDescriptorDto target = new LicenseAgreementDescriptorDto(); + MapLicenseAgreementEntityToLicenseAgreementDescriptorDto mapper = + new MapLicenseAgreementEntityToLicenseAgreementDescriptorDto(); + String param = "b76b2520-2573-4337-9bf8-fbd9b41aecc9"; + source.setName(param); + mapper.doMapping(source, target); + assertEquals(target.getName(), param); + } + + @Test + public void testDescription() { + LicenseAgreementEntity source = new LicenseAgreementEntity(); + LicenseAgreementDescriptorDto target = new LicenseAgreementDescriptorDto(); + MapLicenseAgreementEntityToLicenseAgreementDescriptorDto mapper = + new MapLicenseAgreementEntityToLicenseAgreementDescriptorDto(); + String param = "1a9f859d-0644-450d-9cda-0caced655b94"; + source.setDescription(param); + mapper.doMapping(source, target); + assertEquals(target.getDescription(), param); + } + + @Test + public void testRequirementsAndConstrains() { + LicenseAgreementEntity source = new LicenseAgreementEntity(); + LicenseAgreementDescriptorDto target = new LicenseAgreementDescriptorDto(); + MapLicenseAgreementEntityToLicenseAgreementDescriptorDto mapper = + new MapLicenseAgreementEntityToLicenseAgreementDescriptorDto(); + String param = "1efaca15-4d8a-422c-a33a-7b57f9aaa99c"; + source.setRequirementsAndConstrains(param); + mapper.doMapping(source, target); + assertEquals(target.getRequirementsAndConstrains(), param); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.java new file mode 100644 index 0000000000..ce8363def4 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.java @@ -0,0 +1,173 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import static org.testng.Assert.assertEquals; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import org.junit.Test; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType; +import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; +import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; +import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; +import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto; + + +public class MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest { + + @Test + public void testReferencingFeatureGroups() { + LicenseKeyGroupEntity source = new LicenseKeyGroupEntity(); + LicenseKeyGroupEntityDto target = new LicenseKeyGroupEntityDto(); + MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto mapper = + new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); + Set param = new HashSet<>(Collections.singletonList("c7797917-7548-44c2-93b9-cf72f27bca3f")); + source.setReferencingFeatureGroups(param); + mapper.doMapping(source, target); + assertEquals(target.getReferencingFeatureGroups(), param); + } + + @Test + public void testDescription() { + LicenseKeyGroupEntity source = new LicenseKeyGroupEntity(); + LicenseKeyGroupEntityDto target = new LicenseKeyGroupEntityDto(); + MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto mapper = + new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); + String param = "f026c265-d91f-4c47-8f3b-2600be5023dc"; + source.setDescription(param); + mapper.doMapping(source, target); + assertEquals(target.getDescription(), param); + } + + @Test + public void testType() { + LicenseKeyGroupEntity source = new LicenseKeyGroupEntity(); + LicenseKeyGroupEntityDto target = new LicenseKeyGroupEntityDto(); + MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto mapper = + new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); + LicenseKeyType licenseKeyType = LicenseKeyType.Universal; + source.setType(licenseKeyType); + mapper.doMapping(source, target); + assertEquals(target.getType(), licenseKeyType); + } + + @Test + public void testIncrements() { + LicenseKeyGroupEntity source = new LicenseKeyGroupEntity(); + LicenseKeyGroupEntityDto target = new LicenseKeyGroupEntityDto(); + MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto mapper = + new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); + String param = "813639e7-45d6-4443-8a7c-a955d34a931a"; + source.setIncrements(param); + mapper.doMapping(source, target); + assertEquals(target.getIncrements(), param); + } + + @Test + public void testExpiryDate() { + LicenseKeyGroupEntity source = new LicenseKeyGroupEntity(); + LicenseKeyGroupEntityDto target = new LicenseKeyGroupEntityDto(); + MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto mapper = + new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); + String param = "d7925c8e-239f-44a3-9b24-67ddbd9467c2"; + source.setExpiryDate(param); + mapper.doMapping(source, target); + assertEquals(target.getExpiryDate(), param); + } + + @Test + public void testId() { + LicenseKeyGroupEntity source = new LicenseKeyGroupEntity(); + LicenseKeyGroupEntityDto target = new LicenseKeyGroupEntityDto(); + MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto mapper = + new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); + String param = "b2f35aa5-0240-46b7-bade-35890d46e9f9"; + source.setId(param); + mapper.doMapping(source, target); + assertEquals(target.getId(), param); + } + + @Test + public void testThresholdUnits() { + LicenseKeyGroupEntity source = new LicenseKeyGroupEntity(); + LicenseKeyGroupEntityDto target = new LicenseKeyGroupEntityDto(); + MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto mapper = + new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); + ThresholdUnit thresholdUnit = ThresholdUnit.Absolute; + source.setThresholdUnits(thresholdUnit); + mapper.doMapping(source, target); + assertEquals(target.getThresholdUnits(), thresholdUnit); + } + + @Test + public void testThresholdValue() { + LicenseKeyGroupEntity source = new LicenseKeyGroupEntity(); + LicenseKeyGroupEntityDto target = new LicenseKeyGroupEntityDto(); + MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto mapper = + new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); + Integer param = 1144092791; + source.setThresholdValue(param); + mapper.doMapping(source, target); + assertEquals(target.getThresholdValue(), param); + } + + @Test + public void testName() { + LicenseKeyGroupEntity source = new LicenseKeyGroupEntity(); + LicenseKeyGroupEntityDto target = new LicenseKeyGroupEntityDto(); + MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto mapper = + new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); + String param = "8fb07080-e7ea-4543-812c-1ecdbb9e82c9"; + source.setName(param); + mapper.doMapping(source, target); + assertEquals(target.getName(), param); + } + + @Test + public void testOperationalScope() { + LicenseKeyGroupEntity source = new LicenseKeyGroupEntity(); + LicenseKeyGroupEntityDto target = new LicenseKeyGroupEntityDto(); + MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto mapper = + new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); + MultiChoiceOrOther operationalScopeMultiChoiceOrOther = new MultiChoiceOrOther<>(); + Set set = new HashSet<>(); + set.add(TestEnum.Yes); + operationalScopeMultiChoiceOrOther.setChoices(set); + source.setOperationalScope(operationalScopeMultiChoiceOrOther); + mapper.doMapping(source, target); + assertEquals(target.getOperationalScope().getChoices(), operationalScopeMultiChoiceOrOther.getChoices()); + } + + @Test + public void testStartDate() { + LicenseKeyGroupEntity source = new LicenseKeyGroupEntity(); + LicenseKeyGroupEntityDto target = new LicenseKeyGroupEntityDto(); + MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto mapper = + new MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDto(); + String param = "75f2ae76-b32f-4ac1-92f6-a9d92cb41160"; + source.setStartDate(param); + mapper.doMapping(source, target); + assertEquals(target.getStartDate(), param); + } + + enum TestEnum { + Yes + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.java new file mode 100644 index 0000000000..8d0769ae05 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.java @@ -0,0 +1,140 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import static org.testng.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType; +import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; +import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; +import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupRequestDto; +import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; + + +public class MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest { + + + @Test + public void testExpiryDate() { + LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto(); + LicenseKeyGroupEntity target = new LicenseKeyGroupEntity(); + MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper = + new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity(); + String param = "77d85090-e40d-49d0-ae18-b6aff51728e3"; + source.setExpiryDate(param); + mapper.doMapping(source, target); + assertEquals(target.getExpiryDate(), param); + } + + @Test + public void testThresholdUnits() { + LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto(); + LicenseKeyGroupEntity target = new LicenseKeyGroupEntity(); + MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper = + new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity(); + ThresholdUnit thresholdUnit = ThresholdUnit.Absolute; + source.setThresholdUnits(thresholdUnit); + mapper.doMapping(source, target); + assertEquals(target.getThresholdUnits(), thresholdUnit); + } + + @Test + public void testName() { + LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto(); + LicenseKeyGroupEntity target = new LicenseKeyGroupEntity(); + MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper = + new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity(); + String param = "74ee9b26-9a6c-48a4-b3ec-f9a0fe174bc9"; + source.setName(param); + mapper.doMapping(source, target); + assertEquals(target.getName(), param); + } + + @Test + public void testDescription() { + LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto(); + LicenseKeyGroupEntity target = new LicenseKeyGroupEntity(); + MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper = + new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity(); + String param = "a7aaa0f0-bd68-41b0-a27e-d4e62b1bd6e5"; + source.setDescription(param); + mapper.doMapping(source, target); + assertEquals(target.getDescription(), param); + } + + @Test + public void testThresholdValue() { + LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto(); + LicenseKeyGroupEntity target = new LicenseKeyGroupEntity(); + MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper = + new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity(); + Integer param = -2136417915; + source.setThresholdValue(param); + mapper.doMapping(source, target); + assertEquals(target.getThresholdValue(), param); + } + + @Test + public void testType() { + LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto(); + LicenseKeyGroupEntity target = new LicenseKeyGroupEntity(); + MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper = + new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity(); + LicenseKeyType licenseKeyType = LicenseKeyType.Unique; + source.setType(licenseKeyType); + mapper.doMapping(source, target); + assertEquals(target.getType(), licenseKeyType); + } + + @Test + public void testIncrements() { + LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto(); + LicenseKeyGroupEntity target = new LicenseKeyGroupEntity(); + MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper = + new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity(); + String param = "97f20c3a-6f3a-42cf-aa1a-870ba436bde6"; + source.setIncrements(param); + mapper.doMapping(source, target); + assertEquals(target.getIncrements(), param); + } + + @Test + public void testOperationalScope() { + LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto(); + LicenseKeyGroupEntity target = new LicenseKeyGroupEntity(); + MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper = + new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity(); + MultiChoiceOrOtherDto operationalScopeMultiChoiceOrOtherDto = new MultiChoiceOrOtherDto<>(); + source.setOperationalScope(operationalScopeMultiChoiceOrOtherDto); + mapper.doMapping(source, target); + assertEquals(target.getOperationalScope().getChoices(), operationalScopeMultiChoiceOrOtherDto.getChoices()); + } + + @Test + public void testStartDate() { + LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto(); + LicenseKeyGroupEntity target = new LicenseKeyGroupEntity(); + MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper = + new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity(); + String param = "9aa18de7-ca80-4690-b604-2e0994424f2d"; + source.setStartDate(param); + mapper.doMapping(source, target); + assertEquals(target.getStartDate(), param); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDtoTest.java new file mode 100644 index 0000000000..1ca1c5b9e9 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDtoTest.java @@ -0,0 +1,128 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import static org.testng.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction; +import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LimitType; +import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto; + + +public class MapLimitEntityToLimitDtoTest { + + @Test + public void testDescription() { + LimitEntity source = new LimitEntity(); + LimitEntityDto target = new LimitEntityDto(); + MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto(); + String param = "7315b1fa-f797-438a-b0d1-8b652899ecec"; + source.setDescription(param); + mapper.doMapping(source, target); + assertEquals(target.getDescription(), param); + } + + @Test + public void testAggregationFunction() { + LimitEntity source = new LimitEntity(); + LimitEntityDto target = new LimitEntityDto(); + MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto(); + AggregationFunction aggregationFunction = AggregationFunction.Average; + source.setAggregationFunction(aggregationFunction); + mapper.doMapping(source, target); + assertEquals(target.getAggregationFunction(), aggregationFunction.toString()); + } + + @Test + public void testType() { + LimitEntity source = new LimitEntity(); + LimitEntityDto target = new LimitEntityDto(); + MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto(); + LimitType limitType = LimitType.Vendor; + source.setType(limitType); + mapper.doMapping(source, target); + assertEquals(target.getType(), limitType.toString()); + } + + @Test + public void testUnit() { + LimitEntity source = new LimitEntity(); + LimitEntityDto target = new LimitEntityDto(); + MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto(); + String param = "94ab5e65-f777-49b7-9328-14af712a3767"; + source.setUnit(param); + mapper.doMapping(source, target); + assertEquals(target.getUnit(), param); + } + + @Test + public void testMetric() { + LimitEntity source = new LimitEntity(); + LimitEntityDto target = new LimitEntityDto(); + MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto(); + String param = "1fb615b9-8108-485d-83c9-5dbfb14cf953"; + source.setMetric(param); + mapper.doMapping(source, target); + assertEquals(target.getMetric(), param); + } + + @Test + public void testName() { + LimitEntity source = new LimitEntity(); + LimitEntityDto target = new LimitEntityDto(); + MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto(); + String param = "ab5d6967-0020-4cd2-aeba-ff3e39e52385"; + source.setName(param); + mapper.doMapping(source, target); + assertEquals(target.getName(), param); + } + + @Test + public void testId() { + LimitEntity source = new LimitEntity(); + LimitEntityDto target = new LimitEntityDto(); + MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto(); + String param = "52d4d919-015a-4a46-af04-4d0dec17e88d"; + source.setId(param); + mapper.doMapping(source, target); + assertEquals(target.getId(), param); + } + + @Test + public void testTime() { + LimitEntity source = new LimitEntity(); + LimitEntityDto target = new LimitEntityDto(); + MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto(); + String param = "4e19d619-5004-423c-abf2-0d6e69a47a5c"; + source.setTime(param); + mapper.doMapping(source, target); + assertEquals(target.getTime(), param); + } + + @Test + public void testValue() { + LimitEntity source = new LimitEntity(); + LimitEntityDto target = new LimitEntityDto(); + MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto(); + String param = "13d67707-b02f-40b2-8b19-60fd6405a7af"; + source.setValue(param); + mapper.doMapping(source, target); + assertEquals(target.getValue(), param); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherDtoToMultiChoiceOrOtherTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherDtoToMultiChoiceOrOtherTest.java new file mode 100644 index 0000000000..155201eb6f --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherDtoToMultiChoiceOrOtherTest.java @@ -0,0 +1,57 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import static org.testng.Assert.assertEquals; + +import java.util.HashSet; +import java.util.Set; +import org.junit.Test; +import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; +import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; + + +public class MapMultiChoiceOrOtherDtoToMultiChoiceOrOtherTest { + + @Test + public void testChoices() { + MultiChoiceOrOtherDto source = new MultiChoiceOrOtherDto(); + MultiChoiceOrOther target = new MultiChoiceOrOther(); + MapMultiChoiceOrOtherDtoToMultiChoiceOrOther mapper = new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther(); + Set set = new HashSet(); + set.add(TestEnum.Yes); + set.add(TestEnum.No); + source.setChoices(set); + mapper.doMapping(source, target); + assertEquals(target.getChoices(), set); + } + + @Test + public void testOther() { + MultiChoiceOrOtherDto source = new MultiChoiceOrOtherDto(); + MultiChoiceOrOther target = new MultiChoiceOrOther(); + MapMultiChoiceOrOtherDtoToMultiChoiceOrOther mapper = new MapMultiChoiceOrOtherDtoToMultiChoiceOrOther(); + String param = "930a30ce-72a5-43e3-b845-807a3e34228f"; + source.setOther(param); + mapper.doMapping(source, target); + assertEquals(target.getOther(), param); + } + + enum TestEnum { + Yes, No + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherToMultiChoiceOrOtherDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherToMultiChoiceOrOtherDtoTest.java new file mode 100644 index 0000000000..1107d1be62 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherToMultiChoiceOrOtherDtoTest.java @@ -0,0 +1,54 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import static org.testng.Assert.assertEquals; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import org.junit.Test; +import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; +import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; + + +public class MapMultiChoiceOrOtherToMultiChoiceOrOtherDtoTest { + + @Test + public void testOther() { + MultiChoiceOrOther source = new MultiChoiceOrOther(); + MultiChoiceOrOtherDto target = new MultiChoiceOrOtherDto(); + MapMultiChoiceOrOtherToMultiChoiceOrOtherDto mapper = new MapMultiChoiceOrOtherToMultiChoiceOrOtherDto(); + String param = "32a675f1-c1ab-4d15-a6f4-9c1a07d6ce60"; + source.setOther(param); + mapper.doMapping(source, target); + assertEquals(target.getOther(), param); + } + + @Test + public void testChoices() { + MultiChoiceOrOther source = new MultiChoiceOrOther(); + MultiChoiceOrOtherDto target = new MultiChoiceOrOtherDto(); + MapMultiChoiceOrOtherToMultiChoiceOrOtherDto mapper = new MapMultiChoiceOrOtherToMultiChoiceOrOtherDto(); + mapper.doMapping(source, target); + assertEquals(target.getChoices(), source.getChoices()); + Set param = new HashSet<>(Collections.singletonList("ed6f5011-d9ef-4f27-8b10-ab8142296a9b")); + source.setChoices(param); + mapper.doMapping(source, target); + assertEquals(target.getChoices(), param); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelEntityToDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelEntityToDtoTest.java new file mode 100644 index 0000000000..498e4354db --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelEntityToDtoTest.java @@ -0,0 +1,71 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import static org.testng.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; +import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto; + + +public class MapVendorLicenseModelEntityToDtoTest { + + @Test + public void testIconRef() { + VendorLicenseModelEntity source = new VendorLicenseModelEntity(); + VendorLicenseModelEntityDto target = new VendorLicenseModelEntityDto(); + MapVendorLicenseModelEntityToDto mapper = new MapVendorLicenseModelEntityToDto(); + String param = "3d3aed28-341a-490e-94b0-c7d4a520b64a"; + source.setIconRef(param); + mapper.doMapping(source, target); + assertEquals(target.getIconRef(), param); + } + + @Test + public void testDescription() { + VendorLicenseModelEntity source = new VendorLicenseModelEntity(); + VendorLicenseModelEntityDto target = new VendorLicenseModelEntityDto(); + MapVendorLicenseModelEntityToDto mapper = new MapVendorLicenseModelEntityToDto(); + String param = "68dc3641-94ad-4109-8082-62037720739b"; + source.setDescription(param); + mapper.doMapping(source, target); + assertEquals(target.getDescription(), param); + } + + @Test + public void testId() { + VendorLicenseModelEntity source = new VendorLicenseModelEntity(); + VendorLicenseModelEntityDto target = new VendorLicenseModelEntityDto(); + MapVendorLicenseModelEntityToDto mapper = new MapVendorLicenseModelEntityToDto(); + String param = "019b68df-92d9-40a6-a5b0-951d64838ce9"; + source.setId(param); + mapper.doMapping(source, target); + assertEquals(target.getId(), param); + } + + @Test + public void testVendorName() { + VendorLicenseModelEntity source = new VendorLicenseModelEntity(); + VendorLicenseModelEntityDto target = new VendorLicenseModelEntityDto(); + MapVendorLicenseModelEntityToDto mapper = new MapVendorLicenseModelEntityToDto(); + String param = "99319b1a-5cea-459d-aff6-7a4be4f318c0"; + source.setVendorName(param); + mapper.doMapping(source, target); + assertEquals(target.getVendorName(), param); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntityTest.java new file mode 100644 index 0000000000..34eca9658f --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntityTest.java @@ -0,0 +1,63 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openecomp.sdcrests.vendorlicense.rest.mapping; + +import static org.testng.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; +import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelRequestDto; + + +public class MapVendorLicenseModelRequestDtoToVendorLicenseModelEntityTest { + + @Test + public void testDescription() { + VendorLicenseModelRequestDto source = new VendorLicenseModelRequestDto(); + VendorLicenseModelEntity target = new VendorLicenseModelEntity(); + MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity mapper = + new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity(); + String param = "b77cbdda-ad74-49df-81e6-60438f5f5ff5"; + source.setDescription(param); + mapper.doMapping(source, target); + assertEquals(target.getDescription(), param); + } + + @Test + public void testVendorName() { + VendorLicenseModelRequestDto source = new VendorLicenseModelRequestDto(); + VendorLicenseModelEntity target = new VendorLicenseModelEntity(); + MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity mapper = + new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity(); + String param = "e0559039-599b-447c-a859-fec2cc26e08d"; + source.setVendorName(param); + mapper.doMapping(source, target); + assertEquals(target.getVendorName(), param); + } + + @Test + public void testIconRef() { + VendorLicenseModelRequestDto source = new VendorLicenseModelRequestDto(); + VendorLicenseModelEntity target = new VendorLicenseModelEntity(); + MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity mapper = + new MapVendorLicenseModelRequestDtoToVendorLicenseModelEntity(); + String param = "e79f4e78-ff71-4033-a8d8-3b86d08c9366"; + source.setIconRef(param); + mapper.doMapping(source, target); + assertEquals(target.getIconRef(), param); + } +} -- cgit 1.2.3-korg