2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.ci.tests.execute.AmdocsComplexService;
23 import com.aventstack.extentreports.Status;
24 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
25 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
26 import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
27 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
28 import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
29 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
30 import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
31 import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
32 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
33 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
34 import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils;
35 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
36 import org.testng.annotations.BeforeMethod;
37 import org.testng.annotations.Optional;
38 import org.testng.annotations.Parameters;
39 import org.testng.annotations.Test;
41 public class PathName extends SetupCDTest {
43 protected static String filePath = FileHandling.getFilePath("ComplexService");
44 private static String fullCompositionFile = "fullComposition.zip";
45 private static String fullCompositionFile2 = "fullCompositionNew.zip";
46 private static String HSSFile = "HSS.zip";
47 private static String VMMEFile = "VMME.zip";
48 private static String makeDistributionValue;
50 @Parameters({"makeDistribution"})
52 public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) {
53 makeDistributionValue = makeDistributionReadValue;
56 //------------------------------------------Tests-----------------------------------------------------
58 // Test#8 Jira issue 6168
60 public void ValidateSameNameTest() throws Exception {
61 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
62 String vspName = onboardAndCertify(resourceReqDetails, filePath, fullCompositionFile);
63 reloginWithNewRole(UserRoleEnum.DESIGNER);
64 PathUtilities.createService(getUser());
65 String firstPathName = PathUtilities.createPath("Oren",vspName);
66 PathUtilities.createPathWithoutLink(firstPathName,vspName);
68 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.OK.getValue());
69 } catch (Exception e) {
70 throw new Exception("when creating another path with duplicate name, expected error did not appear");
74 // Test#9 Jira issue 6183
76 public void ValidateEditName() throws Exception {
77 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
78 String vspName = onboardAndCertify(resourceReqDetails, filePath, fullCompositionFile);
79 reloginWithNewRole(UserRoleEnum.DESIGNER);
80 PathUtilities.createService(getUser());
81 String firstPathName = PathUtilities.createPath("Oren",vspName);
82 String secondPathName = PathUtilities.createPathWithoutLink("blabla",vspName);
83 PathValidations.validateEditToExistingName(firstPathName,secondPathName);
86 // Test#10 Jira issue 6411
88 public void SpacesName() throws Exception {
89 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
90 String vspName = onboardAndCertify(resourceReqDetails, filePath, fullCompositionFile);
91 reloginWithNewRole(UserRoleEnum.DESIGNER);
92 PathUtilities.createService(getUser());
93 PathUtilities.createPath(" ", vspName);
95 GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ComplexServiceAmdocs.OK.getValue());
96 } catch (Exception e) {
97 throw new Exception("service path name cannot be empty or spaces ");
101 // Test#11 Jira issue 6186
103 public void ValidateNameWithSpaces() throws Exception {
104 ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();
105 String vspName = onboardAndCertify(resourceReqDetails, filePath, fullCompositionFile);
106 reloginWithNewRole(UserRoleEnum.DESIGNER);
107 PathUtilities.createService(getUser());
108 PathValidations.validateNameWithSpaces("New", vspName);
111 ////////////////////////////////////////////////////////////////////////////////////////
113 ////////////////////////////////////////////////////////////////////////////////////////
115 // workflow leading to path
116 public String onboardAndCertify(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception {
117 VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser());
118 String vspName = vendorSoftwareProductObject.getName();
120 DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen();
121 ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFile, "The topology template for " + vnfFile + " is as follows : ");
123 DeploymentArtifactPage.clickSubmitForTestingButton(vspName);
124 SetupCDTest.getExtendTest().log(Status.INFO, "relogin as TESTER");
125 reloginWithNewRole(UserRoleEnum.TESTER);
126 GeneralUIUtils.findComponentAndClick(vspName);
127 TesterOperationPage.certifyComponent(vspName);
132 protected UserRoleEnum getRole() {
133 return UserRoleEnum.DESIGNER;