2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 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.pages;
23 import org.openecomp.sdc.be.model.ComponentInstance;
24 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
26 public class PropertyNameBuilder {
27 private static final String PREFIX_VAL = DataTestIdEnum.PropertiesAssignmentScreen.PROPERTY_VALUE_FIELD_PREFIX.getValue();
28 private static final String PREFIX_KEY = DataTestIdEnum.PropertiesAssignmentScreen.PROPERTY_KEY_FIELD_PREFIX.getValue();
29 private static final String PREFIX_EXPAND = DataTestIdEnum.PropertiesAssignmentScreen.EXPAND_BUTTON.getValue();
30 private static final String PREFIX_INPUT_VAL = DataTestIdEnum.PropertiesAssignmentScreen.INPUT_VALUE_FIELD_PREFIX.getValue();
31 private static final String POPUP_VAL = DataTestIdEnum.PropertiesAssignmentScreen.POPUP_VALUE_FIELD_PREFIX.getValue();
33 //VF/Service simple property value field
34 public static String buildSimpleField(String propertyName){
35 return new StringBuilder().append(PREFIX_VAL).append(propertyName).toString();
38 public static String buildPopupField(String propertyName){
39 return new StringBuilder().append(POPUP_VAL).append(propertyName).toString();
42 public static String buildIndexedField(String propertyName, int index){
43 return new StringBuilder().append(PREFIX_VAL).append(propertyName).append(".").append(index).toString();
46 public static String buildIndexedKeyField(String propertyName, int index){
47 return new StringBuilder().append(PREFIX_KEY).append(propertyName).append(".").append(index).toString();
50 public static String buildIComplexField(String propertyName, String nestedProperty){
51 return new StringBuilder().append(PREFIX_VAL).append(propertyName).append(".").append(nestedProperty).toString();
54 public static String buildIComplexListField(String propertyName, String nestedProperty, int index){
55 return new StringBuilder().append(PREFIX_VAL).append(propertyName).append(".").append(index).append(".").append(nestedProperty).toString();
58 public static String buildIExpandButton(String propertyName, int index){
59 return new StringBuilder().append(PREFIX_EXPAND).append(propertyName).append(".").append(index).toString();
65 //VF input value field
66 public static String buildDeclaredInputField(String componentName, String propertyName){
67 return new StringBuilder().append(PREFIX_INPUT_VAL).append(componentName).append("_").append(propertyName).toString();
70 public static String buildInputField(String propertyName){
71 return new StringBuilder().append(PREFIX_INPUT_VAL).append(propertyName).toString();
74 //Service Property value field - declared from VF
75 public static String buildServicePropertyValue(String componentName, String propertyName){
76 return new StringBuilder().append(PREFIX_VAL).append(componentName).append("_").append(propertyName).toString();
80 public static String buildServiceInputNameServiceLevel(ComponentInstance componentInstance, String propertyName){
81 return new StringBuilder().append(componentInstance.getNormalizedName())
82 .append("_").append(propertyName).toString();
85 public static String buildServiceInputNameVfLevel(ComponentInstance componentInstance, String componentName, String propertyName){
86 return new StringBuilder().append(componentInstance.getNormalizedName())
87 .append("_").append(componentName).append("_").append(propertyName).toString();
92 public static String buildVfDeclaredPropValue(String componentName, String propertyName){
93 String inputName = componentName + "_" + propertyName;
94 return new StringBuilder().append("{\"get_input\":\"").append(inputName).append("\"}").toString();
97 public static String buildServiceDeclaredPropertyValue(ComponentInstance componentInstance, String componentName, String propertyName){
98 String inputName = buildServiceInputNameVfLevel(componentInstance, componentName, propertyName );
99 return new StringBuilder().append("{\"get_input\":\"").append(inputName).append("\"}").toString();
102 public static String buildServiceDeclaredPropValueServiceLevel(ComponentInstance componentInstance, String propertyName){
103 String inputName = buildServiceInputNameServiceLevel(componentInstance, propertyName );
104 return new StringBuilder().append("{\"get_input\":\"").append(inputName).append("\"}").toString();
107 //Service Input value field
108 public static String buildServiceDeclaredFieldServiceLevel(ComponentInstance componentInstance, String propertyName){
109 String inputName = buildServiceInputNameServiceLevel(componentInstance, propertyName );
110 return new StringBuilder().append(PREFIX_INPUT_VAL).append(inputName).toString();
113 public static String buildServiceDeclaredFieldVfLevel(ComponentInstance componentInstance, String componentName, String propertyName){
114 String inputName = buildServiceInputNameVfLevel(componentInstance, componentName, propertyName );
115 return new StringBuilder().append(PREFIX_INPUT_VAL).append(inputName).toString();