logstash-core 2.4.1-java → 5.0.0.alpha1-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.

Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/lib/logstash-core/version.rb +1 -1
  3. data/lib/logstash/agent.rb +124 -411
  4. data/lib/logstash/api/init.ru +31 -0
  5. data/lib/logstash/api/lib/app.rb +40 -0
  6. data/lib/logstash/api/lib/app/command.rb +29 -0
  7. data/lib/logstash/api/lib/app/command_factory.rb +29 -0
  8. data/lib/logstash/api/lib/app/commands/stats/events_command.rb +13 -0
  9. data/lib/logstash/api/lib/app/commands/stats/hotthreads_command.rb +120 -0
  10. data/lib/logstash/api/lib/app/commands/stats/memory_command.rb +25 -0
  11. data/lib/logstash/api/lib/app/commands/system/basicinfo_command.rb +15 -0
  12. data/lib/logstash/api/lib/app/commands/system/plugins_command.rb +28 -0
  13. data/lib/logstash/api/lib/app/modules/node.rb +25 -0
  14. data/lib/logstash/api/lib/app/modules/node_stats.rb +51 -0
  15. data/lib/logstash/api/lib/app/modules/plugins.rb +15 -0
  16. data/lib/logstash/api/lib/app/modules/stats.rb +21 -0
  17. data/lib/logstash/api/lib/app/root.rb +13 -0
  18. data/lib/logstash/api/lib/app/service.rb +61 -0
  19. data/lib/logstash/api/lib/app/stats.rb +56 -0
  20. data/lib/logstash/api/lib/helpers/app_helpers.rb +23 -0
  21. data/lib/logstash/codecs/base.rb +1 -29
  22. data/lib/logstash/config/config_ast.rb +18 -31
  23. data/lib/logstash/config/loader.rb +3 -5
  24. data/lib/logstash/config/mixin.rb +25 -64
  25. data/lib/logstash/filter_delegator.rb +65 -0
  26. data/lib/logstash/inputs/base.rb +1 -1
  27. data/lib/logstash/inputs/metrics.rb +47 -0
  28. data/lib/logstash/instrument/collector.rb +109 -0
  29. data/lib/logstash/instrument/metric.rb +102 -0
  30. data/lib/logstash/instrument/metric_store.rb +228 -0
  31. data/lib/logstash/instrument/metric_type.rb +24 -0
  32. data/lib/logstash/instrument/metric_type/base.rb +35 -0
  33. data/lib/logstash/instrument/metric_type/counter.rb +29 -0
  34. data/lib/logstash/instrument/metric_type/gauge.rb +22 -0
  35. data/lib/logstash/instrument/metric_type/mean.rb +33 -0
  36. data/lib/logstash/instrument/namespaced_metric.rb +54 -0
  37. data/lib/logstash/instrument/null_metric.rb +4 -3
  38. data/lib/logstash/instrument/periodic_poller/base.rb +57 -0
  39. data/lib/logstash/instrument/periodic_poller/jvm.rb +92 -0
  40. data/lib/logstash/instrument/periodic_poller/os.rb +13 -0
  41. data/lib/logstash/instrument/periodic_poller/periodic_poller_observer.rb +19 -0
  42. data/lib/logstash/instrument/periodic_pollers.rb +26 -0
  43. data/lib/logstash/instrument/snapshot.rb +16 -0
  44. data/lib/logstash/json.rb +2 -3
  45. data/lib/logstash/namespace.rb +1 -0
  46. data/lib/logstash/output_delegator.rb +16 -3
  47. data/lib/logstash/outputs/base.rb +1 -32
  48. data/lib/logstash/pipeline.rb +67 -8
  49. data/lib/logstash/plugin.rb +57 -19
  50. data/lib/logstash/runner.rb +348 -84
  51. data/lib/logstash/util.rb +9 -0
  52. data/lib/logstash/util/duration_formatter.rb +15 -0
  53. data/lib/logstash/util/java_version.rb +2 -4
  54. data/lib/logstash/util/loggable.rb +29 -0
  55. data/lib/logstash/version.rb +1 -1
  56. data/lib/logstash/webserver.rb +98 -0
  57. data/locales/en.yml +42 -24
  58. data/logstash-core.gemspec +9 -6
  59. data/spec/api/lib/api/node_spec.rb +64 -0
  60. data/spec/api/lib/api/node_stats_spec.rb +68 -0
  61. data/spec/api/lib/api/plugins_spec.rb +57 -0
  62. data/spec/api/lib/api/root_spec.rb +20 -0
  63. data/spec/api/lib/api/stats_spec.rb +19 -0
  64. data/spec/api/lib/commands/events_spec.rb +17 -0
  65. data/spec/api/lib/commands/jvm_spec.rb +45 -0
  66. data/spec/api/spec_helper.rb +128 -0
  67. data/spec/logstash/agent_spec.rb +62 -169
  68. data/spec/logstash/config/config_ast_spec.rb +2 -47
  69. data/spec/logstash/config/mixin_spec.rb +0 -157
  70. data/spec/logstash/filter_delegator_spec.rb +143 -0
  71. data/spec/logstash/inputs/metrics_spec.rb +52 -0
  72. data/spec/logstash/instrument/collector_spec.rb +49 -0
  73. data/spec/logstash/instrument/metric_spec.rb +110 -0
  74. data/spec/logstash/instrument/metric_store_spec.rb +163 -0
  75. data/spec/logstash/instrument/metric_type/counter_spec.rb +40 -0
  76. data/spec/logstash/instrument/metric_type/gauge_spec.rb +40 -0
  77. data/spec/logstash/instrument/namespaced_metric_spec.rb +25 -0
  78. data/spec/logstash/instrument/null_metric_spec.rb +9 -51
  79. data/spec/logstash/json_spec.rb +14 -0
  80. data/spec/logstash/output_delegator_spec.rb +6 -3
  81. data/spec/logstash/outputs/base_spec.rb +0 -107
  82. data/spec/logstash/pipeline_spec.rb +204 -33
  83. data/spec/logstash/plugin_spec.rb +80 -15
  84. data/spec/logstash/runner_spec.rb +134 -38
  85. data/spec/logstash/shutdown_watcher_spec.rb +0 -1
  86. data/spec/logstash/util/duration_formatter_spec.rb +11 -0
  87. data/spec/logstash/util/java_version_spec.rb +10 -2
  88. data/spec/logstash/util_spec.rb +28 -0
  89. data/spec/support/matchers.rb +30 -0
  90. metadata +154 -20
  91. data/lib/logstash/logging/json.rb +0 -21
  92. data/lib/logstash/special_agent.rb +0 -8
  93. data/lib/logstash/util/safe_uri.rb +0 -50
  94. data/spec/logstash/codecs/base_spec.rb +0 -74
  95. data/spec/static/i18n_spec.rb +0 -25
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 5.0.0.alpha1
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-07 00:00:00.000000000 Z
11
+ date: 2016-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - '='
16
+ - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 2.4.1
19
- name: logstash-core-event
18
+ version: 5.0.0.alpha1
19
+ name: logstash-core-event-java
20
20
  prerelease: false
21
21
  type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.4.1
26
+ version: 5.0.0.alpha1
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
@@ -113,7 +113,7 @@ dependencies:
113
113
  requirements:
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 0.9.2
116
+ version: 1.0.0
117
117
  name: concurrent-ruby
118
118
  prerelease: false
119
119
  type: :runtime
@@ -121,13 +121,53 @@ dependencies:
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 0.9.2
124
+ version: 1.0.0
125
+ - !ruby/object:Gem::Dependency
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '1.4'
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: 1.4.6
134
+ name: sinatra
135
+ prerelease: false
136
+ type: :runtime
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - "~>"
140
+ - !ruby/object:Gem::Version
141
+ version: '1.4'
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: 1.4.6
145
+ - !ruby/object:Gem::Dependency
146
+ requirement: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - "~>"
149
+ - !ruby/object:Gem::Version
150
+ version: '2.16'
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: 2.16.0
154
+ name: puma
155
+ prerelease: false
156
+ type: :runtime
157
+ version_requirements: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - "~>"
160
+ - !ruby/object:Gem::Version
161
+ version: '2.16'
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ version: 2.16.0
125
165
  - !ruby/object:Gem::Dependency
126
166
  requirement: !ruby/object:Gem::Requirement
127
167
  requirements:
128
168
  - - '='
129
169
  - !ruby/object:Gem::Version
130
- version: 0.9.16
170
+ version: 0.9.13
131
171
  name: jruby-openssl
132
172
  prerelease: false
133
173
  type: :runtime
@@ -135,7 +175,35 @@ dependencies:
135
175
  requirements:
136
176
  - - '='
137
177
  - !ruby/object:Gem::Version
138
- version: 0.9.16
178
+ version: 0.9.13
179
+ - !ruby/object:Gem::Dependency
180
+ requirement: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - '='
183
+ - !ruby/object:Gem::Version
184
+ version: 0.10.6
185
+ name: chronic_duration
186
+ prerelease: false
187
+ type: :runtime
188
+ version_requirements: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - '='
191
+ - !ruby/object:Gem::Version
192
+ version: 0.10.6
193
+ - !ruby/object:Gem::Dependency
194
+ requirement: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - "~>"
197
+ - !ruby/object:Gem::Version
198
+ version: 0.3.1
199
+ name: jruby-monitoring
200
+ prerelease: false
201
+ type: :runtime
202
+ version_requirements: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - "~>"
205
+ - !ruby/object:Gem::Version
206
+ version: 0.3.1
139
207
  - !ruby/object:Gem::Dependency
140
208
  requirement: !ruby/object:Gem::Requirement
141
209
  requirements:
@@ -231,6 +299,23 @@ files:
231
299
  - lib/logstash-core/logstash-core.rb
232
300
  - lib/logstash-core/version.rb
233
301
  - lib/logstash/agent.rb
302
+ - lib/logstash/api/init.ru
303
+ - lib/logstash/api/lib/app.rb
304
+ - lib/logstash/api/lib/app/command.rb
305
+ - lib/logstash/api/lib/app/command_factory.rb
306
+ - lib/logstash/api/lib/app/commands/stats/events_command.rb
307
+ - lib/logstash/api/lib/app/commands/stats/hotthreads_command.rb
308
+ - lib/logstash/api/lib/app/commands/stats/memory_command.rb
309
+ - lib/logstash/api/lib/app/commands/system/basicinfo_command.rb
310
+ - lib/logstash/api/lib/app/commands/system/plugins_command.rb
311
+ - lib/logstash/api/lib/app/modules/node.rb
312
+ - lib/logstash/api/lib/app/modules/node_stats.rb
313
+ - lib/logstash/api/lib/app/modules/plugins.rb
314
+ - lib/logstash/api/lib/app/modules/stats.rb
315
+ - lib/logstash/api/lib/app/root.rb
316
+ - lib/logstash/api/lib/app/service.rb
317
+ - lib/logstash/api/lib/app/stats.rb
318
+ - lib/logstash/api/lib/helpers/app_helpers.rb
234
319
  - lib/logstash/codecs/base.rb
235
320
  - lib/logstash/config/config_ast.rb
236
321
  - lib/logstash/config/cpu_core_strategy.rb
@@ -242,14 +327,30 @@ files:
242
327
  - lib/logstash/config/registry.rb
243
328
  - lib/logstash/environment.rb
244
329
  - lib/logstash/errors.rb
330
+ - lib/logstash/filter_delegator.rb
245
331
  - lib/logstash/filters/base.rb
246
332
  - lib/logstash/inputs/base.rb
333
+ - lib/logstash/inputs/metrics.rb
247
334
  - lib/logstash/inputs/threadable.rb
335
+ - lib/logstash/instrument/collector.rb
336
+ - lib/logstash/instrument/metric.rb
337
+ - lib/logstash/instrument/metric_store.rb
338
+ - lib/logstash/instrument/metric_type.rb
339
+ - lib/logstash/instrument/metric_type/base.rb
340
+ - lib/logstash/instrument/metric_type/counter.rb
341
+ - lib/logstash/instrument/metric_type/gauge.rb
342
+ - lib/logstash/instrument/metric_type/mean.rb
343
+ - lib/logstash/instrument/namespaced_metric.rb
248
344
  - lib/logstash/instrument/null_metric.rb
345
+ - lib/logstash/instrument/periodic_poller/base.rb
346
+ - lib/logstash/instrument/periodic_poller/jvm.rb
347
+ - lib/logstash/instrument/periodic_poller/os.rb
348
+ - lib/logstash/instrument/periodic_poller/periodic_poller_observer.rb
349
+ - lib/logstash/instrument/periodic_pollers.rb
350
+ - lib/logstash/instrument/snapshot.rb
249
351
  - lib/logstash/java_integration.rb
250
352
  - lib/logstash/json.rb
251
353
  - lib/logstash/logging.rb
252
- - lib/logstash/logging/json.rb
253
354
  - lib/logstash/namespace.rb
254
355
  - lib/logstash/output_delegator.rb
255
356
  - lib/logstash/outputs/base.rb
@@ -265,37 +366,53 @@ files:
265
366
  - lib/logstash/program.rb
266
367
  - lib/logstash/runner.rb
267
368
  - lib/logstash/shutdown_watcher.rb
268
- - lib/logstash/special_agent.rb
269
369
  - lib/logstash/util.rb
270
370
  - lib/logstash/util/buftok.rb
271
371
  - lib/logstash/util/charset.rb
272
372
  - lib/logstash/util/decorators.rb
273
373
  - lib/logstash/util/defaults_printer.rb
374
+ - lib/logstash/util/duration_formatter.rb
274
375
  - lib/logstash/util/filetools.rb
275
376
  - lib/logstash/util/java_version.rb
377
+ - lib/logstash/util/loggable.rb
276
378
  - lib/logstash/util/password.rb
277
379
  - lib/logstash/util/plugin_version.rb
278
380
  - lib/logstash/util/prctl.rb
279
381
  - lib/logstash/util/retryable.rb
280
- - lib/logstash/util/safe_uri.rb
281
382
  - lib/logstash/util/socket_peer.rb
282
383
  - lib/logstash/util/unicode_trimmer.rb
283
384
  - lib/logstash/util/worker_threads_default_printer.rb
284
385
  - lib/logstash/util/wrapped_synchronous_queue.rb
285
386
  - lib/logstash/version.rb
387
+ - lib/logstash/webserver.rb
286
388
  - locales/en.yml
287
389
  - logstash-core.gemspec
390
+ - spec/api/lib/api/node_spec.rb
391
+ - spec/api/lib/api/node_stats_spec.rb
392
+ - spec/api/lib/api/plugins_spec.rb
393
+ - spec/api/lib/api/root_spec.rb
394
+ - spec/api/lib/api/stats_spec.rb
395
+ - spec/api/lib/commands/events_spec.rb
396
+ - spec/api/lib/commands/jvm_spec.rb
397
+ - spec/api/spec_helper.rb
288
398
  - spec/conditionals_spec.rb
289
399
  - spec/logstash/agent_spec.rb
290
- - spec/logstash/codecs/base_spec.rb
291
400
  - spec/logstash/config/config_ast_spec.rb
292
401
  - spec/logstash/config/cpu_core_strategy_spec.rb
293
402
  - spec/logstash/config/defaults_spec.rb
294
403
  - spec/logstash/config/loader_spec.rb
295
404
  - spec/logstash/config/mixin_spec.rb
296
405
  - spec/logstash/environment_spec.rb
406
+ - spec/logstash/filter_delegator_spec.rb
297
407
  - spec/logstash/filters/base_spec.rb
298
408
  - spec/logstash/inputs/base_spec.rb
409
+ - spec/logstash/inputs/metrics_spec.rb
410
+ - spec/logstash/instrument/collector_spec.rb
411
+ - spec/logstash/instrument/metric_spec.rb
412
+ - spec/logstash/instrument/metric_store_spec.rb
413
+ - spec/logstash/instrument/metric_type/counter_spec.rb
414
+ - spec/logstash/instrument/metric_type/gauge_spec.rb
415
+ - spec/logstash/instrument/namespaced_metric_spec.rb
299
416
  - spec/logstash/instrument/null_metric_spec.rb
300
417
  - spec/logstash/java_integration_spec.rb
301
418
  - spec/logstash/json_spec.rb
@@ -310,13 +427,14 @@ files:
310
427
  - spec/logstash/util/buftok_spec.rb
311
428
  - spec/logstash/util/charset_spec.rb
312
429
  - spec/logstash/util/defaults_printer_spec.rb
430
+ - spec/logstash/util/duration_formatter_spec.rb
313
431
  - spec/logstash/util/java_version_spec.rb
314
432
  - spec/logstash/util/plugin_version_spec.rb
315
433
  - spec/logstash/util/unicode_trimmer_spec.rb
316
434
  - spec/logstash/util/worker_threads_default_printer_spec.rb
317
435
  - spec/logstash/util/wrapped_synchronous_queue_spec.rb
318
436
  - spec/logstash/util_spec.rb
319
- - spec/static/i18n_spec.rb
437
+ - spec/support/matchers.rb
320
438
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
321
439
  licenses:
322
440
  - Apache License (2.0)
@@ -332,9 +450,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
332
450
  version: '0'
333
451
  required_rubygems_version: !ruby/object:Gem::Requirement
334
452
  requirements:
335
- - - ">="
453
+ - - ">"
336
454
  - !ruby/object:Gem::Version
337
- version: '0'
455
+ version: 1.3.1
338
456
  requirements: []
339
457
  rubyforge_project:
340
458
  rubygems_version: 2.4.8
@@ -342,17 +460,32 @@ signing_key:
342
460
  specification_version: 4
343
461
  summary: logstash-core - The core components of logstash
344
462
  test_files:
463
+ - spec/api/lib/api/node_spec.rb
464
+ - spec/api/lib/api/node_stats_spec.rb
465
+ - spec/api/lib/api/plugins_spec.rb
466
+ - spec/api/lib/api/root_spec.rb
467
+ - spec/api/lib/api/stats_spec.rb
468
+ - spec/api/lib/commands/events_spec.rb
469
+ - spec/api/lib/commands/jvm_spec.rb
470
+ - spec/api/spec_helper.rb
345
471
  - spec/conditionals_spec.rb
346
472
  - spec/logstash/agent_spec.rb
347
- - spec/logstash/codecs/base_spec.rb
348
473
  - spec/logstash/config/config_ast_spec.rb
349
474
  - spec/logstash/config/cpu_core_strategy_spec.rb
350
475
  - spec/logstash/config/defaults_spec.rb
351
476
  - spec/logstash/config/loader_spec.rb
352
477
  - spec/logstash/config/mixin_spec.rb
353
478
  - spec/logstash/environment_spec.rb
479
+ - spec/logstash/filter_delegator_spec.rb
354
480
  - spec/logstash/filters/base_spec.rb
355
481
  - spec/logstash/inputs/base_spec.rb
482
+ - spec/logstash/inputs/metrics_spec.rb
483
+ - spec/logstash/instrument/collector_spec.rb
484
+ - spec/logstash/instrument/metric_spec.rb
485
+ - spec/logstash/instrument/metric_store_spec.rb
486
+ - spec/logstash/instrument/metric_type/counter_spec.rb
487
+ - spec/logstash/instrument/metric_type/gauge_spec.rb
488
+ - spec/logstash/instrument/namespaced_metric_spec.rb
356
489
  - spec/logstash/instrument/null_metric_spec.rb
357
490
  - spec/logstash/java_integration_spec.rb
358
491
  - spec/logstash/json_spec.rb
@@ -367,10 +500,11 @@ test_files:
367
500
  - spec/logstash/util/buftok_spec.rb
368
501
  - spec/logstash/util/charset_spec.rb
369
502
  - spec/logstash/util/defaults_printer_spec.rb
503
+ - spec/logstash/util/duration_formatter_spec.rb
370
504
  - spec/logstash/util/java_version_spec.rb
371
505
  - spec/logstash/util/plugin_version_spec.rb
372
506
  - spec/logstash/util/unicode_trimmer_spec.rb
373
507
  - spec/logstash/util/worker_threads_default_printer_spec.rb
374
508
  - spec/logstash/util/wrapped_synchronous_queue_spec.rb
375
509
  - spec/logstash/util_spec.rb
376
- - spec/static/i18n_spec.rb
510
+ - spec/support/matchers.rb
@@ -1,21 +0,0 @@
1
- # encoding: utf-8
2
- require "logstash/namespace"
3
- require "logstash/logging"
4
- require "logstash/json"
5
-
6
- module LogStash; class Logging; class JSON
7
- def initialize(io)
8
- raise ArgumentError, "Expected IO, got #{io.class.name}" unless io.is_a?(IO)
9
-
10
- @io = io
11
- @lock = Mutex.new
12
- end
13
-
14
- def <<(obj)
15
- serialized = LogStash::Json.dump(obj)
16
- @lock.synchronize do
17
- @io.puts(serialized)
18
- @io.flush
19
- end
20
- end
21
- end; end; end
@@ -1,8 +0,0 @@
1
- # encoding: utf-8
2
- require "logstash/agent"
3
-
4
- class LogStash::SpecialAgent < LogStash::Agent
5
- def fetch_config(settings)
6
- Net::HTTP.get(settings["remote.url"])
7
- end
8
- end
@@ -1,50 +0,0 @@
1
- # encoding: utf-8
2
- require "logstash/namespace"
3
- require "logstash/util"
4
-
5
- # This class exists to quietly wrap a password string so that, when printed or
6
- # logged, you don't accidentally print the password itself.
7
- class LogStash::Util::SafeURI
8
- PASS_PLACEHOLDER = "xxxxxx".freeze
9
- HOSTNAME_PORT_REGEX=/\A(?<hostname>([A-Za-z0-9\.\-]+)|\[[0-9A-Fa-f\:]+\])(:(?<port>\d+))?\Z/
10
-
11
- extend Forwardable
12
-
13
- def_delegators :@uri, :coerce, :query=, :route_from, :port=, :default_port, :select, :normalize!, :absolute?, :registry=, :path, :password, :hostname, :merge, :normalize, :host, :component_ary, :userinfo=, :query, :set_opaque, :+, :merge!, :-, :password=, :parser, :port, :set_host, :set_path, :opaque=, :scheme, :fragment=, :set_query, :set_fragment, :userinfo, :hostname=, :set_port, :path=, :registry, :opaque, :route_to, :set_password, :hierarchical?, :set_user, :set_registry, :set_userinfo, :fragment, :component, :user=, :set_scheme, :absolute, :host=, :relative?, :scheme=, :user
14
-
15
- attr_reader :uri
16
-
17
- public
18
- def initialize(arg)
19
- @uri = case arg
20
- when String
21
- arg = "//#{arg}" if HOSTNAME_PORT_REGEX.match(arg)
22
- URI.parse(arg)
23
- when URI
24
- arg
25
- else
26
- raise ArgumentError, "Expected a string or URI, got a #{arg.class} creating a URL"
27
- end
28
- end
29
-
30
- def to_s
31
- sanitized.to_s
32
- end
33
-
34
- def inspect
35
- sanitized.to_s
36
- end
37
-
38
- def sanitized
39
- return uri unless uri.password # nothing to sanitize here!
40
-
41
- safe = uri.clone
42
- safe.password = PASS_PLACEHOLDER
43
- safe
44
- end
45
-
46
- def ==(other)
47
- other.is_a?(::LogStash::Util::SafeURI) ? @uri == other.uri : false
48
- end
49
- end
50
-
@@ -1,74 +0,0 @@
1
- # encoding: utf-8
2
- require "spec_helper"
3
-
4
- DATA_DOUBLE = "data".freeze
5
-
6
- # use a dummy NOOP output to test Outputs::Base
7
- class LogStash::Codecs::NOOPAsync < LogStash::Codecs::Base
8
- attr_reader :last_result
9
- config_name "noop_async"
10
-
11
- def encode(event)
12
- @last_result = @on_event.call(event, DATA_DOUBLE)
13
- end
14
- end
15
-
16
- class LogStash::Codecs::NOOPSync < LogStash::Codecs::Base
17
- attr_reader :last_result
18
- config_name "noop_sync"
19
-
20
- def encode_sync(event)
21
- DATA_DOUBLE
22
- end
23
- end
24
-
25
- class LogStash::Codecs::NOOPMulti < LogStash::Codecs::Base
26
- attr_reader :last_result
27
- config_name "noop_multi"
28
-
29
- def encode_sync(event)
30
- DATA_DOUBLE
31
- end
32
- end
33
-
34
- describe LogStash::Codecs::Base do
35
- let(:params) { {} }
36
- subject(:instance) { klass.new(params.dup) }
37
- let(:event) { double("event") }
38
- let(:encoded_data) { DATA_DOUBLE }
39
- let(:encoded_tuple) { [event, encoded_data] }
40
-
41
- describe "encoding" do
42
- shared_examples "encoder types" do |codec_class|
43
- let(:klass) { codec_class }
44
-
45
- describe "#{codec_class}" do
46
- describe "multi_encode" do
47
- it "should return an array of [event,data] tuples" do
48
- expect(instance.multi_encode([event,event])).to eq([encoded_tuple, encoded_tuple])
49
- end
50
- end
51
-
52
- describe "#encode" do
53
- before do
54
- @result = nil
55
- instance.on_event do |event, data|
56
- @result = [event, data]
57
- end
58
- instance.encode(event)
59
- end
60
-
61
- it "should yield the correct result" do
62
- expect(@result).to eq(encoded_tuple)
63
- end
64
- end
65
- end
66
- end
67
-
68
- include_examples("encoder types", LogStash::Codecs::NOOPAsync)
69
- include_examples("encoder types", LogStash::Codecs::NOOPSync)
70
- include_examples("encoder types", LogStash::Codecs::NOOPMulti)
71
- end
72
- end
73
-
74
-