Sha256: 5f41233a3fec181abf7de6aba0c16bd06214cdcd4d105c3158e9726ffbc18ead

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require "integration/test_helper"
require "azure/service_bus/queues"
require "azure/service_bus/brokered_message"

describe "Peek-lock a Message from a Queue" do

  after do
    ServiceBusQueueNameHelper.clean
  end

  before do
    @queue = Azure::ServiceBus::Queues.create(ServiceBusQueueNameHelper.name)
  end

  it "should be able to peek a message from a queue" do
    message = Azure::ServiceBus::BrokeredMessage.new("some text", :prop1 => "val1") do |m|
      m.to = "yo"
      m.label = 'my_label'
    end
    Azure::ServiceBus::Queues.send_message_to_queue(@queue, message)

    retrieved = Azure::ServiceBus::Queues.peek_lock_message_from_queue(@queue)
    retrieved.must_be :kind_of?, Azure::ServiceBus::BrokeredMessage
    assert retrieved.valid?

    retrieved.body.must_equal message.body
    retrieved.to.must_equal message.to
    retrieved.label.must_equal message.label
    retrieved.properties['prop1'].must_equal 'val1'

    refute retrieved.lock_token.nil?
    refute retrieved.sequence_number.nil?
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
azure-0.1.1 test/integration/service_bus/queues/peek_message_from_queue_test.rb
azure-0.1.0 test/integration/service_bus/queues/peek_message_from_queue_test.rb