Sha256: a6920bdb76a87375a0c573af4e50468dae7cb60da69b9663f2e257e871c93abd

Contents?: true

Size: 1.63 KB

Versions: 2

Compression:

Stored size: 1.63 KB

Contents

require 'rubygems'
require 'spec'

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

#
# Modulo com metodos uteis para as propertiess.
#
module SparrowHelperMethods

  #
  # Apenas cria, mas nao faz o setup do cliente JMS.
  #
  # WARNING: OC4J will be used as Java EE application server, but any other could
  # be used with no problems.
  #
  def create_jms_client
    jms_client = Sparrow::JMS::Connection::Client.new do |properties|
      properties.client_jar_file         = '/home/leandro/Desenvolvimento/java/servers/oc4j_extended_101330/j2ee/home/oc4jclient.jar'
      properties.initial_context_factory = 'oracle.j2ee.naming.ApplicationClientInitialContextFactory'
      properties.provider_url            = 'ormi://localhost:23791'
      properties.security_principal      = 'oc4jadmin'
      properties.security_credentials    = 'welcome'
    end
  end
  
  #
  # Cria e faz o setup do cliente JMS, habilitando os connection factories, queues e topics
  # que ele pode usar.
  #
  def create_and_setup_jms_client
    jms_client = create_jms_client

    jms_client.enable_connection_factories(
        :queue_connection_factory => 'jms/PardalQCF',
        :topic_connection_factory => 'jms/PardalTCF'
      )
      
    jms_client.enable_queues(
        :pardal_queue => 'jms/PardalQueue'
      )
      
    jms_client.enable_topics(
        :pardal_topic => 'jms/PardalTopic'
      )
    
    # Pronto para ser usado!
    jms_client
  end
end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
leandrosilva-sparrow-1.0.2 spec/spec_helper.rb
leandrosilva-sparrow-1.0.3 spec/spec_helper.rb