logstash-core-event-java 5.0.0.alpha3.snapshot2-java → 5.0.0.alpha3.snapshot4-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8eebc71743b2c787320be90c10637f3495a0080
|
4
|
+
data.tar.gz: 733f274f3c5bfdd2188d831590a881927665ca34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16a0a1637c80949757ac67af159cfef0eb23b5f158c378cc7b12cc114c3de5817207f510cfb5d7fd5435ae5d8fdaa87521fa1a6a58780b0bfbf72b5a6d8e7b73
|
7
|
+
data.tar.gz: ef5f74b3704181db80df4987cd82317b75a070aeab973c1e830e30f03ecd15f27b7c88822c04f08efebb0b10e7a5020f48ac93f1b64c8ed993f99b9a6db0b8e0
|
Binary file
|
data/spec/event_spec.rb
CHANGED
@@ -4,6 +4,7 @@ require "spec_helper"
|
|
4
4
|
require "logstash/util"
|
5
5
|
require "logstash/event"
|
6
6
|
require "json"
|
7
|
+
require "java"
|
7
8
|
|
8
9
|
TIMESTAMP = "@timestamp"
|
9
10
|
|
@@ -26,10 +27,10 @@ describe LogStash::Event do
|
|
26
27
|
|
27
28
|
it "should serialize deep hash from field reference assignments" do
|
28
29
|
e = LogStash::Event.new({TIMESTAMP => "2015-05-28T23:02:05.350Z"})
|
29
|
-
e
|
30
|
-
e
|
31
|
-
e
|
32
|
-
e
|
30
|
+
e.set("foo", "bar")
|
31
|
+
e.set("bar", 1)
|
32
|
+
e.set("baz", 1.0)
|
33
|
+
e.set("[fancy][pants][socks]", "shoes")
|
33
34
|
expect(JSON.parse(e.to_json)).to eq(JSON.parse("{\"@timestamp\":\"2015-05-28T23:02:05.350Z\",\"@version\":\"1\",\"foo\":\"bar\",\"bar\":1,\"baz\":1.0,\"fancy\":{\"pants\":{\"socks\":\"shoes\"}}}"))
|
34
35
|
end
|
35
36
|
end
|
@@ -37,79 +38,79 @@ describe LogStash::Event do
|
|
37
38
|
context "[]" do
|
38
39
|
it "should get simple values" do
|
39
40
|
e = LogStash::Event.new({"foo" => "bar", "bar" => 1, "baz" => 1.0, TIMESTAMP => "2015-05-28T23:02:05.350Z"})
|
40
|
-
expect(e
|
41
|
-
expect(e
|
42
|
-
expect(e
|
43
|
-
expect(e
|
44
|
-
expect(e
|
45
|
-
expect(e
|
46
|
-
expect(e
|
47
|
-
expect(e
|
41
|
+
expect(e.get("foo")).to eq("bar")
|
42
|
+
expect(e.get("[foo]")).to eq("bar")
|
43
|
+
expect(e.get("bar")).to eq(1)
|
44
|
+
expect(e.get("[bar]")).to eq(1)
|
45
|
+
expect(e.get("baz")).to eq(1.0)
|
46
|
+
expect(e.get("[baz]")).to eq(1.0)
|
47
|
+
expect(e.get(TIMESTAMP).to_s).to eq("2015-05-28T23:02:05.350Z")
|
48
|
+
expect(e.get("[#{TIMESTAMP}]").to_s).to eq("2015-05-28T23:02:05.350Z")
|
48
49
|
end
|
49
50
|
|
50
51
|
it "should get deep hash values" do
|
51
52
|
e = LogStash::Event.new({"foo" => {"bar" => 1, "baz" => 1.0}})
|
52
|
-
expect(e
|
53
|
-
expect(e
|
53
|
+
expect(e.get("[foo][bar]")).to eq(1)
|
54
|
+
expect(e.get("[foo][baz]")).to eq(1.0)
|
54
55
|
end
|
55
56
|
|
56
57
|
it "should get deep array values" do
|
57
58
|
e = LogStash::Event.new({"foo" => ["bar", 1, 1.0]})
|
58
|
-
expect(e
|
59
|
-
expect(e
|
60
|
-
expect(e
|
61
|
-
expect(e
|
59
|
+
expect(e.get("[foo][0]")).to eq("bar")
|
60
|
+
expect(e.get("[foo][1]")).to eq(1)
|
61
|
+
expect(e.get("[foo][2]")).to eq(1.0)
|
62
|
+
expect(e.get("[foo][3]")).to be_nil
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
65
66
|
context "[]=" do
|
66
67
|
it "should set simple values" do
|
67
68
|
e = LogStash::Event.new()
|
68
|
-
expect(e
|
69
|
-
expect(e
|
69
|
+
expect(e.set("foo", "bar")).to eq("bar")
|
70
|
+
expect(e.get("foo")).to eq("bar")
|
70
71
|
|
71
72
|
e = LogStash::Event.new({"foo" => "test"})
|
72
|
-
expect(e
|
73
|
-
expect(e
|
73
|
+
expect(e.set("foo", "bar")).to eq("bar")
|
74
|
+
expect(e.get("foo")).to eq("bar")
|
74
75
|
end
|
75
76
|
|
76
77
|
it "should set deep hash values" do
|
77
78
|
e = LogStash::Event.new()
|
78
|
-
expect(e
|
79
|
-
expect(e
|
80
|
-
expect(e
|
79
|
+
expect(e.set("[foo][bar]", "baz")).to eq("baz")
|
80
|
+
expect(e.get("[foo][bar]")).to eq("baz")
|
81
|
+
expect(e.get("[foo][baz]")).to be_nil
|
81
82
|
end
|
82
83
|
|
83
84
|
it "should set deep array values" do
|
84
85
|
e = LogStash::Event.new()
|
85
|
-
expect(e
|
86
|
-
expect(e
|
87
|
-
expect(e
|
88
|
-
expect(e
|
89
|
-
expect(e
|
90
|
-
expect(e
|
91
|
-
expect(e
|
86
|
+
expect(e.set("[foo][0]", "bar")).to eq("bar")
|
87
|
+
expect(e.get("[foo][0]")).to eq("bar")
|
88
|
+
expect(e.set("[foo][1]", 1)).to eq(1)
|
89
|
+
expect(e.get("[foo][1]")).to eq(1)
|
90
|
+
expect(e.set("[foo][2]", 1.0)).to eq(1.0)
|
91
|
+
expect(e.get("[foo][2]")).to eq(1.0)
|
92
|
+
expect(e.get("[foo][3]")).to be_nil
|
92
93
|
end
|
93
94
|
|
94
95
|
it "should add key when setting nil value" do
|
95
96
|
e = LogStash::Event.new()
|
96
|
-
e
|
97
|
+
e.set("[foo]", nil)
|
97
98
|
expect(e.to_hash).to include("foo" => nil)
|
98
99
|
end
|
99
100
|
|
100
101
|
# BigDecinal is now natively converted by JRuby, see https://github.com/elastic/logstash/pull/4838
|
101
102
|
it "should set BigDecimal" do
|
102
103
|
e = LogStash::Event.new()
|
103
|
-
e
|
104
|
-
expect(e
|
105
|
-
expect(e
|
104
|
+
e.set("[foo]", BigDecimal.new(1))
|
105
|
+
expect(e.get("foo")).to be_kind_of(BigDecimal)
|
106
|
+
expect(e.get("foo")).to eq(BigDecimal.new(1))
|
106
107
|
end
|
107
108
|
|
108
109
|
it "should set RubyBignum" do
|
109
110
|
e = LogStash::Event.new()
|
110
|
-
e
|
111
|
-
expect(e
|
112
|
-
expect(e
|
111
|
+
e.set("[foo]", -9223372036854776000)
|
112
|
+
expect(e.get("foo")).to be_kind_of(Bignum)
|
113
|
+
expect(e.get("foo")).to eq(-9223372036854776000)
|
113
114
|
end
|
114
115
|
end
|
115
116
|
|
@@ -117,7 +118,7 @@ describe LogStash::Event do
|
|
117
118
|
it "getters should present a Ruby LogStash::Timestamp" do
|
118
119
|
e = LogStash::Event.new()
|
119
120
|
expect(e.timestamp.class).to eq(LogStash::Timestamp)
|
120
|
-
expect(e
|
121
|
+
expect(e.get(TIMESTAMP).class).to eq(LogStash::Timestamp)
|
121
122
|
end
|
122
123
|
|
123
124
|
it "to_hash should inject a Ruby LogStash::Timestamp" do
|
@@ -134,9 +135,9 @@ describe LogStash::Event do
|
|
134
135
|
it "should set timestamp" do
|
135
136
|
e = LogStash::Event.new
|
136
137
|
now = Time.now
|
137
|
-
e
|
138
|
+
e.set("@timestamp", LogStash::Timestamp.at(now.to_i))
|
138
139
|
expect(e.timestamp.to_i).to eq(now.to_i)
|
139
|
-
expect(e
|
140
|
+
expect(e.get("@timestamp").to_i).to eq(now.to_i)
|
140
141
|
end
|
141
142
|
end
|
142
143
|
|
@@ -144,16 +145,16 @@ describe LogStash::Event do
|
|
144
145
|
it "should append" do
|
145
146
|
event = LogStash::Event.new("message" => "hello world")
|
146
147
|
event.append(LogStash::Event.new("message" => "another thing"))
|
147
|
-
expect(event
|
148
|
+
expect(event.get("message")).to eq(["hello world", "another thing"])
|
148
149
|
end
|
149
150
|
end
|
150
151
|
|
151
152
|
context "tags" do
|
152
153
|
it "should tag" do
|
153
154
|
event = LogStash::Event.new("message" => "hello world")
|
154
|
-
expect(event
|
155
|
-
event
|
156
|
-
expect(event
|
155
|
+
expect(event.get("tags")).to be_nil
|
156
|
+
event.tag("foo")
|
157
|
+
expect(event.get("tags")).to eq(["foo"])
|
157
158
|
end
|
158
159
|
end
|
159
160
|
|
@@ -258,8 +259,8 @@ describe LogStash::Event do
|
|
258
259
|
expect(LogStash::Event.from_json(source_json).size).to eq(1)
|
259
260
|
|
260
261
|
event = LogStash::Event.from_json(source_json)[0]
|
261
|
-
expect(event
|
262
|
-
expect(event
|
262
|
+
expect(event.get("[foo]")).to eq(1)
|
263
|
+
expect(event.get("[bar]")).to eq("baz")
|
263
264
|
end
|
264
265
|
|
265
266
|
it "should ignore blank strings" do
|
@@ -286,4 +287,24 @@ describe LogStash::Event do
|
|
286
287
|
end
|
287
288
|
end
|
288
289
|
end
|
290
|
+
|
291
|
+
context "initialize" do
|
292
|
+
|
293
|
+
it "should accept Ruby Hash" do
|
294
|
+
e = LogStash::Event.new({"foo" => 1, TIMESTAMP => "2015-05-28T23:02:05.350Z"})
|
295
|
+
expect(e.get("foo")).to eq(1)
|
296
|
+
expect(e.timestamp.to_iso8601).to eq("2015-05-28T23:02:05.350Z")
|
297
|
+
end
|
298
|
+
|
299
|
+
it "should accept Java Map" do
|
300
|
+
h = Java::JavaUtil::HashMap.new
|
301
|
+
h.put("foo", 2);
|
302
|
+
h.put(TIMESTAMP, "2016-05-28T23:02:05.350Z");
|
303
|
+
e = LogStash::Event.new(h)
|
304
|
+
|
305
|
+
expect(e.get("foo")).to eq(2)
|
306
|
+
expect(e.timestamp.to_iso8601).to eq("2016-05-28T23:02:05.350Z")
|
307
|
+
end
|
308
|
+
|
309
|
+
end
|
289
310
|
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.alpha3.
|
4
|
+
version: 5.0.0.alpha3.snapshot4
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|