diff options
author | James Turnbull <james@lovedthanlost.net> | 2011-04-20 02:35:40 +1000 |
---|---|---|
committer | Josh Cooper <josh@puppetlabs.com> | 2011-04-19 15:30:59 -0700 |
commit | c87d6c98ec1a315d435be38e7eb2258984c7d88c (patch) | |
tree | d7e7255721198e391f916379912dc6c1bc9410ea | |
parent | 40a5bca736a31784d341aef389edfdde915938ec (diff) | |
download | puppet-c87d6c98ec1a315d435be38e7eb2258984c7d88c.tar.gz puppet-c87d6c98ec1a315d435be38e7eb2258984c7d88c.tar.xz puppet-c87d6c98ec1a315d435be38e7eb2258984c7d88c.zip |
Fixed #7166 - Replaced deprecated stomp "send" method with "publish"
The "send" method in the stomp gem has been deprecated since:
http://gitorious.org/stomp/mainline/commit/d542a976028cb4c5badcbb69e3383e746721e44c
It's been replaced with the "publish" method.
Also renamed the send_message method to publish_message more in
keeping with language used in queuing.
-rw-r--r-- | lib/puppet/indirector/queue.rb | 2 | ||||
-rw-r--r-- | lib/puppet/util/queue.rb | 2 | ||||
-rw-r--r-- | lib/puppet/util/queue/stomp.rb | 4 | ||||
-rwxr-xr-x | spec/integration/indirector/catalog/queue_spec.rb | 4 | ||||
-rwxr-xr-x | spec/unit/indirector/queue_spec.rb | 8 | ||||
-rwxr-xr-x | spec/unit/util/queue/stomp_spec.rb | 20 |
6 files changed, 20 insertions, 20 deletions
diff --git a/lib/puppet/indirector/queue.rb b/lib/puppet/indirector/queue.rb index fd089f431..85ffacacc 100644 --- a/lib/puppet/indirector/queue.rb +++ b/lib/puppet/indirector/queue.rb @@ -36,7 +36,7 @@ class Puppet::Indirector::Queue < Puppet::Indirector::Terminus def save(request) result = nil benchmark :info, "Queued #{indirection.name} for #{request.key}" do - result = client.send_message(queue, request.instance.render(:pson)) + result = client.publish_message(queue, request.instance.render(:pson)) end result rescue => detail diff --git a/lib/puppet/util/queue.rb b/lib/puppet/util/queue.rb index 02357742a..636bdcf2e 100644 --- a/lib/puppet/util/queue.rb +++ b/lib/puppet/util/queue.rb @@ -30,7 +30,7 @@ require 'puppet/util/instance_loader' # # The client plugins are expected to implement an interface similar to that of Stomp::Client: # * <tt>new</tt> should return a connected, ready-to-go client instance. Note that no arguments are passed in. -# * <tt>send_message(queue, message)</tt> should send the _message_ to the specified _queue_. +# * <tt>publish_message(queue, message)</tt> should publish the _message_ to the specified _queue_. # * <tt>subscribe(queue)</tt> _block_ subscribes to _queue_ and executes _block_ upon receiving a message. # * _queue_ names are simple names independent of the message broker or client library. No "/queue/" prefixes like in Stomp::Client. module Puppet::Util::Queue diff --git a/lib/puppet/util/queue/stomp.rb b/lib/puppet/util/queue/stomp.rb index c18edae6a..cabc56627 100644 --- a/lib/puppet/util/queue/stomp.rb +++ b/lib/puppet/util/queue/stomp.rb @@ -28,8 +28,8 @@ class Puppet::Util::Queue::Stomp end end - def send_message(target, msg) - stomp_client.send(stompify_target(target), msg, :persistent => true) + def publish_message(target, msg) + stomp_client.publish(stompify_target(target), msg, :persistent => true) end def subscribe(target) diff --git a/spec/integration/indirector/catalog/queue_spec.rb b/spec/integration/indirector/catalog/queue_spec.rb index 569f096bf..940c8bab8 100755 --- a/spec/integration/indirector/catalog/queue_spec.rb +++ b/spec/integration/indirector/catalog/queue_spec.rb @@ -19,13 +19,13 @@ describe "Puppet::Resource::Catalog::Queue", :if => Puppet.features.pson? do after { Puppet.settings.clear } - it "should render catalogs to pson and send them via the queue client when catalogs are saved" do + it "should render catalogs to pson and publish them via the queue client when catalogs are saved" do terminus = Puppet::Resource::Catalog.indirection.terminus(:queue) client = mock 'client' terminus.stubs(:client).returns client - client.expects(:send_message).with(:catalog, @catalog.to_pson) + client.expects(:publish_message).with(:catalog, @catalog.to_pson) request = Puppet::Indirector::Request.new(:catalog, :save, "foo", :instance => @catalog) diff --git a/spec/unit/indirector/queue_spec.rb b/spec/unit/indirector/queue_spec.rb index b84ed2aea..eba136bbc 100755 --- a/spec/unit/indirector/queue_spec.rb +++ b/spec/unit/indirector/queue_spec.rb @@ -60,20 +60,20 @@ describe Puppet::Indirector::Queue, :if => Puppet.features.pson? do describe "when saving" do it 'should render the instance using pson' do @subject.expects(:render).with(:pson) - @store.client.stubs(:send_message) + @store.client.stubs(:publish_message) @store.save(@request) end - it "should send the rendered message to the appropriate queue on the client" do + it "should publish the rendered message to the appropriate queue on the client" do @subject.expects(:render).returns "mypson" - @store.client.expects(:send_message).with(:my_queue, "mypson") + @store.client.expects(:publish_message).with(:my_queue, "mypson") @store.save(@request) end it "should catch any exceptions raised" do - @store.client.expects(:send_message).raises ArgumentError + @store.client.expects(:publish_message).raises ArgumentError lambda { @store.save(@request) }.should raise_error(Puppet::Error) end diff --git a/spec/unit/util/queue/stomp_spec.rb b/spec/unit/util/queue/stomp_spec.rb index f67189cf5..99c77d0b4 100755 --- a/spec/unit/util/queue/stomp_spec.rb +++ b/spec/unit/util/queue/stomp_spec.rb @@ -63,26 +63,26 @@ describe 'Puppet::Util::Queue::Stomp', :if => Puppet.features.stomp? do end end - describe "when sending a message" do + describe "when publishing a message" do before do @client = stub 'client' Stomp::Client.stubs(:new).returns @client @queue = Puppet::Util::Queue::Stomp.new end - it "should send it to the queue client instance" do - @client.expects(:send).with { |queue, msg, options| msg == "Smite!" } - @queue.send_message('fooqueue', 'Smite!') + it "should publish it to the queue client instance" do + @client.expects(:publish).with { |queue, msg, options| msg == "Smite!" } + @queue.publish_message('fooqueue', 'Smite!') end - it "should send it to the transformed queue name" do - @client.expects(:send).with { |queue, msg, options| queue == "/queue/fooqueue" } - @queue.send_message('fooqueue', 'Smite!') + it "should publish it to the transformed queue name" do + @client.expects(:publish).with { |queue, msg, options| queue == "/queue/fooqueue" } + @queue.publish_message('fooqueue', 'Smite!') end - it "should send it as a persistent message" do - @client.expects(:send).with { |queue, msg, options| options[:persistent] == true } - @queue.send_message('fooqueue', 'Smite!') + it "should publish it as a persistent message" do + @client.expects(:publish).with { |queue, msg, options| options[:persistent] == true } + @queue.publish_message('fooqueue', 'Smite!') end end |