aws 1.11.38 → 2.1.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.
- data/README.markdown +20 -23
- data/lib/acf/right_acf_interface.rb +17 -17
- data/lib/aws.rb +27 -0
- data/lib/awsbase/right_awsbase.rb +8 -8
- data/lib/ec2/right_ec2.rb +37 -35
- data/lib/ec2/right_mon_interface.rb +25 -15
- data/lib/elb/right_elb_interface.rb +6 -6
- data/lib/right_aws.rb +6 -17
- data/lib/s3/right_s3.rb +58 -58
- data/lib/s3/right_s3_interface.rb +18 -18
- data/lib/sdb/active_sdb.rb +28 -28
- data/lib/sdb/right_sdb_interface.rb +18 -18
- data/lib/sqs/right_sqs.rb +13 -13
- data/lib/sqs/right_sqs_interface.rb +12 -12
- data/test/acf/test_right_acf.rb +10 -8
- data/test/ec2/test_helper.rb +1 -1
- data/test/ec2/test_mon.rb +17 -0
- data/test/ec2/test_right_ec2.rb +9 -7
- data/test/s3/test_helper.rb +2 -1
- data/test/s3/test_right_s3.rb +417 -411
- data/test/s3/test_right_s3_stubbed.rb +11 -9
- data/test/sdb/test_active_sdb.rb +11 -10
- data/test/sdb/test_right_sdb.rb +210 -242
- data/test/sqs/test_right_sqs.rb +190 -269
- data/test/test_credentials.rb +52 -40
- metadata +4 -3
- data/test/sqs/test_right_sqs_gen2.rb +0 -209
@@ -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
|
-
|
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 =
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
77
|
+
assert_raise Aws::AwsError do
|
76
78
|
@s3.copy(@bucket, @key1, @bucket, @key1_copy)
|
77
79
|
end
|
78
80
|
|
data/test/sdb/test_active_sdb.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
-
require '
|
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 <
|
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
|
-
|
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
|
-
#
|
38
|
+
# Aws::SdbInterface
|
38
39
|
#---------------------------
|
39
40
|
|
40
41
|
def test_00_delete_domain
|
41
|
-
assert
|
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 !
|
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
|
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(
|
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(
|
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(
|
296
|
+
assert_raise(Aws::AwsError) do
|
296
297
|
Client.find :all
|
297
298
|
end
|
298
299
|
end
|
data/test/sdb/test_right_sdb.rb
CHANGED
@@ -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
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
end
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
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
|