From e575ea8b9c775f72a906aea75c338e1fbb04df06 Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Mon, 24 Jul 2017 00:48:40 +0300 Subject: [SDC] 1710 rebase Change-Id: Ib07b7baacc68a357d302ee591e1fe74151dcea96 Signed-off-by: Michael Lando --- .../US/AddComponentInstancesArtifactsInCsar.java | 5 +- .../sdc/ci/tests/US/LocalGeneralUtilities.java | 8 +-- .../org/openecomp/sdc/ci/tests/US/VfModule.java | 9 +-- .../ci/tests/datatypes/AmdocsLicenseMembers.java | 56 +++++++++++++++ .../sdc/ci/tests/execute/sanity/Onboard.java | 6 +- .../ci/tests/execute/sanity/OnboardViaApis.java | 81 ++++++++++------------ .../sdc/ci/tests/execute/sanity/VFCArtifacts.java | 13 ++-- .../sdc/ci/tests/utilities/OnboardingUtils.java | 77 +++++++++----------- 8 files changed, 146 insertions(+), 109 deletions(-) create mode 100644 ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java (limited to 'ui-ci/src/main/java/org') diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java index a8e6501dff..41c1212cc0 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java @@ -37,6 +37,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; @@ -84,8 +85,8 @@ public class AddComponentInstancesArtifactsInCsar extends SetupCDTest { String vnfFile = "FDNT.zip"; String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip"; - OnboardingUtils.createVendorLicense(getUser()); - Pair> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser()); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser()); + Pair> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser(), amdocsLicenseMembers); String vspName = createVSP.left; resourceMetaData.setName(vspName); Map resourceMeta = createVSP.right; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java index fb1798d0c9..8c282e8b88 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java @@ -23,12 +23,13 @@ import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Map; + import org.json.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.pages.HomePage; import org.openecomp.sdc.ci.tests.utilities.FileHandling; @@ -74,9 +75,8 @@ public static List getValuesFromJsonArray(RestResponse message) throws E } public static String simpleOnBoarding(String fileName, String filePath,User user) throws Exception { - OnboardingUtils.createVendorLicense(user); - Pair> createVendorSoftwareProduct = OnboardingUtils - .createVendorSoftwareProduct(fileName, filePath, user); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(user); + Pair> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(fileName, filePath, user, amdocsLicenseMembers); String vspName = createVendorSoftwareProduct.left; HomePage.showVspRepository(); OnboardingUtils.importVSP(createVendorSoftwareProduct); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java index a038c284e1..e7d933491c 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java @@ -29,12 +29,13 @@ import java.util.List; import java.util.Map; import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum; import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; @@ -58,8 +59,8 @@ import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator; import org.openecomp.sdc.ci.tests.verificator.VfModuleVerificator; import org.testng.annotations.Test; -import com.clearspring.analytics.util.Pair; import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; /** * @author al714h @@ -79,8 +80,8 @@ public class VfModule extends SetupCDTest { getExtendTest().log(Status.INFO, String.format("Going to onboard the VNF %s......", vnfFile)); System.out.println(String.format("Going to onboard the VNF %s......", vnfFile)); - OnboardingUtils.createVendorLicense(getUser()); - Pair> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser()); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser()); + Pair> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser(), amdocsLicenseMembers); String vspName = createVendorSoftwareProduct.left; // DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId")); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java new file mode 100644 index 0000000000..9c2cfa809c --- /dev/null +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java @@ -0,0 +1,56 @@ +package org.openecomp.sdc.ci.tests.datatypes; + +public class AmdocsLicenseMembers { + + private String vendorId; + private String vendorLicenseName; + private String vendorLicenseAgreementId; + private String featureGroupId; + + 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; + } + + @Override + public String toString() { + return "AmdocsLicenseMembers [vendorId=" + vendorId + ", vendorLicenseName=" + vendorLicenseName + ", vendorLicenseAgreementId=" + vendorLicenseAgreementId + ", featureGroupId=" + featureGroupId + "]"; + } + + +} diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java index 76723bba11..2db818948a 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java @@ -31,9 +31,9 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Random; import java.util.stream.Collectors; +import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; @@ -328,8 +328,8 @@ public class Onboard extends SetupCDTest { getExtendTest().log(Status.INFO, String.format("going to onboard the VNF %s......", vnfFile)); System.out.println(String.format("going to onboard the VNF %s......", vnfFile)); - OnboardingUtils.createVendorLicense(getUser()); - Pair> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser()); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser()); + Pair> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser(), amdocsLicenseMembers); getExtendTest().log(Status.INFO, String.format("searching for onboarded %s", vnfFile)); HomePage.showVspRepository(); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java index 0dc6740c30..71fe44cc79 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java @@ -25,7 +25,6 @@ import static org.testng.AssertJUnit.assertEquals; import java.awt.AWTException; import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.nio.charset.StandardCharsets; import java.sql.Timestamp; import java.util.ArrayList; @@ -40,8 +39,8 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ServiceDistributionStatus; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; @@ -51,8 +50,6 @@ import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException; -import org.openecomp.sdc.toscaparser.api.common.JToscaException; import org.slf4j.LoggerFactory; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; @@ -92,23 +89,18 @@ public class OnboardViaApis{ //------------------------------------------------------------------------------------------------------- User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - private static String vendorId; - private static String vendorLicenseName; - private static String vendorLicenseAgreementId; - private static String featureGroupId; - ResourceReqDetails resourceDetails; - Timestamp timestamp = new Timestamp(System.currentTimeMillis()); + ResourceReqDetails resourceDetails; + Timestamp timestamp = new Timestamp(System.currentTimeMillis()); - @BeforeMethod - public void before(){ - LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); - lc.getLogger("org.apache").setLevel(Level.OFF); - lc.getLogger("org.*").setLevel(Level.OFF); - lc.getLogger("org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest").setLevel(Level.OFF); - resourceDetails = ElementFactory.getDefaultResource(); - - } + @BeforeMethod + public void before(){ + LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); + lc.getLogger("org.apache").setLevel(Level.OFF); + lc.getLogger("org.*").setLevel(Level.OFF); + lc.getLogger("org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest").setLevel(Level.OFF); + resourceDetails = ElementFactory.getDefaultResource(); + } @Test(dataProvider = "VNF_List") public void onboardVNFTestViaApis(String filepath, String vnfFile) throws Exception, Throwable { @@ -203,8 +195,8 @@ public class OnboardViaApis{ public Pair> onboardAndValidateViaApi(String filepath, String vnfFile, User user) throws Exception { - createVendorLicense(user); - Pair> createVendorSoftwareProduct = createVendorSoftwareProduct(vnfFile, filepath, user); + AmdocsLicenseMembers amdocsLicenseMembers = createVendorLicense(user); + Pair> createVendorSoftwareProduct = createVendorSoftwareProduct(vnfFile, filepath, user, amdocsLicenseMembers); String vspName = createVendorSoftwareProduct.left; List tags = new ArrayList<>(); tags.add(vspName); @@ -223,9 +215,9 @@ public class OnboardViaApis{ return createVendorSoftwareProduct; } - public static Pair> createVendorSoftwareProduct(String HeatFileName, String filepath, User user) + public static Pair> createVendorSoftwareProduct(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception { - Pair> pair = createVSP(HeatFileName, filepath, user); + Pair> pair = createVSP(HeatFileName, filepath, user, amdocsLicenseMembers); String vspid = pair.right.get("vspId"); @@ -245,35 +237,29 @@ public class OnboardViaApis{ assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue()); } - public static void createVendorLicense(User user) throws Exception { - vendorLicenseName = "ciLicense" + UUID.randomUUID().toString().split("-")[0]; + public static AmdocsLicenseMembers createVendorLicense(User user) throws Exception { + + AmdocsLicenseMembers amdocsLicenseMembers; + String vendorLicenseName = "ciLicense" + UUID.randomUUID().toString().split("-")[0]; RestResponse vendorLicenseResponse = OnboardingUtils.createVendorLicenseModels_1(vendorLicenseName, user); - assertEquals("did not succeed to create vendor license model", 200, - vendorLicenseResponse.getErrorCode().intValue()); - vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value"); + assertEquals("did not succeed to create vendor license model", 200, vendorLicenseResponse.getErrorCode().intValue()); + String vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value"); RestResponse vendorKeyGroupsResponse = OnboardingUtils.createVendorKeyGroups_2(vendorId, user); - assertEquals("did not succeed to create vendor key groups", 200, - vendorKeyGroupsResponse.getErrorCode().intValue()); + assertEquals("did not succeed to create vendor key groups", 200, vendorKeyGroupsResponse.getErrorCode().intValue()); String keyGroupId = ResponseParser.getValueFromJsonResponse(vendorKeyGroupsResponse.getResponse(), "value"); RestResponse vendorEntitlementPool = OnboardingUtils.createVendorEntitlementPool_3(vendorId, user); - assertEquals("did not succeed to create vendor entitlement pool", 200, - vendorEntitlementPool.getErrorCode().intValue()); - String entitlementPoolId = ResponseParser.getValueFromJsonResponse(vendorEntitlementPool.getResponse(), - "value"); + assertEquals("did not succeed to create vendor entitlement pool", 200, vendorEntitlementPool.getErrorCode().intValue()); + String entitlementPoolId = ResponseParser.getValueFromJsonResponse(vendorEntitlementPool.getResponse(), "value"); - RestResponse vendorLicenseFeatureGroups = OnboardingUtils.createVendorLicenseFeatureGroups_4(vendorId, keyGroupId, - entitlementPoolId, user); - assertEquals("did not succeed to create vendor license feature groups", 200, - vendorLicenseFeatureGroups.getErrorCode().intValue()); - featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value"); + RestResponse vendorLicenseFeatureGroups = OnboardingUtils.createVendorLicenseFeatureGroups_4(vendorId, keyGroupId, entitlementPoolId, user); + assertEquals("did not succeed to create vendor license feature groups", 200, vendorLicenseFeatureGroups.getErrorCode().intValue()); + String featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value"); RestResponse vendorLicenseAgreement = OnboardingUtils.createVendorLicenseAgreement_5(vendorId, featureGroupId, user); - assertEquals("did not succeed to create vendor license agreement", 200, - vendorLicenseAgreement.getErrorCode().intValue()); - vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(), - "value"); + assertEquals("did not succeed to create vendor license agreement", 200, vendorLicenseAgreement.getErrorCode().intValue()); + String vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(), "value"); RestResponse checkinVendorLicense = OnboardingUtils.checkinVendorLicense(vendorId, user); assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue()); @@ -281,13 +267,16 @@ public class OnboardViaApis{ RestResponse submitVendorLicense = OnboardingUtils.submitVendorLicense(vendorId, user); assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue()); + amdocsLicenseMembers = new AmdocsLicenseMembers(vendorId, vendorLicenseName, vendorLicenseAgreementId, featureGroupId); + + return amdocsLicenseMembers; } - public static Pair> createVSP(String HeatFileName, String filepath, User user) throws Exception { + public static Pair> createVSP(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception { String vspName = OnboardingUtils.handleFilename(HeatFileName); - Pair> createNewVspPair = OnboardingUtils.createNewVendorSoftwareProduct(vspName, vendorLicenseName, vendorId, vendorLicenseAgreementId, featureGroupId, user); + Pair> createNewVspPair = OnboardingUtils.createNewVendorSoftwareProduct(vspName, amdocsLicenseMembers, user); RestResponse createNewVendorSoftwareProduct = createNewVspPair.left; assertEquals("did not succeed to create new VSP", 200,createNewVendorSoftwareProduct.getErrorCode().intValue()); String vspid = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "vspId"); @@ -303,7 +292,7 @@ public class OnboardViaApis{ } vspObject.put("vspId", vspid); vspObject.put("componentId", componentId); - vspObject.put("vendorName", vendorLicenseName); + vspObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName()); vspObject.put("attContact", user.getUserId()); RestResponse uploadHeatPackage = OnboardingUtils.uploadHeatPackage(filepath, HeatFileName, vspid, user); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java index c043a65e71..f8ad51ca14 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java @@ -30,6 +30,7 @@ import java.util.Map; import java.util.stream.Collectors; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; @@ -248,8 +249,8 @@ public class VFCArtifacts extends SetupCDTest { String vnfFile = "vProbes_FE.zip"; String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip"; - OnboardingUtils.createVendorLicense(getUser()); - Pair> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser()); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser()); + Pair> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser(), amdocsLicenseMembers); String vspName = createVSP.left; resourceMetaData.setName(vspName); Map resourceMeta = createVSP.right; @@ -286,8 +287,8 @@ public class VFCArtifacts extends SetupCDTest { String snmpPollFile = "vprobes-vLB.zip"; String updatedSnmpPollFile = "vprobes-vLBAgent.zip"; - OnboardingUtils.createVendorLicense(getUser()); - Pair> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser()); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser()); + Pair> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser(), amdocsLicenseMembers); String vspName = createVSP.left; resourceMetaData.setName(vspName); Map resourceMeta = createVSP.right; @@ -336,8 +337,8 @@ public class VFCArtifacts extends SetupCDTest { String snmpFile = "vprobes-vLB.zip"; String updatedSnmpFile = "vprobes-vLB-Modified.zip"; - OnboardingUtils.createVendorLicense(getUser()); - Pair> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser()); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser()); + Pair> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser(), amdocsLicenseMembers); String vspName = createVSP.left; resourceMetaData.setName(vspName); Map resourceMeta = createVSP.right; diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java index ae05e77aff..33b9f4a77e 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java @@ -52,6 +52,7 @@ 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.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; @@ -69,8 +70,6 @@ import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.verificator.VfVerificator; import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.ExpectedConditions; -import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; import com.aventstack.extentreports.Status; @@ -81,14 +80,9 @@ public class OnboardingUtils { public OnboardingUtils() { } - private static String vendorId; - private static String vendorLicenseName; - private static String vendorLicenseAgreementId; - private static String featureGroupId; - - public static Pair> createVendorSoftwareProduct(String HeatFileName, String filepath, User user) + public static Pair> createVendorSoftwareProduct(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception { - Pair> pair = createVSP(HeatFileName, filepath, user); + Pair> pair = createVSP(HeatFileName, filepath, user, amdocsLicenseMembers); String vspid = pair.right.get("vspId"); @@ -110,12 +104,12 @@ public class OnboardingUtils { SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor software product"); } - public static Pair> createVSP(String HeatFileName, String filepath, User user) throws Exception { + public static Pair> createVSP(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception { String vspName = handleFilename(HeatFileName); SetupCDTest.getExtendTest().log(Status.INFO, "Starting to create the vendor software product"); - Pair> createNewVspPair = createNewVendorSoftwareProduct(vspName, vendorLicenseName, vendorId, vendorLicenseAgreementId, featureGroupId, user); + Pair> createNewVspPair = createNewVendorSoftwareProduct(vspName, amdocsLicenseMembers, user); RestResponse createNewVendorSoftwareProduct = createNewVspPair.left; assertEquals("did not succeed to create new VSP", 200,createNewVendorSoftwareProduct.getErrorCode().intValue()); String vspid = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "vspId"); @@ -131,7 +125,7 @@ public class OnboardingUtils { } vspObject.put("vspId", vspid); vspObject.put("componentId", componentId); - vspObject.put("vendorName", vendorLicenseName); + vspObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName()); vspObject.put("attContact", user.getUserId()); RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspid, user); @@ -283,36 +277,30 @@ public class OnboardingUtils { return response; } - public static void createVendorLicense(User user) throws Exception { + public static AmdocsLicenseMembers createVendorLicense(User user) throws Exception { + + AmdocsLicenseMembers amdocsLicenseMembers; SetupCDTest.getExtendTest().log(Status.INFO, "Starting to create the vendor license"); - vendorLicenseName = "ciLicense" + getShortUUID(); + String vendorLicenseName = "ciLicense" + getShortUUID(); RestResponse vendorLicenseResponse = createVendorLicenseModels_1(vendorLicenseName, user); - assertEquals("did not succeed to create vendor license model", 200, - vendorLicenseResponse.getErrorCode().intValue()); - vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value"); + assertEquals("did not succeed to create vendor license model", 200, vendorLicenseResponse.getErrorCode().intValue()); + String vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value"); RestResponse vendorKeyGroupsResponse = createVendorKeyGroups_2(vendorId, user); - assertEquals("did not succeed to create vendor key groups", 200, - vendorKeyGroupsResponse.getErrorCode().intValue()); + assertEquals("did not succeed to create vendor key groups", 200, vendorKeyGroupsResponse.getErrorCode().intValue()); String keyGroupId = ResponseParser.getValueFromJsonResponse(vendorKeyGroupsResponse.getResponse(), "value"); RestResponse vendorEntitlementPool = createVendorEntitlementPool_3(vendorId, user); - assertEquals("did not succeed to create vendor entitlement pool", 200, - vendorEntitlementPool.getErrorCode().intValue()); - String entitlementPoolId = ResponseParser.getValueFromJsonResponse(vendorEntitlementPool.getResponse(), - "value"); + assertEquals("did not succeed to create vendor entitlement pool", 200, vendorEntitlementPool.getErrorCode().intValue()); + String entitlementPoolId = ResponseParser.getValueFromJsonResponse(vendorEntitlementPool.getResponse(), "value"); - RestResponse vendorLicenseFeatureGroups = createVendorLicenseFeatureGroups_4(vendorId, keyGroupId, - entitlementPoolId, user); - assertEquals("did not succeed to create vendor license feature groups", 200, - vendorLicenseFeatureGroups.getErrorCode().intValue()); - featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value"); + RestResponse vendorLicenseFeatureGroups = createVendorLicenseFeatureGroups_4(vendorId, keyGroupId, entitlementPoolId, user); + assertEquals("did not succeed to create vendor license feature groups", 200, vendorLicenseFeatureGroups.getErrorCode().intValue()); + String featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value"); RestResponse vendorLicenseAgreement = createVendorLicenseAgreement_5(vendorId, featureGroupId, user); - assertEquals("did not succeed to create vendor license agreement", 200, - vendorLicenseAgreement.getErrorCode().intValue()); - vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(), - "value"); + assertEquals("did not succeed to create vendor license agreement", 200, vendorLicenseAgreement.getErrorCode().intValue()); + String vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(), "value"); RestResponse checkinVendorLicense = checkinVendorLicense(vendorId, user); assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue()); @@ -321,6 +309,10 @@ public class OnboardingUtils { assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue()); SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor license"); + + amdocsLicenseMembers = new AmdocsLicenseMembers(vendorId, vendorLicenseName, vendorLicenseAgreementId, featureGroupId); + + return amdocsLicenseMembers; } private static String getShortUUID() { @@ -441,7 +433,7 @@ public class OnboardingUtils { jTimeObject.put("other", ""); JSONObject jObjectBody = new JSONObject(); - jObjectBody.put("name", "def"); + jObjectBody.put("name", "def"+ getShortUUID()); jObjectBody.put("description", "new vendor license entitlement pool"); jObjectBody.put("thresholdValue", "23"); jObjectBody.put("thresholdUnits", "Absolute"); @@ -470,7 +462,7 @@ public class OnboardingUtils { jOperationalScope.put("other", ""); JSONObject jObjectBody = new JSONObject(); - jObjectBody.put("name", "keyGroup"); + jObjectBody.put("name", "keyGroup" + getShortUUID()); jObjectBody.put("description", "new vendor license key group"); jObjectBody.put("operationalScope", jOperationalScope); jObjectBody.put("type", "Universal"); @@ -482,9 +474,7 @@ public class OnboardingUtils { return response; } - public static Pair> createNewVendorSoftwareProduct(String name, String vendorName, String vendorId, - String licenseAgreementId, String featureGroupsId, User user) throws Exception { - + public static Pair> createNewVendorSoftwareProduct(String name, AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception { Map vspMetadta = new HashMap(); Config config = Utils.getConfig(); @@ -494,8 +484,8 @@ public class OnboardingUtils { String userId = user.getUserId(); JSONObject jlicensingDataObj = new JSONObject(); - jlicensingDataObj.put("licenseAgreement", licenseAgreementId); - jlicensingDataObj.put("featureGroups", Arrays.asList(featureGroupsId).toArray()); + jlicensingDataObj.put("licenseAgreement", amdocsLicenseMembers.getVendorLicenseAgreementId()); + jlicensingDataObj.put("featureGroups", Arrays.asList(amdocsLicenseMembers.getFeatureGroupId()).toArray()); JSONObject jlicensingVersionObj = new JSONObject(); jlicensingVersionObj.put("id", "1.0"); @@ -508,8 +498,8 @@ public class OnboardingUtils { jObject.put("subCategory", "resourceNewCategory.generic.database"); jObject.put("onboardingMethod", "HEAT"); jObject.put("licensingVersion", jlicensingVersionObj); - jObject.put("vendorName", vendorName); - jObject.put("vendorId", vendorId); + jObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName()); + jObject.put("vendorId", amdocsLicenseMembers.getVendorId()); jObject.put("icon", "icon"); jObject.put("licensingData", jlicensingDataObj); @@ -521,7 +511,6 @@ public class OnboardingUtils { HttpRequest http = new HttpRequest(); RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap); - return new Pair>(response, vspMetadta); } @@ -748,8 +737,8 @@ public class OnboardingUtils { ExtentTestActions.log(Status.INFO, String.format("Going to onboard the VNF %s", vnfFile)); System.out.println(String.format("Going to onboard the VNF %s", vnfFile)); - createVendorLicense(user); - Pair> createVendorSoftwareProduct = createVendorSoftwareProduct(vnfFile, filepath, user); + AmdocsLicenseMembers amdocsLicenseMembers = createVendorLicense(user); + Pair> createVendorSoftwareProduct = createVendorSoftwareProduct(vnfFile, filepath, user, amdocsLicenseMembers); String vspName = createVendorSoftwareProduct.left; DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId")); -- cgit 1.2.3-korg