diff options
Diffstat (limited to 'test-apis-ci/src')
11 files changed, 234 insertions, 501 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 new file mode 100644 index 0000000000..cc33e48530 --- /dev/null +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/data/providers/OnboardingDataProviders.java @@ -0,0 +1,109 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.ci.tests.data.providers; + +import static org.testng.Assert.fail; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import org.apache.commons.collections4.CollectionUtils; +import org.openecomp.sdc.ci.tests.datatypes.enums.XnfTypeEnum; +import org.openecomp.sdc.ci.tests.utils.general.FileHandling; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testng.annotations.DataProvider; + +public class OnboardingDataProviders { + + private static final Logger LOGGER = LoggerFactory.getLogger(OnboardingDataProviders.class); + private static final String VNF_FILE_PATH = FileHandling.getXnfRepositoryPath(XnfTypeEnum.VNF); + + private OnboardingDataProviders() { + + } + + @DataProvider(name = "randomVNF_List") + private static Object[][] randomVnfList() { + final int randomElementNumber = 3; //how many VNFs to onboard randomly + final List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); + final List<String> newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder); + if (CollectionUtils.isEmpty(newRandomFileNamesFromFolder)) { + fail("Required number of VNF files not exists under " + VNF_FILE_PATH); + return new Object[0][]; + } + LOGGER.debug(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.size())); + return provideData(newRandomFileNamesFromFolder, VNF_FILE_PATH); + } + + @DataProvider(name = "VNF_List", parallel = true) + private static Object[][] vnfList() { + final List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF); + LOGGER.debug(String.format("There are %s package file(s) to test", fileNamesFromFolder.size())); + return provideData(fileNamesFromFolder, VNF_FILE_PATH); + } + + @DataProvider(name = "PNF_List", parallel = true) + private static Object[][] pnfList() { + return provideData(OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.PNF), + FileHandling.getXnfRepositoryPath(XnfTypeEnum.PNF)); + } + + @DataProvider(name = "Single_VNF", parallel = true) + private static Object[][] singleVNF() { + final List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF); + final List<String> newList = new ArrayList<>(); + newList.add(fileNamesFromFolder.get(0)); + LOGGER.debug(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size())); + return provideData(newList, VNF_FILE_PATH); + } + + private static Object[][] provideData(final List<String> fileNamesFromFolder, final String folderPath) { + final Object[][] parametersArray = new Object[fileNamesFromFolder.size()][]; + int index = 0; + for (final Object obj : fileNamesFromFolder) { + parametersArray[index++] = new Object[]{folderPath, obj}; + } + return parametersArray; + } + + public static List<String> getRandomElements(final int randomElementNumber, + final List<String> fileNamesFromFolder) { + if (fileNamesFromFolder.isEmpty() || fileNamesFromFolder.size() < randomElementNumber) { + return Collections.emptyList(); + } else { + final List<Integer> indexList = new ArrayList<>(); + final List<String> newRandomFileNamesFromFolder = new ArrayList<>(); + for (int i = 0; i < fileNamesFromFolder.size(); i++) { + indexList.add(i); + } + Collections.shuffle(indexList); + final Integer[] randomArray = indexList.subList(0, randomElementNumber) + .toArray(new Integer[randomElementNumber]); + for (final Integer randomNumber : randomArray) { + newRandomFileNamesFromFolder.add(fileNamesFromFolder.get(randomNumber)); + } + return newRandomFileNamesFromFolder; + } + } + + +} diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java deleted file mode 100644 index 65b4b09855..0000000000 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnboardingDataProviders.java +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. 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.sdc.ci.tests.dataProviders; - -import org.openecomp.sdc.ci.tests.datatypes.enums.XnfTypeEnum; -import org.openecomp.sdc.ci.tests.utils.general.FileHandling; -import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; -import org.testng.annotations.DataProvider; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class OnboardingDataProviders { - - protected static String filepath = FileHandling.getVnfRepositoryPath(); - -// -----------------------dataProviders----------------------------------------- - @DataProvider(name = "randomVNF_List", parallel = false) - private static final Object[][] randomVnfList() throws Exception { - int randomElementNumber = 3; //how many VNFs to onboard randomly - List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); - List<String> newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder); - System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.size())); - return provideData(newRandomFileNamesFromFolder, filepath); - } - - @DataProvider(name = "VNF_List" , parallel = true) - private static final Object[][] VnfList() throws Exception { - - List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF); - - System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size())); - return provideData(fileNamesFromFolder, filepath); - } - -// -----------------------factories----------------------------------------- - - - - -// -----------------------methods----------------------------------------- - public static Object[][] provideData(List<String> fileNamesFromFolder, String filepath) { - - Object[][] arObject = new Object[fileNamesFromFolder.size()][]; - int index = 0; - for (Object obj : fileNamesFromFolder) { - arObject[index++] = new Object[] { filepath, obj }; - } - return arObject; - } - - private static List<String> getRandomElements(int randomElementNumber, List<String> fileNamesFromFolder) { - if(fileNamesFromFolder.size() == 0 || fileNamesFromFolder.size() < randomElementNumber){ - return null; - }else{ - List<Integer> indexList = new ArrayList<>(); - List<String> newRandomFileNamesFromFolder = new ArrayList<>(); - for(int i = 0; i < fileNamesFromFolder.size(); i++){ - indexList.add(i); - } - Collections.shuffle(indexList); - Integer[] randomArray = indexList.subList(0, randomElementNumber).toArray(new Integer[randomElementNumber]); - for(int i = 0; i < randomArray.length; i++){ - newRandomFileNamesFromFolder.add(fileNamesFromFolder.get(randomArray[i])); - } - return newRandomFileNamesFromFolder; - } - } - - - - -} diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java deleted file mode 100644 index e11d80b617..0000000000 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProviders/OnbordingDataProviders.java +++ /dev/null @@ -1,111 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. 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.sdc.ci.tests.dataProviders; - -import org.openecomp.sdc.ci.tests.datatypes.enums.XnfTypeEnum; -import org.openecomp.sdc.ci.tests.utils.general.FileHandling; -import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; -import org.testng.annotations.DataProvider; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import static org.testng.Assert.assertFalse; - -public class OnbordingDataProviders { - - protected static String vnfFilepath = FileHandling.getXnfRepositoryPath(XnfTypeEnum.VNF); - -// -----------------------dataProviders----------------------------------------- - @DataProvider(name = "randomVNF_List", parallel = false) - private static final Object[][] randomVnfList() throws Exception { - int randomElementNumber = 3; //how many VNFs to onboard randomly - List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); - List<String> newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder); - if(newRandomFileNamesFromFolder == null){ - assertFalse(true,"Requered number of VNF files not exists under " + vnfFilepath); - } - System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.size())); - return provideData(newRandomFileNamesFromFolder, vnfFilepath); - } - - @DataProvider(name = "VNF_List" , parallel = true) - private static final Object[][] VnfList() throws Exception { - List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF); - System.out.println(String.format("There are %s package file(s) to test", fileNamesFromFolder.size())); - return provideData(fileNamesFromFolder, vnfFilepath); - } - - @DataProvider(name = "PNF_List" , parallel = true) - private static final Object[][] nfList() throws Exception { - List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.PNF); - System.out.println(String.format("There are %s package file(s) to test", fileNamesFromFolder.size())); - return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.PNF)); - } - - @DataProvider(name = "Single_VNF" , parallel = true) - private static final Object[][] SingleVNF() throws Exception { - List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF); - List<String> newList = new ArrayList<>(); - newList.add(fileNamesFromFolder.get(0)); - System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size())); - return provideData(newList, vnfFilepath); - } - -// -----------------------factories----------------------------------------- - - - - -// -----------------------methods----------------------------------------- - public static Object[][] provideData(List<String> fileNamesFromFolder, String filepath) { - - Object[][] arObject = new Object[fileNamesFromFolder.size()][]; - int index = 0; - for (Object obj : fileNamesFromFolder) { - arObject[index++] = new Object[] { filepath, obj }; - } - return arObject; - } - - public static List<String> getRandomElements(int randomElementNumber, List<String> fileNamesFromFolder) { - if(fileNamesFromFolder.size() == 0 || fileNamesFromFolder.size() < randomElementNumber){ - return null; - }else{ - List<Integer> indexList = new ArrayList<>(); - List<String> newRandomFileNamesFromFolder = new ArrayList<>(); - for(int i = 0; i < fileNamesFromFolder.size(); i++){ - indexList.add(i); - } - Collections.shuffle(indexList); - Integer[] randomArray = indexList.subList(0, randomElementNumber).toArray(new Integer[randomElementNumber]); - for(int i = 0; i < randomArray.length; i++){ - newRandomFileNamesFromFolder.add(fileNamesFromFolder.get(randomArray[i])); - } - return newRandomFileNamesFromFolder; - } - } - - - - -} diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java deleted file mode 100644 index 48fd3fd98f..0000000000 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java +++ /dev/null @@ -1,121 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. 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.sdc.ci.tests.datatypes; - -public class AmdocsLicenseMembers { - - private String vendorId; - private String vendorLicenseName; - private String vendorLicenseAgreementId; - private String featureGroupId; - private String licenseVersionId; - private String licenseVersionLabel; - private String version; - - public AmdocsLicenseMembers(String vendorId, String vendorLicenseName, String vendorLicenseAgreementId, - String featureGroupId, String licenseVersionId, String licenseVersionLabel) { - this.vendorId = vendorId; - this.vendorLicenseName = vendorLicenseName; - this.vendorLicenseAgreementId = vendorLicenseAgreementId; - this.featureGroupId = featureGroupId; - this.licenseVersionId = licenseVersionId; - this.licenseVersionLabel = licenseVersionLabel; - } - - public String getLicenseVersionId() { - return licenseVersionId; - } - - public void setLicenseVersionId(String licenseVersionId) { - this.licenseVersionId = licenseVersionId; - } - - public String getLicenseVersionLabel() { - return licenseVersionLabel; - } - - public void setLicenseVersionLabel(String licenseVersionLabel) { - this.licenseVersionLabel = licenseVersionLabel; - } - - public AmdocsLicenseMembers(String vendorId, String vendorLicenseName, String vendorLicenseAgreementId, String featureGroupId) { - super(); - this.vendorId = vendorId; - this.vendorLicenseName = vendorLicenseName; - this.vendorLicenseAgreementId = vendorLicenseAgreementId; - this.featureGroupId = featureGroupId; - } - - public String getVendorId() { - return vendorId; - } - - public void setVendorId(String vendorId) { - this.vendorId = vendorId; - } - - public String getVendorLicenseName() { - return vendorLicenseName; - } - - public void setVendorLicenseName(String vendorLicenseName) { - this.vendorLicenseName = vendorLicenseName; - } - - public String getVendorLicenseAgreementId() { - return vendorLicenseAgreementId; - } - - public void setVendorLicenseAgreementId(String vendorLicenseAgreementId) { - this.vendorLicenseAgreementId = vendorLicenseAgreementId; - } - - public String getFeatureGroupId() { - return featureGroupId; - } - - public void setFeatureGroupId(String featureGroupId) { - this.featureGroupId = featureGroupId; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - @Override - public String toString() { - return "AmdocsLicenseMembers{" + - "vendorId='" + vendorId + '\'' + - ", vendorLicenseName='" + vendorLicenseName + '\'' + - ", vendorLicenseAgreementId='" + vendorLicenseAgreementId + '\'' + - ", featureGroupId='" + featureGroupId + '\'' + - ", licenseVersionId='" + licenseVersionId + '\'' + - ", licenseVersionLabel='" + licenseVersionLabel + '\'' + - ", version='" + version + '\'' + - '}'; - } - - -} diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorLicenseModel.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorLicenseModel.java new file mode 100644 index 0000000000..4ed0e83179 --- /dev/null +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorLicenseModel.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. 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.sdc.ci.tests.datatypes; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@ToString +@Getter +public class VendorLicenseModel { + + private final String vendorId; + private final String vendorLicenseName; + private final String vendorLicenseAgreementId; + private final String featureGroupId; + private String licenseVersionId; + private String licenseVersionLabel; + @Setter + private String version; + + public VendorLicenseModel(final String vendorId, final String vendorLicenseName, + final String vendorLicenseAgreementId, final String featureGroupId, + final String licenseVersionId, final String licenseVersionLabel) { + this.vendorId = vendorId; + this.vendorLicenseName = vendorLicenseName; + this.vendorLicenseAgreementId = vendorLicenseAgreementId; + this.featureGroupId = featureGroupId; + this.licenseVersionId = licenseVersionId; + this.licenseVersionLabel = licenseVersionLabel; + } + + public VendorLicenseModel(String vendorId, String vendorLicenseName, String vendorLicenseAgreementId, String featureGroupId) { + this.vendorId = vendorId; + this.vendorLicenseName = vendorLicenseName; + this.vendorLicenseAgreementId = vendorLicenseAgreementId; + this.featureGroupId = featureGroupId; + } + +} diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java index 7f19d45dfb..65c7f9e206 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java @@ -20,14 +20,14 @@ package org.openecomp.sdc.ci.tests.datatypes.enums; +import lombok.Getter; +import lombok.Setter; import org.openecomp.sdc.ci.tests.config.UserCredentialsFromFile; import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; +@Getter public enum UserRoleEnum { -// ADMIN("jh0003", "Jimmy", "Hendrix"), DESIGNER("cs0008", "Carlos", "Santana"), DESIGNER2("me0009", "Melissa","Etheridge"), TESTER("jm0007", "Joni", "Mitchell"), ADMIN4("km2000", "Kot", "May"), -// GOVERNOR("gv0001","David", "Shadmi"), OPS("op0001", "Steve", "Regev"), PRODUCT_STRATEGIST1("ps0001", "Eden","Rozin"), PRODUCT_STRATEGIST2("ps0002", "Ella", "Kvetny"), PRODUCT_STRATEGIST3("ps0003", "Geva", "Alon"), -// PRODUCT_MANAGER1("pm0001", "Teddy", "Isashar"), PRODUCT_MANAGER2("pm0002", "Sarah", "Bettens"); ADMIN("admin"), ADMIN2("admin"), DESIGNER("designer"), @@ -41,57 +41,24 @@ public enum UserRoleEnum { PRODUCT_MANAGER1("ops"), PRODUCT_MANAGER2("ops"); + private String userName; + private UserCredentials credentials; private String password; + @Setter private String userId; private String firstName; private String lastName; + private String userRole; - - private UserRoleEnum(String userRole) { - String name = name(); + UserRoleEnum(final String userRole) { final UserCredentialsFromFile instance = UserCredentialsFromFile.getInstance(); - this.credentials = instance.getUserCredentialsByRole(userRole); - this.userId = this.credentials.getUserId(); - this.firstName = this.credentials.getFirstName(); + this.credentials = instance.getUserCredentialsByRole(userRole); + this.userId = this.credentials.getUserId(); + this.firstName = this.credentials.getFirstName(); this.lastName = this.credentials.getLastName(); this.password = this.credentials.getPassword(); this.userName = this.firstName + " " + this.lastName; - } - - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; + this.userRole = userRole; } - public UserCredentials getCredentials() { - return credentials; - } - - public String getLastName() { - return lastName; - } - - public String getUserName() { - return userName; - } - - private String userName; - private UserCredentials credentials; - - - public String getPassword() { - return password; - } } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java index c4faf2c9dc..45a5c1c227 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java @@ -32,7 +32,7 @@ import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.ExtentTestActions; -import org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders; +import org.openecomp.sdc.ci.tests.data.providers.OnboardingDataProviders; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; @@ -72,13 +72,13 @@ public class Onboard extends ComponentBaseTest { } - @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List") + @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "VNF_List") public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception { setLog(vnfFile); runOnboardToDistributionFlow(filePath, vnfFile, ResourceTypeEnum.VF); } - @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "PNF_List") + @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "PNF_List") public void onboardPNFFlow(String filePath, String pnfFile) throws Exception { setLog(pnfFile); runOnboardToDistributionFlow(filePath, pnfFile, ResourceTypeEnum.PNF); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java index f9ce645fc7..64a62c5619 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java @@ -28,7 +28,7 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; +import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; @@ -52,8 +52,9 @@ public class OnboardingUtillViaApis { public static VendorSoftwareProductObject createVspViaApis(ResourceReqDetails resourceReqDetails, String filepath, String vnfFile, User user) throws Exception { - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(user); - return VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, user, amdocsLicenseMembers); + VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(user); + return VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, user, + vendorLicenseModel); } public static Resource createResourceFromVSP(ResourceReqDetails resourceDetails) throws Exception { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java~release_1802E b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java~release_1802E deleted file mode 100644 index 71038920ae..0000000000 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/SnmpTypeEnum.java~release_1802E +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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.sdc.ci.tests.utils.general; - -import static org.testng.AssertJUnit.assertEquals; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; -import java.nio.file.FileSystems; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.apache.commons.io.IOUtils; -import org.apache.http.HttpEntity; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.FileBody; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.simple.JSONArray; -import org.json.simple.JSONValue; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; - -import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; - -import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; - - -import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; - -import org.testng.Assert; - -import com.aventstack.extentreports.Status; -import com.clearspring.analytics.util.Pair; - -enum SnmpTypeEnum{ - SNMP_POLL ("snmp"), - SNMP_TRAP ("snmp-trap"); - - private String value; - - public String getValue() { - return value; - } - - private SnmpTypeEnum(String value) { - this.value = value; -} - -} - diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/VendorLicenseModelRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/VendorLicenseModelRestUtils.java index c587404894..7955b95239 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/VendorLicenseModelRestUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/VendorLicenseModelRestUtils.java @@ -26,7 +26,7 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; +import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.Utils; @@ -39,22 +39,23 @@ import static org.testng.AssertJUnit.assertEquals; public class VendorLicenseModelRestUtils { - public static void updateVendorLicense(AmdocsLicenseMembers amdocsLicenseMembers, User user, Boolean isVlmUpdated) throws Exception { + public static void updateVendorLicense(VendorLicenseModel vendorLicenseModel, User user, Boolean isVlmUpdated) throws Exception { // create major method - RestResponse creationMethodVendorLicense = creationMethodVendorLicense(amdocsLicenseMembers, user); + RestResponse creationMethodVendorLicense = creationMethodVendorLicense(vendorLicenseModel, user); assertEquals("did not succeed to create method for vendor license", 200, creationMethodVendorLicense.getErrorCode().intValue()); - amdocsLicenseMembers.setVersion(ResponseParser.getValueFromJsonResponse(creationMethodVendorLicense.getResponse(), "id")); + vendorLicenseModel + .setVersion(ResponseParser.getValueFromJsonResponse(creationMethodVendorLicense.getResponse(), "id")); if(isVlmUpdated) { // TODO update vlm do nothing // commit - RestResponse commitVendorLicense = commitVendorLicense(amdocsLicenseMembers, user); + RestResponse commitVendorLicense = commitVendorLicense(vendorLicenseModel, user); assertEquals("did not succeed to commit vendor license", 200, commitVendorLicense.getErrorCode().intValue()); } // submit - RestResponse submitVendorLicense = submitVendorLicense(amdocsLicenseMembers, user); + RestResponse submitVendorLicense = submitVendorLicense(vendorLicenseModel, user); assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue()); if(ComponentBaseTest.getExtendTest() != null){ @@ -80,9 +81,9 @@ public class VendorLicenseModelRestUtils { return (restResponse.getErrorCode()==200); } - public static AmdocsLicenseMembers createVendorLicense(User user) throws Exception { + public static VendorLicenseModel createVendorLicense(User user) throws Exception { - AmdocsLicenseMembers amdocsLicenseMembers; + VendorLicenseModel vendorLicenseModel; // ComponentBaseTest.getExtendTest().log(Status.INFO, "Starting to create the vendor license"); String vendorLicenseName = "ciLicense" + OnboardingUtils.getShortUUID(); RestResponse vendorLicenseResponse = createVendorLicenseModels_1(vendorLicenseName, user); @@ -109,15 +110,15 @@ public class VendorLicenseModelRestUtils { // RestResponse checkinVendorLicense = OnboardingUtils.checkinVendorLicense(vendorId, user, versionId); // assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue()); - amdocsLicenseMembers = new AmdocsLicenseMembers(vendorId, vendorLicenseName, vendorLicenseAgreementId, featureGroupId); - amdocsLicenseMembers.setVersion(versionId); // Once object created and submitted, his initial version is 1.0 + vendorLicenseModel = new VendorLicenseModel(vendorId, vendorLicenseName, vendorLicenseAgreementId, featureGroupId); + vendorLicenseModel.setVersion(versionId); // Once object created and submitted, his initial version is 1.0 - RestResponse submitVendorLicense = submitVendorLicense(amdocsLicenseMembers, user); + RestResponse submitVendorLicense = submitVendorLicense(vendorLicenseModel, user); assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue()); // ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor license"); - return amdocsLicenseMembers; + return vendorLicenseModel; } private static RestResponse actionOnComponent(String vspid, String body, String onboardComponent, User user, String componentVersion) throws Exception { @@ -142,25 +143,27 @@ public class VendorLicenseModelRestUtils { return response; } - public static RestResponse submitVendorLicense(AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception { - return actionOnComponent(amdocsLicenseMembers.getVendorId(), "{\"action\":\"Submit\"}", "vendor-license-models", user, amdocsLicenseMembers.getVersion()); + public static RestResponse submitVendorLicense(VendorLicenseModel vendorLicenseModel, User user) throws Exception { + return actionOnComponent(vendorLicenseModel.getVendorId(), "{\"action\":\"Submit\"}", "vendor-license-models", user, vendorLicenseModel + .getVersion()); } /** - * @param amdocsLicenseMembers + * @param vendorLicenseModel * @param user * @return * checkOut exist VLM method * @throws Exception */ - public static RestResponse creationMethodVendorLicense(AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception { + public static RestResponse creationMethodVendorLicense(VendorLicenseModel vendorLicenseModel, User user) throws Exception { String messageBody = "{\"description\":\"2.0\",\"creationMethod\":\"major\"}"; - return createMethodVendorLicense(amdocsLicenseMembers.getVendorId(), messageBody, "items", user, amdocsLicenseMembers.getVersion()); + return createMethodVendorLicense(vendorLicenseModel.getVendorId(), messageBody, "items", user, vendorLicenseModel + .getVersion()); } - public static RestResponse commitVendorLicense(AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception { + public static RestResponse commitVendorLicense(VendorLicenseModel vendorLicenseModel, User user) throws Exception { String messageBody = "{\"action\":\"Commit\",\"commitRequest\":{\"message\":\"commit\"}}"; - return actionOnComponent(amdocsLicenseMembers.getVendorId(), messageBody, "items", user, amdocsLicenseMembers.getVersion()); + return actionOnComponent(vendorLicenseModel.getVendorId(), messageBody, "items", user, vendorLicenseModel.getVersion()); } public static RestResponse createVendorLicenseModels_1(String name, User user) throws Exception { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/VendorSoftwareProductRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/VendorSoftwareProductRestUtils.java index 761da19eb0..864dd891ac 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/VendorSoftwareProductRestUtils.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/VendorSoftwareProductRestUtils.java @@ -61,10 +61,11 @@ import static org.testng.AssertJUnit.assertEquals; public class VendorSoftwareProductRestUtils { - public static VendorSoftwareProductObject createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers, Map<CvfcTypeEnum, String> cvfcArtifacts) + public static VendorSoftwareProductObject createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, VendorLicenseModel vendorLicenseModel, Map<CvfcTypeEnum, String> cvfcArtifacts) throws Exception { - VendorSoftwareProductObject vendorSoftwareProductObject = createVSP(resourceReqDetails, heatFileName, filepath, user, amdocsLicenseMembers); + VendorSoftwareProductObject vendorSoftwareProductObject = createVSP(resourceReqDetails, heatFileName, filepath, user, + vendorLicenseModel); if(cvfcArtifacts != null && ! cvfcArtifacts.isEmpty()){ addCvfcArtifacts(cvfcArtifacts, user, vendorSoftwareProductObject); } @@ -72,11 +73,11 @@ public class VendorSoftwareProductRestUtils { return vendorSoftwareProductObject; } - public static VendorSoftwareProductObject createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) + public static VendorSoftwareProductObject createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, VendorLicenseModel vendorLicenseModel) throws Exception { Map<CvfcTypeEnum, String> cvfcArtifacts = new HashMap<>(); - return createVendorSoftwareProduct(resourceReqDetails, heatFileName, filepath, user, amdocsLicenseMembers, cvfcArtifacts); + return createVendorSoftwareProduct(resourceReqDetails, heatFileName, filepath, user, vendorLicenseModel, cvfcArtifacts); } /** @@ -100,24 +101,26 @@ public class VendorSoftwareProductRestUtils { } - public static VendorSoftwareProductObject createAndFillVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filePath, User user, AmdocsLicenseMembers amdocsLicenseMembers, Map<CvfcTypeEnum, String> cvfcArtifacts) + public static VendorSoftwareProductObject createAndFillVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filePath, User user, VendorLicenseModel vendorLicenseModel, Map<CvfcTypeEnum, String> cvfcArtifacts) throws Exception { - VendorSoftwareProductObject createVendorSoftwareProduct = createVendorSoftwareProduct(resourceReqDetails, heatFileName, filePath, user, amdocsLicenseMembers, cvfcArtifacts); + VendorSoftwareProductObject createVendorSoftwareProduct = createVendorSoftwareProduct(resourceReqDetails, heatFileName, filePath, user, + vendorLicenseModel, cvfcArtifacts); VendorSoftwareProductObject vendorSoftwareProductObject = fillVendorSoftwareProductObjectWithMetaData(heatFileName, createVendorSoftwareProduct); return vendorSoftwareProductObject; } - public static VendorSoftwareProductObject createVSP(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception { + public static VendorSoftwareProductObject createVSP(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, VendorLicenseModel vendorLicenseModel) throws Exception { String vspName = handleFilename(heatFileName); if(ComponentBaseTest.getExtendTest() != null){ ComponentBaseTest.getExtendTest().log(Status.INFO, "Starting to create the vendor software product"); } - Pair<RestResponse, VendorSoftwareProductObject> createNewVspPair = createNewVendorSoftwareProduct(resourceReqDetails, vspName, amdocsLicenseMembers, user); + Pair<RestResponse, VendorSoftwareProductObject> createNewVspPair = createNewVendorSoftwareProduct(resourceReqDetails, vspName, + vendorLicenseModel, user); assertEquals("did not succeed to create new VSP", 200,createNewVspPair.left.getErrorCode().intValue()); RestResponse uploadHeatPackage = uploadHeatPackage(filepath, heatFileName, createNewVspPair.right, user); @@ -320,13 +323,14 @@ public class VendorSoftwareProductRestUtils { return response; } - public static Pair<RestResponse, VendorSoftwareProductObject> createNewVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String vspName, AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception { + public static Pair<RestResponse, VendorSoftwareProductObject> createNewVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String vspName, VendorLicenseModel vendorLicenseModel, User user) throws Exception { Config config = Utils.getConfig(); String url = String.format(Urls.CREATE_VENDOR_SOFTWARE_PRODUCT, config.getOnboardingBeHost(), config.getOnboardingBePort()); String userId = user.getUserId(); VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject(); - LicensingData licensingData = new LicensingData(amdocsLicenseMembers.getVendorLicenseAgreementId(), Arrays.asList(amdocsLicenseMembers.getFeatureGroupId())); + LicensingData licensingData = new LicensingData( + vendorLicenseModel.getVendorLicenseAgreementId(), Arrays.asList(vendorLicenseModel.getFeatureGroupId())); ResourceCategoryEnum resourceCategoryEnum = ResourceCategoryEnum.findEnumNameByValues(resourceReqDetails.getCategories().get(0).getName(), resourceReqDetails.getCategories().get(0).getSubcategories().get(0).getName()); vendorSoftwareProductObject.setName(vspName); @@ -334,11 +338,11 @@ public class VendorSoftwareProductRestUtils { vendorSoftwareProductObject.setCategory(resourceCategoryEnum.getCategoryUniqeId()); vendorSoftwareProductObject.setSubCategory(resourceCategoryEnum.getSubCategoryUniqeId()); vendorSoftwareProductObject.setOnboardingMethod("NetworkPackage"); - vendorSoftwareProductObject.setVendorName(amdocsLicenseMembers.getVendorLicenseName()); - vendorSoftwareProductObject.setVendorId(amdocsLicenseMembers.getVendorId()); + vendorSoftwareProductObject.setVendorName(vendorLicenseModel.getVendorLicenseName()); + vendorSoftwareProductObject.setVendorId(vendorLicenseModel.getVendorId()); vendorSoftwareProductObject.setIcon("icon"); vendorSoftwareProductObject.setLicensingData(licensingData); - vendorSoftwareProductObject.setLicensingVersion(amdocsLicenseMembers.getVersion()); + vendorSoftwareProductObject.setLicensingVersion(vendorLicenseModel.getVersion()); Map<String, String> headersMap = OnboardingUtils.prepareHeadersMap(userId); HttpRequest http = new HttpRequest(); @@ -512,16 +516,17 @@ public class VendorSoftwareProductRestUtils { return response; } - public static VendorSoftwareProductObject updateVSPWithNewVLMParameters(VendorSoftwareProductObject vendorSoftwareProductObject, AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception { + public static VendorSoftwareProductObject updateVSPWithNewVLMParameters(VendorSoftwareProductObject vendorSoftwareProductObject, VendorLicenseModel vendorLicenseModel, User user) throws Exception { RestResponse createMethod = creationMethodVendorSoftwareProduct(vendorSoftwareProductObject, user); assertEquals("did not succeed to checkout new VSP", 200, createMethod.getErrorCode().intValue()); // vendorSoftwareProductObject.setComponentId(ResponseParser.getValueFromJsonResponse(createMethod.getResponse(), "id")); - String licensingVersion = amdocsLicenseMembers.getVersion(); - LicensingData licensingData = new LicensingData(amdocsLicenseMembers.getVendorLicenseAgreementId(), Arrays.asList(amdocsLicenseMembers.getFeatureGroupId())); - vendorSoftwareProductObject.setVendorId(amdocsLicenseMembers.getVendorId()); - vendorSoftwareProductObject.setVendorName(amdocsLicenseMembers.getVendorLicenseName()); + String licensingVersion = vendorLicenseModel.getVersion(); + LicensingData licensingData = new LicensingData( + vendorLicenseModel.getVendorLicenseAgreementId(), Arrays.asList(vendorLicenseModel.getFeatureGroupId())); + vendorSoftwareProductObject.setVendorId(vendorLicenseModel.getVendorId()); + vendorSoftwareProductObject.setVendorName(vendorLicenseModel.getVendorLicenseName()); vendorSoftwareProductObject.setLicensingVersion(licensingVersion); vendorSoftwareProductObject.setLicensingData(licensingData); @@ -710,7 +715,9 @@ public class VendorSoftwareProductRestUtils { return vendorSoftwareProductObject; } - public static void updateVendorSoftwareProductToNextVersion(VendorSoftwareProductObject vendorSoftwareProductObject, User user, String filepath, String heatFileName) throws Throwable { + public static void updateVendorSoftwareProductToNextVersion(VendorSoftwareProductObject vendorSoftwareProductObject, + User user, String filepath, + String heatFileName) throws Exception { RestResponse createMethod = creationMethodVendorSoftwareProduct(vendorSoftwareProductObject, user); assertEquals("did not succeed to createMethod for new VSP", 200, createMethod.getErrorCode().intValue()); |