From 130aa901dd94519cd6bc99140a9d935365220cc5 Mon Sep 17 00:00:00 2001 From: ayalaben Date: Wed, 10 Oct 2018 09:40:57 +0300 Subject: Unit test coverage Change-Id: I3634ccaa60c72ee91b89ae42b8da8926b5823436 Issue-ID: SDC-1822 Signed-off-by: ayalaben --- .../MapComponentDataToComponentDtoTest.java | 58 ++++++++++++++++++ ...ComponentDependencyEntityToCreationDtoTest.java | 38 ++++++++++++ .../MapComponentDependencyEntityToDtoTest.java | 66 +++++++++++++++++++++ ...MapComponentDependencyModelEntityToDtoTest.java | 56 ++++++++++++++++++ ...omponentDependencyModelRequestToEntityTest.java | 59 ++++++++++++++++++ ...pComponentEntityToComponentCreationDtoTest.java | 35 +++++++++++ .../MapComponentEntityToComponentDtoTest.java | 35 +++++++++++ .../MapCompositionEntityResponseToDtoTest.java | 51 ++++++++++++++++ ...apCompositionEntityValidationDataToDtoTest.java | 69 ++++++++++++++++++++++ .../MapComputeDataToComputeDetailsDtoTest.java | 47 +++++++++++++++ .../MapComputeEntityToComputeCreationDtoTest.java | 36 +++++++++++ ...orEntityDeploymentFlavorToListResponseTest.java | 38 ++++++++++++ ...vorEntityToDeploymentFlavorCreationDtoTest.java | 38 ++++++++++++ ...ymentFlavorEntityToDeploymentFlavorDtoTest.java | 37 ++++++++++++ .../MapDeploymentFlavorToDeploymentDtoTest.java | 59 ++++++++++++++++++ 15 files changed, 722 insertions(+) create mode 100644 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/MapComponentDataToComponentDtoTest.java create mode 100644 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/MapComponentDependencyEntityToCreationDtoTest.java create mode 100644 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/MapComponentDependencyEntityToDtoTest.java create mode 100644 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/MapComponentDependencyModelEntityToDtoTest.java create mode 100644 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/MapComponentDependencyModelRequestToEntityTest.java create mode 100644 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/MapComponentEntityToComponentCreationDtoTest.java create mode 100644 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/MapComponentEntityToComponentDtoTest.java create mode 100644 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/MapCompositionEntityResponseToDtoTest.java create mode 100644 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/MapCompositionEntityValidationDataToDtoTest.java create mode 100644 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/MapComputeDataToComputeDetailsDtoTest.java create mode 100644 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/MapComputeEntityToComputeCreationDtoTest.java create mode 100644 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/MapDeploymentFlavorEntityDeploymentFlavorToListResponseTest.java create mode 100644 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/MapDeploymentFlavorEntityToDeploymentFlavorCreationDtoTest.java create mode 100644 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/MapDeploymentFlavorEntityToDeploymentFlavorDtoTest.java create mode 100644 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/MapDeploymentFlavorToDeploymentDtoTest.java (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src') 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/MapComponentDataToComponentDtoTest.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/MapComponentDataToComponentDtoTest.java new file mode 100644 index 0000000000..2973426b13 --- /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/MapComponentDataToComponentDtoTest.java @@ -0,0 +1,58 @@ +/* + * 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.ComponentData; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDto; + +public class MapComponentDataToComponentDtoTest { + + @Test + public void testDisplayName() { + ComponentData source = new ComponentData(); + ComponentDto target = new ComponentDto(); + MapComponentDataToComponentDto mapper = new MapComponentDataToComponentDto(); + String displayName = "some_test_name"; + source.setDisplayName(displayName); + mapper.doMapping(source, target); + assertEquals(target.getDisplayName(), displayName); + } + + @Test + public void testName() { + ComponentData source = new ComponentData(); + ComponentDto target = new ComponentDto(); + MapComponentDataToComponentDto mapper = new MapComponentDataToComponentDto(); + String name = "component_name_1"; + source.setName(name); + mapper.doMapping(source, target); + assertEquals(target.getName(), name); + } + + @Test + public void testDescription() { + ComponentData source = new ComponentData(); + ComponentDto target = new ComponentDto(); + MapComponentDataToComponentDto mapper = new MapComponentDataToComponentDto(); + String description = "my_test_component"; + source.setDescription(description); + mapper.doMapping(source, target); + assertEquals(target.getDescription(), description); + } +} 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/MapComponentDependencyEntityToCreationDtoTest.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/MapComponentDependencyEntityToCreationDtoTest.java new file mode 100644 index 0000000000..5abaf8dd23 --- /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/MapComponentDependencyEntityToCreationDtoTest.java @@ -0,0 +1,38 @@ +/* + * 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.ComponentDependencyModelEntity; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyCreationDto; + +public class MapComponentDependencyEntityToCreationDtoTest { + + @Test + public void testId() { + ComponentDependencyModelEntity source = new ComponentDependencyModelEntity(); + ComponentDependencyCreationDto target = new ComponentDependencyCreationDto(); + MapComponentDependencyEntityToCreationDto mapper = new MapComponentDependencyEntityToCreationDto(); + String id = "some_test_id"; + source.setId(id); + mapper.doMapping(source, target); + assertEquals(target.getId(), id); + } + + +} 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/MapComponentDependencyEntityToDtoTest.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/MapComponentDependencyEntityToDtoTest.java new file mode 100644 index 0000000000..c97a274615 --- /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/MapComponentDependencyEntityToDtoTest.java @@ -0,0 +1,66 @@ +/* + * 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.ComponentDependencyModelEntity; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyResponseDto; + +public class MapComponentDependencyEntityToDtoTest { + + private static final String TEST_VALUE = "some_test_id"; + + @Test + public void testSourceId() { + ComponentDependencyModelEntity source = new ComponentDependencyModelEntity(); + ComponentDependencyResponseDto target = new ComponentDependencyResponseDto(); + MapComponentDependencyEntityToDto mapper = new MapComponentDependencyEntityToDto(); + source.setSourceComponentId(TEST_VALUE); + mapper.doMapping(source, target); + assertEquals(target.getSourceId(), TEST_VALUE); + } + @Test + public void testTargetId() { + ComponentDependencyModelEntity source = new ComponentDependencyModelEntity(); + ComponentDependencyResponseDto target = new ComponentDependencyResponseDto(); + MapComponentDependencyEntityToDto mapper = new MapComponentDependencyEntityToDto(); + source.setTargetComponentId(TEST_VALUE); + mapper.doMapping(source, target); + assertEquals(target.getTargetId(), TEST_VALUE); + } + + @Test + public void testRelationType() { + ComponentDependencyModelEntity source = new ComponentDependencyModelEntity(); + ComponentDependencyResponseDto target = new ComponentDependencyResponseDto(); + MapComponentDependencyEntityToDto mapper = new MapComponentDependencyEntityToDto(); + source.setRelation(TEST_VALUE); + mapper.doMapping(source, target); + assertEquals(target.getRelationType(), TEST_VALUE); + } + + @Test + public void testId() { + ComponentDependencyModelEntity source = new ComponentDependencyModelEntity(); + ComponentDependencyResponseDto target = new ComponentDependencyResponseDto(); + MapComponentDependencyEntityToDto mapper = new MapComponentDependencyEntityToDto(); + source.setId(TEST_VALUE); + mapper.doMapping(source, target); + assertEquals(target.getId(), TEST_VALUE); + } +} 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/MapComponentDependencyModelEntityToDtoTest.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/MapComponentDependencyModelEntityToDtoTest.java new file mode 100644 index 0000000000..f92eed584f --- /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/MapComponentDependencyModelEntityToDtoTest.java @@ -0,0 +1,56 @@ +/* + * 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.ComponentDependencyModelEntity; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyModel; + +public class MapComponentDependencyModelEntityToDtoTest { + + private static final String TEST_VALUE = "some_test_id"; + + @Test + public void testSourceId() { + ComponentDependencyModelEntity source = new ComponentDependencyModelEntity(); + ComponentDependencyModel target = new ComponentDependencyModel(); + MapComponentDependencyModelEntityToDto mapper = new MapComponentDependencyModelEntityToDto(); + source.setSourceComponentId(TEST_VALUE); + mapper.doMapping(source, target); + assertEquals(target.getSourceId(), TEST_VALUE); + } + @Test + public void testTargetId() { + ComponentDependencyModelEntity source = new ComponentDependencyModelEntity(); + ComponentDependencyModel target = new ComponentDependencyModel(); + MapComponentDependencyModelEntityToDto mapper = new MapComponentDependencyModelEntityToDto(); + source.setTargetComponentId(TEST_VALUE); + mapper.doMapping(source, target); + assertEquals(target.getTargetId(), TEST_VALUE); + } + + @Test + public void testRelationType() { + ComponentDependencyModelEntity source = new ComponentDependencyModelEntity(); + ComponentDependencyModel target = new ComponentDependencyModel(); + MapComponentDependencyModelEntityToDto mapper = new MapComponentDependencyModelEntityToDto(); + source.setRelation(TEST_VALUE); + mapper.doMapping(source, target); + assertEquals(target.getRelationType(), TEST_VALUE); + } +} 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/MapComponentDependencyModelRequestToEntityTest.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/MapComponentDependencyModelRequestToEntityTest.java new file mode 100644 index 0000000000..467b7e0864 --- /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/MapComponentDependencyModelRequestToEntityTest.java @@ -0,0 +1,59 @@ +/* + * 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.ComponentDependencyModelEntity; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyModel; + +public class MapComponentDependencyModelRequestToEntityTest { + + private static final String TEST_VALUE = "some_test_id"; + private static final String RELATION_TYPE = "dependsOn"; + + @Test + public void testSourceId() { + ComponentDependencyModel source = new ComponentDependencyModel(); + ComponentDependencyModelEntity target = new ComponentDependencyModelEntity(); + MapComponentDependencyModelRequestToEntity mapper = new MapComponentDependencyModelRequestToEntity(); + source.setSourceId(TEST_VALUE); + source.setRelationType(RELATION_TYPE); + mapper.doMapping(source, target); + assertEquals(target.getSourceComponentId(), TEST_VALUE); + } + @Test + public void testTargetId() { + ComponentDependencyModel source = new ComponentDependencyModel(); + ComponentDependencyModelEntity target = new ComponentDependencyModelEntity(); + MapComponentDependencyModelRequestToEntity mapper = new MapComponentDependencyModelRequestToEntity(); + source.setTargetId(TEST_VALUE); + source.setRelationType(RELATION_TYPE); + mapper.doMapping(source, target); + assertEquals(target.getTargetComponentId(), TEST_VALUE); + } + + @Test + public void testRelationType() { + ComponentDependencyModel source = new ComponentDependencyModel(); + ComponentDependencyModelEntity target = new ComponentDependencyModelEntity(); + MapComponentDependencyModelRequestToEntity mapper = new MapComponentDependencyModelRequestToEntity(); + source.setRelationType(RELATION_TYPE); + mapper.doMapping(source, target); + assertEquals(target.getRelation(), RELATION_TYPE); + } +} 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/MapComponentEntityToComponentCreationDtoTest.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/MapComponentEntityToComponentCreationDtoTest.java new file mode 100644 index 0000000000..0fb5c6e167 --- /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/MapComponentEntityToComponentCreationDtoTest.java @@ -0,0 +1,35 @@ +/* + * 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.sdcrests.vendorsoftwareproducts.types.ComponentCreationDto; + +public class MapComponentEntityToComponentCreationDtoTest { + + @Test + public void testVfcId() { + ComponentEntity source = new ComponentEntity(); + ComponentCreationDto target = new ComponentCreationDto(); + MapComponentEntityToComponentCreationDto mapper = new MapComponentEntityToComponentCreationDto(); + source.setId("some_test_id"); + mapper.doMapping(source, target); + assertEquals(target.getVfcId(), "some_test_id"); + } +} 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/MapComponentEntityToComponentDtoTest.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/MapComponentEntityToComponentDtoTest.java new file mode 100644 index 0000000000..e6c4315938 --- /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/MapComponentEntityToComponentDtoTest.java @@ -0,0 +1,35 @@ +/* + * 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.sdcrests.vendorsoftwareproducts.types.ComponentDto; + +public class MapComponentEntityToComponentDtoTest { + + @Test + public void testId() { + ComponentEntity source = new ComponentEntity(); + ComponentDto target = new ComponentDto(); + MapComponentEntityToComponentDto mapper = new MapComponentEntityToComponentDto(); + source.setId("some_test_id"); + mapper.doMapping(source, target); + assertEquals(target.getId(),"some_test_id"); + } +} 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/MapCompositionEntityResponseToDtoTest.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/MapCompositionEntityResponseToDtoTest.java new file mode 100644 index 0000000000..716b7b786d --- /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/MapCompositionEntityResponseToDtoTest.java @@ -0,0 +1,51 @@ +/* + * 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.CompositionEntityResponse; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDto; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityResponseDto; + +public class MapCompositionEntityResponseToDtoTest { + + @Test + public void testId() { + CompositionEntityResponse source = new CompositionEntityResponse(); + CompositionEntityResponseDto target = new CompositionEntityResponseDto(); + String testId = "some_test_id"; + source.setId(testId); + MapCompositionEntityResponseToDto mapper = + new MapCompositionEntityResponseToDto(new MapComponentDataToComponentDto(), ComponentDto.class); + mapper.doMapping(source, target); + assertEquals(target.getId(), testId); + } + + @Test + public void testSchema() { + CompositionEntityResponse source = new CompositionEntityResponse(); + CompositionEntityResponseDto target = new CompositionEntityResponseDto(); + MapCompositionEntityResponseToDto mapper = + new MapCompositionEntityResponseToDto(new MapComponentDataToComponentDto(), ComponentDto.class); + String schema = "component_name_1"; + source.setSchema(schema); + mapper.doMapping(source, target); + assertEquals(target.getSchema(), schema); + } + +} 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/MapCompositionEntityValidationDataToDtoTest.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/MapCompositionEntityValidationDataToDtoTest.java new file mode 100644 index 0000000000..78e634ab3b --- /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/MapCompositionEntityValidationDataToDtoTest.java @@ -0,0 +1,69 @@ +/* + * 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.Arrays; +import java.util.Collection; +import org.junit.Test; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityValidationData; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.CompositionEntityValidationDataDto; + +public class MapCompositionEntityValidationDataToDtoTest { + private static final String TEST_ID = "some_test_id"; + + @Test + public void testEntityType() { + CompositionEntityValidationData source = new CompositionEntityValidationData(CompositionEntityType.compute,TEST_ID); + CompositionEntityValidationDataDto target = new CompositionEntityValidationDataDto(); + MapCompositionEntityValidationDataToDto mapper = new MapCompositionEntityValidationDataToDto(); + mapper.doMapping(source, target); + assertEquals(target.getEntityType(), CompositionEntityType.compute); + } + + @Test + public void testEntityId() { + CompositionEntityValidationData source = new CompositionEntityValidationData(CompositionEntityType.compute,TEST_ID); + CompositionEntityValidationDataDto target = new CompositionEntityValidationDataDto(); + MapCompositionEntityValidationDataToDto mapper = new MapCompositionEntityValidationDataToDto(); + mapper.doMapping(source, target); + assertEquals(target.getEntityId(), TEST_ID); + } + + @Test + public void testEntityName() { + CompositionEntityValidationData source = new CompositionEntityValidationData(CompositionEntityType.compute,TEST_ID); + CompositionEntityValidationDataDto target = new CompositionEntityValidationDataDto(); + String name = "some_test_name"; + source.setEntityName(name); + MapCompositionEntityValidationDataToDto mapper = new MapCompositionEntityValidationDataToDto(); + mapper.doMapping(source, target); + assertEquals(target.getEntityName(), name); + } + + @Test + public void testErrors() { + CompositionEntityValidationData source = new CompositionEntityValidationData(CompositionEntityType.compute,TEST_ID); + CompositionEntityValidationDataDto target = new CompositionEntityValidationDataDto(); + Collection errors = Arrays.asList("some_test_id_1","some_test_id_2","some_test_id_3"); + source.setErrors(errors); + MapCompositionEntityValidationDataToDto mapper = new MapCompositionEntityValidationDataToDto(); + mapper.doMapping(source, target); + assertEquals(target.getErrors(), errors); + } +} 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/MapComputeDataToComputeDetailsDtoTest.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/MapComputeDataToComputeDetailsDtoTest.java new file mode 100644 index 0000000000..4ce5a4d70b --- /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/MapComputeDataToComputeDetailsDtoTest.java @@ -0,0 +1,47 @@ +/* + * 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.ComputeData; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeDetailsDto; + +public class MapComputeDataToComputeDetailsDtoTest { + + @Test + public void testName() { + ComputeData source = new ComputeData(); + ComputeDetailsDto target = new ComputeDetailsDto(); + String name = "some_test_name"; + source.setName(name); + MapComputeDataToComputeDetailsDto mapper = new MapComputeDataToComputeDetailsDto(); + mapper.doMapping(source, target); + assertEquals(target.getName(), name); + } + + @Test + public void testDescription() { + ComputeData source = new ComputeData(); + ComputeDetailsDto target = new ComputeDetailsDto(); + String description = "some_test_description"; + source.setDescription(description); + MapComputeDataToComputeDetailsDto mapper = new MapComputeDataToComputeDetailsDto(); + mapper.doMapping(source, target); + assertEquals(target.getDescription(), description); + } +} 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/MapComputeEntityToComputeCreationDtoTest.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/MapComputeEntityToComputeCreationDtoTest.java new file mode 100644 index 0000000000..1b33f08a8d --- /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/MapComputeEntityToComputeCreationDtoTest.java @@ -0,0 +1,36 @@ +/* + * 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.ComputeEntity; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeCreationDto; + +public class MapComputeEntityToComputeCreationDtoTest { + + @Test + public void testId() { + ComputeEntity source = new ComputeEntity(); + ComputeCreationDto target = new ComputeCreationDto(); + String testId = "some_test_id"; + source.setId(testId); + MapComputeEntityToComputeCreationDto mapper = new MapComputeEntityToComputeCreationDto(); + mapper.doMapping(source, target); + assertEquals(target.getId(), testId); + } +} 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/MapDeploymentFlavorEntityDeploymentFlavorToListResponseTest.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/MapDeploymentFlavorEntityDeploymentFlavorToListResponseTest.java new file mode 100644 index 0000000000..5aefb4194d --- /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/MapDeploymentFlavorEntityDeploymentFlavorToListResponseTest.java @@ -0,0 +1,38 @@ +/* + * 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.DeploymentFlavorEntity; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.DeploymentFlavorListResponseDto; + +public class MapDeploymentFlavorEntityDeploymentFlavorToListResponseTest { + + @Test + public void testId() { + DeploymentFlavorEntity source = new DeploymentFlavorEntity(); + DeploymentFlavorListResponseDto target = new DeploymentFlavorListResponseDto(); + String testId = "some_test_id"; + source.setId(testId); + MapDeploymentFlavorEntityDeploymentFlavorToListResponse mapper = + new MapDeploymentFlavorEntityDeploymentFlavorToListResponse(); + mapper.doMapping(source, target); + assertEquals(target.getId(), testId); + } + +} 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/MapDeploymentFlavorEntityToDeploymentFlavorCreationDtoTest.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/MapDeploymentFlavorEntityToDeploymentFlavorCreationDtoTest.java new file mode 100644 index 0000000000..8044e30950 --- /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/MapDeploymentFlavorEntityToDeploymentFlavorCreationDtoTest.java @@ -0,0 +1,38 @@ +/* + * 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.DeploymentFlavorEntity; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.DeploymentFlavorCreationDto; + +public class MapDeploymentFlavorEntityToDeploymentFlavorCreationDtoTest { + + @Test + public void testId() { + DeploymentFlavorEntity source = new DeploymentFlavorEntity(); + DeploymentFlavorCreationDto target = new DeploymentFlavorCreationDto(); + String testId = "some_test_id"; + source.setId(testId); + MapDeploymentFlavorEntityToDeploymentFlavorCreationDto mapper = + new MapDeploymentFlavorEntityToDeploymentFlavorCreationDto(); + mapper.doMapping(source, target); + assertEquals(target.getDeploymentFlavorId(), testId); + } + +} 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/MapDeploymentFlavorEntityToDeploymentFlavorDtoTest.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/MapDeploymentFlavorEntityToDeploymentFlavorDtoTest.java new file mode 100644 index 0000000000..bfa7a94648 --- /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/MapDeploymentFlavorEntityToDeploymentFlavorDtoTest.java @@ -0,0 +1,37 @@ +/* + * 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.DeploymentFlavorEntity; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.DeploymentFlavorDto; + +public class MapDeploymentFlavorEntityToDeploymentFlavorDtoTest { + + @Test + public void testModel() { + DeploymentFlavorEntity source = new DeploymentFlavorEntity(); + DeploymentFlavorDto target = new DeploymentFlavorDto(); + String testId = "some_test_id"; + source.setId(testId); + MapDeploymentFlavorEntityToDeploymentFlavorDto mapper = new MapDeploymentFlavorEntityToDeploymentFlavorDto(); + mapper.doMapping(source, target); + assertEquals(target.getId(), testId); + } + +} 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/MapDeploymentFlavorToDeploymentDtoTest.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/MapDeploymentFlavorToDeploymentDtoTest.java new file mode 100644 index 0000000000..79dd509e76 --- /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/MapDeploymentFlavorToDeploymentDtoTest.java @@ -0,0 +1,59 @@ +/* + * 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.DeploymentFlavor; +import org.openecomp.sdcrests.vendorsoftwareproducts.types.DeploymentFlavorDto; + +public class MapDeploymentFlavorToDeploymentDtoTest { + + @Test + public void testModel() { + DeploymentFlavor source = new DeploymentFlavor(); + DeploymentFlavorDto target = new DeploymentFlavorDto(); + String model = "some_test_model"; + source.setModel(model); + MapDeploymentFlavorToDeploymentDto mapper = new MapDeploymentFlavorToDeploymentDto(); + mapper.doMapping(source, target); + assertEquals(target.getModel(), model); + } + + @Test + public void testDescription() { + DeploymentFlavor source = new DeploymentFlavor(); + DeploymentFlavorDto target = new DeploymentFlavorDto(); + String description = "some_test_description"; + source.setDescription(description); + MapDeploymentFlavorToDeploymentDto mapper = new MapDeploymentFlavorToDeploymentDto(); + mapper.doMapping(source, target); + assertEquals(target.getDescription(), description); + } + + @Test + public void testFeatureGroupId() { + DeploymentFlavor source = new DeploymentFlavor(); + DeploymentFlavorDto target = new DeploymentFlavorDto(); + String testId = "some_test_id"; + source.setFeatureGroupId(testId); + MapDeploymentFlavorToDeploymentDto mapper = new MapDeploymentFlavorToDeploymentDto(); + mapper.doMapping(source, target); + assertEquals(target.getFeatureGroupId(), testId); + } + +} -- cgit 1.2.3-korg