Skip to content
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

Extended SQL message field type support #292

Merged
merged 4 commits into from
Mar 17, 2023
Merged

Extended SQL message field type support #292

merged 4 commits into from
Mar 17, 2023

Conversation

therealryan
Copy link
Contributor

@therealryan therealryan commented Mar 16, 2023

All message types offer two serialisation mechanisms:

  • assertable() - creates a human-readable string that can be usefully diffed in test assertions
  • content() - creates the bytes of the message as you'd see on the wire

The peer( byte[] ) method is the counterpart to content() - it method parses message data from a byte array.

The byte[] representation of messages is pretty crucial lowest-common denominator - you might be dealing with message types where you really, really care about the exact byte values. For most message types it's less important (e.g.: json key/value order isn't significant).

For the SQL messages we're not trying to implement any particular SQL implementation wire protocol, so instead we just use jackson to splat the message data into json.
The problem is that SQL messages are more heavily typed than json is, so the encode/decode roundtrip will, e.g., turn a byte[] into a base64 string, which is really unhelpful if you have a message dependency that expects to consume a byte[].

#157 fixed that specific example, but now I've been writing tests for a system that involves java.sql.Timestamp, so we're back to cover all of the jdbc types. The change is just to add more typed fields in TypedKVP so that value type is preserved in the round-trip through json.

In the process we've had to deal with a chromedriver bug that's just popped up, and followed the recommendation linked from that bug report to provoke the latest headless mode.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@therealryan therealryan merged commit d9f90a7 into main Mar 17, 2023
@therealryan therealryan deleted the sql_byte_format branch March 17, 2023 15:41
@therealryan therealryan added the enhancement New feature or request label Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant