Unit test coverage 41/70141/4
authorayalaben <ayala.benzvi@amdocs.com>
Wed, 10 Oct 2018 06:40:57 +0000 (09:40 +0300)
committerayalaben <ayala.benzvi@amdocs.com>
Sun, 14 Oct 2018 07:06:00 +0000 (10:06 +0300)
Change-Id: I3634ccaa60c72ee91b89ae42b8da8926b5823436
Issue-ID: SDC-1822
Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
23 files changed:
openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitCreationDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml
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 with mode: 0644]
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 with mode: 0644]
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 with mode: 0644]
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 with mode: 0644]
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 with mode: 0644]
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 with mode: 0644]
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 with mode: 0644]
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 with mode: 0644]
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 with mode: 0644]
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 with mode: 0644]
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 with mode: 0644]
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 with mode: 0644]
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 with mode: 0644]
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 with mode: 0644]
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 with mode: 0644]
openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/pom.xml
openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsServicesImplTest.java
openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/test/java/org/openecomp/sdc/itempermissions/servlet/PermissionsFilterTest.java
openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/OrchestrationTemplateFileExtensionErrorBuilderTest.java
openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductCreationFailedBuilderTest.java
openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductNotFoundErrorBuilderTest.java

diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitCreationDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitCreationDtoTest.java
new file mode 100644 (file)
index 0000000..68a5811
--- /dev/null
@@ -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.vendorlicense.rest.mapping;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
+
+public class MapLimitEntityToLimitCreationDtoTest {
+
+    @Test
+    public void testId() {
+        LimitEntity source = new LimitEntity();
+        LimitCreationDto target = new LimitCreationDto();
+        MapLimitEntityToLimitCreationDto mapper = new MapLimitEntityToLimitCreationDto();
+        String param = "52d4d919-015a-4a46-af04-4d0dec17e88d";
+        source.setId(param);
+        mapper.doMapping(source, target);
+        assertEquals(target.getLimitId(), param);
+    }
+
+}
index 923cc48..bb11b11 100644 (file)
     </parent>
 
     <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
     <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-core</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/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 (file)
index 0000000..2973426
--- /dev/null
@@ -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 (file)
index 0000000..5abaf8d
--- /dev/null
@@ -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 (file)
index 0000000..c97a274
--- /dev/null
@@ -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 (file)
index 0000000..f92eed5
--- /dev/null
@@ -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 (file)
index 0000000..467b7e0
--- /dev/null
@@ -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 (file)
index 0000000..0fb5c6e
--- /dev/null
@@ -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 (file)
index 0000000..e6c4315
--- /dev/null
@@ -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 (file)
index 0000000..716b7b7
--- /dev/null
@@ -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 (file)
index 0000000..78e634a
--- /dev/null
@@ -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<String> 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 (file)
index 0000000..4ce5a4d
--- /dev/null
@@ -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 (file)
index 0000000..1b33f08
--- /dev/null
@@ -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 (file)
index 0000000..5aefb41
--- /dev/null
@@ -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 (file)
index 0000000..8044e30
--- /dev/null
@@ -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 (file)
index 0000000..bfa7a94
--- /dev/null
@@ -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 (file)
index 0000000..79dd509
--- /dev/null
@@ -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);
+    }
+
+}
index 092338f..9721eee 100644 (file)
@@ -56,8 +56,8 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
 
index 9346b0a..a6baf9d 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * 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.sdc.itempermissions.dao.impl;
 
 import static org.mockito.Matchers.anyObject;
@@ -23,9 +39,10 @@ import org.openecomp.sdc.itempermissions.PermissionsRules;
 import org.openecomp.sdc.itempermissions.dao.ItemPermissionsDao;
 import org.openecomp.sdc.itempermissions.dao.UserPermissionsDao;
 import org.openecomp.sdc.itempermissions.type.ItemPermissionsEntity;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
+import org.junit.Test;
+import org.junit.Before;
+import org.junit.Assert;
+
 
 /**
  * Created by ayalaben on 7/9/2017
@@ -54,7 +71,7 @@ public class PermissionsServicesImplTest {
     private PermissionsServicesImpl permissionsServices;
 
 
-    @BeforeMethod
+    @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
     }
@@ -91,32 +108,29 @@ public class PermissionsServicesImplTest {
     @Test
     public void testGetUserItemPermission() {
         Mockito.when(permissionsDaoMock.getUserItemPermission(anyString(), anyString()))
-                .thenReturn(Optional.of(PERMISSION));
+               .thenReturn(Optional.of(PERMISSION));
 
         Optional<String> permission = permissionsServices.getUserItemPermission(ITEM1_ID, USER1_ID);
 
         Assert.assertTrue(permission.isPresent());
-        Assert.assertEquals(permission.get(), PERMISSION);
+        Assert.assertEquals(PERMISSION, permission.get());
     }
 
     @Test
     public void testListItemPermissionsWhenNone() {
-        Collection<ItemPermissionsEntity> permissions =
-                permissionsServices.listItemPermissions(ITEM1_ID);
-        Assert.assertEquals(permissions.size(), 0);
+        Collection<ItemPermissionsEntity> permissions = permissionsServices.listItemPermissions(ITEM1_ID);
+        Assert.assertEquals( 0, permissions.size());
     }
 
 
     @Test
     public void testListItemPermissions() {
-        doReturn(Arrays.asList(
-                createPermissionEntity(ITEM1_ID, USER1_ID, PERMISSION),
-                createPermissionEntity(ITEM1_ID, USER2_ID, PERMISSION)))
-                .when(permissionsDaoMock).listItemPermissions(anyObject());
-
-        Collection<ItemPermissionsEntity> actual =
-                permissionsServices.listItemPermissions(ITEM1_ID);
-        Assert.assertEquals(actual.size(), 2);
+        doReturn(Arrays.asList(createPermissionEntity(ITEM1_ID, USER1_ID, PERMISSION),
+                createPermissionEntity(ITEM1_ID, USER2_ID, PERMISSION))).when(permissionsDaoMock)
+                                                                        .listItemPermissions(anyObject());
+
+        Collection<ItemPermissionsEntity> actual = permissionsServices.listItemPermissions(ITEM1_ID);
+        Assert.assertEquals(2, actual.size());
     }
 
 
@@ -129,10 +143,10 @@ public class PermissionsServicesImplTest {
 
         Assert.assertTrue(result);
 
-  }
+    }
 
-  @Test
-  public void shouldUpdatePermissions(){
+    @Test
+    public void shouldUpdatePermissions() {
 
         Set<String> addedUsers = new HashSet<>();
         addedUsers.add(USER2_ID);
@@ -141,33 +155,31 @@ public class PermissionsServicesImplTest {
 
         verify(permissionsRulesMock).executeAction(ITEM1_ID, USER1_ID, CHANGE_PERMISSIONS);
         verify(permissionsRulesMock).updatePermission(ITEM1_ID, USER1_ID, PERMISSION, addedUsers, new HashSet<>());
-        verify(permissionsDaoMock).updateItemPermissions(ITEM1_ID, PERMISSION, addedUsers, new
-                HashSet<>());
+        verify(permissionsDaoMock).updateItemPermissions(ITEM1_ID, PERMISSION, addedUsers, new HashSet<>());
+    }
+
+    @Test
+    public void shouldExecutePermissionRules() {
+        permissionsServices.execute(ITEM1_ID, USER1_ID, ACTION_SUBMIT);
+        verify(permissionsRulesMock).executeAction(ITEM1_ID, USER1_ID, ACTION_SUBMIT);
     }
 
-  @Test
-  public void shouldExecutePermissionRules(){
-    permissionsServices.execute(ITEM1_ID,USER1_ID,ACTION_SUBMIT);
-    verify(permissionsRulesMock).executeAction(ITEM1_ID,USER1_ID,ACTION_SUBMIT);
-  }
-
-  @Test
-  public void shouldReturnUserItemPermission(){
-    doReturn(Optional.of(PERMISSION)).when(permissionsDaoMock).getUserItemPermission(ITEM1_ID, USER1_ID);
-    Optional<String> actual = permissionsServices.getUserItemPermission(ITEM1_ID, USER1_ID);
-    Assert.assertTrue(actual.isPresent());
-    Assert.assertEquals(actual.get(), PERMISSION);
-  }
-
-  @Test
-  public void shouldDeleteItemPermissions(){
-   permissionsServices.deleteItemPermissions(ITEM1_ID);
-    verify(permissionsDaoMock).deleteItemPermissions(ITEM1_ID);
-  }
-
-
-    private static ItemPermissionsEntity createPermissionEntity(String itemId, String
-            userId, String permission) {
+    @Test
+    public void shouldReturnUserItemPermission() {
+        doReturn(Optional.of(PERMISSION)).when(permissionsDaoMock).getUserItemPermission(ITEM1_ID, USER1_ID);
+        Optional<String> actual = permissionsServices.getUserItemPermission(ITEM1_ID, USER1_ID);
+        Assert.assertTrue(actual.isPresent());
+        Assert.assertEquals(PERMISSION, actual.get());
+    }
+
+    @Test
+    public void shouldDeleteItemPermissions() {
+        permissionsServices.deleteItemPermissions(ITEM1_ID);
+        verify(permissionsDaoMock).deleteItemPermissions(ITEM1_ID);
+    }
+
+
+    private static ItemPermissionsEntity createPermissionEntity(String itemId, String userId, String permission) {
         ItemPermissionsEntity permissionsEntity = new ItemPermissionsEntity();
         permissionsEntity.setItemId(itemId);
         permissionsEntity.setUserId(userId);
index 6bb51c3..fcf8992 100644 (file)
@@ -33,8 +33,9 @@ import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
 import org.mockito.Spy;
 import org.openecomp.sdc.itempermissions.PermissionsServices;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
+import org.junit.Test;
+import org.junit.Before;
+
 
 public class PermissionsFilterTest {
 
@@ -45,7 +46,7 @@ public class PermissionsFilterTest {
     @Spy
     private PermissionsFilter permissionsFilter;
 
-    @BeforeMethod
+    @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
     }
index 1e643fa..3cf91f1 100644 (file)
@@ -1,26 +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.sdc.vendorsoftwareproduct.dao.errors;
 
 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.INVALID_EXTENSION;
 
-import org.junit.Before;
+import org.junit.Assert;
 import org.junit.Test;
 import org.openecomp.sdc.common.errors.ErrorCategory;
 import org.openecomp.sdc.common.errors.ErrorCode;
-import org.testng.Assert;
 
 public class OrchestrationTemplateFileExtensionErrorBuilderTest {
 
-    private OrchestrationTemplateFileExtensionErrorBuilder orchestrationTemplateFileExtensionErrorBuilder;
-
-    @Before
-    public void setUp() {
-        orchestrationTemplateFileExtensionErrorBuilder = new OrchestrationTemplateFileExtensionErrorBuilder();
-    }
-
     @Test
-    public void shouldReturnInvalidExtentionErrorCode(){
+    public void shouldReturnInvalidExtentionErrorCode() {
+        OrchestrationTemplateFileExtensionErrorBuilder orchestrationTemplateFileExtensionErrorBuilder =
+                new OrchestrationTemplateFileExtensionErrorBuilder();
         ErrorCode actual = orchestrationTemplateFileExtensionErrorBuilder.build();
-        Assert.assertEquals(actual.category(), ErrorCategory.APPLICATION);
-        Assert.assertEquals(actual.id(), INVALID_EXTENSION);
+        Assert.assertEquals(ErrorCategory.APPLICATION, actual.category());
+        Assert.assertEquals(INVALID_EXTENSION,actual.id());
     }
 }
index 921881d..150fcc5 100644 (file)
@@ -1,12 +1,28 @@
+/*
+ * 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.sdc.vendorsoftwareproduct.dao.errors;
 
 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.FAILED_TO_CREATE_VSP;
 
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.openecomp.sdc.common.errors.ErrorCategory;
 import org.openecomp.sdc.common.errors.ErrorCode;
-import org.testng.Assert;
+
 
 public class VendorSoftwareProductCreationFailedBuilderTest {
 
@@ -21,7 +37,7 @@ public class VendorSoftwareProductCreationFailedBuilderTest {
     @Test
     public void shouldReturnVspNotFoundErrorCode(){
         ErrorCode actual = vendorSoftwareProductCreationFailedBuilder.build();
-        Assert.assertEquals(actual.category(), ErrorCategory.APPLICATION);
-        Assert.assertEquals(actual.id(), FAILED_TO_CREATE_VSP);
+        Assert.assertEquals(ErrorCategory.APPLICATION, actual.category());
+        Assert.assertEquals(FAILED_TO_CREATE_VSP, actual.id());
     }
 }
index 75e6b1f..9268178 100644 (file)
@@ -1,27 +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.sdc.vendorsoftwareproduct.dao.errors;
 
 import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.VSP_NOT_FOUND;
 
-import org.junit.Before;
+import org.junit.Assert;
 import org.junit.Test;
 import org.openecomp.sdc.common.errors.ErrorCategory;
 import org.openecomp.sdc.common.errors.ErrorCode;
-import org.testng.Assert;
 
 public class VendorSoftwareProductNotFoundErrorBuilderTest {
 
-    private static final String VSP_ID = "testVsp1";
-    private VendorSoftwareProductNotFoundErrorBuilder vendorSoftwareProductNotFoundErrorBuilder;
-
-    @Before
-    public void setUp() {
-        vendorSoftwareProductNotFoundErrorBuilder = new VendorSoftwareProductNotFoundErrorBuilder(VSP_ID);
-    }
-
     @Test
-    public void shouldReturnVspNotFoundErrorCode(){
+    public void shouldReturnVspNotFoundErrorCode() {
+        VendorSoftwareProductNotFoundErrorBuilder vendorSoftwareProductNotFoundErrorBuilder =
+                new VendorSoftwareProductNotFoundErrorBuilder("testVsp1");
         ErrorCode actual = vendorSoftwareProductNotFoundErrorBuilder.build();
-        Assert.assertEquals(actual.category(), ErrorCategory.APPLICATION);
-        Assert.assertEquals(actual.id(), VSP_NOT_FOUND);
+        Assert.assertEquals(ErrorCategory.APPLICATION, actual.category());
+        Assert.assertEquals(VSP_NOT_FOUND, actual.id());
     }
 }