activemessaging 0.13.0 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,36 +0,0 @@
1
- rails_environtment_file = File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment")
2
-
3
- if File.exists? rails_environtment_file
4
- require rails_environment_file
5
- APP_ROOT = RAILS_ROOT
6
- APP_ENV = Rails.env
7
- else
8
- ENV['APP_ENV'] = 'test'
9
- APP_ENV = 'test'
10
- APP_ROOT = File.dirname(__FILE__) + '/app'
11
-
12
- $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
13
- require 'rubygems'
14
- require 'active_support/all'
15
-
16
- module ActiveMessaging
17
- def self.app_root
18
- APP_ROOT
19
- end
20
-
21
- def self.app_env
22
- APP_ENV
23
- end
24
- end
25
-
26
- require 'activemessaging/message_sender'
27
- require 'activemessaging/processor'
28
- require 'activemessaging/gateway'
29
- require 'activemessaging/filter'
30
- require 'activemessaging/adapters/test'
31
- end
32
-
33
- # load other libraries
34
- require 'test/unit'
35
-
36
- require File.dirname(__FILE__) + '/../lib/activemessaging/test_helper'
@@ -1,57 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper'
2
- require 'activemessaging/trace_filter'
3
-
4
- module ActiveMessaging #:nodoc:
5
- def self.reload_activemessaging
6
- end
7
- end
8
-
9
- class TestProcessor < ActiveMessaging::Processor
10
- def on_message message
11
- end
12
- end
13
-
14
- class TestSender < ActiveMessaging::Processor
15
- end
16
-
17
- class FakeMessage < ActiveMessaging::BaseMessage
18
- def initialize
19
- super("Ni hao ma?", 1, {'destination'=>'/queue/helloWorld'}, '/queue/helloWorld')
20
- end
21
- end
22
-
23
- class TracerTest < Test::Unit::TestCase
24
- include ActiveMessaging::TestHelper
25
-
26
- def setup
27
- ActiveMessaging::Gateway.define do |s|
28
- s.queue :hello_world, '/queue/helloWorld'
29
- s.queue :trace, '/queue/trace'
30
-
31
- s.filter :trace_filter, :queue=>:trace
32
- end
33
-
34
- TestProcessor.subscribes_to :hello_world
35
- TestSender.publishes_to :hello_world
36
- end
37
-
38
- def teardown
39
- ActiveMessaging::Gateway.reset
40
- end
41
-
42
- def test_should_trace_sent_messages
43
- message = "Ni hao ma?"
44
-
45
- sender = TestSender.new
46
- sender.publish :hello_world, message
47
-
48
- assert_message :trace, "<sent><from>TestSender</from><queue>hello_world</queue><message>#{message}</message></sent>"
49
- assert_message :hello_world, message
50
- end
51
-
52
- def test_should_trace_received_messages
53
- ActiveMessaging::Gateway.dispatch FakeMessage.new
54
-
55
- assert_message :trace, "<received><by>TestProcessor</by><queue>hello_world</queue><message>Ni hao ma?</message></received>"
56
- end
57
- end