diff options
author | Serban Jora <jora@research.att.com> | 2017-10-02 13:20:50 -0400 |
---|---|---|
committer | Serban Jora <jora@research.att.com> | 2017-10-02 14:33:47 -0400 |
commit | cba3b4f6a26aee3009a56b899a1cb9f093aba805 (patch) | |
tree | 063d570fb8f3390ced12a4ed10efc4388d68d392 /javatoscachecker/checker/src/test/resources/spec | |
parent | 53065490134870ead778bff590cfd9e43ddd9f77 (diff) |
Add unit testing
JUnit based testing added to the checker lib and service, work in progress.
Includes grammar correction.
Change-Id: I8fa950f89faba24e7b45ef41cbc0402362b3f394
Issue-Id: MODELING-26
Signed-off-by: Serban Jora <jora@research.att.com>
Diffstat (limited to 'javatoscachecker/checker/src/test/resources/spec')
30 files changed, 972 insertions, 0 deletions
diff --git a/javatoscachecker/checker/src/test/resources/spec/capability_types/basic.yaml b/javatoscachecker/checker/src/test/resources/spec/capability_types/basic.yaml new file mode 100644 index 0000000..6a6a036 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/capability_types/basic.yaml @@ -0,0 +1,11 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 +description: basic capability type + +metadata: + outcome: "success" + +capability_types: + org.onap.tosca.checker.capability.ElectricalSupply: + description: expresses the capability of a given environment ot host electric appliances + version: "1.0" + diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic.yaml new file mode 100644 index 0000000..c5f9abe --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic.yaml @@ -0,0 +1,25 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +metadata: + outcome: "success" + +data_types: + org.onap.tosca.checker.SomeDataType: + properties: + firstName: + type: string + required: true + lastName: + type: string + required: true + streetNo: + type: integer + required: true + streetName: + type: string + required: true + state: + type: string + constraints: + - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY] + diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_defaults.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_defaults.yaml new file mode 100644 index 0000000..7b39309 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_defaults.yaml @@ -0,0 +1,27 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +metadata: + outcome: "success" + +data_types: + org.onap.tosca.checker.SomeDataType: + properties: + firstName: + type: string + required: true + lastName: + type: string + required: true + streetNo: + type: integer + required: true + default: 1 + streetName: + type: string + required: true + state: + type: string + default: VA + constraints: + - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY] + diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_default_bad_type.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_default_bad_type.yaml new file mode 100644 index 0000000..550a8b1 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_default_bad_type.yaml @@ -0,0 +1,27 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +metadata: + outcome: "fail" + error: "" + +data_types: + org.onap.tosca.checker.SomeDataType: + properties: + firstName: + type: string + required: true + lastName: + type: string + required: true + streetNo: + type: integer + required: true + default: negative + streetName: + type: string + required: true + state: + type: string + constraints: + - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY] + diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_default_unknown_value.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_default_unknown_value.yaml new file mode 100644 index 0000000..6eb4db2 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_default_unknown_value.yaml @@ -0,0 +1,27 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +metadata: + outcome: "fail" + error: "" + +data_types: + org.onap.tosca.checker.SomeDataType: + properties: + firstName: + type: string + required: true + lastName: + type: string + required: true + streetNo: + type: integer + required: true + streetName: + type: string + required: true + state: + type: string + default: "XX" + constraints: + - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY] + diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_property_type.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_property_type.yaml new file mode 100644 index 0000000..2fdd4c4 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_property_type.yaml @@ -0,0 +1,26 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +metadata: + outcome: "fail" + error: "" + +data_types: + org.onap.tosca.checker.SomeDataType: + properties: + firstName: + type: strong + required: true + lastName: + type: string + required: true + streetNo: + type: integer + required: true + streetName: + type: string + required: true + state: + type: string + constraints: + - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY] + diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_required_value.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_required_value.yaml new file mode 100644 index 0000000..8546430 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_basic_with_invalid_required_value.yaml @@ -0,0 +1,27 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +metadata: + outcome: "fail" + error: "" + +data_types: + org.onap.tosca.checker.SomeDataType: + properties: + firstName: + type: string + required: true + lastName: + type: string + required: maybe + streetNo: + type: integer + required: true + streetName: + type: string + required: true + default: 1 + state: + type: string + constraints: + - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY] + diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_nested.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_nested.yaml new file mode 100644 index 0000000..04d6a36 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_nested.yaml @@ -0,0 +1,33 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +metadata: + outcome: "success" + +data_types: + org.onap.tosca.checker.SomeDataType: + properties: + firstName: + type: string + required: true + lastName: + type: string + required: true + streetNo: + type: integer + required: true + streetName: + type: string + required: true + state: + type: string + constraints: + - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY] + + org.onap.tosca.SomeOtherDataType: + properties: + teamName: + type: string + required: true + players: + type: list + entry_schema: org.onap.tosca.checker.SomeDataType diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_redeclared.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_redeclared.yaml new file mode 100644 index 0000000..89ad5e4 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_redeclared.yaml @@ -0,0 +1,18 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +metadata: + outcome: "fail" + error: "" + +data_types: + org.onap.tosca.checker.SomeDataType: + properties: + firstName: + type: string + required: true + + org.onap.tosca.checker.SomeDataType: + lastName: + type: string + required: true + diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_collections.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_collections.yaml new file mode 100644 index 0000000..deefb94 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_collections.yaml @@ -0,0 +1,30 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +metadata: + outcome: "success" + +data_types: + org.onap.tosca.checker.SomeDataType: + properties: + firstName: + type: string + required: true + lastName: + type: string + required: true + nicknames: + type: list + required: false + entry_schema: + type: string + streetNo: + type: integer + required: true + streetName: + type: string + required: true + state: + type: string + constraints: + - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY] + diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_common_supertype.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_common_supertype.yaml new file mode 100644 index 0000000..a2cc7c4 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_common_supertype.yaml @@ -0,0 +1,26 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +metadata: + outcome: "success" + +data_types: + org.onap.tosca.checker.SomeDataType: + derived_from: tosca.datatypes.Root + properties: + firstName: + type: string + required: true + lastName: + type: string + required: true + streetNo: + type: integer + required: true + streetName: + type: string + required: true + state: + type: string + constraints: + - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY] + diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy.yaml new file mode 100644 index 0000000..de72e7d --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy.yaml @@ -0,0 +1,29 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +metadata: + outcome: "success" + +data_types: + org.onap.tosca.checker.SomeBaseDataType: + properties: + firstName: + type: string + required: true + lastName: + type: string + required: true + + org.onap.tosca.checker.SomeDataType: + derived_from: org.onap.tosca.checker.SomeBaseDataType + properties: + streetNo: + type: integer + required: true + streetName: + type: string + required: true + state: + type: string + constraints: + - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY] + diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy_and_invalid_redefinition.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy_and_invalid_redefinition.yaml new file mode 100644 index 0000000..6364a9b --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy_and_invalid_redefinition.yaml @@ -0,0 +1,33 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 +description: redefines the type of a property + +metadata: + outcome: "fail" + +data_types: + org.onap.tosca.checker.SomeBaseDataType: + properties: + firstName: + type: string + required: true + lastName: + type: string + required: true + + org.onap.tosca.checker.SomeDataType: + derived_from: org.onap.tosca.checker.SomeBaseDataType + properties: + firstName: + type: integer + required: true + streetNo: + type: integer + required: true + streetName: + type: string + required: true + state: + type: string + constraints: + - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY] + diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy_and_redefinition.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy_and_redefinition.yaml new file mode 100644 index 0000000..8726012 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_hierarchy_and_redefinition.yaml @@ -0,0 +1,33 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 +description: redefines the required flag of a property + +metadata: + outcome: "success" + +data_types: + org.onap.tosca.checker.SomeBaseDataType: + properties: + firstName: + type: string + required: true + lastName: + type: string + required: true + + org.onap.tosca.checker.SomeDataType: + derived_from: org.onap.tosca.checker.SomeBaseDataType + properties: + firstName: + type: string + required: false + streetNo: + type: integer + required: true + streetName: + type: string + required: true + state: + type: string + constraints: + - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY] + diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_invalid_entry_schema_type.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_invalid_entry_schema_type.yaml new file mode 100644 index 0000000..d53cd1b --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_invalid_entry_schema_type.yaml @@ -0,0 +1,30 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +metadata: + outcome: "fail" + error: "" + +data_types: + org.onap.tosca.checker.SomeDataType: + properties: + firstName: + type: string + required: true + lastName: + type: string + required: true + nicknames: + type: list + entry_schema: + type: strong + streetNo: + type: integer + required: true + streetName: + type: string + required: true + state: + type: string + constraints: + - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY] + diff --git a/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_unknown_supertype.yaml b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_unknown_supertype.yaml new file mode 100644 index 0000000..483dd70 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/data_types/user_defined_with_unknown_supertype.yaml @@ -0,0 +1,27 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +metadata: + outcome: "fail" + error: "" + +data_types: + org.onap.tosca.checker.SomeDataType: + derived_from: tosca.datatypes.Rooter + properties: + firstName: + type: string + required: true + lastName: + type: string + required: true + streetNo: + type: integer + required: true + streetName: + type: string + required: true + state: + type: string + constraints: + - valid_values: [AK,AL,AR,AZ,CA,CO,CT,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VA,VT,WA,WI,WV,WY] + diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.11.3.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.11.3.yaml new file mode 100644 index 0000000..e79c827 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.11.3.yaml @@ -0,0 +1,49 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + TOSCA simple profile with 1 server bound to a new network + +metadata: + outcome: "success" + +imports: + - network: tosca/tosca-network-types.yaml + +topology_template: + + inputs: + network_name: + type: string + description: Network name + + node_templates: + my_server: + type: tosca.nodes.Compute + capabilities: + host: + properties: + disk_size: 10 GB + num_cpus: 1 + mem_size: 4096 MB + os: + properties: + architecture: x86_64 + type: Linux + distribution: CirrOS + version: 0.3.2 + + my_network: + type: tosca.nodes.network.Network + properties: + network_name: { get_input: network_name } + ip_version: 4 + cidr: '192.168.0.0/24' + start_ip: '192.168.0.50' + end_ip: '192.168.0.200' + gateway_ip: '192.168.0.1' + + my_port: + type: tosca.nodes.network.Port + requirements: + - binding: my_server + - link: my_network diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.12.3.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.12.3.yaml new file mode 100644 index 0000000..cbc2b24 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.12.3.yaml @@ -0,0 +1,45 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + TOSCA simple profile with 1 server bound to an existing network + +metadata: + outcome: "success" + +imports: + - network: tosca/tosca-network-types.yaml + +topology_template: + inputs: + network_name: + type: string + description: Network name + + node_templates: + my_server: + type: tosca.nodes.Compute + capabilities: + host: + properties: + disk_size: 10 GB + num_cpus: 1 + mem_size: 4096 MB + os: + properties: + architecture: x86_64 + type: Linux + distribution: CirrOS + version: 0.3.2 + + my_network: + type: tosca.nodes.network.Network + properties: + network_name: { get_input: network_name } + + my_port: + type: tosca.nodes.network.Port + requirements: + - binding: + node: my_server + - link: + node: my_network diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.15.3.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.15.3.yaml new file mode 100644 index 0000000..0efd978 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-11.1.15.3.yaml @@ -0,0 +1,114 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + TOSCA simple profile with WordPress, a web server, a MySQL DBMS hosting the application’s database content on the same server. Does not have input defaults or constraints. + +# well, whomever wrote this example .. there are references to non-existent template and interface inputs. +metadata: + outcome: "fail" + +imports: + - network: tosca/tosca-network-types.yaml + - examples: tosca/tosca-examples-types.yaml + +topology_template: + inputs: + cpus: + type: integer + description: Number of CPUs for the server. + db_name: + type: string + description: The name of the database. + db_user: + type: string + description: The username of the DB user. + db_pwd: + type: string + description: The WordPress database admin account password. + db_root_pwd: + type: string + description: Root password for MySQL. + db_port: + type: tosca.datatypes.network.PortDef + description: Port for the MySQL database + + node_templates: + wordpress: + type: tosca.nodes.WebApplication.WordPress + properties: + context_root: { get_input: context_root } + requirements: + - host: webserver + - database_endpoint: mysql_database + interfaces: + Standard: + create: wordpress_install.sh + configure: + implementation: wordpress_configure.sh + inputs: + wp_db_name: { get_property: [ mysql_database, name ] } + wp_db_user: { get_property: [ mysql_database, user ] } + wp_db_password: { get_property: [ mysql_database, password ] } + # In my own template, find requirement/capability, find port property + wp_db_port: { get_property: [ SELF, database_endpoint, port ] } + + mysql_database: + type: tosca.nodes.Database + properties: + name: { get_input: db_name } + user: { get_input: db_user } + password: { get_input: db_pwd } + port: { get_input: db_port } + capabilities: + database_endpoint: + properties: + port: { get_input: db_port } + requirements: + - host: mysql_dbms + interfaces: + Standard: + configure: mysql_database_configure.sh + + mysql_dbms: + type: tosca.nodes.DBMS + properties: + root_password: { get_input: db_root_pwd } + port: { get_input: db_port } + requirements: + - host: server + interfaces: + Standard: + inputs: + db_root_password: { get_property: [ mysql_dbms, root_password ] } + create: mysql_dbms_install.sh + start: mysql_dbms_start.sh + configure: mysql_dbms_configure.sh + + webserver: + type: tosca.nodes.WebServer + requirements: + - host: server + interfaces: + Standard: + create: webserver_install.sh + start: webserver_start.sh + + server: + type: tosca.nodes.Compute + capabilities: + host: + properties: + disk_size: 10 GB + num_cpus: { get_input: cpus } + mem_size: 4096 MB + os: + properties: + architecture: x86_64 + type: linux + distribution: fedora + version: 17.0 + + outputs: + website_url: + description: URL for Wordpress wiki. + value: { get_attribute: [server, public_address] } diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-2.1.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-2.1.yaml new file mode 100644 index 0000000..e8d5538 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-2.1.yaml @@ -0,0 +1,25 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 +description: Template for deploying a single server with predefined properties. + +metadata: + outcome: "success" + +topology_template: + node_templates: + my_server: + type: tosca.nodes.Compute + capabilities: + # Host container properties + host: + properties: + num_cpus: 1 + disk_size: 10 GB + mem_size: 4096 MB + # Guest Operating System properties + os: + properties: + # host Operating System image properties + architecture: x86_64 + type: linux + distribution: rhel + version: 6.5 diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-5.3.2.2.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-5.3.2.2.yaml new file mode 100644 index 0000000..65f0aea --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-5.3.2.2.yaml @@ -0,0 +1,27 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 +description: expected to fail as this redeclares a common type (and the checker provides them by default) + +metadata: + outcome: "fail" + +data_types: + + tosca.datatypes.Credential: + derived_from: tosca.datatypes.Root + properties: + protocol: + type: string + required: false + token_type: + type: string + default: password + token: + type: string + keys: + type: map + required: false + entry_schema: + type: string + user: + type: string + required: false diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.3.1.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.3.1.yaml new file mode 100644 index 0000000..7e6e375 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.3.1.yaml @@ -0,0 +1,39 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +#it fails because DBMS node type has no Backup interface defined + +metadata: + outcome: "fail" + +imports: + - examples: tosca/tosca-examples-types.yaml + +topology_template: + node_templates: + my_server: + type: tosca.nodes.Compute + mysql: + type: tosca.nodes.DBMS.MySQL + requirements: + - host: my_server + interfaces: + tosca.interfaces.nodes.custom.Backup: + backup: backup.sh + workflows: + backup: + description: Performs a snapshot of the MySQL data. + preconditions: + - target: my_server + condition: + - assert: + - state: [{equal: available}] + - target: mysql + condition: + - assert: + - state: [{valid_values: [started, available]}] + - my_attribute: [{equal: ready }] + steps: + my_step: + target: mysql + activities: + - call_operation: tosca.interfaces.nodes.custom.Backup.backup diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.5-invalid-version.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.5-invalid-version.yaml new file mode 100644 index 0000000..d86177a --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.5-invalid-version.yaml @@ -0,0 +1,45 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +metadata: + outcome: "fail" + +imports: + - examples: tosca/tosca-examples-types.yaml + +topology_template: + node_templates: + my_server: + type: tosca.nodes.Compute + db: + type: tosca.nodes.DBMS.MySQL + requirements: + - host: my_server + interfaces: + Standard: + stop: stop.sh + + workflows: + backup: + description: Performs a snapshot of the MySQL data. + preconditions: + - target: my_server + condition: + - assert: + - state: [{equal: available}] + - target: my_server + condition: + - assert: + - state: [{valid_values: [started, available]}] + - my_attribute: [{equal: ready }] + steps: + backup_step: + target: db + filter: # filter is a list of clauses. Matching between clauses is and. + - or: # only one of sub-clauses must be true. + - assert: + - foo: [{equals: true}] + - assert: + - bar: [{greater_than: 2}, {less_than: 20}] + activities: + - call_operation: tosca.interfaces.node.lifecycle.Standard.stop + diff --git a/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.5.yaml b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.5.yaml new file mode 100644 index 0000000..b26f53a --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/examples/spec-example-7.3.5.yaml @@ -0,0 +1,42 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +imports: + - examples: tosca/tosca-examples-types.yaml + +topology_template: + node_templates: + my_server: + type: tosca.nodes.Compute + db: + type: tosca.nodes.DBMS.MySQL + requirements: + - host: my_server + interfaces: + Standard: + stop: stop.sh + + workflows: + backup: + description: Performs a snapshot of the MySQL data. + preconditions: + - target: my_server + condition: + - assert: + - state: [{equal: available}] + - target: my_server + condition: + - assert: + - state: [{valid_values: [started, available]}] + - my_attribute: [{equal: ready }] + steps: + backup_step: + target: db + filter: # filter is a list of clauses. Matching between clauses is and. + - or: # only one of sub-clauses must be true. + - assert: + - foo: [{equals: true}] + - assert: + - bar: [{greater_than: 2}, {less_than: 20}] + activities: + - call_operation: Standard.stop + diff --git a/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_basic.yaml b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_basic.yaml new file mode 100644 index 0000000..0600a12 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_basic.yaml @@ -0,0 +1,26 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +metadata: + outcome: "success" + +node_types: + org.onap.tosca.checker.Appliance: + properties: + brand: + type: string + required: true + color: + type: string + required: true + warrantyDuration: + type: string + required: true + price: + type: float + required: true + power_type: + type: string + default: "electric" + constraints: + - valid_values: ["electric", "gas"] + diff --git a/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_hierarchy.yaml b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_hierarchy.yaml new file mode 100644 index 0000000..b095297 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_hierarchy.yaml @@ -0,0 +1,44 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +metadata: + outcome: "success" + +node_types: + org.onap.tosca.checker.Appliance: + properties: + brand: + type: string + required: true + color: + type: string + required: true + warrantyDuration: + type: string + required: true + price: + type: float + required: true + power_type: + type: string + default: "electric" + constraints: + - valid_values: ["electric", "gas"] + + org.onap.tosca.checker.Dishwasher: + derived_from: org.onap.tosca.checker.Appliance + properties: + waterFiltration: + type: boolean + required: false + default: false + numberOfCycles: + type: integer + required: false + rackMaterial: + type: string + required: true + energyStar: + type: boolean + required: true + + diff --git a/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_invalid_hierarchy.yaml b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_invalid_hierarchy.yaml new file mode 100644 index 0000000..d71d466 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_invalid_hierarchy.yaml @@ -0,0 +1,10 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 +description: reference to non-existing super type + +metadata: + outcome: "fail" + +node_types: + org.onap.tosca.checker.Appliance: + derived_from: org.onap.tosca.checker.Object + diff --git a/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_user_defined_properties.yaml b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_user_defined_properties.yaml new file mode 100644 index 0000000..752a973 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/node_types/node_type_with_user_defined_properties.yaml @@ -0,0 +1,29 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 +description: defines a property of a user defined data type + +metadata: + outcome: "success" + +imports: + - basic: "spec/node_types/node_type_basic.yaml" + +data_types: + org.onap.tosca.checker.SmartHouseSupport: + properties: + alexaSupport: + type: boolean + default: false + homekitSuppport: + type: boolean + default: false + googlehomeSupport: + type: boolean + default: false + +node_types: + org.onap.tosca.checker.SmartAppliance: + derived_from: org.onap.tosca.checker.Appliance + properties: + environmentSupport: + type: org.onap.tosca.checker.SmartHouseSupport + diff --git a/javatoscachecker/checker/src/test/resources/spec/topology_template/basic.yaml b/javatoscachecker/checker/src/test/resources/spec/topology_template/basic.yaml new file mode 100644 index 0000000..66ff83d --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/topology_template/basic.yaml @@ -0,0 +1,24 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 +description: test basic property value assignment + +metadata: + outcome: "success" + +imports: + - appliances: spec/node_types/node_type_with_hierarchy.yaml + +topology_template: + + node_templates: + dishwasher: + type: org.onap.tosca.checker.Dishwasher + properties: + brand: Samsung + color: white + warrantyDuration: 1 year + price: 550 + numberOfCycles: 6 + rackMaterial: stainless + energyStar: false + + diff --git a/javatoscachecker/checker/src/test/resources/spec/topology_template/basic_invalid_property_assignment.yaml b/javatoscachecker/checker/src/test/resources/spec/topology_template/basic_invalid_property_assignment.yaml new file mode 100644 index 0000000..bb418a7 --- /dev/null +++ b/javatoscachecker/checker/src/test/resources/spec/topology_template/basic_invalid_property_assignment.yaml @@ -0,0 +1,24 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 +description: test invalid property value assignment (numberOfCycles expects an integer) + +metadata: + outcome: "fail" + +imports: + - appliances: spec/node_types/node_type_with_hierarchy.yaml + +topology_template: + + node_templates: + dishwasher: + type: org.onap.tosca.checker.Dishwasher + properties: + brand: Samsung + color: white + warrantyDuration: 1 year + price: 550 + numberOfCycles: unknown + rackMaterial: stainless + energyStar: false + + |