occi-core 4.3.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/occi/core/attributes.rb +7 -7
- data/lib/occi/core/entity.rb +1 -1
- data/lib/occi/core/link.rb +1 -1
- data/lib/occi/core/properties.rb +1 -1
- data/lib/occi/infrastructure/compute.rb +4 -2
- data/lib/occi/infrastructure/network.rb +2 -1
- data/lib/occi/infrastructure/networkinterface.rb +4 -2
- data/lib/occi/infrastructure/storagelink.rb +4 -2
- data/lib/occi/parser/text.rb +2 -2
- data/lib/occi/version.rb +1 -1
- data/occi-core.gemspec +5 -5
- data/spec/occi/collection_spec.rb +6 -6
- data/spec/occi/core/attributes_spec.rb +2 -2
- data/spec/occi/core/link_spec.rb +3 -1
- data/spec/occi/core/properties_spec.rb +5 -5
- data/spec/occi/parser/text_samples/occi_model_categories.expected +3 -3
- metadata +32 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e96f1134c66ae55f82559690a791227f550e25b0
|
|
4
|
+
data.tar.gz: 11c99606645e18a9ac247fbbe23df3ba603d1aba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3ffb32841f7855e60c9a01d05860d4d787294205a7dc473dd007494fdea846a7fd249e88f5fc62d494df84cf7ccdab0d40d024df1a9dcfa10b2e9a3fc4aa5af4
|
|
7
|
+
data.tar.gz: 63829be1f49304bd94194824966eef60e9cb17992582297b54c1b840b2d08f1c2b6b21ce11e35bd675137291b25241c1b417e7bac11714bae552742aaf2b310b
|
data/lib/occi/core/attributes.rb
CHANGED
|
@@ -395,13 +395,13 @@ module Occi
|
|
|
395
395
|
|
|
396
396
|
return attribute_name unless self[property_name]
|
|
397
397
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
398
|
+
props = []
|
|
399
|
+
props << "immutable" if !self[property_name].mutable
|
|
400
|
+
props << "required" if self[property_name].required
|
|
401
|
+
|
|
402
|
+
attribute_name = "#{attribute_name}{#{props.join(' ')}}" unless props.empty?
|
|
403
|
+
|
|
404
|
+
attribute_name
|
|
405
405
|
end
|
|
406
406
|
|
|
407
407
|
end
|
data/lib/occi/core/entity.rb
CHANGED
|
@@ -13,7 +13,7 @@ module Occi
|
|
|
13
13
|
self.mixins = Occi::Core::Mixins.new
|
|
14
14
|
|
|
15
15
|
self.attributes = Occi::Core::Attributes.new
|
|
16
|
-
self.attributes['occi.core.id'] = {:pattern => '[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}'}
|
|
16
|
+
self.attributes['occi.core.id'] = {:pattern => '[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}', :required => true, :mutable => false}
|
|
17
17
|
self.attributes['occi.core.title'] = {:mutable => true}
|
|
18
18
|
|
|
19
19
|
self.kind = Occi::Core::Kind.new scheme='http://schemas.ogf.org/occi/core#',
|
data/lib/occi/core/link.rb
CHANGED
|
@@ -6,7 +6,7 @@ module Occi
|
|
|
6
6
|
|
|
7
7
|
self.attributes = Occi::Core::Attributes.new(Occi::Core::Entity.attributes)
|
|
8
8
|
self.attributes['occi.core.target'] = {:mutable => true}
|
|
9
|
-
self.attributes['occi.core.source'] = {:mutable => true}
|
|
9
|
+
self.attributes['occi.core.source'] = {:mutable => true, :required => true}
|
|
10
10
|
|
|
11
11
|
self.kind = Occi::Core::Kind.new scheme='http://schemas.ogf.org/occi/core#',
|
|
12
12
|
term='link',
|
data/lib/occi/core/properties.rb
CHANGED
|
@@ -25,7 +25,7 @@ module Occi
|
|
|
25
25
|
|
|
26
26
|
self.type = source_hash[:type] || 'string'
|
|
27
27
|
self.required = source_hash[:required].nil? ? false : source_hash[:required]
|
|
28
|
-
self.mutable = source_hash[:mutable].nil? ?
|
|
28
|
+
self.mutable = source_hash[:mutable].nil? ? true : source_hash[:mutable]
|
|
29
29
|
self.pattern = source_hash[:pattern] || '.*'
|
|
30
30
|
self.description = source_hash[:description]
|
|
31
31
|
self.default = source_hash[:default]
|
|
@@ -40,8 +40,10 @@ module Occi
|
|
|
40
40
|
:mutable => true}
|
|
41
41
|
self.attributes['occi.compute.speed'] = {:type => 'number',
|
|
42
42
|
:mutable => true}
|
|
43
|
-
self.attributes['occi.compute.state'] = {:
|
|
44
|
-
:
|
|
43
|
+
self.attributes['occi.compute.state'] = {:type => 'string',
|
|
44
|
+
:pattern => 'inactive|active|suspended|error',
|
|
45
|
+
:default => 'inactive',
|
|
46
|
+
:mutable => false}
|
|
45
47
|
|
|
46
48
|
self.kind = Occi::Core::Kind.new scheme='http://schemas.ogf.org/occi/infrastructure#',
|
|
47
49
|
term='compute',
|
|
@@ -20,7 +20,8 @@ module Occi
|
|
|
20
20
|
:mutable => true}
|
|
21
21
|
self.attributes['occi.network.state'] ={:type => 'string',
|
|
22
22
|
:pattern => 'active|inactive|error',
|
|
23
|
-
:default => 'inactive'
|
|
23
|
+
:default => 'inactive',
|
|
24
|
+
:mutable => false}
|
|
24
25
|
|
|
25
26
|
self.kind = Occi::Core::Kind.new scheme='http://schemas.ogf.org/occi/infrastructure#',
|
|
26
27
|
term='network',
|
|
@@ -16,8 +16,10 @@ module Occi
|
|
|
16
16
|
self.attributes['occi.networkinterface.interface'] = {:mutable => false}
|
|
17
17
|
self.attributes['occi.networkinterface.mac'] = {:mutable => true,
|
|
18
18
|
:pattern => '^([0-9a-fA-F]{2}[:-]){5}([0-9a-fA-F]{2})$'}
|
|
19
|
-
self.attributes['occi.networkinterface.state'] = {:
|
|
20
|
-
:
|
|
19
|
+
self.attributes['occi.networkinterface.state'] = {:type => 'string',
|
|
20
|
+
:pattern => 'active|inactive|error',
|
|
21
|
+
:default => 'inactive',
|
|
22
|
+
:mutable => false}
|
|
21
23
|
|
|
22
24
|
self.kind = Occi::Core::Kind.new scheme='http://schemas.ogf.org/occi/infrastructure#',
|
|
23
25
|
term='networkinterface',
|
|
@@ -15,8 +15,10 @@ module Occi
|
|
|
15
15
|
self.attributes = Occi::Core::Attributes.new(Occi::Core::Link.attributes)
|
|
16
16
|
self.attributes['occi.storagelink.deviceid'] = {:mutable => true}
|
|
17
17
|
self.attributes['occi.storagelink.mountpoint'] = {:mutable => true}
|
|
18
|
-
self.attributes['occi.storagelink.state'] = {:
|
|
19
|
-
:
|
|
18
|
+
self.attributes['occi.storagelink.state'] = {:type => 'string',
|
|
19
|
+
:pattern => 'active|inactive|error',
|
|
20
|
+
:default => 'inactive',
|
|
21
|
+
:mutable => false}
|
|
20
22
|
|
|
21
23
|
self.kind = Occi::Core::Kind.new scheme='http://schemas.ogf.org/occi/infrastructure#',
|
|
22
24
|
term='storagelink',
|
data/lib/occi/parser/text.rb
CHANGED
|
@@ -122,8 +122,8 @@ module Occi
|
|
|
122
122
|
properties = Occi::Core::Properties.new
|
|
123
123
|
|
|
124
124
|
if property_string
|
|
125
|
-
properties.required = property_string.include?('
|
|
126
|
-
properties.mutable = !property_string.include?('
|
|
125
|
+
properties.required = property_string.include?('required')
|
|
126
|
+
properties.mutable = !property_string.include?('immutable')
|
|
127
127
|
end
|
|
128
128
|
|
|
129
129
|
name = attribute[/#{REGEXP_ATTRIBUTE_DEF}/, 1]
|
data/lib/occi/version.rb
CHANGED
data/occi-core.gemspec
CHANGED
|
@@ -18,11 +18,11 @@ Gem::Specification.new do |gem|
|
|
|
18
18
|
gem.test_files = `git ls-files -- {test,spec}/*`.split("\n")
|
|
19
19
|
gem.require_paths = ['lib']
|
|
20
20
|
|
|
21
|
-
gem.add_dependency 'json', '>= 1.8.1'
|
|
22
|
-
gem.add_dependency 'hashie', '>= 3.3.1'
|
|
23
|
-
gem.add_dependency 'uuidtools', '>= 2.1.3'
|
|
24
|
-
gem.add_dependency 'activesupport', '>= 4.0.0'
|
|
25
|
-
gem.add_dependency 'settingslogic', '>= 2.0.9'
|
|
21
|
+
gem.add_dependency 'json', '~> 1.8', '>= 1.8.1'
|
|
22
|
+
gem.add_dependency 'hashie', '~> 3.3', '>= 3.3.1'
|
|
23
|
+
gem.add_dependency 'uuidtools', '~> 2.1', '>= 2.1.3'
|
|
24
|
+
gem.add_dependency 'activesupport', '~> 4.0', '>= 4.0.0'
|
|
25
|
+
gem.add_dependency 'settingslogic', '~> 2.0', '>= 2.0.9'
|
|
26
26
|
|
|
27
27
|
gem.required_ruby_version = '>= 1.9.3'
|
|
28
28
|
end
|
|
@@ -809,7 +809,7 @@ module Occi
|
|
|
809
809
|
collection.action = Occi::Core::ActionInstance.new
|
|
810
810
|
collection.resources << Occi::Core::Resource.new
|
|
811
811
|
collection.links << Occi::Core::Link.new
|
|
812
|
-
expected = "{\"actions\":[{\"scheme\":\"http://schemas.ogf.org/occi/infrastructure/compute/action#\",\"term\":\"start\",\"attributes\":{}}],\"kinds\":[{\"parent\":\"http://schemas.ogf.org/occi/core#resource\",\"related\":[\"http://schemas.ogf.org/occi/core#resource\"],\"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\"],\"location\":\"/compute/\",\"scheme\":\"http://schemas.ogf.org/occi/infrastructure#\",\"term\":\"compute\",\"title\":\"compute resource\",\"attributes\":{\"occi\":{\"core\":{\"id\":{\"type\":\"string\",\"required\":
|
|
812
|
+
expected = "{\"actions\":[{\"scheme\":\"http://schemas.ogf.org/occi/infrastructure/compute/action#\",\"term\":\"start\",\"attributes\":{}}],\"kinds\":[{\"parent\":\"http://schemas.ogf.org/occi/core#resource\",\"related\":[\"http://schemas.ogf.org/occi/core#resource\"],\"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\"],\"location\":\"/compute/\",\"scheme\":\"http://schemas.ogf.org/occi/infrastructure#\",\"term\":\"compute\",\"title\":\"compute resource\",\"attributes\":{\"occi\":{\"core\":{\"id\":{\"type\":\"string\",\"required\":true,\"mutable\":false,\"pattern\":\"[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}\"},\"title\":{\"type\":\"string\",\"required\":false,\"mutable\":true,\"pattern\":\".*\"},\"summary\":{\"type\":\"string\",\"required\":false,\"mutable\":true,\"pattern\":\".*\"}},\"compute\":{\"architecture\":{\"type\":\"string\",\"required\":false,\"mutable\":true,\"pattern\":\"x86|x64\"},\"cores\":{\"type\":\"number\",\"required\":false,\"mutable\":true,\"pattern\":\".*\"},\"hostname\":{\"type\":\"string\",\"required\":false,\"mutable\":true,\"pattern\":\"(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*\"},\"memory\":{\"type\":\"number\",\"required\":false,\"mutable\":true,\"pattern\":\".*\"},\"speed\":{\"type\":\"number\",\"required\":false,\"mutable\":true,\"pattern\":\".*\"},\"state\":{\"default\":\"inactive\",\"type\":\"string\",\"required\":false,\"mutable\":false,\"pattern\":\"inactive|active|suspended|error\"}}}}}],\"links\":[{\"kind\":\"http://schemas.ogf.org/occi/core#link\",\"attributes\":{\"occi\":{\"core\":{\"id\":\"#{collection.links.first.id}\"}}},\"id\":\"#{collection.links.first.id}\",\"rel\":\"http://schemas.ogf.org/occi/core#link\"}],\"mixins\":[{\"location\":\"/mixin/my_mixin/\",\"scheme\":\"http://example.com/occi/tags#\",\"term\":\"my_mixin\",\"attributes\":{}}],\"resources\":[{\"kind\":\"http://schemas.ogf.org/occi/core#resource\",\"attributes\":{\"occi\":{\"core\":{\"id\":\"#{collection.resources.first.id}\"}}},\"id\":\"#{collection.resources.first.id}\"}]}"
|
|
813
813
|
|
|
814
814
|
hash=Hashie::Mash.new(JSON.parse(expected))
|
|
815
815
|
expect(collection.as_json).to eql(hash)
|
|
@@ -828,7 +828,7 @@ module Occi
|
|
|
828
828
|
collection.actions << "http://schemas.ogf.org/occi/infrastructure/compute/action#start"
|
|
829
829
|
collection.action = Occi::Core::ActionInstance.new
|
|
830
830
|
collection.links << Occi::Core::Link.new
|
|
831
|
-
expected = "{\"actions\":[{\"scheme\":\"http://schemas.ogf.org/occi/infrastructure/compute/action#\",\"term\":\"start\",\"attributes\":{}}],\"kinds\":[{\"parent\":\"http://schemas.ogf.org/occi/core#resource\",\"related\":[\"http://schemas.ogf.org/occi/core#resource\"],\"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\"],\"location\":\"/compute/\",\"scheme\":\"http://schemas.ogf.org/occi/infrastructure#\",\"term\":\"compute\",\"title\":\"compute resource\",\"attributes\":{\"occi\":{\"core\":{\"id\":{\"type\":\"string\",\"required\":
|
|
831
|
+
expected = "{\"actions\":[{\"scheme\":\"http://schemas.ogf.org/occi/infrastructure/compute/action#\",\"term\":\"start\",\"attributes\":{}}],\"kinds\":[{\"parent\":\"http://schemas.ogf.org/occi/core#resource\",\"related\":[\"http://schemas.ogf.org/occi/core#resource\"],\"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\"],\"location\":\"/compute/\",\"scheme\":\"http://schemas.ogf.org/occi/infrastructure#\",\"term\":\"compute\",\"title\":\"compute resource\",\"attributes\":{\"occi\":{\"core\":{\"id\":{\"type\":\"string\",\"required\":true,\"mutable\":false,\"pattern\":\"[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}\"},\"title\":{\"type\":\"string\",\"required\":false,\"mutable\":true,\"pattern\":\".*\"},\"summary\":{\"type\":\"string\",\"required\":false,\"mutable\":true,\"pattern\":\".*\"}},\"compute\":{\"architecture\":{\"type\":\"string\",\"required\":false,\"mutable\":true,\"pattern\":\"x86|x64\"},\"cores\":{\"type\":\"number\",\"required\":false,\"mutable\":true,\"pattern\":\".*\"},\"hostname\":{\"type\":\"string\",\"required\":false,\"mutable\":true,\"pattern\":\"(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*\"},\"memory\":{\"type\":\"number\",\"required\":false,\"mutable\":true,\"pattern\":\".*\"},\"speed\":{\"type\":\"number\",\"required\":false,\"mutable\":true,\"pattern\":\".*\"},\"state\":{\"default\":\"inactive\",\"type\":\"string\",\"required\":false,\"mutable\":false,\"pattern\":\"inactive|active|suspended|error\"}}}}}],\"links\":[{\"kind\":\"http://schemas.ogf.org/occi/core#link\",\"attributes\":{\"occi\":{\"core\":{\"id\":\"#{collection.links.first.id}\"}}},\"id\":\"#{collection.links.first.id}\",\"rel\":\"http://schemas.ogf.org/occi/core#link\"}],\"mixins\":[{\"location\":\"/mixin/my_mixin/\",\"scheme\":\"http://example.com/occi/tags#\",\"term\":\"my_mixin\",\"attributes\":{}}]}"
|
|
832
832
|
|
|
833
833
|
hash=Hashie::Mash.new(JSON.parse(expected))
|
|
834
834
|
expect(collection.as_json).to eql(hash)
|
|
@@ -845,7 +845,7 @@ module Occi
|
|
|
845
845
|
collection.resources << Occi::Core::Resource.new
|
|
846
846
|
collection.links << Occi::Core::Link.new
|
|
847
847
|
|
|
848
|
-
expected = "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.core.id{immutable} occi.core.title occi.core.summary occi.compute.architecture occi.compute.cores occi.compute.hostname occi.compute.memory occi.compute.speed occi.compute.state{immutable}\";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\"\nCategory: my_mixin;scheme=\"http://example.com/occi/tags#\";class=\"mixin\";location=\"/mixin/my_mixin/\"\nCategory: start;scheme=\"http://schemas.ogf.org/occi/infrastructure/compute/action#\";class=\"action\"\nCategory: resource;scheme=\"http://schemas.ogf.org/occi/core#\";class=\"kind\";location=\"/resource/\";title=\"resource\"\nX-OCCI-Attribute: occi.core.id=\"#{collection.resources.first.id}\"Link: <>;rel=\"http://schemas.ogf.org/occi/core#link\";self=\"/link/#{collection.links.first.id}\";category=\"http://schemas.ogf.org/occi/core#link\";occi.core.id=\"#{collection.links.first.id}\"Category: action_instance;scheme=\"http://schemas.ogf.org/occi/core#\";class=\"action\""
|
|
848
|
+
expected = "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.core.id{immutable required} occi.core.title occi.core.summary occi.compute.architecture occi.compute.cores occi.compute.hostname occi.compute.memory occi.compute.speed occi.compute.state{immutable}\";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\"\nCategory: my_mixin;scheme=\"http://example.com/occi/tags#\";class=\"mixin\";location=\"/mixin/my_mixin/\"\nCategory: start;scheme=\"http://schemas.ogf.org/occi/infrastructure/compute/action#\";class=\"action\"\nCategory: resource;scheme=\"http://schemas.ogf.org/occi/core#\";class=\"kind\";location=\"/resource/\";title=\"resource\"\nX-OCCI-Attribute: occi.core.id=\"#{collection.resources.first.id}\"Link: <>;rel=\"http://schemas.ogf.org/occi/core#link\";self=\"/link/#{collection.links.first.id}\";category=\"http://schemas.ogf.org/occi/core#link\";occi.core.id=\"#{collection.links.first.id}\"Category: action_instance;scheme=\"http://schemas.ogf.org/occi/core#\";class=\"action\""
|
|
849
849
|
expect(collection.to_text).to eql(expected)
|
|
850
850
|
end
|
|
851
851
|
|
|
@@ -856,7 +856,7 @@ module Occi
|
|
|
856
856
|
|
|
857
857
|
it 'renders text correctly, kinds only' do
|
|
858
858
|
collection.kinds << "http://schemas.ogf.org/occi/infrastructure#compute"
|
|
859
|
-
expected = "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.core.id{immutable} occi.core.title occi.core.summary occi.compute.architecture occi.compute.cores occi.compute.hostname occi.compute.memory occi.compute.speed occi.compute.state{immutable}\";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\"\n"
|
|
859
|
+
expected = "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.core.id{immutable required} occi.core.title occi.core.summary occi.compute.architecture occi.compute.cores occi.compute.hostname occi.compute.memory occi.compute.speed occi.compute.state{immutable}\";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\"\n"
|
|
860
860
|
expect(collection.to_text).to eql(expected)
|
|
861
861
|
end
|
|
862
862
|
|
|
@@ -906,7 +906,7 @@ module Occi
|
|
|
906
906
|
collection.links << Occi::Core::Link.new
|
|
907
907
|
|
|
908
908
|
expected=Hashie::Mash.new
|
|
909
|
-
expected["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.core.id{immutable} occi.core.title occi.core.summary occi.compute.architecture occi.compute.cores occi.compute.hostname occi.compute.memory occi.compute.speed occi.compute.state{immutable}\";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\",my_mixin;scheme=\"http://example.com/occi/tags#\";class=\"mixin\";location=\"/mixin/my_mixin/\",start;scheme=\"http://schemas.ogf.org/occi/infrastructure/compute/action#\";class=\"action\",resource;scheme=\"http://schemas.ogf.org/occi/core#\";class=\"kind\";location=\"/resource/\";title=\"resource\",action_instance;scheme=\"http://schemas.ogf.org/occi/core#\";class=\"action\""
|
|
909
|
+
expected["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.core.id{immutable required} occi.core.title occi.core.summary occi.compute.architecture occi.compute.cores occi.compute.hostname occi.compute.memory occi.compute.speed occi.compute.state{immutable}\";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\",my_mixin;scheme=\"http://example.com/occi/tags#\";class=\"mixin\";location=\"/mixin/my_mixin/\",start;scheme=\"http://schemas.ogf.org/occi/infrastructure/compute/action#\";class=\"action\",resource;scheme=\"http://schemas.ogf.org/occi/core#\";class=\"kind\";location=\"/resource/\";title=\"resource\",action_instance;scheme=\"http://schemas.ogf.org/occi/core#\";class=\"action\""
|
|
910
910
|
expected["Link"] = "<>;rel=\"http://schemas.ogf.org/occi/core#link\";self=\"/link/#{collection.links.first.id}\";category=\"http://schemas.ogf.org/occi/core#link\";occi.core.id=\"#{collection.links.first.id}\""
|
|
911
911
|
expected["X-OCCI-Attribute"] = "occi.core.id=\"#{collection.resources.first.id}\""
|
|
912
912
|
expect(collection.to_header).to eql(expected)
|
|
@@ -920,7 +920,7 @@ module Occi
|
|
|
920
920
|
it 'renders text correctly, kinds only' do
|
|
921
921
|
collection.kinds << "http://schemas.ogf.org/occi/infrastructure#compute"
|
|
922
922
|
expected=Hashie::Mash.new
|
|
923
|
-
expected["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.core.id{immutable} occi.core.title occi.core.summary occi.compute.architecture occi.compute.cores occi.compute.hostname occi.compute.memory occi.compute.speed occi.compute.state{immutable}\";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\""
|
|
923
|
+
expected["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.core.id{immutable required} occi.core.title occi.core.summary occi.compute.architecture occi.compute.cores occi.compute.hostname occi.compute.memory occi.compute.speed occi.compute.state{immutable}\";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\""
|
|
924
924
|
expect(collection.to_header).to eql(expected)
|
|
925
925
|
end
|
|
926
926
|
|
|
@@ -245,7 +245,7 @@ module Occi
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
it 'renders attributes correctly' do
|
|
248
|
-
expected = ";attributes=\"numbertype stringtype booleantype booleantypefalse booleantypepattern nest.nested properties
|
|
248
|
+
expected = ";attributes=\"numbertype stringtype booleantype booleantypefalse booleantypepattern nest.nested properties category entity\""
|
|
249
249
|
expect(attrs.to_string_short).to eql expected
|
|
250
250
|
end
|
|
251
251
|
|
|
@@ -255,7 +255,7 @@ module Occi
|
|
|
255
255
|
end
|
|
256
256
|
|
|
257
257
|
it 'renders attributes with properties correctly' do
|
|
258
|
-
expected = ";attributes=\"immut_attr{immutable} req_attr{required} immut_req_attr{immutable}\""
|
|
258
|
+
expected = ";attributes=\"immut_attr{immutable} req_attr{required} immut_req_attr{immutable required}\""
|
|
259
259
|
expect(attrs_with_req_immut.to_string_short).to eql expected
|
|
260
260
|
end
|
|
261
261
|
end
|
data/spec/occi/core/link_spec.rb
CHANGED
|
@@ -21,6 +21,7 @@ module Occi
|
|
|
21
21
|
model = Occi::Model.new
|
|
22
22
|
model.register(link.kind)
|
|
23
23
|
link.model = model
|
|
24
|
+
link.source = Occi::Core::Resource.new
|
|
24
25
|
|
|
25
26
|
link.check
|
|
26
27
|
expect(link.attributes['stringtype']).to eql 'defaultforlink'
|
|
@@ -33,6 +34,7 @@ module Occi
|
|
|
33
34
|
model = Occi::Model.new
|
|
34
35
|
model.register(link.kind)
|
|
35
36
|
link.model = model
|
|
37
|
+
link.source = Occi::Core::Resource.new
|
|
36
38
|
|
|
37
39
|
link.check(true)
|
|
38
40
|
expect(link.attributes['stringtype']).to eql 'defaultforlink'
|
|
@@ -44,7 +46,7 @@ module Occi
|
|
|
44
46
|
norel.instance_eval { @rel=nil }
|
|
45
47
|
expect{ norel.check }.to raise_exception ArgumentError
|
|
46
48
|
end
|
|
47
|
-
end
|
|
49
|
+
end
|
|
48
50
|
end
|
|
49
51
|
end
|
|
50
52
|
end
|
|
@@ -43,7 +43,7 @@ module Occi
|
|
|
43
43
|
|
|
44
44
|
context 'number' do
|
|
45
45
|
let(:properties){ properties = Occi::Core::Properties.new
|
|
46
|
-
properties.type = 'number'
|
|
46
|
+
properties.type = 'number'
|
|
47
47
|
properties }
|
|
48
48
|
|
|
49
49
|
it 'permits number' do
|
|
@@ -117,20 +117,20 @@ module Occi
|
|
|
117
117
|
expected["pattern"] = "[adefltuv]+"
|
|
118
118
|
expected["required"] = true
|
|
119
119
|
expected["type"] = "string"
|
|
120
|
-
|
|
120
|
+
|
|
121
121
|
expect(properties.to_hash).to eql expected
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
it 'makes a correct rendering of empty props' do
|
|
125
125
|
empty = Occi::Core::Properties.new
|
|
126
126
|
expected = Hash.new
|
|
127
|
-
expected["mutable"] =
|
|
127
|
+
expected["mutable"] = true
|
|
128
128
|
expected["pattern"] = ".*"
|
|
129
129
|
expected["required"] = false
|
|
130
130
|
expected["type"] = "string"
|
|
131
|
-
|
|
131
|
+
|
|
132
132
|
expect(empty.to_hash).to eql expected
|
|
133
|
-
end
|
|
133
|
+
end
|
|
134
134
|
|
|
135
135
|
end
|
|
136
136
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Category: entity;scheme="http://schemas.ogf.org/occi/core#";class="kind";title="entity";location="/entity/";attributes="occi.core.id{immutable} occi.core.title string_attribute"
|
|
2
|
-
Category: resource;scheme="http://schemas.ogf.org/occi/core#";class="kind";title="resource";rel="http://schemas.ogf.org/occi/core#entity";location="/new_location/";attributes="occi.core.id{immutable} occi.core.title occi.core.summary"
|
|
3
|
-
Category: link;scheme="http://schemas.ogf.org/occi/core#";class="kind";title="link";rel="http://schemas.ogf.org/occi/core#entity";location="/link/";attributes="occi.core.id{
|
|
1
|
+
Category: entity;scheme="http://schemas.ogf.org/occi/core#";class="kind";title="entity";location="/entity/";attributes="occi.core.id{immutable required} occi.core.title string_attribute"
|
|
2
|
+
Category: resource;scheme="http://schemas.ogf.org/occi/core#";class="kind";title="resource";rel="http://schemas.ogf.org/occi/core#entity";location="/new_location/";attributes="occi.core.id{immutable required} occi.core.title occi.core.summary"
|
|
3
|
+
Category: link;scheme="http://schemas.ogf.org/occi/core#";class="kind";title="link";rel="http://schemas.ogf.org/occi/core#entity";location="/link/";attributes="occi.core.id{required} occi.core.title occi.core.target occi.core.source{required} stringtype{required} stringtypeoptional"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: occi-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.3.
|
|
4
|
+
version: 4.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Feldhaus
|
|
@@ -10,12 +10,15 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2014-10-
|
|
13
|
+
date: 2014-10-06 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: json
|
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
|
18
18
|
requirements:
|
|
19
|
+
- - "~>"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '1.8'
|
|
19
22
|
- - ">="
|
|
20
23
|
- !ruby/object:Gem::Version
|
|
21
24
|
version: 1.8.1
|
|
@@ -23,6 +26,9 @@ dependencies:
|
|
|
23
26
|
prerelease: false
|
|
24
27
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
28
|
requirements:
|
|
29
|
+
- - "~>"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '1.8'
|
|
26
32
|
- - ">="
|
|
27
33
|
- !ruby/object:Gem::Version
|
|
28
34
|
version: 1.8.1
|
|
@@ -30,6 +36,9 @@ dependencies:
|
|
|
30
36
|
name: hashie
|
|
31
37
|
requirement: !ruby/object:Gem::Requirement
|
|
32
38
|
requirements:
|
|
39
|
+
- - "~>"
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '3.3'
|
|
33
42
|
- - ">="
|
|
34
43
|
- !ruby/object:Gem::Version
|
|
35
44
|
version: 3.3.1
|
|
@@ -37,6 +46,9 @@ dependencies:
|
|
|
37
46
|
prerelease: false
|
|
38
47
|
version_requirements: !ruby/object:Gem::Requirement
|
|
39
48
|
requirements:
|
|
49
|
+
- - "~>"
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: '3.3'
|
|
40
52
|
- - ">="
|
|
41
53
|
- !ruby/object:Gem::Version
|
|
42
54
|
version: 3.3.1
|
|
@@ -44,6 +56,9 @@ dependencies:
|
|
|
44
56
|
name: uuidtools
|
|
45
57
|
requirement: !ruby/object:Gem::Requirement
|
|
46
58
|
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '2.1'
|
|
47
62
|
- - ">="
|
|
48
63
|
- !ruby/object:Gem::Version
|
|
49
64
|
version: 2.1.3
|
|
@@ -51,6 +66,9 @@ dependencies:
|
|
|
51
66
|
prerelease: false
|
|
52
67
|
version_requirements: !ruby/object:Gem::Requirement
|
|
53
68
|
requirements:
|
|
69
|
+
- - "~>"
|
|
70
|
+
- !ruby/object:Gem::Version
|
|
71
|
+
version: '2.1'
|
|
54
72
|
- - ">="
|
|
55
73
|
- !ruby/object:Gem::Version
|
|
56
74
|
version: 2.1.3
|
|
@@ -58,6 +76,9 @@ dependencies:
|
|
|
58
76
|
name: activesupport
|
|
59
77
|
requirement: !ruby/object:Gem::Requirement
|
|
60
78
|
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '4.0'
|
|
61
82
|
- - ">="
|
|
62
83
|
- !ruby/object:Gem::Version
|
|
63
84
|
version: 4.0.0
|
|
@@ -65,6 +86,9 @@ dependencies:
|
|
|
65
86
|
prerelease: false
|
|
66
87
|
version_requirements: !ruby/object:Gem::Requirement
|
|
67
88
|
requirements:
|
|
89
|
+
- - "~>"
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: '4.0'
|
|
68
92
|
- - ">="
|
|
69
93
|
- !ruby/object:Gem::Version
|
|
70
94
|
version: 4.0.0
|
|
@@ -72,6 +96,9 @@ dependencies:
|
|
|
72
96
|
name: settingslogic
|
|
73
97
|
requirement: !ruby/object:Gem::Requirement
|
|
74
98
|
requirements:
|
|
99
|
+
- - "~>"
|
|
100
|
+
- !ruby/object:Gem::Version
|
|
101
|
+
version: '2.0'
|
|
75
102
|
- - ">="
|
|
76
103
|
- !ruby/object:Gem::Version
|
|
77
104
|
version: 2.0.9
|
|
@@ -79,6 +106,9 @@ dependencies:
|
|
|
79
106
|
prerelease: false
|
|
80
107
|
version_requirements: !ruby/object:Gem::Requirement
|
|
81
108
|
requirements:
|
|
109
|
+
- - "~>"
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: '2.0'
|
|
82
112
|
- - ">="
|
|
83
113
|
- !ruby/object:Gem::Version
|
|
84
114
|
version: 2.0.9
|