diff options
Diffstat (limited to 'profiles/http/src/test/resources')
14 files changed, 543 insertions, 0 deletions
diff --git a/profiles/http/src/test/resources/META-INF/services/org.onap.cli.fw.cmd.OnapCommand b/profiles/http/src/test/resources/META-INF/services/org.onap.cli.fw.cmd.OnapCommand new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/profiles/http/src/test/resources/META-INF/services/org.onap.cli.fw.cmd.OnapCommand diff --git a/profiles/http/src/test/resources/open-cli-schema/sample-test1-schema-http.yaml b/profiles/http/src/test/resources/open-cli-schema/sample-test1-schema-http.yaml new file mode 100644 index 00000000..f162231f --- /dev/null +++ b/profiles/http/src/test/resources/open-cli-schema/sample-test1-schema-http.yaml @@ -0,0 +1,95 @@ +open_cli_schema_version: 1.0 +name: sample-test1 +description: Oclip sample command to test the command features + +info: + product: open-cli + service: test + type: cmd + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com + +parameters: + - name: bool-param + type: bool + description: Oclip 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: Oclip 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: Oclip string param + long_option: string-param + short_option: c + is_optional: false + default_Value: test + - name: yaml-param + type: json + description: Oclip yaml file location param + long_option: yaml-param + short_option: y + is_optional: false + - name: json-param + type: json + description: Oclip json file location param + long_option: json-param + short_option: j + is_optional: false + - name: long-param + type: digit + description: Oclip long param + short_option: l + long_option: long-opt + is_optional: false + default_value: 10 + - name: url-param + type: url + description: Oclip url param + short_option: r + long_option: url + is_optional: false + default_value: http://localhost:8082/file.txt + - name: env-param + type: string + description: Oclip env param. + short_option: z + long_option: env + is_optional: false + default_value: ${ENV_VAR} + - name: positional-args + type: string + description: Oclip 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/profiles/http/src/test/resources/open-cli-schema/testauth-login.yaml b/profiles/http/src/test/resources/open-cli-schema/testauth-login.yaml new file mode 100644 index 00000000..3e9211ef --- /dev/null +++ b/profiles/http/src/test/resources/open-cli-schema/testauth-login.yaml @@ -0,0 +1,28 @@ +open_cli_schema_version: 1.0 + +name: testauth-login + +description: basic login auth command + +info: + product: open-cli + service: test + type: auth + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com + +parameters: + - name: string-param + type: string + description: Oclip string param + long_option: string-param + short_option: c + is_optional: false + default_Value: test + +# followings are dummy simulator for http command +http: + request: + uri: / + method: GET + success_codes: + - 200 diff --git a/profiles/http/src/test/resources/open-cli-schema/testauth-logout.yaml b/profiles/http/src/test/resources/open-cli-schema/testauth-logout.yaml new file mode 100644 index 00000000..dfe33638 --- /dev/null +++ b/profiles/http/src/test/resources/open-cli-schema/testauth-logout.yaml @@ -0,0 +1,19 @@ +open_cli_schema_version: 1.0 + +name: testauth-logout + +description: basic logout auth command + +info: + product: open-cli + service: test + type: auth + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com + +# followings are dummy simulator for http command +http: + request: + uri: / + method: GET + success_codes: + - 200
\ No newline at end of file diff --git a/profiles/http/src/test/resources/open-cli.properties b/profiles/http/src/test/resources/open-cli.properties new file mode 100644 index 00000000..026b1f13 --- /dev/null +++ b/profiles/http/src/test/resources/open-cli.properties @@ -0,0 +1,31 @@ +cli.product_name=open-cli +cli.version=1.0 + +cli.discover_always=false + +#schema validation +cli.schema.top_level_params_list=open_cli_schema_version,name,description,parameters,results,http,info +cli.schema.top_level_mandatory_list=open_cli_schema_version + +cli.schema.info_params_list=product,service,type,author,ignore +cli.schema.info_params_mandatory_list=product,service + +cli.schema.input_params_list=name,description,type,short_option,long_option, is_optional,default_value,is_secured,is_include +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.boolean_values=true,false +cli.command.type=cmd,auth,catalog + +# moco properties +cli.sample.gen.enable=false +cli.sample.gen.target=. + +# mrkanag Move this to db, once exteranl command registration is supported in place of discovery +cli.schema.type.supported=http + +#other properties to load (it should be hanled when plugins are made as externally register-able +#when command plugin management support is enabled in oclip +cli.plugins-prps=open-cli-http.properties
\ No newline at end of file diff --git a/profiles/http/src/test/resources/sample-test-schema-auth-required.yaml b/profiles/http/src/test/resources/sample-test-schema-auth-required.yaml new file mode 100644 index 00000000..bb919d9a --- /dev/null +++ b/profiles/http/src/test/resources/sample-test-schema-auth-required.yaml @@ -0,0 +1,16 @@ +open_cli_schema_version: 1.0 +name: sample-test +description: Oclip sample command to test the command features +info: + product: open-cli + service: test + type: cmd + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com +parameters: + - name: bool-param + type: bool + description: Oclip boolean param, by default its always false. + short_option: b + long_option: bool + is_optional: true + default_value: false
\ No newline at end of file diff --git a/profiles/http/src/test/resources/sample-test-schema-http.yaml b/profiles/http/src/test/resources/sample-test-schema-http.yaml new file mode 100644 index 00000000..4ae6e9e0 --- /dev/null +++ b/profiles/http/src/test/resources/sample-test-schema-http.yaml @@ -0,0 +1,92 @@ +open_cli_schema_version: 1.0 +name: sample-create-http +description: Register microservice into Onap +info: + product: open-cli + service: test + type: cmd + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com +parameters: + - name: service-name + description: Oclip service name + type: string + short_option: x + long_option: service-name + is_optional: false + - name: service-version + description: Oclip service version + type: string + short_option: y + long_option: service-version + is_optional: false + - name: service-url + description: Oclip service base url + type: url + short_option: r + long_option: service-url + is_optional: false + - name: status + description: Oclip service status + type: digit + short_option: z + long_option: service-status + is_optional: true + default_value: 1 + - name: node-ip + description: Oclip service running node IP + type: string + - name: node-port + description: Oclip service running node port + type: string + - name: create-or-update + description: Oclip service create or update + type: bool + default_value: true +results: + direction: portrait + attributes: + - name: name + description: Oclip service name + scope: short + type: string + - name: version + description: Oclip service version + scope: short + type: string + - name: url + description: Oclip service base url + scope: short + type: url + - name: status + description: Oclip service status + scope: short + type: digit + - name: nodes + description: Oclip service running nodes + scope: long + type: string + - name: location + description: Oclip service location + scope: long + type: url +http: + request: + uri: /services + method: POST + body: '{"serviceName":"${service-name}","version":"${service-version}","url":"${service-url}","protocol":"REST","visualRange":"1","lb_policy":"hash","nodes":[{"ip":"${node-ip}","port":"${node-port}","ttl":0}]}' + headers: + queries: + createOrUpdate: ${create-or-update} + success_codes: + - 201 + - 200 + result_map: + name: $b{$.serviceName} + version: $b{$.version} + url: $b{$.url} + status: $b{$.status} + nodes: $b{$.nodes[*].ip}:$b{$.nodes[*].port} + location: $h{Location} + + sample_response: + body: {"serviceName":"test","version":"v1","url":"/api/test/v1","protocol":"REST","visualRange":"1","lb_policy":"hash","nodes":[{"ip":"127.0.0.1","port":"8012","ttl":0,"nodeId":"test_127.0.0.1_8012","expiration":"2017-02-10T05:33:25Z","created_at":"2017-02-10T05:33:25Z","updated_at":"2017-02-10T05:33:25Z"}],"status":"1"}
\ No newline at end of file diff --git a/profiles/http/src/test/resources/sample-test-schema-no-auth-no-catalog.yaml b/profiles/http/src/test/resources/sample-test-schema-no-auth-no-catalog.yaml new file mode 100644 index 00000000..2629a2f9 --- /dev/null +++ b/profiles/http/src/test/resources/sample-test-schema-no-auth-no-catalog.yaml @@ -0,0 +1,26 @@ +open_cli_schema_version: 1.0 + +name: sample-cmd-no-auth-no-catalog + +description: sample + +info: + product: open-cli + service: test + type: cmd + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com + +http: + + service: + name: sample + version: v1 + auth: none + mode: direct + request: + uri: /test + method: GET + success_codes: + - 200 + result_map: + name: ${name} diff --git a/profiles/http/src/test/resources/sample-test-schema-no-auth-yes-catalog.yaml b/profiles/http/src/test/resources/sample-test-schema-no-auth-yes-catalog.yaml new file mode 100644 index 00000000..15b5bf0c --- /dev/null +++ b/profiles/http/src/test/resources/sample-test-schema-no-auth-yes-catalog.yaml @@ -0,0 +1,28 @@ +open_cli_schema_version: 1.0 + +name: sample-cmd-no-auth-no-catalog + +description: sample + + +info: + product: open-cli + service: test + type: cmd + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com + +http: + + service: + name: sample + version: v1 + auth: none + mode: catalog + + request: + uri: /test + method: GET + success_codes: + - 200 + result_map: + name: ${name} diff --git a/profiles/http/src/test/resources/sample-test-schema-swagger.yaml b/profiles/http/src/test/resources/sample-test-schema-swagger.yaml new file mode 100644 index 00000000..4108d4e6 --- /dev/null +++ b/profiles/http/src/test/resources/sample-test-schema-swagger.yaml @@ -0,0 +1,28 @@ +open_cli_schema_version: 1.0 +name: sample-test-swagger +description: Sample swagger command test. +info: + product: open-cli + service: test + type: cmd + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com +parameters: + - name: user + type: string + description: Oclip user + short_option: n + long_option: username + is_optional: false +results: + direction: portrait + attributes: + - name: name + description: Oclip user + scope: short + type: string +exec: + api: org.onap.common_services.auth.auth_service.client.api.DefaultApi + client: org.onap.common_services.auth.auth_service.client.invoker.ApiClient + entity: org.onap.common_services.auth.auth_service.client.model.User, username(userName), password, description + method: create + exception: org.onap.common_services.auth.auth_service.client.invoker.ApiException
\ No newline at end of file diff --git a/profiles/http/src/test/resources/sample-test-schema-yes-auth-no-catalog.yaml b/profiles/http/src/test/resources/sample-test-schema-yes-auth-no-catalog.yaml new file mode 100644 index 00000000..bb0ae46b --- /dev/null +++ b/profiles/http/src/test/resources/sample-test-schema-yes-auth-no-catalog.yaml @@ -0,0 +1,26 @@ +open_cli_schema_version: 1.0 + +name: sample-cmd-yes-auth-no-catalog + +description: sample + +info: + product: open-cli + service: test + type: cmd + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com + +http: + + service: + name: sample + version: v1 + auth: basic + mode: direct + request: + uri: /test + method: GET + success_codes: + - 200 + result_map: + name: ${name} diff --git a/profiles/http/src/test/resources/sample-test-schema-yes-auth-with-additional-params-no-catalog.yaml b/profiles/http/src/test/resources/sample-test-schema-yes-auth-with-additional-params-no-catalog.yaml new file mode 100644 index 00000000..a5a39f92 --- /dev/null +++ b/profiles/http/src/test/resources/sample-test-schema-yes-auth-with-additional-params-no-catalog.yaml @@ -0,0 +1,28 @@ +open_cli_schema_version: 1.0 + +name: sample-cmd-yes-auth-no-catalog-extra-params + +description: sample + + +info: + product: open-cli + service: test + type: cmd + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com + +http: + + service: + name: sample + version: v1 + auth: testauth + mode: catalog + + request: + uri: /test + method: GET + success_codes: + - 200 + result_map: + name: ${name} diff --git a/profiles/http/src/test/resources/sample-test-schema-yes-auth-yes-catalog.yaml b/profiles/http/src/test/resources/sample-test-schema-yes-auth-yes-catalog.yaml new file mode 100644 index 00000000..4efd4c51 --- /dev/null +++ b/profiles/http/src/test/resources/sample-test-schema-yes-auth-yes-catalog.yaml @@ -0,0 +1,28 @@ +open_cli_schema_version: 1.0 + +name: sample-cmd-no-auth-no-catalog + +description: sample + + +info: + product: open-cli + service: test + type: cmd + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com + +http: + + service: + name: sample + version: v1 + auth: basic + mode: catalog + + request: + uri: /test + method: GET + success_codes: + - 200 + result_map: + name: ${name} diff --git a/profiles/http/src/test/resources/schema-validate-http.yaml b/profiles/http/src/test/resources/schema-validate-http.yaml new file mode 100644 index 00000000..7bdafc56 --- /dev/null +++ b/profiles/http/src/test/resources/schema-validate-http.yaml @@ -0,0 +1,98 @@ +open_cli_schema_version: 1.0 +description: Register microservice into Onap +name: schema-validate +info: + product: open-cli + service: test + type: cmd + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com + +parameters: + - name: service-name1 + description: Oclip service name + type: string + short_option: x + long_option: service-name + is_optional: false + - name: service-version + description: Oclip service version + type: string + short_option: x + long_option: service-version + is_optional: false + - name: service-url + description: Oclip service base url + type: url1 + short_option: u + long_option: service-url + is_optional: false1 + - name: status + description: Oclip service status + type: digit + short_option: z + long_option: service-version + is_optional: true + default_value: 1 + - name: node-ip + description: Oclip service running node IP + type: string + - name: node-port + description: Oclip service running node port + type: string + - name: create-or-update + description: Oclip service create or update + type: cfbcv + default_value: true +results: + direction: portrait + attributes: + - name: name + description: Oclip service name + scope: short + type: string + - name: version + description: Oclip service version + scope: short + type: string + - name: status + description: Oclip service base url + scope: short + type: url + - name: status + description: Oclip service status + scope: short1 + type: digit + - name: nodes + description: Oclip service running nodes + scope: long + type: string + - name: location + description: Oclip service location + scope: long + type: url +http: + service: + name: msb + version: v1 + type: direct + auth: none + request: + uri: /services + method: POST1 + body: '{"serviceName":"${service}","serviceName":"${service-name}","version":"${service-version}","url":"${service-url}","protocol":"REST","visualRange":"1","lb_policy":"hash","nodes":[{"ip":"${node-ip}","port":"${node-port}","ttl":0}]}' + headers: + queries: + createOrUpdate: ${create-or-update1} + success_codes: + - 201 + - 300 + result_map: + name: $b{$.serviceName} + version: $b{$.version} + url: $b{$.url} + status1: $b{$.status} + nodes: $b{$.nodes[*].ip}:$b{$.nodes[*].port} + location: $h{Location} + sample_response: + body: {"serviceName":"test","version":"v1","url":"/api/test/v1","protocol":"REST","visualRange":"1","lb_policy":"hash","nodes":[{"ip":"127.0.0.1","port":"8012","ttl":0,"nodeId":"test_127.0.0.1_8012","expiration":"2017-02-10T05:33:25Z","created_at":"2017-02-10T05:33:25Z","updated_at":"2017-02-10T05:33:25Z"}],"status":"1"} + |