fmq 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +24 -0
- data/License.txt +675 -0
- data/PostInstall.txt +3 -0
- data/README.txt +69 -0
- data/config/hoe.rb +73 -0
- data/config/requirements.rb +15 -0
- data/default-server/admin-interface/index.html +7 -7
- data/default-server/queues/my_test.rb +6 -15
- data/lib/fmq/client.rb +52 -19
- data/lib/fmq/mongrel_server.rb +43 -24
- data/lib/fmq/queue_manager.rb +265 -260
- data/lib/fmq/queues/README.txt +12 -21
- data/lib/fmq/queues/admin.rb +11 -22
- data/lib/fmq/queues/base.rb +75 -0
- data/lib/fmq/queues/file.rb +6 -19
- data/lib/fmq/queues/forward.rb +7 -12
- data/lib/fmq/queues/linked.rb +28 -59
- data/lib/fmq/queues/load_balanced.rb +105 -104
- data/lib/fmq/queues/syncronized.rb +54 -55
- data/lib/fmq/version.rb +2 -2
- data/test/test_basic.rb +36 -0
- data/test/test_fmq_client.rb +33 -26
- data/test/test_helper.rb +5 -1
- data/test/test_linked.rb +65 -0
- data/test/test_queue_manager.rb +90 -0
- metadata +22 -5
- data/setup.rb +0 -1585
- data/test/test_fmq_queue.rb +0 -47
data/test/test_fmq_queue.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
-
|
3
|
-
class TestFreeMessageQueue < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
#@queue = FreeMessageQueue::LinkedQueue.new
|
6
|
-
@queue = FreeMessageQueue::SyncronizedQueue.new
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_basic_get_poll
|
10
|
-
assert_nil @queue.poll
|
11
|
-
assert_equal 0, @queue.size
|
12
|
-
assert @queue.put(nil) == false
|
13
|
-
assert_nil @queue.poll
|
14
|
-
td_1 = "asdasd"
|
15
|
-
assert @queue.put(td_1)
|
16
|
-
assert_equal 1, @queue.size
|
17
|
-
assert_equal td_1, @queue.poll.data
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_n_items
|
21
|
-
n = 20
|
22
|
-
byte_size = 0
|
23
|
-
n.times { |t| byte_size += t.size }
|
24
|
-
|
25
|
-
assert_equal 0, @queue.bytes
|
26
|
-
assert_nil @queue.poll
|
27
|
-
n.times do |i|
|
28
|
-
assert @queue.put(i)
|
29
|
-
end
|
30
|
-
assert_equal byte_size, @queue.bytes
|
31
|
-
assert_equal n, @queue.size
|
32
|
-
n.times do |i|
|
33
|
-
assert_equal i, @queue.poll.data
|
34
|
-
end
|
35
|
-
assert_equal 0, @queue.bytes
|
36
|
-
assert_nil @queue.poll
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_queue_bytes
|
40
|
-
@queue.put("XX" * 40)
|
41
|
-
@queue.put("X" * 40)
|
42
|
-
@queue.put("XX888" * 40)
|
43
|
-
assert_equal 2*40+40+5*40, @queue.bytes
|
44
|
-
@queue.clear
|
45
|
-
assert_equal 0, @queue.bytes
|
46
|
-
end
|
47
|
-
end
|