rbvmomi 1.8.5 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +13 -0
- data/.travis.yml +10 -0
- data/Gemfile +3 -0
- data/README.rdoc +6 -2
- data/Rakefile +2 -35
- data/{bin → exe}/rbvmomish +0 -0
- data/ext/mkrf_conf.rb +24 -0
- data/lib/rbvmomi/basic_types.rb +6 -0
- data/lib/rbvmomi/trivial_soap.rb +5 -7
- data/lib/rbvmomi/utils/admission_control.rb +19 -19
- data/lib/rbvmomi/utils/perfdump.rb +1 -1
- data/lib/rbvmomi/version.rb +3 -0
- data/lib/rbvmomi/vim.rb +25 -4
- data/lib/rbvmomi/vim/Datacenter.rb +5 -0
- data/lib/rbvmomi/vim/Datastore.rb +2 -1
- data/lib/rbvmomi/vim/OvfManager.rb +2 -1
- data/lib/rbvmomi/vim/ReflectManagedMethodExecuter.rb +2 -2
- data/rbvmomi.gemspec +33 -0
- data/vmodl.db +0 -0
- metadata +100 -32
- data/VERSION +0 -1
- data/test/test_deserialization.rb +0 -383
- data/test/test_emit_request.rb +0 -128
- data/test/test_exceptions.rb +0 -14
- data/test/test_helper.rb +0 -14
- data/test/test_misc.rb +0 -24
- data/test/test_parse_response.rb +0 -69
- data/test/test_serialization.rb +0 -311
data/test/test_emit_request.rb
DELETED
@@ -1,128 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class EmitRequestTest < Test::Unit::TestCase
|
4
|
-
MO = VIM::VirtualMachine(nil, "foo")
|
5
|
-
|
6
|
-
def check desc, str, this, params
|
7
|
-
soap = VIM.new(:ns => 'urn:vim25', :rev => '4.0')
|
8
|
-
xml = Builder::XmlMarkup.new :indent => 2
|
9
|
-
soap.emit_request xml, 'root', desc, this, params
|
10
|
-
|
11
|
-
begin
|
12
|
-
assert_equal str, xml.target!
|
13
|
-
rescue MiniTest::Assertion
|
14
|
-
puts "expected:"
|
15
|
-
puts str
|
16
|
-
puts
|
17
|
-
puts "got:"
|
18
|
-
puts xml.target!
|
19
|
-
puts
|
20
|
-
raise
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_string_array
|
25
|
-
desc = [
|
26
|
-
{
|
27
|
-
'name' => 'blah',
|
28
|
-
'is-array' => true,
|
29
|
-
'is-optional' => true,
|
30
|
-
'wsdl_type' => 'xsd:string',
|
31
|
-
}
|
32
|
-
]
|
33
|
-
|
34
|
-
check desc, <<-EOS, MO, :blah => ['a', 'b', 'c']
|
35
|
-
<root xmlns="urn:vim25">
|
36
|
-
<_this type="VirtualMachine">foo</_this>
|
37
|
-
<blah>a</blah>
|
38
|
-
<blah>b</blah>
|
39
|
-
<blah>c</blah>
|
40
|
-
</root>
|
41
|
-
EOS
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_required_param
|
45
|
-
desc = [
|
46
|
-
{
|
47
|
-
'name' => 'blah',
|
48
|
-
'is-array' => false,
|
49
|
-
'is-optional' => false,
|
50
|
-
'wsdl_type' => 'xsd:string',
|
51
|
-
}
|
52
|
-
]
|
53
|
-
|
54
|
-
check desc, <<-EOS, MO, :blah => 'a'
|
55
|
-
<root xmlns="urn:vim25">
|
56
|
-
<_this type="VirtualMachine">foo</_this>
|
57
|
-
<blah>a</blah>
|
58
|
-
</root>
|
59
|
-
EOS
|
60
|
-
|
61
|
-
assert_raise RuntimeError do
|
62
|
-
check desc, <<-EOS, MO, {}
|
63
|
-
<root xmlns="urn:vim25">
|
64
|
-
<_this type="VirtualMachine">foo</_this>
|
65
|
-
</root>
|
66
|
-
EOS
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_optional_param
|
71
|
-
desc = [
|
72
|
-
{
|
73
|
-
'name' => 'blah',
|
74
|
-
'is-array' => false,
|
75
|
-
'is-optional' => true,
|
76
|
-
'wsdl_type' => 'xsd:string',
|
77
|
-
}
|
78
|
-
]
|
79
|
-
|
80
|
-
check desc, <<-EOS, MO, {}
|
81
|
-
<root xmlns="urn:vim25">
|
82
|
-
<_this type="VirtualMachine">foo</_this>
|
83
|
-
</root>
|
84
|
-
EOS
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_nil_optional_param
|
88
|
-
desc = [
|
89
|
-
{
|
90
|
-
'name' => 'blah',
|
91
|
-
'is-array' => false,
|
92
|
-
'is-optional' => true,
|
93
|
-
'wsdl_type' => 'xsd:string',
|
94
|
-
}
|
95
|
-
]
|
96
|
-
|
97
|
-
check desc, <<-EOS, MO, :blah => nil
|
98
|
-
<root xmlns="urn:vim25">
|
99
|
-
<_this type="VirtualMachine">foo</_this>
|
100
|
-
</root>
|
101
|
-
EOS
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_string_key
|
105
|
-
desc = [
|
106
|
-
{
|
107
|
-
'name' => 'blah',
|
108
|
-
'is-array' => false,
|
109
|
-
'is-optional' => false,
|
110
|
-
'wsdl_type' => 'xsd:string',
|
111
|
-
}
|
112
|
-
]
|
113
|
-
|
114
|
-
check desc, <<-EOS, MO, 'blah' => 'a'
|
115
|
-
<root xmlns="urn:vim25">
|
116
|
-
<_this type="VirtualMachine">foo</_this>
|
117
|
-
<blah>a</blah>
|
118
|
-
</root>
|
119
|
-
EOS
|
120
|
-
end
|
121
|
-
|
122
|
-
def disabled_test_required_property
|
123
|
-
assert_raise RuntimeError do
|
124
|
-
VIM::AboutInfo()
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
data/test/test_exceptions.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class ExceptionTest < Test::Unit::TestCase
|
4
|
-
def test_fault
|
5
|
-
begin
|
6
|
-
fault = VIM::InvalidArgument.new :invalidProperty => 'foo'
|
7
|
-
assert_raises RbVmomi::Fault do
|
8
|
-
raise RbVmomi::Fault.new('A specified parameter was not correct.', fault)
|
9
|
-
end
|
10
|
-
rescue VIM::InvalidArgument
|
11
|
-
assert_equal 'foo', $!.invalidProperty
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
data/test/test_helper.rb
DELETED
data/test/test_misc.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class MiscTest < Test::Unit::TestCase
|
4
|
-
def test_overridden_const
|
5
|
-
assert(VIM::SecurityError < RbVmomi::BasicTypes::Base)
|
6
|
-
assert_equal 'SecurityError', VIM::SecurityError.wsdl_name
|
7
|
-
end
|
8
|
-
|
9
|
-
# XXX
|
10
|
-
def disabled_test_dynamically_overridden_const
|
11
|
-
assert !VIM.const_defined?(:ClusterAttemptedVmInfo)
|
12
|
-
Object.const_set :ClusterAttemptedVmInfo, :override
|
13
|
-
assert VIM::ClusterAttemptedVmInfo.is_a?(Class)
|
14
|
-
assert(VIM::ClusterAttemptedVmInfo < RbVmomi::BasicTypes::Base)
|
15
|
-
assert_equal 'ClusterAttemptedVmInfo', VIM::ClusterAttemptedVmInfo.wsdl_name
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_loader
|
19
|
-
klass = VIM.loader.get('HostSystem')
|
20
|
-
klass2 = VIM::HostSystem
|
21
|
-
assert_equal klass, klass2
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
data/test/test_parse_response.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class ParseResponseTest < Test::Unit::TestCase
|
4
|
-
def check desc, str, expected
|
5
|
-
soap = VIM.new(:ns => 'urn:vim25', :rev => '4.0')
|
6
|
-
got = soap.parse_response Nokogiri(str).root, desc
|
7
|
-
assert_equal expected, got
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_string_array
|
11
|
-
desc = { 'wsdl_type' => 'xsd:string', 'is-array' => true, 'is-task' => false }
|
12
|
-
|
13
|
-
check desc, <<-EOS, ['a', 'b', 'c']
|
14
|
-
<root xmlns="urn:vim25">
|
15
|
-
<blah>a</blah>
|
16
|
-
<blah>b</blah>
|
17
|
-
<blah>c</blah>
|
18
|
-
</root>
|
19
|
-
EOS
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_missing_parameter_fault
|
23
|
-
desc = { 'wsdl_type' => nil, 'is-array' => false, 'is-task' => false }
|
24
|
-
|
25
|
-
assert_raise RuntimeError do
|
26
|
-
check desc, <<-EOS, ['a', 'b', 'c']
|
27
|
-
<soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
28
|
-
<faultcode>ClientFaultCode</faultcode>
|
29
|
-
<faultstring>Required parameter selectionSet is missing</faultstring>
|
30
|
-
</soapenv:Fault>
|
31
|
-
EOS
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_invalid_argument_fault
|
36
|
-
desc = { 'wsdl_type' => nil, 'is-array' => false, 'is-task' => false }
|
37
|
-
|
38
|
-
assert_raise RbVmomi::Fault do
|
39
|
-
begin
|
40
|
-
check desc, <<-EOS, nil
|
41
|
-
<soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
|
42
|
-
<faultcode>ServerFaultCode</faultcode>
|
43
|
-
<faultstring>A specified parameter was not correct. ticketType</faultstring>
|
44
|
-
<detail>
|
45
|
-
<InvalidArgumentFault xmlns="urn:vim25" xsi:type="InvalidArgument">
|
46
|
-
<invalidProperty>ticketType</invalidProperty>
|
47
|
-
</InvalidArgumentFault>
|
48
|
-
</detail>
|
49
|
-
</soapenv:Fault>
|
50
|
-
EOS
|
51
|
-
rescue VIM::InvalidArgument
|
52
|
-
raise
|
53
|
-
rescue
|
54
|
-
raise "wrong fault"
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_task_array_result
|
60
|
-
desc = { 'wsdl_type' => 'xsd:string', 'is-array' => true, 'is-task' => true }
|
61
|
-
|
62
|
-
check desc, <<-EOS, VIM.Task(nil, 'haTask-ha-host-vim.DiagnosticManager.generateLogBundles-865')
|
63
|
-
<root xmlns="urn:vim25">
|
64
|
-
<returnval type="Task">haTask-ha-host-vim.DiagnosticManager.generateLogBundles-865</returnval>
|
65
|
-
</root>
|
66
|
-
EOS
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
data/test/test_serialization.rb
DELETED
@@ -1,311 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class SerializationTest < Test::Unit::TestCase
|
4
|
-
def check str, obj, type, array=false
|
5
|
-
conn = VIM.new(:ns => 'urn:vim25', :rev => '4.0')
|
6
|
-
xml = Builder::XmlMarkup.new :indent => 2
|
7
|
-
conn.obj2xml(xml, 'root', type, array, obj)
|
8
|
-
|
9
|
-
begin
|
10
|
-
assert_equal str, xml.target!
|
11
|
-
rescue MiniTest::Assertion
|
12
|
-
puts "expected:"
|
13
|
-
puts str
|
14
|
-
puts
|
15
|
-
puts "got:"
|
16
|
-
puts xml.target!
|
17
|
-
puts
|
18
|
-
raise
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_moref
|
23
|
-
check <<-EOS, VIM.Folder(nil, "ha-folder-host"), "Folder"
|
24
|
-
<root type="Folder">ha-folder-host</root>
|
25
|
-
EOS
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_config
|
29
|
-
cfg = VIM.VirtualMachineConfigSpec(
|
30
|
-
:name => 'vm',
|
31
|
-
:files => { :vmPathName => '[datastore1]' },
|
32
|
-
:guestId => 'otherGuest64',
|
33
|
-
:numCPUs => 2,
|
34
|
-
:memoryMB => 3072,
|
35
|
-
:deviceChange => [
|
36
|
-
{
|
37
|
-
:operation => :add,
|
38
|
-
:device => VIM.VirtualLsiLogicController(
|
39
|
-
:key => 1000,
|
40
|
-
:busNumber => 0,
|
41
|
-
:sharedBus => :noSharing
|
42
|
-
)
|
43
|
-
}, VIM.VirtualDeviceConfigSpec(
|
44
|
-
:operation => VIM.VirtualDeviceConfigSpecOperation(:add),
|
45
|
-
:fileOperation => VIM.VirtualDeviceConfigSpecFileOperation(:create),
|
46
|
-
:device => VIM.VirtualDisk(
|
47
|
-
:key => 0,
|
48
|
-
:backing => VIM.VirtualDiskFlatVer2BackingInfo(
|
49
|
-
:fileName => '[datastore1]',
|
50
|
-
:diskMode => :persistent,
|
51
|
-
:thinProvisioned => true
|
52
|
-
),
|
53
|
-
:controllerKey => 1000,
|
54
|
-
:unitNumber => 0,
|
55
|
-
:capacityInKB => 4000000
|
56
|
-
)
|
57
|
-
), {
|
58
|
-
:operation => :add,
|
59
|
-
:device => VIM.VirtualE1000(
|
60
|
-
:key => 0,
|
61
|
-
:deviceInfo => {
|
62
|
-
:label => 'Network Adapter 1',
|
63
|
-
:summary => 'VM Network'
|
64
|
-
},
|
65
|
-
:backing => VIM.VirtualEthernetCardNetworkBackingInfo(
|
66
|
-
:deviceName => 'VM Network'
|
67
|
-
),
|
68
|
-
:addressType => 'generated'
|
69
|
-
)
|
70
|
-
}
|
71
|
-
],
|
72
|
-
:extraConfig => [
|
73
|
-
{
|
74
|
-
:key => 'bios.bootOrder',
|
75
|
-
:value => 'ethernet0'
|
76
|
-
}
|
77
|
-
]
|
78
|
-
)
|
79
|
-
check <<-EOS, cfg, "VirtualMachineConfigSpec"
|
80
|
-
<root xsi:type="VirtualMachineConfigSpec">
|
81
|
-
<name>vm</name>
|
82
|
-
<guestId>otherGuest64</guestId>
|
83
|
-
<files xsi:type="VirtualMachineFileInfo">
|
84
|
-
<vmPathName>[datastore1]</vmPathName>
|
85
|
-
</files>
|
86
|
-
<numCPUs>2</numCPUs>
|
87
|
-
<memoryMB>3072</memoryMB>
|
88
|
-
<deviceChange xsi:type="VirtualDeviceConfigSpec">
|
89
|
-
<operation>add</operation>
|
90
|
-
<device xsi:type="VirtualLsiLogicController">
|
91
|
-
<key>1000</key>
|
92
|
-
<busNumber>0</busNumber>
|
93
|
-
<sharedBus>noSharing</sharedBus>
|
94
|
-
</device>
|
95
|
-
</deviceChange>
|
96
|
-
<deviceChange xsi:type="VirtualDeviceConfigSpec">
|
97
|
-
<operation>add</operation>
|
98
|
-
<fileOperation>create</fileOperation>
|
99
|
-
<device xsi:type="VirtualDisk">
|
100
|
-
<key>0</key>
|
101
|
-
<backing xsi:type="VirtualDiskFlatVer2BackingInfo">
|
102
|
-
<fileName>[datastore1]</fileName>
|
103
|
-
<diskMode>persistent</diskMode>
|
104
|
-
<thinProvisioned>1</thinProvisioned>
|
105
|
-
</backing>
|
106
|
-
<controllerKey>1000</controllerKey>
|
107
|
-
<unitNumber>0</unitNumber>
|
108
|
-
<capacityInKB>4000000</capacityInKB>
|
109
|
-
</device>
|
110
|
-
</deviceChange>
|
111
|
-
<deviceChange xsi:type="VirtualDeviceConfigSpec">
|
112
|
-
<operation>add</operation>
|
113
|
-
<device xsi:type="VirtualE1000">
|
114
|
-
<key>0</key>
|
115
|
-
<deviceInfo xsi:type="Description">
|
116
|
-
<label>Network Adapter 1</label>
|
117
|
-
<summary>VM Network</summary>
|
118
|
-
</deviceInfo>
|
119
|
-
<backing xsi:type="VirtualEthernetCardNetworkBackingInfo">
|
120
|
-
<deviceName>VM Network</deviceName>
|
121
|
-
</backing>
|
122
|
-
<addressType>generated</addressType>
|
123
|
-
</device>
|
124
|
-
</deviceChange>
|
125
|
-
<extraConfig xsi:type="OptionValue">
|
126
|
-
<key>bios.bootOrder</key>
|
127
|
-
<value xsi:type="xsd:string">ethernet0</value>
|
128
|
-
</extraConfig>
|
129
|
-
</root>
|
130
|
-
EOS
|
131
|
-
end
|
132
|
-
|
133
|
-
def test_nil_field
|
134
|
-
obj = VIM.OptionValue(:key => 'foo', :value => nil)
|
135
|
-
check <<-EOS, obj, "OptionValue"
|
136
|
-
<root xsi:type="OptionValue">
|
137
|
-
<key>foo</key>
|
138
|
-
</root>
|
139
|
-
EOS
|
140
|
-
end
|
141
|
-
|
142
|
-
def test_string_array
|
143
|
-
obj = ["foo", "bar", "baz"]
|
144
|
-
check <<-EOS, obj, "xsd:string", true
|
145
|
-
<root>foo</root>
|
146
|
-
<root>bar</root>
|
147
|
-
<root>baz</root>
|
148
|
-
EOS
|
149
|
-
end
|
150
|
-
|
151
|
-
def test_int_array
|
152
|
-
obj = [1,2,3]
|
153
|
-
check <<-EOS, obj, "xsd:int", true
|
154
|
-
<root>1</root>
|
155
|
-
<root>2</root>
|
156
|
-
<root>3</root>
|
157
|
-
EOS
|
158
|
-
end
|
159
|
-
|
160
|
-
def test_boolean_array
|
161
|
-
obj = [true,false,true]
|
162
|
-
check <<-EOS, obj, "xsd:boolean", true
|
163
|
-
<root>1</root>
|
164
|
-
<root>0</root>
|
165
|
-
<root>1</root>
|
166
|
-
EOS
|
167
|
-
end
|
168
|
-
|
169
|
-
def test_float_array
|
170
|
-
obj = [0.0,1.5,3.14]
|
171
|
-
check <<-EOS, obj, "xsd:float", true
|
172
|
-
<root>0.0</root>
|
173
|
-
<root>1.5</root>
|
174
|
-
<root>3.14</root>
|
175
|
-
EOS
|
176
|
-
end
|
177
|
-
|
178
|
-
def test_binary
|
179
|
-
obj = "\x00foo\x01bar\x02baz"
|
180
|
-
check <<-EOS, obj, 'xsd:base64Binary'
|
181
|
-
<root>AGZvbwFiYXICYmF6</root>
|
182
|
-
EOS
|
183
|
-
end
|
184
|
-
|
185
|
-
def test_property_spec
|
186
|
-
interested = %w(info.progress info.state info.entityName info.error)
|
187
|
-
tasks = [VIM::Task.new(nil, 'task-11')]
|
188
|
-
obj = {
|
189
|
-
:propSet => [{ :type => 'Task', :all => false, :pathSet => interested }],
|
190
|
-
:objectSet => tasks.map { |x| { :obj => x } },
|
191
|
-
}
|
192
|
-
check <<-EOS, obj, 'PropertyFilterSpec'
|
193
|
-
<root xsi:type="PropertyFilterSpec">
|
194
|
-
<propSet xsi:type="PropertySpec">
|
195
|
-
<type>Task</type>
|
196
|
-
<all>0</all>
|
197
|
-
<pathSet>info.progress</pathSet>
|
198
|
-
<pathSet>info.state</pathSet>
|
199
|
-
<pathSet>info.entityName</pathSet>
|
200
|
-
<pathSet>info.error</pathSet>
|
201
|
-
</propSet>
|
202
|
-
<objectSet xsi:type="ObjectSpec">
|
203
|
-
<obj type="Task">task-11</obj>
|
204
|
-
</objectSet>
|
205
|
-
</root>
|
206
|
-
EOS
|
207
|
-
|
208
|
-
end
|
209
|
-
|
210
|
-
def test_keyvalue
|
211
|
-
obj = RbVmomi::BasicTypes::KeyValue.new('a', 'b')
|
212
|
-
check <<-EOS, obj, 'KeyValue', false
|
213
|
-
<root>
|
214
|
-
<key>a</key>
|
215
|
-
<value>b</value>
|
216
|
-
</root>
|
217
|
-
EOS
|
218
|
-
|
219
|
-
obj = ['a', 'b']
|
220
|
-
check <<-EOS, obj, 'KeyValue', false
|
221
|
-
<root>
|
222
|
-
<key>a</key>
|
223
|
-
<value>b</value>
|
224
|
-
</root>
|
225
|
-
EOS
|
226
|
-
|
227
|
-
obj = [['a', 'b'], ['c', 'd']]
|
228
|
-
check <<-EOS, obj, 'KeyValue', true
|
229
|
-
<root>
|
230
|
-
<key>a</key>
|
231
|
-
<value>b</value>
|
232
|
-
</root>
|
233
|
-
<root>
|
234
|
-
<key>c</key>
|
235
|
-
<value>d</value>
|
236
|
-
</root>
|
237
|
-
EOS
|
238
|
-
|
239
|
-
obj = { 'a' => 'b', :c => 'd' }
|
240
|
-
check <<-EOS, obj, 'KeyValue', true
|
241
|
-
<root>
|
242
|
-
<key>a</key>
|
243
|
-
<value>b</value>
|
244
|
-
</root>
|
245
|
-
<root>
|
246
|
-
<key>c</key>
|
247
|
-
<value>d</value>
|
248
|
-
</root>
|
249
|
-
EOS
|
250
|
-
end
|
251
|
-
|
252
|
-
def test_ovf_import_spec_params
|
253
|
-
obj = RbVmomi::VIM::OvfCreateImportSpecParams(
|
254
|
-
:hostSystem => VIM::HostSystem(nil, "myhost"),
|
255
|
-
:locale => "US",
|
256
|
-
:entityName => "myvm",
|
257
|
-
:deploymentOption => "",
|
258
|
-
:networkMapping => [],
|
259
|
-
:propertyMapping => [['a', 'b'], ['c', 'd']],
|
260
|
-
:diskProvisioning => :thin
|
261
|
-
)
|
262
|
-
|
263
|
-
check <<-EOS, obj, 'OvfCreateImportSpecParams', false
|
264
|
-
<root xsi:type="OvfCreateImportSpecParams">
|
265
|
-
<locale>US</locale>
|
266
|
-
<deploymentOption></deploymentOption>
|
267
|
-
<entityName>myvm</entityName>
|
268
|
-
<hostSystem type="HostSystem">myhost</hostSystem>
|
269
|
-
<propertyMapping>
|
270
|
-
<key>a</key>
|
271
|
-
<value>b</value>
|
272
|
-
</propertyMapping>
|
273
|
-
<propertyMapping>
|
274
|
-
<key>c</key>
|
275
|
-
<value>d</value>
|
276
|
-
</propertyMapping>
|
277
|
-
<diskProvisioning>thin</diskProvisioning>
|
278
|
-
</root>
|
279
|
-
EOS
|
280
|
-
end
|
281
|
-
|
282
|
-
def test_datetime
|
283
|
-
obj = DateTime.new(2011, 11, 16, 13, 36, 8, Rational(-8,24))
|
284
|
-
check <<-EOS, obj, 'xsd:dateTime', false
|
285
|
-
<root>2011-11-16T13:36:08-08:00</root>
|
286
|
-
EOS
|
287
|
-
end
|
288
|
-
|
289
|
-
def test_time
|
290
|
-
obj = Time.at(DateTime.new(2011, 11, 16, 13, 36, 8, Rational(-8,24)).strftime("%s").to_i).getgm
|
291
|
-
check <<-EOS, obj, 'xsd:dateTime', false
|
292
|
-
<root>2011-11-16T21:36:08Z</root>
|
293
|
-
EOS
|
294
|
-
end
|
295
|
-
|
296
|
-
# TODO test all types
|
297
|
-
def test_any_type
|
298
|
-
obj = 1
|
299
|
-
check <<-EOS, obj, 'xsd:anyType', false
|
300
|
-
<root xsi:type="xsd:long">1</root>
|
301
|
-
EOS
|
302
|
-
|
303
|
-
obj = VIM::HostAccountSpec(:id => 'root', :password => 'foo')
|
304
|
-
check <<-EOS, obj, 'xsd:anyType', false
|
305
|
-
<root xsi:type="HostAccountSpec">
|
306
|
-
<id>root</id>
|
307
|
-
<password>foo</password>
|
308
|
-
</root>
|
309
|
-
EOS
|
310
|
-
end
|
311
|
-
end
|