occi 3.0.0.beta.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/Gemfile +3 -26
  2. data/Gemfile.lock +43 -35
  3. data/README.md +40 -4
  4. data/bin/occi +67 -64
  5. data/ext/mkrf_conf.rb +25 -0
  6. data/features/cassettes/Create_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +186 -0
  7. data/features/cassettes/Delete_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +186 -0
  8. data/features/cassettes/Discovery_Interface/Retrieving_all_OCCI_Categories_supported_by_the_OCCI_Server/_http_http___141_5_99_69__application_json_200_.yml +173 -0
  9. data/features/cassettes/Discovery_Interface/Retrieving_all_OCCI_Categories_supported_by_the_OCCI_Server/_http_http___141_5_99_69__text_plain_200_.yml +325 -0
  10. data/features/cassettes/Discovery_Interface/Retrieving_all_OCCI_Categories_supported_by_the_OCCI_Server/_http_http___141_5_99_69__text_plain_200_action_.yml +186 -0
  11. data/features/cassettes/Miscellaneous_operation_on_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +186 -0
  12. data/features/cassettes/Read_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +186 -0
  13. data/features/cassettes/Update_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +186 -0
  14. data/features/occi/core/create/create.feature +3 -2
  15. data/features/occi/core/delete/delete.feature +6 -2
  16. data/features/occi/core/discovery_interface/discovery_interface.feature +4 -2
  17. data/features/occi/core/miscellaneous/miscellaneous.feature +6 -2
  18. data/features/occi/core/read/read.feature +6 -2
  19. data/features/occi/core/update/update.feature +6 -2
  20. data/features/occi/infrastructure/create/create.feature +6 -2
  21. data/features/support/env.rb +13 -1
  22. data/lib/occi/api/client/client_http.rb +914 -820
  23. data/lib/occi/api/client/http/net_http_fix.rb +7 -36
  24. data/lib/occi/api/dsl.rb +32 -2
  25. data/lib/occi/bin/occi_opts.rb +15 -1
  26. data/lib/occi/collection.rb +26 -15
  27. data/lib/occi/core/categories.rb +9 -1
  28. data/lib/occi/core/category.rb +20 -11
  29. data/lib/occi/core/link.rb +4 -5
  30. data/lib/occi/model.rb +2 -2
  31. data/lib/occi/parser.rb +51 -49
  32. data/lib/occi/version.rb +1 -1
  33. data/occi.gemspec +16 -3
  34. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/creates_a_new_compute_resource.yml +222 -0
  35. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/creates_a_new_network_resource.yml +222 -0
  36. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/creates_a_new_storage_resource.yml +222 -0
  37. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/deletes_a_compute_resource.yml +222 -0
  38. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/deletes_a_network_resource.yml +222 -0
  39. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/deletes_a_storage_resource.yml +222 -0
  40. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/deploys_an_instance_based_on_OVF_OVA_file.yml +222 -0
  41. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/describes_all_available_mixins.yml +222 -0
  42. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/describes_compute_resources.yml +324 -0
  43. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/describes_network_resources.yml +326 -0
  44. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/describes_os_tpl_mixins.yml +222 -0
  45. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/describes_resource_tpl_mixins.yml +222 -0
  46. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/describes_storage_resources.yml +386 -0
  47. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/establishes_connection.yml +222 -0
  48. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_compute_resource_using_type_identifier.yml +222 -0
  49. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_compute_resource_using_type_name.yml +222 -0
  50. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_network_resource_using_type_identifier.yml +222 -0
  51. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_network_resource_using_type_name.yml +222 -0
  52. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_storage_resource_using_type_identifier.yml +222 -0
  53. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/instantiates_a_storage_resource_using_type_name.yml +222 -0
  54. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_entity_type_identifiers.yml +222 -0
  55. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_entity_types.yml +222 -0
  56. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_link_type_identifiers.yml +222 -0
  57. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_link_types.yml +222 -0
  58. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_mixin_type_identifiers.yml +222 -0
  59. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_mixin_types.yml +222 -0
  60. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_mixins.yml +222 -0
  61. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_resource_type_identifiers.yml +222 -0
  62. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_all_available_resource_types.yml +222 -0
  63. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_compute_resources.yml +264 -0
  64. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_network_resources.yml +264 -0
  65. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_os_tpl_mixins.yml +222 -0
  66. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_resource_tpl_mixins.yml +222 -0
  67. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/lists_storage_resources.yml +266 -0
  68. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/refreshes_its_model.yml +397 -0
  69. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/triggers_an_action_on_a_compute_resource.yml +222 -0
  70. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/triggers_an_action_on_a_network_resource.yml +222 -0
  71. data/spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/triggers_an_action_on_a_storage_resource.yml +222 -0
  72. data/spec/occi/api/client/client_amqp_spec.rb +10 -2
  73. data/spec/occi/api/client/client_http_spec.rb +111 -117
  74. data/spec/occi/api/dsl_spec.rb +22 -0
  75. data/spec/occi/collection_spec.rb +11 -2
  76. data/spec/occi/core/resource_spec.rb +1 -1
  77. data/spec/occi/infrastructure/compute_spec.rb +3 -3
  78. data/spec/occi/log_spec.rb +1 -1
  79. data/spec/occi/model_spec.rb +4 -8
  80. data/spec/occi/parser_spec.rb +4 -4
  81. data/spec/spec_helper.rb +3 -2
  82. metadata +264 -12
  83. data/spec/cassettes/client_http_text_plain.yml +0 -1066
  84. data/spec/occi/api/client/client_http_0.5_spec.rb +0 -292
@@ -1,292 +0,0 @@
1
- require 'rspec'
2
- require 'occi'
3
-
4
- module Occi
5
- module Api
6
- module Client
7
-
8
- describe ClientHttp do
9
-
10
- it "should do something" do
11
-
12
- # TODO: Implement scenarios for client
13
- end
14
- =begin
15
- describe "using media type text/plain" do
16
-
17
- before(:all) do
18
-
19
-
20
- @client = Occi::Api::Client::ClientHttp.new(
21
- 'http://141.5.99.69', #141.5.99.69 #141.5.99.82
22
- { :type => "none" },
23
- { :out => "/dev/null",
24
- :level => Occi::Log::DEBUG },
25
- true,
26
- "application/occi+json"#"text/plain,text/occi"
27
- )
28
-
29
-
30
-
31
-
32
-
33
- #@client = Occi::Api::Client::ClientAmqp.new("http://141.5.99.83/", auth_options = { :type => "none" },
34
- # log_options = { :out => STDERR, :level => Occi::Log::WARN, :logger => nil },
35
- # media_type = "application/occi+json")
36
- end
37
-
38
- after(:each) do
39
- @client.logger.close
40
- end
41
-
42
- describe "Retrieving all OCCI Categories supported by the OCCI Server" do
43
- it "should establish connection" do
44
- @client.connected.should be_true
45
- end
46
-
47
- it "should have HTTP(200) OK response" do
48
- @client.last_response.code.should == 200
49
- end
50
-
51
- it "should have the same Content Type like the HTTP Accept header" do
52
- @client.last_response.content_type.should == @client.media_type
53
- end
54
-
55
- it "should contains all supported OCCI Categories" do
56
- @client.model.actions.should have_at_least(3).actions
57
- @client.model.kinds .should have_at_least(3).kinds
58
- @client.model.mixins .should have_at_least(3).mixins
59
- end
60
-
61
- it "should contains the basic kinds (entity, resource, link)" do
62
- entity = nil
63
- @client.model.kinds.each do |kind|
64
- if kind.term = "entity"
65
- entity = kind
66
- break
67
- end
68
- end
69
- entity.should_not == nil
70
-
71
- resource = nil
72
- @client.model.kinds.each do |kind|
73
- if kind.term = "resource"
74
- resource = kind
75
- break
76
- end
77
- end
78
- resource.should_not == nil
79
-
80
- link = nil
81
- @client.model.kinds.each do |kind|
82
- if kind.term = "link"
83
- link = kind
84
- break
85
- end
86
- end
87
- link.should_not == nil
88
- end
89
- end
90
-
91
- #TD/OCCI/CORE/DISCOVERY/002
92
- describe "Retrieving the OCCI Categories with an OCCI Category filter from the OCCI Server" do
93
- it "should establish connection" do
94
- @client.connected.should be_true
95
- end
96
- end
97
-
98
- #TD/OCCI/CORE/CREATE/001
99
- describe "Create an OCCI Resource" do
100
- it "should send a HTTP POST request" do
101
- res = Occi::Infrastructure::Compute.new
102
- res.title = "MyComputeResource1"
103
- #
104
- @@uri_new = @client.create res
105
- end
106
-
107
- it "should receipt a HTTP 201 (CREATED) response" do
108
- @client.last_response.code.should == 201
109
- end
110
-
111
- it "should receipt the Location of the created OCCI Resource" do
112
- @@uri_new.should include('/compute/')
113
- end
114
- end
115
-
116
- #TD/OCCI/CORE/CREATE/002
117
- describe "Create an OCCI Resource with an OCCI Mixin" do
118
- it "should send a HTTP POST request" do
119
- res = Occi::Infrastructure::Compute.new
120
- res.title = "MyComputeResource1"
121
- res.mixins << @client.find_mixin('small', "resource_tpl")
122
- res.mixins << @client.find_mixin('my_os', "os_tpl")
123
- #
124
- @@uri_new = @client.create res
125
- end
126
-
127
- it "should receipt a HTTP 201 (CREATED) response" do
128
- @client.last_response.code.should == 201
129
- end
130
-
131
- it "should have the Mixin inside the created Resource after describe these" do
132
- @@uri_new.should include('/compute/')
133
- res = @client.describe @@uri_new
134
- end
135
- end
136
-
137
- #TD/OCCI/CORE/CREATE/003
138
- describe "Create an OCCI Resource with a link to an existing OCCI Resource" do
139
- it "should send a HTTP POST request" do
140
-
141
- end
142
-
143
- it "should receipt a HTTP 201 (CREATED) response" do
144
-
145
- end
146
-
147
- it "should have the Link to the existing Resource inside the created Resource after describe these" do
148
-
149
- end
150
- end
151
-
152
- #TD/OCCI/CORE/READ/001
153
- describe "Retrieve the URLs of all OCCI Resources belonging to an OCCI Kind" do
154
- it "should send a HTTP GET request" do
155
-
156
- end
157
-
158
- it "should receipt a HTTP 200 (OK) response" do
159
-
160
- end
161
-
162
- it "should displays the URLs of the OCCI Resources" do
163
-
164
- end
165
- end
166
-
167
- #TD/OCCI/CORE/READ/002
168
- describe "Retrieve the URLs of the OCCI Resources belonging to an OCCI Kind and related to an OCCI Category filter" do
169
- it "should send a HTTP GET request" do
170
-
171
- end
172
-
173
- it "should receipt a HTTP 200 (OK) response" do
174
-
175
- end
176
-
177
- it "should only displays the URLs of the OCCI Resources which are related to the OCCI Kind or OCCI Mixin specified as filter" do
178
-
179
- end
180
- end
181
-
182
- #TD/OCCI/CORE/READ/003
183
- describe "Retrieve the URLs of the OCCI Resources belonging to an OCCI Kind which contain a specific Attribute" do
184
- it "should send a HTTP GET request" do
185
-
186
- end
187
-
188
- it "should receipt a HTTP 200 (OK) response" do
189
-
190
- end
191
-
192
- it "should only displays the URLs of the OCCI Resources which contain the specified attribute" do
193
-
194
- end
195
- end
196
-
197
- #TD/OCCI/CORE/READ/004
198
- describe "Retrieve the URLs of all OCCI Resources belonging to an OCCI Kind or Mixin" do
199
- it "should send a HTTP GET request" do
200
-
201
- end
202
-
203
- it "should receipt a HTTP 200 (OK) response" do
204
-
205
- end
206
-
207
- it "should displays the URLs of the OCCI Resources which belong to the OCCI Kind or OCCI Mixin" do
208
-
209
- end
210
- end
211
-
212
- #TD/OCCI/CORE/READ/005
213
- describe "Retrieve the description of an OCCI Resource" do
214
- it "should send a HTTP GET request" do
215
-
216
- end
217
-
218
- it "should receipt a HTTP 200 (OK) response" do
219
-
220
- end
221
-
222
- it "should displays the description of the OCCI Resource" do
223
-
224
- end
225
- end
226
-
227
- #TD/OCCI/CORE/READ/006
228
- describe "Retrieve the descriptions of the OCCI Resources belonging to an OCCI Kind and related to an OCCI Category filter" do
229
- it "should send a HTTP GET request" do
230
-
231
- end
232
-
233
- it "should receipt a HTTP 200 (OK) response" do
234
-
235
- end
236
-
237
- it "should only displays the descriptions of the OCCI Resources which are related to the OCCI Kind or OCCI Mixin specified as filter" do
238
-
239
- end
240
- end
241
-
242
- #TD/OCCI/CORE/READ/007
243
- describe "Retrieve the descriptions of the OCCI Resources belonging to an OCCI Kind and containing the Attribute filter" do
244
- it "should send a HTTP GET request" do
245
-
246
- end
247
-
248
- it "should receipt a HTTP 200 (OK) response" do
249
-
250
- end
251
-
252
- it "should only displays the descriptions of the OCCI Resources which contain the specified attribute" do
253
-
254
- end
255
- end
256
-
257
- #TD/OCCI/CORE/UPDATE/001
258
- describe "Full update of a specific OCCI Resource" do
259
- it "should send a HTTP PUT request" do
260
-
261
- end
262
-
263
- it "should displays success of update operation" do
264
-
265
- end
266
-
267
- it "should replaced the description of the OCCI Resource on the OCCI Server" do
268
-
269
- end
270
- end
271
-
272
- #TD/OCCI/CORE/DELETE/002
273
- describe "Delete all OCCI Resources belonging to an OCCI Kind" do
274
- it "should send a HTTP DELETE request" do
275
- @client.delete "compute"
276
- end
277
-
278
- it "should receipt a HTTP 200 (OK) response" do
279
- @client.last_response.code.should == 200
280
- end
281
-
282
- it "should has deleted all OCCI Resource belonging to the OCCI Kind" do
283
- uri_list = @client.list "compute"
284
- uri_list.should be_empty
285
- end
286
- end
287
- end
288
- =end
289
- end
290
- end
291
- end
292
- end