aboisvert_aws 3.0.0

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.
Files changed (78) hide show
  1. data/History.txt +329 -0
  2. data/Manifest.txt +61 -0
  3. data/README.txt +163 -0
  4. data/Rakefile +130 -0
  5. data/lib/acf/right_acf_interface.rb +549 -0
  6. data/lib/acf/right_acf_invalidations.rb +144 -0
  7. data/lib/acf/right_acf_origin_access_identities.rb +230 -0
  8. data/lib/acf/right_acf_streaming_interface.rb +229 -0
  9. data/lib/acw/right_acw_interface.rb +248 -0
  10. data/lib/as/right_as_interface.rb +698 -0
  11. data/lib/awsbase/benchmark_fix.rb +39 -0
  12. data/lib/awsbase/right_awsbase.rb +1343 -0
  13. data/lib/awsbase/support.rb +35 -0
  14. data/lib/awsbase/version.rb +9 -0
  15. data/lib/ec2/right_ec2.rb +541 -0
  16. data/lib/ec2/right_ec2_ebs.rb +481 -0
  17. data/lib/ec2/right_ec2_images.rb +444 -0
  18. data/lib/ec2/right_ec2_instances.rb +788 -0
  19. data/lib/ec2/right_ec2_monitoring.rb +70 -0
  20. data/lib/ec2/right_ec2_placement_groups.rb +108 -0
  21. data/lib/ec2/right_ec2_reserved_instances.rb +184 -0
  22. data/lib/ec2/right_ec2_security_groups.rb +491 -0
  23. data/lib/ec2/right_ec2_spot_instances.rb +422 -0
  24. data/lib/ec2/right_ec2_tags.rb +139 -0
  25. data/lib/ec2/right_ec2_vpc.rb +590 -0
  26. data/lib/ec2/right_ec2_vpc2.rb +381 -0
  27. data/lib/ec2/right_ec2_windows_mobility.rb +84 -0
  28. data/lib/elb/right_elb_interface.rb +573 -0
  29. data/lib/emr/right_emr_interface.rb +727 -0
  30. data/lib/iam/right_iam_access_keys.rb +71 -0
  31. data/lib/iam/right_iam_groups.rb +195 -0
  32. data/lib/iam/right_iam_interface.rb +341 -0
  33. data/lib/iam/right_iam_mfa_devices.rb +67 -0
  34. data/lib/iam/right_iam_users.rb +251 -0
  35. data/lib/rds/right_rds_interface.rb +1384 -0
  36. data/lib/right_aws.rb +86 -0
  37. data/lib/route_53/right_route_53_interface.rb +640 -0
  38. data/lib/s3/right_s3.rb +1138 -0
  39. data/lib/s3/right_s3_interface.rb +1278 -0
  40. data/lib/sdb/active_sdb.rb +1107 -0
  41. data/lib/sdb/right_sdb_interface.rb +762 -0
  42. data/lib/sns/right_sns_interface.rb +286 -0
  43. data/lib/sqs/right_sqs.rb +387 -0
  44. data/lib/sqs/right_sqs_gen2.rb +342 -0
  45. data/lib/sqs/right_sqs_gen2_interface.rb +523 -0
  46. data/lib/sqs/right_sqs_interface.rb +593 -0
  47. data/right_aws.gemspec +90 -0
  48. data/test/README.mdown +39 -0
  49. data/test/acf/test_helper.rb +2 -0
  50. data/test/acf/test_right_acf.rb +138 -0
  51. data/test/awsbase/test_helper.rb +2 -0
  52. data/test/awsbase/test_right_awsbase.rb +11 -0
  53. data/test/ec2/test_helper.rb +2 -0
  54. data/test/ec2/test_right_ec2.rb +107 -0
  55. data/test/elb/test_helper.rb +2 -0
  56. data/test/elb/test_right_elb.rb +43 -0
  57. data/test/http_connection.rb +87 -0
  58. data/test/rds/test_helper.rb +2 -0
  59. data/test/rds/test_right_rds.rb +120 -0
  60. data/test/route_53/fixtures/a_record.xml +18 -0
  61. data/test/route_53/fixtures/alias_record.xml +18 -0
  62. data/test/route_53/test_helper.rb +2 -0
  63. data/test/route_53/test_right_route_53.rb +141 -0
  64. data/test/s3/test_helper.rb +2 -0
  65. data/test/s3/test_right_s3.rb +528 -0
  66. data/test/s3/test_right_s3_stubbed.rb +97 -0
  67. data/test/sdb/test_active_sdb.rb +357 -0
  68. data/test/sdb/test_batch_put_attributes.rb +54 -0
  69. data/test/sdb/test_helper.rb +3 -0
  70. data/test/sdb/test_right_sdb.rb +253 -0
  71. data/test/sns/test_helper.rb +2 -0
  72. data/test/sns/test_right_sns.rb +153 -0
  73. data/test/sqs/test_helper.rb +2 -0
  74. data/test/sqs/test_right_sqs.rb +285 -0
  75. data/test/sqs/test_right_sqs_gen2.rb +264 -0
  76. data/test/test_credentials.rb +37 -0
  77. data/test/ts_right_aws.rb +15 -0
  78. metadata +257 -0
@@ -0,0 +1,97 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestS3Stubbed < Test::Unit::TestCase
4
+
5
+ RIGHT_OBJECT_TEXT = 'Right test message'
6
+
7
+ def setup
8
+ @s3 = Rightscale::S3Interface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
9
+ @bucket = 'right_s3_awesome_test_bucket'
10
+ @key1 = 'test/woohoo1'
11
+ @key2 = 'test1/key/woohoo2'
12
+ @s = Rightscale::S3.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
13
+ Rightscale::HttpConnection.reset
14
+ end
15
+
16
+ # Non-remote tests: these use the stub version of Rightscale::HTTPConnection
17
+ def test_101_create_bucket
18
+ Rightscale::HttpConnection.push(409, 'The named bucket you tried to create already exists')
19
+ Rightscale::HttpConnection.push(500, 'We encountered an internal error. Please try again.')
20
+ Rightscale::HttpConnection.push(500, 'We encountered an internal error. Please try again.')
21
+ assert_raise RightAws::AwsError do
22
+ @s3.create_bucket(@bucket)
23
+ end
24
+ end
25
+
26
+ def test_102_list_all_my_buckets_failure
27
+ Rightscale::HttpConnection.push(401, 'Unauthorized')
28
+ assert_raise RightAws::AwsError do
29
+ @s3.list_all_my_buckets
30
+ end
31
+ end
32
+
33
+ def test_103_list_empty_bucket
34
+ Rightscale::HttpConnection.push(403, 'Access Denied')
35
+ assert_raise RightAws::AwsError do
36
+ @s3.list_bucket(@bucket)
37
+ end
38
+ end
39
+
40
+ def test_104_put
41
+ Rightscale::HttpConnection.push(400, 'Your proposed upload exceeds the maximum allowed object size.')
42
+ Rightscale::HttpConnection.push(400, 'The Content-MD5 you specified was an invalid.')
43
+ Rightscale::HttpConnection.push(409, 'Please try again')
44
+ assert_raise RightAws::AwsError do
45
+ assert @s3.put(@bucket, @key1, RIGHT_OBJECT_TEXT, 'x-amz-meta-family'=>'Woohoo1!'), 'Put bucket fail'
46
+ end
47
+ assert_raise RightAws::AwsError do
48
+ assert @s3.put(@bucket, @key2, RIGHT_OBJECT_TEXT, 'x-amz-meta-family'=>'Woohoo2!'), 'Put bucket fail'
49
+ end
50
+ end
51
+
52
+ def test_105_get_and_get_object
53
+ Rightscale::HttpConnection.push(404, 'not found')
54
+ assert_raise(Rightscale::AwsError) { @s3.get(@bucket, 'undefined/key') }
55
+ end
56
+
57
+ def test_106_head
58
+ Rightscale::HttpConnection.push(404, 'Good Luck!')
59
+ assert_raise RightAws::AwsError do
60
+ @s3.head(@bucket,@key1)
61
+ end
62
+ end
63
+
64
+
65
+ def test_109_delete_bucket
66
+ Rightscale::HttpConnection.push(403, 'Good Luck!')
67
+ assert_raise(Rightscale::AwsError) { @s3.delete_bucket(@bucket) }
68
+ end
69
+
70
+ def test_115_copy_key
71
+
72
+ Rightscale::HttpConnection.push(500, 'not found')
73
+ #--- test COPY
74
+ # copy a key
75
+ assert_raise RightAws::AwsError do
76
+ @s3.copy(@bucket, @key1, @bucket, @key1_copy)
77
+ end
78
+
79
+ end
80
+
81
+ def test_116_move_key
82
+ # move a key
83
+ Rightscale::HttpConnection.push(413, 'not found')
84
+ assert_raise RightAws::AwsError do
85
+ @s3.move(@bucket, @key1, @bucket, @key1_new_name)
86
+ end
87
+ end
88
+
89
+ def test_117_rename_key
90
+ # rename a key
91
+ Rightscale::HttpConnection.push(500, 'not found')
92
+ assert_raise RightAws::AwsError do
93
+ @s3.rename(@bucket, @key2, @key2_new_name)
94
+ end
95
+ end
96
+
97
+ end
@@ -0,0 +1,357 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestSdb < Test::Unit::TestCase
4
+ DOMAIN_PREFIX = 'right_sdb_awesome_test'
5
+ CLIENT_DOMAIN = "#{DOMAIN_PREFIX}_client"
6
+ PERSON_DOMAIN = "#{DOMAIN_PREFIX}_person"
7
+
8
+ class Client < RightAws::ActiveSdb::Base
9
+ set_domain_name CLIENT_DOMAIN
10
+ end
11
+
12
+ class Person < RightAws::ActiveSdb::Base
13
+ set_domain_name PERSON_DOMAIN
14
+
15
+ columns do
16
+ name
17
+ email
18
+ score :Integer
19
+ is_active :Boolean
20
+ registered_at :DateTime
21
+ created_at :DateTime, :default => lambda{ Time.now }
22
+ end
23
+ end
24
+
25
+ def setup
26
+ STDOUT.sync = true
27
+ @clients = [
28
+ { 'name' => 'Bush', 'country' => 'USA', 'gender' => 'male', 'expiration' => '2009', 'post' => 'president' },
29
+ { 'name' => 'Putin', 'country' => 'Russia', 'gender' => 'male', 'expiration' => '2008', 'post' => 'president' },
30
+ { 'name' => 'Medvedev', 'country' => 'Russia', 'gender' => 'male', 'expiration' => '2012', 'post' => 'president' },
31
+ { 'name' => 'Mary', 'country' => 'USA', 'gender' => 'female', 'hobby' => ['patchwork', 'bundle jumping'] },
32
+ { 'name' => 'Sandy', 'country' => 'Russia', 'gender' => 'female', 'hobby' => ['flowers', 'cats', 'cooking'] },
33
+ { 'name' => 'Mary', 'country' => 'Russia', 'gender' => 'female', 'hobby' => ['flowers', 'cats', 'cooking'] } ]
34
+ @people = [
35
+ { :name => 'Yetta E. Andrews', :email => 'nulla.facilisis@metus.com', :score => 100, :is_active => true, :registered_at => Time.local(2000, 1, 1) },
36
+ { :name => 'Sybill O. Olson', :email => 'nisi.Aenean.eget@urna.com', :score => 87, :is_active => true, :registered_at => Time.local(2008, 7, 6) },
37
+ { :name => 'Isabelle K. Flynn', :email => 'velit@amet.com', :score => 98, :is_active => false, :registered_at => Time.local(2003, 5, 20) },
38
+ { :name => 'Juliet H. Witt', :email => 'egestas@pretiumaliquet.ca', :score => 72, :is_active => true, :registered_at => Time.local(2007, 2, 28) },
39
+ { :name => 'Lucy N. Christensen', :email => 'lacus.v12@stu.edu', :score => 94, :is_active => false, :registered_at => Time.local(2005, 10, 26) }
40
+ ]
41
+ RightAws::ActiveSdb.establish_connection(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
42
+ end
43
+
44
+ SDB_DELAY = 3
45
+
46
+ def wait(delay, msg='')
47
+ print " waiting #{delay} seconds: #{msg}"
48
+ while delay>0 do
49
+ delay -= 1
50
+ print '.'
51
+ sleep 1
52
+ end
53
+ puts
54
+ end
55
+
56
+ #---------------------------
57
+ # Rightscale::SdbInterface
58
+ #---------------------------
59
+
60
+ def test_00_delete_domain
61
+ assert RightAws::ActiveSdb.delete_domain(CLIENT_DOMAIN)
62
+ assert RightAws::ActiveSdb.delete_domain(PERSON_DOMAIN)
63
+ wait SDB_DELAY, 'test 00: after domain deletion'
64
+ end
65
+
66
+ def test_01_create_domain
67
+ # check that domain does not exist
68
+ assert !RightAws::ActiveSdb.domains.include?(CLIENT_DOMAIN)
69
+ # create domain
70
+ assert Client.create_domain
71
+ assert Person.create_domain
72
+ wait SDB_DELAY, 'test 01: after domain creation'
73
+ # check that we have received new domain from Amazin
74
+ assert RightAws::ActiveSdb.domains.include?(CLIENT_DOMAIN)
75
+ end
76
+
77
+ def test_02_create_items
78
+ # check that DB is empty
79
+ clients = Client.find(:all)
80
+ assert clients.right_blank?
81
+ # put some clients there
82
+ @clients.each do |client|
83
+ Client.create client
84
+ end
85
+ wait SDB_DELAY, 'test 02: after clients creation'
86
+ # check that DB has all the clients we just putted
87
+ clients = Client.find(:all)
88
+ assert_equal @clients.size, clients.size
89
+ end
90
+
91
+ def test_03_create_and_save_new_item
92
+ # get the db
93
+ old_clients = Client.find(:all)
94
+ # create new client
95
+ new_client = Client.new('country' => 'unknown', 'dummy' => 'yes')
96
+ wait SDB_DELAY, 'test 03: after in-memory client creation'
97
+ # get the db and ensure we created the client in-memory only
98
+ assert_equal old_clients.size, Client.find(:all).size
99
+ # put the client to DB
100
+ new_client.save
101
+ wait SDB_DELAY, 'test 03: after in-memory client saving'
102
+ # get all db again and compare to original list
103
+ assert_equal old_clients.size+1, Client.find(:all).size
104
+ end
105
+
106
+ def test_04_find_all
107
+ # retrieve all the DB, make sure all are in place
108
+ clients = Client.find(:all)
109
+ ids = clients.map{|client| client.id }[0..1]
110
+ assert_equal @clients.size + 1, clients.size
111
+ # retrieve all presidents (must find: Bush, Putin, Medvedev)
112
+ assert_equal 3, Client.find(:all, :conditions => ["[?=?]",'post','president']).size
113
+ # retrieve all russian presidents (must find: Putin, Medvedev)
114
+ assert_equal 2, Client.find(:all, :conditions => ["['post'=?] intersection ['country'=?]",'president', 'Russia']).size
115
+ # retrieve all russian presidents and all women (must find: Putin, Medvedev, 2 Maries and Sandy)
116
+ assert_equal 5, Client.find(:all, :conditions => ["['post'=?] intersection ['country'=?] union ['gender'=?]",'president', 'Russia','female']).size
117
+ # find all rissian presidents Bushes
118
+ assert_equal 0, Client.find(:all, :conditions => ["['post'=?] intersection ['country'=?] intersection ['name'=?]",'president', 'Russia','Bush']).size
119
+ # --- find by ids
120
+ # must find 1 rec (by rec id) and return it
121
+ assert_equal ids.first, Client.find(ids.first).id
122
+ # must find 1 rec (by one item array) and return an array
123
+ assert_equal ids.first, Client.find([ids.first]).first.id
124
+ # must find 2 recs (by a list of comma separated ids) and return an array
125
+ assert_equal ids.size, Client.find(*ids).size
126
+ # must find 2 recs (by an array of ids) and return an array
127
+ assert_equal ids.size, Client.find(ids).size
128
+ ids << 'dummy_id'
129
+ # must raise an error when getting unexistent record
130
+ assert_raise(RightAws::ActiveSdb::ActiveSdbError) do
131
+ Client.find(ids)
132
+ end
133
+ # find one record by unknown id
134
+ assert_raise(RightAws::ActiveSdb::ActiveSdbError) do
135
+ Client.find('dummy_id')
136
+ end
137
+ end
138
+
139
+ def test_05_find_first
140
+ # find any record
141
+ assert Client.find(:first)
142
+ # find any president
143
+ assert Client.find(:first, :conditions => ["[?=?]",'post','president'])
144
+ # find any rissian president
145
+ assert Client.find(:first, :conditions => ["['post'=?] intersection ['country'=?]",'president','Russia'])
146
+ # find any unexistent record
147
+ assert_nil Client.find(:first, :conditions => ["['post'=?] intersection ['country'=?]",'president','Rwanda'])
148
+ end
149
+
150
+ def test_06_find_all_by_helpers
151
+ # find all Bushes
152
+ assert_equal 1, Client.find_all_by_name('Bush').size
153
+ # find all russian presidents
154
+ assert_equal 2, Client.find_all_by_post_and_country('president','Russia').size
155
+ # find all women in USA that love flowers
156
+ assert_equal 2, Client.find_all_by_gender_and_country_and_hobby('female','Russia','flowers').size
157
+ # order and auto_load:
158
+ clients = Client.find_all_by_post('president', :order => 'name', :auto_load => true)
159
+ assert_equal [['Bush'], ['Medvedev'], ['Putin']], clients.map{|c| c['name']}
160
+ clients = Client.find_all_by_post('president', :order => 'name desc', :auto_load => true)
161
+ assert_equal [['Putin'], ['Medvedev'], ['Bush']], clients.map{|c| c['name']}
162
+ end
163
+
164
+ def test_07_find_by_helpers
165
+ # find mr Bush
166
+ assert Client.find_by_name('Bush')
167
+ # find any russian president
168
+ assert Client.find_by_post_and_country('president','Russia')
169
+ # find Mary in Russia that loves flowers
170
+ # order and auto_load:
171
+ assert_equal ['Bush'], Client.find_by_post('president', :order => 'name', :auto_load => true)['name']
172
+ assert_equal ['Putin'], Client.find_by_post('president', :order => 'name desc', :auto_load => true)['name']
173
+ end
174
+
175
+ def test_08_reload
176
+ putin = Client.find_by_name('Putin')
177
+ # attributes must be empty until reload (except 'id' field)
178
+ assert_nil putin['name']
179
+ assert_nil putin['country']
180
+ assert_nil putin['gender']
181
+ assert_nil putin['expiration']
182
+ assert_nil putin['post']
183
+ # reloaded attributes must have 5 items + id
184
+ putin.reload
185
+ assert_equal 6, putin.attributes.size
186
+ # check all attributes
187
+ assert_equal ['Putin'], putin['name']
188
+ assert_equal ['Russia'], putin['country']
189
+ assert_equal ['male'], putin['gender']
190
+ assert_equal ['2008'], putin['expiration']
191
+ assert_equal ['president'], putin['post']
192
+ end
193
+
194
+ def test_09_select
195
+ # select all records
196
+ assert_equal 7, Client.select(:all).size
197
+ # LIMIT
198
+ # 1 record
199
+ assert Client.select(:first).is_a?(Client)
200
+ # select 2 recs
201
+ assert_equal 2, Client.select(:all, :limit => 2).size
202
+ # ORDER
203
+ # select all recs ordered by 'expration' (must find only recs where 'expration' attribute presents)
204
+ result = Client.select(:all, :order => 'expiration')
205
+ assert_equal 3, result.size
206
+ assert_equal ['2008', '2009', '2012'], result.map{ |c| c['expiration'] }.flatten
207
+ # desc order
208
+ result = Client.select(:all, :order => 'expiration desc')
209
+ assert_equal ['2012', '2009', '2008'], result.map{ |c| c['expiration'] }.flatten
210
+ # CONDITIONS
211
+ result = Client.select(:all, :conditions => ["expiration >= ?", 2009], :order => 'name')
212
+ assert_equal ['Bush', 'Medvedev'], result.map{ |c| c['name'] }.flatten
213
+ result = Client.select(:all, :conditions => "hobby='flowers' AND gender='female'", :order => 'name')
214
+ assert_equal ['Mary', 'Sandy'], result.map{ |c| c['name'] }.flatten
215
+ # SELECT
216
+ result = Client.select(:all, :select => 'hobby', :conditions => "gender IS NOT NULL", :order => 'name')
217
+ hobbies = result.map{|c| c['hobby']}
218
+ # must return all recs
219
+ assert_equal 6, result.size
220
+ # but anly 3 of them have this field set
221
+ assert_equal 3, hobbies.compact.size
222
+ end
223
+
224
+ def test_10_select_by
225
+ assert_equal 2, Client.select_all_by_hobby('flowers').size
226
+ assert_equal 2, Client.select_all_by_hobby_and_country('flowers', 'Russia').size
227
+ assert_equal ['Putin'], Client.select_by_post_and_expiration('president','2008')['name']
228
+ end
229
+
230
+ def test_11_save_and_put
231
+ putin = Client.find_by_name('Putin')
232
+ putin.reload
233
+ putin['hobby'] = 'ski'
234
+ # SAVE method (replace values)
235
+ putin.save
236
+ wait SDB_DELAY, 'test 09: after saving'
237
+ # check that DB was updated with 'ski'
238
+ new_putin = Client.find_by_name('Putin')
239
+ new_putin.reload
240
+ assert ['ski'], new_putin['hobby']
241
+ # replace hobby
242
+ putin['hobby'] = 'dogs'
243
+ putin.save
244
+ wait SDB_DELAY, 'test 09: after saving'
245
+ # check that 'ski' in DB was replaced by 'dogs'
246
+ new_putin = Client.find_by_name('Putin')
247
+ new_putin.reload
248
+ assert ['dogs'], new_putin['hobby']
249
+ # PUT method (add values)
250
+ putin['hobby'] = 'ski'
251
+ putin.put
252
+ wait SDB_DELAY, 'test 09: after putting'
253
+ # check that 'ski' was added to 'dogs'
254
+ new_putin = Client.find_by_name('Putin')
255
+ new_putin.reload
256
+ assert ['dogs', 'ski'], new_putin['hobby'].sort
257
+ end
258
+
259
+ def test_12_save_and_put_attributes
260
+ putin = Client.find_by_name('Putin')
261
+ putin.reload
262
+ # SAVE method (replace values)
263
+ putin.save_attributes('language' => 'russian')
264
+ wait SDB_DELAY, 'test 10: after save_attributes'
265
+ # check that DB was updated with 'ski'
266
+ new_putin = Client.find_by_name('Putin')
267
+ new_putin.reload
268
+ assert ['russian'], new_putin['language']
269
+ # replace 'russian' by 'german'
270
+ putin.save_attributes('language' => 'german')
271
+ wait SDB_DELAY, 'test 10: after save_attributes'
272
+ # check that 'russian' in DB was replaced by 'german'
273
+ new_putin = Client.find_by_name('Putin')
274
+ new_putin.reload
275
+ assert ['german'], new_putin['language']
276
+ # PUT method (add values)
277
+ putin.put_attributes('language' => ['russian', 'english'])
278
+ wait SDB_DELAY, 'test 10: after put_attributes'
279
+ # now Putin must know all the languages
280
+ new_putin = Client.find_by_name('Putin')
281
+ new_putin.reload
282
+ assert ['english', 'german', 'russian'], new_putin['language'].sort
283
+ end
284
+
285
+ def test_13_delete
286
+ putin = Client.find_by_name('Putin')
287
+ putin.reload
288
+ # --- delete_values
289
+ # remove an unknown attribute
290
+ # should return an empty hash
291
+ assert_equal( {}, putin.delete_values('undefined_attribute' => 'ohoho'))
292
+ # remove 2 languages
293
+ lang_hash = {'language' => ['english', 'german']}
294
+ assert_equal lang_hash, putin.delete_values(lang_hash)
295
+ wait SDB_DELAY, 'test 11: after put_attributes'
296
+ # now Putin must know only russian lang
297
+ new_putin = Client.find_by_name('Putin')
298
+ new_putin.reload
299
+ assert ['russian'], new_putin['language'].sort
300
+ # --- delete_attributes
301
+ putin.delete_attributes('language', 'hobby')
302
+ wait SDB_DELAY, 'test 11: after delete_attributes'
303
+ # trash hoddy and langs
304
+ new_putin = Client.find_by_name('Putin')
305
+ new_putin.reload
306
+ assert_nil new_putin['language']
307
+ assert_nil new_putin['hobby']
308
+ # --- delete item
309
+ putin.delete
310
+ wait SDB_DELAY, 'test 11: after delete item'
311
+ assert_nil Client.find_by_name('Putin')
312
+ end
313
+
314
+ def test_14_dynamic_attribute_accessors
315
+ bush = Client.find_by_name('Bush')
316
+ bush.reload
317
+ assert_nothing_raised {
318
+ assert_equal ['male'], bush.gender
319
+ bush.name = 'George'
320
+ assert_equal ['George'], bush.name
321
+ }
322
+ assert_raise(NoMethodError) { bush.flarble }
323
+ end
324
+
325
+ def test_15_column_emulation
326
+ @people.each do |person|
327
+ Person.create person
328
+ end
329
+ wait SDB_DELAY, 'test 15: after people creation'
330
+ person = Person.find_by_email 'nulla.facilisis@metus.com'
331
+ person.reload
332
+
333
+ assert_equal 'Yetta E. Andrews', person.name
334
+ assert_equal DateTime, person.registered_at.class
335
+ assert person['registered_at'].is_a?(DateTime)
336
+ assert person[:registered_at].is_a?(DateTime)
337
+
338
+ assert ! person[:created_at].nil?
339
+ assert_equal DateTime, person.created_at.class
340
+ assert person['created_at'].is_a?(DateTime)
341
+ assert person[:created_at].is_a?(DateTime)
342
+
343
+ assert person.is_active
344
+
345
+ assert_equal 100, person.score
346
+ end
347
+
348
+ def test_999_delete_domain
349
+ assert Client.delete_domain
350
+ assert Person.delete_domain
351
+ wait SDB_DELAY, 'test 999: after delete domain'
352
+ assert_raise(Rightscale::AwsError) do
353
+ Client.find :all
354
+ end
355
+ end
356
+
357
+ end