You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by mc...@apache.org on 2013/07/16 15:00:02 UTC

svn commit: r1503701 - in /qpid/proton/trunk/proton-c/bindings/ruby: ChangeLog lib/qpid_proton/data.rb lib/qpid_proton/messenger.rb spec/qpid/proton/data_spec.rb spec/qpid/proton/messenger_spec.rb

Author: mcpierce
Date: Tue Jul 16 13:00:02 2013
New Revision: 1503701

URL: http://svn.apache.org/r1503701
Log:
QPID-355: Fixed the broken Rspec tests.

Removed a few tracker spec tests since the expectation has changed. Also
removed the negative receive limit since that's no longer an exceptional
case.

Modified:
    qpid/proton/trunk/proton-c/bindings/ruby/ChangeLog
    qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/data.rb
    qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb
    qpid/proton/trunk/proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb
    qpid/proton/trunk/proton-c/bindings/ruby/spec/qpid/proton/messenger_spec.rb

Modified: qpid/proton/trunk/proton-c/bindings/ruby/ChangeLog
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/ruby/ChangeLog?rev=1503701&r1=1503700&r2=1503701&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/ruby/ChangeLog (original)
+++ qpid/proton/trunk/proton-c/bindings/ruby/ChangeLog Tue Jul 16 13:00:02 2013
@@ -1,6 +1,10 @@
 version 0.5:
 	* Duck typed the Array class to work with Qpid::Proton::Data.
 	* Duck typed the Hash class to work with Qpid::Proton::Data.
+	* Fixed broken Rspec tests due to changes in under Proton C.
+	  - Messenger.receive can accept a negative maximum
+	  - When testing bad subscribe attempts, tests now use a random string.
+	* Fixed encoding decimal128 values.
 
 version 0.4:
 	* No language-specific features developed in this release.

Modified: qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/data.rb
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/data.rb?rev=1503701&r1=1503700&r2=1503701&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/data.rb (original)
+++ qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/data.rb Tue Jul 16 13:00:02 2013
@@ -640,7 +640,7 @@ module Qpid
       # * value - the decimal128 value
       def decimal128=(value)
         raise TypeError, "invalid decimal128 value: #{value}" if value.nil?
-        value = value.to_s.rjust(32, "0")
+        value = value.to_s(16).rjust(32, "0")
         bytes = []
         value.scan(/(..)/) {|v| bytes << v[0].to_i(16)}
         check(Cproton.pn_data_put_decimal128(@data, bytes))

Modified: qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb?rev=1503701&r1=1503700&r2=1503701&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb (original)
+++ qpid/proton/trunk/proton-c/bindings/ruby/lib/qpid_proton/messenger.rb Tue Jul 16 13:00:02 2013
@@ -228,7 +228,7 @@ module Qpid
       #
       # * limit - the maximum number of messages to receive
       #
-      def receive(limit=-1)
+      def receive(limit = -1)
         check_for_error(Cproton.pn_messenger_recv(@impl, limit))
       end
 

Modified: qpid/proton/trunk/proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb?rev=1503701&r1=1503700&r2=1503701&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb (original)
+++ qpid/proton/trunk/proton-c/bindings/ruby/spec/qpid/proton/data_spec.rb Tue Jul 16 13:00:02 2013
@@ -331,7 +331,7 @@ module Qpid
       end
 
       it "can hold a decimal128" do
-        value = 1 + rand(2**127)
+        value = rand(2**127)
         @data.decimal128 = value
         @data.decimal128.should == value
       end
@@ -414,7 +414,7 @@ module Qpid
       it "can hold an array" do
         values = []
         (1..(rand(100) + 5)).each { values << rand(2**16) }
-        @data.put_array false, Data::INT
+        @data.put_array false, Qpid::Proton::INT
         @data.enter
         values.each { |value| @data.int = value }
         @data.exit
@@ -430,13 +430,13 @@ module Qpid
         values = []
         (1..(rand(100) + 5)).each { values << random_string(64) }
         descriptor = random_string(32)
-        @data.put_array true, Data::STRING
+        @data.put_array true, Qpid::Proton::STRING
         @data.enter
         @data.symbol = descriptor
         values.each { |value| @data.string = value }
         @data.exit
 
-        @data.array.should == [values.size, true, Data::STRING]
+        @data.array.should == [values.size, true, Qpid::Proton::STRING]
         @data.enter
         @data.next
         @data.symbol.should == descriptor

Modified: qpid/proton/trunk/proton-c/bindings/ruby/spec/qpid/proton/messenger_spec.rb
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/ruby/spec/qpid/proton/messenger_spec.rb?rev=1503701&r1=1503700&r2=1503701&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/ruby/spec/qpid/proton/messenger_spec.rb (original)
+++ qpid/proton/trunk/proton-c/bindings/ruby/spec/qpid/proton/messenger_spec.rb Tue Jul 16 13:00:02 2013
@@ -70,7 +70,7 @@ module Qpid
         @messenger.errno.should eq(0)
         # force an error
         expect {
-          @messenger.subscribe("amqp://farkle")
+          @messenger.subscribe("amqp://~#{random_string}")
         }.to raise_error(ProtonError)
         @messenger.error?.should be_true
         @messenger.errno.should_not eq(0)
@@ -81,7 +81,7 @@ module Qpid
         @messenger.error.should be_nil
         # force an error
         expect {
-          @messenger.subscribe("amqp://farkle")
+          @messenger.subscribe("amqp://~#{random_string}")
         }.to raise_error(ProtonError)
         @messenger.error?.should be_true
         @messenger.errno.should_not be_nil
@@ -107,7 +107,7 @@ module Qpid
 
       it "raises an error when subscribing to an invalid address" do
         expect {
-          @messenger.subscribe("amqp://farkle")
+          @messenger.subscribe("amqp://~#{random_string}")
         }.to raise_error(ProtonError)
         @messenger.error?.should be_true
         @messenger.errno.should_not be_nil
@@ -230,10 +230,6 @@ module Qpid
           @messenger.subscribe("amqp://~0.0.0.0").should_not be_nil
         end
 
-        it "does not return a tracker before sending messages" do
-          @messenger.outgoing_tracker.should be_nil
-        end
-
         it "returns a tracker's status"
 
         it "raises an error when settling with a nil flag" do
@@ -273,7 +269,10 @@ module Qpid
             rescue ProtonError => error
               # ignore this error
             end
-            @receiver.stop
+            begin
+              @receiver.stop
+            rescue
+            end
           end
 
           it "raises an error when queueing a nil message" do
@@ -349,10 +348,6 @@ module Qpid
 
           end
 
-          it "has a nil incoming tracker when no messages are received" do
-            @messenger.incoming_tracker.should be_nil
-          end
-
           it "has an incoming tracker"
 
           it "raises an error when rejecting with a nil flag" do
@@ -423,12 +418,6 @@ module Qpid
               }.to raise_error(TypeError)
             end
 
-            it "raises an error when receiving with a negative max" do
-              expect {
-                @messenger.receive(-5)
-              }.to raise_error(RangeError)
-            end
-
             it "can receive messages"
             it "and create a new message when one wasn't provided"
             it "can get a message from the incoming queue"



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org