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.sanity;
23 import static org.testng.Assert.assertTrue;
25 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
26 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
27 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
28 import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
29 import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
30 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
31 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
32 import org.openecomp.sdc.ci.tests.pages.PropertiesAssignmentPage;
33 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
34 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
35 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
36 import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
37 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
38 import org.openecomp.sdc.ci.tests.verificator.PropertiesAssignmentVerificator;
39 import org.testng.AssertJUnit;
40 import org.testng.annotations.BeforeClass;
41 import org.testng.annotations.BeforeMethod;
42 import org.testng.annotations.Test;
44 import com.aventstack.extentreports.Status;
47 public class PropertiesAssignment extends SetupCDTest {
49 private static String filePath;
50 private static String csarFile = "PCRF_OS_FIXED.csar";
53 public void beforeClass(){
54 filePath = FileHandling.getFilePath("");
58 public void beforeTest(){
59 System.out.println("File repository is : " + filePath);
60 getExtendTest().log(Status.INFO, "File repository is : " + filePath);
66 public void declareAndDeleteInputVfTest() throws Exception {
67 // ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
68 // ResourceUIUtils.createResource(vfMetaData, getUser());
70 String csarTestFile = csarFile;
71 String componentName = "abstract_pcm";
72 String propertyName = "min_instances";
74 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
75 resourceMetaData.setVersion("0.1");
76 ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarTestFile, getUser());
79 ResourceGeneralPage.getLeftMenu().moveToPropertiesAssignmentScreen();
80 PropertiesAssignmentPage.clickOnComponentInComposition(componentName);
81 PropertiesAssignmentPage.findSearchBoxAndClick(propertyName);
82 PropertiesAssignmentPage.clickOnDeclareButton();
83 AssertJUnit.assertTrue(PropertiesAssignmentPage.isPropertyChecked(propertyName));
85 PropertiesAssignmentPage.clickOnInputTab();
86 PropertiesAssignmentPage.findInput(componentName, propertyName);
87 PropertiesAssignmentPage.clickOnDeleteInputButton();
88 PropertiesAssignmentPage.clickOnDeleteInputDialogConfirmationButton();
89 PropertiesAssignmentPage.clickOnPropertiesTab();
90 PropertiesAssignmentPage.findProperty(propertyName);
91 AssertJUnit.assertFalse(PropertiesAssignmentPage.isPropertyChecked(propertyName));
98 public void filterAllVfTest() throws Exception {
99 // ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
100 // ResourceUIUtils.createResource(vfMetaData, getUser());
102 String csarTestFile = csarFile;
103 String propertyName = "name";
104 String propertyLocation = DataTestIdEnum.PropertiesAssignmentScreen.PROPERTY_NAME_COLUMN.getValue();
105 int propertiesCountFilter = 22;
106 int propertiesCountWithoutFilter = 0;
108 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
109 resourceMetaData.setVersion("0.1");
110 ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarTestFile, getUser());
113 ResourceGeneralPage.getLeftMenu().moveToPropertiesAssignmentScreen();
114 //Count current properties number before filter is applied
115 propertiesCountWithoutFilter = GeneralUIUtils.getWebElementsListByContainsClassName(propertyLocation).size();
116 PropertiesAssignmentPage.clickOnFilterButton();
117 PropertiesAssignmentPage.clickOnFilterAllCheckbox();
118 PropertiesAssignmentPage.findFilterBoxAndClick(propertyName);
119 PropertiesAssignmentPage.clickOnFilterApplyButton();
120 PropertiesAssignmentVerificator.validateFilteredPropertiesCount(propertiesCountFilter, propertyLocation);
122 PropertiesAssignmentPage.clickOnFilterClearAllButton();
123 PropertiesAssignmentVerificator.validateFilteredPropertiesCount(propertiesCountWithoutFilter, propertyLocation);
127 protected UserRoleEnum getRole() {
128 return UserRoleEnum.DESIGNER;