reliable-msg 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +5 -1
- data/Rakefile +30 -23
- data/changelog.txt +32 -0
- data/lib/reliable-msg.rb +10 -5
- data/lib/reliable-msg/cli.rb +47 -3
- data/lib/reliable-msg/client.rb +213 -0
- data/lib/reliable-msg/message-store.rb +128 -49
- data/lib/reliable-msg/mysql.sql +7 -1
- data/lib/reliable-msg/queue-manager.rb +263 -58
- data/lib/reliable-msg/queue.rb +100 -253
- data/lib/reliable-msg/rails.rb +114 -0
- data/lib/reliable-msg/selector.rb +65 -75
- data/lib/reliable-msg/topic.rb +215 -0
- data/test/test-queue.rb +35 -5
- data/test/test-rails.rb +59 -0
- data/test/test-topic.rb +102 -0
- metadata +54 -41
- data/lib/uuid.rb +0 -384
- data/test/test-uuid.rb +0 -48
data/test/test-uuid.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# = test-uuid.rb - UUID generator test cases
|
3
|
-
#
|
4
|
-
# Author:: Assaf Arkin assaf@labnotes.org
|
5
|
-
# Documentation:: http://trac.labnotes.org/cgi-bin/trac.cgi/wiki/RubyReliableMessaging
|
6
|
-
# Copyright:: Copyright (c) 2005 Assaf Arkin
|
7
|
-
# License:: MIT and/or Creative Commons Attribution-ShareAlike
|
8
|
-
#
|
9
|
-
#--
|
10
|
-
#++
|
11
|
-
|
12
|
-
|
13
|
-
require 'test/unit'
|
14
|
-
require 'uuid'
|
15
|
-
|
16
|
-
class TestUUID < Test::Unit::TestCase
|
17
|
-
|
18
|
-
def setup
|
19
|
-
end
|
20
|
-
|
21
|
-
def teardown
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_format
|
25
|
-
10.times do
|
26
|
-
uuid = UUID.new :compact
|
27
|
-
assert uuid =~ /^[0-9a-fA-F]{32}$/, "UUID does not conform to :compact format"
|
28
|
-
uuid = UUID.new :default
|
29
|
-
assert uuid =~ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/, "UUID does not conform to :default format"
|
30
|
-
uuid = UUID.new :urn
|
31
|
-
assert uuid =~ /^urn:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i, "UUID does not conform to :urn format"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_monotonic
|
36
|
-
count = 100000
|
37
|
-
seen = {}
|
38
|
-
count.times do |i|
|
39
|
-
uuid = UUID.new
|
40
|
-
assert !seen.has_key?(uuid), "UUID repeated"
|
41
|
-
seen[uuid] = true
|
42
|
-
print '.' if (i % 10000) == 0
|
43
|
-
STDOUT.flush
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
|