aboutsummaryrefslogtreecommitdiffstats
path: root/ui-ci/src/main/java
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-06-11 14:22:02 +0300
committerMichael Lando <ml636r@att.com>2017-06-11 17:48:32 +0300
commitb3d4898d9e8452ea0b8d848c048e712d43b8d9a3 (patch)
tree0609319203be13f6c29ccbe24cb39c9d64f90095 /ui-ci/src/main/java
parentaf9929df75604ce407d0ca542b200630164e0ae6 (diff)
[SDC-29] rebase continue work to align source
Change-Id: I218f1c5ee23fb2c8314f1c70921d3ad8682c10f4 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'ui-ci/src/main/java')
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java415
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/ImportUpdateInformationalDeploymentArtifacts.java343
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Inputs.java226
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java99
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java269
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MobProxy.java144
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java123
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java117
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java107
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java125
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java156
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java94
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java299
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/businesslogic/ArtifactBusinessLogic.java208
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactInfo.java105
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasElement.java65
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java268
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CatalogFilterTitlesEnum.java37
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CheckBoxStatusEnum.java50
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndImportButtonsEnum.java27
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java835
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ErrorMessageProperties.java53
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/GeneralCanvasItemsEnum.java38
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatAndHeatEnvNamesPair.java62
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatWithParametersDefinition.java102
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LifeCycleStateEnum.java47
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/MenuOptionsEnum.java37
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/PropertyInfo.java76
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceCategoriesNameEnum.java45
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceCategoriesNameEnum.java36
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TopMenuButtonsEnum.java38
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java36
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserCredentials.java58
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserManagementTab.java114
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VFCArtifact.java71
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/environmentLocal10
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java289
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java236
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java213
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java383
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/DeploymentViewTests.java286
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java678
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java353
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java355
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java303
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Product.java93
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java698
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java402
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java687
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java380
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java862
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ArtifactsCorrelationManager.java72
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/AttFtpClient.java221
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java125
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentManager.java169
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java114
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java60
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/MobProxy.java103
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/OnboardCSVReport.java63
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ReportAfterTestManager.java129
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/Retry.java44
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java573
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/TestFtp.java94
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java164
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTest.java77
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTestManager.java52
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/AdminGeneralPage.java132
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ComponentLeftMenu.java25
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java197
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java277
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentPage.java239
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java160
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GovernorOperationPage.java46
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java109
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/IconPage.java51
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InformationalArtifactPage.java74
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InputsPage.java158
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OpsOperationPage.java156
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductGeneralPage.java119
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductLeftMenu.java48
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesPage.java74
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertyPopup.java111
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceGeneralPage.java177
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java67
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceGeneralPage.java114
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceLeftMenu.java32
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java101
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ToscaArtifactsPage.java54
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java126
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java110
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdminWorkspaceUIUtilies.java57
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java638
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AuditCDUtils.java67
-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.java232
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java115
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java505
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java790
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/HomeUtils.java117
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ImportAssetUIUtils.java57
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java801
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ProductUIUtils.java94
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java108
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java1143
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java344
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ServiceUIUtils.java286
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java168
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CustomizationUUIDVerificator.java27
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/DeploymentViewVerificator.java328
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ErrorMessageUIVerificator.java64
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java335
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/UserManagementVerificator.java152
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCArtifactVerificator.java347
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCverificator.java37
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java156
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java245
117 files changed, 23416 insertions, 0 deletions
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java
new file mode 100644
index 0000000000..a8e6501dff
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java
@@ -0,0 +1,415 @@
+/*-
+ * ============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.US;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
+import org.testng.Assert;
+import org.testng.SkipException;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+
+public class AddComponentInstancesArtifactsInCsar extends SetupCDTest {
+
+ private String filePath;
+ @BeforeClass
+ public void beforeClass(){
+ filePath = System.getProperty("filepath");
+ if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+ filePath = FileHandling.getResourcesFilesPath() + "AddComponentInstancesArtifactsInCsar"+ File.separator;
+ }
+ else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+ filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator + "AddComponentInstancesArtifactsInCsar"+ File.separator;
+ }
+ }
+
+ // US847439 - Story [BE] - Add Component Instance's artifacts in CSAR
+ // TC1521795 - VF CSAR - The Flow
+ @Test
+ public void vfAndServicerCsarTheFlow() throws Exception{
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ String vnfFile = "FDNT.zip";
+ String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip";
+
+ OnboardingUtils.createVendorLicense(getUser());
+ Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser());
+ String vspName = createVSP.left;
+ resourceMetaData.setName(vspName);
+ Map<String, String> resourceMeta = createVSP.right;
+ String vspid = resourceMeta.get("vspId");
+ OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser());
+ OnboardingUtils.prepareVspForUse(getUser(), vspid);
+
+ HomePage.showVspRepository();
+ OnboardingUtils.importVSP(createVSP);
+ resourceMetaData.setVersion("0.1");
+ Resource vfResource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), resourceMetaData.getVersion());
+
+
+ Map<String, Object> artifacts = getArtifactsOfComponentAndComponentsInstance(vfResource);
+
+ List<ImmutablePair<ComponentInstance, ArtifactDefinition>> artifactsUploadedToComponentInstance = new LinkedList<>();
+ Random random = new Random();
+ for(int i=0; i<random.nextInt(10) + 10; i++) {
+ ImmutablePair<ComponentInstance, ArtifactDefinition> uploadArtifactOnRandomVfc = uploadArtifactOnRandomRI(vfResource);
+
+ if(uploadArtifactOnRandomVfc.getRight().getArtifactName() != null) {
+ artifactsUploadedToComponentInstance.add(uploadArtifactOnRandomVfc);
+ }
+ }
+
+ if(artifactsUploadedToComponentInstance.size() > 0) {
+ Map<String, Object> artifactsOfResourceInstance = getArtifactsOfResourceInstance(artifactsUploadedToComponentInstance);
+ artifacts.put("Resources", artifactsOfResourceInstance);
+ }
+
+
+ ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+ ToscaArtifactsPage.downloadCsar();
+ File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+ Map<String, Object> combineHeatArtifacstWithFolderArtifacsToMap = ArtifactFromCsar.getVFCArtifacts(latestFilefromDir.getAbsolutePath());
+
+ compareArtifactFromFileStructureToArtifactsFromJavaObject(artifacts, combineHeatArtifacstWithFolderArtifacsToMap);
+
+
+// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// // Submit for testing + certify
+// DeploymentArtifactPage.clickSubmitForTestingButton(vspName);
+//
+// reloginWithNewRole(UserRoleEnum.TESTER);
+// GeneralUIUtils.findComponentAndClick(vspName);
+// TesterOperationPage.certifyComponent(vspName);
+//
+// reloginWithNewRole(UserRoleEnum.DESIGNER);
+// // create service
+// ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+// ServiceUIUtils.createService(serviceMetadata, getUser());
+// serviceMetadata.setVersion("0.1");
+//
+//
+// // Upload informationl artifact to service
+// ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+//
+// String HEAT_FILE_YAML_NAME = "Heat-File.yaml";
+// String DESCRIPTION = "kuku";
+// String ARTIFACT_LABEL = "artifact3";
+//
+// ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,"OTHER");
+// CompositionPage.showDeploymentArtifactTab();
+// CompositionPage.clickAddArtifactButton();
+// ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+//
+// ArtifactInfo informationArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "GUIDE");
+// CompositionPage.showInformationArtifactTab();
+// CompositionPage.clickAddArtifactButton();
+// ArtifactUIUtils.fillAndAddNewArtifactParameters(informationArtifact, CompositionPage.artifactPopup());
+//
+//
+//
+// // Add component instance to canvas of the service
+// CompositionPage.searchForElement(vspName);
+// CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
+// CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
+//
+// Service service = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceMetadata.getName(), serviceMetadata.getVersion());
+//
+//// ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", "OTHER", true, false);
+//// RestResponse restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(service, getUser(), artifactReqDetails);
+//// Integer responseCode = restResponse.getErrorCode();
+//// Assert.assertEquals(responseCode, (Integer)200, "Response code is not correct.");
+////
+//// service = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceMetadata.getName(), serviceMetadata.getVersion());
+//
+// Map<String, Object> artifactsService = getArtifactsOfComponentAndComponentsInstance(service);
+//
+// System.out.println("12354");
+//
+// artifactsService.put(vfResource.getToscaResourceName(), artifacts);
+//
+// System.out.println("1234");
+
+ }
+
+ public void compareArtifactFromFileStructureToArtifactsFromJavaObject(Map<String, Object> artifactFromJavaObject, Map<String, Object> artifactsFromFileStructure) {
+ for(String key: artifactFromJavaObject.keySet()) {
+ if((!key.equals("Deployment")) && (!key.equals("Informational"))) {
+ Map<String, Object> newArtifactFromJavaObject = (Map<String, Object>) artifactFromJavaObject.get(key);
+ Map<String, Object> newArtifactsFromFileStructure = (Map<String, Object>) artifactsFromFileStructure.get(key);
+ compareArtifactFromFileStructureToArtifactsFromJavaObject(newArtifactFromJavaObject, newArtifactsFromFileStructure);
+ } else {
+ compareArtifacts(artifactFromJavaObject.get(key), artifactsFromFileStructure.get(key));
+ }
+
+
+
+
+ }
+ }
+
+
+ private void compareArtifacts(Object artifactFromJavaObject, Object artifactsFromFileStructure) {
+ Map<String, List<String>> artifactsMap = (Map<String, List<String>>) artifactFromJavaObject;
+ List<HeatMetaFirstLevelDefinition> artifactsList = (List<HeatMetaFirstLevelDefinition>) artifactsFromFileStructure;
+
+ for(HeatMetaFirstLevelDefinition heatMetaFirstLevelDefinition: artifactsList) {
+ Assert.assertTrue(artifactsMap.get(heatMetaFirstLevelDefinition.getType()).contains(heatMetaFirstLevelDefinition.getFileName()),
+ "Expected that artifacts will be the same. Not exists: " + heatMetaFirstLevelDefinition.getFileName() + " of type: " + heatMetaFirstLevelDefinition.getType());
+ }
+
+ for(String key: artifactsMap.keySet()) {
+ List<String> artifacts = artifactsMap.get(key);
+
+ for(HeatMetaFirstLevelDefinition heatMetaFirstLevelDefinition: artifactsList) {
+ if(heatMetaFirstLevelDefinition.getType().equals(key)) {
+ if(artifacts.contains(heatMetaFirstLevelDefinition.getFileName())) {
+ artifacts.remove(heatMetaFirstLevelDefinition.getFileName());
+ }
+ }
+ }
+
+ Assert.assertEquals(artifacts.size(), 0, "Expected that all artifacts equal. There is artifacts which not equal: " + artifacts.toString());
+ }
+ }
+
+
+ public Map<String, Object> getArtifactsOfResourceInstance(List<ImmutablePair<ComponentInstance, ArtifactDefinition>> riList) {
+ Map<String, Object> artifacts = new HashMap<>();
+
+ for(ImmutablePair<ComponentInstance, ArtifactDefinition> ri: riList) {
+ ArtifactDefinition artifactDefinition = ri.getRight();
+ ComponentInstance componentInstance = ri.getLeft();
+ if(artifacts.containsKey(componentInstance.getNormalizedName())) {
+ if( ((Map<String, ArrayList<String>>)((Map<String, Object>)artifacts.get(componentInstance.getNormalizedName())).get("Deployment")).containsKey(artifactDefinition.getArtifactType()) ) {
+
+ ((Map<String, ArrayList<String>>)((Map<String, Object>) artifacts.get(componentInstance.getNormalizedName())).get("Deployment")).get(artifactDefinition.getArtifactType()).add(artifactDefinition.getArtifactName());
+
+ } else {
+ ArrayList<String> list = new ArrayList<String>();
+ list.add(artifactDefinition.getArtifactName());
+ ((Map<String, ArrayList<String>>)((Map<String, Object>) artifacts.get(componentInstance.getNormalizedName())).get("Deployment")).put(artifactDefinition.getArtifactType(), list);
+ }
+
+ } else {
+ try {
+
+
+ ArrayList<String> list = new ArrayList<String>();
+ list.add(artifactDefinition.getArtifactName());
+
+ Map<String, ArrayList<String>> map = new HashMap<>();
+ map.put(artifactDefinition.getArtifactType(), list);
+
+ Map<String, Map<String, ArrayList<String>>> addMap = new HashMap<>();
+ addMap.put("Deployment", map);
+
+ artifacts.put(componentInstance.getNormalizedName(), addMap);
+
+// if(artifacts.size() == 0) {
+// artifacts.put("Deployment", addMap);
+// } else {
+// ((Map<String, Map<String, ArrayList<String>>>) artifacts.get("Deployment")).putAll(addMap);
+// }
+ } catch (Exception e) {
+ Assert.fail("Artifact name is null for componentInstance: " + componentInstance.getNormalizedName());
+ }
+ }
+ }
+ return artifacts;
+ }
+
+ public Map<String, Object> getArtifactsOfComponentAndComponentsInstance(Component component) {
+ Map<String, Object> artifacts = getArtifacstOfComponent(component);
+
+ for(ComponentInstance componentInstance: component.getComponentInstances()) {
+ Map<String, Object> artifacstOfComponentInstance = getArtifacstOfComponentInstance(componentInstance);
+ if(artifacstOfComponentInstance.size() > 0) {
+ artifacts.put(componentInstance.getToscaComponentName() + "." + componentInstance.getComponentVersion(), artifacstOfComponentInstance);
+ }
+ }
+
+ return artifacts;
+ }
+
+ public Map<String, Object> getArtifacstOfComponentInstance(ComponentInstance componentInstance) {
+ Map<String, Object> map = new HashMap<>();
+
+ if(componentInstance.getArtifacts() != null) {
+ Map<String, Object> informationalArtifacts = getArtifacts(componentInstance.getArtifacts());
+ if(informationalArtifacts.size() > 0) {
+ map.put("Informational", informationalArtifacts);
+ }
+ }
+
+ if(componentInstance.getDeploymentArtifacts() != null) {
+ Map<String, Object> deploymentArtifacts = getArtifacts(componentInstance.getDeploymentArtifacts());
+ if(deploymentArtifacts.size() > 0) {
+ map.put("Deployment", deploymentArtifacts);
+ }
+ }
+
+ return map;
+ }
+
+ public Map<String, Object> getArtifacstOfComponent(Component component) {
+ Map<String, Object> map = new HashMap<>();
+
+ if(component.getArtifacts() != null) {
+ Map<String, Object> informationalArtifacts = getArtifacts(component.getArtifacts());
+ if(informationalArtifacts.size() > 0) {
+ map.put("Informational", informationalArtifacts);
+ }
+ }
+
+ if(component.getDeploymentArtifacts() != null) {
+ Map<String, Object> deploymentArtifacts = getArtifacts(component.getDeploymentArtifacts());
+ if(deploymentArtifacts.size() > 0) {
+ map.put("Deployment", deploymentArtifacts);
+ }
+ }
+
+ return map;
+ }
+
+ public Map<String, Object> getArtifacts(Map<String, ArtifactDefinition> artifacts) {
+ Map<String, Object> map = new HashMap<>();
+
+ for(String artifact: artifacts.keySet()) {
+ ArtifactDefinition artifactDefinition = artifacts.get(artifact);
+ if((artifactDefinition.getEsId() != null) && (!artifactDefinition.getEsId().equals("")) && (!artifactDefinition.getArtifactType().equals("HEAT_ENV"))) {
+ if(map.containsKey(artifactDefinition.getArtifactType())) {
+ ((List<String>) map.get(artifactDefinition.getArtifactType())).add(artifactDefinition.getArtifactName());
+ } else {
+ ArrayList<String> list = new ArrayList<String>();
+ list.add(artifactDefinition.getArtifactName());
+ map.put(artifactDefinition.getArtifactType(), list);
+ }
+ }
+ }
+
+ return map;
+ }
+
+ public ImmutablePair<ComponentInstance, ArtifactDefinition> uploadArtifactOnRandomRI(Component component) throws IOException, Exception {
+ ArtifactReqDetails artifactReqDetails = getRandomArtifact();
+ Random random = new Random();
+ int randInt = random.nextInt(component.getComponentInstances().size());
+ User defaultUser = ElementFactory.getDefaultUser(getRole());
+ ComponentInstance componentInstance = component.getComponentInstances().get(randInt);
+
+ RestResponse uploadArtifactRestResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(component, defaultUser, artifactReqDetails, componentInstance);
+
+ // Check response of external API
+ Integer responseCode = uploadArtifactRestResponse.getErrorCode();
+ Assert.assertEquals(responseCode, (Integer)200, "Response code is not correct.");
+
+ ImmutablePair<ComponentInstance, ArtifactDefinition> pair = ImmutablePair.of(componentInstance, ArtifactRestUtils.getArtifactDataFromJson(uploadArtifactRestResponse.getResponse()));
+
+ return pair;
+ }
+
+ public ImmutablePair<ComponentInstance, ArtifactDefinition> uploadArtifactOnRandomRI(Resource resource) throws IOException, Exception {
+ ArtifactReqDetails artifactReqDetails = getRandomVfcArtifact();
+ Random random = new Random();
+ int randInt = random.nextInt(resource.getComponentInstances().size());
+ User defaultUser = ElementFactory.getDefaultUser(getRole());
+ ComponentInstance componentInstance = resource.getComponentInstances().get(randInt);
+
+ RestResponse uploadArtifactRestResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(resource, defaultUser, artifactReqDetails, componentInstance);
+
+
+
+ // Check response of external API
+ Integer responseCode = uploadArtifactRestResponse.getErrorCode();
+
+ if(responseCode.equals(404)) {
+ getExtendTest().log(Status.SKIP, String.format("DE271521"));
+ throw new SkipException("DE271521");
+ }
+
+ Assert.assertEquals(responseCode, (Integer)200, "Response code is not correct.");
+
+ ImmutablePair<ComponentInstance, ArtifactDefinition> pair = ImmutablePair.of(componentInstance, ArtifactRestUtils.getArtifactDataFromJson(uploadArtifactRestResponse.getResponse()));
+
+ return pair;
+ }
+
+ public ArtifactReqDetails getRandomArtifact() throws IOException, Exception {
+ List<String> artifactsTypeList = Arrays.asList("Other");
+ return getRandomArtifact(artifactsTypeList);
+ }
+
+ public ArtifactReqDetails getRandomVfcArtifact() throws IOException, Exception {
+ List<String> vfcArtifactsTypeList = Arrays.asList("DCAE_INVENTORY_TOSCA", "DCAE_INVENTORY_JSON", "DCAE_INVENTORY_POLICY", "DCAE_INVENTORY_DOC",
+ "DCAE_INVENTORY_BLUEPRINT", "DCAE_INVENTORY_EVENT", "SNMP_POLL", "SNMP_TRAP");
+ return getRandomArtifact(vfcArtifactsTypeList);
+ }
+
+ public ArtifactReqDetails getRandomArtifact(List<String> artifactType) throws IOException, Exception {
+ Random random = new Random();
+
+ ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType.get(random.nextInt(artifactType.size())), true, false);
+ return artifactReqDetails;
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/ImportUpdateInformationalDeploymentArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/ImportUpdateInformationalDeploymentArtifacts.java
new file mode 100644
index 0000000000..913064b7fd
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/ImportUpdateInformationalDeploymentArtifacts.java
@@ -0,0 +1,343 @@
+/*-
+ * ============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.US;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.common.api.ArtifactTypeEnum;
+import org.testng.SkipException;
+import org.testng.annotations.Test;
+
+public class ImportUpdateInformationalDeploymentArtifacts extends SetupCDTest {
+
+ private String folder ="US747946";
+
+ // US747946 - Import artifacts to component instances
+ // TC1407822 - Import VFC Artifacts - Deployment Artifacts - Multiple Artifacts, Multiple Types
+ @Test
+ public void importVfvArtifactsDeploymentArtifactsMultipleArtifactsMultipleTypes() throws Exception {
+
+ if(true){
+ throw new SkipException("Open bug 197126");
+ }
+
+ String filePath = FileHandling.getFilePath(folder);
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ String fileName = "TC1407822.csar";
+
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+
+ List<String> snmpPollArtifactList = Stream
+ .of("base_cgi_frwl.mib", "base_vIECCF_volume.yml", "node_userdata_script.sh", "vendor-license-model.xml")
+ .collect(Collectors.toList());
+ List<String> snmpTrapArtifactList = Stream
+ .of("module_1_ixlt.mib", "module_1_ixlt.yaml")
+ .collect(Collectors.toList());
+
+
+ List<ArtifactDefinition> filteredArtifactNames =
+ //Stream of component Instances
+ resource.getComponentInstances().stream()
+ //Stream of all the artifacts on all the component instances
+ .flatMap( e -> e.getDeploymentArtifacts().values().stream())
+ //filter relevant artifact types
+ .filter( e -> e.getArtifactType().equals(ArtifactTypeEnum.SNMP_TRAP.getType()) || e.getArtifactType().equals(ArtifactTypeEnum.SNMP_POLL.getType()))
+ //collect to list
+ .collect(Collectors.toList());
+
+
+ assertTrue("Not contain all SNMP TRAP artifacts.", filteredArtifactNames.stream()
+ .filter(e -> e.getArtifactType().equals(ArtifactTypeEnum.SNMP_TRAP.getType()))
+ .map(e -> e.getArtifactName())
+ .collect(Collectors.toList())
+ .containsAll(snmpTrapArtifactList));
+
+ assertTrue("Not contain all SNMP POLL artifacts.", filteredArtifactNames.stream()
+ .filter(e -> e.getArtifactType().equals(ArtifactTypeEnum.SNMP_POLL.getType()))
+ .map(e -> e.getArtifactName())
+ .collect(Collectors.toList())
+ .containsAll(snmpPollArtifactList));
+
+ filteredArtifactNames.stream()
+ .map(e->e.getArtifactDisplayName())
+ .collect(Collectors.toList())
+ .forEach(e -> {
+ assertTrue("Wrong artifact appear on deployment artifact UI page.",
+ !GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + e));
+ });
+
+ }
+
+
+
+ // US747946 - Import artifacts to component instances
+ // TC1408044 - Import VFC Artifacts - Informational Artifacts on Single VFC
+ @Test
+ public void importVfcArtifactsInformationalArtifactsOnSingleVfc() throws Exception {
+
+ if(true){
+ throw new SkipException("Open bug 197126");
+ }
+
+ String filePath = FileHandling.getFilePath(folder);
+ String fileName = "TC1408044.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+
+ resource.getComponentInstances().forEach(e -> {
+
+ if(e.getToscaComponentName().endsWith("heat.ltm")) {
+ Map<String, List<String>> artifactsMap = new HashMap<String, List<String>>() {
+ {
+ put(ArtifactTypeEnum.GUIDE.getType(), Arrays.asList("module_1_ldsa.yaml", "vendor-license-model.xml"));
+ put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("module_2_ldsa.yaml", "vf-license-model.xml"));
+ }
+ };
+
+ validateInformationalArtifactOnComponetInstance(e, artifactsMap, "heat.ltm");
+ }
+ });
+ }
+
+ // TODO: Note there is performance issue with this CSAR
+ // US747946 - Import artifacts to component instances
+ // TC1407998 - Import VFC Artifacts - Deployment & Informational Artifacts - Multiple VFCs
+ @Test
+ public void importVfcArtifactsDeploymentAndInformationalArtifactsMultipleVfcs() throws Exception {
+
+ if(true){
+ throw new SkipException("Open bug 197126");
+ }
+
+ String filePath = FileHandling.getFilePath(folder);
+ String fileName = "TC1407998.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+
+// resourceMetaData.setName("TC1407998");
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+
+ resource.getComponentInstances().forEach(e -> {
+
+ if(e.getToscaComponentName().endsWith("heat.ps")) {
+ Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() {
+ {
+ put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("PS_DEPL_Poll1.mib", "PS_DEPL_Poll2.xml", "PS_DEPL_Poll3.yaml"));
+ put(ArtifactTypeEnum.SNMP_TRAP.getType(), Arrays.asList("PS_DEPL_Trap1.mib", "PS_DEPL_Trap2.xml", "PS_DEPL_Trap3.sh", "PS_DEPL_Trap4.yml"));
+ }
+ };
+ validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.ps");
+
+ Map<String, List<String>> infoArtifactsMap = new HashMap<String, List<String>>() {
+ {
+ put(ArtifactTypeEnum.GUIDE.getType(), Arrays.asList("PS_INFO_GUIDE1.yaml", "PS_INFO_GUIDE2.xml"));
+ put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("PS_INFO_OTHER1.yaml", "PS_INFO_OTHER2.xml"));
+ }
+ };
+ validateInformationalArtifactOnComponetInstance(e, infoArtifactsMap, "heat.ps");
+
+
+ } else if (e.getToscaComponentName().endsWith("heat.sm")) {
+ Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() {
+ {
+ put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("SM_DEPL_Poll1.mib", "SM_DEPL_Poll2.mib", "SM_DEPL_Poll3.xml"));
+ put(ArtifactTypeEnum.SNMP_TRAP.getType(), Arrays.asList("SM_DEPL_Trap1.mib", "SM_DEPL_Trap2.xml"));
+ }
+ };
+ validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.sm");
+
+ Map<String, List<String>> infoArtifactsMap = new HashMap<String, List<String>>() {
+ {
+ put(ArtifactTypeEnum.GUIDE.getType(), Arrays.asList("SM_INFO_GUIDE1.yaml", "SM_INFO_GUIDE2.xml"));
+ put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("SM_INFO_OTHER1.yaml", "SM_INFO_OTHER2.xml"));
+ }
+ };
+ validateInformationalArtifactOnComponetInstance(e, infoArtifactsMap, "heat.sm");
+ }
+ });
+
+ }
+
+ // US747946 - Import artifacts to component instances
+ // TC1410352 - Import VFC Artifacts - Deployment Artifacts - Extra folder Under VFC-Identification
+ @Test
+ public void importVfcArtifactsDeploymentArtifactsExtraFolderUnderVfcIdentification() throws Exception {
+
+ if(true){
+ throw new SkipException("Open bug 197126");
+ }
+
+ String filePath = FileHandling.getFilePath(folder);
+ String fileName = "TC1410352.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+
+// resourceMetaData.setName("TC1410352");
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+
+ resource.getComponentInstances().forEach(e -> {
+
+ if(e.getToscaComponentName().endsWith("heat.ltm")) {
+ Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() {
+ {
+ put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("Poll1.mib", "Poll2.xml", "Poll3.sh", "Poll4.yml"));
+ put(ArtifactTypeEnum.SNMP_TRAP.getType(), Arrays.asList("Trap1.mib", "Trap2.yaml"));
+ }
+ };
+ validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.ltm");
+
+ Map<String, List<String>> infoArtifactsMap = new HashMap<String, List<String>>() {
+ {
+ put(ArtifactTypeEnum.GUIDE.getType(), Arrays.asList("GUIDE1.yaml", "GUIDE2.xml"));
+ put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("OTHER1.yaml", "OTHER2.xml"));
+ }
+ };
+ validateInformationalArtifactOnComponetInstance(e, infoArtifactsMap, "heat.ltm");
+ }
+ });
+ }
+
+
+ // US747946 - Import artifacts to component instances
+ // TC1410352 - Import VFC Artifacts - Deployment Artifacts - Invalid Artifact Type
+ @Test
+ public void importVfcArtifactsDeploymentArtifactsInvalidArtifactType() throws Exception {
+
+ if(true){
+ throw new SkipException("Open bug 197126");
+ }
+
+ String filePath = FileHandling.getFilePath(folder);
+ String fileName = "TC1425032.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+
+// resourceMetaData.setName("TC1425032");
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+
+ resource.getComponentInstances().forEach(e -> {
+
+ if(e.getToscaComponentName().endsWith("heat.ltm")) {
+ Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() {
+ {
+ put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("DeploySNMPPoll1.mib", "DeploySNMPPoll2.yml", "DeploySNMPPoll3.sh", "DeploySNMPPoll4.xml"));
+ put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("DeploySNMPTrapB1.mib", "DeploySNMPTrapB2.yaml"));
+ }
+ };
+ validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.ltm");
+
+ Map<String, List<String>> infoArtifactsMap = new HashMap<String, List<String>>() {
+ {
+ put(ArtifactTypeEnum.GUIDE.getType(), Arrays.asList("InfoGuide1.yaml", "InfoGuide2.xml"));
+ put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("InfoOther1.yaml", "InfoOther2.xml", "InfoInvalid1.yaml"));
+ }
+ };
+ validateInformationalArtifactOnComponetInstance(e, infoArtifactsMap, "heat.ltm");
+ }
+ });
+ }
+
+
+ private void validateInformationalArtifactOnComponetInstance(ComponentInstance instacne, Map<String, List<String>> artifactsMap, String endswith){
+ if(instacne.getToscaComponentName().endsWith(endswith) ){
+ Set<String> types = artifactsMap.keySet();
+
+ Map<String, List<ArtifactDefinition>> collect = instacne.getArtifacts().values().stream()
+ .filter( a -> types.contains(a.getArtifactType()))
+ .collect(Collectors.groupingBy( e -> e.getArtifactType()));
+
+ types.forEach(m -> {
+ if(collect.containsKey(m)){
+ List<String> found = collect.get(m).stream().map(e -> e.getArtifactName()).collect(Collectors.toList());
+ boolean isValid = found.containsAll(artifactsMap.get(m)) && artifactsMap.get(m).containsAll(found);
+ assertTrue("Not contain all artifact of type: " + m, isValid);
+ } else{
+ assertTrue("Contains informational artifact which not in provided list", false);
+ }
+ });
+ }
+ }
+
+ private void validateDeploymentArtifactOnComponetInstance(ComponentInstance instacne, Map<String, List<String>> artifactsMap, String endswith){
+ if(instacne.getToscaComponentName().endsWith(endswith) ){
+ Set<String> types = artifactsMap.keySet();
+
+ Map<String, List<ArtifactDefinition>> collect = instacne.getDeploymentArtifacts().values().stream()
+ .filter( a -> types.contains(a.getArtifactType()))
+ .collect(Collectors.groupingBy( e -> e.getArtifactType()));
+
+ types.forEach(m -> {
+ if(collect.containsKey(m)){
+ List<String> found = collect.get(m).stream().map(e -> e.getArtifactName()).collect(Collectors.toList());
+ boolean isValid = found.containsAll(artifactsMap.get(m)) && artifactsMap.get(m).containsAll(found);
+ assertTrue("Not contain all artifact of type: " + m, isValid);
+ } else{
+ assertTrue("Contains deployment artifact which not in provided list", false);
+ }
+ });
+ }
+ }
+
+
+
+
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Inputs.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Inputs.java
new file mode 100644
index 0000000000..dff10dba49
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Inputs.java
@@ -0,0 +1,226 @@
+/*-
+ * ============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.US;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.InputsPage;
+import org.openecomp.sdc.ci.tests.pages.PropertyPopup;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.TestException;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class Inputs extends SetupCDTest {
+
+ private static final String DESCRIPTION = "kuku";
+ private static final String ARTIFACT_LABEL = "artifact3";
+ private static final String ARTIFACT_LABEL_UPDATE = "artifactUpdate";
+ private static final String GET_ARTIFACT_LIST_BY_CLASS_NAME = "i-sdc-designer-sidebar-section-content-item-artifact";
+ private static final String HEAT_FILE_YAML_NAME = "Heat-File.yaml";
+ private static final String HEAT_FILE_YAML_UPDATE_NAME = "Heat-File-Update.yaml";
+ private String filePath;
+
+ @BeforeMethod
+ public void beforeTest(){
+ filePath = FileHandling.getFilePath("");
+ }
+
+ // TODO: There is defect that imported VFC checkin not appear in service until refresh
+ // TODO: add support for CP (there is no normative CP's with complex properties which can be selected - import one) - importVFCWithComplexProperty.yml
+ // TC1508249
+ // Delete Input declared from VLi/CPi in service level - Deleting an Input that was declared from Complex property.
+ @Test
+ public void deletingAnInputThatWasDeclaredFromComplexProperty() throws Exception{
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ Map<String, List<String>> resourceInstanceToProperty = new HashMap<>();
+ CompositionPage.searchForElement("ExtVL");
+ CanvasElement computeElement = canvasManager.createElementOnCanvas("ExtVL");
+ canvasManager.clickOnCanvaElement(computeElement);
+ resourceInstanceToProperty.put(CompositionPage.getSelectedInstanceName(), Arrays.asList("network_homing", "instance_node_target"));
+
+// CompositionPage.searchForElement("ExtCP");
+// computeElement = canvasManager.createElementOnCanvas("ExtCP");
+// canvasManager.clickOnCanvaElement(computeElement);
+// resourceInstanceToProperty.put(CompositionPage.getSelectedInstanceName(), "order");
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+ DeploymentArtifactPage.getLeftMenu().moveToInputsScreen();
+
+
+ for(String element: resourceInstanceToProperty.keySet()) {
+ String propertyName = resourceInstanceToProperty.get(element).get(0);
+ String innerPropertyName = resourceInstanceToProperty.get(element).get(1);
+ String dataTestIdPropertyCheckbox = DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + propertyName;
+
+ GeneralUIUtils.clickOnElementByText(element);
+ GeneralUIUtils.ultimateWait();
+
+ InputsPage.clickOnProperty(propertyName);
+
+ PropertyPopup propertyPopup = new PropertyPopup();
+ propertyPopup.selectPropertyRadioButton(innerPropertyName);
+ propertyPopup.clickSave();
+
+ InputsPage.clickOnAddInputButton();
+
+ // Verify that input checkbox selected
+ verifyPropertyCheckBoxSelected(dataTestIdPropertyCheckbox);
+
+ InputsPage.deleteServiceInput(element, propertyName + "_" + innerPropertyName);
+
+ // Trying to find deleted service input
+ try{
+ InputsPage.getServiceInput(element, propertyName + "_" + innerPropertyName);
+ assert(false);
+ } catch(TestException e){
+ System.out.println("Verfied that service input deleted");
+ }
+
+ // Verify that input checkbox not selected
+ verifyPropertyCheckBoxNotSelected(dataTestIdPropertyCheckbox);
+
+ GeneralUIUtils.clickOnElementByText(element);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ }
+
+
+ // TC1508248
+ // Delete inputs who come from CP/VL properties
+ @Test
+ public void deleteInputsWhoComeFromCpVlProperties() throws Exception{
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ Map<String, String> resourceInstanceToProperty = new HashMap<>();
+ CompositionPage.searchForElement("ExtVL");
+ CanvasElement computeElement = canvasManager.createElementOnCanvas("ExtVL");
+ canvasManager.clickOnCanvaElement(computeElement);
+ resourceInstanceToProperty.put(CompositionPage.getSelectedInstanceName(), "network_role");
+
+ CompositionPage.searchForElement("ExtCP");
+ computeElement = canvasManager.createElementOnCanvas("ExtCP");
+ canvasManager.clickOnCanvaElement(computeElement);
+ resourceInstanceToProperty.put(CompositionPage.getSelectedInstanceName(), "order");
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+ DeploymentArtifactPage.getLeftMenu().moveToInputsScreen();
+
+
+ for(String element: resourceInstanceToProperty.keySet()) {
+ GeneralUIUtils.clickOnElementByText(element);
+ GeneralUIUtils.ultimateWait();
+
+ WebElement webElementByTestID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + resourceInstanceToProperty.get(element));
+ InputsPage.clickOnVFInputCheckbox(webElementByTestID);
+
+ InputsPage.clickOnAddInputButton();
+
+ // Verify that input checkbox selected
+ verifyPropertyCheckBoxSelected(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + resourceInstanceToProperty.get(element));
+
+ InputsPage.deleteServiceInput(element, resourceInstanceToProperty.get(element));
+
+ // Trying to find deleted service input
+ try{
+ InputsPage.getServiceInput(element, resourceInstanceToProperty.get(element));
+ assert(false);
+ } catch(TestException e){
+ System.out.println("Verfied that service input deleted");
+ }
+
+ // Verify that input checkbox not selected
+ verifyPropertyCheckBoxNotSelected(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + resourceInstanceToProperty.get(element));
+
+ GeneralUIUtils.clickOnElementByText(element);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ }
+
+
+
+
+
+
+
+ public String verifyPropertyCheckBox(String dataTestId) {
+ WebElement webElementByTestID = GeneralUIUtils.getWebElementByTestID(dataTestId);
+ webElementByTestID = webElementByTestID.findElement(By.className("tlv-checkbox-i"));
+ if(webElementByTestID.getAttribute("checked") == null) {
+ return "false";
+ }
+ return "true";
+ }
+
+ public void verifyPropertyCheckBoxSelected(String dataTestId) {
+ if(!verifyPropertyCheckBox(dataTestId).equals("true")) {
+ Assert.assertEquals(true, false, "Expected that checkbox will be selected.");
+ }
+ }
+
+ public void verifyPropertyCheckBoxNotSelected(String dataTestId) {
+ if(!verifyPropertyCheckBox(dataTestId).equals("false")) {
+ Assert.assertEquals(false, true, "Expected that checkbox will not be selected.");
+ }
+ }
+
+ public String getNormalizedName(String notNormalizedName) {
+ String normalizedName = notNormalizedName.toLowerCase();
+ normalizedName = normalizedName.replaceAll(" ", "");
+
+ return normalizedName;
+ }
+
+
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java
new file mode 100644
index 0000000000..fb1798d0c9
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java
@@ -0,0 +1,99 @@
+/*-
+ * ============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.US;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.json.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+
+import com.clearspring.analytics.util.Pair;
+
+public class LocalGeneralUtilities {
+
+ public LocalGeneralUtilities() {
+ // TODO Auto-generated constructor stub
+ }
+ public static final String FILE_PATH = FileHandling.getBasePath() + "\\src\\main\\resources\\Files\\VNFs\\";
+ public static final String Env_FILE_PATH = FileHandling.getBasePath() + "\\src\\main\\resources\\Files\\Env_files\\";
+ public static String downloadPath = "C:\\Users\\th0695\\Downloads";
+
+public static String getValueFromJsonResponse(String response, String fieldName) {
+ try {
+ JSONObject jsonResp = (JSONObject) JSONValue.parse(response);
+ Object fieldValue = jsonResp.get(fieldName);
+ return fieldValue.toString();
+
+ } catch (Exception e) {
+ return null;
+ }
+
+}
+
+public static List<String> getValuesFromJsonArray(RestResponse message) throws Exception {
+ List<String> artifactTypesArrayFromApi = new ArrayList<String>();
+
+ org.json.JSONObject responseObject = new org.json.JSONObject(message.getResponse());
+ JSONArray jArr = responseObject.getJSONArray("componentInstances");
+
+ for (int i = 0; i < jArr.length(); i++) {
+ org.json.JSONObject jObj = jArr.getJSONObject(i);
+ String value = jObj.get("uniqueId").toString();
+
+ artifactTypesArrayFromApi.add(value);
+ }
+ return artifactTypesArrayFromApi;
+}
+
+public static String simpleOnBoarding(String fileName, String filePath,User user) throws Exception {
+ OnboardingUtils.createVendorLicense(user);
+ Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils
+ .createVendorSoftwareProduct(fileName, filePath, user);
+ String vspName = createVendorSoftwareProduct.left;
+ HomePage.showVspRepository();
+ OnboardingUtils.importVSP(createVendorSoftwareProduct);
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ return vspName;
+}
+
+//check if file downloaded successfully.
+public static boolean isFileDownloaded(String downloadPath, String fileName) {
+ boolean flag = false;
+ File dir = new File(downloadPath);
+ File[] dir_contents = dir.listFiles();
+ for (int i = 0; i < dir_contents.length; i++) {
+ if (dir_contents[i].getName().equals(fileName))
+ return flag = true;
+ }
+ return flag;
+}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
new file mode 100644
index 0000000000..949a20b4a9
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
@@ -0,0 +1,269 @@
+/*-
+ * ============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.US;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
+import org.testng.Assert;
+import org.testng.SkipException;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+
+public class MIBsArtifactsOnResourceInstance extends SetupCDTest {
+
+ private String folder ="";
+
+ @DataProvider(name="mibsArtifactCRUDUi")
+ public static Object[][] dataProviderMibsArtifactCRUDUi() {
+ return new Object[][] {
+ {"mibsvFW_VFC.yml", ResourceTypeEnum.VFC},
+ {"mibsVL.yml", ResourceTypeEnum.VL},
+ {"mibsCP.yml", ResourceTypeEnum.CP}
+ };
+ }
+
+ // US820414
+ // Artifact UI CRUD on VFC/VL/CP
+ // TODO: Change download validation from download artifact via external API to UI
+ @Test(dataProvider="mibsArtifactCRUDUi")
+ public void mibsArtifactCRUDUi(String fileName, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ setLog("mibsArtifactCRUDUi");
+ String filePath = FileHandling.getFilePath(folder);
+
+ if(true){
+ throw new SkipException("Open bug 197101");
+ }
+
+ // import Resource
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser());
+ ResourceUIUtils.importVfc(resourceMetaData, filePath, fileName, getUser());
+
+ // get resourceUUID from BE
+ String resourceUUID = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1").getUUID();
+
+ // 2. Upload MIBs artifacts - SNMP_TRAP & SNMP_POLL.
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "SNMP_TRAP"));
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "SNMP_POLL"));
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact, new UploadArtifactPopup(true));
+
+ assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+
+ String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + deploymentArtifact.getArtifactLabel()).getText();
+ ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(deploymentArtifact.getArtifactLabel(), null, "1", deploymentArtifact.getArtifactType(), true, true, true, false);
+
+ // Verify that uploaded correct file by download artifact via external api
+ RestResponse restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID, artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE.toString());
+ File file = new File(deploymentArtifact.getFilepath() + deploymentArtifact.getFilename());
+ String readFileToString = FileUtils.readFileToString(file);
+ Assert.assertEquals(restResponse.getResponse(), readFileToString);
+
+ DeploymentArtifactPage.clickEditArtifact(deploymentArtifact.getArtifactLabel());
+ UploadArtifactPopup artifactPopup = new UploadArtifactPopup(true);
+ artifactPopup.loadFile(filePath, "CP.yml");
+ artifactPopup.clickDoneButton();
+
+ assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+ Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + deploymentArtifact.getArtifactLabel()).getText(), artifactUUID);
+ ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(deploymentArtifact.getArtifactLabel(), null, "2", deploymentArtifact.getArtifactType(), true, true, true, false);
+
+ // Verify that updated correct file by download artifact via external api
+ artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + deploymentArtifact.getArtifactLabel()).getText();
+ restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID, artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE.toString());
+ file = new File(deploymentArtifact.getFilepath() + "CP.yml");
+ readFileToString = FileUtils.readFileToString(file);
+ Assert.assertEquals(restResponse.getResponse(), readFileToString);
+
+ DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifact.getArtifactLabel());
+ DeploymentArtifactPage.clickOK();
+
+ assertTrue("No artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(0));
+ }
+
+ }
+
+ @DataProvider(name="mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption")
+ public static Object[][] dataProviderMibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption() {
+ return new Object[][] {
+ {"mibs1vFW_VFC.yml", ResourceTypeEnum.VFC},
+ // TODO: delete comment below when we will have support for VL on canvas
+// {"mibs1VL.yml", ResourceTypeEnum.VL},
+ {"mibs1CP.yml", ResourceTypeEnum.CP}
+ };
+ }
+
+ // US820414
+ // Import VFC/VL/CP, upload MIBs artifacts then drag it on VF & verify that deployment artifact have only download option
+ @Test(dataProvider="mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption")
+ public void mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption(String fileName, ResourceTypeEnum resourceTypeEnum) throws Exception {
+
+ setLog("mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption");
+
+ String filePath = FileHandling.getFilePath(folder);
+
+ // import Resource
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser());
+ ResourceUIUtils.importVfc(resourceMetaData, filePath, fileName, getUser());
+
+ // 2. Upload MIBs artifacts - SNMP_TRAP & SNMP_POLL.
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "SNMP_TRAP"));
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "SNMP_POLL"));
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact, new UploadArtifactPopup(true));
+ }
+ assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+
+ // 3. Check-in DataProvider resource.
+ ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName());
+
+ // 4. Create VF.
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ // 5. Click on composition.
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ // 6. Drag created DataProvider resource to canvas.
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(resourceMetaData.getName());
+ CanvasElement resourceInstance = vfCanvasManager.createElementOnCanvas(resourceMetaData.getName());
+
+ // 7. Click on DataProvider resource.
+ vfCanvasManager.clickOnCanvaElement(resourceInstance);
+
+ // 8. Click on deployment artifacts in right menu.
+ CompositionPage.showDeploymentArtifactTab();
+
+ // 9. Verify that each uploaded MIBs artifacts shows in deployment artifacts.
+ // 10. Verify that only have download option.
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ // Hover over webelement -> check that only dowload button displayed
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel());
+ Assert.assertEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DOWNLOAD.getValue() + deploymentArtifact.getArtifactLabel()).isDisplayed(), true);
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + deploymentArtifact.getArtifactLabel()), false);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel());
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPopup.MODAL_WINDOW.getValue()), false);
+ }
+
+
+ }
+
+ // US820414
+ // Create VF, upload MIBs artifacts then drag it on service & verify that deployment artifact have only download option
+ @Test
+ public void mibsArtifacsOnVFInstanceShouldOnlyHaveDownloadOption() throws Exception {
+ String filePath = FileHandling.getFilePath(folder);
+
+ // 1. Create VF.
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(resourceMetaData, getUser());
+
+ // 2. Upload MIBs artifacts - SNMP_TRAP & SNMP_POLL.
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "SNMP_TRAP"));
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "SNMP_POLL"));
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact, new UploadArtifactPopup(true));
+ }
+ assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+
+ // 3. Check-in VF.
+ ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName());
+
+ // 4. Create service.
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ // 5. Click on composition.
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ // 6. Drag created DataProvider s to canvas.
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(resourceMetaData.getName());
+ CanvasElement resourceInstance = canvasManager.createElementOnCanvas(resourceMetaData.getName());
+
+ // 7. Click on DataProvider resource.
+ canvasManager.clickOnCanvaElement(resourceInstance);
+
+ // 8. Click on deployment artifacts in right menu.
+ CompositionPage.showDeploymentArtifactTab();
+
+ // 9. Verify that each uploaded MIBs artifacts shows in deployment artifacts.
+ // 10. Verify that only have download option.
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ // Hover over webelement -> check that only dowload button displayed
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel());
+ Assert.assertEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DOWNLOAD.getValue() + deploymentArtifact.getArtifactLabel()).isDisplayed(), true);
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + deploymentArtifact.getArtifactLabel()), false);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel());
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPopup.MODAL_WINDOW.getValue()), false);
+ }
+ }
+
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MobProxy.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MobProxy.java
new file mode 100644
index 0000000000..179c300a18
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MobProxy.java
@@ -0,0 +1,144 @@
+/*-
+ * ============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.US;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.ProxySelector;
+import java.net.SocketAddress;
+import java.net.URI;
+import java.util.List;
+
+import java.net.Proxy;
+
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.remote.CapabilityType;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.testng.AssertJUnit;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.github.markusbernhardt.proxy.ProxySearch;
+import com.github.markusbernhardt.proxy.ProxySearch.Strategy;
+
+import net.lightbody.bmp.BrowserMobProxyServer;
+import net.lightbody.bmp.client.ClientUtil;
+import net.lightbody.bmp.core.har.Har;
+import net.lightbody.bmp.proxy.CaptureType;
+
+public class MobProxy {
+ public static WebDriver driver;
+ public static BrowserMobProxyServer server;
+
+ @BeforeClass
+ public void setup() throws Exception {
+
+ ProxySearch proxySearch = new ProxySearch();
+ proxySearch.addStrategy(Strategy.OS_DEFAULT);
+ proxySearch.addStrategy(Strategy.JAVA);
+ proxySearch.addStrategy(Strategy.BROWSER);
+ ProxySelector proxySelector = proxySearch.getProxySelector();
+
+ ProxySelector.setDefault(proxySelector);
+ URI home = URI.create("http://www.google.com");
+ System.out.println("ProxySelector: " + proxySelector);
+ System.out.println("URI: " + home);
+ List<Proxy> proxyList = proxySelector.select(home);
+ String host = null;
+ String port = null;
+ if (proxyList != null && !proxyList.isEmpty()) {
+ for (Proxy proxy : proxyList) {
+ System.out.println(proxy);
+ SocketAddress address = proxy.address();
+ if (address instanceof InetSocketAddress) {
+ host = ((InetSocketAddress) address).getHostName();
+ port = Integer.toString(((InetSocketAddress) address).getPort());
+ System.setProperty("http.proxyHost", host);
+ System.setProperty("http.proxyPort", port);
+ }
+ }
+ }
+
+ server = new BrowserMobProxyServer();
+ InetSocketAddress address = new InetSocketAddress(host, Integer.parseInt(port));
+ server.setChainedProxy(address);
+ server.start();
+ int port1 = server.getPort();
+ DesiredCapabilities seleniumCapabilities = new DesiredCapabilities();
+ seleniumCapabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
+ seleniumCapabilities.setCapability(CapabilityType.PROXY, ClientUtil.createSeleniumProxy(server));
+ driver = new FirefoxDriver(seleniumCapabilities);
+ server.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT);
+ System.out.println("Port started:" + port1);
+ }
+
+ @Test
+ public void first_test1() throws InterruptedException {
+
+ server.newHar("asdc.har");
+
+ driver.get("https://www.e-access.att.com/QA-SCRUM1/sdc1/portal#/dashboard");
+ driver.manage().window().maximize();
+
+ WebElement userNameTextbox = driver.findElement(By.name("userid"));
+ userNameTextbox.sendKeys("m99121");
+ WebElement passwordTextbox = driver.findElement(By.name("password"));
+ passwordTextbox.sendKeys("66-Percent");
+
+ WebElement submitButton = driver.findElement(By.name("btnSubmit"));
+ submitButton.click();
+ Thread.sleep(300);
+ WebElement buttonOK = driver.findElement(By.name("successOK"));
+ AssertJUnit.assertTrue(buttonOK.isDisplayed());
+ buttonOK.click();
+ Thread.sleep(2000);
+ driver.findElement(By.xpath(getXpath("main-menu-button-catalog"))).click();
+ Thread.sleep(2000);
+ driver.findElement(By.xpath(getXpath("checkbox-service"))).click();
+ Thread.sleep(2000);
+ }
+
+ public static String getXpath(String dataTestId){
+ return String.format("//*[@data-tests-id='%s']", dataTestId);
+ }
+
+ @AfterClass
+ public void shutdown() {
+ try {
+
+ // Get the HAR data
+ Har har = server.getHar();
+ File harFile = new File("C:\\temp\\asdc.har");
+ har.writeTo(harFile);
+
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ driver.quit();
+ server.stop();
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java
new file mode 100644
index 0000000000..9d460b0b0c
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java
@@ -0,0 +1,123 @@
+/*-
+ * ============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.US;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+public class NewArtifactTypeGuide extends SetupCDTest {
+
+ private String folder ="";
+
+ // US820276
+ // Upload information artifact of type GUIDE to VF
+ @Test
+ public void crudGuideInformationArtifactForVf() throws Exception {
+ String filePath = FileHandling.getFilePath(folder);
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(resourceMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ ArtifactInfo informationArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "GUIDE");
+
+ InformationalArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(informationArtifact);
+
+ assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+
+ String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText();
+ ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "1", informationArtifact.getArtifactType(), true, true, true, false);
+
+ InformationalArtifactPage.clickEditArtifact(informationArtifact.getArtifactLabel());
+ UploadArtifactPopup artifactPopup = new UploadArtifactPopup();
+ artifactPopup.loadFile(filePath, "CP.yml");
+ artifactPopup.clickDoneButton();
+
+ assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+ Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText(), artifactUUID);
+ ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "2", informationArtifact.getArtifactType(), true, true, true, false);
+
+ InformationalArtifactPage.clickDeleteArtifact(informationArtifact.getArtifactLabel());
+ InformationalArtifactPage.clickOK();
+ }
+
+ // US820276
+ // Upload information artifact of type GUIDE to VFC
+ @Test
+ public void crudGuideInformationArtifactForVfc() throws Exception {
+ String filePath = FileHandling.getFilePath(folder);
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VFC, getUser());
+ ResourceUIUtils.importVfc(resourceMetaData, filePath, "guidevFW_VFC.yml", getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ ArtifactInfo informationArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "GUIDE");
+
+ InformationalArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(informationArtifact);
+
+ assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+ String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText();
+ ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "1", informationArtifact.getArtifactType(), true, true, true, false);
+
+ InformationalArtifactPage.clickEditArtifact(informationArtifact.getArtifactLabel());
+ UploadArtifactPopup artifactPopup = new UploadArtifactPopup();
+ artifactPopup.loadFile(filePath, "CP.yml");
+ artifactPopup.clickDoneButton();
+
+ assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+ Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText(), artifactUUID);
+ ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "2", informationArtifact.getArtifactType(), true, true, true, false);
+
+ InformationalArtifactPage.clickDeleteArtifact(informationArtifact.getArtifactLabel());
+ InformationalArtifactPage.clickOK();
+ }
+
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java
new file mode 100644
index 0000000000..1f85ec21fb
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java
@@ -0,0 +1,117 @@
+/*-
+ * ============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.US;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.testng.annotations.Test;
+
+
+public class RemoveRestrictionOfDeploymentArtifacts extends SetupCDTest {
+
+ private String folder ="";
+
+ // US833330 - Story [BE] - remove restriction of deployment artifacts
+ // Create service without resource instance and without deployment artifacts and verify it can submit for testing
+ @Test
+ public void createServiceWithoutRIAndArtifacts() throws Exception {
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+ }
+
+
+ // US833330 - Story [BE] - remove restriction of deployment artifacts
+ // Create service with VL resource instance and without deployment artifacts and verify it can submit for testing
+ @Test
+ public void createServiceWithVlAndWithoutArtfiacts() throws Exception {
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK);
+ canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK);
+ canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK);
+
+ ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+ }
+
+ // US833330 - Story [BE] - remove restriction of deployment artifacts
+ // Create service with VF with informational artifacts and verify it can submit for testing
+ @Test
+ public void createServiceWithInformationalArtifacts() throws Exception {
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(resourceMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ String filePath = FileHandling.getFilePath(folder);
+ List<ArtifactInfo> informationalArtifactList = new ArrayList<ArtifactInfo>();
+ informationalArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+ informationalArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "GUIDE"));
+ for (ArtifactInfo informationalArtifact : informationalArtifactList) {
+ InformationalArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact, new UploadArtifactPopup(true));
+ }
+ ResourceGeneralPage.clickSubmitForTestingButton(resourceMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(resourceMetaData.getName());
+ TesterOperationPage.certifyComponent(resourceMetaData.getName());
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CanvasElement resourceInstance = canvasManager.createElementOnCanvas(resourceMetaData.getName());
+
+ ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java
new file mode 100644
index 0000000000..80801afafb
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java
@@ -0,0 +1,107 @@
+/*-
+ * ============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.US;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.sanity.Onboard;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
+import org.testng.annotations.Test;
+
+import com.clearspring.analytics.util.Pair;
+
+public class Service_Tests_UI extends SetupCDTest{
+
+ public Service_Tests_UI() {
+ // TODO Auto-generated constructor stub
+ }
+
+ // US839610 - E2E Declare VL / CP properties as inputs in service level
+ @Test
+ public void declareVL_CP_InputsInServiceLevel() throws Exception {
+ String vnfFile = "FDNT.zip";
+ Pair<String,Map<String,String>> VspName =OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+ ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser());
+ ServiceUIUtils.createService(servicemetadata, getUser());
+ GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
+ CanvasManager service_CanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(VspName.left);
+ GeneralUIUtils.waitForLoader();
+ CanvasElement vfi_Element = service_CanvasManager.createElementOnCanvas(VspName.left);
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue())
+ .click();
+ GeneralUIUtils.findComponentAndClick(servicemetadata.getName());
+ GeneralUIUtils.moveToStep(StepsEnum.INPUTS);
+ GeneralUIUtils.getWebElementByTestID("inputs-vf-instance-1").click();
+// GeneralUIUtils.onNameClicked(input);
+ }
+ @Test
+ public void CreateServiceWithCpInstance() throws Exception {
+ String vnfFile = "FDNT.zip";
+ Pair<String,Map<String,String>> VspName =OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+ ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser());
+ ServiceUIUtils.createService(servicemetadata, getUser());
+ GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
+ CanvasManager service_CanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(VspName.left);
+ GeneralUIUtils.waitForLoader();
+ CanvasElement vfi_Element = service_CanvasManager.createElementOnCanvas(VspName.left);
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue())
+ .click();
+ GeneralUIUtils.findComponentAndClick(servicemetadata.getName());
+ GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_VIEW);
+ String version = GeneralUIUtils.getWebElementByTestID("versionHeader").getText();
+ RestResponse service = ServiceRestUtils.getServiceByNameAndVersion(getUser(), servicemetadata.getName(),
+ version.substring(1));
+ List<String> serviceResponseArray = new ArrayList<String>();
+ serviceResponseArray =LocalGeneralUtilities.getValuesFromJsonArray(service);
+ servicemetadata.setUniqueId(serviceResponseArray.get(0));
+ RestResponse serviceResponse = ServiceRestUtils.getService(servicemetadata, getUser());
+ if (serviceResponseArray.get(0).contains("VL")) {
+ System.out.println("OK");
+ }
+
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ // TODO Auto-generated method stub
+ return UserRoleEnum.DESIGNER;
+ }
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java
new file mode 100644
index 0000000000..089ad9580f
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java
@@ -0,0 +1,125 @@
+/*-
+ * ============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.US;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
+import org.testng.Assert;
+
+
+
+
+
+
+public class Testing {
+
+ public static void main(String[] args) throws Exception {
+ // TODO Auto-generated method stub
+
+ File path = new File("C:\\Users\\rp955r\\Desktop\\US\\US831517\\TCExport\\TC1459238.yml");
+ ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path);
+
+ Map<String, Object> vl_us831517_1 = new HashMap<String, Object>();
+ vl_us831517_1.put("property_1", true);
+ vl_us831517_1.put("property_2", "init_value_2");
+ vl_us831517_1.put("property_3", "init_value_3");
+
+
+ Map<String, Object> vl_us831517_2 = new HashMap<String, Object>();
+ vl_us831517_2.put("property_1", false);
+ vl_us831517_2.put("property_2", "init_value_2");
+ vl_us831517_2.put("property_3", "new_value_3");
+
+ Map<String, Object> vl_us831517_3 = new HashMap<String, Object>();
+ vl_us831517_3.put("property_1", true);
+ vl_us831517_3.put("property_2", "init_value_2");
+ vl_us831517_3.put("property_3", "init_value_3");
+ vl_us831517_3.put("property_4", false);
+ vl_us831517_3.put("property_5", "init_value_5");
+
+ Map<String, Map<String, Object>> predefinedProperties = new HashMap<String, Map<String, Object>>();
+ predefinedProperties.put("VL_US831517_1", vl_us831517_1);
+ predefinedProperties.put("VL_US831517_2", vl_us831517_2);
+ predefinedProperties.put("VL_US831517_3", vl_us831517_3);
+
+ validateNodeTemplatesProperties(predefinedProperties, toscaDefinition);
+
+
+
+ }
+
+
+
+ private static void validateNodeTemplatesProperties(Map<String, Map<String, Object>> predefinedMap, ToscaDefinition toscaDefinition) {
+
+ for(String key: predefinedMap.keySet()) {
+ Map<String, Object> nodeTemplateProperties = getNodeTemplatePropertiesByNodeTemplateType(key, toscaDefinition);
+
+ predefinedMap.get(key).forEach((i,j) -> {
+ Assert.assertEquals(nodeTemplateProperties.get(i), j, "Expected that the properties will be equal");
+ });
+ }
+
+ }
+
+ // Get properties by type
+ private static Map<String, Object> getNodeTemplatePropertiesByNodeTemplateType(String nodeTemplateType, ToscaDefinition toscaDefinition) {
+ Map<String, Object> propertiesMap = null;
+
+ Set<String> nodeTemplates = getNodeTemplates(toscaDefinition);
+
+ for(String nodeTemplate: nodeTemplates) {
+ String currentNodeTemplateType = getNodeTemplateType(toscaDefinition, nodeTemplate);
+ currentNodeTemplateType = currentNodeTemplateType.substring(currentNodeTemplateType.lastIndexOf(".") + 1);
+ if(currentNodeTemplateType.equals(nodeTemplateType)) {
+ propertiesMap = getNodeTemplateProperties(toscaDefinition, nodeTemplate);
+ break;
+ }
+ }
+
+ return propertiesMap;
+ }
+
+ // Get node templates
+ private static Set<String> getNodeTemplates(ToscaDefinition toscaDefinition) {
+ Set<String> resourceInstanceArray = toscaDefinition.getTopology_template().getNode_templates().keySet();
+ return resourceInstanceArray;
+ }
+
+ // Get type of node template
+ private static String getNodeTemplateType(ToscaDefinition toscaDefinition, String nodeTemplate) {
+ return toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getType();
+ }
+
+ // Get properties of node template
+ private static Map<String, Object> getNodeTemplateProperties(ToscaDefinition toscaDefinition, String nodeTemplate) {
+ Map<String, Object> propertiesMap = toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getProperties();
+ return propertiesMap;
+ }
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java
new file mode 100644
index 0000000000..a038c284e1
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java
@@ -0,0 +1,156 @@
+/*-
+ * ============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.US;
+
+import static org.testng.AssertJUnit.assertNotNull;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+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.pages.ServiceGeneralPage;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.DownloadManager;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.CsarParserUtils;
+import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openecomp.sdc.ci.tests.verificator.VfModuleVerificator;
+import org.testng.annotations.Test;
+
+import com.clearspring.analytics.util.Pair;
+import com.aventstack.extentreports.Status;
+
+/**
+ * @author al714h
+ *
+ */
+
+public class VfModule extends SetupCDTest {
+
+
+ @Test
+ public void checkVfModulesCountAndStructure() throws Exception, AWTException {
+
+// String filepath = "src\\main\\resources\\Files\\VNFs";
+ String filepath = FileHandling.getVnfRepositoryPath();
+// String vnfFile = "LDSA.zip";
+ String vnfFile = "FDNT.zip";
+ getExtendTest().log(Status.INFO, String.format("Going to onboard the VNF %s......", vnfFile));
+ System.out.println(String.format("Going to onboard the VNF %s......", vnfFile));
+
+ OnboardingUtils.createVendorLicense(getUser());
+ Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser());
+ String vspName = createVendorSoftwareProduct.left;
+ //
+ DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId"));
+ File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+ List<TypeHeatMetaDefinition> listTypeHeatMetaDefinition = CsarParserUtils.getListTypeHeatMetaDefinition(latestFilefromDir);
+ //
+ getExtendTest().log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
+ HomePage.showVspRepository();
+ getExtendTest().log(Status.INFO, String.format("Going to import %s......", vnfFile.substring(0, vnfFile.indexOf("."))));
+
+ OnboardingUtils.importVSP(createVendorSoftwareProduct);
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ // Verify deployment artifacts
+ Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(latestFilefromDir.getAbsolutePath());
+ LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment"));
+ for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) {
+ if(deploymentArtifact.getType().equals("HEAT_ENV")) {
+ continue;
+ }
+ System.out.println("--------------");
+ System.out.println(deploymentArtifact.getFileName());
+ System.out.println(deploymentArtifact.getType());
+// System.out.println(deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf(".")));
+ if(deploymentArtifact.getFileName().contains(".")) {
+ ArtifactUIUtils.validateArtifactNameVersionType(deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf(".")), "1", deploymentArtifact.getType());
+ } else {
+ ArtifactUIUtils.validateArtifactNameVersionType(deploymentArtifact.getFileName().trim(), "1", deploymentArtifact.getType());
+ }
+
+ }
+
+ DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile);
+
+ DeploymentArtifactPage.clickSubmitForTestingButton(vspName);
+
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CompositionPage.searchForElement(vspName);
+ CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
+ CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
+ assertNotNull(vfElement);
+ ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+ ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+ GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_TEMPLATE.getValue());
+ latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+
+// verification
+ Service service = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceMetadata.getName(), serviceMetadata.getVersion());
+ ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(latestFilefromDir);
+
+// compare number of vf modules defined in HEAT.meta file vs Service TOSCA yaml
+ VfModuleVerificator.compareNumberOfVfModules(listTypeHeatMetaDefinition, toscaDefinition);
+ VfModuleVerificator.verifyGroupMetadata(toscaDefinition, service);
+
+ getExtendTest().log(Status.INFO, String.format("Onboarding %s test is passed ! ", vnfFile));
+
+ }
+
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java
new file mode 100644
index 0000000000..71c2612a82
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java
@@ -0,0 +1,94 @@
+/*-
+ * ============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.US;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ArtifactPageEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.sanity.Onboard;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class Vf_Tests_UI extends SetupCDTest{
+
+ public Vf_Tests_UI() {
+ // TODO Auto-generated constructor stub
+ }
+ public void uploadHeatEnvVFLevel() throws Exception {
+
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ }
+
+// @Test
+// // Download ENV file from VF level.
+// public void downloadEnvVFLevel() throws AWTException, Exception {
+// String firstEnvArtifact = "base_stsi_dnt_frwl.env";
+// String secondEnvArtifact = "mod_vmsi_dnt_fw_parent.env";
+// String filePath=Config.instance().getWindowsDownloadDirectory();
+// String vnfFile = "FDNT.zip";
+// OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+// Map<String,File> mD5OfFilesToValidate = new HashMap<String,File>();
+// mD5OfFilesToValidate.put(firstEnvArtifact,new File(FileHandling.getResourcesEnvFilesPath() + firstEnvArtifact));
+// mD5OfFilesToValidate.put(secondEnvArtifact,new File(FileHandling.getResourcesEnvFilesPath() + secondEnvArtifact));
+// List<File>filesToBeDeleted=new ArrayList<>(mD5OfFilesToValidate.values());
+// FileHandling.deleteLastDowloadedFiles(filesToBeDeleted);
+// ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+// List<WebElement> allDisplayedArtifcats = DeploymentArtifactPage.getDeploymentArtifactsNamesWorkSpace();
+// for (int i=0;i<allDisplayedArtifcats.size();i++) {
+// if (DeploymentArtifactPage.geteArtifactType(allDisplayedArtifcats.get(i).getText()).equalsIgnoreCase("heat")) {
+// DeploymentArtifactPage.clickDownloadEnvArtifact(allDisplayedArtifcats.get(i));
+// GeneralUIUtils.waitForLoader();
+// File latestFilefromDir = FileHandling.getRequiredFromDir(filePath,allDisplayedArtifcats.get(i).getText()+".env");
+// VfVerificator.verifyFilesChecksum(latestFilefromDir,mD5OfFilesToValidate.get(latestFilefromDir.getName()));
+//
+// }
+// }
+// }
+ @Override
+ protected UserRoleEnum getRole() {
+ // TODO Auto-generated method stub
+ return UserRoleEnum.DESIGNER;
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java
new file mode 100644
index 0000000000..291a1dbb2e
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java
@@ -0,0 +1,299 @@
+/*-
+ * ============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.US;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+
+public class extendNode_TemplatePropertiesWithDefaultValues extends SetupCDTest {
+
+ @DataProvider(name="customizeServiceVfUsedVlsCps")
+ public static Object[][] dataProviderCustomizeServiceVfUsedVlsCps() {
+ return new Object[][] {
+// {"VL_US831517_1.yml", "VL_US831517_2.yml", "VL_US831517_3.yml", ResourceTypeEnum.VL, ComponentTypeEnum.SERVICE},
+ {"CP_US831517_1.yml", "CP_US831517_2.yml", "CP_US831517_3.yml", ResourceTypeEnum.CP, ComponentTypeEnum.SERVICE},
+ {"VL_US831517_1.yml", "VL_US831517_2.yml", "VL_US831517_3.yml", ResourceTypeEnum.VL, ComponentTypeEnum.RESOURCE},
+ {"CP_US831517_1.yml", "CP_US831517_2.yml", "CP_US831517_3.yml", ResourceTypeEnum.CP, ComponentTypeEnum.RESOURCE},
+ };
+ }
+
+ // US831517 - Story [BE] - Extend node_template properties with default values
+ @Test(dataProvider="customizeServiceVfUsedVlsCps")
+ public void customizeServiceVfUsedVlsCps(String fileName_vl1, String fileName_vl2, String fileName_vl3, ResourceTypeEnum resourceTypeEnum, ComponentTypeEnum componentTypeEnum) throws Exception {
+ setLog("Extend node_template properties with default values");
+
+ // import Resource
+ LinkedList<String> assetsName = importThreeAsset(fileName_vl1, fileName_vl2, fileName_vl3, resourceTypeEnum);
+
+ if(ComponentTypeEnum.SERVICE == componentTypeEnum) {
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ } else {
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(resourceMetaData, getUser());
+ }
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CanvasElement resourceInstance1 = canvasManager.createElementOnCanvas(assetsName.get(0));
+ CanvasElement resourceInstance2 = canvasManager.createElementOnCanvas(assetsName.get(1));
+ CanvasElement resourceInstance3 = canvasManager.createElementOnCanvas(assetsName.get(2));
+
+ canvasManager.clickOnCanvaElement(resourceInstance1);
+ CompositionPage.showPropertiesAndAttributesTab();
+ PropertiesUIUtils.changePropertyDefaultValueInComposition("property_1", "false");
+
+ canvasManager.clickOnCanvaElement(resourceInstance2);
+ CompositionPage.showPropertiesAndAttributesTab();
+ PropertiesUIUtils.changePropertyDefaultValueInComposition("property_3", "customize");
+
+ canvasManager.clickOnCanvaElement(resourceInstance3);
+ CompositionPage.showPropertiesAndAttributesTab();
+ PropertiesUIUtils.changePropertyDefaultValueInComposition("property_2", "customize derived");
+ PropertiesUIUtils.changePropertyDefaultValueInComposition("property_5", "customize new");
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+ ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+ GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_TEMPLATE.getValue());
+
+ // TODO: Replace it by automatic download to path
+ // TODO: After it remove
+ File path = new File("C:\\Users\\rp955r\\Desktop\\US\\US831517\\TCExport\\TC1459238.yml");
+ ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path);
+
+ Map<String, Object> vl_us831517_1 = new HashMap<String, Object>();
+ vl_us831517_1.put("property_1", false);
+ vl_us831517_1.put("property_2", "init_value_2");
+ vl_us831517_1.put("property_3", "init_value_3");
+
+
+ Map<String, Object> vl_us831517_2 = new HashMap<String, Object>();
+ vl_us831517_2.put("property_1", false);
+ vl_us831517_2.put("property_2", "init_value_2");
+ vl_us831517_2.put("property_3", "customize");
+
+ Map<String, Object> vl_us831517_3 = new HashMap<String, Object>();
+ vl_us831517_3.put("property_1", true);
+ vl_us831517_3.put("property_2", "customize derived");
+ vl_us831517_3.put("property_3", "init_value_3");
+ vl_us831517_3.put("property_4", false);
+ vl_us831517_3.put("property_5", "customize new");
+
+ Map<String, Map<String, Object>> predefinedProperties = new HashMap<String, Map<String, Object>>();
+ predefinedProperties.put("VL_US831517_1", vl_us831517_1);
+ predefinedProperties.put("VL_US831517_2", vl_us831517_2);
+ predefinedProperties.put("VL_US831517_3", vl_us831517_3);
+
+ validateNodeTemplatesProperties(predefinedProperties, toscaDefinition);
+
+ RestCDUtils.deleteOnDemand();
+ }
+
+ @DataProvider(name="serviceVfUsedVlsCps")
+ public static Object[][] dataProviderServiceVfUsedVlsCps() {
+ return new Object[][] {
+ {"VL_US831517_1.yml", "VL_US831517_2.yml", "VL_US831517_3.yml", ResourceTypeEnum.VL, ComponentTypeEnum.SERVICE},
+ {"CP_US831517_1.yml", "CP_US831517_2.yml", "CP_US831517_3.yml", ResourceTypeEnum.CP, ComponentTypeEnum.SERVICE},
+ {"VL_US831517_1.yml", "VL_US831517_2.yml", "VL_US831517_3.yml", ResourceTypeEnum.VL, ComponentTypeEnum.RESOURCE},
+ {"CP_US831517_1.yml", "CP_US831517_2.yml", "CP_US831517_3.yml", ResourceTypeEnum.CP, ComponentTypeEnum.RESOURCE},
+ };
+ }
+
+
+ // US831517 - Story [BE] - Extend node_template properties with default values
+ @Test(dataProvider="serviceVfUsedVlsCps")
+ public void serviceVfUsedVlsCps(String fileName_vl1, String fileName_vl2, String fileName_vl3, ResourceTypeEnum resourceTypeEnum, ComponentTypeEnum componentTypeEnum) throws Exception {
+ setLog("Extend node_template properties with default values");
+
+ // import Resource
+ LinkedList<String> assetsName = importThreeAsset(fileName_vl1, fileName_vl2, fileName_vl3, resourceTypeEnum);
+
+ if(ComponentTypeEnum.SERVICE == componentTypeEnum) {
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ } else {
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(resourceMetaData, getUser());
+ }
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ canvasManager.createElementOnCanvas(assetsName.get(0));
+ canvasManager.createElementOnCanvas(assetsName.get(1));
+ canvasManager.createElementOnCanvas(assetsName.get(2));
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+ ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+ GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_TEMPLATE.getValue());
+
+ // TODO: Replace it by automatic download to path
+ // TODO: After it remove
+ File path = new File("C:\\Users\\rp955r\\Desktop\\US\\US831517\\TCExport\\TC1459238.yml");
+ ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path);
+
+ Map<String, Object> vl_us831517_1 = new HashMap<String, Object>();
+ vl_us831517_1.put("property_1", true);
+ vl_us831517_1.put("property_2", "init_value_2");
+ vl_us831517_1.put("property_3", "init_value_3");
+
+
+ Map<String, Object> vl_us831517_2 = new HashMap<String, Object>();
+ vl_us831517_2.put("property_1", false);
+ vl_us831517_2.put("property_2", "init_value_2");
+ vl_us831517_2.put("property_3", "new_value_3");
+
+ Map<String, Object> vl_us831517_3 = new HashMap<String, Object>();
+ vl_us831517_3.put("property_1", true);
+ vl_us831517_3.put("property_2", "init_value_2");
+ vl_us831517_3.put("property_3", "init_value_3");
+ vl_us831517_3.put("property_4", false);
+ vl_us831517_3.put("property_5", "init_value_5");
+
+ Map<String, Map<String, Object>> predefinedProperties = new HashMap<String, Map<String, Object>>();
+ predefinedProperties.put("VL_US831517_1", vl_us831517_1);
+ predefinedProperties.put("VL_US831517_2", vl_us831517_2);
+ predefinedProperties.put("VL_US831517_3", vl_us831517_3);
+
+ validateNodeTemplatesProperties(predefinedProperties, toscaDefinition);
+
+ RestCDUtils.deleteOnDemand();
+ }
+
+ private LinkedList<String> importThreeAsset(String fileName_vl1, String fileName_vl2, String fileName_vl3, ResourceTypeEnum resourceTypeEnum) throws Exception {
+ LinkedList<String> assetsNames = new LinkedList<String>();
+
+ String filePath = System.getProperty("filepath");
+ if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+ filePath = FileHandling.getResourcesFilesPath() + File.separator + "US831517" + File.separator;
+ }
+ else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+ filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator + "US831517" + File.separator;
+ }
+
+ // import Resource
+ ResourceReqDetails resourceMetaDataVl1 = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser());
+ assetsNames.add(resourceMetaDataVl1.getName());
+ ResourceUIUtils.importVfc(resourceMetaDataVl1, filePath, fileName_vl1, getUser());
+ GeneralPageElements.clickSubmitForTestingButton(resourceMetaDataVl1.getName());
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(resourceMetaDataVl1.getName());
+ TesterOperationPage.certifyComponent(resourceMetaDataVl1.getName());
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+
+ ResourceReqDetails resourceMetaDataVl2 = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser());
+ assetsNames.add(resourceMetaDataVl2.getName());
+ ResourceUIUtils.importVfc(resourceMetaDataVl2, filePath, fileName_vl2, getUser());
+ GeneralPageElements.clickCheckinButton(resourceMetaDataVl2.getName());
+
+ ResourceReqDetails resourceMetaDataVl3 = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser());
+ assetsNames.add(resourceMetaDataVl3.getName());
+ ResourceUIUtils.importVfc(resourceMetaDataVl3, filePath, fileName_vl3, getUser());
+ GeneralPageElements.clickCheckinButton(resourceMetaDataVl2.getName());
+
+ return assetsNames;
+ }
+
+
+ private static void validateNodeTemplatesProperties(Map<String, Map<String, Object>> predefinedMap, ToscaDefinition toscaDefinition) {
+
+ for(String key: predefinedMap.keySet()) {
+ Map<String, Object> nodeTemplateProperties = getNodeTemplatePropertiesByNodeTemplateType(key, toscaDefinition);
+
+ predefinedMap.get(key).forEach((i,j) -> {
+ Assert.assertEquals(nodeTemplateProperties.get(i), j, "Expected that the properties will be equal");
+ });
+ }
+
+ }
+
+ // Get properties by type
+ private static Map<String, Object> getNodeTemplatePropertiesByNodeTemplateType(String nodeTemplateType, ToscaDefinition toscaDefinition) {
+ Map<String, Object> propertiesMap = null;
+
+ Set<String> nodeTemplates = getNodeTemplates(toscaDefinition);
+
+ for(String nodeTemplate: nodeTemplates) {
+ String currentNodeTemplateType = getNodeTemplateType(toscaDefinition, nodeTemplate);
+ currentNodeTemplateType = currentNodeTemplateType.substring(currentNodeTemplateType.lastIndexOf(".") + 1);
+ if(currentNodeTemplateType.equals(nodeTemplateType)) {
+ propertiesMap = getNodeTemplateProperties(toscaDefinition, nodeTemplate);
+ break;
+ }
+ }
+
+ return propertiesMap;
+ }
+
+ // Get node templates
+ private static Set<String> getNodeTemplates(ToscaDefinition toscaDefinition) {
+ Set<String> resourceInstanceArray = toscaDefinition.getTopology_template().getNode_templates().keySet();
+ return resourceInstanceArray;
+ }
+
+ // Get type of node template
+ private static String getNodeTemplateType(ToscaDefinition toscaDefinition, String nodeTemplate) {
+ return toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getType();
+ }
+
+ // Get properties of node template
+ private static Map<String, Object> getNodeTemplateProperties(ToscaDefinition toscaDefinition, String nodeTemplate) {
+ Map<String, Object> propertiesMap = toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getProperties();
+ return propertiesMap;
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/businesslogic/ArtifactBusinessLogic.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/businesslogic/ArtifactBusinessLogic.java
new file mode 100644
index 0000000000..6dce83fd40
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/businesslogic/ArtifactBusinessLogic.java
@@ -0,0 +1,208 @@
+/*-
+ * ============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.businesslogic;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.HeatAndHeatEnvNamesPair;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.HeatWithParametersDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+
+import com.clearspring.analytics.util.Pair;
+
+public class ArtifactBusinessLogic {
+
+ private final static String[] okFileExtensions = new String[] {"yaml", "yml", "env"};
+ private static final String PARAMETERS = "parameters";
+ private static final String DEPLOYMENT = "Deployment";
+
+ public static synchronized Map<String, File> createEnvFilesListFromCsar(String vspName, String filePath) throws Exception{
+ Map<String, File> generatedEnvFiles = new HashMap<>();
+ File csarFile= HomePage.downloadVspCsarToDefaultDirectory(vspName);
+ FileHandling.unzip(csarFile.toString(), filePath);
+ List<File> yamlList = getHeatFilesCreatedFromCsar(csarFile, filePath);
+ Map<String, HeatAndHeatEnvNamesPair> filesPairMap = getFilesPairMap(yamlList);
+ generatedEnvFiles = generateDefaultEnvFiles(filesPairMap, filePath);
+ return generatedEnvFiles;
+ }
+
+ public static synchronized List<File> getHeatFilesCreatedFromCsar(File pathToDirectory, String filePath) throws Exception {
+ List<File> fileList = new ArrayList<>();
+ String artifactsFilePath = filePath + "Artifacts" + File.separator;
+ List<File> fileListFromArtifactsDirectory = FileHandling.getHeatAndHeatEnvArtifactsFromZip(new File(artifactsFilePath), okFileExtensions);
+ Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(pathToDirectory.toString());
+ LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get(DEPLOYMENT));
+ for(HeatMetaFirstLevelDefinition deploymentArtifact : deploymentArtifacts){
+ String type = deploymentArtifact.getType();
+ if(type.equals(ArtifactTypeEnum.HEAT.getType()) ||
+ type.equals(ArtifactTypeEnum.HEAT_ENV.getType()) ||
+ type.equals(ArtifactTypeEnum.HEAT_VOL.getType()) ||
+ type.equals(ArtifactTypeEnum.HEAT_NET.getType())){
+ File file = (new File(artifactsFilePath + deploymentArtifact.getFileName()));
+ if(fileListFromArtifactsDirectory.contains(file)){
+ fileList.add(file);
+ }else{
+ assertTrue("File " + file + " does not exist", false);
+ }
+ }
+ }
+ return fileList;
+ }
+ public static synchronized Map<String, HeatAndHeatEnvNamesPair> getFilesPairMap(List<File> generatedEnvFiles) {
+
+ Map<String, HeatAndHeatEnvNamesPair> heatAndHeatEnvPairs= new HashMap<>();
+ for(File file : generatedEnvFiles){
+ String[] fileName = file.getName().split("\\.");
+ String currentKey = fileName[0];
+ String currentExtension = fileName[1];
+ HeatAndHeatEnvNamesPair pair;
+ if(!heatAndHeatEnvPairs.containsKey(currentKey)){
+ pair = new HeatAndHeatEnvNamesPair();
+ heatAndHeatEnvPairs.put(currentKey, pair);
+ }else{
+ pair = heatAndHeatEnvPairs.get(currentKey);
+ }
+ setFileToPair(file, currentExtension, pair);
+ }
+ return heatAndHeatEnvPairs;
+ }
+
+ /**
+ * The method fill list of HeatWithParametersDefinition parameters
+ * @param deploymentArtifacts
+ * @return
+ */
+ public static synchronized List<HeatWithParametersDefinition> extractHeatWithParametersDefinition(Map<String, ArtifactDefinition> deploymentArtifacts) {
+
+ List<HeatWithParametersDefinition> heatAndEnvLabelList = new ArrayList<>();
+
+ for (Entry<String, ArtifactDefinition> artifactDefinitionChild : deploymentArtifacts.entrySet()){
+ if(artifactDefinitionChild.getValue().getArtifactType().equals(ArtifactTypeEnum.HEAT_ENV.getType())){
+ for(Entry<String, ArtifactDefinition> artifactDefinitionParent : deploymentArtifacts.entrySet()){
+ if(artifactDefinitionChild.getValue().getGeneratedFromId().equals(artifactDefinitionParent.getValue().getUniqueId())){
+ String heatLabel = artifactDefinitionParent.getValue().getArtifactLabel();
+ String heatArtifactType = artifactDefinitionParent.getValue().getArtifactType();
+ String heatArtifactDisplayName = artifactDefinitionParent.getValue().getArtifactDisplayName();
+ List<HeatParameterDataDefinition> heatParameterDefinition = artifactDefinitionParent.getValue().getHeatParameters();
+ String heatEnvLabel = artifactDefinitionChild.getValue().getArtifactLabel();
+ String heatEnvArtifactType = artifactDefinitionChild.getValue().getArtifactType();
+ heatAndEnvLabelList.add(new HeatWithParametersDefinition(heatLabel, heatEnvLabel, heatArtifactType, heatEnvArtifactType, heatArtifactDisplayName, heatParameterDefinition));
+ break;
+ }
+ }
+ }
+ }
+ return heatAndEnvLabelList;
+ }
+
+
+ public static synchronized void setFileToPair(File file, String currentExtension, HeatAndHeatEnvNamesPair pair) {
+ if(!currentExtension.equals("env")){
+ pair.setHeatFileName(file);
+ }else{
+ pair.setHeatEnvFileName(file);
+ }
+ }
+
+ public static synchronized Map<String, File> generateDefaultEnvFiles(Map<String, HeatAndHeatEnvNamesPair> filesPairMap, String filePath) throws Exception {
+
+ Map<String, File> generatedEnvFilesMap = new HashMap<>();
+ for(Entry<String, HeatAndHeatEnvNamesPair> pair : filesPairMap.entrySet()){
+ Map<String, Pair<String, Object>> envParametersMap = getEnvParametersMap(pair);
+ File generatedEnvFile = createEnvFile(envParametersMap, new File(filePath + pair.getKey() + ".env"));
+ generatedEnvFilesMap.put(pair.getKey(), generatedEnvFile);
+ }
+ return generatedEnvFilesMap;
+ }
+
+ public static synchronized File createEnvFile(Map<String, Pair<String, Object>> envParametersMap, File fileToWrite) throws IOException {
+
+ FileHandling.writeToFile(fileToWrite, PARAMETERS+":", 0);
+ FileHandling.writeToFile(fileToWrite, envParametersMap, 2);
+ return fileToWrite;
+ }
+
+ public static synchronized Map<String, Pair<String, Object>> getEnvParametersMap(Entry<String, HeatAndHeatEnvNamesPair> pair) throws Exception {
+ File heatFileName = pair.getValue().getHeatFileName();
+ File heatEnvFileName = pair.getValue().getHeatEnvFileName();
+ Map<String, Pair<String, Object>> envParametersMap = new HashMap<>();
+ fillParametersMapFromHeatFile(heatFileName, envParametersMap);
+ fillParametersMapFromHeatEnvFile(heatEnvFileName, envParametersMap);
+ return envParametersMap;
+ }
+
+ public static synchronized void fillParametersMapFromHeatEnvFile(File heatEnvFileName, Map<String, Pair<String, Object>> envParametersMap) throws Exception {
+ if(heatEnvFileName != null){
+ Map<String, Object> mapHeatEnvFileParameters = FileHandling.parseYamlFileToMapByPattern(heatEnvFileName, PARAMETERS);
+ for (Map.Entry<String, Object> parameter : mapHeatEnvFileParameters.entrySet()){
+ String key = parameter.getKey();
+ Pair<String, Object> pair;
+ if(envParametersMap.containsKey(key)){
+ if(envParametersMap.get(key).left.equals("string") && parameter.getValue() != null){
+ pair = Pair.create(envParametersMap.get(key).left, "\"" + parameter.getValue() + "\"");
+ }else if(envParametersMap.get(key).left.equals("string") && parameter.getValue() == null){
+ pair = Pair.create(envParametersMap.get(key).left, "");
+ }else if(parameter.getValue() == null){
+ pair = Pair.create(envParametersMap.get(key).left, "");
+ }else{
+ pair = Pair.create(envParametersMap.get(key).left, parameter.getValue());
+ }
+ envParametersMap.put(key, pair);
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static synchronized void fillParametersMapFromHeatFile(File heatFileName, Map<String, Pair<String, Object>> envParametersMap) throws Exception {
+ Map<String, Object> mapHeatFileParameters = FileHandling.parseYamlFileToMapByPattern(heatFileName, PARAMETERS);
+ for (Map.Entry<String, Object> parameter : mapHeatFileParameters.entrySet()){
+ Map<String, Object> value = (Map<String, Object>) parameter.getValue();
+ Pair<String, Object> pair;
+ if(value.get("type").toString().equals("string") && value.get("default") != null ){
+ pair = Pair.create(value.get("type").toString(), "\"" + value.get("default") + "\"");
+ }else if(value.get("type").toString().equals("string") && value.get("default") == null){
+ pair = Pair.create(value.get("type").toString(), "");
+ }else if(value.get("default") == null){
+ pair = Pair.create(value.get("type").toString(), "");
+ }else{
+ pair = Pair.create(value.get("type").toString(), value.get("default"));
+ }
+ envParametersMap.put(parameter.getKey(), pair);
+ }
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactInfo.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactInfo.java
new file mode 100644
index 0000000000..1302cb52af
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactInfo.java
@@ -0,0 +1,105 @@
+/*-
+ * ============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.datatypes;
+
+public class ArtifactInfo {
+
+ private String filepath;
+ private String filename;
+ private String description;
+ private String artifactType;
+ private String artifactLabel;
+ private String artifactVersion;
+
+ public ArtifactInfo(String filepath, String filename, String description, String artifactLabel,
+ String artifactType) {
+ super();
+ this.filepath = filepath;
+ this.filename = filename;
+ this.description = description;
+ this.artifactType = artifactType;
+ this.artifactLabel = artifactLabel;
+ }
+
+ public ArtifactInfo(String filepath, String filename, String description, String artifactLabel,
+ String artifactType, String artifactVersion) {
+ super();
+ this.filepath = filepath;
+ this.filename = filename;
+ this.description = description;
+ this.artifactType = artifactType;
+ this.artifactLabel = artifactLabel;
+ this.artifactVersion = artifactVersion;
+ }
+
+ public ArtifactInfo() {
+ super();
+ }
+
+ public String getArtifactVersion() {
+ return artifactVersion;
+ }
+
+ public void setArtifactVersion(String artifactVersion) {
+ this.artifactVersion = artifactVersion;
+ }
+
+ public String getFilepath() {
+ return filepath;
+ }
+
+ public void setFilepath(String filepath) {
+ this.filepath = filepath;
+ }
+
+ public String getFilename() {
+ return filename;
+ }
+
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getArtifactType() {
+ return artifactType;
+ }
+
+ public void setArtifactType(String artifactType) {
+ this.artifactType = artifactType;
+ }
+
+ public String getArtifactLabel() {
+ return artifactLabel;
+ }
+
+ public void setArtifactLabel(String artifactLabel) {
+ this.artifactLabel = artifactLabel;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasElement.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasElement.java
new file mode 100644
index 0000000000..818b488d64
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasElement.java
@@ -0,0 +1,65 @@
+/*-
+ * ============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.datatypes;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+
+public final class CanvasElement {
+ private final String uniqueId;
+ private ImmutablePair<Integer, Integer> location;
+ private LeftPanelCanvasItems normativeElementType;
+ private String elementType;
+
+ CanvasElement(String name, ImmutablePair<Integer, Integer> location, LeftPanelCanvasItems canvasItem) {
+ super();
+ this.uniqueId = name;
+ this.location = location;
+ normativeElementType = canvasItem;
+ }
+
+ CanvasElement(String name, ImmutablePair<Integer, Integer> location, String 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 LeftPanelCanvasItems getNormativeElementType() {
+ return normativeElementType;
+ }
+
+ public String getElementType() {
+ return elementType;
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java
new file mode 100644
index 0000000000..25ed4c2d91
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java
@@ -0,0 +1,268 @@
+/*-
+ * ============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.datatypes;
+
+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.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.StaleElementReferenceException;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+
+public final class CanvasManager {
+ private Map<String, CanvasElement> canvasElements;
+ private Actions actions;
+ private WebElement canvas;
+ private int reduceCanvasWidthFactor;
+ private CanvasElement canvasElement;
+ // Offsets Are used to find upper right corner of canvas element in order to
+ // connect links
+ private static final int CANVAS_ELEMENT_Y_OFFSET = 30;
+ private static final int CANVAS_ELEMENT_X_OFFSET = 18; // 14 - 27
+
+ private 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();
+ 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 moveToFreeLocation(String containerName) {
+ int maxWait = 5000;
+ int sumOfWaiting = 0;
+ int napPeriod = 200;
+ boolean isKeepWaiting = false;
+ while (!isKeepWaiting) {
+ ImmutablePair<Integer, Integer> freePosition = getFreePosition();
+ actions.moveToElement(canvas, freePosition.left, freePosition.right);
+ actions.clickAndHold();
+ actions.release();
+ actions.perform();
+ isKeepWaiting = GeneralUIUtils.getWebElementByTestID("selectedCompTitle").getText()
+ .equals(containerName);
+ sumOfWaiting += napPeriod;
+ if (sumOfWaiting > maxWait) {
+ Assert.fail("Can't click on VF");
+ }
+ }
+ }
+
+ public void clickOnCanvaElement(CanvasElement canvasElement) {
+ actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right);
+ actions.clickAndHold();
+ actions.release();
+ actions.perform();
+ actions.click().perform();
+ GeneralUIUtils.ultimateWait();
+ ExtentTestActions.log(Status.INFO, String.format("Canvas element %s selected", canvasElement.getElementType()));
+ }
+
+ 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.ultimateWait();
+ if (canvasElement.getElementType().contains("-")){
+ ExtentTestActions.log(Status.INFO, String.format("Canvas element %s removed", canvasElement.getElementType().split("-")[4]));
+ }
+ else{
+ ExtentTestActions.log(Status.INFO, String.format("Canvas element %s removed", canvasElement.getElementType()));
+ }
+ }
+
+ private WebElement findClickElement(String dataTestId) {
+ int attempts = 0;
+ while (attempts < 2) {
+ try {
+ return GeneralUIUtils.getWebElementByTestID(dataTestId);
+ } catch (StaleElementReferenceException e) {
+ }
+ attempts++;
+ }
+ return null;
+ }
+
+ public CanvasElement createElementOnCanvas(String elementName) throws Exception {
+ String actionDuration = GeneralUIUtils.getActionDuration(() -> {
+ try {
+ canvasElement = createElementOnCanvasWithoutDuration(elementName);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ });
+
+ if (canvasElement != null){
+ ExtentTestActions.log(Status.INFO, String.format("The element %s should now be on the canvas", elementName), actionDuration);
+ }
+ return canvasElement;
+ }
+
+ private CanvasElement createElementOnCanvasWithoutDuration(String elementDataTestId) throws Exception {
+ try {
+ WebElement element = findClickElement(elementDataTestId);
+ ImmutablePair<Integer, Integer> freePosition = getFreePosition();
+ actions.moveToElement(element, 20, 20);
+ actions.clickAndHold();
+ actions.moveToElement(canvas, freePosition.left, freePosition.right);
+ actions.release();
+ actions.perform();
+ GeneralUIUtils.ultimateWait();
+ String uniqueId = elementDataTestId + "_" + UUID.randomUUID().toString();
+ CanvasElement canvasElement = new CanvasElement(uniqueId, freePosition, elementDataTestId);
+ addCanvasElement(canvasElement);
+ GeneralUIUtils.ultimateWait();
+ return canvasElement;
+ }
+ catch (Exception e) {
+ System.out.println("Can't create element on canvas");
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public CanvasElement createElementOnCanvas(LeftPanelCanvasItems canvasItem) throws Exception {
+ return createElementOnCanvas(canvasItem.getValue());
+ }
+
+ private ImmutablePair<Integer, Integer> getFreePosition() {
+ 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 {
+ ExtentTestActions.log(Status.INFO, String.format("Linking between the %s instance and the %s instance.", firstElement.getElementType(), secondElement.getElementType()));
+ drawSimpleLink(firstElement, secondElement);
+ selectReqAndCapAndConnect();
+ ExtentTestActions.log(Status.INFO, String.format("The instances %s and %s should now be connected.", firstElement.getElementType(), secondElement.getElementType()));
+ }
+
+ private void selectReqAndCapAndConnect() throws Exception {
+ // Select First Cap
+ GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0).click();
+ // Select First Req
+ GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0).click();
+ // Connect
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click();
+
+ GeneralUIUtils.waitForLoader();
+ }
+
+ private void drawSimpleLink(CanvasElement firstElement, CanvasElement secondElement) throws Exception {
+ 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();
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public String updateElementNameInCanvas(CanvasElement canvasElement, String newInstanceName) throws Exception {
+ GeneralUIUtils.ultimateWait();;
+ clickOnCanvaElement(canvasElement);
+ WebElement updateInstanceName = GeneralUIUtils.getWebElementBy(By.id("editPencil"));
+ updateInstanceName.click();
+ WebElement instanceNameField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.INSTANCE_NAME_FIELD.getValue());
+ String oldInstanceName = instanceNameField.getAttribute("value");
+ instanceNameField.clear();
+ instanceNameField.sendKeys(newInstanceName);
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click();
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("w-sdc-modal-resource-instance-name"));
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Name of element instance changed from %s to %s", oldInstanceName, newInstanceName));
+ return oldInstanceName;
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CatalogFilterTitlesEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CatalogFilterTitlesEnum.java
new file mode 100644
index 0000000000..1335b51788
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CatalogFilterTitlesEnum.java
@@ -0,0 +1,37 @@
+/*-
+ * ============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.datatypes;
+
+public enum CatalogFilterTitlesEnum {
+
+ TYPE("typeFilterTitle"), CATEGORIES("categoriesFilterTitle"), STATUS("statusFilterTitle");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private CatalogFilterTitlesEnum(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CheckBoxStatusEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CheckBoxStatusEnum.java
new file mode 100644
index 0000000000..ffa17ee607
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CheckBoxStatusEnum.java
@@ -0,0 +1,50 @@
+/*-
+ * ============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.datatypes;
+
+public enum CheckBoxStatusEnum {
+ CHECKOUT("", "checkbox-checkout"),
+ CHECKIN("", "checkbox-checkin"),
+ READY_FOR_TESTING("checkbox-readyfortesting","checkbox-1"),
+ IN_TESTING("checkbox-intesting", "checkbox-2"),
+ WAITING_FOR_DISTRIBUTION("", "checkbox-waitingforapproval"),
+ DISTRIBUTION_REJECTED("", "checkbox-distributionrejected"),
+ DISTRIBUTION_APPROVED("", "checkbox-distributionapproved"),
+ CERTIFIED("checkbox-certified", "checkbox-3"),
+ DISTRIBUTED("", "checkbox-4"),
+ IN_DESIGN("", "checkbox-0");
+
+ private String value;
+ private String value2;
+
+ public String getValue() {
+ return value;
+ }
+
+ public String getCatalogValue() {
+ return value2;
+ }
+
+ private CheckBoxStatusEnum(String value, String value2) {
+ this.value = value;
+ this.value2 = value2;
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndImportButtonsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndImportButtonsEnum.java
new file mode 100644
index 0000000000..a49c5024a6
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndImportButtonsEnum.java
@@ -0,0 +1,27 @@
+/*-
+ * ============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.datatypes;
+
+public enum CreateAndImportButtonsEnum {
+
+ IMPORT_VF, IMPORT_VFC, IMPORT_CP, IMPORT_VL, CREATE_VF, CREATE_SERVICE, CREATE_PRODUCT;
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
new file mode 100644
index 0000000000..ef510b8a12
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
@@ -0,0 +1,835 @@
+/*-
+ * ============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.datatypes;
+
+import java.util.Arrays;
+import java.util.List;
+
+public final class DataTestIdEnum {
+ private DataTestIdEnum() {
+ }
+
+ public enum Dashboard {
+ IMPORT_AREA("importButtonsArea"),
+ ADD_AREA("AddButtonsArea"),
+ BUTTON_ADD_VF("createResourceButton"),
+ BUTTON_ADD_SERVICE("createServiceButton"),
+ IMPORT_VFC("importVFCbutton"),
+ IMPORT_VF("importVFbutton"),
+ IMPORT_VFC_FILE("file-importVFCbutton"),
+ IMPORT_VF_FILE("file-importVFbutton"),
+ BUTTON_ADD_PRODUCT("createProductButton");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private Dashboard(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum LifeCyleChangeButtons {
+ CREATE("create/save"),
+ CHECK_IN("check_in"),
+ SUBMIT_FOR_TESTING("submit_for_testing"),
+ START_TESTING("start_testing"),
+ ACCEPT("accept"),
+ CHECKOUT("check_out");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private LifeCyleChangeButtons(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum DistributionChangeButtons {
+ APPROVE("approve"),
+ REJECT("reject"),
+ DISTRIBUTE("distribute"),
+ MONITOR("monitor"),
+ APPROVE_MESSAGE("checkindialog"),
+ RE_DISTRIBUTE("redistribute");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private DistributionChangeButtons(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum InformationalArtifactsPlaceholders {
+ CLOUD_QUESTIONNAIRE("Cloud Questionnaire (completed)"),
+ FEATURES("Features"),
+ VENDOR_TEST_RESULT("Vendor Test Result"),
+ TEST_SCRIPTS("Test Scripts"),
+ RESOURCE_SECURITY_TEMPLATE("Resource Security Template"),
+ HEAT_TEMPLATE_FROM_VENDOR("HEAT Template from Vendor"),
+ CAPACITY("Capacity");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private InformationalArtifactsPlaceholders(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum ModalItems {
+ BROWSE_BUTTON("browseButton"),
+ ADD("Add"),
+ DESCRIPTION("description"),
+ SUMBIT_FOR_TESTING_MESSAGE("changeLifeCycleMessage"),
+ OK("OK"),
+ CANCEL("Cancel"),
+ ACCEP_TESTING_MESSAGE("checkindialog");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ModalItems(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum LeftPanelCanvasItems {
+ BLOCK_STORAGE("BlockStorage"),
+ CINDER_VOLUME("CinderVolume"),
+ COMPUTE("Compute"),
+ LOAD_BALANCER("LoadBalancer"),
+ NOVA_SERVER("NovaServer"),
+ OBJECT_STORAGE("ObjectStorage"),
+ NEUTRON_PORT("NeutronPort"),
+ PORT("Port"), DATABASE("Database"),
+ NETWORK("Network");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private LeftPanelCanvasItems(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum LinkMenuItems {
+ CANCEL_BUTTON("link-menu-button-cancel"),
+ CONNECT_BUTTON("link-menu-button-connect"),
+ LINK_ITEM_CAP("link-item-capabilities"),
+ LINK_ITEM_REQ("link-item-requirements"),
+ LINK_MENU("link-menu-open");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private LinkMenuItems(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum GeneralCanvasItems {
+ CANVAS("canvas"),
+ CANVAS_RIGHT_PANEL("w-sdc-designer-sidebar-head"),
+ DELETE_INSTANCE_BUTTON("e-sdc-small-icon-delete"),
+ UPDATE_INSTANCE_NAME("e-sdc-small-icon-update"),
+ INSTANCE_NAME_FIELD("instanceName");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private GeneralCanvasItems(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum ResourceMetadataEnum {
+ RESOURCE_NAME("name"),
+ DESCRIPTION("description"),
+ CATEGORY("selectGeneralCategory"),
+ VENDOR_NAME("vendorName"),
+ VENDOR_RELEASE("vendorRelease"),
+ TAGS("i-sdc-tag-input"),
+ CONTACT_ID("contactId"),
+ ICON(" iconBox"),
+ TAGS_TABLE("i-sdc-tag-text");
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ResourceMetadataEnum(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum GeneralElementsEnum {
+ CREATE_BUTTON("create/save"),
+ CHECKIN_BUTTON("check_in"),
+ CHECKOUT_BUTTON("check_out"),
+ SUBMIT_FOR_TESTING_BUTTON("submit_for_testing"),
+ DELETE_VERSION_BUTTON("delete_version"),
+ REVERT_BUTTON("revert"),
+ LIFECYCLE_STATE("formlifecyclestate"),
+ VERSION_HEADER("versionHeader"),
+ OK("OK"),
+ UPLOAD_FILE_INPUT("browseButton");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private GeneralElementsEnum(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum ArtifactPageEnum {
+ ADD_DEPLOYMENT_ARTIFACT("add-deployment-artifact-button"),
+ ADD_INFORMATIONAL_ARTIFACT("add-information-artifact-button"),
+ DOWNLOAD_ARTIFACT_ENV("download_env_"),
+ ADD_ANOTHER_ARTIFACT("add-another-artifact-button"),
+ EDIT_ARTIFACT("edit_"), //upload env file by its label(via deployment artifact view)/displayName(via Canvas)
+ DELETE_ARTIFACT("delete_"),
+ DOWNLOAD_ARTIFACT("download_"),
+ GET_DEPLOYMENT_ARTIFACT_DESCRIPTION("description"),
+ GET_INFORMATIONAL_ARTIFACT_DESCRIPTION("Description"),
+ OK("OK"),
+ TYPE("artifactType_"),
+ DEPLOYMENT_TIMEOUT("timeout_"),
+ VERSION("artifactVersion_"),
+ UUID("artifactUUID_"),
+ EDIT_PARAMETERS_OF_ARTIFACT("edit-parameters-of-"),
+ ARTIFACT_NAME("artifactDisplayName_"),
+ UPLOAD_HEAT_ENV_PARAMETERS("uplaodEnv_"),
+ VERSION_ENV("artifactEnvVersion_");
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ArtifactPageEnum(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum PropertiesPageEnum {
+
+ ADD_NEW_PROPERTY("addGrey"),
+ EDIT_PROPERTY("edit_"),
+ DELETE_PROPERTY("delete_"),
+ PROPERTY_NAME("propertyName_"),
+ PROPERTY_DESCRIPTION("propertyDescription_"),
+ PROPERTY_TYPE("propertyType_"),
+ ENTRY_SCHEMA("propertySchema_"),
+ ADD("Add"), CANCEL("Cancel"),
+ DONE("Done"),
+ PROPERTY_ROW("propertyRow"),
+ SAVE("Save"),
+ POPUP_FORM("sdc-edit-property-container");
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private PropertiesPageEnum(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum PropertiesPopupEnum {
+
+ PROPERTY_NAME("propertyName"),
+ PROPERTY_VALUE("defaultvalue"),
+ PROPERTY_BOOLEAN_VALUE("booleantype"),
+ PROPERTY_DESCRIPTION("description"),
+ PROPERTY_TYPE("propertyType"),
+ ENTRY_SCHEMA("schema-type"),
+ CANCEL("Cancel"),
+ SAVE("Save"),
+ POPUP_FORM("sdc-edit-property-container"),
+ ADD("Add"),
+ DONE("Done"),
+ PROPERTY_RADIO_BUTTON_CONTAINER("propertyRadioButton_"),
+ RADIO_BUTTON_CLASS("tlv-radio-label");
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private PropertiesPopupEnum(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum AdminPageTabs {
+ USER_MANAGEMENT("usermanagmenttab"),
+ CATEGORY_MANAGEMENT("categorymanagmenttab");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private AdminPageTabs(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum UserManagementEnum {
+
+ SEARCH_BOX("searchbox"),
+ NEW_USER_FIELD("newuserId"),
+ ROLE_SELECT("selectrole"),
+ CREATE_BUTTON("creategreen"),
+ CLASS__USER_MANAGEMENT_TABLE("sdc-user-management-table"),
+ ROW_TABLE("row_"),
+ FIRST_NAME("firstName_"),
+ LAST_NAME("lastName__"),
+ USER_ID("userId_"),
+ EMAIL("email_"),
+ ROLE("role_"),
+ LAST_ACTIVE("lastActive_"),
+ UPDATE_ROLE("selectRole_"),
+ UPDATE_USER_BUTTON("updateUser_"),
+ SAVE_USER("save_"),
+ DELETE_USER("delete_"),
+ ;
+
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private UserManagementEnum(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum CategoryManagement {
+
+ SERVICE_CATEGORY_HEADER("servicecategoryheader"),
+ RESOURCE_CATEGORY_HEADER("resourcecategoryheader"),
+ SERVICE_CATEGORY_LIST("servicecategory"),
+ RESOURCE_CATEGORY_LIST("resourcecategory"),
+ NEW_CATEGORY_BUTTON("newcategory"),
+ NEW_SUB_CATEGORY_BUTTON("newsubcategory"),
+ NEW_CATEGORY_NAME("i-sdc-form-input");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private CategoryManagement(String value) {
+ this.value = value;
+ }
+ }
+
+
+
+ public enum MainMenuButtons {
+ HOME_BUTTON("main-menu-button-home"),
+ CATALOG_BUTTON("main-menu-button-catalog"),
+ ONBOARD_BUTTON("main-menu-button-onboard"),
+ SEARCH_BOX("main-menu-input-search"),
+ REPOSITORY_ICON("repository-icon");
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private MainMenuButtons(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum MainMenuButtonsFromInsideFrame {
+ HOME_BUTTON("breadcrumbs-button-0");
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private MainMenuButtonsFromInsideFrame(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum MenuOptionsEnum {
+ EDIT("Edit"),
+ CHECK_IN("Check in"),
+ CHECK_OUT("Check out"),
+ VIEW("View"),
+ SUBMIT_FOR_TEST("Submit For Test"),
+ ACCEPT("Accept"),
+ REJECT("Reject"),
+ START_TEST("Start test"),
+ DISTREBUTE("Distribute");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private MenuOptionsEnum(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum StepsEnum {
+ GENERAL("Generalstep"),
+ ICON("Iconstep"),
+ DEPLOYMENT_ARTIFACT("Deployment Artifactstep"),
+ INFORMATION_ARTIFACT("Information Artifactstep"),
+ PROPERTIES("Propertiesstep"),
+ COMPOSITION("Compositionstep"),
+ ACTIVITY_LOG("Activity Logstep"),
+ DEPLOYMENT_VIEW("Deploymentstep"),
+ TOSCA_ARTIFACTS("TOSCA Artifactsstep"),
+ MONITOR("Monitor step"),
+ MANAGEMENT_WORKFLOW("Management Workflowstep"),
+ INPUTS("Inputsstep"),
+ HIERARCHY("Hierarchystep");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private StepsEnum(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum ArtifactPopup {
+
+ BROWSE("browseButton"),
+ ARTIFACT_DESCRIPTION("description"),
+ ARTIFACT_LABEL("artifactLabel"),
+ ARTIFACT_TYPE("artifacttype"),
+ OK("OK"),
+ SAVE("Save"),
+ DONE_BUTTON("Done"),
+ CANCEL_BUTTON("Cancel"),
+ URL("input[class^='i-sdc-form-input']"),
+ MODAL_WINDOW("sdc-add-artifact");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ArtifactPopup(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum ServiceMetadataEnum {
+ SERVICE_NAME("name"), DESCRIPTION("description"), CATEGORY("selectGeneralCategory"), PROJECT_CODE("projectCode"), TAGS("i-sdc-tag-input"), CONTACT_ID("contactId"), ICON(" iconBox");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ServiceMetadataEnum(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum ProductMetadataEnum {
+ PRODUCT_NAME("name"),
+ FULL_NAME("fullName"),
+ DESCRIPTION("description"),
+ PROJECT_CODE("projectCode"),
+ TAGS("i-sdc-tag-input"),
+ ATT_CONTACT("attContact"),
+ ICON(" iconBox");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ProductMetadataEnum(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum DashboardCardEnum {
+ ASSET_TYPE("asset-type"), LIFECYCLE_STATE("span[class^='w-sdc-dashboard-card-info-lifecycleState']"),
+ INFO_NAME("div.sdc-tile-content-info-item-name"),
+ VERSION("div[class^='w-sdc-dashboard-card-info-user']"),
+ DASHBOARD_CARD("div[class^='w-sdc-dashboard-card ']"),
+ ASSET_TYPE_CSS("span[data-tests-id='asset-type']");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private DashboardCardEnum(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum CatalogPageLeftPanelCategoryCheckbox {
+ GENERIC_CHECKBOX("span[data-tests-id='checkbox-resourcenewcategory.generic']"),
+ NETWORK_L2_3("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3']"),
+ NETWORK_L4_PLUS("span[data-tests-id='checkbox-resourcenewcategory.networkl4+']"),
+ NETWORK_CONNECTIVITY("span[data-tests-id='checkbox-resourcenewcategory.networkconnectivity']"),
+ APPLICATION_L4_PLUS("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+']"),
+ DCAE("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent']");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private CatalogPageLeftPanelCategoryCheckbox(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum CatalogPageLeftPanelFilterTitle {
+ TYPE("span[data-tests-id='typeFilterTitle']"),
+ CATEGORIES("span[data-tests-id='categoriesFilterTitle']"),
+ STATUS("span[data-tests-id='statusFilterTitle']");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private CatalogPageLeftPanelFilterTitle(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum CatalogPageLeftPanelSubCategoryCheckbox {
+ COMMON_NETWORK_RESOURCES("span[data-tests-id='checkbox-resourcenewcategory.networkl4+.commonnetworkresources']"),
+ ROUTER("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.router']"),
+ WAN_CONNECTORS("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.wanconnectors']"),
+ LAN_CONNECTORS("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.lanconnectors']"),
+ INFRASTRUCTERE_NETWORKl2_3("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.infrastructure']"),
+ GATEWAY("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.gateway']"),
+ NETWORK_ELEMENTS("span[data-tests-id='checkbox-resourcenewcategory.generic.networkelements']"),
+ ABSTRACT("span[data-tests-id='checkbox-resourcenewcategory.generic.abstract']"),
+ RULES("span[data-tests-id='checkbox-resourcenewcategory.generic.rules']"),
+ DATABASE("span[data-tests-id='checkbox-resourcenewcategory.generic.database']"),
+ INFRASTRUCTERE_GENERIC("span[data-tests-id='checkbox-resourcenewcategory.generic.infrastructure']"),
+ VIRTUAL_LINKS("span[data-tests-id='checkbox-resourcenewcategory.networkconnectivity.virtuallinks']"),
+ CONNECTION_POINTS("span[data-tests-id='checkbox-resourcenewcategory.networkconnectivity.connectionpoints']"),
+ APPLICATION_SERVER("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.applicationserver']"),
+ CALL_CONTROL("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.callcontrol']"),
+ MEDIASERVERS("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.mediaservers']"),
+ WEBSERVER("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.webserver']"),
+ LOAD_BALANCER("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.loadbalancer']"),
+ BORDER_ELEMENT("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.borderelement']"),
+ DATABASE_APPLIVATION_L4_PLUS("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.database']"),
+ FIREWALL("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.firewall']"),
+ DATABASE_DCAE("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.database']"),
+ POLICY("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.policy']"),
+ MICROSERVICE("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.microservice']"),
+ SOURCE("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.source']"),
+ COLLECTOR("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.collector']"),
+ UTILITY("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.utility']"),
+ ANALYTICS("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.analytics']");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private CatalogPageLeftPanelSubCategoryCheckbox(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum CompositionScreenEnum {
+
+ CHANGE_VERSION("changeVersion", Arrays.asList()),
+ DEPLOYMENT_ARTIFACT_TAB("deployment-artifact-tab", Arrays.asList("Deployment Artifacts")),
+ ADD_ARTIFACT("add_Artifact_Button", Arrays.asList()),
+ SEARCH_ASSET("searchAsset", Arrays.asList()),
+ PROPERTIES_AND_ATTRIBUTES_TAB("properties-and-attributes-tab",Arrays.asList()),
+ MENU_INPUTS("sub-menu-button-inputs",Arrays.asList()),
+ MENU_TRIANGLE_DROPDOWN("triangle-dropdown", Arrays.asList()),
+ ARTIFACTS_LIST("artifactName", Arrays.asList()),
+ INFORMATION_ARTIFACTS("button[tooltip-content='Information Artifacts']", Arrays.asList("Informational Artifacts")),
+ API("button[tooltip-content='API']", Arrays.asList("API Artifacts")),
+ INFORMATION("button[tooltip-content='Information']", Arrays.asList("General Info", "Additional Information", "Tags")),
+ COMPOSITION("button[tooltip-content='Composition']", Arrays.asList("Composition")),
+ INPUTS("button[tooltip-content='Inputs']", Arrays.asList("")),
+ REQUIREMENTS_AND_CAPABILITIES("button[tooltip-content='Requirements and Capabilities']", Arrays.asList()),
+ INFORMATION_TAB("information-tab", Arrays.asList()),
+ CUSTOMIZATION_UUID("rightTab_customizationModuleUUID", Arrays.asList());
+
+ private String value;
+ private List<String> title;
+
+ public String getValue() {
+ return value;
+ }
+
+ public List<String> getTitle() {
+ return title;
+ }
+
+ private CompositionScreenEnum(String value, List<String> title) {
+ this.value = value;
+ this.title = title;
+ }
+ }
+
+ public enum ToscaArtifactsScreenEnum {
+
+ TOSCA_MODEL("download-Tosca Model"),
+ TOSCA_TEMPLATE("download-Tosca Template"),
+ ARTIFACT_VERSION("version-"),
+ ARTIFACT_NAME("name-"),
+ ARTIFACT_TYPE("type-"),
+ ARTIFACT_DETAILS("details-"),
+ DOWNLOAD_ARTIFACT("download-"),
+ DOWNLOAD_CSAR("download-Tosca Model");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ToscaArtifactsScreenEnum(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum InformationalArtifactsService {
+ AFFINITY_RULES("artifact_Display_Name-Affinity Rules"),
+ CONTROL_LOOP_FUNCTIONS("artifact_Display_Name-Control Loop Functions"),
+ DEPLOYMENT_VOTING_RECORD("artifact_Display_Name-Deployment Voting Record"),
+ DIMENSIONING_INFO("artifact_Display_Name-Dimensioning Info"),
+ DISTRIBUTION_INSTRUCTION("artifact_Display_Name-Distribution Instructions"),
+ ENGINEERING_RULES("artifact_Display_Name-Engineering Rules (ERD)"),
+ OPERATIONAL_POLICES("artifact_Display_Name-Operational Policies"),
+ SERVICE_ARTIFACT_PLAN("artifact_Display_Name-Service Artifact Plan"),
+ SERVICE_QUESTIONNAIRE("artifact_Display_Name-Service Questionnaire"),
+ SERVICE_SECURITY_TEMPLATE("artifact_Display_Name-Service Security Template"),
+ SERVICE_SPECIFIC_POLICIES("artifact_Display_Name-Service-specific Policies"),
+ SUMMARY_OF_IMPACTS_TO_ECOMP("artifact_Display_Name-Summary of impacts to ECOMP elements,OSSs, BSSs"),
+ TD_CERTIFICATION_TEST_RESULTS("artifact_Display_Name-TD Certification Test Results");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private InformationalArtifactsService(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum APIArtifactsService {
+
+ CONFIGURATION("artifact_Display_Name-Configuration"),
+ INSTANTIATION("artifact_Display_Name-Instantiation"),
+ LOGGING("artifact_Display_Name-Logging"),
+ MONITORING("artifact_Display_Name-Monitoring"),
+ REPORTING("artifact_Display_Name-Reporting"),
+ TESTING("artifact_Display_Name-Testing");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private APIArtifactsService(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum DeploymentArtifactCompositionRightMenu {
+ ARTIFACT_NAME("artifactName-"),
+ ARTIFACT_DISPLAY_NAME("artifact_Display_Name-"),
+ DOWNLOAD("download_"),
+ DELETE("delete_"),
+ ADD_ARTIFACT_BUTTON("add_Artifact_Button"),
+ EDIT_PARAMETERS_OF_ARTIFACT("edit-parameters-of-"),
+ ARTIFACT_ITEM("artifact-item-"),
+ ARTIFACT_ENV("heat_env_");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private DeploymentArtifactCompositionRightMenu(String value) {
+ this.value = value;
+ }
+
+ }
+
+ public enum InputsScreenService {
+ ADD_SELECTED_INPUTS_BTN("add-inputs-to-service-button"),
+ VF_INSTANCE_ROWS("expand-collapse[expanded-selector^='.vf-instance-list.']"),
+ VF_INSTANCE_ROW_NAME("span[class^='title-text']"),
+ VF_INSTANCE_INPUTS("div[class^='vf-instance-list ']"),
+ VF_INSTANCE_INPUT("div[class^='input-row ng-scope']"),
+ VF_INSTNCE_PROPERTY_NAME("div[class^='title-text']"),
+ INPUT_CHECKBOX("span[class^='tlv-checkbox-label']"),
+ SERVICE_INPUT_ROW("div[class^='service-input-row input-row']"),
+ DELETE_INPUT_BTN("span[class$='remove-input-icon']"),
+ RESOURCE_INSTANCE_PROPERTY_NAME("propertyName_"),
+ RESOURCE_INSTANCE_PROPERTY_TYPE("propertyType_"),
+ RESOURCE_INSTANCE_PROPERTY_CHECKBOX("propertyCheckbox_"),
+ SERVICE_INPUTS_DELETE_BUTTON("deleteInput_")
+ ;
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private InputsScreenService(String value) {
+ this.value = value;
+ }
+
+ }
+
+ public enum DeploymentScreen {
+ MODULES("span[class^='expand-collapse-title-text']"),
+ MEMBERS("div[class^='expand-collapse-sub-title']"),
+ PROPERTIES("list-of-Properties"),
+ ARTIFACTS("list-of-Artifacts"),
+ BUTTON_PROPERTIES("div[data-tests-id='list-of-Properties'] span[class^='hand']"),
+ BUTTON_ARTIFACTS("div[data-tests-id='list-of-Artifacts'] span[class^='hand']"),
+ PROPERTY_NAMES("div[data-tests-id='selected-module-property-name'] span"),
+ PROPERTY_TYPES("selected-module-property-type"),
+ PROPERTY_SCHEMA_TYPE("selected-module-property-schema-type"),
+ ARTIFACT_NAME("selected-module-artifact-name"),
+ ARTIFACT_UUID("selected-module-artifact-uuid"),
+ ARTIFACT_VERSION("selected-module-artifact-version"),
+ PENCIL_ICON("edit-name-popover-icon"),
+ MODULE_NAME("selected-module-name"),
+ MODULE_ID("selected-module-group-uuid"),
+ RESOURCE_NAME_ON_POPOVER("popover-vfinstance-name"),
+ MODULE_NAME_ON_POPOVER("popover-module-name"),
+ NAME_INPUT("popover-heat-name"),
+ SAVE("popover-save-button"),
+ CANCEL("popover-close-button"),
+ X_BUTTON("popover-x-button");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private DeploymentScreen(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum ImportVfRepository {
+ SEARCH("onboarding-search"),
+ IMPORT_VSP("import-csar"),
+ DOWNLOAD_CSAR("download-csar"),
+ UPDATE_VSP("update-csar");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ImportVfRepository(String value) {
+ this.value = value;
+ }
+ }
+
+ public enum EnvParameterView {
+ SEARCH_ENV_PARAM_NAME("search-env-param-name"),
+ ENV_CURRENT_VALUE("value-field-of-"),//value-field-of-oam_volume_name_0 - parameter name
+ ENV_DEFAULT_VALUE("default-value-of-");// default-value-of-vnf_name
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private EnvParameterView(String value) {
+ this.value = value;
+ }
+ }
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ErrorMessageProperties.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ErrorMessageProperties.java
new file mode 100644
index 0000000000..a7d2551683
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ErrorMessageProperties.java
@@ -0,0 +1,53 @@
+/*-
+ * ============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.datatypes;
+
+public class ErrorMessageProperties {
+
+ private String messageId ;
+ private String code;
+
+ public ErrorMessageProperties() {
+
+ }
+
+ public ErrorMessageProperties(String messageId, String code) {
+ this.messageId = messageId;
+ this.code = code;
+ }
+
+ public String getMessageId() {
+ return messageId;
+ }
+
+ public void setMessageId(String messageId) {
+ this.messageId = messageId;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/GeneralCanvasItemsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/GeneralCanvasItemsEnum.java
new file mode 100644
index 0000000000..e708fb8ee4
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/GeneralCanvasItemsEnum.java
@@ -0,0 +1,38 @@
+/*-
+ * ============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.datatypes;
+
+public enum GeneralCanvasItemsEnum {
+ CANVAS("canvas"),
+ CANVAS_RIGHT_PANEL("w-sdc-designer-sidebar-head"),
+ DELETE_INSTANCE_BUTTON("e-sdc-small-icon-delete");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private GeneralCanvasItemsEnum(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatAndHeatEnvNamesPair.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatAndHeatEnvNamesPair.java
new file mode 100644
index 0000000000..1df61b734c
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatAndHeatEnvNamesPair.java
@@ -0,0 +1,62 @@
+/*-
+ * ============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.datatypes;
+
+import java.io.File;
+
+public class HeatAndHeatEnvNamesPair {
+
+ private File heatFileName;
+ private File heatEnvFileName;
+
+ public HeatAndHeatEnvNamesPair() {
+ super();
+ }
+
+ public HeatAndHeatEnvNamesPair(File heatFileName, File heatEnvFileName) {
+ super();
+ this.heatFileName = heatFileName;
+ this.heatEnvFileName = heatEnvFileName;
+ }
+
+ public File getHeatFileName() {
+ return heatFileName;
+ }
+
+ public void setHeatFileName(File heatFileName) {
+ this.heatFileName = heatFileName;
+ }
+
+ public File getHeatEnvFileName() {
+ return heatEnvFileName;
+ }
+
+ public void setHeatEnvFileName(File heatEnvFileName) {
+ this.heatEnvFileName = heatEnvFileName;
+ }
+
+ @Override
+ public String toString() {
+ return "HeatHeatEnvNamesPair [heatFileName=" + heatFileName + ", heatEnvFileName=" + heatEnvFileName + "]";
+ }
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatWithParametersDefinition.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatWithParametersDefinition.java
new file mode 100644
index 0000000000..5ff173ee87
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatWithParametersDefinition.java
@@ -0,0 +1,102 @@
+/*-
+ * ============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.datatypes;
+
+import java.util.List;
+
+import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition;
+
+public class HeatWithParametersDefinition {
+
+ private String heatLabel;
+ private String heatEnvLabel;
+ private String heatArtifactType;
+ private String heatEnvArtifactType;
+ private String heatArtifactDisplayName;
+ private List<HeatParameterDataDefinition> heatParameterDefinition;
+
+ public HeatWithParametersDefinition(String heatLabel, String heatEnvLabel, String heatArtifactType, String heatEnvArtifactType, String heatArtifactDisplayName, List<HeatParameterDataDefinition> heatParameterDefinition) {
+ super();
+ this.heatLabel = heatLabel;
+ this.heatEnvLabel = heatEnvLabel;
+ this.heatArtifactType = heatArtifactType;
+ this.heatEnvArtifactType = heatEnvArtifactType;
+ this.heatArtifactDisplayName = heatArtifactDisplayName;
+ this.heatParameterDefinition = heatParameterDefinition;
+ }
+
+ public String getHeatArtifactDisplayName() {
+ return heatArtifactDisplayName;
+ }
+
+ public void setHeatArtifactDisplayName(String heatArtifactDisplayName) {
+ this.heatArtifactDisplayName = heatArtifactDisplayName;
+ }
+
+ public String getHeatLabel() {
+ return heatLabel;
+ }
+
+ public void setHeatLabel(String heatLabel) {
+ this.heatLabel = heatLabel;
+ }
+
+ public String getHeatEnvLabel() {
+ return heatEnvLabel;
+ }
+
+ public void setHeatEnvLabel(String heatEnvLabel) {
+ this.heatEnvLabel = heatEnvLabel;
+ }
+
+ public String getHeatArtifactType() {
+ return heatArtifactType;
+ }
+
+ public void setHeatArtifactType(String heatArtifactType) {
+ this.heatArtifactType = heatArtifactType;
+ }
+
+ public String getHeatEnvArtifactType() {
+ return heatEnvArtifactType;
+ }
+
+ public void setHeatEnvArtifactType(String heatEnvArtifactType) {
+ this.heatEnvArtifactType = heatEnvArtifactType;
+ }
+
+ public List<HeatParameterDataDefinition> getHeatParameterDefinition() {
+ return heatParameterDefinition;
+ }
+
+ public void setHeatParameterDefinition(List<HeatParameterDataDefinition> heatParameterDefinition) {
+ this.heatParameterDefinition = heatParameterDefinition;
+ }
+
+ @Override
+ public String toString() {
+ return "HeatWithParametersDefinition [heatLabel=" + heatLabel + ", heatEnvLabel=" + heatEnvLabel + ", heatArtifactType=" + heatArtifactType + ", heatEnvArtifactType=" + heatEnvArtifactType + ", heatArtifactDisplayName="
+ + heatArtifactDisplayName + ", heatParameterDefinition=" + heatParameterDefinition + "]";
+ }
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LifeCycleStateEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LifeCycleStateEnum.java
new file mode 100644
index 0000000000..773cb57b2e
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LifeCycleStateEnum.java
@@ -0,0 +1,47 @@
+/*-
+ * ============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.datatypes;
+
+public enum LifeCycleStateEnum {
+
+ CHECKOUT("IN DESIGN CHECK OUT"),
+ CHECKIN("IN DESIGN CHECK IN"),
+ READY_FOR_TESTING("READY FOR TESTING"),
+ IN_TESTING("IN TESTING"),
+ WAITING_FOR_DISTRIBUTION("WAITING FOR DISTRIBUTION"),
+ DISTRIBUTION_REJECTED("DISTRIBUTION REJECTED"),
+ DISTRIBUTION_APPROVED("DISTRIBUTION APPROVED"),
+ CERTIFIED("CERTIFIED"),
+ DISTRIBUTED("DISTRIBUTED"),
+ IN_DESIGN("IN DESIGN");
+
+ private String value;
+ private String value2;
+
+ public String getValue() {
+ return value;
+ }
+
+ private LifeCycleStateEnum(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/MenuOptionsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/MenuOptionsEnum.java
new file mode 100644
index 0000000000..63171a6c78
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/MenuOptionsEnum.java
@@ -0,0 +1,37 @@
+/*-
+ * ============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.datatypes;
+
+public enum MenuOptionsEnum {
+
+ EDIT("Edit"), CHECK_IN("Check in"), CHECK_OUT("Check out"), VIEW("View"), SUBMIT_FOR_TEST("Submit For Test"), ACCEPT("Accept"), REJECT("Reject"), START_TEST("Start test"), DISTREBUTE("Distribute");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private MenuOptionsEnum(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/PropertyInfo.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/PropertyInfo.java
new file mode 100644
index 0000000000..785a355e13
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/PropertyInfo.java
@@ -0,0 +1,76 @@
+/*-
+ * ============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.datatypes;
+
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+
+public class PropertyInfo {
+
+ public PropertyInfo() {
+ super();
+ }
+
+ public PropertyInfo(PropertyTypeEnum prop) {
+ super();
+ this.name = prop.getName();
+ this.value = prop.getValue();
+ this.type = prop.getType();
+ this.description = prop.getDescription();
+ }
+
+ private String name;
+ private String value;
+ private String type;
+ private String description;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceCategoriesNameEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceCategoriesNameEnum.java
new file mode 100644
index 0000000000..2c49c8718b
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceCategoriesNameEnum.java
@@ -0,0 +1,45 @@
+/*-
+ * ============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.datatypes;
+
+public enum ResourceCategoriesNameEnum {
+
+ GENERIC("checkbox-resourcenewcategory.generic"), NETWORK_CONNECTIVITY("checkbox-resourcenewcategory.networkconnectivity"), NETWORK_ELEMENTS("checkbox-resourcenewcategory.generic.networkelements"),
+ ABSTRACT("checkbox-resourcenewcategory.generic.abstract"), DATABASE_GENERIC("checkbox-resourcenewcategory.generic.database"), INFRASTRUCTURE("checkbox-resourcenewcategory.generic.infrastructure"),
+ VIRTUAL_LINKS("checkbox-resourcenewcategory.networkconnectivity.virtuallinks"), CONNECTION_POINTS("checkbox-resourcenewcategory.networkconnectivity.connectionpoints"), NETWORKL4("checkbox-resourcenewcategory.networkl4+"),
+ COMMON_NETWORK_RESOURCES("checkbox-resourcenewcategory.networkl4+.commonnetworkresources"), APPLICATIONL4("checkbox-resourcenewcategory.applicationl4+"), WEB_SERVER("checkbox-resourcenewcategory.applicationl4+.webserver"),
+ APPLICATION_SERVER("checkbox-resourcenewcategory.applicationl4+.applicationserver"), CALL_CONTROL("checkbox-resourcenewcategory.applicationl4+.callcontrol"), BORDER_ELEMENT("checkbox-resourcenewcategory.applicationl4+.borderelement"),
+ MEDIA_SERVERS("checkbox-resourcenewcategory.applicationl4+.mediaservers"), DATABASE("checkbox-resourcenewcategory.applicationl4+.database"), FIREWALL("checkbox-resourcenewcategory.applicationl4+.firewall"),
+ LOAD_BALANCER("checkbox-resourcenewcategory.applicationl4+.loadbalancer"), NETWORK_L23("checkbox-resourcenewcategory.networkl2-3"), Router("checkbox-resourcenewcategory.networkl2-3.router"),
+ WAN_Connectors("checkbox-resourcenewcategory.networkl2-3.wanconnectors"), LAN_CONNECTORS("checkbox-resourcenewcategory.networkl2-3.lanconnectors"), GATEWAY("checkbox-resourcenewcategory.networkl2-3.gateway"),
+ INFRASTRUCTUREL23("checkbox-resourcenewcategory.networkl2-3.infrastructure");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ResourceCategoriesNameEnum(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceCategoriesNameEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceCategoriesNameEnum.java
new file mode 100644
index 0000000000..b90e311f72
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceCategoriesNameEnum.java
@@ -0,0 +1,36 @@
+/*-
+ * ============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.datatypes;
+
+public enum ServiceCategoriesNameEnum {
+
+ NETWORK_L13("checkbox-servicenewcategory.networkl1-3"), VOIPCALL_CONTROL("checkbox-servicenewcategory.voipcallcontrol"), NETWORKL4("checkbox-servicenewcategory.networkl4+"), MOBILITY("checkbox-servicenewcategory.mobility");
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private ServiceCategoriesNameEnum(String value) {
+ this.value = value;
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TopMenuButtonsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TopMenuButtonsEnum.java
new file mode 100644
index 0000000000..9e81505111
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TopMenuButtonsEnum.java
@@ -0,0 +1,38 @@
+/*-
+ * ============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.datatypes;
+
+public enum TopMenuButtonsEnum {
+
+ HOME("main-menu-button-home"), CATALOG("main-menu-button-catalog"), ON_BOARDING("main-menu-button-onboard");
+
+ private String value;
+ private String value2;
+
+ public String getButton() {
+ return value;
+ }
+
+ private TopMenuButtonsEnum(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java
new file mode 100644
index 0000000000..d27eb0c150
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java
@@ -0,0 +1,36 @@
+/*-
+ * ============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.datatypes;
+
+public enum TypesEnum {
+
+ RESOURCE("checkbox-resource"), VF("checkbox-vf"), VFC("checkbox-vfc"), CP("checkbox-cp"), VL("checkbox-vl"), SERVICE("checkbox-service"), PRODUCT("checkbox-product");
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ private TypesEnum(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserCredentials.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserCredentials.java
new file mode 100644
index 0000000000..2de872504f
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserCredentials.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.datatypes;
+
+import org.openecomp.sdc.be.model.User;
+
+public class UserCredentials extends User {
+
+ // private String userName;
+ private String password;
+
+ public UserCredentials(String userId, String password, String firstname, String lastname, String role) {
+ super();
+ setUserId(userId);
+ // this.userName = userName;
+ this.password = password;
+ setFirstName(firstname);
+ setLastName(lastname);
+ setRole(role);
+ }
+
+ public UserCredentials() {
+ super();
+ }
+
+ // public String getUserName() {
+ // return userName;
+ // }
+ // public void setUserName(String userName) {
+ // this.userName = userName;
+ // }
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserManagementTab.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserManagementTab.java
new file mode 100644
index 0000000000..0101b430d8
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserManagementTab.java
@@ -0,0 +1,114 @@
+/*-
+ * ============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.datatypes;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+public class UserManagementTab {
+
+ public void searchUser(String searchCriterion){
+ ExtentTestActions.log(Status.INFO, "Searching a user by the value : " + searchCriterion);
+ WebElement searchBoxWebElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.SEARCH_BOX.getValue());
+ searchBoxWebElement.clear();
+ searchBoxWebElement.sendKeys(searchCriterion);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public void setNewUserBox(String user){
+ ExtentTestActions.log(Status.INFO, "Inserting userid " + user);
+ WebElement createNewUserWebElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.NEW_USER_FIELD.getValue());
+ createNewUserWebElement.clear();
+ createNewUserWebElement.sendKeys(user);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public void selectUserRole(UserRoleEnum userRole){
+ String role = userRole.name().toLowerCase();
+ ExtentTestActions.log(Status.INFO, "Selecting role " + userRole.name());
+ GeneralUIUtils.getSelectList(role, DataTestIdEnum.UserManagementEnum.ROLE_SELECT.getValue());
+ }
+
+ public void updateUserRole(UserRoleEnum userRole, int rowIndx){
+ String role = userRole.name().toLowerCase();
+ ExtentTestActions.log(Status.INFO, "Updating the user role to " + userRole.name());
+ GeneralUIUtils.getSelectList(role, DataTestIdEnum.UserManagementEnum.UPDATE_ROLE.getValue() + rowIndx);
+ }
+
+ public void clickCreateButton(){
+ ExtentTestActions.log(Status.INFO, "Clicking on 'Create' button.");
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.UserManagementEnum.CREATE_BUTTON.getValue());
+ }
+
+ public WebElement getRow(int index){
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.ROW_TABLE.getValue() + index);
+ }
+
+ public WebElement getFirstName(int index){
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.FIRST_NAME.getValue() + index);
+ }
+
+ public WebElement getLastName(int index){
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.LAST_NAME.getValue() + index);
+ }
+
+ public WebElement getUserId(int index){
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.USER_ID.getValue() + index);
+ }
+
+ public WebElement getEmail(int index){
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.EMAIL.getValue() + index);
+ }
+
+ public WebElement getRole(int index){
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.ROLE.getValue() + index);
+ }
+
+ public WebElement getLastActive(int index){
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.LAST_ACTIVE.getValue() + index);
+ }
+
+ public void updateUser(int index){
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.UserManagementEnum.UPDATE_USER_BUTTON.getValue() + index);
+ }
+
+ public void deleteUser(int index){
+ ExtentTestActions.log(Status.INFO, "Deleting the user in row " + (index + 1));
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.UserManagementEnum.DELETE_USER.getValue() + index);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+ }
+
+ public void saveAfterUpdateUser(int index){
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.UserManagementEnum.SAVE_USER.getValue() + index);
+ }
+
+ public List<WebElement> getAllRowsDisplayed(){
+ return GeneralUIUtils.getWebElementsListByContainTestID(DataTestIdEnum.UserManagementEnum.ROW_TABLE.getValue());
+ }
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VFCArtifact.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VFCArtifact.java
new file mode 100644
index 0000000000..540a36ad18
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VFCArtifact.java
@@ -0,0 +1,71 @@
+/*-
+ * ============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.datatypes;
+
+public class VFCArtifact {
+
+ String artifactUUID;
+ String artifactVersion;
+ String artifactname;
+ String artifacttype;
+
+
+ public VFCArtifact(String artifactName, String artifactType, String uuid, String version){
+ artifactname = artifactName;
+ artifactUUID = uuid;
+ artifactVersion = version;
+ artifacttype = artifactType;
+ }
+
+ public String getArtifactUUID() {
+ return artifactUUID;
+ }
+
+ public void setArtifactUUID(String artifactUUID) {
+ this.artifactUUID = artifactUUID;
+ }
+
+ public String getArtifactVersion() {
+ return artifactVersion;
+ }
+
+ public void setArtifactVersion(String artifactVersion) {
+ this.artifactVersion = artifactVersion;
+ }
+
+ public String getArtifactname() {
+ return artifactname;
+ }
+
+ public void setArtifactname(String artifactname) {
+ this.artifactname = artifactname;
+ }
+
+ public String getArtifacttype() {
+ return artifacttype;
+ }
+
+ public void setArtifacttype(String artifacttype) {
+ this.artifacttype = artifacttype;
+ }
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/environmentLocal b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/environmentLocal
new file mode 100644
index 0000000000..ea93ddfe85
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/environmentLocal
@@ -0,0 +1,10 @@
+//URL designer
+urlDesigner=http://172.20.43.136:8080/sdc1/proxy-designer1#/dashboard
+//URL tester
+urlTester=http://172.20.43.136:8080/sdc1/proxy-tester1
+//URL Vagrant
+urlDesignerVagrant=http://localhost:8181/sdc1/proxy-designer1#/dashboard
+//UrlStaging
+UrlStaging=https://www.e-access.att.com/sdcpstage/sdc1/portal#/dashboard
+//UrlAdmin
+UrlAdmin=http://172.20.43.136:8080/sdc1/proxy-admin1#/adminDashboard \ No newline at end of file
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java
new file mode 100644
index 0000000000..710188af43
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java
@@ -0,0 +1,289 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.AdminGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.AdminWorkspaceUIUtilies;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.UserRestUtils;
+import org.openecomp.sdc.ci.tests.verificator.ErrorMessageUIVerificator;
+import org.openecomp.sdc.ci.tests.verificator.UserManagementVerificator;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+public class AdminUserManagment extends SetupCDTest {
+
+ @DataProvider(name = "searchValues")
+ private final Object[][] searchString(){
+ User newUser = createNewUserUsingAPI();
+ return new Object[][]{{newUser.getUserId(), newUser}, {newUser.getFirstName(), newUser}, {newUser.getLastName(), newUser}, {newUser.getEmail(), newUser}};
+ }
+
+ //TC915100
+ @Test
+ public void creatNewUserTest() throws Exception {
+
+ String userId = generateValidUserId();
+ UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+ AdminWorkspaceUIUtilies.createNewUser(userId, userRole);
+ UserManagementVerificator.validateUserCreated(userId, userRole);
+ }
+
+ //TC922253
+ @Test
+ public void creatNewUser_MacIdTest() throws Exception {
+
+ String macId = generateValidMacId();
+ UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+ AdminWorkspaceUIUtilies.createNewUser(macId, userRole);
+ UserManagementVerificator.validateUserCreated(macId, userRole);
+ }
+
+ //TC922253
+ @Test
+ public void createExistingUserTest(){
+ String userId = generateValidUserId();
+ UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+ AdminWorkspaceUIUtilies.createNewUser(userId, userRole);
+ ExtentTestActions.log(Status.INFO, "Trying to create the same user once again.");
+ AdminWorkspaceUIUtilies.createNewUser(userId, userRole);
+ ErrorMessageUIVerificator.validateErrorMessage(ActionStatus.USER_ALREADY_EXIST);
+ }
+
+ //TC922253
+ @Test
+ public void createInvalidMacIdTest(){
+ String macId = generateValidMacId();
+ StringBuilder invalidMacId = new StringBuilder(macId);
+ invalidMacId.setCharAt(0, 'a');
+ UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+ ExtentTestActions.log(Status.INFO, "Trying to create an invalid macId.");
+ AdminWorkspaceUIUtilies.createNewUser(invalidMacId.toString(), userRole);
+ ErrorMessageUIVerificator.validateErrorMessage(ActionStatus.INVALID_USER_ID);
+ }
+
+ //TC922253
+ @Test
+ public void specialCharInUserIdTest(){
+ String expectedErrorMsg = "User id not valid.";
+ String userId = generateValidUserId();
+ StringBuilder invalidUserId = new StringBuilder(userId);
+ invalidUserId.setCharAt(1, '#');
+ ExtentTestActions.log(Status.INFO, String.format("Trying to create an invalid user with special character (%s)", userId));
+ AdminGeneralPage.getUserManagementTab().setNewUserBox(invalidUserId.toString());
+ ExtentTestActions.log(Status.INFO, "Validating an error message is displayed as a result of invalid character.");
+ List<WebElement> inputErrors = null;
+ int inputErrorsSize = 0;
+
+ try{
+ WebElement inputField = GeneralUIUtils.getWebElementByClassName("input-error");
+ ExtentTestActions.log(Status.INFO, String.format("Validating the message is : '%s'", expectedErrorMsg));
+ inputErrors = inputField.findElements(By.className("ng-scope"));
+ inputErrorsSize = inputErrors.size();
+ for (WebElement err : inputErrors){
+ String actualErrorMessage = err.getText();
+ if (actualErrorMessage.equals(expectedErrorMsg)){
+ inputErrorsSize--;
+ }
+ }
+ }
+ catch(Exception e){
+ ExtentTestActions.log(Status.INFO, "Did not find an error input.");
+ Assert.fail("Did not find an error message input.");
+ }
+
+ Assert.assertEquals(inputErrors.size() - 1 , inputErrorsSize, "Did not find an error : " + expectedErrorMsg);
+ }
+
+ //TC915101
+ @Test(dataProvider = "searchValues")
+ public void searchUserByCriterionsTest(String searchCriterion, User user) throws IOException{
+ setLog(searchCriterion);
+ AdminWorkspaceUIUtilies.searchForUser(searchCriterion);
+ UserManagementVerificator.validateFirstRowDisplayedCorrectly(user);
+ }
+
+ //TC915101
+ @Test
+ public void searchForUserByRoleTest(){
+ String userId = generateValidUserId();
+ UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+ AdminWorkspaceUIUtilies.createNewUser(userId, userRole);
+ AdminWorkspaceUIUtilies.searchForUser(userRole.name());
+ List<WebElement> allRows = GeneralUIUtils.getWebElementsListByContainTestID(DataTestIdEnum.UserManagementEnum.USER_ID.getValue());
+ ExtentTestActions.log(Status.INFO, String.format("Found %s rows, looking for the user %s.", allRows.size(), userId));
+ int rowsCount = allRows.size();
+ for (int i = 0 ; i < allRows.size() ; i++){
+ String userIdFromTable = GeneralUIUtils.getTextContentAttributeValue(allRows.get(i));
+ if (userIdFromTable.equals(userId)){
+ rowsCount--;
+ break;
+ }
+ }
+ Assert.assertEquals(allRows.size() - 1 , rowsCount , "Did not find a row with the userId " + userId);
+ }
+
+ //TC915102
+ @Test
+ public void modifyUserRoleTest(){
+ User user = new User();
+ user.setUserId(generateValidUserId());
+ UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+ AdminWorkspaceUIUtilies.createNewUser(user.getUserId(), userRole);
+ UserRoleEnum updatedUserRole = UserRoleEnum.TESTER;
+ AdminWorkspaceUIUtilies.updateUserRole(0, updatedUserRole);
+ UserManagementVerificator.validateUserRoleUpdated(0, updatedUserRole);
+ UserManagementVerificator.validateUserRoleUpdatedViaRest(user, getUser(), updatedUserRole);
+ }
+
+ //TC915103
+ @Test
+ public void deleteUserTest(){
+ User user = new User();
+ user.setUserId(generateValidUserId());
+ UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+ AdminWorkspaceUIUtilies.createNewUser(user.getUserId(), userRole);
+ AdminWorkspaceUIUtilies.deleteFirstRow();
+ UserManagementVerificator.validateUserIdNotFound(user.getUserId());
+ UserManagementVerificator.validateUserNotFoundViaRest(user, getUser());
+ }
+
+ //TC951428
+ @Test
+ public void modifyUserRoleWithTaskInHand_Checkout() throws Exception{
+ User newUser = new User();
+ newUser.setUserId(generateValidUserId());
+ UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+ AdminWorkspaceUIUtilies.createNewUser(newUser.getUserId(), userRole);
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, newUser);
+ ExtentTestActions.log(Status.INFO, "Creating a new VF named " + resourceMetaData.getName() + " with the user " + newUser.getUserId());
+ RestResponse createResourceResp = ResourceRestUtils.createResource(resourceMetaData, newUser);
+ Assert.assertEquals(createResourceResp.getErrorCode().intValue(), 201, "Did not succeed to create a VF");
+
+ UserRoleEnum updatedUserRole = UserRoleEnum.TESTER;
+ AdminWorkspaceUIUtilies.updateUserRole(0, updatedUserRole);
+
+ ErrorMessageUIVerificator.validateErrorMessage(ActionStatus.CANNOT_UPDATE_USER_WITH_ACTIVE_ELEMENTS);
+ }
+
+ @Test
+ public void modifyUserRoleWithTaskInHand_InTesting() throws Exception{
+ User newTesterUser = new User();
+ newTesterUser.setUserId(generateValidUserId());
+ UserRoleEnum userTesterRole = UserRoleEnum.TESTER;
+ userTesterRole.setUserId(newTesterUser.getUserId());
+ AdminWorkspaceUIUtilies.createNewUser(newTesterUser.getUserId(), userTesterRole);
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ExtentTestActions.log(Status.INFO, "Creating a new VF named " + resourceMetaData.getName());
+ ResourceUIUtils.createResource(resourceMetaData, getUser());
+ ResourceGeneralPage.clickSubmitForTestingButton(resourceMetaData.getName());
+ Resource resourceObjectByNameAndVersion = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+ ExtentTestActions.log(Status.INFO, "Getting the VF to 'In Testing' state.");
+ AtomicOperationUtils.changeComponentState(resourceObjectByNameAndVersion, userTesterRole, LifeCycleStatesEnum.STARTCERTIFICATION, true);
+ ExtentTestActions.log(Status.INFO, "Succeeded - The VF is in testing state.");
+
+ reloginWithNewRole(UserRoleEnum.ADMIN);
+ UserRoleEnum updatedUserRole = UserRoleEnum.DESIGNER;
+ AdminWorkspaceUIUtilies.searchForUser(newTesterUser.getUserId());
+ AdminWorkspaceUIUtilies.updateUserRole(0, updatedUserRole);
+
+ ErrorMessageUIVerificator.validateErrorMessage(ActionStatus.CANNOT_UPDATE_USER_WITH_ACTIVE_ELEMENTS);
+ }
+
+
+ private static String generateValidUserId() {
+ String charsPattern = "abcdefghijklmnopqrstuvwxyz";
+ String digitPatter = "0123456789";
+ String chars = ResourceUIUtils.buildStringFromPattern(charsPattern, 2);
+ String digits = ResourceUIUtils.buildStringFromPattern(digitPatter, 4);
+ return chars + digits;
+ }
+
+ private String generateValidMacId() {
+ String digitPatter = "0123456789";
+ String digits = ResourceUIUtils.buildStringFromPattern(digitPatter, 5);
+ return "m" + digits;
+ }
+
+ private User createNewUserUsingAPI() {
+ UserRoleEnum role = UserRoleEnum.DESIGNER;
+ String userId = generateValidUserId();
+ User userByEnv = new User("Tzemer", "Gefen", userId, "userId@intl.sdc.com", role.name(), null);
+ User adminUser = getUserByEnv(UserRoleEnum.ADMIN);
+ try {
+ RestResponse createUserResp = UserRestUtils.createUser(userByEnv, adminUser);
+ Assert.assertEquals(createUserResp.getErrorCode().intValue(), 201, "Did not succeed to create a new user using API.");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return userByEnv;
+ }
+
+
+ private User getUserByEnv(UserRoleEnum userRole) {
+ try{
+ if (!getConfig().getUrl().contains("localhost") && !getConfig().getUrl().contains("127.0.0.1")) {
+ return getUserFromFileByRole(userRole);
+ }
+ else{
+ return getUser(userRole);
+ }
+ }
+ catch (Exception e){
+ throw new RuntimeException(e);
+ }
+ }
+
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.ADMIN;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java
new file mode 100644
index 0000000000..10389d9331
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java
@@ -0,0 +1,236 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CatalogPageLeftPanelSubCategoryCheckbox;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.TypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.CatalogVerificator;
+import org.openqa.selenium.WebElement;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+@Test(singleThreaded = true)
+public class CatalogLeftPanelTest extends SetupCDTest{
+
+ private String filePath;
+ @BeforeMethod
+ public void beforeTest(){
+ filePath = System.getProperty("filepath");
+
+ if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+ filePath = FileHandling.getResourcesFilesPath();
+ }
+
+ else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+ filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator;
+ }
+ }
+
+ public static String[] resourceTypes = Arrays.stream(ResourceTypeEnum.class.getEnumConstants()).
+ map(ResourceTypeEnum::name).toArray(String[]::new);
+
+ public static String[] catalogTypes = {"RESOURCE", "SERVICE", "PRODUCT"};
+
+ public static Object[][] provideData(String[] arObj) {
+ Object[][] arObject = new Object[arObj.length][];
+
+ int index = 0;
+ for (Object obj : arObj) {
+ arObject[index++] = new Object[]{obj};
+ }
+ return arObject;
+ }
+
+ @DataProvider(name = "Resource_Type_List")
+ private static final Object[][] resourceTypeList(){
+ // Extract names of constants from enum as array of Strings
+ ResourceTypeEnum[] resourceEnums = {ResourceTypeEnum.CP, ResourceTypeEnum.VF, ResourceTypeEnum.VFC, ResourceTypeEnum.VL};
+ String[] resourcesForTest = Arrays.stream(resourceEnums).map(ResourceTypeEnum::name).toArray(String[]::new);
+ return provideData(resourcesForTest);
+ }
+
+ @DataProvider(name = "Type_List")
+ private static final Object[][] typeList(){
+ // Extract names of constants from enum as array of Strings
+ Object[][] arObject = new Object[catalogTypes.length][];
+ int index = 0;
+ for (String catalogType : catalogTypes) {
+ if (catalogType.equals("RESOURCE")){
+ arObject[index++] = new Object[]{catalogType, resourceTypes};
+ } else {
+ arObject[index++] = new Object[]{catalogType, new String[] {catalogType}};
+ }
+ }
+ return arObject;
+ }
+
+ @DataProvider(name = "Status_List")
+ private static final Object[][] statusList(){
+ CheckBoxStatusEnum[] checkboxes = {CheckBoxStatusEnum.CERTIFIED,
+ CheckBoxStatusEnum.IN_DESIGN,
+ CheckBoxStatusEnum.DISTRIBUTED,
+ CheckBoxStatusEnum.IN_TESTING,
+ CheckBoxStatusEnum.READY_FOR_TESTING};
+ Object[][] arObject = new Object[checkboxes.length][];
+ int index = 0;
+ for (CheckBoxStatusEnum checkbox: checkboxes) {
+ if (checkbox.equals(CheckBoxStatusEnum.CERTIFIED)){
+ arObject[index++] = new Object[]{checkbox, Arrays.asList(LifeCycleStateEnum.CERTIFIED, LifeCycleStateEnum.DISTRIBUTED, LifeCycleStateEnum.WAITING_FOR_DISTRIBUTION) };
+ } else if (checkbox.equals(CheckBoxStatusEnum.IN_DESIGN)) {
+ arObject[index++] = new Object[]{checkbox, Arrays.asList(LifeCycleStateEnum.CHECKIN, LifeCycleStateEnum.CHECKOUT)};
+ } else if (checkbox.equals(CheckBoxStatusEnum.DISTRIBUTED)) {
+ arObject[index++] = new Object[]{checkbox, Arrays.asList(LifeCycleStateEnum.DISTRIBUTED)};
+ } else if (checkbox.equals(CheckBoxStatusEnum.IN_TESTING)) {
+ arObject[index++] = new Object[]{checkbox, Arrays.asList(LifeCycleStateEnum.IN_TESTING)};
+ } else if (checkbox.equals(CheckBoxStatusEnum.READY_FOR_TESTING)) {
+ arObject[index++] = new Object[]{checkbox, Arrays.asList(LifeCycleStateEnum.READY_FOR_TESTING)};
+ }
+ }
+ return arObject;
+ }
+
+ // filter by Type Resource in catalog
+ @Test(dataProvider = "Type_List")
+ public void filterByType(String catalogType, String[] classValues ) throws Exception {
+ setLog(catalogType);
+// getExtendTest().setDescription(catalogType);
+
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ CatalogUIUtilitis.catalogFilterTypeChecBox(TypesEnum.valueOf(catalogType));
+
+ CatalogVerificator.validateType(TypesEnum.valueOf(catalogType));
+ }
+
+ @Test(dataProvider = "Resource_Type_List")
+ public void filterByResourceType(String resourceType) throws Exception {
+ setLog(resourceType);
+// getExtendTest().setDescription(resourceType);
+
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ CatalogUIUtilitis.catalogFilterTypeChecBox(TypesEnum.valueOf(resourceType));
+
+ CatalogVerificator.validateType(TypesEnum.valueOf(resourceType));
+ }
+
+ @Test(dataProvider = "Status_List")
+ public void filterByStatus(CheckBoxStatusEnum statusCheckbox, List<LifeCycleStateEnum> lifecycleStates) throws Exception{
+ setLog(statusCheckbox.name());
+// getExtendTest().setDescription(statusCheckbox.name());
+
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ CatalogUIUtilitis.clickOnLeftPanelElement(DataTestIdEnum.CatalogPageLeftPanelFilterTitle.CATEGORIES);
+ CatalogUIUtilitis.catalogFilterStatusChecBox(statusCheckbox);
+
+ CatalogVerificator.validateStatus(lifecycleStates, statusCheckbox.name());
+ }
+
+ @Test
+ public void filterByUpperCategory() throws Exception{
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ CatalogUIUtilitis.clickOnLeftPanelElement(DataTestIdEnum.CatalogPageLeftPanelFilterTitle.TYPE);
+
+ WebElement categorieCheckbox = CatalogUIUtilitis.clickOnUpperCategoryCheckbox();
+
+ CatalogVerificator.validateCategory(categorieCheckbox.getAttribute("textContent").trim());
+ }
+
+ @Test
+ public void filterByGenericDtabaseSubCategory() throws Exception{
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ CatalogUIUtilitis.clickOnLeftPanelElement(DataTestIdEnum.CatalogPageLeftPanelFilterTitle.TYPE);
+
+ WebElement checkboxElement = GeneralUIUtils.getElementsByCSS(CatalogPageLeftPanelSubCategoryCheckbox.DATABASE.getValue()).get(0);
+ String checkboxElementName = checkboxElement.getAttribute("textContent").trim();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s subcategory ...", checkboxElementName));
+ GeneralUIUtils.clickOnAreaJS(checkboxElement);
+ CatalogVerificator.validateSubCategory("Generic", checkboxElementName);
+ }
+
+ @Test(priority = 1)
+ public void lastUpdatedService() throws Exception{
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ List<WebElement> cardElements = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DashboardCardEnum.INFO_NAME.getValue());
+ String firstElementName = cardElements.get(0).getAttribute("textContent").trim();
+ assertTrue(String.format("Wrong element name, Exepected : %s , Actual: %s", serviceMetadata.getName(), firstElementName), serviceMetadata.getName().equals(firstElementName));
+ }
+
+ @Test(priority = 17)
+ public void lastUpdatedResource() throws Exception{
+ // create resource
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ List<WebElement> cardElements = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DashboardCardEnum.INFO_NAME.getValue());
+ String firstElementName = cardElements.get(0).getAttribute("textContent").trim();
+ assertTrue(String.format("Wrong element name, Exepected : %s , Actual: %s", vfMetaData.getName(), firstElementName), vfMetaData.getName().equals(firstElementName));
+ }
+
+ @Test(priority = 5)
+ public void fromCatalogCheckout() throws Exception{
+ // create resource
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClickInCatalog(vfMetaData.getName());
+ ResourceGeneralPage.clickCheckoutButton();
+ ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java
new file mode 100644
index 0000000000..d2c787e4e5
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java
@@ -0,0 +1,213 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.category.CategoryDefinition;
+import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.AdminGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class Categories extends SetupCDTest {
+
+
+ @Test
+ public void createResourceCategory() throws Exception {
+
+ AdminGeneralPage.selectCategoryManagmetTab();
+ String newResourceCategory = ElementFactory.getDefaultCategory().getName();
+ AdminGeneralPage.createNewResourceCategory(newResourceCategory);
+ GeneralUIUtils.clickSomewhereOnPage();
+ List<WebElement> resourceCategoriesList = AdminGeneralPage.getResourceCategoriesList();
+ List<String> collect = resourceCategoriesList.stream().map(f -> f.getText()).collect(Collectors.toList());
+ collect.contains(newResourceCategory);
+
+
+ }
+
+ @Test
+ public void createServiceCategory() throws Exception {
+
+ AdminGeneralPage.selectCategoryManagmetTab();
+ String newserviceCategory = ElementFactory.getDefaultCategory().getName();
+ AdminGeneralPage.createNewServiceCategory(newserviceCategory);
+ GeneralUIUtils.clickSomewhereOnPage();
+ List<WebElement> serviceCategoriesList = AdminGeneralPage.getServiceCategoriesList();
+ List<String> collect = serviceCategoriesList.stream().map(f -> f.getText()).collect(Collectors.toList());
+ collect.contains(newserviceCategory);
+
+ }
+
+
+ @Test
+ public void createResourceSubCategory() throws Exception {
+
+ AdminGeneralPage.selectCategoryManagmetTab();
+ String newResourceCategory = ElementFactory.getDefaultCategory().getName();
+ String newserviceCategory = ElementFactory.getDefaultCategory().getName();
+ String newSubCategory = ElementFactory.getDefaultSubCategory().getName();
+ AdminGeneralPage.createNewResourceCategory(newResourceCategory);
+ AdminGeneralPage.createNewServiceCategory(newserviceCategory);
+ List<WebElement> serviceCategoriesList = AdminGeneralPage.getServiceCategoriesList();
+ List<WebElement> resourceCategoriesList = AdminGeneralPage.getResourceCategoriesList();
+ AdminGeneralPage.addSubCategoryToResource(resourceCategoriesList, newResourceCategory , newSubCategory);
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.clickSomewhereOnPage();
+
+
+ }
+
+
+ @Test
+ public void createExistingResourceCategory() throws Exception {
+
+ AdminGeneralPage.selectCategoryManagmetTab();
+ String newResourceCategory = ElementFactory.getDefaultCategory().getName();
+ AdminGeneralPage.createNewResourceCategory(newResourceCategory);
+ AdminGeneralPage.createNewResourceCategory(newResourceCategory);
+
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.COMPONENT_CATEGORY_ALREADY_EXISTS.name());
+ Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+
+
+ }
+
+ @Test
+ public void createExistingServiceCategory() throws Exception {
+
+ AdminGeneralPage.selectCategoryManagmetTab();
+ String newserviceCategory = ElementFactory.getDefaultCategory().getName();
+ AdminGeneralPage.createNewServiceCategory(newserviceCategory);
+ AdminGeneralPage.createNewServiceCategory(newserviceCategory);
+ AdminGeneralPage.selectUserManagmetTab();
+
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.COMPONENT_CATEGORY_ALREADY_EXISTS.name());
+ Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+
+ }
+
+ @Test
+ public void createExsitingResourceSubCategory() throws Exception {
+
+
+ AdminGeneralPage.selectCategoryManagmetTab();
+ String newResourceCategory = ElementFactory.getDefaultCategory().getName();
+ String newserviceCategory = ElementFactory.getDefaultCategory().getName();
+ String newSubCategory = ElementFactory.getDefaultSubCategory().getName();
+ AdminGeneralPage.createNewResourceCategory(newResourceCategory);
+ AdminGeneralPage.createNewServiceCategory(newserviceCategory);
+ List<WebElement> serviceCategoriesList = AdminGeneralPage.getServiceCategoriesList();
+ List<WebElement> resourceCategoriesList = AdminGeneralPage.getResourceCategoriesList();
+ AdminGeneralPage.addSubCategoryToResource(resourceCategoriesList, newResourceCategory , newSubCategory);
+ AdminGeneralPage.addSubCategoryToResource(resourceCategoriesList, newResourceCategory , newSubCategory);
+ GeneralUIUtils.waitForLoader();
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.COMPONENT_SUB_CATEGORY_EXISTS_FOR_CATEGORY.name());
+ Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+
+ }
+
+
+ @Test
+ public void createServiceWithNewCategory() throws Exception {
+
+ AdminGeneralPage.selectCategoryManagmetTab();
+ String newResourceCategory = ElementFactory.getDefaultCategory().getName();
+ String newserviceCategory = ElementFactory.getDefaultCategory().getName();
+ String newSubCategory = ElementFactory.getDefaultSubCategory().getName();
+ AdminGeneralPage.createNewResourceCategory(newResourceCategory);
+ AdminGeneralPage.createNewServiceCategory(newserviceCategory);
+ List<WebElement> serviceCategoriesList = AdminGeneralPage.getServiceCategoriesList();
+ List<WebElement> resourceCategoriesList = AdminGeneralPage.getResourceCategoriesList();
+ AdminGeneralPage.addSubCategoryToResource(resourceCategoriesList, newResourceCategory , newSubCategory);
+ GeneralUIUtils.waitForLoader();
+ AdminGeneralPage.selectUserManagmetTab();
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ List<CategoryDefinition> categories = serviceMetadata.getCategories();
+ categories.get(0).setName(newserviceCategory);
+
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ }
+
+
+ @Test
+ public void createResourceWithNewCategory() throws Exception {
+
+ AdminGeneralPage.selectCategoryManagmetTab();
+ String newResourceCategory = ElementFactory.getDefaultCategory().getName();
+ String newserviceCategory = ElementFactory.getDefaultCategory().getName();
+ String newSubCategory = ElementFactory.getDefaultSubCategory().getName();
+ AdminGeneralPage.createNewResourceCategory(newResourceCategory);
+ AdminGeneralPage.createNewServiceCategory(newserviceCategory);
+ List<WebElement> serviceCategoriesList = AdminGeneralPage.getServiceCategoriesList();
+ List<WebElement> resourceCategoriesList = AdminGeneralPage.getResourceCategoriesList();
+ AdminGeneralPage.addSubCategoryToResource(resourceCategoriesList, newResourceCategory , newSubCategory);
+ GeneralUIUtils.waitForLoader();
+ AdminGeneralPage.selectUserManagmetTab();
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ List<CategoryDefinition> categories = resourceMetaData.getCategories();
+ CategoryDefinition categoryDefinition = categories.get(0);
+ categoryDefinition.setName(newResourceCategory);
+ SubCategoryDefinition subCategoryDefinition = categoryDefinition.getSubcategories().get(0);
+ subCategoryDefinition.setName(newSubCategory);
+
+ ResourceUIUtils.createResource(resourceMetaData, getUser());
+
+
+ }
+
+
+
+
+
+
+
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.ADMIN;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java
new file mode 100644
index 0000000000..2c2b09af22
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java
@@ -0,0 +1,383 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.CustomizationUUIDVerificator;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.AssertJUnit;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+public class CustomizationUUID extends SetupCDTest {
+
+ private static final String DESCRIPTION = "kuku";
+ private static final String ARTIFACT_LABEL = "artifact3";
+ private static final String ARTIFACT_LABEL_UPDATE = "artifactUpdate";
+ private static final String GET_ARTIFACT_LIST_BY_CLASS_NAME = "i-sdc-designer-sidebar-section-content-item-artifact";
+ private static final String HEAT_FILE_YAML_NAME = "Heat-File.yaml";
+ private static final String HEAT_FILE_YAML_UPDATE_NAME = "Heat-File-Update.yaml";
+ private String filePath;
+
+ @BeforeMethod
+ public void beforeTest(){
+ filePath = System.getProperty("filepath");
+
+ if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+ filePath = FileHandling.getResourcesFilesPath();
+ }
+
+ else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+ filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator;
+ }
+ }
+
+ @Test
+ public void uniqueCustomizationUUIDforeachVFi() throws Exception {
+
+
+ ResourceReqDetails vfMetaData = createNewResourceWithArtifactSubmitForTesting();
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ TesterOperationPage.certifyComponent(vfMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+
+ List customizationUUIDs = new ArrayList<String>();
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CanvasElement VFiElement1 = addElemntToCanvas(vfMetaData, canvasManager);
+ CanvasElement VFiElement2 = addElemntToCanvas(vfMetaData, canvasManager);
+ CanvasElement VFiElement3 = addElemntToCanvas(vfMetaData, canvasManager);
+
+
+ ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+
+ canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+ addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+ addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement2);
+ addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement3);
+
+ ServiceGeneralPage.clickCheckoutButton();
+ canvasManager = CanvasManager.getCanvasManager();
+ CanvasElement VFiElement4 = addElemntToCanvas(vfMetaData, canvasManager);
+ CanvasElement VFiElement5 = addElemntToCanvas(vfMetaData, canvasManager);
+ CanvasElement VFiElement6 = addElemntToCanvas(vfMetaData, canvasManager);
+
+ ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+ canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+ addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement4);
+ addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement5);
+ addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement6);
+
+ CustomizationUUIDVerificator.validateCustomizationUUIDuniqueness(customizationUUIDs);
+
+
+ }
+
+
+ @Test
+ public void uniqueCustomizationUUIDafterArtifactCRUDofVFi() throws Exception {
+
+
+ ResourceReqDetails vfMetaData = createNewResourceWithArtifactSubmitForTesting();
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ TesterOperationPage.certifyComponent(vfMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+
+ List customizationUUIDs = new ArrayList<>();
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CanvasElement VFiElement1 = addElemntToCanvas(vfMetaData, canvasManager);
+
+ ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+
+ canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+ addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+
+ //add artifact to VFI
+
+ ServiceGeneralPage.clickCheckoutButton();
+ canvasManager = CanvasManager.getCanvasManager();
+
+ ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType());
+
+ canvasManager.clickOnCanvaElement(VFiElement1);
+ CompositionPage.showDeploymentArtifactTab();
+ CompositionPage.clickAddArtifactButton();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+
+
+ ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+ canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+ addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+
+
+ //delete VFI artifacts
+
+ ServiceGeneralPage.clickCheckoutButton();
+ canvasManager = CanvasManager.getCanvasManager();
+ canvasManager.clickOnCanvaElement(VFiElement1);
+ CompositionPage.showDeploymentArtifactTab();
+ List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ITEM.getValue() + ARTIFACT_LABEL);
+ SetupCDTest.getExtendTest().log(Status.INFO, "Going to delete " + HEAT_FILE_YAML_NAME + " artifact" + " and check if deleted");
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + ARTIFACT_LABEL);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+
+
+ ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+ canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+ addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+
+
+ CustomizationUUIDVerificator.validateCustomizationUUIDuniqueness(customizationUUIDs);
+
+ }
+
+
+ @Test
+ public void uniqueCustomizationUUIDchangeVFiVersion() throws Exception {
+
+
+ ResourceReqDetails vfMetaData = createNewResourceWithArtifactSubmitForTesting();
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ TesterOperationPage.certifyComponent(vfMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+
+ List customizationUUIDs = new ArrayList<>();
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CanvasElement VFiElement1 = addElemntToCanvas(vfMetaData, canvasManager);
+
+ ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+
+ canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+ addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+
+ //change VF version
+ HomePage.navigateToHomePage();
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ ResourceGeneralPage.clickCheckoutButton();
+ ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ TesterOperationPage.certifyComponent(vfMetaData.getName());
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+
+ //update VFI version
+
+ canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+ ServiceGeneralPage.clickCheckoutButton();
+ canvasManager = CanvasManager.getCanvasManager();
+ canvasManager.clickOnCanvaElement(VFiElement1);
+ CompositionPage.changeComponentVersion(canvasManager, VFiElement1, "2.0");
+
+ ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+ canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+ addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+
+ CustomizationUUIDVerificator.validateCustomizationUUIDuniqueness(customizationUUIDs);
+
+ }
+
+
+ @Test
+ public void uniqueCustomizationUUIDaddRelation() throws Exception {
+
+
+ ResourceReqDetails vfMetaData = createNewResourceWithArtifactSubmitForTesting();
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ TesterOperationPage.certifyComponent(vfMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+
+ List customizationUUIDs = new ArrayList<>();
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CanvasElement VFiElement1 = addElemntToCanvas(vfMetaData, canvasManager);
+
+ ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+
+ canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+ addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+
+ //change VF version
+ HomePage.navigateToHomePage();
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ ResourceGeneralPage.clickCheckoutButton();
+ ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ TesterOperationPage.certifyComponent(vfMetaData.getName());
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+
+ //update VFI version
+
+ canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+ ServiceGeneralPage.clickCheckoutButton();
+ canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(NormativeTypesEnum.PORT.getFolderName());
+ CanvasElement portElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.PORT);
+ canvasManager.linkElements(portElement, VFiElement1);
+
+ canvasManager.clickOnCanvaElement(VFiElement1);
+
+
+ ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+ canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+ addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+
+ CustomizationUUIDVerificator.validateCustomizationUUIDuniqueness(customizationUUIDs);
+
+ }
+
+
+
+ public CanvasManager findServiceAndNavigateToCanvas(ServiceReqDetails serviceMetadata) throws Exception {
+ CanvasManager canvasManager;
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ canvasManager = CanvasManager.getCanvasManager();
+ return canvasManager;
+ }
+
+ public ResourceReqDetails createNewResourceWithArtifactSubmitForTesting() throws Exception {
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML"));
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
+ }
+ AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+
+ String newDescription = "new description";
+ DeploymentArtifactPage.clickEditArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+ DeploymentArtifactPage.artifactPopup().insertDescription(newDescription);
+ DeploymentArtifactPage.artifactPopup().clickDoneButton();
+ String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel());
+ AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+
+ DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+ DeploymentArtifactPage.clickOK();
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+// ResourceReqDetails vfcCompute = ElementFactory.getDefaultResource(NormativeTypesEnum.COMPUTE);
+ CompositionPage.searchForElement(NormativeTypesEnum.COMPUTE.name());
+ CanvasManager canvasManagerVF = CanvasManager.getCanvasManager();
+ CanvasElement VFiElement1 = canvasManagerVF.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
+
+
+ ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
+ return vfMetaData;
+ }
+
+ public void addCanvasElementToList(List customizationUUIDs, CanvasManager canvasManager, CanvasElement VFiElement1)
+ throws Exception {
+ canvasManager.clickOnCanvaElement(VFiElement1);
+ WebElement VFi1customizationUUID = CompositionPage.getCustomizationUUID();
+ customizationUUIDs.add(VFi1customizationUUID.getText());
+ }
+
+ public CanvasElement addElemntToCanvas(ResourceReqDetails vfMetaData, CanvasManager canvasManager)
+ throws Exception {
+ CompositionPage.searchForElement(vfMetaData.getName());
+ CanvasElement VFiElement1 = canvasManager.createElementOnCanvas(vfMetaData.getName());
+ return VFiElement1;
+ }
+
+ public static void changeDeleteAndValidateVersionOnGeneralPage(String previousVersion, String currentVersion, String serviceName) throws Exception{
+ GeneralPageElements.selectVersion("V" + previousVersion);
+ ServiceVerificator.verifyVersionUI(previousVersion);
+ GeneralUIUtils.clickJSOnElementByText("latest version");
+ ServiceVerificator.verifyVersionUI(currentVersion);
+ GeneralPageElements.clickTrashButtonAndConfirm();
+ GeneralUIUtils.findComponentAndClick(serviceName);
+ ServiceVerificator.verifyVersionUI(previousVersion);
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/DeploymentViewTests.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/DeploymentViewTests.java
new file mode 100644
index 0000000000..87bf7b0506
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/DeploymentViewTests.java
@@ -0,0 +1,286 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.DeploymentPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.DeploymentViewVerificator;
+import org.openqa.selenium.WebElement;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+public class DeploymentViewTests extends SetupCDTest {
+
+ private String filePath;
+
+ @BeforeMethod
+ public void beforeTest(){
+ filePath = System.getProperty("filepath");
+
+ if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+ filePath = FileHandling.getResourcesFilesPath();
+ }
+
+ else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+ filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator;
+ }
+ }
+
+ @DataProvider(name = "CSAR_VF_Files", parallel = false)
+ public Object[][] createDataX() {
+ return new Object[][] { { "vSeGWdoubleMembers.csar" }, { "vSeGW.csar" }, {"vSeGWsingleModule.csar"}};
+ }
+
+
+ @Test(dataProvider = "CSAR_VF_Files")
+ public void deploymentScreenDCAEAssetImportCSARTest(String baseFileName) throws Exception{
+ //
+ setLog(baseFileName);
+// getExtendTest().setDescription(baseFileName);
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentViewScreen();
+ List<WebElement> moduleRowsFromTable = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.MODULES.getValue());
+ DeploymentViewVerificator verificator = new DeploymentViewVerificator(filePath + baseFileName);
+ verificator.verifyDeploymentPageModules(moduleRowsFromTable);
+ for(WebElement moduleRow :moduleRowsFromTable){
+ String moduleRowText = moduleRow.getText();
+ verificator.verifyDeploymentPageSubElements(moduleRowText.split("\\.\\.")[1]);
+ DeploymentPage.updateModuleName(moduleRowText, "updatedName");
+ String updatedModuleName = DeploymentPage.reconstructModuleName(moduleRowText.split("\\.\\."), "updatedName");
+ verificator.verifyComponentNameChanged( moduleRowText, updatedModuleName);
+ // Close module
+ GeneralUIUtils.clickOnElementByText(updatedModuleName);
+ }
+ }
+
+ @Test
+ public void deploymentScreenDCAEAssetUpdateWithNewGroupCSAR_TC1368223_Test() throws Exception{
+ String baseFileName = "baseUpdateMinusGroupFlowVF.csar";
+ String updateFileName = "baseUpdateFlowVF.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 2));
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());
+
+ Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI();
+ metaDataFromUI.put("base_ldsa", new HashMap<String, String> (){ {put("version", "0");
+ put("moduleID", "primary");}});
+
+ // add new group, base_ldsa
+ ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now", 3));
+ ResourceUIUtils.updateVfWithCsar(filePath, updateFileName);
+
+ DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName));
+ DeploymentViewVerificator.validateModuleNameUpadate();
+ };
+
+ @Test
+ public void deploymentScreenDCAEAssetDeleteGroupFromCSAR_TC1368281_Test() throws Exception{
+ String baseFileName = "baseUpdateFlowVF.csar";
+ String updateFileName = "baseUpdateMinusGroupFlowVF.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 3));
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());
+
+ Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI();
+
+ // remove group base_ldsa
+ ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now, base_ldsa group should be removed", 2));
+ ResourceUIUtils.updateVfWithCsar(filePath, updateFileName);
+
+ // validate that group was removed
+ DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName));
+
+ Map<String, HashMap<String, String>> metaDataFromUI2 = DeploymentPage.collectMetaDataFromUI();
+ metaDataFromUI2.put("base_ldsa", new HashMap<String, String> (){ {put("version", "0");
+ put("moduleID", "primary");}});
+
+ ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+ // add group base_ldsa
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now, base_ldsa group should be added", 3));
+ ResourceUIUtils.updateVfWithCsar(filePath, baseFileName);
+
+ // validate that group was added
+ DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI2, new DeploymentViewVerificator(filePath + baseFileName));
+ DeploymentViewVerificator.validateModuleNameUpadate();
+ }
+
+ @Test
+ public void deploymentScreenDCAEAssetUpdateWithNewGroupWithoutMembersCSAR_TC1368280_Test() throws Exception{
+ String baseFileName = "baseUpdateMinusGroupFlowVF.csar";
+ String updateFileName = "baseUpdateAddGroupNoMembersUpdateFlow.csar";
+ String updateFileName2 = "baseUpdateFlowVF.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 2));
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());
+
+ // add new group without members, base_ldsa
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now, base_ldsa group without members", 3));
+ ResourceUIUtils.updateVfWithCsar(filePath, updateFileName);
+
+ Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI();
+
+ // validate that group was added and no members exist
+ DeploymentViewVerificator.regularDepoymentScreenVerificator(null, new DeploymentViewVerificator(filePath + updateFileName));
+
+ ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+ // add group base_ldsa with members
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now, base_ldsa group with members", 3));
+ ResourceUIUtils.updateVfWithCsar(filePath, updateFileName2);
+
+ // validate that member was added to base_ldsa group
+ DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName2));
+ DeploymentViewVerificator.validateModuleNameUpadate();
+ };
+
+ @Test
+ public void deploymentScreenDCAEAssetImportCSARWithArtifactSection_TC1368282_1_Test() throws Exception{
+ String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 4 artifacts in every group ", 3));
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());
+
+ DeploymentViewVerificator.regularDepoymentScreenVerificator(null, new DeploymentViewVerificator(filePath + baseFileName));
+ DeploymentViewVerificator.validateModuleNameUpadate();
+ };
+
+ @Test
+ public void deploymentScreenDCAEAssetImportCSARRemoveArtifact_TC1368282_2_Test() throws Exception{
+ String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar";
+ String updateFileName = "baseUpdateFlowOneArtifactToGroup.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 4 artifacts in every group ", 3));
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());
+
+ Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI();
+
+ ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+ // remove artifact from every group
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be 3 artifacts in every group"));
+ ResourceUIUtils.updateVfWithCsar(filePath, updateFileName);
+
+ DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName));
+ DeploymentViewVerificator.validateModuleNameUpadate();
+ };
+
+ @Test
+ public void deploymentScreenDCAEAssetImportCSARAddArtifact_TC1368282_3_Test() throws Exception{
+ String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar";
+ String updateFileName = "baseUpdateFlowOneArtifactToGroup.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 3 artifacts in every group ", 3));
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, updateFileName, getUser());
+
+ Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI();
+
+ ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+ // add artifact to every group
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be 4 artifacts in every group"));
+ ResourceUIUtils.updateVfWithCsar(filePath, baseFileName);
+
+ DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + baseFileName));
+ DeploymentViewVerificator.validateModuleNameUpadate();
+ };
+
+ @Test
+ public void deploymentScreenDCAEAssetImportCSARMixArtifacts_TC1368282_4_Test() throws Exception{
+ String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar";
+ String updateFileName = "baseUpdateMixedArtifacts.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 4 artifacts in every group ", 3));
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());
+
+ Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI();
+
+ ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+ //mix artifacts between groups
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, mixing between artifacts and groups", 3));
+ ResourceUIUtils.updateVfWithCsar(filePath, updateFileName);
+
+ DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator());
+ DeploymentViewVerificator.validateModuleNameUpadate();
+ };
+
+ @Test
+ public void deploymentScreenDCAEAssetUpdateVFModule_TC1296437_Test() throws Exception{
+ String baseFileName = "baseUpdateMinusGroupFlowVF.csar";
+ String updateFileName = "baseUpdateFlowVF.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 2));
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());
+// SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating %s group version, should be %s ", moduleRowText, metaDataFromUI.get(moduleRowText.split("\\.\\.")[1])));
+
+ Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI();
+ metaDataFromUI.put("base_ldsa", new HashMap<String, String> (){ {put("version", "0");
+ put("moduleID", "primary");}});
+
+ DeploymentViewVerificator.validateEditPopover();
+
+ ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now", 3));
+ ResourceUIUtils.updateVfWithCsar(filePath, updateFileName);
+
+ assertTrue(resourceMetaData.getName().equals(ResourceGeneralPage.getNameText()));
+ DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName));
+ DeploymentViewVerificator.validateModuleNameUpadate();
+ }
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java
new file mode 100644
index 0000000000..6a80dfe854
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java
@@ -0,0 +1,678 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ResourceMetadataEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.InputsPage;
+import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.SkipException;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+public class ImportDCAE extends SetupCDTest {
+
+ private String filePath;
+ @BeforeMethod
+ public void beforeTest(){
+ filePath = System.getProperty("filepath");
+
+ if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+ filePath = FileHandling.getResourcesFilesPath();
+ }
+
+ else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+ filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator;
+ }
+ }
+
+ @Test
+ public void updateDCAEAsset() throws Exception {
+ ResourceReqDetails resourceMetaData = createDCAEAsset();
+
+ // update Resource
+ ResourceReqDetails updatedResource = new ResourceReqDetails();
+ updatedResource.setName("ciUpdatedNameImportDCAE");
+ updatedResource.setDescription("kuku");
+ updatedResource.setVendorName("updatedVendor");
+ updatedResource.setVendorRelease("updatedRelease");
+ updatedResource.setContactId("ab0001");
+ updatedResource.setCategories(resourceMetaData.getCategories());
+ updatedResource.setVersion("0.1");
+ List<String> newTags = resourceMetaData.getTags();
+ newTags.remove(resourceMetaData.getName());
+ newTags.add(updatedResource.getName());
+ updatedResource.setTags(newTags);
+ ResourceUIUtils.updateResource(updatedResource, getUser());
+
+ VfVerificator.verifyVFMetadataInUI(updatedResource);
+ VfVerificator.verifyVFUpdated(updatedResource, getUser());
+ }
+
+ @Test
+ public void vfcLinkedToComputeInDCAEAssetFlowTest() throws Exception {
+ String fileName = "importVFC_VFC14.yml";
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+
+ try{
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+ TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ ResourceReqDetails resourceMetaData = createDCAEAsset();
+
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ CanvasElement cpElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+ Assert.assertNotNull(cpElement);
+ ServiceVerificator.verifyNumOfComponentInstances(resourceMetaData, "0.1", 4, getUser());
+
+ canvasManager.linkElements(cpElement, computeElement);
+
+ resourceMetaData.setVersion("0.1");
+ VfVerificator.verifyLinkCreated(resourceMetaData, getUser(), 1);
+ }
+ finally{
+ ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
+ }
+
+ }
+
+ @Test
+ public void addUpdateDeleteDeploymentArtifactToDCAEAssetTest() throws Exception {
+ createDCAEAsset();
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML"));
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
+ }
+ assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+
+ String newDescription = "new description";
+ DeploymentArtifactPage.clickEditArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+ DeploymentArtifactPage.artifactPopup().insertDescription(newDescription);
+ DeploymentArtifactPage.artifactPopup().clickDoneButton();
+ String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel());
+ assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+
+ DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+ DeploymentArtifactPage.clickOK();
+ assertTrue("artifact "+ deploymentArtifactList.get(0).getArtifactLabel() + "is not deleted", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size() - 1));
+
+ assertTrue("artifact "+ deploymentArtifactList.get(1).getArtifactLabel() + "is not displayed", DeploymentArtifactPage.clickOnArtifactDescription(deploymentArtifactList.get(1).getArtifactLabel()).isDisplayed());
+ }
+
+ @Test
+ public void addUpdateDeleteInformationalArtifactDCAEAssetTest() throws Exception {
+ createDCAEAsset();
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+ InformationalArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
+
+ assertTrue("artifact table does not contain artifacts uploaded", InformationalArtifactPage.checkElementsCountInTable(1));
+
+ String newDescription = "new description";
+ InformationalArtifactPage.clickEditArtifact(informationalArtifact.getArtifactLabel());
+ InformationalArtifactPage.artifactPopup().insertDescription(newDescription);
+ InformationalArtifactPage.artifactPopup().clickDoneButton();
+ String actualArtifactDescription = InformationalArtifactPage.getArtifactDescription(informationalArtifact.getArtifactLabel());
+ assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+
+ InformationalArtifactPage.clickDeleteArtifact(informationalArtifact.getArtifactLabel());
+ InformationalArtifactPage.clickOK();
+ assertTrue("artifact "+ informationalArtifact.getArtifactLabel() + "is not deleted", InformationalArtifactPage.checkElementsCountInTable(0));
+ }
+
+ @Test
+ public void addPropertiesToVfcInstanceInDCAEAssetTest() throws Exception {
+ String fileName = "importVFC_VFC15.yml";
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+
+ try{
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
+
+ createDCAEAsset();
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ CanvasElement vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+
+ vfCanvasManager.clickOnCanvaElement(vfcElement);
+ CompositionPage.showPropertiesAndAttributesTab();
+ List<WebElement> properties = CompositionPage.getProperties();
+ String propertyValue = "abc123";
+ for (int i = 0; i < 2; i++) {
+ WebElement findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label"));
+ findElement.click();
+ PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(propertyValue);
+ PropertiesPage.getPropertyPopup().clickSave();
+
+ findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-value"));
+ assertTrue(findElement.getText().equals(propertyValue));
+ }
+ }
+ finally{
+ ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
+ }
+ }
+
+ @Test
+ public void changeInstanceVersionDCAEAssetTest() throws Exception{
+ ResourceReqDetails atomicResourceMetaData = null;
+ ResourceReqDetails vfMetaData = null;
+ CanvasManager vfCanvasManager;
+ CanvasElement vfcElement = null;
+ String fileName = "importVFC_VFC16.yml";
+ try{
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+
+ vfMetaData = createDCAEAsset();
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+
+ CompositionPage.clickSubmitForTestingButton(vfMetaData.getName());
+ assert(false);
+ }
+ catch(Exception e){
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
+ Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+ TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.changeComponentVersion(vfCanvasManager, vfcElement, "1.0");
+
+ //verfication
+ VfVerificator.verifyInstanceVersion(vfMetaData, getUser(), atomicResourceMetaData.getName(), "1.0");
+ }
+
+ finally{
+ ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
+ }
+
+ }
+
+ // future removed from ui
+ @Test(enabled = false)
+ public void addUpdateDeleteSimplePropertiesToDCAEAssetTest() throws Exception{
+ createDCAEAsset();
+
+ ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen();
+ List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
+ int propertiesCount = PropertiesPage.getElemenetsFromTable().size();
+ for (PropertyTypeEnum prop : propertyList){
+ PropertiesUIUtils.addNewProperty(prop);
+ }
+ assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable()));
+ VfVerificator.verifyPropertiesInUI(propertyList);
+ PropertiesPage.verifyTotalProperitesField(propertiesCount + propertyList.size());
+
+ PropertyTypeEnum prop = propertyList.get(0);
+ prop.setDescription("updatedDescription");
+ prop.setValue("value");
+ PropertiesUIUtils.updateProperty(prop);
+
+ PropertiesPage.clickDeletePropertyArtifact(prop.getName());
+ assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size() - 1, () -> PropertiesPage.getElemenetsFromTable()));
+ }
+
+ // future removed from ui
+ @Test(enabled = false)
+ public void DCAEAssetInstancesInputScreenTest() throws Exception{
+ createDCAEAsset();
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+
+ Map<String, String> elementsIntancesMap = new HashMap<String, String>();
+ for (LeftPanelCanvasItems element : Arrays.asList(LeftPanelCanvasItems.DATABASE)){
+ CanvasElement elementOnCanvas = vfCanvasManager.createElementOnCanvas(element);
+ vfCanvasManager.clickOnCanvaElement(elementOnCanvas);
+ String selectedInstanceName = CompositionPage.getSelectedInstanceName();
+ elementsIntancesMap.put(selectedInstanceName, element.getValue());
+ }
+
+ CompositionPage.moveToInputsScreen();
+ int canvasElementsSize = vfCanvasManager.getCanvasElements().size() + 2;
+ List<String> inputsNamesFromTable = InputsPage.getVFCInstancesNamesFromTable();
+ assertTrue(String.format("Instances count is not as Expected: %s Actual: %s", canvasElementsSize, inputsNamesFromTable.size()), inputsNamesFromTable.size() == canvasElementsSize);
+
+ for (String instanceName :inputsNamesFromTable){
+ String resourceName = instanceName.split(" ")[0];
+ ResourceReqDetails resource = new ResourceReqDetails();
+ resource.setName(resourceName);
+ resource.setVersion("1.0");
+ if (resourceName.equals("Port")){
+ resource.setResourceType(ResourceTypeEnum.CP.toString());
+ } else {
+ resource.setResourceType(ResourceTypeEnum.VFC.toString());
+ }
+ RestResponse restResponse = RestCDUtils.getResource(resource, getUser());
+ Map<String, String> propertiesNameTypeJson = ResponseParser.getPropertiesNameType(restResponse);
+
+ List<WebElement> propertyRowsFromTable = InputsPage.getInstancePropertiesList(resourceName);
+ assertTrue("Some properties are missing in table. Instance name is : " + resourceName, propertyRowsFromTable.size() == propertiesNameTypeJson.size());
+ VfVerificator.verifyVfInputs(instanceName, propertiesNameTypeJson, propertyRowsFromTable);
+
+ GeneralUIUtils.clickOnElementByText(resourceName);
+ }
+ }
+
+ @Test
+ public void addAllInformationalArtifactPlaceholdersInDCAEAssetTest() throws Exception{
+ createDCAEAsset();
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ for(InformationalArtifactsPlaceholders informArtifact : InformationalArtifactsPlaceholders.values()){
+ ArtifactUIUtils.fillPlaceHolderInformationalArtifact(informArtifact, filePath,"asc_heat 0 2.yaml", informArtifact.getValue());
+ }
+
+ assertTrue(InformationalArtifactPage.checkElementsCountInTable(InformationalArtifactsPlaceholders.values().length));
+ }
+
+ @Test
+ public void verifyToscaArtifactsExistDCAEAssetTest() throws Exception{
+ ResourceReqDetails vfMetaData = createDCAEAsset();
+
+ final int numOfToscaArtifacts = 2;
+ ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+ assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts));
+
+ for(int i = 0; i < numOfToscaArtifacts; i++){
+ String typeFromScreen = ToscaArtifactsPage.getArtifactType(i);
+ assertTrue(typeFromScreen.equals(ArtifactTypeEnum.TOSCA_CSAR.getType()) || typeFromScreen.equals(ArtifactTypeEnum.TOSCA_TEMPLATE.getType()));
+ }
+
+ ToscaArtifactsPage.clickSubmitForTestingButton(vfMetaData.getName());
+ VfVerificator.verifyToscaArtifactsInfo(vfMetaData, getUser());
+ }
+
+ @Test
+ public void DCAEAssetCertificationTest() throws Exception{
+ ResourceReqDetails vfMetaData = createDCAEAsset();
+
+ String vfName = vfMetaData.getName();
+
+ ResourceGeneralPage.clickCheckinButton(vfName);
+ GeneralUIUtils.findComponentAndClick(vfName);
+ ResourceGeneralPage.clickSubmitForTestingButton(vfName);
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vfName);
+ TesterOperationPage.certifyComponent(vfName);
+
+ vfMetaData.setVersion("1.0");
+ VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.CERTIFIED);
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(vfName);
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CERTIFIED);
+ }
+
+ @Test
+ public void deleteDCAEAssetCheckedoutTest() throws Exception{
+ ResourceReqDetails vfMetaData = createDCAEAsset();
+
+ GeneralPageElements.clickTrashButtonAndConfirm();
+
+ vfMetaData.setVersion("0.1");
+ VfVerificator.verifyVfDeleted(vfMetaData, getUser());
+ }
+
+ @Test
+ public void revertDCAEAssetMetadataTest() throws Exception{
+ ResourceReqDetails vfMetaData = createDCAEAsset();
+
+ ResourceReqDetails vfRevertDetails = new ResourceReqDetails();
+ vfRevertDetails.setName("ciUpdatedName");
+ vfRevertDetails.setDescription("kuku");
+ vfRevertDetails.setCategories(vfMetaData.getCategories());
+ vfRevertDetails.setVendorName("updatedVendor");
+ vfRevertDetails.setVendorRelease("updatedRelease");
+ ResourceUIUtils.fillResourceGeneralInformationPage(vfRevertDetails, getUser(), false);
+
+ GeneralPageElements.clickRevertButton();
+
+ VfVerificator.verifyVFMetadataInUI(vfMetaData);
+ }
+
+ @Test
+ public void addDeploymentArtifactInCompositionScreenDCAEAssetTest() throws Exception{
+ createDCAEAsset();
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ ArtifactInfo artifact = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3","OTHER");
+ CompositionPage.showDeploymentArtifactTab();
+ CompositionPage.clickAddArtifactButton();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+
+ List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className("i-sdc-designer-sidebar-section-content-item-artifact"));
+ Assert.assertEquals(1, actualArtifactList.size());
+ }
+
+ // future removed from ui
+ @Test(enabled = false)
+ public void addPropertyInCompositionScreenDCAEAssetTest() throws Exception{
+ createDCAEAsset();
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ CompositionPage.showPropertiesAndAttributesTab();
+ List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
+ int propertiesCount = CompositionPage.getProperties().size();
+ for (PropertyTypeEnum prop : propertyList){
+ PropertiesUIUtils.addNewProperty(prop);
+ }
+ assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> CompositionPage.getProperties()));
+ }
+
+ @Test
+ public void addDeploymentArtifactAndVerifyInCompositionScreenDCAEAssetTest() throws Exception{
+ createDCAEAsset();
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ ArtifactInfo deploymentArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
+ assertTrue(DeploymentArtifactPage.checkElementsCountInTable(1));
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ CompositionPage.showDeploymentArtifactTab();
+ List<WebElement> deploymentArtifactsFromScreen = CompositionPage.getDeploymentArtifacts();
+ assertTrue(1 == deploymentArtifactsFromScreen.size());
+
+ String actualArtifactFileName = deploymentArtifactsFromScreen.get(0).getText();
+ assertTrue("asc_heat-0-2.yaml".equals(actualArtifactFileName));
+ }
+
+ @Test
+ public void checkoutDCAEAssetTest() throws Exception{
+ ResourceReqDetails vfMetaData = createDCAEAsset();
+
+ ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ GeneralPageElements.clickCheckoutButton();
+
+ vfMetaData.setVersion("0.2");
+ VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+
+ ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ TesterOperationPage.certifyComponent(vfMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ ResourceGeneralPage.clickCheckoutButton();
+
+ vfMetaData.setVersion("1.1");
+ vfMetaData.setUniqueId(null);
+ VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+ }
+
+ @Test
+ public void deleteInstanceFromDCAEAssetCanvas() throws Exception{
+ ResourceReqDetails vfMetaData = createDCAEAsset();
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+ CanvasElement computeElement = CompositionPage.addElementToCanvasScreen(LeftPanelCanvasItems.COMPUTE, vfCanvasManager);
+
+ vfCanvasManager.clickOnCanvaElement(computeElement);
+ vfCanvasManager.deleteElementFromCanvas(computeElement);
+
+ VfVerificator.verifyNumOfComponentInstances(vfMetaData, 2, getUser());
+ }
+
+ @Test
+ public void changeInstanceNameInDCAEAssetTest() throws Exception{
+ createDCAEAsset();
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+ CanvasElement computeElement = CompositionPage.addElementToCanvasScreen(LeftPanelCanvasItems.COMPUTE, vfCanvasManager);
+
+ String updatedInstanceName = "updatedName";
+ vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName);
+
+ String actualSelectedInstanceName = CompositionPage.getSelectedInstanceName();
+ assertTrue(updatedInstanceName.equals(actualSelectedInstanceName));
+ }
+
+ @Test
+ public void submitDCAEAssetForTestingWithNonCertifiedAsset() throws Exception{
+ String fileName = "importVFC_VFC17.yml";
+
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+
+ ResourceReqDetails vfMetaData = createDCAEAsset();
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.addElementToCanvasScreen(atomicResourceMetaData.getName(), canvasManager);
+
+ try{
+ CompositionPage.clickSubmitForTestingButton(vfMetaData.getName());
+ assert(false);
+ }
+ catch(Exception e){
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
+ Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+ }
+ finally{
+ ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
+ }
+ }
+
+ @Test
+ public void isDisabledAndReadOnlyInCheckinDCAEAssetTest() throws Exception{
+ ResourceReqDetails vfMetaData = createDCAEAsset();
+ ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ ResourceMetadataEnum[] fieldsForCheck = {ResourceMetadataEnum.RESOURCE_NAME,
+ ResourceMetadataEnum.DESCRIPTION,
+ ResourceMetadataEnum.VENDOR_NAME,
+ ResourceMetadataEnum.VENDOR_RELEASE,
+ ResourceMetadataEnum.CONTACT_ID,
+ ResourceMetadataEnum.CATEGORY,
+ ResourceMetadataEnum.TAGS};
+
+ for (ResourceMetadataEnum field: fieldsForCheck){
+ VfVerificator.verifyIsElementDisabled(field.getValue(), field.name());
+ }
+ VfVerificator.verifyIsElementDisabled(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue(), DataTestIdEnum.LifeCyleChangeButtons.CREATE.name());
+ }
+
+ @Test
+ public void removeFileFromGeneralPageDCAEAssetTest() throws Exception{
+ String fileName2 = "service_input_test_VF2.csar";
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ ResourceUIUtils.importVfFromCsarNoCreate(resourceMetaData, filePath, fileName2, getUser());
+ GeneralPageElements.clickDeleteFile();
+
+ try{
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue(), 30);
+ assert(false);
+ }
+ catch(Exception e){
+ assert(true);
+ }
+ }
+
+ @Test
+ public void activityLogDCAEAssetTest() throws Exception{
+ createDCAEAsset();
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+ InformationalArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
+
+ ResourceGeneralPage.getLeftMenu().moveToActivityLogScreen();
+
+ int numberOfRows = GeneralUIUtils.getElementsByCSS("div[class^='flex-container']").size();
+ assertTrue("Wrong rows number, should be 2", numberOfRows == 2);
+ }
+
+ @Test
+ public void checkinCheckoutChangeDeleteVersionDCAEAssetTest() throws Exception{
+ ResourceReqDetails atomicResourceMetaData = createDCAEAsset();
+
+ ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
+ GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+ GeneralPageElements.clickCheckoutButton();
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+
+ GeneralPageElements.selectVersion("V0.1");
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKIN);
+ GeneralUIUtils.clickJSOnElementByText("latest version");
+
+ GeneralPageElements.clickTrashButtonAndConfirm();
+ GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+ String actualVersion = GeneralUIUtils.getSelectedElementFromDropDown(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue()).getText();
+ assertTrue("Expected version: V0.1, Actual version: " + actualVersion, actualVersion.equals("V0.1"));
+ }
+
+ @Test
+ public void badFileDCAEAssetTest() throws Exception {
+ String customFileName = "badVF.csar";
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ try{
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, customFileName, getUser());
+ assert(false);
+ }
+ catch(Exception e){
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.CSAR_INVALID.name());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating error messdge..."));
+ Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+ }
+ }
+
+ @Test
+ public void validContactAfterCreateDCAEAssetTest() throws Exception{
+ String fileName2 = "service_input_test_VF2.csar";
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating that userID equal to user that was logged in..."));
+ assertTrue("wrong userId", resourceMetaData.getContactId().equals(ResourceGeneralPage.getContactIdText()));
+ }
+
+ public ResourceReqDetails createDCAEAsset() throws Exception{
+ String fileName2 = "service_input_test_VF2.csar";
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser());
+ resourceMetaData.setVersion("0.1");
+ return resourceMetaData;
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java
new file mode 100644
index 0000000000..92e9a2f6c1
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java
@@ -0,0 +1,353 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.ci.tests.verificator.VFCverificator;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+public class ImportVFCAsset extends SetupCDTest {
+
+ private ResourceReqDetails atomicResourceMetaData;
+
+ private String filePath;
+ @BeforeClass
+ public void beforeClass(){
+ filePath = System.getProperty("filepath");
+ if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+ filePath = FileHandling.getResourcesFilesPath();
+ }
+ else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+ filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator + "";
+ }
+ }
+
+ @DataProvider(name = "assetFiles", parallel = false)
+ public Object[][] createDataX() {
+ return new Object[][] { { "importVFC_VFC9.yml" }, { "CP.yml" }, {"VL.yml"} };
+ }
+
+ @Test
+ public void importVFCTest() throws Exception {
+ String fileName = "importVFC_VFC1.yml";
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ }
+
+ @Test
+ public void importDuplicateVFCTest() throws Exception {
+ String fileName = "importVFC_VFC2.yml";
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
+
+ ResourceReqDetails atomicResourceMetaDataDup = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_INFRASTRUCTURE, getUser());
+ try{
+ ResourceUIUtils.importVfc(atomicResourceMetaDataDup, filePath, fileName, getUser());
+ assert(false);
+ }
+ catch(Exception e){
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.RESOURCE_ALREADY_EXISTS.name());
+ Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+ }
+ }
+
+ @Test
+ public void badFileVFCTest() throws Exception {
+ String fileName = "importVFC_VFC3.yml";
+ String customFileName = "Heat-File 1.yaml";
+
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ try{
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, customFileName, getUser());
+ assert(false);
+ }
+ catch(Exception e){
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.INVALID_TOSCA_TEMPLATE.name());
+ Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+ }
+ }
+
+ @Test
+ public void validContactAfterCreateVFCTest() throws Exception{
+ String fileName = "importVFC_VFC4.yml";
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+
+ assertTrue("wrong userId", atomicResourceMetaData.getContactId().equals(ResourceGeneralPage.getContactIdText()));
+ }
+
+ @Test
+ public void validContactAfterUpdateVFCTest() throws Exception{
+ String fileName = "importVFC_VFC5.yml";
+ String userIdUpdated = "up1234";
+
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+
+ ResourceUIUtils.defineUserId(userIdUpdated);
+ assertTrue("userId is not updated",userIdUpdated.equals(ResourceGeneralPage.getContactIdText()));
+ }
+
+ @Test
+ public void addUpdateDeleteDeploymentArtifactToVFCTest() throws Exception {
+ String fileName = "importVFC_VFC6.yml";
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML"));
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact, new UploadArtifactPopup(true) );
+ }
+ assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+
+ String newDescription = "new description";
+ DeploymentArtifactPage.updateDescription(newDescription, deploymentArtifactList.get(0));
+ String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel());
+ assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+
+ DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+ DeploymentArtifactPage.clickOK();
+ assertTrue("artifact "+ deploymentArtifactList.get(0).getArtifactLabel() + "is not deleted", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size() - 1));
+
+ assertTrue("artifact "+ deploymentArtifactList.get(1).getArtifactLabel() + "is not displayed", DeploymentArtifactPage.clickOnArtifactDescription(deploymentArtifactList.get(1).getArtifactLabel()).isDisplayed());
+ }
+
+ @Test
+ public void addUpdateDeletePlaceholdersInformationalArtefactVFCTest() throws Exception{
+ String fileName = "importVFC_VFC7.yml";
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ // create artifacts
+ List<ArtifactInfo> informationalArtifactList = new ArrayList<ArtifactInfo>();
+ informationalArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+ informationalArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuuuuku", "artifact3", "HEAT"));
+ for (ArtifactInfo informationalArtifact : informationalArtifactList) {
+ InformationalArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
+ }
+ assertTrue("artifact table does not contain artifacts uploaded", InformationalArtifactPage.checkElementsCountInTable(informationalArtifactList.size()));
+
+ // update artifact description
+ String newDescription = "new description";
+ InformationalArtifactPage.clickEditArtifact(informationalArtifactList.get(0).getArtifactLabel());
+ InformationalArtifactPage.artifactPopup().insertDescription(newDescription);
+ InformationalArtifactPage.artifactPopup().clickDoneButton();
+ String actualArtifactDescription = InformationalArtifactPage.getArtifactDescription(informationalArtifactList.get(0).getArtifactLabel());
+ assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+
+ // delete artifacts
+ for (ArtifactInfo informationalArtifact : informationalArtifactList) {
+ InformationalArtifactPage.clickDeleteArtifact(informationalArtifact.getArtifactLabel());
+ InformationalArtifactPage.clickOK();
+ }
+
+ assertTrue("not all artifacts is deleted", InformationalArtifactPage.checkElementsCountInTable(0));
+
+ // fill placeholders
+ for(InformationalArtifactsPlaceholders informArtifact : InformationalArtifactsPlaceholders.values()){
+ ArtifactUIUtils.fillPlaceHolderInformationalArtifact(informArtifact, filePath,"asc_heat 0 2.yaml", informArtifact.getValue());
+ }
+ InformationalArtifactPage.checkElementsCountInTable(InformationalArtifactsPlaceholders.values().length);
+ }
+
+ @Test
+ public void addSimplePropertiesToVFCTest() throws Exception{
+ String fileName = "importVFC_VFC8.yml";
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen();
+ List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER, PropertyTypeEnum.FLOAT);
+ int propertiesCount = PropertiesPage.getElemenetsFromTable().size();
+ for (PropertyTypeEnum prop : propertyList){
+ PropertiesUIUtils.addNewProperty(prop);
+ }
+ assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable()));
+
+ }
+
+
+ @Test(dataProvider = "assetFiles")
+ public void checkinCheckoutChangeDeleteVersionVFCTest(String customfileName) throws Exception{
+ setLog(customfileName);
+// getExtendTest().setDescription(customfileName);
+
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, customfileName, getUser());
+
+ ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
+ GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+ GeneralPageElements.clickCheckoutButton();
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+
+ GeneralPageElements.selectVersion("V0.1");
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKIN);
+ GeneralUIUtils.clickJSOnElementByText("latest version");
+
+ GeneralPageElements.clickTrashButtonAndConfirm();
+ GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+ String actualVersion = GeneralUIUtils.getSelectedElementFromDropDown(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue()).getText();
+ assertTrue("Expected version: V0.1, Actual version: " + actualVersion, actualVersion.equals("V0.1"));
+ }
+
+ @Test
+ public void certificationVFCTest() throws Exception{
+ String fileName = "importVFC_VFC10.yml";
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+
+ String vfName = atomicResourceMetaData.getName();
+
+ ResourceGeneralPage.clickCheckinButton(vfName);
+ GeneralUIUtils.findComponentAndClick(vfName);
+ ResourceGeneralPage.clickSubmitForTestingButton(vfName);
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vfName);
+ TesterOperationPage.certifyComponent(vfName);
+
+ atomicResourceMetaData.setVersion("1.0");
+ VfVerificator.verifyVFLifecycle(atomicResourceMetaData, getUser(), LifecycleStateEnum.CERTIFIED);
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(vfName);
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CERTIFIED);
+ }
+
+ @Test
+ public void activityLogVFCTest() throws Exception{
+ String fileName = "importVFC_VFC11.yml";
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+ InformationalArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
+
+ ResourceGeneralPage.getLeftMenu().moveToActivityLogScreen();
+
+ int numberOfRows = GeneralUIUtils.getElementsByCSS("div[class^='flex-container']").size();
+ assertTrue("Wrong rows number, should be 2", numberOfRows == 2);
+ }
+
+ @Test
+ public void removeFileFromGeneralPageVFCTest() throws Exception{
+ String fileName = "importVFC_VFC12.yml";
+
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfcNoCreate(atomicResourceMetaData, filePath, fileName, getUser());
+
+ GeneralPageElements.clickDeleteFile();
+
+ try{
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue(), 30);
+ assert(false);
+ }
+ catch(Exception e){
+ assert(true);
+ }
+ }
+
+ @Test
+ public void maxLengthGeneralInformationVFCTest() throws Exception{
+ String fileName = "importVFC_VFC13.yml";
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
+ ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceUIUtils.fillMaxValueResourceGeneralInformationPage(atomicResourceMetaData);
+ GeneralPageElements.clickUpdateButton();
+ VFCverificator.verifyVFCUpdatedInUI(atomicResourceMetaData);
+ GeneralPageElements.clickDeleteVersionButton();
+ }
+
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java
new file mode 100644
index 0000000000..39311731c7
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java
@@ -0,0 +1,355 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.pages.OpsOperationPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openqa.selenium.WebElement;
+import org.testng.AssertJUnit;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.clearspring.analytics.util.Pair;
+import com.aventstack.extentreports.Status;
+import com.aventstack.extentreports.ExtentTest;
+
+public class Onboard extends SetupCDTest {
+
+ public static Object[][] provideData(Object[] fileNamesFromFolder, String filepath) {
+ Object[][] arObject = new Object[fileNamesFromFolder.length][];
+
+ int index = 0;
+ for (Object obj : fileNamesFromFolder) {
+ arObject[index++] = new Object[] { filepath, obj };
+ }
+ return arObject;
+ }
+
+ @DataProvider(name = "VNF_List" , parallel = true)
+ private static final Object[][] VnfList() throws Exception {
+ String filepath = getFilePath();
+
+ Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+ System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.length));
+ return provideData(fileNamesFromFolder, filepath);
+ }
+
+ public static String getFilePath() {
+ String filepath = System.getProperty("filepath");
+ if (filepath == null && System.getProperty("os.name").contains("Windows")) {
+ filepath = FileHandling.getResourcesFilesPath() +"VNFs";
+ }
+
+ else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+ filepath = FileHandling.getBasePath() + File.separator + "Files" + File.separator +"VNFs";
+ }
+ return filepath;
+ }
+
+ @Test
+ public void onboardVNFTestSanity() throws Exception, Throwable {
+// String filepath = getFilePath();
+// String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
+ String filepath = getFilePath();
+ Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+ String vnfFile = fileNamesFromFolder[0].toString();
+ runOnboardToDistributionFlow(filepath, vnfFile);
+ }
+
+ public void runOnboardToDistributionFlow(String filepath, String vnfFile) throws Exception, AWTException {
+ Pair<String,Map<String,String>> onboardAndValidate = OnboardingUtils.onboardAndValidate(filepath, vnfFile, getUser());
+ String vspName = onboardAndValidate.left;
+
+ DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen();
+ ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFile ,"The topology template for " + vnfFile + " is as follows : ");
+
+ DeploymentArtifactPage.clickSubmitForTestingButton(vspName);
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vspName);
+ TesterOperationPage.certifyComponent(vspName);
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CompositionPage.searchForElement(vspName);
+ CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
+ CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
+ ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName);
+
+ assertNotNull(vfElement);
+ ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
+ ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile ,"The service topology is as follows : ");
+
+ ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata.getName());
+
+ reloginWithNewRole(UserRoleEnum.GOVERNOR);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ GovernorOperationPage.approveSerivce(serviceMetadata.getName());
+
+ reloginWithNewRole(UserRoleEnum.OPS);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ OpsOperationPage.distributeService();
+ OpsOperationPage.displayMonitor();
+
+ List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
+ AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
+
+ OpsOperationPage.waitUntilArtifactsDistributed(0);
+
+// validateInputArtsVSouput(serviceMetadata.getName());
+
+ getExtendTest().log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile));
+ }
+
+// protected synchronized void validateInputArtsVSouput(String serviceName) {
+//
+//
+// String filepath = System.getProperty("filepath");
+// if (filepath == null && System.getProperty("os.name").contains("Windows")) {
+// filepath = FileHandling.getResourcesFilesPath() + folder + File.separator;
+// }
+//
+// Set<Entry<String, Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>>> serviceArtifactCorrelationMap = ArtifactsCorrelationManager.getServiceArtifactCorrelationMap(serviceName);
+//
+// }
+
+ @Test(dataProvider = "VNF_List")
+ public void onboardVNFTest(String filepath, String vnfFile) throws Exception, Throwable {
+ setLog(vnfFile);
+ runOnboardToDistributionFlow(filepath, vnfFile);
+ }
+
+
+ @Test
+ public void onboardUpdateVNFTest() throws Exception, Throwable {
+ String filepath = getFilePath();
+ Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+ String vnfFile = fileNamesFromFolder[0].toString();
+
+ Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(filepath, vnfFile, getUser());
+ String vspName = vsp.left;
+ ResourceGeneralPage.clickSubmitForTestingButton(vspName);
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vspName);
+ TesterOperationPage.certifyComponent(vspName);
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CompositionPage.searchForElement(vspName);
+ CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
+ CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
+ assertNotNull(vfElement);
+ ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
+
+ HomePage.navigateToHomePage();
+
+ ///update flow
+ String updatedVnfFile = fileNamesFromFolder[1].toString();
+
+ getExtendTest().log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile));
+ // update VendorSoftwareProduct
+ OnboardingUtils.updateVnfAndValidate(filepath, vsp, updatedVnfFile, getUser());
+
+ ResourceGeneralPage.clickSubmitForTestingButton(vspName);
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vspName);
+ TesterOperationPage.certifyComponent(vspName);
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+
+ // replace exiting VFI in service with new updated
+
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ serviceCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.changeComponentVersion(serviceCanvasManager, vfElement, "2.0");
+ ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
+
+ ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata.getName());
+
+ reloginWithNewRole(UserRoleEnum.GOVERNOR);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ GovernorOperationPage.approveSerivce(serviceMetadata.getName());
+
+ reloginWithNewRole(UserRoleEnum.OPS);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ OpsOperationPage.distributeService();
+ OpsOperationPage.displayMonitor();
+
+ List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
+ AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
+
+ OpsOperationPage.waitUntilArtifactsDistributed(0);
+
+ getExtendTest().log(Status.INFO, String.format("onboarding %s test is passed ! ", vnfFile));
+
+
+ }
+
+ @Test
+ public void threeVMMSCsInServiceTest() throws Exception{
+ String filepath = getFilePath();
+
+
+ List<String> vmmscList = new ArrayList<String>();
+ vmmscList = Arrays.asList(new File(filepath).list()).stream().filter(e -> e.contains("vmmsc") && e.endsWith(".zip")).collect(Collectors.toList());
+ assertTrue("Did not find vMMSCs", vmmscList.size() > 0);
+
+ Map<String, String> vspNames = new HashMap<String, String>();
+ for (String vnfFile : vmmscList){
+ getExtendTest().log(Status.INFO, String.format("going to onboard the VNF %s......", vnfFile));
+ System.out.println(String.format("going to onboard the VNF %s......", vnfFile));
+
+ OnboardingUtils.createVendorLicense(getUser());
+ Pair<String,Map<String,String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser());
+
+ getExtendTest().log(Status.INFO, String.format("searching for onboarded %s", vnfFile));
+ HomePage.showVspRepository();
+ getExtendTest().log(Status.INFO,String.format("going to import %s......", vnfFile.substring(0, vnfFile.indexOf("."))));
+ OnboardingUtils.importVSP(createVendorSoftwareProduct);
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile);
+
+ String vspName = createVendorSoftwareProduct.left;
+ DeploymentArtifactPage.clickSubmitForTestingButton(vspName);
+
+ vspNames.put(vnfFile, vspName);
+ }
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ for (String vsp : vspNames.values()){
+ GeneralUIUtils.findComponentAndClick(vsp);
+ TesterOperationPage.certifyComponent(vsp);
+ }
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
+
+ for (String vsp : vspNames.values()){
+ CompositionPage.searchForElement(vsp);
+ CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vsp);
+ assertNotNull(vfElement);
+ }
+ ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", vspNames.values().size(), getUser());
+ File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Info_" + getExtendTest().getModel().getName());
+ final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
+ SetupCDTest.getExtendTest().log(Status.INFO, "Three kinds of vMMSC are in canvas now." + getExtendTest().addScreenCaptureFromPath(absolutePath));
+
+ ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata.getName());
+
+ reloginWithNewRole(UserRoleEnum.GOVERNOR);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ GovernorOperationPage.approveSerivce(serviceMetadata.getName());
+
+ reloginWithNewRole(UserRoleEnum.OPS);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ OpsOperationPage.distributeService();
+ OpsOperationPage.displayMonitor();
+
+ List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
+ AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
+
+ OpsOperationPage.waitUntilArtifactsDistributed(0);
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java
new file mode 100644
index 0000000000..cb647aec6d
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java
@@ -0,0 +1,303 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertEquals;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.nio.charset.StandardCharsets;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.bouncycastle.util.encoders.Base64;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.clearspring.analytics.util.Pair;
+import com.google.gson.Gson;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.LoggerContext;
+import fj.data.Either;
+
+public class OnboardViaApis{
+
+
+ private static final String FULL_PATH = "C://tmp//CSARs//";
+
+ public static Object[][] provideData(Object[] fileNamesFromFolder, String filepath) {
+ Object[][] arObject = new Object[fileNamesFromFolder.length][];
+
+ int index = 0;
+ for (Object obj : fileNamesFromFolder) {
+ arObject[index++] = new Object[] { filepath, obj };
+ }
+ return arObject;
+ }
+
+ @DataProvider(name = "VNF_List" , parallel = false)
+ private static final Object[][] VnfList() throws Exception {
+ String filepath = FileHandling.getVnfRepositoryPath();
+
+ Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+ System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.length));
+ return provideData(fileNamesFromFolder, filepath);
+ }
+
+
+//-------------------------------------------------------------------------------------------------------
+ User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+ private static String vendorId;
+ private static String vendorLicenseName;
+ private static String vendorLicenseAgreementId;
+ private static String featureGroupId;
+ ResourceReqDetails resourceDetails;
+ Timestamp timestamp = new Timestamp(System.currentTimeMillis());
+
+
+ @BeforeMethod
+ public void before(){
+ LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
+ lc.getLogger("org.apache").setLevel(Level.OFF);
+ lc.getLogger("org.*").setLevel(Level.OFF);
+ lc.getLogger("org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest").setLevel(Level.OFF);
+ resourceDetails = ElementFactory.getDefaultResource();
+
+ }
+
+ @Test(dataProvider = "VNF_List")
+ public void onboardVNFTestViaApis(String filepath, String vnfFile) throws Exception, Throwable {
+ Service service = null;
+ String fullFileName = FULL_PATH + vnfFile + ".csar";
+ Timestamp timestamp = new Timestamp(System.currentTimeMillis());
+ System.err.println(timestamp + " Starting test with VNF: " + vnfFile);
+ service = runOnboardViaApisOnly(filepath, vnfFile);
+ timestamp = new Timestamp(System.currentTimeMillis());
+ System.err.println(timestamp + " Finished test with VNF: " + vnfFile);
+ timestamp = new Timestamp(System.currentTimeMillis());
+ System.err.println(timestamp + " Starting download service csar file: " + vnfFile);
+ File file = new File(fullFileName);
+ downloadToscaCsarToDirectory(service, file);
+ timestamp = new Timestamp(System.currentTimeMillis());
+ System.err.println(timestamp + " Finished download service csar file: " + vnfFile);
+ System.out.println("end");
+
+ }
+
+ public static void downloadToscaCsarToDirectory(Service service, File file) {
+ try {
+ Either<String,RestResponse> serviceToscaArtifactPayload = AtomicOperationUtils.getServiceToscaArtifactPayload(service, "assettoscacsar");
+ if(serviceToscaArtifactPayload.left().value() != null){
+ Gson gson = new Gson();
+ @SuppressWarnings("unchecked")
+ Map<String, String> fromJson = gson.fromJson(serviceToscaArtifactPayload.left().value(), 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();
+ }
+
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ public Service runOnboardViaApisOnly(String filepath, String vnfFile) throws Exception, AWTException {
+ Timestamp timestamp = new Timestamp(System.currentTimeMillis());
+ System.err.println(timestamp + " Starting onboard VNF: " + vnfFile);
+ Pair<String,Map<String,String>> onboardAndValidate = onboardAndValidateViaApi(filepath, vnfFile, sdncDesignerDetails1);
+ String vspName = onboardAndValidate.left;
+ timestamp = new Timestamp(System.currentTimeMillis());
+ System.err.println(timestamp + " Finished onboard VNF: " + vnfFile);
+ Resource resource = AtomicOperationUtils.getResourceObject(resourceDetails.getUniqueId());
+
+ AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
+ resource = AtomicOperationUtils.getResourceObject(resource.getUniqueId());
+ // create service
+
+ Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
+ Either<ComponentInstance,RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+ service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+ return service;
+ }
+
+
+
+ public Pair<String, Map<String, String>> onboardAndValidateViaApi(String filepath, String vnfFile, User user) throws Exception {
+
+ createVendorLicense(user);
+ Pair<String, Map<String, String>> createVendorSoftwareProduct = createVendorSoftwareProduct(vnfFile, filepath, user);
+ String vspName = createVendorSoftwareProduct.left;
+ List<String> tags = new ArrayList<>();
+ tags.add(vspName);
+ Map<String, String> map = createVendorSoftwareProduct.right;
+
+ resourceDetails.setCsarUUID(map.get("vspId"));
+ resourceDetails.setCsarVersion("1.0");
+ resourceDetails.setName(vspName);
+ resourceDetails.setTags(tags);
+ resourceDetails.setResourceType(map.get("componentType"));
+ resourceDetails.setVendorName(map.get("vendorName"));
+ resourceDetails.setVendorRelease("1.0");
+ resourceDetails.setResourceType("VF");
+ RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncDesignerDetails1);
+
+ return createVendorSoftwareProduct;
+ }
+
+ public static Pair<String, Map<String, String>> createVendorSoftwareProduct(String HeatFileName, String filepath, User user)
+ throws Exception {
+ Pair<String, Map<String, String>> pair = createVSP(HeatFileName, filepath, user);
+
+ String vspid = pair.right.get("vspId");
+
+ prepareVspForUse(user, vspid);
+
+ return pair;
+ }
+
+ public static void prepareVspForUse(User user, String vspid) throws Exception {
+ RestResponse checkin = OnboardingUtils.checkinVendorSoftwareProduct(vspid, user);
+ assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue());
+
+ RestResponse submit = OnboardingUtils.submitVendorSoftwareProduct(vspid, user);
+ assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue());
+
+ RestResponse createPackage = OnboardingUtils.createPackageOfVendorSoftwareProduct(vspid, user);
+ assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue());
+
+ }
+ public static void createVendorLicense(User user) throws Exception {
+ vendorLicenseName = "ciLicense" + UUID.randomUUID().toString().split("-")[0];
+ RestResponse vendorLicenseResponse = OnboardingUtils.createVendorLicenseModels_1(vendorLicenseName, user);
+ assertEquals("did not succeed to create vendor license model", 200,
+ vendorLicenseResponse.getErrorCode().intValue());
+ vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value");
+
+ 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());
+ featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value");
+
+ RestResponse vendorLicenseAgreement = OnboardingUtils.createVendorLicenseAgreement_5(vendorId, featureGroupId, user);
+ assertEquals("did not succeed to create vendor license agreement", 200,
+ vendorLicenseAgreement.getErrorCode().intValue());
+ vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(),
+ "value");
+
+ RestResponse checkinVendorLicense = OnboardingUtils.checkinVendorLicense(vendorId, user);
+ assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue());
+
+ RestResponse submitVendorLicense = OnboardingUtils.submitVendorLicense(vendorId, user);
+ assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue());
+
+ }
+
+
+ public static Pair<String, Map<String, String>> createVSP(String HeatFileName, String filepath, User user) throws Exception {
+ String vspName = OnboardingUtils.handleFilename(HeatFileName);
+
+ Pair<RestResponse, Map<String, String>> createNewVspPair = OnboardingUtils.createNewVendorSoftwareProduct(vspName, vendorLicenseName, vendorId, vendorLicenseAgreementId, featureGroupId, 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", vendorLicenseName);
+ vspObject.put("attContact", user.getUserId());
+
+ RestResponse uploadHeatPackage = OnboardingUtils.uploadHeatPackage(filepath, HeatFileName, vspid, user);
+ assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue());
+
+ RestResponse validateUpload = OnboardingUtils.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;
+ }
+
+
+
+
+
+
+
+
+
+// ----------------------------------------------------------------------------------------------------------------------------------------
+
+
+
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Product.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Product.java
new file mode 100644
index 0000000000..e0e13b7036
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Product.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.io.File;
+
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.ProductGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ProductUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * @author al714h
+ *
+ */
+
+public class Product extends SetupCDTest {
+
+ private String filePath;
+ @BeforeMethod
+ public void beforeTest(){
+ filePath = System.getProperty("filepath");
+
+ if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+ filePath = FileHandling.getResourcesFilesPath();
+ }
+
+ else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+ filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator;
+ }
+ }
+
+
+ @Test
+ public void createProductAndAddCertifiedServiceInstance() throws Exception {
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ProductReqDetails productReqDetails = ElementFactory.getDefaultProduct();
+
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ GeneralPageElements.clickSubmitForTestingButton(serviceMetadata.getName());
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata.getName());
+ reloginWithNewRole(UserRoleEnum.PRODUCT_MANAGER1);
+ ProductUIUtils.createProduct(productReqDetails, getUser());
+ ProductGeneralPage.getProductLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CanvasElement canvasElement = CompositionPage.addElementToCanvasScreen(serviceMetadata.getName(), canvasManager);
+ canvasManager.clickOnCanvaElement(canvasElement);
+ }
+
+ @Test
+ public void loginAsProductStrateger() throws Exception {
+ reloginWithNewRole(UserRoleEnum.PRODUCT_STRATEGIST1);
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java
new file mode 100644
index 0000000000..86e52a296d
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java
@@ -0,0 +1,698 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CompositionScreenEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ServiceMetadataEnum;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.InputsPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.ci.tests.verificator.DeploymentViewVerificator;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.AssertJUnit;
+import org.testng.SkipException;
+import org.testng.TestException;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+public class Service extends SetupCDTest {
+
+ private static final String DESCRIPTION = "kuku";
+ private static final String ARTIFACT_LABEL = "artifact3";
+ private static final String ARTIFACT_LABEL_UPDATE = "artifactUpdate";
+ private static final String GET_ARTIFACT_LIST_BY_CLASS_NAME = "i-sdc-designer-sidebar-section-content-item-artifact";
+ private static final String HEAT_FILE_YAML_NAME = "Heat-File.yaml";
+ private static final String HEAT_FILE_YAML_UPDATE_NAME = "Heat-File-Update.yaml";
+ private String filePath;
+
+ @BeforeMethod
+ public void beforeTest(){
+ filePath = FileHandling.getFilePath("");
+ }
+
+
+ @Test
+ public void createService() throws Exception {
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ }
+
+ @Test
+ public void validDefaultContactAndTagAfterCreateService() throws Exception{
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createServiceWithDefaultTagAndUserId(serviceMetadata, getUser());
+
+ assertTrue("wrong userId", getUser().getUserId().equals(ResourceGeneralPage.getContactIdText()));
+
+ List<String> actualTags = Arrays.asList(ServiceGeneralPage.getTags());
+ assertTrue("wrong tags", (actualTags.size() == 1) && actualTags.get(0).equals(serviceMetadata.getName()));
+ }
+
+ @Test
+ public void updateService() throws Exception {
+ // Create Service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ // Update Service
+ ServiceGeneralPage.deleteOldTags(serviceMetadata);
+ serviceMetadata.setName("ciUpdatedNameSanity");
+ serviceMetadata.setDescription("updatedDescriptionSanity");
+ serviceMetadata.setProjectCode("654321");
+ serviceMetadata.setContactId("cs6543");
+ serviceMetadata.getTags().addAll(Arrays.asList("updatedTag", "oneMoreUpdatedTag", "lastOne UpdatedTag"));
+ ServiceUIUtils.setServiceCategory(serviceMetadata, ServiceCategoriesEnum.VOIP);
+ ServiceUIUtils.fillServiceGeneralPage(serviceMetadata, getUser());
+ GeneralPageElements.clickCreateButton();
+
+ ServiceVerificator.verifyServiceUpdatedInUI(serviceMetadata);
+ }
+
+ @Test
+ public void deleteService() throws Exception {
+
+ // create service
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ // Delete service
+ //GeneralUIUtils.HighlightMyElement(GeneralUIUtils.getWebButton("delete_version"));
+ GeneralPageElements.clickTrashButtonAndConfirm();
+
+ // Verification
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ CatalogUIUtilitis.catalogSearchBox(serviceMetadata.getName());
+ ServiceVerificator.verifyServiceDeletedInUI(serviceMetadata);
+ }
+
+ @Test
+ public void checkoutServiceTest() throws Exception{
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,"OTHER");
+ CompositionPage.showDeploymentArtifactTab();
+ CompositionPage.clickAddArtifactButton();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+
+ ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ GeneralPageElements.clickCheckoutButton();
+
+ serviceMetadata.setVersion("0.2");
+ ServiceVerificator.verifyServiceLifecycle(serviceMetadata, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+ ServiceVerificator.verifyVersionUI(serviceMetadata.getVersion());
+
+ ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ ResourceGeneralPage.clickCheckoutButton();
+
+ serviceMetadata.setVersion("1.1");
+ serviceMetadata.setUniqueId(null);
+ ServiceVerificator.verifyServiceLifecycle(serviceMetadata, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+ ServiceVerificator.verifyVersionUI(serviceMetadata.getVersion());
+ }
+
+ @Test
+ public void submitServiceForTestingWithNonCertifiedAsset() throws Exception{
+
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.createResource(atomicResourceMetaData, getUser());
+ ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+
+ try{
+ CompositionPage.clickSubmitForTestingButton(serviceMetadata.getName());
+ assert(false);
+ }
+ catch(Exception e){
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
+ assertTrue(errorMessage.contains(checkUIResponseOnError));
+ }
+ finally{
+ ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
+ }
+
+ }
+
+ @Test
+ public void addDeploymentArtifactInCompositionScreenTest() throws Exception{
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,"OTHER");
+ CompositionPage.showDeploymentArtifactTab();
+ CompositionPage.clickAddArtifactButton();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+
+ List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+ AssertJUnit.assertEquals(1, actualArtifactList.size());
+
+ for(WebElement actualArtifactFileName : CompositionPage.getAllAddedArtifacts()){
+ assertTrue(HEAT_FILE_YAML_NAME.equals(actualArtifactFileName.getText()));
+ }
+
+ }
+
+ @Test
+ public void addInformationArtifactInCompositionScreenTest() throws Exception{
+ String fileName = HEAT_FILE_YAML_NAME;
+ String descriptionText = DESCRIPTION;
+
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ ArtifactInfo artifactInfo = new ArtifactInfo(filePath, fileName, descriptionText, ARTIFACT_LABEL,"OTHER");
+ CompositionPage.showInformationArtifactTab();
+ List<WebElement> beforeArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+ CompositionPage.clickAddArtifactButton();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(artifactInfo, CompositionPage.artifactPopup());
+
+ List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+ assertTrue(String.format("Wrong number of artifacts, Expected: %s Actual: %s", beforeArtifactList.size() + 1, actualArtifactList.size()),
+ (beforeArtifactList.size() + 1) == actualArtifactList.size());
+ for(DataTestIdEnum.InformationalArtifactsService artifact: DataTestIdEnum.InformationalArtifactsService.values()){
+ ArtifactUIUtils.fillPlaceHolderInformationalArtifact(artifact, filePath, fileName, descriptionText);
+ }
+ int numberOfFiles = CompositionPage.getAllAddedArtifacts().size();
+ assertTrue(String.format("Wrong number of artifacts, Expected: %s Actual: %s", (beforeArtifactList.size() + 1), numberOfFiles), (beforeArtifactList.size() + 1) == numberOfFiles);
+
+ for(WebElement actualArtifactFileName : CompositionPage.getAllAddedArtifacts()){
+ assertTrue(fileName.equals(actualArtifactFileName.getText()));
+ }
+
+ }
+
+ @Test
+ public void addAPIArtifactInCompositionScreenTest() throws Exception{
+
+ if(true){
+ throw new SkipException("Open bug 292017");
+ }
+
+ String fileName = HEAT_FILE_YAML_NAME,
+ descriptionText = DESCRIPTION,
+ url = "http://kuku.com";
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ ArtifactInfo artifactInfo = new ArtifactInfo(filePath, fileName, descriptionText, ARTIFACT_LABEL,"OTHER");
+ CompositionPage.showAPIArtifactTab();
+
+ for(DataTestIdEnum.APIArtifactsService artifact: DataTestIdEnum.APIArtifactsService.values()){
+ ArtifactUIUtils.fillPlaceHolderAPIArtifact(artifact, filePath, fileName, descriptionText, url);
+ }
+ int numberOfFiles = CompositionPage.getAllAddedArtifacts().size(),
+ numberOfPlacehoders = DataTestIdEnum.APIArtifactsService.values().length;
+ assertTrue(String.format("Wrong file count, should be %s files", numberOfPlacehoders), numberOfPlacehoders == numberOfFiles);
+
+ for(WebElement actualArtifactFileName : CompositionPage.getAllAddedArtifacts()){
+ assertTrue(fileName.equals(actualArtifactFileName.getText()));
+ }
+ }
+
+ @Test
+ public void ManagmentWorkflowTest() throws Exception{
+
+ if(true){
+ throw new SkipException("Open bug 287416");
+ }
+
+ String descriptionText = DESCRIPTION,
+ descriptionTextEdit = "kuku2";
+
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ServiceGeneralPage.getServiceLeftMenu().moveToManagmentWorkflow();
+ ServiceGeneralPage.fillAndAddNewWorkflow(descriptionText, descriptionText);
+ ServiceVerificator.verifyManagmentWorkflow(descriptionText, descriptionText);
+
+ ServiceGeneralPage.clickAddWorkflow();
+ ServiceGeneralPage.fillAndAddNewWorkflow(descriptionTextEdit, descriptionTextEdit);
+ }
+
+ @Test
+ public void deleteChangeVersionTest() throws Exception{
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,"OTHER");
+ CompositionPage.showDeploymentArtifactTab();
+ CompositionPage.clickAddArtifactButton();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+
+ ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ GeneralPageElements.clickCheckoutButton();
+
+ changeDeleteAndValidateVersionOnGeneralPage("0.1", "0.2", serviceMetadata.getName());
+
+ GeneralPageElements.clickCheckoutButton();
+ ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ ResourceGeneralPage.clickCheckoutButton();
+
+ changeDeleteAndValidateVersionOnGeneralPage("1.0", "1.1", serviceMetadata.getName());
+ }
+
+ @Test
+ public void compositionScreenRightSideButtonsTest() throws Exception{
+
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ CompositionPage.showInformationTab();
+ ServiceVerificator.verifyOpenTabTitle(CompositionScreenEnum.INFORMATION);
+
+ //feature removed from UI
+// CompositionPage.showCompositionTab();
+// ServiceVerificator.verifyOpenTabTitle(CompositionScreenEnum.COMPOSITION);
+
+ CompositionPage.showDeploymentArtifactTab();
+ ServiceVerificator.verifyOpenTabTitle(CompositionScreenEnum.DEPLOYMENT_ARTIFACT_TAB);
+
+ CompositionPage.showInputsTab();
+ assertTrue(CompositionPage.getOpenTabTitle().size() == 0);
+
+ CompositionPage.showAPIArtifactTab();
+ ServiceVerificator.verifyOpenTabTitle(CompositionScreenEnum.API);
+
+ CompositionPage.showInformationArtifactTab();
+ ServiceVerificator.verifyOpenTabTitle(CompositionScreenEnum.INFORMATION_ARTIFACTS);
+
+ }
+
+ @Test
+ public void addDeploymentArtifactToVFInstanceTest() throws Exception{
+
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType());
+
+ CanvasElement computeElement = createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact);
+ checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME);
+ checkInService(serviceMetadata);
+ clickOncanvasElement(computeElement);
+ CompositionPage.showDeploymentArtifactTab();
+ checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME);
+ }
+
+ @Test
+ public void deleteDeploymentArtifactFromVFInstanceTest() throws Exception{
+
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType());
+
+ CanvasElement computeElement = createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact);
+ checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME);
+ clickOncanvasElement(computeElement);
+ CompositionPage.showDeploymentArtifactTab();
+ List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+ deleteAndVerifyArtifact(actualArtifactList);
+
+ }
+
+ @Test
+ public void deleteDeploymentArtifactFromVFInstanceNextVersionTest() throws Exception{
+
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType());
+
+ CanvasElement computeElement = createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact);
+ checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME);
+ checkInService(serviceMetadata);
+ ResourceGeneralPage.clickCheckoutButton();
+ clickOncanvasElement(computeElement);
+ CompositionPage.showDeploymentArtifactTab();
+ List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+ deleteAndVerifyArtifact(actualArtifactList);
+// change container version
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue());
+ GeneralPageElements.selectVersion("V0.1");
+ clickOncanvasElement(computeElement);
+ CompositionPage.showDeploymentArtifactTab();
+ checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME);
+
+ }
+
+// service version V0.1 default artifact, service version V0.2 updated artifact
+ @Test
+ public void updateDeploymentArtifactOnVFInstanceNextVersionTest() throws Exception{
+
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType());
+ ArtifactInfo artifactUpdate = new ArtifactInfo(filePath, HEAT_FILE_YAML_UPDATE_NAME, DESCRIPTION, ARTIFACT_LABEL_UPDATE,ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType());
+
+ CanvasElement computeElement = createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact);
+ checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME);
+ checkInService(serviceMetadata);
+ ResourceGeneralPage.clickCheckoutButton();
+ clickOncanvasElement(computeElement);
+ CompositionPage.showDeploymentArtifactTab();
+ List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+ deleteAndVerifyArtifact(actualArtifactList);
+// upload new artifact
+ addDeploymentArtifact(artifactUpdate, CanvasManager.getCanvasManager(), computeElement);
+ checkArtifactIfAdded(1, HEAT_FILE_YAML_UPDATE_NAME);
+// change container version
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue());
+ GeneralPageElements.selectVersion("V0.1");
+ clickOncanvasElement(computeElement);
+ CompositionPage.showDeploymentArtifactTab();
+ checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME);
+
+ }
+
+ public void clickOncanvasElement(CanvasElement computeElement) {
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ canvasManager.clickOnCanvaElement(computeElement);
+ }
+
+ public void checkInService(ServiceReqDetails serviceMetadata) throws Exception {
+ ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ }
+
+ public static void deleteAndVerifyArtifact(List<WebElement> actualArtifactList) {
+ if (actualArtifactList.size()>0){
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ITEM.getValue() + ARTIFACT_LABEL);
+ SetupCDTest.getExtendTest().log(Status.INFO, "Going to delete " + HEAT_FILE_YAML_NAME + " artifact" + " and check if deleted");
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + ARTIFACT_LABEL);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+ assertTrue("Artifact does not deleted", !GeneralUIUtils.waitForElementInVisibilityByTestId(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME)));
+ }
+ }
+
+
+ public void checkArtifactIfAdded(Integer expectedNumOfARtifacts, String expectedArtifactName) {
+
+ List<WebElement> actualArtifactList;
+ actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+ assertTrue("Expected artifact count is: " + expectedNumOfARtifacts + ", but was " + actualArtifactList.size(),expectedNumOfARtifacts==actualArtifactList.size());
+
+ if(expectedNumOfARtifacts != 0){
+ for(WebElement actualArtifactFileName : CompositionPage.getAllAddedArtifacts()){
+ assertTrue("Artifact name does not match, expected " + expectedArtifactName + ", but was " + actualArtifactFileName.getText(), expectedArtifactName.equals(actualArtifactFileName.getText()));
+ }
+ }
+
+ }
+
+
+ public CanvasElement createServiceWithRiArtifact(ResourceReqDetails atomicResourceMetaData, ServiceReqDetails serviceMetadata, ArtifactInfo artifact) throws Exception, AWTException {
+ ResourceUIUtils.createResource(atomicResourceMetaData, getUser());
+ ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ CanvasElement computeElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+ addDeploymentArtifact(artifact, canvasManager, computeElement);
+
+ return computeElement;
+ }
+
+
+ public void addDeploymentArtifact(ArtifactInfo artifact, CanvasManager canvasManager, CanvasElement computeElement) throws Exception {
+ canvasManager.clickOnCanvaElement(computeElement);
+ CompositionPage.showDeploymentArtifactTab();
+ CompositionPage.clickAddArtifactButton();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+ }
+
+ @Test
+ public void isDisabledAndReadOnlyInCheckin() throws Exception{
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+ GeneralPageElements.clickCheckinButton(serviceMetadata.getName());
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+
+ ServiceMetadataEnum[] fieldsForCheck = {ServiceMetadataEnum.SERVICE_NAME,
+ ServiceMetadataEnum.CONTACT_ID,
+ ServiceMetadataEnum.DESCRIPTION,
+ ServiceMetadataEnum.PROJECT_CODE,
+ ServiceMetadataEnum.TAGS};
+ for (ServiceMetadataEnum field: fieldsForCheck){
+ assertTrue(GeneralUIUtils.isElementReadOnly(field.getValue()));
+ }
+
+ assertTrue(GeneralUIUtils.isElementDisabled(ServiceMetadataEnum.CATEGORY.getValue()));
+ assertTrue(GeneralUIUtils.isElementDisabled(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue()));
+ }
+
+ // future removed from ui
+ @Test(enabled = false)
+ public void inputsTest() throws Exception{
+ String fileName = "service_input_test_VF2.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+ GeneralPageElements.clickCheckinButton(resourceMetaData.getName());
+
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ String selectedInstanceName = addResourceToServiceInCanvas(resourceMetaData);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+ DeploymentArtifactPage.getLeftMenu().moveToInputsScreen();
+
+ InputsPage.addInputToService(selectedInstanceName, "volume_id");
+ InputsPage.deleteServiceInput(selectedInstanceName, "volume_id");
+
+ // Trying to find deleted service input
+ try{
+ InputsPage.getServiceInput(selectedInstanceName, "volume_id");
+ assert(false);
+ }
+ catch(TestException e){
+ }
+ }
+
+ @Test
+ public void deploymentViewServiceTest() throws Exception{
+
+ if(true){
+ throw new SkipException("Open bug 295220, 295180");
+ }
+
+ String fileName2 = "vSeGW.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser());
+ ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName());
+
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ addResourceToServiceInCanvas(resourceMetaData);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+ DeploymentArtifactPage.getLeftMenu().moveToDeploymentViewScreen();
+
+ serviceMetadata.setVersion("0.1");
+ List<WebElement> instanceRowsFromTable = GeneralUIUtils.getElementsByCSS("div[data-tests-id^='hierarchy-instance'] span[class^='expand-collapse-title-text']");
+ for(WebElement instanceRow: instanceRowsFromTable){
+ String instanceRowText = instanceRow.getText();
+ List<WebElement> instanceModulesList = DeploymentPage.getInstanceModulesList(instanceRowText);
+ for (WebElement instanceModule: instanceModulesList){
+ String instanceModuleText = instanceModule.getText();
+ ResourceUIUtils.clickOnElementByText(instanceModuleText, "instance");
+
+ ServiceVerificator.verifyDeploymentPageSubElements(instanceModuleText.split("\\.\\.")[1], new DeploymentViewVerificator(filePath + fileName2));
+
+ ServiceVerificator.verifyDisabledServiceProperties();
+ String isBaseValue = ServiceVerificator.getVFModulePropertieValue(serviceMetadata, "isBase", instanceModuleText);
+ if (isBaseValue.equals("false"))
+ ServiceVerificator.verifyEnabledServiceProperties();
+
+ ResourceUIUtils.clickOnElementByText(instanceModuleText, "instance");
+ }
+ }
+ }
+
+ @Test
+ public void vfModuleCustomizationUUIDServiceTest() throws Exception{
+ String fileName2 = "vSeGW.csar";
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser());
+ ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName());
+
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ addResourceToServiceInCanvas(resourceMetaData);
+
+ serviceMetadata.setVersion("0.1");
+ ServiceVerificator.verifyVFModuleCustomizationUUID(serviceMetadata);
+ }
+
+ @Test
+ public void checkoutCertifyRemainSameCustomizationUUIDServiceTest() throws Exception{
+ String fileName2 = "vSeGW.csar";
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser());
+ ResourceGeneralPage.clickSubmitForTestingButton(resourceMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(resourceMetaData.getName());
+ TesterOperationPage.certifyComponent(resourceMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+
+ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+ ServiceUIUtils.createService(serviceMetadata, getUser());
+
+ addResourceToServiceInCanvas(resourceMetaData);
+
+ serviceMetadata.setVersion("0.1");
+ ServiceVerificator.verifyVFModuleCustomizationUUID(serviceMetadata);
+ List<String> allVFModuleCustomizationUUIDs = ServiceVerificator.getAllVFModuleCustomizationUUIDs(serviceMetadata);
+
+ ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ GeneralPageElements.clickCheckoutButton();
+
+ serviceMetadata.setVersion("0.2");
+ assertTrue(ServiceVerificator.isEqualCustomizationUUIDsAfterChanges(allVFModuleCustomizationUUIDs, ServiceVerificator.getAllVFModuleCustomizationUUIDs(serviceMetadata)));
+
+ ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ TesterOperationPage.certifyComponent(serviceMetadata.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+ ResourceGeneralPage.clickCheckoutButton();
+
+ serviceMetadata.setVersion("1.1");
+ serviceMetadata.setUniqueId(null);
+ assertTrue(ServiceVerificator.isEqualCustomizationUUIDsAfterChanges(allVFModuleCustomizationUUIDs, ServiceVerificator.getAllVFModuleCustomizationUUIDs(serviceMetadata)));
+ }
+
+
+ public synchronized String addResourceToServiceInCanvas(ResourceReqDetails resourceMetaData) throws Exception {
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(resourceMetaData.getName());
+ CanvasElement computeElement = canvasManager.createElementOnCanvas(resourceMetaData.getName());
+ canvasManager.clickOnCanvaElement(computeElement);
+ String selectedInstanceName = CompositionPage.getSelectedInstanceName();
+ return selectedInstanceName;
+ }
+
+ public static void changeDeleteAndValidateVersionOnGeneralPage(String previousVersion, String currentVersion, String serviceName) throws Exception{
+ GeneralPageElements.selectVersion("V" + previousVersion);
+ ServiceVerificator.verifyVersionUI(previousVersion);
+ GeneralUIUtils.clickJSOnElementByText("latest version");
+ ServiceVerificator.verifyVersionUI(currentVersion);
+ GeneralPageElements.clickTrashButtonAndConfirm();
+ GeneralUIUtils.findComponentAndClick(serviceName);
+ ServiceVerificator.verifyVersionUI(previousVersion);
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java
new file mode 100644
index 0000000000..2c7dc9868d
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java
@@ -0,0 +1,402 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar;
+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.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.utilities.DownloadManager;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.VFCArtifactVerificator;
+import org.testng.SkipException;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+public class VFCArtifacts extends SetupCDTest {
+
+ private static final String DEPLOYMENT = "Deployment";
+ private static final String INFORMATIONAL = "Informational";
+ private static final String ARTIFACTS = "artifacts";
+ private static final String DEPLOYMENT_ARTIFACTS = "deploymentArtifacts";
+ private String filePath;
+ private Object object;
+ @BeforeClass
+ public void beforeClass(){
+ filePath = System.getProperty("filepath");
+ if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+ filePath = FileHandling.getResourcesFilesPath() + "VFCArtifacts"+ File.separator;
+ }
+ else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+ filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator + "VFCArtifacts"+ File.separator;
+ }
+ }
+
+ @Test
+ public void ImportMultiVFCTest_TC1407998() throws Exception{
+
+ String csarFile = "Import_Multi_VFC.csar";
+
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ resourceMetaData.setVersion("0.1");
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser());
+
+ RestResponse getResponse = RestCDUtils.getResource(resourceMetaData, getUser());
+ assertTrue(getResponse.getErrorCode().intValue() == 200);
+
+ Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap = verifyVfcArtifacts(filePath, csarFile, resourceMetaData, getResponse);
+
+ VFCArtifactVerificator.verifyVFCArtifactsNotInVFArtifactList(resourceMetaData, getUser(), getResponse, expectedArtifactMap);
+
+
+ }
+
+ @Test
+ public void updateCsarWithVFCArtifacts_ModifyArtifacts_TC1449482() throws Exception{
+
+ String csarFile = "LDSA-ORIG.csar";
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ resourceMetaData.setVersion("0.1");
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser());
+
+ Map<String, Object> artifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(filePath + csarFile);
+ List<String> vfcKeys = artifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList());
+ for (String key : vfcKeys){
+ VFCArtifactVerificator.setActualVfcArtifactList(key, resourceMetaData, getUser());
+ }
+
+ String updatedCsarFile = "LDSA-MODIFY.csar";
+ ResourceUIUtils.updateVfWithCsar(filePath, updatedCsarFile);
+
+ Map<String, Object> updatedArtifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(filePath + updatedCsarFile);
+ List<String> updatedVfcKeys = updatedArtifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList());
+ for (String key : updatedVfcKeys){
+ verifyVfcInstanceArtifacts(resourceMetaData, null, updatedArtifactsFromCsar, key);
+ VFCArtifactVerificator.verifyVfcArtifactUpdated(key, resourceMetaData, getUser());
+ }
+ }
+
+ @Test
+ public void updateCsarWithVFCArtifacts_DeleteAndAddArtifacts_TC1449473() throws Exception{
+ String csarFile = "LDSA-ORIG.csar";
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ resourceMetaData.setVersion("0.1");
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser());
+
+ String updatedCsarFile = "LDSA-DELETE-ADD.csar";
+ ResourceUIUtils.updateVfWithCsar(filePath, updatedCsarFile);
+
+ verifyVfcArtifacts(filePath, updatedCsarFile, resourceMetaData, null);
+ }
+
+ @Test
+ public void updateCsarWithVFCArtifacts_AddFirstVFCIdentifier_TC1425896() throws Exception{
+
+ String csarFile = "LDSA-ORIG-OLD_STRUCTURE.csar";
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ resourceMetaData.setVersion("0.1");
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser());
+
+ VFCArtifactVerificator.verifyNoVfcArtifacts(resourceMetaData, getUser(), null);
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ String[] artifactNamesFromFile = ArtifactFromCsar.getArtifactNamesFromCsar(filePath, csarFile);
+ String[] artifactsFromFileBeforeUpdate = DeploymentArtifactPage.verifyArtifactsExistInTable(artifactNamesFromFile);
+ DeploymentArtifactPage.getLeftMenu().moveToGeneralScreen();
+
+ String updatedCsarFile = "LDSA-ADD.csar";
+ ResourceUIUtils.updateVfWithCsar(filePath, updatedCsarFile);
+
+ verifyVfcArtifacts(filePath, updatedCsarFile, resourceMetaData, null);
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ DeploymentArtifactPage.verifyArtifactsExistInTable(artifactsFromFileBeforeUpdate);
+ }
+
+
+ @Test
+ public void updateCsarWithVFCArtifacts_AddAdditionalVFCIdentifier_TC1425898() throws Exception{
+
+ String csarFile = "LDSA-SINGLE.csar";
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ resourceMetaData.setVersion("0.1");
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser());
+
+ Map<String, Object> artifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(filePath + csarFile);
+ List<String> vfcKeys = artifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList());
+ for (String key : vfcKeys){
+ VFCArtifactVerificator.setActualVfcArtifactList(key, resourceMetaData, getUser());
+ }
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ String[] artifactNamesFromFile = ArtifactFromCsar.getArtifactNamesFromCsar(filePath, csarFile);
+ String[] artifactsFromFileBeforeUpdate = DeploymentArtifactPage.verifyArtifactsExistInTable(artifactNamesFromFile);
+ DeploymentArtifactPage.getLeftMenu().moveToGeneralScreen();
+
+ String updatedCsarFile = "LDSA-MULTI.csar";
+ ResourceUIUtils.updateVfWithCsar(filePath, updatedCsarFile);
+
+ Map<String, Object> updatedArtifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(filePath + updatedCsarFile);
+ List<String> updatedVfcKeys = updatedArtifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList());
+ for (String key : updatedVfcKeys){
+ verifyVfcInstanceArtifacts(resourceMetaData, null, updatedArtifactsFromCsar, key);
+ if (vfcKeys.contains(key)){
+ VFCArtifactVerificator.verifyVFCArtifactNotChanged(key, resourceMetaData, getUser());
+ }
+ }
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ DeploymentArtifactPage.verifyArtifactsExistInTable(artifactsFromFileBeforeUpdate);
+ }
+
+ @Test
+ public void updateCsarWithVFCArtifacts_DeleteAll_TC1425581() throws Exception{
+ String csarFile = "LDSA-ORIG.csar";
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+ resourceMetaData.setVersion("0.1");
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ String[] artifactNamesFromFile = ArtifactFromCsar.getArtifactNamesFromCsar(filePath, csarFile);
+ String[] artifactsFromFileBeforeUpdate = DeploymentArtifactPage.verifyArtifactsExistInTable(artifactNamesFromFile);
+ DeploymentArtifactPage.getLeftMenu().moveToGeneralScreen();
+
+ String updatedCsarFile = "LDSA-DELETE-ALL.csar";
+ ResourceUIUtils.updateVfWithCsar(filePath, updatedCsarFile);
+
+ VFCArtifactVerificator.verifyNoVfcArtifacts(resourceMetaData, getUser(), null);
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ DeploymentArtifactPage.verifyArtifactsExistInTable(artifactsFromFileBeforeUpdate);
+ }
+
+ @Test
+ public void importComplexVFCArtifacts_Onboarding_TC1484153() throws Exception{
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ String vnfFile = "vProbes_FE.zip";
+ String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip";
+
+ OnboardingUtils.createVendorLicense(getUser());
+ Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser());
+ String vspName = createVSP.left;
+ resourceMetaData.setName(vspName);
+ Map<String, String> resourceMeta = createVSP.right;
+ String vspid = resourceMeta.get("vspId");
+ OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser());
+ OnboardingUtils.prepareVspForUse(getUser(), vspid);
+
+ String downloadDirectory = getWindowTest().getDownloadDirectory();
+ String csarFile = vspid + ".csar";
+
+ DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
+ HomePage.showVspRepository();
+ OnboardingUtils.importVSP(createVSP);
+ resourceMetaData.setVersion("0.1");
+
+ verifyVfcArtifacts(downloadDirectory, csarFile, resourceMetaData, null);
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ DeploymentArtifactPage.verifyArtifactsExistInTable(filePath, vnfFile);
+
+ }
+
+ @Test
+ public void updateComplexVFCArtifacts_AddRemove_Onboarding_TC1484185() throws Exception{
+
+ //check of version is 1
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ String vnfFile = "vProbes_FE.zip";
+ String snmpPollFile = "vprobes-vLB.zip";
+ String updatedSnmpPollFile = "vprobes-vLBAgent.zip";
+
+ OnboardingUtils.createVendorLicense(getUser());
+ Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser());
+ String vspName = createVSP.left;
+ resourceMetaData.setName(vspName);
+ Map<String, String> resourceMeta = createVSP.right;
+ String vspid = resourceMeta.get("vspId");
+ String montoringComponentId = OnboardingUtils.addVFCArtifacts(filePath, snmpPollFile, null, vspid, getUser());
+ OnboardingUtils.prepareVspForUse(getUser(), vspid);
+
+ String downloadDirectory = getWindowTest().getDownloadDirectory();
+ String csarFile = vspid + ".csar";
+
+ DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
+ HomePage.showVspRepository();
+ OnboardingUtils.importVSP(createVSP);
+
+ ResourceGeneralPage.clickSubmitForTestingButton(vspName);
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vspName);
+ TesterOperationPage.certifyComponent(vspName);
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpPollFile, null, montoringComponentId, getUser());
+ DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
+ HomePage.showVspRepository();
+ OnboardingUtils.updateVSP(createVSP);
+ resourceMetaData.setVersion("1.1");
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ DeploymentArtifactPage.verifyArtifactsExistInTable(filePath, vnfFile);
+
+ verifyVfcArtifacts(downloadDirectory, csarFile, resourceMetaData, null);
+
+ }
+
+ @Test
+ public void updateComplexVFCArtifacts_Modify_Onboarding_TC1484195() throws Exception{
+
+ //check of version is 2
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ String vnfFile = "vProbes_FE.zip";
+ String snmpFile = "vprobes-vLB.zip";
+ String updatedSnmpFile = "vprobes-vLB-Modified.zip";
+
+ OnboardingUtils.createVendorLicense(getUser());
+ Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser());
+ String vspName = createVSP.left;
+ resourceMetaData.setName(vspName);
+ Map<String, String> resourceMeta = createVSP.right;
+ String vspid = resourceMeta.get("vspId");
+ String monitoringId = OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser());
+ OnboardingUtils.prepareVspForUse(getUser(), vspid);
+
+ String downloadDirectory = getWindowTest().getDownloadDirectory();
+ String csarFile = vspid + ".csar";
+
+ DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
+ HomePage.showVspRepository();
+ OnboardingUtils.importVSP(createVSP);
+
+ Map<String, Object> artifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(downloadDirectory + csarFile);
+ List<String> vfcKeys = artifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList());
+ for (String key : vfcKeys){
+ resourceMetaData.setVersion("0.1");
+ VFCArtifactVerificator.setActualVfcArtifactList(key, resourceMetaData, getUser());
+ }
+
+ ResourceGeneralPage.clickSubmitForTestingButton(vspName);
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vspName);
+ TesterOperationPage.certifyComponent(vspName);
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpFile, null, monitoringId, getUser());
+ DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
+ HomePage.showVspRepository();
+ OnboardingUtils.updateVSP(createVSP);
+ resourceMetaData.setVersion("1.1");
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ DeploymentArtifactPage.verifyArtifactsExistInTable(filePath, vnfFile);
+
+ Map<String, Object> artifactsFromCsarAfterUpdate = ArtifactFromCsar.getVFCArtifacts(downloadDirectory + csarFile);
+ List<String> vfcKeysAfterUpdate = artifactsFromCsarAfterUpdate.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList());
+ for (String key : vfcKeysAfterUpdate){
+ verifyVfcInstanceArtifacts(resourceMetaData, null, artifactsFromCsarAfterUpdate, key);
+ VFCArtifactVerificator.verifyVfcArtifactUpdated(key, resourceMetaData, getUser());
+ }
+
+ }
+
+
+
+
+
+
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+ private Map<String, LinkedList<HeatMetaFirstLevelDefinition>> verifyVfcArtifacts(String filepath, String csarFile,
+ ResourceReqDetails resourceMetaData, RestResponse getResponse) throws Exception {
+ ExtentTestActions.log(Status.INFO, "Verifying VFC artifacts");
+ Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap = null;
+ ExtentTestActions.log(Status.INFO, "Reading artifacts in CSAR file");
+ Map<String, Object> artifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(filepath + csarFile);
+ List<String> vfcKeys = artifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList());
+ for (String key : vfcKeys){
+ expectedArtifactMap = verifyVfcInstanceArtifacts(resourceMetaData, getResponse, artifactsFromCsar, key);
+ }
+ return expectedArtifactMap;
+ }
+
+ private Map<String, LinkedList<HeatMetaFirstLevelDefinition>> verifyVfcInstanceArtifacts(
+ ResourceReqDetails resourceMetaData, RestResponse getResponse, Map<String, Object> artifactsFromCsar, String key) {
+
+ Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap;
+ Map<String,LinkedList<HeatMetaFirstLevelDefinition>> vfcDeploymentArtifacts = (Map<String,LinkedList<HeatMetaFirstLevelDefinition>>)artifactsFromCsar.get(key);
+ LinkedList<HeatMetaFirstLevelDefinition> deploymentList = vfcDeploymentArtifacts.get(DEPLOYMENT);
+ LinkedList<HeatMetaFirstLevelDefinition> informationalList = (LinkedList<HeatMetaFirstLevelDefinition>) artifactsFromCsar.get(INFORMATIONAL);
+
+ expectedArtifactMap = new HashMap<String, LinkedList<HeatMetaFirstLevelDefinition>>();
+ if(deploymentList == null){
+ expectedArtifactMap.put(DEPLOYMENT_ARTIFACTS, new LinkedList<HeatMetaFirstLevelDefinition>());
+ }else{
+ expectedArtifactMap.put(DEPLOYMENT_ARTIFACTS, deploymentList);
+ }
+ if(informationalList == null){
+ expectedArtifactMap.put(ARTIFACTS, new LinkedList<HeatMetaFirstLevelDefinition>());
+ }else{
+ expectedArtifactMap.put(ARTIFACTS, informationalList);
+ }
+
+
+ VFCArtifactVerificator.verifyVfcArtifacts(resourceMetaData, getUser(), key, expectedArtifactMap, getResponse);
+ return expectedArtifactMap;
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
new file mode 100644
index 0000000000..078bc69001
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
@@ -0,0 +1,687 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ResourceMetadataEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.AttFtpClient;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.InputsPage;
+import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openecomp.sdc.ci.tests.verificator.VfModuleVerificator;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.AssertJUnit;
+import org.testng.SkipException;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+
+public class Vf extends SetupCDTest {
+
+ private String filePath;
+ @BeforeClass
+ public void beforeClass(){
+ filePath = System.getProperty("filepath");
+ if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+ filePath = FileHandling.getResourcesFilesPath();
+ }
+ else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+ filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator;
+ }
+ }
+
+ @BeforeMethod
+ public void beforeTest(){
+ System.out.println("File repository is : " + filePath);
+ getExtendTest().log(Status.INFO, "File repository is : " + filePath);
+ }
+
+
+ @Test
+ public void updateVF() throws Exception {
+
+ // create Resource
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(resourceMetaData, getUser());
+
+ // update Resource
+ ResourceReqDetails updatedResource = new ResourceReqDetails();
+ updatedResource.setName("ciUpdatedName");
+ updatedResource.setDescription("kuku");
+ updatedResource.setVendorName("updatedVendor");
+ updatedResource.setVendorRelease("updatedRelease");
+ updatedResource.setContactId("ab0001");
+ updatedResource.setCategories(resourceMetaData.getCategories());
+ updatedResource.setVersion("0.1");
+ updatedResource.setResourceType(ResourceTypeEnum.VF.getValue());
+ List<String> newTags = resourceMetaData.getTags();
+ newTags.remove(resourceMetaData.getName());
+ newTags.add(updatedResource.getName());
+ updatedResource.setTags(newTags);
+ ResourceUIUtils.updateResource(updatedResource, getUser());
+
+ VfVerificator.verifyVFMetadataInUI(updatedResource);
+ VfVerificator.verifyVFUpdated(updatedResource, getUser());
+ }
+
+ @Test
+ public void vfcLinkedToComputeInVfFlow() throws Exception {
+ String fileName = "vFW_VFC2.yml";
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+
+ try{
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+ TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(String.format("%s %s", LeftPanelCanvasItems.COMPUTE.getValue() , "1.0"));
+ CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ CanvasElement cpElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+ AssertJUnit.assertNotNull(cpElement);
+ ServiceVerificator.verifyNumOfComponentInstances(vfMetaData, "0.1", 2, getUser());
+ canvasManager.linkElements(cpElement, computeElement);
+
+ vfMetaData.setVersion("0.1");
+ VfVerificator.verifyLinkCreated(vfMetaData, getUser(), 1);
+ }
+ finally{
+ ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
+ }
+
+ }
+
+ @Test
+ public void addUpdateDeleteDeploymentArtifactToVfTest() throws Exception {
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+ deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML"));
+ for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
+ }
+ AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+
+ String newDescription = "new description";
+ DeploymentArtifactPage.clickEditArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+ DeploymentArtifactPage.artifactPopup().insertDescription(newDescription);
+ DeploymentArtifactPage.artifactPopup().clickDoneButton();
+ String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel());
+ AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+
+ DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+ DeploymentArtifactPage.clickOK();
+ AssertJUnit.assertTrue("artifact "+ deploymentArtifactList.get(0).getArtifactLabel() + "is not deleted", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size() - 1));
+
+ AssertJUnit.assertTrue("artifact "+ deploymentArtifactList.get(1).getArtifactLabel() + "is not displayed", DeploymentArtifactPage.clickOnArtifactDescription(deploymentArtifactList.get(1).getArtifactLabel()).isDisplayed());
+ }
+
+
+ @Test
+ public void addUpdateDeleteInformationalArtifact() throws Exception {
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+ InformationalArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
+
+ AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", InformationalArtifactPage.checkElementsCountInTable(1));
+
+ String newDescription = "new description";
+ InformationalArtifactPage.clickEditArtifact(informationalArtifact.getArtifactLabel());
+ InformationalArtifactPage.artifactPopup().insertDescription(newDescription);
+ InformationalArtifactPage.artifactPopup().clickDoneButton();
+ String actualArtifactDescription = InformationalArtifactPage.getArtifactDescription(informationalArtifact.getArtifactLabel());
+ AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+
+ InformationalArtifactPage.clickDeleteArtifact(informationalArtifact.getArtifactLabel());
+ InformationalArtifactPage.clickOK();
+ AssertJUnit.assertTrue("artifact "+ informationalArtifact.getArtifactLabel() + "is not deleted", InformationalArtifactPage.checkElementsCountInTable(0));
+ }
+
+
+ @Test
+ public void addPropertiesToVfcInstanceInVfTest() throws Exception {
+
+ if(true){
+ throw new SkipException("Open bug 292047");
+ }
+
+ String fileName = "vFW_VFC.yml";
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+
+ try{
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
+
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ CanvasElement vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+
+ vfCanvasManager.clickOnCanvaElement(vfcElement);
+ CompositionPage.showPropertiesAndAttributesTab();
+ List<WebElement> properties = CompositionPage.getProperties();
+ String propertyValue = "abc123";
+ for (int i = 0; i < 2; i++) {
+ WebElement findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label"));
+ findElement.click();
+ PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(propertyValue);
+ PropertiesPage.getPropertyPopup().clickSave();
+
+
+ findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-value"));
+ AssertJUnit.assertTrue(findElement.getText().equals(propertyValue));
+ }
+ }
+ finally{
+ ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
+ }
+ }
+
+ @Test
+ public void changeInstanceVersionTest() throws Exception{
+
+ if(true){
+ throw new SkipException("Open bug 291567");
+ }
+
+ ResourceReqDetails atomicResourceMetaData = null;
+ ResourceReqDetails vfMetaData = null;
+ CanvasManager vfCanvasManager;
+ CanvasElement vfcElement = null;
+ String fileName = "vFW_VFC3.yml";
+ try{
+ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+
+ vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+
+
+ CompositionPage.clickSubmitForTestingButton(vfMetaData.getName());
+ assert(false);
+ }
+ catch(Exception e){
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
+ AssertJUnit.assertTrue(errorMessage.contains(checkUIResponseOnError));
+
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+ TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ vfCanvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.changeComponentVersion(vfCanvasManager, vfcElement, "1.0");
+
+ //verfication
+ VfVerificator.verifyInstanceVersion(vfMetaData, getUser(), atomicResourceMetaData.getName(), "1.0");
+ }
+
+ finally{
+ ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
+ }
+
+ }
+
+ // future removed from ui
+ @Test(enabled = false)
+ public void addUpdateDeleteSimplePropertiesToVfTest() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen();
+ List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
+ int propertiesCount = PropertiesPage.getElemenetsFromTable().size();
+ for (PropertyTypeEnum prop : propertyList){
+ PropertiesUIUtils.addNewProperty(prop);
+ }
+ AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable()));
+ VfVerificator.verifyPropertiesInUI(propertyList);
+ PropertiesPage.verifyTotalProperitesField(propertiesCount + propertyList.size());
+
+
+ PropertyTypeEnum prop = propertyList.get(0);
+ prop.setDescription("updatedDescription");
+ prop.setValue("value");
+ PropertiesUIUtils.updateProperty(prop);
+
+ PropertiesPage.clickDeletePropertyArtifact(prop.getName());
+ AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size() - 1, () -> PropertiesPage.getElemenetsFromTable()));
+ }
+
+ // future removed from ui
+ @Test(enabled = false)
+ public void vfcInstancesInputScreenTest() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+
+ Map<String, String> elementsIntancesMap = new HashMap<String, String>();
+ for (LeftPanelCanvasItems element : Arrays.asList(LeftPanelCanvasItems.DATABASE, LeftPanelCanvasItems.BLOCK_STORAGE)){
+ CanvasElement elementOnCanvas = vfCanvasManager.createElementOnCanvas(element);
+ vfCanvasManager.clickOnCanvaElement(elementOnCanvas);
+ String selectedInstanceName = CompositionPage.getSelectedInstanceName();
+ elementsIntancesMap.put(selectedInstanceName, element.getValue());
+ }
+
+ CompositionPage.moveToInputsScreen();
+ int canvasElementsSize = vfCanvasManager.getCanvasElements().size();
+ AssertJUnit.assertTrue("Instances count is not as expected: " + canvasElementsSize, InputsPage.checkElementsCountInTable(canvasElementsSize));
+
+ for (String element : elementsIntancesMap.keySet()){
+ String resourceName = elementsIntancesMap.get(element);
+ ResourceReqDetails resource = new ResourceReqDetails();
+ resource.setName(resourceName);
+ resource.setVersion("1.0");
+ resource.setResourceType(ResourceTypeEnum.VFC.toString());
+ RestResponse restResponse = RestCDUtils.getResource(resource, getUser());
+ Map<String, String> propertiesNameTypeJson = ResponseParser.getPropertiesNameType(restResponse);
+
+ List<WebElement> propertyRowsFromTable = InputsPage.getInstancePropertiesList(element);
+ AssertJUnit.assertTrue("Some properties are missing in table. Instance name is : " + element, propertyRowsFromTable.size() == propertiesNameTypeJson.size());
+ VfVerificator.verifyVfInputs(element, propertiesNameTypeJson, propertyRowsFromTable);
+
+ GeneralUIUtils.clickOnElementByText(element);
+ }
+
+ }
+
+
+ @Test
+ public void addAllInformationalArtifactPlaceholdersInVfTest() throws Exception{
+
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+
+ for(InformationalArtifactsPlaceholders informArtifact : InformationalArtifactsPlaceholders.values()){
+ ArtifactUIUtils.fillPlaceHolderInformationalArtifact(informArtifact, filePath,"asc_heat 0 2.yaml", informArtifact.getValue());
+ }
+
+ AssertJUnit.assertTrue(InformationalArtifactPage.checkElementsCountInTable(InformationalArtifactsPlaceholders.values().length));
+ }
+
+ @Test
+ public void verifyToscaArtifactsExist() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ final int numOfToscaArtifacts = 2;
+ ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+ AssertJUnit.assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts));
+
+ for(int i = 0; i < numOfToscaArtifacts; i++){
+ String typeFromScreen = ToscaArtifactsPage.getArtifactType(i);
+ AssertJUnit.assertTrue(typeFromScreen.equals(ArtifactTypeEnum.TOSCA_CSAR.getType()) || typeFromScreen.equals(ArtifactTypeEnum.TOSCA_TEMPLATE.getType()));
+ }
+
+ ToscaArtifactsPage.clickSubmitForTestingButton(vfMetaData.getName());
+ VfVerificator.verifyToscaArtifactsInfo(vfMetaData, getUser());
+ }
+
+ @Test(enabled=false)
+ public void testDownload() throws Exception{
+// ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+// ResourceUIUtils.createResource(vfMetaData, getUser());
+//
+// final int numOfToscaArtifacts = 2;
+// ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+// assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts));
+// GeneralUIUtils.clickOnElementByTestId("download-Tosca Model");
+// System.out.println("download me");
+
+ AttFtpClient attFtpClient = AttFtpClient.getInstance();
+
+ File retrieveLastModifiedFileFromFTP = attFtpClient.retrieveLastModifiedFileFromFTP();
+ attFtpClient.deleteFilesFromFTPserver();
+ }
+
+ @Test
+ public void vfCertificationTest() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ String vfName = vfMetaData.getName();
+
+ ResourceGeneralPage.clickCheckinButton(vfName);
+ GeneralUIUtils.findComponentAndClick(vfName);
+ ResourceGeneralPage.clickSubmitForTestingButton(vfName);
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vfName);
+ TesterOperationPage.certifyComponent(vfName);
+
+ vfMetaData.setVersion("1.0");
+ VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.CERTIFIED);
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(vfName);
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CERTIFIED);
+ }
+
+ @Test
+ public void deleteVfCheckedoutTest() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ GeneralPageElements.clickTrashButtonAndConfirm();
+
+ vfMetaData.setVersion("0.1");
+ VfVerificator.verifyVfDeleted(vfMetaData, getUser());
+ }
+
+ @Test
+ public void revertVfMetadataTest() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceReqDetails vfRevertDetails = new ResourceReqDetails();
+ vfRevertDetails.setName("ciUpdatedName");
+ vfRevertDetails.setDescription("kuku");
+ vfRevertDetails.setCategories(vfMetaData.getCategories());
+ vfRevertDetails.setVendorName("updatedVendor");
+ vfRevertDetails.setVendorRelease("updatedRelease");
+ ResourceUIUtils.fillResourceGeneralInformationPage(vfRevertDetails, getUser(), false);
+
+ GeneralPageElements.clickRevertButton();
+
+ VfVerificator.verifyVFMetadataInUI(vfMetaData);
+
+ }
+
+ @Test
+ public void addDeploymentArtifactInCompositionScreenTest() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ ArtifactInfo artifact = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3","OTHER");
+ CompositionPage.showDeploymentArtifactTab();
+ CompositionPage.clickAddArtifactButton();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+
+ List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className("i-sdc-designer-sidebar-section-content-item-artifact"));
+ AssertJUnit.assertEquals(1, actualArtifactList.size());
+ }
+
+ // future removed from ui
+ @Test(enabled = false)
+ public void addPropertyInCompositionScreenTest() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ CompositionPage.showPropertiesAndAttributesTab();
+ List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
+ int propertiesCount = CompositionPage.getProperties().size();
+ for (PropertyTypeEnum prop : propertyList){
+ PropertiesUIUtils.addNewProperty(prop);
+ }
+ AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> CompositionPage.getProperties()));
+ }
+
+ @Test
+ public void addDeploymentArtifactAndVerifyInCompositionScreen() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+ ArtifactInfo deploymentArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+ DeploymentArtifactPage.clickAddNewArtifact();
+ ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
+ AssertJUnit.assertTrue(DeploymentArtifactPage.checkElementsCountInTable(1));
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ CompositionPage.showDeploymentArtifactTab();
+ List<WebElement> deploymentArtifactsFromScreen = CompositionPage.getDeploymentArtifacts();
+ AssertJUnit.assertTrue(1 == deploymentArtifactsFromScreen.size());
+
+ String actualArtifactFileName = deploymentArtifactsFromScreen.get(0).getText();
+ AssertJUnit.assertTrue("asc_heat-0-2.yaml".equals(actualArtifactFileName));
+ }
+
+ @Test
+ public void checkoutVfTest() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ GeneralPageElements.clickCheckoutButton();
+
+ vfMetaData.setVersion("0.2");
+ VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+
+ ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.TESTER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ TesterOperationPage.certifyComponent(vfMetaData.getName());
+
+ reloginWithNewRole(UserRoleEnum.DESIGNER);
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+ ResourceGeneralPage.clickCheckoutButton();
+
+ vfMetaData.setVersion("1.1");
+ vfMetaData.setUniqueId(null);
+ VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+ VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+ }
+
+ @Test
+ public void deleteInstanceFromVfCanvas() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+ CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
+ CanvasElement portElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.PORT);
+
+ vfCanvasManager.clickOnCanvaElement(computeElement);
+ vfCanvasManager.deleteElementFromCanvas(computeElement);
+
+ VfVerificator.verifyNumOfComponentInstances(vfMetaData, 1, getUser());
+ }
+
+ @Test
+ public void changeInstanceNameInVfTest() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+ CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
+
+ String updatedInstanceName = "updatedName";
+ vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName);
+
+ String actualSelectedInstanceName = CompositionPage.getSelectedInstanceName();
+ AssertJUnit.assertTrue(updatedInstanceName.equals(actualSelectedInstanceName));
+ }
+
+
+ @Test
+ public void submitVfForTestingWithNonCertifiedAsset() throws Exception{
+ String fileName = "vFW_VFC4.yml";
+
+ ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+ ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+ ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+ DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+ CanvasManager canvasManager = CanvasManager.getCanvasManager();
+ CompositionPage.searchForElement(atomicResourceMetaData.getName());
+ canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+
+ try{
+ CompositionPage.clickSubmitForTestingButton(vfMetaData.getName());
+ assert(false);
+ }
+ catch(Exception e){
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
+ AssertJUnit.assertTrue(errorMessage.contains(checkUIResponseOnError));
+ }
+ finally{
+ ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
+ }
+ }
+
+ @Test
+ public void isDisabledAndReadOnlyInCheckin() throws Exception{
+ ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.createResource(vfMetaData, getUser());
+ ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
+ GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+
+ ResourceMetadataEnum[] fieldsForCheck = {ResourceMetadataEnum.RESOURCE_NAME,
+ ResourceMetadataEnum.DESCRIPTION, ResourceMetadataEnum.VENDOR_NAME, ResourceMetadataEnum.VENDOR_RELEASE,
+ ResourceMetadataEnum.CONTACT_ID};
+
+ for (ResourceMetadataEnum field: fieldsForCheck){
+ AssertJUnit.assertTrue(GeneralUIUtils.isElementReadOnly(field.getValue()));
+ }
+
+ AssertJUnit.assertTrue(GeneralUIUtils.isElementDisabled(ResourceMetadataEnum.CATEGORY.getValue()));
+ AssertJUnit.assertTrue(GeneralUIUtils.isElementDisabled(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue()));
+ }
+
+ @Test
+ public void exportToscaWithModulePropertiesVFTest() throws AWTException, Exception {
+ String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip";
+ Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+ String vspName = vsp.left;
+ ResourceGeneralPage.clickSubmitForTestingButton(vsp.left);
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
+ VfModuleVerificator.validateSpecificModulePropertiesFromRequest(resource);
+ }
+
+ @Test
+ public void exportToscaWithModulePropertiesTemplateCheckVFTest() throws AWTException, Exception {
+ String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip";
+ OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+ ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+ GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_MODEL.getValue());
+ File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+ ToscaDefinition toscaDefinition = VfModuleVerificator.getToscaTemplate(latestFilefromDir.getAbsolutePath());
+ VfModuleVerificator.validateSpecificModulePropertiesFromFile(toscaDefinition);
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java
new file mode 100644
index 0000000000..2957379ff8
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java
@@ -0,0 +1,380 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.ci.tests.businesslogic.ArtifactBusinessLogic;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CompositionScreenEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.HeatWithParametersDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.HomeUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openqa.selenium.WebElement;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+public class VfArtifacts extends SetupCDTest{
+
+ private String filePath;
+ private String vnfsRepositoryPath;
+ private String updatedVnfsRepositoryPath;
+ private String createdEnvFilePath;
+ private static final String PARAMETERS = "parameters";
+
+ @BeforeMethod
+ public void beforeTest() throws FileNotFoundException{
+ filePath = getWindowTest().getDownloadDirectory();
+ vnfsRepositoryPath = FileHandling.getVnfRepositoryPath();
+// vnfsRepositoryPath = FileHandling.getFilePath("Old_VNFs");
+ updatedVnfsRepositoryPath = vnfsRepositoryPath + "UpdatedVNFs";
+ Config config = Utils.getConfig();
+ createdEnvFilePath = config.getWindowsDownloadDirectory();
+ }
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+
+ @DataProvider(name = "heatEnvAndVersion", parallel = false)
+// parameters: VSP, updatedVsp, expectedHeatVersion, expectedHeatEnvVersion
+ public Object[][] provideData() {
+
+ return new Object[][] {
+ { "2016-043_vsaegw_fdnt_30_1607_e2e.zip", "FDNT_UpdateHeatParams.zip", "2", "1" }, // expected heat version 2 and heatEnv 1
+ { "2016-043_vsaegw_fdnt_30_1607_e2e.zip", "FDNT_WithoutEnvFiles.zip", "1", "1" }, // expected heat version 1 and heatEnv 1
+ { "2016-014_vlandslide_ldsa_30_1607_e2e.zip", "2016-209_vjsa_vjsa_30_1610_e2e.zip", "1", "0" }, // expected heat version 1 and heatEnv 0
+ { "2016-045_vlb_lmsp_30_1607_e2e.zip", "2016-045_vlb_lmsp_30_1607_e2e.zip", "1", "1" }, // expected heat version 1 and heatEnv 1(DE270634)
+ { "2016-109_mobt_mobt_30_1607_e2e.zip", "2016-109_mobt_mobt_30_1607_e2e_DifferentParams.zip", "2", "1" } // expected heat version 2 and heatEnv 1
+ };
+ }
+
+// update first env file and verify parameters value
+ @Test
+ public void uploadUpdatedHeatEnv() throws Exception{
+
+ String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip";
+ File updateEnvFile = null;
+ Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+ String vspName = vsp.left;
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
+ Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
+ List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts);
+// create env file and update it
+ if(envFilesList.size()>0){
+// select index of env file to be updated
+ HeatWithParametersDefinition selectedEnvFileToUpdate = envFilesList.get(0);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue()+selectedEnvFileToUpdate.getHeatEnvLabel());
+ updateEnvFile = ArtifactUIUtils.uploadCreatedUpdateParametersEnvFile(selectedEnvFileToUpdate, createdEnvFilePath);
+ ArtifactUIUtils.verifyUpdatedEnvParameters(selectedEnvFileToUpdate, updateEnvFile);
+ }
+ else{
+ SetupCDTest.getExtendTest().log(Status.INFO, "Resource does not contain HEAT files");
+ }
+ }
+
+// update all env files and verify parameters value in Deployment Artifact View
+ @Test
+ public void uploadUpdatedAllHeatEnv() throws Exception{
+
+ String vnfFile = "2016-044_vfw_fnat_30_1607_e2e.zip";
+ File updateEnvFile = null;
+ Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+ String vspName = vsp.left;
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
+ Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
+ List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts);
+ if(envFilesList.size()>0){
+ for(HeatWithParametersDefinition selectedEnvFileToUpdate : envFilesList){
+ // create env file and update it
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue()+selectedEnvFileToUpdate.getHeatEnvLabel());
+ updateEnvFile = ArtifactUIUtils.uploadCreatedUpdateParametersEnvFile(selectedEnvFileToUpdate, createdEnvFilePath);
+ ArtifactUIUtils.verifyUpdatedEnvParameters(selectedEnvFileToUpdate, updateEnvFile);
+ }
+ }else{
+ SetupCDTest.getExtendTest().log(Status.INFO, "Resource does not contain HEAT files");
+ }
+ }
+
+// update all env files and verify parameters value in Composition
+ @Test
+ public void uploadUpdatedAllHeatEnvComposition() throws Exception{
+
+ String vnfFile = "2016-014_vlandslide_ldst_30_1607_e2e.zip";
+ File updateEnvFile = null;
+ Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+ String vspName = vsp.left;
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
+ Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
+ List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.StepsEnum.COMPOSITION.getValue());
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionScreenEnum.DEPLOYMENT_ARTIFACT_TAB.getValue());
+ if(envFilesList.size()>0){
+ for(HeatWithParametersDefinition selectedEnvFileToUpdate : envFilesList){
+ // create env file and update it
+ String dataTestId = DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ITEM.getValue()+selectedEnvFileToUpdate.getHeatArtifactDisplayName();
+ GeneralUIUtils.hoverOnAreaByTestId(dataTestId);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue()+selectedEnvFileToUpdate.getHeatArtifactDisplayName());
+ updateEnvFile = ArtifactUIUtils.uploadCreatedUpdateParametersEnvFile(selectedEnvFileToUpdate, createdEnvFilePath);
+ ArtifactUIUtils.verifyUpdatedEnvParameters(selectedEnvFileToUpdate, updateEnvFile, dataTestId);
+ }
+ }else{
+ SetupCDTest.getExtendTest().log(Status.INFO, "Resource does not contain HEAT files");
+ }
+ }
+
+// expected heat version 1 and heatEnv 0
+ @Test
+ // Download ENV file from VF level Update VSP.
+ public void downloadEnvFromVFLevelUpdateVSP() throws Throwable {
+ String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
+ String updatedVnfFile="2016-014_vlandslide_ldsa_30_1607_e2e.zip";
+ String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
+ Pair<String, Map<String, String>> CreatedVsp=OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+ String vspName = CreatedVsp.left;
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+ OnboardingUtils.updateVnfAndValidate(vnfsRepositoryPath, CreatedVsp, updatedVnfFile, getUser());
+ //get updated vsp env files
+ Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, downloadDirPath);
+ GeneralUIUtils.findComponentAndClick(vspName);
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ List<String> deploymentArtifcatsList = DeploymentArtifactPage.getDeploymentArtifactsNamesWorkSpace();
+
+ for (int i = 0; i < deploymentArtifcatsList.size(); i++) {
+ if (DeploymentArtifactPage.getArtifactType(deploymentArtifcatsList.get(i)).equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType())) {
+ DeploymentArtifactPage.clickDownloadEnvArtifact(deploymentArtifcatsList.get(i));
+ GeneralUIUtils.ultimateWait();
+ File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(downloadDirPath);
+ ArtifactUIUtils.compareYamlFilesByPattern(latestFilefromDir, currentZipEnvfiles.get(deploymentArtifcatsList.get(i)), PARAMETERS);
+ }
+ }
+ }
+
+ @Test
+ // Download ENV file from VF level Work-Space.
+ public void downloadEnvFromVFLevelWorkSpace() throws AWTException, Exception {
+ String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
+ String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
+
+ Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+
+ Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.left,downloadDirPath);
+ GeneralUIUtils.findComponentAndClick(vsp.left);
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ List<String> deploymentArtifcatsList = DeploymentArtifactPage.getDeploymentArtifactsNamesWorkSpace();
+
+ for (int i = 0; i < deploymentArtifcatsList.size(); i++) {
+
+ if (DeploymentArtifactPage.getArtifactType(deploymentArtifcatsList.get(i)).equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType())) {
+ DeploymentArtifactPage.clickDownloadEnvArtifact(deploymentArtifcatsList.get(i));
+ GeneralUIUtils.ultimateWait();
+ File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(downloadDirPath);
+ ArtifactUIUtils.compareYamlFilesByPattern(latestFilefromDir,currentZipEnvfiles.get(deploymentArtifcatsList.get(i)), PARAMETERS);
+ }
+ }
+ }
+
+ @Test
+ // Download ENV file from VF level Composition.
+ public void downloadEnvVFLevelComposition() throws AWTException, Exception {
+
+ String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
+ String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
+
+ Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+ Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.left,downloadDirPath);
+ GeneralUIUtils.findComponentAndClick(vsp.left);
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+ CompositionPage.clickOnTabTestID(CompositionScreenEnum.DEPLOYMENT_ARTIFACT_TAB);
+ List<WebElement> deploymentArtifcatsList = CompositionPage.getCompositionEnvArtifacts();
+
+ for (int i = 0; i < deploymentArtifcatsList.size(); i++) {
+ String fileName = GeneralUIUtils.getDataTestIdAttributeValue(deploymentArtifcatsList.get(i)).replace(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ENV.getValue(), "");
+ if (GeneralUIUtils.isElementVisibleByTestId(GeneralUIUtils.getDataTestIdAttributeValue(deploymentArtifcatsList.get(i)))) {
+ CompositionPage.clickDownloadEnvArtifactComposition(fileName).click();
+ GeneralUIUtils.ultimateWait();
+ File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(downloadDirPath);
+ ArtifactUIUtils.compareYamlFilesByPattern(latestFilefromDir,currentZipEnvfiles.get(fileName), PARAMETERS);
+ }
+ }
+ }
+
+ @Test
+ // Download ENV file from VF level Update parameters in UI.
+ public void downloadEnvVFLevelUpdateParameters() throws AWTException, Exception {
+
+ String vnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip";
+ String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
+ Pair<String, Map<String, String>> CreatedVsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+
+ Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, CreatedVsp.left, "0.1");
+ Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
+ List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts);
+
+ for (int i = 0; i < envFilesList.size(); i++) {
+ String artifactName = envFilesList.get(i).getHeatArtifactDisplayName();
+ if (envFilesList.get(i).getHeatArtifactType().equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType())) {
+ ExtentTestActions.log(Status.INFO, String.format("Opening the edit/view artifact parameters form of %s resource...", vnfFile));
+ DeploymentArtifactPage.clickEditEnvArtifact(envFilesList.get(i).getHeatArtifactDisplayName());
+
+ ExtentTestActions.log(Status.INFO, String.format("Going To locating all artifact parameters from UI of %s artifact...", artifactName));
+ Map<?, ?> dataToWriteInUI = ArtifactUIUtils.getDataToWriteInUI(envFilesList.get(i).getHeatParameterDefinition());
+ Map<?, ?> data = dataToWriteInUI;
+ ExtentTestActions.log(Status.INFO, String.format("Success to locate all artifact parameters from UI of %s artifact...", artifactName));
+
+ List<HeatParameterDataDefinition> listToSearchEnvParametersInUI = envFilesList.get(i).getHeatParameterDefinition();
+ fillHeatEnvParametersInUi(data, listToSearchEnvParametersInUI);
+
+ DeploymentArtifactPage.clickSaveEnvParameters();
+ GeneralUIUtils.waitForLoader();
+ ExtentTestActions.log(Status.INFO, String.format("Going to get the %s updated resource ...", CreatedVsp.left));
+ resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, CreatedVsp.left, "0.1");
+ deploymentArtifacts = resource.getDeploymentArtifacts();
+ Map<String,List<HeatWithParametersDefinition>> envFilesListupdated = new HashMap<>();
+ ExtentTestActions.log(Status.INFO, String.format("Mapping the %s artifact parameters ...", artifactName));
+ envFilesListupdated.put(artifactName,ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts));
+ List<HeatWithParametersDefinition> heatEnvUpdatedParameters=envFilesListupdated.get(artifactName);
+ DeploymentArtifactPage. clickDownloadEnvArtifact(artifactName);
+
+ Map<String,Object> mapExpectedProperties = new HashMap<>();
+ for (HeatParameterDataDefinition param : heatEnvUpdatedParameters.get(i).getHeatParameterDefinition()) {
+ mapExpectedProperties.put(param.getName(), ArtifactUIUtils.getValue(param));
+ }
+ ArtifactUIUtils.compareYamlParametersByPattern(mapExpectedProperties, FileHandling.getLastModifiedFileFromDir(downloadDirPath), PARAMETERS);
+ }
+ }
+ }
+
+
+ @Test
+ public void checkDefaultCreatedEnvArtifacts() throws Exception{
+ String vnfFile = "2016-017_vixia_ixla_30_1607_e2e.zip";
+ Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+ String vspName = vsp.left;
+ Map<String, File> generatedEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath);
+ HomeUtils.findComponentAndClick(vspName);
+ GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
+ for(Entry<String, File> envFileEntry : generatedEnvFileList.entrySet()){
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
+ ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileFromDir(), PARAMETERS);
+ ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "0", ArtifactTypeEnum.HEAT_ENV);
+ ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "1", ArtifactTypeEnum.HEAT);
+ }
+ }
+
+// -------------------------------------------------------------------------------
+ @Test(dataProvider = "heatEnvAndVersion")
+ public void checkDefaultCreatedEnvArtifactsAfterVspUpdate(String vnfFile, String updatedVnfFile, String expectedHeatVersion, String expectedHeatEnvVersion) throws Throwable{
+ String stringForLog = String.format("%s:%s:%s:%s", vnfFile, updatedVnfFile, expectedHeatVersion, expectedHeatEnvVersion);
+ setLog(stringForLog);
+
+ Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+ String vspName = vsp.left;
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+ OnboardingUtils.updateVnfAndValidate(updatedVnfsRepositoryPath, vsp, updatedVnfFile, getUser());
+ Map<String, File> generatedUpdatedEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath);
+ HomeUtils.findComponentAndClick(vspName);
+ GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
+ for(Entry<String, File> envFileEntry : generatedUpdatedEnvFileList.entrySet()){
+// TODO test will pass on case all objects on deployment view are visible
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
+ ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileFromDir(), PARAMETERS);
+ ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatEnvVersion, ArtifactTypeEnum.HEAT_ENV);
+ ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatVersion, ArtifactTypeEnum.HEAT);
+ }
+ }
+
+// expected heat version 1 and heatEnv 2
+ @Test
+ public void checkDefaultCreatedEnvArtifactsVspUpdatedWithSameVspTwice() throws Throwable{
+ String vnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip";
+ String updatedVnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip";
+ Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+ String vspName = vsp.left;
+
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+ OnboardingUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser());
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+ OnboardingUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser());
+ Map<String, File> generatedUpdatedSecondTimeEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath);
+ HomeUtils.findComponentAndClick(vspName);
+ GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
+ for(Entry<String, File> envFileEntry : generatedUpdatedSecondTimeEnvFileList.entrySet()){
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
+ ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileFromDir(), PARAMETERS);
+ ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "2", ArtifactTypeEnum.HEAT_ENV);
+ ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "1", ArtifactTypeEnum.HEAT);
+ }
+ }
+
+
+ public void downloadFile(Entry<String, File> envFileEntry) {
+ int fileCountBefore = FileHandling.getFileCountFromDefaulDownloadDirectory();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
+ int fileCountAfter = FileHandling.getFileCountFromDefaulDownloadDirectory();
+ assertTrue("Downloaded file is missing", (fileCountAfter - fileCountBefore) == 1 );
+ }
+
+ public static void fillHeatEnvParametersInUi(Map<?, ?> data,List<HeatParameterDataDefinition> listToSearchEnvParametersInUI) {
+ ExtentTestActions.log(Status.INFO, String.format("Going to search parameters in UI and insert new current value to each parameter in UI..."));
+
+ for (HeatParameterDataDefinition paramDefinition : listToSearchEnvParametersInUI){
+ DeploymentArtifactPage.searchBoxEnv(paramDefinition.getName());
+ WebElement currenValueField=GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.EnvParameterView.ENV_CURRENT_VALUE.getValue()+paramDefinition.getName());
+ currenValueField.clear();
+ currenValueField.sendKeys(data.get(paramDefinition.getName()).toString());
+ GeneralUIUtils.ultimateWait();
+ DeploymentArtifactPage.clearSearchBoxEnv();
+ }
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java
new file mode 100644
index 0000000000..42c43f3ac8
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java
@@ -0,0 +1,862 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.Dashboard;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.common.api.ArtifactTypeEnum;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.SkipException;
+import org.testng.annotations.Test;
+
+
+public class VfDeploymentInformationalArtifacts extends SetupCDTest {
+
+
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // START US824719
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ // US824719 - Import VSP - VF informational artifacts
+ // TC1434241 - Import VF Artifacts - Deployment Artifacts - One Artifact, One Type
+ @Test
+ public void importVfArtifactsDeploymentArtifactsOneArtifactOneType() throws Exception {
+ String fileName = "TC1434241.csar";
+ String folder ="US825779";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
+ }
+
+ // US824719 - Import VSP - VF informational artifacts
+ // TC1434245 - Import VF Artifacts - Deployment Artifacts - Multiple Artifacts, Multiple Types
+ @Test
+ public void importVfArtifactsDeploymentArtifactsMultipleArtifactsMultipleTypes() throws Exception {
+ String fileName = "TC1434245.csar";
+ String folder ="US825779";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName3.yaml", null, "HeatVolArtifactName3", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName,folder, deploymentArtifacts, null);
+ }
+
+ // US824719 - Import VSP - VF informational artifacts
+ // TC1434247 - Import VF Artifacts - Informational Artifacts - One Artifact, One Type
+ @Test
+ public void importVfArtifactsInformationalArtifactsOneArtifactOneType() throws Exception {
+ String fileName = "TC1434247.csar";
+ String folder ="US825779";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+ informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
+ }
+
+ // US824719 - Import VSP - VF informational artifacts
+ // TC1434248 - Import VF Artifacts - Informational Artifacts - Multiple Artifacts, Multiple Types
+ @Test
+ public void importVfArtifactsInformationalArtifactsMultipleArtifactsMultipleTypes() throws Exception {
+ String fileName = "TC1434248.csar";
+ String folder ="US825779";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+ informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+ informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1"));
+ informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1"));
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
+ }
+
+ // US824719 - Import VSP - VF informational artifacts
+ // TC1434249 - Import VF Artifacts - Deployment and Informational Artifacts - Multiple Artifacts, Multiple Types
+ @Test
+ public void importVfArtifactsDeploymentAndInformationalArtifactsMultipleArtifactsMultipleTypes() throws Exception {
+ String fileName = "TC1434249.csar";
+ String folder ="US825779";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName3.yaml", null, "HeatVolArtifactName3", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+ informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+ informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1"));
+ informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1"));
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
+ }
+
+ // TODO: there is defect in flow: "Updated button enabled for artifact in invalid type folder"
+ // TODO: re-check it after defect fix
+ // US824719 - Import VSP - VF informational artifacts
+ // TC1438310 - Import VF Artifacts - Deployment Artifacts - Artifact Type Invalid
+ @Test
+ public void importVFArtifactsDeploymentArtifactsArtifactTypeInvalid() throws Exception {
+ String fileName = "DeploymentArtifactWithInvalidType.csar";
+ String folder ="US825779";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "ArtifactName.yaml", null, "ArtifactName", ArtifactTypeEnum.OTHER.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
+ }
+
+ // US824719 - Import VSP - VF informational artifacts
+ // TC1438311 - Import VF Artifacts - Informational Artifacts - Artifact Type Invalid
+ @Test
+ public void importVfArtifactsInformationalArtifactsArtifactTypeInvalid() throws Exception {
+ String fileName = "InformationArtifactWithInvalidType.csar";
+ String folder ="US825779";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+ informationalArtifacts.add(new ArtifactInfo(null, "ArtifactName.yaml", null, "ArtifactName", ArtifactTypeEnum.OTHER.getType(), "1"));
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
+ }
+
+ // US824719 - Import VSP - VF informational artifacts
+ // TC1438231 - Import VF Artifacts - Deployment Artifacts - Artifact Name To Long
+ @Test
+ public void importVfArtifactsDeploymentArtifactsArtifactNameToLong() throws Exception {
+ String folder = "US825779";
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ String fileName = "DeploymentArtifactWithLongName.csar";
+
+ importVfFromCsar(resourceMetaData, folder, fileName, getUser());
+
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
+ Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+ }
+
+ // US824719 - Import VSP - VF informational artifacts
+ // TC1438232 - Import VF Artifacts - Informational Artifacts - Artifact Name To Long
+ // TODO: make informational artifact name longer then 255
+ // TODO: windows/linux not allowed it
+ @Test(enabled=false)
+ public void importVfArtifactsInformationalArtifactsArtifactNameToLong() throws Exception {
+ String folder ="US825779";
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+
+ String fileName = "InformationArtifactWithLongName.csar";
+
+ importVfFromCsar(resourceMetaData, folder, fileName, getUser());
+
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
+ Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // END US824719
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+
+
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // START US825779
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+ // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
+ // TC1443736 - Update With One New Deployment Artifact
+ @Test
+ public void updateWithOneNewDeploymentArtifact() throws Exception {
+ String fileName = "ImportTC1443736.csar";
+ String folder ="US825779";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+
+ fileName = "UpdateTC1443736.csar";
+ deploymentArtifacts.add(new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, null, null, null);
+ }
+
+
+ // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
+ // TC1443737 - Update With One Removed Deployment Artifact
+ @Test
+ public void updateWithOneRemovedDeploymentArtifact() throws Exception {
+ String fileName = "ImportTC1443737.csar";
+ String folder ="US825779";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ ArtifactInfo artifactInfo = new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1");
+ deploymentArtifacts.add(artifactInfo);
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+
+ fileName = "UpdateTC1443737.csar";
+ deploymentArtifacts.remove(artifactInfo);
+
+ List<ArtifactInfo> deploymentArtifactsNotExist = new ArrayList<ArtifactInfo>();
+ deploymentArtifactsNotExist.add(artifactInfo);
+
+ updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, null, deploymentArtifactsNotExist, null);
+ }
+
+ // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
+ // TC1443738 - Update With One New Version Deployment Artifact
+ @Test
+ public void updateWithOneNewVersionDeploymentArtifact() throws Exception {
+ String fileName = "ImportTC1443738.csar";
+ String folder ="US825779";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ ArtifactInfo artifactInfo = new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1");
+ deploymentArtifacts.add(artifactInfo);
+
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+
+ fileName = "UpdateTC1443738.csar";
+ artifactInfo.setArtifactVersion("2");
+
+ updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, null, null, null);
+ }
+
+ // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
+ // TC1443887 - Update With One New Informational Artifact
+ @Test
+ public void updateWithOneNewInformationalArtifact() throws Exception {
+ String fileName = "ImportTC1443887.csar";
+ String folder ="US825779";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+
+ fileName = "UpdateTC1443887.csar";
+
+ List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+ informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+
+ updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, null, null);
+ }
+
+ // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
+ // TC1443888 - Update With One Removed Informational Artifact
+ @Test
+ public void updateWithOneRemovedInformationalArtifact() throws Exception {
+ String folder ="US825779";
+ String fileName = "ImportTC1443888.csar";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+ ArtifactInfo artifactInfo = new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1");
+ informationalArtifacts.add(artifactInfo);
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+
+ fileName = "UpdateTC1443888.csar";
+
+ informationalArtifacts.remove(artifactInfo);
+
+ List<ArtifactInfo> informationalArtifactNotExist = new ArrayList<ArtifactInfo>();
+ informationalArtifactNotExist.add(artifactInfo);
+
+ updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, null, informationalArtifactNotExist);
+ }
+
+ // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
+ // TC1443890 - Update With One New Artifact Version Informational Artifact
+ @Test
+ public void updateWithOneNewArtifactVersionInformationalArtifact() throws Exception {
+ String folder ="US825779";
+ String fileName = "ImportTC1443890.csar";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+ ArtifactInfo artifactInfo = new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1");
+ informationalArtifacts.add(artifactInfo);
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+
+ fileName = "UpdateTC1443890.csar";
+ artifactInfo.setArtifactVersion("2");
+
+ updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, null, null);
+ }
+
+ // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
+ // TC1443893 - Update CSAR With Same Artifacts As Imported
+ @Test
+ public void updateCSARWithSameArtifactsAsImported() throws Exception {
+ String folder ="US825779";
+ String fileName = "ImportUpdateTC1443893.csar";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "HeatVolArtifactName3.yaml", null, "HeatVolArtifactName3", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+
+ List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+ informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+ informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1"));
+ informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1"));
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+
+ fileName = "ImportUpdateTC1443893.csar";
+
+ updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, null, null);
+ }
+
+ // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
+ // TC1443954 - Update With Multiple Changes In Deployment And Informational Artifacts
+ @Test
+ public void updateWithMultipleChangesInDeploymentAndInformationalArtifacts() throws Exception {
+ String folder ="US825779";
+ String fileName = "ImportTC1443954.csar";
+
+ ArtifactInfo deploymentHeat1 = new ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1");
+ ArtifactInfo deploymentHeat2 = new ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1");
+ ArtifactInfo deploymentHeat3 = new ArtifactInfo(null, "heatartifactname3.yaml", null, "heatartifactname3", ArtifactTypeEnum.HEAT.getType(), "1");
+
+ ArtifactInfo deploymentHeatVol1 = new ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1");
+ ArtifactInfo deploymentHeatVol2 = new ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1");
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(deploymentHeat1);
+ deploymentArtifacts.add(deploymentHeat2);
+ deploymentArtifacts.add(deploymentHeat3);
+ deploymentArtifacts.add(deploymentHeatVol1);
+ deploymentArtifacts.add(deploymentHeatVol2);
+
+ ArtifactInfo infoGuide1 = new ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1");
+ ArtifactInfo infoGuide2 = new ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1");
+
+ ArtifactInfo infoOther1 = new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1");
+ ArtifactInfo infoOther2 = new ArtifactInfo(null, "artifactname2.txt", null, "artifactname2", ArtifactTypeEnum.OTHER.getType(), "1");
+ ArtifactInfo infoOther3 = new ArtifactInfo(null, "artifactname3.txt", null, "artifactname3", ArtifactTypeEnum.OTHER.getType(), "1");
+
+ List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+ informationalArtifacts.add(infoGuide1);
+ informationalArtifacts.add(infoGuide2);
+ informationalArtifacts.add(infoOther1);
+ informationalArtifacts.add(infoOther2);
+ informationalArtifacts.add(infoOther3);
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+
+ fileName = "UpdateTC1443954.csar";
+
+ List<ArtifactInfo> informationalArtifactsNotExist = new ArrayList<ArtifactInfo>();
+ List<ArtifactInfo> deploymentArtifactsNotExist = new ArrayList<ArtifactInfo>();
+
+ // Changes in deployment artifacts
+ deploymentArtifactsNotExist.add(deploymentHeat1);
+ deploymentArtifactsNotExist.add(deploymentHeat2);
+ deploymentArtifacts.remove(deploymentHeat1);
+ deploymentArtifacts.remove(deploymentHeat2);
+ deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname4.yaml", null, "heatartifactname4", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "heatartifactname5.yaml", null, "heatartifactname5", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentHeatVol1.setArtifactVersion("2");
+ deploymentHeatVol2.setArtifactVersion("2");
+
+ // Changes in informational artifacts
+ infoGuide1.setArtifactVersion("2");
+ infoOther1.setArtifactVersion("2");
+ informationalArtifactsNotExist.add(infoGuide2);
+ informationalArtifactsNotExist.add(infoOther2);
+ informationalArtifacts.remove(infoGuide2);
+ informationalArtifacts.remove(infoOther2);
+ informationalArtifacts.add(new ArtifactInfo(null, "GuideInfoArtifact3.yml", null, "GuideInfoArtifact3", ArtifactTypeEnum.GUIDE.getType(), "1"));
+ informationalArtifacts.add(new ArtifactInfo(null, "artifactname4.txt", null, "artifactname4", ArtifactTypeEnum.OTHER.getType(), "1"));
+
+ updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, deploymentArtifactsNotExist, informationalArtifactsNotExist);
+ }
+
+
+ // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
+ // TC1444206 - Update With Existed Deployment Artifact By Artifact With Different Type
+ @Test
+ public void updateWithExistedDeploymentArtifactByArtifactWithDifferentType() throws Exception {
+ String folder ="US825779";
+ String fileName = "ImportTC1444206.csar";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+
+ fileName = "UpdateTC1444206.csar";
+ String filePath = FileHandling.getFilePath(folder); ;
+
+ ResourceUIUtils.updateVfWithCsar(filePath, fileName);
+
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.ARTIFACT_ALRADY_EXIST_IN_DIFFERENT_TYPE_IN_CSAR.name());
+ Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+ }
+
+ // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
+ // TC1444207 - Update With Existed Informational Artifact By Artifact With Different Type
+ @Test
+ public void updateWithExistedInformationalArtifactByArtifactWithDifferentType() throws Exception {
+ String folder ="US825779";
+ String fileName = "ImportTC1444207.csar";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+ informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+
+ fileName = "UpdateTC1444207.csar";
+ String filePath = FileHandling.getFilePath(folder); ;
+
+ ResourceUIUtils.updateVfWithCsar(filePath, fileName);
+
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.ARTIFACT_ALRADY_EXIST_IN_DIFFERENT_TYPE_IN_CSAR.name());
+ Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+ }
+
+
+ // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
+ // TC1444208 - Update With Existed Informational Artifact By Deployment Artifact With Different Type
+ @Test
+ public void updateWithExistedInformationalArtifactByDeploymentArtifactWithDifferentType() throws Exception {
+ String folder ="US825779";
+ String fileName = "ImportTC1444208.csar";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+
+ fileName = "UpdateTC1444208.csar";
+ String filePath = FileHandling.getFilePath(folder); ;
+
+ ResourceUIUtils.updateVfWithCsar(filePath, fileName);
+
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.ARTIFACT_ALRADY_EXIST_IN_DIFFERENT_TYPE_IN_CSAR.name());
+ Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+ }
+
+ // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
+ // TC1444520 - Update Deployment Artifact With Name To Long
+ @Test
+ public void updateDeploymentArtifactWithNameToLong() throws Exception {
+ String folder ="US825779";
+
+ String fileName = "ImportTC1444520.csar";
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, null, null);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+
+ fileName = "UpdateTC1444520.csar";
+ String filePath = FileHandling.getFilePath(folder); ;
+
+ ResourceUIUtils.updateVfWithCsar(filePath, fileName);
+
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
+ Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+ }
+
+ // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
+ // TC1444521 - Update Informational Artifact With Name To Long
+ @Test
+ public void updateInformationalArtifactWithNameToLong() throws Exception {
+
+ String folder = "US825779";
+ String fileName = "ImportTC1444521.csar";
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, null, null);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+
+ fileName = "UpdateTC1444521.csar";
+ String filePath = FileHandling.getFilePath(folder); ;
+
+ ResourceUIUtils.updateVfWithCsar(filePath, fileName);
+
+ String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
+ Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+ }
+
+ // TODO: only after below TODO's it complete test
+ // TODO: verify that if delete/edit button need to be disabled then check that there is no such buttons
+ // TODO: in composition & artifact pages
+ // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
+ // TC1444530 - Update Deployment Artifact With Invalid Type
+ @Test
+ public void updateDeploymentArtifactWithInvalidType() throws Exception {
+ String folder ="US825779";
+ String fileName = "ImportTC1444530.csar";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+
+ fileName = "UpdateTC1444530.csar";
+ deploymentArtifacts.add(new ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+
+ updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, null, null, null);
+ }
+
+
+ // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update
+ // TC1444531 - Update Informational Artifact With Invalid Type
+ @Test
+ public void updateInformationalArtifactWithInvalidType() throws Exception {
+ String folder ="US825779";
+ String fileName = "ImportTC1444531.csar";
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, null, null);
+
+ GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+
+ fileName = "UpdateTC1444531.csar";
+
+ List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+ informationalArtifacts.add(new ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+
+ updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, null, informationalArtifacts, null, null);
+ }
+
+
+ @Test
+ public void importValidInformationalArtifactInInvalidFolerTest_TC1438313() throws Exception{
+ String fileName = "ValidArtifactNameInInvalidFolder.csar";
+ String folder = "US824719";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
+ }
+
+ @Test
+ public void updateValidInformationalArtifactInInvalidFolerTest_TC1444533() throws Exception{
+ String fileName = "ImportTC1444533.csar";
+ String folder = "US824719";
+ String filePath = FileHandling.getFilePath(folder);
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+
+ String updatedCsarFileName = "UpdateTC1444533.csar";
+
+ List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+ deploymentArtifacts.add(new ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+ deploymentArtifacts.add(new ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+
+ updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, updatedCsarFileName, deploymentArtifacts, null, null, null);
+ }
+
+
+
+
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // END US825779
+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+ public void updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(String folder, String fileName,
+ List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> informationalArtifacts,
+ List<ArtifactInfo> deploymentArtifactsNotExist, List<ArtifactInfo> informationalArtifactsNotExist) throws Exception {
+ String filePath = FileHandling.getFilePath(folder);
+ ResourceUIUtils.updateVfWithCsar(filePath, fileName);
+
+ validateDeploymentArtifactPage(deploymentArtifacts, null);
+ validateInformationalArtifactPage(informationalArtifacts, null);
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ validateDeploymentArtifactInComposition(deploymentArtifacts, null);
+ validateInformationalArtifactInComposition(informationalArtifacts, null);
+
+ }
+
+
+ public void importVfFromCsar(ResourceReqDetails resourceMetaData, String folder, String fileName, User user) {
+ String filePath = FileHandling.getFilePath(folder);
+ GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue());
+ // Insert file to the browse dialog
+ WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue());
+ browseWebElement.sendKeys(filePath + fileName);
+
+ // Fill the general page fields.
+ GeneralUIUtils.waitForLoader();
+ ResourceUIUtils.fillResourceGeneralInformationPage(resourceMetaData, getUser(), true);
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue());
+ }
+
+
+
+
+ public void importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(String fileName, String folder, List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> informationalArtifacts) throws Exception {
+ String filePath = FileHandling.getFilePath(folder);
+ ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+ ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+
+ validateDeploymentArtifactPage(deploymentArtifacts, null);
+ validateInformationalArtifactPage(informationalArtifacts, null);
+
+ ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+
+ validateDeploymentArtifactInComposition(deploymentArtifacts, null);
+ validateInformationalArtifactInComposition(informationalArtifacts, null);
+ }
+
+ public void validateInformationalArtifactInComposition(List<ArtifactInfo> informationalArtifacts, List<ArtifactInfo> informationalArtifactsNotExist) throws Exception {
+ CompositionPage.showInformationArtifactTab();
+ // Composition informational
+ if(informationalArtifacts != null && informationalArtifacts.size() > 0) {
+ validateEachArtifactOnCompositionRightMenuInformationPage(informationalArtifacts);
+ }
+ if(informationalArtifactsNotExist != null && informationalArtifactsNotExist.size() > 0) {
+ validateEachArtifactNotExistOnCompositionRightMenuInformationPage(informationalArtifactsNotExist);
+ }
+ }
+
+ public void validateDeploymentArtifactInComposition(List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> deploymentArtifactsNotExist) throws Exception {
+ CompositionPage.showDeploymentArtifactTab();
+ // Composition deployment
+ if(deploymentArtifacts != null && deploymentArtifacts.size() > 0) {
+ validateEachArtifactOnCompositionRightMenuDeploymentPage(deploymentArtifacts);
+ }
+ if(deploymentArtifactsNotExist != null && deploymentArtifactsNotExist.size() > 0) {
+ validateEachArtifactNotExistOnCompositionRightMenuDeploymentPage(deploymentArtifactsNotExist);
+ }
+ }
+
+ public void validateInformationalArtifactPage(List<ArtifactInfo> informationalArtifacts, List<ArtifactInfo> informationalArtifactsNotExist) {
+ ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+ // Informational page
+ if(informationalArtifacts != null && informationalArtifacts.size() > 0) {
+ validateEachArtifactInformationPage(informationalArtifacts);
+ }
+ if(informationalArtifactsNotExist != null && informationalArtifactsNotExist.size() > 0) {
+ validateEachArtifactNotExistInformationPage(informationalArtifactsNotExist);
+ }
+ }
+
+ public void validateDeploymentArtifactPage(List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> deploymentArtifactsNotExist) {
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+ // Deployment page
+ if(deploymentArtifacts != null && deploymentArtifacts.size() > 0) {
+ validateEachArtifactOnDeploymentPage(deploymentArtifacts);
+ }
+ if(deploymentArtifactsNotExist != null && deploymentArtifactsNotExist.size() > 0) {
+ validateEachArtifactNotExistOnDeploymentPage(deploymentArtifactsNotExist);
+ }
+ }
+
+ // TODO: add validation that if not editable / deleteable then button should not appear
+ public void validateEachArtifactOnDeploymentPage(List<ArtifactInfo> artifactInfoList) {
+ for(ArtifactInfo artifact: artifactInfoList) {
+ String type = artifact.getArtifactType();
+ String label = artifact.getArtifactLabel();
+ String version = artifact.getArtifactVersion();
+
+ if (type.equals(ArtifactTypeEnum.HEAT.getType()) || type.equals(ArtifactTypeEnum.HEAT_VOL.getType()) || type.equals(ArtifactTypeEnum.HEAT_NET.getType())){
+ ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(label, null, version, type, true, false, false, true);
+ }
+ else{
+ ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(label, null, version, type, true, true, true, false);
+ }
+ }
+ }
+
+ public void validateEachArtifactNotExistOnDeploymentPage(List<ArtifactInfo> artifactInfoList) {
+ for(ArtifactInfo artifact: artifactInfoList) {
+ ArtifactUIUtils.validateNotExistArtifactOnDeploymentInformationPage(artifact.getArtifactLabel());
+ }
+ }
+
+ public void validateEachArtifactInformationPage(List<ArtifactInfo> artifactInfoList) {
+ for(ArtifactInfo artifact: artifactInfoList) {
+ ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(artifact.getArtifactLabel(), null, artifact.getArtifactVersion(), artifact.getArtifactType(), true, true, true, false);
+ }
+ }
+
+ public void validateEachArtifactNotExistInformationPage(List<ArtifactInfo> artifactInfoList) {
+ for(ArtifactInfo artifact: artifactInfoList) {
+ ArtifactUIUtils.validateNotExistArtifactOnDeploymentInformationPage(artifact.getArtifactLabel());
+ }
+ }
+
+ public void validateEachArtifactOnCompositionRightMenuDeploymentPage(List<ArtifactInfo> artifactInfoList) {
+ for(ArtifactInfo artifact: artifactInfoList) {
+
+ String type = artifact.getArtifactType();
+ String label = artifact.getArtifactLabel();
+ String filename = artifact.getFilename();
+
+ if (type.equals(ArtifactTypeEnum.HEAT.getType()) || type.equals(ArtifactTypeEnum.HEAT_VOL.getType()) || type.equals(ArtifactTypeEnum.HEAT_NET.getType())){
+ ArtifactUIUtils.validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(filename, label, false, true, true, false);
+ }
+ else{
+ ArtifactUIUtils.validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(filename, label, true, false, true, true);
+ }
+ }
+ }
+
+ public void validateEachArtifactNotExistOnCompositionRightMenuDeploymentPage(List<ArtifactInfo> artifactInfoList) {
+ for(ArtifactInfo artifact: artifactInfoList) {
+ ArtifactUIUtils.validateNotExistArtifactOnCompositionRightMenuDeploymentInformationPage(artifact.getArtifactLabel());
+ }
+ }
+
+ // TODO: there is defect in this flow
+ // TODO: change isEditable to false when defect fix
+ public void validateEachArtifactOnCompositionRightMenuInformationPage(List<ArtifactInfo> artifactInfoList) {
+ for(ArtifactInfo artifact: artifactInfoList) {
+ ArtifactUIUtils.validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(artifact.getFilename(), artifact.getArtifactLabel(), true, false, true, true);
+ }
+ }
+
+ public void validateEachArtifactNotExistOnCompositionRightMenuInformationPage(List<ArtifactInfo> artifactInfoList) {
+ for(ArtifactInfo artifact: artifactInfoList) {
+ ArtifactUIUtils.validateNotExistArtifactOnCompositionRightMenuDeploymentInformationPage(artifact.getArtifactLabel());
+ }
+ }
+
+
+
+ @Override
+ protected UserRoleEnum getRole() {
+ return UserRoleEnum.DESIGNER;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ArtifactsCorrelationManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ArtifactsCorrelationManager.java
new file mode 100644
index 0000000000..7f67978aea
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ArtifactsCorrelationManager.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+
+public class ArtifactsCorrelationManager {
+
+ private static HashMap<String, LinkedList<HeatMetaFirstLevelDefinition>> vNFArtifactsCorrelationMap = new HashMap<String, LinkedList<HeatMetaFirstLevelDefinition>>();
+ private static HashMap<String, Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>> serviceVNFCorrelationMap = new HashMap<String, Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>>();
+
+ public static void addVNFartifactDetails(String vspName,
+ LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts) {
+
+ vNFArtifactsCorrelationMap.put(vspName, deploymentArtifacts);
+
+
+ }
+
+ public static Entry<String, LinkedList<HeatMetaFirstLevelDefinition>> getVNFartifactDetails(String vnfName){
+
+
+ Set<Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>> entrySet = vNFArtifactsCorrelationMap.entrySet();
+ for (Entry<String, LinkedList<HeatMetaFirstLevelDefinition>> entry : entrySet) {
+ String key = entry.getKey();
+ if (key.equals(vnfName)) {
+ return entry;
+ }
+
+ }
+ return null;
+
+ }
+
+
+ public static void addVNFtoServiceArtifactCorrelation(String service, String vnfName){
+
+ serviceVNFCorrelationMap.put(service, getVNFartifactDetails(vnfName));
+
+ }
+
+ public static Set<Entry<String, Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>>> getServiceArtifactCorrelationMap(String service){
+
+ return serviceVNFCorrelationMap.entrySet();
+
+ }
+
+}
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/AttFtpClient.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/AttFtpClient.java
new file mode 100644
index 0000000000..1d7c4ae554
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/AttFtpClient.java
@@ -0,0 +1,221 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.commons.io.output.ByteArrayOutputStream;
+import org.apache.commons.net.ftp.FTP;
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.commons.net.ftp.FTPFile;
+import org.apache.commons.net.ftp.FTPReply;
+
+public class AttFtpClient {
+
+ private static final AttFtpClient instance = new AttFtpClient();
+
+ public static AttFtpClient getInstance() {
+ return instance;
+ }
+
+ private FTPClient apacheFtpClient;
+
+ private AttFtpClient() {
+ apacheFtpClient = new FTPClient();
+ };
+
+
+ public void init(String server, int port, String user, String pass) {
+
+ try {
+ apacheFtpClient.connect(server, port);
+ showServerReply(apacheFtpClient);
+
+
+ int replyCode = apacheFtpClient.getReplyCode();
+ if (!FTPReply.isPositiveCompletion(replyCode)) {
+ System.out.println("Connect failed");
+ return;
+ }
+
+ boolean success = apacheFtpClient.login(user, pass);
+ showServerReply(apacheFtpClient);
+
+ if (!success) {
+ System.out.println("Could not login to the server");
+ return;
+ }
+
+// else{
+// apacheFtpClient.enterLocalPassiveMode();
+// apacheFtpClient.setFileType(FTP.BINARY_FILE_TYPE);
+// }
+ } catch (IOException ex) {
+ System.out.println("Oops! Something wrong happened");
+ ex.printStackTrace();
+ }
+
+ }
+
+ public File retrieveLastModifiedFileFromFTP() throws IOException {
+ FTPFile[] files1 = retrieveListOfFile();
+
+ // sort list by TimeStamp
+ List<FTPFile> sorted = Arrays.asList(files1).stream()
+ .sorted((e1, e2) -> e1.getTimestamp().compareTo(e2.getTimestamp())).collect(Collectors.toList());
+ printFileDetailsList(sorted);
+
+ // retrieve file from FTP
+ FTPFile ftpFile = sorted.get(sorted.size() - 1);
+
+ return retrieveFileFromFTP(ftpFile);
+
+ }
+
+ public FTPFile[] retrieveListOfFile() throws IOException {
+ // Lists files and directories
+ FTPFile[] files = apacheFtpClient.listFiles("");
+
+ printNames(files);
+ return files;
+ }
+
+ public File retrieveFileFromFTP(FTPFile ftpFile) throws IOException {
+
+ File downloadFile1 = new File("tmp");
+ OutputStream outputStream1 = new BufferedOutputStream(new FileOutputStream(downloadFile1));
+ boolean success = apacheFtpClient.retrieveFile(ftpFile.getName(), outputStream1);
+ outputStream1.close();
+
+ if (success) {
+ System.out.println("File #1 has been downloaded successfully.");
+ }
+
+
+ return downloadFile1;
+
+ }
+
+ public void deleteFilesFromFTPserver() throws IOException {
+ FTPFile[] files = retrieveListOfFile();
+ deleteFiles(files);
+ }
+
+ public void terminateClient() throws IOException {
+
+ String status = apacheFtpClient.getStatus();
+
+ // logs out and disconnects from server
+ try {
+ if (apacheFtpClient.isConnected()) {
+ apacheFtpClient.logout();
+ apacheFtpClient.disconnect();
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ private void printFileDetailsList(List<FTPFile> list) {
+ DateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ for (FTPFile ftpFile : list) {
+
+ String details = ftpFile.getName();
+ if (ftpFile.isDirectory()) {
+ details = "[" + details + "]";
+ }
+ details += "\t\t" + ftpFile.getSize();
+ details += "\t\t" + dateFormater.format(ftpFile.getTimestamp().getTime());
+
+ System.out.println(details);
+ }
+ }
+
+ private void printNames(FTPFile[] files) {
+ if (files != null && files.length > 0) {
+ for (FTPFile aFile : files) {
+ System.out.println(aFile);
+ }
+ }
+ }
+
+ private void showServerReply(FTPClient ftpClient) {
+ String[] replies = ftpClient.getReplyStrings();
+ if (replies != null && replies.length > 0) {
+ for (String aReply : replies) {
+ System.out.println("SERVER: " + aReply);
+ }
+ }
+ }
+
+ public class LastModifiedComparator implements Comparator<FTPFile> {
+
+ public int compare(FTPFile f1, FTPFile f2) {
+ return f1.getTimestamp().compareTo(f2.getTimestamp());
+ }
+ }
+
+ public FTPFile getMaxLastModified(FTPFile[] ftpFiles) {
+ return Collections.max(Arrays.asList(ftpFiles), new LastModifiedComparator());
+ }
+
+ public static void displayFiles(File[] files) {
+ for (File file : files) {
+ System.out.printf("File: %-20s Last Modified:" + new Date(file.lastModified()) + "\n", file.getName());
+ }
+ }
+
+ public void deleteFiles(FTPFile[] files) {
+
+ for (FTPFile file : files) {
+
+ boolean deleted = false;
+ try {
+ deleted = apacheFtpClient.deleteFile(file.getName());
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ if (deleted) {
+ System.out.println("The file was deleted successfully.");
+ } else {
+ System.out.println("Could not delete the  file, it may not exist.");
+ }
+ }
+
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java
new file mode 100644
index 0000000000..7d0d77acfa
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.firefox.FirefoxProfile;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeSuite;
+
+
+public class DriverFactory {
+
+ private static ThreadLocal<WebDriverThread> driverThread;
+ private static List<WebDriverThread> webDriverThreadPool = Collections.synchronizedList(new ArrayList<WebDriverThread>());
+ private static Config config;
+
+ public DriverFactory() {
+ try {
+ config = Utils.getConfig();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @BeforeSuite(alwaysRun = true)
+ public static void instantiateDriverObject() {
+
+
+ File basePath = new File(FileHandling.getBasePath());
+ File[] listFiles = basePath.listFiles(new FilenameFilter() {
+
+ @Override
+ public boolean accept(File basePath, String name) {
+ return name.startsWith(WebDriverThread.AUTOMATION_DOWNLOAD_DIR);
+ }
+ });
+ Arrays.asList(listFiles).forEach(e -> FileHandling.deleteDirectory(e.getAbsolutePath()));
+
+
+
+ driverThread = new ThreadLocal<WebDriverThread>() {
+ @Override
+ protected WebDriverThread initialValue() {
+ WebDriverThread webDriverThread = new WebDriverThread(config);
+ webDriverThreadPool.add(webDriverThread);
+ return webDriverThread;
+ }
+ };
+ }
+
+ public static WebDriver getDriver() throws Exception {
+ return driverThread.get().getDriver();
+ }
+
+ public static FirefoxProfile getDriverFirefoxProfile() throws Exception {
+ return driverThread.get().getFirefoxProfile();
+ }
+
+ @AfterSuite(alwaysRun = true)
+ public static void quitDriverAfterSuite() throws Exception {
+ for (WebDriverThread webDriverThread : webDriverThreadPool) {
+ if (webDriverThread.getDriver() != null)
+ webDriverThread.quitDriver();
+ }
+ deleteDownloadDirs();
+ }
+
+ private static void deleteDownloadDirs() throws IOException {
+// System.gc();
+ HashMap<Long,WindowTest> windowMap = WindowTestManager.getWholeMap();
+ for (WindowTest win : windowMap.values()){
+ String downloadDirectory = win.getDownloadDirectory();
+ FileUtils.deleteDirectory(new File(downloadDirectory));
+ }
+ }
+
+ public static void quitDriver() throws Exception{
+ driverThread.get().quitDriver();
+ driverThread.remove();
+ WindowTestManager.removeWindowTest();
+ }
+
+ public static Config getConfig() {
+ return config;
+ }
+
+ public static void setConfig(Config config) {
+ DriverFactory.config = config;
+ }
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentManager.java
new file mode 100644
index 0000000000..09dcad7c36
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentManager.java
@@ -0,0 +1,169 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.File;
+
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.rest.AutomationUtils;
+import org.testng.ITestContext;
+
+import com.aventstack.extentreports.ExtentReports;
+import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
+import com.aventstack.extentreports.reporter.ExtentXReporter;
+import com.aventstack.extentreports.reporter.configuration.Protocol;
+import com.aventstack.extentreports.reporter.configuration.Theme;
+
+public class ExtentManager {
+
+ private static final String VERSIONS_INFO_FILE_NAME = "versions.info";
+ private static ExtentReports extent;
+ private static ExtentHtmlReporter htmlReporter;
+ private static ExtentXReporter extentxReporter;
+ private static final String icon = "$(document).ready(function() {" +"\n"+
+ "$('.brand-logo').html('').prepend(\"<span><img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQ4AAAB7CAYAAACFKW5jAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH3wwXFAQf1clFIAAANNxJREFUeNrtnXeYXVXV/z+n3To101ImvZFGQiCANKUoSBEFebEj1hcb2MWC+lpAbGD5CaKoiL2ggIgoRUIgQAohJCG9TTLJ9Dszt52y9++PfSeZTO6duXfmTkk4n+eZJ5Nbztn7zNnrrL32Wt8NPj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+PgOjjXYDhpX7WgkZMD2qY2qQFtDlSkSvjlsaGJpGUIeQAS1pyb60hMurRrv1Pj5jFnO0G1As9PvbmBiEDkeS8CSmpuEhCOi6FTW0sAYhiTRNTTM8JBoaGmDpSEODoK65EQM7YpLCCCVC97ciAUODuSU6UpO88Jpxo91NH58xwTHtcSx6vJ2DKUlTSlBVVqKVesnqlrSosaWcFTa0eXFX1nmSmrChjTc1qoCIKwlJ1W8NkDoITUPokAQ6U0I2uYL9FZZ+UNfYnvDkhoWlRnNdhIMP7HWcsqDOonKDsK7znzPLRvsS+PiMCsec4VjwWDvNaUFTh8eS8VbFvpSc4Qh5esJjKbBASDnDlZTqGmEpQQ7yPLoGSGxdIx4xtEZbyhdrA/pGIVk+ParveEt9qOH69d3i1AqTcbg8eE71aF8aH58RY8wbjresjbGiCTzpsb/JYUF9oKwpJZekhLzQkfJMIVnkCMoBY7BGIl90DQyNeEjXdhsaz4UN7V9TwvozK88p31Pzzza5uNykOqDzh2Wlo33ZfHyGlTFrOC58opMGT9DuCG6YGdG/ty0xxxby4pTgEkfKpa6gYrgNRX9ogKHhBHVta4WlPR4xtPtmRPXn/7U73XlGfYCoAf8+o2K0L6OPz7AwJg3H/Mc6aEoLFpUawe0J79RuV76525WXuYLpYrQblwUNCOh0Rk3tuQpL/119WHv4yS3O/lNnBji53OQnS6Kj3UQfn6IypgzHOcvb2ZWQnFRpWavbnDM6XfmelJCXOIKq0fQuCsHScKOmtqbE1H41K2r89Yl9qQPvmh3hnqX+9MXn+GHMGI4TH+vgX2eEtLOXJ09sscUHEx5XOUJWHysGoy+mhltmas9OCOl3/E998O9rO9yub82PMLf0uFkB93kFM+qG44HGNF/dnCSoU7s9Lt4bc+UHUp6cdqwajL6EdS01OaI/eOY469t3nxR9PuFJGTX10W6Wj8+QGFXDIaUE0M5d0XnW+k73pg5HnutJjNG+KMVG12Ba2NjzwWnB2z89O/xLDdoANG3U7baPz6AYlUeflLLHaES++nLius1d3m/bbHnB8Wg0AISEnXFvyv0H7Fu2x727gaU918HH51hkxA1Hr8EyrdkW31vZ7n67MSXqj/chJDXY3O1Zrba8HPgN8DYg2MuI+vgcM4yo4eg1QM4B7m1Kyw++2OlFRvsijEznoTaoMyGkA5wA/AT4IlDR59r4+Ix5Rsxw/L4hBWAAbwF+AZz5SprhmzpcPSnIpNChS14GfBa4HZjSYgu+uTkx2s308cmLETEc5yzvoMrSw2khrwN+AMwAmBrROXPc8b88qQNXTQxy3bQgxpHW0gLeCdxZFdAXfn5jguWtzmg318dnQIbdcLz26U7Chla+KuZ+xRbcAtT0vBc1NL4wJ8yp48zBV6ONZSSUmxrXzwzx/UURaoJZL7cGXPTPg/Yvrq4PvursPzT50xafMc+wGo4LVnRQH9LKG5LiyxNC+g0lpnZU7vXicpO7TyrhqkkBwoZ2fBgQCRFD47xai7uXlnDz/Ah1wf4v9ZOt7ikr2pw73v+qstO1n+z3jYfPmGbYwgyvf6aTqREt+uAB58uTw/rH/rSsNNhrfn8Una7kvkabn+5KsabDJeUNdwuLTGacjwtonFppcs3kIBfWBai0Bu5AhyO58rkuHm92mFFirHltrfXedTH3hWfOqRjtXvn4ZGVYhuWtWxK80CmsZ9rsT+9JiC9+bGYo/J2F0bzcm4NpwWPNDvc12qxsd9mXEoieyraxZER6OQSllsacEoPzqi0uGW+xtNyk1MyvsRL4xZ40H30xTsKT6BrMiBj/vaQu8J7tCXfHg6eXj3ZPfXyOouhD8SMvdHLj3BL99c90XrM17t2edGXpdxZG+OSscEHHSQvJ1m7Bs+0uT7Q4rIm57E4IEp7kCC9+JIxJn/OFdI1JYZ1ZUZ1lFSbnVFssLjOoCeoFN+fxFof3v9DN9m5xqC+mBnNLjL9cNSn4walhvfXaqaER6KSPT/4UdUlDSon221bWd3WdtyfpfS3pSVUSOojBHdQ1FpYZLCwzuGZKkH0pwY64x/pOj7Uxl21xwYGUoDktSAiJK6CYYQFNU0uoYV2jOqgxKaQzM2qwoFT9zIoa1Id1FZcZJI81O1y/Pn6E0QBwJWxPiDf+p9nZ8+mZoS883+4ml1Ue/6tPPscORX1ev3ZFDFfI2eu7vN+12PJkACR8dk6Ym+dHinYyiYoLtNmCVluyJynYkxQcTAmaMq/FHElaSBwJXsagmErBK/OvRkCHgK5haRDQIWRolJka5abGuIDG1IjBlLBOVUCjOqBTbmlF6UNaSP683+amTUl2xL2cf4VKS+u+bHzg479aWvJzQPq1LT5jhaLdiQ812fx2T7r0v63OHftT4m09gxUJ59da/PXUUsrynPcPlZQnSQpwhcRD1YqAKjbTAV3T0FEehaH1/CgDMtzsSgh+uCPJz3eniTmy37+ABiwsM3Z+aW7kf66aGFjlGw6fsULR/N/X11jaFzcm3tmUFld6fWICz7e7PN7icPn4wIh0KmRohIzMyccIHY7k/gM2P9ihVo1kHs2TwM6EmL4z7n0RuFZK2e4bD5+xQFHyOKSUfH5jYv7BlPh4WhDs+36nI7llS5It3d5gDn9ME3PUtOStq7r433VxVre7BaWqdDuS3UlxkSO4llGqZvbx6UuxbsRQxNA+1u7IWVnf1WBlu8snNyTYmxyLqqHF50Ba8Ku9af5nVRfXrOnm4YMOSU8OygnalxLBtJAfBZb4iWE+Y4EhT1UyN/IFC8uM/xnolv7HAZuPAN9eEGFOyfEnvZEW8HKXy0NNDvftt1nX6WJ7HN7+aZBICbrGNOB64DopZcKfsviMJkMyHBmjUQVcf3qlWbGk3OCZVjfnIJHA/QdsmtKCr5wQ4fwaixGKlw4bnoQ9ScEzbQ4PHHBY3uqwLyVUZ4doMHqYEtYJ6RrAG4G/PN5s3z/a/fZ5ZTOk2zpjON4P/BAIPnDA5n0vxGlKif6PLKEmpPOeKUHeOzXI7Oix5X2khVoCXtPh8Z9mm+WtLjsSHk6Pd1FEgrrGL5eW8JZJKrAsJI90OOLqXzekO26Y+cqQMvEZewz6Ns8YjQnAfcBpoJ6+9+xNc+PGBAcHMh4ZTigxuHpSgCsmBplXYmCNwfCfI6HdFmzu9lgT81je6rA25tGQ9NRUZEhXsh8kLKs0+ftppT0CQOxLitSdu1Mf+sbWxC/EG2qGeAIfn8ExVMPxQZS+xqF1Vk/CAwdsvrgpwYZOb+AzZFz6yWGdc6stLqixOL3SHHJW5mAREuKepM2WbI17bOzyeCHmsibmsjchaHN6bUg7zM0L6Ro/PjHKtVODh061Nuby4RfjK84cZ17+7QXRVj/W4TMaDCrGkTEa1cDb6WU0QCVTvXFCgFlRg1u2Jrmv0Sbh9rOakHl9b0Jwz540v9+XZmJI56Ryk6UVJovKDE4oMai0NEpMjUiRjIktIOFJ4p6kOS3ZnfTYHvfY1i3YFvfYnvBoSUs63SyGYgTGqga8tT7AVZMCR5zuYFqytds7pdLSzr9xY+KPw98SnwLp+XMd18tfgxoCpz3Zwcqzy98M3APkrF7rdiV/O2Dz4x0pVnW4uCLPM/a65BFTo9zSmBDUmRLRmRDUqQ3q1AY1qgIapaZOqan0L/Q+9R62kKQ96HKVAYi5klZb0pxWaelNaUFDStBqC5KeMiSMdAFdDi6tC/DjxVGmhI+cu31ra5IvbExwQqnxt1sXRt92SV0gOXqt9EEJUy0CFgNTgCjqzkkCDcALmZ+m0W5oMSnY45BS8udGO5ry5NUhQ+u35LXE1HhHfZDzqi3+2mhz7940L8Rc0gMFEXu9l/AkCU/SmBSs6Tj8uqEfrjnpSSXv7bXLjA0QEjzAkxJPcrhEP8f5RjXZVIKlw5snBbl5XuQoo9HpSh5rcfAkHEzLs//YkF4spFypj73pylnANeTOE4qjAupbBzjOFcAlo9D+DuA2YG8/n5kEvBV4MzAfKCH73dMNbAR+B/yW/AxIFfAZlFc/0vwX5RD0S8GG4/vbkzzR6i4bH9Bee1aVldd3JoZ0PjI9xJsnBHik2eEP+2yebXdoTWce7/nc930+4x0qXivQIxxzYyyDhPEhnQ/PCPGh6SHGZSmc+W+Lw8o2tdzd4YhxOxPiMg1WjnbT+2AC1wLvGeBzu4DvDfCZU/M4znDQDPya7IZDQ6n0fw04k4GTKEsy/VgKXAx8HliVx3feBtSPQt8FeRiOgtcw6sO6tqXLu+jZdrdghZnxIZ13TQ7yh1NK+PtpZXx+bpjTxvUSvTmuZ4U5kFBmalw1KcDvl5Vw4+xwVqPRlBb8YEeKTkddJE+i7Ut5F/xkZ2qsLa1MQw2sgbgYGGgn7tGqUXDIfTe+Dvg5cDaFjR8TeC1wF5kNuQbAHaW+53XNC/Y4VnV445psce7L3R5CZTQWTImpceY4kzPHmdwwQ/Bip8cTLQ6rOlw2dnkcSIvDy5wwdr2EwZJZSaoL6rym2uTt9UHOrbYoyZENlxZw+44UT7Q4h66FBNpsuWBlu7tESvnvMbS68mpgah6fOwkVF3hqtBtcADOAbwIzh3CMJShv5RqgZbQ7NFgKMhxSSi5d2XWiLZi3ocuj3ZFUBYZ2w9YEdc6v0Tm/xiLuSfYkBC/EXFbHPF7qVII9TWml/OX1jU+MmbEy0IU7/GvU1JhbYvC6WovLJwRYUm70ZIVmxZFw1+4UP9qRwu3zDOz2ZKTZFucD/x7tLmaIoDyJfOaw44CLgBUcG76mAbwbNfD7w830p79rcAFwGWp/oWOSgj2Odke8KunJ0p78hvNr8otz5EPU0JhXajCv1OCt9Wo1pNVWS6Uvd3lsjwt2Jz12JQSNKUG3K0l6kBIy96030salTztChlr9mVdqsKzC5Owqi5MqDMYHB/Zy0wLu3JXiKy8n1BSlT19cgbY/KZa91OWVA7ER7mk25gJnFPD516HygMbaikO2u6YOuJzc05O9wN+A9aipzhzgysy/fQmgAr9/AHLtwjVaj8W8zluQ4eh2ZUBDe5WUELMlv99nc1aVRR5jYFCUmhqlpsa0iM6rM4HYlJDEXYi5ksaUoCEp2J8SHEyrn6a04GBaJXAlPUlSqFUZZ5hny4aupmAlhkZtUGdmVGdeqcGiMpOFpQaTwnpBQkZtjuS27Ulu256iK4fgj1QrRgufb3enoG7Y0URDGYLaAr6zABU4fDDH+w65B1Y2LLI/6QWQJj/Ppmcpta9/Ox8Vv8lGM/BR4IE+3/s3Ksg6Kct3FqKCn1uyvCcz/U7m2WYdCJJ90DuZn3zQADufDxZkODQYb2rMEJn//L0xzVsmBYrqdQxESNcIBaAqoDEjcqTFcgTYUmILiLuSFlvSYgtabEGbncnhyEgLdjoqt6PLzUgMCnCkxJXZtUsNDayMzGDE0KiwlCcxIaQzMaQf+ndSSOWZRA3lbQyG9Z0e/7c5wd8bbZyeYrkcpDwqyi1toZRy/SjHOcpRU49sj5Fu1I3d90aJoJZb/0n2oNwfgLV5nl+ilkffkuW9PcD/AW15HiuV+U5vJpM7mPtQ5qevsfkvagn201m+U0luw9GCqoTOtxipFvgy2Q3Ub1CeUD5owM58PliQ4Qga2vSpEX0KLeoUzWnJzVuTzC81DtVSjCaWDhYaUQMqLY36MKip6WGEVMlhQspMfgekPUlKQNKTpAXILEY+oGvKaBlKwNjSD8sNDiZAnI1OV4n+fHdbko35pOsDZaYWmBU1lgC/Z3RjBUtRAc++eMAvUUHTRVnePxeVOJXtht2U+cmXE3O83okyTgeG0L8w2f8iHvAI2Z/qAvgPyhvpK1UfILdhSFBY3Koe+DjZDccG4O9D6HdW8jYcmTTzBadVmtF796bp8TqeaHb45pYkN8+P5FwVGEvoGqh4bq+2jnK7XQkr2xxu25HioQOFCf5MDutMi+jzUDdhfJS6oKO8jWxL9C3Ar1BP8WyGYwZqaTOvJ90Q2jdU7Zl0jtcFcLCf7+WaJLvkOS3Is3+5GBZ5/ELdhPkX1lra3FLj0LPNA362O8XXtyTpco+F4PjYQUhY3eHy0RfjXPV8N3/ZZ5MU+RsNTYMl5QZlpjYDKBvFrtShchSysQp4CfXEzxbAtVDTlWJsHpPrBtQZerAxRvaBbgCz+vnePDhaThM1fWsuQp9BGa/++l50CjloGJg5I2rw3inBI8rfU0JllH755YSqHvXpF1eqKtcbNyZ403Nd3LEzxYF0fjIEvSm3tJ74Uh2FBSWLzRmoFZW+COBfKG9jTeYnG2cCs4vQjly6lMWQVNpDdsOno+IqdVneOxGV+Zrt3Ps4Oo4yWCRj2HBUAHUa8O4pIS6sDRzRVFvAj3akuO6F7lekKHE+JDzJ8laHD63r5rKVXdy6LcneROEGAwAJZ42zWFJugjLqkwZxlGLQ4zFkq1tqRAUIQQ26B8nuuo9H5TYMlVyGoxgex2ZUvCAbZwEf43CluI6K3fyM7HEfULGPjiL0GTJlWf30vegUctByMkU3VQGNr84Ls7DMOMJ4OBL+uN/mHau7efCAjfPK0CUekIak4J69ad62ups3PdfFXbvS7OsRbR7k7Rw2Nd45OUipqZEWMrSy3c0nW3M4mIYKfGbjOQ6vGkhUEHF/ls8ZqBjJUKdbw+lxdAJ/JHsQ1AQ+hMrbqEMVqN0DLMtxrPWoZdpiPWFHfKpSSOCkDLWEBMDScpPvLYpy3bo427uPXAF4vt3l3Wu6efvkIB+eHjouhYkHIuZIVnW4/KvJ4ZEmh03dxREuBkDC62stLqpTq5vb48K4ZWuyLiEkkWIt8eTPa1CrIn3xgIdR05QetgJPonRc+nIKKni6YghtGU6PQ6LU7q4mu6GsAG5GTUFOJffY2g18FlUxWyxGfKpSiOGooM86/GtrLH6wKMr16+Ns6208NGh1JD/YkeLRZof3TA1x9aQAk8bAku1wEvckW7o9Hm12+GeTw+oOl5jdqwK4GGNawpSIzqdmhQ8llD3V6vBsmzsupDaoG0k/LwxcSvb7qAFY3ue1NCpJ6kqODoZWoryOpxn8snJ/+cPFuPoHgFuAE8ge05hK/3U661FG4+EitKVvv8es4ajM1oiL6ywiRpRPvpRgTcfRCucbOj0+syHO7xrSvL0+yOUTLKZHjh8PpMuVbO72+G+Ly2MtNms6PA6mhUoiK9bt2ouoqfG52WFOy2xCnfQkDx100DRqV7d7AY58wg83C8jozWZhJbA9y+tPoeIFi/u83pN5+gMGv9ownB5HD0+jvIW6Ar7johLEvgS8WKR29O33mDUc0VyNeE21xT0nl/ClTQkeOGAfWYylqSSrVe1Kt/Onuw3eNCHApXUBFpUZx0TuR2+UiI5gQ5fHilaHFW0uL3Z6NPc2FjAslQaWBh+eEeLdU4KHks7WxjxWtLlEDMpXxdyR3tL+tWRfzXFRy6/Zli8bUSstJ2a5SvNRbv4/Btme4Yxx9PAqVLp4vhwEfgz8P6C1SG3oy9j1OJrSIloTzK01taDU4K4lJdyxK8WPd6Ro7Ktyrqm8hU2dHpu6kvx0V4qlFSavrw1w5jiTuaXGiG1KXQieVBmd2+IeL8Y8VrSpKciOhCqyY5iNRQ+WBh+YFuLG2eFDIs4pIbl7T4qWtGBaVA82pcVIzgUrUZWw2Xq9m9yxCoFaXXk/vWJmGUqA16MMy2D0KIbT4wijYjM3ouQC82U5SrCov+S8bHUmWqY/NgNP3cau4bi3IV37jvqgXttPRVtVQLnRZ44zuX1HikeanKOFijO/t9iSRw6qwGFtUOeEEoNXjTM5rdJkYZnBhKB+lI7ocONJNRjbbMmOuMembo+1MY91MZedCXHYq+jVj2GvYZQQNuBDM0J8cU6Eil4iP/886PCX/XZPM4wRaE1vlpI7xXsFynjkYh3wPGpq0pfzUEvL/X2/n6uVlaF6HJUog/EhlOddCK8D3gXcSXbDthRVZ1KSpc0vomIiafpnIMOhUeRyhLwNx0MHHX121OCyAXacNzQ1dVlaYfLgAZuf7U7zTJtLKlsadeb/TWlBU0rwZItDyNAYH9KYHjFYVGYwt8RgWkRnWsSgKqDqRYIGBLTBGZWeQri0p4KZB9OCPQnBrqRge9xjc7fHnoQqjGvPthXCSA5NCXUhnU/NCnHd9BDRXkVz2+IeX9+SpMOWPdNBGfdGLPlOR+VuZFs+TaOCf/1VZHaigqQXcPQTsScFfTCGo2eu3/evNBSPoxK1WvJeBpe+XYaKbexGxTl6EwA+ALwhx3e3kp/nJRjhPI68L8TBtLAfOODw+rpAXqUdZabG2+qDXFgb4OEmJVT8dJt7SPoulxFJCcmuuGRXXPB4s1K8KsmU15ebGnUhnbqgRpWlUxXQKLNUKXuJqR3RLg9whTpetyuJe9DhqCrZNlsZjGZbEHeh25Mk+6bLj4ah6CGjrPaqKpMvzInwulqL3oW2bbbkpk1J1vYKRnsS1xUjVuQ2ETg/x3s7UQHEgfgPKnNyWp/Xgyij9CcGftL2JZfhGKzHEUZ5Gv0ZjRZUwPfUzHXJxgTUakwjR1b7LiC30WhGCRznk+sxdqcqpkb838223NAV1BaX5W94qwIab68Pctn4AM+0udzXaPNYi8OuuHc4QSyHEemh25V0O5JG4OWuo6+jnlE813p9USJ79CoQ/V3W0TQQfcm0cWpU592Tg7xvWoj6PkvYcU/yrW1J/rw/fUSXBHRPCGkjpVOZK8Uc4AnyS6XeDDxGdjHiM1H1HxvyOE5vih3jeBNwHbnHyUvAF1BG8ApULCNX/GMR8K1Mfxsyr12Eyprti4fSNc3HAMNYNhwBXduzJ+m59+61rYXzTQqVmigzNS6stTi/xmJvUvB4i8M/Dtisjrk0JMVhWcABNm7KhpBgD6R4PhYMQy4yzR4f0nnDhAD/Oy3I4jLzqKlYypN8d1uKH25P0bckKOnJfcsqzZFYig2gcjeyFW45KKOxkPz28NuMcsX73oeTULGOQg1HrgE0GI9jMvAJjo499LAWZVSezfz/d6j4x80cHfTt4Xzgq6gS+HJUPku2dq1AbR+Rb/Xs2F2OnR4x9u+IC/c3DWnryokBTq8c3MqfqcH0iM70KUHeXh9kR1ztxfpYi8MLMY/dCXGkFOBYHvBDJeNUT4noXFwX4JopQU4uN7Pun9vlSm7ZmuT27SlVQdsLS4fqgN68LuaORPLXdFQMIhsmKt36E3key6SvYIqiJ4byC1QVab7kGkCD8Tgu5+hckx52ATdw2GiA8hLuRhmPr5Ld4OjAO1Bp92Vk1y9NAneQPTU/F2M3OPrxmaFYY0p0PdnihL+7LcnPTyoZ8vJpUOeQxui1U0M0JAWbulye7/BY1eGyucujISWUPsXxYkgyxqLM1FhcbnJxncWldQHmlRo5vbiDacHXNif52e4U6SymIaRr4txqs/VjM8JcP/w9OI/c+31oqAzjYnAyyr1/poDvFCuPowS11JxtfLiovIzlWd5zUPkapcDnyC4VEOCwIlg2o7kJeLzAazV2pyqnVZqxyycEmp9td2ofPODw891pPjYjVPCUJRdWjycSCXBxnRLqbUh6bI0L1sVcNnR57Ih77E4q6b+UJ4+W+BuLRiXTRkOHSktnQanB2VUm59VYLC4zGTeASvyGLo8vbkrwQKOdPUomoT6kpy4dH9g1AtKB/Q2oYlMNXEjhhiOXx1EItSgdjWw0oVZHcg3UFPAdlOdxPX32Vs4QzPHdNCq2Uah489idqgAdb54YaL6/0ea/zQ63bk0yp0TnkrpAAYfIn6AOM6MGM6MGF9VaCAntjtIM3ZUQbOry2JXwaEwJ9qWUYHGrrfRD7VyXcTjHVZ/zBQyosHRmZ0SLT64wWVZhMiOqNtAeCEfAPw7afOXlBOtiuWUEdQ1eV2slLqix9g540KEzn9wp5sPBhcCPyH//kWLlcZSTO07RRP+KX6CSvb6BUmX7IPmPs3+gYiWFTjlHvKy+EMPRNSWs7/7YzBBrYy4HUoLPbEgwztJ51bjhfwDpmlqhqQqo3esvqlX1drZQmZ2drlI835sUHEgppfOmzJJrU1qJFic9JUjsCCWm4wglTlzw7C+zV62pKy3SoK4EjCeGdKZFdGZGDeaXGiwoNZkc1hkX0Aq6a3cmPH68M8Uvdqdps/tRBJMwOapz9aRgU8TQBrqZh4qGGsgjuZ/pIlTVbL5FYcWKcVj0e9XzIsbhxK53MvAAPgB8F2gf5LUaiTqdQxQy4iWw+ZI6i/dPC/H9jKDuR9fHuWNxlFMqRrpMQhHQoTqgUR0wmNGneM6VaiUiJSQpT+VrxDLq5j0q5zFHbZ9gS4ntKU0RL4vMuaFphA2lsh42lGhxmalRFdAZZ2lUB3XKTY0SE4KDTHeNOUqs+Ec7k6yLeeoO7edQmgZXTwxySoW5A5VUNZz0bKCUrUVp8pfgz9oV1NO577GjqCDpI+T3FO7P1yzkj5Ikd/5EBdlFi7LRisr8DKFWUPobJLsYeBPugfqejdH1ODRNQ0r5UlDX7E/NDAU2dXk8dMBmdbvL/66Lc9vCKGdVjY7xyNm5TPJYyZgMfhwm7kmebHH4ya40/25ysmfZ9kXCnFKDa5WM4yYK239kMJxC9uIuG7Ut4vMM/skWROVDnJzlvXNRwdh8ckP6C44WMoC6Uepc2aYrFaiktYY8j3UQ+CkqqNxfjcti4COo5dzBLKuPTcORYSvQOD6kT/32gggxR7Ci1WV1u8t71nbztXkRrpyYX2apj0pse7zF4Zd70jza4ijtjjyfjRFT45OzQswtNWzgBYZ3awQDVXyWLcV8F0rFfDAp4r05EVW30bf3s1HSfL/N4xjFyuNoz/Rnepb3ylGJYc+RX57FKcBXgKoBPhdGLWN3A7dRuAc3ZqUDQVnZ7QDzSw1uXxTl5Ew+x9Zujw+t6+abW5JqXu6Tk/0pwa8zUoLvXN3NX/fbxJw8vIwMGvCW+gBvqw8CtKcFw70Z00Rya4I+g1K9GipPkn26FUBNV4J5HKNYqwud5N4ISkeloL+H/h+8Zqbdd5P/zvYlwOdRe9QWIlozpjVHQVnDQ8tjJ1eY3LWkhFdXW6CpGoqvb05wzdpunm5zEb79OETCkzzX7vLVlxNc9mwX73uhmwcabWJu/gYDAKmKCL80J0JY13iyxdl/w/p4sWT2c3EW2Xdod1Dp1sVIdV8PvFzg+fvSXxykkHtdoAKyXTneL0dNzz6BynLtPciDqCnXt1EJbIsojArg68BVFHZnjNngaA9PoebTEYCTyg3uOinKjRszWxYKeLDR5oWYy3unBHn3lBDTIsNi9MY8CU+yMyF4qtXhHwcdnm13aVJbxQ0uCVrCSRUm310YYVpEZ1WHy81bk+v+tTmV73LlYOh54mdLZtrDkdmTQ6EN5XVkW+7tSUEfSKezv+BooTfhSlQtzeU53q8EvobKBH0eZfQqUbKCp5G74I1MG7ei0tqzBVprgVtRD+oHyY+xG+PIBEjXoZSrl/S8PjtqcOfiEuaVJPnRzhQdtqQhobId/9po8+4pQa6aGGRy+Pg3IDFHif482ery72aHlzpd9qcytThDKaiTsLDc4EcnRjmp3KQ5Lbh5S9Le0OU9EqwLuIWWkRbATNQTPxvPoWIcxUCgMiav4+h07Z4Yy6/I7QX0HCMXhd58ncD3UTGKXFtPBFAeRaFexUvA+1Cxkk+QPUlscub8CZQBy+f6FaPfeTEYj+Mgaq+MJb1frApo3DQ3wsIyg1u3plgTU1OV9TGPz25IcO9emysnBrhsfIB5JUbWeoxjkbgn2Z8UrImpNPnn2l1e7vaOFv0ZirMo4eRKk9sWRjljnIkj4Ac7UjzR6uycV2o83XB2xXB2MVeKuYfa33Qoy7B9WQtsI3sNx6moMvSV/V+pomZQLkd5FbdQvFT6nagVpOdQRX4VKDW0bDGNWcDtqJjKcwP0e8wbjp7dud5LnyeDpcPVk4KcXGFy2/YUv21I026rJKu1HS5rYy4/3ZXi3BqLi2pVoVx9WD+mVmE6XaXlsbHTY3XMZW2Hx0tdLo0pSbq3kE6RVC414Nwai+8sjHBSuYmQ8Mu9aX60M0W5pT16UXVw71D2ExiAKKoSNttNvZfC0sHzoRk1FV6S5b1xKDWtZ8ltHIo5Vek53t2ZY97E0Da9kqjB/3kO16LEUCI/JcDbcrRxIapS9n2oOFB/bc3G2DAcmenKs6inQ9YqyVlRg+8ujHJxXYAf7kjyeItDOpNOsych+NXuNL9vsJkW0TljnKrbOKXCZEpYyQWOFWwBLbbKSN3QpSQEN3UrlbCmdB/xn2IrmksIGWrTpS/ODTMlrKuNPRptbtqUICXoPiGk/21n0hvOitglwOk53lsN7Cjy+TyUW/4Bjnbfeypmf0JuFXRJdiNnUNgqRW8c4C7U9PwzqH1k8k0A62E/aoOmn3L05totqIK4EuCNOb5/Kqqw7v0oL6UQ+suCHTSDzdhq73bl/WFDO9PQslu0oK62Tji90uS+Rpu796RY1XF4U6K0kGzu8tjc5XFvQ5rxQZ0Ty0xOrTQ5vdJkdonB+KB2SJh3OJFApyNpslW6+ta4qoXZFvfYmRDsSXh0uZIjitaHYeuD3g2aEVV7p7xzcpASU0MCf2+0+eRLcQ6kBOND+qolZdbzdywpVAKzIKaSe6XjTxRvt/XePIcKCGYLLnZlXs9lONpQXlCkz+tphpZZK1ECRS+i0u6vQsU+xtNnr6FeJFCKX4+jCteeJ3c26j7gk6iM1Z7ckd5ygE6mDZeg8kv6JohJVFVttmncywxDjs+gbn0pJbdsSS4+s8p86Kwqa2I+BzmYFjx00OHXe9M81+4S73la9/5yZrUhYmhMDuvMiOrMLzWYX2oyI6JTG9SpDmiUWxpmRnN0oHMLUEpgUq1yxBxJW0ZCsCEl2BH32BEX7EkKGlKCgymlB+L1NRIjgVSJXZeNt/jkrDDLMmn8noQ/7U/z6ZcSNCQFloE3t8T4yEuNyTt4+8QhnrRfguQeGP2lZQ8FDbWCk8tDSJF7+dfIfLfvX0xmvles9oZQ8Yc5KI3U8ahSeoHyIPagPIvdqOBxvnGg3tfbI/v0I5fqeYjcMgBFF3ga9JCI3t8SvGJS8Ccfnxm69qTy/B2XNlvydJvDn/crCcF9SaHyPbL9qXsaqamNiKosjXEBncqARnVAoyagU2YqvdHenokjJEkhibtk6lFU5WwsU6PS4ajfU57kKOGwUdIYNXU4rdLkuukhLh8fOLTfTMKT3Lkrzc1bEjSnVc5HpaWtP63SvOT2RaV755YeJ1HmY5+eO+cVkb00+GFy135OnxM5a0bU+MvXTgjXzogWNoV0BGzu9ni0xeGxZofnO1TF7VHbD/RmIN3QfD47tF4XF6nK70+uMHlHfZArJwao67X9xL6U4Ftbk/xsd1rFUzSwdLy5UeNzvz+57DsLK46fHfF8ji2GNITu3Jm07tmb/t7EkP6R7y6MDjpPI+FJNnV5PN7i8Eyby+qYy/6kyC1mfCyTMWhllsaZ40yumhTk4jrrCIMhJDze4vDVzUlWtDpH+KuTQvraC2oCb6gL6g23LowUdm4fnyIxpCF5yTMxrpgYXHTXrtR99WF95m0Lo0waYpJX0pPsTgqebXd5ts1lVYfL9oSn6l+OVfnATLutjDjR+TUWl45XO9iV9lmLbkwJ7t6T5ic7U+xLHrkbXoWlpS+osT72p2WlPx0BtS8fn5wM+e6TUmq/3pv+1Pe2p745Oayb318YYWaB05ZcCAltjlp9WRVzWdXusr7TY19K0GqLI6UDx9I46tWusKkCvadVmpxfbXF2tcnU8NH6oklP8kizw/e2pVjR5hyZaYrSAXldrfXgh6eH3vly3O24fobvbfiMHkMebq6QGBoT/rjP/sPnNyXOnhTSuW2RSlYqNraAmCPYFld5FS9ktEj3JQVNtlAVpiNtTPqcL2JoTMgogZ1WqeQCl5SbTAzpBLI4Y46AZ9odfrorzT8O2od2ZuuNDlwxMdD8iZnht57x345HuaKQrUt9fIpPUYbWj3cm+dC00KV/3Gff8/GX4pXVAY1b5ke4sDYwrHu/isxer01pya6E2utV5V8I9ic9mjK7ttkiy+rJEK+anjES1QGNuqCSC1xYarC43GRuic6EUP/JbLaAtTGXe/am+ct+m4N9N+nOoANvmhjwbpwdvvXkCvPLgONPU3xGm6LcgVLNGQKe5Na/N9ofveGluJ7y4OMzQ7xvapCa4MgtGUrUU7zNOaw9ui8l2J3w2JPRI+12JUkBtpBZS/91DSxdI9Dzb0ZTtNzUqA4qQzElrDMprFMbUEai1NTyUnzvdiXPdbjcuzfNPw86HMhhMHr+OFdODPCNeZGn55QYb5GwV/eNhs8YoGh3YcZ4TJbwm4ebnLM/+VKcLV0e59ZYfGJmmPNrrKyu+kjSY1SSGR1SR2TPsOkRIrY0DUtXWzcE9PwSzrIhJOxNCh5tcfjrfptn2pz+RYhRm3e/tT7IN+ZFmqaE9WuE5GFjON03H58CKOqdmDEe5wG/Xt3hTvzcxgT/aXKoDGhcOTHA+6eGWFphHlNFbUOh2Zas7nB5+KDNv5sdtnZn9svtr/+Z7NEPTAvyhTlhpzqgfwP4hqaN2L6wPj4DMhyGQ0cVKX27ISlKbt2W5O7daeKOZGJE500TAry1PsjJFQah4+wJKiQ02YJ1MY8nWx0ebXbY2OXR5WRJr896AWFCSOezc8J8YGqQsKH9Fvgo0ObHNXzGEkW/GzPGI4ySP7s+5Unjj/ttvrMtyfqYKhWoCemcX23x5okBzqoyj0h+OtbodlUMZU2Hy1NtLk+3uWyPF2AsenFqpcn/nRDhtTUWmsYzmtqPY7tvNHzGGsNyR2aMRxVKhORtgLa52+OHO1L8fl+a1rQaVGFTY1GpwWtrLc6ttlhUZlA7xo1IzJEcSAu2dHs835HJLelSwj090gGFaoiWWRrvmBzkU7PCTIvo7E6IXZ2ueNeJZeZy32j4jEWG7a7MGI+pqJ23LwQ0W8CTrQ4/3ZXikSZH5V1kWlFqapxQYnBKhcmrxqnch0lhnUqrsF3QikmXq3aD259SZfYvdqrl3q1xj+bM/rWDzmaVavVmWaXJJ2aGuXyChY7GYy1O2+Mtzg3fumnXvfLP86VvOHzGIsNtOECVH98BnN/zQtyTPNXq8puGNI80OSqHoRemDjVBnRkRnRNKDRaXmcwtMRgf0qkNaoyzdEx96NJGErXbW7crabMFzbakISnYHle5IDsSHnsSgsa0IOX1KrUf6lWTMDWic+3UEO+ZorRYW23Jr/amuh466Hzu0fWpO9+9IOj9cnglAX18Bs2wPs56GY95KPmz83u/nxbwQszlj/tUTsO2hIfT293vcUgyy6FVmWSr2qDap7U6oFNhqbL6qKERMVS+RTCHupArJUlP5Xg0ppSR2J8StNhKn6PZFnS5Eq+vcmWxrpKE2pDOFRMCfGBa8FB27eoOl9t3pGKrO9ybtnaJn9RHDGfn6yqG80/j4zMkht0P7uN53A5cfNRngN0JwdNtDvc12qxoU9sIZH3C903Y0o78VdNU/kXfBRuJ2hPW65270c+xincBVJsmhnQuHR/gXZODLKswsXQVL/ndvjS/2JNubk6LL0wKa7+IpTV3/QUVw/K38PEpFiM2gc4YkCmo1Za3kkO2MOlJtsUFK1od/tXs8Hy7y8G0OCzbdyxM+TMGKWhozCs1eNOEAG8Yb7GgVBkMV8LTbQ7f357iuXZ32+SwfuMPFkf/+vEXu8XT51QO7dw+PiPAiA7DjPEYB3xWwHW6klvLSc+GRk+3uSxvdVjV4bI3oVLGR6cH/XVO/WPoMCmkc8Y4i8vGW7y62mJS6PDEaVOXx527Uvxxv40j5PMLy8xPPn5m2fIbXopz+6KSQZ7cx2dkGfFhJ6Uk4cnQupj3fk9y04Iyo7rSGrgZjlC6pes6XVa2uazucNkSFzSnBZ3u6FbFllqqIvbkCpNXV5mcXWUxI6ofSnCTqL11/7DP5t69afYkPbcupP9lbtS46ZGNiS3fObeCT80qVDjbx2f0GJXntSMk1p2N5gUnRi+dXWJ86dVV5tLzqq2CiuHinqTVlmzp9lgbUzodW7o9DqQELY5UYsi5dtjojwEqaDWl+UlNUGdOZvn41EqThaUGNUGd3l1IC8mLnR5/2mfzt0ab7XGPkKG1zIzqt79hQuD/PdbktN04O8QbJobw8TmWGDVH/9KVncyMaDzc5M60dD5bH9LfcnFdoPSiOouZEaPgcnxHqKlNY1qwOyHYm1QVsbuT6vd2R9Ltqp90piq2x0bomlraNTRVCRvQVVVsMFMVW2oqj2JmRJXPT4voTIsY1AS1o9LmJdCQFDzT5nL/ASXI3JgU6BqyOqivnB7Rv/G3ZSX//MLmpLj7pNLCOunjM0YY1QjBOU910pj0uKDGDD3a4l7W5crPVFraKa+psrh4vMXJFSodfSiN9KQqn+92JR0ZlfOUUEuzPQs+hga6pmFqaj+YoK6WdMO6UlcP6sqo5CrO8yQcSAtejHk83KSMxdZuoXZ206DE1JprgvrP5kb1Hz+8Pbnvo4tL+OGJfjzD59hl1EOLUkres6abX+xIcuXU0ORn2933tdry3YbGlDlRg7OqTM6qsjixzGBKWB+RDZoGQkg1VdqVEKyNufy3Ram0b48LEr32iwkbWrzS0v45Oaz/6OdLS5766Lq4d2qFxbd8kWGfY5zRH4UZ3vp8FwlP8rfTSrXTnoydtDsh3t9qiytcSa2lQ31IZ26JwbJKkxPLTKZHdCaHlYBOQM9PRGcwOEKpjLU5kt0Jj5e7PdbFPF6MuezOJJD1zjfRgJChpSstbfnUiH7XKZXmQw802t03zApz/fQQfgq5z/HAmLuLr9/QzQP7Hc6uMq2Vbe7p7Y54R6fDJSkhJ/UEJQIGjLN0qgIaUyMG0yNK43NCSCly1QQ1yjIGxeonNV2gJPxSQpL2VIxEbeCkpjX7kmqnt+0Jj8aUSkvvcGRWkWQdCBlavNzSnpoS1n89r9T4x1/22x1XTArwKz+W4XOcMeYMRw9nLu9gS7fHOyYHzYcOOItabXlFSshL00LOcwTBbKsflg5hQ+3qFtBV7MLsJzbhSBXr8DJbRLpCrYTYmbiI6CsPluU4GVnBhgpLe3xqxPjz7Kj+xIMHnM4zq0z+cmrZaF9GH59hYcwajh5e/VQH2+OChguf4pQnzpnQ5ohXdzjy9SmPM1wpp9oiy96mgxUlzvNqBFQA9WCJqa2psLR/zY7qj15dH9zy9c1Je3ZU5++nlflTEp/jmmPm7j5neSfNtkeXC5fWBaw1Mbu+xZanJ1zOTgq51BZM9aSsdYSamRRR0BxDBTq7TJ09tQF9o6nxxLSI8Vx9SN9457Z44uzxQWZGDX651J+S+LwyOGYMRw/jH9jH1LIoaaG2PvjdyaXGDRsSEUtjzr6kNytsaEsTnlzQbMvagMYENCpTHkFbSKOnv7n2t5YgLA0R0LUEcCBssH9CSN8LPDcxpG8aH9I3XjUx2HrpEx326yar2dIZ5QG+utDP+vR5ZXHMGY7enL68i1Jd0JiWVFoaqztc4peO47MbEta6Lq+kxNDqW21RtS3uhbtdWV1uaVODulZqaRi9Ku/TmqZ1t9ui5UBatpQYxKdFjXh9SG8I6TT+YVmpo922z3v96aWMD+lIqXFulck1U/1sT59XLse04ejLHTuSbOwSrIo5TI4YmEBTWvByt8fedhfWxeHmBmAb8CJQAcZ58I4aOKMcakyqQio7dGZER5OSoKlzTrXFtVN8Q+Hj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+PzSuP/AzE1e5ONHe7vAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE1LTEyLTIzVDIwOjA0OjMxKzAwOjAwHarZDQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNS0xMi0yM1QyMDowNDozMSswMDowMGz3YbEAAABNdEVYdHNvZnR3YXJlAEltYWdlTWFnaWNrIDYuOS4yLTcgUTE2IHg4Nl82NCAyMDE1LTEyLTAyIGh0dHA6Ly93d3cuaW1hZ2VtYWdpY2sub3Jnbo4WPwAAAEp0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vdG1wL3ZpZ25ldHRlL2MxZDQ0ZGY2LWM1ZDYtNDkwMC04ZDBhLWQ0OWVmMzBiZGE3MS5zdmd90CehAAAAGHRFWHRUaHVtYjo6RG9jdW1lbnQ6OlBhZ2VzADGn/7svAAAAGHRFWHRUaHVtYjo6SW1hZ2U6OkhlaWdodAAyNjLFg9PDAAAAF3RFWHRUaHVtYjo6SW1hZ2U6OldpZHRoADU3Mz0hlMwAAAAZdEVYdFRodW1iOjpNaW1ldHlwZQBpbWFnZS9zdme/73BOAAAAF3RFWHRUaHVtYjo6TVRpbWUAMTQ1MDkwMTA3McPsyX0AAAAPdEVYdFRodW1iOjpTaXplADBCQpSiPuwAAABIdEVYdFRodW1iOjpVUkkAZmlsZTovLy90bXAvdmlnbmV0dGUvYzFkNDRkZjYtYzVkNi00OTAwLThkMGEtZDQ5ZWYzMGJkYTcxLnN2Z4N+SbEAAAAASUVORK5CYII=' style='display: block; margin-left: auto; margin-right: auto; margin-top: 7px; width: 89px;'/></span>\").width(\"120px\").css(\"float\",\"left\").css(\"padding-left\",\"0\");$('.report-name').css(\"font-weight\",\"bold\");"+"\n"+
+// "$('.logo-content' ).remove();"+"\n"+
+// "$('#slide-out li:first-child').on('click', function(){ $('#charts-row').hide() }) ; $('#slide-out li:last-child').on('click', function(){ $('#charts-row').show() });"+"\n"+
+// "$('.charts div:nth-child(2)').remove();"+"\n"+
+ "})";
+
+ public enum suiteNameXml {
+
+ TESTNG_FAILED_XML_NAME("testng-failed.xml");
+
+ suiteNameXml(String value) {
+ this.value = value;
+ }
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ }
+
+ public synchronized static ExtentReports setReporter(String filePath, String htmlFile, Boolean isAppend) throws Exception {
+ String dbIp = DriverFactory.getConfig().getReportDBhost();
+ int dbPort = DriverFactory.getConfig().getReportDBport();
+
+ if (extent == null) {
+ extentxReporter = new ExtentXReporter(dbIp, dbPort);
+ extent = new ExtentReports();
+ initAndSetExtentHtmlReporter(filePath, htmlFile, isAppend);
+
+ if(extentxReporter.config().getReportObjectId() != null){
+ setExtentXReporter(isAppend);
+ }else{
+ extentxReporter.stop();
+ }
+ }
+ return extent;
+ }
+
+ public synchronized static void setExtentXReporter(Boolean isAppend){
+ extentxReporter.setAppendExisting(isAppend);
+ extent.attachReporter(extentxReporter);
+ }
+
+ public synchronized static void initAndSetExtentHtmlReporter(String filePath, String htmlFile, Boolean isAppend) throws Exception{
+ htmlReporter = new ExtentHtmlReporter(filePath + htmlFile);
+ setConfiguration(htmlReporter);
+ htmlReporter.setAppendExisting(isAppend);
+ extent.attachReporter(htmlReporter);
+ }
+
+ public synchronized static ExtentReports getReporter() {
+ return extent;
+ }
+
+ public static void initReporter(String filepath, String htmlFile, ITestContext context) throws Exception {
+
+ String onboardVersion = AutomationUtils.getOnboardVersion();
+ String osVersion = AutomationUtils.getOSVersion();
+ Config config = Utils.getConfig();
+ String envData = config.getUrl();
+ String suiteName = getSuiteName(context);
+
+ if(suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())){
+ if (config.getUseBrowserMobProxy())
+ setTrafficCaptue(config);
+
+ setReporter(filepath, htmlFile, true);
+ String suiteNameFromVersionInfoFile = FileHandling.getKeyByValueFromPropertyFormatFile(filepath + VERSIONS_INFO_FILE_NAME, "suiteName");
+ reporterDataDefinition(onboardVersion, osVersion, envData, suiteNameFromVersionInfoFile);
+ }else{
+ FileHandling.deleteDirectory(SetupCDTest.getReportFolder());
+ FileHandling.createDirectory(filepath);
+ setReporter(filepath, htmlFile, false);
+ reporterDataDefinition(onboardVersion, osVersion, envData, suiteName);
+ AutomationUtils.createVersionsInfoFile(filepath + VERSIONS_INFO_FILE_NAME, onboardVersion, osVersion, envData, suiteName);
+ }
+
+ }
+
+ public static void reporterDataDefinition(String onboardVersion, String osVersion, String envData, String suiteNameFromVersionInfoFile) throws Exception {
+ extent.setSystemInfo("Onboard Version", onboardVersion);
+ extent.setSystemInfo("OS Version", osVersion);
+ extent.setSystemInfo("Host Name Address", RestCDUtils.getExecutionHostAddress());
+ extent.setSystemInfo("ExecutedOn", envData);
+ extent.setSystemInfo("SuiteName", suiteNameFromVersionInfoFile);
+ }
+
+ public static String getSuiteName(ITestContext context) {
+ String suitePath = context.getSuite().getXmlSuite().getFileName();
+ if(suitePath != null){
+ File file = new File(suitePath);
+ String suiteName = file.getName();
+ return suiteName;
+ }
+ return null;
+ }
+
+ public synchronized static ExtentHtmlReporter setConfiguration(ExtentHtmlReporter htmlReporter) throws Exception {
+
+ htmlReporter.config().setTheme(Theme.STANDARD);
+ htmlReporter.config().setEncoding("UTF-8");
+ htmlReporter.config().setProtocol(Protocol.HTTPS);
+ htmlReporter.config().setDocumentTitle("SDC Automation Report");
+ htmlReporter.config().setChartVisibilityOnOpen(true);
+// htmlReporter.config().setReportName(AutomationUtils.getATTVersion());
+ htmlReporter.config().setReportName("SDC Automation Report");
+ htmlReporter.config().setChartVisibilityOnOpen(false);
+ htmlReporter.config().setJS(icon);
+ return htmlReporter;
+ }
+
+ public static void closeReporter(){
+ extent.flush();
+ }
+
+ public static void setTrafficCaptue(Config config) {
+ boolean mobProxyStatus = config.getUseBrowserMobProxy();
+ if (mobProxyStatus){
+ config.setCaptureTraffic(true);;
+ }
+ }
+}
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java
new file mode 100644
index 0000000000..0523647c16
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java
@@ -0,0 +1,114 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.UUID;
+
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+import com.aventstack.extentreports.ExtentTest;
+import com.aventstack.extentreports.MediaEntityBuilder;
+import com.aventstack.extentreports.Status;
+import com.aventstack.extentreports.markuputils.ExtentColor;
+import com.aventstack.extentreports.markuputils.Markup;
+import com.aventstack.extentreports.markuputils.MarkupHelper;
+
+public class ExtentTestActions {
+
+ public static void log(Status logStatus, Markup mark){
+ ExtentTest test = ExtentTestManager.getTest();
+ test.log(logStatus, mark);
+ }
+
+ public static void log(Status logStatus, String message){
+ ExtentTest test = ExtentTestManager.getTest();
+ test.log(logStatus, message);
+ }
+
+ public static void log(Status logStatus, String message, String duration){
+ log(logStatus, message + addDurationTag(duration));
+ }
+
+ public static void log(Status logStatus, Throwable throwabel){
+ ExtentTest test = ExtentTestManager.getTest();
+ test.log(logStatus, throwabel);
+ }
+
+ public static void addTag(Status logStatus, String message){
+ Markup m = null;
+ switch(logStatus){
+ case PASS:
+ m = MarkupHelper.createLabel(message, ExtentColor.GREEN);
+ break;
+ case FAIL:
+ m = MarkupHelper.createLabel(message, ExtentColor.RED);
+ break;
+ case SKIP:
+ m = MarkupHelper.createLabel(message, ExtentColor.BLUE);
+ break;
+ case FATAL:
+ m = MarkupHelper.createLabel(message, ExtentColor.BROWN);
+ break;
+ default:
+ break;
+ }
+
+ if (m != null){
+ log(logStatus, m);
+ }
+ }
+
+ public static String addScreenshot(Status logStatus, String screenshotName, String message) throws IOException{
+ String imageFilePath = null;
+ String uuid = UUID.randomUUID().toString();
+ String[] stringArray = uuid.split("-");
+ screenshotName = screenshotName + "-" + stringArray[stringArray.length - 1];
+ try {
+ File imageFile = GeneralUIUtils.takeScreenshot(screenshotName, SetupCDTest.getScreenshotFolder());
+ imageFilePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFile.toURI()).getPath();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ ExtentTest test = ExtentTestManager.getTest();
+ test.log(logStatus, message, MediaEntityBuilder.createScreenCaptureFromPath(imageFilePath).build());
+ return imageFilePath;
+ }
+
+ private static String addDurationTag(String duration){
+ return "<td width=\"80px\">" + duration + "</td>";
+ }
+
+ public static String addLinkTag(String fileName, String pathToFile){
+ return String.format("<a download=\"%s\" href=\"%s\">HAR file</a>", fileName, pathToFile);
+ }
+
+ public static void addFileToReportAsLink(File harFile, String pathToFileFromReportDirectory, String message) {
+ log(Status.INFO, message, addLinkTag(harFile.getName(), pathToFileFromReportDirectory));
+ }
+
+
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java
new file mode 100644
index 0000000000..b5ed1ea498
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.util.HashMap;
+
+import com.aventstack.extentreports.ExtentReports;
+import com.aventstack.extentreports.ExtentTest;
+
+public class ExtentTestManager {
+
+ private static HashMap<Long, ExtentTest> extentTestMap = new HashMap<Long, ExtentTest>();
+ private static ExtentReports extent = ExtentManager.getReporter();
+
+ public static synchronized ExtentTest getTest() {
+ return extentTestMap.get(Thread.currentThread().getId());
+ }
+
+ public static synchronized void endTest() {
+// extent.endTest(extentTestMap.get(Thread.currentThread().getId()));
+ extent.flush();
+ }
+
+ public static synchronized ExtentTest startTest(String testName) {
+ return startTest(testName, "");
+ }
+
+ public static synchronized ExtentTest startTest(String testName, String desc) {
+ ExtentTest test = extent.createTest(testName, desc);
+ extentTestMap.put(Thread.currentThread().getId(), test);
+
+ return test;
+ }
+
+ public static synchronized <T> void assignCategory(Class<T> clazz){
+ String[] parts = clazz.getName().split("\\.");
+ String lastOne1 = parts[parts.length-1];
+ String lastOne2 = parts[parts.length-2];
+ getTest().assignCategory(lastOne2 + "-" + lastOne1);
+ }
+}
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/MobProxy.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/MobProxy.java
new file mode 100644
index 0000000000..78cf2709af
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/MobProxy.java
@@ -0,0 +1,103 @@
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.ProxySelector;
+import java.net.SocketAddress;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.slf4j.LoggerFactory;
+
+import com.aventstack.extentreports.ExtentTest;
+import com.github.markusbernhardt.proxy.ProxySearch;
+import com.github.markusbernhardt.proxy.ProxySearch.Strategy;
+import com.github.markusbernhardt.proxy.util.PlatformUtil;
+import com.github.markusbernhardt.proxy.util.PlatformUtil.Platform;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import net.lightbody.bmp.BrowserMobProxyServer;
+
+public class MobProxy {
+
+ private static HashMap<Long, BrowserMobProxyServer> mobProxyServerMap = new HashMap<Long, BrowserMobProxyServer>();
+ public static InetSocketAddress localProxyAddress = getProxy();
+
+ public static InetSocketAddress getProxy(){
+ setLogger();
+
+ ProxySearch proxySearch = new ProxySearch();
+// proxySearch.addStrategy(Strategy.JAVA);
+// proxySearch.addStrategy(Strategy.BROWSER);
+// proxySearch.addStrategy(Strategy.OS_DEFAULT);
+// proxySearch.addStrategy(Strategy.ENV_VAR);
+ if (PlatformUtil.getCurrentPlattform() == Platform.WIN) {
+ proxySearch.addStrategy(Strategy.IE);
+ proxySearch.addStrategy(Strategy.FIREFOX);
+ proxySearch.addStrategy(Strategy.JAVA);
+ } else if (PlatformUtil.getCurrentPlattform() == Platform.LINUX) {
+ proxySearch.addStrategy(Strategy.GNOME);
+ proxySearch.addStrategy(Strategy.KDE);
+ proxySearch.addStrategy(Strategy.FIREFOX);
+ proxySearch.addStrategy(Strategy.ENV_VAR);
+ return null;
+ } else {
+ proxySearch.addStrategy(Strategy.OS_DEFAULT);
+ }
+ ProxySelector proxySelector = proxySearch.getProxySelector();
+
+ ProxySelector.setDefault(proxySelector);
+ URI home = URI.create("http://www.google.com");
+ System.out.println("ProxySelector: " + proxySelector);
+ System.out.println("URI: " + home);
+ List<Proxy> proxyList = proxySelector.select(home);
+ String host = null;
+ String port = null;
+ if (proxyList != null && !proxyList.isEmpty()) {
+ for (Proxy proxy : proxyList) {
+ System.out.println(proxy);
+ SocketAddress address = proxy.address();
+ if (address instanceof InetSocketAddress) {
+ host = ((InetSocketAddress) address).getHostName();
+ port = Integer.toString(((InetSocketAddress) address).getPort());
+ System.setProperty("http.proxyHost", host);
+ System.setProperty("http.proxyPort", port);
+ }
+ }
+ }
+ InetSocketAddress address = new InetSocketAddress(host, Integer.parseInt(port));
+ return address;
+ }
+
+ // set logger for all classes connected to MobProxy
+ public static void setLogger() {
+ LoggerContext lc = (LoggerContext) LoggerFactory. getILoggerFactory();
+// lc.getLogger("ROOT").setLevel(Level.DEBUG);
+ for(Logger logger:lc.getLoggerList()){
+ logger.setLevel(Level.INFO);
+ }
+ }
+
+ public static synchronized void setProxyServer() {
+ BrowserMobProxyServer server = new BrowserMobProxyServer();
+ server.setTrustAllServers(true);
+ if (localProxyAddress != null){
+ server.setChainedProxy(localProxyAddress);
+ server.start();
+ } else {
+ server.start();
+ // filter firefox requests to mozilla when system proxy is absent
+ server.blacklistRequests(".*mozilla.*", 200);
+ }
+ mobProxyServerMap.put(Thread.currentThread().getId(), server);
+ }
+
+ public static synchronized BrowserMobProxyServer getPoxyServer() {
+ return mobProxyServerMap.get(Thread.currentThread().getId());
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/OnboardCSVReport.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/OnboardCSVReport.java
new file mode 100644
index 0000000000..03c9b0281f
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/OnboardCSVReport.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.PrintWriter;
+
+public class OnboardCSVReport {
+
+ private StringBuilder sb;
+ private PrintWriter pw;
+
+ public OnboardCSVReport(String filepath, String filename) {
+ sb = new StringBuilder();
+ try {
+ File csvFile = new File(filepath + filename);
+ pw = new PrintWriter(csvFile);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ public StringBuilder appendStringToFile(String content) {
+ return sb.append(content + ",");
+ }
+
+ public void openNewRow() {
+ sb.append("\n");
+ }
+
+ public void writeRow(String... content) {
+ for (String str : content) {
+ appendStringToFile(str);
+ }
+ openNewRow();
+ }
+
+ public void closeFile() {
+ pw.write(sb.toString());
+ pw.close();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ReportAfterTestManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ReportAfterTestManager.java
new file mode 100644
index 0000000000..ad923d5a1a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ReportAfterTestManager.java
@@ -0,0 +1,129 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.IOException;
+
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentManager.suiteNameXml;
+import org.testng.ITestContext;
+import org.testng.ITestResult;
+
+import com.aventstack.extentreports.Status;
+
+public class ReportAfterTestManager extends ExtentTestActions {
+
+ private static String testName;
+ private static Throwable throwable;
+ private static int status;
+
+ private static void logSuccessAfterTest(){
+ final Status logStatus = Status.PASS;
+ addTag(logStatus, "Success");
+ try{
+ String message = "Finished the test with the following screenshot : ";
+ addScreenshotToReport(logStatus, testName, message);
+ }catch(Exception e){
+ log(logStatus, "SUCCESS - The following exepction occured : " + e.getMessage());
+ }
+ }
+
+ private static void logFailAfterTest(){
+ addTag(Status.FAIL, "Failure");
+ try{
+ log(Status.ERROR, "ERROR - The following exepction occured : ");
+ log(Status.ERROR, throwable);
+ String message = "Failure is described in the following screenshot : ";
+ addScreenshotToReport(Status.FAIL, testName, message);
+ }catch(Exception e){
+ log(Status.ERROR, "ERROR - The following exepction occured : " + e.getMessage());
+ }
+ }
+
+ private static void logSkipAfterTest(){
+ final Status logStatus = Status.SKIP;
+ addTag(logStatus, "Skipped");
+ try{
+ log(logStatus, "SKIP - The following exepction occured : ");
+ log(logStatus, throwable);
+ String message = "Skip is described in the following screenshot : ";
+ addScreenshotToReport(logStatus, testName, message);
+ }catch(Exception e){
+ log(logStatus, "SKIP - The following exepction occured : " + e.getMessage());
+ }
+ }
+ private static void logFatalAfterTest(){
+ final Status logStatus = Status.FATAL;
+ addTag(logStatus, "Fatal");
+ try{
+ log(logStatus, "FATAL - The following exepction occured : ");
+ log(logStatus, throwable);
+ String message = "Fatal is described in the following screenshot : ";
+ addScreenshotToReport(logStatus, testName, message);
+ }catch(Exception e){
+ log(logStatus, "FATAL - The following exepction occured : " + e.getMessage());
+ }
+ }
+
+ private static String addScreenshotToReport(Status logStatus, String testName, String message) throws IOException{
+
+ String addedValueFromDataProvider = WindowTestManager.getWindowMap().getAddedValueFromDataProvider();
+ if (addedValueFromDataProvider != null){
+ addedValueFromDataProvider = addedValueFromDataProvider.replace(":", "-");
+ testName = testName + "...." + addedValueFromDataProvider;
+ }
+
+ return addScreenshot(logStatus, testName, message);
+ }
+
+ public static void report(ITestResult result, ITestContext context){
+
+ testName = result.getName();
+ throwable = result.getThrowable();
+ status = result.getStatus();
+
+ String suiteName = ExtentManager.getSuiteName(context);
+
+ switch(status){
+ case ITestResult.SUCCESS:
+ logSuccessAfterTest();
+ break;
+
+ case ITestResult.FAILURE:
+
+ if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) {
+ logFatalAfterTest();
+ }else{
+ logFailAfterTest();
+ }
+ break;
+
+ case ITestResult.SKIP:
+ logSkipAfterTest();
+ break;
+
+ default:
+ break;
+ }
+
+ }
+
+}
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/Retry.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/Retry.java
new file mode 100644
index 0000000000..0a01da06c3
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/Retry.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import org.testng.Assert;
+import org.testng.IRetryAnalyzer;
+import org.testng.ITestResult;
+import org.testng.annotations.Test;
+
+public class Retry implements IRetryAnalyzer {
+ private int retryCount = 0;
+ private int maxRetryCount = 1;
+
+ public boolean retry(ITestResult result) {
+
+ if (retryCount < maxRetryCount) {
+ retryCount++;
+ return true;
+ }
+ return false;
+ }
+
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
new file mode 100644
index 0000000000..1838d3969d
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
@@ -0,0 +1,573 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.UUID;
+import java.util.logging.FileHandler;
+import java.util.logging.Handler;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+import org.littleshoot.proxy.impl.ClientToProxyConnection;
+import org.littleshoot.proxy.impl.ProxyToServerConnection;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.UserCredentials;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.sanity.Onboard;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentManager.suiteNameXml;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.run.StartTest;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.ITestContext;
+import org.testng.ITestResult;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.ExtentTest;
+import com.aventstack.extentreports.Status;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.LoggerContext;
+import groovyjarjarantlr.Utils;
+import net.lightbody.bmp.BrowserMobProxyServer;
+import net.lightbody.bmp.core.har.Har;
+
+public abstract class SetupCDTest extends DriverFactory {
+
+// private static final String RE_RUN = "ReRun - ";
+ private static final String RE_RUN = "<html><font color=\"red\">ReRun - </font></html>";
+ private static final String WEB_SEAL_PASSWORD = "123123a";
+
+ public SetupCDTest() {
+ LoggerContext lc = (LoggerContext) LoggerFactory. getILoggerFactory();
+ lc.getLogger("org.apache").setLevel(Level.INFO);
+ }
+
+ /**************** CONSTANTS ****************/
+ private static final String CREDENTIALS_FILE = "credentials.yaml";
+ private static final String REPORT_FILE_NAME = "SDC_UI_Extent_Report.html";
+ protected static final String REPORT_FOLDER = "." + File.separator + "ExtentReport" + File.separator;
+ protected static final String SCREENSHOT_FOLDER = REPORT_FOLDER + "screenshots" + File.separator;
+ protected static final String HAR_FILES_FOLDER_NAME = "har_files";
+ protected static final String HAR_FILES_FOLDER = REPORT_FOLDER + HAR_FILES_FOLDER_NAME + File.separator;
+
+
+ private static final String SHORT_CSV_REPORT_FILE_NAME = "ShortReport.csv";
+ private static final int NUM_OF_ATTEMPTS_TO_REFTRESH = 2;
+
+
+ /**************** PRIVATES ****************/
+ private static String url;
+ private static boolean localEnv = true;
+ private static OnboardCSVReport csvReport;
+ private static Map<?, ?> credentials;
+
+ protected static ITestContext myContext;
+
+
+ /**************** METHODS ****************/
+ public static ExtentTest getExtendTest() {
+ return ExtentTestManager.getTest();
+ }
+ public static WindowTest getWindowTest(){
+ return WindowTestManager.getWindowMap();
+ }
+
+ public OnboardCSVReport getCsvReport() {
+ return csvReport;
+ }
+
+ public static String getReportFolder() {
+ return REPORT_FOLDER;
+ }
+
+ public static String getScreenshotFolder() {
+ return SCREENSHOT_FOLDER;
+ }
+
+ public static String getHarFilesFolder() {
+ return HAR_FILES_FOLDER;
+ }
+
+
+ protected abstract UserRoleEnum getRole();
+
+ /**************** BEFORE ****************/
+
+ @BeforeSuite(alwaysRun = true)
+ public void setupBeforeSuite(ITestContext context) throws Exception {
+ RestCDUtils.deleteOnDemand();
+ myContext=context;
+ setErrorConfigurationFile();
+ setUrl();
+ ExtentManager.initReporter(getReportFolder(), REPORT_FILE_NAME, context);
+ csvReport = new OnboardCSVReport(getReportFolder(), SHORT_CSV_REPORT_FILE_NAME);
+ }
+
+ private static void setErrorConfigurationFile() {
+ if (!System.getProperty("os.name").contains("Windows")){
+ String errorConfigurationFilename = getConfig().getErrorConfigurationFile();
+ errorConfigurationFilename = errorConfigurationFilename.substring(errorConfigurationFilename.lastIndexOf("/") + 1, errorConfigurationFilename.length());
+ getConfig().setErrorConfigurationFile(FileHandling.getBasePath() + File.separator + "conf" + File.separator + errorConfigurationFilename);
+ if (new File(getConfig().getErrorConfigurationFile()).exists()){
+ System.out.println("Found error-configuration.yaml in : " + getConfig().getErrorConfigurationFile());
+ }
+ }
+ }
+
+ @BeforeMethod(alwaysRun = true )
+ public void setBrowserBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception {
+
+ boolean emptyDataProvider = method.getAnnotation(Test.class).dataProvider().isEmpty();
+ if (emptyDataProvider) {
+ System.out.println("ExtentReport instance started from BeforeMethod...");
+ String suiteName = ExtentManager.getSuiteName(context);
+ if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) {
+ ExtentTestManager.startTest(RE_RUN + method.getName());
+ }else{
+ ExtentTestManager.startTest(method.getName());
+ }
+
+ ExtentTestManager.assignCategory(this.getClass());
+ setBrowserBeforeTest(getRole());
+ } else {
+ System.out.println("ExtentReport instance started from Test...");
+ }
+
+ getConfig().setWindowsDownloadDirectory(getWindowTest().getDownloadDirectory());
+
+ if (getConfig().getCaptureTraffic()){
+ try{
+ MobProxy.getPoxyServer().newHar(method.getName() + ".har");
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**************** AFTER ****************/
+ @AfterMethod(alwaysRun = true)
+ public void quitAfterTest(ITestResult result, ITestContext context) throws Exception {
+
+ try{
+ ReportAfterTestManager.report(result, context);
+ GeneralUIUtils.closeErrorMessage();
+ }
+ finally{
+ try {
+ if (getConfig().getCaptureTraffic()){
+ addTrafficFileToReport(result);
+ }
+
+ if (result.getInstanceName().equals(Onboard.class.getName()) && result.getStatus() == ITestResult.FAILURE){
+ System.out.println("Onboarding test failed, closign browser....");
+ getExtendTest().log(Status.INFO, "Onboarding test failed, closign browser....");
+ quitDriver();
+ }
+ else if (!getUser().getRole().toLowerCase().equals(UserRoleEnum.ADMIN.name().toLowerCase())){
+ boolean navigateToHomePageSuccess = HomePage.navigateToHomePage();
+ if (!navigateToHomePageSuccess){
+ System.out.println("Navigating to homepage failed, reopening driver....");
+ getExtendTest().log(Status.INFO, "Navigating to homepage failed, reopening driver....");
+ quitDriver();
+ }
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ getExtendTest().log(Status.ERROR, "Exception:"+ e.toString());
+ }
+
+
+
+ ExtentTestManager.endTest();
+ addResultToCSV(result, context);
+// ExtentManager.closeReporter();
+ FileHandling.cleanCurrentDownloadDir();
+ }
+
+ }
+ public void addResultToCSV(ITestResult result, ITestContext context) {
+ String suiteName = ExtentManager.getSuiteName(context);
+ ExtentTest test = ExtentTestManager.getTest();
+ com.aventstack.extentreports.model.Test model = test.getModel();
+ String name = model.getName();
+ String status = model.getStatus().toString();
+ if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue()) && !(result.getStatus() == ITestResult.SUCCESS)) {
+ getCsvReport().writeRow(result.getInstanceName(), name.replace(RE_RUN,""), status);
+ }
+ }
+
+ @AfterSuite(alwaysRun = true)
+ public void afterSuite() throws Exception {
+
+ if (getConfig().getUseBrowserMobProxy()){
+ MobProxy.getPoxyServer().stop();
+ }
+
+ csvReport.closeFile();
+ RestCDUtils.deleteOnDemand();
+ }
+
+ protected static String setUrl() {
+ url = getConfig().getUrl();
+ if (url == null) {
+ String message = "no URL found";
+ System.out.println(message);
+ Assert.fail(message);
+ } else if (!url.contains("localhost") && !url.contains("127.0.0.1")) {
+ localEnv = false;
+ }
+ return url;
+ }
+
+ public static void loadCredentialsFile() throws Exception {
+ if (credentials != null){
+ return;
+ }
+ File credentialsFileRemote = new File(FileHandling.getBasePath() + File.separator + "conf" + File.separator + CREDENTIALS_FILE);
+ File credentialsFileLocal = new File(FileHandling.getConfFilesPath() + CREDENTIALS_FILE);
+ File[] credentialFiles = {credentialsFileRemote, credentialsFileLocal};
+ for (File credentialsFile : credentialFiles){
+ if (credentialsFile.exists()){
+ credentials = FileHandling.parseYamlFile(credentialsFile.getAbsolutePath());
+ break;
+ }
+ }
+ }
+
+ private UserCredentials getUserCredentialsFromFile(String userRole) throws Exception {
+ @SuppressWarnings("unchecked")
+ Map<String, String> credentialsMap = (Map<String, String>) credentials.get(userRole);
+ String user = (String) credentialsMap.get("username");
+ String password = (String) credentialsMap.get("password");
+ String firstname = (String) credentialsMap.get("firstname");
+ String lastname = (String) credentialsMap.get("lastname");
+
+ return new UserCredentials(user, password, firstname, lastname, userRole);
+ }
+
+
+ public static void navigateToUrl(String url) throws Exception {
+ try {
+ System.out.println("Deleting cookies...");
+ deleteCookies();
+
+ System.out.println("Navigating to URL : " + url);
+ getDriver().navigate().to(url);
+ GeneralUIUtils.waitForLoader();
+
+ System.out.println("Zooming out...");
+ GeneralUIUtils.windowZoomOutUltimate();
+
+ }
+ catch (Exception e) {
+ String msg = "Browser is unreachable";
+ System.out.println(msg);
+ getExtendTest().log(Status.ERROR, msg);
+ Assert.fail(msg);
+ }
+ }
+ private static void deleteCookies() throws Exception {
+ getDriver().manage().deleteAllCookies();
+ Thread.sleep(1000);
+
+ int attempts = 0;
+ final int max_attempts = 3;
+
+ while (!getDriver().manage().getCookies().isEmpty() && attempts < max_attempts){
+ getExtendTest().log(Status.INFO, "Trying to delete cookies one more time - " + (attempts + 1) + "/" + max_attempts + "attempts");
+ String deleteCookiesJS = "document.cookie.split(';').forEach(function(c) { document.cookie = c.replace(/^ +/, '').replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/'); });";
+ ((JavascriptExecutor) getDriver()).executeScript(deleteCookiesJS);
+ attempts++;
+
+ if (attempts == max_attempts){
+ String msg = "Did not delete cookies, can't login as user " + WindowTestManager.getWindowMap().getUser().getRole();
+ System.out.println(msg);
+ getExtendTest().log(Status.ERROR, msg);
+ Assert.fail(msg);
+ }
+ }
+ }
+
+ protected void loginToSystem(UserRoleEnum role) throws Exception {
+ UserCredentials credentials;
+ if (localEnv){
+ loginToSimulator(role);
+ credentials = new UserCredentials(role.getUserId(), WEB_SEAL_PASSWORD, role.getFirstName(), role.getLastName(), role.name());
+ }
+ else{
+ credentials = getUserFromFileByRole(role);
+ sendUserAndPasswordKeys(credentials);
+ WebElement submitButton = GeneralUIUtils.getWebElementBy(By.name("btnSubmit"), 30);
+ submitButton.click();
+ WebElement buttonOK = GeneralUIUtils.getWebElementBy(By.name("successOK"), 30);
+ Assert.assertTrue(buttonOK.isDisplayed(), "OK button is not displayed.");
+ buttonOK.click();
+ }
+ GeneralUIUtils.ultimateWait();
+ getWindowTest().setUser(credentials);
+ }
+ protected UserCredentials getUserFromFileByRole(UserRoleEnum role) throws Exception {
+ loadCredentialsFile();
+ return getUserCredentialsFromFile(role.name().toLowerCase());
+ }
+ private void goToHomePage(UserRoleEnum role) throws Exception {
+ try {
+ getWindowTest().setRefreshAttempts(getWindowTest().getRefreshAttempts() == 0 ? NUM_OF_ATTEMPTS_TO_REFTRESH : getWindowTest().getRefreshAttempts());
+ if (!role.equals(UserRoleEnum.ADMIN)) {
+
+ WebElement closeButton = GeneralUIUtils.getClickableButtonBy(By.className("sdc-welcome-close"), 10);
+ if (closeButton != null){
+ closeButton.click();
+ }
+
+ if (!GeneralUIUtils.isElementVisibleByTestId(DataTestIdEnum.MainMenuButtons.HOME_BUTTON.getValue()))
+ {
+ restartBrowser(role);
+ }
+ }
+ }
+ catch (Exception e) {
+ restartBrowser(role);
+ }
+ }
+ private void restartBrowser(UserRoleEnum role) throws Exception {
+ getWindowTest().setRefreshAttempts(getWindowTest().getRefreshAttempts() - 1);
+ if (getWindowTest().getRefreshAttempts() <= 0) {
+ System.out.println("ERR : Something is wrong with browser!");
+ Assert.fail("ERR : Something is wrong with browser!");
+ }
+ System.out.println("Trying again...");
+ getExtendTest().log(Status.INFO, "Trying again...");
+ getExtendTest().log(Status.INFO, String.format("%s attempt(s) left", getWindowTest().getRefreshAttempts() ));
+ System.out.println(String.format("%s attempt(s) left", getWindowTest().getRefreshAttempts() ));
+
+ reloginWithNewRole(role);
+ }
+
+ public void loginToSimulator(UserRoleEnum role){
+ WebDriver driver = GeneralUIUtils.getDriver();
+ WebDriverWait wait = new WebDriverWait(driver, 30);
+
+ wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//*[@method='" + "post" + "']"))));
+
+ WebElement userIdTextbox = GeneralUIUtils.getWebElementBy(By.name("userId"));
+ userIdTextbox.sendKeys(role.getUserId());
+ WebElement passwordTextbox = GeneralUIUtils.getWebElementBy(By.name("password"));
+ passwordTextbox.sendKeys(WEB_SEAL_PASSWORD);
+
+ wait.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.xpath("//*[@value='" + "Login" + "']")))).click();
+ }
+
+ private void sendUserAndPasswordKeys(UserCredentials userId) {
+ System.out.println("Login as user : " + userId.getUserId());
+ WebElement userNameTextbox = GeneralUIUtils.getWebElementBy(By.name("userid"));
+ userNameTextbox.sendKeys(userId.getUserId());
+ WebElement passwordTextbox = GeneralUIUtils.getWebElementBy(By.name("password"));
+ passwordTextbox.sendKeys(userId.getPassword());
+ }
+
+ public void loginWithUser(UserRoleEnum role) {
+ try {
+ getExtendTest().log(Status.INFO, String.format("Login as user %s", role.name().toUpperCase()));
+ loginToSystem(role);
+ goToHomePage(role);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ finally{
+ getWindowTest().setPreviousRole(getWindowTest().getUser().getRole());
+ }
+ }
+
+ private void setUser(UserRoleEnum role) {
+ User user = new User();
+ user.setUserId(role.getUserId());
+ user.setFirstName(role.getFirstName());
+ user.setRole(role.name());
+ user.setLastName(role.getLastName());
+
+ getWindowTest().setUser(user);
+ }
+
+ public User getUser() {
+ return getWindowTest().getUser();
+ }
+
+ private void setBrowserBeforeTest(UserRoleEnum role) {
+ System.out.println(String.format("Setup before test as %s.", role.toString().toUpperCase() ));
+ try {
+ System.out.println("Previous role is : " + getWindowTest().getPreviousRole() + " ; Current role is : " + role.name());
+ if (!getWindowTest().getPreviousRole().toLowerCase().equals(role.name().toLowerCase())){
+ System.out.println("Roles are different, navigate and login");
+ navigateAndLogin(role);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void navigateAndLogin(UserRoleEnum role) throws Exception {
+ getWindowTest().setRefreshAttempts(getWindowTest().getRefreshAttempts() != 0 ? getWindowTest().getRefreshAttempts() : 0);
+ setUser(role);
+ navigateToUrl(url);
+ loginWithUser(role);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public User getUser(UserRoleEnum role) {
+ User user = new User();
+ user.setUserId(role.getUserId());
+ user.setFirstName(role.getFirstName());
+ user.setLastName(role.getLastName());
+ user.setRole(role.name());
+ return user;
+ }
+
+ protected void reloginWithNewRole(UserRoleEnum role) throws Exception {
+ System.out.println(String.format("Setup before relogin as %s", role.toString().toUpperCase()));
+ navigateAndLogin(role);
+ }
+
+ public static void setLocalUrl(UserRoleEnum role) {
+ switch (role) {
+ case ADMIN: {
+ url = "http://localhost:8181/sdc1/proxy-admin1#/dashboard";
+ break;
+ }
+ case DESIGNER: {
+ url = "http://localhost:8181/sdc1/proxy-designer1#/dashboard";
+ break;
+ }
+ case GOVERNOR: {
+ url = "http://localhost:8181/sdc1/proxy-governor1#/dashboard";
+ break;
+ }
+ case OPS: {
+ url = "http://localhost:8181/sdc1/proxy-ops1#/dashboard";
+ break;
+ }
+ case TESTER: {
+ url = "http://localhost:8181/sdc1/proxy-tester1#/dashboard";
+ break;
+ }
+ case PRODUCT_MANAGER1: {
+ url = "http://localhost:8181/sdc1/proxy-pm1#/dashboard";
+ break;
+ }
+ case PRODUCT_MANAGER2: {
+ url = "http://localhost:8181/sdc1/proxy-pm2#/dashboard";
+ break;
+ }
+ case PRODUCT_STRATEGIST1: {
+ url = "http://localhost:8181/sdc1/proxy-ps1#/dashboard";
+ break;
+ }
+ case PRODUCT_STRATEGIST2: {
+ url = "http://localhost:8181/sdc1/proxy-ps2#/dashboard";
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+
+ public void addTrafficFileToReport(ITestResult result) {
+ try {
+ // Get the HAR data
+ Har har = MobProxy.getPoxyServer().getHar();
+ String shortUUID = UUID.randomUUID().toString().split("-")[0];
+ File harFile = new File(getHarFilesFolder() + result.getName() + shortUUID + ".har");
+ new File(getHarFilesFolder()).mkdirs();
+
+ har.writeTo(harFile);
+
+ String pathToFileFromReportDirectory = HAR_FILES_FOLDER_NAME + File.separator + harFile.getName();
+ ExtentTestActions.addFileToReportAsLink(harFile, pathToFileFromReportDirectory, "File with captured traffic");
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ }
+
+ /*
+ * * Start section of test in ExtentReport with DataProvider parameters,
+ * should be started from test method, see example in onboardVNFTest
+ */
+ public void setLog(String fromDataProvider) {
+
+ String suiteName = ExtentManager.getSuiteName(myContext);
+ if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) {
+ ExtentTestManager.startTest(RE_RUN +Thread.currentThread().getStackTrace()[2].getMethodName() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + fromDataProvider);
+ }else{
+ ExtentTestManager.startTest(Thread.currentThread().getStackTrace()[2].getMethodName() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + fromDataProvider);
+ }
+
+
+
+ getWindowTest().setAddedValueFromDataProvider(fromDataProvider);
+ ExtentTestManager.assignCategory(this.getClass());
+ setBrowserBeforeTest(getRole());
+ }
+
+
+
+ /**************** MAIN ****************/
+ public static void main(String[] args) {
+ System.out.println("---------------------");
+ System.out.println("running test from CLI");
+ System.out.println("---------------------");
+
+ String attsdcFilePath = FileHandling.getBasePath() + File.separator + "conf" + File.separator + "attsdc.yaml";
+ System.setProperty("config.resource", attsdcFilePath);
+ System.out.println("attsdc.yaml file path is : " + attsdcFilePath);
+
+ String filepath = FileHandling.getBasePath() + File.separator + "Files" + File.separator;
+ System.setProperty("filepath", filepath);
+ System.out.println("filepath is : " + System.getProperty("filepath"));
+
+ Object[] testSuitsList = FileHandling.filterFileNamesFromFolder(FileHandling.getBasePath() + File.separator + "testSuites", ".xml");
+ if (testSuitsList != null) {
+ System.out.println(String.format("Found %s testSuite(s)", testSuitsList.length));
+ args = Arrays.copyOf(testSuitsList, testSuitsList.length, String[].class);
+ StartTest.main(args);
+ }
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/TestFtp.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/TestFtp.java
new file mode 100644
index 0000000000..0268c69f59
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/TestFtp.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import org.openqa.selenium.remote.internal.ApacheHttpClient;
+
+public class TestFtp {
+
+ public static void main(String[] args) throws IOException {
+ // TODO Auto-generated method stub
+ AttFtpClient instance = AttFtpClient.getInstance();
+
+ String server = "135.177.130.113";
+ int port = 2121;
+ String user = "admin";
+ String pass = "admin";
+ AttFtpClient.getInstance().init(server, port, user, pass);
+
+ try {
+ AttFtpClient.getInstance().retrieveListOfFile();
+
+ File retrieveLastModifiedFileFromFTP = instance.retrieveLastModifiedFileFromFTP();
+ String content = new String(Files.readAllBytes(Paths.get(retrieveLastModifiedFileFromFTP.getPath())), StandardCharsets.UTF_8);
+// instance.deleteFilesFromFTPserver();
+ System.out.println(content);
+ readFile(retrieveLastModifiedFileFromFTP);
+
+ } finally {
+ instance.terminateClient();
+ }
+
+
+
+
+
+
+
+ }
+ public static void readFile(File retrieveLastModifiedFileFromFTP) {
+
+ StringBuilder sb = new StringBuilder();
+ BufferedReader br = null;
+ try {
+ br = new BufferedReader(new FileReader(retrieveLastModifiedFileFromFTP.getPath()));
+ String line;
+ while ((line = br.readLine()) != null) {
+ if (sb.length() > 0) {
+ sb.append("\n");
+ }
+ sb.append(line);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ if (br != null) {
+ br.close();
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+ String contents = sb.toString();
+ System.out.println(contents);
+
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java
new file mode 100644
index 0000000000..5a95df39f8
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java
@@ -0,0 +1,164 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.UUID;
+
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openqa.selenium.Platform;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.firefox.FirefoxProfile;
+import org.openqa.selenium.remote.CapabilityType;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.remote.LocalFileDetector;
+import org.openqa.selenium.remote.RemoteWebDriver;
+
+import net.lightbody.bmp.BrowserMobProxyServer;
+import net.lightbody.bmp.client.ClientUtil;
+import net.lightbody.bmp.proxy.CaptureType;
+
+public class WebDriverThread {
+
+ public static final String AUTOMATION_DOWNLOAD_DIR = "automationDownloadDir";
+ private WebDriver webdriver;
+ private FirefoxProfile firefoxProfile;
+ public static final String SELENIUM_NODE_URL = "http://%s:%s/wd/hub";
+
+ public WebDriverThread(Config config) {
+ initDriver(config);
+ webdriver.manage().window().maximize();
+ }
+
+ public WebDriver getDriver() throws Exception {
+ return webdriver;
+ }
+
+ public void quitDriver() {
+ if (webdriver != null) {
+ webdriver.quit();
+ webdriver = null;
+ }
+ }
+
+
+ public void initDriver(Config config){
+ try {
+ boolean remoteTesting = config.isRemoteTesting();
+ if (!remoteTesting) {
+ boolean mobProxyStatus = config.getUseBrowserMobProxy();
+ if (mobProxyStatus){
+ setWebDriverWithMobProxy();
+ } else {
+ System.out.println("Opening LOCAL browser");
+ DesiredCapabilities cap = new DesiredCapabilities();
+
+ cap = DesiredCapabilities.firefox();
+ cap.setBrowserName("firefox");
+ cap.setCapability(FirefoxDriver.PROFILE, initFirefoxProfile());
+
+ firefoxProfile.setPreference("network.proxy.type", 2);
+ firefoxProfile.setPreference("network.proxy.autoconfig_url", "http://emea-auto.proxy.att.com:8001/");
+ firefoxProfile.setPreference("network.proxy.no_proxies_on", "localhost");
+
+ webdriver = new FirefoxDriver(cap);
+ }
+ } else {
+ System.out.println("Opening REMOTE browser");
+ String remoteEnvIP = config.getRemoteTestingMachineIP();
+ String remoteEnvPort = config.getRemoteTestingMachinePort();
+
+ DesiredCapabilities cap = new DesiredCapabilities();
+ cap = DesiredCapabilities.firefox();
+ cap.setPlatform(Platform.ANY);
+ cap.setBrowserName("firefox");
+
+ String remoteNodeUrl = String.format(SELENIUM_NODE_URL, remoteEnvIP, remoteEnvPort);
+ RemoteWebDriver remoteWebDriver = new RemoteWebDriver(new URL(remoteNodeUrl), cap);
+ remoteWebDriver.setFileDetector(new LocalFileDetector());
+ webdriver = remoteWebDriver;
+ }
+
+
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private FirefoxProfile initFirefoxProfile() {
+ firefoxProfile = new FirefoxProfile();
+ firefoxProfile.setPreference("browser.download.folderList",2);
+ firefoxProfile.setPreference("browser.download.manager.showWhenStarting",false);
+ firefoxProfile.setPreference("browser.download.dir", getDownloadDirectory());
+ firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/octet-stream, application/xml, text/plain, text/xml, image/jpeg");
+ return firefoxProfile;
+ }
+
+ private String getDownloadDirectory() {
+ String downloadDirectory = FileHandling.getBasePath() + File.separator + AUTOMATION_DOWNLOAD_DIR + UUID.randomUUID().toString().split("-")[0] + File.separator;
+ File dir = new File(downloadDirectory);
+ if(!dir.exists()) {
+ dir.mkdirs();
+ }
+ return dir.getAbsolutePath();
+ }
+
+ public FirefoxProfile getFirefoxProfile() {
+ return firefoxProfile;
+ }
+
+ private void setWebDriverWithMobProxy(){
+ WebDriver driver = null;
+ MobProxy.setProxyServer();
+ BrowserMobProxyServer proxyServer = MobProxy.getPoxyServer();
+
+ firefoxProfile = new FirefoxProfile();
+ firefoxProfile.setPreference("browser.download.folderList",2);
+ firefoxProfile.setPreference("browser.download.manager.showWhenStarting",false);
+ firefoxProfile.setPreference("browser.download.dir", getDownloadDirectory());
+ firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/octet-stream, application/xml, text/plain, text/xml, image/jpeg");
+ firefoxProfile.setAcceptUntrustedCertificates(true);
+ firefoxProfile.setAssumeUntrustedCertificateIssuer(true);
+// firefoxProfile.setPreference("network.proxy.http", "localhost");
+// firefoxProfile.setPreference("network.proxy.http_port", proxyServer.getPort());
+// firefoxProfile.setPreference("network.proxy.ssl", "localhost");
+// firefoxProfile.setPreference("network.proxy.ssl_port", proxyServer.getPort());
+// firefoxProfile.setPreference("network.proxy.type", 1);
+// firefoxProfile.setPreference("network.proxy.no_proxies_on", "");
+
+ DesiredCapabilities capabilities = new DesiredCapabilities();
+
+ capabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
+ capabilities.setCapability(CapabilityType.PROXY, ClientUtil.createSeleniumProxy(proxyServer));
+ capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
+
+ webdriver = new FirefoxDriver(capabilities);
+ proxyServer.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT, CaptureType.REQUEST_COOKIES, CaptureType.REQUEST_BINARY_CONTENT,
+ CaptureType.REQUEST_HEADERS, CaptureType.RESPONSE_COOKIES, CaptureType.RESPONSE_HEADERS, CaptureType.RESPONSE_BINARY_CONTENT);
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTest.java
new file mode 100644
index 0000000000..8df3c596fe
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTest.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.File;
+
+import org.openecomp.sdc.be.model.User;
+
+public class WindowTest {
+
+ public WindowTest(){
+ refreshAttempts = 0;
+ previousRole = "";
+ addedValueFromDataProvider = null;
+ try {
+ downloadDirectory = DriverFactory.getDriverFirefoxProfile().getStringPreference("browser.download.dir", null) + File.separator;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private int refreshAttempts;
+ private String previousRole;
+ private User user;
+ private String addedValueFromDataProvider;
+ private String downloadDirectory;
+
+ public int getRefreshAttempts() {
+ return refreshAttempts;
+ }
+ public void setRefreshAttempts(int refreshAttempts) {
+ this.refreshAttempts = refreshAttempts;
+ }
+ public String getPreviousRole() {
+ return previousRole;
+ }
+ public void setPreviousRole(String previousRole) {
+ this.previousRole = previousRole;
+ }
+ public User getUser() {
+ return user;
+ }
+ public void setUser(User user) {
+ this.user = user;
+ }
+ public synchronized String getAddedValueFromDataProvider() {
+ return addedValueFromDataProvider;
+ }
+ public synchronized void setAddedValueFromDataProvider(String addedValueFromDataProvider) {
+ this.addedValueFromDataProvider = addedValueFromDataProvider;
+ }
+ public String getDownloadDirectory() {
+ return downloadDirectory;
+ }
+ public void setDownloadDirectory(String downloadDirectory) {
+ this.downloadDirectory = downloadDirectory;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTestManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTestManager.java
new file mode 100644
index 0000000000..5e5ddc4fbd
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTestManager.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.util.HashMap;
+
+import com.aventstack.extentreports.ExtentTest;
+
+public class WindowTestManager {
+
+ private static HashMap<Long, WindowTest> windowMap = new HashMap<Long, WindowTest>();
+
+ public static synchronized WindowTest getWindowMap() {
+ Long currentThreadId = Thread.currentThread().getId();
+ boolean containsKey = windowMap.containsKey(currentThreadId);
+ if (!containsKey){
+ setWindowMap(currentThreadId);
+ }
+ return windowMap.get(currentThreadId);
+ }
+
+ private static synchronized void setWindowMap(Long currentThreadId) {
+ WindowTestManager.windowMap.put(currentThreadId, new WindowTest());
+ }
+
+ public static synchronized void removeWindowTest(){
+ windowMap.remove(Thread.currentThread().getId());
+ }
+
+ public static synchronized HashMap<Long, WindowTest> getWholeMap(){
+ return windowMap;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/AdminGeneralPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/AdminGeneralPage.java
new file mode 100644
index 0000000000..98ef4318c8
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/AdminGeneralPage.java
@@ -0,0 +1,132 @@
+/*-
+ * ============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.pages;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.UserManagementTab;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+public class AdminGeneralPage extends GeneralPageElements {
+
+ public AdminGeneralPage() {
+ super();
+ }
+
+ private static UserManagementTab userManagementTab = new UserManagementTab();
+
+ public static UserManagementTab getUserManagementTab() {
+ return userManagementTab;
+ }
+
+ public static void selectCategoryManagmetTab() throws Exception {
+
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.AdminPageTabs.CATEGORY_MANAGEMENT.getValue());
+ }
+
+ public static void selectUserManagmetTab() throws Exception {
+
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.AdminPageTabs.USER_MANAGEMENT.getValue());
+ }
+
+ public static List<WebElement> getServiceCategoriesList() throws Exception {
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.SERVICE_CATEGORY_HEADER.getValue());
+ GeneralUIUtils.waitForLoader();
+ return GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.CategoryManagement.SERVICE_CATEGORY_LIST.getValue());
+ }
+
+ public static List<WebElement> getResourceCategoriesList() throws Exception {
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.RESOURCE_CATEGORY_HEADER.getValue());
+ GeneralUIUtils.waitForLoader();
+ return GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.CategoryManagement.RESOURCE_CATEGORY_LIST.getValue());
+ }
+
+ public static void createNewServiceCategory(String name) throws Exception {
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.SERVICE_CATEGORY_HEADER.getValue());
+ SetupCDTest.getExtendTest().log(Status.INFO, "Creating service...");
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.NEW_CATEGORY_BUTTON.getValue());
+ GeneralUIUtils.waitForLoader();
+ defineNewResourceCategoryName(name);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public static void selectElementFromList(List<WebElement> list, String elementToSelect) throws Exception {
+
+ for (WebElement webElement : list) {
+ if (webElement.getText().toLowerCase().equals(elementToSelect.toLowerCase())){
+ webElement.click();
+ }
+ }
+
+ }
+
+
+
+ public static void addSubCategoryToResource(List<WebElement> resourceList, String parentResource, String subCategoryName) throws Exception{
+
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.RESOURCE_CATEGORY_HEADER.getValue());
+ selectElementFromList(resourceList, parentResource);
+ SetupCDTest.getExtendTest().log(Status.INFO, "Creating...");
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.NEW_SUB_CATEGORY_BUTTON.getValue());
+ GeneralUIUtils.waitForLoader();
+ defineNewResourceCategoryName(subCategoryName);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+ GeneralUIUtils.waitForLoader();
+
+
+ }
+
+ public static void createNewResourceCategory(String name) throws Exception {
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.RESOURCE_CATEGORY_HEADER.getValue());
+ SetupCDTest.getExtendTest().log(Status.INFO, "Creating...");
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.NEW_CATEGORY_BUTTON.getValue());
+ GeneralUIUtils.waitForLoader();
+ defineNewResourceCategoryName(name);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+ GeneralUIUtils.waitForLoader();
+
+ }
+
+ public void insertPropertyDefaultValue(String value) {
+ WebElement propertyValue = GeneralUIUtils
+ .getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_VALUE.getValue());
+ propertyValue.clear();
+ propertyValue.sendKeys(value);
+ }
+
+ private static void defineNewResourceCategoryName(String name) {
+ WebElement categoryNameTextbox = getCategoryName();
+ categoryNameTextbox.clear();
+ categoryNameTextbox.sendKeys(name);
+ }
+
+ private static WebElement getCategoryName() {
+ return GeneralUIUtils.getWebElementByClassName(DataTestIdEnum.CategoryManagement.NEW_CATEGORY_NAME.getValue());
+ }
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ComponentLeftMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ComponentLeftMenu.java
new file mode 100644
index 0000000000..d795599f24
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ComponentLeftMenu.java
@@ -0,0 +1,25 @@
+/*-
+ * ============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.pages;
+
+public interface ComponentLeftMenu {
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java
new file mode 100644
index 0000000000..496c537d49
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java
@@ -0,0 +1,197 @@
+/*-
+ * ============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.pages;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.ui.Select;
+
+import com.aventstack.extentreports.Status;
+
+public class CompositionPage extends GeneralPageElements {
+
+ public CompositionPage() {
+ super();
+ }
+
+ public static UploadArtifactPopup artifactPopup() {
+ return new UploadArtifactPopup(true);
+ }
+
+ public static void searchForElement(String elementName) {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + elementName + " in the left panel");
+ WebElement searchField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionScreenEnum.SEARCH_ASSET.getValue());
+ searchField.clear();
+ searchField.sendKeys(elementName);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void showDeploymentArtifactTab() throws Exception {
+ clickOnTabTestID(DataTestIdEnum.CompositionScreenEnum.DEPLOYMENT_ARTIFACT_TAB);
+ }
+
+ public static void showInformationsTab() throws Exception {
+ clickOnTabTestID(DataTestIdEnum.CompositionScreenEnum.INFORMATION_TAB);
+ }
+
+ public static void showPropertiesAndAttributesTab() throws Exception {
+ clickOnTabTestID(DataTestIdEnum.CompositionScreenEnum.PROPERTIES_AND_ATTRIBUTES_TAB);
+ }
+
+ public static List<WebElement> getProperties() {
+ return PropertiesPage.getElemenetsFromTable();
+ }
+
+ public static List<WebElement> getDeploymentArtifacts() {
+ return getAllAddedArtifacts();
+ }
+
+ public static List<WebElement> getAllAddedArtifacts() {
+ String dataTestsId = DataTestIdEnum.CompositionScreenEnum.ARTIFACTS_LIST.getValue();
+ return GeneralUIUtils.getWebElementsListBy(By.xpath("//*[contains(@data-tests-id,'" + dataTestsId + "')]"));
+ }
+
+ public static void moveToInputsScreen() throws Exception {
+ OpenPagesMenu();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionScreenEnum.MENU_INPUTS.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ private static void OpenPagesMenu() {
+ Actions actions = new Actions(GeneralUIUtils.getDriver());
+ List<WebElement> triangleList = GeneralUIUtils.getWebElementsListByClassName(DataTestIdEnum.CompositionScreenEnum.MENU_TRIANGLE_DROPDOWN.getValue());
+ WebElement pagesMenu = triangleList.get(2);
+ actions.moveToElement(pagesMenu).perform();
+ }
+
+ public static void changeComponentVersion(CanvasManager canvasManager, CanvasElement element, String version) {
+ try{
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Changing component version to %s", version));
+ canvasManager.clickOnCanvaElement(element);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionScreenEnum.CHANGE_VERSION.getValue());
+ GeneralUIUtils.ultimateWait();
+ Select selectlist = new Select(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionScreenEnum.CHANGE_VERSION.getValue()));
+ while (selectlist.getOptions().size() == 0) {
+ selectlist = new Select(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionScreenEnum.CHANGE_VERSION.getValue()));
+ }
+ GeneralUIUtils.ultimateWait();;
+ selectlist.selectByValue(version);
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.clickSomewhereOnPage();
+ }
+ catch(Exception e){
+ throw e;
+ }
+ }
+
+ public static void clickAddArtifactButton() throws Exception{
+ clickOnTabTestID(DataTestIdEnum.CompositionScreenEnum.ADD_ARTIFACT);
+ GeneralUIUtils.getWebElementByClassName("sdc-add-artifact");
+ }
+
+ public static String getSelectedInstanceName(){
+ return GeneralUIUtils.getWebElementByTestID("selectedCompTitle").getText();
+ }
+
+ public static void showInformationArtifactTab() throws Exception {
+ clickOnTab(DataTestIdEnum.CompositionScreenEnum.INFORMATION_ARTIFACTS);
+ }
+
+ public static void showAPIArtifactTab() throws Exception {
+ clickOnTab(DataTestIdEnum.CompositionScreenEnum.API);
+ }
+
+ public static void showInformationTab() throws Exception {
+ clickOnTab(DataTestIdEnum.CompositionScreenEnum.INFORMATION);
+ }
+
+ public static void showCompositionTab() throws Exception {
+ clickOnTab(DataTestIdEnum.CompositionScreenEnum.COMPOSITION);
+ }
+
+ public static void showInputsTab() throws Exception {
+ clickOnTab(DataTestIdEnum.CompositionScreenEnum.INPUTS);
+ }
+
+ public static void showRequirementsAndCapabilitiesTab() throws Exception {
+ clickOnTab(DataTestIdEnum.CompositionScreenEnum.REQUIREMENTS_AND_CAPABILITIES);
+ }
+
+ public static List<WebElement> getOpenTabTitle() throws Exception{
+// return GeneralUIUtils.getElementsByCSS("expand-collapse span");
+ return GeneralUIUtils.getElementsByCSS("expand-collapse");
+ }
+
+ public static void clickOnTab(DataTestIdEnum.CompositionScreenEnum tabSelector) throws Exception{
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", tabSelector.name()));
+ GeneralUIUtils.getElementsByCSS(tabSelector.getValue()).get(0).click();
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickOnTabTestID(DataTestIdEnum.CompositionScreenEnum tabSelector) throws Exception{
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", tabSelector.name()));
+ GeneralUIUtils.getWebElementByTestID(tabSelector.getValue()).click();
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static CanvasElement addElementToCanvasScreen(LeftPanelCanvasItems elementName, CanvasManager vfCanvasManager) throws Exception{
+ CompositionPage.searchForElement(elementName.name());
+ return vfCanvasManager.createElementOnCanvas(elementName);
+ }
+
+ public static CanvasElement addElementToCanvasScreen(String elementName, CanvasManager vfCanvasManager) throws Exception{
+ CompositionPage.searchForElement(elementName);
+ return vfCanvasManager.createElementOnCanvas(elementName);
+ }
+
+ public static List<WebElement> getCompositionDeplymentArtifacts() {
+ return GeneralUIUtils.getWebElementsListByContainTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue());
+ }
+ public static WebElement getCustomizationUUID() throws Exception {
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionScreenEnum.CUSTOMIZATION_UUID.getValue());
+ }
+
+
+ public static List<WebElement> getCompositionEnvArtifacts(){
+ return GeneralUIUtils.getWebElementsListByContainTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ENV.getValue());
+ }
+
+ public static WebElement clickDownloadEnvArtifactComposition(String fileName) {
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ENV.getValue() + fileName);
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue() +fileName);
+ }
+
+
+
+
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java
new file mode 100644
index 0000000000..810a1f991c
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java
@@ -0,0 +1,277 @@
+/*-
+ * ============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.pages;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang.WordUtils;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.collections.Lists;
+
+import com.aventstack.extentreports.Status;
+
+public class DeploymentArtifactPage extends GeneralPageElements {
+
+ public DeploymentArtifactPage() {
+ super();
+ }
+
+ public static ResourceLeftMenu getLeftPanel() {
+ return new ResourceLeftMenu();
+ }
+
+ public static UploadArtifactPopup artifactPopup() {
+ return new UploadArtifactPopup();
+ }
+
+ protected static void addNewArtifact(ArtifactGroupTypeEnum artifactGroupType) {
+ switch (artifactGroupType) {
+ case DEPLOYMENT:
+ GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.ADD_DEPLOYMENT_ARTIFACT.getValue()).click();
+ break;
+ case INFORMATIONAL:
+ GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.ADD_INFORMATIONAL_ARTIFACT.getValue()).click();
+ break;
+ default:
+ break;
+ }
+ }
+
+ public static void clickAddNewArtifact() {
+ addNewArtifact(ArtifactGroupTypeEnum.DEPLOYMENT);
+ }
+
+ public static void clickAddAnotherArtifact() {
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.ADD_ANOTHER_ARTIFACT.getValue()).click();
+ }
+
+ public static void clickEditArtifact(String artifactLabel) {
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue() + artifactLabel).click();
+ }
+
+ public static void clickEditEnvArtifact(String artifactLabel) {
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.EDIT_PARAMETERS_OF_ARTIFACT.getValue() + artifactLabel).click();
+ }
+
+ public static void clickDeleteArtifact(String artifactLabel) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Deleting %s Artefact ",artifactLabel));
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.DELETE_ARTIFACT.getValue() + artifactLabel).click();
+ }
+
+ public static WebElement clickDownloadArtifact(String artifactLabel) {
+ WebElement downloadButton = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT.getValue() + artifactLabel);
+
+ return downloadButton;
+ }
+
+ public static void clickDownloadEnvArtifact(String envFileNameToDownload) {
+ ExtentTestActions.log(Status.INFO, String.format("Downloading the updated %s artifact for validate parameters with the response after the update...", envFileNameToDownload));
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue() + envFileNameToDownload);
+ ExtentTestActions.log(Status.INFO, String.format("%s Envartifact was downloaded successfully!", envFileNameToDownload));
+ }
+
+ public static void clickSaveEnvParameters() {
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.SAVE.getValue()).click();
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static WebElement getAddOtherArtifactButton(){
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.ADD_ANOTHER_ARTIFACT.getValue());
+ }
+
+ public static void clickOK(){
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.OK.getValue()).click();
+ GeneralUIUtils.getWebElementBy(By.className("flex-container"));
+ GeneralUIUtils.waitForAngular();
+ }
+
+ public static String getArtifactDescription(String artifactLabel) throws Exception {
+ clickOnArtifactDescription(artifactLabel); // open artifact
+ WebElement artifactDescriptionElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.GET_DEPLOYMENT_ARTIFACT_DESCRIPTION.getValue());
+ String artifactDesc = artifactDescriptionElement.getAttribute("value");
+ closeArtifactDescription(artifactLabel); // close artifact
+ return artifactDesc;
+ }
+
+ public static void closeArtifactDescription(String artifactLabel) {
+ GeneralUIUtils.clickOnElementByTestId("popover-x-button");
+ }
+
+ public static WebElement clickOnArtifactDescription(String artifactLabel) throws Exception {
+ try{
+ WebElement artifact = GeneralUIUtils.getWebElementByTestID("descriptionIcon_" + artifactLabel);
+ artifact.click();
+ GeneralUIUtils.waitForLoader();
+ return artifact;
+ }
+ catch(Exception e){
+ throw new Exception("Artifact " + artifactLabel + "is not found");
+ }
+ }
+
+ public static boolean checkElementsCountInTable(int expectedElementsCount) {
+ return GeneralPageElements.checkElementsCountInTable(expectedElementsCount + 1);
+ }
+
+ public static String[] verifyArtifactsExistInTable(String filepath, String vnfFile) throws Exception{
+ String[] artifactNamesFromZipFile = FileHandling.getArtifactsFromZip(filepath, vnfFile);
+ return verifyArtifactsExistInTable(artifactNamesFromZipFile);
+ }
+
+ public static String[] verifyArtifactsExistInTable(String[] artifactNamesFromZipFile) throws Exception{
+ if (artifactNamesFromZipFile != null){
+ checkArtifactsDisplayed(artifactNamesFromZipFile);
+ checkEnvArtifactsDisplayed();
+ }
+
+ return artifactNamesFromZipFile;
+ }
+
+ public static void checkArtifactsDisplayed(String[] artifactsFromZipFile) throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Verifying the artifacts in the table");
+ List<String> artifactList = Lists.newArrayList(artifactsFromZipFile).stream().filter(p -> !p.contains(".env")).map(p -> getVisualArtifactName(p)).collect(Collectors.toList());
+ try{
+// List<WebElement> rows = GeneralUIUtils.getElementsByCSS("div div[data-tests-id^='artifact-item'] span.ng-binding:nth-of-type(2)");
+ List<WebElement> rows = GeneralUIUtils.getElementsByCSS("div div[data-tests-id^='artifact-item'] span[data-tests-id^='artifactDisplayName']");
+ for (WebElement r : rows){
+ String artifactDisplayed = r.getAttribute("textContent").trim();
+ if (artifactList.contains(artifactDisplayed)){
+ artifactList.remove(artifactDisplayed);
+ }
+ else if (artifactDisplayed.toLowerCase().contains("license")){
+ artifactList.add(artifactDisplayed);
+ }
+ }
+ checkLicenseArtifactsDisplayed(artifactList);
+ }
+ catch(Exception e){
+ throw new Exception("Table problem");
+ }
+
+
+ if (!artifactList.isEmpty()){
+ throw new Exception(String.format("missing the following artifact(s) : %s", artifactList.toString()));
+ }
+ }
+
+ public static void checkEnvArtifactsDisplayed() throws Exception {
+ List<WebElement> envRows;
+ List<WebElement> heatRows;
+ List<WebElement> heatNetRows;
+ List<WebElement> heatVolRows;
+ int envArtifactsSize = 0;
+
+ SetupCDTest.getExtendTest().log(Status.INFO, "Verifying the HEAT_ENV artifacts in the table");
+
+ try{
+ envRows = GeneralUIUtils.getElementsByCSS("div div[data-tests-id='HEAT_ENV']");
+
+ heatRows = GeneralUIUtils.getElementsByCSS("div div[tooltip-content='HEAT']");
+ heatNetRows = GeneralUIUtils.getElementsByCSS("div div[tooltip-content='HEAT_NET']");
+ heatVolRows = GeneralUIUtils.getElementsByCSS("div div[tooltip-content='HEAT_VOL']");
+
+ envArtifactsSize = heatRows.size() + heatNetRows.size() + heatVolRows.size();
+ }
+ catch(Exception e){
+ throw new Exception("Table problem");
+ }
+
+ if (envArtifactsSize !=envRows.size()){
+ throw new Exception(String.format("some env artifacts are missing... there is %s instead of %s", envRows.size(), envArtifactsSize));
+ }
+
+ }
+
+ public static void checkLicenseArtifactsDisplayed(List<String> rowsFromTable) throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Verifying the license artifacts in the table");
+ String vfLicense = getPreparedLicense(ArtifactTypeEnum.VF_LICENSE.getType());
+ String[] split = vfLicense.split(" ");
+ vfLicense = vfLicense.replaceAll(split[0], split[0].toUpperCase());
+ if (rowsFromTable.contains(vfLicense)){
+ rowsFromTable.remove(vfLicense);
+ }
+
+ String vendorLicense = getPreparedLicense(ArtifactTypeEnum.VENDOR_LICENSE.getType());
+ if (rowsFromTable.contains(vendorLicense)){
+ rowsFromTable.remove(vendorLicense);
+ }
+
+ }
+
+ public static String getPreparedLicense(String license) {
+ return WordUtils.capitalizeFully(license.replaceAll("_", " "));
+ }
+
+
+ private static String getVisualArtifactName(String artifactName) {
+ if (artifactName.contains(".")){
+ return artifactName.substring(0, artifactName.lastIndexOf("."));
+ }
+ return artifactName;
+ }
+
+ public static void updateDescription(String newDescription, ArtifactInfo artefact) throws Exception{
+ UploadArtifactPopup artifactPopup = new UploadArtifactPopup(true);
+ DeploymentArtifactPage.clickEditArtifact(artefact.getArtifactLabel());
+ artifactPopup.insertDescription(newDescription);
+ artifactPopup.clickDoneButton();
+ }
+
+ public static List<String> getDeploymentArtifactsNamesWorkSpace() {
+ return GeneralUIUtils.getWebElementListText(GeneralUIUtils.getWebElementsListByContainTestID(DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue()));
+ }
+
+ //Get Artifact Type by Artifact Name.
+ public static String getArtifactType(String artifactName){
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.TYPE.getValue()+artifactName).getText();
+ }
+
+ public static List<String> getHeatParametersInUI(String dataTestId){
+ List<WebElement>elements;
+ List<String>Names=new ArrayList<>();
+ elements=GeneralUIUtils.getWebElementsListByContainTestID(dataTestId);
+ for (WebElement webElement : elements) {
+ String attributevalue=webElement.getAttribute("data-tests-id");
+ Names.add(attributevalue.replace("heatParameterName_", ""));
+ }
+ return Names;
+ }
+
+ public static void searchBoxEnv(String parameterName) {
+ GeneralUIUtils.getWebElementByContainsClassName("w-sdc-env-search-input").sendKeys(parameterName);
+ }
+
+ public static void clearSearchBoxEnv() {
+ GeneralUIUtils.getWebElementByContainsClassName("w-sdc-env-search-input").clear();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentPage.java
new file mode 100644
index 0000000000..5ee85e099e
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentPage.java
@@ -0,0 +1,239 @@
+/*-
+ * ============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.pages;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.DeploymentScreen;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import static org.testng.Assert.assertTrue;
+
+
+import com.aventstack.extentreports.Status;
+
+public class DeploymentPage {
+
+ public DeploymentPage() {
+ super();
+ }
+
+ public static List<WebElement> getGroupMembersList(String instanceName) {
+ List<WebElement> propertyRows = null;
+ clickOnModuleName(instanceName);
+ propertyRows = getVisibleMembers();
+ return propertyRows;
+ }
+
+ public static void clickOnModuleName(String instanceName) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", instanceName));
+ GeneralUIUtils.clickOnElementByText(instanceName);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static List<WebElement> getVisibleMembers() {
+ List<WebElement> instancesFromTable = GeneralUIUtils.getDriver().findElements(By.cssSelector("div[class^='hierarchy-module-member-list']"));
+ for (WebElement instance : instancesFromTable){
+ Object parentAttributes = GeneralUIUtils.getAllElementAttributes(instance);
+ if (!parentAttributes.toString().contains("hidden")){
+ return instance.findElements(By.cssSelector("div[class^='expand-collapse-sub-title']"));
+ }
+ }
+ return null;
+ }
+
+ public static void clickOnProperties() throws Exception{
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Properties button"));
+ GeneralUIUtils.clickOnElementByCSS(DataTestIdEnum.DeploymentScreen.BUTTON_PROPERTIES.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickOnArtifacts() throws Exception{
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Artifacts button"));
+ GeneralUIUtils.clickOnElementByCSS(DataTestIdEnum.DeploymentScreen.BUTTON_ARTIFACTS.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickOnSaveButton(){
+ clickInDeployment(DataTestIdEnum.DeploymentScreen.SAVE);
+ GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("popover-inner"));
+ }
+
+ public static void clickOnCancelButton(){
+ clickInDeployment(DataTestIdEnum.DeploymentScreen.CANCEL);
+ GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("popover-inner"));
+ }
+
+ public static void clickOnXIcon(){
+ clickInDeployment(DataTestIdEnum.DeploymentScreen.X_BUTTON);
+ GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("popover-inner"));
+ }
+
+ public static void clickOnEditIcon(){
+ clickInDeployment(DataTestIdEnum.DeploymentScreen.PENCIL_ICON);
+ }
+
+ public static void clickOnProperty(WebElement property) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s propertie ...", property.getText()));
+ property.click();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.POPUP_FORM.getValue());
+ }
+
+ private static void clickInDeployment(DataTestIdEnum.DeploymentScreen element){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s ...", element.getValue()));
+ GeneralUIUtils.clickOnElementByTestId(element.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static List<WebElement> getPropertyNames() throws Exception{
+ clickOnProperties();
+ return GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.PROPERTY_NAMES.getValue());
+ }
+
+ public static List<WebElement> getArtifactNames() throws Exception{
+ clickOnArtifacts();
+ return GeneralUIUtils.getInputElements(DataTestIdEnum.DeploymentScreen.ARTIFACT_NAME.getValue());
+ }
+
+ public static String updateModuleName(String currentModuleName, String newModuleName) throws Exception {
+ GeneralUIUtils.ultimateWait();
+ ResourceUIUtils.clickOnElementByText(currentModuleName, null);
+ GeneralUIUtils.ultimateWait();
+ clickOnEditIcon();
+ WebElement moduleNameField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentScreen.NAME_INPUT.getValue());
+ String oldModuleName = moduleNameField.getAttribute("value");
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating %s module name ...", currentModuleName));
+ moduleNameField.clear();
+ GeneralUIUtils.ultimateWait();
+ moduleNameField.sendKeys(newModuleName);
+ GeneralUIUtils.ultimateWait();
+ clickOnSaveButton();
+ String newReconstructedModuleName = reconstructModuleName(currentModuleName.split("\\.\\."), newModuleName);
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Name of element instance changed from %s to %s", currentModuleName, newReconstructedModuleName));
+ return oldModuleName;
+ }
+
+ public static String reconstructModuleName(String[] splittedName, String middleName){
+ int i = 0;
+ StringBuilder builder = new StringBuilder();
+ for(String s : splittedName) {
+ if (i == 1){
+ builder.append(middleName);
+ } else {
+ builder.append(s);
+ }
+ if (i < 2 ){
+ builder.append("..");
+ }
+ i++;
+ }
+ return builder.toString();
+ }
+
+ public static List<WebElement> getVisibleModulesService() {
+ List<WebElement> instancesFromTable = GeneralUIUtils.getDriver().findElements(By.cssSelector("div[class^='hierarchy-modules-list']"));
+ for (WebElement instance : instancesFromTable){
+ Object parentAttributes = GeneralUIUtils.getAllElementAttributes(instance);
+ if (!parentAttributes.toString().contains("hidden")){
+ return instance.findElements(By.cssSelector("span[class^='expand-collapse-title-text']"));
+ }
+ }
+ return null;
+ }
+
+ public static List<WebElement> getInstanceModulesList(String instanceName) {
+ List<WebElement> propertyRows = null;
+ ResourceUIUtils.clickOnElementByText(instanceName, null);
+ GeneralUIUtils.ultimateWait();
+ propertyRows = getVisibleModulesService();
+ return propertyRows;
+ }
+
+ public static String getGroupVersion() throws Exception{
+ return GeneralUIUtils.getElementsByCSS("div[data-tests-id='selected-module-version']").get(0).getText();
+ }
+
+ public static String getModuleID() throws Exception{
+ return GeneralUIUtils.getElementsByCSS("div[data-tests-id='selected-module-group-uuid'] span[class^='small-font']").get(0).getText();
+ }
+
+ public static Map<String, HashMap<String, String>> collectMetaDataFromUI() throws Exception{
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentViewScreen();
+ Map<String, HashMap<String, String>> deploymentViewMetaData = new HashMap<String, HashMap<String, String>>();
+ List<WebElement> moduleRowsFromTable = GeneralUIUtils.getElementsByCSS("span[class^='expand-collapse-title-text']");
+ for(WebElement moduleRow :moduleRowsFromTable){
+ HashMap<String, String> tempGroupMap = new HashMap<String, String>();
+ String moduleRowText = moduleRow.getText();
+ GeneralUIUtils.clickOnElementByText(moduleRowText);
+ tempGroupMap.put("moduleID", getModuleID());
+ tempGroupMap.put("version", DeploymentPage.getGroupVersion().split(":")[1].trim());
+ deploymentViewMetaData.put(moduleRowText.split("\\.\\.")[1], tempGroupMap);
+ GeneralUIUtils.clickOnElementByText(moduleRowText);
+ }
+ return deploymentViewMetaData;
+ }
+
+ public static void updateAndCancel(String newModuleName, DataTestIdEnum.DeploymentScreen buttonToClick){
+ WebElement moduleNameField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentScreen.NAME_INPUT.getValue());
+ String oldModuleName = moduleNameField.getAttribute("value");
+ moduleNameField.clear();
+ GeneralUIUtils.ultimateWait();
+ moduleNameField.sendKeys(newModuleName);
+ GeneralUIUtils.ultimateWait();
+ if (buttonToClick.equals(DataTestIdEnum.DeploymentScreen.X_BUTTON))
+ clickOnXIcon();
+ else
+ clickOnCancelButton();
+ }
+
+ public static String getPropertyValueFromPropertiesList(String property) throws InterruptedException{
+ List<WebElement> propertyDataElements = GeneralUIUtils.getElementsByCSS("div[class^='list-item property-data']");
+ for(WebElement propertyDataElement: propertyDataElements){
+ WebElement propertyNameElement = GeneralUIUtils.getElementfromElementByCSS(propertyDataElement, DeploymentScreen.PROPERTY_NAMES.getValue());
+ if (propertyNameElement.getText().equals(property)){
+ WebElement propertyValueElement = GeneralUIUtils.getElementfromElementByCSS(propertyDataElement, String.format("div[data-tests-id='%s']", DeploymentScreen.PROPERTY_SCHEMA_TYPE.getValue()));
+ return propertyValueElement.getText().trim().split(":")[1].trim();
+ }
+ }
+ return null;
+ }
+
+ public static List<WebElement> getPropertyErrorValidationMessdge() throws Exception{
+ List<WebElement> propertyErrorElements = GeneralUIUtils.getElementsByCSS("div[class='input-error'] span[class='ng-scope']");
+ return propertyErrorElements;
+ }
+
+ public static boolean isPropertySaveButtonDisabled(){
+ WebElement saveButtonElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.SAVE.getValue());
+ return GeneralUIUtils.isElementDisabled(saveButtonElement);
+ }
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java
new file mode 100644
index 0000000000..04e3a8bb28
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java
@@ -0,0 +1,160 @@
+/*-
+ * ============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.pages;
+
+import java.util.List;
+import java.util.function.Supplier;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+public class GeneralPageElements {
+
+ public GeneralPageElements() {
+ super();
+ }
+
+ public static ResourceLeftMenu getLeftMenu() {
+ return new ResourceLeftMenu();
+ }
+
+ public static void clickOKButton() {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the OK button");
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public static void clickCreateButton() {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the CREATE/UPDATE button.");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue());
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue());
+ ExtentTestActions.log(Status.INFO, "Succeeded.");
+ }
+
+ public static void clickCreateButton(int timeout) {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the CREATE/UPDATE button");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue(), timeout);
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue());
+ }
+
+ public static void clickUpdateButton(){
+ clickCreateButton();
+ }
+
+ public static void clickCheckinButton(String componentName) throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the CHECKIN button");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue());
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.ACCEP_TESTING_MESSAGE.getValue()).sendKeys("Checkin " + componentName);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue(), 60);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickSubmitForTestingButton(String componentName) throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the submiting for testing button");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.SUBMIT_FOR_TESTING_BUTTON.getValue());
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.SUMBIT_FOR_TESTING_MESSAGE.getValue()).sendKeys("Submit for testing " + componentName);
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue(), 60);
+ GeneralUIUtils.ultimateWait();;
+ }
+
+ public static void clickCheckoutButton() throws Exception{
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on CHECKOUT button ...");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CHECKOUT_BUTTON.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickDeleteVersionButton() throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on DELETE VERSION button ...");
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.DELETE_VERSION_BUTTON.getValue());
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.OK.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickRevertButton() throws Exception{
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on REVERT button ...");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.REVERT_BUTTON.getValue());
+ }
+
+ public static String getLifeCycleState() {
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()).getText();
+ }
+
+ public static void selectVersion(String version) {
+ GeneralUIUtils.getSelectList(version, DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static List<WebElement> getElemenetsFromTable() {
+ GeneralUIUtils.ultimateWait();;
+ return GeneralUIUtils.getElemenetsFromTable(By.className("flex-container"));
+ }
+
+ public static boolean checkElementsCountInTable(int expectedElementsCount) {
+ return checkElementsCountInTable(expectedElementsCount, () -> getElemenetsFromTable());
+ }
+
+
+ public static void clickTrashButtonAndConfirm() throws InterruptedException{
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on TRASH button ...");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.DELETE_VERSION_BUTTON.getValue());
+ clickOKButton();
+ }
+
+ public static boolean checkElementsCountInTable(int expectedElementsCount, Supplier<List<WebElement>> func) {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Checking the number of elements in the table; should be " + (expectedElementsCount - 1));
+// int maxWaitingPeriodMS = 10*1000;
+// int napPeriodMS = 200;
+// int sumOfWaiting = 0;
+// List<WebElement> elements = null;
+// boolean isKeepWaiting = false;
+// while (!isKeepWaiting) {
+// GeneralUIUtils.sleep(napPeriodMS);
+// sumOfWaiting += napPeriodMS;
+// elements = func.get();
+// isKeepWaiting = (expectedElementsCount == elements.size());
+// if (sumOfWaiting > maxWaitingPeriodMS)
+// return false;
+// }
+ GeneralUIUtils.ultimateWait();
+ return true;
+ }
+
+ public static void clickDeleteFile() throws Exception{
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on delete file X-button ...");
+ GeneralUIUtils.clickOnAreaJS(GeneralUIUtils.getWebElementBy
+ (By.cssSelector("div[class='i-sdc-form-file-upload-x-btn']")));
+ GeneralUIUtils.ultimateWait();;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GovernorOperationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GovernorOperationPage.java
new file mode 100644
index 0000000000..ff964e3a01
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GovernorOperationPage.java
@@ -0,0 +1,46 @@
+/*-
+ * ============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.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+import com.aventstack.extentreports.Status;
+
+public class GovernorOperationPage {
+
+ public GovernorOperationPage() {
+ super();
+ }
+
+ public static void approveSerivce(String serviceName) {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Approving the distrbution of the service " + serviceName);
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.APPROVE.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.APPROVE_MESSAGE.getValue())
+ .sendKeys("service " + serviceName + " tested successfuly");
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue());
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java
new file mode 100644
index 0000000000..84451dc905
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java
@@ -0,0 +1,109 @@
+/*-
+ * ============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.pages;
+
+import java.io.File;
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.MainMenuButtonsFromInsideFrame;
+import org.openecomp.sdc.ci.tests.utilities.DownloadManager;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+public class HomePage extends GeneralPageElements {
+
+ public HomePage() {
+ super();
+ }
+
+ public static void showVspRepository(){
+ GeneralUIUtils.waitForElementInVisibilityBy(By.className("ui-notification"), 30);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.MainMenuButtons.REPOSITORY_ICON.getValue());
+ }
+
+ public static boolean searchForVSP(String vspName){
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ImportVfRepository.SEARCH.getValue()).sendKeys(vspName);
+ return checkElementsCountInTable(2);
+ }
+
+ public static void importVSP(String vspName){
+ HomePage.showVspRepository();
+ boolean vspFound = HomePage.searchForVSP(vspName);
+ if (vspFound){
+ List<WebElement> elemenetsFromTable = getElemenetsFromTable();
+// GeneralUIUtils.waitForLoader();
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30);
+ WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1)));
+ findElement.click();
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.IMPORT_VSP.getValue());
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue());
+ GeneralUIUtils.waitForLoader(60*10);
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue());
+ }
+ }
+
+
+ public static boolean navigateToHomePage() {
+ try{
+ System.out.println("Searching for reporsitory icon.");
+ WebElement repositoryIcon = GeneralUIUtils.getInputElement("repository-icon");
+ if (repositoryIcon != null){
+ return true;
+ }
+ else{
+ GeneralUIUtils.ultimateWait();
+ List<WebElement> homeButtons = GeneralUIUtils.getElemenetsFromTable(By.xpath("//a[contains(.,'HOME')]"));
+ if (homeButtons.size() != 0){
+ for (WebElement home : homeButtons){
+ if (home.isDisplayed()){
+ home.click();
+ System.out.println("Clicked on home button");
+ break;
+ }
+ }
+ GeneralUIUtils.closeErrorMessage();
+ WebElement homeButton = GeneralUIUtils.getInputElement(DataTestIdEnum.MainMenuButtons.HOME_BUTTON.getValue());
+ return homeButton.isDisplayed();
+ }
+
+ }
+ }
+ catch(Exception innerException){
+ System.out.println("Can't click on home button.");
+ return false;
+ }
+ return false;
+ }
+
+ public static File downloadVspCsarToDefaultDirectory(String vspName) throws Exception {
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+ DownloadManager.downloadCsarByNameFromVSPRepository(vspName, "");
+ File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+ return latestFilefromDir;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/IconPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/IconPage.java
new file mode 100644
index 0000000000..fd9befa148
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/IconPage.java
@@ -0,0 +1,51 @@
+/*-
+ * ============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.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+public class IconPage extends GeneralPageElements {
+
+ public IconPage() {
+ super();
+ }
+
+ public static void clickOnIcon(ResourceCategoryEnum iconName) {
+ GeneralUIUtils.getWebElementByTestID(iconStringBuilder(iconName) + DataTestIdEnum.ServiceMetadataEnum.ICON.getValue())
+ .click();
+ }
+
+ private static String iconStringBuilder(ResourceCategoryEnum icon) {
+ String iconName = icon.getSubCategory();
+ String[] splitedIconName = iconName.split(" ");
+ splitedIconName[0] = splitedIconName[0].toLowerCase();
+
+ StringBuilder sb = new StringBuilder();
+ for (String word : splitedIconName) {
+ sb.append(word);
+ }
+
+ return sb.toString();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InformationalArtifactPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InformationalArtifactPage.java
new file mode 100644
index 0000000000..9916292e5b
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InformationalArtifactPage.java
@@ -0,0 +1,74 @@
+/*-
+ * ============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.pages;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+public class InformationalArtifactPage extends DeploymentArtifactPage {
+
+ public InformationalArtifactPage() {
+ super();
+ }
+
+ public static void clickAddNewArtifact() {
+ addNewArtifact(ArtifactGroupTypeEnum.INFORMATIONAL);
+ }
+
+ public static String getArtifactDescription(String artifactLabel) throws Exception {
+ InformationalArtifactPage.clickOnArtifact(artifactLabel);
+ String artifactDesc = GeneralUIUtils.getWebElementByTestID(
+ artifactLabel + DataTestIdEnum.ArtifactPageEnum.GET_INFORMATIONAL_ARTIFACT_DESCRIPTION.getValue())
+ .getText();
+ InformationalArtifactPage.clickOnArtifact(artifactLabel); // close artifact
+ return artifactDesc;
+ }
+
+ public static List<WebElement> getElemenetsFromTable() {
+ return GeneralUIUtils.getWebElementsListByTestID("InformationalArtifactRow");
+ }
+
+ public static WebElement clickOnArtifact(String artifactLabel) throws Exception {
+ try{
+ WebElement artifact = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue() + artifactLabel);
+ artifact.click();
+ GeneralUIUtils.waitForLoader();
+ return artifact;
+ }
+ catch(Exception e){
+ throw new Exception("Artifact " + artifactLabel + "is not found");
+ }
+ }
+
+
+ public static void clickDeleteArtifact(String artifactLabel) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Deleting %s Artefact ",artifactLabel));
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.DELETE_ARTIFACT.getValue() + artifactLabel).click();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InputsPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InputsPage.java
new file mode 100644
index 0000000000..b977b263a0
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InputsPage.java
@@ -0,0 +1,158 @@
+/*-
+ * ============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.pages;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InputsScreenService;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.TestException;
+
+import com.aventstack.extentreports.Status;
+
+public class InputsPage extends GeneralPageElements {
+
+ public InputsPage() {
+ super();
+
+ }
+
+ public static List<WebElement> getInstancePropertiesList(String instanceName) {
+ List<WebElement> propertyRows = null;
+ GeneralUIUtils.clickOnElementByText(instanceName);
+ GeneralUIUtils.ultimateWait();
+ propertyRows = getVisibleProperites();
+ return propertyRows;
+ }
+
+ public static List<WebElement> getVisibleProperites() {
+ List<WebElement> instancesFromTable = GeneralUIUtils.getDriver().findElements(By.cssSelector("div[class^='vf-instance-list']"));
+ for (WebElement instance : instancesFromTable){
+ Object parentAttributes = GeneralUIUtils.getAllElementAttributes(instance);
+ if (!parentAttributes.toString().contains("hidden")){
+ return instance.findElements(By.className("property-row"));
+ }
+ }
+ return null;
+ }
+
+ public static void addInputToService(String VFInstanceName, String propertyName) throws Exception{
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Adding property %s from VF instance %s to Service", propertyName, VFInstanceName));
+ List<WebElement> instaceInputs = getInstanceInputsList(VFInstanceName);
+ for(WebElement instancInput: instaceInputs){
+ String actualPropertyName = instancInput.findElement(By.className("title-text")).getText();
+ if (actualPropertyName.equals(propertyName) && clickOnVFInputCheckbox(instancInput)){
+ clickOnAddInputButton();
+ }
+ }
+ }
+
+ public static List<WebElement> getInstanceInputsList(String instanceName) {
+ List<WebElement> inputRows = null;
+ GeneralUIUtils.clickOnElementByText(instanceName);
+ GeneralUIUtils.ultimateWait();
+ inputRows = getVisibleInputs(inputRows);
+ return inputRows;
+ }
+
+ public static List<WebElement> getVisibleInputs(List<WebElement> inputRows) {
+ List<WebElement> instancesFromTable = GeneralUIUtils.getDriver().findElements(By.cssSelector("div[class^='vf-instance-list']"));
+ for (WebElement instance : instancesFromTable){
+ Object parentAttributes = GeneralUIUtils.getAllElementAttributes(instance);
+ if (!parentAttributes.toString().contains("hidden")){
+ inputRows = instance.findElements(By.className("input-row"));
+ break;
+ }
+ }
+ return inputRows;
+ }
+
+ public static void clickOnAddInputButton(){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Add Input aka Greater than symbol button"));
+ GeneralUIUtils.clickOnElementByTestId(InputsScreenService.ADD_SELECTED_INPUTS_BTN.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static boolean clickOnVFInputCheckbox(WebElement instancInput){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on VF instance input checkbox"));
+ instancInput.findElement(By.className("tlv-checkbox-label")).click();
+ GeneralUIUtils.ultimateWait();
+ return instancInput.findElement(By.className("tlv-checkbox-i")).getAttribute("class").contains("ng-not-empty");
+ }
+
+ public static WebElement getServiceInput(String VFInstanceName, String propertyName) throws Exception{
+ String expectedInputName = String.format("%s_%s", VFInstanceName.replace(" ", "").toLowerCase(), propertyName);
+ List<WebElement> inputsFromTable = GeneralUIUtils.getElementsByCSS(InputsScreenService.SERVICE_INPUT_ROW.getValue());
+ for(WebElement inputFromTable: inputsFromTable){
+ String actualInputName = inputFromTable.findElement(By.className("title-text")).getText();
+ if(actualInputName.equals(expectedInputName)){
+ return inputFromTable;
+ }
+ }
+ throw new TestException(String.format("%s input don't exist", expectedInputName));
+ }
+
+ public static void deleteServiceInput(String VFInstanceName, String propertyName) throws Exception{
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Deleting property %s in VF instance %s ", propertyName, VFInstanceName));
+ WebElement serviceInput = getServiceInput(VFInstanceName, propertyName);
+ serviceInput.findElement(By.cssSelector(InputsScreenService.DELETE_INPUT_BTN.getValue())).click();
+ GeneralUIUtils.ultimateWait();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on OK button "));
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.OK.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static List<String> getVFCInstancesNamesFromTable() throws Exception{
+ WebElement inputsTable = getInputsTable("VFC ");
+ return inputsTable.findElements(By.cssSelector("span[class^='title-text']")).stream().
+ map(e -> e.getText()).
+ collect(Collectors.toList());
+ }
+
+ public static WebElement getInputsTable(String tableName) throws Exception{
+ List<WebElement> tableElements = GeneralUIUtils.getElementsByCSS("div.table");
+ for(WebElement tableElement: tableElements){
+ String tableTitle = GeneralUIUtils.getElementfromElementByCSS(tableElement, "div.table-header").getText();
+ if (tableTitle.contains(tableName)){
+ return tableElement;
+ }
+ }
+ throw new TestException(String.format("Can't find %s table", tableName));
+ }
+
+ public static void clickOnProperty(String propertyName) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on property %s ", propertyName));
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_NAME.getValue() + propertyName);
+ GeneralUIUtils.ultimateWait();
+ }
+
+
+
+
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OpsOperationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OpsOperationPage.java
new file mode 100644
index 0000000000..82171b8de9
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OpsOperationPage.java
@@ -0,0 +1,156 @@
+/*-
+ * ============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.pages;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import com.aventstack.extentreports.Status;
+
+public class OpsOperationPage {
+
+ public OpsOperationPage() {
+ super();
+ }
+
+ public static void distributeService() {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Distributing");
+ clickOnButton(DataTestIdEnum.DistributionChangeButtons.DISTRIBUTE);
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.MONITOR.getValue());
+ }
+
+ public static void displayMonitor() {
+ GeneralUIUtils.moveToStep(StepsEnum.MONITOR);
+ }
+
+ public static void re_distributeService() {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Redistributing...");
+ clickOnButton(DataTestIdEnum.DistributionChangeButtons.RE_DISTRIBUTE);
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.MONITOR.getValue());
+ }
+
+ private static void clickOnButton(DataTestIdEnum.DistributionChangeButtons button) {
+ GeneralUIUtils.getWebElementByTestID(button.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public static List<WebElement> getRowsFromMonitorTable() {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Counting the rows from the distribution table");
+ GeneralPageElements.checkElementsCountInTable(1, () -> GeneralUIUtils.getWebElementsListByTestID("ditributionTable"));
+ List<WebElement> distributionRecords = GeneralUIUtils.getWebElementsListByTestID("ditributionTable");
+ List<WebElement> findElements = distributionRecords.get(0).findElements(By.className("w-sdc-distribute-parent-block"));
+ return findElements;
+ }
+
+ public static void showDistributionStatus(int rowIndex) {
+ GeneralUIUtils.getWebElementByTestID("ShowRecordButton_" + String.valueOf(rowIndex)).click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public static String getTotalArtifactsSum(int rowIndex) {
+ return GeneralUIUtils.getWebElementByTestID("totalArtifacts_" + String.valueOf(rowIndex)).getText();
+ }
+
+ public static String getNotifiedArtifactsSum(int rowIndex) {
+ return GeneralUIUtils.getWebElementByTestID("notified_" + String.valueOf(rowIndex)).getText();
+ }
+
+ public static String getDownloadedArtifactsSum(int rowIndex) {
+ return GeneralUIUtils.getWebElementByTestID("downloaded_" + String.valueOf(rowIndex)).getText();
+ }
+
+ public static String getDeployedArtifactsSum(int rowIndex) {
+ return GeneralUIUtils.getWebElementByTestID("deployed_" + String.valueOf(rowIndex)).getText();
+ }
+
+ public static String getNotNotifiedArtifactsSum(int rowIndex) {
+ return GeneralUIUtils.getWebElementByTestID("NotNotified_" + String.valueOf(rowIndex)).getText();
+ }
+
+ public static String getErrorsSum(int rowIndex) {
+ return GeneralUIUtils.getWebElementByTestID("errors_" + String.valueOf(rowIndex)).getText();
+ }
+
+ public static void clickRefreshTableButton(int rowIndex) {
+ GeneralUIUtils.getWebElementByTestID("refreshButton").click();
+ // wait until total artifacts field disappear
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 90);
+ wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + "totalArtifacts_" + String.valueOf(rowIndex) + "']")));
+ }
+
+ public static void waitUntilArtifactsDistributed(int rowIndex) throws Exception {
+ waitUntilArtifactsDistributed("0", 0);
+ }
+
+ public static void waitUntilArtifactsDistributed(String expectedArtifactsSum, int rowIndex) throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Waiting until all artifacts are distributed");
+ boolean isKeepWaiting = true;
+ int maxWaitingPeriodMS = 5 * 60 * 1000;
+ int sumWaitingTime = 0;
+ int napPeriod = 10000;
+ while (isKeepWaiting) {
+ showDistributionStatus(rowIndex);
+ String actualTotalArtifactsSize = getTotalArtifactsSum(rowIndex);
+ String actualNotifiedArtifactsSize = getNotifiedArtifactsSum(rowIndex);
+ String actualDownloadedArtifactsSize = getDownloadedArtifactsSum(rowIndex);
+ String actualDeployedArtifactsSize = getDeployedArtifactsSum(rowIndex);
+ String actualNotNotifedArtifactsSize = getNotNotifiedArtifactsSum(rowIndex);
+ isKeepWaiting = !actualTotalArtifactsSize.equals(actualDownloadedArtifactsSize)
+ || !actualTotalArtifactsSize.equals(actualNotifiedArtifactsSize)
+ || !actualTotalArtifactsSize.equals(actualDeployedArtifactsSize)
+ || actualTotalArtifactsSize.equals("0") || actualDownloadedArtifactsSize.equals("0")
+ || actualNotifiedArtifactsSize.equals("0") || actualDeployedArtifactsSize.equals("0");
+
+ if (isKeepWaiting) {
+
+ if (Integer.parseInt(actualNotNotifedArtifactsSize) > 1) {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Some artifacts are not notified");
+ isKeepWaiting = false;
+ throw new Exception("Some artifacts are not notified...");
+ }
+
+ GeneralUIUtils.sleep(napPeriod);
+ sumWaitingTime += napPeriod;
+
+ if (sumWaitingTime > maxWaitingPeriodMS) {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Not all artifacts are displayed");
+ isKeepWaiting = false;
+ throw new Exception(String.format("Not all artifacts are displayed withing %s seconds",
+ String.valueOf(maxWaitingPeriodMS / 1000)));
+ }
+
+ clickRefreshTableButton(rowIndex);
+ }
+ }
+
+ SetupCDTest.getExtendTest().log(Status.INFO, "All artifacts were successfully distributed");
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductGeneralPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductGeneralPage.java
new file mode 100644
index 0000000000..3bec4f636c
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductGeneralPage.java
@@ -0,0 +1,119 @@
+/*-
+ * ============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.pages;
+
+import java.util.ArrayList;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+/**
+ * @author al714h
+ *
+ */
+
+public class ProductGeneralPage extends ResourceGeneralPage {
+
+ public ProductGeneralPage() {
+ super();
+ }
+
+ public static ProductLeftMenu getProductLeftMenu() {
+ return new ProductLeftMenu();
+ }
+
+ public static void defineName(String productName) {
+ WebElement productNameTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ProductMetadataEnum.PRODUCT_NAME.getValue());
+ productNameTextbox.clear();
+ productNameTextbox.sendKeys(productName);
+ }
+
+ public static void defineFullName(String productFullName) {
+ WebElement productFullNameTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ProductMetadataEnum.FULL_NAME.getValue());
+ productFullNameTextbox.clear();
+ productFullNameTextbox.sendKeys(productFullName);
+ }
+
+ public static void defineProjectCode(String pmat) {
+ WebElement pmattTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ProductMetadataEnum.PROJECT_CODE.getValue());
+ pmattTextbox.clear();
+ pmattTextbox.sendKeys(pmat);
+ }
+
+ public static String getPmattText(){
+ return getPmattField().getAttribute("value");
+ }
+
+ public static String[] getTags(){
+ return ResourceGeneralPage.getElementsFromTagsTable().stream().map(WebElement::getText).toArray(String[]::new);
+ }
+
+ private static WebElement getPmattField() {
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ProductMetadataEnum.PROJECT_CODE.getValue());
+ }
+
+ public static void deleteOldTags(ProductReqDetails product){
+ // Delete tag elements
+ int i = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-delete").size();
+ while (i > 0){
+ GeneralUIUtils.getWebElementByTestID("i-sdc-tag-delete").click();
+ i--;
+ }
+
+ product.setTags(new ArrayList<String>());
+ }
+
+ public static void clickAddWorkflow (){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Adding workflow..."));
+ GeneralUIUtils.clickOnElementByText("Add Workflow");
+ }
+
+ public static void fillAndAddNewWorkflow(String name, String description ) throws InterruptedException{
+ GeneralUIUtils.ultimateWait();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Filling name field with %s", name));
+ insertText(name, "label + input");
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Filling description filed with %s", name));
+ insertText(description,"label + textarea");
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking save button "));
+ clickSave();
+ }
+
+ public static void insertText(String artifactDescriptoin, String element) throws InterruptedException {
+ GeneralUIUtils.getElementsByCSS("div[class='modal-content']");
+ WebElement artifactDescriptionTextbox = GeneralUIUtils.getWebElementBy(By.cssSelector(element));
+ artifactDescriptionTextbox.clear();
+ artifactDescriptionTextbox.sendKeys(artifactDescriptoin);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickSave() {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Save button"));
+ GeneralUIUtils.clickOnElementByText("Save");
+ GeneralUIUtils.ultimateWait();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductLeftMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductLeftMenu.java
new file mode 100644
index 0000000000..2972e59618
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductLeftMenu.java
@@ -0,0 +1,48 @@
+/*-
+ * ============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.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+/**
+ * @author al714h
+ *
+ */
+
+public class ProductLeftMenu implements ComponentLeftMenu {
+
+ public void moveToGeneralScreen() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.GENERAL);
+ }
+
+ public void moveToIconScreen() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.ICON);
+ }
+
+ public void moveToCompositionScreen() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
+ }
+
+ public void moveToHierarchyScreen() {
+ GeneralUIUtils.moveToStep(StepsEnum.HIERARCHY);
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesPage.java
new file mode 100644
index 0000000000..4899ab15af
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesPage.java
@@ -0,0 +1,74 @@
+/*-
+ * ============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.pages;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+public class PropertiesPage extends GeneralPageElements {
+
+ public PropertiesPage() {
+ super();
+ }
+
+ public static List<WebElement> getElemenetsFromTable() {
+ return GeneralUIUtils.getInputElements(DataTestIdEnum.PropertiesPageEnum.PROPERTY_ROW.getValue());
+ }
+
+ public static void clickAddPropertyArtifact() {
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.ADD_NEW_PROPERTY.getValue()).click();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.POPUP_FORM.getValue());
+ }
+
+ public static void clickEditPropertyArtifact(String propertyName) {
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.EDIT_PROPERTY.getValue() + propertyName).click();
+ }
+
+ public static void clickDeletePropertyArtifact(String propertyName) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Delete property %s", propertyName));
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propertyName);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPageEnum.DELETE_PROPERTY.getValue() + propertyName);
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+ GeneralUIUtils.waitForElementInVisibilityBy(By.className("w-sdc-modal-confirmation"), 10);
+ }
+
+ public static void clickOnProperty(String propertyName) {
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propertyName).click();
+ }
+
+ public static PropertyPopup getPropertyPopup() {
+ return new PropertyPopup();
+ }
+
+ public static boolean verifyTotalProperitesField(int count){
+ String totalPropertiesCount = GeneralUIUtils.getWebElementBy(By.id("properties-count")).getText();
+ return ("Total Properties: " + count).equals(totalPropertiesCount);
+ }
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertyPopup.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertyPopup.java
new file mode 100644
index 0000000000..5052406d4e
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertyPopup.java
@@ -0,0 +1,111 @@
+/*-
+ * ============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.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.Select;
+
+import com.aventstack.extentreports.Status;
+
+public class PropertyPopup {
+
+
+ public PropertyPopup() {
+ }
+
+ public boolean getPopupForm(){
+ return GeneralUIUtils.waitForElementInVisibilityByTestId(DataTestIdEnum.PropertiesPageEnum.POPUP_FORM.getValue(), 60);
+ }
+
+ public void insertPropertyName(String name) {
+ WebElement propertyNameField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_NAME.getValue());
+ propertyNameField.clear();
+ propertyNameField.sendKeys(name);
+ }
+
+ public void insertPropertyDefaultValue(String value) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Inserting to property default value: %s ", value));
+ WebElement selectedType = new Select(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_TYPE.getValue())).getFirstSelectedOption();
+ if(selectedType.getText().equals("boolean")) {
+ GeneralUIUtils.getSelectList(value, DataTestIdEnum.PropertiesPopupEnum.PROPERTY_BOOLEAN_VALUE.getValue());
+ } else {
+ WebElement propertyValue = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_VALUE.getValue());
+ propertyValue.clear();
+ propertyValue.sendKeys(value);
+ }
+
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public void insertPropertyDescription(String description) {
+ WebElement propertyDescription = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_DESCRIPTION.getValue());
+ propertyDescription.clear();
+ propertyDescription.sendKeys(description);
+ }
+
+ public void selectPropertyType(String propertyType) {
+ boolean isEntrySchemaDisplayed;
+ try{
+ GeneralUIUtils.getSelectList(propertyType, DataTestIdEnum.PropertiesPopupEnum.PROPERTY_TYPE.getValue());
+ isEntrySchemaDisplayed = GeneralUIUtils.getDriver().findElement(By.xpath(DataTestIdEnum.PropertiesPopupEnum.ENTRY_SCHEMA.getValue())).isDisplayed();
+ if (isEntrySchemaDisplayed){
+ PropertiesPage.getPropertyPopup().selectEntrySchema(propertyType);
+ }
+ }
+ catch(NoSuchElementException e){
+
+ }
+ }
+
+ public void selectEntrySchema(String propertyType){
+ GeneralUIUtils.getSelectList(propertyType, DataTestIdEnum.PropertiesPopupEnum.ENTRY_SCHEMA.getValue());
+ }
+
+ public void clickAdd() {
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.ADD.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public void clickSave() {
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.SAVE.getValue());
+ getPopupForm();
+ }
+
+ public void clickCancel() {
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.CANCEL.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public void clickDone() {
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.DONE.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public void selectPropertyRadioButton(String propertyName) {
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_RADIO_BUTTON_CONTAINER.getValue() + propertyName).findElement(By.className(DataTestIdEnum.PropertiesPopupEnum.RADIO_BUTTON_CLASS.getValue())).click();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceGeneralPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceGeneralPage.java
new file mode 100644
index 0000000000..1412a4b969
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceGeneralPage.java
@@ -0,0 +1,177 @@
+/*-
+ * ============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.pages;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+
+
+public class ResourceGeneralPage extends GeneralPageElements {
+
+ public ResourceGeneralPage() {
+ super();
+ }
+
+ public static WebElement getNameField() {
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ResourceMetadataEnum.RESOURCE_NAME.getValue());
+ }
+
+ public static WebElement getDescriptionField() {
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.DESCRIPTION.getValue());
+ }
+
+ public static String getCategoryDataTestsIdAttribute() {
+ return DataTestIdEnum.ResourceMetadataEnum.CATEGORY.getValue();
+ }
+
+ public static WebElement getVendorNameField() {
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ResourceMetadataEnum.VENDOR_NAME.getValue());
+ }
+
+ public static WebElement getVendorReleaseField() {
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ResourceMetadataEnum.VENDOR_RELEASE.getValue());
+ }
+
+ public static WebElement getTagsField() {
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ResourceMetadataEnum.TAGS.getValue());
+ }
+
+ public static WebElement getContactIdField() {
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ResourceMetadataEnum.CONTACT_ID.getValue());
+ }
+
+ /***************************************************************/
+
+ public static String getNameText() {
+ return getNameField().getAttribute("value");
+ }
+
+ public static void defineName(String resourceName) {
+ WebElement resourceNameTextbox = getNameField();
+ resourceNameTextbox.clear();
+ resourceNameTextbox.sendKeys(resourceName);
+ }
+
+ public static void defineNameWithPaste() {
+ defineTextBoxWithPaste(getNameField());
+ }
+
+ public static String getDescriptionText() {
+ return getDescriptionField().getAttribute("value");
+ }
+
+ public static void defineDescription(String description) {
+ WebElement descriptionTextbox = getDescriptionField();
+ descriptionTextbox.clear();
+ descriptionTextbox.sendKeys(description);
+ }
+
+ public static void defineDescriptionWithPaste() {
+ defineTextBoxWithPaste(getDescriptionField());
+ }
+
+ public static String getVendorNameText() {
+ return getVendorNameField().getAttribute("value");
+ }
+
+ public static void defineVendorName(String vendorName) {
+ WebElement vendorNameTextbox = getVendorNameField();
+ vendorNameTextbox.clear();
+ vendorNameTextbox.sendKeys(vendorName);
+ }
+
+ public static void defineVendorNameWithPaste() {
+ defineTextBoxWithPaste(getVendorNameField());
+ }
+
+ public static String getVendorReleaseText() {
+ return getVendorReleaseField().getAttribute("value");
+ }
+
+ public static void defineVendorRelease(String vendorRelease) {
+ WebElement vendorReleaseTextbox = getVendorReleaseField();
+ vendorReleaseTextbox.clear();
+ vendorReleaseTextbox.sendKeys(vendorRelease);
+ }
+
+ public static void defineVendorReleaseWithPaste() {
+ defineTextBoxWithPaste(getVendorReleaseField());
+ }
+
+ public static void defineTag(String resourceTags) {
+ WebElement tagTextbox = getTagsField();
+ tagTextbox.clear();
+ tagTextbox.sendKeys(resourceTags);
+ tagTextbox.sendKeys(Keys.ENTER);
+ }
+
+ public static void defineTagsList(ComponentReqDetails component, String[] tags) {
+ List<String> taglist = new ArrayList<String>();
+ WebElement resourceTagsTextbox = getTagsField();
+ for (String tag : tags) {
+ resourceTagsTextbox.clear();
+ resourceTagsTextbox.sendKeys(tag);
+ GeneralUIUtils.sleep(500);
+ resourceTagsTextbox.sendKeys(Keys.ENTER);
+ taglist.add(tag);
+ }
+ component.getTags().addAll(taglist);
+ }
+
+ public static void defineTagsListWithPaste() {
+ List<String> taglist = new ArrayList<String>();
+ WebElement resourceTagsTextbox = getTagsField();
+ defineTextBoxWithPaste(resourceTagsTextbox);
+ resourceTagsTextbox.sendKeys(Keys.ENTER);
+ }
+
+ public static void defineCategory(String category) {
+ GeneralUIUtils.getSelectList(category, getCategoryDataTestsIdAttribute());
+ }
+
+ public static String getContactIdText() {
+ return getContactIdField().getAttribute("value");
+ }
+
+ public static void defineContactId(String userId) {
+ WebElement contactIdTextbox = getContactIdField();
+ contactIdTextbox.clear();
+ contactIdTextbox.sendKeys(userId);
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public static List<WebElement> getElementsFromTagsTable(){
+ return GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.ResourceMetadataEnum.TAGS_TABLE.getValue());
+ }
+
+ public static void defineTextBoxWithPaste(WebElement textBox) {
+ textBox.clear();
+ textBox.sendKeys(Keys.CONTROL + "v");
+ GeneralUIUtils.ultimateWait();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java
new file mode 100644
index 0000000000..a128aefdc8
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java
@@ -0,0 +1,67 @@
+/*-
+ * ============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.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+public class ResourceLeftMenu implements ComponentLeftMenu {
+
+ public void moveToGeneralScreen() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.GENERAL);
+ }
+
+ public void moveToIconScreen() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.ICON);
+ }
+
+ public void moveToDeploymentArtifactScreen() {
+ GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
+ }
+
+ public void moveToInformationalArtifactScreen() {
+ GeneralUIUtils.moveToStep(StepsEnum.INFORMATION_ARTIFACT);
+ }
+
+ public void moveToPropertiesScreen() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES);
+ }
+
+ public void moveToCompositionScreen() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
+ }
+
+ public void moveToActivityLogScreen() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.ACTIVITY_LOG);
+ }
+
+ public void moveToDeploymentViewScreen() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_VIEW);
+ }
+
+ public void moveToToscaArtifactsScreen() {
+ GeneralUIUtils.moveToStep(StepsEnum.TOSCA_ARTIFACTS);
+ }
+
+ public void moveToInputsScreen() {
+ GeneralUIUtils.moveToStep(StepsEnum.INPUTS);
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceGeneralPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceGeneralPage.java
new file mode 100644
index 0000000000..0394978261
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceGeneralPage.java
@@ -0,0 +1,114 @@
+/*-
+ * ============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.pages;
+
+import java.util.ArrayList;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+public class ServiceGeneralPage extends ResourceGeneralPage {
+
+ public ServiceGeneralPage() {
+ super();
+ }
+
+ public static ServiceLeftMenu getServiceLeftMenu() {
+ return new ServiceLeftMenu();
+ }
+
+ public static void defineName(String serviceName) {
+ WebElement serviceNameTextbox = GeneralUIUtils
+ .getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.SERVICE_NAME.getValue());
+ serviceNameTextbox.clear();
+ serviceNameTextbox.sendKeys(serviceName);
+ }
+
+ public static void defineProjectCode(String pmat) {
+ WebElement projectCodeTextbox = GeneralUIUtils
+ .getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.PROJECT_CODE.getValue());
+ projectCodeTextbox.clear();
+ projectCodeTextbox.sendKeys(pmat);
+ }
+
+ public static String getProjectCodeText(){
+ return getProjectCodeField().getAttribute("value");
+ }
+
+ public static String[] getTags(){
+ return ResourceGeneralPage.getElementsFromTagsTable().stream().map(WebElement::getText).toArray(String[]::new);
+ }
+
+ private static WebElement getProjectCodeField() {
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.PROJECT_CODE.getValue());
+ }
+
+ public static void deleteOldTags(ServiceReqDetails service){
+ // Delete tag elements
+ int i = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-delete").size();
+ while (i > 0){
+ GeneralUIUtils.getWebElementByTestID("i-sdc-tag-delete").click();
+ i--;
+ }
+
+ service.setTags(new ArrayList<String>());
+ }
+
+ public static String getCategoryText() {
+ return GeneralUIUtils.getSelectedElementFromDropDown(getCategoryDataTestsIdAttribute()).getText();
+ }
+
+ public static void clickAddWorkflow (){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Adding workflow..."));
+ GeneralUIUtils.clickOnElementByText("Add Workflow");
+ }
+
+ public static void fillAndAddNewWorkflow(String name, String description ) throws InterruptedException{
+ GeneralUIUtils.ultimateWait();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Filling name field with %s", name));
+ insertText(name, "label + input");
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Filling description filed with %s", name));
+ insertText(description,"label + textarea");
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking save button "));
+ clickSave();
+ }
+
+ public static void insertText(String artifactDescriptoin, String element) throws InterruptedException {
+ GeneralUIUtils.getElementsByCSS("div[class='modal-content']");
+ WebElement artifactDescriptionTextbox = GeneralUIUtils.getWebElementBy(By.cssSelector(element));
+ artifactDescriptionTextbox.clear();
+ artifactDescriptionTextbox.sendKeys(artifactDescriptoin);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickSave() {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Save button"));
+ GeneralUIUtils.clickOnElementByText("Save");
+ GeneralUIUtils.ultimateWait();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceLeftMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceLeftMenu.java
new file mode 100644
index 0000000000..127ada2309
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceLeftMenu.java
@@ -0,0 +1,32 @@
+/*-
+ * ============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.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+public class ServiceLeftMenu implements ComponentLeftMenu {
+
+ public void moveToManagmentWorkflow() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.MANAGEMENT_WORKFLOW);
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java
new file mode 100644
index 0000000000..d9ef375d17
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java
@@ -0,0 +1,101 @@
+/*-
+ * ============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.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+import com.aventstack.extentreports.Status;
+
+public class TesterOperationPage {
+
+ public TesterOperationPage() {
+ super();
+ }
+
+ public static void certifyComponent(String componentName) throws Exception{
+ clickStartTestingButton();
+ clickAccpetCertificationButton(componentName);
+ }
+
+ public static void clickAccpetCertificationButton(String componentName) throws Exception {
+ ExtentTestActions.log(Status.INFO, "Accepting certifiction of " + componentName);
+ String actionDuration = GeneralUIUtils.getActionDuration(() ->
+ {
+ try {
+ clickAccpetCertificationButtonWithoutDuration(componentName);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ });
+ ExtentTestActions.log(Status.INFO, componentName + " is certifed", actionDuration);
+
+ }
+
+ public static void clickStartTestingButton() throws Exception{
+ ExtentTestActions.log(Status.INFO, "Starting to test");
+ String actionDuration = GeneralUIUtils.getActionDuration(() -> {
+ try {
+ clickStartTestingButtonWithoutDuration();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ });
+ ExtentTestActions.log(Status.INFO, "Ready for certification", actionDuration);
+ }
+
+
+ private static void certifyComponentWithoutDuration(String componentName) throws Exception {
+ clickStartTestingButtonWithoutDuration();
+ clickAccpetCertificationButtonWithoutDuration(componentName);
+ }
+
+
+ private static void clickAccpetCertificationButtonWithoutDuration(String componentName) throws Exception {
+ try{
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.LifeCyleChangeButtons.ACCEPT.getValue());
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.ACCEP_TESTING_MESSAGE.getValue()).sendKeys(componentName + " tested successfuly");
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.sleep(2000);
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue());
+ }
+ catch (Exception e){
+ throw new Exception("Accepting certification of " + componentName + " falied");
+ }
+ }
+
+ private static void clickStartTestingButtonWithoutDuration() throws Exception {
+ try{
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.LifeCyleChangeButtons.START_TESTING.getValue());
+// GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LifeCyleChangeButtons.ACCEPT.getValue());
+// GeneralUIUtils.ultimateWait();
+// GeneralUIUtils.sleep(1000);
+ }
+ catch (Exception e){
+ throw new Exception("Start testing falied");
+ }
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ToscaArtifactsPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ToscaArtifactsPage.java
new file mode 100644
index 0000000000..077ccacde1
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ToscaArtifactsPage.java
@@ -0,0 +1,54 @@
+/*-
+ * ============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.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+
+public class ToscaArtifactsPage extends DeploymentArtifactPage {
+
+ public ToscaArtifactsPage() {
+
+ }
+
+ public static String getArtifactName(int row){
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ToscaArtifactsScreenEnum.ARTIFACT_NAME.getValue() + row).getText();
+ }
+
+ public static String getArtifactType(int row){
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ToscaArtifactsScreenEnum.ARTIFACT_TYPE.getValue() + row).getText();
+ }
+
+ public static String getArtifactVersion(int row){
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ToscaArtifactsScreenEnum.ARTIFACT_VERSION.getValue() + row).getText();
+ }
+
+ public static WebElement getArtifactDetails(int row){
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ToscaArtifactsScreenEnum.ARTIFACT_DETAILS.getValue() + row);
+ }
+
+ public static void downloadCsar() {
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ToscaArtifactsScreenEnum.DOWNLOAD_CSAR.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java
new file mode 100644
index 0000000000..e97f3feb62
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java
@@ -0,0 +1,126 @@
+/*-
+ * ============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.pages;
+
+import java.io.File;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.Select;
+import org.testng.TestException;
+
+import com.aventstack.extentreports.Status;
+
+public class UploadArtifactPopup {
+
+ boolean isCompositionPage;
+
+ public UploadArtifactPopup(boolean isCompositionPage) {
+ super();
+ this.isCompositionPage = isCompositionPage;
+ }
+
+ public UploadArtifactPopup() {
+ super();
+ }
+
+ public WebElement getArtifactDescriptionWebElement(){
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.ARTIFACT_DESCRIPTION.getValue());
+ }
+
+ public void loadFile(String path, String filename) {
+ final WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPopup.BROWSE.getValue());
+// browseWebElement.sendKeys(path + filename);
+ browseWebElement.sendKeys(path + File.separator + filename);
+ GeneralUIUtils.ultimateWait();
+
+// if (!browseWebElement.getAttribute("value").equals(filename))
+// {
+// throw new TestException("File named " + filename + " does not presented");
+// }
+ }
+
+
+
+ public void insertDescription(String artifactDescriptoin) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Changing artifact description to: %s", artifactDescriptoin));
+ WebElement artifactDescriptionTextbox = getArtifactDescriptionWebElement();
+ artifactDescriptionTextbox.clear();
+ artifactDescriptionTextbox.sendKeys(artifactDescriptoin);
+
+ GeneralUIUtils.ultimateWait();;
+ }
+
+ public Select defineArtifactLabel(String requiredArtifactLabel) {
+ Select selectList = null;
+ WebElement artifactLabelWebElement = null;
+
+// if (isCompositionPage){
+ artifactLabelWebElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue());
+// }
+// else{
+// selectList = GeneralUIUtils.getSelectList("Create New Artifact", DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue());
+// artifactLabelWebElement = GeneralUIUtils.getDriver().findElement(By.name(DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue()));
+// }
+
+ artifactLabelWebElement.clear();
+ artifactLabelWebElement.sendKeys(requiredArtifactLabel);
+ return selectList;
+ }
+
+ public Select selectArtifactType(String artifactType) {
+ return GeneralUIUtils.getSelectList(artifactType, DataTestIdEnum.ArtifactPopup.ARTIFACT_TYPE.getValue());
+ }
+
+ public void clickDoneButton() throws Exception {
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPopup.DONE_BUTTON.getValue());
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.waitForElementInVisibilityBy(By.className("sdc-add-artifact"), 10);
+ }
+
+ public void clickCancelButton() throws Exception {
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.CANCEL_BUTTON.getValue()).click();
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.waitForElementInVisibilityByTestId("sdc-add-artifact");
+ }
+
+// public void clickUpdateButton() throws Exception {
+// clickAddButton();
+// GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.UPDATE_BUTTON.getValue()).click();
+// GeneralUIUtils.waitForLoader();
+// GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("sdc-add-artifact"), 50);
+// }
+
+ public void insertURL(String artifactDescriptoin) throws Exception {
+ WebElement artifactDescriptionTextbox = getArtifactURLWebElement();
+ artifactDescriptionTextbox.clear();
+ artifactDescriptionTextbox. sendKeys(artifactDescriptoin);
+ }
+
+ public WebElement getArtifactURLWebElement(){
+ return GeneralUIUtils.getWebElementBy(By.cssSelector((DataTestIdEnum.ArtifactPopup.URL.getValue())));
+ }
+
+
+}
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
new file mode 100644
index 0000000000..aa260ecc80
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java
@@ -0,0 +1,110 @@
+/*-
+ * ============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.concurrent.TimeUnit;
+
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import com.paulhammant.ngwebdriver.NgWebDriver;
+
+public class AdditionalConditions {
+
+ public static ExpectedCondition<Boolean> jQueryAJAXCallsHaveCompleted() {
+ return new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver driver) {
+ return (Boolean) ((JavascriptExecutor)driver).
+ executeScript("return (window.jQuery!= null) && (jQuery.active === 0);");
+ }
+ };
+ }
+
+ public static ExpectedCondition <Boolean> angularHasFinishedProcessing() {
+ return new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver driver) {
+// String scriptJS = "return (window.angular !==undefined) &&"
+// + " (angular.element(document).injector() !==undefined) &&"
+// + " (angular.element(document).injector().get('$http').pendingRequests.length === 0)";
+// return Boolean.valueOf(( (JavascriptExecutor) driver).executeScript(scriptJS).toString());
+ new NgWebDriver((JavascriptExecutor) driver).waitForAngularRequestsToFinish();
+ return true;
+ }
+ };
+ }
+
+ public static ExpectedCondition <Boolean> pageLoadWait() {
+ return new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver driver) {
+ String scriptJS =
+ "try {\r\n" +
+ " if (document.readyState !== 'complete') {\r\n" +
+ " return false; // Page not loaded yet\r\n" +
+ " }\r\n" +
+ " if (window.jQuery) {\r\n" +
+ " if (window.jQuery.active) {\r\n" +
+ " return false;\r\n" +
+ " } else if (window.jQuery.ajax && window.jQuery.ajax.active) {\r\n" +
+ " return false;\r\n" +
+ " }\r\n" +
+ " }\r\n" +
+ " if (window.angular) {\r\n" +
+ " if (!window.qa) {\r\n" +
+ " // Used to track the render cycle finish after loading is complete\r\n" +
+ " window.qa = {\r\n" +
+ " doneRendering: false\r\n" +
+ " };\r\n" +
+ " }\r\n" +
+ " // Get the angular injector for this app (change element if necessary)\r\n" +
+ " var injector = window.angular.element('body').injector();\r\n" +
+ " // Store providers to use for these checks\r\n" +
+ " var $rootScope = injector.get('$rootScope');\r\n" +
+ " var $http = injector.get('$http');\r\n" +
+ " var $timeout = injector.get('$timeout');\r\n" +
+ " // Check if digest\r\n" +
+ " if ($rootScope.$$phase === '$apply' || $rootScope.$$phase === '$digest' || $http.pendingRequests.length !== 0) {\r\n" +
+ " window.qa.doneRendering = false;\r\n" +
+ " return false; // Angular digesting or loading data\r\n" +
+ " }\r\n" +
+ " if (!window.qa.doneRendering) {\r\n" +
+ " // Set timeout to mark angular rendering as finished\r\n" +
+ " $timeout(function() {\r\n" +
+ " window.qa.doneRendering = true;\r\n" +
+ " }, 0);\r\n" +
+ " return false;\r\n" +
+ " }\r\n" +
+ " }\r\n" +
+ " return true;\r\n" +
+ "} catch (ex) {\r\n" +
+ " return false;\r\n" +
+ "}";
+ return Boolean.valueOf(( (JavascriptExecutor) driver).executeScript(scriptJS).toString());
+ }
+ };
+ }
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdminWorkspaceUIUtilies.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdminWorkspaceUIUtilies.java
new file mode 100644
index 0000000000..db621f3355
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdminWorkspaceUIUtilies.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.pages.AdminGeneralPage;
+
+public class AdminWorkspaceUIUtilies {
+
+
+ public static void createNewUser(String userId, UserRoleEnum userRole){
+ AdminGeneralPage.getUserManagementTab().setNewUserBox(userId);
+ AdminGeneralPage.getUserManagementTab().selectUserRole(userRole);
+ AdminGeneralPage.getUserManagementTab().clickCreateButton();
+// AdminWorkspaceUIUtilies.highlightNewRow();
+ }
+
+ private static void highlightNewRow(){
+ GeneralUIUtils.HighlightMyElement(AdminGeneralPage.getUserManagementTab().getRow(0));
+ }
+
+ public static void updateUserRole(int rowIndx, UserRoleEnum userRole) {
+ AdminGeneralPage.getUserManagementTab().updateUser(rowIndx);
+ AdminGeneralPage.getUserManagementTab().updateUserRole(userRole, rowIndx);
+ AdminGeneralPage.getUserManagementTab().saveAfterUpdateUser(rowIndx);
+ }
+
+ public static void deleteFirstRow(){
+ AdminGeneralPage.getUserManagementTab().deleteUser(0);
+ }
+
+ public static void searchForUser(String searchString){
+ AdminGeneralPage.getUserManagementTab().searchUser(searchString);
+ }
+
+
+
+
+}
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
new file mode 100644
index 0000000000..d55ace4374
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java
@@ -0,0 +1,638 @@
+/*-
+ * ============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.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.awt.AWTException;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.datatransfer.StringSelection;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders;
+import org.openecomp.sdc.ci.tests.datatypes.HeatWithParametersDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+
+public final class ArtifactUIUtils {
+
+ private static final String PARAMETERS = "parameters";
+
+ private ArtifactUIUtils() {
+ }
+
+ public static void fillAndAddNewArtifactParameters(ArtifactInfo artifactInfo) throws Exception {
+ UploadArtifactPopup artifactPopup = new UploadArtifactPopup();
+ fillAndAddNewArtifactParameters(artifactInfo, artifactPopup);
+// artifactPopup.defineArtifactLabel(artifactInfo.getArtifactLabel());
+// artifactPopup.selectArtifactType(artifactInfo.getArtifactType());
+// artifactPopup.insertDescription(artifactInfo.getDescription());
+// artifactPopup.loadFile(artifactInfo.getFilepath(), artifactInfo.getFilename());
+// artifactPopup.clickAddButton();
+ }
+
+ public static void fillAndAddNewArtifactParameters(ArtifactInfo artifactInfo, UploadArtifactPopup artifactPopup) throws Exception {
+ artifactPopup.defineArtifactLabel(artifactInfo.getArtifactLabel());
+ artifactPopup.selectArtifactType(artifactInfo.getArtifactType());
+ artifactPopup.insertDescription(artifactInfo.getDescription());
+ artifactPopup.loadFile(artifactInfo.getFilepath(), artifactInfo.getFilename());
+ artifactPopup.clickDoneButton();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("A new artifact of type %s was added", artifactInfo.getArtifactType()));
+ }
+
+ public static void fillAndAddNewEnvArtifactParameters(ArtifactInfo artifactInfo, UploadArtifactPopup artifactPopup) throws Exception {
+ artifactPopup.insertDescription(artifactInfo.getDescription());
+ artifactPopup.loadFile(artifactInfo.getFilepath(), artifactInfo.getFilename());
+ artifactPopup.clickDoneButton();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("ENV parameters %s artifact updated ", artifactInfo.getArtifactType()));
+ }
+
+ public static void fillPlaceHolderInformationalArtifact(DataTestIdEnum.InformationalArtifactsPlaceholders artifactLabel,String filepath, String filename, String description) throws Exception {
+ GeneralUIUtils.clickOnElementByTestId(artifactLabel.getValue());
+ InformationalArtifactPage.artifactPopup().loadFile(filepath, filename);
+ InformationalArtifactPage.artifactPopup().insertDescription(description);
+ InformationalArtifactPage.artifactPopup().clickDoneButton();
+ }
+
+ public static void fillPlaceHolderInformationalArtifact(DataTestIdEnum.InformationalArtifactsService artifactLabel,
+ String filepath, String filename, String description) throws Exception {
+ GeneralUIUtils.clickOnElementByTestId(artifactLabel.getValue());
+ UploadArtifactPopup artifactPopup = new UploadArtifactPopup(true);
+ artifactPopup.loadFile(filepath, filename);
+ artifactPopup.insertDescription(description);
+ artifactPopup.clickDoneButton();
+ }
+
+ public static void fillPlaceHolderAPIArtifact(DataTestIdEnum.APIArtifactsService artifactLabel,
+ String filepath, String filename, String description, String url) throws Exception {
+ GeneralUIUtils.clickOnElementByTestId(artifactLabel.getValue());
+ UploadArtifactPopup artifactPopup = new UploadArtifactPopup(true);
+ artifactPopup.loadFile(filepath, filename);
+ artifactPopup.insertURL(url);
+ artifactPopup.insertDescription(description);
+ artifactPopup.clickDoneButton();
+ }
+
+ public static RestResponse deploymentArtifactResourceInUI(ResourceReqDetails resource, User user,
+ ArtifactReqDetails artifact, String file) throws Exception {
+ Thread.sleep(1000);
+
+ List<WebElement> listFormInput = GeneralUIUtils.getDriver()
+ .findElements(By.className("i-sdc-designer-sidebar-tab"));
+ WebElement addArtifactElement = listFormInput.get(2);
+ addArtifactElement.click();
+
+ WebElement addArtifact = GeneralUIUtils.getDriver()
+ .findElement(By.className("i-sdc-designer-sidebar-section-content-item-artifact-details-name"));
+ addArtifact.click();
+
+ Thread.sleep(1000);
+ WebElement descriptionProperty = GeneralUIUtils.getDriver().findElement(By.className("i-sdc-form-textarea"));
+ descriptionProperty.clear();
+ descriptionProperty.sendKeys(artifact.getDescription());
+
+ WebElement uploadFile = GeneralUIUtils.getDriver().findElement(By.className("i-sdc-form-label-upload"));
+ uploadFile.click();
+
+ StringSelection sel = new StringSelection(file);
+ Toolkit.getDefaultToolkit().getSystemClipboard().setContents(sel, null);
+ // System.out.println("selection" + sel);
+ Thread.sleep(1000);
+
+ Robot robot = new Robot();
+ Thread.sleep(1000);
+
+ Thread.sleep(2000);
+
+ robot.keyPress(KeyEvent.VK_ENTER);
+
+ // Release Enter
+ robot.keyRelease(KeyEvent.VK_ENTER);
+
+ // Press CTRL+V
+ robot.keyPress(KeyEvent.VK_CONTROL);
+ robot.keyPress(KeyEvent.VK_V);
+
+ // Release CTRL+V
+ robot.keyRelease(KeyEvent.VK_CONTROL);
+ robot.keyRelease(KeyEvent.VK_V);
+ Thread.sleep(1000);
+
+ // Press Enter
+ robot.keyPress(KeyEvent.VK_ENTER);
+ robot.keyRelease(KeyEvent.VK_ENTER);
+ Thread.sleep(3000);
+
+ WebElement clickDone = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-form-action"));
+ clickDone.click();
+
+ Thread.sleep(3500);
+
+ GeneralUIUtils.getDriver().findElement(By.cssSelector("button[data-ng-click^=save]")).click();
+
+ RestResponse getResource = RestCDUtils.getResource(resource, user);
+ assertEquals("Did not succeed to get resource after create", 200, getResource.getErrorCode().intValue());
+ return getResource;
+ }
+
+ public static void addInformationArtifact(ArtifactReqDetails artifact, String filePath,
+ final InformationalArtifactsPlaceholders dataTestEnum) throws Exception {
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.sleep(2000);
+ GeneralUIUtils.getWebElementByTestID(dataTestEnum.getValue()).click();
+
+// final WebElement browseWebElement = GeneralUIUtils.retryMethodOnException(
+// () -> GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.ModalItems.BROWSE_BUTTON.getValue()));
+
+ WebElement browseWebElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.BROWSE_BUTTON.getValue());
+ browseWebElement.sendKeys(filePath);
+
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.DESCRIPTION.getValue())
+ .sendKeys(artifact.getDescription());
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.ADD.getValue()).click();
+
+ }
+
+ private static void addFileToWindowBrowse(String file) throws InterruptedException, AWTException {
+ StringSelection sel = new StringSelection(file);
+ Toolkit.getDefaultToolkit().getSystemClipboard().setContents(sel, null);
+ // System.out.println("selection" + sel);
+ Thread.sleep(1000);
+
+ Robot robot = new Robot();
+
+ robot.keyPress(KeyEvent.VK_ENTER);
+
+ // Release Enter
+ robot.keyRelease(KeyEvent.VK_ENTER);
+
+ // Press CTRL+V
+ robot.keyPress(KeyEvent.VK_CONTROL);
+ robot.keyPress(KeyEvent.VK_V);
+
+ // Release CTRL+V
+ robot.keyRelease(KeyEvent.VK_CONTROL);
+ robot.keyRelease(KeyEvent.VK_V);
+ Thread.sleep(1000);
+
+ // Press Enter
+ robot.keyPress(KeyEvent.VK_ENTER);
+ robot.keyRelease(KeyEvent.VK_ENTER);
+ Thread.sleep(3000);
+ }
+
+ static WebElement ArtifactLabel;
+
+ public static Map<String, String> addInformationalArtifact(String artifactLabel) throws Exception {
+ String type = GeneralUIUtils.getSelectList(null, "artifacttype").getFirstSelectedOption().getText();
+ Map<String, String> artifactValues = new HashMap<String, String>();
+ String labelName = GeneralUIUtils.getSelectList(artifactLabel, "selectArtifact").getFirstSelectedOption()
+ .getText();
+ ArtifactLabel = GeneralUIUtils.getDriver().findElement(By.name("artifactLabel"));
+ if (ArtifactLabel.getAttribute("value").equals("")) {
+ labelName = "New-Test-Artifact";
+ ArtifactLabel.sendKeys(labelName);
+ type = GeneralUIUtils.getSelectList("HEAT", "artifacttype").getFirstSelectedOption().getText();
+ }
+ String description = "This is Description";
+ String fileName = "Heat-File.yaml";
+ GeneralUIUtils.setWebElementByTestId("description", "description");
+ ResourceUIUtils.importFileWithSendKeyBrowse(ImportAssetUIUtils.FILE_PATH, fileName);
+ GeneralUIUtils.getWebElementByTestID("Add").click();
+ GeneralUIUtils.getWebElementByTestID(labelName);
+
+ artifactValues.put("type", type);
+ artifactValues.put("description", description);
+ artifactValues.put("name", labelName);
+ artifactValues.put("fileName", fileName);
+ return artifactValues;
+ }
+
+ public static Map<String, String> addDeploymentArtifact(String artifactLabel, String artifactType, String fileName)
+ throws Exception {
+ String type = null;
+ String labelName;
+ Map<String, String> artifactValues = new HashMap<String, String>();
+ try {
+ labelName = GeneralUIUtils.getSelectList(artifactLabel, "selectArtifact").getOptions().get(1).getText();
+ GeneralUIUtils.getSelectList(artifactLabel, "selectArtifact").selectByVisibleText(labelName);
+ } catch (Exception e) {
+ labelName = GeneralUIUtils.getWebElementByClassName(artifactLabel).getText();
+ }
+ ArtifactLabel = GeneralUIUtils.getDriver().findElement(By.name("artifactLabel"));
+ if (ArtifactLabel.getText().equals("")) {
+ labelName = "New-Test-Artifact";
+ ArtifactLabel.sendKeys(labelName);
+ type = GeneralUIUtils.getSelectList(artifactType, "artifacttype").getFirstSelectedOption().getText();
+ }
+ String description = "This is Description";
+ GeneralUIUtils.setWebElementByTestId("description", "description" );
+ ResourceUIUtils.importFileWithSendKeyBrowse(ImportAssetUIUtils.FILE_PATH, fileName);
+ try {
+ GeneralUIUtils.getWebElementByTestID("Add").click();
+ } catch (Exception e) {
+ GeneralUIUtils.getWebElementByClassName("w-sdc-form-action add-property").click();
+ }
+
+ artifactValues.put("type", artifactType);
+ artifactValues.put("description", description);
+ artifactValues.put("name", labelName);
+ artifactValues.put("fileName", fileName);
+ return artifactValues;
+ }
+
+
+ public static Map<String, String> addDeploymentArtifactFromCanvas(String artifactLabel) throws Exception {
+ String type = null;
+ Map<String, String> artifactValues = new HashMap<String, String>();
+ String labelName = GeneralUIUtils.getSelectList(artifactLabel, "selectArtifact").getFirstSelectedOption()
+ .getText();
+ ArtifactLabel = GeneralUIUtils.getDriver().findElement(By.name("artifactLabel"));
+ if (ArtifactLabel.getText().equals("")) {
+ labelName = "New-Test-Artifact";
+ ArtifactLabel.sendKeys(labelName);
+ type = GeneralUIUtils.getSelectList("OTHER", "artifacttype").getFirstSelectedOption().getText();
+ }
+ String description = "This is Description";
+ String filePath = "C:\\Git_work\\ASDC\\d2-sdnc\\ui-ci\\src\\main\\resources\\Files\\";
+ String fileName = "Heat-File.yaml";
+ GeneralUIUtils.setWebElementByTestId("description", "description");
+ ResourceUIUtils.importFileWithSendKeyBrowse(filePath, fileName);
+ GeneralUIUtils.getWebElementByTestID("Add").click();
+ artifactValues.put("type", type);
+ artifactValues.put("description", description);
+ artifactValues.put("name", labelName);
+ artifactValues.put("fileName", fileName);
+ return artifactValues;
+ }
+
+ public static Map<String, String> valideArtifact(Map<String, String> artifactValues, Boolean condition)
+ throws Exception {
+ if (condition) {
+ GeneralUIUtils.getWebElementByClassName("table-edit-btn").click();
+ } else {
+ System.out.println(artifactValues.get("name"));
+ GeneralUIUtils.getWebElementByTestID("edit_" + artifactValues.get("name")).click();
+ }
+ Thread.sleep(1000);
+ String labelname = GeneralUIUtils.getWebElementByClassName("artifactLabel").getAttribute("value");
+ String filename = GeneralUIUtils.getWebElementByTestID("filename").getText();
+ String description = GeneralUIUtils.getWebElementByTestID("description").getAttribute("value");
+ String type = GeneralUIUtils.getSelectList(null, "artifacttype").getFirstSelectedOption().getText();
+ labelname.compareToIgnoreCase(artifactValues.get("name").replaceAll("-", ""));
+ assertEquals(filename, artifactValues.get("fileName").replaceAll(" ", "-"));
+ assertEquals(type, artifactValues.get("type"));
+ assertEquals(description, artifactValues.get("description"));
+ GeneralUIUtils.getWebElementByTestID("Update").click();
+ return artifactValues;
+ }
+
+ public static void valideArtifactFromCanvas(Map<String, String> artifactValues) throws Exception {
+ GeneralUIUtils.getWebElementByTestID("artifactDisplayName-" + artifactValues.get("name")).click();
+ Thread.sleep(1000);
+ String labelname = GeneralUIUtils.getWebElementByClassName("artifactLabel").getAttribute("value");
+ String filename = GeneralUIUtils.getWebElementByTestID("filename").getText();
+ String description = GeneralUIUtils.getWebElementByTestID("description").getAttribute("value");
+ String type = GeneralUIUtils.getSelectList(null, "artifacttype").getFirstSelectedOption().getText();
+ labelname.compareToIgnoreCase(artifactValues.get("name").replaceAll("-", ""));
+ assertEquals(filename, artifactValues.get("fileName"));
+ assertEquals(type, artifactValues.get("type"));
+ assertEquals(description, artifactValues.get("description"));
+ }
+
+ public static Map<String, Map<String, Object>> getArtifactsListFromResponse(String jsonResponse,
+ String fieldOfArtifactList) {
+ JSONObject object = (JSONObject) JSONValue.parse(jsonResponse);
+ Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object.get(fieldOfArtifactList);
+ return map;
+ }
+
+ public static void validateArtifactNameVersionType(String artifactLabel, String artifactVersion, String artifactType) {
+// Assert.assertEquals(GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue() + artifactLabel + "']")).getAttribute("textContent").trim(), artifactLabel);
+ if(!GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue() + artifactLabel + "']")).getAttribute("textContent").trim().equals(artifactLabel)) {
+ SetupCDTest.getExtendTest().log(Status.WARNING, "Artifact label not equal - this warnning represent defect.");
+ }
+ if(artifactVersion != null) {
+// Assert.assertEquals(GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.VERSION.getValue() + artifactLabel + "']")).getAttribute("textContent").trim(), artifactVersion, "Artifact version not equal.");
+ if(!GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.VERSION.getValue() + artifactLabel + "']")).getAttribute("textContent").trim().equals(artifactVersion)) {
+ SetupCDTest.getExtendTest().log(Status.WARNING, "Artifact version not equal - this warnning represent defect.");
+ }
+ }
+ if(artifactType != null) {
+// Assert.assertEquals(GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.TYPE.getValue() + artifactLabel + "']")).getAttribute("textContent").trim(), artifactType, "Artifact type not equal.");
+ if(!GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.TYPE.getValue() + artifactLabel + "']")).getAttribute("textContent").trim().equals(artifactType)) {
+ SetupCDTest.getExtendTest().log(Status.WARNING, "Artifact type not equal - this warnning represent defect.");
+ }
+ }
+ }
+
+ public static void validateArtifactVersionByTypeAndLabel(String artifactLabel, String expectedArtifactVersion, ArtifactTypeEnum artifactType) {
+ if(expectedArtifactVersion != null) {
+ String xPath;
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Going to validate artifact version ..."));
+ if(artifactType.getType().equals(ArtifactTypeEnum.HEAT_ENV.getType())){
+ xPath = "//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.VERSION_ENV.getValue() + artifactLabel + "']";
+ }else{
+ xPath = "//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.VERSION.getValue() + artifactLabel + "']";
+ }
+ String actualartifactVersion = GeneralUIUtils.getDriver().findElement(By.xpath(xPath)).getAttribute("textContent").trim();
+ Assert.assertEquals(actualartifactVersion, expectedArtifactVersion, "Artifact type " + artifactType.getType() + " expected version is " + expectedArtifactVersion + " not equal to " + actualartifactVersion);
+ }
+ }
+
+ public static void validateExistArtifactOnDeploymentInformationPage(String expectedArtifactLabel, String artifactUUID, String artifactVersion, String artifactType, boolean isDownloadable, boolean isEditable, boolean isDeletable, boolean isArtifactParametersEditable) {
+
+ String dataTestId = DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue() + expectedArtifactLabel;
+
+ List<WebElement> artifactElements = GeneralUIUtils.getWebElementsListByContainTestID(dataTestId);
+ Assert.assertEquals(artifactElements.size(), 1, "There are more then one artifact named " + expectedArtifactLabel);
+
+ WebElement artifact = artifactElements.get(0);
+ String actualArtifactLabel = GeneralUIUtils.getTextContentAttributeValue(artifact).trim();
+ Assert.assertEquals(actualArtifactLabel, expectedArtifactLabel);
+
+ if(artifactUUID != null) {
+ WebElement uuid = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + expectedArtifactLabel);
+ Assert.assertEquals(GeneralUIUtils.getTextContentAttributeValue(uuid).trim(), artifactUUID, "Artifact uuid not equal.");
+ }
+ if(artifactVersion != null) {
+ WebElement version = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.VERSION.getValue() + expectedArtifactLabel);
+ Assert.assertEquals(GeneralUIUtils.getTextContentAttributeValue(version).trim(), artifactVersion, "Artifact version not equal.");
+ }
+ if(artifactType != null) {
+ WebElement type = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.TYPE.getValue() + expectedArtifactLabel);
+ Assert.assertEquals(GeneralUIUtils.getTextContentAttributeValue(type).trim(), artifactType, "Artifact type not equal.");
+ }
+ if(isArtifactParametersEditable) {
+ Assert.assertNotNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.EDIT_PARAMETERS_OF_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that parameters edit button enabled.");
+ } else if(isArtifactParametersEditable==false) {
+ Assert.assertNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.EDIT_PARAMETERS_OF_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that parameters edit button disabled.");
+ }
+ if(isDownloadable) {
+ Assert.assertNotNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that download button enabled.");
+ } else if(isDownloadable==false) {
+ Assert.assertNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that download button disabled.");
+ }
+ if(isEditable) {
+ Assert.assertNotNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that edit button enabled.");
+ } else if(isEditable==false) {
+ Assert.assertNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that edit button disabled.");
+ }
+ if(isDeletable) {
+ Assert.assertNotNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.DELETE_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that delete button enabled.");
+ } else if(isDeletable==false) {
+ Assert.assertNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.DELETE_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that delete button disabled.");
+ }
+ }
+
+ public static void validateNotExistArtifactOnDeploymentInformationPage(String artifactLabel) {
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue() + artifactLabel), false);
+ }
+
+ public static void validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(String fileName, String artifactDisplayedName,
+ boolean isUpdateable, boolean isParametersEditable, boolean isDownloadable, boolean isDeleteable) {
+ Assert.assertEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_NAME.getValue() + artifactDisplayedName).getText(), fileName);
+ Assert.assertEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + artifactDisplayedName).getText(), artifactDisplayedName);
+
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + artifactDisplayedName);
+
+ if(isParametersEditable) {
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.EDIT_PARAMETERS_OF_ARTIFACT.getValue() + artifactDisplayedName), true, "Expect that parameters edit button enabled.");
+ } else {
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.EDIT_PARAMETERS_OF_ARTIFACT.getValue() + artifactDisplayedName), false, "Expect that parameters edit button disabled.");
+ }
+ if(isDownloadable) {
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DOWNLOAD.getValue() + artifactDisplayedName), true, "Expect that download button enabled.");
+ } else {
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DOWNLOAD.getValue() + artifactDisplayedName), false, "Expect that download button disabled.");
+ }
+ if(isDeleteable) {
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + artifactDisplayedName), true, "Expect that delete button enabled.");
+ } else {
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + artifactDisplayedName), false, "Expect that delete button disabled.");
+ }
+ if(isUpdateable) {
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + artifactDisplayedName);
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPopup.MODAL_WINDOW.getValue()), true, "Expect that edit button enabled.");
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPopup.DONE_BUTTON.getValue());
+ GeneralUIUtils.waitForElementInVisibilityByTestId(DataTestIdEnum.ArtifactPopup.DONE_BUTTON.getValue());
+ } else {
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + artifactDisplayedName);
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPopup.MODAL_WINDOW.getValue()), false, "Expect that edit button disabled.");
+ }
+
+ }
+
+ public static void validateNotExistArtifactOnCompositionRightMenuDeploymentInformationPage(String artifactDisplayedName) {
+ Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_NAME.getValue() + artifactDisplayedName), false);
+ }
+
+ public static File verifyUpdatedEnvParameters(HeatWithParametersDefinition pairToUpdate, File updateEnvFile, String dataTestId) throws Exception {
+ GeneralUIUtils.hoverOnAreaByTestId(dataTestId);
+ return verifyUpdatedEnvParameters(pairToUpdate, updateEnvFile);
+ }
+
+ public static File verifyUpdatedEnvParameters(HeatWithParametersDefinition pairToUpdate, File updateEnvFile) throws Exception {
+
+ String heatDisplayName = pairToUpdate.getHeatArtifactDisplayName();
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+heatDisplayName);
+ File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+
+ String pattern = PARAMETERS;
+ Map<String, Object> mapUpdetedEnvFile = FileHandling.parseYamlFileToMapByPattern(updateEnvFile, pattern);
+ Map<String, Object> mapDownloadedEnvFile = FileHandling.parseYamlFileToMapByPattern(latestFilefromDir, pattern);
+
+ SetupCDTest.getExtendTest().log(Status.INFO, "Going to check, that ENV file was updated ...");
+ assertTrue("File" + latestFilefromDir.getName() + " contains different parameters number from expected file", mapDownloadedEnvFile.size() == mapUpdetedEnvFile.size());
+ assertTrue("Updated file contains not updated parameters value", mapDownloadedEnvFile.entrySet().containsAll(mapUpdetedEnvFile.entrySet()));
+ return latestFilefromDir;
+ }
+
+ /**
+ * compare heat env files by pattern ("parameters")
+ * @param expectedFile
+ * @param actualFile
+ * @param pattern
+ * @throws Exception
+ */
+ public static void compareYamlFilesByPattern(File expectedFile, File actualFile, String pattern) throws Exception {
+
+ 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 ...");
+ 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()));
+ }
+
+ public static void compareYamlParametersByPattern(Map<String, Object> mapExpectedproperties, File actualFileproperties, String pattern) throws Exception {
+
+ 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());
+ Map<String, Object> newMap = new HashMap<>(mapActualFileProerties);
+ assertTrue("Actual file does not contains all expected parametrs", newMap.entrySet().containsAll(mapExpectedproperties.entrySet()));
+ }
+
+
+ public static File uploadCreatedUpdateParametersEnvFile(HeatWithParametersDefinition heatEnvDetails, String directoryPath) throws Exception {
+// created env file to upload
+ File pathToEnvParametersFile = prepareEnvParametersFile(heatEnvDetails, directoryPath);
+ ArtifactInfo heatEnvArtifactInfo = new ArtifactInfo(directoryPath, heatEnvDetails.getHeatEnvLabel()+".env", "heatEnvDesc", heatEnvDetails.getHeatEnvLabel(),heatEnvDetails.getHeatEnvArtifactType());
+ ArtifactUIUtils.fillAndAddNewEnvArtifactParameters(heatEnvArtifactInfo, CompositionPage.artifactPopup());
+ return pathToEnvParametersFile;
+ }
+
+ public static File prepareEnvParametersFile(HeatWithParametersDefinition heatEnvDetails, String directoryPath) throws IOException {
+ File pathToEnvParametersFile = FileHandling.createEmptyFile(directoryPath+heatEnvDetails.getHeatEnvLabel()+".env");
+// fill file
+ FileHandling.writeToFile(pathToEnvParametersFile, "parameters:", 0);
+ for(HeatParameterDataDefinition paramDefinition : heatEnvDetails.getHeatParameterDefinition()){
+ Object data = getDataToWrite(paramDefinition);
+ FileHandling.writeToFile(pathToEnvParametersFile, data, 2);
+ }
+
+ return pathToEnvParametersFile;
+ }
+
+ public static Object getDataToWrite(HeatParameterDataDefinition paramDefinition) {
+ Object data = "";
+ switch (paramDefinition.getType()) {
+ case "string":
+ String text = "\"string\"";
+ data = getFormatedData(paramDefinition.getName(), text);
+ break;
+ case "number":
+ data = getFormatedData(paramDefinition.getName(), 666);
+ break;
+ case "json":
+ String jsonText = "{\"param1\":\"param1\", \"param2\":2}";
+ data = getFormatedData(paramDefinition.getName(), jsonText);
+ break;
+ case "boolean":
+ if(paramDefinition.getCurrentValue().equals("true")){
+ data = getFormatedData(paramDefinition.getName(), false);
+ }else{
+ data = getFormatedData(paramDefinition.getName(), true);
+ }
+ break;
+ case "comma_delimited_list":
+ String commaDelimitedListText = "127.0.0.10, 127.0.0.15, 127.0.0.20";
+ data = getFormatedData(paramDefinition.getName(), commaDelimitedListText);
+ break;
+ default:
+ break;
+ }
+ return data;
+ }
+
+
+ public static Map<String, Object> getDataToWriteInUI(List<HeatParameterDataDefinition> paramDefinitionFromGetResourceResponse) {
+ Map<String, Object>newValuesToUpdateInUI=new HashMap<>();
+ for (HeatParameterDataDefinition param : paramDefinitionFromGetResourceResponse) {
+ System.out.println(param.getCurrentValue());
+ switch (param.getType()) {
+
+ case "string":
+ String text = "string";
+ newValuesToUpdateInUI.put(param.getName(),text);
+ break;
+ case "number":
+ newValuesToUpdateInUI.put(param.getName(),666);
+ break;
+ case "json":
+ String jsonText = "{\"param1\":\"param1\", \"param2\":2}";
+ newValuesToUpdateInUI.put(param.getName(),jsonText);
+ break;
+ case "boolean":
+ if (param.getCurrentValue().equals(true)) {
+ newValuesToUpdateInUI.put(param.getName(),false);
+ } else {
+ newValuesToUpdateInUI.put(param.getName(),true);
+ }
+ break;
+ case "comma_delimited_list":
+ String commaDelimitedListText = "127.0.0.10, 127.0.0.15, 127.0.0.20";
+ newValuesToUpdateInUI.put(param.getName(),commaDelimitedListText);
+ break;
+ default:
+ break;
+
+ }
+
+ }
+ return newValuesToUpdateInUI;
+ }
+
+ public static Object getValue(HeatParameterDataDefinition param) {
+ String type = param.getType();
+ Object result = null;
+ switch(type){
+ case "string":
+ result = param.getCurrentValue();
+ break;
+ case "number":
+ result = new Integer(param.getCurrentValue());
+ break;
+ case "json":
+ result = param.getCurrentValue();
+ break;
+ case "boolean":
+ result = new Boolean(param.getCurrentValue());
+ break;
+ case "comma_delimited_list":
+ result = param.getCurrentValue();
+ break;
+ default:
+ break;
+ }
+ return result;
+ }
+
+ public static Object getFormatedData(String name, Object text) {
+ return name + ": " + text;
+}
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AuditCDUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AuditCDUtils.java
new file mode 100644
index 0000000000..c53fef596a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AuditCDUtils.java
@@ -0,0 +1,67 @@
+/*-
+ * ============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.codehaus.jettison.json.JSONObject;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
+import org.openecomp.sdc.ci.tests.utils.general.Convertor;
+import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
+
+public class AuditCDUtils {
+
+ public static void validateResourceSuccessAudit(ResourceReqDetails resource, User user, String action)
+ throws Exception {
+ JSONObject auditBody = AuditValidationUtils.filterAuditByUuid(action, resource.getUUID());
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+ .constructFieldsForAuditValidation(resource, resource.getVersion(), user);
+ String auditAction = "Create";
+ expectedResourceAuditJavaObject.setAction(auditAction);
+ expectedResourceAuditJavaObject.setPrevVersion("");
+ expectedResourceAuditJavaObject.setPrevState("");
+ expectedResourceAuditJavaObject.setStatus("201");
+ expectedResourceAuditJavaObject.setDesc("OK");
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, auditBody.toString(), false);
+ }
+
+ public static void validateServiceSuccessAudit(ServiceReqDetails service, User user, String action)
+ throws Exception {
+ validateServiceSuccessAudit(service, user, action, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+ }
+
+ public static void validateServiceSuccessAudit(ServiceReqDetails service, User user, String action,
+ LifecycleStateEnum lifecycleStatus) throws Exception {
+ ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = AuditValidationUtils
+ .constructFieldsForAuditValidation(service, service.getVersion(), user);
+ String body = AuditValidationUtils.filterAuditByUuid(action, service.getUUID()).toString();
+ expectedResourceAuditJavaObject.setAction(action);
+ expectedResourceAuditJavaObject.setPrevState("");
+ expectedResourceAuditJavaObject.setPrevVersion("");
+ expectedResourceAuditJavaObject.setCurrState(lifecycleStatus.toString());
+ expectedResourceAuditJavaObject.setStatus("201");
+ expectedResourceAuditJavaObject.setDesc("OK");
+ AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, action, body, false);
+ }
+
+}
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
new file mode 100644
index 0000000000..fbe8c04036
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasElement.java
@@ -0,0 +1,54 @@
+/*-
+ * ============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
new file mode 100644
index 0000000000..18cb338891
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java
@@ -0,0 +1,179 @@
+/*-
+ * ============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
new file mode 100644
index 0000000000..e9ba11f0f4
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java
@@ -0,0 +1,232 @@
+/*-
+ * ============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.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+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.TypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils;
+import org.openqa.selenium.WebElement;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+public class CatalogUIUtilitis {
+
+
+
+
+
+ // Get all Categories , Subcategories and Icons.
+ public void getAllCategoriesAndSubcategories() throws IOException, JSONException {
+ RestResponse allcategoriesJson = CatalogRestUtils.getAllCategoriesTowardsCatalogBe();
+ JSONArray categories = new JSONArray(allcategoriesJson.getResponse());
+ for (int i = 0; i < categories.length(); i++) {
+ String categoryname = (String) categories.getJSONObject(i).get("name");
+ JSONArray subcategories = (JSONArray) categories.getJSONObject(i).get("subcategories");
+ for (int j = 0; j < subcategories.length(); j++) {
+ String subcategoryname = (String) subcategories.getJSONObject(j).get("name");
+ System.out.println(subcategoryname);
+ }
+ for (int j = 0; j < subcategories.length(); j++) {
+ JSONArray icons = (JSONArray) subcategories.getJSONObject(j).get("icons");
+ for (int k = 0; k < icons.length(); k++) {
+ System.out.println(icons.get(k));
+ }
+ }
+ System.out.println("-------------------------------");
+ }
+ }
+
+ @Test
+ // FOr testing---delete.
+ public static List<String> abcd() throws IOException, JSONException {
+ RestResponse allcategoriesJson = CatalogRestUtils.getAllCategoriesTowardsCatalogBe();
+ JSONArray categories = new JSONArray(allcategoriesJson.getResponse());
+ List<String> allcat = new ArrayList<>();
+ String uniqueId = null;
+ for (int i = 0; i < categories.length(); i++) {
+ String categoryname = (String) categories.getJSONObject(i).get("name");
+ uniqueId = (String) categories.getJSONObject(i).get("uniqueId");
+ allcat.add(uniqueId);
+ JSONArray subcategories = (JSONArray) categories.getJSONObject(i).get("subcategories");
+ for (int j = 0; j < subcategories.length(); j++) {
+ String subcategoryname = (String) subcategories.getJSONObject(j).get("name");
+ uniqueId = (String) subcategories.getJSONObject(j).get("uniqueId");
+ allcat.add(uniqueId);
+ }
+ }
+ return allcat;
+
+ }
+
+ public static void clickTopMenuButton(TopMenuButtonsEnum button) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s button ...", button.name()));
+ switch (button) {
+ case CATALOG:
+ GeneralUIUtils.getWebElementByTestID(button.getButton()).click();
+ break;
+ case HOME:
+ GeneralUIUtils.getWebElementByTestID(button.getButton()).click();
+ break;
+ case ON_BOARDING:
+ GeneralUIUtils.getWebElementByTestID(button.getButton()).click();
+ break;
+ default:
+ break;
+ }
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static String catalogFilterTypeChecBox(TypesEnum enumtype) throws Exception {
+ String Type = enumtype.toString().toLowerCase();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s ...", Type));
+ GeneralUIUtils.getWebElementByTestID(enumtype.getValue()).click();
+ return Type;
+ }
+
+ public static List<String> catalogFilterStatusChecBox(CheckBoxStatusEnum statusEnum) throws Exception {
+ List<String> status = null;
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s status", statusEnum.name()));
+ switch (statusEnum) {
+ case IN_DESIGN:
+ status = Arrays.asList("NOT_CERTIFIED_CHECKIN", "NOT_CERTIFIED_CHECKOUT");
+ GeneralUIUtils.getWebElementByTestID(statusEnum.getCatalogValue()).click();
+ break;
+ case READY_FOR_TESTING:
+ status = Arrays.asList("READY_FOR_CERTIFICATION");
+ GeneralUIUtils.getWebElementByTestID(statusEnum.getCatalogValue()).click();
+ break;
+ case IN_TESTING:
+ status = Arrays.asList("CERTIFICATION_IN_PROGRESS");
+ GeneralUIUtils.getWebElementByTestID(statusEnum.getCatalogValue()).click();
+ break;
+ case CERTIFIED:
+ status = Arrays.asList("CERTIFIED");
+ GeneralUIUtils.getWebElementByTestID(statusEnum.getCatalogValue()).click();
+ break;
+ case DISTRIBUTED:
+ status = Arrays.asList("CERTIFIED");
+ GeneralUIUtils.getWebElementByTestID(statusEnum.getCatalogValue()).click();
+ break;
+ }
+ return status;
+ }
+
+ // Get all Categories uniqueID .//The parent categories.
+ public static List<String> getCategories() throws IOException, JSONException {
+ List<String> allCategoriesList = new ArrayList<>();
+ RestResponse allcategoriesJson = CatalogRestUtils.getAllCategoriesTowardsCatalogBe();
+ JSONArray categories = new JSONArray(allcategoriesJson.getResponse());
+ for (int i = 0; i < categories.length(); i++) {
+ String categoryname = (String) categories.getJSONObject(i).get("name");
+ System.out.println(categoryname);
+ allCategoriesList.add(categoryname);
+ }
+ return allCategoriesList;
+ }
+
+ @Test
+ // Get Subcategories by Category name
+ public static List<String> getAllSubcategoriesByUniqueId(String uniqueId) throws IOException, JSONException {
+
+ RestResponse allcategoriesJson = CatalogRestUtils.getAllCategoriesTowardsCatalogBe();
+ JSONArray categories = new JSONArray(allcategoriesJson.getResponse());
+ List<String> subCategories = new ArrayList<>();// subCategories to
+ // return.
+ JSONArray subcategories = null;
+
+ for (int i = 0; i < categories.length(); i++) {
+
+ String categoryuniqueId = (String) categories.getJSONObject(i).get("uniqueId");
+
+ if (categoryuniqueId.contentEquals(uniqueId)) {
+ subcategories = (JSONArray) categories.getJSONObject(i).get("subcategories");
+
+ for (int j = 0; j < subcategories.length(); j++) {
+
+ subCategories.add((String) subcategories.getJSONObject(j).get("uniqueId"));
+ }
+
+ break;
+ }
+ }
+ if (subcategories == null) {
+ subCategories.add(uniqueId);
+ }
+ return subCategories;
+ }
+
+ @Test
+ // Get icons by category name
+ public void getSubCategoryIcons() throws IOException, JSONException {
+ RestResponse allcategoriesJson = CatalogRestUtils.getAllCategoriesTowardsCatalogBe();
+
+ JSONArray categories = new JSONArray(allcategoriesJson.getResponse());
+ for (int i = 0; i < categories.length(); i++) {
+ String subcategoryname = (String) categories.getJSONObject(i).get("name");
+ if (subcategoryname.contentEquals("Generic")) {
+ JSONArray subcategories = (JSONArray) categories.getJSONObject(i).get("subcategories");
+ for (int j = 0; j < subcategories.length(); j++) {
+ JSONArray icons = (JSONArray) subcategories.getJSONObject(j).get("icons");
+ for (int k = 0; k < icons.length(); k++) {
+ System.out.println(icons.get(k));
+ }
+ }
+ break;
+ }
+ }
+ }
+
+
+ public static WebElement clickOnUpperCategoryCheckbox() throws InterruptedException {
+ List<WebElement> categorieCheckboxes = GeneralUIUtils.getElementsByCSS("span[data-tests-id*='category']"); // get all categories and subcategories
+ WebElement categorieCheckbox = categorieCheckboxes.get(0);
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s category ...", categorieCheckbox.getText()));
+ categorieCheckbox.click();
+ GeneralUIUtils.ultimateWait();
+ return categorieCheckbox;
+ }
+
+ public static void clickOnLeftPanelElement(DataTestIdEnum.CatalogPageLeftPanelFilterTitle leftPanelElement) throws InterruptedException {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", leftPanelElement.name()));
+ GeneralUIUtils.getElementsByCSS(leftPanelElement.getValue()).forEach(WebElement::click);
+ }
+
+ public static WebElement catalogSearchBox(String searchText) {
+ WebElement searchBox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue());
+ searchBox.clear();
+ searchBox.sendKeys(searchText);
+ return searchBox;
+ }
+
+}
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
new file mode 100644
index 0000000000..08b392fcd6
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java
@@ -0,0 +1,115 @@
+/*-
+ * ============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.io.File;
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.AttFtpClient;
+import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory;
+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.HomePage;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import com.aventstack.extentreports.Status;
+
+public class DownloadManager {
+
+
+ public File fetchDownloadedFile(){
+
+ File retrieveLastModifiedFileFromFTP = null;
+
+ if (DriverFactory.getConfig().isRemoteTesting()){
+
+
+ try {
+
+ AttFtpClient instance = AttFtpClient.getInstance();
+ AttFtpClient.getInstance().retrieveListOfFile();
+ retrieveLastModifiedFileFromFTP = instance.retrieveLastModifiedFileFromFTP();
+
+ } catch (Exception e) {
+ System.out.println("could not retriev file");
+ }
+
+ return retrieveLastModifiedFileFromFTP;
+
+ }
+
+
+ return retrieveLastModifiedFileFromFTP;
+
+ }
+
+
+ /**
+ * this method download csar file from VSP repository to default browser download directory
+ * @param vspName
+ * @throws Exception
+ */
+ public static void downloadCsarByNameFromVSPRepository(String vspName, String vspId) throws Exception{
+ 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());
+ 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();
+ }
+ }
+
+// AttFtpClient instance = AttFtpClient.getInstance();
+//
+// String server = "135.177.130.113";
+// int port = 2121;
+// String user = "admin";
+// String pass = "admin";
+// AttFtpClient.getInstance().init(server, port, user, pass);
+//
+// try {
+// AttFtpClient.getInstance().retrieveListOfFile();
+//
+// File retrieveLastModifiedFileFromFTP = instance.retrieveLastModifiedFileFromFTP();
+// String content = new String(Files.readAllBytes(Paths.get(retrieveLastModifiedFileFromFTP.getPath())), StandardCharsets.UTF_8);
+//// instance.deleteFilesFromFTPserver();
+// System.out.println(content);
+// readFile(retrieveLastModifiedFileFromFTP);
+//
+// } finally {
+// instance.terminateClient();
+// }
+
+
+}
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
new file mode 100644
index 0000000000..6008f200d2
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java
@@ -0,0 +1,505 @@
+/*-
+ * ============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.assertTrue;
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+
+import org.apache.commons.io.FileUtils;
+import org.openecomp.sdc.ci.tests.config.Config;
+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;
+import org.yaml.snakeyaml.Yaml;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+public class FileHandling {
+
+// ------------------yaml parser methods----------------------------
+ public static Map<?, ?> parseYamlFile(String filePath) throws Exception {
+ Yaml yaml = new Yaml();
+ File file = new File(filePath);
+ InputStream inputStream = new FileInputStream(file);
+ Map<?, ?> map = (Map<?, ?>) yaml.load(inputStream);
+ return map;
+ }
+
+ /**
+ * The method return map fetched objects by pattern from yaml file
+ * @param yamlFile
+ * @param pattern
+ * @return
+ * @throws Exception
+ */
+ public static Map<String, Object> parseYamlFileToMapByPattern(File yamlFile, String pattern) throws Exception {
+ Map<?, ?> yamlFileToMap = FileHandling.parseYamlFile(yamlFile.toString());
+ Map<String, Object> objectMap = getObjectMapByPattern(yamlFileToMap, pattern);
+ return objectMap;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Map<String, Object> getObjectMapByPattern(Map<?, ?> parseUpdetedEnvFile, String pattern) {
+ Map<String, Object> objectMap = null;
+
+ Object objectUpdetedEnvFile = parseUpdetedEnvFile.get(pattern);
+ if(objectUpdetedEnvFile instanceof HashMap){
+ objectMap = (Map<String, Object>) objectUpdetedEnvFile;
+ }
+ return objectMap;
+ }
+
+// -------------------------------------------------------------------------------------------------
+
+ 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;
+ }
+
+ else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+ filepath = FileHandling.getBasePath() + "Files" + File.separator + folder + File.separator;
+ }
+
+ System.out.println(filepath);
+
+ return filepath;
+ }
+
+ public static String getBasePath() {
+ return System.getProperty("user.dir") + File.separator;
+ }
+
+ public static String getDriversPath() {
+ return getBasePath() + "src" + File.separator + "main" + File.separator + "resources"
+ + File.separator + "ci" + File.separator + "drivers" + File.separator;
+ }
+
+ public static String getResourcesFilesPath() {
+ return getBasePath() + "src" + File.separator + "main" + File.separator + "resources"
+ + File.separator + "Files" + File.separator;
+ }
+
+ public static String getResourcesEnvFilesPath() {
+ return getBasePath() + File.separator + "src" + File.separator + "main" + File.separator + "resources"
+ + File.separator + "Files" + File.separator + "ResourcesEnvFiles" +File.separator;
+ }
+
+ public static String getCiFilesPath() {
+ return getBasePath() + "src" + File.separator + "main" + File.separator + "resources"
+ + File.separator + "ci";
+ }
+
+ public static String getConfFilesPath() {
+ return getCiFilesPath() + File.separator + "conf" + File.separator;
+ }
+
+ public static String getTestSuitesFilesPath() {
+ return getCiFilesPath() + File.separator + "testSuites" + File.separator;
+ }
+
+ public static String getVnfRepositoryPath() {
+ return getFilePath("VNFs");
+ }
+
+ public static File getConfigFile(String configFileName) throws Exception {
+ File configFile = new File(FileHandling.getBasePath() + File.separator + "conf" + File.separator + configFileName);
+ if (!configFile.exists()) {
+ configFile = new File(FileHandling.getConfFilesPath() + configFileName);
+ }
+ return configFile;
+ }
+
+ public static Object[] filterFileNamesFromFolder(String filepath, String extension) {
+ try {
+ File dir = new File(filepath);
+ List<String> filenames = new ArrayList<String>();
+
+ FilenameFilter extensionFilter = new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(extension);
+ }
+ };
+
+ if (dir.isDirectory()) {
+ for (File file : dir.listFiles(extensionFilter)) {
+ filenames.add(file.getName());
+ }
+ return filenames.toArray();
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static String[] getArtifactsFromZip(String filepath, String zipFilename){
+ try{
+ ZipFile zipFile = new ZipFile(filepath + File.separator + zipFilename);
+ Enumeration<? extends ZipEntry> entries = zipFile.entries();
+
+ String[] artifactNames = new String[zipFile.size() - 1];
+
+ int i = 0;
+ while(entries.hasMoreElements()){
+ ZipEntry nextElement = entries.nextElement();
+ if (!nextElement.isDirectory()){
+ if (!nextElement.getName().equals("MANIFEST.json")){
+ String name = nextElement.getName();
+ artifactNames[i++] = name;
+ }
+ }
+ }
+ zipFile.close();
+ return artifactNames;
+ }
+ catch(ZipException zipEx){
+ System.err.println("Error in zip file named : " + zipFilename);
+ zipEx.printStackTrace();
+ } catch (IOException e) {
+ System.err.println("Unhandled exception : ");
+ e.printStackTrace();
+ }
+
+ return null;
+
+ }
+
+ public static Object[] getZipFileNamesFromFolder(String filepath) {
+ return filterFileNamesFromFolder(filepath, ".zip");
+ }
+
+ public static int countFilesInZipFile(String[] artifactsArr, String reqExtension){
+ int fileCounter = 0;
+ for (String artifact : artifactsArr){
+ String extensionFile = artifact.substring(artifact.lastIndexOf(".") + 1 , artifact.length());
+ if (extensionFile.equals(reqExtension)){
+ fileCounter++;
+ }
+ }
+ return fileCounter;
+ }
+
+
+ public static synchronized File getLastModifiedFileFromDir() throws Exception{
+ return getLastModifiedFileFromDir(SetupCDTest.getWindowTest().getDownloadDirectory());
+ }
+
+ public static synchronized File getLastModifiedFileFromDir(String dirPath){
+ File dir = new File(dirPath);
+ File[] files = dir.listFiles();
+ if (files == null) {
+ assertTrue("File not found under directory " + dirPath, false);
+ return null;
+ }
+
+ File lastModifiedFile = files[0];
+ for (int i = 1; i < files.length; i++) {
+ if(files[i].isDirectory()) {
+ continue;
+ }
+ if (lastModifiedFile.lastModified() < files[i].lastModified()) {
+ lastModifiedFile = files[i];
+ }
+ }
+ return lastModifiedFile;
+ }
+
+ public static void deleteDirectory(String directoryPath) {
+ File dir = new File(directoryPath);
+ try {
+ FileUtils.deleteDirectory(dir);
+ } catch (IOException e) {
+ System.out.println("Failed to delete " + dir);
+ SetupCDTest.getExtendTest().log(Status.INFO, "Failed to delete " + dir);
+ }
+ }
+
+ public static void createDirectory(String directoryPath) {
+ File directory = new File(String.valueOf(directoryPath));
+ if (! directory.exists()){
+ directory.mkdir();
+ }
+ }
+
+
+ /**
+ * The method append data to existing file, if file not exists - create it
+ * @param pathToFile
+ * @param text
+ * @param leftSpaceCount
+ * @throws IOException
+ */
+ public static synchronized void writeToFile(File pathToFile, Object text, Integer leftSpaceCount) throws IOException{
+
+ BufferedWriter bw = null;
+ FileWriter fw = null;
+ if(!pathToFile.exists()){
+ createEmptyFile(pathToFile);
+ }
+ try {
+ fw = new FileWriter(pathToFile, true);
+ bw = new BufferedWriter(fw);
+ StringBuilder sb = new StringBuilder();
+ if(leftSpaceCount > 0 ){
+ for(int i = 0; i < leftSpaceCount; i++){
+ sb.append(" ");
+ }
+ }
+ bw.write(sb.toString() + text);
+ bw.newLine();
+ bw.close();
+ fw.close();
+ } catch (Exception e) {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Unable to write to flie " + pathToFile);
+ }
+ }
+
+ public static synchronized void writeToFile(File pathToFile, Map<String, Pair<String, Object>> dataMap, Integer leftSpaceCount) throws IOException{
+
+ BufferedWriter bw = null;
+ FileWriter fw = null;
+ try {
+ if(!pathToFile.exists()){
+ createEmptyFile(pathToFile);
+ }
+ fw = new FileWriter(pathToFile, true);
+ bw = new BufferedWriter(fw);
+ StringBuilder sb = new StringBuilder();
+ if(leftSpaceCount > 0 ){
+ for(int i = 0; i < leftSpaceCount; i++){
+ sb.append(" ");
+ }
+ }
+ for(Map.Entry<String, Pair<String, Object>> entry : dataMap.entrySet()){
+ Object record = ArtifactUIUtils.getFormatedData(entry.getKey(), entry.getValue().right);
+ bw.write(sb.toString() + record);
+ bw.newLine();
+ }
+ bw.close();
+ fw.close();
+ } catch (Exception e) {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Unable to write to flie " + pathToFile);
+ }
+ }
+
+ public static void deleteLastDowloadedFiles(List<File> files) throws IOException {
+ for (File file : files) {
+ File fileToDelete =new File(Config.instance().getWindowsDownloadDirectory()+file.getName());
+ fileToDelete.delete();
+ }
+ }
+
+ public static void cleanCurrentDownloadDir() throws IOException {
+ try{
+ ExtentTestActions.log(Status.INFO, "Cleaning directory " + SetupCDTest.getWindowTest().getDownloadDirectory());
+ System.gc();
+ FileUtils.cleanDirectory(new File(SetupCDTest.getWindowTest().getDownloadDirectory()));
+ }
+ catch(Exception e){
+
+ }
+ }
+
+ public static boolean isFileDownloaded(String downloadPath, String fileName) {
+ boolean flag = false;
+ File dir = new File(downloadPath);
+ File[] dir_contents = dir.listFiles();
+ for (int i = 0; i < dir_contents.length; i++) {
+ if (dir_contents[i].getName().equals(fileName))
+ return flag = true;
+ }
+ return flag;
+ }
+
+ public static String getMD5OfFile(File file) throws IOException {
+ String content = FileUtils.readFileToString(file);
+ String md5 = GeneralUtility.calculateMD5ByString(content);
+ return md5;
+ }
+
+ public static File createEmptyFile(String fileToCreate) {
+ File file= new File(fileToCreate);
+ try {
+ if(file.exists()){
+ deleteFile(file);
+ }
+ file.createNewFile();
+ SetupCDTest.getExtendTest().log(Status.INFO, "Create file " + fileToCreate);
+ } catch (IOException e) {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Failed to create file " + fileToCreate);
+ e.printStackTrace();
+ }
+ return file;
+ }
+
+ public static File createEmptyFile(File fileToCreate) {
+ try {
+ if(fileToCreate.exists()){
+ deleteFile(fileToCreate);
+ }
+ fileToCreate.createNewFile();
+ SetupCDTest.getExtendTest().log(Status.INFO, "Create file " + fileToCreate);
+ } catch (IOException e) {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Failed to create file " + fileToCreate);
+ e.printStackTrace();
+ }
+ return fileToCreate;
+ }
+
+ public static void deleteFile(File file){
+
+ try{
+ if(file.exists()){
+ file.deleteOnExit();
+ SetupCDTest.getExtendTest().log(Status.INFO, "File " + file.getName() + "has been deleted");
+ }else{
+ SetupCDTest.getExtendTest().log(Status.INFO, "Failed to delete file " + file.getName());
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+
+ }
+
+
+ /**
+ * get file list from directory by extension array
+ * @param directory
+ * @param okFileExtensions
+ * @return
+ */
+ public static List<File> getHeatAndHeatEnvArtifactsFromZip(File directory, String[] okFileExtensions){
+
+ List<File> fileList = new ArrayList<>();
+ File[] files = directory.listFiles();
+
+ for (String extension : okFileExtensions){
+ for(File file : files){
+ if (file.getName().toLowerCase().endsWith(extension)){
+ fileList.add(file);
+ }
+ }
+ }
+ return fileList;
+ }
+
+ private static final int BUFFER_SIZE = 4096;
+ public static void unzip(String zipFilePath, String destDirectory) throws IOException {
+ File destDir = new File(destDirectory);
+ if (!destDir.exists()) {
+ destDir.mkdir();
+ }
+ ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFilePath));
+ ZipEntry entry = zipIn.getNextEntry();
+// iterates over entries in the zip file
+ while (entry != null) {
+ String entryName;
+ if(System.getProperty("os.name").contains("Windows")){
+ entryName = entry.getName().replaceAll("/", "\\"+File.separator);
+ }else{
+ entryName = entry.getName();
+ }
+ String filePath = destDirectory + entryName;
+ String currPath = destDirectory;
+ String[] dirs = entryName.split("\\"+File.separator);
+ String currToken;
+ for(int i = 0; i<dirs.length;++i){
+ currToken = dirs[i];
+ if(!entry.isDirectory() && i==dirs.length-1){
+ extractFile(zipIn, filePath);
+ } else {
+ if(currPath.endsWith(File.separator)){
+ currPath = currPath + currToken;
+ }else{
+ currPath = currPath + File.separator + currToken;
+ }
+// if the entry is a directory, make the directory
+ File dir = new File(currPath);
+ dir.mkdir();
+ }
+ }
+ zipIn.closeEntry();
+ entry = zipIn.getNextEntry();
+ }
+ zipIn.close();
+ }
+
+ private static void extractFile(ZipInputStream zipIn, String filePath) throws IOException {
+ BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath));
+ byte[] bytesIn = new byte[BUFFER_SIZE];
+ int read = 0;
+ while ((read = zipIn.read(bytesIn)) != -1) {
+ bos.write(bytesIn, 0, read);
+ }
+ bos.close();
+ }
+
+ public static int getFileCountFromDefaulDownloadDirectory(){
+ return new File(SetupCDTest.getWindowTest().getDownloadDirectory()).listFiles().length;
+ }
+
+
+ public static String getKeyByValueFromPropertyFormatFile(String fullPath, String key) {
+ Properties prop = new Properties();
+ InputStream input = null;
+ String value = null;
+ try {
+ input = new FileInputStream(fullPath);
+ prop.load(input);
+ value = (prop.getProperty(key));
+
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ } finally {
+ if (input != null) {
+ try {
+ input.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ return value.replaceAll("\"","");
+ }
+}
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
new file mode 100644
index 0000000000..19c2242550
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java
@@ -0,0 +1,790 @@
+/*-
+ * ============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.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.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
+
+import org.apache.commons.io.FileUtils;
+import org.openecomp.sdc.ci.tests.datatypes.CatalogFilterTitlesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.DashboardCardEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.OutputType;
+import org.openqa.selenium.TakesScreenshot;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.FluentWait;
+import org.openqa.selenium.support.ui.Select;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import com.aventstack.extentreports.Status;
+
+
+public final class GeneralUIUtils {
+
+ public static final String FILE_NAME = "Valid_tosca_Mycompute.yml";
+
+ private static int timeOut=(int) (60*1.5);
+
+// public static void setTimeOut(int time) {
+// if (time>0) {
+// timeOut=time;
+// }
+// else {
+// timeOut=timeOut;
+// }
+// }
+
+ /**************** DRIVER ****************/
+
+ public static WebDriver getDriver() {
+ try{
+ return DriverFactory.getDriver();
+ }
+ catch(Exception e){
+ e.printStackTrace();
+ }
+ return null;
+ }
+ /****************************************/
+
+ public static List<WebElement> getElemenetsFromTable(By by) {
+ return getDriver().findElements(by);
+ }
+
+ public static File takeScreenshot(String screenshotFilename, String dir, String testName) throws IOException {
+ if (screenshotFilename == null) {
+ if (testName != null){
+ screenshotFilename = testName;
+ }
+ else
+ {
+ screenshotFilename = UUID.randomUUID().toString();
+ }
+ }
+ try {
+ File scrFile = ((TakesScreenshot) getDriver()).getScreenshotAs(OutputType.FILE);
+ File filePath = new File(String.format("%s/%s.png", dir, screenshotFilename));
+ new File(dir).mkdirs();
+ FileUtils.copyFile(scrFile, filePath);
+ return filePath;
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ return null;
+ }
+
+ public static File takeScreenshot(String screenshotFilename, String dir) throws IOException{
+ return takeScreenshot(screenshotFilename, dir, null);
+ }
+
+
+ public static void scrollDown() {
+ try{
+ Robot robot = new Robot();
+ robot.keyPress(KeyEvent.VK_DOWN);
+ robot.keyRelease(KeyEvent.VK_DOWN);
+ GeneralUIUtils.waitForLoader();
+ }
+ catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ public static void minimizeCatalogFilterByTitle(CatalogFilterTitlesEnum titlesEnum) {
+
+ switch (titlesEnum) {
+ case CATEGORIES:
+ GeneralUIUtils.getWebElementByTestID(titlesEnum.getValue()).click();
+ break;
+ case STATUS:
+ GeneralUIUtils.getWebElementByTestID(titlesEnum.getValue()).click();
+ break;
+ case TYPE:
+ GeneralUIUtils.getWebElementByTestID(titlesEnum.getValue()).click();
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ public static WebElement getWebElementByTestID(String dataTestId) {
+ return getWebElementByTestID(dataTestId, timeOut);
+ }
+
+ public static WebElement getWebElementByTestID(String dataTestId, int timeout) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeout);
+ return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+ }
+
+ public static boolean isWebElementExistByTestId(String dataTestId) {
+ if(getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']")).size() == 0) {
+ return false;
+ }
+ return true;
+ }
+
+ public static WebElement getInputElement(String dataTestId) {
+ try{
+ ultimateWait();
+ return getDriver().findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']"));
+ }
+ catch(Exception e){
+ return null;
+ }
+ }
+
+ public static List<WebElement> getInputElements(String dataTestId) {
+ ultimateWait();
+ return getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']"));
+
+ }
+
+ public static WebElement getWebElementBy(By by) {
+ return getWebElementBy(by, timeOut);
+ }
+
+ public static WebElement getWebElementBy(By by, int timeOut) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ return wait.until(ExpectedConditions.visibilityOfElementLocated(by));
+ }
+
+ public static List<String> getWebElementListText(List<WebElement>elements) {
+ List<String>Text=new ArrayList<>();
+ for (WebElement webElement : elements) {
+ Text.add(webElement.getText());
+ }
+ return Text;
+ }
+
+
+ public static List<WebElement> getWebElementsListBy(By by) {
+ return getWebElementsListBy(by, timeOut);
+ }
+
+ public static List<WebElement> getWebElementsListBy(By by, int timeOut) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(by));
+ }
+
+ public static List<WebElement> getWebElementsListByContainTestID(String dataTestId) {
+ try{
+ WebDriverWait wait = new WebDriverWait(getDriver(), 10);
+ return wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("//*[contains(@data-tests-id, '"+dataTestId+"')]")));
+ }
+ catch(Exception e){
+ return new ArrayList<WebElement>();
+ }
+ }
+
+ public static List<WebElement> getWebElementsListByContainsClassName(String containedText) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ return wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("//*[contains(@class, '"+containedText+"')]")));
+ }
+
+ public static WebElement getWebElementByContainsClassName(String containedText) {
+ return getWebElementBy(By.xpath("//*[contains(@class, '"+containedText+"')]"));
+ }
+
+ public static WebElement getWebElementByClassName(String className) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ return wait.until(ExpectedConditions.visibilityOfElementLocated(By.className(className)));
+ }
+
+ public static WebElement getWebElementByLinkText(String linkText) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@text='" + linkText + "']")));
+ }
+
+
+ public static List<WebElement> getWebElementsListByTestID(String dataTestId) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+ }
+
+ public static List<WebElement> getWebElementsListByClassName(String className) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.className(className)));
+ }
+
+
+
+
+ public static Boolean isElementInvisibleByTestId(String dataTestId) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ return wait.until(
+ ExpectedConditions.invisibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+ }
+
+ public static Boolean isElementVisibleByTestId(String dataTestId) {
+ try{
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ if(wait.until(ExpectedConditions.visibilityOfElementLocated((By.xpath("//*[@data-tests-id='" + dataTestId + "']")))).isDisplayed()){
+ return true;
+ }else {
+ return false;
+ }
+ }
+ catch(Exception e){
+ return false;
+ }
+ }
+
+ public static void clickOnElementByTestId(String dataTestId) {
+ clickOnElementByTestIdWithoutWait(dataTestId);
+ ultimateWait();
+ }
+
+ public static void clickOnElementByTestIdWithoutWait(String dataTestId) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))).click();
+ }
+
+ public static void clickOnElementByTestId(String dataTestId, int customTimeout) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), customTimeout);
+ wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))).click();
+ }
+
+ public static WebElement waitForElementVisibilityByTestId(String dataTestId) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+ }
+
+ public static Boolean waitForElementInVisibilityByTestId(String dataTestId) {
+ return waitForElementInVisibilityByTestId(dataTestId, timeOut);
+ }
+
+ public static Boolean waitForElementInVisibilityByTestId(String dataTestId, int timeOut) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ boolean displayed = getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']")).isEmpty();
+ if (!displayed){
+ Boolean until = wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "'])")));
+ ultimateWait();
+ return until;
+ }
+ return false;
+ }
+
+ public static Boolean waitForElementInVisibilityByTestId(By by) {
+ return waitForElementInVisibilityBy(by, timeOut);
+ }
+
+
+ public static Boolean waitForElementInVisibilityBy(By by, int timeOut) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ boolean displayed = getDriver().findElements(by).isEmpty();
+ if (!displayed){
+ Boolean until = wait.until(ExpectedConditions.invisibilityOfElementLocated(by));
+ sleep(1000);
+ return until;
+ }
+ return false;
+ }
+
+
+ public static void setWebElementByTestId(String elemetID, String value) {
+ WebElement resourceDescriptionTextbox = GeneralUIUtils.getWebElementByTestID(elemetID);
+ resourceDescriptionTextbox.clear();
+ resourceDescriptionTextbox.sendKeys(value);
+
+ }
+
+ public static WebElement hoverOnAreaByTestId(String areaId) {
+ Actions actions = new Actions(getDriver());
+ WebElement area = getWebElementByTestID(areaId);
+ actions.moveToElement(area).perform();
+ ultimateWait();
+ return area;
+ }
+
+ public static WebElement hoverOnAreaByClassName(String className) {
+ Actions actions = new Actions(getDriver());
+ WebElement area = getWebElementByClassName(className);
+ actions.moveToElement(area).perform();
+ GeneralUIUtils.ultimateWait();
+ return area;
+ }
+
+ public static void clickElementUsingActions(WebElement element){
+ Actions actions = new Actions(getDriver());
+
+ actions.moveToElement(element);
+ actions.perform();
+
+ actions.click();
+ actions.perform();
+
+ ultimateWait();
+ }
+
+ public static void waitForLoader() {
+ waitForLoader(timeOut);
+ }
+
+ public static void waitForLoader(int timeOut) {
+ sleep(500);
+ waitForElementInVisibilityBy(By.className("tlv-loader"), timeOut);
+ }
+
+ public static void findComponentAndClick(String resourceName) throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " in homepage");
+ WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue());
+ try{
+ searchTextbox.clear();
+ searchTextbox.sendKeys(resourceName);
+ ultimateWait();
+ }
+ catch(Exception e){
+ SetupCDTest.getExtendTest().log(Status.INFO, "Can't interact with search bar");
+ e.printStackTrace();
+ }
+
+
+ try{
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component from home screen", resourceName));
+ clickOnElementByTestId(resourceName);
+ GeneralUIUtils.ultimateWait();
+ getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue());
+ }
+ catch(Exception e){
+ SetupCDTest.getExtendTest().log(Status.INFO, "Can't click on component named " + resourceName);
+ e.printStackTrace();
+ }
+ }
+
+
+ public static String getComponentVersion(String componentName) {
+ return GeneralUIUtils.getWebElementByTestID(componentName + "Version").getText();
+ }
+
+ public static void windowZoomOut() {
+ final int zoomOutFactor = 3;
+ for (int i = 0; i < zoomOutFactor; i++) {
+ if(getDriver() instanceof FirefoxDriver) {
+ getDriver().findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT));
+ }
+ }
+ }
+
+ public static void resetZoom(){
+ getDriver().findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL, "0"));
+ }
+
+ public static void windowZoomOutUltimate(){
+ resetZoom();
+ windowZoomOut();
+// JavascriptExecutor js = (JavascriptExecutor) driver;
+// js.executeScript("document.body.style.zoom='90%'");
+ }
+
+ public static void clickASDCLogo() {
+ WebDriverWait wait = new WebDriverWait(getDriver(), 15);
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("ASDC")));
+ WebElement ClickASDCLogo = getDriver().findElement(By.linkText("ASDC"));
+ ClickASDCLogo.click();
+ GeneralUIUtils.waitForLoader();
+ }
+
+ public static void sleep(int duration) {
+ try {
+ Thread.sleep(duration);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ 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(String dataTestId) {
+ clickOnElementByTestId(dataTestId);
+ ultimateWait();
+ }
+
+
+ public static Select getSelectList(String item, String datatestsid) {
+ Select selectlist = new Select(getWebElementByTestID(datatestsid));
+ if (item != null) {
+ selectlist.selectByVisibleText(item);
+ }
+ return selectlist;
+ }
+
+ public static List<WebElement> waitForElementsListVisibilityTestMethod(DashboardCardEnum dataTestId) {
+ GeneralUIUtils.waitForLoader();
+ return getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId.getValue() + "']"));
+ }
+
+ public static List<WebElement> getElementsByCSS(String cssString) throws InterruptedException {
+ GeneralUIUtils.waitForLoader();
+ List<WebElement> assets = getDriver().findElements(By.cssSelector(cssString));
+ return assets;
+ }
+
+ public static WebElement getElementfromElementByCSS(WebElement parentElement, String cssString){
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ GeneralUIUtils.waitForLoader();
+ return parentElement.findElement(By.cssSelector(cssString));
+ }
+
+ public static WebElement getElementfromElementByXPATH(WebElement parentElement, DashboardCardEnum dataTestId){
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ GeneralUIUtils.waitForLoader();
+ return HighlightMyElement( parentElement.findElement(By.xpath("//*[@data-tests-id='" + dataTestId.getValue() + "']")));
+ }
+
+ public static WebElement HighlightMyElement(WebElement element) {
+ JavascriptExecutor javascript = (JavascriptExecutor) getDriver();
+ javascript.executeScript("arguments[0].setAttribute('style', arguments[1]);", element, "color: yellow; border: 4px solid yellow;");
+ return element;
+ }
+
+ public static WebElement getSelectedElementFromDropDown(String dataTestId){
+ GeneralUIUtils.ultimateWait();;
+ WebElement selectedElement = new Select (getDriver().findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))).getFirstSelectedOption();
+ return selectedElement;
+ }
+
+
+ public static void waitForPageLoadByReadyState() {
+ new WebDriverWait(getDriver(), 30).until((ExpectedCondition<Boolean>) wd ->
+ ((JavascriptExecutor) wd).executeScript("return document.readyState").equals("complete"));
+ }
+
+
+ public static boolean checkElementsCountInTable(int expectedElementsCount, Supplier<List<WebElement>> func) {
+ int maxWaitingPeriodMS = 10 * 1000;
+ int napPeriodMS = 100;
+ int sumOfWaiting = 0;
+ List<WebElement> elements = null;
+ boolean isKeepWaiting = false;
+ while (!isKeepWaiting) {
+ elements = func.get();
+ isKeepWaiting = (expectedElementsCount == elements.size());
+ sleep(napPeriodMS);
+ sumOfWaiting += napPeriodMS;
+ if (sumOfWaiting > maxWaitingPeriodMS)
+ return false;
+ }
+ return true;
+ }
+
+ public static String getActionDuration(Runnable func) throws Exception{
+ long startTime = System.nanoTime();
+ func.run();
+ long estimateTime = System.nanoTime();
+ long duration = TimeUnit.NANOSECONDS.toSeconds(estimateTime - startTime);
+ String durationString = String.format("%02d:%02d", duration / 60, duration % 60);
+ return durationString;
+ }
+
+ public static WebElement clickOnAreaJS(String areaId) {
+ return clickOnAreaJS(areaId, timeOut);
+ }
+
+
+ public static WebElement clickOnAreaJS(String areaId, int timeout) {
+ try{
+ ultimateWait();
+ WebElement area = getWebElementByTestID(areaId);
+ JavascriptExecutor javascript = (JavascriptExecutor) getDriver();
+ //HighlightMyElement(area);
+ Object executeScript = javascript.executeScript("arguments[0].click();", area, "color: yellow; border: 4px solid yellow;");
+ waitForLoader(timeout);
+ return area;
+ }
+ catch (Exception e){
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+
+
+ public static WebElement clickOnAreaJS(WebElement areaId) throws InterruptedException {
+ JavascriptExecutor javascript = (JavascriptExecutor) getDriver();
+ //HighlightMyElement(area);
+ javascript.executeScript("arguments[0].click();", areaId, "color: yellow; border: 4px solid yellow;");
+ return areaId;
+ }
+
+
+
+ public static void clickSomewhereOnPage() {
+ getDriver().findElement(By.cssSelector(".asdc-app-title")).click();
+ }
+
+ public static void findComponentAndClickInCatalog(String resourceName) throws Exception {
+ // This method will find element by element name, don't use data-tests-id argument
+ WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue());
+ searchTextbox.clear();
+ searchTextbox.sendKeys(resourceName);
+ ultimateWait();
+ clickOnElementByText(resourceName);
+ ultimateWait();
+ }
+
+ public static void clickOnElementByText(String textInElement) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ HighlightMyElement(wait.until(
+ ExpectedConditions.elementToBeClickable(findByText(textInElement)))).click();
+ }
+
+ public static void clickOnElementByText(String textInElement, int customTimeout) {
+ WebDriverWait wait = new WebDriverWait(getDriver(), customTimeout);
+ HighlightMyElement(wait.until(
+ ExpectedConditions.elementToBeClickable(findByText(textInElement)))).click();
+ }
+
+ public static void clickJSOnElementByText(String textInElement) throws Exception {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ clickOnAreaJS(wait.until(
+ ExpectedConditions.elementToBeClickable(findByText(textInElement))));
+ }
+
+ public static void fluentWaitTestID(String dataTestId, String text) {
+ FluentWait<WebDriver> fluentWait = new FluentWait<WebDriver>(getDriver())
+ .withTimeout(30, TimeUnit.SECONDS)
+ .pollingEvery(50, TimeUnit.MILLISECONDS)
+ .ignoring(NoSuchElementException.class);
+
+ fluentWait.until(ExpectedConditions.refreshed(
+ ExpectedConditions.textToBePresentInElementValue(By.xpath("//*[@data-tests-id='" + dataTestId + "']"), text)));
+ }
+
+ public static void regularWait(WebElement element, String text){
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+
+ wait.until(ExpectedConditions.textToBePresentInElementValue(element, text));
+ }
+
+ public static void waitForAngular(){
+ WebDriverWait wait = new WebDriverWait(getDriver(), 90, 100);
+ wait.until(AdditionalConditions.pageLoadWait());
+ wait.until(AdditionalConditions.angularHasFinishedProcessing());
+ }
+
+ public static Object getAllElementAttributes(WebElement element) {
+ return ((JavascriptExecutor)getDriver()).executeScript("var s = []; var attrs = arguments[0].attributes; for (var l = 0; l < attrs.length; ++l) { var a = attrs[l]; s.push(a.name + ':' + a.value); } ; return s;", element);
+ }
+
+ public static boolean isElementReadOnly(WebElement element){
+ try {
+ HighlightMyElement(element).clear();
+ return false;
+ } catch (Exception e) {
+ return true;
+ }
+ }
+
+ public static boolean isElementReadOnly(String dataTestId){
+ return isElementReadOnly(
+ waitForElementVisibilityByTestId(dataTestId));
+ }
+
+ public static boolean isElementDisabled(WebElement element){
+ return HighlightMyElement(element).getAttribute("class").contains("view-mode") ||
+ element.getAttribute("class").contains("disabled");
+ }
+
+ public static boolean isElementDisabled(String dataTestId){
+ return isElementDisabled(
+ waitForElementVisibilityByTestId(dataTestId));
+ }
+
+ public static void ultimateWait(){
+ long startTime = System.nanoTime();
+
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.waitForBackLoader();
+ GeneralUIUtils.waitForAngular();
+
+ long estimateTime = System.nanoTime();
+ long duration = TimeUnit.NANOSECONDS.toSeconds(estimateTime - startTime);
+// System.out.println("UltimateWait took: "+ duration);
+ if(duration > timeOut){
+ SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Delays on page, %d seconds", duration));
+ }
+// waitForUINotification();
+ }
+
+ public static WebElement makeElementVisibleWithJS(WebElement element){
+ String js = "arguments[0].style.height='auto'; arguments[0].style.visibility='visible';";
+ ((JavascriptExecutor) getDriver()).executeScript(js, element);
+ return element;
+ }
+
+ public static WebElement unhideElement(WebElement element, String attributeValue){
+ String js = "arguments[0].setAttribute('class','" + attributeValue + "');";
+ ((JavascriptExecutor) getDriver()).executeScript(js, element);
+ return element;
+ }
+
+ public static WebElement findByText(String textInElement){
+ return getDriver().findElement(searchByTextContaining(textInElement));
+ }
+ public static By searchByTextContaining(String textInElement) {
+ return By.xpath("//*[contains(text(),'" + textInElement + "')]");
+ }
+
+
+ public static boolean findAndWaitByText(String textInElement, int timeout){
+ try{
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeout);
+ wait.until(ExpectedConditions.presenceOfElementLocated(searchByTextContaining(textInElement)));
+ return true;
+ }
+ catch(Exception e){
+ return false;
+ }
+ }
+
+ public static WebElement getClickableButtonBy(By by, int timout){
+ try{
+ WebDriverWait wait = new WebDriverWait(getDriver(), timout);
+ WebElement element = wait.until(ExpectedConditions.elementToBeClickable(by));
+ return element;
+ }
+ catch(Exception e){
+ return null;
+ }
+ }
+
+
+
+ public static WebElement getButtonWithText(String textInButton){
+ try{
+ return getDriver().findElement(By.xpath("//button[contains(text(),'" + textInButton + "')]"));
+ }
+ catch(Exception e)
+ {
+ return null;
+ }
+ }
+
+
+ public static List<WebElement> getElementsByDataTestsIdStartWith(String startWithString){
+ ultimateWait();
+ return getDriver().findElements(By.xpath("//*[starts-with(@data-tests-id,'" + startWithString + "')]"));
+ }
+
+ public static void closeErrorMessage() {
+ WebElement okWebElement = getButtonWithText("OK");
+ if (okWebElement != null){
+ okWebElement.click();
+ ultimateWait();
+ }
+ }
+
+ public static WebElement getElementByCSS(String cssString) throws InterruptedException {
+ ultimateWait();
+ return getDriver().findElement(By.cssSelector(cssString));
+ }
+
+ public static String getDataTestIdAttributeValue(WebElement element) {
+ return element.getAttribute("data-tests-id");
+ }
+
+ public static String getTextContentAttributeValue(WebElement element) {
+ return element.getAttribute("textContent");
+ }
+
+ public static WebElement getElementInsideElementByDataTestsId(WebElement element, String dataTestId) {
+ try{
+ return element.findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']"));
+ }
+ catch(Exception e){
+ return null;
+ }
+ }
+
+ public static void clickOnElementByCSS(String cssString) throws Exception {
+ WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(cssString))).click();
+ ultimateWait();
+ }
+ public static String getRandomComponentName(String prefix) {
+ return prefix + GeneralUIUtils.randomNumber();
+ }
+ public static int randomNumber() {
+ Random r = new Random();
+ return r.nextInt(10000);
+ }
+
+ public static void waitForUINotification() {
+ List<WebElement> notificationElements = getDriver().findElements(By.className("ui-notification"));
+ if (!notificationElements.isEmpty()){
+ notificationElements.forEach(WebElement::click);
+ }
+ }
+
+ public static boolean checkForDisabledAttribute(String dataTestId){
+ Object elementAttributes = getAllElementAttributes(waitForElementVisibilityByTestId(dataTestId));
+ return elementAttributes.toString().contains("disabled");
+ }
+
+ public static void dragAndDropElementByY(WebElement area, int yOffset) {
+ Actions actions = new Actions(getDriver());
+ actions.dragAndDropBy(area, 10, yOffset).perform();
+ ultimateWait();
+ }
+
+ public static void waitForBackLoader() {
+ waitForBackLoader(timeOut);
+ }
+
+ public static void waitForBackLoader(int timeOut) {
+ sleep(100);
+ waitForElementInVisibilityBy(By.className("tlv-loader-back"), timeOut);
+ }
+
+ public static void addStringtoClipboard(String text){
+ StringSelection selection = new StringSelection(text);
+ Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+ clipboard.setContents(selection, selection);
+ }
+
+}
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
new file mode 100644
index 0000000000..1bef2ad32c
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/HomeUtils.java
@@ -0,0 +1,117 @@
+/*-
+ * ============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.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;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+
+public final class HomeUtils {
+
+ public static WebElement createAndImportButtons(CreateAndImportButtonsEnum type, WebDriver driver)
+ throws InterruptedException {
+ switch (type) {
+ case IMPORT_CP:
+ case IMPORT_VFC:
+ case IMPORT_VL:
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.IMPORT_AREA.getValue());
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.IMPORT_VFC.getValue());
+
+ case IMPORT_VF:
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.IMPORT_AREA.getValue());
+ return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.IMPORT_VFC.getValue());
+ case CREATE_SERVICE:
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.ADD_AREA.getValue());
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()).click();
+ ;
+ break;
+
+ case CREATE_PRODUCT:
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()).click();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()).click();
+ break;
+
+ default:
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.ADD_AREA.getValue());
+ driver.findElement(By.xpath("//*[@data-tests-id='createResourceButton']")).click();
+ break;
+ }
+ return null;
+
+ }
+
+ public static String checkBoxLifeCyclestate(CheckBoxStatusEnum lifeCycle) {
+ String Status = "IN DESIGN CHECK OUT";
+ switch (lifeCycle) {
+ case CHECKIN:
+ Status = "IN DESIGN CHECK IN";
+ if (GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).isDisplayed()) {
+ GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).click();
+ }
+ break;
+ case CHECKOUT:
+ GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).click();
+ Status = "IN DESIGN CHECK OUT";
+ break;
+ case IN_TESTING:
+ GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).click();
+ Status = "IN TESTING";
+ break;
+ case READY_FOR_TESTING:
+ GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).click();
+ Status = "READY FOR TESTING";
+ break;
+ case CERTIFIED:
+ GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).click();
+ Status = "CERTIFIED";
+ break;
+ }
+ return Status;
+ }
+
+ public static void findComponentAndClick(String componentName) throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "finding component " + componentName);
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue()).sendKeys(componentName);
+ WebElement foundComp = null;
+ try {
+ foundComp = GeneralUIUtils.getWebElementByTestID(componentName);
+ foundComp.click();
+ GeneralUIUtils.waitForLoader();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue());
+ } catch (Exception e) {
+ String msg = String.format("DID NOT FIND A COMPONENT NAMED %s", componentName);
+ SetupCDTest.getExtendTest().log(Status.FAIL, msg);
+ System.out.println(msg);
+ Assert.fail(msg);
+ }
+ }
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ImportAssetUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ImportAssetUIUtils.java
new file mode 100644
index 0000000000..d1045eab76
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ImportAssetUIUtils.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+public class ImportAssetUIUtils {
+
+ public static final String FILE_PATH = System.getProperty("user.dir") + "\\src\\main\\resources\\Files\\";
+ public static String fileName = "JDM_vfc.yml";
+ public static final String toscaErrorMessage = "Invalid TOSCA template.";
+ public static final String yamlError = "Invalid YAML file.";
+ public static final String allReadyExistErro = "Imported resource already exists in ASDC Catalog.";
+
+ public static void importAsssetAndFillGeneralInfo(String FILE_PATH, String fileName,
+ ResourceReqDetails resourceDetails, User user, CreateAndImportButtonsEnum type) throws Exception {
+ ResourceUIUtils.importFileWithSendKey(FILE_PATH, fileName, type);
+ ResourceUIUtils.fillResourceGeneralInformationPage(resourceDetails, user,true);
+ }
+
+ public static void importAsssetFillGeneralInfoAndSelectIcon(String FILE_PATH, String fileName,
+ ResourceReqDetails resourceDetails, User user, CreateAndImportButtonsEnum type) throws Exception {
+ importAsssetAndFillGeneralInfo(FILE_PATH, fileName, resourceDetails, user, type);
+ GeneralPageElements.clickCreateButton();
+ ResourceUIUtils.selectRandomResourceIcon();
+ }
+
+ // checking or unchecking the checkbox on right palette at designer
+ // workspace
+ public static void checkbox(String checkBoxname, WebDriver driver) {
+ driver.findElement(By.xpath("//label[@for='" + checkBoxname + "']")).click();
+ }
+
+}
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
new file mode 100644
index 0000000000..dfb4b74fac
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java
@@ -0,0 +1,801 @@
+/*-
+ * ============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 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.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+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.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+public class OnboardingUtils {
+
+ public OnboardingUtils() {
+ }
+
+ private static String vendorId;
+ private static String vendorLicenseName;
+ private static String vendorLicenseAgreementId;
+ private static String featureGroupId;
+
+ public static Pair<String, Map<String, String>> createVendorSoftwareProduct(String HeatFileName, String filepath, User user)
+ throws Exception {
+ Pair<String, Map<String, String>> pair = createVSP(HeatFileName, filepath, user);
+
+ 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) 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, vendorLicenseName, vendorId, vendorLicenseAgreementId, featureGroupId, 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", vendorLicenseName);
+ 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 void createVendorLicense(User user) throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Starting to create the vendor license");
+ vendorLicenseName = "ciLicense" + getShortUUID();
+ RestResponse vendorLicenseResponse = createVendorLicenseModels_1(vendorLicenseName, user);
+ assertEquals("did not succeed to create vendor license model", 200,
+ vendorLicenseResponse.getErrorCode().intValue());
+ vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value");
+
+ 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());
+ featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value");
+
+ RestResponse vendorLicenseAgreement = createVendorLicenseAgreement_5(vendorId, featureGroupId, user);
+ assertEquals("did not succeed to create vendor license agreement", 200,
+ vendorLicenseAgreement.getErrorCode().intValue());
+ vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(),
+ "value");
+
+ 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");
+ }
+
+ 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("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");
+ 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");
+ 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, String vendorName, String vendorId,
+ String licenseAgreementId, String featureGroupsId, 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", licenseAgreementId);
+ jlicensingDataObj.put("featureGroups", Arrays.asList(featureGroupsId).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("licensingVersion", jlicensingVersionObj);
+ jObject.put("vendorName", vendorName);
+ jObject.put("vendorId", vendorId);
+ 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 getVendorSoftwareProduct(Map vspObject, User user) throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/" + vspObject.get("vspId"),
+ config.getCatalogBeHost(), config.getCatalogBePort());
+
+ String userId = user.getUserId();
+
+ Map<String, String> headersMap = prepareHeadersMap(userId);
+ HttpRequest http = new HttpRequest();
+
+ RestResponse response = http.httpsSendGet(url, headersMap);
+
+ return response;
+ }
+
+ 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));
+
+ createVendorLicense(user);
+ Pair<String, Map<String, String>> createVendorSoftwareProduct = createVendorSoftwareProduct(vnfFile, filepath, user);
+ String vspName = createVendorSoftwareProduct.left;
+
+ DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId"));
+ File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+
+ 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);
+
+ for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) {
+ if(deploymentArtifact.getType().equals("HEAT_ENV")) {
+ continue;
+ } else if(deploymentArtifact.getFileName().contains(".")) {
+ ArtifactUIUtils.validateArtifactNameVersionType(deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf(".")), "1", deploymentArtifact.getType());
+ } else {
+ ArtifactUIUtils.validateArtifactNameVersionType(deploymentArtifact.getFileName().trim(), "1", deploymentArtifact.getType());
+ }
+
+ }
+
+ DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile);
+ return createVendorSoftwareProduct;
+ }
+
+}
+
+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/ProductUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ProductUIUtils.java
new file mode 100644
index 0000000000..9e478c8523
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ProductUIUtils.java
@@ -0,0 +1,94 @@
+/*-
+ * ============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.awt.AWTException;
+import java.util.List;
+
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.ProductGeneralPage;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+/**
+ * @author al714h
+ *
+ */
+
+public class ProductUIUtils {
+
+ protected static WebDriver driver;
+
+ public ProductUIUtils(TestName name, String className) {
+ super();
+ }
+
+ public static void fillProductGeneralPage(ProductReqDetails product, User user) throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Fill in metadata values in general page.. "));
+ ProductGeneralPage.defineName(product.getName());
+ ProductGeneralPage.defineFullName(product.getFullName());
+ ProductGeneralPage.defineDescription(product.getDescription());
+ ProductGeneralPage.defineProjectCode(product.getProjectCode());
+ defineTagsList2(product.getTags());
+ ProductGeneralPage.defineContactId(product.getContactId());
+ GeneralUIUtils.clickSomewhereOnPage();
+ }
+
+ public static void createProduct(ProductReqDetails product, User user) throws Exception, AWTException {
+ clikAddProduct();
+ fillProductGeneralPage(product, user);
+ GeneralPageElements.clickCreateButton();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Product %s created", product.getName()));
+ }
+
+ public static void defineTagsList2(List<String> productTags){
+ WebElement productTagsTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ProductMetadataEnum.TAGS.getValue());
+ for (String tag : productTags) {
+ productTagsTextbox.clear();
+ productTagsTextbox.sendKeys(tag);
+ GeneralUIUtils.waitForAngular();
+ productTagsTextbox.sendKeys(Keys.ENTER);
+ }
+ }
+
+ public static void clikAddProduct(){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking Add Product button"));
+ try {
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.ADD_AREA.getValue());
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_PRODUCT.getValue()).click();
+ GeneralUIUtils.ultimateWait();
+ } catch (Exception e){
+ SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exception on catched on Add Product button, retrying ..."));
+ GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new");
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_PRODUCT.getValue()).click();
+ GeneralUIUtils.ultimateWait();
+ }
+ }
+
+}
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
new file mode 100644
index 0000000000..62b2f832bd
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java
@@ -0,0 +1,108 @@
+/*-
+ * ============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.Map;
+
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+public class PropertiesUIUtils {
+
+ // public static void addPropertByType(String type,String name,String
+ // defaultValue,String description) throws Exception{
+ //
+ // ResourceUIUtils.defineNewSelectList(type);
+ // ResourceUIUtils.definePropertyName(name);
+ // ResourceUIUtils.defineDefaultValueByType(defaultValue);
+ // ResourceUIUtils.defineDescription(description);
+ // Thread.sleep(2000);
+ // ResourceUIUtils.clickButton("Add");
+ // }
+ public static Map<String, String> addProperties(String name, String itemType, String defaultValue,
+ String description, String schemaType) throws Exception {
+ Map<String, String> propertyvalues = new HashMap<String, String>();
+ GeneralUIUtils.getSelectList(itemType, "propertyType");
+ ResourceUIUtils.definePropertyName(name);
+ if (itemType == "boolean") {
+ ResourceUIUtils.defineBoolenDefaultValue(defaultValue);
+ GeneralUIUtils.setWebElementByTestId("description","description");
+ Thread.sleep(2000);
+ GeneralUIUtils.getWebElementByTestID("Add").click();
+ ;
+ } else if (itemType == "list" || itemType == "map") {
+ GeneralUIUtils.getSelectList(schemaType, "schemaType");
+ }
+ if (!(itemType == "boolean")) {
+ ResourceUIUtils.defineDefaultValueByType(defaultValue);
+ GeneralUIUtils.setWebElementByTestId("description", "des");
+ GeneralUIUtils.getWebElementByTestID("Add").click();
+ ;
+ Thread.sleep(2000);
+ }
+ propertyvalues.put("type", itemType);
+ propertyvalues.put("defaultValue", defaultValue);
+ propertyvalues.put("description", description);
+ propertyvalues.put("name", name);
+
+ return propertyvalues;
+ }
+
+ public static void vlidateProperties(Map<String, String> propertyValues) throws InterruptedException {
+ WebElement name = GeneralUIUtils.getWebElementByTestID(propertyValues.get("name"));
+ name.getText().equalsIgnoreCase(propertyValues.get("name"));
+ WebElement defaultValue = GeneralUIUtils.getWebElementByTestID(propertyValues.get("name"));
+ defaultValue.getText().equalsIgnoreCase(propertyValues.get("defaultValue"));
+ WebElement type = GeneralUIUtils.getWebElementByTestID(propertyValues.get("type"));
+ type.getText().equalsIgnoreCase(propertyValues.get("type"));
+ }
+
+ public static void addNewProperty(PropertyTypeEnum property) {
+ GeneralUIUtils.ultimateWait();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Adding new %s property", property.name()));
+ PropertiesPage.clickAddPropertyArtifact();
+ PropertiesPage.getPropertyPopup().insertPropertyName(property.getName());
+ PropertiesPage.getPropertyPopup().selectPropertyType(property.getType());
+ PropertiesPage.getPropertyPopup().insertPropertyDescription(property.getDescription());
+ PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(property.getValue());
+ PropertiesPage.getPropertyPopup().clickSave();
+ }
+
+ 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().clickSave();
+ }
+
+ public static void changePropertyDefaultValueInComposition(String propertyName, String defaultValue) {
+ GeneralUIUtils.clickOnElementByTestId(propertyName);
+ PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(defaultValue);
+ 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
new file mode 100644
index 0000000000..c76bf4b74a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java
@@ -0,0 +1,1143 @@
+/*-
+ * ============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 static org.testng.AssertJUnit.assertNotNull;
+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;
+import java.util.List;
+import java.util.Random;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.http.HttpStatus;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.Dashboard;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceCategoriesNameEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+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.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openqa.selenium.By;
+import org.openqa.selenium.ElementNotVisibleException;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.Select;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.AssertJUnit;
+
+import com.aventstack.extentreports.Status;
+
+public final class ResourceUIUtils {
+ public static final String RESOURCE_NAME_PREFIX = "ResourceCDTest-";
+ protected static final boolean IS_BEFORE_TEST = true;
+ public static final String INITIAL_VERSION = "0.1";
+ public static final String ICON_RESOURCE_NAME = "call_controll";
+ protected static final String UPDATED_RESOURCE_ICON_NAME = "objectStorage";
+
+ private ResourceUIUtils() {
+ }
+
+ static WebDriver driver = GeneralUIUtils.getDriver();
+
+ public static void defineResourceName(String resourceName) {
+
+ WebElement resourceNameTextbox = GeneralUIUtils.getDriver().findElement(By.name("componentName"));
+ resourceNameTextbox.clear();
+ resourceNameTextbox.sendKeys(resourceName);
+ }
+
+ public static void defineResourceCategory(String category, String datatestsid) {
+
+ GeneralUIUtils.getSelectList(category, datatestsid);
+ }
+
+ // public static void uploadFileWithJavaRobot(String FilePath,String
+ // FileName) throws Exception{
+ //
+ // StringSelection Path= new StringSelection(FilePath+FileName);
+ // Thread.sleep(1000);
+ // java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().setContents(Path,
+ // null);
+ // Robot robot = new Robot();
+ // robot.delay(1000);
+ // robot.keyPress(KeyEvent.VK_CONTROL);
+ // robot.keyPress(KeyEvent.VK_V);
+ // robot.keyRelease(KeyEvent.VK_V);
+ // robot.keyRelease(KeyEvent.VK_CONTROL);
+ // robot.delay(1000);
+ // robot.keyPress(KeyEvent.VK_ENTER);
+ // robot.keyRelease(KeyEvent.VK_ENTER);
+ // robot.delay(1000);
+ // }
+ // click and upload tosca file //**to be changed.
+ public static void importFileWithSendKey(String FilePath, String FileName, CreateAndImportButtonsEnum type)
+ throws Exception {
+ WebElement importButton = HomeUtils.createAndImportButtons(type, driver).findElement(By.tagName("input"));
+ importButton.sendKeys(FilePath + FileName);
+ }
+
+ public static void importFileWithSendKeyBrowse(String FilePath, String FileName) throws Exception {
+ WebElement browsebutton = GeneralUIUtils.getWebElementByTestID("browseButton");
+ browsebutton.sendKeys(FilePath + FileName);
+ }
+
+ // public static void defineVendorName(String resourceVendorName) {
+ //
+ // WebElement resourceVendorNameTextbox =
+ // GeneralUIUtils.getWebElementByTestID("vendorName");
+ // resourceVendorNameTextbox.clear();
+ // resourceVendorNameTextbox.sendKeys(resourceVendorName);
+ // }
+
+ // public static void defineTagsList(ResourceReqDetails resource,String
+ // []resourceTags) {
+ // List<String>taglist = new ArrayList<String>();;
+ // WebElement resourceTagsTextbox =
+ // GeneralUIUtils.getWebElementByTestID("i-sdc-tag-input");
+ // for (String tag : resourceTags) {
+ // resourceTagsTextbox.clear();
+ // resourceTagsTextbox.sendKeys(tag);
+ // resourceTagsTextbox.sendKeys(Keys.ENTER);
+ // taglist.add(tag);
+ // }
+ // resource.setTags(taglist);
+ // }
+
+ public static String defineUserId(String userId) {
+ //
+ WebElement resourceUserIdTextbox = ResourceGeneralPage.getContactIdField();
+ resourceUserIdTextbox.clear();
+ resourceUserIdTextbox.sendKeys(userId);
+ return userId;
+ }
+
+ public static void defineVendorRelease(String resourceVendorRelease) {
+
+ WebElement resourceVendorReleaseTextbox = GeneralUIUtils.getWebElementByTestID("vendorRelease");
+ resourceVendorReleaseTextbox.clear();
+ resourceVendorReleaseTextbox.sendKeys(resourceVendorRelease);
+ }
+
+ public static void selectResourceIcon(String resourceIcon) throws Exception {
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 10);
+ wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@data-tests-id='" + resourceIcon + "']")))
+ .click();
+ }
+
+ public static String definePropertyName(String name) {
+
+ WebElement nameProperty = GeneralUIUtils.getDriver().findElement(By.name("propertyName"));
+ nameProperty.sendKeys(name);
+ return name;
+ }
+
+ public static void selectRandomResourceIcon() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.ICON);
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 4);
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[contains(@data-tests-id, 'iconBox')]")));
+ List<WebElement> iconElement = GeneralUIUtils.getDriver()
+ .findElements(By.xpath("//*[contains(@data-tests-id, 'iconBox')]"));
+ iconElement.get(0).click();
+ }
+
+ public static List<WebElement> getAllObjectsOnWorkspace(WebDriver driver, ResourceReqDetails resource)
+ throws Exception {
+
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 10);
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@*='" + resource.getName() + "']")));
+ return GeneralUIUtils.getDriver()
+ .findElements(By.xpath("//div[@class='" + "w-sdc-dashboard-card-info-name" + "']"));
+
+ }
+
+ public static String getErrorMessageText(String text) throws Exception {
+
+ return GeneralUIUtils.getWebElementByClassName(text).getText();
+
+ }
+
+ public static WebElement scrollElement(WebDriver driver) throws Exception {
+
+ return GeneralUIUtils.getDriver().findElement(By.className("ps-scrollbar-y"));
+ }
+
+ public static void scrollDownPage() throws AWTException, InterruptedException {
+ Robot robot = new Robot();
+ robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+ robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+ robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+ robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+ robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+ robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+ robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+ }
+
+ public static void defineNewSelectList(String Text) {
+ WebElement mySelectElm = GeneralUIUtils.getDriver().findElement(By.className("i-sdc-form-select"));
+ Select mySelectString = new Select(mySelectElm);
+ mySelectString.selectByVisibleText(Text);
+ }
+
+ public static void defineDefaultValueByType(String Value) {
+
+ WebElement valueString = GeneralUIUtils.getDriver().findElement(By.name("value"));
+ valueString.clear();
+ valueString.sendKeys(Value);
+ }
+
+ public static void defineBoolenDefaultValue(String Value) {
+
+ WebElement elementBoolean = GeneralUIUtils.getDriver().findElement(By.name("value"));
+ Select se = new Select(elementBoolean);
+ se.selectByValue(Value);
+ }
+
+ public static void clickButtonBlue() {
+ WebElement clickButtonBlue = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-btn-blue"));
+ clickButtonBlue.click();
+ }
+
+ public static void clickButton(String selectButton) {
+
+ WebElement clickButton = GeneralUIUtils.getDriver()
+ .findElement(By.xpath("//*[@data-tests-id='" + selectButton + "']"));
+ clickButton.click();
+ }
+
+ public static WebElement Waitfunctionforbuttons(String element, int timeout) {
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), timeout);
+ return wait.until(ExpectedConditions.elementToBeClickable(By.xpath(element)));
+ }
+
+ public static WebElement waitToButtonSubmitForTesting() {
+ return Waitfunctionforbuttons("//*[@data-tests-id='submitForTesting']", 10);
+ }
+
+ public static WebElement waitToFinishButtonEnabled() {
+ return Waitfunctionforbuttons("//button[@data-tests-id='Finish']", 10);
+ }
+
+ public static WebElement waitToNextButtonEnabled() {
+ return Waitfunctionforbuttons("//button[@data-tests-id='Next']", 10);
+ }
+
+ public static WebElement waitToHomeMenu() {
+ return Waitfunctionforbuttons("//*[@data-tests-id='main-menu-button-home']", 10);
+ }
+
+ public static WebElement waitToCatalogMenu() {
+ return Waitfunctionforbuttons("//*[@data-tests-id='main-menu-button-catalog']", 10);
+ }
+
+ public static WebElement waitSearch() {
+ return Waitfunctionforbuttons("//*[@data-tests-id='main-menu-input-search']", 10);
+ }
+
+ public static WebElement waitSubmitforTestingCard() {
+ return Waitfunctionforbuttons("//*[@data-tests-id='i-sdc-dashboard-card-menu-item-SubmitforTesting']", 10);
+ }
+
+ public static WebElement waitViewCard() {
+ return Waitfunctionforbuttons("//*[@data-tests-id='i-sdc-dashboard-card-menu-item-View']", 5);
+ }
+
+// public static void waitOpenCard(String requiredElementUniqueId) throws Exception {
+// WebElement menu = GeneralUIUtils.getDriver()
+// .findElement(By.xpath("//*[@data-tests-id='" + requiredElementUniqueId + "']"));
+// GeneralUIUtils.hoverOnAreaByTestId(menu);
+// }
+
+ public static void fillResourceGeneralInformationPage(ResourceReqDetails resource, User user, boolean isNewResource) {
+ try {
+ ResourceGeneralPage.defineName(resource.getName());
+ ResourceGeneralPage.defineDescription(resource.getDescription());
+ ResourceGeneralPage.defineCategory(resource.getCategories().get(0).getSubcategories().get(0).getName());
+ ResourceGeneralPage.defineVendorName(resource.getVendorName());
+ ResourceGeneralPage.defineVendorRelease(resource.getVendorRelease());
+ if (isNewResource){
+ ResourceGeneralPage.defineTagsList(resource, new String[] { "This-is-tag", "another-tag", "Test-automation-tag" });
+ }
+ else{
+ ResourceGeneralPage.defineTagsList(resource, new String[] { "one-more-tag" });
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void fillMaxValueResourceGeneralInformationPage(ResourceReqDetails resource) {
+ String stringPattern = "ABCDabcd123456";
+ GeneralUIUtils.addStringtoClipboard(buildStringFromPattern(stringPattern, 5000));
+ ResourceGeneralPage.defineNameWithPaste();
+ ResourceGeneralPage.defineDescriptionWithPaste();
+ ResourceGeneralPage.defineVendorNameWithPaste();
+ ResourceGeneralPage.defineVendorReleaseWithPaste();
+// ResourceGeneralPage.defineName(buildStringFromPattern(stringPattern, 5000));
+// ResourceGeneralPage.defineDescription(buildStringFromPattern(stringPattern, 5000));
+// ResourceGeneralPage.defineVendorName(buildStringFromPattern(stringPattern, 5000));
+// ResourceGeneralPage.defineVendorRelease(buildStringFromPattern(stringPattern, 5000));
+// ResourceGeneralPage.defineTagsList(resource, new String[] { buildStringFromPattern(stringPattern, 5000) });
+ ResourceGeneralPage.defineTagsListWithPaste();
+ GeneralUIUtils.waitForAngular();
+ }
+
+ public static String buildStringFromPattern(String stringPattern, int stringLength){
+ char[] chars = stringPattern.toCharArray();
+ StringBuilder sb = new StringBuilder();
+ Random random = new Random();
+ for (int i = 0; i < stringLength; i++) {
+ char c = chars[random.nextInt(chars.length)];
+ sb.append(c);
+ }
+ return sb.toString();
+ }
+
+ public static void fillNewResourceValues(ResourceReqDetails resource, User user) throws Exception {
+ fillResourceGeneralInformationPage(resource, user, true);
+ GeneralPageElements.clickCreateButton();
+ // selectIcon();
+ }
+
+ // coded by teddy.
+
+ public static WebElement waitfunctionforallelements(String element) {
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 5);
+ return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@*='" + element + "']")));
+ }
+
+ public static WebElement waitFunctionForaGetElements(String element, int timeout) {
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), timeout);
+ return wait.until(
+ ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + element + "']")));
+ }
+
+ public static void getVFCGeneralInfo(ResourceReqDetails resource, User user) throws InterruptedException {
+ Thread.sleep(2000);
+ String version = GeneralUIUtils.getWebElementsListByTestID("versionvalue").get(0).getText().substring(1);
+ String name = GeneralUIUtils.getWebElementByTestID("name").getAttribute("value");
+ String description = GeneralUIUtils.getWebElementByTestID("description").getAttribute("value");
+ String category = GeneralUIUtils.getSelectList(null, "selectGeneralCategory").getFirstSelectedOption()
+ .getText();
+ String vendorName = GeneralUIUtils.getWebElementByTestID("vendorName").getAttribute("value");
+ String vendorRelease = GeneralUIUtils.getWebElementByTestID("vendorRelease").getAttribute("value");
+ List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-text");
+ String type = GeneralUIUtils.getWebElementsListByTestID("type").get(1).getText();
+ int index = type.lastIndexOf(":");
+ System.out.println(type.substring(0, index));
+ String AttContact = GeneralUIUtils.getWebElementByTestID("attContact").getAttribute("value");
+ System.out.println(resource.getVersion());
+ assertTrue(resource.getVersion().equals(version));
+ assertTrue(resource.getName().equals(name));
+ assertTrue(resource.getDescription().equals(description));
+ System.out.println(resource.getVendorName());
+ System.out.println(resource.getVendorRelease());
+ assertTrue(resource.getCategories().get(0).getSubcategories().get(0).getName().equals(category));
+ assertTrue(resource.getVendorName().equals(vendorName));
+ assertTrue(resource.getVendorRelease().equals(vendorRelease));
+ assertTrue(resource.getCreatorUserId().equals(AttContact));
+ assertEquals(type.substring(0, index), resource.getResourceType());
+
+ for (int i = 0; i < tags.size(); i++) {
+ assertEquals(resource.getTags().get(i), tags.get(i).getText());
+ }
+ }
+
+ public static void getGeneralInfo(ResourceReqDetails resource, User user) {
+
+ // clickMore();
+ // String
+ // componentType=waitFunctionForaGetElements("componentType",3).getText();
+ // String version=waitFunctionForaGetElements("version",3).getText();
+ // String
+ // category=waitFunctionForaGetElements("category",3).getText();//get
+ // right panel Category.
+ // String
+ // resourceType=waitFunctionForaGetElements("resourceType",3).getText();//get
+ // right panel SubCategory.
+ // String date=waitfunctionforelements("creationDate",3).getText();
+ // String aouthor=waitfunctionforallelements("author'",3).getText();
+ // String
+ // vendorName=waitFunctionForaGetElements("vendorName",3).getText();
+ // String
+ // vendorRelease=waitFunctionForaGetElements("vendorRelease",3).getText();
+ // String
+ // AttContact=waitFunctionForaGetElements("attContact",3).getText();
+ // String
+ // Description=waitFunctionForaGetElements("description",3).getText();
+ List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("tag");
+ // // String TagVF=waitFunctionForaGetElements("tag",3).getText();
+ // assertTrue(componentType.equals("RESOURCE"));
+ // assertTrue(version.equals(resource.getVersion()));
+ // assertTrue(category.equals(resource.getCategories().get(0).getName()));
+ // assertEquals(resourceType,resource.getResourceType());
+ // // assertEquals(Date,resource.getCreationDate());
+ // // assertEquals(Aouthor,resource.getCreatorFullName());
+ // assertTrue(vendorName.equals(resource.getVendorName()));
+ // assertTrue(vendorRelease.equals(resource.getVendorRelease()));
+ // assertTrue(AttContact.equals(resource.getAttContact()));
+ // assertTrue(Description.equals(resource.getDescription()+"\nLess"));
+ for (WebElement tag : tags) {
+ System.out.println(resource.getTags().get(0));
+ }
+ }
+
+ public static void getGeneralInfoForTags(ResourceReqDetails resource, User user) {
+
+ clickMore();
+ String componentType = waitFunctionForaGetElements("componentType", 3).getText();
+ String version = waitFunctionForaGetElements("version", 3).getText();
+ String category = waitFunctionForaGetElements("category", 3).getText();// get
+ // right
+ // panel
+ // Category.
+ String resourceType = waitFunctionForaGetElements("resourceType", 3).getText();// get
+ // right
+ // panel
+ // SubCategory.
+ String date = GeneralUIUtils.getWebElementByClassName("creationDate").getText();
+ String aouthor = waitfunctionforallelements("author'").getText();
+ String vendorName = waitFunctionForaGetElements("vendorName", 3).getText();
+ String vendorRelease = waitFunctionForaGetElements("vendorRelease", 3).getText();
+ String attContact = waitFunctionForaGetElements("attContact", 3).getText();
+ String description = waitFunctionForaGetElements("description", 3).getText();
+ List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("tag");
+ assertTrue(componentType.equals("RESOURCE"));
+ assertTrue(version.equals(resource.getVersion()));
+ assertTrue(category.equals(resource.getCategories().get(0).getName()));
+ assertEquals(resourceType, resource.getResourceType());
+ // assertEquals(Date,resource.getCreationDate());
+ // assertEquals(Aouthor,resource.getCreatorFullName());
+ assertTrue(vendorName.equals(resource.getVendorName()));
+ assertTrue(vendorRelease.equals(resource.getVendorRelease()));
+ assertTrue(attContact.equals(resource.getContactId()));
+ assertTrue(description.equals(resource.getDescription() + "\nLess"));
+ assertTrue(tags.equals("Tag-150"));
+ }
+
+ public static WebElement searchVFNameInWorkspace(ResourceReqDetails resource, User user) throws Exception {
+
+ List<WebElement> findElements = GeneralUIUtils.getDriver()
+ .findElements(By.xpath("//div[@data-tests-id='" + resource.getUniqueId() + "']"));
+ assertNotNull("did not find any elements", findElements);
+ for (WebElement webElement : findElements) {
+ if (webElement.getText().contains(resource.getUniqueId())) {
+ System.out.println("I find it");
+ return webElement;
+ }
+ }
+ return null;
+ }
+
+ public static Boolean searchCheckOutWorkspace(ResourceReqDetails resource, User user,
+ CheckBoxStatusEnum checkBoxStatusEnum) throws Exception {
+
+ List<WebElement> findElements = GeneralUIUtils.getDriver()
+ .findElements(By.xpath("//div[@data-tests-id='component.lifecycleState']"));
+ assertNotNull("did not find any elements", findElements);
+ for (WebElement webElement : findElements) {
+ if (!webElement.getAttribute("class").contains(checkBoxStatusEnum.name())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // coded by tedy.
+ public static void validateWithRightPalett(ResourceReqDetails resource, User user) {
+ // String
+ // Type=Waitfunctionforallelements("sharingService.selectedEntity.getTypeForView()",3).getText();
+ String ResourceType = waitfunctionforallelements("selectedComponent.resourceType").getText();
+ System.out.println(ResourceType);
+ String Version = waitfunctionforallelements("selectedComponent.version").getText();
+ String Category = waitfunctionforallelements("selectedComponent.categories[0].name").getText();// get
+ // right
+ // panel
+ // Category.
+ String CanvasSubCategory = waitfunctionforallelements("selectedComponent.categories[0].subcategories[0].name")
+ .getText();// get right panel SubCategory.
+ // String Date=Waitfunctionforelements("selectedComponent.creationDate |
+ // date: 'MM/dd/yyyy'").getText();
+ // String
+ // Aouthor=waitfunctionforallelements("selectedComponent.creatorFullName'").getText();
+ String VendorName = waitfunctionforallelements("selectedComponent.vendorName").getText();
+ String VendorRelease = waitfunctionforallelements("selectedComponent.vendorRelease").getText();
+ String AttContact = waitfunctionforallelements("selectedComponent.attContact").getText();
+ String Description = waitfunctionforallelements("selectedComponent.description").getText();
+ String TagVF = waitfunctionforallelements("tag").getText();
+ AssertJUnit.assertEquals(ResourceType, resource.getResourceType());
+ AssertJUnit.assertEquals(Version, resource.getVersion());
+ AssertJUnit.assertEquals(Category, resource.getCategories().get(0).getName());
+ AssertJUnit.assertEquals(CanvasSubCategory,
+ resource.getCategories().get(0).getSubcategories().get(0).getName());
+ // assertEquals(Date,resource.getCreationDate());
+ // assertEquals(Aouthor,resource.getCreatorFullName());
+ AssertJUnit.assertEquals(VendorName, resource.getVendorName());
+ AssertJUnit.assertEquals(VendorRelease, resource.getVendorRelease());
+ AssertJUnit.assertEquals(AttContact, resource.getContactId());
+ AssertJUnit.assertEquals(Description, resource.getDescription() + "\nLess");
+ AssertJUnit.assertEquals(TagVF, "qa123");
+ }
+
+ public static void clickMore() {
+ WebElement clickButtonSubmit = GeneralUIUtils.getDriver()
+ .findElement(By.className("ellipsis-directive-more-less"));
+ clickButtonSubmit.click();
+ }
+
+ public static RestResponse createResourceInUI(ResourceReqDetails resource, User user)
+ throws Exception, AWTException {
+ System.out.println("creating resource...");
+ fillNewResourceValues(resource, user);
+ RestResponse getCreatedResource = RestCDUtils.getResource(resource, user);
+ AssertJUnit.assertEquals("Did not succeed to get any resource", HttpStatus.SC_OK,
+ getCreatedResource.getErrorCode().intValue());
+
+ return getCreatedResource;
+ }
+
+ public static void createResource(ResourceReqDetails resource, User user) throws Exception {
+ ExtentTestActions.log(Status.INFO, "Going to create a new VF.");
+ WebElement addVFButton = null;
+ try {
+ GeneralUIUtils.ultimateWait();
+ try{
+ GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new");
+ addVFButton = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
+ }
+ catch (Exception e){
+ File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resource.getName());
+ final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
+ SetupCDTest.getExtendTest().log(Status.WARNING, "Add VF button is not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));
+ showButtonsADD();
+ addVFButton = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
+ }
+ addVFButton.click();
+ GeneralUIUtils.ultimateWait();
+ }
+ catch (Exception e ) {
+ SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on ADD VF button, retrying ... "));
+ GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new");
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue()).click();
+ GeneralUIUtils.ultimateWait();
+ }
+ fillResourceGeneralInformationPage(resource, user, true);
+ resource.setVersion("0.1");
+ GeneralPageElements.clickCreateButton();
+ }
+
+ public static void updateResource(ResourceReqDetails resource, User user){
+ ResourceGeneralPage.defineContactId(resource.getContactId());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating General screen fields ..."));
+ fillResourceGeneralInformationPage(resource, user, false);
+ ResourceGeneralPage.clickUpdateButton();
+ }
+
+
+
+ public static RestResponse updateResourceInformationPage(ResourceReqDetails resource, User user)
+ throws Exception, AWTException {
+
+ fillResourceGeneralInformationPage(resource, user, true);
+ GeneralPageElements.clickCreateButton();
+ return null;
+
+ }
+
+ public static RestResponse checkInResourceInUI(ResourceReqDetails resource, User user) throws Exception {
+
+ WebElement ASDCLink = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-header-logo-link"));
+ ASDCLink.click();
+ Thread.sleep(2000);
+
+ List<WebElement> listFormInput = GeneralUIUtils.getDriver()
+ .findElements(By.className("i-sdc-left-sidebar-nav-item"));
+ WebElement addPropertyElement = listFormInput.get(0);
+ addPropertyElement.click();
+ Thread.sleep(2000);
+
+ WebElement searchResource = GeneralUIUtils.getDriver()
+ .findElement(By.className("w-sdc-header-catalog-search-input"));
+ searchResource.sendKeys("newresource4test");
+
+ Thread.sleep(1000);
+
+ WebElement buttonClickMenu = GeneralUIUtils.getDriver()
+ .findElement(By.className("w-sdc-dashboard-card-menu-button"));
+ buttonClickMenu.click();
+
+ WebElement clickMenu = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-dashboard-card-menu"));
+ clickMenu.click();
+
+ List<WebElement> clickCheckIn = GeneralUIUtils.getDriver()
+ .findElements(By.className("i-sdc-dashboard-card-menu-item"));
+ WebElement clickCheckInMenu = clickCheckIn.get(1);
+ clickCheckInMenu.click();
+
+ WebElement descriptionForSubmit = GeneralUIUtils.getDriver()
+ .findElement(By.className("w-sdc-modal-body-comment"));
+ descriptionForSubmit.sendKeys("checkin resource");
+ Thread.sleep(2000);
+ WebElement clickButtonSubmitTwo = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-btn-blue"));
+ clickButtonSubmitTwo.click();
+ Thread.sleep(2000);
+
+ WebElement buttonClickMenu1 = GeneralUIUtils.getDriver()
+ .findElement(By.className("w-sdc-dashboard-card-menu-button"));
+ buttonClickMenu1.click();
+
+ WebElement clickMenu1 = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-dashboard-card-menu"));
+ clickMenu1.click();
+
+ List<WebElement> clickCheckOut = GeneralUIUtils.getDriver()
+ .findElements(By.className("i-sdc-dashboard-card-menu-item"));
+ WebElement clickCheckOutMenu = clickCheckOut.get(0);
+ clickCheckOutMenu.click();
+
+ Thread.sleep(3000);
+ RestResponse getResource = RestCDUtils.getResource(resource, user);
+ AssertJUnit.assertEquals("Did not succeed to get resource after create", 200,
+ getResource.getErrorCode().intValue());
+ return getResource;
+
+ }
+
+ public static String lifeCycleStateUI() throws InterruptedException {
+ return GeneralUIUtils.getWebElementByTestID("formlifecyclestate").getText();
+ }
+
+ public static List<String> catalogFilterResourceCategoriesChecBox(ResourceCategoriesNameEnum enumName)
+ throws Exception {
+ List<String> categories = Arrays.asList();
+ switch (enumName) {
+ case APPLICATIONL4:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("applicationServer", "defaulticon", "vl", "cp", "call_controll", "borderElement",
+ "network", "firewall", "database", "loadBalancer");
+ break;
+ case APPLICATION_SERVER:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("applicationServer", "vl", "cp", "defaulticon");
+ break;
+ case BORDER_ELEMENT:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("borderElement", "vl", "cp", "defaulticon");
+ break;
+ case CALL_CONTROL:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("call_controll", "vl", "cp", "defaulticon");
+ break;
+ case COMMON_NETWORK_RESOURCES:
+ GeneralUIUtils.getWebElementByLinkText("Common Network Resources").click();
+ categories = Arrays.asList("network", "vl", "cp", "defaulticon");
+ break;
+ case CONNECTION_POINTS:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("cp", "defaulticon");
+ break;
+ case DATABASE:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("database", "vl", "cp", "defaulticon");
+ break;
+ case DATABASE_GENERIC:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("database", "vl", "cp", "defaulticon");
+ break;
+ case FIREWALL:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("firewall", "vl", "cp", "defaulticon");
+ break;
+ case GATEWAY:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("gateway", "vl", "cp", "defaulticon");
+ break;
+ case INFRASTRUCTURE:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("connector", "vl", "cp", "defaulticon");
+ break;
+ case INFRASTRUCTUREL23:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("ucpe", "vl", "cp", "defaulticon");
+ break;
+ case LAN_CONNECTORS:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("network", "port", "connector", "vl", "cp", "defaulticon");
+ break;
+ case LOAD_BALANCER:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("loadBalancer", "vl", "cp", "defaulticon");
+ break;
+ case MEDIA_SERVERS:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("network", "vl", "cp", "defaulticon");
+ break;
+ case NETWORKL4:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("network", "vl", "cp", "defaulticon");
+ break;
+ case NETWORK_ELEMENTS:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("port", "defaulticon", "network", "connector", "vl", "cp");
+ break;
+ case NETWORK_L23:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("network", "vl", "defaulticon", "cp", "router", "port", "connector", "gateway",
+ "ucpe");
+ break;
+ case NETWORK_CONNECTIVITY:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("network", "vl", "cp", "defaulticon");
+ break;
+ case GENERIC:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("database", "port", "loadBalancer", "vl", "cp", "objectStorage", "compute",
+ "defaulticon", "ucpe", "network", "connector");
+ break;
+ case ABSTRACT:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("objectStorage", "compute", "defaulticon", "cp", "vl");
+ break;
+ case Router:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("router", "vl", "cp", "defaulticon");
+ break;
+ case VIRTUAL_LINKS:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("vl", "defaulticon");
+ break;
+ case WAN_Connectors:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("network", "port", "connector", "vl", "cp", "defaulticon");
+ break;
+ case WEB_SERVER:
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ categories = Arrays.asList("applicationServer", "vl", "cp", "defaulticon");
+ break;
+ }
+ return categories;
+ }
+
+ public static void deleteVersionInUI() throws Exception {
+
+ waitToDeleteVersion().click();
+ ResourceUIUtils.clickButtonBlue();
+ }
+
+ public static void selectTabInRightPallete(String className) throws Exception {
+ WebElement tab = GeneralUIUtils.getWebElementByClassName(className);
+ tab.click();
+ }
+
+ public static WebElement waitToDeleteVersion() {
+ return Waitfunctionforbuttons("//*[@data-tests-id='deleteVersion']", 10);
+ }
+
+ public static WebElement rihtPanelAPI() {
+ return waitFunctionForaGetElements("tab-api", 10);
+ }
+
+ /**
+ * Click on HTML element.
+ *
+ * @param dataTestId
+ * @throws Exception
+ */
+ public static void getWebElementByTestID(String dataTestId) throws Exception {
+ WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 20);
+ WebElement element = wait
+ .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+ element.click();
+ // wait.until(ExpectedConditions.elemetto)
+ // WebElement serviceButton =
+ // GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='"
+ // + dataTestId + "']"));
+ // serviceButton.
+ // serviceButton.click();
+ }
+
+ /**
+ * Move to HTML element by class name. When moving to the HTML element, it
+ * will raise hover event.
+ *
+ * @param className
+ */
+// public static void moveToHTMLElementByClassName(String className) {
+// Actions actions = new Actions(GeneralUIUtils.getDriver());
+// final WebElement createButtonsArea = GeneralUIUtils
+// .retryMethodOnException(() -> GeneralUIUtils.getDriver().findElement(By.className(className)));
+// actions.moveToElement(createButtonsArea).perform();
+// }
+
+ /**
+ * Move to HTML element by element id. When moving to the HTML element, it
+ * will raise hover event.
+ *
+ * @param className
+ */
+// static void moveToHTMLElementByDataTestId(String dataTestId) {
+// // WebElement hoverArea =
+// // GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='"
+// // + dataTestId + "']"));
+// WebElement hoverArea = GeneralUIUtils.waitForElementVisibility(dataTestId);
+// // WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(),
+// // 30);
+// // wait.until(ExpectedConditions.visibilityOf(hoverArea));
+//
+// Actions actions = new Actions(GeneralUIUtils.getDriver());
+// actions.moveToElement(hoverArea).perform();
+// }
+
+ // public static ResourceReqDetails createResourceInUI(User user){
+ // try{
+ // ResourceReqDetails defineResourceDetails =
+ // defineResourceDetails(ResourceTypeEnum.VF);
+ // ResourceUIUtils.moveToHTMLElementByClassName("w-sdc-dashboard-card-new");
+ // ResourceUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
+ // GeneralUIUtils.waitForLoader();
+ //// GeneralUIUtils.sleep(1000);
+ // fillResourceGeneralInformationPage(defineResourceDetails, user);
+ // GeneralPageElements.clickCreateButton();
+ // return defineResourceDetails;
+ // }
+ // catch( Exception e){
+ // throw new RuntimeException(e);
+ // }
+ // }
+
+ /**
+ * Import VFC
+ *
+ * @param user
+ * @param filePath
+ * @param fileName
+ * @return
+ * @throws Exception
+ */
+
+ public static void importVfc(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user)
+ throws Exception {
+ GeneralUIUtils.ultimateWait();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating new VFC resource ", resourceMetaData.getName()));
+ GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue());
+ GeneralUIUtils.ultimateWait();
+ // Insert file to the browse dialog
+ WebElement buttonVFC = GeneralUIUtils.findByText("Import VFC");
+ WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VFC_FILE.getValue());
+ if (!buttonVFC.isDisplayed()){
+ File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName());
+ final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
+ SetupCDTest.getExtendTest().log(Status.WARNING, "VFC button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));
+ }
+ try{
+ fileInputElement.sendKeys(filePath + fileName);
+ } catch (ElementNotVisibleException e) {
+ SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting VFC file input to visible"));
+ showButtons();
+ fileInputElement.sendKeys(filePath + fileName);
+ }
+ // Fill the general page fields.
+ GeneralUIUtils.ultimateWait();
+ fillResourceGeneralInformationPage(resourceMetaData, user, true);
+ GeneralPageElements.clickCreateButton();
+ }
+
+ public static void importVfcNoCreate(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user)
+ throws Exception {
+ GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue());
+ // Insert file to the browse dialog
+ WebElement buttonVFC = GeneralUIUtils.findByText("Import VFC");
+ WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VFC_FILE.getValue());
+ if (!buttonVFC.isDisplayed()){
+ File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName());
+ final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
+ SetupCDTest.getExtendTest().log(Status.WARNING, "VFC button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));
+ }
+ try{
+ fileInputElement.sendKeys(filePath + fileName);
+ } catch (ElementNotVisibleException e) {
+ SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting VFC file input to visible"));
+ showButtons();
+ fileInputElement.sendKeys(filePath + fileName);
+ }
+ // Fill the general page fields.
+ GeneralUIUtils.waitForLoader();
+ fillResourceGeneralInformationPage(resourceMetaData, user, true);
+ }
+
+
+ public static void importVfFromCsar(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user)
+ throws Exception {
+ GeneralUIUtils.ultimateWait();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating new VF asset resource %s", resourceMetaData.getName()));
+ GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue());
+ GeneralUIUtils.ultimateWait();
+ // Insert file to the browse dialog
+ WebElement buttonDCAE = GeneralUIUtils.findByText("Import DCAE asset");
+ WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue());
+ if (!buttonDCAE.isDisplayed()){
+ File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName());
+ final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
+ SetupCDTest.getExtendTest().log(Status.WARNING, "DCAE button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));
+ }
+ try{
+ fileInputElement.sendKeys(filePath + fileName);
+ } catch (ElementNotVisibleException e) {
+ SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting DCAE file input to visible"));
+ showButtons();
+ fileInputElement.sendKeys(filePath + fileName);
+ }
+ // Fill the general page fields.
+ GeneralUIUtils.ultimateWait();
+ fillResourceGeneralInformationPage(resourceMetaData, user, true);
+ GeneralPageElements.clickCreateButton(10*60);
+// GeneralUIUtils.ultimateWait(); "don't change import of csar can take longer then 3 minutes"
+ GeneralUIUtils.waitForLoader(10*60);
+ }
+
+ public static void importVfFromCsarNoCreate(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user)
+ throws Exception {
+ GeneralUIUtils.ultimateWait();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating new VF asset resource %s, Create button will not be clicked", resourceMetaData.getName()));
+ GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue());
+ GeneralUIUtils.ultimateWait();
+ // Insert file to the browse dialog
+ WebElement buttonDCAE = GeneralUIUtils.findByText("Import DCAE asset");
+ WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue());
+ if (!buttonDCAE.isDisplayed()){
+ File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName());
+ final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
+ SetupCDTest.getExtendTest().log(Status.WARNING, "DCAE button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));
+ }
+ try{
+ fileInputElement.sendKeys(filePath + fileName);
+ } catch (ElementNotVisibleException e) {
+ SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting DCAE file input to visible"));
+ showButtons();
+ fileInputElement.sendKeys(filePath + fileName);
+ }
+ // Fill the general page fields.
+ GeneralUIUtils.ultimateWait();
+ fillResourceGeneralInformationPage(resourceMetaData, user, true);
+ GeneralUIUtils.waitForLoader(10*60);
+ }
+
+ public static void updateVfWithCsar(String filePath, String fileName) {
+ ExtentTestActions.log(Status.INFO, "Updating VF with updated CSAR file named " + fileName);
+ WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.GeneralElementsEnum.UPLOAD_FILE_INPUT.getValue());
+ browseWebElement.sendKeys(filePath + fileName);
+ GeneralUIUtils.ultimateWait();
+ GeneralPageElements.clickUpdateButton();
+ GeneralUIUtils.waitForLoader();
+ ExtentTestActions.log(Status.INFO, "VF is updated.");
+ }
+
+
+
+ // public static ResourceReqDetails importVfcInUI(User user, String
+ // filePath, String fileName, ResourceTypeEnum resourceType) {
+ // ResourceReqDetails defineResourceDetails =
+ // defineResourceDetails(resourceType);
+ // ResourceUIUtils.moveToHTMLElementByDataTestId(Dashboard.IMPORT_AREA.getValue());
+ //
+ // // Insert file to the browse dialog
+ // final WebElement browseWebElement =
+ // GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.Dashboard.IMPORT_VFC_FILE.getValue());
+ // browseWebElement.sendKeys(filePath + fileName);
+ //
+ // // Fill the general page fields.
+ // GeneralUIUtils.waitForLoader();
+ // fillResourceGeneralInformationPage(defineResourceDetails, user);
+ // GeneralPageElements.clickCreateButton();
+ // return defineResourceDetails;
+ // }
+
+ /**
+ * Import VF
+ *
+ * @param user
+ * @param filePath
+ * @param fileName
+ * @return
+ * @throws Exception
+ */
+ // public static ResourceReqDetails importVfInUI(User user, String filePath,
+ // String fileName) throws Exception {
+ // ResourceReqDetails defineResourceDetails =
+ // defineResourceDetails(ResourceTypeEnum.VF);
+ // ResourceUIUtils.moveToHTMLElementByDataTestId(Dashboard.IMPORT_AREA.getValue());
+ //
+ // // Insert file to the browse dialog
+ // final WebElement browseWebElement =
+ // GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue());
+ // browseWebElement.sendKeys(filePath + fileName);
+ //
+ // // Fill the general page fields.
+ // GeneralUIUtils.waitForLoader();
+ // fillResourceGeneralInformationPage(defineResourceDetails, user);
+ // GeneralPageElements.clickCreateButton();
+ // return defineResourceDetails;
+ // }
+
+ // public static ResourceReqDetails defineResourceDetails(ResourceTypeEnum
+ // resourceType) {
+ // ResourceReqDetails resource = new ResourceReqDetails();
+ // resource = ElementFactory.getDefaultResource(NormativeTypesEnum.ROOT,
+ // ResourceCategoryEnum.APPLICATION_L4_CALL_CONTROL);
+ // resource.setVersion(INITIAL_VERSION);
+ // resource.setIcon(ICON_RESOURCE_NAME);
+ // resource.setResourceType(resourceType.toString());
+ // resource.setName(getRandomComponentName(RESOURCE_NAME_PREFIX));
+ //
+ // SetupCDTest.setCreatedComponents(Arrays.asList(resource));
+ //
+ // return resource;
+ // }
+
+ protected static String getRandomComponentName(String prefix) {
+ return prefix + new Random().nextInt(10000);
+ }
+
+ public static ImmutablePair<String, String> getFirstRIPos(ResourceReqDetails createResourceInUI, User user) {
+ String responseAfterDrag = RestCDUtils.getResource(createResourceInUI, user).getResponse();
+ JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+ String xPosPostDrag = (String) ((JSONObject) ((JSONArray) jsonResource.get("componentInstances")).get(0))
+ .get("posX");
+ String yPosPostDrag = (String) ((JSONObject) ((JSONArray) jsonResource.get("componentInstances")).get(0))
+ .get("posY");
+ return new ImmutablePair<String, String>(xPosPostDrag, yPosPostDrag);
+
+ }
+
+ public static WebElement getErrorMessageText(WebDriver driver, String text) throws Exception {
+
+ return GeneralUIUtils.getWebElementByClassName(text);
+
+ }
+
+ public static void fillGeneralInfoValuesAndIcon(ResourceReqDetails resource, User user) throws Exception {
+ fillResourceGeneralInformationPage(resource, user, true);
+
+ GeneralPageElements.clickCreateButton();
+
+ selectRandomResourceIcon();
+ }
+
+ // coded by teddy.
+ public static void getVFCGeneralInfoAndValidate(ResourceReqDetails resource, User user)
+ throws InterruptedException {
+ Thread.sleep(2000);
+ WebDriver driver = GeneralUIUtils.getDriver();
+ String version = GeneralUIUtils.getSelectList(null, "versionHeader").getFirstSelectedOption().getText();
+ String name = GeneralUIUtils.getWebElementByTestID( "name").getAttribute("value");
+ String description = GeneralUIUtils.getWebElementByTestID( "description").getAttribute("value");
+ String category = GeneralUIUtils.getSelectList(null, "selectGeneralCategory").getFirstSelectedOption()
+ .getText();
+ String vendorName = GeneralUIUtils.getWebElementByTestID( "vendorName").getAttribute("value");
+ String vendorRelease = GeneralUIUtils.getWebElementByTestID( "vendorRelease").getAttribute("value");
+ List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-text");
+ String type = GeneralUIUtils.getWebElementsListByTestID("type").get(1).getText();
+ int index = type.lastIndexOf(":");
+ System.out.println(type.substring(0, index));
+ String AttContact = GeneralUIUtils.getWebElementByTestID( "attContact").getAttribute("value");
+ System.out.println(resource.getVersion());
+ assertTrue(resource.getVersion().equals(version.substring(1)));
+ assertTrue(resource.getName().equals(name));
+ assertTrue(resource.getDescription().equals(description));
+ System.out.println(resource.getVendorName());
+ System.out.println(resource.getVendorRelease());
+ assertTrue(resource.getCategories().get(0).getSubcategories().get(0).getName().equals(category));
+ assertTrue(resource.getVendorName().equals(vendorName));
+ assertTrue(resource.getVendorRelease().equals(vendorRelease));
+ assertTrue(resource.getCreatorUserId().equals(AttContact));
+ assertEquals(type.substring(0, index), resource.getResourceType());
+
+ for (int i = 0; i < tags.size(); i++) {
+ assertEquals(resource.getTags().get(i), tags.get(i).getText());
+ }
+ }
+
+ public static RestResponse createResourceNG(ResourceReqDetails resource, User user) throws Exception, AWTException {
+
+ GeneralUIUtils.hoverOnAreaByTestId("w-sdc-dashboard-card-new");
+ ResourceUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
+ fillResourceGeneralInformationPage(resource, user, true);
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue());
+ return null;
+
+ }
+
+ public static void showButtons(){
+ String parentElementClassAttribute = "sdc-dashboard-import-element-container";
+ WebElement fileInputElementWithVisible = GeneralUIUtils.getDriver().findElement(By.className(parentElementClassAttribute));
+ GeneralUIUtils.unhideElement(fileInputElementWithVisible, parentElementClassAttribute);
+ GeneralUIUtils.ultimateWait();
+ SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Input buttons now visible..."));
+ }
+
+ public static void showButtonsADD(){
+ try {
+ GeneralUIUtils.ultimateWait();
+ String parentElementClassAttribute = "sdc-dashboard-create-element-container";
+ WebElement fileInputElementWithVisible = GeneralUIUtils.getDriver().findElement(By.className(parentElementClassAttribute));
+ GeneralUIUtils.unhideElement(fileInputElementWithVisible, parentElementClassAttribute);
+ GeneralUIUtils.ultimateWait();
+ } catch (Exception e ){
+ GeneralUIUtils.ultimateWait();
+ String parentElementClassAttribute = "sdc-dashboard-create-element-container";
+ WebElement fileInputElementWithVisible = GeneralUIUtils.getDriver().findElement(By.className(parentElementClassAttribute));
+ GeneralUIUtils.unhideElement(fileInputElementWithVisible, parentElementClassAttribute);
+ GeneralUIUtils.ultimateWait();
+ }
+ SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Input buttons now visible..."));
+ }
+
+ public static void clickOnElementByText(String textToClick, String customizationFoLog){
+ String customizationFoLogLocal = customizationFoLog != null ? customizationFoLog : "";
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s %s", textToClick, customizationFoLogLocal));
+ GeneralUIUtils.clickOnElementByText(textToClick);
+ }
+}
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
new file mode 100644
index 0000000000..b2bad99d2a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java
@@ -0,0 +1,344 @@
+/*-
+ * ============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.assertTrue;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+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;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.category.CategoryDefinition;
+import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.UserRestUtils;
+
+import com.aventstack.extentreports.Status;
+
+public class RestCDUtils {
+
+ private static void setResourceUniqueIdAndUUID(ComponentReqDetails element, RestResponse getResourceResponse) {
+ element.setUniqueId(ResponseParser.getUniqueIdFromResponse(getResourceResponse));
+ element.setUUID(ResponseParser.getUuidFromResponse(getResourceResponse));
+ }
+
+ public static RestResponse getResource(ResourceReqDetails resource, User user) {
+ final String getResourceMsg = "Trying to get resource named " + resource.getName() + " with version " + resource.getVersion();
+ final String succeedGetResourceMsg = "Succeeded to get resource named " + resource.getName() + " with version " + resource.getVersion();
+ final String failedGetResourceMsg = "Failed to get resource named " + resource.getName() + " with version " + resource.getVersion();
+ try {
+ ExtentTestActions.log(Status.INFO, getResourceMsg);
+ System.out.println(getResourceMsg);
+ GeneralUIUtils.sleep(1000);
+ RestResponse getResourceResponse = null;
+ String reourceUniqueId = resource.getUniqueId();
+ if (reourceUniqueId != null) {
+ getResourceResponse = ResourceRestUtils.getResource(reourceUniqueId);
+ if (getResourceResponse.getErrorCode().intValue() == 200) {
+ ExtentTestActions.log(Status.INFO, succeedGetResourceMsg);
+ System.out.println(succeedGetResourceMsg);
+ }
+ return getResourceResponse;
+ }
+ JSONObject getResourceJSONObject = null;
+ getResourceResponse = ResourceRestUtils.getResourceByNameAndVersion(user.getUserId(), resource.getName(), resource.getVersion());
+ if (getResourceResponse.getErrorCode().intValue() == 200) {
+// JSONArray jArray = new JSONArray(getResourceResponse.getResponse());
+// for (int i = 0; i < jArray.length(); i++) {
+// getResourceJSONObject = jArray.getJSONObject(i);
+// String resourceType = ResponseParser.getValueFromJsonResponse(getResourceJSONObject.toString(), "resourceType");
+// if (resourceType.equals(resource.getResourceType())) {
+// getResourceResponse.setResponse(getResourceJSONObject.toString());
+ setResourceUniqueIdAndUUID(resource, getResourceResponse);
+ ExtentTestActions.log(Status.INFO, succeedGetResourceMsg);
+ System.out.println(succeedGetResourceMsg);
+ return getResourceResponse;
+// }
+// }
+ }
+ ExtentTestActions.log(Status.INFO, failedGetResourceMsg);
+ return getResourceResponse;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static RestResponse getService(ServiceReqDetails service, User user) {
+ try {
+ Thread.sleep(3500);
+ RestResponse getServiceResponse = ServiceRestUtils.getServiceByNameAndVersion(user, service.getName(),
+ service.getVersion());
+ if (getServiceResponse.getErrorCode().intValue() == 200) {
+ setResourceUniqueIdAndUUID(service, getServiceResponse);
+ }
+ return getServiceResponse;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public static RestResponse getProduct(ProductReqDetails product, User user) {
+ try {
+ Thread.sleep(3500);
+ RestResponse getProductResponse = ProductRestUtils.getProductByNameAndVersion(product.getName(),
+ product.getVersion(), user.getUserId());
+ if (getProductResponse.getErrorCode().intValue() == 200) {
+ setResourceUniqueIdAndUUID(product, getProductResponse);
+ }
+ return getProductResponse;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static Map<String, String> getAllElementVersionsFromResponse(RestResponse getResource) throws Exception {
+ Map<String, String> versionsMap = new HashMap<String, String>();
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+
+ JSONObject object = new JSONObject(getResource.getResponse());
+ versionsMap = mapper.readValue(object.get("allVersions").toString(), Map.class);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return versionsMap;
+
+ }
+
+ return versionsMap;
+ }
+
+ public static void deleteElementVersions(Map<String, String> elementVersions, boolean isBeforeTest, Object clazz,
+ User user) throws Exception {
+ Iterator<String> iterator = elementVersions.keySet().iterator();
+ while (iterator.hasNext()) {
+ String singleVersion = iterator.next();
+ String uniqueId = elementVersions.get(singleVersion);
+ RestResponse deleteResponse = null;
+ if (clazz instanceof ServiceReqDetails) {
+ deleteResponse = ServiceRestUtils.deleteServiceById(uniqueId, user.getUserId());
+ } else if (clazz instanceof ResourceReqDetails) {
+ deleteResponse = ResourceRestUtils.deleteResource(uniqueId, user.getUserId());
+ } else if (clazz instanceof ProductReqDetails) {
+ deleteResponse = ProductRestUtils.deleteProduct(uniqueId, user.getUserId());
+ }
+
+ if (isBeforeTest) {
+ assertTrue(deleteResponse.getErrorCode().intValue() == 204
+ || deleteResponse.getErrorCode().intValue() == 404);
+ } else {
+ assertTrue(deleteResponse.getErrorCode().intValue() == 204);
+ }
+ }
+ }
+
+ public static void deleteAllResourceVersionsAfterTest(ComponentReqDetails componentDetails,
+ RestResponse getObjectResponse, User user) {
+ try {
+ deleteAllComponentVersion(false, componentDetails, getObjectResponse, user);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void deleteAllResourceVersionsBeforeTest(ComponentReqDetails componentDetails,
+ RestResponse getObjectResponse, User user) throws Exception {
+ deleteAllComponentVersion(true, componentDetails, getObjectResponse, user);
+ }
+
+ public static void deleteAllComponentVersion(boolean isBeforeTest, ComponentReqDetails componentDetails,
+ RestResponse getObjectResponse, User user) throws Exception {
+ if (getObjectResponse.getErrorCode().intValue() == 404)
+ return;
+ Map<String, String> componentVersionsMap = getAllElementVersionsFromResponse(getObjectResponse);
+ System.out.println("deleting...");
+ deleteElementVersions(componentVersionsMap, isBeforeTest, componentDetails, user);
+ componentDetails.setUniqueId(null);
+ }
+
+
+
+ public static String getExecutionHostAddress() {
+
+ String computerName = null;
+ try {
+ computerName = InetAddress.getLocalHost().getHostAddress().replaceAll("\\.", "&middot;");
+ System.out.println(computerName);
+ if (computerName.indexOf(".") > -1)
+ computerName = computerName.substring(0,
+ computerName.indexOf(".")).toUpperCase();
+ } catch (UnknownHostException e) {
+ System.out.println("Uknown hostAddress");
+ }
+ return computerName != null ? computerName : "Uknown hostAddress";
+ }
+
+ public static Map<String, List<Component>> getCatalogAsMap() throws IOException {
+ User defaultAdminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+ RestResponse catalog = CatalogRestUtils.getCatalog(defaultAdminUser.getUserId());
+ Map<String, List<Component>> convertCatalogResponseToJavaObject = ResponseParser
+ .convertCatalogResponseToJavaObject(catalog.getResponse());
+ return convertCatalogResponseToJavaObject;
+ }
+
+ public static Map<String, List<CategoryDefinition>> getCategories() throws Exception {
+
+ User defaultAdminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+
+ Map<String,List<CategoryDefinition>> map = new HashMap<String,List<CategoryDefinition>>();
+
+
+ RestResponse allResourceCategories = CategoryRestUtils.getAllCategories(defaultAdminUser, ComponentTypeEnum.RESOURCE_PARAM_NAME);
+ RestResponse allServiceCategories = CategoryRestUtils.getAllCategories(defaultAdminUser, ComponentTypeEnum.SERVICE_PARAM_NAME);
+
+ List<CategoryDefinition> parsedResourceCategories = ResponseParser.parseCategories(allResourceCategories);
+ List<CategoryDefinition> parsedServiceCategories = ResponseParser.parseCategories(allServiceCategories);
+
+ map.put(ComponentTypeEnum.RESOURCE_PARAM_NAME, parsedResourceCategories);
+ map.put(ComponentTypeEnum.SERVICE_PARAM_NAME, parsedServiceCategories);
+
+ return map;
+ }
+
+ public static void deleteCreatedComponents(Map<String, List<Component>> map) throws IOException {
+
+ System.out.println("going to delete all created components...");
+
+ User defaultAdminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+ 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());
+ 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());
+ 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());
+ for (String uId : collect) {
+ ResourceRestUtils.markResourceToDelete(uId, userId);
+ }
+ ResourceRestUtils.deleteMarkedResources(userId);
+
+
+
+
+
+ }
+
+ public static void deleteCategoriesByList(List<CategoryDefinition> listCategories, String componentType, User user) throws Exception {
+
+ for (CategoryDefinition categoryDefinition : listCategories) {
+ if (categoryDefinition.getName().toLowerCase().startsWith("ci")) {
+ List<SubCategoryDefinition> subcategories = categoryDefinition.getSubcategories();
+ if (subcategories != null) {
+ for (SubCategoryDefinition subCategoryDefinition : subcategories) {
+
+ CategoryRestUtils.deleteSubCategory(subCategoryDefinition.getUniqueId(),
+ categoryDefinition.getUniqueId(), user.getUserId(),
+ componentType);
+ }
+ }
+
+ CategoryRestUtils.deleteCategory(categoryDefinition.getUniqueId(), user.getUserId(),
+ componentType);
+
+ }
+ }
+ }
+
+ public static String getUserRole(User reqUser, User user){
+ try{
+ RestResponse getUserRoleResp = UserRestUtils.getUserRole(reqUser, user);
+ JSONObject jObject = new JSONObject(getUserRoleResp.getResponse());
+ return jObject.getString("role");
+ }
+ catch(Exception e){
+ return null;
+ }
+ }
+
+ public static RestResponse getUser(User reqUser, User user){
+ try{
+ return UserRestUtils.getUser(reqUser, user);
+ }
+ catch(Exception e){
+ return null;
+ }
+ }
+
+ /*************************************/
+
+ public static void deleteOnDemand() throws IOException {
+ Config config = DriverFactory.getConfig();
+ if(!config.getSystemUnderDebug()){
+ deleteCreatedComponents(getCatalogAsMap());
+ }else{
+ System.out.println("Accordindig to configuration components will not be deleted, in case to unable option to delete, please change systemUnderDebug parameter value to false ...");
+ }
+ }
+
+ public static void deleteCategories(User user) throws Exception {
+ Map<String, List<CategoryDefinition>> categoriesMap = getCategories();
+ List<CategoryDefinition> listCategories = categoriesMap.get(ComponentTypeEnum.RESOURCE_PARAM_NAME);
+ deleteCategoriesByList(listCategories, ComponentTypeEnum.RESOURCE_PARAM_NAME, user);
+ listCategories = categoriesMap.get(ComponentTypeEnum.SERVICE_PARAM_NAME);
+ deleteCategoriesByList(listCategories, ComponentTypeEnum.SERVICE_PARAM_NAME, user);
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ServiceUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ServiceUIUtils.java
new file mode 100644
index 0000000000..8b07e621d9
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ServiceUIUtils.java
@@ -0,0 +1,286 @@
+/*-
+ * ============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 static org.testng.AssertJUnit.assertTrue;
+
+import java.awt.AWTException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.category.CategoryDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceCategoriesNameEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.Select;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import com.aventstack.extentreports.Status;
+
+public class ServiceUIUtils {
+
+ protected static WebDriver driver;
+
+ public ServiceUIUtils(TestName name, String className) {
+ super();
+ }
+
+ public static String defineServiceName(String Name) {
+ WebElement serviceName = GeneralUIUtils.getWebElementByTestID("name");
+ serviceName.clear();
+ serviceName.sendKeys(Name);
+ return Name;
+ }
+
+ public void moveResourceInstanceToCanvasUI() throws Exception {
+ List<WebElement> moveResource = driver.findElements(By.className("sprite-resource-icons"));
+ WebElement moveResourceToCanvasResourceOne = moveResource.get(0);
+ // WebElement moveResource =
+ // driver.findElement(By.className("sprite-resource-icons"));
+ Actions action = new Actions(driver);
+ action.moveToElement(moveResourceToCanvasResourceOne);
+ action.clickAndHold(moveResourceToCanvasResourceOne);
+ action.moveByOffset(635, 375);
+ action.release();
+ action.perform();
+ WebElement moveResourceToCanvasResourceTwo = moveResource.get(1);
+ action.moveToElement(moveResourceToCanvasResourceTwo);
+ action.clickAndHold(moveResourceToCanvasResourceTwo);
+ action.moveByOffset(535, 375);
+ action.release();
+ action.perform();
+ WebElement moveResourceToCanvasResourceTree = moveResource.get(2);
+ action.moveToElement(moveResourceToCanvasResourceTree);
+ action.clickAndHold(moveResourceToCanvasResourceTree);
+ action.moveByOffset(435, 375);
+ action.release();
+ action.perform();
+ Thread.sleep(2000);
+ }
+
+ public static String catalogFilterServiceCategoriesChecBox(ServiceCategoriesNameEnum enumName) throws Exception {
+ String Type = null;
+ GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+ return Type;
+ }
+
+ public static List<String> catalogServiceTypeChecBox(ServiceCategoriesNameEnum enumtype) throws Exception {
+ List<String> categories = null;
+ switch (enumtype) {
+ case NETWORK_L13:
+ GeneralUIUtils.getWebElementByTestID(enumtype.getValue()).click();
+ categories = Arrays.asList("network_l_1-3");
+ break;
+ case NETWORKL4:
+ GeneralUIUtils.getWebElementByTestID(enumtype.getValue()).click();
+ categories = Arrays.asList("network_l_4 ");
+ break;
+ case MOBILITY:
+ GeneralUIUtils.getWebElementByTestID(enumtype.getValue()).click();
+ categories = Arrays.asList("mobility");
+ break;
+ case VOIPCALL_CONTROL:
+ GeneralUIUtils.getWebElementByTestID(enumtype.getValue()).click();
+ categories = Arrays.asList("call_controll ");
+ break;
+ }
+ return categories;
+ }
+
+ public static WebElement waitToNextButtonEnabled() {
+ return GeneralUIUtils.getWebElementByTestID("Next");
+ }
+
+ public static WebElement waitToFinishButtonEnabled() {
+ return GeneralUIUtils.getWebElementByTestID("Finish");
+ }
+
+ public static WebElement deleteServiceInUI() {
+
+ return GeneralUIUtils.getWebElementByTestID("deleteVersion");
+ }
+
+ // get the service view data for validate.
+ // created by tedy.
+ public static void getServiceGeneralInfo(ServiceReqDetails service, User user) throws InterruptedException {
+ Thread.sleep(2000);
+ String version = GeneralUIUtils.getSelectList(null, "versionHeader").getFirstSelectedOption().getText()
+ .substring(1);
+ String name = GeneralUIUtils.getWebElementByTestID("name").getAttribute("value");
+ String description = GeneralUIUtils.getWebElementByTestID("description").getAttribute("value");
+ String category = GeneralUIUtils.getSelectList(null, "selectGeneralCategory").getFirstSelectedOption()
+ .getText();
+ List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-text");
+ String type = GeneralUIUtils.getWebElementsListByTestID("type").get(1).getText();
+ int index = type.lastIndexOf(":");
+ System.out.println(type.substring(0, index));
+ String attContact = GeneralUIUtils.getWebElementByTestID("attContact").getAttribute("value");
+ String pmatt = GeneralUIUtils.getWebElementByTestID("pmatt").getAttribute("value");
+ System.out.println(service.getVersion());
+ assertTrue(service.getVersion().equals(version));
+ assertTrue(service.getName().equals(name));
+ assertTrue(service.getDescription().equals(description));
+ assertTrue(service.getCategories().get(0).getName().equals(category));
+ System.out.println(service.getContactId());
+ assertTrue(service.getContactId().equals(attContact));
+ assertTrue(service.getProjectCode().equals(pmatt));
+ for (int i = 0; i < tags.size(); i++) {
+ assertEquals(service.getTags().get(i), tags.get(i).getText());
+ }
+
+ }
+
+// public static void defineTagsList(ServiceReqDetails service, String[] serviceTags) {
+// List<String> taglist = new ArrayList<String>();
+// WebElement serviceTagsTextbox = GeneralUIUtils.getWebElementByTestID("i-sdc-tag-input");
+// for (String tag : serviceTags) {
+// serviceTagsTextbox.clear();
+// serviceTagsTextbox.sendKeys(tag);
+// GeneralUIUtils.sleep(1000);
+// serviceTagsTextbox.sendKeys(Keys.ENTER);
+// taglist.add(tag);
+// }
+// taglist.add(0, service.getName());
+// service.setTags(taglist);
+// }
+
+ public static void defineTagsList2(List<String> serviceTags){
+ WebElement serviceTagsTextbox = GeneralUIUtils.getWebElementByTestID("i-sdc-tag-input");
+ for (String tag : serviceTags) {
+ serviceTagsTextbox.clear();
+ serviceTagsTextbox.sendKeys(tag);
+ GeneralUIUtils.waitForAngular();
+ serviceTagsTextbox.sendKeys(Keys.ENTER);
+ }
+ }
+
+ public static Select defineServiceCategory(String category) {
+
+ return GeneralUIUtils.getSelectList(category, "selectGeneralCategory");
+ }
+
+ public static void defineServicePmatt(String pmatt) {
+ WebElement attPmattTextbox = GeneralUIUtils.getWebElementByTestID("pmatt");
+ attPmattTextbox.clear();
+ attPmattTextbox.sendKeys(pmatt);
+ }
+
+ public static void selectRandomResourceIcon() throws Exception {
+ GeneralUIUtils.moveToStep(StepsEnum.ICON);
+ WebDriverWait wait = new WebDriverWait(driver, 6);
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[contains(@data-tests-id, 'iconBox')]")));
+ List<WebElement> iconElement = driver.findElements(By.xpath("//*[contains(@data-tests-id, 'iconBox')]"));
+ iconElement.get(0).click();
+ }
+
+ public static String defineDescription(String description) {
+ WebElement descriptionTextbox = GeneralUIUtils.getWebElementByTestID("description");
+ descriptionTextbox.clear();
+ descriptionTextbox.sendKeys(description);
+ return description;
+ }
+
+ public static void defineContactId(String userId) {
+ WebElement attContact = GeneralUIUtils.getWebElementByTestID("attContact");
+ attContact.clear();
+ attContact.sendKeys(userId);
+ }
+
+ public static WebElement clickAddArtifact() {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking Add Artifact button"));
+ return GeneralUIUtils.getWebElementByTestID("addArtifactButton");
+ }
+
+ public static WebElement getArtifactName() {
+ return GeneralUIUtils.getWebElementByTestID("artifactName");
+ }
+
+ public static WebElement getArtifactDetails() {
+ return GeneralUIUtils.getWebElementByTestID("artifactDisplayName");
+ }
+
+ public static void fillServiceGeneralPage(ServiceReqDetails service, User user) throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Fill in metadata values in general page"));
+ ServiceGeneralPage.defineName(service.getName());
+ ServiceGeneralPage.defineDescription(service.getDescription());
+ ServiceGeneralPage.defineCategory(service.getCategories().get(0).getName());
+ ServiceGeneralPage.defineProjectCode(service.getProjectCode());
+ defineTagsList2(service.getTags());
+ ServiceGeneralPage.defineContactId(service.getContactId());
+ GeneralUIUtils.clickSomewhereOnPage();
+ }
+
+ public static void createService(ServiceReqDetails service, User user) throws Exception, AWTException {
+ clickAddService();
+ fillServiceGeneralPage(service, user);
+ GeneralPageElements.clickCreateButton();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("The service %s was created", service.getName()));
+ }
+
+ public static void setServiceCategory(ServiceReqDetails service, ServiceCategoriesEnum category){
+ CategoryDefinition categoryDefinition = new CategoryDefinition();
+ categoryDefinition.setName(category.getValue());
+ List<CategoryDefinition> categories = new ArrayList<>();
+ categories.add(categoryDefinition);
+ service.setCategories(categories);
+ }
+
+ public static void createServiceWithDefaultTagAndUserId(ServiceReqDetails service, User user) {
+ clickAddService();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Defining General Page fields"));
+ ServiceGeneralPage.defineName(service.getName());
+ ServiceGeneralPage.defineDescription(service.getDescription());
+ ServiceGeneralPage.defineCategory(service.getCategories().get(0).getName());
+ ServiceGeneralPage.defineProjectCode(service.getProjectCode());
+ GeneralUIUtils.ultimateWait();
+ GeneralPageElements.clickCreateButton();
+ }
+
+ public static void clickAddService(){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking the Add Service button"));
+ try {
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.ADD_AREA.getValue());
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()).click();
+ GeneralUIUtils.ultimateWait();
+ } catch (Exception e){
+ SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exception on catched on Add Service button, retrying ..."));
+ GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new");
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()).click();
+ GeneralUIUtils.ultimateWait();
+ }
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java
new file mode 100644
index 0000000000..25f71eeb0a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java
@@ -0,0 +1,168 @@
+/*-
+ * ============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.verificator;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.DistributionStatusEnum;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.TypesEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.testng.Assert;
+import org.testng.TestNGException;
+
+import com.aventstack.extentreports.Status;
+
+public class CatalogVerificator {
+
+ public static int getResourceNumber(ResourceTypeEnum resourceType, Map<String, List<Component>> catalogAsMap) throws Exception {
+ List<Component> resourcesArrayList = catalogAsMap.get("resources");
+ return resourcesArrayList.stream().
+ filter(s -> ((Resource)s).getResourceType().equals(resourceType)).
+ collect(Collectors.toList()).size();
+ }
+
+ public static int getTypeNumber(TypesEnum enumtype) throws Exception{
+ Map<String, List<Component>> catalogAsMap = RestCDUtils.getCatalogAsMap();
+ switch (enumtype) {
+ case RESOURCE:
+ return getResourceNumber(catalogAsMap);
+ case SERVICE:
+ return getServiceNumber(catalogAsMap);
+ case PRODUCT:
+ return getProductsNumber(catalogAsMap);
+ default:
+ return getResourceNumber(ResourceTypeEnum.valueOf(enumtype.name()), catalogAsMap);
+ }
+ }
+
+ public static int getResourceNumber(Map<String, List<Component>> catalogAsMap) throws Exception {
+ return catalogAsMap.get("resources").size();
+ }
+
+ public static int getServiceNumber(Map<String, List<Component>> catalogAsMap) throws Exception {
+ return catalogAsMap.get("services").size();
+ }
+
+ public static int getProductsNumber(Map<String, List<Component>> catalogAsMap) throws Exception {
+ return catalogAsMap.get("products").size();
+ }
+
+ public static void validateType(TypesEnum enumtype) throws Exception{
+ int numberOfElementsFromBE = getTypeNumber(enumtype);
+ int numberOfElementsFromUI = getNumberOfElementsFromCatalogHeader();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating number of %s elements, should be %s ...", enumtype.name(), numberOfElementsFromBE));
+ Assert.assertEquals(numberOfElementsFromBE, numberOfElementsFromUI, String.format("Expected : %s, Actual: %s", numberOfElementsFromBE, numberOfElementsFromUI));
+ }
+
+ public static int getStatusNumber(List<LifeCycleStateEnum> status) throws Exception {
+ Map<String, List<Component>> catalogAsMap = RestCDUtils.getCatalogAsMap();
+ return catalogAsMap.entrySet().stream().
+ map(s -> s.getValue()).
+ flatMap(List::stream).
+ filter(s -> status.contains(mapBeLifecycleToUIStatus(s))).
+ collect(Collectors.toList()).size();
+ }
+
+ public static void validateStatus(List<LifeCycleStateEnum> status, String checkboxName) throws Exception{
+ int numberOfElementsFromBE = getStatusNumber(status);
+ int numberOfElementsFromUI = getNumberOfElementsFromCatalogHeader();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating number of %s elements , should be %s ...", checkboxName, numberOfElementsFromBE));
+ Assert.assertEquals(numberOfElementsFromBE, numberOfElementsFromUI, String.format("Expected : %s, Actual: %s", numberOfElementsFromBE, numberOfElementsFromUI));
+ }
+
+ public static int getCategoryNumber(String categoryName) throws Exception {
+ Map<String, List<Component>> catalogAsMap = RestCDUtils.getCatalogAsMap();
+ List<Component> serviceAndResourceList = new ArrayList<Component>();
+ serviceAndResourceList.addAll(catalogAsMap.get("resources"));
+ serviceAndResourceList.addAll(catalogAsMap.get("services"));
+ return serviceAndResourceList.stream().
+ filter(s -> s.getCategories().get(0).getName().equals(categoryName)).
+ collect(Collectors.toList()).size();
+ }
+
+ public static void validateCategory(String categoryName) throws Exception{
+ int numberOfElementsFromBE = getCategoryNumber(categoryName);
+ int numberOfElementsFromUI = getNumberOfElementsFromCatalogHeader();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating number of %s category elements , should be %s ...", categoryName, numberOfElementsFromBE));
+ Assert.assertEquals(numberOfElementsFromBE, numberOfElementsFromUI, String.format("Expected : %s, Actual: %s", numberOfElementsFromBE, numberOfElementsFromUI));
+ }
+
+ public static int getSubCategoryNumber(String categoryName , String subCategoryName) throws Exception {
+ Map<String, List<Component>> catalogAsMap = RestCDUtils.getCatalogAsMap();
+ List<Component> resourcesArrayList = catalogAsMap.get("resources");
+ return resourcesArrayList.stream().
+ filter(s -> s.getCategories().get(0).getName().equals(categoryName) &&
+ s.getCategories().get(0).getSubcategories().get(0).getName().equals(subCategoryName)).
+ collect(Collectors.toList()).size();
+ }
+
+ public static void validateSubCategory(String categoryName, String subCategoryName) throws Exception{
+ int numberOfElementsFromBE = getSubCategoryNumber(categoryName, subCategoryName);
+ int numberOfElementsFromUI = getNumberOfElementsFromCatalogHeader();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating number of %s/%s subcategory elements , should be %s ...", categoryName, subCategoryName, numberOfElementsFromBE));
+ Assert.assertEquals(numberOfElementsFromBE, numberOfElementsFromUI, String.format("Expected : %s, Actual: %s", numberOfElementsFromBE, numberOfElementsFromUI));
+ }
+
+ public static int getNumberOfElementsFromCatalogHeader(){
+ String elementsAsString = GeneralUIUtils.getWebElementByClassName("w-sdc-dashboard-catalog-header").getText();
+ String numberOfElementsAsString = elementsAsString.split(" ")[0];
+ if (numberOfElementsAsString.equals("No")){
+ return 0;
+ } else {
+ return Integer.parseInt(numberOfElementsAsString);
+ }
+ }
+
+ private static LifeCycleStateEnum mapBeLifecycleToUIStatus(Component component){
+ boolean isServiceAndDistributed = component.getComponentType().equals(ComponentTypeEnum.SERVICE) &&
+ ((Service) component).getDistributionStatus().equals(DistributionStatusEnum.DISTRIBUTED);
+ switch (component.getLifecycleState()) {
+ case CERTIFIED:
+ if (isServiceAndDistributed){
+ return LifeCycleStateEnum.DISTRIBUTED;
+ } else {
+ return LifeCycleStateEnum.CERTIFIED;
+ }
+ case READY_FOR_CERTIFICATION:
+ return LifeCycleStateEnum.READY_FOR_TESTING;
+ case CERTIFICATION_IN_PROGRESS:
+ return LifeCycleStateEnum.IN_TESTING;
+ case NOT_CERTIFIED_CHECKIN:
+ return LifeCycleStateEnum.CHECKIN; //to IN DESIGN
+ case NOT_CERTIFIED_CHECKOUT:
+ return LifeCycleStateEnum.CHECKOUT; //to IN DESIGN
+ default:
+ throw new TestNGException("Missing enum value in enum converter");
+ }
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CustomizationUUIDVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CustomizationUUIDVerificator.java
new file mode 100644
index 0000000000..9cb305deae
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CustomizationUUIDVerificator.java
@@ -0,0 +1,27 @@
+package org.openecomp.sdc.ci.tests.verificator;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class CustomizationUUIDVerificator {
+
+ public static void validateCustomizationUUIDuniqueness(List customizationUUIDs) {
+ boolean hasNoDuplicates = CustomizationUUIDVerificator.containsUnique(customizationUUIDs);
+ assertTrue("There are duplicate customizationUUIDs in list",hasNoDuplicates==true);
+ }
+
+ public static <T> boolean containsUnique(List<T> list){
+ Set<T> set = new HashSet<>();
+
+ for (T t: list){
+ if (!set.add(t))
+ return false;
+ }
+
+ return true;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/DeploymentViewVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/DeploymentViewVerificator.java
new file mode 100644
index 0000000000..0d06d8ef96
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/DeploymentViewVerificator.java
@@ -0,0 +1,328 @@
+/*-
+ * ============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.verificator;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+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.FileUtils;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.DeploymentPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsTopologyTemplateDefinition;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
+import org.openqa.selenium.WebElement;
+import org.testng.SkipException;
+import org.testng.TestException;
+import org.testng.TestNGException;
+
+import com.aventstack.extentreports.Status;
+
+public class DeploymentViewVerificator {
+
+ private static String[] currentProperties = {"isBase",
+ "vf_module_label",
+ "vf_module_description",
+ "min_vf_module_instances",
+ "max_vf_module_instances",
+ "initial_count",
+ "vf_module_type",
+ "volume_group",
+ "vfc_list",
+ "availability_zone_count"};
+
+ private static Map<String, HashMap<String, List<String>>> deploymentViewData = new HashMap<String, HashMap<String, List<String>>>(){
+ {
+ HashMap<String, List<String>> segw_heat_c3_base , segw_heat_c3_VMs1 ;
+
+ segw_heat_c3_base = new HashMap<String, List<String>>();
+ segw_heat_c3_base.put("members", Arrays.asList("segw_internet_security_group", "segw_security_group", "int_layer2vlan_net"));
+ segw_heat_c3_base.put("artifacts", Arrays.asList("segw_heat_c3_base.yml", "segw_heat_c3_base.env"));
+ segw_heat_c3_base.put("properties", Arrays.asList(currentProperties));
+ put("segw_heat_c3_base", segw_heat_c3_base);
+ segw_heat_c3_VMs1 = new HashMap<String, List<String>>();
+ segw_heat_c3_VMs1.put("members", Arrays.asList("segw_oam_protected_0_port",
+ "fw_oam_int_layer2vlan_1_port",
+ "segw_0", "segw_internet_1_port",
+ "segw_layer2vlan_2_port",
+ "fw_gn_0", "fw_gn_hsl_direct_3_port",
+ "fw_oam_oam_mgmt_0_port",
+ "fw_oam_hsl_direct_3_port",
+ "fw_gn_oam_mgmt_0_port",
+ "fw_oam_oam_direct_2_port",
+ "fw_gn_gn_direct_2_port",
+ "fw_oam_0",
+ "fw_gn_int_layer2vlan_1_port"));
+ segw_heat_c3_VMs1.put("artifacts", Arrays.asList("segw_heat_c3_VMs1.yml", "segw_heat_c3_VMs1.env"));
+ segw_heat_c3_VMs1.put("properties", Arrays.asList(currentProperties));
+ put("segw_heat_c3_VMs1", segw_heat_c3_VMs1);
+ }
+ };
+
+ private static Map<String, HashMap<String, List<String>>> deploymentViewDataMixedArtefects = new HashMap<String, HashMap<String, List<String>>>(){
+ {
+ HashMap<String, List<String>> module_1_ldsa, module_2_ldsa, base_ldsa;
+
+ module_1_ldsa = new HashMap<String, List<String>>();
+ module_1_ldsa.put("members", new ArrayList(Arrays.asList("ltm_oam_protected_0_port", "ltm_dmz_direct_0_port", "ltm_server_0")));
+ module_1_ldsa.put("artifacts", new ArrayList(Arrays.asList("module_1_ldsa.yaml", "module_1_ldsa.env", "base_ldsa.33.yaml", "module_1_ldsa.11.yaml")));
+ module_1_ldsa.put("properties", new ArrayList(Arrays.asList(currentProperties)));
+ put("module_1_ldsa", module_1_ldsa);
+ module_2_ldsa = new HashMap<String, List<String>>();
+ module_2_ldsa.put("members", new ArrayList(Arrays.asList("ltm_server_0")));
+ module_2_ldsa.put("artifacts", new ArrayList(Arrays.asList("module_2_ldsa.yaml", "module_2_ldsa.env", "base_ldsa.3.yaml", "module_2_ldsa.22.yaml")));
+ module_2_ldsa.put("properties", new ArrayList(Arrays.asList(currentProperties)));
+ put("module_2_ldsa", module_2_ldsa);
+ base_ldsa = new HashMap<String, List<String>>();
+ base_ldsa.put("members", new ArrayList(Arrays.asList("ldsa_sec_grp_1")));
+ base_ldsa.put("artifacts", new ArrayList(Arrays.asList("base_ldsa.yaml", "module_2_ldsa.2.yaml", "module_1_ldsa.1.yaml")));
+ base_ldsa.put("properties", new ArrayList(Arrays.asList(currentProperties)));
+ put("base_ldsa", base_ldsa);
+ }
+ };
+
+ private Map<String, HashMap<String, List<String>>> deploymentViewDataFromFile;
+
+ public DeploymentViewVerificator(String pathToCSAR) throws Exception {
+ deploymentViewDataFromFile = getDeploymentViewDataFromCSAR(pathToCSAR);
+ }
+
+ public DeploymentViewVerificator() throws Exception {
+ deploymentViewDataFromFile = deploymentViewDataMixedArtefects;
+ }
+
+
+ public void verifyDeploymentPageSubElements(String moduleName) throws Exception{
+ HashMap<String, List<String>> moduleProperties = getDeploymentViewData().get(moduleName);
+
+ // add env placeholder to deployment view data
+ if (!moduleProperties.get("artifacts").contains(moduleName + ".env")){
+ moduleProperties.get("artifacts").add(moduleName + ".env");
+ }
+
+ List<WebElement> members, artifacts, properties;
+ members = DeploymentPage.getGroupMembersList(moduleName);
+ artifacts = DeploymentPage.getArtifactNames();
+ properties = DeploymentPage.getPropertyNames();
+
+ File imageFilePath = GeneralUIUtils.takeScreenshot(moduleName + UUID.randomUUID(), SetupCDTest.getScreenshotFolder(), null);
+ final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating group %s, should be %s members, %s artefacts " + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath),
+ moduleName, moduleProperties.get("members").size(), moduleProperties.get("artifacts").size()));
+
+ assertTrue(moduleProperties.get("artifacts").size() == artifacts.size(), "Artifacts amount not as expected, expected " + moduleProperties.get("artifacts").size());
+ assertTrue(moduleProperties.get("artifacts").containsAll(artifacts.stream().
+ map(e -> e.getAttribute("textContent")).
+ collect(Collectors.toList())));
+ assertTrue(moduleProperties.get("members").size() == members.size(), "Members amount not as expected, expected " + moduleProperties.get("members").size());
+ assertTrue(moduleProperties.get("members").containsAll(members.stream().
+ map(e -> e.getAttribute("textContent")).
+ collect(Collectors.toList())));
+ assertTrue(moduleProperties.get("properties").size() == properties.size(), "Properties amount not as expected, expected " + moduleProperties.get("properties").size());
+ assertTrue(moduleProperties.get("properties").containsAll(properties.stream().
+ map(e -> e.getAttribute("textContent")).
+ collect(Collectors.toList())));
+ DeploymentPage.clickOnProperties();
+ DeploymentPage.clickOnArtifacts();
+ }
+
+ public void verifyDeploymentPageModules(List<WebElement> modules){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating VF groups , should be %s groups ", getDeploymentViewData().size()));
+ assertFalse(modules.isEmpty(), "No modules found");
+ assertTrue(modules.size() == getDeploymentViewData().size(), "Modules amount not as expected, expected " + getDeploymentViewData().size());
+ for (WebElement module: modules){
+ assertTrue(getDeploymentViewData().containsKey(module.getText().split("\\.\\.")[1]));
+ }
+ }
+
+ public static void verifyComponentNameChanged(String oldName, String newName){
+ try{
+ GeneralUIUtils.clickOnElementByText(oldName, 10);
+ assertTrue(false, "Element name don't changed");
+ } catch(Exception e){
+ GeneralUIUtils.clickOnElementByText(newName);
+ }
+ }
+
+ public Map<String, HashMap<String, List<String>>> getDeploymentViewData() {
+// return deploymentViewData;
+ return getDeploymentViewDataFromFile();
+ }
+
+ public static Map<String, HashMap<String, List<String>>> buildDeploymentViewDataFromCSAR(String pathToCSAR, File mainServiceTemplate) throws Exception{
+ ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(mainServiceTemplate);
+ Map<String, HashMap<String, List<String>>> deploymentViewDataFromFile = new HashMap<String, HashMap<String, List<String>>>();
+ Map<String, ToscaGroupsTopologyTemplateDefinition> groups = toscaDefinition.getTopology_template().getGroups();
+ List<String> keyList = groups.keySet().stream().collect(Collectors.toList());
+ HashMap<String, List<String>> groupsToArtefacts = getDeploymentArtefactsMapedToGroupsFromCSAR(pathToCSAR);
+ for(String groupKey: keyList){
+ HashMap<String, List<String>> tempGroupMap = new HashMap<String, List<String>>();
+ tempGroupMap.put("artifacts", groupsToArtefacts.get(groupKey));
+ if (groups.get(groupKey).getMembers() == null){
+ tempGroupMap.put("members", Arrays.asList());
+ } else {
+ tempGroupMap.put("members", groups.get(groupKey).getMembers());
+ }
+ tempGroupMap.put("properties", Arrays.asList(currentProperties));
+ deploymentViewDataFromFile.put(groupKey, tempGroupMap);
+ }
+ return deploymentViewDataFromFile;
+ }
+
+ public static HashMap<String, List<String>> getDeploymentArtefactsMapedToGroupsFromCSAR(String pathToFile) throws Exception {
+ Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(pathToFile);
+ LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment"));
+ HashMap<String, List<String>> tempGroupMap = new HashMap<String, List<String>>();
+ for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) {
+ String groupName = deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().indexOf("."));
+ if(deploymentArtifact.getType().equals("HEAT")) {
+ tempGroupMap.put(groupName, new ArrayList(Arrays.asList(deploymentArtifact.getFileName().trim())));
+ } else {
+ // update current key
+ tempGroupMap.get(groupName).add(deploymentArtifact.getFileName().trim());
+ tempGroupMap.put(groupName, tempGroupMap.get(groupName));
+ }
+ }
+ return tempGroupMap;
+ }
+
+ public static Map<String, HashMap<String, List<String>>> getDeploymentViewDataFromCSAR(String pathToCsar) throws Exception {
+ String outputFolder = unzipCsarFile(pathToCsar);
+
+ File pathToMainServiceTemplate = new File(outputFolder + File.separator + "Definitions" + File.separator + "MainServiceTemplate.yaml");
+ Map<String, HashMap<String, List<String>>> deploymentViewData = buildDeploymentViewDataFromCSAR(pathToCsar, pathToMainServiceTemplate);
+ cleanFolders(outputFolder);
+
+ return deploymentViewData;
+ }
+
+ public static void cleanFolders(String outputFolder) throws IOException {
+ System.gc();
+ FileUtils.cleanDirectory(new File(outputFolder));
+ FileUtils.deleteDirectory(new File(outputFolder));
+ }
+
+ public static String unzipCsarFile(String pathToCsar) {
+ File csarFile = new File(pathToCsar);
+
+
+ File dir = new File(csarFile.getParent() + File.separator + "output"+UUID.randomUUID() + File.separator + UUID.randomUUID());
+ if(!dir.exists()) {
+ dir.mkdirs();
+ }
+
+ String outputFolder = dir.getPath();
+ ArtifactFromCsar.unZip(pathToCsar, outputFolder);
+ return outputFolder;
+ }
+
+ public static void validateEditPopoverFields(String expectedVNFName, String expectedHeatName, String expectedModuleName){
+ String VNFname = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentScreen.RESOURCE_NAME_ON_POPOVER.getValue()).getText();
+ String heatName = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentScreen.NAME_INPUT.getValue()).getAttribute("value");
+ String moduleName = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentScreen.MODULE_NAME_ON_POPOVER.getValue()).getText();
+ assertTrue(expectedVNFName.equals(VNFname), String.format("VNF name Expected: %s, Actual: %s ", expectedVNFName, VNFname));
+ assertTrue(expectedHeatName.equals(heatName), String.format("HEAT name Expected: %s, Actual: %s ", expectedHeatName, heatName ));
+ assertTrue(expectedModuleName.equals(moduleName), String.format("Module name Expected: %s, Actual: %s ", expectedModuleName, moduleName));
+ }
+
+ public static void validateEditPopoverButtons(String newName, String invalidModuleName, String validModueName ){
+ DeploymentPage.updateAndCancel(newName, DataTestIdEnum.DeploymentScreen.X_BUTTON);
+ verifyComponentNameChanged(invalidModuleName, validModueName);
+ DeploymentPage.clickOnEditIcon();
+ DeploymentPage.updateAndCancel(newName, DataTestIdEnum.DeploymentScreen.CANCEL);
+ verifyComponentNameChanged(invalidModuleName, validModueName);
+ }
+
+ public static void validateEditPopover() throws Exception{
+ String moduleRowText = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.MODULES.getValue()).get(0).getText();
+ DeploymentPage.clickOnModuleName(moduleRowText);
+ DeploymentPage.clickOnEditIcon();
+ String[] splitedModuleName = moduleRowText.split("\\.\\.");
+
+ validateEditPopoverFields(splitedModuleName[0], splitedModuleName[1], splitedModuleName[2]);
+
+ String newName = "kuku";
+ String newModuleName = DeploymentPage.reconstructModuleName(splitedModuleName, newName);
+ validateEditPopoverButtons(newName, newModuleName, moduleRowText);
+ }
+
+ private Map<String, HashMap<String, List<String>>> getDeploymentViewDataFromFile() {
+ return deploymentViewDataFromFile;
+ }
+
+ public static void validateModuleNameUpadate() throws Exception{
+ List<WebElement> moduleRowsFromTable = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.MODULES.getValue());
+ int i = 0;
+ for(WebElement moduleRow :moduleRowsFromTable){
+ String moduleRowText = moduleRow.getText();
+ String updatedName = "updatedName" + i;
+ DeploymentPage.updateModuleName(moduleRowText, updatedName);
+ String updatedModuleName = DeploymentPage.reconstructModuleName(moduleRowText.split("\\.\\."), updatedName);
+ verifyComponentNameChanged(moduleRowText, updatedModuleName);
+ // Close module
+ GeneralUIUtils.clickOnElementByText(updatedModuleName);
+ i++;
+ }
+ }
+
+ public static void regularDepoymentScreenVerificator(Map<String, HashMap<String, String>> metaDataFromUI, DeploymentViewVerificator verificator) throws Exception, InterruptedException {
+ ResourceGeneralPage.getLeftMenu().moveToDeploymentViewScreen();
+ List<WebElement> moduleRowsFromTable = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.MODULES.getValue());
+ verificator.verifyDeploymentPageModules(moduleRowsFromTable);
+ for(WebElement moduleRow :moduleRowsFromTable){
+ String moduleRowText = moduleRow.getText();
+ String middleName = moduleRowText.split("\\.\\.")[1];
+ verificator.verifyDeploymentPageSubElements(middleName);
+ if (metaDataFromUI != null){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating %s group version, should be %s ", moduleRowText, metaDataFromUI.get(moduleRowText.split("\\.\\.")[1])));
+ String groupVersion = DeploymentPage.getGroupVersion().split(":")[1].trim();
+ String increasedVersion = String.valueOf(Integer.parseInt(metaDataFromUI.get(middleName).get("version")) + 1);
+ assertTrue(groupVersion.equals(increasedVersion));
+ if ( metaDataFromUI.get(middleName).get("moduleID") != "primary"){
+ String moduleID = DeploymentPage.getModuleID();
+ assertFalse(moduleID.equals(metaDataFromUI.get(middleName).get("moduleID")));
+ }
+ }
+ // Close module
+ GeneralUIUtils.clickOnElementByText(moduleRowText);
+ }
+ }
+
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ErrorMessageUIVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ErrorMessageUIVerificator.java
new file mode 100644
index 0000000000..f53bfa4e07
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ErrorMessageUIVerificator.java
@@ -0,0 +1,64 @@
+/*-
+ * ============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.verificator;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.ci.tests.datatypes.ErrorMessageProperties;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+
+public class ErrorMessageUIVerificator {
+
+ private static ErrorMessageProperties getErrorByType(ActionStatus errorType){
+ try{
+ ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(errorType.name());
+ String messageId = errorInfo.getMessageId();
+ String code = errorInfo.getCode().toString();
+
+ return new ErrorMessageProperties(messageId, code);
+ }
+ catch(Exception e){
+ return null;
+ }
+ }
+
+ public static void validateErrorMessage(ActionStatus errorMessage) {
+ String errorMessageBox = null;
+ try{
+ errorMessageBox = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+ }
+ catch(Exception e){
+ ExtentTestActions.log(Status.INFO, "Did not find an error message popup.");
+ Assert.fail("Did not find an error message popup.");
+ }
+
+ ExtentTestActions.log(Status.INFO, "An error message raised, validating its content.");
+ ErrorMessageProperties expectedResponseError = getErrorByType(errorMessage);
+ Assert.assertTrue(errorMessageBox.contains(expectedResponseError.getCode()), "Error message code is not " + expectedResponseError.getCode());
+ Assert.assertTrue(errorMessageBox.contains(expectedResponseError.getMessageId()), "Error message ID is not " + expectedResponseError.getMessageId());
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java
new file mode 100644
index 0000000000..2c1f59fe9f
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java
@@ -0,0 +1,335 @@
+/*-
+ * ============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.verificator;
+
+import static org.testng.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+import java.util.function.Predicate;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.GroupInstance;
+import org.openecomp.sdc.be.model.GroupInstanceProperty;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.PropertiesPopupEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentPage;
+import org.openecomp.sdc.ci.tests.pages.PropertyPopup;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.Select;
+
+import com.aventstack.extentreports.Status;
+
+public class ServiceVerificator {
+
+ private ServiceVerificator() {
+ }
+
+ public static void verifyNumOfComponentInstances(ComponentReqDetails component, String version, int numOfVFC,
+ User user) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifing the number of components on the canvas; should be %s", numOfVFC));
+ String responseAfterDrag = null;
+ component.setVersion(version);
+ if (component instanceof ServiceReqDetails) {
+ responseAfterDrag = RestCDUtils.getService((ServiceReqDetails) component, user).getResponse();
+ } else if (component instanceof ResourceReqDetails) {
+ responseAfterDrag = RestCDUtils.getResource((ResourceReqDetails) component, user).getResponse();
+ }
+ JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+ int size = ((JSONArray) jsonResource.get("componentInstances")).size();
+ assertTrue(size == numOfVFC);
+ ExtentTestActions.log(Status.INFO, "The number of components on the canvas was verified.");
+ }
+
+ public static void verifyServiceUpdatedInUI(ServiceReqDetails service) {
+ assertTrue(service.getName().equals(ResourceGeneralPage.getNameText()));
+ assertTrue(service.getDescription().equals(ResourceGeneralPage.getDescriptionText()));
+ assertTrue(service.getCategory().equals(ServiceGeneralPage.getCategoryText()));
+ assertTrue(service.getProjectCode().equals(ServiceGeneralPage.getProjectCodeText()));
+ for(String tag: ServiceGeneralPage.getTags()){
+ assertTrue(service.getTags().contains(tag));
+ }
+ assertTrue(service.getContactId().equals(ResourceGeneralPage.getContactIdText()));
+ }
+
+ public static void verifyServiceDeletedInUI(ServiceReqDetails service) throws InterruptedException {
+ Thread.sleep(1000);
+ List<WebElement> cardElements = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DashboardCardEnum.DASHBOARD_CARD.getValue());
+ if (!(cardElements.isEmpty())){
+ for (WebElement cardElement: cardElements){
+ WebElement componentName = GeneralUIUtils.getElementfromElementByCSS(cardElement,
+ DataTestIdEnum.DashboardCardEnum.INFO_NAME.getValue());
+ WebElement componentType = GeneralUIUtils.getElementfromElementByCSS(cardElement,
+ DataTestIdEnum.DashboardCardEnum.ASSET_TYPE_CSS.getValue());
+
+ String componentNameStr = componentName.getAttribute("textContent").trim(),
+ componentTypeStr = componentType.getAttribute("class");
+
+ if(componentTypeStr.equals("S")){
+ assertTrue( !(componentNameStr.equals(service.getName())), "Deleted service was found !!!");
+ }
+ }
+ }
+ }
+
+ public static void verifyServiceLifecycle(ServiceReqDetails service, User user, LifecycleStateEnum expectedLifecycleState) {
+ String responseAfterDrag = RestCDUtils.getService(service, user).getResponse();
+ JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+ String actualLifecycleState = jsonResource.get("lifecycleState").toString();
+ assertTrue(expectedLifecycleState.name().equals(actualLifecycleState), "actual: " + actualLifecycleState + "-- expected: " + expectedLifecycleState);
+ }
+
+ public static void verifyLinkCreated(ServiceReqDetails createServiceInUI, User user, int expectedRelationsSize) {
+ String responseAfterDrag = RestCDUtils.getService(createServiceInUI, user).getResponse();
+ JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+ assertTrue(((JSONArray) jsonResource.get("componentInstancesRelations")).size() == expectedRelationsSize);
+
+ }
+
+ public static void verifyManagmentWorkflow(String expectedName, String expectedDescription){
+ String actualName = GeneralUIUtils.getWebElementBy(By.cssSelector("div[class='text name']")).getText();
+ String actualDescription = GeneralUIUtils.getWebElementBy(By.cssSelector("div[class='text description']")).getText();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifing name ( should be %s ) and description ( should be %s ) ", expectedName, expectedDescription));
+ assertTrue(actualName.equals(expectedName) && actualDescription.equals(expectedDescription));
+ }
+
+ public static void verifyVersionUI(String expected){
+ String actualVersion = GeneralUIUtils.getSelectedElementFromDropDown(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue()).getText().replace("V", "");
+ assertTrue(actualVersion.equals(expected), String.format( "Expected version: %s, Actual version: %s", expected, actualVersion));
+ }
+
+ public static void verifyOpenTabTitle(DataTestIdEnum.CompositionScreenEnum currentTab) throws Exception{
+ List<String> expectedTitles = new ArrayList<String>();
+ for(String expectedTitle: currentTab.getTitle()){
+ expectedTitles.add(expectedTitle);
+ }
+ for (WebElement actualTitle: CompositionPage.getOpenTabTitle()){
+ int indexOfTitle = expectedTitles.indexOf(actualTitle.getText());
+ assertTrue(indexOfTitle >= 0, "Wrong title");
+ expectedTitles.remove(indexOfTitle);
+ }
+ assertTrue(expectedTitles.size() == 0, "Missing titles in " + currentTab.getValue());
+ }
+
+ public static void verifyDeploymentPageSubElements(String moduleName, DeploymentViewVerificator verificatorObj) throws Exception{
+ HashMap<String, List<String>> moduleProperties = verificatorObj.getDeploymentViewData().get(moduleName);
+
+ ServiceVerificator.moveMetadataPropertiesArtifactSection(-700);
+
+ List<WebElement> artifacts, properties;
+ artifacts = DeploymentPage.getArtifactNames();
+ properties = DeploymentPage.getPropertyNames();
+ assertTrue(moduleProperties.get("artifacts").size() == artifacts.size(), "Artifacts amount not as expected, expected " + moduleProperties.get("artifacts").size());
+ assertTrue(moduleProperties.get("artifacts").containsAll(artifacts.stream().
+ map(e -> e.getAttribute("textContent")).
+ collect(Collectors.toList())));
+ assertTrue(moduleProperties.get("properties").size() == properties.size(), "Properties amount not as expected, expected " + moduleProperties.get("properties").size());
+ assertTrue(moduleProperties.get("properties").containsAll(properties.stream().
+ map(e -> e.getAttribute("textContent")).
+ collect(Collectors.toList())));
+
+ DeploymentPage.clickOnProperties();
+ DeploymentPage.clickOnArtifacts();
+ ServiceVerificator.moveMetadataPropertiesArtifactSection(700);
+ }
+
+ public static void verifyVFModuleCustomizationUUID(ServiceReqDetails service) throws Exception {
+ Predicate<String> componentInstancePredicate = e -> e.length() > 35;
+ List<String> customizationUUIDList = getAllVFModuleCustomizationUUIDs(service);
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating vfModuleCustomizationUUID uniqness ... "));
+ assertTrue(customizationUUIDList.stream().allMatch(componentInstancePredicate), "vfModuleCustomizationUUID is less then 35 chars");
+ CustomizationUUIDVerificator.validateCustomizationUUIDuniqueness(customizationUUIDList);
+ }
+
+ public static List<String> getAllVFModuleCustomizationUUIDs(ServiceReqDetails service) throws Exception {
+ Service serviceObj = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, service.getName(), service.getVersion());
+ List<String> customizationUUIDList = serviceObj.getComponentInstances().get(0).getGroupInstances().stream().
+ map(e -> e.getCustomizationUUID()).
+ collect(Collectors.toList());
+
+ return customizationUUIDList;
+ }
+
+ public static String getVFModulePropertieValue(ServiceReqDetails service, String propertyName, String moduleName) throws Exception {
+ Service serviceObj = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, service.getName(), service.getVersion());
+ List<GroupInstance> groupInstances = serviceObj.getComponentInstances().get(0).getGroupInstances();
+ List<GroupInstanceProperty> groupInstancesProperties = groupInstances.stream().
+ filter(e -> e.getName().equals(moduleName)).
+ findFirst().
+ get().
+ convertToGroupInstancesProperties();
+ String propertieValue = groupInstancesProperties.stream().
+ filter(e -> e.getName().equals(propertyName)).
+ findFirst().
+ get().
+ getValue();
+ return propertieValue;
+ }
+
+ public static boolean isEqualCustomizationUUIDsAfterChanges(List<String> listBefore, List<String> listAfter){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating if vfModuleCustomizationUUID changed after certification ... "));
+ return (listBefore.size() == listAfter.size()) && (listBefore.containsAll(listAfter));
+ }
+
+ public static void verifyDisabledServiceProperties() throws Exception{
+ List<String> propertiesForCheck = Arrays.asList("isBase", "vf_module_type", "vf_module_label", "vf_module_description");
+ List<PropertiesPopupEnum> popupElementsForCheck = Arrays.asList(PropertiesPopupEnum.PROPERTY_NAME,
+ PropertiesPopupEnum.PROPERTY_DESCRIPTION,
+ PropertiesPopupEnum.PROPERTY_TYPE,
+ PropertiesPopupEnum.PROPERTY_VALUE);
+ ServiceVerificator.moveMetadataPropertiesArtifactSection(-700);
+ List<WebElement> properties = DeploymentPage.getPropertyNames();
+
+ for(WebElement property : properties){
+ if (propertiesForCheck.contains(property.getAttribute("textContent"))){
+ DeploymentPage.clickOnProperty(property);
+ Select propertTypeElement = new Select(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_TYPE.getValue()));
+ boolean isTypeBoolean = propertTypeElement.getFirstSelectedOption().getText().contains("boolean");
+ for (PropertiesPopupEnum popupElement: popupElementsForCheck){
+ if (isTypeBoolean && popupElement == PropertiesPopupEnum.PROPERTY_VALUE){
+ assertTrue(GeneralUIUtils.checkForDisabledAttribute(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_BOOLEAN_VALUE.getValue()), String.format("Element %s not disabled ", property.getText()));
+ } else {
+ assertTrue(GeneralUIUtils.checkForDisabledAttribute(popupElement.getValue()), String.format("Element %s not disabled ", property.getText()));
+ }
+ }
+ new PropertyPopup().clickCancel();
+ }
+ }
+
+ DeploymentPage.clickOnProperties();
+ ServiceVerificator.moveMetadataPropertiesArtifactSection(700);
+ }
+
+ public static void verifyEnabledServiceProperties() throws Exception{
+ List<String> propertiesForCheck = Arrays.asList("initial_count", "max_vf_module_instances", "min_vf_module_instances");
+
+ ServiceVerificator.moveMetadataPropertiesArtifactSection(-700);
+ List<WebElement> properties = DeploymentPage.getPropertyNames();
+
+ ServiceVerificator.positiveFlow(propertiesForCheck, properties);
+ ServiceVerificator.negativeFlow(propertiesForCheck, properties);
+
+ DeploymentPage.clickOnProperties();
+ ServiceVerificator.moveMetadataPropertiesArtifactSection(700);
+ }
+
+ public static void positiveFlow(List<String> propertiesForCheck, List<WebElement> properties)
+ throws InterruptedException {
+ int baseNumber = new Random().nextInt(100) + 2;
+ for(WebElement property : properties){
+ String propertyName = property.getAttribute("textContent");
+ if (propertiesForCheck.contains(propertyName)){
+ DeploymentPage.clickOnProperty(property);
+ int actualNumber = 0;
+ if (propertyName.equals("initial_count")){
+ actualNumber = baseNumber;
+ } else if (propertyName.equals("max_vf_module_instances")) {
+ actualNumber = baseNumber + 1;
+ } else if (propertyName.equals("min_vf_module_instances")){
+ actualNumber = baseNumber - 1;
+ }
+
+ new PropertyPopup().insertPropertyDefaultValue(String.valueOf(actualNumber));
+ new PropertyPopup().clickSave();
+ assertTrue(DeploymentPage.getPropertyValueFromPropertiesList(propertyName).equals(String.valueOf(actualNumber)));
+ }
+ }
+ }
+
+ public static void negativeFlow(List<String> propertiesForCheck, List<WebElement> properties)
+ throws Exception {
+ int currentMaxValue = Integer.valueOf(DeploymentPage.getPropertyValueFromPropertiesList("max_vf_module_instances"));
+ int currentMinValue = Integer.valueOf(DeploymentPage.getPropertyValueFromPropertiesList("min_vf_module_instances"));
+ int currentInitialValue = Integer.valueOf(DeploymentPage.getPropertyValueFromPropertiesList("initial_count"));
+ PropertyPopup propertyPopupObj = new PropertyPopup();
+
+ for(WebElement property : properties){
+ String propertyName = property.getAttribute("textContent");
+ if (propertiesForCheck.contains(propertyName)){
+ DeploymentPage.clickOnProperty(property);
+ if (propertyName.equals("initial_count")){
+
+ propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentMaxValue + 1));
+ ServiceVerificator.verifyErrorPresentAndSaveDisabled();
+ propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentMinValue - 1));
+ ServiceVerificator.verifyErrorPresentAndSaveDisabled();
+ propertyPopupObj.insertPropertyDefaultValue(String.valueOf(0));
+ ServiceVerificator.verifyErrorPresentAndSaveDisabled();
+
+ } else if (propertyName.equals("max_vf_module_instances")) {
+
+ propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentInitialValue - 1));
+ ServiceVerificator.verifyErrorPresentAndSaveDisabled();
+ propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentMinValue - 1));
+ ServiceVerificator.verifyErrorPresentAndSaveDisabled();
+ propertyPopupObj.insertPropertyDefaultValue(String.valueOf(0));
+ verifyErrorPresentAndSaveDisabled();
+
+ } else if (propertyName.equals("min_vf_module_instances")){
+
+ propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentInitialValue + 1));
+ ServiceVerificator.verifyErrorPresentAndSaveDisabled();
+ propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentMaxValue + 1));
+ ServiceVerificator.verifyErrorPresentAndSaveDisabled();
+ }
+
+ new PropertyPopup().clickCancel();
+ }
+ }
+ }
+
+ public static void verifyErrorPresentAndSaveDisabled() throws Exception{
+ assertTrue(DeploymentPage.isPropertySaveButtonDisabled());
+ assertTrue(DeploymentPage.getPropertyErrorValidationMessdge().size() == 1);
+ }
+
+ public static void moveMetadataPropertiesArtifactSection(int offset) throws InterruptedException {
+ WebElement dragLineElement = GeneralUIUtils.getElementByCSS("div.rg-top");
+ GeneralUIUtils.dragAndDropElementByY(dragLineElement, offset);
+ }
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/UserManagementVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/UserManagementVerificator.java
new file mode 100644
index 0000000000..3b0b458f1e
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/UserManagementVerificator.java
@@ -0,0 +1,152 @@
+/*-
+ * ============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.verificator;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.lang3.text.WordUtils;
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.pages.AdminGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+
+public class UserManagementVerificator {
+
+
+
+ public static void validateUserCreated(String userId, UserRoleEnum role){
+
+ ExtentTestActions.log(Status.INFO, "Validating that a new user is created and displayed in the first row in the table.");
+
+ final int firstRow = 0;
+
+ WebElement actualFirstName = AdminGeneralPage.getUserManagementTab().getFirstName(firstRow);
+ WebElement actualLastName = AdminGeneralPage.getUserManagementTab().getLastName(firstRow);
+ WebElement actualUserId = AdminGeneralPage.getUserManagementTab().getUserId(firstRow);
+ WebElement actualEmail = AdminGeneralPage.getUserManagementTab().getEmail(firstRow);
+ WebElement actualRole = AdminGeneralPage.getUserManagementTab().getRole(firstRow);
+ WebElement actualLastActive = AdminGeneralPage.getUserManagementTab().getLastActive(firstRow);
+
+
+ String actualFirstNameText = actualFirstName.getText();
+ String actualLastNameText = actualLastName.getText();
+ String actualUserIdText = actualUserId.getText();
+ String actualEmailText = actualEmail.getText();
+ String actualRoleText = actualRole.getText();
+ String actualLastActiveText = actualLastActive.getText();
+
+ Assert.assertTrue(actualFirstNameText.equals("---"), "Actual first name is not '---'.");
+ Assert.assertTrue(actualLastNameText.equals("---"), "Actual last name is not '---'.");
+ Assert.assertTrue(actualUserIdText.equals(userId), "Actual user id is not " + userId);
+ Assert.assertTrue(actualEmailText.equals("---"), "Actual email is not '---'.");
+ Assert.assertTrue(actualRoleText.equals(WordUtils.capitalize(role.name().toLowerCase())), "Actual role is not " + role.name());
+ Assert.assertTrue(actualLastActiveText.equals("Waiting"), "Actual role is not 'Waiting'.");
+ }
+
+
+ public static void validateUserRoleUpdated(int rowIndx, UserRoleEnum updatedRole){
+ ExtentTestActions.log(Status.INFO, "Validating role is updated to " + updatedRole.name() + " in UI.");
+ WebElement actualRole = AdminGeneralPage.getUserManagementTab().getRole(rowIndx);
+ String actualRoleText = actualRole.getText();
+ Assert.assertTrue(actualRoleText.equals(WordUtils.capitalize(updatedRole.name().toLowerCase())), "Actual role is not " + updatedRole.name());
+ }
+
+ public static void validateUserRoleUpdatedViaRest(User reqUser, User user, UserRoleEnum expectedUserRole){
+ try{
+ ExtentTestActions.log(Status.INFO, "Validating role is updated to " + expectedUserRole.name() + " in BE.");
+ String actualUserRole = RestCDUtils.getUserRole(reqUser, user);
+ Assert.assertTrue(expectedUserRole.name().toLowerCase().equals(actualUserRole.toLowerCase()), "User role is not updated.");
+ }
+ catch(Exception e){
+ Assert.fail("The actual user role is null");
+ }
+ }
+
+ public static void validateUserNotFoundViaRest(User reqUser, User user){
+ try{
+ ExtentTestActions.log(Status.INFO, "Validating user " + reqUser.getUserId() + " is not found in BE.");
+ RestResponse getUserResp = RestCDUtils.getUser(reqUser, user);
+ ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.USER_INACTIVE.name(), Arrays.asList(reqUser.getUserId()), getUserResp.getResponse());
+ }
+ catch(Exception e){
+ Assert.fail("The response message does not describe the user is not found.");
+ }
+ }
+
+ public static void validateUserIdNotFound(String userId){
+ ExtentTestActions.log(Status.INFO, "Validating that user " + userId + " is not found.");
+ AdminGeneralPage.getUserManagementTab().searchUser(userId);
+ List<WebElement> rows = AdminGeneralPage.getUserManagementTab().getAllRowsDisplayed();
+ Assert.assertEquals(rows.size(), 0, String.format("There are %s rows instead of none.", rows.size()));
+ }
+
+ public static void validateOnlySingleRowDisplayed(){
+ ExtentTestActions.log(Status.INFO, "Validating that only a single row is displayed in table.");
+ List<WebElement> rows = AdminGeneralPage.getUserManagementTab().getAllRowsDisplayed();
+ Assert.assertEquals(rows.size(), 1, String.format("There are %s rows instead of %s.", rows.size(), 1));
+ }
+
+ public static void validateRowDisplayedCorrectly(User user, int rowindex){
+ String role = user.getRole();
+ String userId = user.getUserId();
+ String firstName = user.getFirstName();
+ String lastName = user.getLastName();
+ String email = user.getEmail();
+
+ ExtentTestActions.log(Status.INFO, "Validating that the row is properly displayed.");
+
+ WebElement actualFirstName = AdminGeneralPage.getUserManagementTab().getFirstName(rowindex);
+ WebElement actualLastName = AdminGeneralPage.getUserManagementTab().getLastName(rowindex);
+ WebElement actualUserId = AdminGeneralPage.getUserManagementTab().getUserId(rowindex);
+ WebElement actualEmail = AdminGeneralPage.getUserManagementTab().getEmail(rowindex);
+ WebElement actualRole = AdminGeneralPage.getUserManagementTab().getRole(rowindex);
+
+
+ String actualFirstNameText = actualFirstName.getText();
+ String actualLastNameText = actualLastName.getText();
+ String actualUserIdText = actualUserId.getText();
+ String actualEmailText = actualEmail.getText();
+ String actualRoleText = actualRole.getText();
+
+ Assert.assertTrue(actualFirstNameText.equals(firstName), "Actual first name is not " + firstName);
+ Assert.assertTrue(actualLastNameText.equals(lastName), "Actual last name is not " + lastName);
+ Assert.assertTrue(actualUserIdText.equals(userId), "Actual user id is not " + userId);
+ Assert.assertTrue(actualEmailText.contains(email), "Actual email does not contain " + email);
+ Assert.assertTrue(actualRoleText.equals(WordUtils.capitalize(role.toLowerCase())), "Actual role is not " + role);
+ }
+
+ public static void validateFirstRowDisplayedCorrectly(User user){
+ validateRowDisplayedCorrectly(user, 0);
+ }
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCArtifactVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCArtifactVerificator.java
new file mode 100644
index 0000000000..ac009c6327
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCArtifactVerificator.java
@@ -0,0 +1,347 @@
+/*-
+ * ============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.verificator;
+
+import static org.testng.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.VFCArtifact;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+
+public class VFCArtifactVerificator {
+
+ private static final String ARTIFACTS = "artifacts";
+ private static final String DEPLOYMENT_ARTIFACTS = "deploymentArtifacts";
+ private static List<VFCArtifact> vfcArtifactList = new ArrayList<VFCArtifact>();
+ private static JSONObject jsonResource;
+
+ public static void verifyVFCArtifactsNotInVFArtifactList(ResourceReqDetails resource , User user, RestResponse optionalGetResponse, Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap){
+ ExtentTestActions.log(Status.INFO, "Verifying that VFC artifacts are not as part of VF artifacts.");
+ LinkedList<HeatMetaFirstLevelDefinition> expectedDeploymentArtifacts = expectedArtifactMap.get(DEPLOYMENT_ARTIFACTS);
+ LinkedList<HeatMetaFirstLevelDefinition> expectedInformationalArtifacts = expectedArtifactMap.get(ARTIFACTS);
+
+ Map<String, Object> vfDepArtifacts = getVFDeploymentArtifacts(resource, user, optionalGetResponse);
+ for (Object artifact : vfDepArtifacts.values()){
+ JSONObject acArtifact = ((JSONObject) JSONValue.parse(artifact.toString()));
+ String acArtifactName = acArtifact.get("artifactName").toString();
+
+ for(HeatMetaFirstLevelDefinition exDepArtifact : expectedDeploymentArtifacts){
+ assertTrue(!exDepArtifact.getType().equals(acArtifactName));
+ }
+ }
+
+ Map<String, Object> vfInfoArtifacts = getVFInforamtionalArtifacts(resource, user, optionalGetResponse);
+ for (Object artifact : vfInfoArtifacts.values()){
+ JSONObject acArtifact = ((JSONObject) JSONValue.parse(artifact.toString()));
+ if (acArtifact.containsKey("artifactName")){
+ String acArtifactName = acArtifact.get("artifactName").toString();
+
+ for(HeatMetaFirstLevelDefinition exInfoArtifact : expectedInformationalArtifacts){
+ assertTrue(!exInfoArtifact.getType().equals(acArtifactName));
+ }
+ }
+
+
+ }
+
+
+
+ }
+
+ public static void verifyVfcArtifactUpdated(String instanceName, ResourceReqDetails resource, User user){
+ ExtentTestActions.log(Status.INFO, "Verifying VFC artifacts are updated.");
+ List<VFCArtifact> vfcArtifactsBeforeUpdate = getVfcArtifactList();
+
+ setVfcArtifactList(new ArrayList<VFCArtifact>());
+ setActualVfcArtifactList(instanceName, resource, user);
+
+ for (VFCArtifact artifact : vfcArtifactsBeforeUpdate){
+ String artifactnameBeforeUpdate = artifact.getArtifactname();
+ for (VFCArtifact newArtifact : vfcArtifactList){
+ String artifactnameAfterUpdate = newArtifact.getArtifactname();
+ if (artifactnameBeforeUpdate.equals(artifactnameAfterUpdate)){
+ String artifactUUIDAfterUpdate = newArtifact.getArtifactUUID();
+ assertTrue(!artifactUUIDAfterUpdate.equals(artifact.getArtifactUUID()));
+
+ int artifactVersionAfterUpdate = Integer.parseInt(newArtifact.getArtifactVersion());
+ int artifactVersionBeforeUpdate = Integer.parseInt(artifact.getArtifactVersion());
+ assertTrue(artifactVersionAfterUpdate == artifactVersionBeforeUpdate + 1);
+
+
+ vfcArtifactList.remove(newArtifact);
+
+ ExtentTestActions.log(Status.INFO, "VFC artifacts are updated and verified.");
+
+ break;
+ }
+ }
+ }
+
+
+ assertTrue(vfcArtifactList.size() == 0);
+
+ }
+
+ public static void verifyVFCArtifactNotChanged(String instanceName, ResourceReqDetails resource, User user){
+ ExtentTestActions.log(Status.INFO, "Verifying VFC artifacts are not chaned after update.");
+ List<VFCArtifact> vfcArtifactsBeforeUpdate = getVfcArtifactList();
+
+ setVfcArtifactList(new ArrayList<VFCArtifact>());
+ setActualVfcArtifactList(instanceName, resource, user);
+
+ for (VFCArtifact artifact : vfcArtifactsBeforeUpdate){
+ String artifactnameBeforeUpdate = artifact.getArtifactname();
+ for (VFCArtifact newArtifact : vfcArtifactList){
+ String artifactnameAfterUpdate = newArtifact.getArtifactname();
+ if (artifactnameBeforeUpdate.equals(artifactnameAfterUpdate)){
+ String artifactUUIDAfterUpdate = newArtifact.getArtifactUUID();
+ assertTrue(artifactUUIDAfterUpdate.equals(artifact.getArtifactUUID()));
+
+ int artifactVersionAfterUpdate = Integer.parseInt(newArtifact.getArtifactVersion());
+ int artifactVersionBeforeUpdate = Integer.parseInt(artifact.getArtifactVersion());
+ assertTrue(artifactVersionAfterUpdate == artifactVersionBeforeUpdate);
+
+ vfcArtifactList.remove(newArtifact);
+ break;
+ }
+ }
+ }
+
+
+ assertTrue(vfcArtifactList.size() == 0);
+
+ }
+
+ public static void verifyNoVfcArtifacts(ResourceReqDetails resource , User user, RestResponse optionalGetResponse){
+ ExtentTestActions.log(Status.INFO, "Verifying that there are no VFC artifacts at all.");
+ JSONArray jArr = getVFInstances(resource, user, optionalGetResponse);
+ for (Object instanceObj : jArr){
+ JSONObject instance = (JSONObject) JSONValue.parse(instanceObj.toString());
+ List<String> actualDeploymentArtifacts = getActualVfcInstanceArtifactsFromJson(DEPLOYMENT_ARTIFACTS, instance);
+
+ assertTrue(actualDeploymentArtifacts == null || actualDeploymentArtifacts.size() == 0);
+ }
+ }
+
+ public static void verifyVfcArtifacts(ResourceReqDetails resource , User user, String instanceName, Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap,
+ RestResponse optionalGetResponse){
+ ExtentTestActions.log(Status.INFO, "Verifying VFC artifacts for instance named " + instanceName);
+
+ String exCompName = instanceName.split(".vfc.")[1].toLowerCase();
+ String exName = instanceName.split(".heat.")[1].toLowerCase();
+
+ JSONArray jArr = getVFInstances(resource, user, optionalGetResponse);
+ int jArrSize = jArr.size();
+
+ for (Object instanceObj : jArr){
+ JSONObject instance = (JSONObject) JSONValue.parse(instanceObj.toString());
+ String componentName = instance.get("componentName").toString().toLowerCase();
+ String name = instance.get("name").toString().toLowerCase();
+
+ if (componentName.contains(exCompName) || name.toLowerCase().equals(exName)){
+
+ List<String> actualDeploymentArtifacts = getActualVfcInstanceArtifactsFromJson(DEPLOYMENT_ARTIFACTS, instance);
+ LinkedList<HeatMetaFirstLevelDefinition> expectedDeploymentArtifacts = expectedArtifactMap.get(DEPLOYMENT_ARTIFACTS);
+ checkVFCArtifactsExist(expectedDeploymentArtifacts, actualDeploymentArtifacts);
+
+
+ List<String> actualInformationalArtifacts = getActualVfcInstanceArtifactsFromJson(ARTIFACTS, instance);
+ LinkedList<HeatMetaFirstLevelDefinition> expectedInformationalArtifacts = expectedArtifactMap.get(ARTIFACTS);
+ checkVFCArtifactsExist(expectedInformationalArtifacts, actualInformationalArtifacts);
+
+ jArr.remove(instanceObj);
+
+ ExtentTestActions.log(Status.INFO, "VFC artifacts for instance named " + instanceName + "are verified.");
+
+ break;
+ }
+ }
+
+ assertTrue(jArr.size() == jArrSize - 1, "Instance " + instanceName + " was not found and tested");
+
+ }
+
+
+
+ private static JSONArray getVFInstances(ResourceReqDetails resource, User user, RestResponse response) {
+
+ jsonResource = getVFAsJsonObject(resource, user, response);
+ JSONArray jArr = (JSONArray) jsonResource.get("componentInstances");
+ return jArr;
+ }
+
+ private static Map<String, Object> getVFDeploymentArtifacts(ResourceReqDetails resource, User user, RestResponse response) {
+
+ jsonResource = getVFAsJsonObject(resource, user, response);
+ Map<String, Object> jArr = (Map<String, Object>) jsonResource.get(DEPLOYMENT_ARTIFACTS);
+ return jArr;
+ }
+
+ private static Map<String, Object> getVFInforamtionalArtifacts(ResourceReqDetails resource, User user, RestResponse response) {
+
+ jsonResource = getVFAsJsonObject(resource, user, response);
+ Map<String, Object> jArr = (Map<String, Object>) jsonResource.get(ARTIFACTS);
+ return jArr;
+ }
+
+ private static JSONObject getVFAsJsonObject(ResourceReqDetails resource, User user, RestResponse response) {
+ if (response == null){
+ resource.setUniqueId(null);
+ response = RestCDUtils.getResource(resource, user);
+ assertTrue(response.getErrorCode().intValue() == 200);
+ getVFAsJsonObject(resource, user, response);
+ }
+
+ String responseAfterDrag = response.getResponse();
+ jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+ return jsonResource;
+ }
+
+
+
+ private static List<String> getActualVfcInstanceArtifactsFromJson(String artifactKind, JSONObject instanceFromJson){
+ Object actualtObject = instanceFromJson.get(artifactKind);
+ if (actualtObject != null){
+ JSONObject actualJsonObject = (JSONObject) JSONValue.parse(actualtObject.toString());
+ List<String> actualArtifacts = (List<String>) actualJsonObject.keySet().stream().map(e -> actualJsonObject.get(e).toString()).collect(Collectors.toList());
+ return actualArtifacts;
+ }
+ return null;
+ }
+
+ private static void checkVFCArtifactsExist(LinkedList<HeatMetaFirstLevelDefinition> expectedArtifacts, List<String> actualArtifacts) {
+ if (expectedArtifacts == null){
+ return;
+ }
+
+ if (expectedArtifacts.size() != actualArtifacts.size()){
+ ExtentTestActions.log(Status.FAIL, "Expected and actual VFC artifacts lists size are not the same. Expected size: " + expectedArtifacts.size() + " , actual size: " + actualArtifacts.size());
+ Assert.fail("Expected and actual VFC artifacts lists size are not the same. Expected size: " + expectedArtifacts.size() + " , actual size: " + actualArtifacts.size());
+ }
+
+ List<String> types = new ArrayList<String>();
+ List<String> fileNames = new ArrayList<String>();
+ for (HeatMetaFirstLevelDefinition exArtifact : expectedArtifacts){
+
+ fileNames.add(exArtifact.getFileName());
+ types.add(exArtifact.getType());
+
+ }
+
+ for (int i = 0 ; i < actualArtifacts.size() ; i++){
+ String actualArtifactsString = actualArtifacts.get(i);
+ JSONObject acArtifact = ((JSONObject) JSONValue.parse(actualArtifactsString));
+
+ String acArtifactFileName = acArtifact.get("artifactName").toString();
+ String acArtifactType = acArtifact.get("artifactType").toString();
+
+ assertTrue(types.contains(acArtifactType), "List does not contain " + acArtifactType);
+ assertTrue(fileNames.contains(acArtifactFileName), "List does not contain " + acArtifactFileName);
+
+ types.remove(acArtifactType);
+ fileNames.remove(acArtifactFileName);
+
+ }
+
+ assertTrue(types.size() == 0);
+ assertTrue(fileNames.size() == 0);
+
+ }
+
+ public static List<VFCArtifact> getVfcArtifactList(){
+ return vfcArtifactList;
+ }
+
+
+ public static void setVfcArtifactList(List<VFCArtifact> vfcArtifactList) {
+ VFCArtifactVerificator.vfcArtifactList = vfcArtifactList;
+ }
+
+ public static void setActualVfcArtifactList(String instanceName, ResourceReqDetails resource , User user) {
+ String exCompName = instanceName.split(".vfc.")[1].toLowerCase();
+ String exName = instanceName.split(".heat.")[1].toLowerCase();
+
+ JSONArray jArr = getVFInstances(resource, user, null);
+
+ for (Object instanceObj : jArr){
+ JSONObject instance = (JSONObject) JSONValue.parse(instanceObj.toString());
+ String componentName = instance.get("componentName").toString().toLowerCase();
+ String name = instance.get("name").toString().toLowerCase();
+
+ if (componentName.contains(exCompName) || name.toLowerCase().equals(exName)){
+ List<String> actualDeploymentArtifacts = getActualVfcInstanceArtifactsFromJson(DEPLOYMENT_ARTIFACTS, instance);
+ List<String> actualInformationalArtifacts = getActualVfcInstanceArtifactsFromJson(ARTIFACTS, instance);
+
+ if (actualDeploymentArtifacts != null){
+ for (int i = 0 ; i < actualDeploymentArtifacts.size() ; i++){
+ String actualArtifactsString = actualDeploymentArtifacts.get(i);
+ JSONObject acArtifact = ((JSONObject) JSONValue.parse(actualArtifactsString));
+
+ if (acArtifact.containsKey("artifactName")){
+ String acArtifactType = acArtifact.get("artifactName").toString();
+ String acArtifactFileName = acArtifact.get("artifactType").toString();
+ String acArtifactUUID = acArtifact.get("artifactUUID").toString();
+ String acArtifactVersion = acArtifact.get("artifactVersion").toString();
+
+ vfcArtifactList.add(new VFCArtifact(acArtifactType, acArtifactFileName, acArtifactUUID, acArtifactVersion));
+ }
+ }
+ }
+ if (actualInformationalArtifacts != null){
+ for (int i = 0 ; i < actualInformationalArtifacts.size() ; i++){
+ String actualArtifactsString = actualInformationalArtifacts.get(i);
+ JSONObject acArtifact = ((JSONObject) JSONValue.parse(actualArtifactsString));
+
+ if (acArtifact.containsKey("artifactName")){
+ String acArtifactType = acArtifact.get("artifactName").toString();
+ String acArtifactFileName = acArtifact.get("artifactType").toString();
+ String acArtifactUUID = acArtifact.get("artifactUUID").toString();
+ String acArtifactVersion = acArtifact.get("artifactVersion").toString();
+ vfcArtifactList.add(new VFCArtifact(acArtifactType, acArtifactFileName, acArtifactUUID, acArtifactVersion));
+ }
+
+
+ }
+ }
+ }
+ }
+ }
+
+}
+
+
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCverificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCverificator.java
new file mode 100644
index 0000000000..0872a3a5c3
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCverificator.java
@@ -0,0 +1,37 @@
+/*-
+ * ============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.verificator;
+
+import static org.testng.AssertJUnit.assertFalse;
+
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+
+
+public class VFCverificator {
+
+ public static void verifyVFCUpdatedInUI(ResourceReqDetails vf) {
+ assertFalse(vf.getName().equals(ResourceGeneralPage.getNameText()));
+ assertFalse(vf.getDescription().equals(ResourceGeneralPage.getDescriptionText()));
+ assertFalse(vf.getVendorName().equals(ResourceGeneralPage.getVendorNameText()));
+ assertFalse(vf.getVendorRelease().equals(ResourceGeneralPage.getVendorReleaseText()));
+ }
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java
new file mode 100644
index 0000000000..7f01b86eaf
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java
@@ -0,0 +1,156 @@
+/*-
+ * ============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.verificator;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.GroupInstance;
+import org.openecomp.sdc.be.model.GroupProperty;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsMetadataDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsTopologyTemplateDefinition;
+import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
+
+import com.aventstack.extentreports.Status;
+
+public class VfModuleVerificator {
+
+ private static final String [] PROPERTY_TYPES = {"vf_module_label", "min_vf_module_instances", "max_vf_module_instances", "initial_count"};
+ private static final String VF_MODULE_TYPE = "org.openecomp.groups.VfModule";
+
+ /**
+ * compare number of groups from HEAT.meta file vs TOSCA yaml groups generated by ASDC
+ * @param listTypeHeatMetaDefinition - java object created from HEAT.meta file
+ * @param toscaDefinition - java object created from TOSCA yaml
+ */
+ public static void compareNumberOfVfModules(List<TypeHeatMetaDefinition> listTypeHeatMetaDefinition, ToscaDefinition toscaDefinition) {
+
+ int heatMetaGroupCount = 0;
+ int toscaDefinitionGroupCount = 0;
+ for (TypeHeatMetaDefinition typeHeatMetaDefinition : listTypeHeatMetaDefinition) {
+ heatMetaGroupCount = typeHeatMetaDefinition.getGroupHeatMetaDefinition().size();
+ }
+ toscaDefinitionGroupCount = toscaDefinition.getTopology_template().getGroups().size();
+ assertEquals("Expected num of groups in HEAT.meta file is " + heatMetaGroupCount + ", but was in TOSCA yaml file " + toscaDefinitionGroupCount, heatMetaGroupCount, toscaDefinitionGroupCount);
+ }
+
+ /**
+ * check group structure and "metadata" parameters vs data on the service object
+ * @param toscaDefinition
+ */
+ public static void verifyGroupMetadata(ToscaDefinition toscaDefinition, Service service) {
+
+ Map<String, ToscaGroupsTopologyTemplateDefinition> groups = toscaDefinition.getTopology_template().getGroups();
+ for (Map.Entry<String, ToscaGroupsTopologyTemplateDefinition> groupTopologyTemplateDefinition : groups.entrySet()) {
+ String key = groupTopologyTemplateDefinition.getKey();
+ GroupInstance groupInstanceObject = getGroupInstanceByKey(key, service);
+ ToscaGroupsMetadataDefinition metadata = groupTopologyTemplateDefinition.getValue().getMetadata();
+ assertNotNull("groupInstanceObject is null", groupInstanceObject);
+ assertTrue("expected vfModuleModelName " + groupInstanceObject.getGroupName() + ", actual " + metadata.getVfModuleModelName(), groupInstanceObject.getGroupName().equals(metadata.getVfModuleModelName()));
+ assertTrue("expected vfModuleModelInvariantUUID " + groupInstanceObject.getInvariantUUID() + ", actual " + metadata.getVfModuleModelInvariantUUID(), groupInstanceObject.getInvariantUUID().equals(metadata.getVfModuleModelInvariantUUID()));
+ assertTrue("expected vfModuleModelCustomizationUUID " + groupInstanceObject.getCustomizationUUID() + ", actual " + metadata.getVfModuleModelCustomizationUUID(), groupInstanceObject.getCustomizationUUID().equals(metadata.getVfModuleModelCustomizationUUID()));
+ assertTrue("expected vfModuleModelUUID " + groupInstanceObject.getGroupUUID() + ", actual " + metadata.getVfModuleModelUUID(), groupInstanceObject.getGroupUUID().equals(metadata.getVfModuleModelUUID()));
+ assertTrue("expected vfModuleModelVersion " + groupInstanceObject.getVersion() + ", actual " + metadata.getVfModuleModelVersion(), groupInstanceObject.getVersion().equals(metadata.getVfModuleModelVersion()));
+ }
+ }
+
+
+ /**
+ * @param key
+ * @param service
+ * @return
+ */
+ public static GroupInstance getGroupInstanceByKey(String key, Service service) {
+ for(ComponentInstance componentInstance : service.getComponentInstances()){
+ for(GroupInstance groupInstance : componentInstance.getGroupInstances()){
+ if( key.equals(groupInstance.getName())){
+ return groupInstance;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static void validateSpecificModulePropertiesFromRequest(Resource resource) {
+ List<List<PropertyDataDefinition>> allProperties = resource.getGroups().stream().
+ filter(e -> e.getType().equals(VF_MODULE_TYPE)).
+ map(e -> e.getProperties()).
+ collect(Collectors.toList());
+ for(String propertyType :PROPERTY_TYPES){
+ int numberOfTypes = getPropertyType(allProperties, propertyType).size();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating VF property %s exist, Expected: %s, Actual: %s ", propertyType, allProperties.size(), numberOfTypes));
+ assertTrue(numberOfTypes == allProperties.size());
+ }
+ }
+
+ public static List<PropertyDataDefinition> getPropertyType(List<List<PropertyDataDefinition>> allProperties, String propertyType) {
+ return allProperties.stream().
+ flatMap(List::stream).
+ filter(e -> e.getName().equals(propertyType)).
+ collect(Collectors.toList());
+ }
+
+ public static void validateSpecificModulePropertiesFromFile(ToscaDefinition toscaDefinition){
+ List<ToscaGroupsTopologyTemplateDefinition> vfModules = toscaDefinition.getTopology_template().getGroups().values().stream().
+ filter(e -> e.getType().equals(VF_MODULE_TYPE)).
+ collect(Collectors.toList());
+
+ for(String propertyType :PROPERTY_TYPES){
+ int numberOfTypes = (int) vfModules.stream().
+ filter(e -> e.getProperties().containsKey(propertyType)).
+ count();
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating VF property %s exist, Expected: %s, Actual: %s ", propertyType, vfModules.size(), numberOfTypes));
+ assertTrue(numberOfTypes == vfModules.size());
+ }
+ }
+
+ public static ToscaDefinition getToscaTemplate(String pathToCsar) throws Exception {
+ String outputFolder = DeploymentViewVerificator.unzipCsarFile(pathToCsar);
+ String templateFileName = VfModuleVerificator.getTemplateFilenname(pathToCsar);
+
+ File pathToMainServiceTemplate = new File(outputFolder + File.separator + "Definitions" + File.separator + templateFileName);
+ ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(pathToMainServiceTemplate);
+
+ DeploymentViewVerificator.cleanFolders(new File(outputFolder).getParent());
+
+ return toscaDefinition;
+ }
+
+ public static String getTemplateFilenname(String pathToCsar) {
+ File csarFile = new File(pathToCsar);
+ String templateFileName = csarFile.getName().replaceAll("-csar.csar", "-template.yml");
+ return templateFileName;
+ }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java
new file mode 100644
index 0000000000..e877146256
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java
@@ -0,0 +1,245 @@
+/*-
+ * ============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.verificator;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.category.CategoryDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+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.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+
+public final class VfVerificator {
+
+ public static void verifyNumOfComponentInstances(ResourceReqDetails createResourceInUI, int numOfVFC, User user) {
+ ServiceVerificator.verifyNumOfComponentInstances(createResourceInUI, createResourceInUI.getVersion(), numOfVFC, user);
+ }
+
+ public static void verifyRILocationChanged(ResourceReqDetails createResourceInUI,
+ ImmutablePair<String, String> prevRIPos, User user) {
+
+ ImmutablePair<String, String> currRIPos = ResourceUIUtils.getFirstRIPos(createResourceInUI, user);
+ assertTrue(!prevRIPos.left.equals(currRIPos.left) || !prevRIPos.right.equals(currRIPos.right));
+ }
+
+ public static void verifyLinkCreated(ResourceReqDetails createResourceInUI, User user, int expectedRelationsSize) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifing that a link was created on canvas"));
+ String responseAfterDrag = RestCDUtils.getResource(createResourceInUI, user).getResponse();
+ JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+ assertTrue(((JSONArray) jsonResource.get("componentInstancesRelations")).size() == expectedRelationsSize);
+ ExtentTestActions.log(Status.INFO, "The link was verified.");
+
+ }
+
+ public static void verifyVFMetadataInUI(ResourceReqDetails vf) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifying fields on General screen through UI ..."));
+ assertTrue(vf.getName().equals(ResourceGeneralPage.getNameText()));
+ assertTrue(vf.getDescription().equals(ResourceGeneralPage.getDescriptionText()));
+ assertTrue(vf.getCategories().get(0).getSubcategories().get(0).getName().equals(GeneralUIUtils.getSelectedElementFromDropDown(ResourceGeneralPage.getCategoryDataTestsIdAttribute()).getText()));
+ assertTrue(vf.getVendorName().equals(ResourceGeneralPage.getVendorNameText()));
+ assertTrue(vf.getVendorRelease().equals(ResourceGeneralPage.getVendorReleaseText()));
+ assertTrue(vf.getContactId().equals(ResourceGeneralPage.getContactIdText()));
+ List<WebElement> tagsList = ResourceGeneralPage.getElementsFromTagsTable();
+ assertTrue(vf.getTags().size() == tagsList.size());
+ for (int i = 0 ; i < vf.getTags().size(); i ++ ){
+ assertTrue(vf.getTags().contains(tagsList.get(i).getText()));
+ }
+ assertTrue(vf.getContactId().equals(ResourceGeneralPage.getContactIdText()));
+ }
+
+ public static void verifyVFUpdated(ResourceReqDetails vf, User user) {
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifying fields on General screen through Backend ..."));
+ String response = RestCDUtils.getResource(vf, user).getResponse();
+ Resource resource = ResponseParser.convertResourceResponseToJavaObject(response);
+ assertTrue(vf.getName().equals(resource.getName()));
+ assertTrue(vf.getDescription().equals(resource.getDescription()));
+ assertTrue(vf.getVendorName().equals(resource.getVendorName()));
+ assertTrue(vf.getVendorRelease().equals(resource.getVendorRelease()));
+ assertTrue(vf.getContactId().equals(resource.getContactId()));
+
+ assertTrue(vf.getCategories().size() == (resource.getCategories().size()));
+ for (int i = 0 ; i < vf.getCategories().size() ; i ++)
+ {
+ CategoryDefinition expectedCategoryDefinition = vf.getCategories().get(i);
+ CategoryDefinition actualCategoryDefinition = resource.getCategories().get(i);
+ assertTrue(expectedCategoryDefinition.getName().equals(actualCategoryDefinition.getName()));
+ assertTrue(expectedCategoryDefinition.getSubcategories().get(i).getName().equals(actualCategoryDefinition.getSubcategories().get(i).getName()));
+ }
+
+ assertTrue(vf.getTags().size() == (resource.getTags().size()));
+ for (int i = 0 ; i < vf.getTags().size() ; i ++){
+ List<String> expectedTags = vf.getTags();
+ List<String> actualTags = resource.getTags();
+
+ assertTrue(actualTags.contains(expectedTags.get(i)));
+
+ }
+ }
+
+ public static void verifyVFLifecycle(ResourceReqDetails vf, User user, LifecycleStateEnum expectedLifecycleState) {
+ String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse();
+ JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+ String actualLifecycleState = jsonResource.get("lifecycleState").toString();
+ assertTrue(expectedLifecycleState.name().equals(actualLifecycleState), "actual: " + actualLifecycleState + "-- expected: " + expectedLifecycleState);
+ }
+
+ public static void verifyVfLifecycleInUI(LifeCycleStateEnum lifecycleState){
+ GeneralUIUtils.ultimateWait();
+ assertTrue(ResourceGeneralPage.getLifeCycleState().equals(lifecycleState.getValue()));
+ }
+
+ public static void verifyInstanceVersion(ResourceReqDetails vf, User user, String instanceName, String instanceVersion){
+ String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse();
+ JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+ JSONArray jsonArrayResource = (JSONArray) jsonResource.get("componentInstances");
+ for (int i = 0; i < jsonArrayResource.size(); i++){
+ Object object = jsonArrayResource.get(i);
+ try{
+ JSONObject jRes = (JSONObject) JSONValue.parse(object.toString());
+ String componentName = jRes.get("componentName").toString();
+ if (componentName.equals(instanceName)){
+ String componentVersion = jRes.get("componentVersion").toString();
+ assertTrue(componentVersion.equals(instanceVersion));
+ }
+ }
+ catch(Exception e){
+ System.out.println("Can't test object in componentInstances array");
+ Assert.fail("Can't test object in componentInstances array");
+ }
+ }
+ }
+
+ public static void verifyVfDeleted(ResourceReqDetails vf, User user){
+ RestResponse response = RestCDUtils.getResource(vf, user);
+ assertTrue(response.getErrorCode().intValue() == 404);
+ }
+
+ public static void verifyPropertiesInUI(List<PropertyTypeEnum> propertyList){
+
+ for (PropertyTypeEnum prop : propertyList){
+ String propName = prop.getName();
+
+ String actualName = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propName).getText();
+ String actualType = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_TYPE.getValue() + propName).getText();
+ String actualDesciprtion = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_DESCRIPTION.getValue() + propName).getText();
+
+ assertTrue(propName.equals(actualName), String.format("Property name is not correct. expected:%s ; actual %s", propName, actualName));
+ assertTrue(prop.getType().equals(actualType), String.format("Property type is not correct. expected:%s ; actual %s", prop.getType(), actualType));
+ assertTrue(prop.getDescription().equals(actualDesciprtion), String.format("Property description is not correct. expected:%s ; actual %s", prop.getDescription(), actualDesciprtion));
+
+ if (prop.getSchemaDefinition() != null){
+ String actualSchema = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.ENTRY_SCHEMA.getValue() + propName).getText();
+ assertTrue(prop.getSchemaDefinition().equals(actualSchema), String.format("Property schema is not correct. expected:%s ; actual %s", prop.getSchemaDefinition(), actualSchema));
+ }
+ }
+ }
+
+ public static void verifyToscaArtifactsInfo(ResourceReqDetails vf, User user){
+ String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse();
+ JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+ JSONObject toscaArtifacts = (JSONObject) jsonResource.get("toscaArtifacts");
+
+ assertEquals(2, toscaArtifacts.size());
+ for (Object artifactObj : toscaArtifacts.keySet()){
+ JSONObject artifact = (JSONObject) JSONValue.parse(toscaArtifacts.get(artifactObj).toString());
+ assertFalse(artifact.get("artifactUUID").toString().isEmpty(), "artifactUUID field is empty");
+ assertFalse(artifact.get("artifactChecksum").toString().isEmpty(), "artifactChecksum filed is empty");
+ assertFalse(artifact.get("payloadUpdateDate").toString().isEmpty(), "payloadUpdateDate field is empty");
+ assertFalse(artifact.get("artifactVersion").toString().equals("0"), "artifactVersion field is 0");
+ }
+ }
+
+ public static void verifyVfInputs(String instanceName, Map<String, String> instancePropertiesMapFromJson,List<WebElement> propertyRowsFromTable) {
+
+ for (int i = 0 ; i < propertyRowsFromTable.size() ; i++){
+ WebElement row = propertyRowsFromTable.get(i);
+ String propertyNameFromTable = row.findElement(By.xpath(".//*[@data-tests-id='" + "propertyName']")).getText();
+ String propertyTypeFromTable = row.findElement(By.xpath(".//*[@data-tests-id='" + "propertyType']")).getText();
+ String instanceNameFromTable = row.findElement(By.xpath(".//*[@data-tests-id='" + "instanceName']")).getText();
+ String propertySchemaFromTable = row.findElement(By.xpath(".//*[@data-tests-id='" + "propertySchema']")).getText();
+
+ assertTrue(instancePropertiesMapFromJson.containsKey(propertyNameFromTable), "No property named : " + propertyNameFromTable + "for instance " + instanceName);
+ String expectedType = instancePropertiesMapFromJson.get(propertyNameFromTable);
+ assertTrue(expectedType.equals(propertyTypeFromTable.toLowerCase()), propertyNameFromTable + "type is incorrect");
+ assertTrue(instanceName.equals(instanceNameFromTable), "Instance name of property named " + propertyNameFromTable + "is incorrect");
+ }
+ }
+
+ public static void verifyOnboardedVnfMetadata(String vspName, Map<String, String> vspMetadata) {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Verifying metadata");
+ assertTrue(vspName.equals(ResourceGeneralPage.getNameText()), "VSP name is not valid.");
+ assertTrue(vspMetadata.get("description").equals(ResourceGeneralPage.getDescriptionText()), "VSP description is not valid.");
+ assertTrue(vspMetadata.get("subCategory").equals(GeneralUIUtils.getSelectedElementFromDropDown(ResourceGeneralPage.getCategoryDataTestsIdAttribute()).getText().toLowerCase().trim()), "VSP category is not valid.");
+ assertTrue(vspMetadata.get("vendorName").equals(ResourceGeneralPage.getVendorNameText()), "VSP vendor name is not valid.");
+ assertTrue("1.0".equals(ResourceGeneralPage.getVendorReleaseText()), "VSP version is not valid.");
+ List<WebElement> tagsList = ResourceGeneralPage.getElementsFromTagsTable();
+ assertTrue(tagsList.size() == 1, "VSP tags size is not equal to 1.");
+ assertTrue(vspName.equals(tagsList.get(0).getText()), "VSP tag is not its name.");
+ assertTrue(vspMetadata.get("attContact").equals(ResourceGeneralPage.getContactIdText()), "VSP attContact is not valid.");
+ }
+
+ public static void verifyIsElementDisabled(String elementLocator, String elementName){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Checking if %s is disabled", elementName));
+ assertTrue(GeneralUIUtils.isElementReadOnly(elementLocator));
+ }
+
+ public static void verifyFilesChecksum(File actual, File expected){
+ try {
+ String actualMd5OfFile = FileHandling.getMD5OfFile(actual);
+ String expectedMd5OfFile = FileHandling.getMD5OfFile(expected);
+ Assert.assertEquals(expectedMd5OfFile, actualMd5OfFile, "File does not exist");
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+}