Sha256: ae308a6337292f09918a5e9e453b2bd234062358bfcd875ec88dd916b6af45e0

Contents?: true

Size: 1.4 KB

Versions: 5

Compression:

Stored size: 1.4 KB

Contents

require "logstash/devutils/rspec/spec_helper"
require "logstash/inputs/jdbc"

# This test requires: Firebird installed to Mac OSX, it uses the built-in example database `employee`

describe LogStash::Inputs::Jdbc, :integration => true do
  # This is a necessary change test-wide to guarantee that no local timezone
  # is picked up.  It could be arbitrarily set to any timezone, but then the test
  # would have to compensate differently.  That's why UTC is chosen.
  ENV["TZ"] = "Etc/UTC"
  let(:mixin_settings) do
    { "jdbc_user" => "SYSDBA", "jdbc_driver_class" => "org.firebirdsql.jdbc.FBDriver", "jdbc_driver_library" => "/elastic/tmp/jaybird-full-3.0.4.jar",
    "jdbc_connection_string" => "jdbc:firebirdsql://localhost:3050//Library/Frameworks/Firebird.framework/Versions/A/Resources/examples/empbuild/employee.fdb", "jdbc_password" => "masterkey"}
  end
  let(:settings) { {"statement" => "SELECT FIRST_NAME, LAST_NAME FROM EMPLOYEE WHERE EMP_NO > 144"} }
  let(:plugin) { LogStash::Inputs::Jdbc.new(mixin_settings.merge(settings)) }
  let(:queue) { Queue.new }

  context "when passing no parameters" do
    before do
      plugin.register
    end

    after do
      plugin.stop
    end

    it "should retrieve params correctly from Event" do
      plugin.run(queue)
      event = queue.pop
      expect(event.get('first_name')).to eq("Mark")
      expect(event.get('last_name')).to eq("Guckenheimer")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
logstash-input-jdbc-4.3.17 spec/inputs/integ_spec.rb
logstash-input-jdbc-4.3.16 spec/inputs/integ_spec.rb
logstash-input-jdbc-4.3.14 spec/inputs/integ_spec.rb
logstash-input-jdbc-4.3.13 spec/inputs/integ_spec.rb
logstash-input-jdbc-4.3.12 spec/inputs/integ_spec.rb