Sha256: a862113dec8d856c1da69bf501b873bcd37d67038441b5236f7ef3bc42707a65

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

require "logstash/devutils/rspec/spec_helper"
require 'logstash/outputs/jms'
require 'jms'
require 'json'

def getYamlPath()
  return File.join(File.dirname(__FILE__),"jms.yml")
end

describe "outputs/jms" do
  let (:jms_config) {{'yaml_file' => getYamlPath(), 'yaml_section' => 'hornetq', 'destination' => 'ExampleQueue'}}
  let (:event) { LogStash::Event.new({'message' => 'hello',
                                      '@timestamp' => LogStash::Timestamp.now}) }

  context 'when initializing' do
    it "should register" do
      pending('JMS Provider')
      output = LogStash::Plugin.lookup("output", "jms").new(jms_config)
      expect {output.register}.to_not raise_error
    end

    it 'should populate jms config with default values' do
      jms = LogStash::Outputs::Jms.new(jms_config)
      expect(jms.pub_sub).to eq(false)
    end
  end

  context 'when outputting messages' do
    it 'should send logstash event to jms queue' do
      pending('JMS Provider')
      jms = LogStash::Outputs::Jms.new(jms_config)
      jms.register
      jms.receive(event)
      # Add code to check the message is correct on the queue.
    end
  end

  describe "debugging `password`" do
    let(:config) { jms_config.merge("password" => "$ecre&-key") }
    it "should not show origin value" do

      output = LogStash::Plugin.lookup("output", "jms").new(config)
      expect(output.logger).to receive(:debug).with('<password>')
      output.logger.send(:debug, output.password.to_s)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logstash-output-jms-3.0.5 spec/outputs/jms_spec.rb