Skip to content

[Backport 8.16] Reimplement LogStash::String setting in Java (#16559) #16961

Merged
andsel merged 1 commit intoelastic:8.16from
andsel:backport_16959_8.16
Jan 27, 2025
Merged

[Backport 8.16] Reimplement LogStash::String setting in Java (#16559) #16961
andsel merged 1 commit intoelastic:8.16from
andsel:backport_16959_8.16

Conversation

@andsel
Copy link
Copy Markdown
Member

@andsel andsel commented Jan 27, 2025

Non clean backport of #16959 from 8.x to 8.16 (which is a non clean backport of #16576 to 8.x)

Changes respect to 8.x:


Reimplements LogStash::Setting::String Ruby setting class into the org.logstash.settings.SettingString and exposes it through java_import as LogStash::Setting::SettingString. Updates the rspec tests in two ways:

  • logging mock is now converted to real Log4J appender that spy log line that are later verified
  • verifies java.lang.IllegalArgumentException instead of ArgumentError is thrown because the kind of exception thrown by Java code, during verification.
  • Fixed the rename of NullableString to SettingNullableString

  • Fixed runner test to use real spy logger from Java Settings instead of mock test double

Release notes

What does this PR do?

Why is it important/What is the impact to the user?

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files (and/or docker env variables)
  • I have added tests that prove my fix is effective or that my feature works

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

…16576) (elastic#16959)

Non clean backport of elastic#16576

----

Reimplements `LogStash::Setting::String` Ruby setting class into the `org.logstash.settings.SettingString` and exposes it through `java_import` as `LogStash::Setting::SettingString`.
Updates the rspec tests in two ways:
- logging mock is now converted to real Log4J appender that spy log line that are later verified
- verifies `java.lang.IllegalArgumentException` instead of `ArgumentError` is thrown because the kind of exception thrown by Java code, during verification.

* Fixed the rename of NullableString to SettingNullableString

* Fixed runner test to use real spy logger from Java Settings instead of mock test double
@elastic-sonarqube
Copy link
Copy Markdown

@elasticmachine
Copy link
Copy Markdown

💚 Build Succeeded

@andsel andsel marked this pull request as ready for review January 27, 2025 16:34
@andsel andsel requested a review from kaisecheng January 27, 2025 16:37
Copy link
Copy Markdown
Contributor

@kaisecheng kaisecheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@andsel andsel merged commit ed38254 into elastic:8.16 Jan 27, 2025
@andsel andsel added the v8.16.4 label Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants