aboutsummaryrefslogtreecommitdiffstats
path: root/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities')
-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
15 files changed, 1196 insertions, 1304 deletions
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);
}