Sha256: c8c9c81693570dd5d2723cc1ed8760ce86b05962b8e9df85ccaa96b8e6650b88

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

require 'rubygems'
require 'spec'

require File.dirname(File.expand_path(__FILE__)) + '/../lib/jsparrow.rb'

#
# Modulo com metodos uteis para as specs.
#
module JSparrowHelperMethods

  #
  # Apenas cria, mas nao faz o setup do cliente JMS.
  #
  def create_jms_client
    configure_connection
    
    JSparrow::Connection.new_client
  end
  
  def configure_connection
    JSparrow::Connection.configure do |connection|
      connection.use_jms_client_jar '/opt/openjms/lib/openjms-0.7.7-beta-1.jar'

      connection.use_jndi_properties :initial_context_factory => 'org.exolab.jms.jndi.InitialContextFactory',
                                     :provider_url            => 'tcp://localhost:3035'
                                   # :security_principal      => 'user',
                                   # :security_credentials    => 'password'
      
      connection.enable_connection_factories :queue_connection_factory => 'ConnectionFactory', 
                                             :topic_connection_factory => 'ConnectionFactory'
      
      connection.enable_queues :test_queue => 'TestQueue'
      
      connection.enable_topics :test_topic => 'TestTopic'
    end
  end
end

#
# Enriquece a classe Spec::Example::ExampleGroup com o helper.
#
class Spec::Example::ExampleGroup
  include JSparrowHelperMethods
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jsparrow-1.1.1 spec/spec_helper.rb