diff options
author | vempo <vitaliy.emporopulo@amdocs.com> | 2018-11-17 21:10:53 +0200 |
---|---|---|
committer | Oren Kleks <orenkle@amdocs.com> | 2018-11-18 07:10:13 +0000 |
commit | 91f0a9df3d688f3a7508c9088c8410872e22428e (patch) | |
tree | b5b0b58d372d16178aff729b22b361a0c1787f33 /openecomp-be/api/openecomp-sdc-rest-webapp | |
parent | cc628e4c8258820e2fb0a47acdcc47c15a2b71bd (diff) |
Unit-tests for mappers in VSP library
Change-Id: Ibbe2e9c4ee85a7fe77b2b68e21d2266010f4fa62
Issue-ID: SDC-1917
Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp')
28 files changed, 1511 insertions, 43 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml index b6142e8fe4..26a7c15ff2 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml @@ -18,51 +18,56 @@ <artifactId>junit</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - <version>${spring.framework.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>${spring.framework.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context-support</artifactId> - <version>${spring.framework.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - <version>${spring.framework.version}</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-beans</artifactId> - <version>${spring.framework.version}</version> - </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${spring.framework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.framework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context-support</artifactId> + <version>${spring.framework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>${spring.framework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + <version>${spring.framework.version}</version> + </dependency> - <!-- CXF --> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-frontend-jaxrs</artifactId> - <version>${cxf.version}</version> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>${http.client.version}</version> - </dependency> + <!-- CXF --> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-frontend-jaxrs</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>${http.client.version}</version> + </dependency> - <!-- Java Stuff --> - <dependency> - <groupId>javax.inject</groupId> - <artifactId>javax.inject</artifactId> - <version>${javax.inject.version}</version> - <scope>provided</scope> - </dependency> + <!-- Java Stuff --> + <dependency> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> + <version>${javax.inject.version}</version> + <scope>provided</scope> + </dependency> <dependency> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentRequestDtoToComponentEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentRequestDtoToComponentEntityTest.java new file mode 100644 index 0000000000..d1ef411fd6 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentRequestDtoToComponentEntityTest.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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentRequestDto; + +/** + * This class was generated. + */ +public class MapComponentRequestDtoToComponentEntityTest { + + @Test + public void testConversion() { + + final ComponentRequestDto source = new ComponentRequestDto(); + + final String name = "a4bea41c-d14a-4249-841a-31668485ced7"; + source.setName(name); + + final String description = "1ec317d3-58e7-47ef-9c9c-00afa0a5414d"; + source.setDescription(description); + + final String displayName = "356f3c57-4531-4e22-a988-bfc8571d3c91"; + source.setDisplayName(displayName); + + final ComponentEntity target = new ComponentEntity(); + final MapComponentRequestDtoToComponentEntity mapper = new MapComponentRequestDtoToComponentEntity(); + mapper.doMapping(source, target); + ComponentData componentCompositionData = target.getComponentCompositionData(); + + assertEquals(name, componentCompositionData.getName()); + assertEquals(description, componentCompositionData.getDescription()); + assertEquals(displayName, componentCompositionData.getDisplayName()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapDeploymentFlavorRequestDtoToDeploymentFlavorEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapDeploymentFlavorRequestDtoToDeploymentFlavorEntityTest.java new file mode 100644 index 0000000000..9414bb5bba --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapDeploymentFlavorRequestDtoToDeploymentFlavorEntityTest.java @@ -0,0 +1,61 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import java.util.Collections; +import java.util.List; +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentComputeAssociation; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.DeploymentFlavorRequestDto; + +/** + * This class was generated. + */ +public class MapDeploymentFlavorRequestDtoToDeploymentFlavorEntityTest { + + @Test() + public void testConversion() { + + final DeploymentFlavorRequestDto source = new DeploymentFlavorRequestDto(); + + final String model = "a4bea41c-d14a-4249-841a-31668485ced7"; + source.setModel(model); + + final String description = "1ec317d3-58e7-47ef-9c9c-00afa0a5414d"; + source.setDescription(description); + + final String featureGroupId = "356f3c57-4531-4e22-a988-bfc8571d3c91"; + source.setFeatureGroupId(featureGroupId); + + final List<ComponentComputeAssociation> componentComputeAssociations = Collections.emptyList(); + source.setComponentComputeAssociations(componentComputeAssociations); + + final DeploymentFlavorEntity target = new DeploymentFlavorEntity(); + final MapDeploymentFlavorRequestDtoToDeploymentFlavorEntity mapper = new MapDeploymentFlavorRequestDtoToDeploymentFlavorEntity(); + mapper.doMapping(source, target); + + DeploymentFlavor deploymentFlavor = target.getDeploymentFlavorCompositionData(); + assertEquals(model, deploymentFlavor.getModel()); + assertEquals(description, deploymentFlavor.getDescription()); + assertEquals(featureGroupId, deploymentFlavor.getFeatureGroupId()); + assertEquals(componentComputeAssociations, deploymentFlavor.getComponentComputeAssociations()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapFilesDataStructureToDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapFilesDataStructureToDtoTest.java new file mode 100644 index 0000000000..905c405bbe --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapFilesDataStructureToDtoTest.java @@ -0,0 +1,60 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertSame; + +import java.util.Collections; +import java.util.List; +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure; +import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.Module; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.FileDataStructureDto; + +/** + * This class was generated. + */ +public class MapFilesDataStructureToDtoTest { + + @Test() + public void testConversion() { + + final FilesDataStructure source = new FilesDataStructure(); + + final List<Module> modules = Collections.emptyList(); + source.setModules(modules); + + final List<String> unassigned = Collections.emptyList(); + source.setUnassigned(unassigned); + + final List<String> artifacts = Collections.emptyList(); + source.setArtifacts(artifacts); + + final List<String> nested = Collections.emptyList(); + source.setNested(nested); + + final FileDataStructureDto target = new FileDataStructureDto(); + + final MapFilesDataStructureToDto mapper = new MapFilesDataStructureToDto(); + mapper.doMapping(source, target); + + assertSame(modules, target.getModules()); + assertSame(unassigned, target.getUnassigned()); + assertSame(artifacts, target.getArtifacts()); + assertSame(nested, target.getNested()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageDataToImageDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageDataToImageDtoTest.java new file mode 100644 index 0000000000..01c1f208af --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageDataToImageDtoTest.java @@ -0,0 +1,48 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ImageData; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageDto; + +/** + * This class was generated. + */ +public class MapImageDataToImageDtoTest { + + @Test() + public void testConversion() { + + final ImageData source = new ImageData(); + + final String fileName = "4a71a5bf-bfee-4060-8d43-4f90215b5ce7"; + source.setFileName(fileName); + + final String description = "759ff9e4-cc83-4b66-b507-556d98c081e6"; + source.setDescription(description); + + final ImageDto target = new ImageDto(); + final MapImageDataToImageDto mapper = new MapImageDataToImageDto(); + mapper.doMapping(source, target); + + assertEquals(fileName, target.getFileName()); + assertEquals(description, target.getDescription()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageEntityToImageCreationDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageEntityToImageCreationDtoTest.java new file mode 100644 index 0000000000..d9344e6d35 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageEntityToImageCreationDtoTest.java @@ -0,0 +1,44 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageCreationDto; + +/** + * This class was generated. + */ +public class MapImageEntityToImageCreationDtoTest { + + @Test() + public void testConversion() { + + final ImageEntity source = new ImageEntity(); + + final String id = "8461aa16-39aa-4ecf-aed6-b41e8ebc47d2"; + source.setId(id); + + final ImageCreationDto target = new ImageCreationDto(); + final MapImageEntityToImageCreationDto mapper = new MapImageEntityToImageCreationDto(); + mapper.doMapping(source, target); + + assertEquals(id, target.getId()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageEntityToImageDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageEntityToImageDtoTest.java new file mode 100644 index 0000000000..8fc7b4a1b5 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageEntityToImageDtoTest.java @@ -0,0 +1,44 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageDto; + +/** + * This class was generated. + */ +public class MapImageEntityToImageDtoTest { + + @Test() + public void testConversion() { + + final ImageEntity source = new ImageEntity(); + + final String id = "11a950b3-e6d8-4bf9-b63c-4f7aea28639f"; + source.setId(id); + + final ImageDto target = new ImageDto(); + final MapImageEntityToImageDto mapper = new MapImageEntityToImageDto(); + mapper.doMapping(source, target); + + assertEquals(id, target.getId()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageRequestDtoToImageEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageRequestDtoToImageEntityTest.java new file mode 100644 index 0000000000..430e249d66 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapImageRequestDtoToImageEntityTest.java @@ -0,0 +1,50 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ImageRequestDto; + +/** + * This class was generated. + */ +public class MapImageRequestDtoToImageEntityTest { + + @Test() + public void testConversion() { + + final ImageRequestDto source = new ImageRequestDto(); + + final String fileName = "e32b7688-972e-4c99-8343-9c21fbbb5261"; + source.setFileName(fileName); + + final String description = "5be79c85-3fec-4a5e-b757-846203f4ea09"; + source.setDescription(description); + + final ImageEntity target = new ImageEntity(); + final MapImageRequestDtoToImageEntity mapper = new MapImageRequestDtoToImageEntity(); + mapper.doMapping(source, target); + + Image image = target.getImageCompositionData(); + assertEquals(fileName, image.getFileName()); + assertEquals(description, image.getDescription()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapItemToVspDetailsDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapItemToVspDetailsDtoTest.java new file mode 100644 index 0000000000..569e4a812b --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapItemToVspDetailsDtoTest.java @@ -0,0 +1,61 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.versioning.types.Item; +import org.openecomp.sdc.versioning.types.ItemStatus; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto; + +/** + * This class was generated. + */ +public class MapItemToVspDetailsDtoTest { + + @Test() + public void testConversion() { + + final Item source = new Item(); + + final String id = "1377a613-7f39-43f7-a930-bec3156dcc51"; + source.setId(id); + + final String name = "5a4e8b51-f661-4a47-a920-378aac80aad3"; + source.setName(name); + + final String owner = "021fe90b-e51c-4683-bc0d-9d2456a07896"; + source.setOwner(owner); + + final ItemStatus status = ItemStatus.ACTIVE; + source.setStatus(status); + + final String description = "7514fb1a-2f2b-4d44-a7ab-971813ee8413"; + source.setDescription(description); + + final VspDetailsDto target = new VspDetailsDto(); + final MapItemToVspDetailsDto mapper = new MapItemToVspDetailsDto(); + mapper.doMapping(source, target); + + assertEquals(id, target.getId()); + assertEquals(name, target.getName()); + assertEquals(owner, target.getOwner()); + assertEquals(status.name(), target.getStatus()); + assertEquals(description, target.getDescription()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapMonitoringUploadStatusToDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapMonitoringUploadStatusToDtoTest.java new file mode 100644 index 0000000000..2e9b835d0e --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapMonitoringUploadStatusToDtoTest.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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MonitoringUploadStatus; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.MonitoringUploadStatusDto; + +/** + * This class was generated. + */ +public class MapMonitoringUploadStatusToDtoTest { + + @Test() + public void testConversion() { + + final MonitoringUploadStatus source = new MonitoringUploadStatus(); + + final String snmpTrap = "15fc54f6-e719-4da0-9a57-da9926994566"; + source.setSnmpTrap(snmpTrap); + + final String snmpPoll = "808c78c4-4463-42c3-93b5-0169cc60b59d"; + source.setSnmpPoll(snmpPoll); + + final String vesEvent = "3ad7d4cf-2aed-47ef-a6d0-3ba5753fda7b"; + source.setVesEvent(vesEvent); + + final MonitoringUploadStatusDto target = new MonitoringUploadStatusDto(); + final MapMonitoringUploadStatusToDto mapper = new MapMonitoringUploadStatusToDto(); + mapper.doMapping(source, target); + + assertEquals(snmpTrap, target.getSnmpTrap()); + assertEquals(snmpPoll, target.getSnmpPoll()); + assertEquals(vesEvent, target.getVesEvent()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkEntityToNetworkDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkEntityToNetworkDtoTest.java new file mode 100644 index 0000000000..5babd1fba4 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkEntityToNetworkDtoTest.java @@ -0,0 +1,43 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkDto; + +/** + * This class was generated. + */ +public class MapNetworkEntityToNetworkDtoTest { + + @Test() + public void testConversion() { + + final NetworkEntity source = new NetworkEntity(); + final String id = "cd2c50b6-a8d2-449b-b3ab-337679b38c83"; + source.setId(id); + + final NetworkDto target = new NetworkDto(); + final MapNetworkEntityToNetworkDto mapper = new MapNetworkEntityToNetworkDto(); + mapper.doMapping(source, target); + + assertEquals(id, target.getId()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkRequestDtoToNetworkEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkRequestDtoToNetworkEntityTest.java new file mode 100644 index 0000000000..8c3e5d7a1b --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkRequestDtoToNetworkEntityTest.java @@ -0,0 +1,50 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkRequestDto; + +/** + * This class was generated. + */ +public class MapNetworkRequestDtoToNetworkEntityTest { + + @Test() + public void testConversion() { + + final NetworkRequestDto source = new NetworkRequestDto(); + + final String name = "a15dd471-62cf-4702-841b-bd14865f646f"; + source.setName(name); + + final boolean dhcp = true; + source.setDhcp(dhcp); + + final NetworkEntity target = new NetworkEntity(); + final MapNetworkRequestDtoToNetworkEntity mapper = new MapNetworkRequestDtoToNetworkEntity(); + mapper.doMapping(source, target); + + Network network = target.getNetworkCompositionData(); + assertEquals(name, network.getName()); + assertEquals(dhcp, network.isDhcp()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkToNetworkDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkToNetworkDtoTest.java new file mode 100644 index 0000000000..363c0e4a57 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNetworkToNetworkDtoTest.java @@ -0,0 +1,48 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.NetworkDto; + +/** + * This class was generated. + */ +public class MapNetworkToNetworkDtoTest { + + @Test() + public void testConversion() { + + final Network source = new Network(); + + final String name = "32b4cb6a-4d67-499e-aaa0-1965cc4bd057"; + source.setName(name); + + final boolean dhcp = false; + source.setDhcp(dhcp); + + final NetworkDto target = new NetworkDto(); + final MapNetworkToNetworkDto mapper = new MapNetworkToNetworkDto(); + mapper.doMapping(source, target); + + assertEquals(name, target.getName()); + assertEquals(dhcp, target.isDhcp()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicEntityToNicCreationResponseDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicEntityToNicCreationResponseDtoTest.java new file mode 100644 index 0000000000..54e9f60123 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicEntityToNicCreationResponseDtoTest.java @@ -0,0 +1,43 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicCreationResponseDto; + +/** + * This class was generated. + */ +public class MapNicEntityToNicCreationResponseDtoTest { + + @Test() + public void testConversion() { + + final NicEntity source = new NicEntity(); + final String nicId = "2fc02984-1199-4502-affb-dbbbe6a4c2e6"; + source.setId(nicId); + + final NicCreationResponseDto target = new NicCreationResponseDto(); + final MapNicEntityToNicCreationResponseDto mapper = new MapNicEntityToNicCreationResponseDto(); + mapper.doMapping(source, target); + + assertEquals(nicId, target.getNicId()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicEntityToNicDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicEntityToNicDtoTest.java new file mode 100644 index 0000000000..6c87c19494 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicEntityToNicDtoTest.java @@ -0,0 +1,44 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicDto; + +/** + * This class was generated. + */ +public class MapNicEntityToNicDtoTest { + + @Test() + public void testConversion() { + + final NicEntity source = new NicEntity(); + + final String id = "6798b60a-f6fa-4e46-aead-4edc7eb2d405"; + source.setId(id); + + final NicDto target = new NicDto(); + final MapNicEntityToNicDto mapper = new MapNicEntityToNicDto(); + mapper.doMapping(source, target); + + assertEquals(id, target.getId()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicRequestDtoToNicEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicRequestDtoToNicEntityTest.java new file mode 100644 index 0000000000..595913b887 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicRequestDtoToNicEntityTest.java @@ -0,0 +1,62 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.NetworkType; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicRequestDto; + +/** + * This class was generated. + */ +public class MapNicRequestDtoToNicEntityTest { + + @Test() + public void testConversion() { + + final NicRequestDto source = new NicRequestDto(); + final String name = "a15dd471-bd14865f646f"; + source.setName(name); + + final String description = "bf3b2713-0248c69a0da3"; + source.setDescription(description); + + final String networkId = "c381c91c-3f15170693b9"; + source.setNetworkId(networkId); + + final NetworkType networkType = NetworkType.Internal; + source.setNetworkType(networkType.name()); + + final String networkDescription = "0fa4629d-0d6353b49857"; + source.setNetworkDescription(networkDescription); + + final NicEntity target = new NicEntity(); + final MapNicRequestDtoToNicEntity mapper = new MapNicRequestDtoToNicEntity(); + mapper.doMapping(source, target); + + Nic nicCompositionData = target.getNicCompositionData(); + assertEquals(name, nicCompositionData.getName()); + assertEquals(description, nicCompositionData.getDescription()); + assertEquals(networkId, nicCompositionData.getNetworkId()); + assertEquals(networkType, nicCompositionData.getNetworkType()); + assertEquals(networkDescription, nicCompositionData.getNetworkDescription()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicToNicDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicToNicDtoTest.java new file mode 100644 index 0000000000..9004ee4c13 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapNicToNicDtoTest.java @@ -0,0 +1,60 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.NicDto; + +/** + * This class was generated. + */ +public class MapNicToNicDtoTest { + + @Test() + public void testConversion() { + + final Nic source = new Nic(); + + final String name = "a15dd471-62cf-4702-841b-bd14865f646f"; + source.setName(name); + + final String description = "bf3b2713-5f3d-40f9-abf1-0248c69a0da3"; + source.setDescription(description); + + final String networkId = "c381c91c-d872-4a95-8f63-3f15170693b9"; + source.setNetworkId(networkId); + + final String networkName = "58efd7dd-3142-4fbe-8a67-ac136057c177"; + source.setNetworkName(networkName); + + final String networkDescription = "0fa4629d-bdd1-407e-b12c-0d6353b49857"; + source.setNetworkDescription(networkDescription); + + final NicDto target = new NicDto(); + final MapNicToNicDto mapper = new MapNicToNicDto(); + mapper.doMapping(source, target); + + assertEquals(name, target.getName()); + assertEquals(description, target.getDescription()); + assertEquals(networkId, target.getNetworkId()); + assertEquals(networkName, target.getNetworkName()); + assertEquals(networkDescription, target.getNetworkDescription()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDtoTest.java new file mode 100644 index 0000000000..b85b87c6ca --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapPackageInfoToPackageInfoDtoTest.java @@ -0,0 +1,80 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.PackageInfoDto; + +/** + * This class was generated. + */ +public class MapPackageInfoToPackageInfoDtoTest { + + @Test() + public void testConversion() { + + final PackageInfo source = new PackageInfo(); + + final String version = "5e20ad09-38c1-4230-bb53-c5b4faa26ced"; + source.setVersion(version); + + final String vspName = "4a0b3575-807f-4aa3-b142-3880374fe974"; + source.setVspName(vspName); + + final String description = "6798b60a-f6fa-4e46-aead-4edc7eb2d405"; + source.setVspDescription(description); + + final String packageId = "c381c91c-d872-4a95-8f63-3f15170693b9"; + source.setVspId(packageId); + + final String vendorName = "416c7ffa-f595-4459-8d5c-9f57a6ac5234"; + source.setVendorName(vendorName); + + final String category = "7a07b1e1-2e6d-43af-8ddc-1807dfa8acf2"; + source.setCategory(category); + + final String subCategory = "b2efb540-86af-4949-873c-6a77a7dcc92b"; + source.setSubCategory(subCategory); + + final String vendorRelease = "070bb92c-91c7-4ecb-87c3-7497d55eb9b3"; + source.setVendorRelease(vendorRelease); + + final String packageChecksum = "d691b1cc-91fd-4645-a46f-483000aeaf06"; + source.setPackageChecksum(packageChecksum); + + final String packageType = "a158c2f9-5970-40cd-9e7f-efa4be050c59"; + source.setPackageType(packageType); + + final PackageInfoDto target = new PackageInfoDto(); + final MapPackageInfoToPackageInfoDto mapper = new MapPackageInfoToPackageInfoDto(); + mapper.doMapping(source, target); + + assertEquals(description, target.getDescription()); + assertEquals(vspName, target.getVspName()); + assertEquals(version, target.getVersion()); + assertEquals(packageId, target.getPackageId()); + assertEquals(category, target.getCategory()); + assertEquals(subCategory, target.getSubCategory()); + assertEquals(vendorName, target.getVendorName()); + assertEquals(vendorRelease, target.getVendorRelease()); + assertEquals(packageChecksum, target.getPackageChecksum()); + assertEquals(packageType, target.getPackageType()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapProcessEntityToProcessEntityDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapProcessEntityToProcessEntityDtoTest.java new file mode 100644 index 0000000000..d5382f18e4 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapProcessEntityToProcessEntityDtoTest.java @@ -0,0 +1,60 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessType; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessEntityDto; + +/** + * This class was generated. + */ +public class MapProcessEntityToProcessEntityDtoTest { + + @Test() + public void testConversion() { + final ProcessEntity source = new ProcessEntity(); + + final String id = "0ac97ed6-b35e-4568-80c2-71b5db9e3261"; + source.setId(id); + + final String name = "c449c97f-330d-4864-aa7b-a4569520f880"; + source.setName(name); + + final String description = "11040b64-24eb-4fca-b1d8-373a3727d535"; + source.setDescription(description); + + final ProcessType type = ProcessType.Lifecycle_Operations; + source.setType(type); + + final String artifactName = "11773228-4e11-4f29-b5e4-733089b99d76"; + source.setArtifactName(artifactName); + + final ProcessEntityDto target = new ProcessEntityDto(); + final MapProcessEntityToProcessEntityDto mapper = new MapProcessEntityToProcessEntityDto(); + mapper.doMapping(source, target); + + assertEquals(id, target.getId()); + assertEquals(name, target.getName()); + assertEquals(description, target.getDescription()); + assertEquals(type, target.getType()); + assertEquals(artifactName, target.getArtifactName()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapProcessRequestDtoToProcessEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapProcessRequestDtoToProcessEntityTest.java new file mode 100644 index 0000000000..ea2fca5cdb --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapProcessRequestDtoToProcessEntityTest.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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessType; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessRequestDto; + +/** + * This class was generated. + */ +public class MapProcessRequestDtoToProcessEntityTest { + + @Test() + public void testConversion() { + + final ProcessRequestDto source = new ProcessRequestDto(); + + final String name = "bab6bcf0-7c1e-44e8-9730-55638c58027a"; + source.setName(name); + + final String description = "725019d0-2501-4c70-ade7-5deca94b40e3"; + source.setDescription(description); + + final ProcessType type = ProcessType.Lifecycle_Operations; + source.setType(type); + + final ProcessEntity target = new ProcessEntity(); + final MapProcessRequestDtoToProcessEntity mapper = new MapProcessRequestDtoToProcessEntity(); + mapper.doMapping(source, target); + + assertEquals(name, target.getName()); + assertEquals(description, target.getDescription()); + assertSame(type, target.getType()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapQuestionnaireResponseToQuestionnaireResponseDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapQuestionnaireResponseToQuestionnaireResponseDtoTest.java new file mode 100644 index 0000000000..b3df2807b1 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapQuestionnaireResponseToQuestionnaireResponseDtoTest.java @@ -0,0 +1,55 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; + +import org.junit.Test; +import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto; + +/** + * This class was generated. + */ +public class MapQuestionnaireResponseToQuestionnaireResponseDtoTest { + + @Test() + public void testConversion() { + + final QuestionnaireResponse source = new QuestionnaireResponse(); + + final String schema = "20f7944e-ae84-4604-b597-f4c14ee413cc"; + source.setSchema(schema); + + final String data = "8fac7a9d-b801-47d4-a482-e21ee6558873"; + source.setData(data); + + final ErrorMessage errorMessage = new ErrorMessage(ErrorLevel.WARNING, "15fc54f6-e719-4da0-9a57-da9926994566"); + source.setErrorMessage(errorMessage); + + final QuestionnaireResponseDto target = new QuestionnaireResponseDto(); + final MapQuestionnaireResponseToQuestionnaireResponseDto mapper = new MapQuestionnaireResponseToQuestionnaireResponseDto(); + mapper.doMapping(source, target); + + assertEquals(schema, target.getSchema()); + assertEquals(data, target.getData()); + assertSame(errorMessage, target.getErrorMessage()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapQuestionnaireToQuestionnaireDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapQuestionnaireToQuestionnaireDtoTest.java new file mode 100644 index 0000000000..e51dec1c48 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapQuestionnaireToQuestionnaireDtoTest.java @@ -0,0 +1,42 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.CompositionEntity; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireDto; + +public class MapQuestionnaireToQuestionnaireDtoTest { + + @Test() + public void testConversion() { + + final String id = "1ec317d3-58e7-47ef-9c9c-00afa0a5414d"; + final CompositionEntity source = Mockito.mock(CompositionEntity.class); + Mockito.when(source.getId()).thenReturn(id); + Mockito.when(source.getQuestionnaireData()).thenReturn("{}"); + + final QuestionnaireDto target = new QuestionnaireDto(); + final MapQuestionnaireToQuestionnaireDto mapper = new MapQuestionnaireToQuestionnaireDto(); + mapper.doMapping(source, target); + + assertEquals(id, target.getId()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapUploadFileResponseToUploadFileResponseDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapUploadFileResponseToUploadFileResponseDtoTest.java new file mode 100644 index 0000000000..9d71cc3f4e --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapUploadFileResponseToUploadFileResponseDtoTest.java @@ -0,0 +1,55 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; + +import org.junit.Test; +import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; +import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileStatus; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.UploadFileResponseDto; + +/** + * This class was generated. + */ +public class MapUploadFileResponseToUploadFileResponseDtoTest { + + @Test() + public void testConversion() { + + final UploadFileResponse source = new UploadFileResponse(); + + final UploadFileStatus status = UploadFileStatus.Failure; + source.setStatus(status); + + final OnboardingTypesEnum onboardingOrigin = OnboardingTypesEnum.MANUAL; + source.setOnboardingType(onboardingOrigin); + + final String networkPackageName = "2527ac7d-76bd-4263-9472-e767e1c25fbb"; + source.setNetworkPackageName(networkPackageName); + + final UploadFileResponseDto target = new UploadFileResponseDto(); + final MapUploadFileResponseToUploadFileResponseDto mapper = new MapUploadFileResponseToUploadFileResponseDto(); + mapper.doMapping(source, target); + + assertSame(status, target.getStatus()); + assertEquals(onboardingOrigin.toString(), target.getOnboardingOrigin()); + assertEquals(networkPackageName, target.getNetworkPackageName()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDtoTest.java new file mode 100644 index 0000000000..17b9b218c5 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapValidationResponseToDtoTest.java @@ -0,0 +1,65 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireValidationResult; +import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ValidationResponseDto; + +/** + * This class was generated. + */ +public class MapValidationResponseToDtoTest { + + @Test() + public void testConversion() { + + final ValidationResponse source = new ValidationResponse(); + + final Collection<ErrorCode> vspErrors = Collections.emptyList(); + source.setVspErrors(vspErrors); + + final Collection<ErrorCode> licensingDataErrors = Collections.emptyList(); + source.setLicensingDataErrors(licensingDataErrors); + + final Map<String, List<ErrorMessage>> uploadDataErrors = Collections.emptyMap(); + source.setUploadDataErrors(uploadDataErrors); + + final QuestionnaireValidationResult questionnaireValidationResult = new QuestionnaireValidationResult(null); + source.setQuestionnaireValidationResult(questionnaireValidationResult); + + final ValidationResponseDto target = new ValidationResponseDto(); + final MapValidationResponseToDto mapper = new MapValidationResponseToDto(); + mapper.doMapping(source, target); + + assertTrue(target.isValid()); + assertNull(target.getVspErrors()); + assertNull(target.getLicensingDataErrors()); + assertNull(target.getUploadDataErrors()); + assertNull(target.getQuestionnaireValidationResult()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToItemTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToItemTest.java new file mode 100644 index 0000000000..29d49afdeb --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToItemTest.java @@ -0,0 +1,60 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import java.util.Map; +import org.junit.Test; +import org.openecomp.sdc.versioning.types.Item; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto; +import org.openecomp.sdcrests.vsp.rest.services.VspItemProperty; + +/** + * This class was generated. + */ +public class MapVspDescriptionDtoToItemTest { + + @Test() + public void testConversion() { + + final VspDescriptionDto source = new VspDescriptionDto(); + + final String name = "992d877f-90c7-4d67-b431-e2b761ca954c"; + source.setName(name); + + final String description = "af946014-eb47-4c98-a9f8-e3b43bbfe4e8"; + source.setDescription(description); + + final String vendorId = "20f7944e-ae84-4604-b597-f4c14ee413cc"; + source.setVendorId(vendorId); + + final String vendorName = "8fac7a9d-b801-47d4-a482-e21ee6558873"; + source.setVendorName(vendorName); + + final Item target = new Item(); + + final MapVspDescriptionDtoToItem mapper = new MapVspDescriptionDtoToItem(); + mapper.doMapping(source, target); + + assertEquals(name, target.getName()); + assertEquals(description, target.getDescription()); + Map<String, Object> properties = target.getProperties(); + assertEquals(vendorId, properties.get(VspItemProperty.VENDOR_ID)); + assertEquals(vendorName, properties.get(VspItemProperty.VENDOR_NAME)); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetailsTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetailsTest.java new file mode 100644 index 0000000000..9ec43e9226 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetailsTest.java @@ -0,0 +1,68 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto; + +/** + * This class was generated. + */ +public class MapVspDescriptionDtoToVspDetailsTest { + + @Test() + public void testConversion() { + + final VspDescriptionDto source = new VspDescriptionDto(); + + final String name = "e507ee61-df86-4cbd-8efc-fc5ac7182a42"; + source.setName(name); + + final String description = "9493bf30-d5dd-4436-9cf8-917ef5a9f2c4"; + source.setDescription(description); + + final String icon = "593e7453-239d-4979-abc7-2b3d0c9bfa30"; + source.setIcon(icon); + + final String category = "0dee3401-f7e5-4da4-bd36-8f88c4380884"; + source.setCategory(category); + + final String subCategory = "4db52d19-bb60-4490-b88a-a14d1237316a"; + source.setSubCategory(subCategory); + + final String vendorName = "200378cb-ee09-47fb-975b-25fe4ddd3794"; + source.setVendorName(vendorName); + + final String vendorId = "a634f9b4-685e-4903-b23d-572b67d1374c"; + source.setVendorId(vendorId); + + final VspDetails target = new VspDetails(); + final MapVspDescriptionDtoToVspDetails mapper = new MapVspDescriptionDtoToVspDetails(); + mapper.doMapping(source, target); + + assertEquals(name, target.getName()); + assertEquals(description, target.getDescription()); + assertEquals(category, target.getCategory()); + assertEquals(subCategory, target.getSubCategory()); + assertEquals(icon, target.getIcon()); + assertEquals(vendorName, target.getVendorName()); + assertEquals(vendorId, target.getVendorId()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDtoTest.java new file mode 100644 index 0000000000..d5eb7be0d3 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDetailsToDtoTest.java @@ -0,0 +1,87 @@ +/* + * 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.vsp.rest.mapping; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto; + +/** + * This class was generated. + */ +public class MapVspDetailsToDtoTest { + + @Test() + public void testConversion() { + + final VspDetails source = new VspDetails(); + + final String id = "072b88a8-0b34-4e3e-a0be-1f664100f76c"; + source.setId(id); + + final String versionId = "345-96f20205613f"; + final Version version = new Version(versionId); + source.setVersion(version); + + final String name = "cd60b1d0-cf2f-48b4-b578-96f20205613f"; + source.setName(name); + + final String description = "3baf3188-c7b4-48a2-9b4d-0258216ce4b5"; + source.setDescription(description); + + final String category = "d05d10e3-35d6-45aa-83a5-f41194468fc2"; + source.setCategory(category); + + final String subCategory = "9a4652df-ff91-4817-bfa0-ded9fd57012e"; + source.setSubCategory(subCategory); + + final String icon = "2ee3b647-f3f0-4c85-9134-b4e960246b06"; + source.setIcon(icon); + + final String vendorName = "e9351739-6a2b-4214-b386-e71dc48ff97d"; + source.setVendorName(vendorName); + + final String vendorId = "b2f67f43-3b19-4037-a982-ed7bc2ed8d68"; + source.setVendorId(vendorId); + + final String vlmVersionId = "3b194037a982ed7b"; + source.setVlmVersion(new Version(vlmVersionId)); + + final String onboardingMethod = "b46520ac-e62f-4a24-8f40-ee6e65889bfc"; + source.setOnboardingMethod(onboardingMethod); + + final VspDetailsDto target = new VspDetailsDto(); + final MapVspDetailsToDto mapper = new MapVspDetailsToDto(); + mapper.doMapping(source, target); + + assertEquals(id, source.getId()); + assertEquals(versionId, target.getVersion()); + assertEquals(name, target.getName()); + assertEquals(description, target.getDescription()); + assertEquals(icon, target.getIcon()); + assertEquals(category, target.getCategory()); + assertEquals(subCategory, target.getSubCategory()); + assertEquals(vendorId, target.getVendorId()); + assertEquals(vendorName, target.getVendorName()); + assertEquals(vlmVersionId, target.getLicensingVersion()); + assertEquals(onboardingMethod, target.getOnboardingMethod()); + } +} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/resources/logback-test.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..f9fa3d88e8 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ +<configuration> + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</pattern> + </encoder> + </appender> + + <root level="OFF"> + <appender-ref ref="STDOUT" /> + </root> + +</configuration>
\ No newline at end of file |