logstash-core 1.5.6-java → 2.0.0.beta1-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.

Potentially problematic release.


This version of logstash-core might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 723f34de549c83a2114afd134860e9a93cafb310
4
- data.tar.gz: 73fce31c78dc734c8922fe2a38257c43bce819b7
3
+ metadata.gz: 8280b889d663e0310425acfb0f7d75f4e1a024e0
4
+ data.tar.gz: a164ff373d9abbd7189adf99af24bacb3bc91238
5
5
  SHA512:
6
- metadata.gz: cec9fae39b4b2c75bf262b2be5749a65d9e13e534e5483e7f32179fb4528cf0a79eae63f35792f571b364711dd52b616cf40324c579a8a84e1ecb770fa35b6a3
7
- data.tar.gz: e7882a5bef5a3b932c61f0992a68c81f4402ce6f034f4140b435bbb53203cc5ad45da640290a36487f6c4ad831c0caa8ed279c92350be9c70f4b20e5f6f37e13
6
+ metadata.gz: c8b4f816cac02bf178e9b408a28a8178d4b608adbca9d58e0528fe9f9b52b1c0ab37edddd88f83b8f8b9b66de4fed6f9aafe8b4867b7ab5aca48588df8edeccb
7
+ data.tar.gz: 4dd5b531749f62087e2816b5855e4093f8039ad07a5c9753b1a8d2a58f9d3a311b7459f129ed4eaf38c311132c16537c766c6f85556bf438fe5809d924b75173
@@ -7,22 +7,22 @@ require "net/http"
7
7
  LogStash::Environment.load_locale!
8
8
 
9
9
  class LogStash::Agent < Clamp::Command
10
+ DEFAULT_INPUT = "input { stdin { type => stdin } }"
11
+ DEFAULT_OUTPUT = "output { stdout { codec => rubydebug } }"
12
+
10
13
  option ["-f", "--config"], "CONFIG_PATH",
11
14
  I18n.t("logstash.agent.flag.config"),
12
15
  :attribute_name => :config_path
13
16
 
14
17
  option "-e", "CONFIG_STRING",
15
- I18n.t("logstash.agent.flag.config-string"),
18
+ I18n.t("logstash.agent.flag.config-string",
19
+ :default_input => DEFAULT_INPUT, :default_output => DEFAULT_OUTPUT),
16
20
  :default => "", :attribute_name => :config_string
17
21
 
18
22
  option ["-w", "--filterworkers"], "COUNT",
19
23
  I18n.t("logstash.agent.flag.filterworkers"),
20
24
  :attribute_name => :filter_workers, :default => 1, &:to_i
21
25
 
22
- option "--watchdog-timeout", "SECONDS",
23
- I18n.t("logstash.agent.flag.watchdog-timeout"),
24
- :default => 10, &:to_f
25
-
26
26
  option ["-l", "--log"], "FILE",
27
27
  I18n.t("logstash.agent.flag.log"),
28
28
  :attribute_name => :log_file
@@ -102,11 +102,11 @@ class LogStash::Agent < Clamp::Command
102
102
  else
103
103
  # include a default stdin input if no inputs given
104
104
  if @config_string !~ /input *{/
105
- @config_string += "input { stdin { type => stdin } }"
105
+ @config_string += DEFAULT_INPUT
106
106
  end
107
107
  # include a default stdout output if no outputs given
108
108
  if @config_string !~ /output *{/
109
- @config_string += "output { stdout { codec => rubydebug } }"
109
+ @config_string += DEFAULT_OUTPUT
110
110
  end
111
111
  end
112
112
 
data/lib/logstash/json.rb CHANGED
@@ -32,23 +32,15 @@ module LogStash
32
32
  ### JRuby
33
33
 
34
34
  def jruby_load(data, options = {})
35
- # TODO [guyboertje] remove these comments in 5.0
36
- # options[:symbolize_keys] ? JrJackson::Raw.parse_sym(data) : JrJackson::Raw.parse_raw(data)
37
-
38
- JrJackson::Ruby.parse(data, options)
39
-
35
+ options[:symbolize_keys] ? JrJackson::Raw.parse_sym(data) : JrJackson::Raw.parse_raw(data)
40
36
  rescue JrJackson::ParseError => e
41
37
  raise LogStash::Json::ParserError.new(e.message)
42
38
  end
43
39
 
44
40
  def jruby_dump(o)
45
- # TODO [guyboertje] remove these comments in 5.0
46
41
  # test for enumerable here to work around an omission in JrJackson::Json.dump to
47
42
  # also look for Java::JavaUtil::ArrayList, see TODO submit issue
48
- # o.is_a?(Enumerable) ? JrJackson::Raw.generate(o) : JrJackson::Json.dump(o)
49
-
50
- JrJackson::Base.generate(o, {})
51
-
43
+ o.is_a?(Enumerable) ? JrJackson::Raw.generate(o) : JrJackson::Json.dump(o)
52
44
  rescue => e
53
45
  raise LogStash::Json::GeneratorError.new(e.message)
54
46
  end
@@ -61,7 +61,7 @@ class OpenSSL::SSL::SSLContext
61
61
  # For more details see: https://github.com/elastic/logstash/issues/3657
62
62
  remove_const(:DEFAULT_PARAMS) if const_defined?(:DEFAULT_PARAMS)
63
63
  DEFAULT_PARAMS = {
64
- :ssl_version => "TLS",
64
+ :ssl_version => "SSLv23",
65
65
  :ciphers => MOZILLA_INTERMEDIATE_CIPHERS,
66
66
  :options => __default_options # Not a constant because it's computed at start-time.
67
67
  }
@@ -97,18 +97,6 @@ class LogStash::Plugin
97
97
  return "#{self.class.name}: #{@params}"
98
98
  end
99
99
 
100
- protected
101
- def update_watchdog(state)
102
- Thread.current[:watchdog] = Time.now
103
- Thread.current[:watchdog_state] = state
104
- end
105
-
106
- protected
107
- def clear_watchdog
108
- Thread.current[:watchdog] = nil
109
- Thread.current[:watchdog_state] = nil
110
- end
111
-
112
100
  public
113
101
  def inspect
114
102
  if !@params.nil?
@@ -46,7 +46,7 @@ module LogStash
46
46
  position = match.offset(0).last
47
47
  end
48
48
 
49
- if position < template.size
49
+ if position < template.size - 1
50
50
  nodes << StaticNode.new(template[position..-1])
51
51
  end
52
52
 
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  # The version of logstash.
3
- LOGSTASH_VERSION = "1.5.6"
3
+ LOGSTASH_VERSION = "2.0.0-beta1"
4
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.
data/locales/en.yml CHANGED
@@ -128,7 +128,7 @@ en:
128
128
  This is often a permissions issue, or the wrong
129
129
  path was specified?
130
130
  flag:
131
- # Note: Wrap these at 45 chars so they display nicely when clamp emits
131
+ # Note: Wrap these at 55 chars so they display nicely when clamp emits
132
132
  # them in an 80-character terminal
133
133
  config: |+
134
134
  Load the logstash config from a specific file
@@ -141,20 +141,18 @@ en:
141
141
  config-string: |+
142
142
  Use the given string as the configuration
143
143
  data. Same syntax as the config file. If no
144
- input is specified, then 'stdin
145
- { type => stdin }' is the default input.
146
- If no output is specified, then 'stdout
147
- { codec => rubydebug } }' is default output.
144
+ input is specified, then the following is
145
+ used as the default input:
146
+ "%{default_input}"
147
+ and if no output is specified, then the
148
+ following is used as the default output:
149
+ "%{default_output}"
150
+ If you wish to use both defaults, please use
151
+ the empty string for the '-e' flag.
148
152
  configtest: |+
149
- Check configuration, then exit.
153
+ Check configuration for valid syntax and then exit.
150
154
  filterworkers: |+
151
155
  Sets the number of filter workers to run.
152
- watchdog-timeout: |+
153
- Set the filter watchdog timeout (in seconds).
154
- This timeout is used to detect stuck filters;
155
- stuck filters usually symptoms of bugs.
156
- When a filter takes longer than TIMEOUT
157
- seconds, it will cause logstash to abort.
158
156
  log: |+
159
157
  Write logstash internal logs to the given
160
158
  file. Without this flag, logstash will emit
@@ -23,8 +23,6 @@ Gem::Specification.new do |gem|
23
23
  gem.add_runtime_dependency "clamp", "~> 0.6.5" #(MIT license) for command line args/flags
24
24
  gem.add_runtime_dependency "filesize", "0.0.4" #(MIT license) for :bytes config validator
25
25
  gem.add_runtime_dependency "gems", "~> 0.8.3" #(MIT license)
26
- gem.add_runtime_dependency "concurrent-ruby", "0.9.2"
27
- gem.add_runtime_dependency "jruby-openssl", ">= 0.9.11" # Required to support TLSv1.2
28
26
 
29
27
  # TODO(sissel): Treetop 1.5.x doesn't seem to work well, but I haven't
30
28
  # investigated what the cause might be. -Jordan
@@ -39,7 +37,7 @@ Gem::Specification.new do |gem|
39
37
 
40
38
  if RUBY_PLATFORM == 'java'
41
39
  gem.platform = RUBY_PLATFORM
42
- gem.add_runtime_dependency "jrjackson", "~> 0.3.7" #(Apache 2.0 license)
40
+ gem.add_runtime_dependency "jrjackson", "~> 0.2.9" #(Apache 2.0 license)
43
41
  else
44
42
  gem.add_runtime_dependency "oj" #(MIT-style license)
45
43
  end
@@ -50,10 +50,6 @@ describe LogStash::Event do
50
50
  expect(subject.sprintf("%{+%s}")).to eq("1356998400")
51
51
  end
52
52
 
53
- it "should work if there is no fieldref in the string" do
54
- expect(subject.sprintf("bonjour")).to eq("bonjour")
55
- end
56
-
57
53
  it "should raise error when formatting %{+%s} when @timestamp field is missing" do
58
54
  str = "hello-%{+%s}"
59
55
  subj = subject.clone
@@ -104,10 +100,6 @@ describe LogStash::Event do
104
100
  expect(subject.sprintf("%{[j][k3]}")).to eq("{\"4\":\"m\"}")
105
101
  end
106
102
 
107
- it "should not strip last character" do
108
- expect(subject.sprintf("%{type}%{message}|")).to eq("sprintfhello world|")
109
- end
110
-
111
103
  context "#encoding" do
112
104
  it "should return known patterns as UTF-8" do
113
105
  expect(subject.sprintf("%{message}").encoding).to eq(Encoding::UTF_8)
@@ -446,14 +438,14 @@ describe LogStash::Event do
446
438
  end
447
439
  end
448
440
  end
449
- end
450
441
 
451
- context "signal events" do
452
- it "should define the shutdown event" do
453
- # the SHUTDOWN and FLUSH constants are part of the plugin API contract
454
- # if they are changed, all plugins must be updated
455
- expect(LogStash::SHUTDOWN).to be_a(LogStash::ShutdownEvent)
456
- expect(LogStash::FLUSH).to be_a(LogStash::FlushEvent)
442
+ context "signal events" do
443
+ it "should define the shutdown event" do
444
+ # the SHUTDOWN and FLUSH constants are part of the plugin API contract
445
+ # if they are changed, all plugins must be updated
446
+ expect(LogStash::SHUTDOWN).to be_a(LogStash::ShutdownEvent)
447
+ expect(LogStash::FLUSH).to be_a(LogStash::FlushEvent)
448
+ end
457
449
  end
458
450
  end
459
451
 
data/spec/license_spec.rb CHANGED
@@ -16,18 +16,6 @@ describe "Project licenses" do
16
16
  /lgpl/])
17
17
  }
18
18
 
19
- ##
20
- # This licenses are skipped from the license test of many reasons, check
21
- # the exact dependency for detailed information.
22
- ##
23
- let(:skipped_dependencies) do
24
- [
25
- # Skipped because of already included and bundled within JRuby so checking here is redundant.
26
- # Need to take action about jruby licenses to enable again or keep skeeping.
27
- "jruby-openssl"
28
- ]
29
- end
30
-
31
19
  shared_examples "runtime license test" do
32
20
 
33
21
  subject(:gem_name) do |example|
@@ -45,7 +33,6 @@ describe "Project licenses" do
45
33
  it "has runtime dependencies with expected licenses" do
46
34
  spec.runtime_dependencies.map { |dep| dep.to_spec }.each do |runtime_spec|
47
35
  next unless runtime_spec
48
- next if skipped_dependencies.include?(runtime_spec.name)
49
36
  runtime_spec.licenses.each do |license|
50
37
  expect(license.downcase).to match(expected_licenses)
51
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.6
4
+ version: 2.0.0.beta1
5
5
  platform: java
6
6
  authors:
7
7
  - Jordan Sissel
@@ -10,190 +10,162 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-12-07 00:00:00.000000000 Z
13
+ date: 2015-09-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ~>
19
- - !ruby/object:Gem::Version
20
- version: 0.7.0
21
16
  name: cabin
22
- prerelease: false
23
- type: :runtime
24
17
  version_requirements: !ruby/object:Gem::Requirement
25
18
  requirements:
26
19
  - - ~>
27
20
  - !ruby/object:Gem::Version
28
21
  version: 0.7.0
29
- - !ruby/object:Gem::Dependency
30
22
  requirement: !ruby/object:Gem::Requirement
31
23
  requirements:
32
24
  - - ~>
33
25
  - !ruby/object:Gem::Version
34
- version: 0.10.1
35
- name: pry
26
+ version: 0.7.0
36
27
  prerelease: false
37
28
  type: :runtime
29
+ - !ruby/object:Gem::Dependency
30
+ name: pry
38
31
  version_requirements: !ruby/object:Gem::Requirement
39
32
  requirements:
40
33
  - - ~>
41
34
  - !ruby/object:Gem::Version
42
35
  version: 0.10.1
43
- - !ruby/object:Gem::Dependency
44
36
  requirement: !ruby/object:Gem::Requirement
45
37
  requirements:
46
38
  - - ~>
47
39
  - !ruby/object:Gem::Version
48
- version: 0.0.19
49
- name: stud
40
+ version: 0.10.1
50
41
  prerelease: false
51
42
  type: :runtime
43
+ - !ruby/object:Gem::Dependency
44
+ name: stud
52
45
  version_requirements: !ruby/object:Gem::Requirement
53
46
  requirements:
54
47
  - - ~>
55
48
  - !ruby/object:Gem::Version
56
49
  version: 0.0.19
57
- - !ruby/object:Gem::Dependency
58
50
  requirement: !ruby/object:Gem::Requirement
59
51
  requirements:
60
52
  - - ~>
61
53
  - !ruby/object:Gem::Version
62
- version: 0.6.5
63
- name: clamp
54
+ version: 0.0.19
64
55
  prerelease: false
65
56
  type: :runtime
57
+ - !ruby/object:Gem::Dependency
58
+ name: clamp
66
59
  version_requirements: !ruby/object:Gem::Requirement
67
60
  requirements:
68
61
  - - ~>
69
62
  - !ruby/object:Gem::Version
70
63
  version: 0.6.5
71
- - !ruby/object:Gem::Dependency
72
64
  requirement: !ruby/object:Gem::Requirement
73
65
  requirements:
74
- - - '='
66
+ - - ~>
75
67
  - !ruby/object:Gem::Version
76
- version: 0.0.4
77
- name: filesize
68
+ version: 0.6.5
78
69
  prerelease: false
79
70
  type: :runtime
71
+ - !ruby/object:Gem::Dependency
72
+ name: filesize
80
73
  version_requirements: !ruby/object:Gem::Requirement
81
74
  requirements:
82
75
  - - '='
83
76
  - !ruby/object:Gem::Version
84
77
  version: 0.0.4
85
- - !ruby/object:Gem::Dependency
86
78
  requirement: !ruby/object:Gem::Requirement
87
79
  requirements:
88
- - - ~>
80
+ - - '='
89
81
  - !ruby/object:Gem::Version
90
- version: 0.8.3
91
- name: gems
82
+ version: 0.0.4
92
83
  prerelease: false
93
84
  type: :runtime
85
+ - !ruby/object:Gem::Dependency
86
+ name: gems
94
87
  version_requirements: !ruby/object:Gem::Requirement
95
88
  requirements:
96
89
  - - ~>
97
90
  - !ruby/object:Gem::Version
98
91
  version: 0.8.3
99
- - !ruby/object:Gem::Dependency
100
92
  requirement: !ruby/object:Gem::Requirement
101
93
  requirements:
102
- - - '='
94
+ - - ~>
103
95
  - !ruby/object:Gem::Version
104
- version: 0.9.2
105
- name: concurrent-ruby
96
+ version: 0.8.3
106
97
  prerelease: false
107
98
  type: :runtime
108
- version_requirements: !ruby/object:Gem::Requirement
109
- requirements:
110
- - - '='
111
- - !ruby/object:Gem::Version
112
- version: 0.9.2
113
99
  - !ruby/object:Gem::Dependency
114
- requirement: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - '>='
117
- - !ruby/object:Gem::Version
118
- version: 0.9.11
119
- name: jruby-openssl
120
- prerelease: false
121
- type: :runtime
100
+ name: treetop
122
101
  version_requirements: !ruby/object:Gem::Requirement
123
102
  requirements:
124
- - - '>='
103
+ - - <
125
104
  - !ruby/object:Gem::Version
126
- version: 0.9.11
127
- - !ruby/object:Gem::Dependency
105
+ version: 1.5.0
128
106
  requirement: !ruby/object:Gem::Requirement
129
107
  requirements:
130
108
  - - <
131
109
  - !ruby/object:Gem::Version
132
110
  version: 1.5.0
133
- name: treetop
134
111
  prerelease: false
135
112
  type: :runtime
113
+ - !ruby/object:Gem::Dependency
114
+ name: i18n
136
115
  version_requirements: !ruby/object:Gem::Requirement
137
116
  requirements:
138
- - - <
117
+ - - '='
139
118
  - !ruby/object:Gem::Version
140
- version: 1.5.0
141
- - !ruby/object:Gem::Dependency
119
+ version: 0.6.9
142
120
  requirement: !ruby/object:Gem::Requirement
143
121
  requirements:
144
122
  - - '='
145
123
  - !ruby/object:Gem::Version
146
124
  version: 0.6.9
147
- name: i18n
148
125
  prerelease: false
149
126
  type: :runtime
127
+ - !ruby/object:Gem::Dependency
128
+ name: minitar
150
129
  version_requirements: !ruby/object:Gem::Requirement
151
130
  requirements:
152
- - - '='
131
+ - - ~>
153
132
  - !ruby/object:Gem::Version
154
- version: 0.6.9
155
- - !ruby/object:Gem::Dependency
133
+ version: 0.5.4
156
134
  requirement: !ruby/object:Gem::Requirement
157
135
  requirements:
158
136
  - - ~>
159
137
  - !ruby/object:Gem::Version
160
138
  version: 0.5.4
161
- name: minitar
162
139
  prerelease: false
163
140
  type: :runtime
141
+ - !ruby/object:Gem::Dependency
142
+ name: thread_safe
164
143
  version_requirements: !ruby/object:Gem::Requirement
165
144
  requirements:
166
145
  - - ~>
167
146
  - !ruby/object:Gem::Version
168
- version: 0.5.4
169
- - !ruby/object:Gem::Dependency
147
+ version: 0.3.5
170
148
  requirement: !ruby/object:Gem::Requirement
171
149
  requirements:
172
150
  - - ~>
173
151
  - !ruby/object:Gem::Version
174
152
  version: 0.3.5
175
- name: thread_safe
176
153
  prerelease: false
177
154
  type: :runtime
155
+ - !ruby/object:Gem::Dependency
156
+ name: jrjackson
178
157
  version_requirements: !ruby/object:Gem::Requirement
179
158
  requirements:
180
159
  - - ~>
181
160
  - !ruby/object:Gem::Version
182
- version: 0.3.5
183
- - !ruby/object:Gem::Dependency
161
+ version: 0.2.9
184
162
  requirement: !ruby/object:Gem::Requirement
185
163
  requirements:
186
164
  - - ~>
187
165
  - !ruby/object:Gem::Version
188
- version: 0.3.7
189
- name: jrjackson
166
+ version: 0.2.9
190
167
  prerelease: false
191
168
  type: :runtime
192
- version_requirements: !ruby/object:Gem::Requirement
193
- requirements:
194
- - - ~>
195
- - !ruby/object:Gem::Version
196
- version: 0.3.7
197
169
  description: The core components of logstash, the scalable log and event management tool
198
170
  email:
199
171
  - jls@semicomplete.com
@@ -236,7 +208,6 @@ files:
236
208
  - lib/logstash/runner.rb
237
209
  - lib/logstash/sized_queue.rb
238
210
  - lib/logstash/string_interpolation.rb
239
- - lib/logstash/threadwatchdog.rb
240
211
  - lib/logstash/timestamp.rb
241
212
  - lib/logstash/util.rb
242
213
  - lib/logstash/util/accessors.rb
@@ -277,7 +248,6 @@ files:
277
248
  - spec/pluginmanager/util_spec.rb
278
249
  - spec/spec_helper.rb
279
250
  - spec/util/accessors_spec.rb
280
- - spec/util/buftok_spec.rb
281
251
  - spec/util/charset_spec.rb
282
252
  - spec/util/gemfile_spec.rb
283
253
  - spec/util/java_version_spec.rb
@@ -300,12 +270,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
300
270
  version: '0'
301
271
  required_rubygems_version: !ruby/object:Gem::Requirement
302
272
  requirements:
303
- - - '>='
273
+ - - '>'
304
274
  - !ruby/object:Gem::Version
305
- version: '0'
275
+ version: 1.3.1
306
276
  requirements: []
307
277
  rubyforge_project:
308
- rubygems_version: 2.4.5
278
+ rubygems_version: 2.2.2
309
279
  signing_key:
310
280
  specification_version: 4
311
281
  summary: logstash-core - The core components of logstash
@@ -331,7 +301,6 @@ test_files:
331
301
  - spec/pluginmanager/util_spec.rb
332
302
  - spec/spec_helper.rb
333
303
  - spec/util/accessors_spec.rb
334
- - spec/util/buftok_spec.rb
335
304
  - spec/util/charset_spec.rb
336
305
  - spec/util/gemfile_spec.rb
337
306
  - spec/util/java_version_spec.rb
@@ -1,37 +0,0 @@
1
- # encoding: utf-8
2
- require "logstash/namespace"
3
- require "logstash/logging"
4
-
5
- class LogStash::ThreadWatchdog
6
- attr_accessor :logger
7
- attr_accessor :threads
8
-
9
- class TimeoutError < StandardError; end
10
-
11
- public
12
- def initialize(threads, watchdog_timeout=10)
13
- @threads = threads
14
- @watchdog_timeout = watchdog_timeout
15
- end # def initialize
16
-
17
- public
18
- def watch
19
- while sleep(1)
20
- cutoff = Time.now - @watchdog_timeout
21
- @threads.each do |t|
22
- watchdog = t[:watchdog]
23
- if watchdog and watchdog <= cutoff
24
- age = Time.now - watchdog
25
- @logger.fatal("thread watchdog timeout",
26
- :thread => t,
27
- :backtrace => t.backtrace,
28
- :thread_watchdog => watchdog,
29
- :age => age,
30
- :cutoff => @watchdog_timeout,
31
- :state => t[:watchdog_state])
32
- raise TimeoutError, "watchdog timeout"
33
- end
34
- end
35
- end
36
- end # def watch
37
- end # class LogStash::ThreadWatchdog
@@ -1,31 +0,0 @@
1
- # encoding: utf-8
2
- require "spec_helper"
3
- require "logstash/util/buftok"
4
-
5
- describe FileWatch::BufferedTokenizer do
6
-
7
- subject { FileWatch::BufferedTokenizer.new }
8
-
9
- it "should tokenize a single token" do
10
- expect(subject.extract("foo\n")).to eq(["foo"])
11
- end
12
-
13
- it "should merge multiple token" do
14
- expect(subject.extract("foo")).to eq([])
15
- expect(subject.extract("bar\n")).to eq(["foobar"])
16
- end
17
-
18
- it "should tokenize multiple token" do
19
- expect(subject.extract("foo\nbar\n")).to eq(["foo", "bar"])
20
- end
21
-
22
- it "should ignore empty payload" do
23
- expect(subject.extract("")).to eq([])
24
- expect(subject.extract("foo\nbar")).to eq(["foo"])
25
- end
26
-
27
- it "should tokenize empty payload with newline" do
28
- expect(subject.extract("\n")).to eq([""])
29
- expect(subject.extract("\n\n\n")).to eq(["", "", ""])
30
- end
31
- end