aws 2.8.0 → 2.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,97 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+ require File.dirname(__FILE__) + '/../test_credentials.rb'
3
+
4
+ class TestS3Stubbed < Test::Unit::TestCase
5
+
6
+ RIGHT_OBJECT_TEXT = 'Right test message'
7
+
8
+ def setup
9
+ TestCredentials.get_credentials
10
+ @s3 = Aws::S3Interface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
11
+ @bucket = 'right_s3_awesome_test_bucket'
12
+ @key1 = 'test/woohoo1'
13
+ @key2 = 'test1/key/woohoo2'
14
+ @s = Aws::S3.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
15
+ Rightscale::HttpConnection.reset
16
+ end
17
+
18
+ # Non-remote tests: these use the stub version of Rightscale::HTTPConnection
19
+ def test_101_create_bucket
20
+ Rightscale::HttpConnection.push(409, 'The named bucket you tried to create already exists')
21
+ Rightscale::HttpConnection.push(500, 'We encountered an internal error. Please try again.')
22
+ Rightscale::HttpConnection.push(500, 'We encountered an internal error. Please try again.')
23
+ assert_raise Aws::AwsError do
24
+ @s3.create_bucket(@bucket)
25
+ end
26
+ end
27
+
28
+ def test_102_list_all_my_buckets_failure
29
+ Rightscale::HttpConnection.push(401, 'Unauthorized')
30
+ assert_raise Aws::AwsError do
31
+ @s3.list_all_my_buckets
32
+ end
33
+ end
34
+
35
+ def test_103_list_empty_bucket
36
+ Rightscale::HttpConnection.push(403, 'Access Denied')
37
+ assert_raise Aws::AwsError do
38
+ @s3.list_bucket(@bucket)
39
+ end
40
+ end
41
+
42
+ def test_104_put
43
+ Rightscale::HttpConnection.push(400, 'Your proposed upload exceeds the maximum allowed object size.')
44
+ Rightscale::HttpConnection.push(400, 'The Content-MD5 you specified was an invalid.')
45
+ Rightscale::HttpConnection.push(409, 'Please try again')
46
+ assert_raise Aws::AwsError do
47
+ assert @s3.put(@bucket, @key1, RIGHT_OBJECT_TEXT, 'x-amz-meta-family'=>'Woohoo1!'), 'Put bucket fail'
48
+ end
49
+ assert_raise Aws::AwsError do
50
+ assert @s3.put(@bucket, @key2, RIGHT_OBJECT_TEXT, 'x-amz-meta-family'=>'Woohoo2!'), 'Put bucket fail'
51
+ end
52
+ end
53
+
54
+ def test_105_get_and_get_object
55
+ Rightscale::HttpConnection.push(404, 'not found')
56
+ assert_raise(Rightscale::AwsError) { @s3.get(@bucket, 'undefined/key') }
57
+ end
58
+
59
+ def test_106_head
60
+ Rightscale::HttpConnection.push(404, 'Good Luck!')
61
+ assert_raise Aws::AwsError do
62
+ @s3.head(@bucket,@key1)
63
+ end
64
+ end
65
+
66
+
67
+ def test_109_delete_bucket
68
+ Rightscale::HttpConnection.push(403, 'Good Luck!')
69
+ assert_raise(Rightscale::AwsError) { @s3.delete_bucket(@bucket) }
70
+ end
71
+
72
+ def test_115_copy_key
73
+
74
+ Rightscale::HttpConnection.push(500, 'not found')
75
+ #--- test COPY
76
+ # copy a key
77
+ assert_raise Aws::AwsError do
78
+ @s3.copy(@bucket, @key1, @bucket, @key1_copy)
79
+ end
80
+
81
+ end
82
+
83
+ def test_116_move_key
84
+ # move a key
85
+ Rightscale::HttpConnection.push(413, 'not found')
86
+ assert @s3.move(@bucket, @key1, @bucket, @key1_new_name)
87
+
88
+ end
89
+
90
+ def test_117_rename_key
91
+ # rename a key
92
+ Rightscale::HttpConnection.push(500, 'not found')
93
+ assert @s3.rename(@bucket, @key2, @key2_new_name)
94
+
95
+ end
96
+
97
+ end
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../../lib/aws'
@@ -0,0 +1,226 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+ require File.dirname(__FILE__) + '/../test_credentials.rb'
3
+
4
+ class TestSdb < Test::Unit::TestCase
5
+
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 ['girls', 'vodka'], values
107
+ # delete an item
108
+ @sdb.delete_attributes @domain, @item
109
+ sleep 1
110
+ # get attributes (values must be empty)
111
+ values = @sdb.get_attributes(@domain, @item)[:attributes]['Volodya']
112
+ assert_nil values
113
+ end
114
+
115
+ def test_08_batch_put_and_delete_attributes
116
+ items = []
117
+ 10.times do |i|
118
+ items << Aws::SdbInterface::Item.new("#{@item}_#{i}", {:name=>"name_#{i}"}, true)
119
+ end
120
+ @sdb.batch_put_attributes @domain, items
121
+ sleep 1
122
+
123
+ @sdb.batch_delete_attributes @domain, items.collect { |x| x.item_name }
124
+ end
125
+
126
+
127
+ def test_11_signature_version_2
128
+ sdb = Aws::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :signature_version => '2')
129
+ domains = nil
130
+ assert_nothing_thrown "Failed to use signature V2" do
131
+ domains = sdb.list_domains
132
+ end
133
+ assert domains
134
+ end
135
+
136
+ def test_12_unicode
137
+
138
+ # This was creating a bad signature
139
+ s = ''
140
+ File.open("unicode.txt", "r") { |f|
141
+ s = f.read
142
+ }
143
+ # s = s.force_encoding("UTF-8")
144
+ puts 's=' + s.inspect
145
+ puts "encoding? " + s.encoding.name
146
+ # s = s.encode("ASCII")
147
+ # todo: I'm thinking just iterate through characters and swap out ones that aren't in ascii range.
148
+ @sdb.put_attributes @domain, @item, {"badname"=>[s]}
149
+ sleep 1
150
+ value = @sdb.get_attributes(@domain, @item)[:attributes]['badname'][0]
151
+ puts 'value=' + value.inspect
152
+ # assert value == s # NOT WORKING, not even sure this is a valid test though
153
+
154
+ end
155
+
156
+ def test_15_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_16_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_17_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
+ sleep 1
177
+ assert_nothing_thrown do
178
+ res = @sdb.get_attributes(@domain, item)
179
+ end
180
+ assert_nil(res[:attributes]['one'][0])
181
+ assert_nil(res[:attributes]['two'][0])
182
+ assert_not_nil(res[:attributes]['three'][0])
183
+ end
184
+
185
+ def test_18_url_escape
186
+ item = 'urlescapes'
187
+ content = {:a=>"one & two & three",
188
+ :b=>"one ? two / three"}
189
+ @sdb.put_attributes(@domain, item, content)
190
+
191
+ res = @sdb.get_attributes(@domain, item)
192
+ assert_equal(content[:a], res[:attributes]['a'][0])
193
+ assert_equal(content[:b], res[:attributes]['b'][0])
194
+ end
195
+
196
+ def test_19_put_attrs_by_post
197
+ item = 'reqgirth'
198
+ i = 0
199
+ sa = ""
200
+ while (i < 64) do
201
+ sa += "aaaaaaaa"
202
+ i += 1
203
+ end
204
+ @sdb.put_attributes(@domain, item, {:a => sa, :b => sa, :c => sa, :d => sa, :e => sa})
205
+ end
206
+
207
+ # from https://github.com/appoxy/aws/issues#issue/15
208
+ def test_21_query_with_single_quotes
209
+ sel = "select * from `#{@domain}` where one=#{@sdb.escape("ain't good")}"
210
+ puts sel
211
+ @sdb.select(sel)
212
+ sel = "select * from `#{@domain}` where one=#{@sdb.escape('ain\t good')}"
213
+ puts sel
214
+ @sdb.select(sel)
215
+ end
216
+
217
+ # Keep this test last, because it deletes the domain...
218
+ def test_40_delete_domain
219
+ assert @sdb.delete_domain(@domain), 'delete_domain fail'
220
+ wait SDB_DELAY, 'after domain deletion'
221
+ # check that domain does not exist
222
+ assert !@sdb.list_domains[:domains].include?(@domain)
223
+ end
224
+
225
+
226
+ end
@@ -0,0 +1 @@
1
+ Helmut Fischer GmbH Institut für Elektronik und Messtechnik
@@ -0,0 +1,54 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../../lib/aws'
3
+ require 'pp'
4
+ require File.dirname(__FILE__) + '/../test_credentials.rb'
5
+
6
+ class TestSes < Test::Unit::TestCase
7
+
8
+ def setup
9
+ TestCredentials.get_credentials
10
+
11
+ @ses = Aws::Ses.new(TestCredentials.aws_access_key_id,
12
+ TestCredentials.aws_secret_access_key)
13
+
14
+ end
15
+
16
+ def test_01_get_send_quota
17
+
18
+ ret = @ses.get_send_quota
19
+ p ret
20
+ assert_true(ret.size == 0)
21
+ end
22
+
23
+ def test_02_get_send_statistics
24
+ ret = @ses.get_send_quota
25
+ p ret
26
+ end
27
+
28
+ def test_10_list_verified_email_addresses
29
+
30
+ ret = @ses.get_send_quota
31
+ p ret
32
+ assert_true(ret.size == 0)
33
+ end
34
+
35
+ def test_20_send_email
36
+
37
+ ret = @ses.get_send_quota
38
+ p ret
39
+ assert_true(ret.size == 0)
40
+ end
41
+
42
+ def test_30_send_raw_email
43
+
44
+ ret = @ses.get_send_quota
45
+ p ret
46
+ assert_true(ret.size == 0)
47
+ end
48
+
49
+ def test_40_verify_email_address
50
+ ret = @ses.get_send_quota
51
+ p ret
52
+ assert_true(ret.size == 0)
53
+ end
54
+ end
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../../lib/right_aws'
@@ -0,0 +1,231 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+ require File.dirname(__FILE__) + '/../test_credentials.rb'
3
+
4
+
5
+ class TestSqs < Test::Unit::TestCase
6
+
7
+ GRANTEE_EMAIL_ADDRESS = 'fester@example.com'
8
+ RIGHT_MESSAGE_TEXT = 'Right test message'
9
+
10
+
11
+ def setup
12
+ TestCredentials.get_credentials
13
+ @sqs = Aws::SqsInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
14
+ @queue_name = 'right_sqs_test_gen2_queue'
15
+ # for classes
16
+ @s = Aws::Sqs.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
17
+ end
18
+
19
+ # Wait for the queue to appear in the queues list.
20
+ # Amazon needs some time to after the queue creation to place
21
+ # it to the accessible queues list. If we dont want to get
22
+ # the additional faults then wait a bit...
23
+ def wait_for_queue_url(queue_name)
24
+ queue_url = nil
25
+ until queue_url
26
+ queue_url = @sqs.queue_url_by_name(queue_name)
27
+ unless queue_url
28
+ print '-'
29
+ STDOUT.flush
30
+ sleep 1
31
+ end
32
+ end
33
+ queue_url
34
+ end
35
+
36
+ def test_on_exception_no_method_error
37
+ assert_raise Aws::ResourceNotFoundError do
38
+ Aws::Sqs::Queue.new(@s, "some_nonexistant_queue")
39
+ end
40
+ end
41
+
42
+
43
+ #---------------------------
44
+ # Rightscale::SqsInterface
45
+ #---------------------------
46
+
47
+ def test_01_create_queue
48
+ queue_url = @sqs.create_queue @queue_name
49
+ assert queue_url[/http.*#{@queue_name}/], 'New queue creation failed'
50
+ end
51
+
52
+ def test_02_list_queues
53
+ wait_for_queue_url(@queue_name)
54
+ queues = @sqs.list_queues('right_')
55
+ assert queues.size>0, 'Must more that 0 queues in list'
56
+ end
57
+
58
+ def test_03_set_and_get_queue_attributes
59
+ queue_url = @sqs.queue_url_by_name(@queue_name)
60
+ assert queue_url[/http.*#{@queue_name}/], "#{@queue_name} must exist!"
61
+ assert @sqs.set_queue_attributes(queue_url, 'VisibilityTimeout', 111), 'Set_queue_attributes fail'
62
+ sleep 20 # Amazon needs some time to change attribute
63
+ assert_equal '111', @sqs.get_queue_attributes(queue_url)['VisibilityTimeout'], 'New VisibilityTimeout must be equal to 111'
64
+ end
65
+
66
+ def test_06_send_message
67
+ queue_url = @sqs.queue_url_by_name(@queue_name)
68
+ # send 5 messages for the tests below
69
+ assert @sqs.send_message(queue_url, RIGHT_MESSAGE_TEXT)
70
+ assert @sqs.send_message(queue_url, RIGHT_MESSAGE_TEXT)
71
+ assert @sqs.send_message(queue_url, RIGHT_MESSAGE_TEXT)
72
+ assert @sqs.send_message(queue_url, RIGHT_MESSAGE_TEXT)
73
+ assert @sqs.send_message(queue_url, RIGHT_MESSAGE_TEXT)
74
+ sleep 2
75
+ end
76
+
77
+ def test_07_get_queue_length
78
+ queue_url = @sqs.queue_url_by_name(@queue_name)
79
+ assert_equal 5, @sqs.get_queue_length(queue_url), 'Queue must have 5 messages'
80
+ end
81
+
82
+ def test_08_receive_message
83
+ queue_url = @sqs.queue_url_by_name(@queue_name)
84
+ r_message = @sqs.receive_message(queue_url, 1)[0]
85
+ assert r_message, "Receive returned no message(s), but this is not necessarily incorrect"
86
+ assert_equal RIGHT_MESSAGE_TEXT, r_message['Body'], 'Receive message got wrong message text'
87
+ end
88
+
89
+ def test_09_delete_message
90
+ queue_url = @sqs.queue_url_by_name(@queue_name)
91
+ message = @sqs.receive_message(queue_url)[0]
92
+ assert @sqs.delete_message(queue_url, message['ReceiptHandle']), 'Delete_message fail'
93
+ assert @sqs.pop_message(queue_url), 'Pop_message fail'
94
+ end
95
+
96
+ def test_10_clear_and_delete_queue
97
+ queue_url = @sqs.queue_url_by_name(@queue_name)
98
+ assert @sqs.delete_queue(queue_url)
99
+ end
100
+
101
+ #---------------------------
102
+ # Aws::Sqs classes
103
+ #---------------------------
104
+
105
+ def test_20_sqs_create_delete_queue
106
+ assert @s, 'Aws::Sqs must exist'
107
+ # get queues list
108
+ queues_size = @s.queues.size
109
+ # create new queue
110
+ queue = @s.queue("#{@queue_name}_20", true)
111
+ # check that it is created
112
+ assert queue.is_a?(Aws::Sqs::Queue)
113
+ wait_for_queue_url(@queue_name)
114
+ # check that amount of queues has increased
115
+ assert_equal queues_size + 1, @s.queues.size
116
+ # delete queue
117
+ assert queue.delete
118
+ end
119
+
120
+ def test_21_queue_create
121
+ # create new queue
122
+ queue = Aws::Sqs::Queue.create(@s, "#{@queue_name}_21", true)
123
+ # check that it is created
124
+ assert queue.is_a?(Aws::Sqs::Queue)
125
+ wait_for_queue_url(@queue_name)
126
+ end
127
+
128
+ def test_22_queue_attributes
129
+ queue = Aws::Sqs::Queue.create(@s, "#{@queue_name}_21", false)
130
+ # get a list of attrinutes
131
+ attributes = queue.get_attribute
132
+ assert attributes.is_a?(Hash) && attributes.size>0
133
+ # get attribute value and increase it by 10
134
+ v = (queue.get_attribute('VisibilityTimeout').to_i + 10).to_s
135
+ # set attribute
136
+ assert queue.set_attribute('VisibilityTimeout', v)
137
+ # wait a bit
138
+ sleep 20
139
+ # check that attribute has changed
140
+ assert_equal v, queue.get_attribute('VisibilityTimeout')
141
+ # get queue visibility timeout
142
+ assert_equal v, queue.visibility
143
+ # change it
144
+ queue.visibility = queue.visibility.to_i + 10
145
+ # make sure that it is changed
146
+ assert v.to_i + 10, queue.visibility
147
+ end
148
+
149
+ def test_24_send_size
150
+ queue = Aws::Sqs::Queue.create(@s, "#{@queue_name}_24", true)
151
+ # send 5 messages
152
+ assert queue.push('a1')
153
+ assert queue.push('a2')
154
+ assert queue.push('a3')
155
+ assert queue.push('a4')
156
+ assert queue.push('a5')
157
+ sleep 10
158
+ # check queue size
159
+ assert_equal 5, queue.size
160
+ # send one more
161
+ assert queue.push('a6')
162
+ sleep 10
163
+ # check queue size again
164
+ assert_equal 6, queue.size
165
+ end
166
+
167
+ def test_25_message_receive_pop_delete
168
+ queue = Aws::Sqs::Queue.create(@s, "#{@queue_name}_24", false)
169
+ # get queue size
170
+ size = queue.size
171
+ # get first message
172
+ m1 = queue.receive(10)
173
+ assert m1.is_a?(Aws::Sqs::Message)
174
+ # pop second message
175
+ m2 = queue.pop
176
+ assert m2.is_a?(Aws::Sqs::Message)
177
+ # make sure that queue size has decreased
178
+ assert_equal size-1, queue.size
179
+ # delete messsage
180
+ assert m1.delete
181
+ # make sure that queue size has decreased again
182
+ assert_equal size-2, queue.size
183
+ end
184
+
185
+ def test_26
186
+ queue = Aws::Sqs::Queue.create(@s, "#{@queue_name}_24", false)
187
+ # lock message
188
+ queue.receive(100)
189
+ # clear queue
190
+ assert queue.clear
191
+ # queue size is greater than zero
192
+ assert queue.size>0
193
+ end
194
+
195
+ def test_27_set_amazon_problems
196
+ original_problems = Aws::SqsInterface.amazon_problems
197
+ assert(original_problems.length > 0)
198
+ Aws::SqsInterface.amazon_problems= original_problems << "A New Problem"
199
+ new_problems = Aws::SqsInterface.amazon_problems
200
+ assert_equal(new_problems, original_problems)
201
+
202
+ Aws::SqsInterface.amazon_problems= nil
203
+ assert_nil(Aws::SqsInterface.amazon_problems)
204
+ end
205
+
206
+ def test_28_check_threading_model
207
+ assert(!@sqs.multi_thread)
208
+ newsqs = Aws::SqsInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, {:multi_thread => true})
209
+ assert(newsqs.multi_thread)
210
+ end
211
+
212
+ # Note that just like the other tests, this one does not clean up
213
+ # after itself (queue does not get deleted)
214
+ def test_29_change_message_visibility
215
+ queue = Aws::Sqs::Queue.create(@s, "#{@queue_name}_29", true, 10)
216
+ # Be sure the queue is empty. Useful when rerunning the tests.
217
+ queue.clear
218
+ queue.send_message(RIGHT_MESSAGE_TEXT)
219
+ m = nil
220
+ # Wait for the message to be delivered
221
+ while m.nil?
222
+ m = queue.receive
223
+ end
224
+ m.visibility = 60
225
+ sleep(20)
226
+ # Had the visibility timeout been not updated, the message would be available
227
+ # at this point.
228
+ assert queue.receive.nil?
229
+ end
230
+
231
+ end