/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation
+ * Copyright (C) 2021 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.
return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.CNF));
}
+ @DataProvider(name = "Invalid_CNF_List", parallel = true)
+ private static Object[][] invalidCnfList() {
+ final List<String> fileNamesFromFolder = OnboardingUtils.getInvalidXnfNamesFileList(XnfTypeEnum.CNF);
+ LOGGER.debug(String.format("There are %s package file(s) to test", fileNamesFromFolder.size()));
+ return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.CNF));
+ }
+
@DataProvider(name = "Single_VNF", parallel = true)
private static Object[][] singleVNF() {
final List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF);
* SDC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2021 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.
package org.onap.sdc.backend.ci.tests.sanity;
+import static org.testng.Assert.assertThrows;
+
import com.aventstack.extentreports.Status;
import fj.data.Either;
import org.junit.Rule;
runOnboardToDistributionFlow(filePath, cnfFile, ResourceTypeEnum.VF);
}
+ @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Invalid_CNF_List")
+ public void onboardCNFFlowShouldFailForInvalidHelmPackage(String filePath, String cnfFile) {
+ setLog(cnfFile);
+ assertThrows(() -> runOnboardToDistributionFlow(filePath, cnfFile, ResourceTypeEnum.VF));
+ }
+
private void runOnboardToDistributionFlow(String packageFilePath, String packageFileName, ResourceTypeEnum resourceTypeEnum) throws Exception {
ExtentTestActions.log(Status.INFO, String.format("Going to onboard the %s %s", resourceTypeEnum.getValue(), packageFileName));
User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
* SDC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2021 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.
package org.onap.sdc.backend.ci.tests.utils.general;
+import java.io.File;
import org.onap.sdc.backend.ci.tests.datatypes.enums.XnfTypeEnum;
import org.onap.sdc.backend.ci.tests.datatypes.http.HttpHeaderEnum;
import org.onap.sdc.backend.ci.tests.datatypes.http.HttpRequest;
"1-2017-404_vUSP_vCCF_AIC3.0-(VOIP)_v6.0.zip",
"1-2017389vtsbc4vf-(VOIP)_v11.0.zip"
);
-
+
+ private static final String INVALID_XNFS_SUBPATH = "invalid";
+
public static String handleFilename(String heatFileName) {
final String namePrefix = String.format("%sVF%s", ElementFactory.getResourcePrefix(), "Onboarded-");
final String nameSuffix = "-" + getShortUUID();
String vnfName = namePrefix + subHeatFileName + nameSuffix;
return vnfName;
}
-
+
public static String getShortUUID() {
return UUID.randomUUID().toString().split("-")[0];
return fileNamesFromFolder;
}
+ /**
+ * @return
+ * The method returns names list of invalid XNF packages from Files directory under sdc repository
+ */
+ public static List<String> getInvalidXnfNamesFileList(XnfTypeEnum xnfTypeEnum) {
+ String filepath = FileHandling.getXnfRepositoryPath(xnfTypeEnum) + File.separator + INVALID_XNFS_SUBPATH;
+ return FileHandling.getZipFileNamesFromFolder(filepath);
+ }
+
/**
* @param vnfNamesFileList
* @return divide List according to day of month, if day of month is even as get first half part of the List, else - second
}
}
-
\ No newline at end of file
* SDC
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2021 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.
return provideData(fileNamesFromFolder, FileHandling.getCnfRepositoryPath());
}
+ @DataProvider(name = "Invalid_CNF_List", parallel = true)
+ private static Object[][] invalidCnfList() {
+
+ List<String> fileNamesFromFolder = OnboardingUtils.getInvalidXnfNamesFileList(XnfTypeEnum.CNF);
+
+ System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
+ return provideData(fileNamesFromFolder, FileHandling.getCnfRepositoryPath());
+ }
+
@DataProvider(name = "updateList")
private static Object[][] updateList() throws Exception {
* SDC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2021 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.
import org.openqa.selenium.WebElement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.testng.Assert;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Optional;
runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, cnfFile);
}
+ @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "Invalid_CNF_List")
+ public void onboardCNFTestShouldFailForInvalidHelmPackage(String filePath, String cnfFile) {
+ setLog(cnfFile);
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
+ Assert.assertThrows(() -> runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, cnfFile));
+ }
+
@Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception {
setLog(vnfFile);
<methods>
<include name="onapOnboardVNFflow"/>
<include name="onboardCNFTest"/>
+ <include name="onboardCNFTestShouldFailForInvalidHelmPackage"/>
<include name="onapOnboardVSPValidationsSanityFlow"/>
<include name="onboardPNFSoftwareInformationFlow"/>
</methods>