Extended SQL message field type support #292
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All message types offer two serialisation mechanisms:
assertable()
- creates a human-readable string that can be usefully diffed in test assertionscontent()
- creates the bytes of the message as you'd see on the wireThe
peer( byte[] )
method is the counterpart tocontent()
- 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 abyte[]
.#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 inTypedKVP
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.