activemq 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/.rvmrc +1 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +52 -0
- data/README.textile +52 -0
- data/Rakefile +14 -0
- data/activemq.gemspec +29 -0
- data/ext/ActiveMQ/Connection.cpp +16 -0
- data/ext/ActiveMQ/ConnectionFactory.cpp +30 -0
- data/ext/ActiveMQ/DeliveryMode.cpp +10 -0
- data/ext/ActiveMQ/Destinations.cpp +28 -0
- data/ext/ActiveMQ/Message.cpp +68 -0
- data/ext/ActiveMQ/MessageProducer.cpp +42 -0
- data/ext/ActiveMQ/Session.cpp +63 -0
- data/ext/ActiveMQ/TextMessage.cpp +11 -0
- data/ext/ActiveMQ/activemq.cpp +44 -0
- data/ext/ActiveMQ/activemq.hpp +40 -0
- data/ext/ActiveMQ/extconf.rb +51 -0
- data/lib/activemq.rb +5 -0
- data/lib/activemq/version.rb +3 -0
- data/spec/lib/activemq/connection_factory_spec.rb +111 -0
- data/spec/lib/activemq/connection_spec.rb +52 -0
- data/spec/lib/activemq/delivery_mode_spec.rb +30 -0
- data/spec/lib/activemq/destinations_spec.rb +63 -0
- data/spec/lib/activemq/message_producer_spec.rb +77 -0
- data/spec/lib/activemq/message_spec.rb +6 -0
- data/spec/lib/activemq/session_spec.rb +92 -0
- data/spec/lib/activemq/text_message_spec.rb +25 -0
- data/spec/lib/activemq_spec.rb +110 -0
- data/spec/matchers_helper.rb +9 -0
- data/spec/spec_helper.rb +41 -0
- metadata +143 -0
@@ -0,0 +1,92 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe ActiveMQ::Session do
|
5
|
+
describe "constants" do
|
6
|
+
it "should has a defined AcknowledgeMode" do
|
7
|
+
ActiveMQ::Session.constants.should include("AcknowledgeMode")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should has a Class as AcknowledgeMode" do
|
11
|
+
ActiveMQ::Session::AcknowledgeMode.should be_instance_of(::Class)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should has some constants in the class AcknowledgeMode" do
|
15
|
+
ActiveMQ::Session::AcknowledgeMode.constants.should include_all(["AUTO_ACKNOWLEDGE", "DUPS_OK_ACKNOWLEDGE", "CLIENT_ACKNOWLEDGE", "SESSION_TRANSACTED"])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "destinations" do
|
20
|
+
it "should create topic from class ActiveMQ::Topic" do
|
21
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
22
|
+
session.create_topic("TEST_SESSION").should be_instance_of(ActiveMQ::Topic)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should create queue from class ActiveMQ::Queue" do
|
26
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
27
|
+
session.create_queue("TEST_SESSION").should be_instance_of(ActiveMQ::Queue)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should create topic from class ActiveMQ::TemporaryTopic" do
|
31
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
32
|
+
session.create_temporary_topic.should be_instance_of(ActiveMQ::TemporaryTopic)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should create queue from class ActiveMQ::TemporaryQueue" do
|
36
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
37
|
+
session.create_temporary_queue.should be_instance_of(ActiveMQ::TemporaryQueue)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "producer" do
|
42
|
+
it "should create a producer to given destination" do
|
43
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
44
|
+
session.create_producer(session.create_topic("TEST_SESSION")).should be_instance_of(ActiveMQ::MessageProducer)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "acknowledge_mode" do
|
49
|
+
it "should not be possible change acknowledge_mode" do
|
50
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
51
|
+
session.should_not respond_to(:acknowledge_mode=)
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should be possible get acknowledge_mode" do
|
55
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
56
|
+
session.should respond_to(:acknowledge_mode)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "message" do
|
61
|
+
it "should create a text message" do
|
62
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
63
|
+
session.create_message.should be_instance_of(ActiveMQ::Message)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should create a text message" do
|
67
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
68
|
+
session.create_text_message.should be_instance_of(ActiveMQ::TextMessage)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should create a text message with a message" do
|
72
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
73
|
+
session.create_text_message("message").text.should == "message"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe "transaction" do
|
78
|
+
it "should be possible to know if the session is transacted or not" do
|
79
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
80
|
+
session.should respond_to(:transacted?)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should return a boolean as response to call method transacted?" do
|
84
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
85
|
+
session.transacted?.should satisfy { |v| v.is_a?(::FalseClass) or v.is_a?(::TrueClass) }
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should respond to transactions methods" do
|
89
|
+
ActiveMQ::Session.instance_methods.should include_all(["close", "commit", "rollback", "recover"])
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe ActiveMQ::TextMessage do
|
5
|
+
|
6
|
+
describe "text" do
|
7
|
+
it "should create a text message without text" do
|
8
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
9
|
+
session.create_text_message.text.should be_empty
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should create a text message with a message" do
|
13
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
14
|
+
session.create_text_message("message").text.should == "message"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should be possible to set text to a message" do
|
18
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
19
|
+
message = session.create_text_message
|
20
|
+
message.text = "TEXT_MESSAGE"
|
21
|
+
message.text.should == "TEXT_MESSAGE"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe ActiveMQ do
|
5
|
+
describe "constants" do
|
6
|
+
it "should has a defined version" do
|
7
|
+
ActiveMQ.constants.should include("VERSION")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should has a string as version" do
|
11
|
+
ActiveMQ::VERSION.should be_instance_of(::String)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should has a constant ConnectionFactory" do
|
15
|
+
ActiveMQ.constants.should include("ConnectionFactory")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should has a class ConnectionFactory" do
|
19
|
+
ActiveMQ::ConnectionFactory.should be_instance_of(::Class)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should has a constant Connection" do
|
23
|
+
ActiveMQ.constants.should include("Connection")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should has a class Connection" do
|
27
|
+
ActiveMQ::Connection.should be_instance_of(::Class)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should has a constant DeliveryMode" do
|
31
|
+
ActiveMQ.constants.should include("DeliveryMode")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should has a class DeliveryMode" do
|
35
|
+
ActiveMQ::DeliveryMode.should be_instance_of(::Class)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should has a constant Destination" do
|
39
|
+
ActiveMQ.constants.should include("Destination")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should has a class Destination" do
|
43
|
+
ActiveMQ::Destination.should be_instance_of(::Class)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should has a constant Message" do
|
47
|
+
ActiveMQ.constants.should include("Message")
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should has a class Message" do
|
51
|
+
ActiveMQ::Message.should be_instance_of(::Class)
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should has a constant MessageProducer" do
|
55
|
+
ActiveMQ.constants.should include("MessageProducer")
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should has a class MessageProducer" do
|
59
|
+
ActiveMQ::MessageProducer.should be_instance_of(::Class)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should has a constant Queue" do
|
63
|
+
ActiveMQ.constants.should include("Queue")
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should has a class Queue" do
|
67
|
+
ActiveMQ::Queue.should be_instance_of(::Class)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should has a constant Session" do
|
71
|
+
ActiveMQ.constants.should include("Session")
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should has a class Session" do
|
75
|
+
ActiveMQ::Session.should be_instance_of(::Class)
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should has a constant TemporaryQueue" do
|
79
|
+
ActiveMQ.constants.should include("TemporaryQueue")
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should has a class TemporaryQueue" do
|
83
|
+
ActiveMQ::TemporaryQueue.should be_instance_of(::Class)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should has a constant TemporaryTopic" do
|
87
|
+
ActiveMQ.constants.should include("TemporaryTopic")
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should has a class TemporaryTopic" do
|
91
|
+
ActiveMQ::TemporaryTopic.should be_instance_of(::Class)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should has a constant TextMessage" do
|
95
|
+
ActiveMQ.constants.should include("TextMessage")
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should has a class TextMessage" do
|
99
|
+
ActiveMQ::TextMessage.should be_instance_of(::Class)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should has a constant Topic" do
|
103
|
+
ActiveMQ.constants.should include("Topic")
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should has a class Topic" do
|
107
|
+
ActiveMQ::Topic.should be_instance_of(::Class)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
require 'rspec'
|
4
|
+
require 'activemq'
|
5
|
+
require 'matchers_helper'
|
6
|
+
require 'ruby-debug'
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
def fixture(path)
|
10
|
+
File.join(fixtures_dir, path)
|
11
|
+
end
|
12
|
+
|
13
|
+
def fixtures_dir
|
14
|
+
File.expand_path('fixtures', File.dirname(__FILE__))
|
15
|
+
end
|
16
|
+
|
17
|
+
def sandbox(path)
|
18
|
+
File.join(sandbox_dir, path)
|
19
|
+
end
|
20
|
+
|
21
|
+
def sandbox_dir
|
22
|
+
File.expand_path('sandbox', File.dirname(__FILE__))
|
23
|
+
end
|
24
|
+
|
25
|
+
def capture(stream)
|
26
|
+
begin
|
27
|
+
stream = stream.to_s
|
28
|
+
eval "$#{stream} = StringIO.new"
|
29
|
+
yield
|
30
|
+
result = eval("$#{stream}").string
|
31
|
+
ensure
|
32
|
+
eval("$#{stream} = #{stream.upcase}")
|
33
|
+
end
|
34
|
+
|
35
|
+
result
|
36
|
+
end
|
37
|
+
|
38
|
+
alias silence capture
|
39
|
+
end
|
40
|
+
|
41
|
+
BROKER_URL_TEST = "tcp://localhost:60606"
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: activemq
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Wandenberg Peixoto
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-04-14 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rice
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 4
|
32
|
+
- 2
|
33
|
+
version: 1.4.2
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake-compiler
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 13
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
- 7
|
48
|
+
- 7
|
49
|
+
version: 0.7.7
|
50
|
+
type: :development
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: rspec
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 2
|
63
|
+
- 3
|
64
|
+
- 0
|
65
|
+
version: 2.3.0
|
66
|
+
type: :development
|
67
|
+
version_requirements: *id003
|
68
|
+
description: ActiveMQ client for Ruby using openwire protocol through activemq-cpp client
|
69
|
+
email:
|
70
|
+
- wandenberg@gmail.com
|
71
|
+
executables: []
|
72
|
+
|
73
|
+
extensions:
|
74
|
+
- ext/ActiveMQ/extconf.rb
|
75
|
+
extra_rdoc_files: []
|
76
|
+
|
77
|
+
files:
|
78
|
+
- .gitignore
|
79
|
+
- .rvmrc
|
80
|
+
- Gemfile
|
81
|
+
- Gemfile.lock
|
82
|
+
- README.textile
|
83
|
+
- Rakefile
|
84
|
+
- activemq.gemspec
|
85
|
+
- ext/ActiveMQ/Connection.cpp
|
86
|
+
- ext/ActiveMQ/ConnectionFactory.cpp
|
87
|
+
- ext/ActiveMQ/DeliveryMode.cpp
|
88
|
+
- ext/ActiveMQ/Destinations.cpp
|
89
|
+
- ext/ActiveMQ/Message.cpp
|
90
|
+
- ext/ActiveMQ/MessageProducer.cpp
|
91
|
+
- ext/ActiveMQ/Session.cpp
|
92
|
+
- ext/ActiveMQ/TextMessage.cpp
|
93
|
+
- ext/ActiveMQ/activemq.cpp
|
94
|
+
- ext/ActiveMQ/activemq.hpp
|
95
|
+
- ext/ActiveMQ/extconf.rb
|
96
|
+
- lib/activemq.rb
|
97
|
+
- lib/activemq/version.rb
|
98
|
+
- spec/lib/activemq/connection_factory_spec.rb
|
99
|
+
- spec/lib/activemq/connection_spec.rb
|
100
|
+
- spec/lib/activemq/delivery_mode_spec.rb
|
101
|
+
- spec/lib/activemq/destinations_spec.rb
|
102
|
+
- spec/lib/activemq/message_producer_spec.rb
|
103
|
+
- spec/lib/activemq/message_spec.rb
|
104
|
+
- spec/lib/activemq/session_spec.rb
|
105
|
+
- spec/lib/activemq/text_message_spec.rb
|
106
|
+
- spec/lib/activemq_spec.rb
|
107
|
+
- spec/matchers_helper.rb
|
108
|
+
- spec/spec_helper.rb
|
109
|
+
homepage: ""
|
110
|
+
licenses: []
|
111
|
+
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
hash: 3
|
123
|
+
segments:
|
124
|
+
- 0
|
125
|
+
version: "0"
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
hash: 3
|
132
|
+
segments:
|
133
|
+
- 0
|
134
|
+
version: "0"
|
135
|
+
requirements: []
|
136
|
+
|
137
|
+
rubyforge_project: activemq
|
138
|
+
rubygems_version: 1.7.2
|
139
|
+
signing_key:
|
140
|
+
specification_version: 3
|
141
|
+
summary: ActiveMQ client for Ruby
|
142
|
+
test_files: []
|
143
|
+
|