You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2018/03/27 16:33:55 UTC

qpid-proton git commit: PROTON-1814: [ruby] undefined methods for #

Repository: qpid-proton
Updated Branches:
  refs/heads/master dc90e617b -> 4bc6e125a


PROTON-1814: [ruby] undefined methods for #<Qpid::Proton::Terminus>

Fixed incorrect code in Terminus#apply, added unit test.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/4bc6e125
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/4bc6e125
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/4bc6e125

Branch: refs/heads/master
Commit: 4bc6e125aeabdf3a2ae9f8e8c354e4ec5a9ac96d
Parents: dc90e61
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Mar 27 12:32:39 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Mar 27 12:32:39 2018 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/core/terminus.rb    |  6 ++---
 proton-c/bindings/ruby/tests/test_container.rb | 29 +++++++++++++++++++++
 2 files changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4bc6e125/proton-c/bindings/ruby/lib/core/terminus.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/terminus.rb b/proton-c/bindings/ruby/lib/core/terminus.rb
index a7a8af0..3b169f9 100644
--- a/proton-c/bindings/ruby/lib/core/terminus.rb
+++ b/proton-c/bindings/ruby/lib/core/terminus.rb
@@ -234,10 +234,10 @@ module Qpid::Proton
           when :dynamic then self.dynamic = !!v
           when :distribution_mode then self.distribution_mode = v
           when :durability_mode then self.durability_mode = v
-          when :timeout then self.timeout = v
+          when :timeout then self.timeout = v.round # Should be integer seconds
           when :expiry_policy then self.expiry_policy = v
-          when :filter then self.filter = v
-          when :capabilities then self.capabilities = v
+          when :filter then self.filter << v
+          when :capabilities then self.capabilities << v
           end
         end
       end

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/4bc6e125/proton-c/bindings/ruby/tests/test_container.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/tests/test_container.rb b/proton-c/bindings/ruby/tests/test_container.rb
index 7f89205..adce409 100644
--- a/proton-c/bindings/ruby/tests/test_container.rb
+++ b/proton-c/bindings/ruby/tests/test_container.rb
@@ -247,6 +247,35 @@ class ContainerTest < MiniTest::Test
     assert_equal expect, client_handler.links.map { |l| [l.source.address, l.target.address] }
   end
 
+  def extract_terminus_options(t)
+    opts = Hash[[:address, :distribution_mode, :durability_mode, :timeout, :expiry_policy].map { |m| [m, t.send(m)] }]
+    opts[:filter] = t.filter.map
+    opts[:capabilities] = t.capabilities.map
+    opts[:dynamic] = t.dynamic?
+    opts
+  end
+
+  def test_terminus_options
+    opts = {
+      :distribution_mode => Terminus::DIST_MODE_COPY,
+      :durability_mode => Terminus::DELIVERIES,
+      :timeout => 5,
+      :expiry_policy => Terminus::EXPIRE_WITH_LINK,
+      :filter => { :try => 'me' },
+      :capabilities => { :cap => 'len' },
+    }
+    src_opts = { :address => "src", :dynamic => true }.update(opts)
+    tgt_opts = { :address => "tgt", :dynamic => false }.update(opts)
+
+    cont = ServerContainer.new(__method__, {}, 1)
+    c = cont.connect(cont.url)
+    s = c.open_sender({:target => tgt_opts, :source => src_opts })
+    assert_equal src_opts, extract_terminus_options(s.source)
+    assert_equal tgt_opts, extract_terminus_options(s.target)
+    assert s.source.dynamic?
+    assert !s.target.dynamic?
+  end
+
   # Test for time out on connecting to an unresponsive server
   def test_idle_timeout_server_no_open
     s = TCPServer.new(0)


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