From 39f345954434553d10e0cea114e15e0521ec9471 Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Tue, 26 Sep 2017 10:04:10 +0530 Subject: Migrate onap-cli-schema into open-cli-schema Issue-Id: CLI-66 Change-Id: I719719194bc5f21f4316380e606ce1a58f0f046c Signed-off-by: Kanagaraj Manickam k00365106 --- .../src/main/java/org/onap/cli/fw/OnapCommand.java | 2 +- .../java/org/onap/cli/fw/OnapCommandRegistrar.java | 2 +- .../main/java/org/onap/cli/fw/conf/Constants.java | 20 ++--- .../org/onap/cli/fw/conf/OnapCommandConfg.java | 20 +---- .../resources/onap-cli-schema/basic-login.yaml | 17 ---- .../resources/onap-cli-schema/basic-logout.yaml | 13 --- .../main/resources/onap-cli-schema/catalog.yaml | 42 ---------- .../resources/onap-cli-schema/schema-refresh.yaml | 31 -------- .../resources/onap-cli-schema/schema-validate.yaml | 38 --------- framework/src/main/resources/onap.properties | 62 --------------- .../resources/open-cli-schema/basic-login.yaml | 17 ++++ .../resources/open-cli-schema/basic-logout.yaml | 13 +++ .../main/resources/open-cli-schema/catalog.yaml | 42 ++++++++++ .../resources/open-cli-schema/schema-refresh.yaml | 31 ++++++++ .../resources/open-cli-schema/schema-validate.yaml | 38 +++++++++ framework/src/main/resources/open-cli.properties | 49 ++++++++++++ .../org/onap/cli/fw/OnapCommandRegistrarTest.java | 4 +- .../org/onap/cli/fw/conf/OnapCommandConfgTest.java | 2 +- .../org/onap/cli/fw/schema/ValidateSchemaTest.java | 2 +- .../onap-cli-schema/sample-test1-schema-http.yaml | 92 ---------------------- .../open-cli-schema/sample-test1-schema-http.yaml | 92 ++++++++++++++++++++++ .../src/test/resources/sample-cmd-test-help.txt | 2 +- .../test/resources/sample-test-schema-http.yaml | 2 +- .../src/test/resources/sample-test-schema.yaml | 2 +- 24 files changed, 301 insertions(+), 334 deletions(-) delete mode 100644 framework/src/main/resources/onap-cli-schema/basic-login.yaml delete mode 100644 framework/src/main/resources/onap-cli-schema/basic-logout.yaml delete mode 100644 framework/src/main/resources/onap-cli-schema/catalog.yaml delete mode 100644 framework/src/main/resources/onap-cli-schema/schema-refresh.yaml delete mode 100644 framework/src/main/resources/onap-cli-schema/schema-validate.yaml delete mode 100644 framework/src/main/resources/onap.properties create mode 100644 framework/src/main/resources/open-cli-schema/basic-login.yaml create mode 100644 framework/src/main/resources/open-cli-schema/basic-logout.yaml create mode 100644 framework/src/main/resources/open-cli-schema/catalog.yaml create mode 100644 framework/src/main/resources/open-cli-schema/schema-refresh.yaml create mode 100644 framework/src/main/resources/open-cli-schema/schema-validate.yaml create mode 100644 framework/src/main/resources/open-cli.properties delete mode 100644 framework/src/test/resources/onap-cli-schema/sample-test1-schema-http.yaml create mode 100644 framework/src/test/resources/open-cli-schema/sample-test1-schema-http.yaml (limited to 'framework') diff --git a/framework/src/main/java/org/onap/cli/fw/OnapCommand.java b/framework/src/main/java/org/onap/cli/fw/OnapCommand.java index bce27642..b100b155 100644 --- a/framework/src/main/java/org/onap/cli/fw/OnapCommand.java +++ b/framework/src/main/java/org/onap/cli/fw/OnapCommand.java @@ -282,7 +282,7 @@ public abstract class OnapCommand { // For auth type commands, login and logout logic is not required boolean isAuthRequired = !this.onapService.isNoAuth() && "false".equals(paramMap.get(Constants.DEFAULT_PARAMETER_OUTPUT_NO_AUTH).getValue()) - && !this.getType().equals(CommandType.AUTH); + && this.getType().equals(CommandType.CMD); if (!isCommandInternal()) { this.authClient = new OnapAuthClient( diff --git a/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java b/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java index 74793f47..37ed81a5 100644 --- a/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java +++ b/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java @@ -265,7 +265,7 @@ public class OnapCommandRegistrar { String errorNote = ""; String usageNote = "\n\nTo enable a product version, use one of following methods:" + "\n 1. set env variable CLI_PRODUCT_VERSION" - + "\n 2. set cli.product.version in onap.properties" + + "\n 2. set cli.product.version in open-cli.properties" + "\n 3. in interactive mode, use the directive 'use '\n"; if (!this.availableProductVersions.contains(configuredProductVersion)) { 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 f9e5ba99..5ae3c502 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 @@ -43,15 +43,7 @@ public class Constants { 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"; - public static final String AUTH_SERVICE = "cli.auth_service"; - public static final String AUTH_SERVICE_VERSION = "v1"; - public static final String TOKEN = "{\"userName\": \"%s\",\"password\": \"%s\"}"; - public static final String MSB_URI = "/api/microservices/v1"; - public static final String MSB_SERVICE_URI = MSB_URI + "/services/%s/version/%s"; - - public static final String API_GATEWAY = "cli.api_gateway"; public static final String SERVICE_NAME = "cli.service_name"; //http @@ -127,11 +119,11 @@ public class Constants { public static final String DEFAULT_PARAMETER_OUTPUT_NO_AUTH = "no-auth"; // Configuration properties - public static final String CONF = "onap.properties"; - public static final String ONAP_IGNORE_AUTH = "cli.ignore_auth"; - public static final String ONAP_CLI_VERSION = "cli.version"; - public static final String ONAP_CLI_PRODUCT_VERSION = "cli.product.version"; - public static final String ONAP_CLI_PRODUCT_VERSION_ENV_NAME = "CLI_PRODUCT_VERSION"; + public static final String CONF = "open-cli.properties"; + public static final String OPEN_IGNORE_AUTH = "cli.ignore_auth"; + public static final String OPEN_CLI_VERSION = "cli.version"; + public static final String OPEN_CLI_PRODUCT_VERSION = "cli.product.version"; + public static final String OPEN_CLI_PRODUCT_VERSION_ENV_NAME = "CLI_PRODUCT_VERSION"; public static final String HTTP_API_KEY_USE_COOKIES = "cli.http.api_key_use_cookies"; public static final String EXCLUDE_PARAMS_INTERNAL_CMD = "cli.exclude_params_internal_cmd"; public static final String NO_AUTH_DISABLE_INCLUDE_PARAMS_EXTERNAL_CMD = "cli.no_auth_disable_include_params_external_cmd"; @@ -144,7 +136,7 @@ public class Constants { public static final String PORTRAINT_COLUMN_NAME_PROPERTY = "property"; public static final String PORTRAINT_COLUMN_NAME_VALUE = "value"; - public static final String EXTERNAL_SCHEMA_DIRECTORY = "onap-cli-schema"; + public static final String EXTERNAL_SCHEMA_DIRECTORY = "open-cli-schema"; public static final String EXTERNAL_YAML_PATTERN = "/**/*.yaml"; public static final String EXTERNAL_JSON_PATTERN = "/**/*.json"; public static final String EXTERNAL_SCHEMA_PATH_PATERN = EXTERNAL_SCHEMA_DIRECTORY + EXTERNAL_YAML_PATTERN; 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 bb0e2c06..447a7f4c 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 @@ -55,7 +55,7 @@ public final class OnapCommandConfg { * @return boolean */ public static boolean isAuthIgnored() { - if ("true".equals(prps.getProperty(Constants.ONAP_IGNORE_AUTH))) { + if ("true".equals(prps.getProperty(Constants.OPEN_IGNORE_AUTH))) { return true; } @@ -76,13 +76,13 @@ public final class OnapCommandConfg { } public static String getVersion() { - return prps.getProperty(Constants.ONAP_CLI_VERSION); + return prps.getProperty(Constants.OPEN_CLI_VERSION); } public static String getEnabledProductVersion() { - String version = System.getenv(Constants.ONAP_CLI_PRODUCT_VERSION_ENV_NAME); + String version = System.getenv(Constants.OPEN_CLI_PRODUCT_VERSION_ENV_NAME); if (version == null) { - version = prps.getProperty(Constants.ONAP_CLI_PRODUCT_VERSION); + version = prps.getProperty(Constants.OPEN_CLI_PRODUCT_VERSION); } return version; } @@ -100,22 +100,10 @@ public final class OnapCommandConfg { return false; } - public static String getXAuthTokenName() { - return prps.getProperty(Constants.SERVICE_AUTH_BASIC_HTTP_HEADERS + "." + Constants.X_AUTH_TOKEN); - } - public static String getInternalCmd() { return prps.getProperty(Constants.SERVICE_NAME); } - public static String getApiGateway() { - return prps.getProperty(Constants.API_GATEWAY); - } - - public static String getAuthService() { - return prps.getProperty(Constants.AUTH_SERVICE); - } - public static String getAuthType() { return prps.getProperty(Constants.SERVICE_AUTH, Constants.AUTH_BASIC); } diff --git a/framework/src/main/resources/onap-cli-schema/basic-login.yaml b/framework/src/main/resources/onap-cli-schema/basic-login.yaml deleted file mode 100644 index 10bc8a80..00000000 --- a/framework/src/main/resources/onap-cli-schema/basic-login.yaml +++ /dev/null @@ -1,17 +0,0 @@ -open_cli_schema_version: 1.0 -name: basic-login -description: basic login auth command -version: cli-1.0 -type: auth - -service: - name: onap-cli - version: 1.0.0 - -results: - direction: portrait - attributes: - - name: Authorization - description: Authorization - scope: short - type: string diff --git a/framework/src/main/resources/onap-cli-schema/basic-logout.yaml b/framework/src/main/resources/onap-cli-schema/basic-logout.yaml deleted file mode 100644 index ccb05160..00000000 --- a/framework/src/main/resources/onap-cli-schema/basic-logout.yaml +++ /dev/null @@ -1,13 +0,0 @@ -open_cli_schema_version: 1.0 - -name: basic-logout - -description: basic logout auth command - -version: cli-1.0 - -type: auth - -service: - name: onap-cli - version: 1.0.0 diff --git a/framework/src/main/resources/onap-cli-schema/catalog.yaml b/framework/src/main/resources/onap-cli-schema/catalog.yaml deleted file mode 100644 index 6cfdb0a0..00000000 --- a/framework/src/main/resources/onap-cli-schema/catalog.yaml +++ /dev/null @@ -1,42 +0,0 @@ -open_cli_schema_version: 1.0 - -name: catalog - -description: cli catalog command to find the base path for service. - -version: cli-1.0 - -type: catalog - -service: - auth: none - name: onap-cli - version: 1.0.0 - mode: direct - -parameters: - - name: catalog-service-name - type: string - description: service name registered in catalog service - short_option: l - long_option: catalog-service-name - is_optional: false - - name: catalog-service-version - type: string - description: service version registered in catalog service - short_option: i - long_option: catalog-service-version - is_optional: false -results: - direction: portrait - attributes: - - name: catalog-service-host-url - description: Service connection url - scope: short - type: string - default_value: ${host-url} - - name: catalog-service-base-path - description: service base path, to append with host-url for connecting the service. - scope: short - type: string - default_value: / \ No newline at end of file diff --git a/framework/src/main/resources/onap-cli-schema/schema-refresh.yaml b/framework/src/main/resources/onap-cli-schema/schema-refresh.yaml deleted file mode 100644 index 280dec36..00000000 --- a/framework/src/main/resources/onap-cli-schema/schema-refresh.yaml +++ /dev/null @@ -1,31 +0,0 @@ -open_cli_schema_version: 1.0 -name: schema-refresh -description: Onap command to refresh schemas stored in onap_cli_schema folders. -version: cli-1.0 -service: - auth: none - name: onap-cli - version: 1.0.0 -results: - direction: landscape - attributes: - - name: sl-no - description: Serial Number - scope: short - type: string - - name: command - description: Command name - scope: short - type: string - - name: product-version - description: Command product version - scope: short - type: string - - name: schema - description: Schema name - scope: short - type: string - - name: version - description: Schema version - scope: short - type: string \ No newline at end of file diff --git a/framework/src/main/resources/onap-cli-schema/schema-validate.yaml b/framework/src/main/resources/onap-cli-schema/schema-validate.yaml deleted file mode 100644 index 55e61e58..00000000 --- a/framework/src/main/resources/onap-cli-schema/schema-validate.yaml +++ /dev/null @@ -1,38 +0,0 @@ -open_cli_schema_version: 1.0 -name: schema-validate -description: Onap command to validate schema -version: cli-1.0 -service: - auth: none - name: onap-cli - version: 1.0.0 -default_parameters: - exclude: - - host-username - - host-password - - host-url - - no-auth -parameters: - - name: schema-location - type: url - description: Schema file location - short_option: l - long_option: schema-location - is_optional: false - - name: internal-schema - type: bool - description: Validate existing schema file - short_option: i - long_option: internal-schema - is_optional: false -results: - direction: landscape - attributes: - - name: sl-no - description: Serial Number of error - scope: short - type: string - - name: error - description: Schema validation error - scope: short - type: string \ No newline at end of file diff --git a/framework/src/main/resources/onap.properties b/framework/src/main/resources/onap.properties deleted file mode 100644 index d73f1454..00000000 --- a/framework/src/main/resources/onap.properties +++ /dev/null @@ -1,62 +0,0 @@ -cli.ignore_auth=false -cli.version=1.0 -cli.http.api_key_use_cookies=true -cli.discover_always=false - -cli.service_name=onap-cli -cli.api_gateway=msb -cli.auth_service=auth - -# service section -cli.exclude_params_internal_cmd=host-username,host-password,host-url,no-auth -cli.no_auth_disable_include_params_external_cmd=host-username,host-password,host-url,no-auth -cli.no_auth_enable_exclude_params_external_cmd=host-username,host-password,no-auth -cli.no_auth_enable_include_params_external_cmd=host-url - -cli.http.basic.common_headers=x-auth-token,x-transaction-id,x-app-id -cli.http.basic.common_headers.x-auth-token=Authorization -cli.http.basic.common_headers.x-transaction-id=X-TransactionId -cli.http.basic.common_headers.x-transaction-id.value=req-uuid -cli.http.basic.common_headers.x-app-id=X-FromAppId -cli.http.basic.common_headers.x-app-id.value=onap-cli - -# Service specific headers -cli.http.basic.common_headers.sdc=user-id -cli.http.basic.common_headers.sdc.user-id=USER_ID -cli.http.basic.common_headers.sdc.user-id.value=${host-username} - -#TODO mrkanag add support for aaf like defined above for basic -#cli.service.auth=aaf - -#schema validation -cli.schema.top_level_params_list=open_cli_schema_version,name,version,description,service,parameters,results,http,type -cli.schema.top_level_mandatory_list=open_cli_schema_version - -cli.schema.service_params_list=name,version,auth,mode -cli.schema.service_params_mandatory_list=name,version - -cli.schema.input_params_list=name,description,type,short_option,long_option, is_optional,default_value,is_secured -cli.schema.input_params_mandatory_list=name,description,type - -cli.schema.result_params_list=name,description,scope,type,is_secured, default_value -cli.schema.result_params_mandatory_list=name, description, type, scope - -cli.schema.http_sections=request,success_codes,result_map,sample_response -cli.schema.http_mandatory_sections=request, success_codes - -cli.schema.http_request_params=uri,method,body,headers,queries,multipart_entity_name -cli.schema.http_request_mandatory_params=uri,method - -cli.schema.http_methods=post,get,delete,put,head - -cli.schema.boolean_values=true,false -cli.schema.auth_values=none,basic -cli.schema.mode_values=direct,catalog - -#product version -cli.product.version=cli-1.0 - -# moco properties -cli.sample.gen.enable=false -cli.sample.gen.target=. - diff --git a/framework/src/main/resources/open-cli-schema/basic-login.yaml b/framework/src/main/resources/open-cli-schema/basic-login.yaml new file mode 100644 index 00000000..78294fc5 --- /dev/null +++ b/framework/src/main/resources/open-cli-schema/basic-login.yaml @@ -0,0 +1,17 @@ +open_cli_schema_version: 1.0 +name: basic-login +description: basic login auth command +version: cli-1.0 +type: auth + +service: + name: open-cli + version: 1.0.0 + +results: + direction: portrait + attributes: + - name: Authorization + description: Authorization + scope: short + type: string diff --git a/framework/src/main/resources/open-cli-schema/basic-logout.yaml b/framework/src/main/resources/open-cli-schema/basic-logout.yaml new file mode 100644 index 00000000..2c0e3dbd --- /dev/null +++ b/framework/src/main/resources/open-cli-schema/basic-logout.yaml @@ -0,0 +1,13 @@ +open_cli_schema_version: 1.0 + +name: basic-logout + +description: basic logout auth command + +version: cli-1.0 + +type: auth + +service: + name: open-cli + version: 1.0.0 diff --git a/framework/src/main/resources/open-cli-schema/catalog.yaml b/framework/src/main/resources/open-cli-schema/catalog.yaml new file mode 100644 index 00000000..160ff1d4 --- /dev/null +++ b/framework/src/main/resources/open-cli-schema/catalog.yaml @@ -0,0 +1,42 @@ +open_cli_schema_version: 1.0 + +name: catalog + +description: cli catalog command to find the base path for service. + +version: cli-1.0 + +type: catalog + +service: + auth: none + name: open-cli + version: 1.0.0 + mode: direct + +parameters: + - name: catalog-service-name + type: string + description: service name registered in catalog service + short_option: l + long_option: catalog-service-name + is_optional: false + - name: catalog-service-version + type: string + description: service version registered in catalog service + short_option: i + long_option: catalog-service-version + is_optional: false +results: + direction: portrait + attributes: + - name: catalog-service-host-url + description: Service connection url + scope: short + type: string + default_value: ${host-url} + - name: catalog-service-base-path + description: service base path, to append with host-url for connecting the service. + scope: short + type: string + default_value: / \ No newline at end of file diff --git a/framework/src/main/resources/open-cli-schema/schema-refresh.yaml b/framework/src/main/resources/open-cli-schema/schema-refresh.yaml new file mode 100644 index 00000000..5f1cb50e --- /dev/null +++ b/framework/src/main/resources/open-cli-schema/schema-refresh.yaml @@ -0,0 +1,31 @@ +open_cli_schema_version: 1.0 +name: schema-refresh +description: Onap command to refresh schemas stored in OPEN_cli_schema folders. +version: cli-1.0 +service: + auth: none + name: open-cli + version: 1.0.0 +results: + direction: landscape + attributes: + - name: sl-no + description: Serial Number + scope: short + type: string + - name: command + description: Command name + scope: short + type: string + - name: product-version + description: Command product version + scope: short + type: string + - name: schema + description: Schema name + scope: short + type: string + - name: version + description: Schema version + scope: short + type: string \ No newline at end of file diff --git a/framework/src/main/resources/open-cli-schema/schema-validate.yaml b/framework/src/main/resources/open-cli-schema/schema-validate.yaml new file mode 100644 index 00000000..8c777666 --- /dev/null +++ b/framework/src/main/resources/open-cli-schema/schema-validate.yaml @@ -0,0 +1,38 @@ +open_cli_schema_version: 1.0 +name: schema-validate +description: Onap command to validate schema +version: cli-1.0 +service: + auth: none + name: open-cli + version: 1.0.0 +default_parameters: + exclude: + - host-username + - host-password + - host-url + - no-auth +parameters: + - name: schema-location + type: url + description: Schema file location + short_option: l + long_option: schema-location + is_optional: false + - name: internal-schema + type: bool + description: Validate existing schema file + short_option: i + long_option: internal-schema + is_optional: false +results: + direction: landscape + attributes: + - name: sl-no + description: Serial Number of error + scope: short + type: string + - name: error + description: Schema validation error + scope: short + type: string \ No newline at end of file diff --git a/framework/src/main/resources/open-cli.properties b/framework/src/main/resources/open-cli.properties new file mode 100644 index 00000000..2531ce22 --- /dev/null +++ b/framework/src/main/resources/open-cli.properties @@ -0,0 +1,49 @@ +cli.ignore_auth=false +cli.http.api_key_use_cookies=true +cli.discover_always=false + +cli.service_name=open-cli +cli.product.version=cli-1.0 +cli.version=1.0 + +# service section +cli.exclude_params_internal_cmd=host-username,host-password,host-url,no-auth +cli.no_auth_disable_include_params_external_cmd=host-username,host-password,host-url,no-auth +cli.no_auth_enable_exclude_params_external_cmd=host-username,host-password,no-auth +cli.no_auth_enable_include_params_external_cmd=host-url + +#schema validation +cli.schema.top_level_params_list=open_cli_schema_version,name,version,description,service,parameters,results,http,type +cli.schema.top_level_mandatory_list=open_cli_schema_version + +cli.schema.service_params_list=name,version,auth,mode +cli.schema.service_params_mandatory_list=name,version + +cli.schema.input_params_list=name,description,type,short_option,long_option, is_optional,default_value,is_secured +cli.schema.input_params_mandatory_list=name,description,type + +cli.schema.result_params_list=name,description,scope,type,is_secured, default_value +cli.schema.result_params_mandatory_list=name, description, type, scope + +cli.schema.http_sections=request,success_codes,result_map,sample_response +cli.schema.http_mandatory_sections=request, success_codes + +cli.schema.http_request_params=uri,method,body,headers,queries,multipart_entity_name +cli.schema.http_request_mandatory_params=uri,method + +cli.schema.http_methods=post,get,delete,put,head + +cli.schema.boolean_values=true,false +cli.schema.auth_values=none,basic +cli.schema.mode_values=direct,catalog + +<<<<<<< 5301969fc26714a8494882027116282898278f32:framework/src/main/resources/onap.properties +#product version +cli.product.version=cli-1.0 + +# moco properties +cli.sample.gen.enable=false +cli.sample.gen.target=. + +======= +>>>>>>> Migrate onap-cli-schema into open-cli-schema:framework/src/main/resources/open-cli.properties diff --git a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java index 4f5c95e2..d34f89c2 100644 --- a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java +++ b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java @@ -42,10 +42,10 @@ public class OnapCommandRegistrarTest { } private void createDir() { - URL url = OnapCommandRegistrarTest.class.getClassLoader().getResource("onap-cli-schema"); + URL url = OnapCommandRegistrarTest.class.getClassLoader().getResource("open-cli-schema"); if (url != null) { String path = url.getPath(); - path = path.replaceFirst("onap-cli-schema", "data"); + path = path.replaceFirst("open-cli-schema", "data"); File file = new File(path); if (!file.exists()) { file.mkdir(); diff --git a/framework/src/test/java/org/onap/cli/fw/conf/OnapCommandConfgTest.java b/framework/src/test/java/org/onap/cli/fw/conf/OnapCommandConfgTest.java index 7d58a6f4..1a677707 100644 --- a/framework/src/test/java/org/onap/cli/fw/conf/OnapCommandConfgTest.java +++ b/framework/src/test/java/org/onap/cli/fw/conf/OnapCommandConfgTest.java @@ -33,7 +33,7 @@ public class OnapCommandConfgTest { @Test public void isAuthIgnoredTest() throws IOException { Properties prps = new Properties(); - prps.load(OnapCommandConfg.class.getClassLoader().getResourceAsStream("onap.properties")); + prps.load(OnapCommandConfg.class.getClassLoader().getResourceAsStream("open-cli.properties")); boolean auth = OnapCommandConfg.isAuthIgnored(); Assert.assertTrue(auth == Boolean.valueOf(prps.getProperty("cli.ignore_auth"))); Assert.assertTrue(OnapCommandConfg.isCookiesBasedAuth() == Boolean diff --git a/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java b/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java index a8df9979..d8745989 100644 --- a/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java +++ b/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java @@ -55,7 +55,7 @@ public class ValidateSchemaTest { protected void run() throws OnapCommandException {} }; OnapCommandUtils.loadSchema(cmd, - ValidateSchemaTest.class.getClassLoader().getResource("onap.properties").getFile(), + ValidateSchemaTest.class.getClassLoader().getResource("open-cli.properties").getFile(), true, true); } diff --git a/framework/src/test/resources/onap-cli-schema/sample-test1-schema-http.yaml b/framework/src/test/resources/onap-cli-schema/sample-test1-schema-http.yaml deleted file mode 100644 index 21f863b6..00000000 --- a/framework/src/test/resources/onap-cli-schema/sample-test1-schema-http.yaml +++ /dev/null @@ -1,92 +0,0 @@ -open_cli_schema_version: 1.0 -name: sample-test1 -description: Onap sample command to test the command features -version: cli-1.0 -service: - name: sample - version: v1 -parameters: - - name: bool-param - type: bool - description: Onap boolean param, by default its always false. - short_option: b - long_option: bool - is_optional: true - default_value: false - - name: secure-param - type: string - description: Onap secure param such as password - short_option: x - long_option: secure - is_secured: true - is_optional: false - default_Value: pass123# - - name: string-param - type: string - description: Onap string param - long_option: string-param - short_option: c - is_optional: false - default_Value: test - - name: yaml-param - type: json - description: Onap yaml file location param - long_option: yaml-param - short_option: y - is_optional: false - - name: json-param - type: json - description: Onap json file location param - long_option: json-param - short_option: j - is_optional: false - - name: long-param - type: digit - description: Onap long param - short_option: l - long_option: long-opt - is_optional: false - default_value: 10 - - name: url-param - type: url - description: Onap url param - short_option: r - long_option: url - is_optional: false - default_value: http://localhost:8082/file.txt - - name: env-param - type: string - description: Onap env param. - short_option: z - long_option: env - is_optional: false - default_value: ${ENV_VAR} - - name: positional-args - type: string - description: Onap positional args, if no short option and no long option given for it - is_optional: false - default_value: http://localhost:8082/file.txt -http: - request: - uri: /vims - method: POST - body: '{"name":"${name}","vendor":"${vendor}","version":"${vim-version}","description":"${description}","type":"${type}","url":"${url}","userName":"${username}","password":"${password}","domain":"${domain}","tenant":"${tenant}"}' - headers: - success_codes: - - 201 - - 200 - result_map: - id: $b{$.vimId} - name: $b{$.name} - vendor: $b{$.vendor} - type: $b{$.type} - version: $b{$.version} - url: $b{$.url} - description: $b{$.description} - username: $b{$.userName} - password: $b{$.password} - domain: $b{$.domain} - tenant: $b{$.tenant} - create-time: $b{$.createTime} - sample_response: - body:'{"id":"string","name":"string","vendor":"string","version":"string","description":"string","type":"string","createTime":"string","url":"string","userName":"string","password":"string","domain":"string","tenant":"string"}' \ No newline at end of file diff --git a/framework/src/test/resources/open-cli-schema/sample-test1-schema-http.yaml b/framework/src/test/resources/open-cli-schema/sample-test1-schema-http.yaml new file mode 100644 index 00000000..21f863b6 --- /dev/null +++ b/framework/src/test/resources/open-cli-schema/sample-test1-schema-http.yaml @@ -0,0 +1,92 @@ +open_cli_schema_version: 1.0 +name: sample-test1 +description: Onap sample command to test the command features +version: cli-1.0 +service: + name: sample + version: v1 +parameters: + - name: bool-param + type: bool + description: Onap boolean param, by default its always false. + short_option: b + long_option: bool + is_optional: true + default_value: false + - name: secure-param + type: string + description: Onap secure param such as password + short_option: x + long_option: secure + is_secured: true + is_optional: false + default_Value: pass123# + - name: string-param + type: string + description: Onap string param + long_option: string-param + short_option: c + is_optional: false + default_Value: test + - name: yaml-param + type: json + description: Onap yaml file location param + long_option: yaml-param + short_option: y + is_optional: false + - name: json-param + type: json + description: Onap json file location param + long_option: json-param + short_option: j + is_optional: false + - name: long-param + type: digit + description: Onap long param + short_option: l + long_option: long-opt + is_optional: false + default_value: 10 + - name: url-param + type: url + description: Onap url param + short_option: r + long_option: url + is_optional: false + default_value: http://localhost:8082/file.txt + - name: env-param + type: string + description: Onap env param. + short_option: z + long_option: env + is_optional: false + default_value: ${ENV_VAR} + - name: positional-args + type: string + description: Onap positional args, if no short option and no long option given for it + is_optional: false + default_value: http://localhost:8082/file.txt +http: + request: + uri: /vims + method: POST + body: '{"name":"${name}","vendor":"${vendor}","version":"${vim-version}","description":"${description}","type":"${type}","url":"${url}","userName":"${username}","password":"${password}","domain":"${domain}","tenant":"${tenant}"}' + headers: + success_codes: + - 201 + - 200 + result_map: + id: $b{$.vimId} + name: $b{$.name} + vendor: $b{$.vendor} + type: $b{$.type} + version: $b{$.version} + url: $b{$.url} + description: $b{$.description} + username: $b{$.userName} + password: $b{$.password} + domain: $b{$.domain} + tenant: $b{$.tenant} + create-time: $b{$.createTime} + sample_response: + body:'{"id":"string","name":"string","vendor":"string","version":"string","description":"string","type":"string","createTime":"string","url":"string","userName":"string","password":"string","domain":"string","tenant":"string"}' \ No newline at end of file diff --git a/framework/src/test/resources/sample-cmd-test-help.txt b/framework/src/test/resources/sample-cmd-test-help.txt index 3d3d2415..63b5decc 100644 --- a/framework/src/test/resources/sample-cmd-test-help.txt +++ b/framework/src/test/resources/sample-cmd-test-help.txt @@ -20,7 +20,7 @@ where, default, it is read from environment variable HOST_PASSWORD. Secured. -m | --host-url Onap MSB url. It is of type URL. By default, it - is read from environment variable ONAP_MSB_URL. + is read from environment variable OPEN_MSB_URL. -h | --help Onap command help message. It is of type STRING. By default, it is false. -v | --version Onap command service version. It is of type diff --git a/framework/src/test/resources/sample-test-schema-http.yaml b/framework/src/test/resources/sample-test-schema-http.yaml index 87918792..9bfa2a53 100644 --- a/framework/src/test/resources/sample-test-schema-http.yaml +++ b/framework/src/test/resources/sample-test-schema-http.yaml @@ -1,7 +1,7 @@ open_cli_schema_version: 1.0 name: sample-create-http description: Register microservice into Onap -version: onap-1.0 +version: cli-1.0 service: name: msb version: v1 diff --git a/framework/src/test/resources/sample-test-schema.yaml b/framework/src/test/resources/sample-test-schema.yaml index 98964a60..092e0e75 100644 --- a/framework/src/test/resources/sample-test-schema.yaml +++ b/framework/src/test/resources/sample-test-schema.yaml @@ -1,7 +1,7 @@ open_cli_schema_version: 1.0 name: sample-test description: Onap sample command to test the command features -version: onap-1.0 +version: cli-1.0 service: name: sample version: v1 -- cgit 1.2.3-korg