occi-core 4.2.13 → 4.2.14
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/link.rb +7 -7
- data/lib/occi/version.rb +1 -1
- data/spec/occi/core/link_spec.rb +17 -2
- data/spec/occi/core/resource_spec.rb +1 -1
- data/spec/occi/infrastructure/compute_spec.rb +5 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97bfbcd8727b44c08e826dbbe76a6f7c05034a5c
|
4
|
+
data.tar.gz: b549d11e985dc2ef189b17fe6e51d02b26fdb75b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b48367de96eccf0689868a85e72fb3eadc0576f2bbc7e9cf3248538aa5a21e943cc66e6aeeb3dd679be635b6613453df410330efb731aa92606e649c52f3ba75
|
7
|
+
data.tar.gz: d735235babe4e5405902d583504957ee15a0235037566f7adb4cc152aa74da33c8525236b92c723687951541da5480031c1787a2e4a6f3d7e70a6336552e3164
|
data/lib/occi/core/link.rb
CHANGED
@@ -11,7 +11,7 @@ module Occi
|
|
11
11
|
self.kind = Occi::Core::Kind.new scheme='http://schemas.ogf.org/occi/core#',
|
12
12
|
term='link',
|
13
13
|
title='link',
|
14
|
-
attributes=self.attributes,
|
14
|
+
attributes=Occi::Core::Attributes.new(self.attributes),
|
15
15
|
parent=Occi::Core::Entity.kind
|
16
16
|
|
17
17
|
# @param [String] kind
|
@@ -38,8 +38,8 @@ module Occi
|
|
38
38
|
# set target attribute of link
|
39
39
|
# @param [String] target
|
40
40
|
def target=(target)
|
41
|
-
self.attributes['occi.core.target'] = target
|
42
|
-
@target = target
|
41
|
+
self.attributes['occi.core.target'] = target.to_s
|
42
|
+
@target = target.to_s
|
43
43
|
end
|
44
44
|
|
45
45
|
# @return [String] source attribute of the link
|
@@ -51,13 +51,13 @@ module Occi
|
|
51
51
|
# set source attribute of link
|
52
52
|
# @param [String] source
|
53
53
|
def source=(source)
|
54
|
-
self.attributes['occi.core.source'] = source
|
55
|
-
@source = source
|
54
|
+
self.attributes['occi.core.source'] = source.to_s
|
55
|
+
@source = source.to_s
|
56
56
|
end
|
57
57
|
|
58
58
|
# Runs check on attributes
|
59
|
-
def check
|
60
|
-
raise ArgumentError, "Cannot run check on #{self.to_s} without relation (
|
59
|
+
def check(set_defaults = false)
|
60
|
+
raise ArgumentError, "Cannot run check on #{self.to_s.inspect} kind #{self.kind.to_s.inspect} without relation (the rel attribute) set!" unless @rel
|
61
61
|
super
|
62
62
|
end
|
63
63
|
|
data/lib/occi/version.rb
CHANGED
data/spec/occi/core/link_spec.rb
CHANGED
@@ -8,9 +8,11 @@ module Occi
|
|
8
8
|
context '#check' do
|
9
9
|
let(:defs){
|
10
10
|
defs = Occi::Core::Attributes.new
|
11
|
-
defs['occi.core.id']
|
12
|
-
defs['stringtype']
|
11
|
+
defs['occi.core.id'] = { :type=> 'string', :required => true }
|
12
|
+
defs['stringtype'] = { :type => 'string', :pattern => '[adefltuv]+',
|
13
13
|
:default => 'defaultforlink', :mutable => true, :required => true }
|
14
|
+
defs['stringtypeoptional'] = { :type => 'string', :pattern => '[adefltuv]+',
|
15
|
+
:default => 'defaultforlink', :mutable => true, :required => false }
|
14
16
|
defs }
|
15
17
|
|
16
18
|
it 'sets default for required attribute' do
|
@@ -22,6 +24,19 @@ module Occi
|
|
22
24
|
|
23
25
|
link.check
|
24
26
|
expect(link.attributes['stringtype']).to eql 'defaultforlink'
|
27
|
+
expect(link.attributes['stringtypeoptional']).to be_nil
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'accepts the set_defaults flag' do
|
31
|
+
link = Occi::Core::Link.new
|
32
|
+
link.kind.attributes.merge!(defs)
|
33
|
+
model = Occi::Model.new
|
34
|
+
model.register(link.kind)
|
35
|
+
link.model = model
|
36
|
+
|
37
|
+
link.check(true)
|
38
|
+
expect(link.attributes['stringtype']).to eql 'defaultforlink'
|
39
|
+
expect(link.attributes['stringtypeoptional']).to eql 'defaultforlink'
|
25
40
|
end
|
26
41
|
|
27
42
|
it 'raises error if no relationship is set' do
|
@@ -27,12 +27,12 @@ module Occi
|
|
27
27
|
|
28
28
|
it "has the correct link as target" do
|
29
29
|
compute.storagelink target
|
30
|
-
expect(compute.links.first.target).to
|
30
|
+
expect(compute.links.first.target).to eq target.to_s
|
31
31
|
end
|
32
32
|
|
33
33
|
it "has target with correct ID" do
|
34
34
|
compute.storagelink target
|
35
|
-
expect(compute.links.first.target.
|
35
|
+
expect(compute.links.first.target.split('/').last).to eq target.id
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -55,7 +55,7 @@ module Occi
|
|
55
55
|
it 'shows correctly in collections' do
|
56
56
|
compute.storagelink target
|
57
57
|
compute.model=modl
|
58
|
-
expect(compute.storagelinks[0].target.
|
58
|
+
expect(compute.storagelinks[0].target.split('/').last).to eq target.id
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
@@ -80,7 +80,7 @@ module Occi
|
|
80
80
|
|
81
81
|
it "has the correct interface as target" do
|
82
82
|
compute.networkinterface target
|
83
|
-
expect(compute.links.first.target).to
|
83
|
+
expect(compute.links.first.target).to eq target.to_s
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
@@ -103,7 +103,7 @@ module Occi
|
|
103
103
|
it 'shows correctly in collections' do
|
104
104
|
compute.networkinterface target
|
105
105
|
compute.model=modl
|
106
|
-
expect(compute.networkinterfaces[0].target.
|
106
|
+
expect(compute.networkinterfaces[0].target.split('/').last).to eq target.id
|
107
107
|
end
|
108
108
|
end
|
109
109
|
end
|
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.2.
|
4
|
+
version: 4.2.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Feldhaus
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-04-
|
13
|
+
date: 2014-04-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -242,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
242
|
version: '0'
|
243
243
|
requirements: []
|
244
244
|
rubyforge_project:
|
245
|
-
rubygems_version: 2.
|
245
|
+
rubygems_version: 2.2.2
|
246
246
|
signing_key:
|
247
247
|
specification_version: 4
|
248
248
|
summary: OCCI toolkit
|