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,11 @@
|
|
1
|
+
#include "activemq.hpp"
|
2
|
+
|
3
|
+
void register_TextMessage(Module rb_module) {
|
4
|
+
Data_Type< cms::TextMessage > rb_cTextMessage = define_class_under< cms::TextMessage,cms::Message >(rb_module, "TextMessage");
|
5
|
+
rb_cTextMessage.define_method("text", &cms::TextMessage::getText);
|
6
|
+
|
7
|
+
{
|
8
|
+
typedef void ( cms::TextMessage::*setText_func_type )( const std::string& msg );
|
9
|
+
rb_cTextMessage.define_method("text=", setText_func_type( &cms::TextMessage::setText ), (Arg("msg")));
|
10
|
+
}
|
11
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#include "activemq.hpp"
|
2
|
+
|
3
|
+
void register_Connection(Module rb_module);
|
4
|
+
void register_ConnectionFactory(Module rb_module);
|
5
|
+
void register_Session(Module rb_module);
|
6
|
+
void register_Message(Module rb_module);
|
7
|
+
void register_Destinations(Module rb_module);
|
8
|
+
void register_MessageProducer(Module rb_module);
|
9
|
+
void register_DeliveryMode(Module rb_module);
|
10
|
+
void register_TextMessage(Module rb_module);
|
11
|
+
|
12
|
+
extern "C"
|
13
|
+
void Init_ActiveMQ() {
|
14
|
+
Module rb_mActivemq = define_module("ActiveMQ");
|
15
|
+
|
16
|
+
activemq::library::ActiveMQCPP::initializeLibrary();
|
17
|
+
|
18
|
+
register_Connection(rb_mActivemq);
|
19
|
+
register_ConnectionFactory(rb_mActivemq);
|
20
|
+
register_Session(rb_mActivemq);
|
21
|
+
register_Message(rb_mActivemq);
|
22
|
+
register_Destinations(rb_mActivemq);
|
23
|
+
register_MessageProducer(rb_mActivemq);
|
24
|
+
register_DeliveryMode(rb_mActivemq);
|
25
|
+
register_TextMessage(rb_mActivemq);
|
26
|
+
}
|
27
|
+
|
28
|
+
template<>
|
29
|
+
long long from_ruby<long long>(Object x)
|
30
|
+
{
|
31
|
+
return protect(detail::num2long, x);
|
32
|
+
}
|
33
|
+
|
34
|
+
template<>
|
35
|
+
Object to_ruby<long long>(long long const & x)
|
36
|
+
{
|
37
|
+
return protect(detail::long2num, x);
|
38
|
+
}
|
39
|
+
|
40
|
+
Object
|
41
|
+
instance(Object self, Object class_name)
|
42
|
+
{
|
43
|
+
return to_ruby<bool>(self.class_of().value() == class_name.value());
|
44
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#ifndef __ACTIVEMQ_HPP__
|
2
|
+
#define __ACTIVEMQ_HPP__
|
3
|
+
|
4
|
+
#include <rice/Object.hpp>
|
5
|
+
#include <rice/Data_Type.hpp>
|
6
|
+
#include <rice/Data_Object.hpp>
|
7
|
+
#include <rice/String.hpp>
|
8
|
+
#include <rice/Class.hpp>
|
9
|
+
#include <rice/Module.hpp>
|
10
|
+
#include <rice/Exception.hpp>
|
11
|
+
#include <rice/Array.hpp>
|
12
|
+
#include <rice/Arg.hpp>
|
13
|
+
#include <rice/global_function.hpp>
|
14
|
+
#include <rice/Constructor.hpp>
|
15
|
+
#include <rice/Enum.hpp>
|
16
|
+
|
17
|
+
#include <activemq/core/ActiveMQConnectionFactory.h>
|
18
|
+
#include <activemq/library/ActiveMQCPP.h>
|
19
|
+
#include <cms/Connection.h>
|
20
|
+
#include <cms/ConnectionFactory.h>
|
21
|
+
#include <cms/Session.h>
|
22
|
+
#include <cms/Message.h>
|
23
|
+
#include <cms/Destination.h>
|
24
|
+
#include <cms/Topic.h>
|
25
|
+
#include <cms/MessageProducer.h>
|
26
|
+
#include <cms/DeliveryMode.h>
|
27
|
+
#include <cms/TextMessage.h>
|
28
|
+
|
29
|
+
using namespace Rice;
|
30
|
+
|
31
|
+
template<>
|
32
|
+
long long from_ruby<long long>(Rice::Object x);
|
33
|
+
|
34
|
+
template<>
|
35
|
+
Rice::Object to_ruby<long long>(long long const & x);
|
36
|
+
|
37
|
+
Object
|
38
|
+
instance(Object self, Object class_name);
|
39
|
+
|
40
|
+
#endif // __ACTIVEMQ_HPP__
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Loads mkmf which is used to make makefiles for Ruby extensions
|
2
|
+
require 'rubygems'
|
3
|
+
require 'mkmf-rice'
|
4
|
+
|
5
|
+
# Add the arguments to the linker flags.
|
6
|
+
def append_ld_flags(flags)
|
7
|
+
flags = [flags] unless flags.is_a?(Array)
|
8
|
+
with_ldflags("#{$LDFLAGS} #{flags.join(' ')}") { true }
|
9
|
+
end
|
10
|
+
|
11
|
+
def crash(str)
|
12
|
+
printf(" extconf failure: %s\n", str)
|
13
|
+
exit 1
|
14
|
+
end
|
15
|
+
|
16
|
+
if RUBY_PLATFORM =~ /darwin/
|
17
|
+
# In order to link the shared library into our bundle with GCC 4.x on OSX, we have to work around a bug:
|
18
|
+
# GCC redefines symbols - which the -fno-common prohibits. In order to keep the -fno-common, we
|
19
|
+
# remove the flat_namespace (we now have two namespaces, which fixes the GCC clash). Also, we now lookup
|
20
|
+
# symbols in both the namespaces (dynamic_lookup).
|
21
|
+
|
22
|
+
$LDSHARED_CXX.gsub!('suppress', 'dynamic_lookup')
|
23
|
+
$LDSHARED_CXX.gsub!('-flat_namespace', '')
|
24
|
+
|
25
|
+
append_ld_flags '-all_load'
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
# Give it a name
|
30
|
+
extension_name = 'ActiveMQ'
|
31
|
+
|
32
|
+
# The destination
|
33
|
+
dir_config(extension_name)
|
34
|
+
|
35
|
+
dir_config('activemq-cpp', '/opt/activemq-cpp-3.2.5/include/activemq-cpp-3.2.5', '/opt/activemq-cpp-3.2.5/lib')
|
36
|
+
|
37
|
+
unless have_library('activemq-cpp')
|
38
|
+
crash(<<EOL)
|
39
|
+
need activemq-cpp.
|
40
|
+
|
41
|
+
Install the activemq-cpp or try passing one of the following options
|
42
|
+
to extconf.rb:
|
43
|
+
|
44
|
+
--with-activemq-cpp-dir=/path/to/activemq-cpp
|
45
|
+
--with-activemq-cpp-lib=/path/to/activemq-cpp/lib
|
46
|
+
--with-activemq-cpp-include=/path/to/activemq-cpp/include
|
47
|
+
EOL
|
48
|
+
end
|
49
|
+
|
50
|
+
# Do the work
|
51
|
+
create_makefile(extension_name)
|
data/lib/activemq.rb
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe ActiveMQ::ConnectionFactory do
|
5
|
+
describe "constants" do
|
6
|
+
it "should has a defined default_uri" do
|
7
|
+
ActiveMQ::ConnectionFactory.constants.should include("DEFAULT_URI")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should has a string as default_uri" do
|
11
|
+
ActiveMQ::ConnectionFactory::DEFAULT_URI.should be_instance_of(::String)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "new" do
|
16
|
+
it "should be possible create an instance whithout any parameters" do
|
17
|
+
amqcf = ActiveMQ::ConnectionFactory.new
|
18
|
+
amqcf.should_not be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should be created an instance with default values" do
|
22
|
+
amqcf = ActiveMQ::ConnectionFactory.new
|
23
|
+
amqcf.broker_url.should == ActiveMQ::ConnectionFactory::DEFAULT_URI
|
24
|
+
amqcf.username.should be_empty
|
25
|
+
amqcf.password.should be_empty
|
26
|
+
amqcf.client_id.should be_empty
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should be possible pass only broker_url argument to create an instance with other attributes with default values" do
|
30
|
+
amqcf = ActiveMQ::ConnectionFactory.new "url"
|
31
|
+
amqcf.broker_url.should == "url"
|
32
|
+
amqcf.username.should be_empty
|
33
|
+
amqcf.password.should be_empty
|
34
|
+
amqcf.client_id.should be_empty
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should be possible pass broker_url and username arguments to create an instance with other attributes with default values" do
|
38
|
+
amqcf = ActiveMQ::ConnectionFactory.new "url", "username"
|
39
|
+
amqcf.broker_url.should == "url"
|
40
|
+
amqcf.username.should == "username"
|
41
|
+
amqcf.password.should be_empty
|
42
|
+
amqcf.client_id.should be_empty
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should be possible pass broker_url, username and password arguments to create an instance" do
|
46
|
+
amqcf = ActiveMQ::ConnectionFactory.new "url", "username", "password"
|
47
|
+
amqcf.broker_url.should == "url"
|
48
|
+
amqcf.username.should == "username"
|
49
|
+
amqcf.password.should == "password"
|
50
|
+
amqcf.client_id.should be_empty
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "change attributes" do
|
55
|
+
it "should be possible change broker_url attribute" do
|
56
|
+
amqcf = ActiveMQ::ConnectionFactory.new
|
57
|
+
amqcf.broker_url = "url"
|
58
|
+
amqcf.broker_url.should == "url"
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should be possible change username attribute" do
|
62
|
+
amqcf = ActiveMQ::ConnectionFactory.new
|
63
|
+
amqcf.username = "username"
|
64
|
+
amqcf.username.should == "username"
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should be possible change password attribute" do
|
68
|
+
amqcf = ActiveMQ::ConnectionFactory.new
|
69
|
+
amqcf.password = "password"
|
70
|
+
amqcf.password.should == "password"
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should be possible change client_id attribute" do
|
74
|
+
amqcf = ActiveMQ::ConnectionFactory.new
|
75
|
+
amqcf.client_id = "client_id"
|
76
|
+
amqcf.client_id.should == "client_id"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe "connection" do
|
81
|
+
it "should create connection using instance attributes" do
|
82
|
+
amqcf = ActiveMQ::ConnectionFactory.new BROKER_URL_TEST
|
83
|
+
conn = amqcf.create_connection
|
84
|
+
conn.client_id.should be_empty
|
85
|
+
conn.close
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should create connection using given username and password" do
|
89
|
+
amqcf = ActiveMQ::ConnectionFactory.new BROKER_URL_TEST
|
90
|
+
conn = amqcf.create_connection_for("username", "password")
|
91
|
+
conn.client_id.should be_empty
|
92
|
+
conn.close
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should create connection using given username and password and instance client_id" do
|
96
|
+
amqcf = ActiveMQ::ConnectionFactory.new BROKER_URL_TEST
|
97
|
+
amqcf.client_id = "TEST"
|
98
|
+
conn = amqcf.create_connection_for("username", "password")
|
99
|
+
conn.client_id.should == "TEST"
|
100
|
+
conn.close
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should create connection using given username, password and client_id" do
|
104
|
+
amqcf = ActiveMQ::ConnectionFactory.new BROKER_URL_TEST
|
105
|
+
amqcf.client_id = "TEST"
|
106
|
+
conn = amqcf.create_connection_for_client("username", "password", "client_id")
|
107
|
+
conn.client_id.should == "client_id"
|
108
|
+
conn.close
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe ActiveMQ::Connection do
|
5
|
+
|
6
|
+
describe "change attributes" do
|
7
|
+
it "should be created with the same client_id from factory" do
|
8
|
+
amqcf = ActiveMQ::ConnectionFactory.new BROKER_URL_TEST
|
9
|
+
amqcf.client_id = "client_id_fac"
|
10
|
+
|
11
|
+
conn = amqcf.create_connection
|
12
|
+
conn.client_id.should == "client_id_fac"
|
13
|
+
conn.close
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should be possible change client_id attribute" do
|
17
|
+
conn = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection
|
18
|
+
conn.client_id.should be_empty
|
19
|
+
conn.client_id = "client_id"
|
20
|
+
conn.client_id.should == "client_id"
|
21
|
+
conn.close
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "close connection" do
|
26
|
+
it "should respond to close method" do
|
27
|
+
conn = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection
|
28
|
+
conn.should respond_to(:close)
|
29
|
+
conn.close
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should respond to close method with no argumments" do
|
33
|
+
conn = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection
|
34
|
+
conn.close.should be_nil
|
35
|
+
conn.close
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "session" do
|
40
|
+
it "should create session using default acknowledge_mode" do
|
41
|
+
conn = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection
|
42
|
+
conn.create_session.acknowledge_mode.should == ActiveMQ::Session::AcknowledgeMode::AUTO_ACKNOWLEDGE
|
43
|
+
conn.close
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should create session using given acknowledge_mode" do
|
47
|
+
conn = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection
|
48
|
+
conn.create_session(ActiveMQ::Session::AcknowledgeMode::DUPS_OK_ACKNOWLEDGE).acknowledge_mode.should == ActiveMQ::Session::AcknowledgeMode::DUPS_OK_ACKNOWLEDGE
|
49
|
+
conn.close
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe ActiveMQ::DeliveryMode do
|
5
|
+
describe "constants" do
|
6
|
+
it "should has a defined PERSISTENT" do
|
7
|
+
ActiveMQ::DeliveryMode.constants.should include("PERSISTENT")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should PERSISTENT be equal to 0" do
|
11
|
+
ActiveMQ::DeliveryMode::PERSISTENT.should == 0
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should has a defined NON_PERSISTENT" do
|
15
|
+
ActiveMQ::DeliveryMode.constants.should include("NON_PERSISTENT")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should NON_PERSISTENT be equal to 1" do
|
19
|
+
ActiveMQ::DeliveryMode::NON_PERSISTENT.should == 1
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "new" do
|
24
|
+
it "should be possible create an instance whithout any parameters" do
|
25
|
+
delivery = ActiveMQ::DeliveryMode.new
|
26
|
+
delivery.should be_instance_of(ActiveMQ::DeliveryMode)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe ActiveMQ::Destination do
|
5
|
+
describe "constants" do
|
6
|
+
it "should has a defined DestinationType" do
|
7
|
+
ActiveMQ::Destination.constants.should include("DestinationType")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should has a Class as DestinationType" do
|
11
|
+
ActiveMQ::Destination::DestinationType.should be_instance_of(::Class)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should has some constants in the class DestinationType" do
|
15
|
+
ActiveMQ::Destination::DestinationType.constants.should include_all(["TOPIC", "QUEUE", "TEMPORARY_TOPIC", "TEMPORARY_QUEUE"])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "destination_type" do
|
20
|
+
it "should create destination from type ActiveMQ::Destination::DestinationType::TOPIC" do
|
21
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
22
|
+
session.create_topic("TEST_SESSION").destination_type.should == ActiveMQ::Destination::DestinationType::TOPIC
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should create destination from type ActiveMQ::Destination::DestinationType::QUEUE" do
|
26
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
27
|
+
session.create_queue("TEST_SESSION").destination_type.should == ActiveMQ::Destination::DestinationType::QUEUE
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should create destination from type ActiveMQ::Destination::DestinationType::TEMPORARY_TOPIC" do
|
31
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
32
|
+
session.create_temporary_topic.destination_type.should == ActiveMQ::Destination::DestinationType::TEMPORARY_TOPIC
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should create destination from type ActiveMQ::Destination::DestinationType::TEMPORARY_QUEUE" do
|
36
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
37
|
+
session.create_temporary_queue.destination_type.should == ActiveMQ::Destination::DestinationType::TEMPORARY_QUEUE
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "name" do
|
42
|
+
it "should create topic destination with given name" do
|
43
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
44
|
+
session.create_topic("TEST_TOPIC").name.should == "TEST_TOPIC"
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should create queue destination with given name" do
|
48
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
49
|
+
session.create_queue("TEST_QUEUE").name.should == "TEST_QUEUE"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should temporary topic respond to name" do
|
53
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
54
|
+
session.create_temporary_topic.should respond_to(:name)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should temporary queue respond to name" do
|
58
|
+
session = ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
59
|
+
session.create_temporary_queue.should respond_to(:name)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe ActiveMQ::MessageProducer do
|
5
|
+
|
6
|
+
let :session do
|
7
|
+
ActiveMQ::ConnectionFactory.new(BROKER_URL_TEST).create_connection.create_session
|
8
|
+
end
|
9
|
+
|
10
|
+
let :producer do
|
11
|
+
session.create_producer(session.create_topic("TEST_MESSAGE_PRODUCER"))
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "attributes" do
|
15
|
+
it "should respond to some attributes accessors methods" do
|
16
|
+
ActiveMQ::MessageProducer.instance_methods.should include_all(["time_to_live", "time_to_live=", "delivery_mode", "delivery_mode=", "priority", "priority=", "disable_message_time_stamp?", "disable_message_time_stamp=", "disable_message_id?", "disable_message_id="])
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have default time to live equal 0" do
|
20
|
+
producer.time_to_live.should == 0
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should accept a interger as value for time to live attribute" do
|
24
|
+
producer.time_to_live = 5
|
25
|
+
producer.time_to_live.should == 5
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should have default delivery mode equal ActiveMQ::DeliveryMode::PERSISTENT" do
|
29
|
+
producer.delivery_mode.should == ActiveMQ::DeliveryMode::PERSISTENT
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should accept a interger as value for delivery mode attribute" do
|
33
|
+
producer.delivery_mode = ActiveMQ::DeliveryMode::NON_PERSISTENT
|
34
|
+
producer.delivery_mode.should == 1
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should have default priority equal 4" do
|
38
|
+
producer.priority.should == 4
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should accept a interger as value for priority attribute" do
|
42
|
+
producer.priority = 5
|
43
|
+
producer.priority.should == 5
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should have default disable_message_time_stamp equal false" do
|
47
|
+
producer.disable_message_time_stamp?.should be_false
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should accept a boolean as value for disable_message_time_stamp attribute" do
|
51
|
+
producer.disable_message_time_stamp = true
|
52
|
+
producer.disable_message_time_stamp?.should be_true
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should have default disable_message_id equal false" do
|
56
|
+
producer.disable_message_id?.should be_false
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should accept a boolean as value for disable_message_id attribute" do
|
60
|
+
producer.disable_message_id = true
|
61
|
+
producer.disable_message_id?.should be_true
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
describe "send message" do
|
67
|
+
it "should respond to some send message methods" do
|
68
|
+
ActiveMQ::MessageProducer.instance_methods.should include_all(["send_message"])
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should be possible send a message" do
|
72
|
+
message = session.create_text_message "TEST_MESSAGE"
|
73
|
+
expect { producer.send_message(message) }.to_not raise_error
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|