kerryb-right_aws 1.7.6 → 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,146 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestAcf < Test::Unit::TestCase
4
+
5
+ RIGHT_OBJECT_TEXT = 'Right test message'
6
+
7
+ STDOUT.sync = true
8
+
9
+ def setup
10
+ @acf= Rightscale::AcfInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
11
+ @s3 = Rightscale::S3.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
12
+ @bucket_name = "right-acf-awesome-test-bucket-0001"
13
+ @bucket_domain = "#{@bucket_name}.s3.amazonaws.com"
14
+ end
15
+
16
+ def test_01_list_distributions_part1
17
+ distributions = nil
18
+ assert_nothing_raised(Rightscale::AwsError) do
19
+ distributions = @acf.list_distributions
20
+ end
21
+ assert distributions.is_a?(Array)
22
+ end
23
+
24
+ def test_02_try_to_create_for_bad_bucket
25
+ # a bucket does not exist
26
+ assert_raise(Rightscale::AwsError) do
27
+ @acf.create_distribution("right-cloudfront-awesome-test-bucket-not-exist", "Mustn't to be born", true)
28
+ end
29
+ # a bucket is not a domain naming complied guy
30
+ bucket_name = 'right_cloudfront_awesome_test_bucket_BAD'
31
+ @s3.bucket(bucket_name, :create)
32
+ assert_raise(Rightscale::AwsError) do
33
+ @acf.create_distribution(bucket_name, "Mustn't to be born", true)
34
+ end
35
+ end
36
+
37
+ def test_03_create
38
+ comment = 'WooHoo!!!'
39
+ # create a test bucket
40
+ @s3.bucket(@bucket_name, :create)
41
+ # create a distribution
42
+ distribution = @acf.create_distribution(@bucket_domain, comment, true)
43
+ assert_equal comment, distribution[:comment]
44
+ assert distribution[:cnames].size == 0
45
+ assert distribution[:enabled]
46
+ end
47
+
48
+ def test_04_list_distributions_part2
49
+ distributions = @acf.list_distributions
50
+ assert distributions.size > 0
51
+ end
52
+
53
+ def get_test_distribution
54
+ @acf.list_distributions.select{ |d| d[:origin] == @bucket_domain }.first
55
+ end
56
+
57
+ def test_05_get_distribution
58
+ old = get_test_distribution
59
+ assert_nothing_raised do
60
+ @acf.get_distribution(old[:aws_id])
61
+ end
62
+ end
63
+
64
+ def test_06_get_and_set_config
65
+ config = nil
66
+ old = get_test_distribution
67
+ assert_nothing_raised do
68
+ config = @acf.get_distribution_config(old[:aws_id])
69
+ end
70
+ # change a config
71
+ config[:enabled] = false
72
+ config[:cnames] << 'x1.myawesomesite.com'
73
+ config[:cnames] << 'x2.myawesomesite.com'
74
+ # set config
75
+ set_config_result = nil
76
+ assert_nothing_raised do
77
+ set_config_result = @acf.set_distribution_config(old[:aws_id], config)
78
+ end
79
+ assert set_config_result
80
+ # reget the config and check
81
+ new_config = nil
82
+ assert_nothing_raised do
83
+ new_config = @acf.get_distribution_config(old[:aws_id])
84
+ end
85
+ assert !new_config[:enabled]
86
+ assert_equal new_config[:cnames].sort, ['x1.myawesomesite.com', 'x2.myawesomesite.com']
87
+ assert_not_equal config[:e_tag], new_config[:e_tag]
88
+
89
+ # try to update the old config again (must fail because ETAG has changed)
90
+ assert_raise(Rightscale::AwsError) do
91
+ @acf.set_distribution_config(old[:aws_id], config)
92
+ end
93
+ end
94
+
95
+ def test_07_caching
96
+ # enable caching
97
+ @acf.params[:cache] = true
98
+ # list distributions
99
+ @acf.list_distributions
100
+ # list the distributions again - cache should hit
101
+ assert_raise(Rightscale::AwsNoChange) do
102
+ @acf.list_distributions
103
+ end
104
+ # disable caching
105
+ @acf.params[:cache] = true
106
+ end
107
+
108
+ def test_08_delete_distribution
109
+ # we need ETAG so use get_distribution
110
+ distribution = @acf.get_distribution(get_test_distribution[:aws_id])
111
+ # try to delete a distribution
112
+ # should fail because
113
+ if distribution[:status] == 'InProgress'
114
+ # should fail because the distribution is not deployed yet
115
+ assert_raise(Rightscale::AwsError) do
116
+ @acf.delete_distribution(distribution[:aws_id], distribution[:e_tag])
117
+ end
118
+ # wait for a deployed state
119
+ print "waiting up to 5 min while the distribution is being deployed: "
120
+ 100.times do
121
+ print '.'
122
+ distribution = @acf.get_distribution(distribution[:aws_id])
123
+ if distribution[:status] == 'Deployed'
124
+ print ' done'
125
+ break
126
+ end
127
+ sleep 3
128
+ end
129
+ puts
130
+ end
131
+
132
+ # only disabled and deployed distribution can be deleted
133
+ assert_equal 'Deployed', distribution[:status]
134
+ assert !distribution[:enabled]
135
+
136
+ # delete the distribution
137
+ assert_nothing_raised do
138
+ @acf.delete_distribution(distribution[:aws_id], distribution[:e_tag])
139
+ end
140
+ end
141
+
142
+ def test_09_drop_bucket
143
+ assert @s3.bucket(@bucket_name).delete
144
+ end
145
+
146
+ end
@@ -72,5 +72,37 @@ class TestEc2 < Test::Unit::TestCase
72
72
  # check that the request has correct signature version
73
73
  assert ec2.last_request.path.include?('SignatureVersion=0')
74
74
  end
75
+
76
+ def test_11_regions
77
+ regions = nil
78
+ assert_nothing_raised do
79
+ regions = @ec2.describe_regions
80
+ end
81
+ # check we got more that 0 regions
82
+ assert regions.size > 0
83
+ # check an access to regions
84
+ regions.each do |region|
85
+ regional_ec2 = Rightscale::Ec2.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :region => region)
86
+ # do we have a correct endpoint server?
87
+ assert_equal "#{region}.ec2.amazonaws.com", regional_ec2.params[:server]
88
+ # get a list of images from every region
89
+ images = nil
90
+ assert_nothing_raised do
91
+ images = regional_ec2.describe_regions
92
+ end
93
+ # every region must have images
94
+ assert images.size > 0
95
+ end
96
+ end
75
97
 
98
+ def test_12_endpoint_url
99
+ ec2 = Rightscale::Ec2.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :endpoint_url => 'a://b.c:0/d/', :region => 'z')
100
+ # :endpoint_url has a priority hence :region should be ommitted
101
+ assert_equal 'a', ec2.params[:protocol]
102
+ assert_equal 'b.c', ec2.params[:server]
103
+ assert_equal '/d/', ec2.params[:service]
104
+ assert_equal 0, ec2.params[:port]
105
+ assert_nil ec2.params[:region]
106
+ end
107
+
76
108
  end
@@ -6,7 +6,8 @@ class TestS3 < Test::Unit::TestCase
6
6
 
7
7
  def setup
8
8
  @s3 = Rightscale::S3Interface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
9
- @bucket = 'right_s3_awesome_test_bucket_00001'
9
+ @bucket = 'right_s3_awesome_test_bucket_000A1'
10
+ @bucket2 = 'right_s3_awesome_test_bucket_000A2'
10
11
  @key1 = 'test/woohoo1/'
11
12
  @key2 = 'test1/key/woohoo2'
12
13
  @key3 = 'test2/A%B@C_D&E?F+G=H"I'
@@ -72,9 +73,9 @@ class TestS3 < Test::Unit::TestCase
72
73
  def test_08_keys
73
74
  keys = @s3.list_bucket(@bucket).map{|b| b[:key]}
74
75
  assert_equal keys.size, 3, "There should be 3 keys"
75
- assert(keys.include? @key1)
76
- assert(keys.include? @key2)
77
- assert(keys.include? @key3)
76
+ assert(keys.include?(@key1))
77
+ assert(keys.include?(@key2))
78
+ assert(keys.include?(@key3))
78
79
  end
79
80
 
80
81
  def test_09_copy_key
@@ -120,18 +121,26 @@ class TestS3 < Test::Unit::TestCase
120
121
  keys = @s3.list_bucket(@bucket).map{|b| b[:key]}
121
122
  assert(!keys.include?(@key2))
122
123
  end
123
-
124
- def test_12_delete_folder
124
+ def test_12_retrieve_object
125
+ assert_raise(Rightscale::AwsError) { @s3.retrieve_object(:bucket => @bucket, :key => 'undefined/key') }
126
+ data1 = @s3.retrieve_object(:bucket => @bucket, :key => @key1_new_name)
127
+ assert_equal RIGHT_OBJECT_TEXT, data1[:object], "Object text must be equal to '#{RIGHT_OBJECT_TEXT}'"
128
+ assert_equal 'Woohoo1!', data1[:headers]['x-amz-meta-family'], "x-amz-meta-family header must be equal to 'Woohoo1!'"
129
+ end
130
+ def test_13_delete_folder
125
131
  assert_equal 1, @s3.delete_folder(@bucket, 'test').size, "Only one key(#{@key1}) must be deleted!"
126
132
  end
127
-
128
- def test_13_delete_bucket
133
+
134
+ def test_14_delete_bucket
129
135
  assert_raise(Rightscale::AwsError) { @s3.delete_bucket(@bucket) }
130
136
  assert @s3.clear_bucket(@bucket), 'Clear_bucket fail'
131
137
  assert_equal 0, @s3.list_bucket(@bucket).size, 'Bucket must be empty'
132
138
  assert @s3.delete_bucket(@bucket)
133
139
  assert !@s3.list_all_my_buckets.map{|bucket| bucket[:name]}.include?(@bucket), "#{@bucket} must not exist"
134
140
  end
141
+
142
+
143
+
135
144
 
136
145
  #---------------------------
137
146
  # Rightscale::S3 classes
@@ -312,10 +321,10 @@ class TestS3 < Test::Unit::TestCase
312
321
  assert grantee.apply
313
322
  assert !grantee.exists?
314
323
  # Check multiple perms assignment
315
- assert grantee.grant 'FULL_CONTROL', 'READ', 'WRITE'
324
+ assert grantee.grant('FULL_CONTROL', 'READ', 'WRITE')
316
325
  assert_equal ['FULL_CONTROL','READ','WRITE'].sort, grantee.perms.sort
317
326
  # Check multiple perms removal
318
- assert grantee.revoke 'FULL_CONTROL', 'WRITE'
327
+ assert grantee.revoke('FULL_CONTROL', 'WRITE')
319
328
  assert_equal ['READ'], grantee.perms
320
329
  # check 'Drop' method
321
330
  assert grantee.drop
@@ -384,5 +393,27 @@ class TestS3 < Test::Unit::TestCase
384
393
  RightAws::S3Interface.amazon_problems= nil
385
394
  assert_nil(RightAws::S3Interface.amazon_problems)
386
395
  end
396
+
397
+ def test_37_access_logging
398
+ bucket = Rightscale::S3::Bucket.create(@s, @bucket, false)
399
+ targetbucket = Rightscale::S3::Bucket.create(@s, @bucket2, true)
400
+ # Take 'AllUsers' grantee
401
+ grantee = Rightscale::S3::Grantee.new(targetbucket,'http://acs.amazonaws.com/groups/s3/LogDelivery')
402
+
403
+ assert grantee.grant(['READ_ACP', 'WRITE'])
404
+
405
+ assert bucket.enable_logging(:targetbucket => targetbucket, :targetprefix => "loggylogs/")
406
+
407
+ assert_equal(bucket.logging_info, {:enabled => true, :targetbucket => @bucket2, :targetprefix => "loggylogs/"})
408
+
409
+ assert bucket.disable_logging
410
+
411
+ # check 'Drop' method
412
+ assert grantee.drop
413
+
414
+ # Delete bucket
415
+ bucket.delete(true)
416
+ targetbucket.delete(true)
417
+ end
387
418
 
388
419
  end
@@ -107,6 +107,10 @@ class TestSdb < Test::Unit::TestCase
107
107
  assert_raise(RightAws::ActiveSdb::ActiveSdbError) do
108
108
  Client.find(ids)
109
109
  end
110
+ # find one record by unknown id
111
+ assert_raise(RightAws::ActiveSdb::ActiveSdbError) do
112
+ Client.find('dummy_id')
113
+ end
110
114
  end
111
115
 
112
116
  def test_05_find_first
@@ -127,6 +131,11 @@ class TestSdb < Test::Unit::TestCase
127
131
  assert_equal 2, Client.find_all_by_post_and_country('president','Russia').size
128
132
  # find all women in USA that love flowers
129
133
  assert_equal 2, Client.find_all_by_gender_and_country_and_hobby('female','Russia','flowers').size
134
+ # order and auto_load:
135
+ clients = Client.find_all_by_post('president', :order => 'name', :auto_load => true)
136
+ assert_equal [['Bush'], ['Medvedev'], ['Putin']], clients.map{|c| c['name']}
137
+ clients = Client.find_all_by_post('president', :order => 'name desc', :auto_load => true)
138
+ assert_equal [['Putin'], ['Medvedev'], ['Bush']], clients.map{|c| c['name']}
130
139
  end
131
140
 
132
141
  def test_07_find_by_helpers
@@ -135,9 +144,11 @@ class TestSdb < Test::Unit::TestCase
135
144
  # find any russian president
136
145
  assert Client.find_by_post_and_country('president','Russia')
137
146
  # find Mary in Russia that loves flowers
138
- assert Client.find_by_gender_and_country_and_hobby('female','Russia','flowers')
147
+ # order and auto_load:
148
+ assert_equal ['Bush'], Client.find_by_post('president', :order => 'name', :auto_load => true)['name']
149
+ assert_equal ['Putin'], Client.find_by_post('president', :order => 'name desc', :auto_load => true)['name']
139
150
  end
140
-
151
+
141
152
  def test_08_reload
142
153
  putin = Client.find_by_name('Putin')
143
154
  # attributes must be empty until reload (except 'id' field)
@@ -156,9 +167,44 @@ class TestSdb < Test::Unit::TestCase
156
167
  assert_equal ['2008'], putin['expiration']
157
168
  assert_equal ['president'], putin['post']
158
169
  end
170
+
171
+ def test_09_select
172
+ # select all records
173
+ assert_equal 7, Client.select(:all).size
174
+ # LIMIT
175
+ # 1 record
176
+ assert Client.select(:first).is_a?(Client)
177
+ # select 2 recs
178
+ assert_equal 2, Client.select(:all, :limit => 2).size
179
+ # ORDER
180
+ # select all recs ordered by 'expration' (must find only recs where 'expration' attribute presents)
181
+ result = Client.select(:all, :order => 'expiration')
182
+ assert_equal 3, result.size
183
+ assert_equal ['2008', '2009', '2012'], result.map{ |c| c['expiration'] }.flatten
184
+ # desc order
185
+ result = Client.select(:all, :order => 'expiration desc')
186
+ assert_equal ['2012', '2009', '2008'], result.map{ |c| c['expiration'] }.flatten
187
+ # CONDITIONS
188
+ result = Client.select(:all, :conditions => ["expiration >= ?", 2009], :order => 'name')
189
+ assert_equal ['Bush', 'Medvedev'], result.map{ |c| c['name'] }.flatten
190
+ result = Client.select(:all, :conditions => "hobby='flowers' AND gender='female'", :order => 'name')
191
+ assert_equal ['Mary', 'Sandy'], result.map{ |c| c['name'] }.flatten
192
+ # SELECT
193
+ result = Client.select(:all, :select => 'hobby', :conditions => "gender IS NOT NULL", :order => 'name')
194
+ hobbies = result.map{|c| c['hobby']}
195
+ # must return all recs
196
+ assert_equal 6, result.size
197
+ # but anly 3 of them have this field set
198
+ assert_equal 3, hobbies.compact.size
199
+ end
200
+
201
+ def test_10_select_by
202
+ assert_equal 2, Client.select_all_by_hobby('flowers').size
203
+ assert_equal 2, Client.select_all_by_hobby_and_country('flowers', 'Russia').size
204
+ assert_equal ['Putin'], Client.select_by_post_and_expiration('president','2008')['name']
205
+ end
159
206
 
160
-
161
- def test_09_save_and_put
207
+ def test_11_save_and_put
162
208
  putin = Client.find_by_name('Putin')
163
209
  putin.reload
164
210
  putin['hobby'] = 'ski'
@@ -187,7 +233,7 @@ class TestSdb < Test::Unit::TestCase
187
233
  assert ['dogs', 'ski'], new_putin['hobby'].sort
188
234
  end
189
235
 
190
- def test_10_save_and_put_attributes
236
+ def test_12_save_and_put_attributes
191
237
  putin = Client.find_by_name('Putin')
192
238
  putin.reload
193
239
  # SAVE method (replace values)
@@ -213,12 +259,16 @@ class TestSdb < Test::Unit::TestCase
213
259
  assert ['english', 'german', 'russian'], new_putin['language'].sort
214
260
  end
215
261
 
216
- def test_11_delete
262
+ def test_13_delete
217
263
  putin = Client.find_by_name('Putin')
218
264
  putin.reload
219
265
  # --- delete_values
266
+ # remove an unknown attribute
267
+ # should return an empty hash
268
+ assert_equal( {}, putin.delete_values('undefined_attribute' => 'ohoho'))
220
269
  # remove 2 languages
221
- putin.delete_values('language' => ['english', 'german'])
270
+ lang_hash = {'language' => ['english', 'german']}
271
+ assert_equal lang_hash, putin.delete_values(lang_hash)
222
272
  wait SDB_DELAY, 'test 11: after put_attributes'
223
273
  # now Putin must know only russian lang
224
274
  new_putin = Client.find_by_name('Putin')
@@ -226,7 +276,7 @@ class TestSdb < Test::Unit::TestCase
226
276
  assert ['russian'], new_putin['language'].sort
227
277
  # --- delete_attributes
228
278
  putin.delete_attributes('language', 'hobby')
229
- wait SDB_DELAY, 'test 11: after put_attributes'
279
+ wait SDB_DELAY, 'test 11: after delete_attributes'
230
280
  # trash hoddy and langs
231
281
  new_putin = Client.find_by_name('Putin')
232
282
  new_putin.reload
@@ -238,7 +288,7 @@ class TestSdb < Test::Unit::TestCase
238
288
  assert_nil Client.find_by_name('Putin')
239
289
  end
240
290
 
241
- def test_12_delete_domain
291
+ def test_14_delete_domain
242
292
  assert Client.delete_domain
243
293
  wait SDB_DELAY, 'test 12: after delete domain'
244
294
  assert_raise(Rightscale::AwsError) do
@@ -1,2 +1,3 @@
1
1
  require 'test/unit'
2
2
  require File.dirname(__FILE__) + '/../../lib/right_aws'
3
+ require 'sdb/active_sdb'
@@ -97,15 +97,15 @@ class TestSdb < Test::Unit::TestCase
97
97
  end
98
98
 
99
99
  def test_07_delete_item
100
- @sdb.put_attributes @domain, @item, {'Jon' => ['girls','vodka']}
100
+ @sdb.put_attributes @domain, @item, {'Volodya' => ['girls','vodka']}
101
101
  wait SDB_DELAY, 'after adding attributes'
102
102
  # get attributes ('girls' and 'vodka' must be there)
103
- values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon'].to_a.sort
103
+ values = @sdb.get_attributes(@domain, @item)[:attributes]['Volodya'].to_a.sort
104
104
  assert_equal values, ['girls', 'vodka']
105
105
  # delete an item
106
106
  @sdb.delete_attributes @domain, @item
107
107
  # get attributes (values must be empty)
108
- values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon']
108
+ values = @sdb.get_attributes(@domain, @item)[:attributes]['Volodya']
109
109
  assert_equal values, nil
110
110
  end
111
111
 
@@ -121,6 +121,7 @@ class TestSdb < Test::Unit::TestCase
121
121
  def test_09_signature_version_0
122
122
  sdb = Rightscale::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :signature_version => '0')
123
123
  item = 'toys'
124
+ # TODO: need to change the below test. I think Juergen's intention was to include some umlauts in the values
124
125
  # put attributes
125
126
  # mhhh... Not sure how to translate this: hölzchehn klötzchen grÃŒnspan buße... Lets assume this is:
126
127
  attributes = { 'Jurgen' => %w{kitten puppy chickabiddy piglet} }
@@ -133,15 +134,114 @@ class TestSdb < Test::Unit::TestCase
133
134
  # check that the request has correct signature version
134
135
  assert sdb.last_request.path.include?('SignatureVersion=0')
135
136
  end
137
+
138
+ def test_10_signature_version_1
139
+ sdb = Rightscale::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :signature_version => '1')
140
+ domains = nil
141
+ assert_nothing_thrown "Failed to use signature V1" do
142
+ domains = sdb.list_domains
143
+ end
144
+ assert domains
145
+ end
146
+
147
+ def test_11_signature_version_1
148
+ sdb = Rightscale::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :signature_version => '2')
149
+ domains = nil
150
+ assert_nothing_thrown "Failed to use signature V2" do
151
+ domains = sdb.list_domains
152
+ end
153
+ assert domains
154
+ end
155
+
156
+ def test_12_array_of_attrs
157
+ item = 'multiples'
158
+ assert_nothing_thrown "Failed to put multiple attrs" do
159
+ @sdb.put_attributes(@domain, item, {:one=>1, :two=>2, :three=>3})
160
+ end
161
+ end
162
+
163
+ def test_13_zero_len_attrs
164
+ item = 'zeroes'
165
+ assert_nothing_thrown "Failed to put zero-length attributes" do
166
+ @sdb.put_attributes(@domain, item, {:one=>"", :two=>"", :three=>""})
167
+ end
168
+ end
136
169
 
170
+ def test_14_nil_attrs
171
+ item = 'nils'
172
+ res = nil
173
+ assert_nothing_thrown do
174
+ @sdb.put_attributes(@domain, item, {:one=>nil, :two=>nil, :three=>'chunder'})
175
+ end
176
+ assert_nothing_thrown do
177
+ res = @sdb.get_attributes(@domain, item)
178
+ end
179
+ assert_nil(res[:attributes]['one'][0])
180
+ assert_nil(res[:attributes]['two'][0])
181
+ assert_not_nil(res[:attributes]['three'][0])
182
+ end
183
+
184
+ def test_15_url_escape
185
+ item = 'urlescapes'
186
+ content = {:a=>"one & two & three",
187
+ :b=>"one ? two / three"}
188
+ @sdb.put_attributes(@domain, item, content)
189
+
190
+ res = @sdb.get_attributes(@domain, item)
191
+ assert_equal(content[:a], res[:attributes]['a'][0])
192
+ assert_equal(content[:b], res[:attributes]['b'][0])
193
+ end
194
+
195
+ def test_16_put_attrs_by_post
196
+ item = 'reqgirth'
197
+ i = 0
198
+ sa = ""
199
+ while(i < 64) do
200
+ sa += "aaaaaaaa"
201
+ i += 1
202
+ end
203
+ @sdb.put_attributes(@domain, item, {:a => sa, :b => sa, :c => sa, :d => sa, :e => sa})
204
+ end
205
+
206
+ def test_20_query_with_atributes
207
+ response = @sdb.query_with_attributes(@domain)
208
+ # convers response to a hash representation
209
+ items = {};
210
+ response[:items].each{ |item| items.merge!(item) }
211
+ # check we have receied all 5 items each full of attributes
212
+ assert_equal 5, items.keys.size
213
+ assert items['toys'].size > 0
214
+ assert items['nils'].size > 0
215
+ assert items['urlescapes'].size > 0
216
+ assert items['multiples'].size > 0
217
+ assert items['reqgirth'].size > 0
218
+ # fetch only Jon's attributes from all items
219
+ response = @sdb.query_with_attributes(@domain,['Jon'])
220
+ items = {};
221
+ response[:items].each{ |item| items.merge!(item) }
222
+ # check we have receied all 5 items
223
+ # check we have receied all 5 items, but only 'toys' has attributes
224
+ puts items.inspect
225
+ assert_equal 2, items['toys']['Jon'].size
226
+ assert_equal 0, items['nils'].size
227
+ assert_equal 0, items['urlescapes'].size
228
+ assert_equal 0, items['multiples'].size
229
+ assert_equal 0, items['reqgirth'].size
230
+ # kust Jurgen's attriburs
231
+ response = @sdb.query_with_attributes(@domain,['Jurgen'], "['Jurgen'='piglet']")
232
+ items = {};
233
+ response[:items].each{ |item| items.merge!(item) }
234
+ # check we have receied an only item
235
+ assert_equal 1, items.keys.size
236
+ assert_equal ["chickabiddy", "kitten", "piglet", "puppy"], items['toys']['Jurgen'].sort
237
+ end
238
+
137
239
  # Keep this test last, because it deletes the domain...
138
- def test_10_delete_domain
240
+ def test_21_delete_domain
139
241
  assert @sdb.delete_domain(@domain), 'delete_domain fail'
140
242
  wait SDB_DELAY, 'after domain deletion'
141
243
  # check that domain does not exist
142
244
  assert !@sdb.list_domains[:domains].include?(@domain)
143
245
  end
144
246
 
145
-
146
-
147
247
  end
data/test/ts_right_aws.rb CHANGED
@@ -11,3 +11,4 @@ require 's3/test_right_s3_stubbed.rb'
11
11
  require 'sqs/test_right_sqs.rb'
12
12
  require 'sqs/test_right_sqs_gen2.rb'
13
13
  require 'sdb/test_right_sdb.rb'
14
+ require 'acf/test_right_acf.rb'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kerryb-right_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.6
4
+ version: 1.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - RightScale, Inc.
@@ -9,31 +9,36 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-04 00:00:00 -08:00
12
+ date: 2009-10-28 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: kerryb-right_http_connection
16
+ name: right_http_connection
17
17
  type: :runtime
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.2.5
23
+ version: 1.2.4
24
24
  version:
25
- - !ruby/object:Gem::Dependency
26
- name: hoe
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.9.0
34
- version:
35
- description: "== DESCRIPTION: The RightScale AWS gems have been designed to provide a robust, fast, and secure interface to Amazon EC2, Amazon S3, Amazon SQS, and Amazon SDB. These gems have been used in production by RightScale since late 2006 and are being maintained to track enhancements made by Amazon. The RightScale AWS gems comprise: - RightAws::Ec2 -- interface to Amazon EC2 (Elastic Compute Cloud) - RightAws::S3 and RightAws::S3Interface -- interface to Amazon S3 (Simple Storage Service) - RightAws::Sqs and RightAws::SqsInterface -- interface to first-generation Amazon SQS (Simple Queue Service) (API version 2007-05-01) - RightAws::SqsGen2 and RightAws::SqsGen2Interface -- interface to second-generation Amazon SQS (Simple Queue Service) (API version 2008-01-01) - RightAws::SdbInterface and RightAws::ActiveSdb -- interface to Amazon SDB (SimpleDB) == FEATURES:"
36
- email: support@rightscale.com
25
+ description: |-
26
+ == DESCRIPTION:
27
+
28
+ The RightScale AWS gems have been designed to provide a robust, fast, and secure interface to Amazon EC2, EBS, S3, SQS, SDB, and CloudFront.
29
+ These gems have been used in production by RightScale since late 2006 and are being maintained to track enhancements made by Amazon.
30
+ The RightScale AWS gems comprise:
31
+
32
+ - RightAws::Ec2 -- interface to Amazon EC2 (Elastic Compute Cloud) and the
33
+ associated EBS (Elastic Block Store)
34
+ - RightAws::S3 and RightAws::S3Interface -- interface to Amazon S3 (Simple Storage Service)
35
+ - RightAws::Sqs and RightAws::SqsInterface -- interface to first-generation Amazon SQS (Simple Queue Service) (API version 2007-05-01)
36
+ - RightAws::SqsGen2 and RightAws::SqsGen2Interface -- interface to second-generation Amazon SQS (Simple Queue Service) (API version 2008-01-01)
37
+ - RightAws::SdbInterface and RightAws::ActiveSdb -- interface to Amazon SDB (SimpleDB)
38
+ - RightAws::AcfInterface -- interface to Amazon CloudFront, a content distribution service
39
+
40
+ == FEATURES:
41
+ email: rubygems@rightscale.com
37
42
  executables: []
38
43
 
39
44
  extensions: []
@@ -48,7 +53,6 @@ files:
48
53
  - README.txt
49
54
  - Rakefile
50
55
  - lib/awsbase/benchmark_fix.rb
51
- - lib/awsbase/file_fix.rb
52
56
  - lib/awsbase/right_awsbase.rb
53
57
  - lib/awsbase/support.rb
54
58
  - lib/ec2/right_ec2.rb
@@ -61,6 +65,7 @@ files:
61
65
  - lib/sqs/right_sqs_gen2.rb
62
66
  - lib/sqs/right_sqs_gen2_interface.rb
63
67
  - lib/sqs/right_sqs_interface.rb
68
+ - lib/acf/right_acf_interface.rb
64
69
  - test/ec2/test_helper.rb
65
70
  - test/ec2/test_right_ec2.rb
66
71
  - test/http_connection.rb
@@ -75,8 +80,12 @@ files:
75
80
  - test/sqs/test_right_sqs_gen2.rb
76
81
  - test/test_credentials.rb
77
82
  - test/ts_right_aws.rb
83
+ - test/acf/test_helper.rb
84
+ - test/acf/test_right_acf.rb
78
85
  has_rdoc: true
79
86
  homepage:
87
+ licenses: []
88
+
80
89
  post_install_message:
81
90
  rdoc_options:
82
91
  - --main
@@ -97,10 +106,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
106
  version:
98
107
  requirements: []
99
108
 
100
- rubyforge_project: rightaws
101
- rubygems_version: 1.2.0
109
+ rubyforge_project: rightscale
110
+ rubygems_version: 1.3.5
102
111
  signing_key:
103
- specification_version: 2
104
- summary: Interface classes for the Amazon EC2, SQS, and S3 Web Services
112
+ specification_version: 3
113
+ summary: Interface classes for the Amazon EC2/EBS, SQS, S3, SDB, and ACF Web Services
105
114
  test_files:
106
115
  - test/ts_right_aws.rb