increasing test coverage in openecomp-be api 69/93969/6
authorBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Tue, 20 Aug 2019 13:53:19 +0000 (15:53 +0200)
committerBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Wed, 21 Aug 2019 12:35:38 +0000 (14:35 +0200)
Issue-ID: SDC-2326
Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Change-Id: I93cc5183190fcbada2349b18f14fbec9c28f1ae5

30 files changed:
openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/test/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImplTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictToDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/sdcrests/conflict/rest/mapping/MapItemVersionConflictToDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/test/java/org/openecomp/sdcrests/health/rest/mapping/MapHealthCheckInfoToDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-types/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-types/src/test/java/org/openecomp/sdcrests/health/types/HealthInfoDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-types/src/test/java/org/openecomp/sdcrests/health/types/HealthInfoDtosTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/src/test/java/org/openecomp/sdcrests/itempermissions/types/ItemPermissionsDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/src/test/java/org/openecomp/sdcrests/itempermissions/types/ItemPermissionsRequestDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/ActivityLogDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/ActivityStatusTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/CommitRequestDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/ItemActionRequestDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/ItemCreationDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/ItemDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/RevisionDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/RevisionRequestDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/SubmitRequestDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/VersionActionRequestDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/VersionDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/VersionRequestDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/test/java/org/openecomp/sdcrests/notifications/types/NotificationEntityDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/test/java/org/openecomp/sdcrests/notifications/types/NotificationsStatusDtoTest.java [new file with mode: 0644]
openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/test/java/org/openecomp/sdcrests/notifications/types/UpdateNotificationResponseStatusTest.java [new file with mode: 0644]
openecomp-be/pom.xml

index 034f87e..b1adca2 100644 (file)
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/test/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImplTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/test/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImplTest.java
new file mode 100644 (file)
index 0000000..43ebeab
--- /dev/null
@@ -0,0 +1,123 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.applicationconfig.rest.services;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.openecomp.core.utilities.applicationconfig.dao.type.ApplicationConfigEntity;
+import org.openecomp.core.utilities.applicationconfig.type.ConfigurationData;
+import org.openecomp.sdc.applicationconfig.ApplicationConfigManager;
+import org.openecomp.sdcrests.applicationconfiguration.types.ApplicationConfigDto;
+import org.openecomp.sdcrests.applicationconfiguration.types.ConfigurationDataDto;
+import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper;
+import org.springframework.http.HttpStatus;
+
+import javax.ws.rs.core.Response;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+public class ApplicationConfigurationImplTest {
+
+
+    private ApplicationConfigurationImpl applicationConfiguration;
+
+    @Mock
+    ApplicationConfigManager applicationConfigManager;
+
+    @Before
+    public void setUp() {
+        initMocks(this);
+        applicationConfiguration = new ApplicationConfigurationImpl(applicationConfigManager);
+    }
+
+    @Test
+    public void validateInsertInToTableCallsManagerFunctionWithValidParameters() {
+
+        final String testNamespace = "namespace";
+        final String testKey = "key";
+        final String testValue = "testingValue";
+        final InputStream testInput = new ByteArrayInputStream(testValue.getBytes());
+
+        Response response = applicationConfiguration.insertToTable(testNamespace, testKey, testInput);
+
+        assertEquals(response.getStatus(), HttpStatus.OK.value());
+        verify(applicationConfigManager).insertIntoTable(eq(testNamespace),eq(testKey),eq(testValue));
+    }
+
+    @Test
+    public void validateGetFromTableReturnsValidObject() {
+
+        final String testNamespace = "namespace";
+        final String testKey = "key";
+        final ConfigurationData testValue = new ConfigurationData("testValue", 111);
+
+        when(applicationConfigManager.getFromTable(eq(testNamespace),eq(testKey))).thenReturn(testValue);
+
+        Response response = applicationConfiguration.getFromTable(testNamespace, testKey);
+
+        assertEquals(response.getEntity().getClass(), ConfigurationDataDto.class);
+        assertEquals(((ConfigurationDataDto)response.getEntity()).getValue(),testValue.getValue());
+    }
+
+
+    @Test
+    public void validateGetListOfConfigurationByNamespaceFromTableReturnsValidList() {
+
+        final String testNamespace = "namespace";
+        final ArrayList<ApplicationConfigEntity> testApplicationConfigEntities = new ArrayList<>();
+        final ApplicationConfigEntity testConfigEntity01 = new ApplicationConfigEntity();
+        final String testValue01 = "testValue01";
+        final ApplicationConfigEntity testConfigEntity02 = new ApplicationConfigEntity();
+        final String testValue02 = "testValue02";
+        testConfigEntity01.setValue(testValue01);
+        testConfigEntity02.setValue(testValue02);
+        testApplicationConfigEntities.add(testConfigEntity01);
+        testApplicationConfigEntities.add(testConfigEntity02);
+
+        when(applicationConfigManager.getListOfConfigurationByNamespace(eq(testNamespace)))
+                .thenReturn(testApplicationConfigEntities);
+
+        Response response = applicationConfiguration.getListOfConfigurationByNamespaceFromTable(testNamespace);
+
+        assertEquals(response.getEntity().getClass(), GenericCollectionWrapper.class);
+        assertEquals(
+                ((GenericCollectionWrapper)response.getEntity()).getResults().size(),
+                testApplicationConfigEntities.size()
+        );
+        assertEquals(
+                ((ApplicationConfigDto)response.readEntity(GenericCollectionWrapper.class).getResults().get(0)).getValue(),
+                testApplicationConfigEntities.get(0).getValue()
+        );
+        assertEquals(
+                ((ApplicationConfigDto)response.readEntity(GenericCollectionWrapper.class).getResults().get(1)).getValue(),
+                testApplicationConfigEntities.get(1).getValue()
+        );
+    }
+
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictToDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/sdcrests/conflict/rest/mapping/MapConflictToDtoTest.java
new file mode 100644 (file)
index 0000000..a37be72
--- /dev/null
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.conflict.rest.mapping;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.openecomp.conflicts.types.Conflict;
+import org.openecomp.sdc.datatypes.model.ElementType;
+import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;
+import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
+import org.openecomp.sdcrests.conflict.types.ConflictDto;
+import static org.junit.Assert.assertEquals;
+
+public class MapConflictToDtoTest {
+
+    private MapConflictToDto mapConflictToDto;
+
+    private final String testId = "testId";
+    private final String testName = "testName";
+
+    @Before
+    public void setUp() {
+        mapConflictToDto = new MapConflictToDto();
+    }
+
+    @Test
+    public void validDoMappingIsCorrectForNetworkEntity() {
+        final NetworkEntity testYoursNetworkEntity = new NetworkEntity();
+        testYoursNetworkEntity.setId("YoursId");
+        final NetworkEntity testTheirsNetworkEntity = new NetworkEntity();
+        testTheirsNetworkEntity.setId("TheirsId");
+        final Conflict<NetworkEntity> testConflict = new Conflict<>(testId, ElementType.Network, testName);
+        testConflict.setYours(testYoursNetworkEntity);
+        testConflict.setTheirs(testTheirsNetworkEntity);
+        final ConflictDto testConflictDto = new ConflictDto();
+
+        mapConflictToDto.doMapping(testConflict, testConflictDto);
+
+        assertEquals(testConflict.getId(), testConflictDto.getId());
+        assertEquals(testConflict.getName(), testConflictDto.getName());
+        assertEquals(testConflict.getType(), testConflictDto.getType());
+        assertEquals(testConflict.getYours().getId(), testConflictDto.getYours().get("id"));
+        assertEquals(testConflict.getTheirs().getId(), testConflictDto.getTheirs().get("id"));
+    }
+
+    @Test
+    public void validDoMappingIsCorrectForLicenseAgreement() {
+        final LicenseAgreementEntity testYoursLicenseAgreementEntity = new LicenseAgreementEntity();
+        testYoursLicenseAgreementEntity.setName("YoursName");
+        final LicenseAgreementEntity testTheirsLicenseAgreementEntity = new LicenseAgreementEntity();
+        testTheirsLicenseAgreementEntity.setName("TheirsName");
+        final Conflict<LicenseAgreementEntity> testConflict = new Conflict<>(testId, ElementType.LicenseAgreement, testName);
+        testConflict.setYours(testYoursLicenseAgreementEntity);
+        testConflict.setTheirs(testTheirsLicenseAgreementEntity);
+        final ConflictDto testConflictDto = new ConflictDto();
+
+        mapConflictToDto.doMapping(testConflict, testConflictDto);
+
+        assertEquals(testConflict.getId(), testConflictDto.getId());
+        assertEquals(testConflict.getName(), testConflictDto.getName());
+        assertEquals(testConflict.getType(), testConflictDto.getType());
+        assertEquals(testConflict.getYours().getName(), testConflictDto.getYours().get("name"));
+        assertEquals(testConflict.getTheirs().getName(), testConflictDto.getTheirs().get("name"));
+    }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/sdcrests/conflict/rest/mapping/MapItemVersionConflictToDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/sdcrests/conflict/rest/mapping/MapItemVersionConflictToDtoTest.java
new file mode 100644 (file)
index 0000000..0f1a007
--- /dev/null
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.conflict.rest.mapping;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.conflicts.types.ConflictInfo;
+import org.openecomp.conflicts.types.ItemVersionConflict;
+import org.openecomp.sdc.datatypes.model.ElementType;
+import org.openecomp.sdcrests.conflict.types.ConflictInfoDto;
+import org.openecomp.sdcrests.conflict.types.ItemVersionConflictDto;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+public class MapItemVersionConflictToDtoTest {
+
+    private MapItemVersionConflictToDto mapItemVersionConflictToDto;
+
+
+    @Before
+    public void setUp() {
+        mapItemVersionConflictToDto = new MapItemVersionConflictToDto();
+    }
+
+    @Test
+    public void validDoMappingCorrectMapsVersionConflicts() {
+
+        final String testId01 = "testId01";
+        final String testName01 = "testName01";
+        final String testId02 = "testId02";
+        final String testName02 = "testName02";
+
+        final ItemVersionConflict testSource = new ItemVersionConflict();
+        Collections.addAll(testSource.getElementConflicts(),
+                new ConflictInfo(testId01, ElementType.itemVersion, testName01),
+                new ConflictInfo(testId02, ElementType.itemVersion, testName02)
+        );
+        final ItemVersionConflictDto testTarget = new ItemVersionConflictDto();
+
+        mapItemVersionConflictToDto.doMapping(testSource, testTarget);
+
+        assertArrayEquals(
+                testSource.getElementConflicts().stream().map(ConflictInfo::getName).toArray(),
+                testTarget.getConflictInfoList().stream().map(ConflictInfoDto::getName).toArray()
+        );
+        assertArrayEquals(
+                testSource.getElementConflicts().stream().map(ConflictInfo::getId).toArray(),
+                testTarget.getConflictInfoList().stream().map(ConflictInfoDto::getId).toArray()
+        );
+    }
+}
index a3054b1..2d88272 100644 (file)
             <artifactId>cxf-rt-frontend-jaxrs</artifactId>
             <version>${cxf.version}</version>
         </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
 
     </dependencies>
 
 
-</project>
\ No newline at end of file
+</project>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/test/java/org/openecomp/sdcrests/health/rest/mapping/MapHealthCheckInfoToDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/test/java/org/openecomp/sdcrests/health/rest/mapping/MapHealthCheckInfoToDtoTest.java
new file mode 100644 (file)
index 0000000..7c1ab83
--- /dev/null
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.health.rest.mapping;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.sdc.health.data.HealthCheckStatus;
+import org.openecomp.sdc.health.data.HealthInfo;
+import org.openecomp.sdc.health.data.MonitoredModules;
+import org.openecomp.sdcrests.health.types.HealthInfoDto;
+import org.openecomp.sdcrests.health.types.HealthInfoDtos;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+public class MapHealthCheckInfoToDtoTest {
+
+    private MapHealthCheckInfoToDto mapHealthCheckInfoToDto;
+
+    @Before
+    public void setUp() {
+        mapHealthCheckInfoToDto = new MapHealthCheckInfoToDto();
+    }
+
+    @Test
+    public void validateDoMappingCorrectMapsHealthInfoToHealthInfoDto() {
+
+        final HealthInfo healthInfo = new HealthInfo(MonitoredModules.BE, HealthCheckStatus.UP, "1.0", "test");
+        List<HealthInfo> testSource = Collections.singletonList(healthInfo);
+
+        HealthInfoDtos testTarget = new HealthInfoDtos();
+
+        mapHealthCheckInfoToDto.doMapping(testSource ,testTarget);
+
+        final HealthInfo sourceElement = testSource.get(0);
+        final HealthInfoDto responceElement = testTarget.getHealthInfos().get(0);
+        assertEquals(sourceElement.getDescription(),responceElement.getDescription());
+        assertEquals(sourceElement.getHealthCheckStatus().toString(),responceElement.getHealthStatus().toString());
+        assertEquals(sourceElement.getVersion(),responceElement.getVersion());
+        assertEquals(sourceElement.getHealthCheckComponent().toString(),responceElement.getHealthCheckComponent().toString());
+    }
+}
index 6b7059e..0d23c84 100644 (file)
@@ -3,6 +3,13 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
 
     <parent>
         <groupId>org.openecomp.sdc</groupId>
@@ -12,4 +19,4 @@
 
     <artifactId>healthcheck-rest-types</artifactId>
 
-</project>
\ No newline at end of file
+</project>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-types/src/test/java/org/openecomp/sdcrests/health/types/HealthInfoDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-types/src/test/java/org/openecomp/sdcrests/health/types/HealthInfoDtoTest.java
new file mode 100644 (file)
index 0000000..1b270aa
--- /dev/null
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.health.types;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class HealthInfoDtoTest {
+
+    @Test
+    public void testBean() {
+        assertThat(HealthInfoDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-types/src/test/java/org/openecomp/sdcrests/health/types/HealthInfoDtosTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-types/src/test/java/org/openecomp/sdcrests/health/types/HealthInfoDtosTest.java
new file mode 100644 (file)
index 0000000..259548a
--- /dev/null
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.health.types;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class HealthInfoDtosTest {
+
+    @Test
+    public void testBean() {
+        assertThat(HealthInfoDtos.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+
+}
index 5249403..f7b228a 100644 (file)
@@ -9,6 +9,12 @@
             <artifactId>swagger-annotations</artifactId>
             <version>${swagger.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-api</artifactId>
+            <version>5.3.1</version>
+            <scope>test</scope>
+        </dependency>
 
     </dependencies>
 
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/src/test/java/org/openecomp/sdcrests/itempermissions/types/ItemPermissionsDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/src/test/java/org/openecomp/sdcrests/itempermissions/types/ItemPermissionsDtoTest.java
new file mode 100644 (file)
index 0000000..82570b2
--- /dev/null
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.itempermissions.types;
+
+import org.junit.jupiter.api.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class ItemPermissionsDtoTest {
+
+
+    @Test
+    public void testBean() {
+        assertThat(ItemPermissionsDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/src/test/java/org/openecomp/sdcrests/itempermissions/types/ItemPermissionsRequestDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-permissions-rest/item-permissions-rest-types/src/test/java/org/openecomp/sdcrests/itempermissions/types/ItemPermissionsRequestDtoTest.java
new file mode 100644 (file)
index 0000000..94ce4c1
--- /dev/null
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.itempermissions.types;
+
+import org.junit.jupiter.api.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class ItemPermissionsRequestDtoTest {
+
+    @Test
+    public void testBean() {
+        assertThat(ItemPermissionsRequestDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+
+}
index f3b5dbf..0a368df 100644 (file)
             <artifactId>openecomp-sdc-conflict-manager</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-api</artifactId>
+            <version>5.3.1</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
 
-</project>
\ No newline at end of file
+</project>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/ActivityLogDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/ActivityLogDtoTest.java
new file mode 100644 (file)
index 0000000..8a740e2
--- /dev/null
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.item.types;
+
+import org.junit.jupiter.api.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class ActivityLogDtoTest {
+    @Test
+    void testBean() {
+        assertThat(ActivityLogDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/ActivityStatusTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/ActivityStatusTest.java
new file mode 100644 (file)
index 0000000..b643e71
--- /dev/null
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.item.types;
+
+import org.junit.jupiter.api.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class ActivityStatusTest {
+
+    @Test
+    void testBean() {
+        assertThat(ActivityStatus.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+
+    @Test
+    void validateArgConstructors() {
+
+        final String testMessage = "testMessage";
+
+        ActivityStatus activityStatus = new ActivityStatus(false);
+        assertEquals(activityStatus.isSuccess(),false);
+
+        activityStatus = new ActivityStatus(true,testMessage);
+        assertEquals(activityStatus.isSuccess(),true);
+        assertEquals(activityStatus.getMessage(), testMessage);
+    }
+
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/CommitRequestDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/CommitRequestDtoTest.java
new file mode 100644 (file)
index 0000000..8eb1b5e
--- /dev/null
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.item.types;
+
+import org.junit.jupiter.api.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class CommitRequestDtoTest {
+    @Test
+    void testBean() {
+        assertThat(CommitRequestDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/ItemActionRequestDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/ItemActionRequestDtoTest.java
new file mode 100644 (file)
index 0000000..9933e81
--- /dev/null
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.item.types;
+
+import org.junit.jupiter.api.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class ItemActionRequestDtoTest {
+    @Test
+    void testBean() {
+        assertThat(ItemActionRequestDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/ItemCreationDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/ItemCreationDtoTest.java
new file mode 100644 (file)
index 0000000..e3050b1
--- /dev/null
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.item.types;
+
+import org.junit.jupiter.api.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class ItemCreationDtoTest {
+    @Test
+    void testBean() {
+        assertThat(ItemCreationDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/ItemDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/ItemDtoTest.java
new file mode 100644 (file)
index 0000000..742b60a
--- /dev/null
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.item.types;
+
+import org.junit.jupiter.api.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class ItemDtoTest {
+    @Test
+    void testBean() {
+        assertThat(ItemDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/RevisionDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/RevisionDtoTest.java
new file mode 100644 (file)
index 0000000..7928724
--- /dev/null
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.item.types;
+
+import org.junit.jupiter.api.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class RevisionDtoTest {
+    @Test
+    void testBean() {
+        assertThat(RevisionDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/RevisionRequestDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/RevisionRequestDtoTest.java
new file mode 100644 (file)
index 0000000..bef452b
--- /dev/null
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.item.types;
+
+import org.junit.jupiter.api.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class RevisionRequestDtoTest {
+    @Test
+    void testBean() {
+        assertThat(RevisionRequestDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/SubmitRequestDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/SubmitRequestDtoTest.java
new file mode 100644 (file)
index 0000000..94987de
--- /dev/null
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.item.types;
+
+import org.junit.jupiter.api.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class SubmitRequestDtoTest {
+    @Test
+    void testBean() {
+        assertThat(SubmitRequestDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/VersionActionRequestDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/VersionActionRequestDtoTest.java
new file mode 100644 (file)
index 0000000..94d9e37
--- /dev/null
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.item.types;
+
+import org.junit.jupiter.api.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class VersionActionRequestDtoTest {
+    @Test
+    void testBean() {
+        assertThat(VersionActionRequestDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/VersionDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/VersionDtoTest.java
new file mode 100644 (file)
index 0000000..50db26b
--- /dev/null
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.item.types;
+
+import org.junit.jupiter.api.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class VersionDtoTest {
+    @Test
+    void testBean() {
+        assertThat(VersionDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/VersionRequestDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/test/java/org/openecomp/sdcrests/item/types/VersionRequestDtoTest.java
new file mode 100644 (file)
index 0000000..20d651d
--- /dev/null
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.item.types;
+
+import org.junit.jupiter.api.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class VersionRequestDtoTest {
+    @Test
+    void testBean() {
+        assertThat(VersionRequestDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+}
index 76b6fcf..03ff748 100644 (file)
@@ -9,6 +9,12 @@
             <artifactId>openecomp-sdc-datatypes-lib</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-api</artifactId>
+            <version>5.3.1</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <parent>
@@ -20,4 +26,4 @@
     <artifactId>notifications-rest-types</artifactId>
 
 
-</project>
\ No newline at end of file
+</project>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/test/java/org/openecomp/sdcrests/notifications/types/NotificationEntityDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/test/java/org/openecomp/sdcrests/notifications/types/NotificationEntityDtoTest.java
new file mode 100644 (file)
index 0000000..e9e2bee
--- /dev/null
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.notifications.types;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.UUID;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class NotificationEntityDtoTest {
+    @Test
+    void testBean() {
+        assertThat(NotificationEntityDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+    @Test
+    void validateArgConstructors() {
+
+        final boolean read = false;
+        final UUID eventId = new UUID(10,20);
+        final String eventType = "testType";
+        final Map<String, Object> eventAttributes = Collections.singletonMap("testKey","testValue");
+        NotificationEntityDto notificationEntityDto = new NotificationEntityDto(read,eventId,eventType,eventAttributes);
+        assertEquals(notificationEntityDto.isRead(), read);
+        assertEquals(notificationEntityDto.getEventId(), eventId);
+        assertEquals(notificationEntityDto.getEventType(), eventType);
+        assertEquals(notificationEntityDto.getEventAttributes(), eventAttributes);
+
+        final String dataTime = "10-10-2019";
+        notificationEntityDto = new NotificationEntityDto(read, eventId, eventType, eventAttributes, dataTime);
+        assertEquals(notificationEntityDto.isRead(), read);
+        assertEquals(notificationEntityDto.getEventId(), eventId);
+        assertEquals(notificationEntityDto.getEventType(), eventType);
+        assertEquals(notificationEntityDto.getEventAttributes(), eventAttributes);
+        assertEquals(notificationEntityDto.getDateTime(), dataTime);
+    }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/test/java/org/openecomp/sdcrests/notifications/types/NotificationsStatusDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/test/java/org/openecomp/sdcrests/notifications/types/NotificationsStatusDtoTest.java
new file mode 100644 (file)
index 0000000..fe236f3
--- /dev/null
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.notifications.types;
+
+import org.junit.jupiter.api.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class NotificationsStatusDtoTest {
+    @Test
+    void testBean() {
+        assertThat(NotificationsStatusDto.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/test/java/org/openecomp/sdcrests/notifications/types/UpdateNotificationResponseStatusTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-rest/notifications-rest-types/src/test/java/org/openecomp/sdcrests/notifications/types/UpdateNotificationResponseStatusTest.java
new file mode 100644 (file)
index 0000000..20d23fb
--- /dev/null
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdcrests.notifications.types;
+
+import org.junit.jupiter.api.Test;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class UpdateNotificationResponseStatusTest {
+    @Test
+    void testBean() {
+        assertThat(UpdateNotificationResponseStatus.class,  allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+    @Test
+    void validateAddStructureErrorCorrectlyAddsOneError() {
+        UpdateNotificationResponseStatus updateNotificationResponseStatus = new UpdateNotificationResponseStatus();
+
+        assertTrue(updateNotificationResponseStatus.getErrors().isEmpty());
+        final String notificationId = "testId";
+        final ErrorMessage testError = new ErrorMessage(ErrorLevel.ERROR,"test Error");
+        updateNotificationResponseStatus.addStructureError(notificationId, testError);
+
+        assertFalse(updateNotificationResponseStatus.getErrors().isEmpty());
+        assertEquals(updateNotificationResponseStatus.getErrors().size(),1);
+        assertEquals(updateNotificationResponseStatus.getErrors().get(notificationId).size(),1);
+        assertEquals(updateNotificationResponseStatus.getErrors().get(notificationId).get(0),testError);
+    }
+    @Test
+    void validateAddStructureErrorCorrectlyAddsTwoErrorsToOneKey() {
+        UpdateNotificationResponseStatus updateNotificationResponseStatus = new UpdateNotificationResponseStatus();
+
+        assertTrue(updateNotificationResponseStatus.getErrors().isEmpty());
+        final String notificationId = "testId";
+        final ErrorMessage testError01 = new ErrorMessage(ErrorLevel.ERROR,"test Error01");
+        final ErrorMessage testError02 = new ErrorMessage(ErrorLevel.ERROR,"test Error02");
+        final List<ErrorMessage > testErrorsList = new ArrayList<>();
+        Collections.addAll(testErrorsList,testError01,testError02);
+        updateNotificationResponseStatus.addStructureError(notificationId, testError01);
+        updateNotificationResponseStatus.addStructureError(notificationId, testError02);
+
+        assertFalse(updateNotificationResponseStatus.getErrors().isEmpty());
+        assertEquals(updateNotificationResponseStatus.getErrors().size(),1);
+        assertEquals(updateNotificationResponseStatus.getErrors().get(notificationId).size(),2);
+        assertArrayEquals(updateNotificationResponseStatus.getErrors().get(notificationId).toArray(), testErrorsList.toArray());
+    }
+    @Test
+    void validateAddStructureErrorCorrectlyAddsTwoErrorsToTwoKeys() {
+        UpdateNotificationResponseStatus updateNotificationResponseStatus = new UpdateNotificationResponseStatus();
+
+        assertTrue(updateNotificationResponseStatus.getErrors().isEmpty());
+        final String notificationId01 = "testId01";
+        final ErrorMessage testError01 = new ErrorMessage(ErrorLevel.ERROR,"test Error01");
+        final String notificationId02 = "testId02";
+        final ErrorMessage testError02 = new ErrorMessage(ErrorLevel.ERROR,"test Error02");
+        updateNotificationResponseStatus.addStructureError(notificationId01, testError01);
+        updateNotificationResponseStatus.addStructureError(notificationId02, testError02);
+
+        assertFalse(updateNotificationResponseStatus.getErrors().isEmpty());
+        assertEquals(updateNotificationResponseStatus.getErrors().size(),2);
+        assertEquals(updateNotificationResponseStatus.getErrors().get(notificationId01).size(),1);
+        assertEquals(updateNotificationResponseStatus.getErrors().get(notificationId01).get(0), testError01);
+        assertEquals(updateNotificationResponseStatus.getErrors().get(notificationId02).size(),1);
+        assertEquals(updateNotificationResponseStatus.getErrors().get(notificationId02).get(0), testError02);
+    }
+}
index 9e6a01c..8a5f990 100644 (file)
     </parent>
 
     <dependencies>
+
+        <dependency>
+            <groupId>com.google.code.bean-matchers</groupId>
+            <artifactId>bean-matchers</artifactId>
+            <version>${bean-matchers.version}</version>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.togglz</groupId>
             <artifactId>togglz-core</artifactId>