diff options
27 files changed, 124 insertions, 121 deletions
diff --git a/asdctool/pom.xml b/asdctool/pom.xml index 2c419bce99..ef9ff17766 100644 --- a/asdctool/pom.xml +++ b/asdctool/pom.xml @@ -512,12 +512,6 @@ </dependency> <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>${testng.version}</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>com.github.testng-team</groupId> <artifactId>testng-junit5</artifactId> <version>0.0.1</version> diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/core/DBVersion.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/core/DBVersion.java index 17c3aea42c..a18ea69c4e 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/core/DBVersion.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/migration/core/DBVersion.java @@ -21,14 +21,16 @@ package org.openecomp.sdc.asdctool.migration.core; import java.math.BigInteger; +import lombok.Getter; +@Getter public class DBVersion implements Comparable<DBVersion>{ private static final String VERSION_PARTS_SEPARATOR = "\\."; private static final int MAJOR_PART_IDX = 0; private static final int MINOR_PART_IDX = 1; - private BigInteger major; - private BigInteger minor; + private final BigInteger major; + private final BigInteger minor; /** * The current db version. should be tested against real db to verify it is compatible to the db version @@ -45,14 +47,6 @@ public class DBVersion implements Comparable<DBVersion>{ this.minor = BigInteger.valueOf(minor); } - public BigInteger getMajor() { - return major; - } - - public BigInteger getMinor() { - return minor; - } - public static DBVersion from(BigInteger major, BigInteger minor) { return new DBVersion(major, minor); } diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java index bffc0daee1..c2a8a561d8 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java @@ -22,11 +22,11 @@ package org.openecomp.sdc.asdctool.impl; import org.junit.Test; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.openecomp.sdc.asdctool.impl.GraphMLDataAnalyzer.EXCEL_EXTENSION; import static org.openecomp.sdc.asdctool.impl.GraphMLDataAnalyzer.GRAPH_ML_EXTENSION; -import static org.testng.AssertJUnit.assertNotNull; public class GraphMLDataAnalyzerTest { diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutorContract.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutorContract.java index 3a325fcb09..21a931cc86 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutorContract.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutorContract.java @@ -20,6 +20,7 @@ package org.openecomp.sdc.asdctool.impl.validator.executor; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.mockito.Mockito.mock; import java.util.HashMap; @@ -34,7 +35,6 @@ import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; -import org.testng.Assert; public interface ArtifactValidatorExecutorContract { @@ -70,6 +70,6 @@ public interface ArtifactValidatorExecutorContract { // Initially no outputFilePath was passed to this function (hence it is set to null) // TODO: Fix this null and see if the argument is used by this function - Assert.assertFalse(testSubject.validate(vertices, null)); + assertFalse(testSubject.validate(vertices, null)); } } diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/DBVersionTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/DBVersionTest.java index 54c5829e8d..c69cb45fc3 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/DBVersionTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/DBVersionTest.java @@ -7,9 +7,9 @@ * 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. @@ -20,57 +20,60 @@ package org.openecomp.sdc.asdctool.migration.core; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; -public class DBVersionTest { +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +public class DBVersionTest { - @DataProvider(name = "invalidVersionStringsProvider") - private Object[][] invalidVersionStringsProvider() { - return new Object[][] { - {"1.1.1"}, - {"1.a"}, - {"a.1"}, - {"1"} + public static Object[][] invalidVersionStringsProvider() { + return new Object[][]{ + {"1.1.1"}, + {"1.a"}, + {"a.1"}, + {"1"} }; } - @Test(dataProvider = "invalidVersionStringsProvider", expectedExceptions = MigrationException.class) + @ParameterizedTest + @MethodSource("invalidVersionStringsProvider") public void testFromString_invalidVersionString(String invalidVersion) { - DBVersion.fromString(invalidVersion); + assertThrows(MigrationException.class, () -> { + DBVersion.fromString(invalidVersion); + }); } - @DataProvider(name = "validVersionStringsProvider") - private Object[][] validVersionStringsProvider() { - return new Object[][] { - {"1.1", "1.1"}, - {"10100.0001", "10100.1"}, - {"000.1", "0.1"}, - {"01.00001000", "1.1000"}, + public static Object[][] validVersionStringsProvider() { + return new Object[][]{ + {"1.1", "1.1"}, + {"10100.0001", "10100.1"}, + {"000.1", "0.1"}, + {"01.00001000", "1.1000"}, }; } - @Test(dataProvider = "validVersionStringsProvider") + @ParameterizedTest + @MethodSource("validVersionStringsProvider") public void testFromString(String validString, String expectedVersionString) { assertEquals(expectedVersionString, DBVersion.fromString(validString).toString()); } - @DataProvider(name = "versionComparisionProvider") public static Object[][] versionComparisionProvider() { - return new Object[][] { - {"1.1", "001.00001", 0}, - {"10.1", "0010.00001", 0}, - {"1.1", "001.000010", -1}, - {"1.1", "0010.00001", -1}, - {"10.10", "0010.00001", 1}, - {"1.1", "001.00", 1}, + return new Object[][]{ + {"1.1", "001.00001", 0}, + {"10.1", "0010.00001", 0}, + {"1.1", "001.000010", -1}, + {"1.1", "0010.00001", -1}, + {"10.10", "0010.00001", 1}, + {"1.1", "001.00", 1}, }; } - @Test(dataProvider = "versionComparisionProvider") + @ParameterizedTest + @MethodSource("versionComparisionProvider") public void testVersionCompareTo2(String firstVersion, String otherVersion, int expectedComparisionResult) { assertEquals(DBVersion.fromString(firstVersion).compareTo(DBVersion.fromString(otherVersion)), expectedComparisionResult); } diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/execution/MigrationExecutorImplTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/execution/MigrationExecutorImplTest.java index b9469afc16..b547aef2f9 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/execution/MigrationExecutorImplTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/execution/MigrationExecutorImplTest.java @@ -20,13 +20,13 @@ package org.openecomp.sdc.asdctool.migration.core.execution; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import org.junit.jupiter.api.Test; import org.openecomp.sdc.asdctool.migration.DummyMigrationFactory; import org.openecomp.sdc.asdctool.migration.core.task.Migration; import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult; -import org.testng.annotations.Test; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; public class MigrationExecutorImplTest { diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolverTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolverTest.java index a169e6f752..0c22bfbc15 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolverTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolverTest.java @@ -20,10 +20,10 @@ package org.openecomp.sdc.asdctool.migration.resolver; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; import java.util.Arrays; import java.util.Collections; diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/service/SdcRepoServiceTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/service/SdcRepoServiceTest.java index e260464669..e09538dd8c 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/service/SdcRepoServiceTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/service/SdcRepoServiceTest.java @@ -20,9 +20,9 @@ package org.openecomp.sdc.asdctool.migration.service; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.testng.Assert.assertEquals; import java.math.BigInteger; import org.junit.jupiter.api.Test; diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/task/MigrationTasksTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/task/MigrationTasksTest.java index 138abf3c83..198d36e62b 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/task/MigrationTasksTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/task/MigrationTasksTest.java @@ -20,13 +20,14 @@ package org.openecomp.sdc.asdctool.migration.task; +import static org.junit.jupiter.api.Assertions.fail; + import org.apache.commons.lang.StringUtils; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.openecomp.sdc.asdctool.migration.core.DBVersion; import org.openecomp.sdc.asdctool.migration.core.task.Migration; import org.openecomp.sdc.asdctool.migration.scanner.ClassScanner; -import org.testng.Assert; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; import java.util.Collection; import java.util.List; @@ -40,7 +41,7 @@ public class MigrationTasksTest { public static final String MIGRATIONS_BASE_PACKAGE = "org.openecomp.sdc.asdctool.migration.tasks"; private List<Migration> migrations; - @BeforeMethod + @BeforeEach public void setUp() throws Exception { ClassScanner classScanner = new ClassScanner(); migrations = classScanner.getAllClassesOfType(MIGRATIONS_BASE_PACKAGE, Migration.class); @@ -52,7 +53,7 @@ public class MigrationTasksTest { migrationsByVersion.forEach((version, migrations) -> { if (migrations.size() > 1) { System.out.println(String.format("the following migration tasks have the same version %s. versions must be unique", version.toString())); - Assert.fail(String.format("migration tasks %s has same version %s. migration tasks versions must be unique.", getMigrationsNameAsString(migrations), version.toString())); + fail(String.format("migration tasks %s has same version %s. migration tasks versions must be unique.", getMigrationsNameAsString(migrations), version.toString())); } }); } @@ -63,7 +64,7 @@ public class MigrationTasksTest { .collect(Collectors.toSet()); if (!migrationsWithVersionsGreaterThanCurrent.isEmpty()) { - Assert.fail(String.format("migrations tasks %s have version which is greater than DBVersion.DEFAULT_VERSION %s. did you forget to update current version?", + fail(String.format("migrations tasks %s have version which is greater than DBVersion.DEFAULT_VERSION %s. did you forget to update current version?", getMigrationsNameAsString(migrationsWithVersionsGreaterThanCurrent), DBVersion.DEFAULT_VERSION.toString())); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml index 1f6b8aecfd..25e403119a 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml @@ -49,6 +49,12 @@ <artifactId>openecomp-sdc-item-permissions-manager</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>${testng.version}</version> + <scope>test</scope> + </dependency> <!-- CXF --> <dependency> diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerImplTest.java index 2755edeafd..f214e69dbe 100644 --- a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerImplTest.java @@ -16,14 +16,14 @@ package org.openecomp.sdc.itempermissions.dao.impl; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.ITEM_ID_PROP; import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_CHANGED; import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_GRANTED; import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.PERMISSION_ITEM; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; import java.util.Collections; import java.util.HashSet; diff --git a/openecomp-be/lib/openecomp-common-lib/src/test/java/org/openecomp/sdc/common/utils/CommonUtilTest.java b/openecomp-be/lib/openecomp-common-lib/src/test/java/org/openecomp/sdc/common/utils/CommonUtilTest.java index e08238aa1f..e8b6efa683 100644 --- a/openecomp-be/lib/openecomp-common-lib/src/test/java/org/openecomp/sdc/common/utils/CommonUtilTest.java +++ b/openecomp-be/lib/openecomp-common-lib/src/test/java/org/openecomp/sdc/common/utils/CommonUtilTest.java @@ -20,20 +20,20 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.onap.sdc.tosca.services.CommonUtil.DEFAULT; import static org.onap.sdc.tosca.services.CommonUtil.UNDERSCORE_DEFAULT; -import static org.testng.Assert.assertTrue; import com.google.common.io.Files; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; +import org.junit.Test; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.zip.exception.ZipException; -import org.testng.annotations.Test; public class CommonUtilTest { private static final String VALID_ZIP_FILE_PATH = "src/test/resources/valid.zip"; @@ -70,7 +70,7 @@ public class CommonUtilTest { assertThat(fch.containsFile("file.two.yaml"), is(true)); } - @Test(expectedExceptions={CoreException.class}) + @Test(expected=CoreException.class) public void testValidateNoFolders() throws IOException { byte[] file = getFileAsBytes(VALID_ZIP_WITH_DIR_FILE_PATH); diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/test/java/org/openecomp/core/util/UniqueValueUtilTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/test/java/org/openecomp/core/util/UniqueValueUtilTest.java index 72ae4e7227..9b8228d94c 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/test/java/org/openecomp/core/util/UniqueValueUtilTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/test/java/org/openecomp/core/util/UniqueValueUtilTest.java @@ -19,6 +19,9 @@ package org.openecomp.core.util; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -29,7 +32,6 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.openecomp.core.dao.UniqueValueDao; import org.openecomp.core.dao.types.UniqueValueEntity; import org.openecomp.sdc.common.errors.CoreException; -import org.testng.Assert; @ExtendWith(MockitoExtension.class) class UniqueValueUtilTest { @@ -111,12 +113,12 @@ class UniqueValueUtilTest { @Test void testIsUniqueValueOccupied() { Mockito.when(uniqueValueDao.get(Mockito.any())).thenReturn(new UniqueValueEntity()); - Assert.assertTrue(uniqueValueUtil.isUniqueValueOccupied(ENTITLEMENT_POOL_NAME, ORIGINAL_ENTITY_NAME)); + assertTrue(uniqueValueUtil.isUniqueValueOccupied(ENTITLEMENT_POOL_NAME, ORIGINAL_ENTITY_NAME)); } @Test void testIsUniqueValueOccupiedFalse() { Mockito.when(uniqueValueDao.get(Mockito.any())).thenReturn(null); - Assert.assertFalse(uniqueValueUtil.isUniqueValueOccupied(ENTITLEMENT_POOL_NAME, ORIGINAL_ENTITY_NAME)); + assertFalse(uniqueValueUtil.isUniqueValueOccupied(ENTITLEMENT_POOL_NAME, ORIGINAL_ENTITY_NAME)); } } diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/LastSeenNotificationEntityTest.java b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/LastSeenNotificationEntityTest.java index 823a7f2166..dc2f2d3126 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/LastSeenNotificationEntityTest.java +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/LastSeenNotificationEntityTest.java @@ -16,11 +16,13 @@ package org.openecomp.sdc.notification.dao.types; -import org.testng.annotations.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import java.util.UUID; +import org.junit.jupiter.api.Test; -import static org.testng.Assert.*; /** * @author EVITALIY diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/NotificationEntityTest.java b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/NotificationEntityTest.java index eff4d24995..4089ebf12f 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/NotificationEntityTest.java +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/NotificationEntityTest.java @@ -16,12 +16,12 @@ package org.openecomp.sdc.notification.dao.types; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import java.util.UUID; +import org.junit.jupiter.api.Test; -import org.testng.annotations.Test; /** * @author EVITALIY diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/SubscribersEntityTest.java b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/SubscribersEntityTest.java index b5761dcc72..023294bf8b 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/SubscribersEntityTest.java +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/SubscribersEntityTest.java @@ -16,15 +16,16 @@ package org.openecomp.sdc.notification.dao.types; -import org.testng.annotations.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.util.UUID; +import org.junit.jupiter.api.Test; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotEquals; /** * @author EVITALIY diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java index 5b04c6c6f8..37174a91e7 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java @@ -16,11 +16,14 @@ package org.openecomp.sdc.heat.services.tree; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +import org.junit.jupiter.api.Test; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree; -import org.testng.Assert; -import org.testng.annotations.Test; import java.io.File; import java.io.FileInputStream; @@ -50,8 +53,8 @@ public class HeatTreeManagerTest { HeatTreeManager heatTreeManager = HeatTreeManagerUtil.initHeatTreeManager(fileContentMap); heatTreeManager.createTree(); HeatStructureTree tree = heatTreeManager.getTree(); - Assert.assertNotNull(tree); - Assert.assertEquals(tree.getHeat().size(), 2); + assertNotNull(tree); + assertEquals(tree.getHeat().size(), 2); } @Test @@ -74,8 +77,8 @@ public class HeatTreeManagerTest { HeatTreeManager heatTreeManager = HeatTreeManagerUtil.initHeatTreeManager(fileContentMap); heatTreeManager.createTree(); HeatStructureTree tree = heatTreeManager.getTree(); - Assert.assertNotNull(tree); - Assert.assertEquals(tree.getHeat().size(), 3); + assertNotNull(tree); + assertEquals(tree.getHeat().size(), 3); verifyHeatArtifacts(tree, "ocgmgr.yaml", 1); verifyHeatArtifacts(tree, "ocgapp.yaml", 0); verifyHeatArtifacts(tree, "base_ocg.yaml", 0); @@ -84,12 +87,12 @@ public class HeatTreeManagerTest { private void verifyHeatArtifacts(HeatStructureTree tree, String heatName, int expectedArtifactNum ) { HeatStructureTree heat = HeatStructureTree.getHeatStructureTreeByName(tree.getHeat(), heatName); - Assert.assertNotNull(heat); + assertNotNull(heat); if (expectedArtifactNum > 0) { - Assert.assertNotNull(heat.getArtifacts()); - Assert.assertEquals(heat.getArtifacts().size(), expectedArtifactNum); + assertNotNull(heat.getArtifacts()); + assertEquals(heat.getArtifacts().size(), expectedArtifactNum); } else { - Assert.assertNull(heat.getArtifacts()); + assertNull(heat.getArtifacts()); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/base/ResourceBaseValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/base/ResourceBaseValidatorTest.java index ec39ead030..35a8c00ee9 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/base/ResourceBaseValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/base/ResourceBaseValidatorTest.java @@ -15,19 +15,20 @@ */ package org.openecomp.sdc.validation.base; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + import org.apache.commons.collections4.MapUtils; +import org.junit.jupiter.api.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration; import org.openecomp.sdc.validation.type.ConfigConstants; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; import java.util.Collections; import java.util.HashMap; import java.util.Map; -@Test public class ResourceBaseValidatorTest { private String testValidator = "testValidator"; @@ -36,7 +37,7 @@ private String testValidator = "testValidator"; ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); Map<String, MessageContainer> messages = ValidationTestUtil.testValidator( resourceBaseValidator, "/InvalidResourceType"); - Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), + assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), "WARNING: [RBV1]: A resource has an invalid or unsupported type - null, " + "Resource ID [FSB2]"); } @@ -46,7 +47,7 @@ private String testValidator = "testValidator"; ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(resourceBaseValidator, "/InvalidHeatStructure"); - Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), + assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), "ERROR: [RBV2]: Invalid HEAT format problem - [while scanning for the next " + "token\n" + "found character '\\t(TAB)' that cannot start any token. " + "(Do not use \\t(TAB) for indentation)\n" + @@ -62,7 +63,7 @@ private String testValidator = "testValidator"; Map<String, Object> properties = new HashMap<>(); resourceBaseValidator.init(properties); - Assert.assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); + assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); } @Test @@ -72,8 +73,8 @@ private String testValidator = "testValidator"; Map<String, ImplementationConfiguration> resourceTypeToImpl = resourceBaseValidator.getResourceTypeToImpl(); - Assert.assertTrue(MapUtils.isNotEmpty(resourceTypeToImpl)); - Assert.assertTrue(resourceTypeToImpl.containsKey(testValidator)); + assertTrue(MapUtils.isNotEmpty(resourceTypeToImpl)); + assertTrue(resourceTypeToImpl.containsKey(testValidator)); } @Test @@ -84,7 +85,7 @@ private String testValidator = "testValidator"; resourceBaseValidator.init(properties); - Assert.assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); + assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); } @Test @@ -92,7 +93,7 @@ private String testValidator = "testValidator"; ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); initProperties(resourceBaseValidator, new HashMap<>()); - Assert.assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); + assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); } public Map<String, Object> getValidImplementationConfiguration() { diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java index 75a581e776..608208c707 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java @@ -16,6 +16,8 @@ package org.openecomp.sdc.validation.util; +import static org.junit.jupiter.api.Assertions.assertEquals; + import org.apache.commons.collections4.MapUtils; import org.apache.commons.io.IOUtils; import org.openecomp.core.utilities.file.FileUtils; @@ -33,7 +35,6 @@ import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.base.ResourceBaseValidator; -import org.testng.Assert; import java.io.File; import java.io.FileInputStream; @@ -177,7 +178,7 @@ public class ValidationTestUtil { public static void validateErrorMessage(String actualMessage, String expected, String... params) { - Assert.assertEquals(actualMessage.replace("\n", "").replace("\r", ""), + assertEquals(actualMessage.replace("\n", "").replace("\r", ""), ErrorMessagesFormatBuilder.getErrorWithParameters(expected, params).replace("\n", "") .replace("\r", "")); } diff --git a/openecomp-be/pom.xml b/openecomp-be/pom.xml index f3750ca8d8..cb58a9c1e1 100644 --- a/openecomp-be/pom.xml +++ b/openecomp-be/pom.xml @@ -48,12 +48,6 @@ </dependency> <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>${testng.version}</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>com.github.testng-team</groupId> <artifactId>testng-junit5</artifactId> <version>0.0.1</version> diff --git a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/commands/exportinfo/serialize/VLMExtractTest.java b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/commands/exportinfo/serialize/VLMExtractTest.java index 9faf5918c6..9c8b1815a1 100644 --- a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/commands/exportinfo/serialize/VLMExtractTest.java +++ b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/commands/exportinfo/serialize/VLMExtractTest.java @@ -20,14 +20,14 @@ package org.openecomp.core.tools.commands.exportinfo.serialize; -import org.openecomp.core.tools.exportinfo.ExportSerializer; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; -import static org.testng.Assert.*; +import org.junit.Test; +import org.openecomp.core.tools.exportinfo.ExportSerializer; public class VLMExtractTest { - - @Test public void extractVLM(){ String vlmId = "979a56c7b2fa41e6a5742137f53a5c1b"; @@ -51,7 +51,7 @@ public class VLMExtractTest { } - @Test(expectedExceptions = IllegalStateException.class) + @Test(expected = IllegalStateException.class) public void failToExtractVLMBecauseJsonIsCorrupted(){ String elemenet_info_string = "gfhhhghgh"; assertNull(new CustomExportSerializer().extractVlm(elemenet_info_string)); diff --git a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/model/ColumnDefinitionTest.java b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/model/ColumnDefinitionTest.java index d756179368..b45a3370ff 100644 --- a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/model/ColumnDefinitionTest.java +++ b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/model/ColumnDefinitionTest.java @@ -19,10 +19,10 @@ */ package org.openecomp.core.tools.model; -import static org.testng.AssertJUnit.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.datastax.driver.core.DataType; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; public class ColumnDefinitionTest { diff --git a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/ElementEntityTest.java b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/ElementEntityTest.java index 2ce73f469e..67ce2e78f0 100644 --- a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/ElementEntityTest.java +++ b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/ElementEntityTest.java @@ -22,7 +22,7 @@ package org.openecomp.core.tools.store.zusammen.datatypes; import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; import static org.hamcrest.MatcherAssert.assertThat; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; public class ElementEntityTest { @Test diff --git a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/HealingEntityTest.java b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/HealingEntityTest.java index a62c4021a7..fec6ef1782 100644 --- a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/HealingEntityTest.java +++ b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/HealingEntityTest.java @@ -22,7 +22,7 @@ package org.openecomp.core.tools.store.zusammen.datatypes; import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; import static org.hamcrest.MatcherAssert.assertThat; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; public class HealingEntityTest { @Test diff --git a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionElementsEntityTest.java b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionElementsEntityTest.java index 617665d2ef..9e7bdaa6f6 100644 --- a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionElementsEntityTest.java +++ b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionElementsEntityTest.java @@ -22,7 +22,8 @@ package org.openecomp.core.tools.store.zusammen.datatypes; import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; import static org.hamcrest.MatcherAssert.assertThat; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; + public class VersionElementsEntityTest { @Test diff --git a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionEntityTest.java b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionEntityTest.java index 742bff6992..e122c5f519 100644 --- a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionEntityTest.java +++ b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionEntityTest.java @@ -22,7 +22,7 @@ package org.openecomp.core.tools.store.zusammen.datatypes; import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; import static org.hamcrest.MatcherAssert.assertThat; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; public class VersionEntityTest { @Test @@ -33,7 +33,7 @@ Modifications copyright (c) 2018-2019 Nokia <parent> <groupId>org.onap.oparent</groupId> <artifactId>oparent</artifactId> - <version>2.0.0</version> + <version>3.2.0</version> <relativePath/> </parent> |