diff options
author | 2019-11-21 13:23:07 +0000 | |
---|---|---|
committer | 2020-01-13 09:56:16 +0000 | |
commit | 2e6d1bb2e6870f758a9231a2f2bb096e7f7c8295 (patch) | |
tree | cbaa200b20174aea56e6ce9b34d6bdfcc0789430 /test-apis-ci/src/main/java/org/openecomp | |
parent | 8b346842194edb8a9e8c4cd2764ae8ebbce988f0 (diff) |
Onboard PNF software version Ui test case
Change-Id: Ie5785c220e15afbc35efaa8158ab86c41fc34437
Issue-ID: SDC-2702
Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'test-apis-ci/src/main/java/org/openecomp')
2 files changed, 37 insertions, 8 deletions
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/data/providers/OnboardingDataProviders.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/data/providers/OnboardingDataProviders.java index cc33e48530..a2f39b3f0e 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/data/providers/OnboardingDataProviders.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/data/providers/OnboardingDataProviders.java @@ -22,8 +22,10 @@ package org.openecomp.sdc.ci.tests.data.providers; import static org.testng.Assert.fail; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Optional; import org.apache.commons.collections4.CollectionUtils; import org.openecomp.sdc.ci.tests.datatypes.enums.XnfTypeEnum; import org.openecomp.sdc.ci.tests.utils.general.FileHandling; @@ -32,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.DataProvider; -public class OnboardingDataProviders { +public final class OnboardingDataProviders { private static final Logger LOGGER = LoggerFactory.getLogger(OnboardingDataProviders.class); private static final String VNF_FILE_PATH = FileHandling.getXnfRepositoryPath(XnfTypeEnum.VNF); @@ -76,6 +78,27 @@ public class OnboardingDataProviders { return provideData(newList, VNF_FILE_PATH); } + @DataProvider(name = "softwareInformationPnf", parallel = true) + private static Object[][] softwareInformationPnf() { + final List<String> pnfPackageFileNameList = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.PNF); + if (CollectionUtils.isEmpty(pnfPackageFileNameList)) { + fail("Could not create softwareInformationPnf datasource"); + } + final String pnfPackage = "sample-pnf-1.0.1-SNAPSHOT.csar"; + final Optional<String> softwareInformationPnfPackage = pnfPackageFileNameList.stream() + .filter(pnfPackage::equals).findFirst(); + if (!softwareInformationPnfPackage.isPresent()) { + fail(String.format("Could not create softwareInformationPnf datasource, the package '%s' was not found", + pnfPackage)); + } + + final String folderPath = FileHandling.getXnfRepositoryPath(XnfTypeEnum.PNF); + final Object[][] parametersArray = new Object[1][]; + parametersArray[0] = new Object[]{folderPath, softwareInformationPnfPackage.get(), + Arrays.asList("5gDUv18.05.201", "5gDUv18.06.205")}; + return parametersArray; + } + private static Object[][] provideData(final List<String> fileNamesFromFolder, final String folderPath) { final Object[][] parametersArray = new Object[fileNamesFromFolder.size()][]; int index = 0; diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java index 82954e642a..31b8c5b47a 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/ElementFactory.java @@ -49,7 +49,7 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -public class ElementFactory { +public final class ElementFactory { private static final String CI_SERVICE = "ciService"; private static final String CI_RES = "ciRes"; @@ -58,6 +58,10 @@ public class ElementFactory { private static final String RESOURCE_INSTANCE_POS_X = "20"; private static final String RESOURCE_INSTANCE_POS_Y = "20"; private static final String RESOURCE_INSTANCE_DESCRIPTION = "description"; + + private ElementFactory() { + + } // *** Getters *** @@ -133,7 +137,7 @@ public class ElementFactory { } public static ResourceReqDetails getDefaultResource(String resourceName, NormativeTypesEnum derived, ResourceCategoryEnum category, String contactId) { - resourceName = (resourceName + generateUUIDforSufix()); + resourceName = addRandomSuffixToName(resourceName); String description = "Represents a generic software component that can be managed and run by a Compute Node Type."; ArrayList<String> resourceTags = new ArrayList<>(); resourceTags.add(resourceName); @@ -156,7 +160,7 @@ public class ElementFactory { } public static ResourceReqDetails getDefaultResource(String resourceName, Resource derived, ResourceCategoryEnum category, String contactId) { - resourceName = (resourceName + generateUUIDforSufix()); + resourceName = addRandomSuffixToName(resourceName); String description = "Represents a generic software component that can be managed and run by a Compute Node Type."; ArrayList<String> resourceTags = new ArrayList<>(); resourceTags.add(resourceName); @@ -173,6 +177,10 @@ public class ElementFactory { } + public static String addRandomSuffixToName(final String name) { + return name + generateUUIDforSufix(); + } + public static ResourceReqDetails getDefaultResourceByType(String resourceName, NormativeTypesEnum derived, ResourceCategoryEnum category, String contactId, ResourceTypeEnum resourceType) { return getDefaultResourceByType(resourceName, derived, category, contactId, resourceType.toString()); } @@ -1028,10 +1036,8 @@ public class ElementFactory { } public static String generateUUIDforSufix() { - - String uniqueSufix = UUID.randomUUID().toString(); - String[] split = uniqueSufix.split("-"); - return uniqueSufix = split[4]; + final String uniqueSuffix = UUID.randomUUID().toString(); + return uniqueSuffix.split("-")[4]; } private static String normalizeArtifactLabel(String label) { |