qpid_messaging 0.20.2 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/LICENSE +0 -4
- data/README.rdoc +15 -20
- data/TODO +10 -5
- data/ext/cqpid/cqpid.cpp +156 -40
- data/ext/cqpid/extconf.rb +10 -2
- data/lib/qpid_messaging.rb +56 -3
- data/lib/qpid_messaging/address.rb +51 -28
- data/lib/qpid_messaging/connection.rb +75 -46
- data/lib/qpid_messaging/duration.rb +49 -14
- data/lib/qpid_messaging/encoding.rb +5 -5
- data/lib/qpid_messaging/message.rb +61 -68
- data/lib/qpid_messaging/receiver.rb +62 -67
- data/lib/qpid_messaging/sender.rb +39 -56
- data/lib/qpid_messaging/session.rb +78 -81
- metadata +51 -61
- data/Rakefile +0 -137
- data/features/closing_a_connection.feature +0 -13
- data/features/closing_a_session.feature +0 -13
- data/features/connecting_to_a_broker.feature +0 -13
- data/features/creating_a_receiver.feature +0 -29
- data/features/creating_a_sender.feature +0 -25
- data/features/creating_a_session.feature +0 -12
- data/features/getting_the_connections_authenticated_username.feature +0 -8
- data/features/receiving_a_message.feature +0 -30
- data/features/sending_a_message.feature +0 -21
- data/features/session_returns_its_connection.feature +0 -12
- data/features/sessions_have_names.feature +0 -8
- data/features/step_definitions/address_steps.rb +0 -22
- data/features/step_definitions/connection_steps.rb +0 -93
- data/features/step_definitions/receiver_steps.rb +0 -69
- data/features/step_definitions/sender_steps.rb +0 -34
- data/features/step_definitions/session_steps.rb +0 -99
- data/features/support/env.rb +0 -22
- data/lib/qpid_messaging/errors.rb +0 -33
- data/lib/qpid_messaging/version.rb +0 -31
- data/spec/qpid_messaging/address_spec.rb +0 -87
- data/spec/qpid_messaging/connection_spec.rb +0 -191
- data/spec/qpid_messaging/duration_spec.rb +0 -56
- data/spec/qpid_messaging/encoding_spec.rb +0 -63
- data/spec/qpid_messaging/message_spec.rb +0 -305
- data/spec/qpid_messaging/receiver_spec.rb +0 -170
- data/spec/qpid_messaging/sender_spec.rb +0 -135
- data/spec/qpid_messaging/session_spec.rb +0 -353
- data/spec/spec_helper.rb +0 -20
data/Rakefile
DELETED
@@ -1,137 +0,0 @@
|
|
1
|
-
# Rakefile for Qpid -*- ruby -*-
|
2
|
-
#
|
3
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
5
|
-
# distributed with this work for additional information
|
6
|
-
# regarding copyright ownership. The ASF licenses this file
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
8
|
-
# "License"); you may not use this file except in compliance
|
9
|
-
# with the License. You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
#
|
20
|
-
|
21
|
-
task :noop
|
22
|
-
|
23
|
-
$:.push File.expand_path("../lib", __FILE__)
|
24
|
-
|
25
|
-
OUTPUT_DIR=ENV["OUTPUT_DIR"] || "."
|
26
|
-
|
27
|
-
require "rubygems"
|
28
|
-
require "rubygems/package_task"
|
29
|
-
|
30
|
-
require "rake/clean"
|
31
|
-
require "rake/extensiontask"
|
32
|
-
require "rdoc/task"
|
33
|
-
require "rake/testtask"
|
34
|
-
|
35
|
-
require "cucumber/rake/task"
|
36
|
-
require "rspec/core/rake_task"
|
37
|
-
|
38
|
-
CLOBBER.include("pkg")
|
39
|
-
|
40
|
-
load "./lib/qpid_messaging/version.rb"
|
41
|
-
|
42
|
-
#-------------
|
43
|
-
# Gem Details.
|
44
|
-
#-------------
|
45
|
-
|
46
|
-
NAME = "qpid_messaging"
|
47
|
-
# VERSION = Qpid::VERSION
|
48
|
-
AUTHOR = "Apache Qpid Project"
|
49
|
-
EMAIL = "dev@qpid.apache.org"
|
50
|
-
HOMEPAGE = "http://qpid.apache.org"
|
51
|
-
SUMMARY = "Qpid is an enterprise messaging framework."
|
52
|
-
|
53
|
-
desc "Default: run all tests."
|
54
|
-
task :default => :test
|
55
|
-
|
56
|
-
desc "Runs all tests."
|
57
|
-
task :test => :"test:all"
|
58
|
-
|
59
|
-
#---------------
|
60
|
-
# Testing tasks.
|
61
|
-
#---------------
|
62
|
-
|
63
|
-
namespace :test do
|
64
|
-
|
65
|
-
desc "Run RSpec tests."
|
66
|
-
RSpec::Core::RakeTask.new do |t|
|
67
|
-
t.ruby_opts = ['-rtest/unit']
|
68
|
-
t.rcov = false
|
69
|
-
t.rcov_opts = [
|
70
|
-
'--exclude', 'lib\/qpid_messaging.rb,spec\/,lib\/ruby',
|
71
|
-
]
|
72
|
-
end
|
73
|
-
|
74
|
-
desc "Run all tests (default)."
|
75
|
-
task :all => [:spec, :features]
|
76
|
-
|
77
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
78
|
-
t.libs = ["lib", "ext/nonblockio"]
|
79
|
-
t.cucumber_opts = "--format progress"
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
83
|
-
|
84
|
-
#---------------------
|
85
|
-
# Documentation tasks.
|
86
|
-
#---------------------
|
87
|
-
|
88
|
-
Rake::RDocTask.new(:rdoc => "rdoc",
|
89
|
-
:clobber_rdoc => "rdoc:clean",
|
90
|
-
:rerdoc => "rdoc:force") do |rd|
|
91
|
-
rd.main = "README.rdoc"
|
92
|
-
rd.options << "--all"
|
93
|
-
rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
|
94
|
-
rd.title = "Qpid Messaging Documentation"
|
95
|
-
end
|
96
|
-
|
97
|
-
#-----------------
|
98
|
-
# Package the gem.
|
99
|
-
#-----------------
|
100
|
-
|
101
|
-
spec = Gem::Specification.new do |s|
|
102
|
-
s.name = NAME
|
103
|
-
s.version = Qpid::VERSION
|
104
|
-
s.platform = Gem::Platform::RUBY
|
105
|
-
s.extra_rdoc_files = ["README.rdoc"]
|
106
|
-
s.summary = SUMMARY
|
107
|
-
s.description = s.summary
|
108
|
-
s.author = AUTHOR
|
109
|
-
s.email = EMAIL
|
110
|
-
s.homepage = HOMEPAGE
|
111
|
-
|
112
|
-
s.extensions = FileList["ext/**/extconf.rb"]
|
113
|
-
|
114
|
-
s.require_path = "lib"
|
115
|
-
# DEPRECATED s.autorequire = NAME
|
116
|
-
s.files = FileList["LICENSE",
|
117
|
-
"README.rdoc",
|
118
|
-
"Rakefile",
|
119
|
-
"TODO",
|
120
|
-
"lib/**/*.rb",
|
121
|
-
"test/**/*.rb",
|
122
|
-
"examples/**/*.rb",
|
123
|
-
"ext/**/*",
|
124
|
-
"features/**/*",
|
125
|
-
"spec/**/*"]
|
126
|
-
end
|
127
|
-
|
128
|
-
Gem::PackageTask.new(spec) do |pkg|
|
129
|
-
pkg.package_dir = "#{OUTPUT_DIR}/pkg"
|
130
|
-
end
|
131
|
-
|
132
|
-
#------------------
|
133
|
-
# Build native code
|
134
|
-
#------------------
|
135
|
-
|
136
|
-
Rake::ExtensionTask.new("cqpid", spec)
|
137
|
-
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Feature: Closing an open connection
|
2
|
-
When working with a broker
|
3
|
-
As a producer or consumer
|
4
|
-
I want to close a connection
|
5
|
-
|
6
|
-
Scenario: The connection is already closed
|
7
|
-
Given a closed connection
|
8
|
-
Then calling close does not raise an exception
|
9
|
-
|
10
|
-
Scenario: The connection is open
|
11
|
-
Given an open connection
|
12
|
-
And the connection is closed
|
13
|
-
Then the connection is in the closed state
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Feature: Closing an open session
|
2
|
-
While working with a session
|
3
|
-
As a producer or consumer
|
4
|
-
I want to close the session
|
5
|
-
|
6
|
-
Scenario: The connection has already been closed
|
7
|
-
Given an open session with a closed connection
|
8
|
-
Then closing the session does not raise an error
|
9
|
-
|
10
|
-
Scenario: Closing an active session
|
11
|
-
Given an open session
|
12
|
-
Then closing the session does not raise an error
|
13
|
-
And the connection is in the open state
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Feature: Connecting to a broker
|
2
|
-
In order to interaction on an AMQP network
|
3
|
-
As a producer or consumer
|
4
|
-
I want to connect to a broker
|
5
|
-
|
6
|
-
Scenario: Connections are closed by default
|
7
|
-
Given a new connection
|
8
|
-
Then the connection is in the closed state
|
9
|
-
|
10
|
-
Scenario: Opening a connection
|
11
|
-
Given a new connection
|
12
|
-
And the connection is opened
|
13
|
-
Then the connection is in the open state
|
@@ -1,29 +0,0 @@
|
|
1
|
-
Feature: Creating a receiver
|
2
|
-
When working with a messaging environment
|
3
|
-
As a consumer
|
4
|
-
I want to create a Receiver for consuming messages
|
5
|
-
|
6
|
-
Scenario: The session is closed
|
7
|
-
Given a closed session
|
8
|
-
Then creating a receiver with "my-queue" raises an exception
|
9
|
-
|
10
|
-
Scenario: The connection is closed
|
11
|
-
Given an open session with a closed connection
|
12
|
-
Then creating a receiver with "my-queue" raises an exception
|
13
|
-
|
14
|
-
Scenario: The address is malformed
|
15
|
-
Given an open session
|
16
|
-
Then creating a receiver with "my-queue;{foo:bar}" raises an exception
|
17
|
-
|
18
|
-
Scenario: The address string is valid but the queue does not exist
|
19
|
-
Given an open session
|
20
|
-
Then creating a receiver for a nonexistent queue raises an exception
|
21
|
-
|
22
|
-
Scenario: The address string is fine
|
23
|
-
Given an open session
|
24
|
-
Then creating a receiver with "my-queue;{create:always,delete:always}" succeeds
|
25
|
-
|
26
|
-
Scenario: Using an Address object
|
27
|
-
Given an open session
|
28
|
-
And an Address with the string "create-receiver-test;{create:always}"
|
29
|
-
Then creating a receiver with an Address succeeds
|
@@ -1,25 +0,0 @@
|
|
1
|
-
Feature: Creating a sender
|
2
|
-
When working with a session
|
3
|
-
As a producer
|
4
|
-
I want to create a Sender for sending messages
|
5
|
-
|
6
|
-
Scenario: The session is closed
|
7
|
-
Given a closed session
|
8
|
-
Then creating a sender with "my-queue;{create:always,delete:always}" raises an exception
|
9
|
-
|
10
|
-
Scenario: The connection is closed
|
11
|
-
Given an open session with a closed connection
|
12
|
-
Then creating a sender with "my-queue;{create:always,delete:always}" raises an exception
|
13
|
-
|
14
|
-
Scenario: The address is malformed
|
15
|
-
Given an open session
|
16
|
-
Then creating a sender with "my-queue;{foo:bar}" raises an exception
|
17
|
-
|
18
|
-
Scenario: The address string is valid
|
19
|
-
Given an open session
|
20
|
-
Then creating a sender with "my-queue;{create:always,delete:always}" succeeds
|
21
|
-
|
22
|
-
Scenario: Using an Address object
|
23
|
-
Given an open session
|
24
|
-
And an Address with the string "my-queue/my-subject;{create:always}"
|
25
|
-
Then creating a sender with an Address succeeds
|
@@ -1,12 +0,0 @@
|
|
1
|
-
Feature: Creating a session
|
2
|
-
When working with a broker
|
3
|
-
As a producer or consumer
|
4
|
-
I want to create a session
|
5
|
-
|
6
|
-
Scenario: The connection is closed
|
7
|
-
Given a closed connection
|
8
|
-
Then creating a session raises an exception
|
9
|
-
|
10
|
-
Scenario: The connection is open
|
11
|
-
Given an open connection
|
12
|
-
Then creating a session works
|
@@ -1,8 +0,0 @@
|
|
1
|
-
Feature: Getting the authenticated username from an open connection.
|
2
|
-
When connected to a broker
|
3
|
-
As a producer or consumer
|
4
|
-
I can retrieve the username used to authenticate
|
5
|
-
|
6
|
-
Scenario: When connected anonymously
|
7
|
-
Given an open connection
|
8
|
-
Then the authenticated username should be "anonymous"
|
@@ -1,30 +0,0 @@
|
|
1
|
-
Feature: Receving a message
|
2
|
-
When working with a broker
|
3
|
-
As a message consumer
|
4
|
-
I need to be able to receive messages
|
5
|
-
|
6
|
-
Scenario: Receiving after the session is closed
|
7
|
-
Given a sender and receiver for "my-queue;{create:always,delete:always}"
|
8
|
-
And the message "this is a test" is sent
|
9
|
-
And the session is closed
|
10
|
-
Then getting the next message raises an error
|
11
|
-
|
12
|
-
Scenario: Receiving after the connection is closed
|
13
|
-
Given a sender and receiver for "my-queue;{create:always,delete:always}"
|
14
|
-
And the message "this is a test" is sent
|
15
|
-
And the connection is closed
|
16
|
-
Then getting the next message raises an error
|
17
|
-
|
18
|
-
Scenario: No message is received on an empty queue
|
19
|
-
Given an existing receiver for "my-queue;{create:always,delete:always}"
|
20
|
-
And the receiver has no pending messages
|
21
|
-
Then getting the next message raises an error
|
22
|
-
|
23
|
-
Scenario: A message is pending
|
24
|
-
Given an open session
|
25
|
-
And given a sender for "my-queue;{create:always}"
|
26
|
-
And given a receiver for "my-queue;{create:always,delete:always}"
|
27
|
-
And the receiver has a capacity of 1
|
28
|
-
And the message "this is a test" is sent
|
29
|
-
Then the receiver should have 1 message available
|
30
|
-
And the receiver should receive a message with "this is a test"
|
@@ -1,21 +0,0 @@
|
|
1
|
-
Feature: Sending a message
|
2
|
-
When working with a broker
|
3
|
-
As a producer
|
4
|
-
I want to send messages using an existing Sender
|
5
|
-
|
6
|
-
Scenario: The session is closed
|
7
|
-
Given an open session
|
8
|
-
And creating a sender with "my-queue;{create:always,delete:always}" succeeds
|
9
|
-
And the session is closed
|
10
|
-
Then sending the message "This is a test" should raise an error
|
11
|
-
|
12
|
-
Scenario: The connection is closed
|
13
|
-
Given an open session
|
14
|
-
And creating a sender with "my-queue;{create:always,delete:always}" succeeds
|
15
|
-
And the connection is closed
|
16
|
-
Then sending the message "This is a test" should raise an error
|
17
|
-
|
18
|
-
Scenario: The message sends successfully
|
19
|
-
Given an open session
|
20
|
-
And creating a sender with "my-queue;{create:always,delete:always}" succeeds
|
21
|
-
Then sending the message "This is a test" succeeds
|
@@ -1,12 +0,0 @@
|
|
1
|
-
Feature: A session returns its connection
|
2
|
-
With an action session
|
3
|
-
As a producer or consumer
|
4
|
-
I can retrieve the underlying connection for the session
|
5
|
-
|
6
|
-
Scenario: The connection is closed
|
7
|
-
Given an open session with a closed connection
|
8
|
-
Then the connection for the session is in the closed state
|
9
|
-
|
10
|
-
Scenario: The connection is open
|
11
|
-
Given an open session
|
12
|
-
Then the connection for the session is in the open state
|
@@ -1,8 +0,0 @@
|
|
1
|
-
Feature: Session have a name
|
2
|
-
When using a session
|
3
|
-
As a producer or consumer
|
4
|
-
I can name a session and then later retrieve it by name
|
5
|
-
|
6
|
-
Scenario: Naming a session
|
7
|
-
Given an existing session named "test-session"
|
8
|
-
Then the session can be retrieved by the name "test-session"
|
@@ -1,22 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
3
|
-
# or more contributor license agreements. See the NOTICE file
|
4
|
-
# distributed with this work for additional information
|
5
|
-
# regarding copyright ownership. The ASF licenses this file
|
6
|
-
# to you under the Apache License, Version 2.0 (the
|
7
|
-
# "License"); you may not use this file except in compliance
|
8
|
-
# with the License. You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing,
|
13
|
-
# software distributed under the License is distributed on an
|
14
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
-
# KIND, either express or implied. See the License for the
|
16
|
-
# specific language governing permissions and limitations
|
17
|
-
# under the License.
|
18
|
-
#
|
19
|
-
|
20
|
-
Given /^an Address with the string "(.*?)"$/ do |address|
|
21
|
-
@address = Qpid::Messaging::Address.new "#{address}"
|
22
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
3
|
-
# or more contributor license agreements. See the NOTICE file
|
4
|
-
# distributed with this work for additional information
|
5
|
-
# regarding copyright ownership. The ASF licenses this file
|
6
|
-
# to you under the Apache License, Version 2.0 (the
|
7
|
-
# "License"); you may not use this file except in compliance
|
8
|
-
# with the License. You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing,
|
13
|
-
# software distributed under the License is distributed on an
|
14
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
-
# KIND, either express or implied. See the License for the
|
16
|
-
# specific language governing permissions and limitations
|
17
|
-
# under the License.
|
18
|
-
#
|
19
|
-
|
20
|
-
# close all connections
|
21
|
-
After do
|
22
|
-
@connection.close if @connection
|
23
|
-
end
|
24
|
-
|
25
|
-
Given /^a new connection$/ do
|
26
|
-
@connection = Qpid::Messaging::Connection.new unless @connection
|
27
|
-
end
|
28
|
-
|
29
|
-
Given /^an open connection$/ do
|
30
|
-
steps %Q{
|
31
|
-
Given a new connection
|
32
|
-
}
|
33
|
-
@connection.open
|
34
|
-
end
|
35
|
-
|
36
|
-
Given /^a closed connection$/ do
|
37
|
-
steps %Q{
|
38
|
-
Given a new connection
|
39
|
-
}
|
40
|
-
@connection.close if @connection.open?
|
41
|
-
end
|
42
|
-
|
43
|
-
Then /^the connection is in the (open|closed) state$/ do |state|
|
44
|
-
@connection.open?.should == false if state == "closed"
|
45
|
-
@connection.open?.should == true if state == "open"
|
46
|
-
end
|
47
|
-
|
48
|
-
Given /^the connection is opened$/ do
|
49
|
-
@connection.open
|
50
|
-
end
|
51
|
-
|
52
|
-
Given /^the connection is closed$/ do
|
53
|
-
@connection.close
|
54
|
-
end
|
55
|
-
|
56
|
-
Then /^creating a session raises an exception$/ do
|
57
|
-
lambda {
|
58
|
-
@session = @connection.create_session
|
59
|
-
}.should raise_error
|
60
|
-
end
|
61
|
-
|
62
|
-
Then /^creating a session works$/ do
|
63
|
-
steps %Q{
|
64
|
-
Given a session exists with the name "nameless"
|
65
|
-
}
|
66
|
-
@session.should_not be_nil
|
67
|
-
end
|
68
|
-
|
69
|
-
Given /^an existing session named "([^"]*)"$/ do |name|
|
70
|
-
steps %Q{
|
71
|
-
Given an open connection
|
72
|
-
And a session exists with the name "#{name}"
|
73
|
-
}
|
74
|
-
end
|
75
|
-
|
76
|
-
Given /^a session exists with the name "([^"]*)"$/ do |name|
|
77
|
-
@session = @connection.create_session :name => "#{name}"
|
78
|
-
end
|
79
|
-
|
80
|
-
Then /^the session can be retrieved by the name "([^"]*)"$/ do |name|
|
81
|
-
session = @connection.session "#{name}"
|
82
|
-
session.should_not be_nil
|
83
|
-
end
|
84
|
-
|
85
|
-
Then /^calling close does not raise an exception$/ do
|
86
|
-
lambda {
|
87
|
-
@connection.close
|
88
|
-
}.should_not raise_error
|
89
|
-
end
|
90
|
-
|
91
|
-
Then /^the authenticated username should be "([^"]*)"$/ do |username|
|
92
|
-
@connection.authenticated_username.should == "#{username}"
|
93
|
-
end
|