activemessaging 0.13.0 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.13.0
@@ -1,51 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- activemessaging (0.12.1)
5
- activemessaging
6
- activesupport (>= 2.3.11)
7
- celluloid
8
-
9
- GEM
10
- remote: http://rubygems.org/
11
- specs:
12
- activesupport (2.3.14)
13
- appraisal (0.4.1)
14
- bundler
15
- rake
16
- celluloid (0.11.1)
17
- timers (>= 1.0.0)
18
- git (1.2.5)
19
- jeweler (1.8.4)
20
- bundler (~> 1.0)
21
- git (>= 1.2.5)
22
- rake
23
- rdoc
24
- jruby-activemq (5.5.1-java)
25
- json (1.7.4)
26
- json (1.7.4-java)
27
- macaddr (1.6.1)
28
- systemu (~> 2.5.0)
29
- rake (0.9.2.2)
30
- rdoc (3.12)
31
- json (~> 1.4)
32
- reliable-msg (1.1.0)
33
- uuid (>= 1.0.0)
34
- stomp (1.2.4)
35
- systemu (2.5.2)
36
- timers (1.0.1)
37
- uuid (2.3.5)
38
- macaddr (~> 1.0)
39
-
40
- PLATFORMS
41
- java
42
- ruby
43
-
44
- DEPENDENCIES
45
- activemessaging!
46
- activesupport (~> 2.3.11)
47
- appraisal
48
- jeweler
49
- jruby-activemq
50
- reliable-msg (~> 1.1)
51
- stomp
@@ -1,53 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- activemessaging (0.12.1)
5
- activemessaging
6
- activesupport (>= 2.3.11)
7
- celluloid
8
-
9
- GEM
10
- remote: http://rubygems.org/
11
- specs:
12
- activesupport (3.0.16)
13
- appraisal (0.4.1)
14
- bundler
15
- rake
16
- celluloid (0.11.1)
17
- timers (>= 1.0.0)
18
- git (1.2.5)
19
- i18n (0.6.0)
20
- jeweler (1.8.4)
21
- bundler (~> 1.0)
22
- git (>= 1.2.5)
23
- rake
24
- rdoc
25
- jruby-activemq (5.5.1-java)
26
- json (1.7.4)
27
- json (1.7.4-java)
28
- macaddr (1.6.1)
29
- systemu (~> 2.5.0)
30
- rake (0.9.2.2)
31
- rdoc (3.12)
32
- json (~> 1.4)
33
- reliable-msg (1.1.0)
34
- uuid (>= 1.0.0)
35
- stomp (1.2.4)
36
- systemu (2.5.2)
37
- timers (1.0.1)
38
- uuid (2.3.5)
39
- macaddr (~> 1.0)
40
-
41
- PLATFORMS
42
- java
43
- ruby
44
-
45
- DEPENDENCIES
46
- activemessaging!
47
- activesupport (~> 3.0.8)
48
- appraisal
49
- i18n
50
- jeweler
51
- jruby-activemq
52
- reliable-msg (~> 1.1)
53
- stomp
@@ -1,55 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- activemessaging (0.12.1)
5
- activemessaging
6
- activesupport (>= 2.3.11)
7
- celluloid
8
-
9
- GEM
10
- remote: http://rubygems.org/
11
- specs:
12
- activesupport (3.1.7)
13
- multi_json (>= 1.0, < 1.3)
14
- appraisal (0.4.1)
15
- bundler
16
- rake
17
- celluloid (0.11.1)
18
- timers (>= 1.0.0)
19
- git (1.2.5)
20
- i18n (0.6.0)
21
- jeweler (1.8.4)
22
- bundler (~> 1.0)
23
- git (>= 1.2.5)
24
- rake
25
- rdoc
26
- jruby-activemq (5.5.1-java)
27
- json (1.7.4)
28
- json (1.7.4-java)
29
- macaddr (1.6.1)
30
- systemu (~> 2.5.0)
31
- multi_json (1.2.0)
32
- rake (0.9.2.2)
33
- rdoc (3.12)
34
- json (~> 1.4)
35
- reliable-msg (1.1.0)
36
- uuid (>= 1.0.0)
37
- stomp (1.2.4)
38
- systemu (2.5.2)
39
- timers (1.0.1)
40
- uuid (2.3.5)
41
- macaddr (~> 1.0)
42
-
43
- PLATFORMS
44
- java
45
- ruby
46
-
47
- DEPENDENCIES
48
- activemessaging!
49
- activesupport (~> 3.1.2)
50
- appraisal
51
- i18n
52
- jeweler
53
- jruby-activemq
54
- reliable-msg (~> 1.1)
55
- stomp
@@ -1,55 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- activemessaging (0.12.1)
5
- activemessaging
6
- activesupport (>= 2.3.11)
7
- celluloid
8
-
9
- GEM
10
- remote: http://rubygems.org/
11
- specs:
12
- activesupport (3.2.7)
13
- i18n (~> 0.6)
14
- multi_json (~> 1.0)
15
- appraisal (0.4.1)
16
- bundler
17
- rake
18
- celluloid (0.11.1)
19
- timers (>= 1.0.0)
20
- git (1.2.5)
21
- i18n (0.6.0)
22
- jeweler (1.8.4)
23
- bundler (~> 1.0)
24
- git (>= 1.2.5)
25
- rake
26
- rdoc
27
- jruby-activemq (5.5.1-java)
28
- json (1.7.4)
29
- json (1.7.4-java)
30
- macaddr (1.6.1)
31
- systemu (~> 2.5.0)
32
- multi_json (1.3.6)
33
- rake (0.9.2.2)
34
- rdoc (3.12)
35
- json (~> 1.4)
36
- reliable-msg (1.1.0)
37
- uuid (>= 1.0.0)
38
- stomp (1.2.4)
39
- systemu (2.5.2)
40
- timers (1.0.1)
41
- uuid (2.3.5)
42
- macaddr (~> 1.0)
43
-
44
- PLATFORMS
45
- java
46
- ruby
47
-
48
- DEPENDENCIES
49
- activemessaging!
50
- activesupport (~> 3.2.2)
51
- appraisal
52
- jeweler
53
- jruby-activemq
54
- reliable-msg (~> 1.1)
55
- stomp
data/init.rb DELETED
@@ -1 +0,0 @@
1
- require 'activemessaging'
data/poller.rb DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Make sure stdout and stderr write out without delay for using with daemon like scripts
3
- STDOUT.sync = true; STDOUT.flush
4
- STDERR.sync = true; STDERR.flush
5
-
6
- # Load Rails
7
- RAILS_ROOT=File.expand_path(File.join(File.dirname(__FILE__), '..','..','..'))
8
- load File.join(RAILS_ROOT, 'config', 'environment.rb')
9
-
10
- # Load ActiveMessaging processors
11
- #ActiveMessaging::load_processors
12
-
13
- # Start it up!
14
- ActiveMessaging::start
@@ -1,10 +0,0 @@
1
- require 'rubygems'
2
-
3
- require 'test/unit'
4
-
5
- # tests
6
- require 'config_test'
7
- require 'filter_test'
8
- require 'tracer_test'
9
- require 'jms_test'
10
- require 'asqs_test'
@@ -1,4 +0,0 @@
1
- # Yaml config file for testing ActiveMessaging
2
- test:
3
- adapter: test
4
- reliable: false
@@ -1,125 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper'
2
- require 'activemessaging/adapters/asqs'
3
-
4
- class AsqsTest < Test::Unit::TestCase
5
-
6
- class FakeHTTPResponse
7
- attr_accessor :headers, :body
8
-
9
- def to_hash
10
- @headers
11
- end
12
-
13
- def kind_of? kind
14
- true
15
- end
16
- end
17
-
18
- ::ActiveMessaging::Adapters::AmazonSqs::Connection.class_eval do
19
- attr_accessor :test_response, :test_headers
20
-
21
- DEFAULT_RESPONSE = <<EOM
22
- <ListQueuesResponse xmlns='http://queue.amazonaws.com/doc/2007-05-01/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ListQueuesResponse'>
23
- <Queues>
24
- <QueueUrl>http://queue.amazonaws.com/thisisatestid1/test1</QueueUrl>
25
- <QueueUrl>http://queue.amazonaws.com/thisisatestid12/test2</QueueUrl>
26
- </Queues>
27
- <ResponseStatus><StatusCode>Success</StatusCode><RequestId>cb919c0a-9bce-4afe-9b48-9bdf2412bb67</RequestId></ResponseStatus>
28
- </ListQueuesResponse>
29
- EOM
30
-
31
- def http_request h, p, r
32
- raise test_response if test_response.is_a?(Exception)
33
-
34
- resp = FakeHTTPResponse.new
35
- resp.body = @test_response || DEFAULT_RESPONSE
36
- resp.headers = @test_headers || {}
37
- return resp
38
- end
39
- end
40
-
41
-
42
- def setup
43
- @connection = ActiveMessaging::Adapters::AmazonSqs::Connection.new(:reliable=>false, :access_key_id=>'access_key_id', :secret_access_key=>'secret_access_key', :reconnectDelay=>1)
44
- @d = "asqs"
45
- @message = "mary had a little lamb"
46
- end
47
-
48
- def teardown
49
- @connection.disconnect unless @connection.nil?
50
- end
51
-
52
- def test_message_size
53
- assert_equal @connection.max_message_size, 8
54
-
55
- @connection = ActiveMessaging::Adapters::AmazonSqs::Connection.new(:reliable=>false, :access_key_id=>'access_key_id', :secret_access_key=>'secret_access_key', :max_message_size => 10)
56
-
57
- assert_nothing_raised do
58
- @connection.send @d, @message
59
- end
60
-
61
- large_message = "m" * 1024 * 9
62
- assert_nothing_raised do
63
- @connection.send @d, large_message
64
- end
65
- large_message = nil
66
-
67
- large_message = "m" * 1024 * 11
68
- assert_raise(RuntimeError) do
69
- @connection.send @d, large_message
70
- end
71
- large_message = nil
72
-
73
- end
74
-
75
- def test_allow_underscore_and_dash
76
- assert_nothing_raised do
77
- @connection.subscribe 'name-name_dash'
78
- end
79
- assert_raise(RuntimeError) do
80
- @connection.subscribe '!@#$%^&'
81
- end
82
- end
83
-
84
-
85
- def test_send_and_receive
86
- @connection.subscribe @d, :visibility_timeout=>100
87
- @connection.send @d, @message
88
-
89
- @connection.test_headers = {:destination=>@d}
90
- @connection.test_response = <<EOM
91
- <ReceiveMessageResponse>
92
- <Message>
93
- <MessageId>11YEJMCHE2DM483NGN40|3H4AA8J7EJKM0DQZR7E1|PT6DRTB278S4MNY77NJ0</MessageId>
94
- <ReceiptHandle>some handle value</ReceiptHandle>
95
- <Body>#{@message}</Body>
96
- <MD5OfBody>not really the md5</MD5OfBody>
97
- </Message>
98
- <ResponseStatus>
99
- <StatusCode>Success</StatusCode>
100
- <RequestId>b5bf2332-e983-4d3e-941a-f64c0d21f00f</RequestId>
101
- </ResponseStatus>
102
- </ReceiveMessageResponse>
103
- EOM
104
-
105
- message = @connection.receive
106
- assert_equal @message, message.body
107
- end
108
-
109
- def test_receive_timeout
110
- @connection.subscribe @d
111
- @connection.send @d, @message
112
-
113
- @connection.test_headers = {:destination=>@d}
114
- @connection.test_response = TimeoutError.new('test timeout error')
115
- @connection.reliable = true
116
- begin
117
- Timeout.timeout 2 do
118
- @connection.receive
119
- end
120
- rescue Timeout::Error=>toe
121
- assert_not_equal toe.message, 'test timeout error'
122
- end
123
- end
124
-
125
- end
@@ -1,42 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper'
2
-
3
- class TestProcessor < ActiveMessaging::Processor
4
- end
5
-
6
- class ConfigTest < Test::Unit::TestCase
7
-
8
- def setup
9
- ActiveMessaging::Gateway.define do |s|
10
- s.destination :hello_world, '/queue/helloWorld'
11
- end
12
- end
13
-
14
- def teardown
15
- ActiveMessaging::Gateway.reset
16
- end
17
-
18
- def test_can_subscribe_to_named_queue
19
- TestProcessor.subscribes_to :hello_world
20
- sub = ActiveMessaging::Gateway.subscriptions.values.last
21
- assert_equal :hello_world, sub.destination.name
22
- assert_equal TestProcessor, sub.processor_class
23
- end
24
-
25
- def test_can_publish_to_named_queue
26
- TestProcessor.publishes_to :hello_world
27
- #no exception - publish just checks to see if the queue exists
28
- end
29
-
30
- def test_should_raise_error_if_subscribe_to_queue_that_does_not_exist
31
- assert_raises(RuntimeError) do
32
- TestProcessor.subscribes_to :queue_that_does_not_exist
33
- end
34
- end
35
-
36
- def test_should_raise_error_if_publishes_to_queue_that_does_not_exist
37
- assert_raises(RuntimeError) do
38
- TestProcessor.publishes_to :queue_that_does_not_exist
39
- end
40
- end
41
-
42
- end
@@ -1,131 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper'
2
- require 'activemessaging/filter'
3
-
4
- module ActiveMessaging #:nodoc:
5
- def self.reload_activemessaging
6
- end
7
- end
8
-
9
- class FilterTest < Test::Unit::TestCase
10
-
11
- class MockFilter < ActiveMessaging::Filter
12
-
13
- @@called = {}
14
- cattr_reader :called
15
-
16
- attr_reader :options
17
-
18
- def initialize(options)
19
- @options = options
20
- end
21
-
22
- def process(message, details={})
23
- @@called[options[:name]] = {:message=>message, :details=>details}
24
- end
25
-
26
- class << self
27
- include Test::Unit::Assertions
28
-
29
- def reset
30
- @@called = {}
31
- end
32
-
33
- def assert_was_called(name=nil)
34
- assert @@called.has_key?(name)
35
- end
36
-
37
- def assert_was_not_called(name=nil)
38
- assert !@@called.has_key?(name)
39
- end
40
-
41
- def assert_routing(name, routing)
42
- assert_equal routing, @@called[name][:details]
43
- end
44
- end
45
- end
46
-
47
- class TestProcessor < ActiveMessaging::Processor
48
- include ActiveMessaging::MessageSender
49
- #subscribes_to :testqueue
50
-
51
- @@was_called = false
52
- class<<self
53
- include Test::Unit::Assertions
54
-
55
- def assert_was_called
56
- assert @@was_called
57
- @@was_called = false
58
- end
59
- end
60
-
61
- def on_message(message)
62
- @@was_called = true
63
- end
64
- end
65
-
66
- include ActiveMessaging::TestHelper
67
-
68
- def setup
69
- ActiveMessaging::Gateway.define do |d|
70
- d.destination :testqueue, '/queue/test.queue'
71
- d.filter 'filter_test/mock_filter', :direction=>:bidirectional, :name=>:bidirectional
72
- d.filter 'filter_test/mock_filter', :direction=>:incoming, :name=>:incoming
73
- d.filter 'filter_test/mock_filter', :direction=>:outgoing, :name=>:outgoing
74
-
75
- d.filter 'filter_test/mock_filter', :direction=>:incoming, :name=>:exclude_only, :only=>:foo
76
- d.filter 'filter_test/mock_filter', :direction=>:incoming, :name=>:include_only, :only=>:testqueue
77
- d.filter 'filter_test/mock_filter', :direction=>:incoming, :name=>:exclude_except, :except=>:testqueue
78
- d.filter 'filter_test/mock_filter', :direction=>:incoming, :name=>:include_except, :except=>:foo
79
- end
80
-
81
- TestProcessor.subscribes_to :testqueue
82
- MockFilter.reset
83
- end
84
-
85
- def teardown
86
- ActiveMessaging::Gateway.reset
87
- end
88
-
89
- def test_filters_use_include
90
- ActiveMessaging::Gateway.dispatch ActiveMessaging::TestMessage.new('body', {}, '/queue/test.queue')
91
- MockFilter.assert_was_called(:include_only)
92
- MockFilter.assert_was_not_called(:exclude_only)
93
- end
94
-
95
- def test_filters_use_exclude
96
- ActiveMessaging::Gateway.dispatch ActiveMessaging::TestMessage.new('body', {}, '/queue/test.queue')
97
- MockFilter.assert_was_called(:include_except)
98
- MockFilter.assert_was_not_called(:exclude_except)
99
- end
100
-
101
- def test_filters_and_processor_gets_called_on_receive
102
- ActiveMessaging::Gateway.dispatch ActiveMessaging::TestMessage.new('body', {}, '/queue/test.queue')
103
- MockFilter.assert_was_called(:bidirectional)
104
- MockFilter.assert_was_called(:incoming)
105
- MockFilter.assert_was_not_called(:outgoing)
106
- TestProcessor.assert_was_called
107
- end
108
-
109
- def test_filters_gets_called_on_publish
110
- ActiveMessaging::Gateway.publish :testqueue, "blah blah"
111
- MockFilter.assert_was_called(:bidirectional)
112
- MockFilter.assert_was_not_called(:incoming)
113
- MockFilter.assert_was_called(:outgoing)
114
- end
115
-
116
- def test_sets_routing_details_on_send
117
- sender = TestProcessor.new
118
- sender.publish :testqueue, "Hi there!"
119
-
120
- MockFilter.assert_was_called(:outgoing)
121
- MockFilter.assert_routing(:outgoing, {:destination=>ActiveMessaging::Gateway.find_queue(:testqueue), :publisher=>FilterTest::TestProcessor, :direction=>:outgoing})
122
- end
123
-
124
- def test_sets_routing_details_on_receive
125
- ActiveMessaging::Gateway.dispatch ActiveMessaging::TestMessage.new('body', {}, '/queue/test.queue')
126
-
127
- MockFilter.assert_was_called(:incoming)
128
- MockFilter.assert_routing(:incoming, {:destination=>ActiveMessaging::Gateway.find_queue(:testqueue), :receiver=>FilterTest::TestProcessor, :direction=>:incoming})
129
- end
130
-
131
- end