-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON Array splitting #77
Conversation
src/main/java/com/teragrep/lsh_01/conversion/DefaultPayload.java
Outdated
Show resolved
Hide resolved
src/main/java/com/teragrep/lsh_01/conversion/RegexConversion.java
Outdated
Show resolved
Hide resolved
@51-code please rebase |
I'll be adding fixes to the config issues today. |
Fixed the Config problems. Refactoring of all configuration in the component should be done, which is a bit out of scope for this PR. I'll create a new issue about that. Stuff left out for now is for example default configurations with a decorator object and reworking the config file / system property mix that it now has. Now the end-to-end tests are still using System properties, so I left that possibility in the new ConversionFactory as well. |
Delete PayloadConfig and include configuration in ConversionFactory that provides the correct object instead Add secondary ctor to RegexConversion Use Collections.singletonList in DefaultPayload, RegexConversion as final class Add object equality test for RegexPayload Move tests to the correct package Move config tests from RegexPayloadTest to PayloadConfigTest and add tests for splitType Refactor split() function in Payload Refactor JsonPayload and RegexPayload to encapsulate Payload instead of String Rename Payload's take() function to message() Implement json_array splitting Refactor Payload objects and regex splitting Remove duplicate tests from RegexSplittingTest Apply spotless Move regex splitting tests to their own file, refactor the tests Change config to allow splitting with json_array Refactor regex splitting to a decorator
Rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
src/main/java/com/teragrep/lsh_01/authentication/BasicAuthentication.java
Outdated
Show resolved
Hide resolved
src/test/java/com/teragrep/lsh_01/MultithreadingEndToEndTest.java
Outdated
Show resolved
Hide resolved
…ed value in assertions
Adds a new splitting option: json_array. Takes HTTP requests with this kind of format:
and converts each of the JSON objects to their own syslog message and sends them forward.
Configuration had changes:
payload.splitEnabled
was changed topayload.splitType
. Valid values are regex, json_array or none. none is the default.payload.splitRegex
was moved topayload.splitType.regex.pattern
.Regex splitting was already supported, but the design was not scalable. Therefore it was refactored as well to allow json_array to be implemented.
There was a problem with Jakarta's way of getting a JSON object as a string. It removes any whitespace from the String representation. This is okay as the content stays the same.
Tests most importantly include:
JsonPayloadTest
for unit tests for the new functionalityJsonSplittingTest
for end-to-end testing the functionality with actual HTTP-requests sent to the component