torquebox-messaging-container 1.0.0.CR1-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,79 @@
1
+ require 'torquebox/messaging/dispatcher'
2
+
3
+ describe TorqueBox::Messaging::Dispatcher do
4
+
5
+ # Fake MessageProcessor
6
+ class Nothing; end
7
+
8
+ # Easier than getting TorqueBox::Messaging::Topic on the load-path ;)
9
+ class Topic
10
+ def initialize(name)
11
+ @name = name
12
+ end
13
+ def to_s
14
+ @name
15
+ end
16
+ end
17
+
18
+ it "should have correct message processor metadata" do
19
+
20
+ dispatcher = TorqueBox::Messaging::Dispatcher.new do
21
+ map 'Nothing', '/queues/not', :filter => "x=1"
22
+ map Nothing, Topic.new('/topics/not'), 'filter' => 'whatever'
23
+ end
24
+
25
+ dispatcher.processors.should have(2).things
26
+
27
+ p1 = dispatcher.processors.shift
28
+ p1.ruby_class_name.should == 'Nothing'
29
+ p1.ruby_require_path.should == 'nothing'
30
+ p1.destination_name.should == '/queues/not'
31
+ p1.message_selector.should == 'x=1'
32
+
33
+ p2 = dispatcher.processors.shift
34
+ p2.ruby_class_name.should == 'Nothing'
35
+ p2.ruby_require_path.should be_nil
36
+ p2.destination_name.should == '/topics/not'
37
+ p2.message_selector.should == 'whatever'
38
+
39
+ end
40
+
41
+ context "naming" do
42
+ it "should configure naming host and url" do
43
+ dispatcher = TorqueBox::Messaging::Dispatcher.new(:naming_host => 'ahost', :naming_port => 1234) do
44
+ map Nothing, Topic.new('/topics/not'), 'filter' => 'whatever'
45
+ end
46
+
47
+ config = mock('Config')
48
+ config.should_receive(:host=).with('ahost')
49
+ config.should_receive(:port=).with(1234)
50
+
51
+ TorqueBox::Naming.should_receive(:configure).and_yield(config)
52
+
53
+ container = mock('Container')
54
+ container.should_receive(:enable)
55
+
56
+ TorqueBox::Container::Foundation.should_receive(:new).and_return(container)
57
+
58
+ dispatcher.send(:container)
59
+ end
60
+
61
+ it "should configure only naming host" do
62
+ dispatcher = TorqueBox::Messaging::Dispatcher.new(:naming_host => 'somehost') do
63
+ map Nothing, Topic.new('/topics/not'), 'filter' => 'whatever'
64
+ end
65
+
66
+ config = mock('Config')
67
+ config.should_receive(:host=).with('somehost')
68
+
69
+ TorqueBox::Naming.should_receive(:configure).and_yield(config)
70
+
71
+ container = mock('Container')
72
+ container.should_receive(:enable)
73
+
74
+ TorqueBox::Container::Foundation.should_receive(:new).and_return(container)
75
+
76
+ dispatcher.send(:container)
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,72 @@
1
+
2
+ require 'torquebox-naming-container'
3
+ require 'torquebox-naming'
4
+
5
+ require 'torquebox/messaging/message_broker'
6
+
7
+ describe TorqueBox::Messaging::MessageBroker do
8
+
9
+ describe "basics" do
10
+
11
+ before(:each) do
12
+ @container = TorqueBox::Container::Foundation.new
13
+ @container.enable( TorqueBox::Naming::NamingService ) {|config| config.export=false}
14
+ @container.enable( TorqueBox::Messaging::MessageBroker ) {|config| config.data_dir = "#{Dir.pwd}/target"}
15
+ begin
16
+ @container.start
17
+ rescue => e
18
+ puts e
19
+ puts e.backtrace
20
+ raise e
21
+ end
22
+ end
23
+
24
+ after(:each) do
25
+ @container.stop
26
+ end
27
+
28
+ it "should have an RMIClassProvider" do
29
+ @container['RMIClassProvider'].should_not be_nil
30
+ end
31
+
32
+ it "should have a QueuesYamlParsingDeployer" do
33
+ @container['QueuesYamlParsingDeployer'].should_not be_nil
34
+ end
35
+ end
36
+
37
+ describe "deployments" do
38
+ before(:each) do
39
+ #TorqueBox::Naming.configure_local
40
+ @container = TorqueBox::Container::Foundation.new
41
+ @container.enable( TorqueBox::Naming::NamingService ) {|config| config.export=false}
42
+ @container.enable( TorqueBox::Messaging::MessageBroker ) {|config| config.data_dir = "#{Dir.pwd}/target"}
43
+ begin
44
+ @container.start
45
+ rescue => e
46
+ puts e
47
+ puts e.backtrace
48
+ raise e
49
+ end
50
+ @deployments = []
51
+ end
52
+
53
+ after(:each) do
54
+ @deployments.reverse.each do |deployment|
55
+ @container.undeploy( deployment )
56
+ end
57
+ @container.stop
58
+ end
59
+
60
+ it "should be able to deploy a queues.yml" do
61
+ @deployments << @container.deploy( File.join( File.dirname(__FILE__), 'queues.yml' ) )
62
+ @container.process_deployments(true)
63
+ end
64
+
65
+ it "should be able to deploy a messaging.yml" do
66
+ @deployments << @container.deploy( File.join( File.dirname(__FILE__), 'messaging.yml' ) )
67
+ @container.process_deployments(true)
68
+ end
69
+
70
+ end
71
+
72
+ end
@@ -0,0 +1,29 @@
1
+
2
+ require 'torquebox/messaging/message_processor_host'
3
+
4
+ describe TorqueBox::Messaging::MessageProcessorHost do
5
+
6
+ describe "basics" do
7
+ before(:each) do
8
+ @container = TorqueBox::Container::Foundation.new
9
+ @container.enable( TorqueBox::Messaging::MessageProcessorHost )
10
+ begin
11
+ @container.start
12
+ rescue => e
13
+ puts e
14
+ puts e.backtrace
15
+ raise e
16
+ end
17
+ end
18
+
19
+ after(:each) do
20
+ @container.stop
21
+ end
22
+
23
+ it "should have a MessageProcessorDeployer" do
24
+ @container['MessageProcessorDeployer'].should_not be_nil
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,21 @@
1
+ /simple: Simple
2
+
3
+ /array:
4
+ - One
5
+ - Two: &foo
6
+ filter: "x > 18"
7
+ config:
8
+ x: ex
9
+ y: why
10
+ - Three
11
+
12
+ /hash:
13
+ A:
14
+ B:
15
+ filter: "y < 18"
16
+ config:
17
+ h: ache
18
+ i: eye
19
+ Two:
20
+ <<: *foo
21
+
data/spec/queues.yml ADDED
@@ -0,0 +1,2 @@
1
+ /queues/foo:
2
+ durable: false
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: torquebox-messaging-container
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: 6
5
+ version: 1.0.0.CR1
6
+ platform: java
7
+ authors: []
8
+
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-04-15 00:00:00 -04:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: torquebox-container-foundation
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - "="
23
+ - !ruby/object:Gem::Version
24
+ version: 1.0.0.CR1
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: torquebox-vfs
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - "="
34
+ - !ruby/object:Gem::Version
35
+ version: 1.0.0.CR1
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: torquebox-naming-container
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - "="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.0.0.CR1
47
+ type: :development
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: torquebox-naming
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - "="
56
+ - !ruby/object:Gem::Version
57
+ version: 1.0.0.CR1
58
+ type: :runtime
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: rspec
62
+ prerelease: false
63
+ requirement: &id005 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - "="
67
+ - !ruby/object:Gem::Version
68
+ version: 2.3.0
69
+ type: :development
70
+ version_requirements: *id005
71
+ description: ""
72
+ email:
73
+ executables:
74
+ - trq-message-broker
75
+ - trq-message-processor-host
76
+ extensions: []
77
+
78
+ extra_rdoc_files: []
79
+
80
+ files:
81
+ - licenses/lgpl-2.1.txt
82
+ - lib/torquebox-messaging-container.jar
83
+ - lib/torquebox-messaging-container.rb
84
+ - lib/jboss-common-core-2.2.17.GA.jar
85
+ - lib/jnp-client-5.0.5.Final.jar
86
+ - lib/torquebox-messaging-int.jar
87
+ - lib/torquebox-messaging-core.jar
88
+ - lib/torquebox-messaging-metadata.jar
89
+ - lib/jboss-jms-api_1.1_spec-1.0.0.Final.jar
90
+ - lib/hornetq-core-2.1.2.Final.jar
91
+ - lib/hornetq-jms-2.1.2.Final.jar
92
+ - lib/hornetq-logging-2.1.2.Final.jar
93
+ - lib/netty-3.2.1.Final.jar
94
+ - bin/trq-message-broker
95
+ - bin/trq-message-processor-host
96
+ - lib/gem_hook.rb
97
+ - lib/org.torquebox.messaging-container.rb
98
+ - lib/torquebox/messaging/dispatcher.rb
99
+ - lib/torquebox/messaging/hornetq-configuration.xml
100
+ - lib/torquebox/messaging/message-broker-jboss-beans.xml
101
+ - lib/torquebox/messaging/message-processor-host-jboss-beans.xml
102
+ - lib/torquebox/messaging/message_broker.rb
103
+ - lib/torquebox/messaging/message_processor_host.rb
104
+ - lib/torquebox/messaging/commands/message_broker.rb
105
+ - lib/torquebox/messaging/commands/message_processor_host.rb
106
+ - spec/dispatcher_spec.rb
107
+ - spec/message_broker_spec.rb
108
+ - spec/message_processor_host_spec.rb
109
+ - spec/messaging.yml
110
+ - spec/queues.yml
111
+ has_rdoc: true
112
+ homepage: http://www.torquebox.org/container-parent/torquebox-messaging-container/
113
+ licenses:
114
+ - lgpl
115
+ post_install_message:
116
+ rdoc_options: []
117
+
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: "0"
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ">"
130
+ - !ruby/object:Gem::Version
131
+ version: 1.3.1
132
+ requirements: []
133
+
134
+ rubyforge_project:
135
+ rubygems_version: 1.5.1
136
+ signing_key:
137
+ specification_version: 3
138
+ summary: TorqueBox Messaging Container
139
+ test_files:
140
+ - spec/dispatcher_spec.rb
141
+ - spec/message_broker_spec.rb
142
+ - spec/message_processor_host_spec.rb