occi-core 4.3.6 → 5.0.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.fasterer.yml +3 -0
- data/.gitignore +9 -16
- data/.rspec +1 -1
- data/.rubocop.yml +69 -0
- data/.travis.yml +27 -0
- data/AUTHORS +8 -6
- data/CHANGELOG.md +0 -0
- data/Gemfile +1 -1
- data/LICENSE +1 -1
- data/README.md +25 -170
- data/Rakefile +25 -17
- data/examples/initialize_model.rb +10 -0
- data/examples/parse_action_instance_json.rb +15 -0
- data/examples/parse_action_instance_text.rb +15 -0
- data/examples/parse_categories_json.rb +15 -0
- data/examples/parse_categories_text.rb +15 -0
- data/examples/parse_instance_json.rb +15 -0
- data/examples/parse_instance_text.rb +15 -0
- data/examples/parse_model_json.rb +9 -0
- data/examples/parse_model_text.rb +9 -0
- data/examples/render_action_instance_json.rb +17 -0
- data/examples/render_action_instance_text.rb +17 -0
- data/examples/render_instance_json.rb +20 -0
- data/examples/render_instance_text.rb +20 -0
- data/examples/render_model_json.rb +12 -0
- data/examples/render_model_text.rb +12 -0
- data/examples/rendering/action_instance.json +6 -0
- data/examples/rendering/action_instance.txt +2 -0
- data/examples/rendering/categories.json +78 -0
- data/examples/rendering/categories.txt +4 -0
- data/examples/rendering/instance.json +70 -0
- data/examples/rendering/instance.txt +12 -0
- data/examples/rendering/model.alt.json +1716 -0
- data/examples/rendering/model.json +785 -0
- data/examples/rendering/model.txt +68 -0
- data/lib/occi/core/action.rb +12 -26
- data/lib/occi/core/action_instance.rb +109 -65
- data/lib/occi/core/attribute.rb +136 -0
- data/lib/occi/core/attribute_definition.rb +269 -0
- data/lib/occi/core/category.rb +110 -83
- data/lib/occi/core/collection.rb +255 -0
- data/lib/occi/core/constants.rb +14 -0
- data/lib/occi/core/entity.rb +301 -195
- data/lib/occi/core/errors/.gitkeep +0 -0
- data/lib/occi/core/errors/attribute_definition_error.rb +11 -0
- data/lib/occi/core/errors/attribute_validation_error.rb +13 -0
- data/lib/occi/core/errors/category_validation_error.rb +13 -0
- data/lib/occi/core/errors/collection_lookup_error.rb +11 -0
- data/lib/occi/core/errors/instance_validation_error.rb +13 -0
- data/lib/occi/core/errors/mandatory_argument_error.rb +11 -0
- data/lib/occi/core/errors/model_lookup_error.rb +11 -0
- data/lib/occi/core/errors/parser_error.rb +11 -0
- data/lib/occi/core/errors/parsing_error.rb +11 -0
- data/lib/occi/core/errors/renderer_error.rb +11 -0
- data/lib/occi/core/errors/rendering_error.rb +11 -0
- data/lib/occi/core/errors/validation_error.rb +11 -0
- data/lib/occi/core/errors.rb +9 -0
- data/lib/occi/core/helpers/.gitkeep +0 -0
- data/lib/occi/core/helpers/argument_validator.rb +27 -0
- data/lib/occi/core/helpers/attributes_accessor.rb +22 -0
- data/lib/occi/core/helpers/error_handler.rb +29 -0
- data/lib/occi/core/helpers/hash_dereferencer.rb +149 -0
- data/lib/occi/core/helpers/identifier_validator.rb +135 -0
- data/lib/occi/core/helpers/instance_attribute_resetter.rb +131 -0
- data/lib/occi/core/helpers/instance_attributes_accessor.rb +30 -0
- data/lib/occi/core/helpers/locatable.rb +40 -0
- data/lib/occi/core/helpers/parser_dereferencer.rb +96 -0
- data/lib/occi/core/helpers/raw_json_parser.rb +18 -0
- data/lib/occi/core/helpers/renderable.rb +93 -0
- data/lib/occi/core/helpers/yaml_summoner.rb +44 -0
- data/lib/occi/core/helpers.rb +13 -0
- data/lib/occi/core/instance_builder.rb +162 -0
- data/lib/occi/core/kind.rb +100 -132
- data/lib/occi/core/link.rb +47 -72
- data/lib/occi/core/mixin.rb +76 -61
- data/lib/occi/core/model.rb +341 -0
- data/lib/occi/core/parsers/.gitkeep +0 -0
- data/lib/occi/core/parsers/base_parser.rb +168 -0
- data/lib/occi/core/parsers/json/.gitkeep +0 -0
- data/lib/occi/core/parsers/json/action_instance.rb +36 -0
- data/lib/occi/core/parsers/json/category.rb +113 -0
- data/lib/occi/core/parsers/json/entity.rb +156 -0
- data/lib/occi/core/parsers/json/validator/.gitkeep +0 -0
- data/lib/occi/core/parsers/json/validator/action-instance.json +3 -0
- data/lib/occi/core/parsers/json/validator/entity-collection.json +3 -0
- data/lib/occi/core/parsers/json/validator/link-collection.json +3 -0
- data/lib/occi/core/parsers/json/validator/link.json +3 -0
- data/lib/occi/core/parsers/json/validator/locations.json +3 -0
- data/lib/occi/core/parsers/json/validator/mixin-collection.json +3 -0
- data/lib/occi/core/parsers/json/validator/model.json +3 -0
- data/lib/occi/core/parsers/json/validator/occi-schema.json +277 -0
- data/lib/occi/core/parsers/json/validator/resource-collection.json +3 -0
- data/lib/occi/core/parsers/json/validator/resource.json +3 -0
- data/lib/occi/core/parsers/json/validator.rb +87 -0
- data/lib/occi/core/parsers/json_parser.rb +128 -0
- data/lib/occi/core/parsers/text/.gitkeep +0 -0
- data/lib/occi/core/parsers/text/category.rb +183 -0
- data/lib/occi/core/parsers/text/constants.rb +89 -0
- data/lib/occi/core/parsers/text/entity.rb +257 -0
- data/lib/occi/core/parsers/text/location.rb +48 -0
- data/lib/occi/core/parsers/text_parser.rb +257 -0
- data/lib/occi/core/parsers.rb +18 -0
- data/lib/occi/core/renderer_factory.rb +213 -0
- data/lib/occi/core/renderers/.gitkeep +0 -0
- data/lib/occi/core/renderers/base_renderer.rb +81 -0
- data/lib/occi/core/renderers/json/.gitkeep +0 -0
- data/lib/occi/core/renderers/json/action_instance.rb +24 -0
- data/lib/occi/core/renderers/json/attributes.rb +50 -0
- data/lib/occi/core/renderers/json/base.rb +46 -0
- data/lib/occi/core/renderers/json/category.rb +85 -0
- data/lib/occi/core/renderers/json/collection.rb +52 -0
- data/lib/occi/core/renderers/json/instance.rb +39 -0
- data/lib/occi/core/renderers/json/link.rb +48 -0
- data/lib/occi/core/renderers/json/model.rb +26 -0
- data/lib/occi/core/renderers/json/resource.rb +27 -0
- data/lib/occi/core/renderers/json_renderer.rb +72 -0
- data/lib/occi/core/renderers/text/.gitkeep +0 -0
- data/lib/occi/core/renderers/text/action_instance.rb +36 -0
- data/lib/occi/core/renderers/text/attributes.rb +87 -0
- data/lib/occi/core/renderers/text/base.rb +82 -0
- data/lib/occi/core/renderers/text/category.rb +183 -0
- data/lib/occi/core/renderers/text/collection.rb +65 -0
- data/lib/occi/core/renderers/text/instance.rb +44 -0
- data/lib/occi/core/renderers/text/link.rb +40 -0
- data/lib/occi/core/renderers/text/model.rb +41 -0
- data/lib/occi/core/renderers/text/resource.rb +109 -0
- data/lib/occi/core/renderers/text_renderer.rb +72 -0
- data/lib/occi/core/renderers.rb +20 -0
- data/lib/occi/core/resource.rb +93 -57
- data/lib/occi/core/utils/.gitkeep +0 -0
- data/lib/occi/core/version.rb +17 -0
- data/lib/occi/core/warehouse/actions/.gitkeep +0 -0
- data/lib/occi/core/warehouse/actions/attributes/.gitkeep +0 -0
- data/lib/occi/core/warehouse/kinds/.gitkeep +0 -0
- data/lib/occi/core/warehouse/kinds/attributes/.gitkeep +0 -0
- data/lib/occi/core/warehouse/kinds/attributes/occi.core.id.yml +7 -0
- data/lib/occi/core/warehouse/kinds/attributes/occi.core.source.yml +7 -0
- data/lib/occi/core/warehouse/kinds/attributes/occi.core.summary.yml +7 -0
- data/lib/occi/core/warehouse/kinds/attributes/occi.core.target.yml +7 -0
- data/lib/occi/core/warehouse/kinds/attributes/occi.core.title.yml +7 -0
- data/lib/occi/core/warehouse/kinds/entity.yml +10 -0
- data/lib/occi/core/warehouse/kinds/link.yml +10 -0
- data/lib/occi/core/warehouse/kinds/resource.yml +9 -0
- data/lib/occi/core/warehouse/mixins/.gitkeep +0 -0
- data/lib/occi/core/warehouse/mixins/attributes/.gitkeep +0 -0
- data/lib/occi/core/warehouse.rb +115 -0
- data/lib/occi/core.rb +59 -23
- data/lib/occi/infrastructure/compute.rb +5 -122
- data/lib/occi/infrastructure/constants.rb +25 -0
- data/lib/occi/infrastructure/instance_builder.rb +24 -0
- data/lib/occi/infrastructure/mixins/.gitkeep +0 -0
- data/lib/occi/infrastructure/mixins/os_tpl.rb +19 -0
- data/lib/occi/infrastructure/mixins/resource_tpl.rb +19 -0
- data/lib/occi/infrastructure/mixins.rb +12 -0
- data/lib/occi/infrastructure/model.rb +27 -0
- data/lib/occi/infrastructure/network.rb +5 -104
- data/lib/occi/infrastructure/networkinterface.rb +5 -100
- data/lib/occi/infrastructure/storage.rb +5 -59
- data/lib/occi/infrastructure/storagelink.rb +5 -54
- data/lib/occi/infrastructure/version.rb +5 -0
- data/lib/occi/infrastructure/warehouse/actions/.gitkeep +0 -0
- data/lib/occi/infrastructure/warehouse/actions/attributes/.gitkeep +0 -0
- data/lib/occi/infrastructure/warehouse/actions/compute_restart.yml +12 -0
- data/lib/occi/infrastructure/warehouse/actions/compute_save.yml +19 -0
- data/lib/occi/infrastructure/warehouse/actions/compute_start.yml +4 -0
- data/lib/occi/infrastructure/warehouse/actions/compute_stop.yml +12 -0
- data/lib/occi/infrastructure/warehouse/actions/compute_suspend.yml +12 -0
- data/lib/occi/infrastructure/warehouse/actions/network_down.yml +4 -0
- data/lib/occi/infrastructure/warehouse/actions/network_up.yml +4 -0
- data/lib/occi/infrastructure/warehouse/actions/networkinterface_down.yml +4 -0
- data/lib/occi/infrastructure/warehouse/actions/networkinterface_up.yml +4 -0
- data/lib/occi/infrastructure/warehouse/actions/storage_backup.yml +4 -0
- data/lib/occi/infrastructure/warehouse/actions/storage_offline.yml +4 -0
- data/lib/occi/infrastructure/warehouse/actions/storage_online.yml +4 -0
- data/lib/occi/infrastructure/warehouse/actions/storage_resize.yml +12 -0
- data/lib/occi/infrastructure/warehouse/actions/storage_snapshot.yml +4 -0
- data/lib/occi/infrastructure/warehouse/actions/storagelink_offline.yml +4 -0
- data/lib/occi/infrastructure/warehouse/actions/storagelink_online.yml +4 -0
- data/lib/occi/infrastructure/warehouse/kinds/.gitkeep +0 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/.gitkeep +0 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.compute.architecture.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.compute.cores.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.compute.hostname.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.compute.memory.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.compute.speed.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.compute.state.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.network.label.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.network.state.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.network.vlan.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.networkinterface.interface.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.networkinterface.mac.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.networkinterface.state.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.storage.size.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.storage.state.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.storagelink.deviceid.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.storagelink.mountpoint.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/attributes/occi.storagelink.state.yml +7 -0
- data/lib/occi/infrastructure/warehouse/kinds/compute.yml +19 -0
- data/lib/occi/infrastructure/warehouse/kinds/network.yml +13 -0
- data/lib/occi/infrastructure/warehouse/kinds/networkinterface.yml +13 -0
- data/lib/occi/infrastructure/warehouse/kinds/storage.yml +15 -0
- data/lib/occi/infrastructure/warehouse/kinds/storagelink.yml +13 -0
- data/lib/occi/infrastructure/warehouse/mixins/.gitkeep +0 -0
- data/lib/occi/infrastructure/warehouse/mixins/attributes/.gitkeep +0 -0
- data/lib/occi/infrastructure/warehouse/mixins/attributes/occi.network.address.yml +7 -0
- data/lib/occi/infrastructure/warehouse/mixins/attributes/occi.network.allocation.yml +7 -0
- data/lib/occi/infrastructure/warehouse/mixins/attributes/occi.network.gateway.yml +7 -0
- data/lib/occi/infrastructure/warehouse/mixins/attributes/occi.networkinterface.address.yml +7 -0
- data/lib/occi/infrastructure/warehouse/mixins/attributes/occi.networkinterface.allocation.yml +7 -0
- data/lib/occi/infrastructure/warehouse/mixins/attributes/occi.networkinterface.gateway.yml +7 -0
- data/lib/occi/infrastructure/warehouse/mixins/ipnetwork.yml +11 -0
- data/lib/occi/infrastructure/warehouse/mixins/ipnetworkinterface.yml +11 -0
- data/lib/occi/infrastructure/warehouse.rb +20 -0
- data/lib/occi/infrastructure-ext.rb +35 -0
- data/lib/occi/infrastructure.rb +34 -19
- data/lib/occi/infrastructure_ext/constants.rb +20 -0
- data/lib/occi/infrastructure_ext/instance_builder.rb +22 -0
- data/lib/occi/infrastructure_ext/ipreservation.rb +9 -0
- data/lib/occi/infrastructure_ext/mixins/.gitkeep +0 -0
- data/lib/occi/infrastructure_ext/mixins/availability_zone.rb +19 -0
- data/lib/occi/infrastructure_ext/mixins.rb +12 -0
- data/lib/occi/infrastructure_ext/model.rb +26 -0
- data/lib/occi/infrastructure_ext/securitygroup.rb +9 -0
- data/lib/occi/infrastructure_ext/securitygrouplink.rb +9 -0
- data/lib/occi/infrastructure_ext/version.rb +5 -0
- data/lib/occi/infrastructure_ext/warehouse/actions/.gitkeep +0 -0
- data/lib/occi/infrastructure_ext/warehouse/actions/attributes/.gitkeep +0 -0
- data/lib/occi/infrastructure_ext/warehouse/actions/ipreservation_down.yml +4 -0
- data/lib/occi/infrastructure_ext/warehouse/actions/ipreservation_up.yml +4 -0
- data/lib/occi/infrastructure_ext/warehouse/kinds/.gitkeep +0 -0
- data/lib/occi/infrastructure_ext/warehouse/kinds/attributes/.gitkeep +0 -0
- data/lib/occi/infrastructure_ext/warehouse/kinds/attributes/occi.ipreservation.address.yml +7 -0
- data/lib/occi/infrastructure_ext/warehouse/kinds/attributes/occi.ipreservation.state.yml +7 -0
- data/lib/occi/infrastructure_ext/warehouse/kinds/attributes/occi.ipreservation.used.yml +7 -0
- data/lib/occi/infrastructure_ext/warehouse/kinds/attributes/occi.securitygroup.rules.yml +7 -0
- data/lib/occi/infrastructure_ext/warehouse/kinds/attributes/occi.securitygroup.state.yml +7 -0
- data/lib/occi/infrastructure_ext/warehouse/kinds/attributes/occi.securitygrouplink.state.yml +7 -0
- data/lib/occi/infrastructure_ext/warehouse/kinds/ipreservation.yml +13 -0
- data/lib/occi/infrastructure_ext/warehouse/kinds/securitygroup.yml +9 -0
- data/lib/occi/infrastructure_ext/warehouse/kinds/securitygrouplink.yml +8 -0
- data/lib/occi/infrastructure_ext/warehouse/mixins/.gitkeep +0 -0
- data/lib/occi/infrastructure_ext/warehouse/mixins/attributes/.gitkeep +0 -0
- data/lib/occi/infrastructure_ext/warehouse.rb +20 -0
- data/lib/occi/monkey_island/boolean.rb +6 -0
- data/lib/occi/monkey_island/hash.rb +4 -0
- data/occi-core.gemspec +26 -26
- metadata +312 -243
- data/.yardopts +0 -1
- data/config/occi.yml +0 -4
- data/lib/occi/collection.rb +0 -265
- data/lib/occi/core/actions.rb +0 -21
- data/lib/occi/core/attributes.rb +0 -411
- data/lib/occi/core/categories.rb +0 -64
- data/lib/occi/core/dependencies.rb +0 -7
- data/lib/occi/core/entities.rb +0 -48
- data/lib/occi/core/kinds.rb +0 -22
- data/lib/occi/core/links.rb +0 -37
- data/lib/occi/core/mixins.rb +0 -37
- data/lib/occi/core/properties.rb +0 -108
- data/lib/occi/core/resources.rb +0 -14
- data/lib/occi/errors/attribute_definitions_converted_error.rb +0 -5
- data/lib/occi/errors/attribute_missing_error.rb +0 -5
- data/lib/occi/errors/attribute_name_invalid_error.rb +0 -5
- data/lib/occi/errors/attribute_not_defined_error.rb +0 -5
- data/lib/occi/errors/attribute_property_type_error.rb +0 -5
- data/lib/occi/errors/attribute_type_error.rb +0 -5
- data/lib/occi/errors/category_not_defined_error.rb +0 -5
- data/lib/occi/errors/kind_not_defined_error.rb +0 -5
- data/lib/occi/errors/parser_input_error.rb +0 -5
- data/lib/occi/errors/parser_type_error.rb +0 -5
- data/lib/occi/errors.rb +0 -1
- data/lib/occi/extensions/hashie.rb +0 -25
- data/lib/occi/helpers/comparators/action_instance.rb +0 -22
- data/lib/occi/helpers/comparators/attributes.rb +0 -22
- data/lib/occi/helpers/comparators/categories.rb +0 -22
- data/lib/occi/helpers/comparators/category.rb +0 -22
- data/lib/occi/helpers/comparators/collection.rb +0 -40
- data/lib/occi/helpers/comparators/entities.rb +0 -22
- data/lib/occi/helpers/comparators/entity.rb +0 -22
- data/lib/occi/helpers/comparators/properties.rb +0 -26
- data/lib/occi/helpers/comparators.rb +0 -1
- data/lib/occi/helpers/inspect.rb +0 -12
- data/lib/occi/infrastructure/network/ipnetwork.rb +0 -28
- data/lib/occi/infrastructure/networkinterface/ipnetworkinterface.rb +0 -28
- data/lib/occi/infrastructure/os_tpl.rb +0 -20
- data/lib/occi/infrastructure/resource_tpl.rb +0 -20
- data/lib/occi/log.rb +0 -71
- data/lib/occi/model.rb +0 -87
- data/lib/occi/parser/json.rb +0 -38
- data/lib/occi/parser/text/constants.rb +0 -89
- data/lib/occi/parser/text.rb +0 -280
- data/lib/occi/parser.rb +0 -144
- data/lib/occi/settings.rb +0 -10
- data/lib/occi/version.rb +0 -3
- data/lib/occi-core.rb +0 -53
- data/spec/helpers/to_plain.rb +0 -39
- data/spec/helpers/yaml_hash.rb +0 -32
- data/spec/occi/collection_samples/collection1.json +0 -1
- data/spec/occi/collection_samples/directory2/collection2.json +0 -1
- data/spec/occi/collection_spec.rb +0 -1003
- data/spec/occi/core/action_instance_spec.rb +0 -317
- data/spec/occi/core/action_spec.rb +0 -71
- data/spec/occi/core/attributes_spec.rb +0 -665
- data/spec/occi/core/categories_spec.rb +0 -28
- data/spec/occi/core/category_spec.rb +0 -216
- data/spec/occi/core/entities_spec.rb +0 -160
- data/spec/occi/core/entity_spec.rb +0 -374
- data/spec/occi/core/kind_spec.rb +0 -182
- data/spec/occi/core/link_spec.rb +0 -52
- data/spec/occi/core/links_spec.rb +0 -132
- data/spec/occi/core/mixin_spec.rb +0 -38
- data/spec/occi/core/mixins_spec.rb +0 -107
- data/spec/occi/core/properties_spec.rb +0 -171
- data/spec/occi/core/resource_spec.rb +0 -42
- data/spec/occi/core_spec.rb +0 -12
- data/spec/occi/infrastructure/compute_spec.rb +0 -229
- data/spec/occi/infrastructure/network_spec.rb +0 -96
- data/spec/occi/infrastructure/networkinterface_spec.rb +0 -96
- data/spec/occi/infrastructure/storage_spec.rb +0 -33
- data/spec/occi/infrastructure/storagelink_spec.rb +0 -45
- data/spec/occi/log_spec.rb +0 -117
- data/spec/occi/model_spec.rb +0 -256
- data/spec/occi/parser/json_samples/test.json +0 -49
- data/spec/occi/parser/text_samples/occi_categories.body_plain.expected +0 -2
- data/spec/occi/parser/text_samples/occi_categories.expected +0 -2
- data/spec/occi/parser/text_samples/occi_categories.parse_headers.expected +0 -2
- data/spec/occi/parser/text_samples/occi_categories.text +0 -2
- data/spec/occi/parser/text_samples/occi_compute_rocci_server.expected +0 -11
- data/spec/occi/parser/text_samples/occi_compute_rocci_server.text +0 -10
- data/spec/occi/parser/text_samples/occi_link_resource_instance.body_plain.expected +0 -7
- data/spec/occi/parser/text_samples/occi_link_resource_instance.expected +0 -7
- data/spec/occi/parser/text_samples/occi_link_resource_instance.parse.expected +0 -7
- data/spec/occi/parser/text_samples/occi_link_resource_instance.text +0 -7
- data/spec/occi/parser/text_samples/occi_link_simple.expected +0 -7
- data/spec/occi/parser/text_samples/occi_link_simple.text +0 -1
- data/spec/occi/parser/text_samples/occi_link_w_attributes.expected +0 -7
- data/spec/occi/parser/text_samples/occi_link_w_attributes.text +0 -7
- data/spec/occi/parser/text_samples/occi_link_w_category.expected +0 -7
- data/spec/occi/parser/text_samples/occi_link_w_category.text +0 -3
- data/spec/occi/parser/text_samples/occi_model_categories.expected +0 -3
- data/spec/occi/parser/text_samples/occi_model_rocci_server.text +0 -51
- data/spec/occi/parser/text_samples/occi_network_rocci_server.body_plain.expected +0 -11
- data/spec/occi/parser/text_samples/occi_network_rocci_server.expected +0 -11
- data/spec/occi/parser/text_samples/occi_network_rocci_server.resource.header.expected +0 -9
- data/spec/occi/parser/text_samples/occi_network_rocci_server.resource.rack.expected +0 -9
- data/spec/occi/parser/text_samples/occi_network_rocci_server.text +0 -11
- data/spec/occi/parser/text_samples/occi_resource_custom_class_w_attributes.parse.expected +0 -15
- data/spec/occi/parser/text_samples/occi_resource_custom_class_w_attributes.text +0 -15
- data/spec/occi/parser/text_samples/occi_resource_w_attributes.text +0 -11
- data/spec/occi/parser/text_samples/occi_resource_w_inline_links.expected +0 -1
- data/spec/occi/parser/text_samples/occi_resource_w_inline_links.text +0 -16
- data/spec/occi/parser/text_samples/occi_resource_w_inline_links_only.text +0 -13
- data/spec/occi/parser/text_samples/occi_storage_rocci_server.expected +0 -9
- data/spec/occi/parser/text_samples/occi_storage_rocci_server.text +0 -9
- data/spec/occi/parser/text_spec.rb +0 -320
- data/spec/occi/parser_spec.rb +0 -259
- data/spec/occi-core_spec.rb +0 -31
- data/spec/spec_helper.rb +0 -18
@@ -1,11 +0,0 @@
|
|
1
|
-
Category: compute;scheme="http://schemas.ogf.org/occi/infrastructure#";class="kind"\nCategory: compute;scheme="http://opennebula.org/occi/infrastructure#";class="mixin"
|
2
|
-
Category: monitoring;scheme="https://occi.carach5.ics.muni.cz/occi/infrastructure/os_tpl#";class="mixin"
|
3
|
-
Category: small;scheme="https://occi.carach5.ics.muni.cz/occi/infrastructure/resource_tpl#";class="mixin"
|
4
|
-
X-OCCI-Attribute: occi.core.id="ee13808d-7708-4341-a4ba-0e42e4818218"
|
5
|
-
X-OCCI-Attribute: occi.core.title="TestVM"
|
6
|
-
X-OCCI-Attribute: occi.compute.cores=1
|
7
|
-
X-OCCI-Attribute: occi.compute.memory=1.7
|
8
|
-
X-OCCI-Attribute: occi.compute.architecture="x86"
|
9
|
-
X-OCCI-Attribute: occi.compute.speed=1
|
10
|
-
X-OCCI-Attribute: occi.compute.state="active"
|
11
|
-
X-OCCI-Attribute: org.opennebula.compute.cpu=1.0
|
@@ -1 +0,0 @@
|
|
1
|
-
Category: compute;scheme="http://schemas.ogf.org/occi/infrastructure#";class="kind";title="Compute Resource";rel="http://schemas.ogf.org/occi/core#resource";location="/compute/";attributes="occi.compute.architecture occi.compute.state occi.compute.speed occi.compute.memory occi.compute.cores occi.compute.hostname";actions="http://schemas.ogf.org/occi/infrastructure/compute/action#start http://schemas.ogf.org/occi/infrastructure/compute/action#stop http://schemas.ogf.org/occi/infrastructure/compute/action#restart http://schemas.ogf.org/occi/infrastructure/compute/action#suspend"
|
@@ -1,16 +0,0 @@
|
|
1
|
-
Category: compute; scheme="http://schemas.ogf.org/occi/infrastructure#"; class="kind"; title="Compute Resource"; rel="http://schemas.ogf.org/occi/core#resource"; location="https://egi-cloud.zam.kfa-juelich.de:8787/compute/"; attributes="occi.compute.architecture occi.compute.state{immutable} occi.compute.speed occi.compute.memory occi.compute.cores occi.compute.hostname"; actions="http://schemas.ogf.org/occi/infrastructure/compute/action#start http://schemas.ogf.org/occi/infrastructure/compute/action#stop http://schemas.ogf.org/occi/infrastructure/compute/action#restart http://schemas.ogf.org/occi/infrastructure/compute/action#suspend"
|
2
|
-
Category: os_vms; scheme="http://schemas.openstack.org/compute/instance#"; class="mixin"; location="https://egi-cloud.zam.kfa-juelich.de:8787/os_vms/"; attributes="org.openstack.compute.console.vnc{immutable} org.openstack.compute.state{immutable}"; actions="http://schemas.openstack.org/instance/action#chg_pwd http://schemas.openstack.org/instance/action#create_image"
|
3
|
-
Link: </compute/04106bce-87eb-4f8f-a665-2f624e54ba46?action=stop>; rel="http://schemas.ogf.org/occi/infrastructure/compute/action#stop"
|
4
|
-
Link: </compute/04106bce-87eb-4f8f-a665-2f624e54ba46?action=suspend>; rel="http://schemas.ogf.org/occi/infrastructure/compute/action#suspend"
|
5
|
-
Link: </compute/04106bce-87eb-4f8f-a665-2f624e54ba46?action=restart>; rel="http://schemas.ogf.org/occi/infrastructure/compute/action#restart"
|
6
|
-
Link: </network/public>; rel="http://schemas.ogf.org/occi/infrastructure#network"; self="/network/interface/6a7a9446-a146-4faf-a961-52f66d2808df"; category="http://schemas.ogf.org/occi/infrastructure#networkinterface http://schemas.ogf.org/occi/infrastructure/networkinterface#ipnetworkinterface"; occi.networkinterface.gateway="0.0.0.0"; occi.networkinterface.mac="aa:bb:cc:dd:ee:ff"; occi.networkinterface.interface="eth0"; occi.networkinterface.state="active"; occi.networkinterface.allocation="static"; occi.networkinterface.address="134.94.32.154"; occi.core.source="/compute/04106bce-87eb-4f8f-a665-2f624e54ba46"; occi.core.target="/network/public"; occi.core.id="/network/interface/6a7a9446-a146-4faf-a961-52f66d2808df"
|
7
|
-
Link: </network/admin>; rel="http://schemas.ogf.org/occi/infrastructure#network"; self="/network/interface/02b630f6-087e-4969-b04c-1e22d9480dec"; category="http://schemas.ogf.org/occi/infrastructure#networkinterface http://schemas.ogf.org/occi/infrastructure/networkinterface#ipnetworkinterface"; occi.networkinterface.gateway="192.168.16.1"; occi.networkinterface.mac="fa:16:3e:45:1c:26"; occi.networkinterface.interface="eth0"; occi.networkinterface.state="active"; occi.networkinterface.allocation="static"; occi.networkinterface.address="192.168.16.103"; occi.core.source="/compute/04106bce-87eb-4f8f-a665-2f624e54ba46"; occi.core.target="/network/admin"; occi.core.id="/network/interface/02b630f6-087e-4969-b04c-1e22d9480dec"
|
8
|
-
X-OCCI-Attribute: org.openstack.compute.console.vnc="http://134.94.32.4:6080/vnc_auto.html?token=9923dc1b-eca0-4c62-81a8-a0dd6848341a"
|
9
|
-
X-OCCI-Attribute: occi.compute.architecture="x86"
|
10
|
-
X-OCCI-Attribute: occi.compute.state="active"
|
11
|
-
X-OCCI-Attribute: occi.compute.speed="0.0"
|
12
|
-
X-OCCI-Attribute: occi.compute.cores="1"
|
13
|
-
X-OCCI-Attribute: occi.compute.memory="1.0"
|
14
|
-
X-OCCI-Attribute: org.openstack.compute.state="active"
|
15
|
-
X-OCCI-Attribute: occi.compute.hostname="openmodeller-test-bjoernh"
|
16
|
-
X-OCCI-Attribute: occi.core.id="04106bce-87eb-4f8f-a665-2f624e54ba46"
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Category: compute;scheme="http://schemas.ogf.org/occi/infrastructure#";class="kind"\nCategory: compute;scheme="http://opennebula.org/occi/infrastructure#";class="mixin"
|
2
|
-
Category: monitoring;scheme="https://occi.carach5.ics.muni.cz/occi/infrastructure/os_tpl#";class="mixin"
|
3
|
-
Category: small;scheme="https://occi.carach5.ics.muni.cz/occi/infrastructure/resource_tpl#";class="mixin"
|
4
|
-
X-OCCI-Attribute: occi.core.id="ee13808d-7708-4341-a4ba-0e42e4818218"
|
5
|
-
X-OCCI-Attribute: occi.core.title="TestVM"
|
6
|
-
X-OCCI-Attribute: occi.compute.cores=1
|
7
|
-
X-OCCI-Attribute: occi.compute.memory=1.7
|
8
|
-
X-OCCI-Attribute: occi.compute.architecture="x86"
|
9
|
-
X-OCCI-Attribute: occi.compute.speed=1
|
10
|
-
X-OCCI-Attribute: occi.compute.state="active"
|
11
|
-
X-OCCI-Attribute: org.opennebula.compute.cpu=1.0
|
12
|
-
Link: </storage/e60aa2b8-0c86-5973-b93e-30c5c46d6eac>;rel="http://schemas.ogf.org/occi/infrastructure#storage";self="/storagelink/b2f7f1de-c60c-5b08-879c-81f52429c4ef";category="http://schemas.ogf.org/occi/infrastructure#storagelink";occi.core.id="b2f7f1de-c60c-5b08-879c-81f52429c4ef" occi.core.title="link to storage" occi.storagelink.deviceid="xvda" occi.storagelink.state="inactive" org.opennebula.storagelink.bus="ide" org.opennebula.storagelink.driver="tap2:tapdisk:aio:"
|
13
|
-
Link: </network/e4bd81c4-adda-5626-840d-39bb7959db97>;rel="http://schemas.ogf.org/occi/infrastructure#network";self="/networkinterface/e75ab249-9325-511c-82b8-a7e4430381e3";category="http://schemas.ogf.org/occi/infrastructure#networkinterface";occi.core.id="e75ab249-9325-511c-82b8-a7e4430381e3" occi.core.title="link to network interface" occi.networkinterface.address="192.168.254.8" occi.networkinterface.mac="02:00:c0:a8:fe:08" occi.networkinterface.state="inactive" org.opennebula.networkinterface.bridge="xenbr0"
|
@@ -1,9 +0,0 @@
|
|
1
|
-
Category: storage;scheme="http://schemas.ogf.org/occi/infrastructure#";class="kind";location="/storage/";title=nil
|
2
|
-
Category: storage;scheme="http://opennebula.org/occi/infrastructure#";class="mixin";location="/mixin/storage/";title=""
|
3
|
-
X-OCCI-Attribute: occi.core.id="33601efd-1c81-5547-8e65-6f8ef3dcb8c6"
|
4
|
-
X-OCCI-Attribute: occi.core.title="EGI-COMPSs-CESNET_NFS_3"
|
5
|
-
X-OCCI-Attribute: occi.storage.state="online"
|
6
|
-
X-OCCI-Attribute: org.opennebula.storage.id="116"
|
7
|
-
X-OCCI-Attribute: org.opennebula.storage.dev_prefix="xvd"
|
8
|
-
X-OCCI-Attribute: org.opennebula.storage.driver="tap2:tapdisk:aio:"
|
9
|
-
X-OCCI-Attribute: org.opennebula.storage.persistent="NO"
|
@@ -1,9 +0,0 @@
|
|
1
|
-
Category: storage;scheme="http://schemas.ogf.org/occi/infrastructure#";class="kind"
|
2
|
-
Category: storage;scheme="http://opennebula.org/occi/infrastructure#";class="mixin"
|
3
|
-
X-OCCI-Attribute: occi.core.id="33601efd-1c81-5547-8e65-6f8ef3dcb8c6"
|
4
|
-
X-OCCI-Attribute: occi.core.title="EGI-COMPSs-CESNET_NFS_3"
|
5
|
-
X-OCCI-Attribute: occi.storage.state="online"
|
6
|
-
X-OCCI-Attribute: org.opennebula.storage.id="116"
|
7
|
-
X-OCCI-Attribute: org.opennebula.storage.dev_prefix="xvd"
|
8
|
-
X-OCCI-Attribute: org.opennebula.storage.driver="tap2:tapdisk:aio:"
|
9
|
-
X-OCCI-Attribute: org.opennebula.storage.persistent="NO"
|
@@ -1,320 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module Occi
|
4
|
-
module Parser
|
5
|
-
describe Text do
|
6
|
-
|
7
|
-
context '.category' do
|
8
|
-
it 'parses a string describing an OCCI Category' do
|
9
|
-
category_string = 'Category: a_a1-_;scheme="http://a.a/a#";class="kind";title="aA1!§$%&/()=?`´ß+*#-_.:,;<>";rel="http://a.a/b#a";location="/a1-A/";attributes="a_1-_.a1-_a a-1.a.b";actions="http://a.a/a1#a1 http://a.b1/b1#b2"'
|
10
|
-
category = Occi::Parser::Text.category category_string
|
11
|
-
expect(category.to_text).to eql category_string
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'parses a string describing an OCCI Category with unquoted class value' do
|
15
|
-
category_string = 'Category: a_a1-_;scheme="http://a.a/a#";class="kind"'
|
16
|
-
category = Occi::Parser::Text.category category_string
|
17
|
-
expect(category.to_text).to eql "#{category_string};location=\"/a_a1-_/\""
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'parses a string describing an OCCI Category with unquoted class value and explicit location' do
|
21
|
-
category_string = 'Category: a_a1-_;scheme="http://a.a/a#";class="kind";location="/a_a1-_/"'
|
22
|
-
category = Occi::Parser::Text.category category_string
|
23
|
-
expect(category.to_text).to eql category_string
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'parses a string describing an OCCI Category with uppercase term' do
|
27
|
-
category_string = 'Category: TERM;scheme="http://a.a/a#";class="kind"'
|
28
|
-
category = Occi::Parser::Text.category category_string
|
29
|
-
expect(category.to_text).to eql 'Category: term;scheme="http://a.a/a#";class="kind";location="/term/"'
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'parses a string describing an OCCI Category incl. attributes with properties' do
|
33
|
-
category_string = 'Category: restart;scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#";class="action";title="Restart Compute instance";attributes="method{required} test{immutable}"'
|
34
|
-
category = Occi::Parser::Text.category category_string
|
35
|
-
|
36
|
-
expect(category.attributes['method'].required).to be true
|
37
|
-
expect(category.attributes['method'].mutable).to be true
|
38
|
-
expect(category.attributes['test'].required).to be false
|
39
|
-
expect(category.attributes['test'].mutable).to be false
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'parses attributes correctly' do
|
43
|
-
resource_string = File.open("spec/occi/parser/text_samples/occi_resource_w_attributes.text", "rt").read
|
44
|
-
category = Occi::Parser::Text.category resource_string
|
45
|
-
expect(category.to_text).to eql "Category: compute;scheme=\"http://schemas.ogf.org/occi/infrastructure#\";class=\"kind\";location=\"/compute/\""
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'parses inline links correctly' do
|
49
|
-
resource_string = File.open("spec/occi/parser/text_samples/occi_resource_w_inline_links_only.text", "rt").read
|
50
|
-
category = Occi::Parser::Text.category resource_string
|
51
|
-
expect(category.to_text).to eql "Category: compute;scheme=\"http://schemas.ogf.org/occi/infrastructure#\";class=\"kind\";location=\"/compute/\""
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'parses inline Links and Mixins correctly' do
|
55
|
-
resource_string = File.open("spec/occi/parser/text_samples/occi_resource_w_inline_links.text", "rt").read
|
56
|
-
category = Occi::Parser::Text.category resource_string
|
57
|
-
expected = File.open("spec/occi/parser/text_samples/occi_resource_w_inline_links.expected", "rt").read.chomp
|
58
|
-
expect(category.to_text).to eql expected
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'parses action correctly' do
|
62
|
-
category_string = 'Category: restart;scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#";class="action";title="Restart Compute instance";attributes="method"'
|
63
|
-
category = Occi::Parser::Text.category category_string
|
64
|
-
expect(category.to_text).to eql category_string
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'parses network resource from rOCCI server' do
|
68
|
-
resource_string = File.open("spec/occi/parser/text_samples/occi_network_rocci_server.text", "rt").read
|
69
|
-
category = Occi::Parser::Text.category resource_string
|
70
|
-
expect(category.to_text).to eql "Category: network;scheme=\"http://schemas.ogf.org/occi/infrastructure#\";class=\"kind\";location=\"/network/\""
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'parses storage resource from rOCCI server' do
|
74
|
-
resource_string = File.open("spec/occi/parser/text_samples/occi_storage_rocci_server.text", "rt").read
|
75
|
-
category = Occi::Parser::Text.category resource_string
|
76
|
-
expect(category.to_text).to eql "Category: storage;scheme=\"http://schemas.ogf.org/occi/infrastructure#\";class=\"kind\";location=\"/storage/\""
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'parses compute resource from rOCCI server' do
|
80
|
-
resource_string = File.open("spec/occi/parser/text_samples/occi_compute_rocci_server.text", "rt").read
|
81
|
-
category = Occi::Parser::Text.category resource_string
|
82
|
-
expect(category.to_text).to eql "Category: compute;scheme=\"http://schemas.ogf.org/occi/infrastructure#\";class=\"kind\";location=\"/compute/\""
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'parses model from rOCCI server' do
|
86
|
-
resource_string = File.open("spec/occi/parser/text_samples/occi_model_rocci_server.text", "rt").read
|
87
|
-
category = Occi::Parser::Text.category resource_string
|
88
|
-
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'raises error for obviously nonsensical class' do
|
92
|
-
category_string = 'Category: restart;scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#";class="actions";title="Restart Compute instance";attributes="method"'
|
93
|
-
expect{ category = Occi::Parser::Text.category category_string }.to raise_error(Occi::Errors::ParserInputError)
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'raises error for cleverly nonsensical class' do
|
97
|
-
category_string = 'Category: restart;scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#";class="action|mixin";title="Restart Compute instance";attributes="method"'
|
98
|
-
expect{ category = Occi::Parser::Text.category category_string }.to raise_error(Occi::Errors::ParserInputError)
|
99
|
-
end
|
100
|
-
|
101
|
-
it 'raises error for a nonsensical class even with lenient regexp' do
|
102
|
-
category_string = 'Category: restart;scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#";class="invalid";title="Restart Compute instance";attributes="method"'
|
103
|
-
|
104
|
-
regexp_category = Occi::Parser::Text::Constants.const_get('REGEXP_CATEGORY')
|
105
|
-
regexp_category_alt = regexp_category
|
106
|
-
regexp_category_alt['action'] = 'invalid'
|
107
|
-
|
108
|
-
Occi::Parser::Text::Constants.const_set('REGEXP_CATEGORY', regexp_category_alt)
|
109
|
-
|
110
|
-
expect{ category = Occi::Parser::Text.category category_string }.to raise_error(Occi::Errors::ParserInputError)
|
111
|
-
Occi::Parser::Text.const_set('REGEXP_CATEGORY', regexp_category)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
context '.resource' do
|
116
|
-
it 'parses network resource from rOCCI server' do
|
117
|
-
resource_string = File.open("spec/occi/parser/text_samples/occi_network_rocci_server.text", "rt").read
|
118
|
-
resource = Occi::Parser::Text.resource resource_string
|
119
|
-
expected = File.open("spec/occi/parser/text_samples/occi_network_rocci_server.expected", "rt").read.chomp
|
120
|
-
expect(resource.to_text).to eql expected
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'parses storage resource from rOCCI server' do
|
124
|
-
resource_string = File.open("spec/occi/parser/text_samples/occi_storage_rocci_server.text", "rt").read
|
125
|
-
resource = Occi::Parser::Text.resource resource_string
|
126
|
-
expected = File.open("spec/occi/parser/text_samples/occi_storage_rocci_server.expected", "rt").read.chomp
|
127
|
-
expect(resource.to_text).to eql expected
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'parses compute resource from rOCCI server' do
|
131
|
-
resource_string = File.open("spec/occi/parser/text_samples/occi_compute_rocci_server.text", "rt").read
|
132
|
-
resource = Occi::Parser::Text.resource resource_string
|
133
|
-
expected = File.open("spec/occi/parser/text_samples/occi_compute_rocci_server.expected", "rt").read.chomp
|
134
|
-
expect(resource.to_text).to eql expected
|
135
|
-
end
|
136
|
-
|
137
|
-
it 'types parsed compute resource from rOCCI server as Occi::Infrastructure::Compute' do
|
138
|
-
resource_string = File.open("spec/occi/parser/text_samples/occi_compute_rocci_server.text", "rt").read
|
139
|
-
expected_class = Occi::Infrastructure::Compute
|
140
|
-
resource_class = Occi::Parser::Text.resource(resource_string).resources.first.class
|
141
|
-
expect(resource_class).to eql expected_class
|
142
|
-
end
|
143
|
-
|
144
|
-
it 'types parsed custom resource as related to Occi::Core::Resource' do
|
145
|
-
resource_string = File.open("spec/occi/parser/text_samples/occi_resource_custom_class_w_attributes.text", "rt").read
|
146
|
-
expected_class = "Org::Fogbowcloud::Schemas::Request::FogbowRequest"
|
147
|
-
|
148
|
-
resource_instance = Occi::Parser::Text.resource(resource_string).resources.first
|
149
|
-
resource_class = resource_instance.class.to_s
|
150
|
-
expect(resource_class).to eql expected_class
|
151
|
-
expect(resource_instance).to be_kind_of Occi::Core::Resource
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
context '.categories' do
|
156
|
-
it 'parses strings describing OCCI Categories' do
|
157
|
-
categories_string = File.open("spec/occi/parser/text_samples/occi_categories.text", "rt").read
|
158
|
-
categories = Occi::Parser::Text.categories categories_string
|
159
|
-
expected = File.open("spec/occi/parser/text_samples/occi_categories.expected", "rt").read
|
160
|
-
expect(categories.to_text).to eql expected
|
161
|
-
end
|
162
|
-
|
163
|
-
it 'parses strings describing OCCI Categories, skipping unparseable additions' do
|
164
|
-
categories_string = File.open("spec/occi/parser/text_samples/occi_categories.text", "rt").read
|
165
|
-
categories_string["\n"] = "\n\n&*$this won't parse\n"
|
166
|
-
categories = Occi::Parser::Text.categories categories_string
|
167
|
-
expected = File.open("spec/occi/parser/text_samples/occi_categories.expected", "rt").read
|
168
|
-
expect(categories.to_text).to eql expected
|
169
|
-
end
|
170
|
-
|
171
|
-
it 'does not fail on unparseable input' do
|
172
|
-
categories_string = "\n\n&*$this won't parse\n"
|
173
|
-
categories = Occi::Parser::Text.categories categories_string
|
174
|
-
expect(categories.blank?).to eql true
|
175
|
-
end
|
176
|
-
|
177
|
-
end
|
178
|
-
|
179
|
-
context '.link' do
|
180
|
-
it 'parses link resource instance' do
|
181
|
-
link_string = File.open("spec/occi/parser/text_samples/occi_link_resource_instance.text", "rt").read
|
182
|
-
link = Occi::Parser::Text.link link_string
|
183
|
-
expected = File.open("spec/occi/parser/text_samples/occi_link_resource_instance.expected", "rt").read.chomp
|
184
|
-
expect(link.to_text).to eql expected
|
185
|
-
end
|
186
|
-
|
187
|
-
end
|
188
|
-
|
189
|
-
context '.location' do
|
190
|
-
it 'parses single location' do
|
191
|
-
location_string = "X-OCCI-Location: http://example.com:8090/a/b/vm1"
|
192
|
-
location = Occi::Parser::Text.location location_string
|
193
|
-
expected = "http://example.com:8090/a/b/vm1"
|
194
|
-
expect(location).to eql expected
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
context '.locations' do
|
199
|
-
let(:locations_string){ "X-OCCI-Location: http://example.com:8090/a/b/vm1\nX-OCCI-Location: http://example.com:8090/a/b/vm2" }
|
200
|
-
let(:expected){ ["http://example.com:8090/a/b/vm1", "http://example.com:8090/a/b/vm2"] }
|
201
|
-
|
202
|
-
it 'parses multiple locations' do
|
203
|
-
locations = Occi::Parser::Text.locations locations_string
|
204
|
-
expect(locations).to eql expected
|
205
|
-
end
|
206
|
-
|
207
|
-
it 'parses multiple locations, skipping unparseable additions' do
|
208
|
-
locations_string["\n"] = "\n\n&*$this won't parse\n"
|
209
|
-
locations = Occi::Parser::Text.locations locations_string
|
210
|
-
expect(locations).to eql expected
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
context '.attribute' do
|
215
|
-
end
|
216
|
-
|
217
|
-
context '.link_string' do
|
218
|
-
it 'parses string with category set' do
|
219
|
-
link_string = File.open("spec/occi/parser/text_samples/occi_link_simple.text", "rt").read
|
220
|
-
link = Occi::Parser::Text.link_string link_string, nil
|
221
|
-
expected = File.open("spec/occi/parser/text_samples/occi_link_simple.expected", "rt").read.chomp
|
222
|
-
expect(link.to_text).to eql expected
|
223
|
-
end
|
224
|
-
|
225
|
-
it 'parses link with category' do
|
226
|
-
link_string = File.open("spec/occi/parser/text_samples/occi_link_w_category.text", "rt").read
|
227
|
-
link = Occi::Parser::Text.link_string link_string, nil
|
228
|
-
expected = File.open("spec/occi/parser/text_samples/occi_link_w_category.expected", "rt").read.chomp
|
229
|
-
expect(link.to_text).to eql expected
|
230
|
-
end
|
231
|
-
|
232
|
-
it 'parses link with attributes' do
|
233
|
-
link_string = File.open("spec/occi/parser/text_samples/occi_link_w_attributes.text", "rt").read
|
234
|
-
link = Occi::Parser::Text.link_string link_string, nil
|
235
|
-
expected = File.open("spec/occi/parser/text_samples/occi_link_w_attributes.expected", "rt").read.chomp
|
236
|
-
expect(link.to_text).to eql expected
|
237
|
-
end
|
238
|
-
|
239
|
-
it 'parses string with action link' do
|
240
|
-
link_string = 'Link: </compute/04106bce-87eb-4f8f-a665-2f624e54ba46?action=restart>; rel="http://schemas.ogf.org/occi/infrastructure/compute/action#restart"'
|
241
|
-
link = Occi::Parser::Text.link_string(link_string, "source")
|
242
|
-
expect(link.to_text).to eql "Category: restart;scheme=\"http://schemas.ogf.org/occi/infrastructure/compute/action#\";class=\"action\""
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
context 'compatibility' do
|
247
|
-
after(:each) { Occi::Settings.reload! }
|
248
|
-
context 'terms' do
|
249
|
-
it 'parses uppercase term, compatibility on' do
|
250
|
-
Occi::Settings['compatibility']=true
|
251
|
-
category_string = 'Category: TERM;scheme="http://a.a/a#";class="kind"'
|
252
|
-
category = Occi::Parser::Text.category category_string
|
253
|
-
expect(category.to_text).to eql "Category: term;scheme=\"http://a.a/a#\";class=\"kind\";location=\"/term/\""
|
254
|
-
end
|
255
|
-
|
256
|
-
it 'refuses uppercase term, compatibility off' do
|
257
|
-
Occi::Settings['compatibility']=false
|
258
|
-
category_string = 'Category: TERM;scheme="http://a.a/a#";class="kind"'
|
259
|
-
expect{ category = Occi::Parser::Text.category category_string }.to raise_error(Occi::Errors::ParserInputError)
|
260
|
-
end
|
261
|
-
|
262
|
-
it 'parses term starting with number, compatibility on' do
|
263
|
-
Occi::Settings['compatibility']=true
|
264
|
-
category_string = 'Category: 1TERM;scheme="http://a.a/a#";class="kind"'
|
265
|
-
category = Occi::Parser::Text.category category_string
|
266
|
-
expect(category.to_text).to eql "Category: 1term;scheme=\"http://a.a/a#\";class=\"kind\";location=\"/1term/\""
|
267
|
-
end
|
268
|
-
|
269
|
-
it 'refuses term starting with number, compatibility off' do
|
270
|
-
Occi::Settings['compatibility']=false
|
271
|
-
category_string = 'Category: 1TERM;scheme="http://a.a/a#";class=kind'
|
272
|
-
expect{ category = Occi::Parser::Text.category category_string }.to raise_error(Occi::Errors::ParserInputError)
|
273
|
-
end
|
274
|
-
|
275
|
-
|
276
|
-
it 'parses upper case Category with compatibility mode on' do
|
277
|
-
Occi::Settings['compatibility']=true
|
278
|
-
category_string = 'Category: A_A1-_;scheme="http://a.a/a#";class="kind"'
|
279
|
-
expect{ category = Occi::Parser::Text.category category_string }.to_not raise_error
|
280
|
-
end
|
281
|
-
|
282
|
-
it 'refuses upper case Category with compatibility mode off' do
|
283
|
-
Occi::Settings['compatibility']=false
|
284
|
-
category_string = 'Category: A_A1-_;scheme="http://a.a/a#";class="kind"'
|
285
|
-
expect{ category = Occi::Parser::Text.category category_string }.to raise_error(Occi::Errors::ParserInputError)
|
286
|
-
end
|
287
|
-
|
288
|
-
end
|
289
|
-
|
290
|
-
context 'schemes' do
|
291
|
-
it 'parses a Category, compatibility on' do
|
292
|
-
Occi::Settings['compatibility']=true
|
293
|
-
category_string = 'Category: a_a1-_;scheme="http://a.a/a#a_a1-_";class="kind";title="aA1!§$%&/()=?`´ß+*#-_.:,;<>";rel="http://a.a/b#a";location="/a1-A/";attributes="a_1-_.a1-_a a-1.a.b";actions="http://a.a/a1#a1 http://a.b1/b1#b2"'
|
294
|
-
category = Occi::Parser::Text.category category_string
|
295
|
-
expect(category.to_text).to eql "Category: a_a1-_;scheme=\"http://a.a/a#\";class=\"kind\";title=\"aA1!§$%&/()=?`´ß+*#-_.:,;<>\";rel=\"http://a.a/b#a\";location=\"/a1-A/\";attributes=\"a_1-_.a1-_a a-1.a.b\";actions=\"http://a.a/a1#a1 http://a.b1/b1#b2\""
|
296
|
-
end
|
297
|
-
|
298
|
-
it 'parses a Category, compatibility off' do
|
299
|
-
Occi::Settings['compatibility']=false
|
300
|
-
category_string = 'Category: a_a1-_;scheme="http://a.a/a#a_a1-_";class="kind";title="aA1!\"§$%&/()=?`´ß+*#-_.:,;<>";rel="http://a.a/b#a";location="/a1-A/";attributes="a_1-_.a1-_a a-1.a.b";actions="http://a.a/a1#a1 http://a.b1/b1#b2"'
|
301
|
-
expect{ category = Occi::Parser::Text.category category_string }.to raise_error(Occi::Errors::ParserInputError)
|
302
|
-
end
|
303
|
-
end
|
304
|
-
end
|
305
|
-
|
306
|
-
context 'with other OCCI implementations' do
|
307
|
-
|
308
|
-
it 'correctly parses input from FogBow Cloud' do
|
309
|
-
category_string = File.open("spec/occi/parser/text_samples/occi_resource_custom_class_w_attributes.text", "rt").read
|
310
|
-
category = Occi::Parser::Text.category category_string
|
311
|
-
expected = "Category: fogbow_request;scheme=\"http://schemas.fogbowcloud.org/request#\";class=\"kind\";title=\"Request new Instances\";rel=\"http://schemas.ogf.org/occi/core#resource\";location=\"/fogbow_request/\";attributes=\"org.fogbowcloud.request.instance-count org.fogbowcloud.request.type org.fogbowcloud.request.valid-until org.fogbowcloud.request.valid-from org.fogbowcloud.request.state org.fogbowcloud.request.instance-id\""
|
312
|
-
expect(category.to_text).to eql expected
|
313
|
-
end
|
314
|
-
|
315
|
-
it 'renders correctly OCCI from other sources'
|
316
|
-
end
|
317
|
-
|
318
|
-
end
|
319
|
-
end
|
320
|
-
end
|