logstash-integration-jdbc 5.1.6 → 5.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef9180da50049c113170083c54826d75aadc91883fdca644bd82b5802ccd7234
4
- data.tar.gz: 55b6adf668a1aac55c7a5883ae02de29431bcdf1e58d2177ab6004524bd99780
3
+ metadata.gz: 631bf72cc9e0bb40840f5e7537919e0501a766ddc020a970508004dbebe19d9e
4
+ data.tar.gz: d712fc0933239f37b56c88b3cfb7de121452ea07901ed7a17ce6339b0f351fc5
5
5
  SHA512:
6
- metadata.gz: 22e48f5ac21bde7821142cc77accd458dd695a8895941bed7d7a495459d06663c2166c94c91f9592f1621f119a9c796c186401542a8085f01abd6544b3345376
7
- data.tar.gz: 3f0a613c6bd1d4a9c8b272ec6b344bc0f791f5a137f25adbee547fbece9d7a5a01028f125641255186266d47714bb47e499325c21700d865c4cc9bf22dd529f2
6
+ metadata.gz: 304d561709459feb36273bfb95cfb8dcc50aa86f2fe39d9f0af7153cdef5dbdbe91c934d8bf5c015f2c7b16ccba679042e8713f6460101b626bce79c7d2d1d3a
7
+ data.tar.gz: 220f00788a142ec81d5b00b0fd370ae15a02709553a28679351e04d1551252c080f2a6f62a11d1a61fe832f2e77ca0259d31b570834242277d18a09670ee38c3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 5.1.7
2
+ - Normalize jdbc_driver_class loading to support any top-level java packages [#86](https://github.com/logstash-plugins/logstash-integration-jdbc/pull/86)
3
+
1
4
  ## 5.1.6
2
5
  - Fix, serialize the JDBC driver loading steps to avoid concurrency issues [#84](https://github.com/logstash-plugins/logstash-integration-jdbc/pull/84)
3
6
 
@@ -30,7 +30,7 @@ module LogStash module PluginMixins module Jdbc
30
30
  begin
31
31
  load_driver_jars
32
32
  begin
33
- @driver_impl = Sequel::JDBC.load_driver(@jdbc_driver_class)
33
+ @driver_impl = Sequel::JDBC.load_driver(normalized_driver_class)
34
34
  rescue Sequel::AdapterNotFound => e # Sequel::AdapterNotFound, "#{@jdbc_driver_class} not loaded"
35
35
  # fix this !!!
36
36
  message = if jdbc_driver_library_set?
@@ -71,5 +71,16 @@ module LogStash module PluginMixins module Jdbc
71
71
  !@jdbc_driver_library.nil? && !@jdbc_driver_library.empty?
72
72
  end
73
73
 
74
+ # normalizing the class name to always have a Java:: prefix
75
+ # is helpful since JRuby is only able to directly load class names
76
+ # whose top-level package is com, org, java, javax
77
+ # There are many jdbc drivers that use cc, io, net, etc.
78
+ def normalized_driver_class
79
+ if @jdbc_driver_class.start_with?("Java::", "Java.")
80
+ @jdbc_driver_class
81
+ else
82
+ "Java::#{@jdbc_driver_class}"
83
+ end
84
+ end
74
85
  end
75
86
  end end end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-integration-jdbc'
3
- s.version = '5.1.6'
3
+ s.version = '5.1.7'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "Integration with JDBC - input and filter plugins"
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -14,10 +14,11 @@ require "date"
14
14
 
15
15
  describe LogStash::Inputs::Jdbc do
16
16
  let(:connection_string) { "jdbc:derby:memory:testdb;create=true" }
17
+ let(:jdbc_driver_class) { "org.apache.derby.jdbc.EmbeddedDriver" }
17
18
  let(:mixin_settings) do
18
19
  {
19
20
  "jdbc_user" => ENV['USER'],
20
- "jdbc_driver_class" => "org.apache.derby.jdbc.EmbeddedDriver",
21
+ "jdbc_driver_class" => jdbc_driver_class,
21
22
  "jdbc_connection_string" => connection_string
22
23
  }
23
24
  end
@@ -1619,4 +1620,21 @@ describe LogStash::Inputs::Jdbc do
1619
1620
  end
1620
1621
  end
1621
1622
  end
1623
+
1624
+ describe "jdbc_driver_class" do
1625
+ context "when not prefixed with Java::" do
1626
+ let(:jdbc_driver_class) { "org.apache.derby.jdbc.EmbeddedDriver" }
1627
+ it "loads the class prefixed with Java::" do
1628
+ expect(Sequel::JDBC).to receive(:load_driver).with(/^Java::/)
1629
+ plugin.send(:load_driver)
1630
+ end
1631
+ end
1632
+ context "when prefixed with Java::" do
1633
+ let(:jdbc_driver_class) { "Java::org.apache.derby.jdbc.EmbeddedDriver" }
1634
+ it "loads the class as-is" do
1635
+ expect(Sequel::JDBC).to receive(:load_driver).with(jdbc_driver_class)
1636
+ plugin.send(:load_driver)
1637
+ end
1638
+ end
1639
+ end
1622
1640
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-integration-jdbc
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.6
4
+ version: 5.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-12 00:00:00.000000000 Z
11
+ date: 2021-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement