qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject svn commit: r1238807 - in /qpid/trunk/qpid/cpp/bindings/qpid/ruby: ./ features/ features/step_definitions/ features/support/
Date Tue, 31 Jan 2012 20:50:15 GMT
Author: tross
Date: Tue Jan 31 20:50:15 2012
New Revision: 1238807

URL: http://svn.apache.org/viewvc?rev=1238807&view=rev
Log:
QPID-3791 - Cucumber-based integration tests for the Ruby binding.
Committed patch from Darryl Pierce.

Added:
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/closing_a_connection.feature
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/closing_a_session.feature
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/connecting_to_a_broker.feature
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/creating_a_receiver.feature
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/creating_a_sender.feature
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/creating_a_session.feature
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/getting_the_connections_authenticated_username.feature
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/receiving_a_message.feature
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/sending_a_message.feature
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/session_returns_its_connection.feature
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/sessions_have_names.feature
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/address_steps.rb
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/connection_steps.rb
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/receiver_steps.rb
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/sender_steps.rb
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/session_steps.rb
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/support/
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/support/env.rb
Modified:
    qpid/trunk/qpid/cpp/bindings/qpid/ruby/Rakefile

Modified: qpid/trunk/qpid/cpp/bindings/qpid/ruby/Rakefile
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/Rakefile?rev=1238807&r1=1238806&r2=1238807&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/Rakefile (original)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/Rakefile Tue Jan 31 20:50:15 2012
@@ -32,6 +32,7 @@ require "rake/extensiontask"
 require "rake/rdoctask"
 require "rake/testtask"
 
+require "cucumber/rake/task"
 require "spec/rake/spectask"
 
 CLOBBER.include("pkg")
@@ -50,15 +51,15 @@ HOMEPAGE = "http://qpid.apache.org"
 SUMMARY  = "Qpid is an enterprise messaging framework."
 
 desc "Default: run all tests."
-task :default => :"test:all"
+task :default => :test
+
+desc "Runs all tests."
+task :test => :"test:all"
 
 #---------------
 # Testing tasks.
 #---------------
 
-desc "Run all tests (alias for test:all)."
-task :test => :"test:all"
-
 namespace :test do
 
   desc "Run RSpec tests."
@@ -72,20 +73,11 @@ namespace :test do
   end
 
   desc "Run all tests (default)."
-  task :all => [:spec, :integrations]
-
-  desc "Run unit tests."
-  Rake::TestTask.new(:units) do |t|
-    t.libs << "."
-    t.pattern = "test/test*.rb"
-    t.verbose = true
-  end
+  task :all => [:spec, :features]
 
-  desc "Run integration tests."
-  Rake::TestTask.new(:integrations) do |t|
-    t.libs << "."
-    t.pattern = "test/integration/*.rb"
-    t.verbose = true
+  Cucumber::Rake::Task.new(:features) do |t|
+    t.libs          = ["lib", "ext/nonblockio"]
+    t.cucumber_opts = "--format progress"
   end
 
 end

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/closing_a_connection.feature
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/closing_a_connection.feature?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/closing_a_connection.feature (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/closing_a_connection.feature Tue Jan 31
20:50:15 2012
@@ -0,0 +1,13 @@
+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
\ No newline at end of file

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/closing_a_session.feature
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/closing_a_session.feature?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/closing_a_session.feature (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/closing_a_session.feature Tue Jan 31 20:50:15
2012
@@ -0,0 +1,13 @@
+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

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/connecting_to_a_broker.feature
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/connecting_to_a_broker.feature?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/connecting_to_a_broker.feature (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/connecting_to_a_broker.feature Tue Jan
31 20:50:15 2012
@@ -0,0 +1,13 @@
+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

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/creating_a_receiver.feature
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/creating_a_receiver.feature?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/creating_a_receiver.feature (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/creating_a_receiver.feature Tue Jan 31
20:50:15 2012
@@ -0,0 +1,29 @@
+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}" succeeds
+
+  Scenario: Using an Address object
+    Given an open session
+    And an Address with the name "create-receiver-test" and subject "foo" and option "create"
set to "always"
+    Then creating a receiver with an Address succeeds

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/creating_a_sender.feature
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/creating_a_sender.feature?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/creating_a_sender.feature (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/creating_a_sender.feature Tue Jan 31 20:50:15
2012
@@ -0,0 +1,25 @@
+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}" 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}" 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}" succeeds
+
+  Scenario: Using an Address object
+    Given an open session
+    And an Address with the name "my-queue" and subject "my-subject" and option "create"
set to "always"
+    Then creating a sender with an Address succeeds

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/creating_a_session.feature
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/creating_a_session.feature?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/creating_a_session.feature (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/creating_a_session.feature Tue Jan 31
20:50:15 2012
@@ -0,0 +1,12 @@
+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

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/getting_the_connections_authenticated_username.feature
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/getting_the_connections_authenticated_username.feature?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/getting_the_connections_authenticated_username.feature
(added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/getting_the_connections_authenticated_username.feature
Tue Jan 31 20:50:15 2012
@@ -0,0 +1,8 @@
+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"

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/receiving_a_message.feature
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/receiving_a_message.feature?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/receiving_a_message.feature (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/receiving_a_message.feature Tue Jan 31
20:50:15 2012
@@ -0,0 +1,28 @@
+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}"
+    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}"
+    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}"
+    And the receiver has no pending messages
+    Then getting the next message raises an error
+
+  Scenario: A message is pending
+    Given a sender and receiver for "my-queue;{create: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"

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/sending_a_message.feature
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/sending_a_message.feature?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/sending_a_message.feature (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/sending_a_message.feature Tue Jan 31 20:50:15
2012
@@ -0,0 +1,21 @@
+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}" 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}" 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}" succeeds
+    Then sending the message "This is a test" succeeds
\ No newline at end of file

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/session_returns_its_connection.feature
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/session_returns_its_connection.feature?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/session_returns_its_connection.feature
(added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/session_returns_its_connection.feature
Tue Jan 31 20:50:15 2012
@@ -0,0 +1,12 @@
+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

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/sessions_have_names.feature
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/sessions_have_names.feature?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/sessions_have_names.feature (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/sessions_have_names.feature Tue Jan 31
20:50:15 2012
@@ -0,0 +1,8 @@
+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"

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/address_steps.rb
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/address_steps.rb?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/address_steps.rb (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/address_steps.rb Tue
Jan 31 20:50:15 2012
@@ -0,0 +1,5 @@
+Given /^an Address with the name "([^"]*)" and subject "([^"]*)" and option "([^"]*)" set
to "([^"]*)"$/ do |name, subject, key, value|
+  options = Hash.new
+  options["#{key}"] = "#{value}"
+  @address = Qpid::Messaging::Address.new "#{name}", "#{subject}", options
+end

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/connection_steps.rb
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/connection_steps.rb?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/connection_steps.rb (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/connection_steps.rb Tue
Jan 31 20:50:15 2012
@@ -0,0 +1,74 @@
+# 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

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/receiver_steps.rb
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/receiver_steps.rb?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/receiver_steps.rb (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/receiver_steps.rb Tue
Jan 31 20:50:15 2012
@@ -0,0 +1,42 @@
+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

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/sender_steps.rb
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/sender_steps.rb?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/sender_steps.rb (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/sender_steps.rb Tue Jan
31 20:50:15 2012
@@ -0,0 +1,15 @@
+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

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/session_steps.rb
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/session_steps.rb?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/session_steps.rb (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/step_definitions/session_steps.rb Tue
Jan 31 20:50:15 2012
@@ -0,0 +1,80 @@
+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

Added: qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/support/env.rb
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/support/env.rb?rev=1238807&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/support/env.rb (added)
+++ qpid/trunk/qpid/cpp/bindings/qpid/ruby/features/support/env.rb Tue Jan 31 20:50:15 2012
@@ -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'



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message