diff options
author | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2017-08-18 12:09:45 +0530 |
---|---|---|
committer | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2017-08-18 07:05:17 +0000 |
commit | 7fcf1e84c6e2a1b8bfbeaff52b8baa9bc8d418d6 (patch) | |
tree | 79dd1c0f3bc0266275f219ede31f8d32a2f46508 /framework/src/main/java | |
parent | a2b0adac6b2d29011e543e460a3286ed51a49aa4 (diff) |
Move schema validation to load schema
Move schema validation to load schema.
Issue-Id: CLI-25
Change-Id: I68855caf80cf1b55b41916e124a53b53e7af93d3
Signed-off-by: Subhash Kumar Singh <Subhash.Kumar.Singh@huawei.com>
Diffstat (limited to 'framework/src/main/java')
3 files changed, 57 insertions, 0 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/conf/Constants.java b/framework/src/main/java/org/onap/cli/fw/conf/Constants.java index f6a4193f..d559f7aa 100644 --- a/framework/src/main/java/org/onap/cli/fw/conf/Constants.java +++ b/framework/src/main/java/org/onap/cli/fw/conf/Constants.java @@ -22,6 +22,25 @@ package org.onap.cli.fw.conf; */ public class Constants { + // schema validation + public static final String TOP_LEVEL_PARAMS_LIST ="cli.schema.top_level_params_list"; + public static final String TOP_LEVEL_MANDATORY_LIST ="cli.schema.top_level_mandatory_list"; + public static final String SERVICE_PARAMS_LIST ="cli.schema.service_params_list"; + public static final String SERVICE_PARAMS_MANDATORY_LIST ="cli.schema.service_params_mandatory_list"; + public static final String INPUT_PARAMS_LIST ="cli.schema.input_params_list"; + public static final String INPUT_PARAMS_MANDATORY_LIST ="cli.schema.input_params_mandatory_list"; + public static final String RESULT_PARAMS_LIST ="cli.schema.result_params_list"; + public static final String RESULT_PARAMS_MANDATORY_LIST ="cli.schema.result_params_mandatory_list"; + public static final String HTTP_SECTIONS ="cli.schema.http_sections"; + public static final String HTTP_MANDATORY_SECTIONS ="cli.schema.http_mandatory_sections"; + public static final String HTTP_REQUEST_PARAMS ="cli.schema.http_request_params"; + public static final String HTTP_REQUEST_MANDATORY_PARAMS ="cli.schema.http_request_mandatory_params"; + public static final String HTTP_METHODS ="cli.schema.http_methods"; + public static final String BOOLEAN_VALUE ="cli.schema.boolean_values"; + public static final String AUTH_VALUES="cli.schema.auth_values"; + public static final String MODE_VALUES="cli.schema.mode_values"; + + public static final String SSLCONTEST_TLS = "TLSV1.2"; public static final String APPLICATION_JSON = "application/json"; public static final String X_AUTH_TOKEN = "x-auth-token"; diff --git a/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConfg.java b/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConfg.java index acb2c2b0..1dfd345c 100644 --- a/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConfg.java +++ b/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConfg.java @@ -19,6 +19,7 @@ package org.onap.cli.fw.conf; import java.io.IOException; import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; @@ -133,4 +134,9 @@ public final class OnapCommandConfg { return Arrays.stream(prps.getProperty(Constants.NO_AUTH_ENABLE_INCLUDE_PARAMS_EXTERNAL_CMD) .split(",")).map(String::trim).collect(Collectors.toSet()); } + + public static List<String> getSchemaAttrInfo(String key) { + return Arrays.stream(prps.getProperty(key).split(",")).map(String::trim).collect(Collectors.toList()); + } + } diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResultMap.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResultMap.java new file mode 100644 index 00000000..491f18cb --- /dev/null +++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResultMap.java @@ -0,0 +1,32 @@ +/* + * Copyright 2017 Huawei Technologies Co., Ltd. + * + * 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. + */ + +package org.onap.cli.fw.error; + +import java.util.List; + +/** + * Invalid result map in HTTP section. + * + */ +public class OnapCommandHttpInvalidResultMap extends OnapCommandException { + + private static final long serialVersionUID = 6676137916023457963L; + + public OnapCommandHttpInvalidResultMap(List<String> invalidParams) { + super("0x0028", "Invalide result map parameters : " + invalidParams.toString()); + } +} |