aboutsummaryrefslogtreecommitdiffstats
path: root/ui-ci
diff options
context:
space:
mode:
Diffstat (limited to 'ui-ci')
-rw-r--r--ui-ci/pom.xml8
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java26
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java13
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MobProxy.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java1
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java1
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java12
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java6
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java20
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java26
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/businesslogic/ArtifactBusinessLogic.java14
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java72
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java56
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java151
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ConnectionWizardPopUpObject.java58
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java68
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceContainer.java51
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserManagementTab.java1
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java86
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java8
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/DeploymentViewTests.java53
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java3
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java40
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java77
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java230
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlows.java400
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java127
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PortMirroring.java124
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignment.java95
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java49
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidationTest.java599
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java79
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java20
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java111
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java71
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/AttFtpClient.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java7
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java11
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java15
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/MobProxy.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/Retry.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java39
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java12
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTestManager.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java1
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentPage.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java1
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesAssignmentPage.java149
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java1
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java12
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasElement.java54
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java179
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java3
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java36
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java34
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java11
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/HomeUtils.java1
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java969
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtillViaApis.java362
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java814
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java3
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java16
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java18
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/DeploymentViewVerificator.java103
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ErrorMessageUIVerificator.java3
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/PropertyVerificator.java18
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java4
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ToscaValidation.java198
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/UserManagementVerificator.java2
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java23
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java10
-rw-r--r--ui-ci/src/main/resources/ci/conf/attsdc.yaml16
-rw-r--r--ui-ci/src/main/resources/ci/scripts/startTest.sh4
-rw-r--r--ui-ci/src/main/resources/ci/testSuites/devOnboardE2EOneFileSanity.xml14
-rw-r--r--ui-ci/src/main/resources/ci/testSuites/extendedSanity.xml12
-rw-r--r--ui-ci/src/main/resources/ci/testSuites/onboardVNFWithoutDistribution.xml16
-rw-r--r--ui-ci/src/main/resources/ci/testSuites/toscaValidationSuite.xml2
83 files changed, 3715 insertions, 2250 deletions
diff --git a/ui-ci/pom.xml b/ui-ci/pom.xml
index 20597acbde..ff0973c650 100644
--- a/ui-ci/pom.xml
+++ b/ui-ci/pom.xml
@@ -14,6 +14,7 @@
<properties>
<sonar.skip>true</sonar.skip>
+ <jacoco.skip>true</jacoco.skip>
</properties>
<dependencies>
@@ -21,6 +22,7 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
+<!-- <version>21.0</version> -->
<scope>compile</scope>
</dependency>
@@ -28,12 +30,14 @@
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
+<!-- <version>3.4.0</version> -->
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.53.1</version>
+<!-- <version>3.4.0</version> -->
<scope>runtime</scope>
</dependency>
@@ -55,7 +59,7 @@
<groupId>org.openecomp.sdc</groupId>
<artifactId>test-apis-ci</artifactId>
<version>${project.version}</version>
- <!-- <classifier>jar-with-dependencies</classifier> -->
+ <!-- <classifier>jar-with-dependencies</classifier> -->
<scope>compile</scope>
</dependency>
@@ -176,7 +180,7 @@
<dependency>
<groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-distribution-client</artifactId>
- <version>1.1.9-SNAPSHOT</version>
+ <version>1.1.50</version>
<scope>compile</scope>
</dependency>
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 06e55bc51f..47fd8330c5 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
@@ -49,16 +49,15 @@ import org.openecomp.sdc.ci.tests.pages.HomePage;
import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
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.general.OnboardingUtils;
import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
import org.testng.Assert;
-import org.testng.SkipException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import com.aventstack.extentreports.Status;
import com.clearspring.analytics.util.Pair;
@@ -67,7 +66,7 @@ public class AddComponentInstancesArtifactsInCsar extends SetupCDTest {
private String filePath;
@BeforeClass
public void beforeClass(){
- filePath = System.getProperty("filepath");
+ filePath = System.getProperty("filePath");
if (filePath == null && System.getProperty("os.name").contains("Windows")) {
filePath = FileHandling.getResourcesFilesPath() + "AddComponentInstancesArtifactsInCsar"+ File.separator;
}
@@ -86,16 +85,17 @@ public class AddComponentInstancesArtifactsInCsar extends SetupCDTest {
String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip";
AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser());
- Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser(), amdocsLicenseMembers);
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(resourceReqDetails, vnfFile, filePath, getUser(), amdocsLicenseMembers);
String vspName = createVSP.left;
resourceMetaData.setName(vspName);
Map<String, String> resourceMeta = createVSP.right;
String vspid = resourceMeta.get("vspId");
OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser());
- OnboardingUtils.prepareVspForUse(getUser(), vspid);
+ OnboardingUtils.prepareVspForUse(getUser(), vspid, "0.1");
HomePage.showVspRepository();
- OnboardingUtils.importVSP(createVSP);
+ OnboardingUiUtils.importVSP(createVSP);
resourceMetaData.setVersion("0.1");
Resource vfResource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), resourceMetaData.getVersion());
@@ -196,10 +196,6 @@ public class AddComponentInstancesArtifactsInCsar extends SetupCDTest {
} else {
compareArtifacts(artifactFromJavaObject.get(key), artifactsFromFileStructure.get(key));
}
-
-
-
-
}
}
@@ -378,10 +374,10 @@ public class AddComponentInstancesArtifactsInCsar extends SetupCDTest {
// Check response of external API
Integer responseCode = uploadArtifactRestResponse.getErrorCode();
- if(responseCode.equals(404)) {
- getExtendTest().log(Status.SKIP, String.format("DE271521"));
- throw new SkipException("DE271521");
- }
+// if(responseCode.equals(404)) {
+// getExtendTest().log(Status.SKIP, String.format("DE271521"));
+// throw new SkipException("DE271521");
+// }
Assert.assertEquals(responseCode, (Integer)200, "Response code is not correct.");
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 8c282e8b88..e2650fe4b3 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
@@ -30,18 +30,19 @@ 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.ResourceReqDetails;
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;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
+import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
import com.clearspring.analytics.util.Pair;
public class LocalGeneralUtilities {
public LocalGeneralUtilities() {
- // TODO Auto-generated constructor stub
}
public static final String FILE_PATH = FileHandling.getBasePath() + "\\src\\main\\resources\\Files\\VNFs\\";
public static final String Env_FILE_PATH = FileHandling.getBasePath() + "\\src\\main\\resources\\Files\\Env_files\\";
@@ -74,12 +75,12 @@ public static List<String> getValuesFromJsonArray(RestResponse message) throws E
return artifactTypesArrayFromApi;
}
-public static String simpleOnBoarding(String fileName, String filePath,User user) throws Exception {
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(user);
- Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(fileName, filePath, user, amdocsLicenseMembers);
+public static String simpleOnBoarding(ResourceReqDetails resourceReqDetails, String fileName, String filePath,User user) throws Exception {
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(user);
+ Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, fileName, filePath, user, amdocsLicenseMembers);
String vspName = createVendorSoftwareProduct.left;
HomePage.showVspRepository();
- OnboardingUtils.importVSP(createVendorSoftwareProduct);
+ OnboardingUiUtils.importVSP(createVendorSoftwareProduct);
GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()).click();
GeneralUIUtils.waitForLoader();
return vspName;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
index 3fb1529461..a7d96dd2c7 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
@@ -30,7 +30,6 @@ import org.apache.commons.io.FileUtils;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
-import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
@@ -52,7 +51,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.ArtifactRestUtils;
import org.testng.Assert;
-import org.testng.SkipException;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MobProxy.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MobProxy.java
index 179c300a18..8195976d69 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MobProxy.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MobProxy.java
@@ -23,14 +23,12 @@ package org.openecomp.sdc.ci.tests.US;
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
+import java.net.Proxy;
import java.net.ProxySelector;
import java.net.SocketAddress;
import java.net.URI;
import java.util.List;
-import java.net.Proxy;
-
-import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java
index 2195af9a90..1600b3df52 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java
@@ -24,7 +24,6 @@ import static org.testng.AssertJUnit.assertTrue;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
-import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java
index df68a1893a..816a89af1d 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java
@@ -25,7 +25,6 @@ import java.util.List;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
-import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java
index a4c7ffa632..6ae9a34a84 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java
@@ -28,15 +28,15 @@ import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
-import org.openecomp.sdc.ci.tests.execute.sanity.Onboard;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.ci.tests.pages.CompositionPage;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
@@ -47,14 +47,14 @@ import com.clearspring.analytics.util.Pair;
public class Service_Tests_UI extends SetupCDTest{
public Service_Tests_UI() {
- // TODO Auto-generated constructor stub
}
// US839610 - E2E Declare VL / CP properties as inputs in service level
@Test
public void declareVL_CP_InputsInServiceLevel() throws Exception {
String vnfFile = "FDNT.zip";
- Pair<String,Map<String,String>> VspName =OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String,Map<String,String>> VspName = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser());
ServiceUIUtils.createService(servicemetadata, getUser());
GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
@@ -72,7 +72,8 @@ public class Service_Tests_UI extends SetupCDTest{
@Test
public void CreateServiceWithCpInstance() throws Exception {
String vnfFile = "FDNT.zip";
- Pair<String,Map<String,String>> VspName =OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String,Map<String,String>> VspName = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser());
ServiceUIUtils.createService(servicemetadata, getUser());
GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
@@ -99,7 +100,6 @@ public class Service_Tests_UI extends SetupCDTest{
@Override
protected UserRoleEnum getRole() {
- // TODO Auto-generated method stub
return UserRoleEnum.DESIGNER;
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java
index 8e669b1fac..9c727bb100 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java
@@ -22,7 +22,6 @@ package org.openecomp.sdc.ci.tests.US;
import java.io.File;
import java.text.SimpleDateFormat;
-import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -30,14 +29,11 @@ import java.util.Set;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaParameterConstants;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaTopologyTemplateDefinition;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
import org.testng.Assert;
-import fj.data.Array;
-
@@ -179,7 +175,7 @@ public class Testing {
additionalInputs = objectHelper.getNode_types().get(key).getProperties();
}
}
- topologyTemplate.addInputs(additionalInputs);
+// topologyTemplate.addInputs(additionalInputs);
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 64caee87e9..3efb42d569 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,11 +29,13 @@ import java.util.List;
import java.util.Map;
import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders;
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.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
@@ -49,12 +51,13 @@ import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
import org.openecomp.sdc.ci.tests.utilities.DownloadManager;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
import org.openecomp.sdc.ci.tests.utils.CsarParserUtils;
import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
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.general.OnboardingUtils;
import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
import org.openecomp.sdc.ci.tests.verificator.VfModuleVerificator;
import org.testng.annotations.Test;
@@ -73,15 +76,20 @@ public class VfModule extends SetupCDTest {
@Test
public void checkVfModulesCountAndStructure() throws Exception, AWTException {
-// String filepath = "src\\main\\resources\\Files\\VNFs";
+// String filePath = "src\\main\\resources\\Files\\VNFs";
String filepath = FileHandling.getVnfRepositoryPath();
// String vnfFile = "LDSA.zip";
- String vnfFile = "FDNT.zip";
+// String vnfFile = "FDNT.zip";
+ List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure();
+ List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(1, fileNamesFromFolder);
+ String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath();
+ String vnfFile = newRandomFileNamesFromFolder.get(0);
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));
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser());
- Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser(), amdocsLicenseMembers);
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser());
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, getUser(), amdocsLicenseMembers);
String vspName = createVendorSoftwareProduct.left;
//
DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId"));
@@ -92,7 +100,7 @@ public class VfModule extends SetupCDTest {
HomePage.showVspRepository();
getExtendTest().log(Status.INFO, String.format("Going to import %s......", vnfFile.substring(0, vnfFile.indexOf("."))));
- OnboardingUtils.importVSP(createVendorSoftwareProduct);
+ OnboardingUiUtils.importVSP(createVendorSoftwareProduct);
ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java
index 677eb8cb10..c3d980163e 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java
@@ -20,39 +20,16 @@
package org.openecomp.sdc.ci.tests.US;
-import java.awt.AWTException;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.ci.tests.config.Config;
-import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
-import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ArtifactPageEnum;
-import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
-import org.openecomp.sdc.ci.tests.execute.sanity.Onboard;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
-import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
-import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
-import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.FileHandling;
-import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
-import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
-import org.openqa.selenium.WebElement;
-import org.testng.Assert;
-import org.testng.annotations.Test;
public class Vf_Tests_UI extends SetupCDTest{
public Vf_Tests_UI() {
- // TODO Auto-generated constructor stub
}
public void uploadHeatEnvVFLevel() throws Exception {
@@ -68,7 +45,7 @@ public class Vf_Tests_UI extends SetupCDTest{
// String secondEnvArtifact = "mod_vmsi_dnt_fw_parent.env";
// String filePath=Config.instance().getWindowsDownloadDirectory();
// String vnfFile = "FDNT.zip";
-// OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+// OnboardingUiUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
// Map<String,File> mD5OfFilesToValidate = new HashMap<String,File>();
// mD5OfFilesToValidate.put(firstEnvArtifact,new File(FileHandling.getResourcesEnvFilesPath() + firstEnvArtifact));
// mD5OfFilesToValidate.put(secondEnvArtifact,new File(FileHandling.getResourcesEnvFilesPath() + secondEnvArtifact));
@@ -88,7 +65,6 @@ public class Vf_Tests_UI extends SetupCDTest{
// }
@Override
protected UserRoleEnum getRole() {
- // TODO Auto-generated method stub
return UserRoleEnum.DESIGNER;
}
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java
index 6fcede0fce..0123bfedc1 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java
@@ -28,11 +28,9 @@ import java.util.Set;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
-import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum;
-import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
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.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/businesslogic/ArtifactBusinessLogic.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/businesslogic/ArtifactBusinessLogic.java
index 6dce83fd40..3b15686733 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/businesslogic/ArtifactBusinessLogic.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/businesslogic/ArtifactBusinessLogic.java
@@ -42,6 +42,7 @@ import org.openecomp.sdc.ci.tests.pages.HomePage;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import com.clearspring.analytics.util.Pair;
+import com.google.gson.Gson;
public class ArtifactBusinessLogic {
@@ -175,7 +176,18 @@ public class ArtifactBusinessLogic {
pair = Pair.create(envParametersMap.get(key).left, "\"" + parameter.getValue() + "\"");
}else if(envParametersMap.get(key).left.equals("string") && parameter.getValue() == null){
pair = Pair.create(envParametersMap.get(key).left, "");
- }else if(parameter.getValue() == null){
+ }else if(parameter.getValue() == null) {
+ pair = Pair.create(envParametersMap.get(key).left, "");
+ } else if(envParametersMap.get(key).left.equals("json") && parameter.getValue() != null){
+ String pairValue = "";
+ Gson gson = new Gson();
+ if(parameter.getValue() instanceof java.util.LinkedHashMap){
+ pairValue = gson.toJson(parameter.getValue());
+ }
+// pair = Pair.create(envParametersMap.get(key).left, "\"" + pairValue + "\"");
+ pair = Pair.create(envParametersMap.get(key).left, pairValue );
+
+ }else if(envParametersMap.get(key).left.equals("json") && parameter.getValue() == null){
pair = Pair.create(envParametersMap.get(key).left, "");
}else{
pair = Pair.create(envParametersMap.get(key).left, parameter.getValue());
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java
index 69037500a2..ad9ce781c8 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/dataProvider/OnbordingDataProviders.java
@@ -1,26 +1,23 @@
package org.openecomp.sdc.ci.tests.dataProvider;
-import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.openecomp.sdc.ci.tests.execute.sanity.ToscaValidationTest;
-import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
-
public class OnbordingDataProviders {
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.getVnfNamesFileList();
+ 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);
@@ -30,12 +27,29 @@ public class OnbordingDataProviders {
private static final Object[][] VnfList() throws Exception {
List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
-
+
System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
return provideData(fileNamesFromFolder, filepath);
}
-
-// -----------------------factories-----------------------------------------
+
+ @DataProvider(name = "updateList")
+ private static final Object[][] updateList() throws Exception {
+
+ Object[][] objectArr = new Object[2][];
+
+ Object[][] filteredArObject = null;
+
+ objectArr[0] = new Object[]{ "1-2016-20-visbc3vf-(VOIP)_v2.1.zip", "2-2016-20-visbc3vf-(VOIP)_v2.1_RenameResourceToShay.zip" };
+ objectArr[1] = new Object[]{ "1-2017-404_vUSP_vCCF_AIC3.0-(VOIP)_v6.0.zip", "2-2017-404_vUSP_vCCF_AIC3.0-(VOIP)_v6.0_Added2TestParameters.zip" };
+
+ filteredArObject = OnboardingUtils.filterObjectArrWithExcludedVnfs(objectArr);
+
+ return filteredArObject;
+
+
+ }
+
+ // -----------------------factories-----------------------------------------
@Factory(dataProvider = "VNF_List")
public Object[] OnbordingDataProviders(String filepath, String vnfFile){
return new Object[] { new ToscaValidationTest(filepath, vnfFile)};
@@ -54,7 +68,7 @@ public class OnbordingDataProviders {
return arObject;
}
- private static List<String> getRandomElements(int randomElementNumber, List<String> fileNamesFromFolder) {
+ public static List<String> getRandomElements(int randomElementNumber, List<String> fileNamesFromFolder) {
if(fileNamesFromFolder.size() == 0 || fileNamesFromFolder.size() < randomElementNumber){
return null;
}else{
@@ -71,8 +85,38 @@ public class OnbordingDataProviders {
return newRandomFileNamesFromFolder;
}
}
-
-
-
-
+
+
+// private static String[][] arrangeFilesVersionPairs(List<String> filesArr) {
+// String[][] filesArrangeByPairs = null;
+//
+// List<String> versionOneFiles= null;
+// List<String> versionTowFiles= null;
+//
+// for ( String fileName : filesArr )
+// {
+// if(fileName.startsWith("1-"))
+// {
+// versionOneFiles.add(fileName);
+// }
+// else if(fileName.startsWith("2-"))
+// {
+// versionTowFiles.add(fileName);
+// }
+// }
+//
+// Collections.sort(versionOneFiles);
+// Collections.sort(versionTowFiles);
+//
+// for (int i=0 ; i<versionOneFiles.size() ; i++ )
+// {
+// for (int j=0 ; j<versionTowFiles.size() ; j++ )
+// {
+//
+// }
+// }
+//
+// return filesArrangeByPairs;
+// }
+
}
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
deleted file mode 100644
index 9c2cfa809c..0000000000
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/AmdocsLicenseMembers.java
+++ /dev/null
@@ -1,56 +0,0 @@
-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/datatypes/CanvasManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java
index 25ed4c2d91..b4f50020df 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java
@@ -25,12 +25,15 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
+import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.datatypes.enums.CircleSize;
import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.StaleElementReferenceException;
@@ -39,6 +42,7 @@ import org.openqa.selenium.interactions.Actions;
import org.testng.Assert;
import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
public final class CanvasManager {
private Map<String, CanvasElement> canvasElements;
@@ -48,8 +52,14 @@ public final class CanvasManager {
private CanvasElement canvasElement;
// Offsets Are used to find upper right corner of canvas element in order to
// connect links
- private static final int CANVAS_ELEMENT_Y_OFFSET = 30;
- private static final int CANVAS_ELEMENT_X_OFFSET = 18; // 14 - 27
+ private static final int CANVAS_VF_Y_OFFSET = 30;
+ private static final int CANVAS_VF_X_OFFSET = 18; // 14 - 27
+
+ private static final int CANVAS_NORMATIVE_ELEMENT_Y_OFFSET = 12;
+ private static final int CANVAS_NORMATIVE_ELEMENT_X_OFFSET = 7;
+
+ private static final int CANVAS_SERVICE_Y_OFFSET = 27;
+ private static final int CANVAS_SERVICE_X_OFFSET = 16;
private CanvasManager() {
canvasElements = new HashMap<>();
@@ -116,6 +126,8 @@ public final class CanvasManager {
actions.perform();
actions.click().perform();
GeneralUIUtils.ultimateWait();
+
+ validateInstanceSelected(canvasElement);
ExtentTestActions.log(Status.INFO, String.format("Canvas element %s selected", canvasElement.getElementType()));
}
@@ -152,7 +164,7 @@ public final class CanvasManager {
}
return null;
}
-
+
public CanvasElement createElementOnCanvas(String elementName) throws Exception {
String actionDuration = GeneralUIUtils.getActionDuration(() -> {
try {
@@ -161,13 +173,13 @@ public final class CanvasManager {
e.printStackTrace();
}
});
-
+
if (canvasElement != null){
ExtentTestActions.log(Status.INFO, String.format("The element %s should now be on the canvas", elementName), actionDuration);
}
return canvasElement;
}
-
+
private CanvasElement createElementOnCanvasWithoutDuration(String elementDataTestId) throws Exception {
try {
WebElement element = findClickElement(elementDataTestId);
@@ -183,7 +195,7 @@ public final class CanvasManager {
addCanvasElement(canvasElement);
GeneralUIUtils.ultimateWait();
return canvasElement;
- }
+ }
catch (Exception e) {
System.out.println("Can't create element on canvas");
e.printStackTrace();
@@ -218,6 +230,7 @@ public final class CanvasManager {
return new ImmutablePair<Integer, Integer>(xElement, yElement);
}
+ // Will work only if 2 elements are big sized (VF size), if one of the elements is Small use the function linkElements
public void linkElements(CanvasElement firstElement, CanvasElement secondElement) throws Exception {
ExtentTestActions.log(Status.INFO, String.format("Linking between the %s instance and the %s instance.", firstElement.getElementType(), secondElement.getElementType()));
drawSimpleLink(firstElement, secondElement);
@@ -225,20 +238,41 @@ public final class CanvasManager {
ExtentTestActions.log(Status.INFO, String.format("The instances %s and %s should now be connected.", firstElement.getElementType(), secondElement.getElementType()));
}
+ public void linkElements(CanvasElement firstElement, CircleSize firstElementSize, CanvasElement secondElement, CircleSize secondElementSize) throws Exception {
+ drawSimpleLink(firstElement,firstElementSize, secondElement,secondElementSize);
+ selectReqAndCapAndConnect();
+ ExtentTestActions.log(Status.INFO, String.format("The instances %s and %s should now be connected.", firstElement.getElementType(), secondElement.getElementType()));
+ }
+
private void selectReqAndCapAndConnect() throws Exception {
- // Select First Cap
- GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0).click();
- // Select First Req
- GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0).click();
- // Connect
- GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click();
+ addFitstReqOrCapAndPressNext();
+ addFitstReqOrCapAndPressNext();
+ linkMenuClickOnFinishButton();
+ }
- GeneralUIUtils.waitForLoader();
+ private void addFitstReqOrCapAndPressNext() throws Exception {
+ addFirstReqOrCap();
+ linkMenuClickOnNextButton();
}
+ private void addFirstReqOrCap() {
+ GeneralUIUtils.getWebElementsListByClassName(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP_Or_REQ.getValue()).get(0).click();
+ }
+
+ private void linkMenuClickOnNextButton() throws Exception {
+ GeneralUIUtils.clickOnElementByText("Next");
+ GeneralUIUtils.ultimateWait();
+ }
+
+ private void linkMenuClickOnFinishButton() throws Exception {
+ GeneralUIUtils.clickOnElementByText("Finish");
+ GeneralUIUtils.ultimateWait();
+ }
+
+
private void drawSimpleLink(CanvasElement firstElement, CanvasElement secondElement) throws Exception {
- int yOffset = CANVAS_ELEMENT_Y_OFFSET;
- int xOffset = CANVAS_ELEMENT_X_OFFSET;
+ int yOffset = CANVAS_VF_Y_OFFSET;
+ int xOffset = CANVAS_VF_X_OFFSET;
actions.moveToElement(canvas, firstElement.getLocation().left + xOffset,
firstElement.getLocation().right - yOffset);
@@ -250,6 +284,45 @@ public final class CanvasManager {
GeneralUIUtils.ultimateWait();
}
+ private void drawSimpleLink(CanvasElement firstElement, CircleSize firstElementSize, CanvasElement secondElement, CircleSize secondElementSize) throws Exception {
+ ExtentTestActions.log(Status.INFO, String.format("Linking between the %s instance and the %s instance.", firstElement.getElementType(), secondElement.getElementType()));
+ Integer yOffset = getCircleOffset(firstElementSize).right;
+ Integer xOffset = getCircleOffset(firstElementSize).left;
+ firstElement.getElementType();
+
+
+ actions.moveToElement(canvas, firstElement.getLocation().left + xOffset,
+ firstElement.getLocation().right - yOffset);
+
+ actions.clickAndHold();
+
+ yOffset = getCircleOffset(secondElementSize).right;
+ xOffset = getCircleOffset(secondElementSize).left;
+
+ actions.moveToElement(canvas, secondElement.getLocation().left + xOffset, secondElement.getLocation().right - yOffset);
+ actions.release();
+ actions.perform();
+ GeneralUIUtils.ultimateWait();
+ }
+
+ private Pair<Integer,Integer> getCircleOffset(CircleSize circleSize)
+ {
+ Pair<Integer,Integer> circleSizes;
+ if(circleSize.equals(CircleSize.VF))
+ {
+ circleSizes = new Pair <Integer,Integer> (CANVAS_VF_X_OFFSET,CANVAS_VF_Y_OFFSET);
+ }
+ else if (circleSize.equals(CircleSize.NORMATIVE))
+ {
+ circleSizes = new Pair <Integer,Integer> (CANVAS_NORMATIVE_ELEMENT_X_OFFSET,CANVAS_NORMATIVE_ELEMENT_Y_OFFSET);
+ }
+ else
+ {
+ circleSizes = new Pair <Integer,Integer> (CANVAS_SERVICE_X_OFFSET,CANVAS_SERVICE_Y_OFFSET);
+ }
+ return circleSizes;
+ }
+
public String updateElementNameInCanvas(CanvasElement canvasElement, String newInstanceName) throws Exception {
GeneralUIUtils.ultimateWait();;
clickOnCanvaElement(canvasElement);
@@ -265,4 +338,52 @@ public final class CanvasManager {
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Name of element instance changed from %s to %s", oldInstanceName, newInstanceName));
return oldInstanceName;
}
+
+ /**
+ * @param canvasElement
+ * Validate that instance was selected on right sidebar
+ */
+ public void validateInstanceSelected(CanvasElement canvasElement) {
+ long maxWait = 3000;
+ long sumOfWaiting = 0;
+ long napPeriod = 200;
+ boolean isInstanceSelected;
+ do {
+ isInstanceSelected = CompositionPage.getSelectedInstanceName().contains(canvasElement.getElementType());
+
+ if (!isInstanceSelected) {
+ try {
+ TimeUnit.MILLISECONDS.sleep(napPeriod);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ sumOfWaiting += napPeriod;
+ if (sumOfWaiting > maxWait) {
+ Assert.fail(String.format("Can't select instance properly, waited for %s seconds", (int) (maxWait/1000)));
+ }
+ } while (!isInstanceSelected);
+ }
+
+ private void selectReqCapByName(String reqCapName)
+ {
+ GeneralUIUtils.clickOnElementByText(reqCapName);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ private void selectTypeOfReqCap(String reqCapType)
+ {
+ GeneralUIUtils.getSelectList(reqCapType,DataTestIdEnum.LinkMenuItems.REQ_CAP_SELECT_DATA_TESTS_ID.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public void linkElementsAndSelectCapReqTypeAndCapReqName(CanvasElement firstElement, CircleSize firstElementSize, CanvasElement secondElement, CircleSize secondElementSize, ConnectionWizardPopUpObject connectionWizardPopUpObject) throws Exception {
+ drawSimpleLink(firstElement, firstElementSize, secondElement, secondElementSize);
+ selectTypeOfReqCap(connectionWizardPopUpObject.getCapabilityTypeSecondItem());
+ addFitstReqOrCapAndPressNext();
+ selectReqCapByName(connectionWizardPopUpObject.getCapabilityNameSecondItem());
+ linkMenuClickOnNextButton();
+ linkMenuClickOnFinishButton();
+ }
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ConnectionWizardPopUpObject.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ConnectionWizardPopUpObject.java
new file mode 100644
index 0000000000..be957fb87b
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ConnectionWizardPopUpObject.java
@@ -0,0 +1,58 @@
+package org.openecomp.sdc.ci.tests.datatypes;
+
+public class ConnectionWizardPopUpObject {
+
+ private String capabilityTypeFirstItem;
+ private String capabilityTypeSecondItem;
+ private String capabilityNameFirstItem;
+ private String capabilityNameSecondItem;
+
+ public ConnectionWizardPopUpObject(String capabilityTypeFirstItem, String capabilityNameFirstItem, String capabilityTypeSecondItem, String capabilityNameSecondItem) {
+ this.capabilityTypeFirstItem = capabilityTypeFirstItem;
+ this.capabilityTypeSecondItem = capabilityTypeSecondItem;
+ this.capabilityNameFirstItem = capabilityNameFirstItem;
+ this.capabilityNameSecondItem = capabilityNameSecondItem;
+ }
+
+ public String getCapabilityTypeFirstItem() {
+ return capabilityTypeFirstItem;
+ }
+
+ public void setCapabilityTypeFirstItem(String capabilityTypeFirstItem) {
+ this.capabilityTypeFirstItem = capabilityTypeFirstItem;
+ }
+
+ public String getCapabilityTypeSecondItem() {
+ return capabilityTypeSecondItem;
+ }
+
+ public void setCapabilityTypeSecondItem(String capabilityTypeSecondItem) {
+ this.capabilityTypeSecondItem = capabilityTypeSecondItem;
+ }
+
+ public String getCapabilityNameFirstItem() {
+ return capabilityNameFirstItem;
+ }
+
+ public void setCapabilityNameFirstItem(String capabilityNameFirstItem) {
+ this.capabilityNameFirstItem = capabilityNameFirstItem;
+ }
+
+ public String getCapabilityNameSecondItem() {
+ return capabilityNameSecondItem;
+ }
+
+ public void setCapabilityNameSecondItem(String capabilityNameSecondItem) {
+ this.capabilityNameSecondItem = capabilityNameSecondItem;
+ }
+
+ @Override
+ public String toString() {
+ return "ConnectionWizardPopUpObject{" +
+ "capabilityTypeFirstItem='" + capabilityTypeFirstItem + '\'' +
+ ", capabilityTypeSecondItem='" + capabilityTypeSecondItem + '\'' +
+ ", capabilityNameFirstItem='" + capabilityNameFirstItem + '\'' +
+ ", capabilityNameSecondItem='" + capabilityNameSecondItem + '\'' +
+ '}';
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
index f2e46b2973..fdd6a572a4 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
@@ -151,11 +151,13 @@ public final class DataTestIdEnum {
}
public enum LinkMenuItems {
- CANCEL_BUTTON("link-menu-button-cancel"),
- CONNECT_BUTTON("link-menu-button-connect"),
- LINK_ITEM_CAP("link-item-capabilities"),
- LINK_ITEM_REQ("link-item-requirements"),
- LINK_MENU("link-menu-open");
+// CANCEL_BUTTON("link-menu-button-cancel"),
+// CONNECT_BUTTON("link-menu-button-connect"),
+// LINK_ITEM_CAP("link-item-capabilities"),
+// LINK_ITEM_REQ("link-item-requirements"),
+// LINK_MENU("link-menu-open");
+ LINK_ITEM_CAP_Or_REQ("req-or-cap-item"),
+ REQ_CAP_SELECT_DATA_TESTS_ID("SelectType");
private String value;
@@ -167,6 +169,9 @@ public final class DataTestIdEnum {
this.value = value;
}
}
+
+
+
public enum GeneralCanvasItems {
CANVAS("canvas"),
@@ -434,19 +439,20 @@ public final class DataTestIdEnum {
}
public enum StepsEnum {
- GENERAL("General"),
+ GENERAL("GeneralLeftSideMenu"),
ICON("Iconstep"),
- DEPLOYMENT_ARTIFACT("Deployment Artifact"),
- INFORMATION_ARTIFACT("Information Artifact"),
- PROPERTIES("Properties"),
- COMPOSITION("Composition"),
- ACTIVITY_LOG("Activity Log"),
- DEPLOYMENT_VIEW("Deployment"),
- TOSCA_ARTIFACTS("TOSCA Artifacts"),
- MONITOR("Monitor "),
- MANAGEMENT_WORKFLOW("Management Workflow"),
+ DEPLOYMENT_ARTIFACT("Deployment ArtifactLeftSideMenu"),
+ INFORMATION_ARTIFACT("Information ArtifactLeftSideMenu"),
+ PROPERTIES("PropertiesLeftSideMenu"),
+ COMPOSITION("CompositionLeftSideMenu"),
+ ACTIVITY_LOG("Activity LogLeftSideMenu"),
+ DEPLOYMENT_VIEW("DeploymentLeftSideMenu"),
+ TOSCA_ARTIFACTS("TOSCA ArtifactsLeftSideMenu"),
+ MONITOR("Monitor LeftSideMenu"),
+ MANAGEMENT_WORKFLOW("Management WorkflowLeftSideMenu"),
INPUTS("Inputs"),
- HIERARCHY("Hierarchy");
+ HIERARCHY("Hierarchy"),
+ PROPERTIES_ASSIGNMENT("Properties AssignmentLeftSideMenu");
private String value;
@@ -799,6 +805,36 @@ public final class DataTestIdEnum {
}
}
+ public enum PropertiesAssignmentScreen {
+
+ PROPERTIES_TAB("Properties"),
+ INPUTS_TAB("Inputs"),
+ COMPOSITION_TAB("Composition"),
+ PROPERTY_STRUCTURE_TAB("Property Structure"),
+ DECLARE_BUTTON("declare-button"),
+ SEARCH_BOX("search-box"),
+ SEARCH_BUTTON("search-button"),
+ FILTER_BUTTON("filter-button"),
+ FILTER_BOX("filter-box"),
+ CLEAR_FILTER_BUTTON("clear-filter-button"),
+ INPUT_DELETE_BUTTON("delete-input-button"),
+ INPUT_DELETE_DIALOG_DELETE("Delete"),
+ INPUT_DELETE_DIALOG_CLOSE("Close"),
+ FILTER_CHECKBOX_ALL("filter-checkbox-all");
+
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private PropertiesAssignmentScreen(String value) {
+ this.value = value;
+ }
+
+ }
+
public enum ImportVfRepository {
SEARCH("onboarding-search"),
IMPORT_VSP("import-csar"),
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceContainer.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceContainer.java
new file mode 100644
index 0000000000..e812bf97c6
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceContainer.java
@@ -0,0 +1,51 @@
+package org.openecomp.sdc.ci.tests.datatypes;
+
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
+
+
+public class ServiceContainer {
+ private Service service;
+ private Resource resource;
+ private VendorSoftwareProductObject vendorSoftwareProductObject;
+ private AmdocsLicenseMembers amdocsLicenseMembers;
+
+ public ServiceContainer(Service service, Resource resource, VendorSoftwareProductObject vendorSoftwareProductObject, AmdocsLicenseMembers amdocsLicenseMembers) {
+ this.service = service;
+ this.resource = resource;
+ this.vendorSoftwareProductObject = vendorSoftwareProductObject;
+ this.amdocsLicenseMembers = amdocsLicenseMembers;
+ }
+
+ public Service getService() {
+ return service;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+ public Resource getResource() {
+ return resource;
+ }
+
+ public void setResource(Resource resource) {
+ this.resource = resource;
+ }
+
+ public VendorSoftwareProductObject getVendorSoftwareProductObject() {
+ return vendorSoftwareProductObject;
+ }
+
+ public void setVendorSoftwareProductObject(VendorSoftwareProductObject vendorSoftwareProductObject) {
+ this.vendorSoftwareProductObject = vendorSoftwareProductObject;
+ }
+
+ public AmdocsLicenseMembers getAmdocsLicenseMembers() {
+ return amdocsLicenseMembers;
+ }
+
+ public void setAmdocsLicenseMembers(AmdocsLicenseMembers amdocsLicenseMembers) {
+ this.amdocsLicenseMembers = amdocsLicenseMembers;
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java
index d27eb0c150..4249f9cd68 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java
@@ -22,7 +22,7 @@ package org.openecomp.sdc.ci.tests.datatypes;
public enum TypesEnum {
- RESOURCE("checkbox-resource"), VF("checkbox-vf"), VFC("checkbox-vfc"), CP("checkbox-cp"), VL("checkbox-vl"), SERVICE("checkbox-service"), PRODUCT("checkbox-product");
+ RESOURCE("checkbox-resource"), VF("checkbox-vf"), VFC("checkbox-vfc"), PNF("checkbox-pnf"), CP("checkbox-cp"), VL("checkbox-vl"), SERVICE("checkbox-service"), PRODUCT("checkbox-product");
private String value;
public String getValue() {
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserManagementTab.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserManagementTab.java
index 0101b430d8..799649b1b6 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserManagementTab.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserManagementTab.java
@@ -93,6 +93,7 @@ public class UserManagementTab {
}
public void updateUser(int index){
+ GeneralUIUtils.ultimateWait();
GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.UserManagementEnum.UPDATE_USER_BUTTON.getValue() + index);
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java
index fbdb88e712..8b40210c0d 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VendorSoftwareProductObject.java
@@ -1,47 +1,27 @@
package org.openecomp.sdc.ci.tests.datatypes;
-public class VendorSoftwareProductObject {
+public class VendorSoftwareProductObject extends VendorSoftwareProductObjectReqDetails {
- private String vendorName;
private String vspId;
- private String category;
- private String subCategory;
private String componentId;
- private String description;
private String attContact;
- private String vspName;
-
- public VendorSoftwareProductObject() {
- super();
- // TODO Auto-generated constructor stub
- }
+ private String version;
+
+ public VendorSoftwareProductObject(){super();}
- public VendorSoftwareProductObject(String vendorName, String vspId, String category, String subCategory, String componentId, String description, String attContact) {
- super();
- this.vendorName = vendorName;
+ public VendorSoftwareProductObject(String vspId, String componentId, String attContact, String version) {
this.vspId = vspId;
- this.category = category;
- this.subCategory = subCategory;
this.componentId = componentId;
- this.description = description;
this.attContact = attContact;
+ this.version = version;
}
-
- public String getVspName() {
- return vspName;
- }
-
- public void setVspName(String vspName) {
- this.vspName = vspName;
- }
-
- public String getVendorName() {
- return vendorName;
- }
-
- public void setVendorName(String vendorName) {
- this.vendorName = vendorName;
+ public VendorSoftwareProductObject(String name, String description, String category, String subCategory, String vendorId, String vendorName, LicensingVersion licensingVersion, LicensingData licensingData, String onboardingMethod, String networkPackageName, String onboardingOrigin, String vspId, String componentId, String attContact, String version) {
+ super(name, description, category, subCategory, vendorId, vendorName, licensingVersion, licensingData, onboardingMethod, networkPackageName, onboardingOrigin);
+ this.vspId = vspId;
+ this.componentId = componentId;
+ this.attContact = attContact;
+ this.version = version;
}
public String getVspId() {
@@ -52,22 +32,6 @@ public class VendorSoftwareProductObject {
this.vspId = vspId;
}
- public String getCategory() {
- return category;
- }
-
- public void setCategory(String category) {
- this.category = category;
- }
-
- public String getSubCategory() {
- return subCategory;
- }
-
- public void setSubCategory(String subCategory) {
- this.subCategory = subCategory;
- }
-
public String getComponentId() {
return componentId;
}
@@ -76,14 +40,6 @@ public class VendorSoftwareProductObject {
this.componentId = componentId;
}
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
public String getAttContact() {
return attContact;
}
@@ -92,11 +48,21 @@ public class VendorSoftwareProductObject {
this.attContact = attContact;
}
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
@Override
public String toString() {
- return "VendorSoftwareProductObject [vendorName=" + vendorName + ", vspId=" + vspId + ", category=" + category + ", subCategory=" + subCategory + ", componentId=" + componentId + ", description=" + description + ", attContact="
- + attContact + "]";
+ return "VendorSoftwareProductObject{" +
+ "vspId='" + vspId + '\'' +
+ ", componentId='" + componentId + '\'' +
+ ", attContact='" + attContact + '\'' +
+ ", version='" + version + '\'' +
+ '}';
}
-
-
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java
index 0e09059b28..e4423dd7d0 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java
@@ -48,7 +48,6 @@ import org.openecomp.sdc.ci.tests.verificator.UserManagementVerificator;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
-import org.testng.SkipException;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -98,6 +97,7 @@ public class AdminUserManagment extends SetupCDTest {
UserRoleEnum userRole = UserRoleEnum.DESIGNER;
AdminWorkspaceUIUtilies.createNewUser(userId, userRole);
ExtentTestActions.log(Status.INFO, "Trying to create the same user once again.");
+ GeneralUIUtils.ultimateWait(); // extra wait, necessary for system with large user list
AdminWorkspaceUIUtilies.createNewUser(userId, userRole);
ErrorMessageUIVerificator.validateErrorMessage(ActionStatus.USER_ALREADY_EXIST);
}
@@ -106,9 +106,9 @@ public class AdminUserManagment extends SetupCDTest {
@Test
public void createInvalidMacIdTest(){
- if(true){
- throw new SkipException("Open bug 324032");
- }
+// if(true){
+// throw new SkipException("Open bug 324032");
+// }
String macId = generateValidMacId();
StringBuilder invalidMacId = new StringBuilder(macId);
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/DeploymentViewTests.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/DeploymentViewTests.java
index 1af68d9364..38a71f4a20 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/DeploymentViewTests.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/DeploymentViewTests.java
@@ -41,7 +41,6 @@ import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.verificator.DeploymentViewVerificator;
import org.openqa.selenium.WebElement;
-import org.testng.SkipException;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -59,7 +58,7 @@ public class DeploymentViewTests extends SetupCDTest {
@DataProvider(name = "CSAR_VF_Files", parallel = false)
public Object[][] createDataX() {
- return new Object[][] { { "vSeGWdoubleMembers.csar" }, { "vSeGW.csar" }, {"vSeGWsingleModule.csar"}};
+ return new Object[][] {{"vSeGWNew.csar"}, {"vSeGWNewDoubleMembers.csar"}, {"vSeGWNewSingleModule.csar"}};
}
@@ -76,7 +75,7 @@ public class DeploymentViewTests extends SetupCDTest {
List<WebElement> moduleRowsFromTable = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.MODULES.getValue());
DeploymentViewVerificator verificator = new DeploymentViewVerificator(filePath + baseFileName);
verificator.verifyDeploymentPageModules(moduleRowsFromTable);
- for(WebElement moduleRow :moduleRowsFromTable){
+ for(WebElement moduleRow : moduleRowsFromTable){
String moduleRowText = moduleRow.getText();
verificator.verifyDeploymentPageSubElements(moduleRowText.split("\\.\\.")[1]);
DeploymentPage.updateModuleName(moduleRowText, "updatedName");
@@ -89,8 +88,8 @@ public class DeploymentViewTests extends SetupCDTest {
@Test
public void deploymentScreenDCAEAssetUpdateWithNewGroupCSAR_TC1368223_Test() throws Exception{
- String baseFileName = "baseUpdateMinusGroupFlowVF.csar";
- String updateFileName = "baseUpdateFlowVF.csar";
+ String baseFileName = "baseUpdateMinusGroupFlowVF_NEW.csar";
+ String updateFileName = "baseUpdateFlowVF_NEW.csar";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 2));
@@ -111,8 +110,8 @@ public class DeploymentViewTests extends SetupCDTest {
@Test
public void deploymentScreenDCAEAssetDeleteGroupFromCSAR_TC1368281_Test() throws Exception{
- String baseFileName = "baseUpdateFlowVF.csar";
- String updateFileName = "baseUpdateMinusGroupFlowVF.csar";
+ String baseFileName = "baseUpdateFlowVF_NEW.csar";
+ String updateFileName = "baseUpdateMinusGroupFlowVF_NEW.csar";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 3));
@@ -145,9 +144,9 @@ public class DeploymentViewTests extends SetupCDTest {
@Test
public void deploymentScreenDCAEAssetUpdateWithNewGroupWithoutMembersCSAR_TC1368280_Test() throws Exception{
- String baseFileName = "baseUpdateMinusGroupFlowVF.csar";
- String updateFileName = "baseUpdateAddGroupNoMembersUpdateFlow.csar";
- String updateFileName2 = "baseUpdateFlowVF.csar";
+ String baseFileName = "baseUpdateMinusGroupFlowVF_NEW.csar";
+ String updateFileName = "baseUpdateAddGroupNoMembersUpdateFlow_NEW.csar";
+ String updateFileName2 = "baseUpdateFlowVF_NEW.csar";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 2));
@@ -167,10 +166,6 @@ public class DeploymentViewTests extends SetupCDTest {
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now, base_ldsa group with members", 3));
ResourceUIUtils.updateVfWithCsar(filePath, updateFileName2);
- if(true){
- throw new SkipException("Open bug 305812");
- }
-
// validate that member was added to base_ldsa group
DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName2));
DeploymentViewVerificator.validateModuleNameUpadate();
@@ -178,7 +173,7 @@ public class DeploymentViewTests extends SetupCDTest {
@Test
public void deploymentScreenDCAEAssetImportCSARWithArtifactSection_TC1368282_1_Test() throws Exception{
- String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar";
+ String baseFileName = "baseUpdateFlowTwoArtifactsToGroup_NEW.csar";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 4 artifacts in every group ", 3));
@@ -190,8 +185,8 @@ public class DeploymentViewTests extends SetupCDTest {
@Test
public void deploymentScreenDCAEAssetImportCSARRemoveArtifact_TC1368282_2_Test() throws Exception{
- String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar";
- String updateFileName = "baseUpdateFlowOneArtifactToGroup.csar";
+ String baseFileName = "baseUpdateFlowTwoArtifactsToGroup_NEW.csar";
+ String updateFileName = "baseUpdateFlowOneArtifactToGroup_NEW.csar";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 4 artifacts in every group ", 3));
@@ -203,10 +198,6 @@ public class DeploymentViewTests extends SetupCDTest {
// remove artifact from every group
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be 3 artifacts in every group"));
ResourceUIUtils.updateVfWithCsar(filePath, updateFileName);
-
- if(true){
- throw new SkipException("Open bug 306329");
- }
DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName));
DeploymentViewVerificator.validateModuleNameUpadate();
@@ -214,8 +205,8 @@ public class DeploymentViewTests extends SetupCDTest {
@Test
public void deploymentScreenDCAEAssetImportCSARAddArtifact_TC1368282_3_Test() throws Exception{
- String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar";
- String updateFileName = "baseUpdateFlowOneArtifactToGroup.csar";
+ String baseFileName = "baseUpdateFlowTwoArtifactsToGroup_NEW.csar";
+ String updateFileName = "baseUpdateFlowOneArtifactToGroup_NEW.csar";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 3 artifacts in every group ", 3));
@@ -227,10 +218,6 @@ public class DeploymentViewTests extends SetupCDTest {
// add artifact to every group
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be 4 artifacts in every group"));
ResourceUIUtils.updateVfWithCsar(filePath, baseFileName);
-
- if(true){
- throw new SkipException("Open bug 306005");
- }
DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + baseFileName));
DeploymentViewVerificator.validateModuleNameUpadate();
@@ -238,8 +225,8 @@ public class DeploymentViewTests extends SetupCDTest {
@Test
public void deploymentScreenDCAEAssetImportCSARMixArtifacts_TC1368282_4_Test() throws Exception{
- String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar";
- String updateFileName = "baseUpdateMixedArtifacts.csar";
+ String baseFileName = "baseUpdateFlowTwoArtifactsToGroup_NEW.csar";
+ String updateFileName = "baseUpdateMixedArtifacts_NEW.csar";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 4 artifacts in every group ", 3));
@@ -252,18 +239,14 @@ public class DeploymentViewTests extends SetupCDTest {
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, mixing between artifacts and groups", 3));
ResourceUIUtils.updateVfWithCsar(filePath, updateFileName);
- if(true){
- throw new SkipException("Open bug 306005");
- }
-
DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator());
DeploymentViewVerificator.validateModuleNameUpadate();
};
@Test
public void deploymentScreenDCAEAssetUpdateVFModule_TC1296437_Test() throws Exception{
- String baseFileName = "baseUpdateMinusGroupFlowVF.csar";
- String updateFileName = "baseUpdateFlowVF.csar";
+ String baseFileName = "baseUpdateMinusGroupFlowVF_NEW.csar";
+ String updateFileName = "baseUpdateFlowVF_NEW.csar";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 2));
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java
index a26919ae2a..cf510578ef 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java
@@ -71,7 +71,6 @@ import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
-import org.testng.SkipException;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -93,7 +92,7 @@ public class ImportDCAE extends SetupCDTest {
// update Resource
ResourceReqDetails updatedResource = new ResourceReqDetails();
- updatedResource.setName("ciUpdatedNameImportDCAE");
+ updatedResource.setName(ElementFactory.getResourcePrefix() + "UpdatedName" + resourceMetaData.getName());
updatedResource.setDescription("kuku");
updatedResource.setVendorName("updatedVendor");
updatedResource.setVendorRelease("updatedRelease");
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java
index fca568794b..273a502895 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java
@@ -53,10 +53,10 @@ import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.ci.tests.verificator.PropertyVerificator;
import org.openecomp.sdc.ci.tests.verificator.VFCverificator;
import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
import org.testng.Assert;
-import org.testng.SkipException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -234,6 +234,37 @@ public class ImportVFCAsset extends SetupCDTest {
}
+ @Test
+ public void updateAfterCheckoutNewSimplePropertiesVFCTest() throws Exception{
+ String fileName = "importVFC_VFC16.yml";
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen();
+ List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER, PropertyTypeEnum.FLOAT);
+ int propertiesCount = PropertiesPage.getElemenetsFromTable().size();
+ for (PropertyTypeEnum prop : propertyList){
+ PropertiesUIUtils.addNewProperty(prop);
+ }
+ ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
+ GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+ GeneralPageElements.clickCheckoutButton();
+ ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen();
+
+ for (PropertyTypeEnum prop : propertyList){
+ PropertiesUIUtils.updateProperty(prop);
+ }
+ assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable()));
+
+ for (PropertyTypeEnum prop : propertyList){
+ PropertiesPage.clickOnProperty(prop.getName());
+ PropertyVerificator.validateEditVFCPropertiesPopoverFields(prop);
+ PropertiesPage.getPropertyPopup().clickCancel();
+ }
+
+ }
+
@Test(dataProvider = "assetFiles")
public void checkinCheckoutChangeDeleteVersionVFCTest(String customfileName) throws Exception{
@@ -285,12 +316,7 @@ public class ImportVFCAsset extends SetupCDTest {
}
@Test
- public void activityLogVFCTest() throws Exception{
-
- if(true){
- throw new SkipException("Open bug 291623");
- }
-
+ public void activityLogVFCTest() throws Exception{
String fileName = "importVFC_VFC11.yml";
atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
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 e6d1177425..7681af63c3 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
@@ -28,7 +28,6 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -38,6 +37,7 @@ import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders;
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.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager;
@@ -53,14 +53,14 @@ import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
import org.openqa.selenium.WebElement;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
@@ -70,7 +70,7 @@ import com.clearspring.analytics.util.Pair;
public class Onboard extends SetupCDTest {
- protected static String filepath = FileHandling.getVnfRepositoryPath();
+ protected static String filePath = FileHandling.getVnfRepositoryPath();
protected String makeDistributionValue;
@Parameters({ "makeDistribution" })
@@ -80,19 +80,35 @@ public class Onboard extends SetupCDTest {
}
@Test
+ public void onboardVNFTestSanityOneFile() throws Exception, Throwable {
+// List<String> fileNamesFromFolder = OnboardingUiUtils.getVnfNamesFileList();
+// String vnfFile = fileNamesFromFolder.get(0).toString();
+ String vnfFile = "2017-302_vNSO.zip";
+// String vnfFile = "1-Fn-vprobe-be-11-2-5-1-vf-(MOBILITY)_v5.0.zip";
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();//getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
+ }
+
+ @Test
public void onboardVNFTestSanity() throws Exception, Throwable {
List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList();
String vnfFile = fileNamesFromFolder.get(0).toString();
- runOnboardToDistributionFlow(filepath, vnfFile);
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();//getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
}
- public void runOnboardToDistributionFlow(String filepath, String vnfFile) throws Exception, AWTException {
- String vspName = onboardAndCertify(filepath, vnfFile);
+ public void runOnboardToDistributionFlow(ResourceReqDetails resourceReqDetails, ServiceReqDetails serviceMetadata, String filePath, String vnfFile) throws Exception, AWTException {
+ getExtendTest().log(Status.INFO, "Going to create resource with category: " + resourceReqDetails.getCategories().get(0).getName()
+ + " subCategory: " + resourceReqDetails.getCategories().get(0).getSubcategories().get(0).getName()
+ + " and service category: " + serviceMetadata.getCategory());
+ String vspName = onboardAndCertify(resourceReqDetails, filePath, vnfFile);
reloginWithNewRole(UserRoleEnum.DESIGNER);
// create service
- ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+// ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
ServiceUIUtils.createService(serviceMetadata, getUser());
ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
@@ -135,8 +151,8 @@ public class Onboard extends SetupCDTest {
getExtendTest().log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile));
}
- public String onboardAndCertify(String filepath, String vnfFile) throws Exception, IOException {
- Pair<String,Map<String,String>> onboardAndValidate = OnboardingUtils.onboardAndValidate(filepath, vnfFile, getUser());
+ public String onboardAndCertify(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception, IOException {
+ Pair<String,Map<String,String>> onboardAndValidate = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
String vspName = onboardAndValidate.left;
DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen();
@@ -152,36 +168,41 @@ public class Onboard extends SetupCDTest {
@Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
- public void onboardVNFTest(String filepath, String vnfFile) throws Exception, Throwable {
+ public void onboardVNFTest(String filePath, String vnfFile) throws Exception, Throwable {
setLog(vnfFile);
System.out.println("printttttttttttttt - >" + makeDistributionValue);
- runOnboardToDistributionFlow(filepath, vnfFile);
+ ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource();
+ ServiceReqDetails serviceReqDetails = ElementFactory.getRandomCategoryService();
+ runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
}
@Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
- public void onboardVNFShotFlow(String filepath, String vnfFile) throws Exception, Throwable {
+ public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception, Throwable {
setLog(vnfFile);
System.out.println("printttttttttttttt - >" + makeDistributionValue);
- onboardAndCertify(filepath, vnfFile);
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ onboardAndCertify(resourceReqDetails, filePath, vnfFile);
}
@Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List")
- public void onboardRandomVNFsTest(String filepath, String vnfFile) throws Exception, Throwable {
+ public void onboardRandomVNFsTest(String filePath, String vnfFile) throws Exception, Throwable {
setLog(vnfFile);
System.out.println("printttttttttttttt - >" + makeDistributionValue);
System.out.println("Vnf File name is: " + vnfFile);
- runOnboardToDistributionFlow(filepath, vnfFile);
+ ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource();
+ ServiceReqDetails serviceReqDetails = ElementFactory.getRandomCategoryService();
+ runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile);
}
@Test
public void onboardUpdateVNFTest() throws Exception, Throwable {
-// Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
- List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+// Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filePath);
+ List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filePath);
// String vnfFile = fileNamesFromFolder[0].toString();
String vnfFile = fileNamesFromFolder.get(0);
-
- Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(filepath, vnfFile, getUser());
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
String vspName = vsp.left;
ResourceGeneralPage.clickSubmitForTestingButton(vspName);
@@ -209,7 +230,7 @@ public class Onboard extends SetupCDTest {
getExtendTest().log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile));
// update VendorSoftwareProduct
- OnboardingUtils.updateVnfAndValidate(filepath, vsp, updatedVnfFile, getUser());
+ OnboardingUiUtils.updateVnfAndValidate(filePath, vsp, updatedVnfFile, getUser());
ResourceGeneralPage.clickSubmitForTestingButton(vspName);
@@ -257,9 +278,10 @@ public class Onboard extends SetupCDTest {
@Test
public void threeVMMSCsInServiceTest() throws Exception{
-
+
+ String pathFile = FileHandling.getFilePath("VmmscArtifacts");
List<String> vmmscList = new ArrayList<String>();
- vmmscList = Arrays.asList(new File(filepath).list()).stream().filter(e -> e.contains("vmmsc") && e.endsWith(".zip")).collect(Collectors.toList());
+ vmmscList = Arrays.asList(new File(pathFile).list()).stream().filter(e -> e.contains("vmmsc") && e.endsWith(".zip")).collect(Collectors.toList());
assertTrue("Did not find vMMSCs", vmmscList.size() > 0);
Map<String, String> vspNames = new HashMap<String, String>();
@@ -267,16 +289,17 @@ 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));
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser());
- Pair<String,Map<String,String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser(), amdocsLicenseMembers);
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser());
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String,Map<String,String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, pathFile, getUser(), amdocsLicenseMembers);
getExtendTest().log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
HomePage.showVspRepository();
getExtendTest().log(Status.INFO,String.format("Going to import %s......", vnfFile.substring(0, vnfFile.indexOf("."))));
- OnboardingUtils.importVSP(createVendorSoftwareProduct);
+ OnboardingUiUtils.importVSP(createVendorSoftwareProduct);
ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
- DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile);
+ DeploymentArtifactPage.verifyArtifactsExistInTable(pathFile, vnfFile);
String vspName = createVendorSoftwareProduct.left;
DeploymentArtifactPage.clickSubmitForTestingButton(vspName);
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 f32709e219..6cea8d6c6f 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
@@ -20,16 +20,12 @@
package org.openecomp.sdc.ci.tests.execute.sanity;
-import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
import java.awt.AWTException;
-import java.io.File;
import java.sql.Timestamp;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.UUID;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.Resource;
@@ -38,16 +34,16 @@ import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders;
import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
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;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUtillViaApis;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
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.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis;
+import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
import org.slf4j.LoggerFactory;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -58,6 +54,7 @@ import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
import fj.data.Either;
+
public class OnboardViaApis{
@@ -79,23 +76,11 @@ public class OnboardViaApis{
// resourceDetails = ElementFactory.getDefaultResource();
}
- @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List")
+ @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List")
public void onboardVNFTestViaApis(String filepath, String vnfFile) throws Exception, Throwable {
- Service service = null;
- String fullFileName = FULL_PATH + vnfFile + ".csar";
- Timestamp timestamp = new Timestamp(System.currentTimeMillis());
- System.err.println(timestamp + " Starting test with VNF: " + vnfFile);
- service = runOnboardViaApisOnly(filepath, vnfFile);
- timestamp = new Timestamp(System.currentTimeMillis());
- System.err.println(timestamp + " Finished test with VNF: " + vnfFile);
- timestamp = new Timestamp(System.currentTimeMillis());
- System.err.println(timestamp + " Starting download service csar file: " + vnfFile);
- File file = new File(fullFileName);
- OnboardingUtillViaApis.downloadToscaCsarToDirectory(service, file);
- timestamp = new Timestamp(System.currentTimeMillis());
- System.err.println(timestamp + " Finished download service csar file: " + vnfFile);
- System.out.println("end");
-
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();//getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Service service = runOnboardViaApisOnly(serviceReqDetails, resourceReqDetails, filepath, vnfFile);
}
@@ -105,148 +90,83 @@ public class OnboardViaApis{
List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
String vnfFile = fileNamesFromFolder.get(7);
System.err.println(timestamp + " Starting test with VNF: " + vnfFile);
- service = runOnboardViaApisOnly(filepath, vnfFile);
-
-// AtomicOperationUtils.getServiceObjectByNameAndVersion(sdncModifierDetails, serviceName, serviceVersion);
-// RestResponse distributeService = AtomicOperationUtils.distributeService(service, true);
-// Map<Long, ServiceDistributionStatus> convertServiceDistributionStatusToObject = ResponseParser.convertServiceDistributionStatusToObject(distributeService.getResponse());
-// convertServiceDistributionStatusToObject.
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();//getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ service = runOnboardViaApisOnly(serviceReqDetails, resourceReqDetails, filepath, vnfFile);
}
-
-
-
- public Service runOnboardViaApisOnly(String filepath, String vnfFile) throws Exception, AWTException {
- Timestamp timestamp = new Timestamp(System.currentTimeMillis());
- System.err.println(timestamp + " Starting onboard VNF: " + vnfFile);
- Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(filepath, vnfFile, sdncDesignerDetails1);
- String vspName = createVendorSoftwareProduct.left;
- VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right;
- timestamp = new Timestamp(System.currentTimeMillis());
- System.err.println(timestamp + " Finished onboard VNF: " + vnfFile);
- ResourceReqDetails resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(vendorSoftwareProductObject, vspName);
- Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails, vspName);
-
- AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
- resource = AtomicOperationUtils.getResourceObject(resource.getUniqueId());
- // create service
-
- Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
- Either<ComponentInstance,RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+ @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List")
+ public void updateVSPFullScenario(String filepath, String vnfFile) throws Exception
+ {
+ //CREATE DATA REQUIRED FOR TEST
+ boolean skipReport = true;
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(sdncDesignerDetails1);
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, sdncDesignerDetails1, amdocsLicenseMembers);
+ VendorSoftwareProductObject vendorSoftwareProductObject = fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct);
+ resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
+ Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();//getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+// serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(serviceReqDetails, sdncDesignerDetails1);
+ Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+ Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+ ComponentInstance componentInstanceDefinition = addComponentInstanceToComponentContainer.left().value();
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
- return service;
- }
-
-
-
-
-
-
-
- public static Pair<String, Map<String, String>> createVendorSoftwareProduct(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers)
- throws Exception {
- Pair<String, Map<String, String>> pair = createVSP(HeatFileName, filepath, user, amdocsLicenseMembers);
-
- String vspid = pair.right.get("vspId");
-
- prepareVspForUse(user, vspid);
-
- return pair;
+ // TEST START
+
+ // Update exist VLM Version (From 1.0 to 2.0)
+ OnboardingUtils.updateVendorLicense(amdocsLicenseMembers, sdncDesignerDetails1, "1.0");
+ // Set VLM version to 2.0 in VLM Meta data object
+ amdocsLicenseMembers.setLicenseVersionId("2.0");
+ amdocsLicenseMembers.setLicenseVersionLabel("2.0");
+ OnboardingUtils.validateVlmExist(amdocsLicenseMembers.getVendorId(), amdocsLicenseMembers.getLicenseVersionId(), sdncDesignerDetails1);
+
+ // Update the VSP With the VLM new version and submit the VSP
+ vendorSoftwareProductObject = OnboardingUtils.updateVSPWithNewVLMParameters(vendorSoftwareProductObject, amdocsLicenseMembers, sdncDesignerDetails1, "1.1", "2.0");
+ OnboardingUtils.validateVspExist(vendorSoftwareProductObject.getVspId(),vendorSoftwareProductObject.getVersion(), sdncDesignerDetails1);
+ Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
+ assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
+ System.out.println(distributeAndValidateService);
}
-
- public static void prepareVspForUse(User user, String vspid) throws Exception {
- RestResponse checkin = OnboardingUtils.checkinVendorSoftwareProduct(vspid, user);
- assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue());
-
- RestResponse submit = OnboardingUtils.submitVendorSoftwareProduct(vspid, user);
- assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue());
-
- RestResponse createPackage = OnboardingUtils.createPackageOfVendorSoftwareProduct(vspid, user);
- assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue());
+ public static VendorSoftwareProductObject fillVendorSoftwareProductObjectWithMetaData(String vnfFile, Pair<String, Map<String, String>> createVendorSoftwareProduct) {
+ VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject();
+ Map<String, String> map = createVendorSoftwareProduct.right;
+ vendorSoftwareProductObject.setAttContact(map.get("attContact"));
+ vendorSoftwareProductObject.setCategory(map.get("category"));
+ vendorSoftwareProductObject.setComponentId(map.get("componentId"));
+ vendorSoftwareProductObject.setDescription(map.get("description"));
+ vendorSoftwareProductObject.setSubCategory(map.get("subCategory"));
+ vendorSoftwareProductObject.setVendorName(map.get("vendorName"));
+ vendorSoftwareProductObject.setVspId(map.get("vspId"));
+ vendorSoftwareProductObject.setName(createVendorSoftwareProduct.left);
+ String[] arrFileNameAndExtension = vnfFile.split("\\.");
+ vendorSoftwareProductObject.setOnboardingMethod("NetworkPackage");
+ vendorSoftwareProductObject.setNetworkPackageName(arrFileNameAndExtension[0]);
+ vendorSoftwareProductObject.setOnboardingOrigin(arrFileNameAndExtension[1]);
+
+ return vendorSoftwareProductObject;
}
- 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());
- 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());
- 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");
-
- 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());
- String vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(), "value");
+ public Service runOnboardViaApisOnly(ServiceReqDetails serviceReqDetails, ResourceReqDetails resourceReqDetails, String filepath, String vnfFile) throws Exception, AWTException {
- RestResponse checkinVendorLicense = OnboardingUtils.checkinVendorLicense(vendorId, user);
- assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue());
-
- 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<String, Map<String, String>> createVSP(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception {
- String vspName = OnboardingUtils.handleFilename(HeatFileName);
-
- Pair<RestResponse, Map<String, String>> 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");
- String componentId = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "componentId");
-
- Map<String, String> vspMeta = createNewVspPair.right;
- Map<String, String> vspObject = new HashMap<String, String>();
- Iterator<String> iterator = vspMeta.keySet().iterator();
- while(iterator.hasNext()){
- Object key = iterator.next();
- Object value = vspMeta.get(key);
- vspObject.put(key.toString(), value.toString());
- }
- vspObject.put("vspId", vspid);
- vspObject.put("componentId", componentId);
- vspObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName());
- vspObject.put("attContact", user.getUserId());
-
- RestResponse uploadHeatPackage = OnboardingUtils.uploadHeatPackage(filepath, HeatFileName, vspid, user);
- assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue());
+ Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(resourceReqDetails, filepath, vnfFile, sdncDesignerDetails1);
+ VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right;
+ vendorSoftwareProductObject.setName(createVendorSoftwareProduct.left);
- RestResponse validateUpload = OnboardingUtils.validateUpload(vspid, user);
- assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue());
+ resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
+ Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
- Pair<String, Map<String, String>> pair = new Pair<String, Map<String, String>>(vspName, vspObject);
+// serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(serviceReqDetails, sdncDesignerDetails1);
+ Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
- return pair;
- }
-
-
-
-
-
-
-
-
-
-// ----------------------------------------------------------------------------------------------------------------------------------------
-
-
-
-
+ Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+ ComponentInstance componentInstanceDefinition = addComponentInstanceToComponentContainer.left().value();
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ return service;
+ }
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlows.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlows.java
new file mode 100644
index 0000000000..da43435cdf
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlows.java
@@ -0,0 +1,400 @@
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+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.dataProviders.OnbordingDataProviders;
+import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
+import org.openecomp.sdc.ci.tests.datatypes.enums.CvfcTypeEnum;
+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;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
+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.general.FileHandling;
+import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis;
+import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+import fj.data.Either;
+
+public class OnboardingFlows extends SetupCDTest{
+
+ protected boolean skipReport = false;
+ protected User sdncDesignerDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+
+
+// https://sdp.web.att.com/fa3qm1/web/console/Application_Development_Tools_QM_20.20.01#action=com.ibm.rqm.planning.home.actionDispatcher&subAction=viewTestPlan&id=6184
+
+ @Test
+ public void addVesFileToVsp() throws Exception{
+ String vnfFile = "vMME_Ericsson_small_v2.zip";
+ String vesArtifactFile = "VES.zip";
+ String filePath = FileHandling.getFilePath("VFCArtifacts");
+ String vesArtifactFileLocation = filePath + File.separator + vesArtifactFile;
+ List<String> vesArtifacts = FileHandling.getFileNamesFromZip(vesArtifactFileLocation);
+ List<String> tempVesArtifacts = FileHandling.getFileNamesFromZip(vesArtifactFileLocation);
+ Map<CvfcTypeEnum, String> cvfcArtifacts = new HashMap<>();
+ cvfcArtifacts.put(CvfcTypeEnum.VES_EVENTS, vesArtifactFileLocation);
+ getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
+
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser());
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, cvfcArtifacts);
+ resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
+ Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
+ List<ComponentInstance> componentInstances = resource.getComponentInstances();
+ for(ComponentInstance componentInstance : componentInstances){
+ if(componentInstance.getDeploymentArtifacts() !=null && !componentInstance.getDeploymentArtifacts().isEmpty()){
+ Map<String, ArtifactDefinition> deploymentArtifacts = componentInstance.getDeploymentArtifacts();
+ for(Entry<String, ArtifactDefinition> entry : deploymentArtifacts.entrySet()){
+ if(entry.getValue().getArtifactType().equals(CvfcTypeEnum.VES_EVENTS.getValue())){
+ for(String vesArtifact : vesArtifacts){
+ if(entry.getValue().getArtifactName().equals(vesArtifact)){
+ tempVesArtifacts.remove(vesArtifact);
+ }
+ }
+ }
+ }
+ }
+ }
+ assertTrue("Not all VES_EVENTS artifact files are on the resource instance", tempVesArtifacts.isEmpty());
+ }
+
+// 741433: Update Old VSP
+// 2. Updated VSP "JSA AUG 2017" with the attached zip from v3 to v4. Follow normal steps to update the VF
+// 3. Update the VSP "vHSS-EPC-RDM3-Lab-0830" using the attached zip. Follow the normal steps to update the VF
+// @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List")
+// public void create2(String filePath, String vnfFile) throws Exception{
+// setLog(vnfFile);
+// }
+
+
+// 741509: E2E flow using old VLM
+ @Test
+ public void VlmReuse() throws Exception{
+ List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure();
+ List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(2, fileNamesFromFolder);
+ String filePath = FileHandling.getVnfRepositoryPath();
+ String vnfFile = newRandomFileNamesFromFolder.get(0);
+ getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
+// setLog(vnfFile);
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser());
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null);
+ resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
+ Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails);
+ org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+
+ Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+ addComponentInstanceToComponentContainer.left().value();
+ service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
+ assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService);
+
+// update
+ vnfFile = newRandomFileNamesFromFolder.get(1);
+ getExtendTest().log(Status.INFO, "Going to update VNF with file " + vnfFile);
+ OnboardingUtils.updateVendorLicense(amdocsLicenseMembers, sdncDesignerDetails, "1.0");
+ vendorSoftwareProductObject = OnboardingUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null);
+ resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
+ resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails);
+ service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+
+ addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+ addComponentInstanceToComponentContainer.left().value();
+ service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
+ assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService);
+
+
+ }
+
+
+// 741607: E2E flow using old VSP
+ @Test
+ public void updateVfiVersionOnServiceLevel() throws Throwable{
+ List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure();
+ List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(2, fileNamesFromFolder);
+ String filePath = FileHandling.getVnfRepositoryPath();
+ String vnfFile = newRandomFileNamesFromFolder.get(0);
+ getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser());
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null);
+ resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
+ Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails);
+ org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+
+ Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+ ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value();
+ service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
+ assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService);
+
+// update resource to v2.0
+ String updateVnfFile = newRandomFileNamesFromFolder.get(1);
+ getExtendTest().log(Status.INFO, "Going to update VNF with file " + vnfFile);
+ OnboardingUiUtils.updateVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), updateVnfFile, filePath, sdncDesignerDetails, "2.0");
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
+ resourceReqDetails.setUniqueId(resource.getUniqueId());
+ resourceReqDetails.setVersion(resource.getVersion());
+ resource = AtomicOperationUtils.updateResource(resourceReqDetails, sdncDesignerDetails, true).left().value();
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
+ AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true);
+
+ service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
+ assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService);
+ }
+
+
+// 741608: E2E flow using old Service
+// @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List")
+// public void create5(String filePath, String vnfFile) throws Exception{
+// setLog(vnfFile);
+// // 1. Create Service with old resource -> Certify this Service - > Distribute
+// // 2. Service is distributed
+// // 3. Update old Service: fetch few new resources and few old resources -> Certify this Service - > Distribute
+// // 4. Service is distributed
+// }
+
+// 741633: Update HEAT parameter value
+ @Test()
+ public void updateHeatParametersValue() throws Throwable{
+ String msg = "VfArtifacts-->checkDefaultCreatedEnvArtifactsAfterVspUpdate tests with data provider index 4(last one) check it fully";
+ getExtendTest().log(Status.INFO, msg);
+ }
+
+ @Test()
+ public void UpdateVSPRevertToEarlierVersion() throws Throwable
+ {
+ // Test Case: 745821
+// 1. Import VSP v1.0
+ List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure();
+ List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(1, fileNamesFromFolder);
+ String filePath = FileHandling.getVnfRepositoryPath();
+ String vnfFile = newRandomFileNamesFromFolder.get(0);
+ getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
+ User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(sdncDesignerDetails1);
+ getExtendTest().log(Status.INFO, "Create Vendor License Model " + amdocsLicenseMembers.getVendorLicenseName());
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ getExtendTest().log(Status.INFO, "Create Vendor Software Product " + resourceReqDetails.getName());
+ Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, amdocsLicenseMembers);
+ VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct);
+// 2. Create VF, certify - v1.0 is created
+ resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
+ getExtendTest().log(Status.INFO, "Create VF " + resourceReqDetails.getName());
+ Resource resource_v1 = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
+ getExtendTest().log(Status.INFO, "Certify VF " + resourceReqDetails.getName());
+ resource_v1 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+// 3. Update VSP to v2.0
+ getExtendTest().log(Status.INFO, "Update VSP to version 2.0");
+ OnboardingUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, "2.0", sdncDesignerDetails1, filePath, vnfFile);
+ OnboardingUtils.validateVspExist(vendorSoftwareProductObject.getVspId(),vendorSoftwareProductObject.getVersion(),sdncDesignerDetails1);
+// 4. Update the VF with v2.0 of the VSP
+ getExtendTest().log(Status.INFO, "Checkout VF v1.1");
+ resource_v1 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
+ resourceReqDetails.setUniqueId(resource_v1.getUniqueId());
+ resourceReqDetails.setVersion("1.1");
+ resourceReqDetails.setCsarVersion("2.0");
+ getExtendTest().log(Status.INFO, "Update VF to v2.0");
+ resource_v1 = AtomicOperationUtils.updateResource(resourceReqDetails, sdncDesignerDetails, true).left().value();
+ getExtendTest().log(Status.INFO, "Certify VF");
+ Resource resource_v2 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+// 5. Update VSP to v3.0 wih the zip from v1.0
+ getExtendTest().log(Status.INFO, "Update VSP to version 3.0");
+ OnboardingUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, "3.0", sdncDesignerDetails1);
+ OnboardingUtils.validateVspExist(vendorSoftwareProductObject.getVspId(),vendorSoftwareProductObject.getVersion(),sdncDesignerDetails1);
+ getExtendTest().log(Status.INFO, "Checkout VF v2.1");
+ resource_v1 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
+ resourceReqDetails.setUniqueId(resource_v1.getUniqueId());
+ resourceReqDetails.setVersion("2.1");
+ resourceReqDetails.setCsarVersion("3.0");
+ getExtendTest().log(Status.INFO, "Update VF to v3.0");
+ ResourceRestUtils.updateResource(resourceReqDetails,sdncDesignerDetails1,resource_v1.getUniqueId());
+// 6. Update VF to v3.0
+ getExtendTest().log(Status.INFO, "Certify VF");
+ Resource resource_v3 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+// 7. Compare versions v1.0 and v3.0 - should be the same
+// TODO: Shay add resource comparison.
+// 8. Add each of the versions to service, certify - OK
+ ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails1);
+ getExtendTest().log(Status.INFO, "Create Service " + serviceReqDetails.getName() );
+ org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+ getExtendTest().log(Status.INFO, "Add vf's v1 & v2 to service");
+ Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource_v1, service, UserRoleEnum.DESIGNER, true);
+ Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer1 = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource_v3, service, UserRoleEnum.DESIGNER, true);
+ getExtendTest().log(Status.INFO, "Certify Service");
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ System.out.println("");
+ }
+
+ @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders.class, dataProvider = "updateList")
+ public void distributeServiceAndUpgradeWithNewHeatFile(String vnfFile1, String vnfFile2) throws Throwable
+ {
+ setLog(String.format("Update VSP Test: Create VF from %s add it to service, distribute than upgrade the VF with file %s and update the service and distribute", vnfFile1, vnfFile2));
+// 1. Import VSP v1.0
+ String filePath = org.openecomp.sdc.ci.tests.utilities.FileHandling.getUpdateVSPVnfRepositoryPath();
+ User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(sdncDesignerDetails1);
+ getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName()));
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
+ getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile1));
+ Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails1, amdocsLicenseMembers);
+ VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile1, createVendorSoftwareProduct);
+// 2. Create VF, certify - v1.0 is created
+ resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
+ Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName()));
+ getExtendTest().log(Status.INFO, String.format("Certify the VF"));
+// 3. Create Service add to it the certified VF and certify the Service v1.0
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
+ Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+ getExtendTest().log(Status.INFO, String.format("Creating Service: %s v1.0", serviceReqDetails.getName()));
+ Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+ ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value();
+ getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service"));
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ getExtendTest().log(Status.INFO, String.format("Certify the Service"));
+// 5. Distribute the Service v1.0
+ Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
+ getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
+ assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
+// 6. Update VSP to v2.0
+ getExtendTest().log(Status.INFO, "Upgrading the VSP with new file: " + vnfFile2);
+ OnboardingUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, "2.0", sdncDesignerDetails1, filePath, vnfFile2);
+ getExtendTest().log(Status.INFO, String.format("Validating VSP %s upgrade to version 2.0: " ,vnfFile2));
+ OnboardingUtils.validateVspExist(vendorSoftwareProductObject.getVspId(),vendorSoftwareProductObject.getVersion(),sdncDesignerDetails1);
+// 7. Update the VF with v2.0 of the VSP and certify the VF
+ getExtendTest().log(Status.INFO, String.format("Checkout the VF %s v1.1 " ,resourceReqDetails.getName()));
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
+ resourceReqDetails.setUniqueId(resource.getUniqueId());
+ resourceReqDetails.setVersion("1.1");
+ resourceReqDetails.setCsarVersion("2.0");
+ getExtendTest().log(Status.INFO, String.format("Upgrade the VF %s v1.1 with the new VSP %s v2.0 " ,resourceReqDetails.getName(),vendorSoftwareProductObject.getName()));
+ resource = AtomicOperationUtils.updateResource(resourceReqDetails, sdncDesignerDetails, true).left().value();
+ getExtendTest().log(Status.INFO, String.format("Certify the VF to v2.0"));
+ Resource resource_v2 = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+// 8. Update the Service with the VFi version 2.0
+ getExtendTest().log(Status.INFO, String.format("Checkout the Service v1.1"));
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
+ getExtendTest().log(Status.INFO, String.format("Change the instance of the VF in the service to VFi v2.0"));
+ AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true);
+ getExtendTest().log(Status.INFO, String.format("Certify the Service to v2.0"));
+ service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+// 9. Distribute the service v2.0
+ distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
+ getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
+ assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
+ }
+
+ @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders.class, dataProvider = "VNF_List")
+ public void distributeServiceFromHeatFile(String filePath, String vnfFile) throws Throwable
+ {
+// String vnfFile1 = "1-2016-20-visbc3vf-(VOIP)_v2.1.zip";
+// String vnfFile2 = "2-2016-20-visbc3vf-(VOIP)_v2.0.zip";
+ setLog(String.format("Distribute Service Test: Create VF from %s add it to service than distribute", vnfFile));
+// 1. Import VSP v1.0
+ //String filePath = FileHandling.getVnfRepositoryPath();
+ User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(sdncDesignerDetails1);
+ getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName()));
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
+ getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile));
+ Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, amdocsLicenseMembers);
+ VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct);
+// 2. Create VF, certify - v1.0 is created
+ resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
+ Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName()));
+ getExtendTest().log(Status.INFO, String.format("Certify the VF"));
+// 3. Create Service add to it the certified VF and certify the Service v1.0
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
+ Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+ getExtendTest().log(Status.INFO, String.format("Creating Service: %s v1.0", serviceReqDetails.getName()));
+ Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+ ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value();
+ getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service"));
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ getExtendTest().log(Status.INFO, String.format("Certify the Service"));
+// 5. Distribute the Service v1.0
+ Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
+ getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
+ assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
+ }
+
+ @Test()
+ public void onboardE2EviaAPI() throws Throwable
+ {
+// 1. Import VSP v1.0
+ String filePath = FileHandling.getVnfRepositoryPath();
+ String vnfFile1 = "HeatCandidate_2017-09-20_13-37_70Name_2017-491-4vshaken-HTTP-CM-vf-v1.0-(VOIP)_10202017.zip";
+ User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(sdncDesignerDetails1);
+ getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName()));
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
+ getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile1));
+ Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails1, amdocsLicenseMembers);
+ VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile1, createVendorSoftwareProduct);
+// 2. Create VF, certify - v1.0 is created
+ resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
+ Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName()));
+ getExtendTest().log(Status.INFO, String.format("Certify the VF"));
+// 3. Create Service add to it the certified VF and certify the Service v1.0
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
+ Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+ getExtendTest().log(Status.INFO, String.format("Creating Service: %s v1.0", serviceReqDetails.getName()));
+ Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+ ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value();
+ getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service"));
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ getExtendTest().log(Status.INFO, String.format("Certify the Service"));
+// 5. Distribute the Service v1.0
+ Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service);
+ getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service"));
+ assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService);
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java
index 0bb315aefe..d24000806e 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PNF.java
@@ -1,5 +1,7 @@
package org.openecomp.sdc.ci.tests.execute.sanity;
+import static org.testng.Assert.assertTrue;
+
import java.util.List;
import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -10,22 +12,32 @@ import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.TypesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.CircleSize;
import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage;
import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.OpsOperationPage;
import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
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.validation.ErrorValidationUtils;
@@ -60,7 +72,7 @@ public class PNF extends SetupCDTest {
// update Resource
ResourceReqDetails updatedResource = new ResourceReqDetails();
- updatedResource.setName("ciUpdatedName");
+ updatedResource.setName(ElementFactory.getResourcePrefix() + "UpdatedName" + pnfMetaData.getName());
updatedResource.setDescription("kuku");
updatedResource.setVendorName("updatedVendor");
updatedResource.setVendorRelease("updatedRelease");
@@ -68,7 +80,7 @@ public class PNF extends SetupCDTest {
updatedResource.setCategories(pnfMetaData.getCategories());
updatedResource.setVersion("0.1");
updatedResource.setResourceType(ResourceTypeEnum.VF.getValue());
- List<String> newTags = pnfMetaData.getTags();
+ List<String> newTags = pnfMetaData.getTags();
newTags.remove(pnfMetaData.getName());
newTags.add(updatedResource.getName());
updatedResource.setTags(newTags);
@@ -105,7 +117,7 @@ public class PNF extends SetupCDTest {
@Test
public void addPropertiesToVfcInstanceInPNFTest() throws Exception {
- String fileName = "CP.yml";
+ String fileName = "CP02.yml";
ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.CP, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
try{
@@ -130,6 +142,7 @@ public class PNF extends SetupCDTest {
PropertiesPage.getPropertyPopup().clickSave();
findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-value"));
+ SetupCDTest.getExtendTest().log(Status.INFO, "Validating properties");
AssertJUnit.assertTrue(findElement.getText().equals(propertyValue));
}
}
@@ -145,7 +158,7 @@ public class PNF extends SetupCDTest {
ResourceReqDetails pnfMetaData = null;
CanvasManager vfCanvasManager;
CanvasElement cpElement = null;
- String fileName = "CP.yml";
+ String fileName = "CP03.yml";
try{
atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.CP, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
@@ -228,7 +241,7 @@ public class PNF extends SetupCDTest {
}
@Test
- public void deletePNFCheckedoutTest() throws Exception{
+ public void deletePNFTest() throws Exception{
ResourceReqDetails pnfMetaData = createPNFWithGenerateName();
GeneralPageElements.clickTrashButtonAndConfirm();
@@ -253,9 +266,9 @@ public class PNF extends SetupCDTest {
VfVerificator.verifyVFMetadataInUI(pnfMetaData);
}
-
+
@Test
- public void checkoutVfTest() throws Exception{
+ public void checkoutPnfTest() throws Exception{
ResourceReqDetails pnfMetaData = createPNFWithGenerateName();
ResourceGeneralPage.clickCheckinButton(pnfMetaData.getName());
@@ -287,7 +300,105 @@ public class PNF extends SetupCDTest {
ResourceUIUtils.createPNF(pnfMetaData, getUser());
return pnfMetaData;
}
-
+
+ @Test
+ public void verifyPNF_UI_Limitations() throws Exception {
+ ResourceReqDetails pnfMetaData = createPNFWithGenerateName();
+
+ SetupCDTest.getExtendTest().log(Status.INFO, "Validating Deployment Artifact Left Side Menu not exist");
+ assertTrue(GeneralUIUtils.isElementInvisibleByTestId("Deployment ArtifactLeftSideMenu"));
+ SetupCDTest.getExtendTest().log(Status.INFO, "Validating Deployment Left Side Menu not exist");
+ assertTrue(GeneralUIUtils.isElementInvisibleByTestId("DeploymentLeftSideMenu"));
+ }
+
+ @Test
+ public void filteringCatalogByPNF() throws Exception {
+ ResourceReqDetails pnfMetaData = createPNFWithGenerateName();
+
+ String pnfName = pnfMetaData.getName();
+ ResourceGeneralPage.clickSubmitForTestingButton(pnfName);
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(pnfName);
+ TesterOperationPage.certifyComponent(pnfName);
+
+ pnfMetaData.setVersion("1.0");
+ VfVerificator.verifyVFLifecycle(pnfMetaData, getUser(), LifecycleStateEnum.CERTIFIED);
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ CatalogUIUtilitis.catalogFilterTypeChecBox(TypesEnum.valueOf("PNF"));
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating resource %s found", pnfName));
+ GeneralUIUtils.clickOnElementByTestId(pnfName);
+ }
+
+ @Test
+ public void addPNFtoServiceAndDistribute() throws Exception {
+ ResourceReqDetails pnfMetaData = createPNFWithGenerateName();
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement("ContrailPort");
+ vfCanvasManager.createElementOnCanvas("ContrailPort");
+
+ String pnfName = pnfMetaData.getName();
+ ResourceGeneralPage.clickSubmitForTestingButton(pnfName);
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(pnfName);
+ TesterOperationPage.certifyComponent(pnfName);
+
+ pnfMetaData.setVersion("1.0");
+ VfVerificator.verifyVFLifecycle(pnfMetaData, getUser(), LifecycleStateEnum.CERTIFIED);
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(pnfName);
+ CanvasElement pnfElement = canvasManager.createElementOnCanvas(pnfName);
+ CompositionPage.searchForElement("Network");
+ CanvasElement networkElement = canvasManager.createElementOnCanvas("Network");
+
+ canvasManager.linkElements(pnfElement, CircleSize.VF, networkElement, CircleSize.NORMATIVE);
+ String serviceName = serviceMetadata.getName();
+ ServiceGeneralPage.clickSubmitForTestingButton(serviceName);
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(serviceName);
+ TesterOperationPage.certifyComponent(serviceName);
+
+ reloginWithNewRole(UserRoleEnum.GOVERNOR);
+ GeneralUIUtils.findComponentAndClick(serviceName);
+ GovernorOperationPage.approveSerivce(serviceName);
+
+ reloginWithNewRole(UserRoleEnum.OPS);
+ GeneralUIUtils.findComponentAndClick(serviceName);
+ OpsOperationPage.distributeService();
+ }
+
+ @Test
+ public void checkInfomationArtifactUploadLimitation() throws Exception {
+ ResourceReqDetails pnfMetaData = createPNFWithGenerateName();
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+ List<WebElement> webElements = GeneralUIUtils.getWebElementsListBy(By.xpath("//button[@class='add-button ng-scope']"));
+ int numberOfElements = webElements.size();
+ String buttonText = webElements.get(0).getText();
+ SetupCDTest.getExtendTest().log(Status.INFO, "Verifying only one button exist: Add Other Artifact");
+ assertTrue(buttonText.equalsIgnoreCase(("Add Other Artifact")));
+ assertTrue(1==numberOfElements, "There should be only one option for uploading artifact in PNF");
+ }
+
+ @Test
+ public void checkNonCPVLObjectsNotExistInComosition() throws Exception {
+ ResourceReqDetails pnfMetaData = createPNFWithGenerateName();
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ String pnfName = pnfMetaData.getName();
+ // Searching for VFC element and make sure it not exist in PNF composition (Only VL/CP are allowed).
+ CompositionPage.searchForElement("BlockStorage");
+ SetupCDTest.getExtendTest().log(Status.INFO, "Verifying Element found");
+ assertTrue(GeneralUIUtils.isElementInvisibleByTestId("BlockStorage"));
+ }
+
@Override
protected UserRoleEnum getRole() {
return UserRoleEnum.DESIGNER;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PortMirroring.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PortMirroring.java
new file mode 100644
index 0000000000..b4bd55c6ca
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PortMirroring.java
@@ -0,0 +1,124 @@
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.util.Map;
+
+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.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.ConnectionWizardPopUpObject;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceContainer;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
+import org.openecomp.sdc.ci.tests.datatypes.enums.CircleSize;
+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;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+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.general.FileHandling;
+import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis;
+import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+import fj.data.Either;
+
+public class PortMirroring extends SetupCDTest
+{
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER3;
+ }
+
+ String portMirroringElementNameInPallete = "Port Mirroring Configuration";
+ String portMirroringCapReqType = "org.openecomp.capabilities.PortMirroring";
+ String portMirroringSourceCapability = "Port Mirroring Configuration 0: source: [1, UNBOUNDED]";
+ String portMirroringCollectorCapability = "Port Mirroring Configuration 0: collector: [1, 1]";
+
+ @Test
+ public void createPortMirroringServiceProxy() throws Throwable {
+ //Using API onboard and certify 2 zip files Source: vmmme and Collector: Vprobe
+ String filePath = FileHandling.getPortMirroringRepositoryPath();
+ ServiceContainer serviceContainerVmme_Source = createServiceFromHeatFile(filePath,"2016-227_vmme_vmme_30_1610_e2e.zip");
+ ServiceContainer serviceContainerVprobe_Collector = createServiceFromHeatFile(filePath,"vProbe_2017-10-22_07-24.zip");
+
+// String vmmeSourceName = "ciServiceb560327d162f";
+// String vprobeSourceName = "ciService3d9933d31791";
+
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ String vmmeSourceName = serviceContainerVmme_Source.getService().getName();
+ String vprobeSourceName = serviceContainerVprobe_Collector.getService().getName();
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+
+ CompositionPage.searchForElement(vmmeSourceName);
+ CanvasElement serviceElementVmmeSourceName = canvasManager.createElementOnCanvas(vmmeSourceName);
+
+ CompositionPage.searchForElement(vprobeSourceName);
+ CanvasElement serviceElementVprobeCollector = canvasManager.createElementOnCanvas(vprobeSourceName);
+
+ CompositionPage.searchForElement(portMirroringElementNameInPallete);
+ CanvasElement portMirroringConfigurationElement = canvasManager.createElementOnCanvas(portMirroringElementNameInPallete);
+
+ ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("","", portMirroringCapReqType, portMirroringSourceCapability);
+ ConnectionWizardPopUpObject connectionWizardPopUpObjectVProbe = new ConnectionWizardPopUpObject("","", portMirroringCapReqType, portMirroringCollectorCapability);
+
+ canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSourceName, CircleSize.SERVICE,portMirroringConfigurationElement, CircleSize.NORMATIVE, connectionWizardPopUpObjectVMME);
+ canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVprobeCollector, CircleSize.SERVICE, portMirroringConfigurationElement, CircleSize.NORMATIVE, connectionWizardPopUpObjectVProbe);
+
+ serviceMetadata.setVersion("0.1");
+ ServiceVerificator.verifyLinkCreated(serviceMetadata, getUser(), 2);
+
+ System.out.println("End");
+ }
+
+ public ServiceContainer createServiceFromHeatFile(String filePath, String vnfFile) throws Throwable
+ {
+ setLog(String.format("Distribute Service Test: Create VF from %s add it to service than distribute", vnfFile));
+// 1. Import VSP v1.0
+ User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER3);
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(sdncDesignerDetails1);
+ getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName()));
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
+ getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile));
+ Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, amdocsLicenseMembers);
+ VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct);
+// 2. Create VF, certify - v1.0 is created
+ resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
+ Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName()));
+ getExtendTest().log(Status.INFO, String.format("Certify the VF"));
+// 3. Create Service add to it the certified VF and certify the Service v1.0
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
+ Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+ getExtendTest().log(Status.INFO, String.format("Creating Service: %s v1.0", serviceReqDetails.getName()));
+ Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+ ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value();
+ getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service"));
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ getExtendTest().log(Status.INFO, String.format("Certify the Service"));
+
+ return new ServiceContainer(service,resource,vendorSoftwareProductObject,amdocsLicenseMembers);
+ }
+
+
+}
+
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignment.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignment.java
new file mode 100644
index 0000000000..4ccc7b024b
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/PropertiesAssignment.java
@@ -0,0 +1,95 @@
+/*-
+ * ============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.execute.sanity;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.PropertiesAssignmentPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.testng.AssertJUnit;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+
+public class PropertiesAssignment extends SetupCDTest {
+
+ private String filePath;
+ @BeforeClass
+ public void beforeClass(){
+ filePath = FileHandling.getFilePath("");
+ }
+
+ @BeforeMethod
+ public void beforeTest(){
+ System.out.println("File repository is : " + filePath);
+ getExtendTest().log(Status.INFO, "File repository is : " + filePath);
+ }
+
+
+
+ @Test
+ public void declareAndDeleteInputVfTest() throws Exception {
+// ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+// ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ String csarFile = "PCRF_OS_FIXED.csar";
+ String componentName = "abstract_pcm";
+ String propertyName = "min_instances";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ resourceMetaData.setVersion("0.1");
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser());
+
+
+ ResourceGeneralPage.getLeftMenu().moveToPropertiesAssignmentScreen();
+ PropertiesAssignmentPage.clickOnComponentInComposition(componentName);
+ PropertiesAssignmentPage.findSearchBoxAndClick(propertyName);
+ PropertiesAssignmentPage.clickOnDeclareButton();
+ AssertJUnit.assertTrue(PropertiesAssignmentPage.isPropertyChecked(propertyName));
+
+ PropertiesAssignmentPage.clickOnInputTab();
+ PropertiesAssignmentPage.findInput(componentName, propertyName);
+ PropertiesAssignmentPage.clickOnDeleteInputButton();
+ PropertiesAssignmentPage.clickOnDeleteInputDialogConfirmationButton();
+ PropertiesAssignmentPage.clickOnPropertiesTab();
+ PropertiesAssignmentPage.findProperty(propertyName);
+ AssertJUnit.assertFalse(PropertiesAssignmentPage.isPropertyChecked(propertyName));
+
+
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java
index 54656d8b9b..d6370c10dc 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java
@@ -23,7 +23,6 @@ package org.openecomp.sdc.ci.tests.execute.sanity;
import static org.testng.AssertJUnit.assertTrue;
import java.awt.AWTException;
-import java.io.File;
import java.util.Arrays;
import java.util.List;
@@ -31,7 +30,6 @@ import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
-import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
@@ -40,6 +38,7 @@ import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ServiceMetadataEnum;
import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
@@ -69,7 +68,6 @@ import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.AssertJUnit;
-import org.testng.SkipException;
import org.testng.TestException;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -117,7 +115,7 @@ public class Service extends SetupCDTest {
// Update Service
ServiceGeneralPage.deleteOldTags(serviceMetadata);
- serviceMetadata.setName("ciUpdatedNameSanity");
+ serviceMetadata.setName(ElementFactory.getServicePrefix() + "UpdatedName" + serviceMetadata.getName());
serviceMetadata.setDescription("updatedDescriptionSanity");
serviceMetadata.setProjectCode("654321");
serviceMetadata.setContactId("cs6543");
@@ -214,6 +212,23 @@ public class Service extends SetupCDTest {
}
@Test
+ public void createLinkService() throws Exception{
+ String fileName2 = "vSeGW.csar";
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser());
+ ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName());
+
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(resourceMetaData.getName());
+ CanvasElement firstElement = canvasManager.createElementOnCanvas(resourceMetaData.getName());
+ CanvasElement secondElement = canvasManager.createElementOnCanvas(resourceMetaData.getName());
+ canvasManager.linkElements(firstElement, secondElement);
+ }
+
+ @Test
public void addDeploymentArtifactInCompositionScreenTest() throws Exception{
ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
ServiceUIUtils.createService(serviceMetadata, getUser());
@@ -264,7 +279,7 @@ public class Service extends SetupCDTest {
}
@Test
- public void addAPIArtifactInCompositionScreenTest() throws Exception{
+ public void addAPIArtifactInCompositionScreenTest() throws Exception{
String fileName = HEAT_FILE_YAML_NAME,
descriptionText = DESCRIPTION,
url = "http://kuku.com";
@@ -272,7 +287,7 @@ public class Service extends SetupCDTest {
ServiceUIUtils.createService(serviceMetadata, getUser());
ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
- ArtifactInfo artifactInfo = new ArtifactInfo(filePath, fileName, descriptionText, ARTIFACT_LABEL,"OTHER");
+ new ArtifactInfo(filePath, fileName, descriptionText, ARTIFACT_LABEL,"OTHER");
CompositionPage.showAPIArtifactTab();
for(DataTestIdEnum.APIArtifactsService artifact: DataTestIdEnum.APIArtifactsService.values()){
@@ -367,10 +382,6 @@ public class Service extends SetupCDTest {
@Test
public void addDeploymentArtifactToVFInstanceTest() throws Exception{
- if(true){
- throw new SkipException("Open bug 321669");
- }
-
ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType());
@@ -385,12 +396,12 @@ public class Service extends SetupCDTest {
@Test
public void deleteDeploymentArtifactFromVFInstanceTest() throws Exception{
-
+
ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType());
- CanvasElement computeElement = createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact);
+ createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact);
checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME);
List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
deleteAndVerifyArtifact(actualArtifactList);
@@ -400,9 +411,9 @@ public class Service extends SetupCDTest {
@Test
public void deleteDeploymentArtifactFromVFInstanceNextVersionTest() throws Exception{
- if(true){
- throw new SkipException("Open bug 322930");
- }
+// if(true){
+// throw new SkipException("Open bug 342260");
+// }
ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
@@ -429,9 +440,9 @@ public class Service extends SetupCDTest {
@Test
public void updateDeploymentArtifactOnVFInstanceNextVersionTest() throws Exception{
- if(true){
- throw new SkipException("Open bug 322930");
- }
+// if(true){
+// throw new SkipException("Open bug 322930");
+// }
ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
@@ -569,7 +580,7 @@ public class Service extends SetupCDTest {
@Test
public void deploymentViewServiceTest() throws Exception{
- String fileName2 = "vSeGW.csar";
+ String fileName2 = "vSeGWNew.csar";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser());
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidationTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidationTest.java
index d70f5e8d5d..d42df64a5a 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidationTest.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ToscaValidationTest.java
@@ -1,39 +1,21 @@
-/*-
- * ============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.execute.sanity;
import java.io.File;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Random;
-import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.ComponentInstanceInput;
+import org.openecomp.sdc.be.model.PropertyDefinition;
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.dataProvider.OnbordingDataProviders;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
@@ -42,21 +24,22 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaInputsTopologyTemplateDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaTopologyTemplateDefinition;
import org.openecomp.sdc.ci.tests.tosca.model.ToscaMetadataFieldsPresentationEnum;
import org.openecomp.sdc.ci.tests.utilities.DownloadManager;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUtillViaApis;
import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
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.general.OnboardingUtillViaApis;
+import org.openecomp.sdc.ci.tests.utils.rest.PropertyRestUtils;
import org.openecomp.sdc.ci.tests.verificator.ToscaValidation;
import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory;
import org.openecomp.sdc.toscaparser.api.NodeTemplate;
import org.openecomp.sdc.toscaparser.api.elements.Metadata;
import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.aventstack.extentreports.Status;
@@ -66,27 +49,31 @@ import fj.data.Either;
public class ToscaValidationTest extends SetupCDTest{
-
- ToscaDefinition toscaMainAmdocsDefinition, toscaMainVfDefinition, toscaMainServiceDefinition;
+
+ private static final String GENERIC_VF = "Generic_VF";
+ private static final String GENERIC_PNF = "Generic_PNF";
+
+// private ToscaDefinition toscaMainAmdocsDefinition, toscaMainVfDefinition, toscaMainServiceDefinition, toscaExpectedMainServiceDefinition;
protected String vnfFile;
protected String filepath;
- protected File filesFolder;
+// protected File filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory());
protected SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
- protected ISdcCsarHelper fdntCsarHelper;
- protected ResourceReqDetails resourceReqDetails;
- protected Resource resource;
- protected ServiceReqDetails serviceReqDetails;
- protected Service service;
- protected ComponentInstance componentInstanceDefinition;
+// protected ISdcCsarHelper fdntCsarHelper;
+// protected ResourceReqDetails resourceReqDetails;
+// protected Resource resource;
+// protected ServiceReqDetails serviceReqDetails;
+// protected Service service;
+// protected ComponentInstance componentInstanceDefinition;
User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- File importToscaFilesFolder = new File("C:/Git_work/sdc/catalog-be/src/main/resources/import/tosca/");
+// File importToscaFilesFolder = new File("C:/Git_work/sdc/catalog-be/src/main/resources/import/tosca/");
- File dataTypesLocation = new File(importToscaFilesFolder.getPath() + "/data-types/dataTypes.yml");
+// File dataTypesLocation = new File(importToscaFilesFolder.getPath() + "/data-types/dataTypes.yml");
+// List<Boolean> status = new ArrayList<>();
- File genericVfFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_VF/Generic_VF.yml");
- File genericVfcFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_VFC/Generic_VFC.yml");
- File genericPnfFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_PNF/Generic_PNF.yml");
- File genericServiceFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_Service/Generic_Service.yml");
+// File genericVfFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_VF/Generic_VF.yml");
+// File genericVfcFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_VFC/Generic_VFC.yml");
+// File genericPnfFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_PNF/Generic_PNF.yml");
+// File genericServiceFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_Service/Generic_Service.yml");
// Map<String, DataTypeDefinition> parseDataTypesYaml = FileHandling.parseDataTypesYaml(dataTypesLocation.getAbsoluteFile().toString());
@@ -102,115 +89,246 @@ public class ToscaValidationTest extends SetupCDTest{
this.vnfFile = vnfFile;
}
+ public ToscaValidationTest() {
+ }
- @BeforeClass
-
- public void precondition() throws Exception{
+
+
+// @BeforeClass
+ @Test()
+ public void toscaFileValidator() throws Exception{
//--------------------------GENERAL--------------------------------
- setLog(vnfFile);
- filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory());
-//--------------------------AMDOCS--------------------------------
- Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(filepath, vnfFile, user);
- VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right;
- vendorSoftwareProductObject.setVspName(createVendorSoftwareProduct.left);
- DownloadManager.downloadCsarByNameFromVSPRepository(vendorSoftwareProductObject.getVspName(), vendorSoftwareProductObject.getVspId(), false);
- File amdocsCsarFileName = FileHandling.getLastModifiedFileNameFromDir(filesFolder.getAbsolutePath());
+/*// for debugging only
+ setLog("Test");
+ File amdocsCsarFileName = (new File("C:\\Users\\al714h\\Downloads\\d218be69637647b0b693647d84a8c03f.csar"));
toscaMainAmdocsDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(amdocsCsarFileName);
-
+ toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File("C:\\Users\\al714h\\Downloads\\resource-Civfonboarded2016073VmxBv301072E2eE60f5c15-csar.csar"));
+ */
+ setLog(vnfFile);
+ List<Boolean> status = new ArrayList<>();
+ ISdcCsarHelper fdntCsarHelper;
+ File filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory());
+// filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory());
+//--------------------------AMDOCS--------------------------------
+// vnfFile = "HeatCandidate_2017-09-22_01-32_60Name_Vdbe-vsp-15.1x49-d50.3-v1.0-(VOIP).zip";
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, user);//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ resourceReqDetails = createCustomizedVsp(resourceReqDetails, filepath, vnfFile);
+
+ ToscaDefinition toscaMainAmdocsDefinition = downloadAndGetToscaMainYamlObjectUI(resourceReqDetails, filesFolder);
+//------adding generic inputs to expected object
+ toscaMainAmdocsDefinition = addGenericPropertiesToToscaDefinitionObject(toscaMainAmdocsDefinition, GENERIC_VF);
+// copy object
+ ToscaDefinition toscaExpectedMainServiceDefinition = new ToscaDefinition(toscaMainAmdocsDefinition);
//TODO--------------------------AMDOCS DOWNLOAD VIA APIS--------------------------------
//--------------------------VF--------------------------------
// create VF base on VNF imported from previous step - have, resourceReqDetails object include part of resource metadata
- resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(vendorSoftwareProductObject, vendorSoftwareProductObject.getVspName());
- resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails, vendorSoftwareProductObject.getVspName());
+ Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
- File VfCsarFileName = new File(File.separator + "VfCsar_" + ElementFactory.generateUUIDforSufix() + ".csar");
- OnboardingUtillViaApis.downloadToscaCsarToDirectory(resource, new File(filesFolder.getPath() + VfCsarFileName));
- toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName));
+ ToscaDefinition toscaMainVfDefinition = downloadAndGetToscaMainYamlObjectApi(resource, filesFolder);
+
//--------------------------SERVICE--------------------------------
- serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(user);
- service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();//getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+// serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(serviceReqDetails, user);
+ Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
- componentInstanceDefinition = addComponentInstanceToComponentContainer.left().value();
-// TODO declare all VFi inputs + add all generic
+ ComponentInstance componentInstanceDefinition = addComponentInstanceToComponentContainer.left().value();
+
+//--------------------------getProperties set values and declare--------------------
+
+ Component componentObject = AtomicOperationUtils.getComponentObject(service, UserRoleEnum.DESIGNER);
+ Map<String, List<ComponentInstanceInput>> componentInstancesInputs = componentObject.getComponentInstancesInputs();
+ setValuesToPropertiesList(componentInstancesInputs, toscaExpectedMainServiceDefinition);
+ PropertyRestUtils.declareProporties(componentObject, componentInstancesInputs, user);
+
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
File ServiceCsarFileName = new File(File.separator + "ServiceCsar_" + ElementFactory.generateUUIDforSufix() + ".csar");
OnboardingUtillViaApis.downloadToscaCsarToDirectory(service, new File(filesFolder.getPath() + ServiceCsarFileName));
- toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + ServiceCsarFileName));
+ ToscaDefinition toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + ServiceCsarFileName));
+
+
+
+
-//--------------------------verification against Pavel Parser--------------------------------
+//--------------------------initialization of Tosca Parser--------------------------------
+
+ fdntCsarHelper = initSdcCsarHelper(ServiceCsarFileName, filesFolder);
+
+
+//---------------------------TESTS--------------------------------------------------
+ status = validateVfMetadata(toscaMainAmdocsDefinition, toscaMainVfDefinition, resourceReqDetails, resource, vnfFile, status);
+ status = validateResourceNodeTemplateMetadata(toscaMainVfDefinition, resource, vnfFile, status);
+ status = validateServiceMetadata(toscaMainServiceDefinition, serviceReqDetails, service, vnfFile, status);
+ status = validateServiceNodeTemplateMetadata(toscaMainServiceDefinition, componentInstanceDefinition, resourceReqDetails, resource, vnfFile, status);
+ status = validateServiceMetadataUsingParser(fdntCsarHelper, serviceReqDetails, service, vnfFile, status);
+ status = validateServiceNodeTemplateMetadataUsingParser(fdntCsarHelper, resourceReqDetails, resource, componentInstanceDefinition, vnfFile, status);
+ status = validateResourceInputs(toscaMainAmdocsDefinition, toscaMainVfDefinition, vnfFile, status);
+ status = validateServiceInputs(toscaExpectedMainServiceDefinition, toscaMainServiceDefinition, vnfFile, status);
+ status = validateServiceInputsUsingParser(fdntCsarHelper, toscaExpectedMainServiceDefinition, vnfFile, status);
- SetupCDTest.getExtendTest().log(Status.INFO, "Tosca parser is going to convert service csar file to ISdcCsarHelper object...");
- fdntCsarHelper = factory.getSdcCsarHelper(filesFolder.getPath() + ServiceCsarFileName);
+ if(status.contains(false)){
+ SetupCDTest.getExtendTest().log(Status.FAIL, "Summary: tosca validation test failed with zip file " + vnfFile);
+ Assert.assertFalse(true);
+ }
+ }
+
+
+
+
+
+
+
+ /**The method set values to toscaDefinition object service level only, to resource level should put instead of setDefault --> setValue
+ * inputs.get(componentInstanceInput.getName()).setValue(randomString);
+ * @param componentInstancesInputs
+ * @param toscaDefinition
+ */
+ private void setValuesToPropertiesList(Map<String, List<ComponentInstanceInput>> componentInstancesInputs, ToscaDefinition toscaDefinition) {
+ for(Map.Entry<String, List<ComponentInstanceInput>> entry : componentInstancesInputs.entrySet()) {
+ List<ComponentInstanceInput> value = entry.getValue();
+ String[] names = entry.getKey().split("\\.");
+ String expectedServiceInputPrefix = null;
+ Map<String, ToscaInputsTopologyTemplateDefinition> inputs = toscaDefinition.getTopology_template().getInputs();
+ if(names.length>0) {
+ expectedServiceInputPrefix = names[names.length - 1] + "_";
+ }
+ for (ComponentInstanceInput componentInstanceInput :value) {
+
+ String type = componentInstanceInput.getType();
+ List<String> myList = new ArrayList<String>();
+ myList.add("cbf8049e-69e8-48c3-a06f-255634391403");
+ if (type.equals("string")) {
+ String randomString = getRandomString();
+ componentInstanceInput.setValue(randomString);
+ inputs.get(componentInstanceInput.getName()).setDefault(randomString);
+
+ }
+ else if (type.equals("integer") ) {
+ int randomInteger = getRandomInteger();
+ componentInstanceInput.setValue(Integer.toString(randomInteger));
+ inputs.get(componentInstanceInput.getName()).setDefault(randomInteger);
+ }
+ else if (type.equals("float") ){
+ componentInstanceInput.setValue("5.5");
+ inputs.get(componentInstanceInput.getName()).setDefault("5.5");
+
+ }
+ else if (type.equals("boolean") ){
+ componentInstanceInput.setValue("true");
+ inputs.get(componentInstanceInput.getName()).setDefault("true");
+ }
+ else if (type.equals("list") ){
+ String myListofStrings = myList.toString();
+ componentInstanceInput.setValue(myListofStrings);
+ inputs.get(componentInstanceInput.getName()).setDefault(myListofStrings);
+ }
+
+ String expectedServiceInputName = expectedServiceInputPrefix + componentInstanceInput.getName();
+ ToscaInputsTopologyTemplateDefinition oldInput = inputs.get(componentInstanceInput.getName());
+ inputs.put(expectedServiceInputName, oldInput);
+ inputs.remove(componentInstanceInput.getName());
+
+ }
+
+ }
}
-
+
+ protected String getRandomString() {
+ String SALTCHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
+ StringBuilder salt = new StringBuilder();
+ Random rnd = new Random();
+ while (salt.length() < 18) { // length of the random string.
+ int index = (int) (rnd.nextFloat() * SALTCHARS.length());
+ salt.append(SALTCHARS.charAt(index));
+ }
+ String strValue = salt.toString();
+ return strValue;
+
+ }
+
+ protected int getRandomInteger() {
+ Random r = new Random();
+ int Low = 10;
+ int High = 100;
+ int integerValue = r.nextInt(High - Low) + Low;
+ return integerValue;
+ }
+
+
//--------------------------Metadata verification--------------------------------
//--------------------------Resource--------------------------------
- @Test()
- public void validateVfMetadata() throws Exception{
- setLog(vnfFile);
- SetupCDTest.getExtendTest().log(Status.INFO, "validateVfMetadata " + vnfFile);
+ public List<Boolean> validateVfMetadata(ToscaDefinition toscaMainAmdocsDefinition, ToscaDefinition toscaMainVfDefinition, ResourceReqDetails resourceReqDetails,Resource resource, String vnfFile, List<Boolean> status) throws Exception{
+ reportStartTestPrint("validateVfMetadata", vnfFile);
//add resource metadata to expected object
toscaMainAmdocsDefinition = addAndGenerateResourceMetadataToExpectedObject(toscaMainAmdocsDefinition, resourceReqDetails, resource);
Either<Boolean,Map<String,Object>> resourceToscaMetadataValidator = ToscaValidation.resourceToscaMetadataValidator(toscaMainAmdocsDefinition, toscaMainVfDefinition);
- Assert.assertFalse(!resourceToscaMetadataValidator.left().value().equals(true), "Found error/s on Vf metadata verification");
-
+ if(resourceToscaMetadataValidator.isRight())
+ status.add(false);
+ return status;
}
- @Test()
- public void validateResourceNodeTemplateMetadata() throws Exception{
- setLog(vnfFile);
- SetupCDTest.getExtendTest().log(Status.INFO, "validateResourceNodeTemplateMetadata " + vnfFile);
+ public List<Boolean> validateResourceNodeTemplateMetadata(ToscaDefinition toscaMainVfDefinition, Resource resource, String vnfFile, List<Boolean> status) throws Exception{
+ reportStartTestPrint("validateResourceNodeTemplateMetadata", vnfFile);
Map<String, Map<String, String>> generateReosurceNodeTemplateMetadataToExpectedObject = generateResourceNodeTemplateMetadataToExpectedObject(resource);
Boolean resourceToscaMetadataValidator = ToscaValidation.resourceToscaNodeTemplateMetadataValidator(generateReosurceNodeTemplateMetadataToExpectedObject, toscaMainVfDefinition);
- Assert.assertFalse(!resourceToscaMetadataValidator.equals(true), "Found error/s on Resource Node Template metadata verification");
+ if(! resourceToscaMetadataValidator)
+ status.add(false);
+ return status;
}
//--------------------------Service--------------------------------
- @Test()
- public void validateServiceMetadata() throws Exception{
- setLog(vnfFile);
- SetupCDTest.getExtendTest().log(Status.INFO, "validateServiceMetadata " + vnfFile);
+ public List<Boolean> validateServiceMetadata(ToscaDefinition toscaMainServiceDefinition, ServiceReqDetails serviceReqDetails, Service service, String vnfFile, List<Boolean> status) throws Exception{
+ reportStartTestPrint("validateServiceMetadata", vnfFile);
Map<String, String> generateServiceMetadataToExpectedObject = generateServiceMetadataToExpectedObject(serviceReqDetails, service);
Either<Boolean,Map<String, Object>> serviceToscaMetadataValidator = ToscaValidation.serviceToscaMetadataValidator(generateServiceMetadataToExpectedObject, toscaMainServiceDefinition);
- Assert.assertFalse(!serviceToscaMetadataValidator.left().value().equals(true), "Found error/s on Service metadata verification");
+ if(serviceToscaMetadataValidator.isRight())
+ status.add(false);
+ return status;
}
- @Test()
- public void validateServiceNodeTemplateMetadata() throws Exception{
- setLog(vnfFile);
- SetupCDTest.getExtendTest().log(Status.INFO, "validateServiceNodeTemplateMetadata " + vnfFile);
+ public List<Boolean> validateServiceNodeTemplateMetadata(ToscaDefinition toscaMainServiceDefinition, ComponentInstance componentInstanceDefinition, ResourceReqDetails resourceReqDetails, Resource resource, String vnfFile, List<Boolean> status) throws Exception{
+ reportStartTestPrint("validateServiceNodeTemplateMetadata", vnfFile);
Map<String, String> generateServiceNodeTemplateMetadataToExpectedObject = generateServiceNodeTemplateMetadataToExpectedObject(resourceReqDetails, resource, componentInstanceDefinition);
- Either<Boolean,Map<String, Object>> serviceToscaMetadataValidator = ToscaValidation.componentToscaNodeTemplateMetadataValidator(generateServiceNodeTemplateMetadataToExpectedObject, toscaMainServiceDefinition, componentInstanceDefinition.getName(), ComponentTypeEnum.SERVICE);
- Assert.assertFalse(!serviceToscaMetadataValidator.left().value().equals(true), "Found error/s on Service Node Template metadata verification");
+ Either<Boolean,Map<String, Object>> serviceToscaMetadataValidator = ToscaValidation.componentToscaNodeTemplateMetadataValidator(generateServiceNodeTemplateMetadataToExpectedObject, toscaMainServiceDefinition, componentInstanceDefinition.getName(), ComponentTypeEnum.SERVICE, componentInstanceDefinition.getName());
+ if(serviceToscaMetadataValidator.isRight())
+ status.add(false);
+ return status;
}
//--------------------------Service verification against Pavel Parser--------------------------------
- @Test()
- public void validateServiceMetadataUsingParser() throws Exception{
- setLog(vnfFile);
- SetupCDTest.getExtendTest().log(Status.INFO, "validateServiceMetadataUsingParser " + vnfFile);
- Map<String, String> generateServiceMetadataToExpectedObject = generateServiceMetadataToExpectedObject(serviceReqDetails, service);
- Metadata serviceMetadata = fdntCsarHelper.getServiceMetadata();
- Either<Boolean,Map<String, Object>> serviceToscaMetadataValidatorAgainstParser = ToscaValidation.serviceToscaMetadataValidatorAgainstParser(generateServiceMetadataToExpectedObject, serviceMetadata);
- Assert.assertFalse(!serviceToscaMetadataValidatorAgainstParser.left().value().equals(true), "Found error/s on Service metadata verification");
+ public List<Boolean> validateServiceMetadataUsingParser(ISdcCsarHelper fdntCsarHelper, ServiceReqDetails serviceReqDetails, Service service, String vnfFile, List<Boolean> status) throws Exception{
+ if(fdntCsarHelper == null){
+ reportSkipTestPrint("validateServiceMetadataUsingParser", status);
+ }else{
+ reportStartTestPrint("validateServiceMetadataUsingParser", vnfFile);
+ Map<String, String> generateServiceMetadataToExpectedObject = generateServiceMetadataToExpectedObject(serviceReqDetails, service);
+ Metadata serviceMetadata = fdntCsarHelper.getServiceMetadata();
+ Either<Boolean,Map<String, Object>> serviceToscaMetadataValidatorAgainstParser = ToscaValidation.serviceToscaMetadataValidatorAgainstParser(generateServiceMetadataToExpectedObject, serviceMetadata);
+ if(serviceToscaMetadataValidatorAgainstParser.isRight())
+ status.add(false);
+ }
+ return status;
}
- @Test()
- public void validateServiceNodeTemplateMetadataUsingParser() throws Exception{
- setLog(vnfFile);
- SetupCDTest.getExtendTest().log(Status.INFO, "validateServiceMetadataUsingParser " + vnfFile);
- Map<String, String> generateServiceNodeTemplateMetadataToExpectedObject = generateServiceNodeTemplateMetadataToExpectedObject(resourceReqDetails, resource, componentInstanceDefinition);
- List<NodeTemplate> serviceNodeTemplates = fdntCsarHelper.getServiceNodeTemplates();
- Metadata serviceNodeTemplateMetadata = serviceNodeTemplates.get(0).getMetaData();
- Either<Boolean,Map<String, Object>> serviceNodeTemplateToscaMetadataValidatorAgainstParser = ToscaValidation.serviceToscaMetadataValidatorAgainstParser(generateServiceNodeTemplateMetadataToExpectedObject, serviceNodeTemplateMetadata);
- Assert.assertFalse(!serviceNodeTemplateToscaMetadataValidatorAgainstParser.left().value().equals(true), "Found error/s on Service metadata verification");
+ public List<Boolean> validateServiceNodeTemplateMetadataUsingParser(ISdcCsarHelper fdntCsarHelper, ResourceReqDetails resourceReqDetails,Resource resource, ComponentInstance componentInstanceDefinition, String vnfFile, List<Boolean> status) throws Exception{
+ if(fdntCsarHelper == null){
+ reportSkipTestPrint("validateServiceNodeTemplateMetadataUsingParser", status);
+ }else{
+ reportStartTestPrint("validateServiceNodeTemplateMetadataUsingParser", vnfFile);
+ Map<String, String> generateServiceNodeTemplateMetadataToExpectedObject = generateServiceNodeTemplateMetadataToExpectedObject(resourceReqDetails, resource, componentInstanceDefinition);
+ List<NodeTemplate> serviceNodeTemplates = fdntCsarHelper.getServiceNodeTemplates();
+ Metadata serviceNodeTemplateMetadata = serviceNodeTemplates.get(0).getMetaData();
+ Either<Boolean,Map<String, Object>> serviceNodeTemplateToscaMetadataValidatorAgainstParser = ToscaValidation.serviceToscaMetadataValidatorAgainstParser(generateServiceNodeTemplateMetadataToExpectedObject, serviceNodeTemplateMetadata);
+ if(serviceNodeTemplateToscaMetadataValidatorAgainstParser.isRight())
+ status.add(false);
+ }
+ return status;
}
@@ -218,13 +336,51 @@ public class ToscaValidationTest extends SetupCDTest{
//--------------------------Input verification--------------------------------
//--------------------------Resource--------------------------------
-
+ public List<Boolean> validateResourceInputs(ToscaDefinition toscaMainAmdocsDefinition, ToscaDefinition toscaMainVfDefinition, String vnfFile, List<Boolean> status) throws Exception{
+ reportStartTestPrint("validateResourceInputs", vnfFile);
+ Map<String, ToscaInputsTopologyTemplateDefinition> expectedInputsMap = toscaMainAmdocsDefinition.getTopology_template().getInputs();
+ Map<String, ToscaInputsTopologyTemplateDefinition> actualInputsMap = toscaMainVfDefinition.getTopology_template().getInputs();
+ Either<Boolean,Map<String, Object>> toscaInputsValidator = ToscaValidation.toscaInputsValidator(expectedInputsMap, actualInputsMap);
+ if(toscaInputsValidator.isRight())
+ status.add(false);
+ return status;
+ }
//--------------------------Service--------------------------------
+ public List<Boolean> validateServiceInputs(ToscaDefinition toscaExpectedMainServiceDefinition, ToscaDefinition toscaMainServiceDefinition, String vnfFile, List<Boolean> status) throws Exception{
+ reportStartTestPrint("validateServiceInputs", vnfFile);
+ Map<String, ToscaInputsTopologyTemplateDefinition> expectedInputsMap = toscaExpectedMainServiceDefinition.getTopology_template().getInputs();
+ Map<String, ToscaInputsTopologyTemplateDefinition> actualInputsMap = toscaMainServiceDefinition.getTopology_template().getInputs();
+ Either<Boolean,Map<String, Object>> toscaInputsValidator = ToscaValidation.toscaInputsValidator(expectedInputsMap, actualInputsMap);
+ if(toscaInputsValidator.isRight())
+ status.add(false);
+ return status;
+ }
//--------------------------Service verification against Pavel Parser--------------------------------
+ public List<Boolean> validateServiceInputsUsingParser(ISdcCsarHelper fdntCsarHelper, ToscaDefinition toscaExpectedMainServiceDefinition, String vnfFile, List<Boolean> status) throws Exception{
+ if(fdntCsarHelper == null){
+ reportSkipTestPrint("validateServiceInputsUsingParser", status);
+ }else{
+ reportStartTestPrint("validateServiceInputsUsingParser", vnfFile);
+ Map<String, ToscaInputsTopologyTemplateDefinition> expectedInputsMap = toscaExpectedMainServiceDefinition.getTopology_template().getInputs();
+ Either<Boolean,Map<String, Object>> toscaInputsValidator = ToscaValidation.toscaInputsValidatorAgainstParser(expectedInputsMap, fdntCsarHelper);
+ if(toscaInputsValidator.isRight())
+ status.add(false);
+ }
+ return status;
+ }
+ //--------------------------XXX verification--------------------------------
+
+ //--------------------------Resource--------------------------------
+
+
+ //--------------------------Service--------------------------------
+
+
+ //--------------------------Service verification against Pavel Parser--------------------------------
@@ -239,6 +395,38 @@ public class ToscaValidationTest extends SetupCDTest{
}
+ public static ToscaDefinition addGenericInputsToToscaObject(ToscaDefinition toscaDefinition, String genericName) throws Exception {
+ Resource genericResource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, genericName, "1.0");
+ ToscaTopologyTemplateDefinition topologyTemplate = toscaDefinition.getTopology_template();
+ Map<String, ToscaInputsTopologyTemplateDefinition> newInput = new HashMap<String, ToscaInputsTopologyTemplateDefinition>();
+ for (PropertyDefinition property : genericResource.getProperties()) {
+ ToscaInputsTopologyTemplateDefinition input = new ToscaInputsTopologyTemplateDefinition();
+// input.setConstraints(property.getConstraints());
+ input.setDefault(property.getDefaultValue());
+ input.setDescription(property.getDescription());
+// input.setEntry_schema(property.getSchema());
+ input.setName(property.getName());
+// input.setRequired(property.get);
+ input.setStatus(property.getStatus());
+ input.setType(property.getType());
+ input.setValue(property.getValue());
+ newInput.put(property.getName(),input);
+ }
+
+ topologyTemplate.addInputs(newInput);
+ toscaDefinition.setTopology_template(topologyTemplate);
+ return toscaDefinition;
+ }
+
+ public static ToscaDefinition setNameToToscaInput(ToscaDefinition toscaDefinition) {
+ Map<String, ToscaInputsTopologyTemplateDefinition> inputs = toscaDefinition.getTopology_template().getInputs();
+ for (String name : inputs.keySet()) {
+ inputs.get(name).setName(name);
+ }
+ toscaDefinition.getTopology_template().setInputs(inputs);
+ return toscaDefinition;
+ }
+
public static ToscaDefinition addAndGenerateResourceMetadataToExpectedObject(ToscaDefinition toscaDefinition, ResourceReqDetails resourceReqDetails, Component component) {
@@ -255,7 +443,7 @@ public class ToscaValidationTest extends SetupCDTest{
metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.CATEGORY.value, resourceReqDetails.getCategories().get(0).getName());
metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.DESCRIPTION.value, resourceReqDetails.getDescription());
metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.INVARIANT_UUID.value, component.getInvariantUUID());
- metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.TYPE.value, "VF");
+ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.TYPE.value, resourceReqDetails.getResourceType());
metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.UUID.value, component.getUUID());
metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.NAME.value, component.getName());
@@ -329,6 +517,199 @@ public class ToscaValidationTest extends SetupCDTest{
return metadata;
}
-
+ public static void reportStartTestPrint (String testName, String vnfFile){
+// reportMessageInColor("info", "blue", "Running test \" + testName + \" with zip file - \" + vnfFile");
+ SetupCDTest.getExtendTest().log(Status.INFO, "<html><font color=\"blue\"> Running test " + testName + " with zip file - " + vnfFile + "</font></html>");
+ }
+ public static void reportSkipTestPrint (String testName, List<Boolean> status){
+// reportMessageInColor("error", "orange", "Skip test \" + testName + \" due to previous tosca parser error");
+ SetupCDTest.getExtendTest().log(Status.ERROR, "<html><font color=\"orange\"> Skip test " + testName + " due to previous tosca parser error" + "</font></html>");
+ status.add(false);
+ }
+ public static void reportMessageInColor(String status, String color, String message){
+ String printLine = getReportMessageInColor(color, message);
+ SetupCDTest.getExtendTest().log(Status.valueOf(status), printLine);
+// SetupCDTest.getExtendTest().log(Status.valueOf(status), getReportMessageInColor(color, message));
+ }
+ /**
+ * @param color = red, green, orange, blue ...
+ * @param message - message string
+ * @return string in desired color
+ */
+ public static String getReportMessageInColor(String color, String message){
+ String returnValue = ("<html><font color=\\\"+color+\"\">" + message + "</font></html>").toString();
+ return returnValue;
+ }
+
+/* @Test()
+ public void printTest(){
+ System.out.println("print");
+ reportMessageInColor("ERROR", "green", "green");
+ reportMessageInColor("INFO", "orange", "orange");
+ reportMessageInColor("INFO", "red", "red");
+ }*/
+
+/* @Test
+ public void allottedResourceModelTest() throws Exception{
+ List<Boolean> status = new ArrayList<>();
+
+ List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure();
+ List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(1, fileNamesFromFolder);
+ String vnfFile = newRandomFileNamesFromFolder.get(0);
+ setLog(vnfFile);
+ String filePath = FileHandling.getVnfRepositoryPath();
+ File filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory());
+
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(ResourceCategoryEnum.ALLOTTED_RESOURCE_SERVICE_ADMIN);
+ resourceReqDetails = createCustomizedVsp(resourceReqDetails, filePath, vnfFile);
+
+ ToscaDefinition toscaMainAmdocsDefinition = downloadAndGetToscaMainYamlObjectUI(resourceReqDetails, filesFolder);
+ toscaMainAmdocsDefinition = addGenericPropertiesToToscaDefinitionObject(toscaMainAmdocsDefinition, GENERIC_VF);
+
+ Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ ToscaDefinition toscaMainVfDefinition = downloadAndGetToscaMainYamlObjectApi(resource, filesFolder);
+
+ status = validateVfMetadata(toscaMainAmdocsDefinition, toscaMainVfDefinition, resourceReqDetails, resource, vnfFile, status);
+ status = validateResourceNodeTemplateMetadata(toscaMainVfDefinition, resource, vnfFile, status);
+ status = validateResourceInputs(toscaMainAmdocsDefinition, toscaMainVfDefinition, vnfFile, status);
+
+ if(status.contains(false)){
+ SetupCDTest.getExtendTest().log(Status.FAIL, "Summary: allottedResourceModelTest tosca validation test failed with zip file " + vnfFile);
+ Assert.assertFalse(true);
+ }
+ }
+
+
+
+ @Test()
+ public void NetworkModel() throws Exception{
+//--------------------------GENERAL--------------------------------
+ String vnfFile = "networkModel";
+ setLog(vnfFile);
+ List<Boolean> status = new ArrayList<>();
+ ISdcCsarHelper fdntCsarHelper;
+ ToscaDefinition toscaMainAmdocsDefinition = new ToscaDefinition();
+ File filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory());
+// filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory());
+
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.PNF, user);
+ toscaMainAmdocsDefinition = addGenericPropertiesToToscaDefinitionObject(toscaMainAmdocsDefinition, GENERIC_PNF);
+ ToscaDefinition toscaExpectedMainServiceDefinition = new ToscaDefinition(toscaMainAmdocsDefinition);
+//--------------------------VF--------------------------------
+ Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceReqDetails,UserRoleEnum.DESIGNER,true).left().value();
+ resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
+ ToscaDefinition toscaMainVfDefinition = downloadAndGetToscaMainYamlObjectApi(resource, filesFolder);
+
+//--------------------------SERVICE--------------------------------
+ ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();
+ Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
+
+ Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+ ComponentInstance componentInstanceDefinition = addComponentInstanceToComponentContainer.left().value();
+
+//--------------------------getProperties set values and declare--------------------
+
+ Component componentObject = AtomicOperationUtils.getComponentObject(service, UserRoleEnum.DESIGNER);
+ Map<String, List<ComponentInstanceInput>> componentInstancesInputs = componentObject.getComponentInstancesInputs();
+ setValuesToPropertiesList(componentInstancesInputs, toscaExpectedMainServiceDefinition);
+ PropertyRestUtils.declareProporties(componentObject, componentInstancesInputs, user);
+
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ File ServiceCsarFileName = new File(File.separator + "ServiceCsar_" + ElementFactory.generateUUIDforSufix() + ".csar");
+ OnboardingUtillViaApis.downloadToscaCsarToDirectory(service, new File(filesFolder.getPath() + ServiceCsarFileName));
+ ToscaDefinition toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + ServiceCsarFileName));
+
+//--------------------------initialization of Tosca Parser--------------------------------
+
+ fdntCsarHelper = initSdcCsarHelper(ServiceCsarFileName, filesFolder);
+
+
+//---------------------------TESTS--------------------------------------------------
+ status = validateVfMetadata(toscaMainAmdocsDefinition, toscaMainVfDefinition, resourceReqDetails, resource, vnfFile, status);
+ status = validateResourceNodeTemplateMetadata(toscaMainVfDefinition, resource, vnfFile, status);
+ status = validateServiceMetadata(toscaMainServiceDefinition, serviceReqDetails, service, vnfFile, status);
+ status = validateServiceNodeTemplateMetadata(toscaMainServiceDefinition, componentInstanceDefinition, resourceReqDetails, resource, vnfFile, status);
+ status = validateServiceMetadataUsingParser(fdntCsarHelper, serviceReqDetails, service, vnfFile, status);
+ status = validateServiceNodeTemplateMetadataUsingParser(fdntCsarHelper, resourceReqDetails, resource, componentInstanceDefinition, vnfFile, status);
+ status = validateResourceInputs(toscaMainAmdocsDefinition, toscaMainVfDefinition, vnfFile, status);
+ status = validateServiceInputs(toscaExpectedMainServiceDefinition, toscaMainServiceDefinition, vnfFile, status);
+ status = validateServiceInputsUsingParser(fdntCsarHelper, toscaExpectedMainServiceDefinition, vnfFile, status);
+
+ if(status.contains(false)){
+ SetupCDTest.getExtendTest().log(Status.FAIL, "Summary: tosca validation test failed with zip file " + vnfFile);
+ Assert.assertFalse(true);
+ }
+ }*/
+
+ // help method to toscaValidation tests
+ private ISdcCsarHelper initSdcCsarHelper(File serviceCsarFileName, File filesFolder) {
+
+ ISdcCsarHelper fdntCsarHelper;
+ try{
+ SetupCDTest.getExtendTest().log(Status.INFO, "Tosca parser is going to convert service csar file to ISdcCsarHelper object...");
+ fdntCsarHelper = factory.getSdcCsarHelper(filesFolder.getPath() + serviceCsarFileName);
+ }catch(Exception e){
+ SetupCDTest.getExtendTest().log(Status.ERROR, "Tosca parser FAILED to convert service csar file to ISdcCsarHelper object...");
+ SetupCDTest.getExtendTest().log(Status.FAIL, e);
+ fdntCsarHelper = null;
+ }
+ return fdntCsarHelper;
+ }
+
+
+ /**
+ * @param resourceReqDetails to create Vsp
+ * @return updated resourceReqDetails after Vsp was created
+ */
+ private ResourceReqDetails createCustomizedVsp(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception {
+ Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(resourceReqDetails, filePath, vnfFile, user);
+ VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right;
+ vendorSoftwareProductObject.setName(createVendorSoftwareProduct.left);
+ resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
+ return resourceReqDetails;
+ }
+
+ /**
+ * @param resourceReqDetails to download csar file via UI
+ * @return Tosca definition object from main yaml file
+ */
+ private ToscaDefinition downloadAndGetToscaMainYamlObjectUI(ResourceReqDetails resourceReqDetails, File filesFolder) throws Exception {
+ DownloadManager.downloadCsarByNameFromVSPRepository(resourceReqDetails.getName(), false);
+ File amdocsCsarFileName = FileHandling.getLastModifiedFileNameFromDir(filesFolder.getAbsolutePath());
+ return ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(amdocsCsarFileName);
+ }
+
+ /**
+ * @param toscaMainAmdocsDefinition object to add generic properties
+ * @param genericName resource name
+ * @return updated toscaMainAmdocsDefinition object
+ */
+ private ToscaDefinition addGenericPropertiesToToscaDefinitionObject(ToscaDefinition toscaMainAmdocsDefinition, String genericName) throws Exception {
+ toscaMainAmdocsDefinition = setNameToToscaInput(toscaMainAmdocsDefinition);
+ toscaMainAmdocsDefinition = addGenericInputsToToscaObject(toscaMainAmdocsDefinition, genericName);
+ return toscaMainAmdocsDefinition;
+ }
+
+ /**
+ * @param resource to download csar file via API
+ * @return Tosca definition object from main yaml file
+ */
+ private ToscaDefinition downloadAndGetToscaMainYamlObjectApi(Resource resource, File filesFolder) throws Exception {
+ File VfCsarFileName = new File(File.separator + "VfCsar_" + ElementFactory.generateUUIDforSufix() + ".csar");
+ OnboardingUtillViaApis.downloadToscaCsarToDirectory(resource, new File(filesFolder.getPath() + VfCsarFileName));
+ return ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName));
+ }
+
+ /*public static void main(String[] args) {
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
+ List<CategoryDefinition> categories = resourceReqDetails.getCategories();
+ System.out.println(categories);
+ }*/
+
}
+
+
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 c96c66982c..b79393a0c9 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
@@ -46,12 +46,12 @@ import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
import org.openecomp.sdc.ci.tests.utilities.DownloadManager;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
import org.openecomp.sdc.ci.tests.verificator.VFCArtifactVerificator;
-import org.testng.SkipException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -73,10 +73,6 @@ public class VFCArtifacts extends SetupCDTest {
@Test
public void ImportMultiVFCTest_TC1407998() throws Exception{
- if(true){
- throw new SkipException("Open bug 294400");
- }
-
String csarFile = "Import_Multi_VFC.csar";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
@@ -96,10 +92,6 @@ public class VFCArtifacts extends SetupCDTest {
@Test
public void updateCsarWithVFCArtifacts_ModifyArtifacts_TC1449482() throws Exception{
- if(true){
- throw new SkipException("Open bug 294400");
- }
-
String csarFile = "LDSA-ORIG.csar";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
resourceMetaData.setVersion("0.1");
@@ -125,10 +117,6 @@ public class VFCArtifacts extends SetupCDTest {
@Test
public void updateCsarWithVFCArtifacts_DeleteAndAddArtifacts_TC1449473() throws Exception{
- if(true){
- throw new SkipException("Open bug 294400");
- }
-
String csarFile = "LDSA-ORIG.csar";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
resourceMetaData.setVersion("0.1");
@@ -143,10 +131,6 @@ public class VFCArtifacts extends SetupCDTest {
@Test
public void updateCsarWithVFCArtifacts_AddFirstVFCIdentifier_TC1425896() throws Exception{
- if(true){
- throw new SkipException("Open bug 294400");
- }
-
String csarFile = "LDSA-ORIG-OLD_STRUCTURE.csar";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
resourceMetaData.setVersion("0.1");
@@ -172,10 +156,6 @@ public class VFCArtifacts extends SetupCDTest {
@Test
public void updateCsarWithVFCArtifacts_AddAdditionalVFCIdentifier_TC1425898() throws Exception{
- if(true){
- throw new SkipException("Open bug 294400");
- }
-
String csarFile = "LDSA-SINGLE.csar";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
resourceMetaData.setVersion("0.1");
@@ -210,6 +190,7 @@ public class VFCArtifacts extends SetupCDTest {
@Test
public void updateCsarWithVFCArtifacts_DeleteAll_TC1425581() throws Exception{
+
String csarFile = "LDSA-ORIG.csar";
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
resourceMetaData.setVersion("0.1");
@@ -232,30 +213,26 @@ public class VFCArtifacts extends SetupCDTest {
@Test
public void importComplexVFCArtifacts_Onboarding_TC1484153() throws Exception{
- if(true){
- throw new SkipException("Open bug 294400");
- }
-
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
String vnfFile = "vProbes_FE.zip";
String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip";
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser());
- Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser(), amdocsLicenseMembers);
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser());
+ Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), amdocsLicenseMembers);
String vspName = createVSP.left;
resourceMetaData.setName(vspName);
Map<String, String> resourceMeta = createVSP.right;
String vspid = resourceMeta.get("vspId");
OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser());
- OnboardingUtils.prepareVspForUse(getUser(), vspid);
+ OnboardingUtils.prepareVspForUse(getUser(), vspid, "0.1");
String downloadDirectory = getWindowTest().getDownloadDirectory();
String csarFile = vspid + ".csar";
DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
HomePage.showVspRepository();
- OnboardingUtils.importVSP(createVSP);
+ OnboardingUiUtils.importVSP(createVSP);
resourceMetaData.setVersion("0.1");
verifyVfcArtifacts(downloadDirectory, csarFile, resourceMetaData, null);
@@ -268,10 +245,6 @@ public class VFCArtifacts extends SetupCDTest {
@Test
public void updateComplexVFCArtifacts_AddRemove_Onboarding_TC1484185() throws Exception{
- if(true){
- throw new SkipException("Open bug 294400");
- }
-
//check of version is 1
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
@@ -279,21 +252,21 @@ public class VFCArtifacts extends SetupCDTest {
String snmpPollFile = "vprobes-vLB.zip";
String updatedSnmpPollFile = "vprobes-vLBAgent.zip";
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser());
- Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser(), amdocsLicenseMembers);
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser());
+ Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), amdocsLicenseMembers);
String vspName = createVSP.left;
resourceMetaData.setName(vspName);
Map<String, String> resourceMeta = createVSP.right;
String vspid = resourceMeta.get("vspId");
String montoringComponentId = OnboardingUtils.addVFCArtifacts(filePath, snmpPollFile, null, vspid, getUser());
- OnboardingUtils.prepareVspForUse(getUser(), vspid);
+ OnboardingUiUtils.prepareVspForUse(getUser(), vspid, "0.1");
String downloadDirectory = getWindowTest().getDownloadDirectory();
String csarFile = vspid + ".csar";
DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
HomePage.showVspRepository();
- OnboardingUtils.importVSP(createVSP);
+ OnboardingUiUtils.importVSP(createVSP);
ResourceGeneralPage.clickSubmitForTestingButton(vspName);
@@ -302,10 +275,10 @@ public class VFCArtifacts extends SetupCDTest {
TesterOperationPage.certifyComponent(vspName);
reloginWithNewRole(UserRoleEnum.DESIGNER);
- OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpPollFile, null, montoringComponentId, getUser());
+ OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpPollFile, null, montoringComponentId, getUser(), "0.1");
DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
HomePage.showVspRepository();
- OnboardingUtils.updateVSP(createVSP);
+ OnboardingUiUtils.updateVSP(createVSP);
resourceMetaData.setVersion("1.1");
ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
@@ -318,10 +291,6 @@ public class VFCArtifacts extends SetupCDTest {
@Test
public void updateComplexVFCArtifacts_Modify_Onboarding_TC1484195() throws Exception{
- if(true){
- throw new SkipException("Open bug 294400");
- }
-
//check of version is 2
ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
@@ -329,21 +298,21 @@ public class VFCArtifacts extends SetupCDTest {
String snmpFile = "vprobes-vLB.zip";
String updatedSnmpFile = "vprobes-vLB-Modified.zip";
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser());
- Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser(), amdocsLicenseMembers);
+ AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser());
+ Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), amdocsLicenseMembers);
String vspName = createVSP.left;
resourceMetaData.setName(vspName);
Map<String, String> resourceMeta = createVSP.right;
String vspid = resourceMeta.get("vspId");
String monitoringId = OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser());
- OnboardingUtils.prepareVspForUse(getUser(), vspid);
+ OnboardingUiUtils.prepareVspForUse(getUser(), vspid, "0.1");
String downloadDirectory = getWindowTest().getDownloadDirectory();
String csarFile = vspid + ".csar";
DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
HomePage.showVspRepository();
- OnboardingUtils.importVSP(createVSP);
+ OnboardingUiUtils.importVSP(createVSP);
Map<String, Object> artifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(downloadDirectory + csarFile);
List<String> vfcKeys = artifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList());
@@ -359,10 +328,10 @@ public class VFCArtifacts extends SetupCDTest {
TesterOperationPage.certifyComponent(vspName);
reloginWithNewRole(UserRoleEnum.DESIGNER);
- OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpFile, null, monitoringId, getUser());
+ OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpFile, null, monitoringId, getUser(), "0.1");
DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
HomePage.showVspRepository();
- OnboardingUtils.updateVSP(createVSP);
+ OnboardingUiUtils.updateVSP(createVSP);
resourceMetaData.setVersion("1.1");
ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
@@ -378,12 +347,6 @@ public class VFCArtifacts extends SetupCDTest {
}
-
-
-
-
-
-
@Override
protected UserRoleEnum getRole() {
return UserRoleEnum.DESIGNER;
@@ -391,6 +354,7 @@ public class VFCArtifacts extends SetupCDTest {
private Map<String, LinkedList<HeatMetaFirstLevelDefinition>> verifyVfcArtifacts(String filepath, String csarFile,
ResourceReqDetails resourceMetaData, RestResponse getResponse) throws Exception {
+
ExtentTestActions.log(Status.INFO, "Verifying VFC artifacts");
Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap = null;
ExtentTestActions.log(Status.INFO, "Reading artifacts in CSAR file");
@@ -408,7 +372,7 @@ public class VFCArtifacts extends SetupCDTest {
Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap;
Map<String,LinkedList<HeatMetaFirstLevelDefinition>> vfcDeploymentArtifacts = (Map<String,LinkedList<HeatMetaFirstLevelDefinition>>)artifactsFromCsar.get(key);
LinkedList<HeatMetaFirstLevelDefinition> deploymentList = vfcDeploymentArtifacts.get(DEPLOYMENT);
- LinkedList<HeatMetaFirstLevelDefinition> informationalList = (LinkedList<HeatMetaFirstLevelDefinition>) artifactsFromCsar.get(INFORMATIONAL);
+ LinkedList<HeatMetaFirstLevelDefinition> informationalList = (LinkedList<HeatMetaFirstLevelDefinition>) vfcDeploymentArtifacts.get(INFORMATIONAL);
expectedArtifactMap = new HashMap<String, LinkedList<HeatMetaFirstLevelDefinition>>();
if(deploymentList == null){
@@ -422,7 +386,6 @@ public class VFCArtifacts extends SetupCDTest {
expectedArtifactMap.put(ARTIFACTS, informationalList);
}
-
VFCArtifactVerificator.verifyVfcArtifacts(resourceMetaData, getUser(), key, expectedArtifactMap, getResponse);
return expectedArtifactMap;
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
index 730cc1ce56..fe2187f338 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
@@ -63,10 +63,11 @@ import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
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;
@@ -78,7 +79,6 @@ import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.AssertJUnit;
-import org.testng.SkipException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -111,7 +111,7 @@ public class Vf extends SetupCDTest {
// update Resource
ResourceReqDetails updatedResource = new ResourceReqDetails();
- updatedResource.setName("ciUpdatedName");
+ updatedResource.setName(ElementFactory.getResourcePrefix() + "UpdatedName" + resourceMetaData.getName());
updatedResource.setDescription("kuku");
updatedResource.setVendorName("updatedVendor");
updatedResource.setVendorRelease("updatedRelease");
@@ -646,8 +646,9 @@ public class Vf extends SetupCDTest {
@Test
public void exportToscaWithModulePropertiesVFTest() throws AWTException, Exception {
- String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip";
- Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
+ String vnfFile = "1-Vf-zrdm5bpxmc02-092017-(MOBILITY)_v2.0.zip";
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String, Map<String, String>> vsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
String vspName = vsp.left;
ResourceGeneralPage.clickSubmitForTestingButton(vsp.left);
Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
@@ -656,14 +657,17 @@ public class Vf extends SetupCDTest {
@Test
public void exportToscaWithModulePropertiesTemplateCheckVFTest() throws AWTException, Exception {
- String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip";
- OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
+ String vnfFile = "1-Vf-zrdm5bpxmc02-092017-(MOBILITY)_v2.0.zip";
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_MODEL.getValue());
File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
- ToscaDefinition toscaDefinition = VfModuleVerificator.getToscaTemplate(latestFilefromDir.getAbsolutePath());
+ ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(latestFilefromDir);
VfModuleVerificator.validateSpecificModulePropertiesFromFile(toscaDefinition);
}
+
+
@Override
protected UserRoleEnum getRole() {
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java
index 2faeedc15b..8055a86d58 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java
@@ -39,6 +39,7 @@ import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CompositionScreenEnum;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
import org.openecomp.sdc.ci.tests.datatypes.HeatWithParametersDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
@@ -50,9 +51,10 @@ import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openecomp.sdc.ci.tests.utilities.HomeUtils;
-import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openqa.selenium.WebElement;
import org.testng.SkipException;
import org.testng.annotations.BeforeMethod;
@@ -63,19 +65,29 @@ import com.aventstack.extentreports.Status;
import com.clearspring.analytics.util.Pair;
public class VfArtifacts extends SetupCDTest{
-
+
+ public static final String VSAEGW_FDNT_30_1607_E2E_ZIP = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
+ public static final String VFW_FCGI_30_1607_E2E_ZIP = "2016-044_vfw_fcgi_30_1607_e2e.zip";
+ public static final String FDNT_UPDATE_HEAT_PARAMS_ZIP = "FDNT_UpdateHeatParams.zip";
+ public static final String FDNT_WITHOUT_ENV_FILES_ZIP = "FDNT_WithoutEnvFiles.zip";
+ public static final String VLANDSLIDE_LDSA_30_1607_E2E_ZIP = "2016-014_vlandslide_ldsa_30_1607_e2e.zip";
+ public static final String VJSA_VJSA_30_1610_E2E_ZIP = "2016-209_vjsa_vjsa_30_1610_e2e.zip";
+ public static final String VLB_LMSP_30_1607_E2E_ZIP = "2016-045_vlb_lmsp_30_1607_e2e.zip";
+ public static final String MOBT_MOBT_30_1607_E2E_ZIP = "2016-109_mobt_mobt_30_1607_e2e.zip";
+ public static final String MOBT_MOBT_30_1607_E2E_DIFFERENT_PARAMS_ZIP = "2016-109_mobt_mobt_30_1607_e2e_DifferentParams.zip";
+ public static final String VMSP_PXMC_30_1607_E2E_ZIP = "2016-042_vmsp_pxmc_30_1607_e2e.zip";
+ public static final String VFW_FNAT_30_1607_E2E_ZIP = "2016-044_vfw_fnat_30_1607_e2e.zip";
+ public static final String VLANDSLIDE_LDST_30_1607_E2E_ZIP = "2016-014_vlandslide_ldst_30_1607_e2e.zip";
+ public static final String VIXIA_IXLA_30_1607_E2E_ZIP = "2016-017_vixia_ixla_30_1607_e2e.zip";
private String filePath;
private String vnfsRepositoryPath;
- private String updatedVnfsRepositoryPath;
private String createdEnvFilePath;
private static final String PARAMETERS = "parameters";
@BeforeMethod
public void beforeTest() throws FileNotFoundException{
filePath = getWindowTest().getDownloadDirectory();
- vnfsRepositoryPath = FileHandling.getVnfRepositoryPath();
-// vnfsRepositoryPath = FileHandling.getFilePath("Old_VNFs");
- updatedVnfsRepositoryPath = vnfsRepositoryPath + "UpdatedVNFs";
+ vnfsRepositoryPath = FileHandling.getFilePath("VfArtifacts");
Config config = Utils.getConfig();
createdEnvFilePath = config.getWindowsDownloadDirectory();
}
@@ -91,11 +103,11 @@ public class VfArtifacts extends SetupCDTest{
public Object[][] provideData() {
return new Object[][] {
- { "2016-043_vsaegw_fdnt_30_1607_e2e.zip", "FDNT_UpdateHeatParams.zip", "2", "2" }, // expected heat version 2 and heatEnv 2
- { "2016-043_vsaegw_fdnt_30_1607_e2e.zip", "FDNT_WithoutEnvFiles.zip", "1", "2" }, // expected heat version 1 and heatEnv 2
- { "2016-014_vlandslide_ldsa_30_1607_e2e.zip", "2016-209_vjsa_vjsa_30_1610_e2e.zip", "1", "1" }, // expected heat version 1 and heatEnv 1
- { "2016-045_vlb_lmsp_30_1607_e2e.zip", "2016-045_vlb_lmsp_30_1607_e2e.zip", "1", "2" }, // expected heat version 1 and heatEnv 2(DE270634)
- { "2016-109_mobt_mobt_30_1607_e2e.zip", "2016-109_mobt_mobt_30_1607_e2e_DifferentParams.zip", "2", "2" } // expected heat version 2 and heatEnv 2
+ { VSAEGW_FDNT_30_1607_E2E_ZIP, FDNT_UPDATE_HEAT_PARAMS_ZIP, "2", "2" }, // expected heat version 2 and heatEnv 2
+ { VSAEGW_FDNT_30_1607_E2E_ZIP, FDNT_WITHOUT_ENV_FILES_ZIP, "1", "2" }, // expected heat version 1 and heatEnv 2
+ {VLANDSLIDE_LDSA_30_1607_E2E_ZIP, VJSA_VJSA_30_1610_E2E_ZIP, "1", "1" }, // expected heat version 1 and heatEnv 1
+ {VLB_LMSP_30_1607_E2E_ZIP, VLB_LMSP_30_1607_E2E_ZIP, "1", "2" }, // expected heat version 1 and heatEnv 2(DE270634)
+ {MOBT_MOBT_30_1607_E2E_ZIP, MOBT_MOBT_30_1607_E2E_DIFFERENT_PARAMS_ZIP, "2", "2" } // expected heat version 2 and heatEnv 2
};
}
@@ -103,9 +115,10 @@ public class VfArtifacts extends SetupCDTest{
@Test
public void uploadUpdatedHeatEnv() throws Exception{
- String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip";
+ String vnfFile = VMSP_PXMC_30_1607_E2E_ZIP;
File updateEnvFile = null;
- Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
String vspName = vsp.left;
Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
@@ -127,9 +140,10 @@ public class VfArtifacts extends SetupCDTest{
@Test
public void uploadUpdatedAllHeatEnv() throws Exception{
- String vnfFile = "2016-044_vfw_fnat_30_1607_e2e.zip";
+ String vnfFile = VFW_FNAT_30_1607_E2E_ZIP;
File updateEnvFile = null;
- Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
String vspName = vsp.left;
Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
@@ -150,9 +164,10 @@ public class VfArtifacts extends SetupCDTest{
@Test
public void uploadUpdatedAllHeatEnvComposition() throws Exception{
- String vnfFile = "2016-014_vlandslide_ldst_30_1607_e2e.zip";
+ String vnfFile = VLANDSLIDE_LDST_30_1607_E2E_ZIP;
File updateEnvFile = null;
- Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
String vspName = vsp.left;
Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
@@ -177,13 +192,14 @@ public class VfArtifacts extends SetupCDTest{
@Test
// Download ENV file from VF level Update VSP.
public void downloadEnvFromVFLevelUpdateVSP() throws Throwable {
- String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
- String updatedVnfFile="2016-014_vlandslide_ldsa_30_1607_e2e.zip";
+ String vnfFile = VSAEGW_FDNT_30_1607_E2E_ZIP;
+ String updatedVnfFile= VLANDSLIDE_LDSA_30_1607_E2E_ZIP;
String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
- Pair<String, Map<String, String>> CreatedVsp=OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String, Map<String, String>> CreatedVsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
String vspName = CreatedVsp.left;
GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
- OnboardingUtils.updateVnfAndValidate(vnfsRepositoryPath, CreatedVsp, updatedVnfFile, getUser());
+ OnboardingUiUtils.updateVnfAndValidate(vnfsRepositoryPath, CreatedVsp, updatedVnfFile, getUser());
//get updated vsp env files
Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, downloadDirPath);
GeneralUIUtils.findComponentAndClick(vspName);
@@ -203,11 +219,10 @@ public class VfArtifacts extends SetupCDTest{
@Test
// Download ENV file from VF level Work-Space.
public void downloadEnvFromVFLevelWorkSpace() throws AWTException, Exception {
- String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
+ String vnfFile = VSAEGW_FDNT_30_1607_E2E_ZIP;
String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
-
- Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
-
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String, Map<String, String>> vsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.left,downloadDirPath);
GeneralUIUtils.findComponentAndClick(vsp.left);
ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
@@ -229,9 +244,9 @@ public class VfArtifacts extends SetupCDTest{
public void downloadEnvVFLevelComposition() throws AWTException, Exception {
String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
- String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
-
- Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
+ String vnfFile = VSAEGW_FDNT_30_1607_E2E_ZIP;
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String, Map<String, String>> vsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.left,downloadDirPath);
GeneralUIUtils.findComponentAndClick(vsp.left);
ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
@@ -253,10 +268,10 @@ public class VfArtifacts extends SetupCDTest{
// Download ENV file from VF level Update parameters in UI.
public void downloadEnvVFLevelUpdateParameters() throws AWTException, Exception {
- String vnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip";
+ String vnfFile = VFW_FCGI_30_1607_E2E_ZIP;
String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
- Pair<String, Map<String, String>> CreatedVsp=OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser());
-
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String, Map<String, String>> CreatedVsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, CreatedVsp.left, "0.1");
Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts);
@@ -298,8 +313,9 @@ public class VfArtifacts extends SetupCDTest{
@Test
public void checkDefaultCreatedEnvArtifacts() throws Exception{
- String vnfFile = "2016-017_vixia_ixla_30_1607_e2e.zip";
- Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+ String vnfFile = VIXIA_IXLA_30_1607_E2E_ZIP;
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
String vspName = vsp.left;
Map<String, File> generatedEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath);
HomeUtils.findComponentAndClick(vspName);
@@ -319,12 +335,12 @@ public class VfArtifacts extends SetupCDTest{
@Test(dataProvider = "heatEnvAndVersion")
public void checkDefaultCreatedEnvArtifactsAfterVspUpdate(String vnfFile, String updatedVnfFile, String expectedHeatVersion, String expectedHeatEnvVersion) throws Throwable{
String stringForLog = String.format("%s:%s:%s:%s", vnfFile, updatedVnfFile, expectedHeatVersion, expectedHeatEnvVersion);
- setLog(stringForLog);
-
- Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+ setLog(stringForLog);
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
String vspName = vsp.left;
GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
- OnboardingUtils.updateVnfAndValidate(updatedVnfsRepositoryPath, vsp, updatedVnfFile, getUser());
+ OnboardingUiUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser());
Map<String, File> generatedUpdatedEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath);
HomeUtils.findComponentAndClick(vspName);
GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
@@ -332,26 +348,27 @@ public class VfArtifacts extends SetupCDTest{
// TODO test will pass on case all objects on deployment view are visible
GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileNameFromDir(), PARAMETERS);
- if(true){
- throw new SkipException("Test skipped, new artifact version design should be developed");
- }
- ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatEnvVersion, ArtifactTypeEnum.HEAT_ENV);
- ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatVersion, ArtifactTypeEnum.HEAT);
+// ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatEnvVersion, ArtifactTypeEnum.HEAT_ENV);
+// ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatVersion, ArtifactTypeEnum.HEAT);
+ }
+ if(true){
+ throw new SkipException("Test skipped, new artifact version design should be developed");
}
}
// expected heat version 1 and heatEnv 3
@Test
public void checkDefaultCreatedEnvArtifactsVspUpdatedWithSameVspTwice() throws Throwable{
- String vnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip";
- String updatedVnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip";
- Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+ String vnfFile = VFW_FCGI_30_1607_E2E_ZIP;
+ String updatedVnfFile = VFW_FCGI_30_1607_E2E_ZIP;
+ ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
+ Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser());
String vspName = vsp.left;
GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
- OnboardingUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser());
+ OnboardingUiUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser());
GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
- OnboardingUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser());
+ OnboardingUiUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser());
Map<String, File> generatedUpdatedSecondTimeEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath);
HomeUtils.findComponentAndClick(vspName);
GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java
index 24badb3ec2..ef8a337394 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java
@@ -43,7 +43,6 @@ import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
-import org.testng.SkipException;
import org.testng.annotations.Test;
@@ -94,11 +93,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1434247 - Import VF Artifacts - Informational Artifacts - One Artifact, One Type
@Test
public void importVfArtifactsInformationalArtifactsOneArtifactOneType() throws Exception {
-
- if(true){
- throw new SkipException("Open bug 299719");
- }
-
String fileName = "TC1434247.csar";
String folder ="US825779";
@@ -116,11 +110,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1434248 - Import VF Artifacts - Informational Artifacts - Multiple Artifacts, Multiple Types
@Test
public void importVfArtifactsInformationalArtifactsMultipleArtifactsMultipleTypes() throws Exception {
-
- if(true){
- throw new SkipException("Open bug 299719");
- }
-
String fileName = "TC1434248.csar";
String folder ="US825779";
@@ -140,11 +129,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1434249 - Import VF Artifacts - Deployment and Informational Artifacts - Multiple Artifacts, Multiple Types
@Test
public void importVfArtifactsDeploymentAndInformationalArtifactsMultipleArtifactsMultipleTypes() throws Exception {
-
- if(true){
- throw new SkipException("Open bug 299719");
- }
-
String fileName = "TC1434249.csar";
String folder ="US825779";
@@ -171,11 +155,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1438310 - Import VF Artifacts - Deployment Artifacts - Artifact Type Invalid
@Test
public void importVFArtifactsDeploymentArtifactsArtifactTypeInvalid() throws Exception {
-
- if(true){
- throw new SkipException("Open bug 299719");
- }
-
String fileName = "DeploymentArtifactWithInvalidType.csar";
String folder ="US825779";
@@ -191,11 +170,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1438311 - Import VF Artifacts - Informational Artifacts - Artifact Type Invalid
@Test
public void importVfArtifactsInformationalArtifactsArtifactTypeInvalid() throws Exception {
-
- if(true){
- throw new SkipException("Open bug 299719");
- }
-
String fileName = "InformationArtifactWithInvalidType.csar";
String folder ="US825779";
@@ -335,11 +309,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1443887 - Update With One New Informational Artifact
@Test
public void updateWithOneNewInformationalArtifact() throws Exception {
-
- if(true){
- throw new SkipException("Open bug 299719");
- }
-
String fileName = "ImportTC1443887.csar";
String folder ="US825779";
@@ -363,11 +332,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1443888 - Update With One Removed Informational Artifact
@Test
public void updateWithOneRemovedInformationalArtifact() throws Exception {
-
- if(true){
- throw new SkipException("Open bug 299719");
- }
-
String folder ="US825779";
String fileName = "ImportTC1443888.csar";
@@ -397,11 +361,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1443890 - Update With One New Artifact Version Informational Artifact
@Test
public void updateWithOneNewArtifactVersionInformationalArtifact() throws Exception {
-
- if(true){
- throw new SkipException("Open bug 299719");
- }
-
String folder ="US825779";
String fileName = "ImportTC1443890.csar";
@@ -426,12 +385,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
// TC1443893 - Update CSAR With Same Artifacts As Imported
@Test
- public void updateCSARWithSameArtifactsAsImported() throws Exception {
-
- if(true){
- throw new SkipException("Open bug 299719");
- }
-
+ public void updateCSARWithSameArtifactsAsImported() throws Exception {
String folder ="US825779";
String fileName = "ImportUpdateTC1443893.csar";
@@ -462,11 +416,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1443954 - Update With Multiple Changes In Deployment And Informational Artifacts
@Test
public void updateWithMultipleChangesInDeploymentAndInformationalArtifacts() throws Exception {
-
- if(true){
- throw new SkipException("Open bug 299719");
- }
-
String folder ="US825779";
String fileName = "ImportTC1443954.csar";
@@ -560,11 +509,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1444207 - Update With Existed Informational Artifact By Artifact With Different Type
@Test
public void updateWithExistedInformationalArtifactByArtifactWithDifferentType() throws Exception {
-
- if(true){
- throw new SkipException("Open bug 299719");
- }
-
String folder ="US825779";
String fileName = "ImportTC1444207.csar";
@@ -667,11 +611,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// TC1444530 - Update Deployment Artifact With Invalid Type
@Test
public void updateDeploymentArtifactWithInvalidType() throws Exception {
-
- if(true){
- throw new SkipException("Open bug 299719");
- }
-
+
String folder ="US825779";
String fileName = "ImportTC1444530.csar";
@@ -694,12 +634,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest {
// US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
// TC1444531 - Update Informational Artifact With Invalid Type
@Test
- public void updateInformationalArtifactWithInvalidType() throws Exception {
-
- if(true){
- throw new SkipException("Open bug 299719");
- }
-
+ public void updateInformationalArtifactWithInvalidType() throws Exception {
String folder ="US825779";
String fileName = "ImportTC1444531.csar";
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/AttFtpClient.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/AttFtpClient.java
index 1d7c4ae554..a20e3db2de 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/AttFtpClient.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/AttFtpClient.java
@@ -24,7 +24,6 @@ import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@@ -35,8 +34,6 @@ import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
-import org.apache.commons.io.output.ByteArrayOutputStream;
-import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply;
@@ -205,7 +202,6 @@ public class AttFtpClient {
try {
deleted = apacheFtpClient.deleteFile(file.getName());
} catch (IOException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java
index fd53249ac2..6c76e327f0 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java
@@ -37,8 +37,6 @@ import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
-import org.testng.ITestContext;
-import org.testng.ITestResult;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
@@ -59,7 +57,10 @@ public class DriverFactory {
@BeforeSuite(alwaysRun = true)
public static void instantiateDriverObject() {
-
+
+ // Selenium 3.4.0 change, location of gecko driver, set system property
+// System.setProperty("webdriver.gecko.driver","C:\\Gekko18\\geckodriver-v0.18.0-win64\\geckodriver.exe"); //change for 3.4.0, gecko driver location
+ // End of Selenium 3.4.0 change
File basePath = new File(FileHandling.getBasePath());
File[] listFiles = basePath.listFiles(new FilenameFilter() {
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java
index 0523647c16..6718150115 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java
@@ -24,6 +24,7 @@ import java.io.File;
import java.io.IOException;
import java.util.UUID;
+import org.openecomp.sdc.ci.tests.api.SomeInterface;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import com.aventstack.extentreports.ExtentTest;
@@ -35,13 +36,15 @@ import com.aventstack.extentreports.markuputils.MarkupHelper;
public class ExtentTestActions {
+ public static SomeInterface testManager = new ExtentTestManager();
+
public static void log(Status logStatus, Markup mark){
- ExtentTest test = ExtentTestManager.getTest();
+ ExtentTest test = testManager.getTest();
test.log(logStatus, mark);
}
public static void log(Status logStatus, String message){
- ExtentTest test = ExtentTestManager.getTest();
+ ExtentTest test = testManager.getTest();
test.log(logStatus, message);
}
@@ -50,7 +53,7 @@ public class ExtentTestActions {
}
public static void log(Status logStatus, Throwable throwabel){
- ExtentTest test = ExtentTestManager.getTest();
+ ExtentTest test = testManager.getTest();
test.log(logStatus, throwabel);
}
@@ -90,7 +93,7 @@ public class ExtentTestActions {
e.printStackTrace();
}
- ExtentTest test = ExtentTestManager.getTest();
+ ExtentTest test = testManager.getTest();
test.log(logStatus, message, MediaEntityBuilder.createScreenCaptureFromPath(imageFilePath).build());
return imageFilePath;
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java
index b5ed1ea498..6d9b367460 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java
@@ -22,15 +22,22 @@ package org.openecomp.sdc.ci.tests.execute.setup;
import java.util.HashMap;
+import org.openecomp.sdc.ci.tests.api.SomeInterface;
+
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
-public class ExtentTestManager {
+public class ExtentTestManager implements SomeInterface{
private static HashMap<Long, ExtentTest> extentTestMap = new HashMap<Long, ExtentTest>();
private static ExtentReports extent = ExtentManager.getReporter();
-
- public static synchronized ExtentTest getTest() {
+
+ public ExtentTestManager(){
+
+ }
+
+ @Override
+ public synchronized ExtentTest getTest() {
return extentTestMap.get(Thread.currentThread().getId());
}
@@ -54,7 +61,7 @@ public class ExtentTestManager {
String[] parts = clazz.getName().split("\\.");
String lastOne1 = parts[parts.length-1];
String lastOne2 = parts[parts.length-2];
- getTest().assignCategory(lastOne2 + "-" + lastOne1);
+ extentTestMap.get(Thread.currentThread().getId()).assignCategory(lastOne2 + "-" + lastOne1);
}
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/MobProxy.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/MobProxy.java
index bab4508716..f996514dc0 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/MobProxy.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/MobProxy.java
@@ -27,11 +27,9 @@ import java.net.SocketAddress;
import java.net.URI;
import java.util.HashMap;
import java.util.List;
-import java.util.stream.Collectors;
import org.slf4j.LoggerFactory;
-import com.aventstack.extentreports.ExtentTest;
import com.github.markusbernhardt.proxy.ProxySearch;
import com.github.markusbernhardt.proxy.ProxySearch.Strategy;
import com.github.markusbernhardt.proxy.util.PlatformUtil;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/Retry.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/Retry.java
index 0a01da06c3..d208537702 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/Retry.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/Retry.java
@@ -20,10 +20,8 @@
package org.openecomp.sdc.ci.tests.execute.setup;
-import org.testng.Assert;
import org.testng.IRetryAnalyzer;
import org.testng.ITestResult;
-import org.testng.annotations.Test;
public class Retry implements IRetryAnalyzer {
private int retryCount = 0;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
index 21aa5720a0..3bb4c7598c 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
@@ -26,15 +26,10 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
import java.util.UUID;
-import java.util.logging.FileHandler;
-import java.util.logging.Handler;
-import java.util.logging.LogManager;
-import java.util.logging.Logger;
import org.json.simple.JSONObject;
-import org.littleshoot.proxy.impl.ClientToProxyConnection;
-import org.littleshoot.proxy.impl.ProxyToServerConnection;
import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.api.SomeInterface;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
import org.openecomp.sdc.ci.tests.datatypes.UserCredentials;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
@@ -60,16 +55,15 @@ import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Optional;
+import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
-import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
-import groovyjarjarantlr.Utils;
-import net.lightbody.bmp.BrowserMobProxyServer;
import net.lightbody.bmp.core.har.Har;
public abstract class SetupCDTest extends DriverFactory {
@@ -107,7 +101,8 @@ public abstract class SetupCDTest extends DriverFactory {
/**************** METHODS ****************/
public static ExtentTest getExtendTest() {
- return ExtentTestManager.getTest();
+ SomeInterface testManager = new ExtentTestManager();
+ return testManager.getTest();
}
public static WindowTest getWindowTest(){
return WindowTestManager.getWindowMap();
@@ -230,7 +225,7 @@ public abstract class SetupCDTest extends DriverFactory {
}
public void addResultToCSV(ITestResult result, ITestContext context) {
String suiteName = ExtentManager.getSuiteName(context);
- ExtentTest test = ExtentTestManager.getTest();
+ ExtentTest test = getExtendTest();
com.aventstack.extentreports.model.Test model = test.getModel();
String name = model.getName();
String status = model.getStatus().toString();
@@ -268,15 +263,19 @@ public abstract class SetupCDTest extends DriverFactory {
}
-
- @AfterSuite(alwaysRun = true)
-
- public void afterSuite2() throws Exception {
+ @Parameters({ "eraseAfterTests" })
+ @AfterSuite(alwaysRun = true)
+ public void afterSuite2(@Optional("true") String eraseAfterTestsReadValue) throws Exception {
// public void afterSuite() throws Exception {
csvReport.closeFile();
generateReport4Jenkins(myContext);
- RestCDUtils.deleteOnDemand();
+
+ if (Boolean.parseBoolean(eraseAfterTestsReadValue)){
+ RestCDUtils.deleteOnDemand();
+ } else {
+ System.out.println("Resources will not be deleted according to suite configuration ...");
+ }
if (getConfig().getUseBrowserMobProxy()){
MobProxy.getPoxyServer().stop();
@@ -506,7 +505,7 @@ public abstract class SetupCDTest extends DriverFactory {
navigateAndLogin(role);
}
- public static void setLocalUrl(UserRoleEnum role) {
+ /*public static void setLocalUrl(UserRoleEnum role) {
switch (role) {
case ADMIN: {
url = "http://localhost:8181/sdc1/proxy-admin1#/dashboard";
@@ -548,7 +547,7 @@ public abstract class SetupCDTest extends DriverFactory {
break;
}
}
- }
+ }*/
public void addTrafficFileToReport(ITestResult result) {
try {
@@ -600,8 +599,8 @@ public abstract class SetupCDTest extends DriverFactory {
System.out.println("attsdc.yaml file path is : " + attsdcFilePath);
String filepath = FileHandling.getBasePath() + File.separator + "Files" + File.separator;
- System.setProperty("filepath", filepath);
- System.out.println("filepath is : " + System.getProperty("filepath"));
+ System.setProperty("filePath", filepath);
+ System.out.println("filePath is : " + System.getProperty("filePath"));
Object[] testSuitsList = FileHandling.filterFileNamesFromFolder(FileHandling.getBasePath() + File.separator + "testSuites", ".xml");
if (testSuitsList != null) {
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java
index 5a95df39f8..1dc099e9ea 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java
@@ -21,17 +21,16 @@
package org.openecomp.sdc.ci.tests.execute.setup;
import java.io.File;
-import java.io.FileNotFoundException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.UUID;
import org.openecomp.sdc.ci.tests.config.Config;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
-import org.openecomp.sdc.ci.tests.utils.Utils;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
+//import org.openqa.selenium.firefox.FirefoxOptions; // Selenium 3.4.0 change
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
@@ -74,6 +73,13 @@ public class WebDriverThread {
if (mobProxyStatus){
setWebDriverWithMobProxy();
} else {
+
+ // Selenium 3.4.0 change, add firefox options : set, add firefox 5.X location and enable
+// FirefoxOptions options = new FirefoxOptions();
+// options.setBinary("C:\\Program Files (x86)\\Mozilla Firefox5\\firefox.exe"); //Location where Firefox is installed
+// options.addPreference("dom.file.createInChild", true); // Enable file upload with sendKeys
+ // End of Selenium 3.4.0 change
+
System.out.println("Opening LOCAL browser");
DesiredCapabilities cap = new DesiredCapabilities();
@@ -81,6 +87,8 @@ public class WebDriverThread {
cap.setBrowserName("firefox");
cap.setCapability(FirefoxDriver.PROFILE, initFirefoxProfile());
+// cap.setCapability("moz:firefoxOptions", options); //Add options to Capabilities, Selenium 3.4.0 change
+
firefoxProfile.setPreference("network.proxy.type", 2);
firefoxProfile.setPreference("network.proxy.autoconfig_url", "http://emea-auto.proxy.att.com:8001/");
firefoxProfile.setPreference("network.proxy.no_proxies_on", "localhost");
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTestManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTestManager.java
index 5e5ddc4fbd..b160b57132 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTestManager.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTestManager.java
@@ -22,8 +22,6 @@ package org.openecomp.sdc.ci.tests.execute.setup;
import java.util.HashMap;
-import com.aventstack.extentreports.ExtentTest;
-
public class WindowTestManager {
private static HashMap<Long, WindowTest> windowMap = new HashMap<Long, WindowTest>();
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java
index 810a1f991c..cc6f9b7c89 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java
@@ -109,6 +109,7 @@ public class DeploymentArtifactPage extends GeneralPageElements {
}
public static void clickOK(){
+ SetupCDTest.getExtendTest().log(Status.INFO, "Artifact Page, Clicking OK");
GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.OK.getValue()).click();
GeneralUIUtils.getWebElementBy(By.className("flex-container"));
GeneralUIUtils.waitForAngular();
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentPage.java
index 5ee85e099e..892a5d1056 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentPage.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentPage.java
@@ -23,8 +23,6 @@ package org.openecomp.sdc.ci.tests.pages;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.stream.Collector;
-import java.util.stream.Collectors;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.DeploymentScreen;
@@ -33,8 +31,6 @@ import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
-import static org.testng.Assert.assertTrue;
-
import com.aventstack.extentreports.Status;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java
index ae86923396..d0ff5c0c6e 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java
@@ -24,7 +24,6 @@ import java.io.File;
import java.util.List;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
-import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.MainMenuButtonsFromInsideFrame;
import org.openecomp.sdc.ci.tests.utilities.DownloadManager;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesAssignmentPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesAssignmentPage.java
new file mode 100644
index 0000000000..cdf68da0dd
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesAssignmentPage.java
@@ -0,0 +1,149 @@
+package org.openecomp.sdc.ci.tests.pages;
+
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.PropertiesAssignmentScreen;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+public class PropertiesAssignmentPage {
+ public static void clickOnInputTab(){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Input Tab"));
+ GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.INPUTS_TAB.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickOnPropertiesTab(){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Properties Tab"));
+ GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.PROPERTIES_TAB.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickOnCompositionRightTab(){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Composition Right Tab"));
+ GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.COMPOSITION_TAB.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickOnPropertyStructureRightTab(){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Property Structure Right Tab"));
+ GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.PROPERTY_STRUCTURE_TAB.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickOnDeclareButton(){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Declare Button"));
+ GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.DECLARE_BUTTON.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void findSearchBoxAndClick(String resourceName) throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " in homepage");
+ WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesAssignmentScreen.SEARCH_BOX.getValue());
+ try{
+ searchTextbox.clear();
+ searchTextbox.sendKeys(resourceName);
+ GeneralUIUtils.ultimateWait();
+ }
+ catch(Exception e){
+ SetupCDTest.getExtendTest().log(Status.INFO, "Can't interact with search bar");
+ e.printStackTrace();
+ }
+
+
+ try{
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component from home screen", resourceName));
+ GeneralUIUtils.clickOnElementByTestId(resourceName);
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue());
+ }
+ catch(Exception e){
+ SetupCDTest.getExtendTest().log(Status.INFO, "Can't click on component named " + resourceName);
+ e.printStackTrace();
+ }
+ }
+
+ public static void clickOnProperty(String propertyName) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on property %s ", propertyName));
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_NAME.getValue() + propertyName);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickOnDeleteInputButton(){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Delete Input Button"));
+ GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.INPUT_DELETE_BUTTON.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickOnDeleteInputDialogConfirmationButton(){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Delete Input Dialog Confirmation Button"));
+ GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_DELETE.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickOnFilterAll() {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on property %s "));
+ GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_CHECKBOX_ALL.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickOnComponentInComposition(String resourceName) throws Exception{
+ try{
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component from properties composition", resourceName));
+ GeneralUIUtils.clickOnElementByTestId(resourceName);
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue());
+ }
+ catch(Exception e){
+ SetupCDTest.getExtendTest().log(Status.INFO, "Can't click on component named " + resourceName);
+ e.printStackTrace();
+ }
+ }
+
+ public static void findInput(String componentName, String resourceName) throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + componentName + "_" + resourceName + " in homepage");
+ WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesAssignmentScreen.SEARCH_BOX.getValue());
+ String searchPattern = componentName + "_" + resourceName;
+ try{
+ searchTextbox.clear();
+ searchTextbox.sendKeys(searchPattern);
+ GeneralUIUtils.ultimateWait();
+ }
+ catch(Exception e){
+ SetupCDTest.getExtendTest().log(Status.INFO, "Can't interact with search bar");
+ e.printStackTrace();
+ }
+
+ }
+
+ public static void findProperty(String resourceName) throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " in homepage");
+ WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesAssignmentScreen.SEARCH_BOX.getValue());
+
+ try{
+ searchTextbox.clear();
+ searchTextbox.sendKeys(resourceName);
+ GeneralUIUtils.ultimateWait();
+ }
+ catch(Exception e){
+ SetupCDTest.getExtendTest().log(Status.INFO, "Can't interact with search bar");
+ e.printStackTrace();
+ }
+
+ }
+
+ public static Boolean isPropertyChecked(String resourceName){
+// TODO add better implementation for css string
+ GeneralUIUtils.ultimateWait();
+ Boolean isDisabled = GeneralUIUtils.checkForDisabledAttributeInHiddenElement("checkbox[data-tests-id='" + resourceName + "'] input");
+ if (isDisabled)
+ return true;
+ return false;
+
+ }
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java
index a128aefdc8..2955d72e2e 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java
@@ -64,4 +64,8 @@ public class ResourceLeftMenu implements ComponentLeftMenu {
public void moveToInputsScreen() {
GeneralUIUtils.moveToStep(StepsEnum.INPUTS);
}
+
+ public void moveToPropertiesAssignmentScreen() {
+ GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES_ASSIGNMENT);
+ }
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java
index e97f3feb62..d12e75ac0c 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java
@@ -28,7 +28,6 @@ import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
-import org.testng.TestException;
import com.aventstack.extentreports.Status;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java
index aa260ecc80..6587bd8f28 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java
@@ -20,8 +20,6 @@
package org.openecomp.sdc.ci.tests.utilities;
-import java.util.concurrent.TimeUnit;
-
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java
index 1abae858e3..2f581cc009 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java
@@ -501,18 +501,18 @@ public final class ArtifactUIUtils {
Map<String, Object> mapExpectedFile = FileHandling.parseYamlFileToMapByPattern(expectedFile, pattern);
Map<String, Object> mapActualFile = FileHandling.parseYamlFileToMapByPattern(actualFile, pattern);
- SetupCDTest.getExtendTest().log(Status.INFO, "Going to compare files ...");
+ SetupCDTest.getExtendTest().log(Status.INFO, "Going to compare file " + expectedFile.getName());
assertTrue("File" + actualFile.getName() + " contains different parameters number from expected file", mapActualFile.size() == mapExpectedFile.size());
- assertTrue("File " + actualFile.getName() + " does not contains all expected parametrs", mapActualFile.entrySet().containsAll(mapExpectedFile.entrySet()));
+ assertTrue("File " + actualFile.getName() + " does not contains all expected parameters", mapActualFile.entrySet().containsAll(mapExpectedFile.entrySet()));
}
- public static void compareYamlParametersByPattern(Map<String, Object> mapExpectedproperties, File actualFileproperties, String pattern) throws Exception {
+ public static void compareYamlParametersByPattern(Map<String, Object> mapExpectedProperties, File actualFileProperties, String pattern) throws Exception {
- Map<String, Object> mapActualFileProerties = FileHandling.parseYamlFileToMapByPattern(actualFileproperties, pattern);
+ Map<String, Object> mapActualFileProerties = FileHandling.parseYamlFileToMapByPattern(actualFileProperties, pattern);
SetupCDTest.getExtendTest().log(Status.INFO, "Going to compare files ...");
- assertTrue("Actual file contains different parameters number from expected file", mapActualFileProerties.size() == mapExpectedproperties.size());
+ assertTrue("Actual file contains different parameters number from expected file", mapActualFileProerties.size() == mapExpectedProperties.size());
Map<String, Object> newMap = new HashMap<>(mapActualFileProerties);
- assertTrue("Actual file does not contains all expected parametrs", newMap.entrySet().containsAll(mapExpectedproperties.entrySet()));
+ assertTrue("Actual file does not contains all expected parameters", newMap.entrySet().containsAll(mapExpectedProperties.entrySet()));
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasElement.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasElement.java
deleted file mode 100644
index fbe8c04036..0000000000
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasElement.java
+++ /dev/null
@@ -1,54 +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.utilities;
-
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
-import org.openqa.selenium.WebElement;
-
-public final class CanvasElement {
- private final String uniqueId;
- private ImmutablePair<Integer, Integer> location;
- private WebElement elementType;
-
- CanvasElement(String name, ImmutablePair<Integer, Integer> location, WebElement canvasItem) {
- super();
- this.uniqueId = name;
- this.location = location;
- elementType = canvasItem;
- }
-
- public String getUniqueId() {
- return uniqueId;
- }
-
- public ImmutablePair<Integer, Integer> getLocation() {
- return location;
- }
-
- public void setLocation(ImmutablePair<Integer, Integer> location) {
- this.location = location;
- }
-
- public WebElement getElementType() {
- return elementType;
- }
-}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java
deleted file mode 100644
index 18cb338891..0000000000
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java
+++ /dev/null
@@ -1,179 +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.utilities;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.UUID;
-import java.util.stream.Collectors;
-
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.interactions.Actions;
-
-public final class CanvasManager {
- private Map<String, CanvasElement> canvasElements;
- private Actions actions;
- private WebElement canvas;
- private int reduceCanvasWidthFactor;
- // Offsets Are used to find upper right corner of canvas element in order to
- // connect links
- private static final int CANVAS_ELEMENT_Y_OFFSET = 40;
- private static final int CANVAS_ELEMENT_X_OFFSET = 21; // 14 - 27
-
- private CanvasManager() {
- canvasElements = new HashMap<>();
- actions = new Actions(GeneralUIUtils.getDriver());
- canvas = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS.getValue());
- try {
- WebElement webElement = GeneralUIUtils
- .getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS_RIGHT_PANEL.getValue());
- reduceCanvasWidthFactor = webElement.getSize().width;
- } catch (Exception e) {
- reduceCanvasWidthFactor = 0;
- }
- }
-
- public static CanvasManager getCanvasManager() {
- return new CanvasManager();
- }
-
- public List<CanvasElement> getCanvasElements() {
- return canvasElements.values().stream().collect(Collectors.toList());
- }
-
- private void addCanvasElement(CanvasElement element) {
- canvasElements.put(element.getUniqueId(), element);
- }
-
- private void moveElementOnCanvas(CanvasElement canvasElement, ImmutablePair<Integer, Integer> newLocation)
- throws Exception {
- GeneralUIUtils.waitForLoader();
- Thread.sleep(500);
- actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right);
- actions.clickAndHold();
- actions.moveToElement(canvas, newLocation.left, newLocation.right);
- actions.release();
- actions.perform();
- canvasElement.setLocation(newLocation);
- GeneralUIUtils.waitForLoader();
-
- }
-
- public void moveElementOnCanvas(CanvasElement canvasElement) throws Exception {
- moveElementOnCanvas(canvasElement, getFreePosition());
- }
-
- public void deleteElementFromCanvas(CanvasElement canvasElement) throws Exception {
- GeneralUIUtils.waitForLoader();
- actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right);
- actions.click();
- actions.perform();
- GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.DELETE_INSTANCE_BUTTON.getValue())
- .click();
- GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click();
- canvasElements.remove(canvasElement.getUniqueId());
- GeneralUIUtils.waitForLoader();
- }
-
- private String getItemName(WebElement canvasItem) {
- String canvasItemName = canvasItem.getAttribute("data-tests-id");
-
- return canvasItemName.substring(canvasItemName.lastIndexOf("-"));
- }
-
- public CanvasElement createElementOnCanvas(WebElement canvasItem) throws Exception {
- GeneralUIUtils.waitForLoader();
- ImmutablePair<Integer, Integer> freePosition = getFreePosition();
- actions.moveToElement(canvasItem, 0, 0);
- actions.clickAndHold();
- actions.moveToElement(canvas, freePosition.left, freePosition.right);
- actions.release();
- actions.perform();
-
- String uniqueId = getItemName(canvasItem) + "_" + UUID.randomUUID().toString();
- CanvasElement canvasElement = new CanvasElement(uniqueId, freePosition, canvasItem);
- addCanvasElement(canvasElement);
- GeneralUIUtils.waitForLoader();
- return canvasElement;
- }
-
- private ImmutablePair<Integer, Integer> getFreePosition() {
- // TODO mshitrit use better method
- ImmutablePair<Integer, Integer> randomPosition = null;
- boolean freePosition = false;
- int minSpace = 150;
- while (!freePosition) {
- ImmutablePair<Integer, Integer> tempRandomPosition = getRandomPosition();
- freePosition = !canvasElements.values().stream().map(e -> e.getLocation())
- .filter(e -> Math.abs(e.left - tempRandomPosition.left) < minSpace
- && Math.abs(e.right - tempRandomPosition.right) < minSpace)
- .findAny().isPresent();
- randomPosition = tempRandomPosition;
- }
- return randomPosition;
- }
-
- private ImmutablePair<Integer, Integer> getRandomPosition() {
- int edgeBuffer = 50;
- Random random = new Random();
- int xElement = random.nextInt(canvas.getSize().width - 2 * edgeBuffer - reduceCanvasWidthFactor) + edgeBuffer;
- int yElement = random.nextInt(canvas.getSize().height - 2 * edgeBuffer) + edgeBuffer;
- return new ImmutablePair<Integer, Integer>(xElement, yElement);
- }
-
- public void linkElements(CanvasElement firstElement, CanvasElement secondElement) throws Exception {
- GeneralUIUtils.waitForLoader();
- drawSimpleLink(firstElement, secondElement);
-
- selectReqAndCapAndConnect();
-
- GeneralUIUtils.waitForLoader();
-
- }
-
- private void selectReqAndCapAndConnect() {
- // Select First Cap
- GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0).click();
- // Select First Req
- GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0).click();
- // Connect
- GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click();
- }
-
- private void drawSimpleLink(CanvasElement firstElement, CanvasElement secondElement) {
-
- int yOffset = CANVAS_ELEMENT_Y_OFFSET;
- int xOffset = CANVAS_ELEMENT_X_OFFSET;
-
- actions.moveToElement(canvas, firstElement.getLocation().left + xOffset,
- firstElement.getLocation().right - yOffset);
-
- actions.clickAndHold();
- actions.moveToElement(canvas, secondElement.getLocation().left + xOffset,
- secondElement.getLocation().right - yOffset);
- actions.release();
- actions.perform();
- }
-}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java
index e9ba11f0f4..bf8f1cc3bb 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java
@@ -27,10 +27,9 @@ import java.util.List;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
-import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
-import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CatalogPageLeftPanelFilterTitle;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
import org.openecomp.sdc.ci.tests.datatypes.TypesEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java
index f4264ffdea..4b3ee3fc17 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java
@@ -68,7 +68,7 @@ public class DownloadManager {
* @param vspName
* @throws Exception
*/
- public static void downloadCsarByNameFromVSPRepository(String vspName, String vspId, Boolean isDelete) throws Exception{
+ public static void downloadCsarByNameFromVSPRepository(String vspName, Boolean isDelete) throws Exception{
if(isDelete){
FileHandling.cleanCurrentDownloadDir();
@@ -78,21 +78,43 @@ public class DownloadManager {
if (vspFound){
ExtentTestActions.log(Status.INFO, String.format("Going to downloading VSP %s", vspName));
List<WebElement> elemenetsFromTable = HomePage.getElemenetsFromTable();
+ elemenetsFromTable.get(1).click();
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.DOWNLOAD_CSAR.getValue());
+ ExtentTestActions.log(Status.INFO, "Succeeded to downloaded CSAR file named " + vspName + " into folder " + SetupCDTest.getWindowTest().getDownloadDirectory());
+ GeneralUIUtils.getElementsByCSS("div[class^='w-sdc-modal-close']").forEach(e -> e.click());
+ GeneralUIUtils.ultimateWait();
+ }
+ }
+
+
+
+ /*public static void downloadCsarByNameFromVSPRepository(String vspName, String vspId, Boolean isDelete) throws Exception{
+
+ if(isDelete){
+ FileHandling.cleanCurrentDownloadDir();
+ }
+ HomePage.showVspRepository();
+ boolean vspFound = HomePage.searchForVSP(vspName);
+ if (vspFound){
+ ExtentTestActions.log(Status.INFO, String.format("Going to downloading VSP %s", vspName));
+ List<WebElement> elemenetsFromTable = HomePage.getElemenetsFromTable();
// GeneralUIUtils.ultimateWait();
// WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 5);
// WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1)));
elemenetsFromTable.get(1).click();
// findElement.click();
GeneralUIUtils.waitForLoader();
- GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.DOWNLOAD_CSAR.getValue());
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.DOWNLOAD_CSAR.getValue());
ExtentTestActions.log(Status.INFO, "Succeeded to downloaded CSAR file named " + vspId + " into folder " + SetupCDTest.getWindowTest().getDownloadDirectory());
- GeneralUIUtils.getElementsByCSS("div[class^='w-sdc-modal-close']").forEach(e -> e.click());
- GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.getElementsByCSS("div[class^='w-sdc-modal-close']").forEach(e -> e.click());
+ GeneralUIUtils.ultimateWait();
}
- }
-
+ }*/
+
+
public static void downloadCsarByNameFromVSPRepository(String vspName, String vspId) throws Exception{
- downloadCsarByNameFromVSPRepository(vspName, vspId, true);
+ downloadCsarByNameFromVSPRepository(vspName, true);
}
// AttFtpClient instance = AttFtpClient.getInstance();
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java
index 8c2556d00a..cbe3283a66 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java
@@ -26,7 +26,6 @@ import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.FilenameFilter;
@@ -47,7 +46,6 @@ import java.util.zip.ZipInputStream;
import org.apache.commons.io.FileUtils;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.ci.tests.config.Config;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.common.util.GeneralUtility;
@@ -63,7 +61,8 @@ public class FileHandling {
Yaml yaml = new Yaml();
File file = new File(filePath);
InputStream inputStream = new FileInputStream(file);
- Map<?, ?> map = (Map<?, ?>) yaml.load(inputStream);
+ Map<?, ?> map = new HashMap<>();
+ map = (Map<?, ?>) yaml.load(inputStream);
return map;
}
@@ -99,19 +98,22 @@ public class FileHandling {
}
// -------------------------------------------------------------------------------------------------
+
+ /**
+ * @param folder, folder name under "Files" folder
+ * @return path to given folder from perspective of working directory or sdc-vnfs repository
+ */
public static String getFilePath(String folder) {
- String filepath = System.getProperty("filepath");
- if (filepath == null && System.getProperty("os.name").contains("Windows")) {
- filepath = FileHandling.getResourcesFilesPath() + folder + File.separator;
- }
+ String filepath = System.getProperty("filePath");
+ boolean isFilePathEmptyOrNull = (filepath == null || filepath.isEmpty());
- else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
- filepath = FileHandling.getBasePath() + "Files" + File.separator + folder + File.separator;
+ // return folder from perspective of sdc-vnfs repository
+ if (isFilePathEmptyOrNull && ( System.getProperty("os.name").contains("Windows") || System.getProperty("os.name").contains("Mac"))) {
+ return FileHandling.getResourcesFilesPath() + folder + File.separator;
}
- System.out.println(filepath);
-
- return filepath;
+ // return folder from perspective of working directory ( in general for nightly run from Linux, should already contain "Files" directory )
+ return FileHandling.getBasePath() + "Files" + File.separator + folder + File.separator;
}
public static String getBasePath() {
@@ -155,6 +157,10 @@ public class FileHandling {
public static String getVnfRepositoryPath() {
return getFilePath("VNFs");
}
+
+ public static String getUpdateVSPVnfRepositoryPath() {
+ return getFilePath("UpdateVSP");
+ }
public static File getConfigFile(String configFileName) throws Exception {
File configFile = new File(FileHandling.getBasePath() + File.separator + "conf" + File.separator + configFileName);
@@ -244,8 +250,8 @@ public class FileHandling {
}
-// public static Object[] getZipFileNamesFromFolder(String filepath) {
-// return filterFileNamesFromFolder(filepath, ".zip");
+// public static Object[] getZipFileNamesFromFolder(String filePath) {
+// return filterFileNamesFromFolder(filePath, ".zip");
// }
public static List<String> getZipFileNamesFromFolder(String filepath) {
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java
index 44ff08938a..526ed7a8f4 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java
@@ -433,9 +433,9 @@ public final class GeneralUIUtils {
}
}
- public static void moveToStep(DataTestIdEnum.StepsEnum Stepname) {
- moveToStep(Stepname.getValue());
- SetupCDTest.getExtendTest().log(Status.INFO, String.format("Going to %s page ", Stepname.toString()));
+ public static void moveToStep(DataTestIdEnum.StepsEnum stepName) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Going to %s page ", stepName.toString()));
+ moveToStep(stepName.getValue());
}
public static void moveToStep(String dataTestId) {
@@ -785,5 +785,10 @@ public final class GeneralUIUtils {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(selection, selection);
}
+
+ public static boolean checkForDisabledAttributeInHiddenElement(String cssString){
+ Object elementAttributes = getAllElementAttributes(getDriver().findElement(By.cssSelector(cssString)));
+ return elementAttributes.toString().contains("disabled");
+ }
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/HomeUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/HomeUtils.java
index 1bef2ad32c..ca4dd567d6 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/HomeUtils.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/HomeUtils.java
@@ -20,7 +20,6 @@
package org.openecomp.sdc.ci.tests.utilities;
-import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum;
import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java
new file mode 100644
index 0000000000..b610cf1c54
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUiUtils.java
@@ -0,0 +1,969 @@
+/*-
+ * ============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.utilities;
+
+import static org.testng.AssertJUnit.assertEquals;
+
+import java.io.File;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+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.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar;
+import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+
+
+
+
+
+
+
+
+public class OnboardingUiUtils {
+
+// /**
+// * excluded VNF file list
+// */
+// protected static List<String> exludeVnfList =
+//// new ArrayList<String>();
+//
+// Arrays.asList(
+//
+//// new VNFs
+// "Vhss-epc-rdm3-lab-vf-0921-v2.0-MOBILITY-10-20.zip", "Apndns-1710-vf-v3.0-10-20.zip",
+// "HeatCandidate_2017-09-22_01-48_55Name_2016-182-asbg-nsbg-tsbg-v1.0-(VOIP).zip", "HeatCandidate_2017-09-22_01-47_55Name_2016-182-asbg-nsbg-tsbg-v7.0-(VOIP).zip",
+// "Efmc-dbe-nin-v24.0-VOIP-10-20.zip", "VF_LMSP_v5-062317-V3.0-(Mobility).zip", "base_bwks_nfm_volume-236262502.zip",
+//
+//// newest failed VNFs
+// "HeatCandidate_2017-09-20_15-07_66Name_2016-20-visbc1vf-v4.0-(VOIP).zip",
+// "HeatCandidate_2017-09-20_15-06_66Name_2016-20-visbc1vf-v6.0-(VOIP).zip", "1-Vf-zrdm5bpxtc02-092017-(MOBILITY)_v3.0.zip",
+// "2-Vf-zrdm5bpxtc02-092017-(MOBILITY)_v2.0.zip", "1-2017-491-4vshaken-HTTP-CM-vf-(VOIP)_v2.0.zip"
+//
+// );
+//
+// /**
+// * additional files to exludeVnfList files for tosca parser tests
+// */
+// protected static List<String> exludeVnfListForToscaParser = new ArrayList<String>();
+// //Arrays.asList("2016-043_vsaegw_fdnt_30_1607_e2e.zip", "vIRC_CC.zip",
+//// "2016-045_vlb_lmsp_30_1607_e2e.zip", "2016-050_vdns_vmdns_30_1607_e2e.zip",
+//// "2016-247_mns_mns_30_1610_e2e.zip", "2016-044_vfw_fcgi_30_1607_e2e.zip");
+
+ public OnboardingUiUtils() {
+ }
+
+// public static Pair<String, Map<String, String>> createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers, Map<CvfcTypeEnum, String> cvfcArtifacts)
+// throws Exception {
+//
+// Pair<String, Map<String, String>> pair = createVSP(resourceReqDetails, heatFileName, filepath, user, amdocsLicenseMembers);
+// String vspid = pair.right.get("vspId");
+// if(cvfcArtifacts != null && ! cvfcArtifacts.isEmpty()){
+// OnboardingUiUtils.addCvfcArtifacts(cvfcArtifacts, vspid, user, null);
+//
+// }
+// prepareVspForUse(user, vspid, "0.1");
+// return pair;
+// }
+
+ public static void prepareVspForUse(User user, String vspid, String vspVersion) throws Exception {
+
+ RestResponse checkin = OnboardingUtils.checkinVendorSoftwareProduct(vspid, user, vspVersion);
+ assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue());
+
+ RestResponse submit = OnboardingUtils.submitVendorSoftwareProduct(vspid, user, vspVersion);
+ assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue());
+
+ RestResponse createPackage = OnboardingUtils.createPackageOfVendorSoftwareProduct(vspid, user, vspVersion);
+ assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue());
+ if(SetupCDTest.getExtendTest() != null){
+ SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor software product");
+ }
+ }
+
+
+// public static VendorSoftwareProductObject createAndFillVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filePath, User user, AmdocsLicenseMembers amdocsLicenseMembers, Map<CvfcTypeEnum, String> cvfcArtifacts)
+// throws Exception {
+//
+// Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUiUtils.createVendorSoftwareProduct(resourceReqDetails, heatFileName, filePath, user, amdocsLicenseMembers, cvfcArtifacts);
+// VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(heatFileName, createVendorSoftwareProduct);
+// return vendorSoftwareProductObject;
+//
+// }
+
+// public static Pair<String, Map<String, String>> createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers)
+// throws Exception {
+//
+// Map<CvfcTypeEnum, String> cvfcArtifacts = new HashMap<>();
+// return createVendorSoftwareProduct(resourceReqDetails, heatFileName, filepath, user, amdocsLicenseMembers, cvfcArtifacts);
+// }
+
+// public static Pair<String, Map<String, String>> createVSP(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception {
+// String vspName = handleFilename(heatFileName);
+//
+// if(SetupCDTest.getExtendTest() != null){
+// SetupCDTest.getExtendTest().log(Status.INFO, "Starting to create the vendor software product");
+// }
+//
+// Pair<RestResponse, Map<String, String>> createNewVspPair = createNewVendorSoftwareProduct(resourceReqDetails, 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");
+// String componentId = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "componentId");
+//
+// Map<String, String> vspMeta = createNewVspPair.right;
+// Map<String, String> vspObject = new HashMap<String, String>();
+// Iterator<String> iterator = vspMeta.keySet().iterator();
+// while(iterator.hasNext()){
+// Object key = iterator.next();
+// Object value = vspMeta.get(key);
+// vspObject.put(key.toString(), value.toString());
+// }
+// vspObject.put("vspId", vspid);
+// vspObject.put("componentId", componentId);
+// vspObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName());
+// vspObject.put("attContact", user.getUserId());
+//
+// RestResponse uploadHeatPackage = uploadHeatPackage(filepath, heatFileName, vspid, user, "0.1");
+// assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue());
+//
+// RestResponse validateUpload = validateUpload(vspid, user, "0.1");
+// assertEquals("did not succeed to validate upload process, reason: " + validateUpload.getResponse(), 200, validateUpload.getErrorCode().intValue());
+//
+// Pair<String, Map<String, String>> pair = new Pair<String, Map<String, String>>(vspName, vspObject);
+//
+// return pair;
+// }
+
+// public static void updateVspWithVfcArtifacts(String filepath, String vspId, String updatedSnmpPoll, String updatedSnmpTrap, String componentId, User user, String vspVersion) throws Exception{
+// RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user, vspVersion);
+// assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue());
+// ExtentTestActions.log(Status.INFO, "Deleting SNMP POLL");
+// deleteArtifactByType(componentId, vspId, user, CvfcTypeEnum.SNMP_POLL);
+// ExtentTestActions.log(Status.INFO, "Deleting SNMP TRAP");
+// deleteArtifactByType(componentId, vspId, user, CvfcTypeEnum.SNMP_TRAP);
+// addVFCArtifacts(filepath, updatedSnmpPoll, updatedSnmpTrap, vspId, user, componentId);
+// prepareVspForUse(user, vspId, vspVersion);
+// }
+
+ public static String updateVendorSoftwareProduct(String vspId, String HeatFileName, String filepath, User user, String vspVersion)
+ throws Exception, Throwable {
+ String vspName = OnboardingUtils.handleFilename(HeatFileName);
+ SetupCDTest.getExtendTest().log(Status.INFO, "Starting to update the vendor software product");
+
+ RestResponse checkout = OnboardingUtils.checkoutVendorSoftwareProduct(vspId, user, vspVersion);
+ assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue());
+
+ RestResponse uploadHeatPackage = OnboardingUtils.uploadHeatPackage(filepath, HeatFileName, vspId, user, vspVersion);
+ assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue());
+
+ RestResponse validateUpload = OnboardingUtils.validateUpload(vspId, user, vspVersion);
+ assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue());
+
+ RestResponse checkin = OnboardingUtils.checkinVendorSoftwareProduct(vspId, user, vspVersion);
+ assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue());
+
+ RestResponse submit = OnboardingUtils.submitVendorSoftwareProduct(vspId, user, vspVersion);
+ assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue());
+
+ RestResponse createPackage = OnboardingUtils.createPackageOfVendorSoftwareProduct(vspId, user, vspVersion);
+ assertEquals("did not succeed to update package of VSP ", 200, createPackage.getErrorCode().intValue());
+
+ SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in updating the vendor software product");
+
+ return vspName;
+ }
+
+// public static void updateVendorSoftwareProductToNextVersion(VendorSoftwareProductObject vendorSoftwareProductObject, String toVspVersion, User user)
+// throws Exception, Throwable {
+//
+// RestResponse checkout = checkoutVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vendorSoftwareProductObject.getVersion());
+// assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue());
+//
+// RestResponse checkin = checkinVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vendorSoftwareProductObject.getVersion());
+// assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue());
+//
+// RestResponse submit = submitVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vendorSoftwareProductObject.getVersion());
+// assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue());
+//
+// vendorSoftwareProductObject.setVersion(toVspVersion);
+// }
+
+// public static String handleFilename(String heatFileName) {
+// final String namePrefix = String.format("%sVFOnboarded-", ElementFactory.getResourcePrefix());
+// final String nameSuffix = "-" + getShortUUID();
+//
+// String subHeatFileName = heatFileName.substring(0, heatFileName.lastIndexOf("."));
+//
+// if ((namePrefix + subHeatFileName + nameSuffix).length() >= 50) {
+// subHeatFileName = subHeatFileName.substring(0, 50 - namePrefix.length() - nameSuffix.length());
+// }
+//
+// if (subHeatFileName.contains("(") || subHeatFileName.contains(")")) {
+// subHeatFileName = subHeatFileName.replace("(", "-");
+// subHeatFileName = subHeatFileName.replace(")", "-");
+// }
+//
+// String vnfName = namePrefix + subHeatFileName + nameSuffix;
+// return vnfName;
+// }
+
+// public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user, String vspComponentId) throws Exception{
+// vspComponentId = (vspComponentId == null) ? getVSPComponentId(vspid, user) : vspComponentId;
+// if (vspComponentId != null){
+// if (snmpPoll != null){
+// ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP POLL with the file " + snmpPoll);
+// RestResponse uploadSnmpPollArtifact = uploadSnmpPollArtifact(filepath, snmpPoll, vspid, user, vspComponentId);
+// assertEquals("Did not succeed to add SNMP POLL", 200, uploadSnmpPollArtifact.getErrorCode().intValue());
+// }
+// if (snmpTrap != null){
+// ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP TRAP with the file " + snmpTrap);
+// RestResponse uploadSnmpTrapArtifact = uploadSnmpTrapArtifact(filepath, snmpTrap, vspid, user, vspComponentId);
+// assertEquals("Did not succeed to add SNMP TRAP", 200, uploadSnmpTrapArtifact.getErrorCode().intValue());
+// }
+// }
+//
+// return vspComponentId;
+// }
+
+// public static String addCvfcArtifacts(Map<CvfcTypeEnum, String> componentVfcArtifacts, String vspid, User user, String vspComponentId) throws Exception{
+// vspComponentId = (vspComponentId == null) ? getVSPComponentId(vspid, user) : vspComponentId;
+// if (vspComponentId != null){
+// for(Entry<CvfcTypeEnum, String> entry : componentVfcArtifacts.entrySet()){
+// ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type " + entry.getKey().getValue() + " with the file " + entry.getValue());
+// RestResponse uploadSnmpPollArtifact = uploadCvfcArtifact(entry.getValue(), entry.getKey().getValue(), vspid, user, vspComponentId);
+// assertEquals("Did not succeed to add " + entry.getKey().getValue(), BaseRestUtils.STATUS_CODE_SUCCESS, uploadSnmpPollArtifact.getErrorCode().intValue());
+// }
+// }
+// return vspComponentId;
+// }
+
+// public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user) throws Exception{
+// return addVFCArtifacts(filepath, snmpPoll, snmpTrap, vspid, user, null);
+// }
+
+// public static RestResponse uploadCvfcArtifact(String filepath, String cvfcType, String vspid, User user, String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException {
+// Config config = Utils.getConfig();
+// String snmpPollUrl = String.format(Urls.UPLOAD_AMDOCS_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId, cvfcType);
+// return uploadFile(filepath, null, snmpPollUrl, user);
+// }
+
+// private static RestResponse uploadSnmpPollArtifact(String filepath, String zipArtifact, String vspid, User user,
+// String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException {
+// Config config = Utils.getConfig();
+// String snmpPollUrl = String.format(Urls.UPLOAD_SNMP_POLL_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId);
+// return uploadFile(filepath, zipArtifact, snmpPollUrl, user);
+// }
+
+// private static RestResponse uploadSnmpTrapArtifact(String filepath, String zipArtifact, String vspid, User user,
+// String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException {
+// Config config = Utils.getConfig();
+// String snmpTrapUrl = String.format(Urls.UPLOAD_SNMP_POLL_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId);
+// return uploadFile(filepath, zipArtifact, snmpTrapUrl, user);
+// }
+
+// private static RestResponse deleteArtifactByType(String componentId, String vspId, User user, CvfcTypeEnum snmpType) throws Exception
+// {
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.DELETE_AMDOCS_ARTIFACT_BY_TYPE, config.getCatalogBeHost(),config.getCatalogBePort(), vspId, componentId, snmpType.getValue());
+// String userId = user.getUserId();
+// Map<String, String> headersMap = prepareHeadersMap(userId);
+//
+// HttpRequest http = new HttpRequest();
+// RestResponse response = http.httpSendDelete(url, headersMap);
+// return response;
+// }
+
+// private static String getVSPComponentId(String vspid, User user) throws Exception, JSONException {
+// RestResponse components = getVSPComponents(vspid, user);
+// String response = components.getResponse();
+// Map<String, Object> responseMap = (Map<String, Object>) JSONValue.parse(response);
+// JSONArray results = (JSONArray)responseMap.get("results");
+// for (Object res : results){
+// Map<String, Object> compMap= (Map<String, Object>) JSONValue.parse(res.toString());
+// String componentId = compMap.get("id").toString();
+// return componentId;
+// }
+// return null;
+// }
+
+// private static RestResponse getVSPComponents(String vspid, User user) throws Exception{
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.GET_VSP_COMPONENTS, config.getCatalogBeHost(),config.getCatalogBePort(), vspid);
+// String userId = user.getUserId();
+//
+// Map<String, String> headersMap = prepareHeadersMap(userId);
+//
+// HttpRequest http = new HttpRequest();
+// RestResponse response = http.httpSendGet(url, headersMap);
+// return response;
+// }
+
+// private static RestResponse getVSPComponentByVersion(String vspId, String vspVersion, User user) throws Exception{
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.GET_VSP_COMPONENT_BY_VERSION, config.getCatalogBeHost(),config.getCatalogBePort(), vspId,vspVersion);
+// String userId = user.getUserId();
+//
+// Map<String, String> headersMap = prepareHeadersMap(userId);
+//
+// HttpRequest http = new HttpRequest();
+// RestResponse response = http.httpSendGet(url, headersMap);
+// return response;
+// }
+
+// private static RestResponse getVLMComponentByVersion(String vlmId, String vlmVersion, User user) throws Exception{
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.GET_VLM_COMPONENT_BY_VERSION, config.getCatalogBeHost(),config.getCatalogBePort(), vlmId,vlmVersion);
+// String userId = user.getUserId();
+//
+// Map<String, String> headersMap = prepareHeadersMap(userId);
+//
+// HttpRequest http = new HttpRequest();
+// RestResponse response = http.httpSendGet(url, headersMap);
+// return response;
+// }
+
+// public static boolean validateVspExist(String vspId, String vspVersion, User user) throws Exception {
+// RestResponse restResponse = getVSPComponentByVersion(vspId, vspVersion, user);
+// assertEquals(String.format("Vsp version not updated, reponse message: %s", restResponse.getResponse()),restResponse.getErrorCode().intValue(),200);
+// return (restResponse.getErrorCode()==200);
+// }
+//
+// public static boolean validateVlmExist(String vlmId, String vlmVersion, User user) throws Exception {
+// RestResponse restResponse = getVLMComponentByVersion(vlmId, vlmVersion, user);
+// assertEquals(String.format("VLM version not updated, reponse code message: %s", restResponse.getResponse()),restResponse.getErrorCode().intValue(),200);
+// return (restResponse.getErrorCode()==200);
+// }
+
+ public static AmdocsLicenseMembers createVendorLicense(User user) throws Exception {
+
+ AmdocsLicenseMembers amdocsLicenseMembers;
+ if(SetupCDTest.getExtendTest() != null){
+ SetupCDTest.getExtendTest().log(Status.INFO, "Starting to create the vendor license");
+ }
+ String vendorLicenseName = "ciLicense" + OnboardingUtils.getShortUUID();
+ RestResponse vendorLicenseResponse = OnboardingUtils.createVendorLicenseModels_1(vendorLicenseName, user);
+ 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());
+ 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");
+
+ 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());
+ String vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(), "value");
+
+ RestResponse checkinVendorLicense = OnboardingUtils.checkinVendorLicense(vendorId, user, "0.1");
+ assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue());
+
+ RestResponse submitVendorLicense = OnboardingUtils.submitVendorLicense(vendorId, user, "0.1");
+ assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue());
+
+ if(SetupCDTest.getExtendTest() != null){
+ SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor license");
+ }
+
+ amdocsLicenseMembers = new AmdocsLicenseMembers(vendorId, vendorLicenseName, vendorLicenseAgreementId, featureGroupId);
+ amdocsLicenseMembers.setVersion("1.0"); // Once object created and submitted, his initial version is 1.0
+
+ return amdocsLicenseMembers;
+ }
+
+// public static void updateVendorLicense(AmdocsLicenseMembers amdocsLicenseMembers, User user, String vlmVersion) throws Exception {
+//
+// RestResponse checkoutVendorLicense = checkoutVendorLicense(amdocsLicenseMembers.getVendorId(), user, vlmVersion);
+// assertEquals("did not succeed to checkout vendor license", 200, checkoutVendorLicense.getErrorCode().intValue());
+//
+// RestResponse checkinVendorLicense = checkinVendorLicense(amdocsLicenseMembers.getVendorId(), user, vlmVersion);
+// assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue());
+//
+// RestResponse submitVendorLicense = submitVendorLicense(amdocsLicenseMembers.getVendorId(), user, vlmVersion);
+// assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue());
+//
+// if(SetupCDTest.getExtendTest() != null){
+// SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in updating the vendor license");
+// }
+// }
+
+
+// private static String getShortUUID() {
+// return UUID.randomUUID().toString().split("-")[0];
+// }
+
+// private static RestResponse actionOnComponent(String vspid, String action, String onboardComponent, User user, String componentVersion)
+// throws Exception {
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.ACTION_ON_COMPONENT, config.getCatalogBeHost(), config.getCatalogBePort(), onboardComponent, vspid, componentVersion);
+// String userId = user.getUserId();
+//
+// JSONObject jObject = new JSONObject();
+// jObject.put("action", action);
+//
+// Map<String, String> headersMap = prepareHeadersMap(userId);
+//
+// HttpRequest http = new HttpRequest();
+// RestResponse response = http.httpSendPut(url, jObject.toString(), headersMap);
+// return response;
+// }
+
+// public static RestResponse checkinVendorLicense(String vspid, User user, String vlmVersion) throws Exception {
+// return actionOnComponent(vspid, "Checkin", "vendor-license-models", user, vlmVersion);
+// }
+//
+// public static RestResponse checkoutVendorLicense(String vspid, User user, String vlmVersion) throws Exception {
+// return actionOnComponent(vspid, "Checkout", "vendor-license-models", user, vlmVersion);
+// }
+//
+// public static RestResponse submitVendorLicense(String vspid, User user, String vlmVersion) throws Exception {
+// return actionOnComponent(vspid, "Submit", "vendor-license-models", user, vlmVersion);
+// }
+
+// public static RestResponse createVendorLicenseModels_1(String name, User user) throws Exception {
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.CREATE_VENDOR_LISENCE_MODELS, config.getCatalogBeHost(),
+// config.getCatalogBePort());
+// String userId = user.getUserId();
+//
+// JSONObject jObject = new JSONObject();
+// jObject.put("vendorName", name);
+// jObject.put("description", "new vendor license model");
+// jObject.put("iconRef", "icon");
+//
+// Map<String, String> headersMap = prepareHeadersMap(userId);
+//
+// HttpRequest http = new HttpRequest();
+// RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap);
+// return response;
+//
+// }
+//
+// public static RestResponse createVendorLicenseAgreement_5(String vspid, String featureGroupId, User user)
+// throws Exception {
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.CREATE_VENDOR_LISENCE_AGREEMENT, config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+// String userId = user.getUserId();
+//
+// JSONObject licenseTermpObject = new JSONObject();
+// licenseTermpObject.put("choice", "Fixed_Term");
+// licenseTermpObject.put("other", "");
+//
+// JSONObject jObjectBody = new JSONObject();
+// jObjectBody.put("name", "abc");
+// jObjectBody.put("description", "new vendor license agreement");
+// jObjectBody.put("requirementsAndConstrains", "abc");
+// jObjectBody.put("licenseTerm", licenseTermpObject);
+// jObjectBody.put("addedFeatureGroupsIds", Arrays.asList(featureGroupId).toArray());
+//
+// Map<String, String> headersMap = prepareHeadersMap(userId);
+//
+// HttpRequest http = new HttpRequest();
+// RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap);
+// return response;
+// }
+//
+// public static RestResponse createVendorLicenseFeatureGroups_4(String vspid, String licenseKeyGroupId,
+// String entitlementPoolId, User user) throws Exception {
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.CREATE_VENDOR_LISENCE_FEATURE_GROUPS, config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+// String userId = user.getUserId();
+//
+// JSONObject jObject = new JSONObject();
+// jObject.put("name", "xyz");
+// jObject.put("description", "new vendor license feature groups");
+// jObject.put("partNumber", "123abc456");
+// jObject.put("manufacturerReferenceNumber", "5");
+// jObject.put("addedLicenseKeyGroupsIds", Arrays.asList(licenseKeyGroupId).toArray());
+// jObject.put("addedEntitlementPoolsIds", Arrays.asList(entitlementPoolId).toArray());
+//
+// Map<String, String> headersMap = prepareHeadersMap(userId);
+//
+// HttpRequest http = new HttpRequest();
+// RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap);
+// return response;
+//
+// }
+//
+// public static RestResponse createVendorEntitlementPool_3(String vspid, User user) throws Exception {
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.CREATE_VENDOR_LISENCE_ENTITLEMENT_POOL, config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+// String userId = user.getUserId();
+//
+// JSONObject jEntitlementMetricObject = new JSONObject();
+// jEntitlementMetricObject.put("choice", "CPU");
+// jEntitlementMetricObject.put("other", "");
+//
+// JSONObject jAggregationFunctionObject = new JSONObject();
+// jAggregationFunctionObject.put("choice", "Peak");
+// jAggregationFunctionObject.put("other", "");
+//
+// JSONObject jOperationalScope = new JSONObject();
+// jOperationalScope.put("choices", Arrays.asList("Availability_Zone").toArray());
+// jOperationalScope.put("other", "");
+//
+// JSONObject jTimeObject = new JSONObject();
+// jTimeObject.put("choice", "Hour");
+// jTimeObject.put("other", "");
+//
+// JSONObject jObjectBody = new JSONObject();
+// jObjectBody.put("name", "def"+ getShortUUID());
+// jObjectBody.put("description", "new vendor license entitlement pool");
+// jObjectBody.put("thresholdValue", "23");
+// jObjectBody.put("thresholdUnits", "Absolute");
+// jObjectBody.put("entitlementMetric", jEntitlementMetricObject);
+// jObjectBody.put("increments", "abcd");
+// jObjectBody.put("aggregationFunction", jAggregationFunctionObject);
+// jObjectBody.put("operationalScope", jOperationalScope);
+// jObjectBody.put("time", jTimeObject);
+// jObjectBody.put("manufacturerReferenceNumber", "123aaa");
+//
+// Map<String, String> headersMap = prepareHeadersMap(userId);
+//
+// HttpRequest http = new HttpRequest();
+// RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap);
+// return response;
+// }
+//
+// public static RestResponse createVendorKeyGroups_2(String vspid, User user) throws Exception {
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.CREATE_VENDOR_LISENCE_KEY_GROUPS, config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+// String userId = user.getUserId();
+//
+// JSONObject jOperationalScope = new JSONObject();
+// jOperationalScope.put("choices", Arrays.asList("Tenant").toArray());
+// jOperationalScope.put("other", "");
+//
+// JSONObject jObjectBody = new JSONObject();
+// jObjectBody.put("name", "keyGroup" + getShortUUID());
+// jObjectBody.put("description", "new vendor license key group");
+// jObjectBody.put("operationalScope", jOperationalScope);
+// jObjectBody.put("type", "Universal");
+//
+// Map<String, String> headersMap = prepareHeadersMap(userId);
+//
+// HttpRequest http = new HttpRequest();
+// RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap);
+// return response;
+// }
+
+// public static Pair<RestResponse, Map<String, String>> createNewVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String vspName, AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception {
+// Map<String, String> vspMetadta = new HashMap<String, String>();
+//
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.CREATE_VENDOR_SOFTWARE_PRODUCT, config.getCatalogBeHost(), config.getCatalogBePort());
+// String userId = user.getUserId();
+// VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject();
+// LicensingData licensingData = new LicensingData(amdocsLicenseMembers.getVendorLicenseAgreementId(), Arrays.asList(amdocsLicenseMembers.getFeatureGroupId()));
+// LicensingVersion licensingVersion = new LicensingVersion("1.0", "1.0");
+// ResourceCategoryEnum resourceCategoryEnum = ResourceCategoryEnum.findEnumNameByValues(resourceReqDetails.getCategories().get(0).getName(), resourceReqDetails.getCategories().get(0).getSubcategories().get(0).getName());
+//
+// vendorSoftwareProductObject.setLicensingVersion(licensingVersion);
+//
+// vendorSoftwareProductObject.setName(vspName);
+// vendorSoftwareProductObject.setDescription(resourceReqDetails.getDescription());
+// vendorSoftwareProductObject.setCategory(resourceCategoryEnum.getCategoryUniqeId());
+// vendorSoftwareProductObject.setSubCategory(resourceCategoryEnum.getSubCategoryUniqeId());
+// vendorSoftwareProductObject.setOnboardingMethod("NetworkPackage");
+// vendorSoftwareProductObject.setVendorName(amdocsLicenseMembers.getVendorLicenseName());
+// vendorSoftwareProductObject.setVendorId(amdocsLicenseMembers.getVendorId());
+// vendorSoftwareProductObject.setIcon("icon");
+// vendorSoftwareProductObject.setLicensingData(licensingData);
+//
+// vspMetadta.put("description", resourceReqDetails.getDescription());
+// vspMetadta.put("category", resourceCategoryEnum.getCategory());
+// vspMetadta.put("subCategory", resourceCategoryEnum.getSubCategory());
+//
+// Map<String, String> headersMap = prepareHeadersMap(userId);
+// HttpRequest http = new HttpRequest();
+// Gson gson = new Gson();
+// String body = gson.toJson(vendorSoftwareProductObject);
+//
+// RestResponse response = http.httpSendPost(url, body, headersMap);
+// return new Pair<RestResponse, Map<String, String>>(response, vspMetadta);
+// }
+
+
+// public static RestResponse validateUpload(String vspid, User user, String vspVersion) throws Exception {
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.VALIDATE_UPLOAD, config.getCatalogBeHost(), config.getCatalogBePort(), vspid,vspVersion);
+//
+// String userId = user.getUserId();
+//
+// Map<String, String> headersMap = prepareHeadersMap(userId);
+// HttpRequest http = new HttpRequest();
+//
+// String body =null;
+//
+// RestResponse response = http.httpSendPut(url, body, headersMap);
+//
+// return response;
+// }
+
+// public static RestResponse uploadHeatPackage(String filepath, String filename, String vspid, User user, String vspVersion) throws Exception {
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.UPLOAD_HEAT_PACKAGE, config.getCatalogBeHost(), config.getCatalogBePort(), vspid, vspVersion);
+// return uploadFile(filepath, filename, url, user);
+// }
+
+// private static RestResponse uploadFile(String filepath, String filename, String url, User user)
+// throws FileNotFoundException, IOException, ClientProtocolException {
+// CloseableHttpResponse response = null;
+//
+// MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create();
+// mpBuilder.addPart("upload", new FileBody(getTestZipFile(filepath, filename)));
+//
+// Map<String, String> headersMap = prepareHeadersMap(user.getUserId());
+// headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "multipart/form-data");
+//
+// CloseableHttpClient client = HttpClients.createDefault();
+// try {
+// HttpPost httpPost = new HttpPost(url);
+// RestResponse restResponse = new RestResponse();
+//
+// Iterator<String> iterator = headersMap.keySet().iterator();
+// while (iterator.hasNext()) {
+// String key = iterator.next();
+// String value = headersMap.get(key);
+// httpPost.addHeader(key, value);
+// }
+// httpPost.setEntity(mpBuilder.build());
+// response = client.execute(httpPost);
+// HttpEntity entity = response.getEntity();
+// String responseBody = null;
+// if (entity != null) {
+// InputStream instream = entity.getContent();
+// try {
+// StringWriter writer = new StringWriter();
+// IOUtils.copy(instream, writer);
+// responseBody = writer.toString();
+// } finally {
+// instream.close();
+// }
+// }
+//
+// restResponse.setErrorCode(response.getStatusLine().getStatusCode());
+// restResponse.setResponse(responseBody);
+//
+// return restResponse;
+//
+// } finally {
+// closeResponse(response);
+// closeHttpClient(client);
+//
+// }
+// }
+
+// private static void closeResponse(CloseableHttpResponse response) {
+// try {
+// if (response != null) {
+// response.close();
+// }
+// } catch (IOException e) {
+// System.out.println(String.format("failed to close client or response: %s", e.getMessage()));
+// }
+// }
+//
+// private static void closeHttpClient(CloseableHttpClient client) {
+// try {
+// if (client != null) {
+// client.close();
+// }
+// } catch (IOException e) {
+// System.out.println(String.format("failed to close client or response: %s", e.getMessage()));
+// }
+// }
+
+// private static File getTestZipFile(String filepath, String filename) throws IOException {
+// Config config = Utils.getConfig();
+// String sourceDir = config.getImportResourceTestsConfigDir();
+// java.nio.file.Path filePath;
+// if(filename == null){
+// filePath = FileSystems.getDefault().getPath(filepath);
+// }else{
+// filePath = FileSystems.getDefault().getPath(filepath + File.separator + filename);
+// }
+// return filePath.toFile();
+// }
+
+// public static RestResponse checkinVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception {
+// return actionOnComponent(vspid, "Checkin", "vendor-software-products", user, vspVersion);
+// }
+//
+// private static RestResponse checkoutVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception {
+// return actionOnComponent(vspid, "Checkout", "vendor-software-products", user, vspVersion);
+// }
+//
+// public static RestResponse submitVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception {
+// return actionOnComponent(vspid, "Submit", "vendor-software-products", user, vspVersion);
+// }
+//
+// public static RestResponse createPackageOfVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception {
+// return actionOnComponent(vspid, "Create_Package", "vendor-software-products", user, vspVersion);
+// }
+
+// protected static Map<String, String> prepareHeadersMap(String userId) {
+// Map<String, String> headersMap = new HashMap<String, String>();
+// headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json");
+// headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json");
+// headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId);
+// return headersMap;
+// }
+
+
+ private static void importUpdateVSP(Pair<String, Map<String, String>> vsp, boolean isUpdate) throws Exception{
+ String vspName = vsp.left;
+ Map<String, String> vspMetadata = vsp.right;
+ boolean vspFound = HomePage.searchForVSP(vspName);
+
+ if (vspFound){
+
+ List<WebElement> elemenetsFromTable = HomePage.getElemenetsFromTable();
+// WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30);
+// WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1)));
+// findElement.click();
+ elemenetsFromTable.get(1).click();
+ GeneralUIUtils.waitForLoader();
+
+ if (isUpdate){
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.UPDATE_VSP.getValue());
+
+ }
+ else{
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.IMPORT_VSP.getValue());
+ }
+
+ String lifeCycleState = ResourceGeneralPage.getLifeCycleState();
+ boolean needCheckout = lifeCycleState.equals(LifeCycleStateEnum.CHECKIN.getValue()) || lifeCycleState.equals(LifeCycleStateEnum.CERTIFIED.getValue());
+ if (needCheckout)
+ {
+ try {
+ ResourceGeneralPage.clickCheckoutButton();
+ Assert.assertTrue(ResourceGeneralPage.getLifeCycleState().equals(LifeCycleStateEnum.CHECKOUT.getValue()), "Did not succeed to checkout");
+
+ } catch (Exception e) {
+ ExtentTestActions.log(Status.ERROR, "Did not succeed to checkout");
+ e.printStackTrace();
+ }
+ GeneralUIUtils.waitForLoader();
+ }
+
+ //Metadata verification
+ VfVerificator.verifyOnboardedVnfMetadata(vspName, vspMetadata);
+
+ ExtentTestActions.log(Status.INFO, "Clicking create/update VNF");
+ String duration = GeneralUIUtils.getActionDuration(() -> waitUntilVnfCreated());
+ ExtentTestActions.log(Status.INFO, "Succeeded in importing/updating " + vspName, duration);
+ }
+ else{
+ Assert.fail("Did not find VSP named " + vspName);
+ }
+ }
+
+ private static void waitUntilVnfCreated() {
+ GeneralUIUtils.clickOnElementByTestIdWithoutWait(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue());
+ GeneralUIUtils.waitForLoader(60*10);
+ GeneralUIUtils.waitForAngular();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue());
+ }
+
+ public static void updateVSP(Pair<String, Map<String, String>> vsp) throws Exception{
+ ExtentTestActions.log(Status.INFO, "Updating VSP " + vsp.left);
+ importUpdateVSP(vsp, true);
+ }
+
+ public static void importVSP(Pair<String, Map<String, String>> vsp) throws Exception{
+ ExtentTestActions.log(Status.INFO, "Importing VSP " + vsp.left);
+ importUpdateVSP(vsp, false);
+ }
+
+ public static void updateVnfAndValidate(String filepath, Pair<String, Map<String, String>> vsp, String updatedVnfFile, User user) throws Exception, Throwable {
+ ExtentTestActions.log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile));
+ System.out.println(String.format("Going to update the VNF with %s......", updatedVnfFile));
+
+ Map<String, String> vspMap = vsp.right;
+ String vspId = vspMap.get("vspId");
+
+ updateVendorSoftwareProduct(vspId, updatedVnfFile, filepath, user, "0.1");
+ HomePage.showVspRepository();
+ updateVSP(vsp);
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, updatedVnfFile);
+ }
+
+ public static Pair<String, Map<String, String>> onboardAndValidate(ResourceReqDetails resourceReqDetails, String filepath, String vnfFile, User user) throws Exception {
+ 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));
+
+ AmdocsLicenseMembers amdocsLicenseMembers = createVendorLicense(user);
+ Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, user, amdocsLicenseMembers);
+ String vspName = createVendorSoftwareProduct.left;
+
+ DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId"));
+ File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
+
+ ExtentTestActions.log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
+ HomePage.showVspRepository();
+ ExtentTestActions.log(Status.INFO,String.format("Going to import %s", vnfFile.substring(0, vnfFile.indexOf("."))));
+ importVSP(createVendorSoftwareProduct);
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ // Verify deployment artifacts
+ Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(latestFilefromDir.getAbsolutePath());
+
+ LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment"));
+ ArtifactsCorrelationManager.addVNFartifactDetails(vspName, deploymentArtifacts);
+
+ List<String> heatEnvFilesFromCSAR = deploymentArtifacts.stream().filter(e -> e.getType().equals("HEAT_ENV")).
+ map(e -> e.getFileName()).
+ collect(Collectors.toList());
+
+ validateDeploymentArtifactsVersion(deploymentArtifacts, heatEnvFilesFromCSAR);
+
+ DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile);
+ return createVendorSoftwareProduct;
+ }
+
+ public static void validateDeploymentArtifactsVersion(LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts,
+ List<String> heatEnvFilesFromCSAR) {
+ String artifactVersion;
+ String artifactName;
+
+ for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) {
+ artifactVersion = "1";
+
+ if(deploymentArtifact.getType().equals("HEAT_ENV")) {
+ continue;
+ } else if(deploymentArtifact.getFileName().contains(".")) {
+ artifactName = deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf("."));
+ } else {
+ artifactName = deploymentArtifact.getFileName().trim();
+ }
+
+ if (heatEnvFilesFromCSAR.contains(artifactName + ".env")){
+ artifactVersion = "2";
+ }
+ ArtifactUIUtils.validateArtifactNameVersionType(artifactName, artifactVersion, deploymentArtifact.getType());
+ }
+ }
+
+// public static VendorSoftwareProductObject updateVSPWithNewVLMParameters(VendorSoftwareProductObject vendorSoftwareProductObject,
+// AmdocsLicenseMembers amdocsLicenseMembers, User user, String vspCurrentVersion, String vspNextVersion) throws Exception {
+//
+// LicensingVersion licensingVersion = new LicensingVersion(amdocsLicenseMembers.getLicenseVersionId(),amdocsLicenseMembers.getLicenseVersionId());
+// LicensingData licensingData = new LicensingData(amdocsLicenseMembers.getVendorLicenseAgreementId(), Arrays.asList(amdocsLicenseMembers.getFeatureGroupId()));
+// vendorSoftwareProductObject.setVendorId(amdocsLicenseMembers.getVendorId());
+// vendorSoftwareProductObject.setVendorName(amdocsLicenseMembers.getVendorLicenseName());
+// vendorSoftwareProductObject.setLicensingVersion(licensingVersion);
+// vendorSoftwareProductObject.setLicensingData(licensingData);
+//
+// VendorSoftwareProductObjectReqDetails vendorSoftwareProductObjectReqDetails = new VendorSoftwareProductObjectReqDetails(
+// vendorSoftwareProductObject.getName(),
+// vendorSoftwareProductObject.getDescription(),
+// vendorSoftwareProductObject.getCategory(),
+// vendorSoftwareProductObject.getSubCategory(),
+// vendorSoftwareProductObject.getVendorId(),
+// vendorSoftwareProductObject.getVendorName(),
+// licensingVersion,
+// licensingData,
+// vendorSoftwareProductObject.getOnboardingMethod(),
+// vendorSoftwareProductObject.getNetworkPackageName(),
+// vendorSoftwareProductObject.getOnboardingOrigin());
+//
+// Gson gson = new Gson();
+// String json = gson.toJson(vendorSoftwareProductObjectReqDetails);
+//
+// RestResponse checkout = checkoutVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, "1.0");
+// assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue());
+//
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.UPDATE_VSP, config.getCatalogBeHost(), config.getCatalogBePort(), vendorSoftwareProductObject.getVspId(), vspCurrentVersion);
+// String userId = user.getUserId();
+//
+// Map<String, String> headersMap = prepareHeadersMap(userId);
+// HttpRequest http = new HttpRequest();
+//
+// RestResponse response = http.httpSendPut(url, json, headersMap);
+//
+// RestResponse checkin = checkinVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vspCurrentVersion);
+// assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue());
+//
+// RestResponse submit = submitVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vspCurrentVersion);
+// assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue());
+//
+// vendorSoftwareProductObject.setVersion(vspNextVersion);
+//
+// return vendorSoftwareProductObject;
+// }
+
+// /**
+// * @return
+// * The method returns VNF names list from Files directory under sdc-vnfs repository
+// */
+// public static List<String> getVnfNamesFileList() {
+// String filepath = FileHandling.getVnfRepositoryPath();
+// List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+// fileNamesFromFolder.removeAll(exludeVnfList);
+// return fileNamesFromFolder;
+// }
+//
+// /**
+// * @return
+// * The method returns VNF names list from Files directory under sdc-vnfs repository excluding zip files that known as failed in tosca parser
+// */
+// public static List<String> getVnfNamesFileListExcludeToscaParserFailure() {
+// List<String> fileNamesFromFolder = getVnfNamesFileList();
+// fileNamesFromFolder.removeAll(exludeVnfListForToscaParser);
+// return fileNamesFromFolder;
+// }
+
+}
+
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtillViaApis.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtillViaApis.java
index 6abce99acb..8a319a3af4 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtillViaApis.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtillViaApis.java
@@ -20,73 +20,33 @@
package org.openecomp.sdc.ci.tests.utilities;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.bouncycastle.util.encoders.Base64;
-import org.openecomp.sdc.be.model.Component;
-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.ResourceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
-import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
-import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
-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.utils.Utils;
-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.BaseRestUtils;
-
-import com.clearspring.analytics.util.Pair;
-import com.google.gson.Gson;
-
-import fj.data.Either;
-
public class OnboardingUtillViaApis {
- protected static Map<String, String> prepareHeadersMap(String userId) {
- Map<String, String> headersMap = new HashMap<String, String>();
- headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json");
- headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json");
- headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId);
- return headersMap;
- }
+// protected static Map<String, String> prepareHeadersMap(String userId) {
+// Map<String, String> headersMap = new HashMap<String, String>();
+// headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json");
+// headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json");
+// headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId);
+// return headersMap;
+// }
- public static Pair<String, VendorSoftwareProductObject> createVspViaApis(String filepath, String vnfFile, User user) throws Exception {
-
- VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject();
-
- AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(user);
- Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, user, amdocsLicenseMembers);
- Map<String, String> map = createVendorSoftwareProduct.right;
- vendorSoftwareProductObject.setAttContact(map.get("attContact"));
- vendorSoftwareProductObject.setCategory(map.get("category"));
- vendorSoftwareProductObject.setComponentId(map.get("componentId"));
- vendorSoftwareProductObject.setDescription(map.get("description"));
- vendorSoftwareProductObject.setSubCategory(map.get("subCategory"));
- vendorSoftwareProductObject.setVendorName(map.get("vendorName"));
- vendorSoftwareProductObject.setVspId(map.get("vspId"));
- Pair<String, VendorSoftwareProductObject> pair = new Pair<String, VendorSoftwareProductObject>(createVendorSoftwareProduct.left, vendorSoftwareProductObject);
- return pair;
- }
+// public static Pair<String, VendorSoftwareProductObject> createVspViaApis(ResourceReqDetails resourceReqDetails, String filepath, String vnfFile, User user, Boolean skipReport) throws Exception {
+//
+// VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject();
+//
+// AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(user);
+// Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUiUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, user, amdocsLicenseMembers);
+// Map<String, String> map = createVendorSoftwareProduct.right;
+// vendorSoftwareProductObject.setAttContact(map.get("attContact"));
+// vendorSoftwareProductObject.setCategory(map.get("category"));
+// vendorSoftwareProductObject.setComponentId(map.get("componentId"));
+// vendorSoftwareProductObject.setDescription(map.get("description"));
+// vendorSoftwareProductObject.setSubCategory(map.get("subCategory"));
+// vendorSoftwareProductObject.setVendorName(map.get("vendorName"));
+// vendorSoftwareProductObject.setVspId(map.get("vspId"));
+// Pair<String, VendorSoftwareProductObject> pair = new Pair<String, VendorSoftwareProductObject>(createVendorSoftwareProduct.left, vendorSoftwareProductObject);
+// return pair;
+// }
/* public static Resource createResourceFromVSP(Pair<String, Map<String, String>> createVendorSoftwareProduct, String vspName) throws Exception {
List<String> tags = new ArrayList<>();
@@ -110,39 +70,22 @@ public class OnboardingUtillViaApis {
return resource;
}*/
- public static Resource createResourceFromVSP(ResourceReqDetails resourceDetails, String vspName) throws Exception {
-// List<String> tags = new ArrayList<>();
-// tags.add(vspName);
-// Map<String, String> map = createVendorSoftwareProduct.right;
-// ResourceReqDetails resourceDetails = new ResourceReqDetails();
-// resourceDetails.setCsarUUID(map.get("vspId"));
-// resourceDetails.setCsarVersion("1.0");
-// resourceDetails.setName(vspName);
-// resourceDetails.setTags(tags);
-// resourceDetails.setDescription(map.get("description"));
-// resourceDetails.setResourceType(map.get("componentType"));
-// resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory());
-// resourceDetails.setVendorName(map.get("vendorName"));
-// resourceDetails.setVendorRelease("1.0");
-// resourceDetails.setResourceType("VF");
-// resourceDetails.setResourceVendorModelNumber("666");
-// resourceDetails.setContactId(map.get("attContact"));
-// resourceDetails.setIcon("defaulticon");
- Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value();
-
- return resource;
- }
- public static void downloadToscaCsarToDirectory(Component component, File file) {
- try {
- Either<String, RestResponse> componentToscaArtifactPayload = AtomicOperationUtils.getComponenetArtifactPayload(component, "assettoscacsar");
- if(componentToscaArtifactPayload.left().value() != null){
- convertPayloadToFile(componentToscaArtifactPayload.left().value(), file);
- }
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
+
+// public static Resource createResourceFromVSP(ResourceReqDetails resourceDetails) throws Exception {
+// Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value();
+// return resource;
+// }
+
+// public static void downloadToscaCsarToDirectory(Component component, File file) {
+// try {
+// Either<String, RestResponse> componentToscaArtifactPayload = AtomicOperationUtils.getComponenetArtifactPayload(component, "assettoscacsar");
+// if(componentToscaArtifactPayload.left().value() != null){
+// convertPayloadToFile(componentToscaArtifactPayload.left().value(), file);
+// }
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
// public static void convertPayloadToFile(String payload, File file, boolean isBased64, boolean isSdcFormat) throws IOException{
//
@@ -167,132 +110,131 @@ public class OnboardingUtillViaApis {
//
// }
- public static void convertPayloadToFile(String payload, File file) throws IOException{
-
- Gson gson = new Gson();
- @SuppressWarnings("unchecked")
- Map<String, String> fromJson = gson.fromJson(payload, Map.class);
- String string = fromJson.get("base64Contents").toString();
- byte[] byteArray = Base64.decode(string.getBytes(StandardCharsets.UTF_8));
- File downloadedFile = new File(file.getAbsolutePath());
- FileOutputStream fos = new FileOutputStream(downloadedFile);
- fos.write(byteArray);
- fos.flush();
- fos.close();
- }
+// public static void convertPayloadToFile(String payload, File file) throws IOException{
+//
+// Gson gson = new Gson();
+// @SuppressWarnings("unchecked")
+// Map<String, String> fromJson = gson.fromJson(payload, Map.class);
+// String string = fromJson.get("base64Contents").toString();
+// byte[] byteArray = Base64.decode(string.getBytes(StandardCharsets.UTF_8));
+// File downloadedFile = new File(file.getAbsolutePath());
+// FileOutputStream fos = new FileOutputStream(downloadedFile);
+// fos.write(byteArray);
+// fos.flush();
+// fos.close();
+// }
- public static void convertPayloadToZipFile(String payload, File file) throws IOException{
-
- byte[] byteArray = payload.getBytes(StandardCharsets.ISO_8859_1);
- File downloadedFile = new File(file.getAbsolutePath());
- FileOutputStream fos = new FileOutputStream(downloadedFile);
- fos.write(byteArray);
- fos.flush();
- fos.close();
-
-
-// ZipOutputStream fos = null;
-//
-//
-// for (Charset charset : Charset.availableCharsets().values()) {
-// try{
-// // System.out.println("How to do it???");
-// File downloadedFile = new File(file.getAbsolutePath() + "_" + charset +".csar");
-// fos = new ZipOutputStream(new FileOutputStream(downloadedFile));
-// byte[] byteArray = payload.getBytes(charset);
-// fos.write(byteArray);
-// fos.flush();
-//
-// }
-// catch(Exception e){
-// fos.close();
-// }
-// }
- System.out.println("");
-
-// ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream(byteArray));
-// ZipEntry entry = null;
-// while ((entry = zipStream.getNextEntry()) != null) {
+// public static void convertPayloadToZipFile(String payload, File file) throws IOException{
//
-// String entryName = entry.getName();
+// byte[] byteArray = payload.getBytes(StandardCharsets.ISO_8859_1);
+// File downloadedFile = new File(file.getAbsolutePath());
+// FileOutputStream fos = new FileOutputStream(downloadedFile);
+// fos.write(byteArray);
+// fos.flush();
+// fos.close();
//
-// FileOutputStream out = new FileOutputStream(file+"/"+entryName);
//
-// byte[] byteBuff = new byte[4096];
-// int bytesRead = 0;
-// while ((bytesRead = zipStream.read(byteBuff)) != -1)
-// {
-// out.write(byteBuff, 0, bytesRead);
-// }
+//// ZipOutputStream fos = null;
+////
+////
+//// for (Charset charset : Charset.availableCharsets().values()) {
+//// try{
+//// // System.out.println("How to do it???");
+//// File downloadedFile = new File(file.getAbsolutePath() + "_" + charset +".csar");
+//// fos = new ZipOutputStream(new FileOutputStream(downloadedFile));
+//// byte[] byteArray = payload.getBytes(charset);
+//// fos.write(byteArray);
+//// fos.flush();
+////
+//// }
+//// catch(Exception e){
+//// fos.close();
+//// }
+//// }
+// System.out.println("");
//
-// out.close();
-// zipStream.closeEntry();
-// }
-// zipStream.close();
-//
-
-
-
- BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(payload.getBytes(StandardCharsets.ISO_8859_1)));
- String filePath = file.toString();
- BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(filePath)));
- int inByte;
- while((inByte = bis.read()) != -1) bos.write(inByte);
- bis.close();
- bos.close();
- }
+//// ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream(byteArray));
+//// ZipEntry entry = null;
+//// while ((entry = zipStream.getNextEntry()) != null) {
+////
+//// String entryName = entry.getName();
+////
+//// FileOutputStream out = new FileOutputStream(file+"/"+entryName);
+////
+//// byte[] byteBuff = new byte[4096];
+//// int bytesRead = 0;
+//// while ((bytesRead = zipStream.read(byteBuff)) != -1)
+//// {
+//// out.write(byteBuff, 0, bytesRead);
+//// }
+////
+//// out.close();
+//// zipStream.closeEntry();
+//// }
+//// zipStream.close();
+////
+//
+//
+//
+// BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(payload.getBytes(StandardCharsets.ISO_8859_1)));
+// String filePath = file.toString();
+// BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(filePath)));
+// int inByte;
+// while((inByte = bis.read()) != -1) bos.write(inByte);
+// bis.close();
+// bos.close();
+// }
- public static Either<String, RestResponse> getVendorSoftwareProduct(String vspId, User user, Boolean validateState) throws Exception {
-
- Config config = Utils.getConfig();
- String url = String.format(Urls.GET_VENDOR_SOFTWARE_PRODUCT, config.getCatalogBeHost(), config.getCatalogBePort(), vspId);
- String userId = user.getUserId();
- Map<String, String> headersMap = prepareHeadersMap(userId);
- headersMap.put(HttpHeaderEnum.X_ECOMP_REQUEST_ID_HEADER.getValue(), "123456");
- headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "*/*");
- headersMap.put("Accept-Encoding", "gzip, deflate, br");
- HttpRequest http = new HttpRequest();
- RestResponse response = http.httpSendGet(url, headersMap);
- if (validateState) {
- assertTrue("add property to resource failed: " + response.getResponseMessage(), response.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
- }
- if (response.getErrorCode() != BaseRestUtils.STATUS_CODE_SUCCESS && response.getResponse().getBytes() == null && response.getResponse().getBytes().length == 0) {
- return Either.right(response);
- }
- return Either.left(response.getResponse());
-
- }
+// public static Either<String, RestResponse> getVendorSoftwareProduct(String vspId, User user, Boolean validateState) throws Exception {
+//
+// Config config = Utils.getConfig();
+// String url = String.format(Urls.GET_VENDOR_SOFTWARE_PRODUCT, config.getCatalogBeHost(), config.getCatalogBePort(), vspId);
+// String userId = user.getUserId();
+// Map<String, String> headersMap = prepareHeadersMap(userId);
+// headersMap.put(HttpHeaderEnum.X_ECOMP_REQUEST_ID_HEADER.getValue(), "123456");
+// headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "*/*");
+// headersMap.put("Accept-Encoding", "gzip, deflate, br");
+// HttpRequest http = new HttpRequest();
+// RestResponse response = http.httpSendGet(url, headersMap);
+// if (validateState) {
+// assertTrue("add property to resource failed: " + response.getResponseMessage(), response.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
+// }
+// if (response.getErrorCode() != BaseRestUtils.STATUS_CODE_SUCCESS && response.getResponse().getBytes() == null && response.getResponse().getBytes().length == 0) {
+// return Either.right(response);
+// }
+// return Either.left(response.getResponse());
+//
+// }
- public static ResourceReqDetails prepareOnboardedResourceDetailsBeforeCreate(VendorSoftwareProductObject vendorSoftwareProductObject, String vspName) {
-
- List<String> tags = new ArrayList<>();
- tags.add(vspName);
- ResourceReqDetails resourceDetails = new ResourceReqDetails();
- resourceDetails.setCsarUUID(vendorSoftwareProductObject.getVspId());
- resourceDetails.setCsarVersion("1.0");
- resourceDetails.setName(vspName);
- resourceDetails.setTags(tags);
- resourceDetails.setDescription(vendorSoftwareProductObject.getDescription());
- resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory());
- resourceDetails.setVendorName(vendorSoftwareProductObject.getVendorName());
- resourceDetails.setVendorRelease("1.0");
- resourceDetails.setResourceType("VF");
- resourceDetails.setResourceVendorModelNumber("666");
- resourceDetails.setContactId(vendorSoftwareProductObject.getAttContact());
- resourceDetails.setIcon("defaulticon");
-
- return resourceDetails;
- }
+// public static ResourceReqDetails prepareOnboardedResourceDetailsBeforeCreate(ResourceReqDetails resourceDetails, VendorSoftwareProductObject vendorSoftwareProductObject) {
+//
+// List<String> tags = new ArrayList<>();
+// tags.add(vendorSoftwareProductObject.getName());
+//// ResourceReqDetails resourceDetails = new ResourceReqDetails();
+// resourceDetails.setCsarUUID(vendorSoftwareProductObject.getVspId());
+// resourceDetails.setCsarVersion(vendorSoftwareProductObject.getVersion());
+// resourceDetails.setName(vendorSoftwareProductObject.getName());
+// resourceDetails.setTags(tags);
+// resourceDetails.setDescription(vendorSoftwareProductObject.getDescription());
+//// resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory());
+// resourceDetails.setVendorName(vendorSoftwareProductObject.getVendorName());
+//// resourceDetails.setVendorRelease("1.0");
+// resourceDetails.setResourceType("VF");
+// resourceDetails.setResourceVendorModelNumber("666");
+// resourceDetails.setContactId(vendorSoftwareProductObject.getAttContact());
+//// resourceDetails.setIcon("defaulticon");
+//
+// return resourceDetails;
+// }
- public static ServiceReqDetails prepareServiceDetailsBeforeCreate(User user) {
+ /*public static ServiceReqDetails prepareServiceDetailsBeforeCreate(ServiceReqDetails serviceDetails, User user) {
- ServiceReqDetails serviceDetails = ElementFactory.getDefaultService(ServiceCategoriesEnum.NETWORK_L4, user);
serviceDetails.setServiceType("MyServiceType");
serviceDetails.setServiceRole("MyServiceRole");
serviceDetails.setNamingPolicy("MyServiceNamingPolicy");
- serviceDetails.setEcompGeneratedNaming(false);
+ serviceDetails.setEcompGeneratedNaming(true);
return serviceDetails;
- }
+ }*/
}
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
deleted file mode 100644
index b4f834a421..0000000000
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java
+++ /dev/null
@@ -1,814 +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.utilities;
-
-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.DataTestIdEnum;
-import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
-import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
-import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
-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.execute.setup.ArtifactsCorrelationManager;
-import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
-import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
-import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
-import org.openecomp.sdc.ci.tests.pages.HomePage;
-import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
-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.testng.Assert;
-
-import com.aventstack.extentreports.Status;
-import com.clearspring.analytics.util.Pair;
-
-public class OnboardingUtils {
-
- protected static List<String> exludeVnfList = Arrays.asList("2016-197_vscp_vscp-fw_1610_e2e.zip", "2016-281_vProbes_BE_11_1_f_30_1610_e2e.zip",
- "2016-282_vProbes_FE_11_1_f_30_1610_e2e.zip", "2016-044_vfw_fnat_30_1607_e2e.zip", "2017-376_vMOG_11_1.zip", "vMOG.zip",
- "vMRF_USP_AIC3.0_1702.zip", "2016-211_vprobesbe_vprobes_be_30_1610_e2e.zip", "2016-005_vprobesfe_vprobes_fe_30_1607_e2e.zip",
- "vMRF_RTT.zip", "2016-006_vvm_vvm_30_1607_e2e.zip", "2016-001_vvm_vvm_30_1607_e2e.zip");
-
- public OnboardingUtils() {
- }
-
- public static Pair<String, Map<String, String>> createVendorSoftwareProduct(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers)
- throws Exception {
- Pair<String, Map<String, String>> pair = createVSP(HeatFileName, filepath, user, amdocsLicenseMembers);
-
- String vspid = pair.right.get("vspId");
-
- prepareVspForUse(user, vspid);
-
- return pair;
- }
-
- public static void prepareVspForUse(User user, String vspid) throws Exception {
- RestResponse checkin = checkinVendorSoftwareProduct(vspid, user);
- assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue());
-
- RestResponse submit = submitVendorSoftwareProduct(vspid, user);
- assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue());
-
- RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspid, user);
- assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue());
-
- SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor software product");
- }
-
- public static Pair<String, Map<String, String>> 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<RestResponse, Map<String, String>> 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");
- String componentId = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "componentId");
-
- Map<String, String> vspMeta = createNewVspPair.right;
- Map<String, String> vspObject = new HashMap<String, String>();
- Iterator<String> iterator = vspMeta.keySet().iterator();
- while(iterator.hasNext()){
- Object key = iterator.next();
- Object value = vspMeta.get(key);
- vspObject.put(key.toString(), value.toString());
- }
- vspObject.put("vspId", vspid);
- vspObject.put("componentId", componentId);
- vspObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName());
- vspObject.put("attContact", user.getUserId());
-
- RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspid, user);
- assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue());
-
- RestResponse validateUpload = validateUpload(vspid, user);
- assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue());
-
- Pair<String, Map<String, String>> pair = new Pair<String, Map<String, String>>(vspName, vspObject);
-
- return pair;
- }
-
- public static void updateVspWithVfcArtifacts(String filepath, String vspId, String updatedSnmpPoll, String updatedSnmpTrap, String componentId, User user) throws Exception{
- RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user);
- assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue());
- ExtentTestActions.log(Status.INFO, "Deleting SNMP POLL");
- deleteSnmpArtifact(componentId, vspId, user, SnmpTypeEnum.SNMP_POLL);
- ExtentTestActions.log(Status.INFO, "Deleting SNMP TRAP");
- deleteSnmpArtifact(componentId, vspId, user, SnmpTypeEnum.SNMP_TRAP);
- addVFCArtifacts(filepath, updatedSnmpPoll, updatedSnmpTrap, vspId, user, componentId);
- prepareVspForUse(user, vspId);
- }
-
- public static String updateVendorSoftwareProduct(String vspId, String HeatFileName, String filepath, User user)
- throws Exception, Throwable {
- String vspName = handleFilename(HeatFileName);
- SetupCDTest.getExtendTest().log(Status.INFO, "Starting to update the vendor software product");
-
- RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user);
- assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue());
-
- RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspId, user);
- assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue());
-
- RestResponse validateUpload = validateUpload(vspId, user);
- assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue());
-
- RestResponse checkin = checkinVendorSoftwareProduct(vspId, user);
- assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue());
-
-
- RestResponse submit = submitVendorSoftwareProduct(vspId, user);
- assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue());
-
- RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspId, user);
- assertEquals("did not succeed to update package of VSP ", 200, createPackage.getErrorCode().intValue());
-
- SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in updating the vendor software product");
-
- return vspName;
- }
-
- public static String handleFilename(String heatFileName) {
- final String namePrefix = "ciVFOnboarded-";
- final String nameSuffix = "-" + getShortUUID();
-
- String subHeatFileName = heatFileName.substring(0, heatFileName.lastIndexOf("."));
-
- if ((namePrefix + subHeatFileName + nameSuffix).length() >= 50) {
- subHeatFileName = subHeatFileName.substring(0, 50 - namePrefix.length() - nameSuffix.length());
- }
-
- if (subHeatFileName.contains("(") || subHeatFileName.contains(")")) {
- subHeatFileName = subHeatFileName.replace("(", "-");
- subHeatFileName = subHeatFileName.replace(")", "-");
- }
-
- String vnfName = namePrefix + subHeatFileName + nameSuffix;
- return vnfName;
- }
-
- public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user, String vspComponentId) throws Exception{
- vspComponentId = (vspComponentId == null) ? getVSPComponentId(vspid, user) : vspComponentId;
- if (vspComponentId != null){
- if (snmpPoll != null){
- ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP POLL with the file " + snmpPoll);
- RestResponse uploadSnmpPollArtifact = uploadSnmpPollArtifact(filepath, snmpPoll, vspid, user, vspComponentId);
- assertEquals("Did not succeed to add SNMP POLL", 200, uploadSnmpPollArtifact.getErrorCode().intValue());
- }
- if (snmpTrap != null){
- ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP TRAP with the file " + snmpTrap);
- RestResponse uploadSnmpTrapArtifact = uploadSnmpTrapArtifact(filepath, snmpTrap, vspid, user, vspComponentId);
- assertEquals("Did not succeed to add SNMP TRAP", 200, uploadSnmpTrapArtifact.getErrorCode().intValue());
- }
- }
-
- return vspComponentId;
- }
-
- public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user) throws Exception{
- return addVFCArtifacts(filepath, snmpPoll, snmpTrap, vspid, user, null);
- }
-
- private static RestResponse uploadSnmpPollArtifact(String filepath, String zipArtifact, String vspid, User user,
- String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException {
- Config config = Utils.getConfig();
- String snmpPollUrl = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/snmp/upload",
- config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId);
- return uploadFile(filepath, zipArtifact, snmpPollUrl, user);
- }
-
- private static RestResponse uploadSnmpTrapArtifact(String filepath, String zipArtifact, String vspid, User user,
- String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException {
- Config config = Utils.getConfig();
- String snmpTrapUrl = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/snmp-trap/upload",
- config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId);
- return uploadFile(filepath, zipArtifact, snmpTrapUrl, user);
- }
-
- private static RestResponse deleteSnmpArtifact(String componentId, String vspId, User user, SnmpTypeEnum snmpType) throws Exception
- {
- Config config = Utils.getConfig();
- String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/%s",
- config.getCatalogBeHost(),config.getCatalogBePort(), vspId, componentId, snmpType.getValue());
- String userId = user.getUserId();
-
- Map<String, String> headersMap = prepareHeadersMap(userId);
-
- HttpRequest http = new HttpRequest();
- RestResponse response = http.httpSendDelete(url, headersMap);
- return response;
- }
-
-
-
- private static String getVSPComponentId(String vspid, User user) throws Exception, JSONException {
- RestResponse components = getVSPComponents(vspid, user);
- String response = components.getResponse();
- Map<String, Object> responseMap = (Map<String, Object>) JSONValue.parse(response);
- JSONArray results = (JSONArray)responseMap.get("results");
- for (Object res : results){
- Map<String, Object> compMap= (Map<String, Object>) JSONValue.parse(res.toString());
- String componentId = compMap.get("id").toString();
- return componentId;
- }
- return null;
- }
-
- private static RestResponse getVSPComponents(String vspid, User user) throws Exception{
- Config config = Utils.getConfig();
- String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components", config.getCatalogBeHost(),config.getCatalogBePort(), vspid);
- String userId = user.getUserId();
-
- Map<String, String> headersMap = prepareHeadersMap(userId);
-
- HttpRequest http = new HttpRequest();
- RestResponse response = http.httpSendGet(url, headersMap);
- return response;
- }
-
- public static AmdocsLicenseMembers createVendorLicense(User user) throws Exception {
-
- AmdocsLicenseMembers amdocsLicenseMembers;
- SetupCDTest.getExtendTest().log(Status.INFO, "Starting to create the vendor license");
- String vendorLicenseName = "ciLicense" + getShortUUID();
- RestResponse vendorLicenseResponse = createVendorLicenseModels_1(vendorLicenseName, user);
- 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());
- 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");
-
- 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());
- String vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(), "value");
-
- RestResponse checkinVendorLicense = checkinVendorLicense(vendorId, user);
- assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue());
-
- RestResponse submitVendorLicense = submitVendorLicense(vendorId, user);
- 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() {
- return UUID.randomUUID().toString().split("-")[0];
- }
-
- private static RestResponse actionOnComponent(String vspid, String action, String onboardComponent, User user)
- throws Exception {
- Config config = Utils.getConfig();
- String url = String.format("http://%s:%s/onboarding-api/v1.0/" + onboardComponent + "/%s/versions/0.1/actions",
- config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
- String userId = user.getUserId();
-
- JSONObject jObject = new JSONObject();
- jObject.put("action", action);
-
- Map<String, String> headersMap = prepareHeadersMap(userId);
-
- HttpRequest http = new HttpRequest();
- RestResponse response = http.httpSendPut(url, jObject.toString(), headersMap);
- return response;
- }
-
- public static RestResponse checkinVendorLicense(String vspid, User user) throws Exception {
- return actionOnComponent(vspid, "Checkin", "vendor-license-models", user);
- }
-
- public static RestResponse submitVendorLicense(String vspid, User user) throws Exception {
- return actionOnComponent(vspid, "Submit", "vendor-license-models", user);
- }
-
- public static RestResponse createVendorLicenseModels_1(String name, User user) throws Exception {
- Config config = Utils.getConfig();
- String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models", config.getCatalogBeHost(),
- config.getCatalogBePort());
- String userId = user.getUserId();
-
- JSONObject jObject = new JSONObject();
- jObject.put("vendorName", name);
- jObject.put("description", "new vendor license model");
- jObject.put("iconRef", "icon");
-
- Map<String, String> headersMap = prepareHeadersMap(userId);
-
- HttpRequest http = new HttpRequest();
- RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap);
- return response;
-
- }
-
- public static RestResponse createVendorLicenseAgreement_5(String vspid, String featureGroupId, User user)
- throws Exception {
- Config config = Utils.getConfig();
- String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-agreements",
- config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
- String userId = user.getUserId();
-
- JSONObject licenseTermpObject = new JSONObject();
- licenseTermpObject.put("choice", "Fixed_Term");
- licenseTermpObject.put("other", "");
-
- JSONObject jObjectBody = new JSONObject();
- jObjectBody.put("name", "abc");
- jObjectBody.put("description", "new vendor license agreement");
- jObjectBody.put("requirementsAndConstrains", "abc");
- jObjectBody.put("licenseTerm", licenseTermpObject);
- jObjectBody.put("addedFeatureGroupsIds", Arrays.asList(featureGroupId).toArray());
-
- Map<String, String> headersMap = prepareHeadersMap(userId);
-
- HttpRequest http = new HttpRequest();
- RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap);
- return response;
- }
-
- public static RestResponse createVendorLicenseFeatureGroups_4(String vspid, String licenseKeyGroupId,
- String entitlementPoolId, User user) throws Exception {
- Config config = Utils.getConfig();
- String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/feature-groups",
- config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
- String userId = user.getUserId();
-
- JSONObject jObject = new JSONObject();
- jObject.put("name", "xyz");
- jObject.put("description", "new vendor license feature groups");
- jObject.put("partNumber", "123abc456");
- jObject.put("manufacturerReferenceNumber", "5");
- jObject.put("addedLicenseKeyGroupsIds", Arrays.asList(licenseKeyGroupId).toArray());
- jObject.put("addedEntitlementPoolsIds", Arrays.asList(entitlementPoolId).toArray());
-
- Map<String, String> headersMap = prepareHeadersMap(userId);
-
- HttpRequest http = new HttpRequest();
- RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap);
- return response;
-
- }
-
- public static RestResponse createVendorEntitlementPool_3(String vspid, User user) throws Exception {
- Config config = Utils.getConfig();
- String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/entitlement-pools",
- config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
- String userId = user.getUserId();
-
- JSONObject jEntitlementMetricObject = new JSONObject();
- jEntitlementMetricObject.put("choice", "CPU");
- jEntitlementMetricObject.put("other", "");
-
- JSONObject jAggregationFunctionObject = new JSONObject();
- jAggregationFunctionObject.put("choice", "Peak");
- jAggregationFunctionObject.put("other", "");
-
- JSONObject jOperationalScope = new JSONObject();
- jOperationalScope.put("choices", Arrays.asList("Availability_Zone").toArray());
- jOperationalScope.put("other", "");
-
- JSONObject jTimeObject = new JSONObject();
- jTimeObject.put("choice", "Hour");
- jTimeObject.put("other", "");
-
- JSONObject jObjectBody = new JSONObject();
- jObjectBody.put("name", "def"+ getShortUUID());
- jObjectBody.put("description", "new vendor license entitlement pool");
- jObjectBody.put("thresholdValue", "23");
- jObjectBody.put("thresholdUnits", "Absolute");
- jObjectBody.put("entitlementMetric", jEntitlementMetricObject);
- jObjectBody.put("increments", "abcd");
- jObjectBody.put("aggregationFunction", jAggregationFunctionObject);
- jObjectBody.put("operationalScope", jOperationalScope);
- jObjectBody.put("time", jTimeObject);
- jObjectBody.put("manufacturerReferenceNumber", "123aaa");
-
- Map<String, String> headersMap = prepareHeadersMap(userId);
-
- HttpRequest http = new HttpRequest();
- RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap);
- return response;
- }
-
- public static RestResponse createVendorKeyGroups_2(String vspid, User user) throws Exception {
- Config config = Utils.getConfig();
- String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-key-groups",
- config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
- String userId = user.getUserId();
-
- JSONObject jOperationalScope = new JSONObject();
- jOperationalScope.put("choices", Arrays.asList("Tenant").toArray());
- jOperationalScope.put("other", "");
-
- JSONObject jObjectBody = new JSONObject();
- jObjectBody.put("name", "keyGroup" + getShortUUID());
- jObjectBody.put("description", "new vendor license key group");
- jObjectBody.put("operationalScope", jOperationalScope);
- jObjectBody.put("type", "Universal");
-
- Map<String, String> headersMap = prepareHeadersMap(userId);
-
- HttpRequest http = new HttpRequest();
- RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap);
- return response;
- }
-
- public static Pair<RestResponse, Map<String, String>> createNewVendorSoftwareProduct(String name, AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception {
- Map<String, String> vspMetadta = new HashMap<String, String>();
-
- Config config = Utils.getConfig();
- String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products",
- config.getCatalogBeHost(), config.getCatalogBePort());
-
- String userId = user.getUserId();
-
- JSONObject jlicensingDataObj = new JSONObject();
- jlicensingDataObj.put("licenseAgreement", amdocsLicenseMembers.getVendorLicenseAgreementId());
- jlicensingDataObj.put("featureGroups", Arrays.asList(amdocsLicenseMembers.getFeatureGroupId()).toArray());
-
- JSONObject jlicensingVersionObj = new JSONObject();
- jlicensingVersionObj.put("id", "1.0");
- jlicensingVersionObj.put("label", "1.0");
-
- JSONObject jObject = new JSONObject();
- jObject.put("name", name);
- jObject.put("description", "new VSP description");
- jObject.put("category", "resourceNewCategory.generic");
- jObject.put("subCategory", "resourceNewCategory.generic.database");
- jObject.put("onboardingMethod", "HEAT");
- jObject.put("licensingVersion", jlicensingVersionObj);
- jObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName());
- jObject.put("vendorId", amdocsLicenseMembers.getVendorId());
- jObject.put("icon", "icon");
- jObject.put("licensingData", jlicensingDataObj);
-
- vspMetadta.put("description", jObject.getString("description"));
- vspMetadta.put("category", jObject.getString("category"));
- vspMetadta.put("subCategory", jObject.getString("subCategory").split("\\.")[2]);
-
- Map<String, String> headersMap = prepareHeadersMap(userId);
- HttpRequest http = new HttpRequest();
-
- RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap);
- return new Pair<RestResponse, Map<String, String>>(response, vspMetadta);
- }
-
- public static RestResponse validateUpload(String vspid, User user) throws Exception {
- Config config = Utils.getConfig();
- String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/orchestration-template-candidate/process",
- config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
-
- String userId = user.getUserId();
-
- Map<String, String> headersMap = prepareHeadersMap(userId);
- HttpRequest http = new HttpRequest();
-
- String body =null;
-
- RestResponse response = http.httpSendPut(url, body, headersMap);
-
- return response;
- }
-
- public static RestResponse uploadHeatPackage(String filepath, String filename, String vspid, User user) throws Exception {
- Config config = Utils.getConfig();
- String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/orchestration-template-candidate", config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
- return uploadFile(filepath, filename, url, user);
- }
-
- private static RestResponse uploadFile(String filepath, String filename, String url, User user)
- throws FileNotFoundException, IOException, ClientProtocolException {
- CloseableHttpResponse response = null;
-
- MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create();
- mpBuilder.addPart("upload", new FileBody(getTestZipFile(filepath, filename)));
-
- Map<String, String> headersMap = prepareHeadersMap(user.getUserId());
- headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "multipart/form-data");
-
- CloseableHttpClient client = HttpClients.createDefault();
- try {
- HttpPost httpPost = new HttpPost(url);
- RestResponse restResponse = new RestResponse();
-
- Iterator<String> iterator = headersMap.keySet().iterator();
- while (iterator.hasNext()) {
- String key = iterator.next();
- String value = headersMap.get(key);
- httpPost.addHeader(key, value);
- }
- httpPost.setEntity(mpBuilder.build());
- response = client.execute(httpPost);
- HttpEntity entity = response.getEntity();
- String responseBody = null;
- if (entity != null) {
- InputStream instream = entity.getContent();
- StringWriter writer = new StringWriter();
- IOUtils.copy(instream, writer);
- responseBody = writer.toString();
- try {
-
- } finally {
- instream.close();
- }
- }
-
- restResponse.setErrorCode(response.getStatusLine().getStatusCode());
- restResponse.setResponse(responseBody);
-
- return restResponse;
-
- } finally {
- closeResponse(response);
- closeHttpClient(client);
-
- }
- }
-
- private static void closeResponse(CloseableHttpResponse response) {
- try {
- if (response != null) {
- response.close();
- }
- } catch (IOException e) {
- System.out.println(String.format("failed to close client or response: %s", e.getMessage()));
- }
- }
-
- private static void closeHttpClient(CloseableHttpClient client) {
- try {
- if (client != null) {
- client.close();
- }
- } catch (IOException e) {
- System.out.println(String.format("failed to close client or response: %s", e.getMessage()));
- }
- }
-
- private static File getTestZipFile(String filepath, String filename) throws IOException {
- Config config = Utils.getConfig();
- String sourceDir = config.getImportResourceTestsConfigDir();
- java.nio.file.Path filePath = FileSystems.getDefault().getPath(filepath + File.separator + filename);
- return filePath.toFile();
- }
-
- public static RestResponse checkinVendorSoftwareProduct(String vspid, User user) throws Exception {
- return actionOnComponent(vspid, "Checkin", "vendor-software-products", user);
- }
-
- private static RestResponse checkoutVendorSoftwareProduct(String vspid, User user) throws Exception {
- return actionOnComponent(vspid, "Checkout", "vendor-software-products", user);
- }
-
- public static RestResponse submitVendorSoftwareProduct(String vspid, User user) throws Exception {
- return actionOnComponent(vspid, "Submit", "vendor-software-products", user);
- }
-
- public static RestResponse createPackageOfVendorSoftwareProduct(String vspid, User user) throws Exception {
- return actionOnComponent(vspid, "Create_Package", "vendor-software-products", user);
- }
-
- protected static Map<String, String> prepareHeadersMap(String userId) {
- Map<String, String> headersMap = new HashMap<String, String>();
- headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json");
- headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json");
- headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId);
- return headersMap;
- }
-
-
- private static void importUpdateVSP(Pair<String, Map<String, String>> vsp, boolean isUpdate) throws Exception{
- String vspName = vsp.left;
- Map<String, String> vspMetadata = vsp.right;
- boolean vspFound = HomePage.searchForVSP(vspName);
-
- if (vspFound){
-
- List<WebElement> elemenetsFromTable = HomePage.getElemenetsFromTable();
-// WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30);
-// WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1)));
-// findElement.click();
- elemenetsFromTable.get(1).click();
- GeneralUIUtils.waitForLoader();
-
- if (isUpdate){
- GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.UPDATE_VSP.getValue());
-
- }
- else{
- GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.IMPORT_VSP.getValue());
- }
-
- String lifeCycleState = ResourceGeneralPage.getLifeCycleState();
- boolean needCheckout = lifeCycleState.equals(LifeCycleStateEnum.CHECKIN.getValue()) || lifeCycleState.equals(LifeCycleStateEnum.CERTIFIED.getValue());
- if (needCheckout)
- {
- try {
- ResourceGeneralPage.clickCheckoutButton();
- Assert.assertTrue(ResourceGeneralPage.getLifeCycleState().equals(LifeCycleStateEnum.CHECKOUT.getValue()), "Did not succeed to checkout");
-
- } catch (Exception e) {
- ExtentTestActions.log(Status.ERROR, "Did not succeed to checkout");
- e.printStackTrace();
- }
- GeneralUIUtils.waitForLoader();
- }
-
- //Metadata verification
- VfVerificator.verifyOnboardedVnfMetadata(vspName, vspMetadata);
-
- ExtentTestActions.log(Status.INFO, "Clicking create/update VNF");
- String duration = GeneralUIUtils.getActionDuration(() -> waitUntilVnfCreated());
- ExtentTestActions.log(Status.INFO, "Succeeded in importing/updating " + vspName, duration);
- }
- else{
- Assert.fail("Did not find VSP named " + vspName);
- }
- }
-
- private static void waitUntilVnfCreated() {
- GeneralUIUtils.clickOnElementByTestIdWithoutWait(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue());
- GeneralUIUtils.waitForLoader(60*10);
- GeneralUIUtils.waitForAngular();
- GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue());
- }
-
- public static void updateVSP(Pair<String, Map<String, String>> vsp) throws Exception{
- ExtentTestActions.log(Status.INFO, "Updating VSP " + vsp.left);
- importUpdateVSP(vsp, true);
- }
-
- public static void importVSP(Pair<String, Map<String, String>> vsp) throws Exception{
- ExtentTestActions.log(Status.INFO, "Importing VSP " + vsp.left);
- importUpdateVSP(vsp, false);
- }
-
- public static void updateVnfAndValidate(String filepath, Pair<String, Map<String, String>> vsp, String updatedVnfFile, User user) throws Exception, Throwable {
- ExtentTestActions.log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile));
- System.out.println(String.format("Going to update the VNF with %s......", updatedVnfFile));
-
- Map<String, String> vspMap = vsp.right;
- String vspId = vspMap.get("vspId");
-
- updateVendorSoftwareProduct(vspId, updatedVnfFile, filepath, user);
- HomePage.showVspRepository();
- updateVSP(vsp);
- ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
- DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, updatedVnfFile);
- }
-
- public static Pair<String, Map<String, String>> onboardAndValidate(String filepath, String vnfFile, User user) throws Exception {
- 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));
-
- AmdocsLicenseMembers amdocsLicenseMembers = createVendorLicense(user);
- Pair<String, Map<String, String>> createVendorSoftwareProduct = createVendorSoftwareProduct(vnfFile, filepath, user, amdocsLicenseMembers);
- String vspName = createVendorSoftwareProduct.left;
-
- DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId"));
- File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir();
-
- ExtentTestActions.log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
- HomePage.showVspRepository();
- ExtentTestActions.log(Status.INFO,String.format("Going to import %s", vnfFile.substring(0, vnfFile.indexOf("."))));
- importVSP(createVendorSoftwareProduct);
-
- ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
-
- // Verify deployment artifacts
- Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(latestFilefromDir.getAbsolutePath());
-
- LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment"));
- ArtifactsCorrelationManager.addVNFartifactDetails(vspName, deploymentArtifacts);
-
- List<String> heatEnvFilesFromCSAR = deploymentArtifacts.stream().filter(e -> e.getType().equals("HEAT_ENV")).
- map(e -> e.getFileName()).
- collect(Collectors.toList());
-
- validateDeploymentArtifactsVersion(deploymentArtifacts, heatEnvFilesFromCSAR);
-
- DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile);
- return createVendorSoftwareProduct;
- }
-
- public static void validateDeploymentArtifactsVersion(LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts,
- List<String> heatEnvFilesFromCSAR) {
- String artifactVersion;
- String artifactName;
-
- for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) {
- artifactVersion = "1";
-
- if(deploymentArtifact.getType().equals("HEAT_ENV")) {
- continue;
- } else if(deploymentArtifact.getFileName().contains(".")) {
- artifactName = deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf("."));
- } else {
- artifactName = deploymentArtifact.getFileName().trim();
- }
-
- if (heatEnvFilesFromCSAR.contains(artifactName + ".env")){
- artifactVersion = "2";
- }
- ArtifactUIUtils.validateArtifactNameVersionType(artifactName, artifactVersion, deploymentArtifact.getType());
- }
- }
-
-
- /**
- * @return
- * The method returns VNF names list from Files directory under sdc-vnfs repository
- */
- public static List<String> getVnfNamesFileList() {
- String filepath = FileHandling.getVnfRepositoryPath();
- List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
- fileNamesFromFolder.removeAll(exludeVnfList);
- return fileNamesFromFolder;
- }
-
-}
-
- 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/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java
index 62b2f832bd..b1682b34e6 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java
@@ -94,8 +94,8 @@ public class PropertiesUIUtils {
public static void updateProperty(PropertyTypeEnum property) {
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating property: %s", property.name()));
PropertiesPage.clickOnProperty(property.getName());
- PropertiesPage.getPropertyPopup().insertPropertyDescription(property.getDescription());
- PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(property.getValue());
+ PropertiesPage.getPropertyPopup().insertPropertyDescription(property.getUpdateDescription());
+ PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(property.getUpdateValue());
PropertiesPage.getPropertyPopup().clickSave();
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java
index 1eaa626e94..1ce5455dab 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java
@@ -26,9 +26,6 @@ import static org.testng.AssertJUnit.assertTrue;
import java.awt.AWTException;
import java.awt.Robot;
-import java.awt.Toolkit;
-import java.awt.datatransfer.Clipboard;
-import java.awt.datatransfer.StringSelection;
import java.awt.event.KeyEvent;
import java.io.File;
import java.util.Arrays;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java
index b2bad99d2a..aa219d0d12 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java
@@ -32,7 +32,6 @@ import java.util.Map;
import java.util.stream.Collectors;
import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONObject;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.model.Component;
@@ -253,23 +252,26 @@ public class RestCDUtils {
final String userId = defaultAdminUser.getUserId();
List<Component> resourcesArrayList = map.get("products");
- List<String> collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("Ci")).map(e -> e.getUniqueId())
- .collect(Collectors.toList());
+ List<String> collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith(ElementFactory.getProductPrefix())).
+ map(e -> e.getUniqueId()).
+ collect(Collectors.toList());
for (String uId : collect) {
ProductRestUtils.deleteProduct(uId, userId);
}
resourcesArrayList = map.get("services");
- collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")).map(e -> e.getUniqueId())
- .collect(Collectors.toList());
+ collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith(ElementFactory.getServicePrefix())).
+ map(e -> e.getUniqueId()).
+ collect(Collectors.toList());
for (String uId : collect) {
ServiceRestUtils.markServiceToDelete(uId, userId);
}
ServiceRestUtils.deleteMarkedServices(userId);
resourcesArrayList = map.get("resources");
- collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci"))
- .map(e -> e.getUniqueId()).collect(Collectors.toList());
+ collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith(ElementFactory.getResourcePrefix())).
+ map(e -> e.getUniqueId()).
+ collect(Collectors.toList());
for (String uId : collect) {
ResourceRestUtils.markResourceToDelete(uId, userId);
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java
index 25f71eeb0a..da2c7d7cc0 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java
@@ -54,28 +54,16 @@ public class CatalogVerificator {
Map<String, List<Component>> catalogAsMap = RestCDUtils.getCatalogAsMap();
switch (enumtype) {
case RESOURCE:
- return getResourceNumber(catalogAsMap);
+ return catalogAsMap.get("resources").size();
case SERVICE:
- return getServiceNumber(catalogAsMap);
+ return catalogAsMap.get("services").size();
case PRODUCT:
- return getProductsNumber(catalogAsMap);
+ return catalogAsMap.get("products").size();
default:
return getResourceNumber(ResourceTypeEnum.valueOf(enumtype.name()), catalogAsMap);
}
}
- public static int getResourceNumber(Map<String, List<Component>> catalogAsMap) throws Exception {
- return catalogAsMap.get("resources").size();
- }
-
- public static int getServiceNumber(Map<String, List<Component>> catalogAsMap) throws Exception {
- return catalogAsMap.get("services").size();
- }
-
- public static int getProductsNumber(Map<String, List<Component>> catalogAsMap) throws Exception {
- return catalogAsMap.get("products").size();
- }
-
public static void validateType(TypesEnum enumtype) throws Exception{
int numberOfElementsFromBE = getTypeNumber(enumtype);
int numberOfElementsFromUI = getNumberOfElementsFromCatalogHeader();
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/DeploymentViewVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/DeploymentViewVerificator.java
index 0d06d8ef96..8eb2122b3d 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/DeploymentViewVerificator.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/DeploymentViewVerificator.java
@@ -33,6 +33,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
import org.apache.commons.io.FileUtils;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
@@ -46,15 +47,12 @@ import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsTopologyTemplateDef
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
import org.openqa.selenium.WebElement;
-import org.testng.SkipException;
-import org.testng.TestException;
-import org.testng.TestNGException;
import com.aventstack.extentreports.Status;
public class DeploymentViewVerificator {
- private static String[] currentProperties = {"isBase",
+ private static List<String> currentPropertiesForUI = Arrays.asList("isBase",
"vf_module_label",
"vf_module_description",
"min_vf_module_instances",
@@ -63,7 +61,28 @@ public class DeploymentViewVerificator {
"vf_module_type",
"volume_group",
"vfc_list",
- "availability_zone_count"};
+ "availability_zone_count");
+
+ private static List<String> currentPropertiesWithoutIsBaseForFile = Arrays.asList("vf_module_label",
+ "vf_module_description",
+ "min_vf_module_instances",
+ "max_vf_module_instances",
+ "initial_count",
+ "vf_module_type",
+ "volume_group",
+ "vfc_list",
+ "availability_zone_count");
+
+ public static List<String> getCurrentProperties() {
+ return currentPropertiesForUI;
+ }
+
+ public static List<String> getCurrentPropertiesWithoutIsBase() {
+ return currentPropertiesWithoutIsBaseForFile;
+ }
+
+
+ public static final String partToReplace = "_group";
private static Map<String, HashMap<String, List<String>>> deploymentViewData = new HashMap<String, HashMap<String, List<String>>>(){
{
@@ -72,7 +91,7 @@ public class DeploymentViewVerificator {
segw_heat_c3_base = new HashMap<String, List<String>>();
segw_heat_c3_base.put("members", Arrays.asList("segw_internet_security_group", "segw_security_group", "int_layer2vlan_net"));
segw_heat_c3_base.put("artifacts", Arrays.asList("segw_heat_c3_base.yml", "segw_heat_c3_base.env"));
- segw_heat_c3_base.put("properties", Arrays.asList(currentProperties));
+ segw_heat_c3_base.put("properties", currentPropertiesForUI);
put("segw_heat_c3_base", segw_heat_c3_base);
segw_heat_c3_VMs1 = new HashMap<String, List<String>>();
segw_heat_c3_VMs1.put("members", Arrays.asList("segw_oam_protected_0_port",
@@ -88,41 +107,42 @@ public class DeploymentViewVerificator {
"fw_oam_0",
"fw_gn_int_layer2vlan_1_port"));
segw_heat_c3_VMs1.put("artifacts", Arrays.asList("segw_heat_c3_VMs1.yml", "segw_heat_c3_VMs1.env"));
- segw_heat_c3_VMs1.put("properties", Arrays.asList(currentProperties));
+ segw_heat_c3_VMs1.put("properties", currentPropertiesForUI);
put("segw_heat_c3_VMs1", segw_heat_c3_VMs1);
}
};
- private static Map<String, HashMap<String, List<String>>> deploymentViewDataMixedArtefects = new HashMap<String, HashMap<String, List<String>>>(){
+ private static Map<String, HashMap<String, List<String>>> deploymentViewDataMixedArtifacts = new HashMap<String, HashMap<String, List<String>>>(){
{
HashMap<String, List<String>> module_1_ldsa, module_2_ldsa, base_ldsa;
module_1_ldsa = new HashMap<String, List<String>>();
- module_1_ldsa.put("members", new ArrayList(Arrays.asList("ltm_oam_protected_0_port", "ltm_dmz_direct_0_port", "ltm_server_0")));
- module_1_ldsa.put("artifacts", new ArrayList(Arrays.asList("module_1_ldsa.yaml", "module_1_ldsa.env", "base_ldsa.33.yaml", "module_1_ldsa.11.yaml")));
- module_1_ldsa.put("properties", new ArrayList(Arrays.asList(currentProperties)));
+ module_1_ldsa.put("members", Stream.of("ltm_oam_protected_0_port", "ltm_dmz_direct_0_port", "ltm_server_0").collect(Collectors.toList()));
+ module_1_ldsa.put("artifacts", Stream.of("module_1_ldsa.yaml", "module_1_ldsa.env", "base_ldsa.33.yaml", "module_1_ldsa.11.yaml").collect(Collectors.toList()));
+ module_1_ldsa.put("properties", currentPropertiesForUI);
put("module_1_ldsa", module_1_ldsa);
module_2_ldsa = new HashMap<String, List<String>>();
- module_2_ldsa.put("members", new ArrayList(Arrays.asList("ltm_server_0")));
- module_2_ldsa.put("artifacts", new ArrayList(Arrays.asList("module_2_ldsa.yaml", "module_2_ldsa.env", "base_ldsa.3.yaml", "module_2_ldsa.22.yaml")));
- module_2_ldsa.put("properties", new ArrayList(Arrays.asList(currentProperties)));
+ module_2_ldsa.put("members", Stream.of("ltm_server_0").collect(Collectors.toList()));
+ module_2_ldsa.put("artifacts", Stream.of("module_2_ldsa.yaml", "module_2_ldsa.env", "base_ldsa.3.yaml", "module_2_ldsa.22.yaml").collect(Collectors.toList()));
+ module_2_ldsa.put("properties", currentPropertiesForUI);
put("module_2_ldsa", module_2_ldsa);
base_ldsa = new HashMap<String, List<String>>();
- base_ldsa.put("members", new ArrayList(Arrays.asList("ldsa_sec_grp_1")));
- base_ldsa.put("artifacts", new ArrayList(Arrays.asList("base_ldsa.yaml", "module_2_ldsa.2.yaml", "module_1_ldsa.1.yaml")));
- base_ldsa.put("properties", new ArrayList(Arrays.asList(currentProperties)));
+ base_ldsa.put("members", Stream.of("ldsa_sec_grp_1").collect(Collectors.toList()));
+ base_ldsa.put("artifacts", Stream.of("base_ldsa.yaml", "module_2_ldsa.2.yaml", "module_1_ldsa.1.yaml").collect(Collectors.toList()));
+ base_ldsa.put("properties", currentPropertiesForUI);
put("base_ldsa", base_ldsa);
}
};
+
private Map<String, HashMap<String, List<String>>> deploymentViewDataFromFile;
- public DeploymentViewVerificator(String pathToCSAR) throws Exception {
- deploymentViewDataFromFile = getDeploymentViewDataFromCSAR(pathToCSAR);
+ public DeploymentViewVerificator(String pathToCsar) throws Exception {
+ deploymentViewDataFromFile = buildDeploymentViewDataFromCSAR(pathToCsar);
}
public DeploymentViewVerificator() throws Exception {
- deploymentViewDataFromFile = deploymentViewDataMixedArtefects;
+ deploymentViewDataFromFile = deploymentViewDataMixedArtifacts;
}
@@ -141,7 +161,7 @@ public class DeploymentViewVerificator {
File imageFilePath = GeneralUIUtils.takeScreenshot(moduleName + UUID.randomUUID(), SetupCDTest.getScreenshotFolder(), null);
final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
- SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating group %s, should be %s members, %s artefacts " + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath),
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating group %s, should be %s members, %s artifacts " + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath),
moduleName, moduleProperties.get("members").size(), moduleProperties.get("artifacts").size()));
assertTrue(moduleProperties.get("artifacts").size() == artifacts.size(), "Artifacts amount not as expected, expected " + moduleProperties.get("artifacts").size());
@@ -183,52 +203,47 @@ public class DeploymentViewVerificator {
return getDeploymentViewDataFromFile();
}
- public static Map<String, HashMap<String, List<String>>> buildDeploymentViewDataFromCSAR(String pathToCSAR, File mainServiceTemplate) throws Exception{
- ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(mainServiceTemplate);
+ public static Map<String, HashMap<String, List<String>>> buildDeploymentViewDataFromCSAR(String pathToCSAR) throws Exception{
+ ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(pathToCSAR));
Map<String, HashMap<String, List<String>>> deploymentViewDataFromFile = new HashMap<String, HashMap<String, List<String>>>();
Map<String, ToscaGroupsTopologyTemplateDefinition> groups = toscaDefinition.getTopology_template().getGroups();
List<String> keyList = groups.keySet().stream().collect(Collectors.toList());
- HashMap<String, List<String>> groupsToArtefacts = getDeploymentArtefactsMapedToGroupsFromCSAR(pathToCSAR);
+ HashMap<String, List<String>> groupsToArtifacts = getDeploymentArtifactsMappedToGroupsFromCSAR(pathToCSAR);
for(String groupKey: keyList){
HashMap<String, List<String>> tempGroupMap = new HashMap<String, List<String>>();
- tempGroupMap.put("artifacts", groupsToArtefacts.get(groupKey));
+ tempGroupMap.put("artifacts", groupsToArtifacts.get(convertAmdocsCsarGroupNameToSdcCsarGroupName(groupKey)));
if (groups.get(groupKey).getMembers() == null){
tempGroupMap.put("members", Arrays.asList());
} else {
tempGroupMap.put("members", groups.get(groupKey).getMembers());
}
- tempGroupMap.put("properties", Arrays.asList(currentProperties));
- deploymentViewDataFromFile.put(groupKey, tempGroupMap);
+ tempGroupMap.put("properties", currentPropertiesForUI);
+ deploymentViewDataFromFile.put(convertAmdocsCsarGroupNameToSdcCsarGroupName(groupKey), tempGroupMap);
}
return deploymentViewDataFromFile;
}
- public static HashMap<String, List<String>> getDeploymentArtefactsMapedToGroupsFromCSAR(String pathToFile) throws Exception {
+ public static HashMap<String, List<String>> getDeploymentArtifactsMappedToGroupsFromCSAR(String pathToFile) throws Exception {
Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(pathToFile);
LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment"));
+
HashMap<String, List<String>> tempGroupMap = new HashMap<String, List<String>>();
for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) {
String groupName = deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().indexOf("."));
- if(deploymentArtifact.getType().equals("HEAT")) {
- tempGroupMap.put(groupName, new ArrayList(Arrays.asList(deploymentArtifact.getFileName().trim())));
+ if(deploymentArtifact.getType().equals("HEAT") || deploymentArtifact.getType().equals("HEAT_NET") || deploymentArtifact.getType().equals("HEAT_VOL")) {
+ List<String> list = new ArrayList<>();
+ list.add(deploymentArtifact.getFileName().trim());
+ tempGroupMap.put(groupName, list);
} else {
// update current key
- tempGroupMap.get(groupName).add(deploymentArtifact.getFileName().trim());
- tempGroupMap.put(groupName, tempGroupMap.get(groupName));
+ List<String> list = tempGroupMap.get(groupName);
+ list.add(deploymentArtifact.getFileName().trim());
+ tempGroupMap.put(groupName, list);
}
}
return tempGroupMap;
}
- public static Map<String, HashMap<String, List<String>>> getDeploymentViewDataFromCSAR(String pathToCsar) throws Exception {
- String outputFolder = unzipCsarFile(pathToCsar);
-
- File pathToMainServiceTemplate = new File(outputFolder + File.separator + "Definitions" + File.separator + "MainServiceTemplate.yaml");
- Map<String, HashMap<String, List<String>>> deploymentViewData = buildDeploymentViewDataFromCSAR(pathToCsar, pathToMainServiceTemplate);
- cleanFolders(outputFolder);
-
- return deploymentViewData;
- }
public static void cleanFolders(String outputFolder) throws IOException {
System.gc();
@@ -240,7 +255,7 @@ public class DeploymentViewVerificator {
File csarFile = new File(pathToCsar);
- File dir = new File(csarFile.getParent() + File.separator + "output"+UUID.randomUUID() + File.separator + UUID.randomUUID());
+ File dir = new File(csarFile.getParent() + File.separator + "output"+ UUID.randomUUID() + File.separator + UUID.randomUUID());
if(!dir.exists()) {
dir.mkdirs();
}
@@ -322,6 +337,10 @@ public class DeploymentViewVerificator {
}
}
+ public static String convertAmdocsCsarGroupNameToSdcCsarGroupName(String originalString){
+ return originalString.replace(partToReplace, "");
+ }
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ErrorMessageUIVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ErrorMessageUIVerificator.java
index f53bfa4e07..9af0f19c02 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ErrorMessageUIVerificator.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ErrorMessageUIVerificator.java
@@ -48,7 +48,8 @@ public class ErrorMessageUIVerificator {
public static void validateErrorMessage(ActionStatus errorMessage) {
String errorMessageBox = null;
try{
- errorMessageBox = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+// errorMessageBox = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ errorMessageBox = GeneralUIUtils.getWebElementByClassName("error-message-component").getText();
}
catch(Exception e){
ExtentTestActions.log(Status.INFO, "Did not find an error message popup.");
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/PropertyVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/PropertyVerificator.java
new file mode 100644
index 0000000000..c7b18c7fcc
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/PropertyVerificator.java
@@ -0,0 +1,18 @@
+package org.openecomp.sdc.ci.tests.verificator;
+
+import static org.testng.Assert.assertTrue;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+public class PropertyVerificator {
+
+
+ public static void validateEditVFCPropertiesPopoverFields(PropertyTypeEnum propertyType){
+ String propertyValue = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_VALUE.getValue()).getAttribute("value");
+ String propertyDescription = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_DESCRIPTION.getValue()).getAttribute("value");
+ assertTrue(propertyType.getUpdateValue().equals(propertyValue), String.format("Property Value of type %s. Expected: %s, Actual: %s ", propertyType.getType().toString(), propertyType.getUpdateValue(), propertyValue));
+ assertTrue(propertyType.getUpdateDescription().equals(propertyDescription), String.format("Property Description of type %s. Expected: %s, Actual: %s ", propertyType.getType().toString(), propertyType.getUpdateDescription(), propertyDescription));
+ }
+} \ No newline at end of file
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java
index 4035ef9243..90861cacd5 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java
@@ -25,13 +25,10 @@ import static org.testng.Assert.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.function.Predicate;
-import java.util.stream.Collector;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
@@ -60,7 +57,6 @@ import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
-import org.testng.SkipException;
import com.aventstack.extentreports.Status;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ToscaValidation.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ToscaValidation.java
index 5afb94fda1..922c6e4a03 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ToscaValidation.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ToscaValidation.java
@@ -1,12 +1,17 @@
package org.openecomp.sdc.ci.tests.verificator;
+import java.lang.reflect.Field;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaInputsTopologyTemplateDefinition;
+import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
import org.openecomp.sdc.toscaparser.api.elements.Metadata;
+import org.openecomp.sdc.toscaparser.api.parameters.Input;
import com.aventstack.extentreports.Status;
@@ -16,8 +21,8 @@ public class ToscaValidation {
/**
- * @param expectedToscaDefinition
- * @param actualToscaDefinition
+ * @param expectedToscaDefinition - expected toscaDefinition object
+ * @param actualToscaDefinition - actual toscaDefinition object
* @return true if all validation success else return error map
*/
public static Either<Boolean, Map<String, Object>> resourceToscaMetadataValidator(ToscaDefinition expectedToscaDefinition, ToscaDefinition actualToscaDefinition){
@@ -25,7 +30,7 @@ public class ToscaValidation {
SetupCDTest.getExtendTest().log(Status.INFO, "Going to validate resource TOSCA metadata...");
Map<String, String> expectedMetadata = expectedToscaDefinition.getMetadata();
Map<String, String> actualMetadata = actualToscaDefinition.getMetadata();
- Either<Boolean, Map<String, Object>> resourceToscaMetadataValidator = compareMapData(expectedMetadata, actualMetadata);
+ Either<Boolean, Map<String, Object>> resourceToscaMetadataValidator = compareStringMapData(expectedMetadata, actualMetadata);
if(resourceToscaMetadataValidator.isLeft()){
SetupCDTest.getExtendTest().log(Status.INFO, "Resource TOSCA metadata verification success");
}else{
@@ -37,7 +42,7 @@ public class ToscaValidation {
public static Boolean resourceToscaNodeTemplateMetadataValidator(Map<String, Map<String, String>> expectedMetadata, ToscaDefinition actualToscaDefinition){
boolean isTestFailed = true;
for(String nodeTemplateName : expectedMetadata.keySet()){
- Either<Boolean,Map<String,Object>> serviceToscaMetadataValidator = componentToscaNodeTemplateMetadataValidator(expectedMetadata.get(nodeTemplateName), actualToscaDefinition, nodeTemplateName, ComponentTypeEnum.RESOURCE);
+ Either<Boolean,Map<String,Object>> serviceToscaMetadataValidator = componentToscaNodeTemplateMetadataValidator(expectedMetadata.get(nodeTemplateName), actualToscaDefinition, nodeTemplateName, ComponentTypeEnum.RESOURCE, nodeTemplateName);
if(serviceToscaMetadataValidator.left().value() == false){
isTestFailed = false;
}
@@ -49,7 +54,7 @@ public class ToscaValidation {
SetupCDTest.getExtendTest().log(Status.INFO, "Going to validate service TOSCA metadata...");
Map<String, String> actualMetadata = actualToscaDefinition.getMetadata();
- Either<Boolean,Map<String,Object>> serviceToscaMetadataValidator = compareMapData(expectedMetadata, actualMetadata);
+ Either<Boolean,Map<String,Object>> serviceToscaMetadataValidator = compareStringMapData(expectedMetadata, actualMetadata);
if(serviceToscaMetadataValidator.isLeft()){
SetupCDTest.getExtendTest().log(Status.INFO, "Service TOSCA metadata verification success");
}else{
@@ -58,15 +63,15 @@ public class ToscaValidation {
return serviceToscaMetadataValidator;
}
- public static Either<Boolean, Map<String, Object>> componentToscaNodeTemplateMetadataValidator(Map<String, String> expectedMetadata, ToscaDefinition actualToscaDefinition, String nodeTemplateName, ComponentTypeEnum componentType){
+ public static Either<Boolean, Map<String, Object>> componentToscaNodeTemplateMetadataValidator(Map<String, String> expectedMetadata, ToscaDefinition actualToscaDefinition, String nodeTemplateName, ComponentTypeEnum componentType, String componentName){
- SetupCDTest.getExtendTest().log(Status.INFO, "Going to validate "+ componentType.getValue() + " node template TOSCA metadata...");
+ SetupCDTest.getExtendTest().log(Status.INFO, "Going to validate "+ componentName + " " + componentType.getValue() + " node template TOSCA metadata...");
Map<String, String> actualMetadata = actualToscaDefinition.getTopology_template().getNode_templates().get(nodeTemplateName).getMetadata();
- Either<Boolean,Map<String,Object>> componentToscaMetadataValidator = compareMapData(expectedMetadata, actualMetadata);
+ Either<Boolean,Map<String,Object>> componentToscaMetadataValidator = compareStringMapData(expectedMetadata, actualMetadata);
if(componentToscaMetadataValidator.isLeft()){
- SetupCDTest.getExtendTest().log(Status.INFO, componentType.getValue() + " TOSCA node template metadata verification success");
+ SetupCDTest.getExtendTest().log(Status.INFO, " " + componentName + " " + componentType.getValue() + "TOSCA node template metadata verification success");
}else{
- SetupCDTest.getExtendTest().log(Status.ERROR, componentType.getValue() + " TOSCA node template metadata verification failed" + componentToscaMetadataValidator.right().value().toString());
+ SetupCDTest.getExtendTest().log(Status.ERROR, " " +componentName + " " + componentType.getValue() + "TOSCA node template metadata verification failed" + componentToscaMetadataValidator.right().value().toString());
}
return componentToscaMetadataValidator;
}
@@ -85,16 +90,16 @@ public class ToscaValidation {
}
- public static Either<Boolean, Map<String, Object>> compareMapData(Map<String, String> expectedMetadata, Map<String, String> actualMetadata) {
+ public static Either<Boolean, Map<String, Object>> compareStringMapData(Map<String, String> expectedMetadata, Map<String, String> actualMetadata) {
Either.left(false);
Map<String, Object> errorMap = new HashMap<>();
for(String key : expectedMetadata.keySet()){
- boolean isError = compaireValue(expectedMetadata.get(key), actualMetadata.get(key));
+ boolean isError = compareValue(expectedMetadata.get(key), actualMetadata.get(key));
if(!isError){
errorMap.put("Data key["+key+"]", "expected: " + expectedMetadata.get(key) + ", actual: " + actualMetadata.get(key));
}
}
- if(errorMap != null && !errorMap.isEmpty()){
+ if(!errorMap.isEmpty()){
return Either.right(errorMap);
}
return Either.left(true);
@@ -103,23 +108,182 @@ public class ToscaValidation {
public static Either<Boolean, Map<String, Object>> compareMetadataUsingToscaParser(Map<String, String> expectedMetadata, Metadata actualMetadata) {
Map<String, Object> errorMap = new HashMap<>();
for(String key : expectedMetadata.keySet()){
- boolean isError = compaireValue(expectedMetadata.get(key), actualMetadata.getValue(key));
+ boolean isError = compareValue(expectedMetadata.get(key), actualMetadata.getValue(key));
if(!isError){
errorMap.put("Data key["+key+"]", "expected: " + expectedMetadata.get(key) + ", actual: " + actualMetadata.getValue(key));
}
}
- if(errorMap != null && !errorMap.isEmpty()){
+ if(!errorMap.isEmpty()){
return Either.right(errorMap);
}
return Either.left(true);
}
- private static boolean compaireValue(String expected, String actual) {
+ private static boolean compareValue(String expected, String actual) {
+
+ return expected.equals(actual);
+
+ }
+
+ public static Either<Boolean, Map<String, Object>> toscaInputsValidator(Map<String, ToscaInputsTopologyTemplateDefinition> expectedInputs, Map<String, ToscaInputsTopologyTemplateDefinition> actualInputs){
+
+ SetupCDTest.getExtendTest().log(Status.INFO, "Going to validate TOSCA inputs...");
+ Either<Boolean,Map<String,Object>> toscaInputsValidator = compareInputs(expectedInputs, actualInputs);
+ if(toscaInputsValidator.isLeft()){
+ SetupCDTest.getExtendTest().log(Status.INFO, "TOSCA inputs verification success");
+ }else{
+ SetupCDTest.getExtendTest().log(Status.ERROR, "TOSCA inputs verification failed" + toscaInputsValidator.right().value().toString());
+ }
+
+ if(toscaInputsValidator.right() != null && ! toscaInputsValidator.right().equals("")){
+ return toscaInputsValidator;
+ }
+ return Either.left(true);
+ }
+
+ public static Either<Boolean,Map<String,Object>> compareInputs(Map<String, ToscaInputsTopologyTemplateDefinition> expectedInputs, Map<String, ToscaInputsTopologyTemplateDefinition> actualInputs) {
+
+ Map<String, Object> errorMap = new HashMap<>();
+
+ for (String inputName : expectedInputs.keySet()){
+ if (actualInputs.get(inputName) == null ){
+ errorMap.put("input [" + inputName + "]", " does not exist in TOSCA main yaml");
+ }else{
+ compareInputData(expectedInputs.get(inputName), actualInputs.get(inputName), errorMap);
+ }
+ }
+ if(errorMap != null && !errorMap.isEmpty()){
+ return Either.right(errorMap);
+ }
+ return Either.left(true);
+ }
+
+ public static Either<Boolean, Map<String, Object>> compareInputData(ToscaInputsTopologyTemplateDefinition expectedInputDefinition, ToscaInputsTopologyTemplateDefinition actualInputDefinition, Map<String, Object> errorMap) {
+
+ Field[] declaredFields = expectedInputDefinition.getClass().getDeclaredFields();
+ for (Field field : declaredFields){
+ try {
+ Object expectedValue = field.get(expectedInputDefinition);
+ Object actualValue = field.get(actualInputDefinition);
+// verification exclude fields as (immutable, hidden, constraints, entry_schema) according Renana
+ if(expectedValue != null && expectedValue.toString().trim()!= "" && field.getName() != "name" && field.getName() != "immutable" && field.getName() != "hidden" && field.getName() != "constraints" && field.getName() != "entry_schema" && field.getName() != "required") {
+ if (actualValue != null) {
+ compareInputValue(expectedInputDefinition, errorMap, field, expectedValue, actualValue);
+ } else {
+ errorMap.put("Data field [" + field.getName() + "] in input [" + expectedInputDefinition.getName() + "]", " does not exist in actual object");
+ System.out.println("Data field [" + field.getName() + "] in input [" + expectedInputDefinition.getName() + "] does not exist in actual object");
+ }
+ }
+ }catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
- return expected.equals(actual) ? true : false;
+ if(errorMap != null && !errorMap.isEmpty()){
+ return Either.right(errorMap);
+ }
+ return Either.left(true);
+ }
+
+ public static void compareInputValue(ToscaInputsTopologyTemplateDefinition expectedInputDefinition, Map<String, Object> errorMap, Field field, Object expectedValue, Object actualValue) {
+ if(field.getName() == "value" || field.getName() == "Default"){
+ switch (expectedInputDefinition.getType()) {
+ case "string":
+ if(! expectedValue.toString().replace("\n"," ").replaceAll("( +)", " ").equals(actualValue.toString().replace("\n"," ").replaceAll("( +)", " "))){
+ errorMap.put("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]", "expected: " + expectedValue + ", actual: " + actualValue);
+ System.out.println("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]: expected: " + expectedValue + ", actual: " + actualValue);
+ }
+ break;
+ case "float":
+ float newExpectedValue = convertObjectToFloat(expectedValue);
+ float newActualValue = convertObjectToFloat(actualValue);
+ if(newExpectedValue != newActualValue){
+ errorMap.put("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]", "expected: " + newExpectedValue + ", actual: " + newActualValue);
+ System.out.println("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]: expected: " + newExpectedValue + ", actual: " + newActualValue);
+ }
+ break;
+ case "boolean":
+ if(! expectedValue.toString().toLowerCase().equals(actualValue.toString().toLowerCase())){
+ errorMap.put("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]", "expected: " + expectedValue + ", actual: " + actualValue);
+ System.out.println("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]: expected: " + expectedValue + ", actual: " + actualValue);
+ }
+ break;
+ case "list":
+ expectedInputDefinition.getEntry_schema().get("type");
+ break;
+ case "map":
+
+ break;
+ default:
+ break;
+ }
+
+
+ }else{
+ if(! expectedValue.equals(actualValue)){
+ errorMap.put("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]", "expected: " + expectedValue + ", actual: " + actualValue);
+ System.out.println("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]: expected: " + expectedValue + ", actual: " + actualValue);
+ }
+ }
}
+ public static float convertObjectToFloat(Object object){
+
+ float floatValue = 0;
+
+ if(object instanceof Integer){
+ floatValue = ((Integer)object).floatValue();
+ }
+ if(object instanceof Double){
+ floatValue = ((Double)object).floatValue();
+ }
+ if(object instanceof Float){
+ floatValue = ((Float) object).floatValue();
+ }
+ if(object instanceof String){
+ floatValue = Float.parseFloat(object.toString());
+ }
+
+ if(object instanceof Long){
+ floatValue = ((Long) object).floatValue();
+ }
+ return floatValue;
+ }
+
+ public static Either<Boolean, Map<String, Object>> toscaInputsValidatorAgainstParser(Map<String, ToscaInputsTopologyTemplateDefinition> expectedInputsMap, ISdcCsarHelper fdntCsarHelper) {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Going to convert tosca parser inputs output to ToscaInputsTopologyTemplateDefinition object...");
+ if(fdntCsarHelper.getServiceInputs().size() == 0){
+ if(expectedInputsMap != null && ! expectedInputsMap.isEmpty()){
+ return Either.left(true);
+ }else{
+ Map<String, Object> errorMap = new HashMap<>();
+ errorMap.put("Inputs", " do not exist on actual service");
+ SetupCDTest.getExtendTest().log(Status.INFO, "Inputs do not exist on actual service csar");
+ return Either.right(errorMap);
+ }
+ }
+ Map<String, ToscaInputsTopologyTemplateDefinition> actualInputsMap = convertInputsParserOutputToMap(fdntCsarHelper);
+ return toscaInputsValidator(expectedInputsMap, actualInputsMap);
+ }
+
+ /**
+ * @param fdntCsarHelper convert list of inputs return from tosca parser to map of ToscaInputsTopologyTemplateDefinition
+ * @return
+ */
+ public static Map<String, ToscaInputsTopologyTemplateDefinition> convertInputsParserOutputToMap(ISdcCsarHelper fdntCsarHelper) {
+ Map<String, ToscaInputsTopologyTemplateDefinition> actualInputsMap = new HashMap<>();
+ List<Input> serviceInputs = fdntCsarHelper.getServiceInputs();
+ for (Input input : serviceInputs){
+ ToscaInputsTopologyTemplateDefinition actualInputDefinition = new ToscaInputsTopologyTemplateDefinition();
+ actualInputDefinition.setDefault(input.getDefault());
+ actualInputDefinition.setType(input.getType());
+ actualInputDefinition.setDescription(input.getDescription());
+ actualInputsMap.put(input.getName(), actualInputDefinition);
+ }
+ return actualInputsMap;
+ }
+
}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/UserManagementVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/UserManagementVerificator.java
index 3b0b458f1e..4d14084b80 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/UserManagementVerificator.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/UserManagementVerificator.java
@@ -26,12 +26,10 @@ import java.util.List;
import org.apache.commons.lang3.text.WordUtils;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.model.User;
-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.execute.setup.ExtentTestActions;
import org.openecomp.sdc.ci.tests.pages.AdminGeneralPage;
-import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
import org.openqa.selenium.WebElement;
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java
index 9426fc1cde..588e984106 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java
@@ -32,21 +32,20 @@ import java.util.stream.Collectors;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.GroupInstance;
-import org.openecomp.sdc.be.model.GroupProperty;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
-import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaServiceGroupsMetadataDefinition;
import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsTopologyTemplateDefinition;
-import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaServiceGroupsMetadataDefinition;
import com.aventstack.extentreports.Status;
public class VfModuleVerificator {
- private static final String [] PROPERTY_TYPES = {"vf_module_label", "min_vf_module_instances", "max_vf_module_instances", "initial_count"};
+
+ private final static List<String> PROPERTY_TYPES = DeploymentViewVerificator.getCurrentPropertiesWithoutIsBase();//{"vf_module_label", "min_vf_module_instances", "max_vf_module_instances", "initial_count"};
private static final String VF_MODULE_TYPE = "org.openecomp.groups.VfModule";
/**
@@ -107,7 +106,7 @@ public class VfModuleVerificator {
filter(e -> e.getType().equals(VF_MODULE_TYPE)).
map(e -> e.getProperties()).
collect(Collectors.toList());
- for(String propertyType :PROPERTY_TYPES){
+ for(String propertyType : PROPERTY_TYPES){
int numberOfTypes = getPropertyType(allProperties, propertyType).size();
SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating VF property %s exist, Expected: %s, Actual: %s ", propertyType, allProperties.size(), numberOfTypes));
assertTrue(numberOfTypes == allProperties.size());
@@ -126,7 +125,7 @@ public class VfModuleVerificator {
filter(e -> e.getType().equals(VF_MODULE_TYPE)).
collect(Collectors.toList());
- for(String propertyType :PROPERTY_TYPES){
+ for(String propertyType : PROPERTY_TYPES){
int numberOfTypes = (int) vfModules.stream().
filter(e -> e.getProperties().containsKey(propertyType)).
count();
@@ -135,18 +134,6 @@ public class VfModuleVerificator {
}
}
- public static ToscaDefinition getToscaTemplate(String pathToCsar) throws Exception {
- String outputFolder = DeploymentViewVerificator.unzipCsarFile(pathToCsar);
- String templateFileName = VfModuleVerificator.getTemplateFilenname(pathToCsar);
-
- File pathToMainServiceTemplate = new File(outputFolder + File.separator + "Definitions" + File.separator + templateFileName);
- ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(pathToMainServiceTemplate);
-
- DeploymentViewVerificator.cleanFolders(new File(outputFolder).getParent());
-
- return toscaDefinition;
- }
-
public static String getTemplateFilenname(String pathToCsar) {
File csarFile = new File(pathToCsar);
String templateFileName = csarFile.getName().replaceAll("-csar.csar", "-template.yml");
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java
index e877146256..38fb351179 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java
@@ -124,18 +124,21 @@ public final class VfVerificator {
}
public static void verifyVFLifecycle(ResourceReqDetails vf, User user, LifecycleStateEnum expectedLifecycleState) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verfiying that object %s version is %s", vf.getName(),expectedLifecycleState));
String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse();
JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
String actualLifecycleState = jsonResource.get("lifecycleState").toString();
assertTrue(expectedLifecycleState.name().equals(actualLifecycleState), "actual: " + actualLifecycleState + "-- expected: " + expectedLifecycleState);
}
-
+
public static void verifyVfLifecycleInUI(LifeCycleStateEnum lifecycleState){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verfiying that object version is %s", lifecycleState.getValue()));
GeneralUIUtils.ultimateWait();
assertTrue(ResourceGeneralPage.getLifeCycleState().equals(lifecycleState.getValue()));
}
public static void verifyInstanceVersion(ResourceReqDetails vf, User user, String instanceName, String instanceVersion){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verfiying that instance %s version is %s", instanceName,instanceVersion));
String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse();
JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
JSONArray jsonArrayResource = (JSONArray) jsonResource.get("componentInstances");
@@ -157,6 +160,7 @@ public final class VfVerificator {
}
public static void verifyVfDeleted(ResourceReqDetails vf, User user){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating resource %s was deleted", vf.getName()));
RestResponse response = RestCDUtils.getResource(vf, user);
assertTrue(response.getErrorCode().intValue() == 404);
}
@@ -182,6 +186,7 @@ public final class VfVerificator {
}
public static void verifyToscaArtifactsInfo(ResourceReqDetails vf, User user){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating Tosca Aritfact Info of resource %s", vf.getName()));
String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse();
JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
JSONObject toscaArtifacts = (JSONObject) jsonResource.get("toscaArtifacts");
@@ -216,7 +221,7 @@ public final class VfVerificator {
SetupCDTest.getExtendTest().log(Status.INFO, "Verifying metadata");
assertTrue(vspName.equals(ResourceGeneralPage.getNameText()), "VSP name is not valid.");
assertTrue(vspMetadata.get("description").equals(ResourceGeneralPage.getDescriptionText()), "VSP description is not valid.");
- assertTrue(vspMetadata.get("subCategory").equals(GeneralUIUtils.getSelectedElementFromDropDown(ResourceGeneralPage.getCategoryDataTestsIdAttribute()).getText().toLowerCase().trim()), "VSP category is not valid.");
+ assertTrue(vspMetadata.get("subCategory").equals(GeneralUIUtils.getSelectedElementFromDropDown(ResourceGeneralPage.getCategoryDataTestsIdAttribute()).getText().trim()), "VSP category is not valid.");
assertTrue(vspMetadata.get("vendorName").equals(ResourceGeneralPage.getVendorNameText()), "VSP vendor name is not valid.");
assertTrue("1.0".equals(ResourceGeneralPage.getVendorReleaseText()), "VSP version is not valid.");
List<WebElement> tagsList = ResourceGeneralPage.getElementsFromTagsTable();
@@ -236,7 +241,6 @@ public final class VfVerificator {
String expectedMd5OfFile = FileHandling.getMD5OfFile(expected);
Assert.assertEquals(expectedMd5OfFile, actualMd5OfFile, "File does not exist");
} catch (IOException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
diff --git a/ui-ci/src/main/resources/ci/conf/attsdc.yaml b/ui-ci/src/main/resources/ci/conf/attsdc.yaml
index 4dd7e75abd..9537cf5360 100644
--- a/ui-ci/src/main/resources/ci/conf/attsdc.yaml
+++ b/ui-ci/src/main/resources/ci/conf/attsdc.yaml
@@ -1,12 +1,15 @@
outputFolder: target
reportName: index.html
-#catalogBeHost: 127.0.0.1
+catalogBeHost: 127.0.0.1
#Automate
#catalogBeHost: 135.63.125.67
#catalogFeHost: 135.63.125.63
#IFT
-catalogBeHost: 135.21.143.248
-catalogFeHost: 135.21.125.96
+#catalogBeHost: 135.21.143.248
+#catalogFeHost: 135.21.125.96
+#QA-SCRUM1
+#catalogBeHost: 135.21.125.97
+#catalogFeHost: 135.21.125.89
esHost: eshost
disributionClientHost: disClient
catalogFePort: 8181
@@ -17,9 +20,10 @@ neoHost: neoHost
neoPort: 7474
neoDBusername: neo4j
neoDBpassword: 123456
-#url: http://localhost:8285/sdc1
+url: http://localhost:8285/sdc1
#url: https://www.e-access.att.com/QA-AUTOMATE1/sdc1/portal
-url: https://www.e-access.att.com/AA-IFT-testing/sdc1/portal
+#url: https://www.e-access.att.com/AA-IFT-testing/sdc1/portal
+#url: https://www.e-access.att.com/QA-SCRUM1/sdc1/portal
remoteTestingMachineIP: 0.0.0.0
remoteTestingMachinePort: 5566
remoteTesting: false
@@ -32,7 +36,7 @@ configurationFile: ../catalog-be/src/main/resources/config/configuration.yaml
importTypesConfigDir: src/test/resources/CI/importTypesTest
browser: FireFox
windowsDownloadDirectory: "c:\\apache-ftpserver-1.1.0\\res\\home\\"
-systemUnderDebug: true
+systemUnderDebug: false
reportDBhost: dbhost
reportDBport: 27017
diff --git a/ui-ci/src/main/resources/ci/scripts/startTest.sh b/ui-ci/src/main/resources/ci/scripts/startTest.sh
index a0de1fa56d..8bf35a5d88 100644
--- a/ui-ci/src/main/resources/ci/scripts/startTest.sh
+++ b/ui-ci/src/main/resources/ci/scripts/startTest.sh
@@ -102,7 +102,7 @@ if [ ${REMOTE_DEBUG} == "true" ]; then
JAVA_OPTION="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debug_port}" ;
fi
-cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &"
+cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -DfilePath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &"
if [ $DEBUG == "true" ]
@@ -117,7 +117,7 @@ if [ ${RERUN} == "true" ]; then
echo "Prepare" ${TARGET_DIR}/${fileName} "file to rerun all failed tests ...";
prepareFailedXmlFile ${TARGET_DIR}/${fileName} $SUITE_FILE;
SUITE_FILE=${fileName};
- cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &"
+ cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -DfilePath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &"
$cmd;
fi
fi
diff --git a/ui-ci/src/main/resources/ci/testSuites/devOnboardE2EOneFileSanity.xml b/ui-ci/src/main/resources/ci/testSuites/devOnboardE2EOneFileSanity.xml
new file mode 100644
index 0000000000..73ddc90cf3
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/testSuites/devOnboardE2EOneFileSanity.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="uitests" configfailurepolicy="continue">
+ <test name="uitests">
+ <classes>
+ <!--onboard-->
+ <class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard">
+ <methods>
+ <include name="onboardVNFTestSanityOneFile"/>
+ </methods>
+ </class>
+ </classes>
+ </test> <!-- uitests -->
+</suite> <!-- uisuite --> \ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/testSuites/extendedSanity.xml b/ui-ci/src/main/resources/ci/testSuites/extendedSanity.xml
index 36993e382c..87a52bde7a 100644
--- a/ui-ci/src/main/resources/ci/testSuites/extendedSanity.xml
+++ b/ui-ci/src/main/resources/ci/testSuites/extendedSanity.xml
@@ -6,11 +6,17 @@
<test name="uiSanity">
<classes>
+ <class name="org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders">
+ <methods>
+ <include name="OnbordingDataProviders"/>
+ </methods>
+ </class>
<class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard">
<methods>
<exclude name="onboardVNFTestSanity"/>
<exclude name="onboardVNFShotFlow"/>
- <exclude name="onboardRandomVNFsTest"/>
+ <exclude name="onboardVNFTest"/>
+ <exclude name="onboardVNFTestSanityOneFile"/>
</methods>
</class>
<class name="org.openecomp.sdc.ci.tests.execute.sanity.CatalogLeftPanelTest"/>
@@ -23,12 +29,16 @@
<class name="org.openecomp.sdc.ci.tests.execute.sanity.VfArtifacts"/>
<class name="org.openecomp.sdc.ci.tests.execute.sanity.VfDeploymentInformationalArtifacts"/>
<class name="org.openecomp.sdc.ci.tests.execute.sanity.AdminUserManagment"/>
+ <class name="org.openecomp.sdc.ci.tests.execute.sanity.PNF"/>
+ <class name="org.openecomp.sdc.ci.tests.execute.sanity.PropertiesAssignment"/>
<!-- <class name="org.openecomp.sdc.ci.tests.execute.sanity.Product"/> -->
<class name="org.openecomp.sdc.ci.tests.US.ImportUpdateInformationalDeploymentArtifacts"/>
<class name="org.openecomp.sdc.ci.tests.US.MIBsArtifactsOnResourceInstance"/>
<class name="org.openecomp.sdc.ci.tests.US.NewArtifactTypeGuide"/>
<class name="org.openecomp.sdc.ci.tests.US.RemoveRestrictionOfDeploymentArtifacts"/>
+ <class name="org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlows"/>
+ <class name="org.openecomp.sdc.ci.tests.execute.sanity.PortMirroring"/>
<!-- <class name="org.openecomp.sdc.ci.tests.US.AddComponentInstancesArtifactsInCsar"/> -->
diff --git a/ui-ci/src/main/resources/ci/testSuites/onboardVNFWithoutDistribution.xml b/ui-ci/src/main/resources/ci/testSuites/onboardVNFWithoutDistribution.xml
new file mode 100644
index 0000000000..54c4ea854b
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/testSuites/onboardVNFWithoutDistribution.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="1" data-provider-thread-count="1">
+ <parameter name="makeDistribution" value="false"/>
+ <parameter name="eraseAfterTests" value="false"/>
+
+ <test name="uiSanity">
+ <classes>
+ <class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard">
+ <methods>
+ <include name="onboardVNFTestSanity"/>
+ </methods>
+ </class>
+ </classes>
+ </test> <!-- uitests -->
+</suite> <!-- uisuite --> \ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/testSuites/toscaValidationSuite.xml b/ui-ci/src/main/resources/ci/testSuites/toscaValidationSuite.xml
index 6114517c8f..96c538dfc9 100644
--- a/ui-ci/src/main/resources/ci/testSuites/toscaValidationSuite.xml
+++ b/ui-ci/src/main/resources/ci/testSuites/toscaValidationSuite.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
-<suite name="uitests" configfailurepolicy="continue" parallel="instances" thread-count="2" data-provider-thread-count="2">
+<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="2" data-provider-thread-count="2">
<parameter name="makeDistribution" value="false"/>
<test name="OnbordingDataProviders">