summaryrefslogtreecommitdiff
path: root/qpid/cpp/bindings/qpid/ruby/features
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/cpp/bindings/qpid/ruby/features')
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/closing_a_connection.feature31
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/closing_a_session.feature30
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/connecting_to_a_broker.feature30
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/creating_a_receiver.feature47
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/creating_a_sender.feature42
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/creating_a_session.feature29
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/getting_the_connections_authenticated_username.feature25
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/receiving_a_message.feature47
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/sending_a_message.feature38
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/session_returns_its_connection.feature29
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/sessions_have_names.feature25
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/step_definitions/address_steps.rb22
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/step_definitions/connection_steps.rb93
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/step_definitions/receiver_steps.rb69
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/step_definitions/sender_steps.rb34
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/step_definitions/session_steps.rb99
-rw-r--r--qpid/cpp/bindings/qpid/ruby/features/support/env.rb22
17 files changed, 712 insertions, 0 deletions
diff --git a/qpid/cpp/bindings/qpid/ruby/features/closing_a_connection.feature b/qpid/cpp/bindings/qpid/ruby/features/closing_a_connection.feature
new file mode 100644
index 0000000000..b5cb92b5ea
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/closing_a_connection.feature
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+Feature: Closing an open connection
+ When working with a broker
+ As a producer or consumer
+ I want to close a connection
+
+ Scenario: The connection is already closed
+ Given a closed connection
+ Then calling close does not raise an exception
+
+ Scenario: The connection is open
+ Given an open connection
+ And the connection is closed
+ Then the connection is in the closed state
diff --git a/qpid/cpp/bindings/qpid/ruby/features/closing_a_session.feature b/qpid/cpp/bindings/qpid/ruby/features/closing_a_session.feature
new file mode 100644
index 0000000000..37b3f51df1
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/closing_a_session.feature
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+Feature: Closing an open session
+ While working with a session
+ As a producer or consumer
+ I want to close the session
+
+ Scenario: The connection has already been closed
+ Given an open session with a closed connection
+ Then closing the session does not raise an error
+
+ Scenario: Closing an active session
+ Given an open session
+ Then closing the session does not raise an error
+ And the connection is in the open state
diff --git a/qpid/cpp/bindings/qpid/ruby/features/connecting_to_a_broker.feature b/qpid/cpp/bindings/qpid/ruby/features/connecting_to_a_broker.feature
new file mode 100644
index 0000000000..3c7917b8b5
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/connecting_to_a_broker.feature
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+Feature: Connecting to a broker
+ In order to interaction on an AMQP network
+ As a producer or consumer
+ I want to connect to a broker
+
+ Scenario: Connections are closed by default
+ Given a new connection
+ Then the connection is in the closed state
+
+ Scenario: Opening a connection
+ Given a new connection
+ And the connection is opened
+ Then the connection is in the open state
diff --git a/qpid/cpp/bindings/qpid/ruby/features/creating_a_receiver.feature b/qpid/cpp/bindings/qpid/ruby/features/creating_a_receiver.feature
new file mode 100644
index 0000000000..2dd5fe33f2
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/creating_a_receiver.feature
@@ -0,0 +1,47 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+Feature: Creating a receiver
+ When working with a messaging environment
+ As a consumer
+ I want to create a Receiver for consuming messages
+
+ Scenario: The session is closed
+ Given a closed session
+ Then creating a receiver with "my-queue" raises an exception
+
+ Scenario: The connection is closed
+ Given an open session with a closed connection
+ Then creating a receiver with "my-queue" raises an exception
+
+ Scenario: The address is malformed
+ Given an open session
+ Then creating a receiver with "my-queue;{foo:bar}" raises an exception
+
+ Scenario: The address string is valid but the queue does not exist
+ Given an open session
+ Then creating a receiver for a nonexistent queue raises an exception
+
+ Scenario: The address string is fine
+ Given an open session
+ Then creating a receiver with "my-queue;{create:always,delete:always}" succeeds
+
+ Scenario: Using an Address object
+ Given an open session
+ And an Address with the string "create-receiver-test;{create:always}"
+ Then creating a receiver with an Address succeeds
diff --git a/qpid/cpp/bindings/qpid/ruby/features/creating_a_sender.feature b/qpid/cpp/bindings/qpid/ruby/features/creating_a_sender.feature
new file mode 100644
index 0000000000..d603f1749a
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/creating_a_sender.feature
@@ -0,0 +1,42 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+Feature: Creating a sender
+ When working with a session
+ As a producer
+ I want to create a Sender for sending messages
+
+ Scenario: The session is closed
+ Given a closed session
+ Then creating a sender with "my-queue;{create:always,delete:always}" raises an exception
+
+ Scenario: The connection is closed
+ Given an open session with a closed connection
+ Then creating a sender with "my-queue;{create:always,delete:always}" raises an exception
+
+ Scenario: The address is malformed
+ Given an open session
+ Then creating a sender with "my-queue;{foo:bar}" raises an exception
+
+ Scenario: The address string is valid
+ Given an open session
+ Then creating a sender with "my-queue;{create:always,delete:always}" succeeds
+
+ Scenario: Using an Address object
+ Given an open session
+ And an Address with the string "my-queue/my-subject;{create:always}"
+ Then creating a sender with an Address succeeds
diff --git a/qpid/cpp/bindings/qpid/ruby/features/creating_a_session.feature b/qpid/cpp/bindings/qpid/ruby/features/creating_a_session.feature
new file mode 100644
index 0000000000..257d85ee7a
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/creating_a_session.feature
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+Feature: Creating a session
+ When working with a broker
+ As a producer or consumer
+ I want to create a session
+
+ Scenario: The connection is closed
+ Given a closed connection
+ Then creating a session raises an exception
+
+ Scenario: The connection is open
+ Given an open connection
+ Then creating a session works
diff --git a/qpid/cpp/bindings/qpid/ruby/features/getting_the_connections_authenticated_username.feature b/qpid/cpp/bindings/qpid/ruby/features/getting_the_connections_authenticated_username.feature
new file mode 100644
index 0000000000..783faafa67
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/getting_the_connections_authenticated_username.feature
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+Feature: Getting the authenticated username from an open connection.
+ When connected to a broker
+ As a producer or consumer
+ I can retrieve the username used to authenticate
+
+ Scenario: When connected anonymously
+ Given an open connection
+ Then the authenticated username should be "anonymous"
diff --git a/qpid/cpp/bindings/qpid/ruby/features/receiving_a_message.feature b/qpid/cpp/bindings/qpid/ruby/features/receiving_a_message.feature
new file mode 100644
index 0000000000..6386afb79d
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/receiving_a_message.feature
@@ -0,0 +1,47 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+Feature: Receving a message
+ When working with a broker
+ As a message consumer
+ I need to be able to receive messages
+
+ Scenario: Receiving after the session is closed
+ Given a sender and receiver for "my-queue;{create:always,delete:always}"
+ And the message "this is a test" is sent
+ And the session is closed
+ Then getting the next message raises an error
+
+ Scenario: Receiving after the connection is closed
+ Given a sender and receiver for "my-queue;{create:always,delete:always}"
+ And the message "this is a test" is sent
+ And the connection is closed
+ Then getting the next message raises an error
+
+ Scenario: No message is received on an empty queue
+ Given an existing receiver for "my-queue;{create:always,delete:always}"
+ And the receiver has no pending messages
+ Then getting the next message raises an error
+
+ Scenario: A message is pending
+ Given an open session
+ And given a sender for "my-queue;{create:always}"
+ And given a receiver for "my-queue;{create:always,delete:always}"
+ And the receiver has a capacity of 1
+ And the message "this is a test" is sent
+ Then the receiver should have 1 message available
+ And the receiver should receive a message with "this is a test"
diff --git a/qpid/cpp/bindings/qpid/ruby/features/sending_a_message.feature b/qpid/cpp/bindings/qpid/ruby/features/sending_a_message.feature
new file mode 100644
index 0000000000..d6e6a9464e
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/sending_a_message.feature
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+Feature: Sending a message
+ When working with a broker
+ As a producer
+ I want to send messages using an existing Sender
+
+ Scenario: The session is closed
+ Given an open session
+ And creating a sender with "my-queue;{create:always,delete:always}" succeeds
+ And the session is closed
+ Then sending the message "This is a test" should raise an error
+
+ Scenario: The connection is closed
+ Given an open session
+ And creating a sender with "my-queue;{create:always,delete:always}" succeeds
+ And the connection is closed
+ Then sending the message "This is a test" should raise an error
+
+ Scenario: The message sends successfully
+ Given an open session
+ And creating a sender with "my-queue;{create:always,delete:always}" succeeds
+ Then sending the message "This is a test" succeeds
diff --git a/qpid/cpp/bindings/qpid/ruby/features/session_returns_its_connection.feature b/qpid/cpp/bindings/qpid/ruby/features/session_returns_its_connection.feature
new file mode 100644
index 0000000000..58cb0aa0b9
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/session_returns_its_connection.feature
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+Feature: A session returns its connection
+ With an action session
+ As a producer or consumer
+ I can retrieve the underlying connection for the session
+
+ Scenario: The connection is closed
+ Given an open session with a closed connection
+ Then the connection for the session is in the closed state
+
+ Scenario: The connection is open
+ Given an open session
+ Then the connection for the session is in the open state
diff --git a/qpid/cpp/bindings/qpid/ruby/features/sessions_have_names.feature b/qpid/cpp/bindings/qpid/ruby/features/sessions_have_names.feature
new file mode 100644
index 0000000000..58a5771c9f
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/sessions_have_names.feature
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+Feature: Session have a name
+ When using a session
+ As a producer or consumer
+ I can name a session and then later retrieve it by name
+
+ Scenario: Naming a session
+ Given an existing session named "test-session"
+ Then the session can be retrieved by the name "test-session"
diff --git a/qpid/cpp/bindings/qpid/ruby/features/step_definitions/address_steps.rb b/qpid/cpp/bindings/qpid/ruby/features/step_definitions/address_steps.rb
new file mode 100644
index 0000000000..a7eca6f9ce
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/step_definitions/address_steps.rb
@@ -0,0 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+Given /^an Address with the string "(.*?)"$/ do |address|
+ @address = Qpid::Messaging::Address.new "#{address}"
+end
diff --git a/qpid/cpp/bindings/qpid/ruby/features/step_definitions/connection_steps.rb b/qpid/cpp/bindings/qpid/ruby/features/step_definitions/connection_steps.rb
new file mode 100644
index 0000000000..3fe3e6941f
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/step_definitions/connection_steps.rb
@@ -0,0 +1,93 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# close all connections
+After do
+ @connection.close if @connection
+end
+
+Given /^a new connection$/ do
+ @connection = Qpid::Messaging::Connection.new unless @connection
+end
+
+Given /^an open connection$/ do
+ steps %Q{
+ Given a new connection
+ }
+ @connection.open
+end
+
+Given /^a closed connection$/ do
+ steps %Q{
+ Given a new connection
+ }
+ @connection.close if @connection.open?
+end
+
+Then /^the connection is in the (open|closed) state$/ do |state|
+ @connection.open?.should == false if state == "closed"
+ @connection.open?.should == true if state == "open"
+end
+
+Given /^the connection is opened$/ do
+ @connection.open
+end
+
+Given /^the connection is closed$/ do
+ @connection.close
+end
+
+Then /^creating a session raises an exception$/ do
+ lambda {
+ @session = @connection.create_session
+ }.should raise_error
+end
+
+Then /^creating a session works$/ do
+ steps %Q{
+ Given a session exists with the name "nameless"
+ }
+ @session.should_not be_nil
+end
+
+Given /^an existing session named "([^"]*)"$/ do |name|
+ steps %Q{
+ Given an open connection
+ And a session exists with the name "#{name}"
+ }
+end
+
+Given /^a session exists with the name "([^"]*)"$/ do |name|
+ @session = @connection.create_session :name => "#{name}"
+end
+
+Then /^the session can be retrieved by the name "([^"]*)"$/ do |name|
+ session = @connection.session "#{name}"
+ session.should_not be_nil
+end
+
+Then /^calling close does not raise an exception$/ do
+ lambda {
+ @connection.close
+ }.should_not raise_error
+end
+
+Then /^the authenticated username should be "([^"]*)"$/ do |username|
+ @connection.authenticated_username.should == "#{username}"
+end
diff --git a/qpid/cpp/bindings/qpid/ruby/features/step_definitions/receiver_steps.rb b/qpid/cpp/bindings/qpid/ruby/features/step_definitions/receiver_steps.rb
new file mode 100644
index 0000000000..e454dac345
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/step_definitions/receiver_steps.rb
@@ -0,0 +1,69 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+Given /^an existing receiver for "([^"]*)"$/ do |address|
+ steps %Q{
+ Given an open session
+ Then creating a receiver with "#{address}" succeeds
+ }
+end
+
+Given /^the receiver has no pending messages$/ do
+ available = @receiver.available
+ available.should == 0
+end
+
+Then /^getting the next message raises an error$/ do
+ lambda {
+ @message = @receiver.get Qpid::Messaging::Duration::IMMEDIATE
+ }.should raise_error
+end
+
+Given /^a sender and receiver for "([^"]*)"$/ do |address|
+ steps %Q{
+ Given an open session
+ Then creating a sender with "#{address}" succeeds
+ Then creating a receiver with "#{address}" succeeds
+ }
+end
+
+Then /^the receiver should receive a message with "([^"]*)"$/ do |content|
+ @message = @receiver.fetch Qpid::Messaging::Duration::IMMEDIATE
+
+ @message.should_not be_nil
+ @message.content.should == "#{content}"
+end
+
+Given /^the receiver has a capacity of (\d+)$/ do |capacity|
+ @receiver.capacity = capacity.to_i
+end
+
+Then /^the receiver should have (\d+) message available$/ do |available|
+ # TODO we shouldn't need to sleep a second in order to have this update
+ sleep 1
+ @receiver.available.should == available.to_i
+end
+
+Given /^given a sender for "([^"]*)"$/ do |address|
+ @sender = @session.create_sender "#{address}"
+end
+
+Given /^given a receiver for "([^"]*)"$/ do |address|
+ @receiver = @session.create_receiver "#{address}"
+end
diff --git a/qpid/cpp/bindings/qpid/ruby/features/step_definitions/sender_steps.rb b/qpid/cpp/bindings/qpid/ruby/features/step_definitions/sender_steps.rb
new file mode 100644
index 0000000000..93dbd2d5c0
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/step_definitions/sender_steps.rb
@@ -0,0 +1,34 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+Given /^the message "([^"]*)" is sent$/ do |content|
+ @sender.send Qpid::Messaging::Message.new :content => "#{content}"
+end
+
+Then /^sending the message "([^"]*)" should raise an error$/ do |content|
+ lambda {
+ steps %Q{
+ Then sending the message "#{content}" succeeds
+ }
+ }.should raise_error
+end
+
+Then /^sending the message "([^"]*)" succeeds$/ do |content|
+ @sender.send Qpid::Messaging::Message.new :content => "#{content}"
+end
diff --git a/qpid/cpp/bindings/qpid/ruby/features/step_definitions/session_steps.rb b/qpid/cpp/bindings/qpid/ruby/features/step_definitions/session_steps.rb
new file mode 100644
index 0000000000..cf775d917d
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/step_definitions/session_steps.rb
@@ -0,0 +1,99 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+Given /^a closed session/ do
+ steps %Q{
+ Given an open connection
+ Then creating a session works
+ }
+ @connection.close
+end
+
+Then /^creating a sender with "([^"]*)" raises an exception$/ do |address|
+ lambda {
+ steps %Q{
+ @sender = @session.create_sender "#{address}"
+ }
+ }.should raise_error
+end
+
+Then /^creating a receiver with "([^"]*)" raises an exception$/ do |address|
+ lambda {
+ steps %Q{
+ @sender = @session.create_sender "#{address}"
+ }
+ }.should raise_error
+end
+
+Given /^an open session with a closed connection$/ do
+ steps %Q{
+ Given an open connection
+ Then creating a session works
+ }
+ @session.connection.close
+end
+
+Given /^an open session$/ do
+ steps %Q{
+ Given an open connection
+ Then creating a session works
+ }
+end
+
+Given /^the session is closed$/ do
+ @session.close
+end
+
+Then /^creating a sender with "([^"]*)" succeeds$/ do |address|
+ @sender = @session.create_sender "#{address}"
+ @sender.should_not be_nil
+end
+
+Then /^creating a sender with an Address succeeds$/ do
+ @sender = @session.create_receiver @address
+ @sender.should_not be_nil
+end
+
+Then /^creating a receiver for a nonexistent queue raises an exception$/ do
+ lambda {
+ steps %Q{
+ Then creating a receiver with "queue-#{Time.new.to_i}" succeeds
+ }
+ }.should raise_error
+end
+
+Then /^creating a receiver with "([^"]*)" succeeds$/ do |address|
+ @receiver = @session.create_receiver "#{address}"
+ @receiver.should_not be_nil
+end
+
+Then /^creating a receiver with an Address succeeds$/ do
+ @receiver = @session.create_receiver @address
+ @receiver.should_not be_nil
+end
+
+Then /^closing the session does not raise an error$/ do
+ lambda {
+ @session.close
+ }.should_not raise_error
+end
+
+Then /^the connection for the session is in the (open|closed) state$/ do |state|
+ @session.connection.open?.should == false if state == "closed"
+end
diff --git a/qpid/cpp/bindings/qpid/ruby/features/support/env.rb b/qpid/cpp/bindings/qpid/ruby/features/support/env.rb
new file mode 100644
index 0000000000..cc0097ca8b
--- /dev/null
+++ b/qpid/cpp/bindings/qpid/ruby/features/support/env.rb
@@ -0,0 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+$LOAD_PATH.unshift(File.dirname(__FILE__) + "/../../lib")
+
+require 'qpid_messaging'