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.datatypes.enums;
23 import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
24 import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
25 import org.openecomp.sdc.be.model.PropertyDefinition;
26 import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
28 public enum PropertyTypeEnum {
29 INTEGER("defaultIntegerPropName1", "integer", "125", "default integer type property description", null),
30 STRING("defaultStringPropName1", "string", "string", "default string type property description", null),
31 BOOLEAN("defaultBooleanPropName1", "boolean", "true", "default boolean type property description", null),
32 FLOAT("defaultBooleanPropName1", "float", "1.2", "default float type property description", null),
33 STRING_LIST("defaultStringListPropName", "list", "[a,b]", "outer description", getDefaultStringSchema(ToscaPropertyType.STRING.getType())),
34 INTEGER_LIST("defaultIntegerListPropName", "list", "[1,2]", "outer description", getDefaultStringSchema(ToscaPropertyType.INTEGER.getType())),
35 BOOLEAN_LIST("defaultBooleanListPropName", "list", "[true,false]", "outer description", getDefaultStringSchema(ToscaPropertyType.BOOLEAN.getType())),
36 FLOAT_LIST("defaultFloatMapPropName", "list", "[1.0,2.0]", "outer description", getDefaultStringSchema(ToscaPropertyType.FLOAT.getType())),
37 STRING_MAP("defaultStringMapPropName", "map", "{\"key1\":val1 , \"key2\":val2}", "outer description", getDefaultStringSchema(ToscaPropertyType.STRING.getType())),
38 INTEGER_MAP("defaultIntegerMapPropName", "map", "{\"key1\":123 , \"key2\":-456}", "outer description", getDefaultStringSchema(ToscaPropertyType.INTEGER.getType())),
39 BOOLEAN_MAP("defaultBooleanMapPropName", "map", "{\"key1\":true , \"key2\":false}", "outer description", getDefaultStringSchema(ToscaPropertyType.BOOLEAN.getType())),
40 FLOAT_MAP("defaultFloatMapPropName", "map", "{\"key1\":0.2123 , \"key2\":43.545f}", "outer description", getDefaultStringSchema(ToscaPropertyType.FLOAT.getType()));
45 private String description;
46 private SchemaDefinition schemaDefinition;
48 private PropertyTypeEnum(String name, String type, String value, String description,
49 SchemaDefinition schemaDefinition) {
53 this.description = description;
54 this.schemaDefinition = schemaDefinition;
57 public String getName() {
61 public void setName(String name) {
65 public String getType() {
69 public void setType(String type) {
73 public String getValue() {
77 public void setValue(String value) {
81 public String getDescription() {
85 public void setDescription(String description) {
86 this.description = description;
89 public SchemaDefinition getSchemaDefinition() {
90 return schemaDefinition;
93 public void setSchemaDefinition(SchemaDefinition schemaDefinition) {
94 this.schemaDefinition = schemaDefinition;
97 private static SchemaDefinition getDefaultStringSchema(String innerType) {
98 SchemaDefinition schema = new SchemaDefinition();
99 String description = "inner description";
100 PropertyDefinition property = new PropertyDefinition();
101 property.setType(innerType);
102 property.setDescription(description);
103 schema.setProperty(property);