logstash-core-event-java 5.0.0.pre.rc1-java → 5.0.1-java

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
  SHA1:
3
- metadata.gz: 1862bc126c2b8b9e79027171d795afc984a9ce95
4
- data.tar.gz: e5aab94f01286183da58e2c6656cd9faaf1b8aeb
3
+ metadata.gz: 986d77995ad435e6e83f4447a41d689f8a8c90bd
4
+ data.tar.gz: 6e300dfb3c4566e1b9d4c3c321666263d921292e
5
5
  SHA512:
6
- metadata.gz: 53bfbee786ddc17019a8ea0ced44b163974a78ffce9c0591ddc7cc74a7978cc6ac28e9ac16a8665e2fcc307edcd4c2bf70378c55512ca59d8bf5de4f8cf6ac55
7
- data.tar.gz: 71fb3625e10777fa073f8cec5688c0b5bf9fd5bf3759ffea13afaeb5382084416b3c08bf87d1e540d28097247c5fe1d8b9404c49d1215ba0d459f20362f34ee3
6
+ metadata.gz: 1695d0c9434307108f5847691197d1629ff819b4363869fa9259d3a915557e34495cdf317d64116239f3c4f8b424399709f99e59fad91ed79bd9bb4e33dff269
7
+ data.tar.gz: f94f47617eb3dad580fe8a99badb6c23dade0bf80130868e0f81ecba2b2983f305dad827d1c5d8799c83d3558ef71cfed804f80d0e354386764ac3c396590e24
@@ -25,4 +25,4 @@ end
25
25
  require "jruby_event_ext"
26
26
  require "jruby_timestamp_ext"
27
27
  require "logstash/event"
28
- require "logstash/timestamp"
28
+ require "logstash/timestamp"
@@ -5,4 +5,4 @@
5
5
  # Note to authors: this should not include dashes because 'gem' barfs if
6
6
  # you include a dash in the version string.
7
7
 
8
- LOGSTASH_CORE_EVENT_JAVA_VERSION = "5.0.0-rc1"
8
+ LOGSTASH_CORE_EVENT_JAVA_VERSION = "5.0.1"
@@ -29,9 +29,26 @@ module LogStash
29
29
 
30
30
  # LogStash::SHUTDOWN is used by plugins
31
31
  SHUTDOWN = ShutdownEvent.new
32
+
33
+ class Event
34
+ MSG_BRACKETS_METHOD_MISSING = "Direct event field references (i.e. event['field']) have been disabled in favor of using event get and set methods (e.g. event.get('field')). Please consult the Logstash 5.0 breaking changes documentation for more details.".freeze
35
+ MSG_BRACKETS_EQUALS_METHOD_MISSING = "Direct event field references (i.e. event['field'] = 'value') have been disabled in favor of using event get and set methods (e.g. event.set('field', 'value')). Please consult the Logstash 5.0 breaking changes documentation for more details.".freeze
36
+ RE_BRACKETS_METHOD = /^\[\]$/.freeze
37
+ RE_BRACKETS_EQUALS_METHOD = /^\[\]=$/.freeze
38
+
39
+ def method_missing(method_name, *arguments, &block)
40
+ if RE_BRACKETS_METHOD.match(method_name.to_s)
41
+ raise NoMethodError.new(MSG_BRACKETS_METHOD_MISSING)
42
+ end
43
+ if RE_BRACKETS_EQUALS_METHOD.match(method_name.to_s)
44
+ raise NoMethodError.new(MSG_BRACKETS_EQUALS_METHOD_MISSING)
45
+ end
46
+ super
47
+ end
48
+ end
32
49
  end
33
50
 
34
51
  # for backward compatibility, require "logstash/event" is used a lots of places so let's bootstrap the
35
52
  # Java code loading from here.
36
53
  # TODO: (colin) I think we should mass replace require "logstash/event" with require "logstash-core-event"
37
- require "logstash-core-event"
54
+ require "logstash-core-event"
data/spec/event_spec.rb CHANGED
@@ -35,7 +35,7 @@ describe LogStash::Event do
35
35
  end
36
36
  end
37
37
 
38
- context "[]" do
38
+ context "#get" do
39
39
  it "should get simple values" do
40
40
  e = LogStash::Event.new({"foo" => "bar", "bar" => 1, "baz" => 1.0, TIMESTAMP => "2015-05-28T23:02:05.350Z"})
41
41
  expect(e.get("foo")).to eq("bar")
@@ -63,7 +63,7 @@ describe LogStash::Event do
63
63
  end
64
64
  end
65
65
 
66
- context "[]=" do
66
+ context "#set" do
67
67
  it "should set simple values" do
68
68
  e = LogStash::Event.new()
69
69
  expect(e.set("foo", "bar")).to eq("bar")
@@ -306,4 +306,20 @@ describe LogStash::Event do
306
306
  end
307
307
 
308
308
  end
309
+
310
+ context "method missing exception messages" do
311
+ subject { LogStash::Event.new({"foo" => "bar"}) }
312
+
313
+ it "#[] method raises a better exception message" do
314
+ expect { subject["foo"] }.to raise_error(NoMethodError, /Direct event field references \(i\.e\. event\['field'\]\)/)
315
+ end
316
+
317
+ it "#[]= method raises a better exception message" do
318
+ expect { subject["foo"] = "baz" }.to raise_error(NoMethodError, /Direct event field references \(i\.e\. event\['field'\] = 'value'\)/)
319
+ end
320
+
321
+ it "other missing method raises normal exception message" do
322
+ expect { subject.baz() }.to raise_error(NoMethodError, /undefined method `baz' for/)
323
+ end
324
+ end
309
325
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-core-event-java
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.pre.rc1
4
+ version: 5.0.1
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-07 00:00:00.000000000 Z
11
+ date: 2016-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -75,9 +75,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - ">"
78
+ - - ">="
79
79
  - !ruby/object:Gem::Version
80
- version: 1.3.1
80
+ version: '0'
81
81
  requirements:
82
82
  - jar com.fasterxml.jackson.core:jackson-core, 2.7.3
83
83
  - jar com.fasterxml.jackson.core:jackson-databind, 2.7.3