aws 1.11.38 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,17 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
+ require File.dirname(__FILE__) + '/../test_credentials.rb'
2
3
 
3
4
  class TestS3Stubbed < Test::Unit::TestCase
4
5
 
5
6
  RIGHT_OBJECT_TEXT = 'Right test message'
6
7
 
7
8
  def setup
8
- @s3 = Rightscale::S3Interface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
9
+ TestCredentials.get_credentials
10
+ @s3 = Aws::S3Interface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
9
11
  @bucket = 'right_s3_awesome_test_bucket'
10
12
  @key1 = 'test/woohoo1'
11
13
  @key2 = 'test1/key/woohoo2'
12
- @s = Rightscale::S3.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
14
+ @s = Aws::S3.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
13
15
  Rightscale::HttpConnection.reset
14
16
  end
15
17
 
@@ -18,21 +20,21 @@ class TestS3Stubbed < Test::Unit::TestCase
18
20
  Rightscale::HttpConnection.push(409, 'The named bucket you tried to create already exists')
19
21
  Rightscale::HttpConnection.push(500, 'We encountered an internal error. Please try again.')
20
22
  Rightscale::HttpConnection.push(500, 'We encountered an internal error. Please try again.')
21
- assert_raise RightAws::AwsError do
23
+ assert_raise Aws::AwsError do
22
24
  @s3.create_bucket(@bucket)
23
25
  end
24
26
  end
25
27
 
26
28
  def test_102_list_all_my_buckets_failure
27
29
  Rightscale::HttpConnection.push(401, 'Unauthorized')
28
- assert_raise RightAws::AwsError do
30
+ assert_raise Aws::AwsError do
29
31
  @s3.list_all_my_buckets
30
32
  end
31
33
  end
32
34
 
33
35
  def test_103_list_empty_bucket
34
36
  Rightscale::HttpConnection.push(403, 'Access Denied')
35
- assert_raise RightAws::AwsError do
37
+ assert_raise Aws::AwsError do
36
38
  @s3.list_bucket(@bucket)
37
39
  end
38
40
  end
@@ -41,10 +43,10 @@ class TestS3Stubbed < Test::Unit::TestCase
41
43
  Rightscale::HttpConnection.push(400, 'Your proposed upload exceeds the maximum allowed object size.')
42
44
  Rightscale::HttpConnection.push(400, 'The Content-MD5 you specified was an invalid.')
43
45
  Rightscale::HttpConnection.push(409, 'Please try again')
44
- assert_raise RightAws::AwsError do
46
+ assert_raise Aws::AwsError do
45
47
  assert @s3.put(@bucket, @key1, RIGHT_OBJECT_TEXT, 'x-amz-meta-family'=>'Woohoo1!'), 'Put bucket fail'
46
48
  end
47
- assert_raise RightAws::AwsError do
49
+ assert_raise Aws::AwsError do
48
50
  assert @s3.put(@bucket, @key2, RIGHT_OBJECT_TEXT, 'x-amz-meta-family'=>'Woohoo2!'), 'Put bucket fail'
49
51
  end
50
52
  end
@@ -56,7 +58,7 @@ class TestS3Stubbed < Test::Unit::TestCase
56
58
 
57
59
  def test_106_head
58
60
  Rightscale::HttpConnection.push(404, 'Good Luck!')
59
- assert_raise RightAws::AwsError do
61
+ assert_raise Aws::AwsError do
60
62
  @s3.head(@bucket,@key1)
61
63
  end
62
64
  end
@@ -72,7 +74,7 @@ class TestS3Stubbed < Test::Unit::TestCase
72
74
  Rightscale::HttpConnection.push(500, 'not found')
73
75
  #--- test COPY
74
76
  # copy a key
75
- assert_raise RightAws::AwsError do
77
+ assert_raise Aws::AwsError do
76
78
  @s3.copy(@bucket, @key1, @bucket, @key1_copy)
77
79
  end
78
80
 
@@ -1,15 +1,16 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
- require '../test_credentials'
2
+ require File.dirname(__FILE__) + '/../test_credentials.rb'
3
3
 
4
4
  class TestSdb < Test::Unit::TestCase
5
5
 
6
6
  DOMAIN_NAME = 'right_sdb_awesome_test_domain'
7
7
 
8
- class Client < RightAws::ActiveSdb::Base
8
+ class Client < Aws::ActiveSdb::Base
9
9
  set_domain_name DOMAIN_NAME
10
10
  end
11
11
 
12
12
  def setup
13
+ TestCredentials.get_credentials
13
14
  STDOUT.sync = true
14
15
  @clients = [
15
16
  { 'name' => 'Bush', 'country' => 'USA', 'gender' => 'male', 'expiration' => '2009', 'post' => 'president' },
@@ -18,7 +19,7 @@ class TestSdb < Test::Unit::TestCase
18
19
  { 'name' => 'Mary', 'country' => 'USA', 'gender' => 'female', 'hobby' => ['patchwork', 'bundle jumping'] },
19
20
  { 'name' => 'Sandy', 'country' => 'Russia', 'gender' => 'female', 'hobby' => ['flowers', 'cats', 'cooking'] },
20
21
  { 'name' => 'Mary', 'country' => 'Russia', 'gender' => 'female', 'hobby' => ['flowers', 'cats', 'cooking'] } ]
21
- RightAws::ActiveSdb.establish_connection(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
22
+ Aws::ActiveSdb.establish_connection(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
22
23
  end
23
24
 
24
25
  SDB_DELAY = 3
@@ -34,22 +35,22 @@ class TestSdb < Test::Unit::TestCase
34
35
  end
35
36
 
36
37
  #---------------------------
37
- # Rightscale::SdbInterface
38
+ # Aws::SdbInterface
38
39
  #---------------------------
39
40
 
40
41
  def test_00_delete_domain
41
- assert RightAws::ActiveSdb.delete_domain(DOMAIN_NAME)
42
+ assert Aws::ActiveSdb.delete_domain(DOMAIN_NAME)
42
43
  wait SDB_DELAY, 'test 00: after domain deletion'
43
44
  end
44
45
 
45
46
  def test_01_create_domain
46
47
  # check that domain does not exist
47
- assert !RightAws::ActiveSdb.domains.include?(DOMAIN_NAME)
48
+ assert !Aws::ActiveSdb.domains.include?(DOMAIN_NAME)
48
49
  # create domain
49
50
  assert Client.create_domain
50
51
  wait SDB_DELAY, 'test 01: after domain creation'
51
52
  # check that we have received new domain from Amazin
52
- assert RightAws::ActiveSdb.domains.include?(DOMAIN_NAME)
53
+ assert Aws::ActiveSdb.domains.include?(DOMAIN_NAME)
53
54
  end
54
55
 
55
56
  def test_02_create_items
@@ -105,11 +106,11 @@ class TestSdb < Test::Unit::TestCase
105
106
  assert_equal ids.size, Client.find(ids).size
106
107
  ids << 'dummy_id'
107
108
  # must raise an error when getting unexistent record
108
- assert_raise(RightAws::ActiveSdb::ActiveSdbError) do
109
+ assert_raise(Aws::ActiveSdb::ActiveSdbError) do
109
110
  Client.find(ids)
110
111
  end
111
112
  # find one record by unknown id
112
- assert_raise(RightAws::ActiveSdb::ActiveSdbError) do
113
+ assert_raise(Aws::ActiveSdb::ActiveSdbError) do
113
114
  Client.find('dummy_id')
114
115
  end
115
116
  end
@@ -292,7 +293,7 @@ class TestSdb < Test::Unit::TestCase
292
293
  def test_14_delete_domain
293
294
  assert Client.delete_domain
294
295
  wait SDB_DELAY, 'test 12: after delete domain'
295
- assert_raise(Rightscale::AwsError) do
296
+ assert_raise(Aws::AwsError) do
296
297
  Client.find :all
297
298
  end
298
299
  end
@@ -1,247 +1,215 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
+ require File.dirname(__FILE__) + '/../test_credentials.rb'
2
3
 
3
4
  class TestSdb < Test::Unit::TestCase
4
5
 
5
- def setup
6
- STDOUT.sync = true
7
- @domain = 'right_sdb_awesome_test_domain'
8
- @item = 'toys'
9
- @attr = { 'Jon' => %w{beer car} }
10
- # Interface instance
11
- @sdb = Rightscale::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
12
- end
13
-
14
- SDB_DELAY = 2
15
-
16
- def wait(delay, msg='')
17
- print "waiting #{delay} seconds #{msg}"
18
- while delay>0 do
19
- delay -= 1
20
- print '.'
21
- sleep 1
22
- end
23
- puts
24
- end
25
-
26
- #---------------------------
27
- # Rightscale::SdbInterface
28
- #---------------------------
29
-
30
- def test_00_delete_domain
31
- # delete the domain to reset all the things
32
- assert @sdb.delete_domain(@domain), 'delete_domain fail'
33
- wait SDB_DELAY, 'after domain deletion'
34
- end
35
-
36
- def test_01_create_domain
37
- # check that domain does not exist
38
- assert !@sdb.list_domains[:domains].include?(@domain)
39
- # create domain
40
- assert @sdb.create_domain(@domain), 'create_domain fail'
41
- wait SDB_DELAY, 'after domain creation'
42
- # check that we have received new domain from Amazin
43
- assert @sdb.list_domains[:domains].include?(@domain)
44
- end
45
-
46
- def test_02_put_attributes
47
- # put attributes
48
- assert @sdb.put_attributes(@domain, @item, @attr)
49
- wait SDB_DELAY, 'after putting attributes'
50
- end
51
-
52
- def test_03_get_attributes
53
- # get attributes
54
- values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon'].to_a.sort
55
- # compare to original list
56
- assert_equal values, @attr['Jon'].sort
57
- end
58
-
59
- def test_04_add_attributes
60
- # add new attribute
61
- new_value = 'girls'
62
- @sdb.put_attributes @domain, @item, {'Jon' => new_value}
63
- wait SDB_DELAY, 'after putting attributes'
64
- # get attributes ('girls' must be added to already existent attributes)
65
- values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon'].to_a.sort
66
- assert_equal values, (@attr['Jon'] << new_value).sort
67
- end
68
-
69
- def test_05_replace_attributes
70
- # replace attributes
71
- @sdb.put_attributes @domain, @item, {'Jon' => 'pub'}, :replace
72
- wait SDB_DELAY, 'after replacing attributes'
73
- # get attributes (all must be removed except of 'pub')
74
- values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon']
75
- assert_equal values, ['pub']
76
- end
77
-
78
- def test_06_delete_attribute
79
- # add value 'girls' and 'vodka' to 'Jon'
80
- @sdb.put_attributes @domain, @item, {'Jon' => ['girls','vodka']}
81
- wait SDB_DELAY, 'after adding attributes'
82
- # get attributes ('girls' and 'vodka' must be added 'pub')
83
- values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon'].to_a.sort
84
- assert_equal values, ['girls', 'pub', 'vodka']
85
- # delete a single value 'girls' from attribute 'Jon'
86
- @sdb.delete_attributes @domain, @item, 'Jon' => ['girls']
87
- wait SDB_DELAY, 'after the deletion of attribute'
88
- # get attributes ('girls' must be removed)
89
- values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon']
90
- assert_equal values, ['pub', 'vodka']
91
- # delete all values from attribute 'Jon'
92
- @sdb.delete_attributes @domain, @item, ['Jon']
93
- wait SDB_DELAY, 'after the deletion of attributes'
94
- # get attributes (values must be empty)
95
- values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon']
96
- assert_equal values, nil
97
- end
98
-
99
- def test_07_delete_item
100
- @sdb.put_attributes @domain, @item, {'Volodya' => ['girls','vodka']}
101
- wait SDB_DELAY, 'after adding attributes'
102
- # get attributes ('girls' and 'vodka' must be there)
103
- values = @sdb.get_attributes(@domain, @item)[:attributes]['Volodya'].to_a.sort
104
- assert_equal values, ['girls', 'vodka']
105
- # delete an item
106
- @sdb.delete_attributes @domain, @item
107
- # get attributes (values must be empty)
108
- values = @sdb.get_attributes(@domain, @item)[:attributes]['Volodya']
109
- assert_equal values, nil
110
- end
111
-
112
- def test_08_query
113
- # add some values for query
114
- @sdb.put_attributes @domain, @item, {'Jon' => ['girls','vodka']}
115
- wait SDB_DELAY, 'after adding attributes'
116
- items = @sdb.query(@domain, ['[?=?]', 'Jon','vodka'])[:items]
117
- assert_equal items.size, 1
118
- assert_equal items.first, @item
119
- end
120
-
121
- def test_09_signature_version_0
122
- sdb = Rightscale::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :signature_version => '0')
123
- item = 'toys'
124
- # TODO: need to change the below test. I think Juergen's intention was to include some umlauts in the values
125
- # put attributes
126
- # mhhh... Not sure how to translate this: hölzchehn klötzchen grÃŒnspan buße... Lets assume this is:
127
- attributes = { 'Jurgen' => %w{kitten puppy chickabiddy piglet} }
128
- assert sdb.put_attributes(@domain, item, attributes)
129
- wait SDB_DELAY, 'after putting attributes'
130
- # get attributes
131
- values = sdb.get_attributes(@domain, item)[:attributes]['Jurgen'].to_a.sort
132
- # compare to original list
133
- assert_equal values, attributes['Jurgen'].sort
134
- # check that the request has correct signature version
135
- assert sdb.last_request.path.include?('SignatureVersion=0')
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
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
-
239
- # Keep this test last, because it deletes the domain...
240
- def test_21_delete_domain
241
- assert @sdb.delete_domain(@domain), 'delete_domain fail'
242
- wait SDB_DELAY, 'after domain deletion'
243
- # check that domain does not exist
244
- assert !@sdb.list_domains[:domains].include?(@domain)
245
- end
246
-
6
+ def setup
7
+ TestCredentials.get_credentials
8
+ STDOUT.sync = true
9
+ @domain = 'right_sdb_awesome_test_domain'
10
+ @item = 'toys'
11
+ @attr = { 'Jon' => %w{beer car} }
12
+ # Interface instance
13
+ @sdb = Aws::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
14
+ end
15
+
16
+ SDB_DELAY = 2
17
+
18
+ def wait(delay, msg='')
19
+ print "waiting #{delay} seconds #{msg}"
20
+ while delay>0 do
21
+ delay -= 1
22
+ print '.'
23
+ sleep 1
24
+ end
25
+ puts
26
+ end
27
+
28
+ #---------------------------
29
+ # Aws::SdbInterface
30
+ #---------------------------
31
+
32
+ def test_00_delete_domain
33
+ # delete the domain to reset all the things
34
+ assert @sdb.delete_domain(@domain), 'delete_domain fail'
35
+ wait SDB_DELAY, 'after domain deletion'
36
+ end
37
+
38
+ def test_01_create_domain
39
+ # check that domain does not exist
40
+ assert !@sdb.list_domains[:domains].include?(@domain)
41
+ # create domain
42
+ assert @sdb.create_domain(@domain), 'create_domain fail'
43
+ wait SDB_DELAY, 'after domain creation'
44
+ # check that we have received new domain from Amazin
45
+ assert @sdb.list_domains[:domains].include?(@domain)
46
+ end
47
+
48
+ def test_02_put_attributes
49
+ # put attributes
50
+ assert @sdb.put_attributes(@domain, @item, @attr)
51
+ wait SDB_DELAY, 'after putting attributes'
52
+ end
53
+
54
+ def test_03_get_attributes
55
+ # get attributes
56
+ values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon'].to_a.sort
57
+ # compare to original list
58
+ assert_equal values, @attr['Jon'].sort
59
+ end
60
+
61
+ def test_04_add_attributes
62
+ # add new attribute
63
+ new_value = 'girls'
64
+ @sdb.put_attributes @domain, @item, {'Jon' => new_value}
65
+ wait SDB_DELAY, 'after putting attributes'
66
+ # get attributes ('girls' must be added to already existent attributes)
67
+ values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon'].to_a.sort
68
+ assert_equal values, (@attr['Jon'] << new_value).sort
69
+ end
70
+
71
+ def test_05_replace_attributes
72
+ # replace attributes
73
+ @sdb.put_attributes @domain, @item, {'Jon' => 'pub'}, :replace
74
+ wait SDB_DELAY, 'after replacing attributes'
75
+ # get attributes (all must be removed except of 'pub')
76
+ values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon']
77
+ assert_equal values, ['pub']
78
+ end
79
+
80
+ def test_06_delete_attribute
81
+ # add value 'girls' and 'vodka' to 'Jon'
82
+ @sdb.put_attributes @domain, @item, {'Jon' => ['girls', 'vodka']}
83
+ wait SDB_DELAY, 'after adding attributes'
84
+ # get attributes ('girls' and 'vodka' must be added 'pub')
85
+ values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon'].to_a.sort
86
+ assert_equal values, ['girls', 'pub', 'vodka']
87
+ # delete a single value 'girls' from attribute 'Jon'
88
+ @sdb.delete_attributes @domain, @item, 'Jon' => ['girls']
89
+ wait SDB_DELAY, 'after the deletion of attribute'
90
+ # get attributes ('girls' must be removed)
91
+ values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon']
92
+ assert_equal values, ['pub', 'vodka']
93
+ # delete all values from attribute 'Jon'
94
+ @sdb.delete_attributes @domain, @item, ['Jon']
95
+ wait SDB_DELAY, 'after the deletion of attributes'
96
+ # get attributes (values must be empty)
97
+ values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon']
98
+ assert_equal values, nil
99
+ end
100
+
101
+ def test_07_delete_item
102
+ @sdb.put_attributes @domain, @item, {'Volodya' => ['girls', 'vodka']}
103
+ wait SDB_DELAY, 'after adding attributes'
104
+ # get attributes ('girls' and 'vodka' must be there)
105
+ values = @sdb.get_attributes(@domain, @item)[:attributes]['Volodya'].to_a.sort
106
+ assert_equal values, ['girls', 'vodka']
107
+ # delete an item
108
+ @sdb.delete_attributes @domain, @item
109
+ # get attributes (values must be empty)
110
+ values = @sdb.get_attributes(@domain, @item)[:attributes]['Volodya']
111
+ assert_equal values, nil
112
+ end
113
+
114
+ def test_08_query
115
+ # not applicable anymore
116
+ end
117
+
118
+ def test_09_signature_version_0
119
+ sdb = Aws::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :signature_version => '0')
120
+ item = 'toys'
121
+ # TODO: need to change the below test. I think Juergen's intention was to include some umlauts in the values
122
+ # put attributes
123
+ # mhhh... Not sure how to translate this: hölzchehn klötzchen grÃŒnspan buße... Lets assume this is:
124
+ attributes = { 'Jurgen' => %w{kitten puppy chickabiddy piglet} }
125
+ assert sdb.put_attributes(@domain, item, attributes)
126
+ wait SDB_DELAY, 'after putting attributes'
127
+ # get attributes
128
+ values = sdb.get_attributes(@domain, item)[:attributes]['Jurgen'].to_a.sort
129
+ # compare to original list
130
+ assert_equal values, attributes['Jurgen'].sort
131
+ # check that the request has correct signature version
132
+ assert sdb.last_request.path.include?('SignatureVersion=0')
133
+ end
134
+
135
+ def test_10_signature_version_1
136
+ sdb = Aws::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :signature_version => '1')
137
+ domains = nil
138
+ assert_nothing_thrown "Failed to use signature V1" do
139
+ domains = sdb.list_domains
140
+ end
141
+ assert domains
142
+ end
143
+
144
+ def test_11_signature_version_1
145
+ sdb = Aws::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :signature_version => '2')
146
+ domains = nil
147
+ assert_nothing_thrown "Failed to use signature V2" do
148
+ domains = sdb.list_domains
149
+ end
150
+ assert domains
151
+ end
152
+
153
+ def test_12_array_of_attrs
154
+ item = 'multiples'
155
+ assert_nothing_thrown "Failed to put multiple attrs" do
156
+ @sdb.put_attributes(@domain, item, {:one=>1, :two=>2, :three=>3})
157
+ end
158
+ end
159
+
160
+ def test_13_zero_len_attrs
161
+ item = 'zeroes'
162
+ assert_nothing_thrown "Failed to put zero-length attributes" do
163
+ @sdb.put_attributes(@domain, item, {:one=>"", :two=>"", :three=>""})
164
+ end
165
+ end
166
+
167
+ def test_14_nil_attrs
168
+ item = 'nils'
169
+ res = nil
170
+ assert_nothing_thrown do
171
+ @sdb.put_attributes(@domain, item, {:one=>nil, :two=>nil, :three=>'chunder'})
172
+ end
173
+ assert_nothing_thrown do
174
+ res = @sdb.get_attributes(@domain, item)
175
+ end
176
+ assert_nil(res[:attributes]['one'][0])
177
+ assert_nil(res[:attributes]['two'][0])
178
+ assert_not_nil(res[:attributes]['three'][0])
179
+ end
180
+
181
+ def test_15_url_escape
182
+ item = 'urlescapes'
183
+ content = {:a=>"one & two & three",
184
+ :b=>"one ? two / three"}
185
+ @sdb.put_attributes(@domain, item, content)
186
+
187
+ res = @sdb.get_attributes(@domain, item)
188
+ assert_equal(content[:a], res[:attributes]['a'][0])
189
+ assert_equal(content[:b], res[:attributes]['b'][0])
190
+ end
191
+
192
+ def test_16_put_attrs_by_post
193
+ item = 'reqgirth'
194
+ i = 0
195
+ sa = ""
196
+ while (i < 64) do
197
+ sa += "aaaaaaaa"
198
+ i += 1
199
+ end
200
+ @sdb.put_attributes(@domain, item, {:a => sa, :b => sa, :c => sa, :d => sa, :e => sa})
201
+ end
202
+
203
+ def test_20_query_with_atributes
204
+ # not applicable anymore
205
+ end
206
+
207
+ # Keep this test last, because it deletes the domain...
208
+ def test_21_delete_domain
209
+ assert @sdb.delete_domain(@domain), 'delete_domain fail'
210
+ wait SDB_DELAY, 'after domain deletion'
211
+ # check that domain does not exist
212
+ assert !@sdb.list_domains[:domains].include?(@domain)
213
+ end
214
+
247
215
  end