Modified ProtoCloudEventData to always return a
Protobuf Any object - this ensures it is coherent with
the Protobuf CloudEvent format specification.
It remains possible to wrap any Protobuf 'Message'
object directly (which includes an 'Any') as a
convienience to reduce application code.
Signed-off-by: Jem Day <Jem.Day@cliffhanger.com>
Fixed issue where mutiple serialize/de-serialize operations
would result in corrupted data if the data was a protobuf
message object.
- Introduced equality checks for ProtoDataWrapper.
- Refactored and cleaned up data-wrappers.
Fixes https://github.com/cloudevents/sdk-java/issues/523
Signed-off-by: Jem Day <Jem.Day@cliffhanger.com>
Now checks if `datacontenttype` matches the regex:
`^(application|text)\/([a-zA-Z]+\+)?json$")`
This regex support
`application/foobar+json`
or standard
```
application/json
text/json
```
Signed-off-by: Isaac Aymerich <isaac.aymerich@roche.com>
- Move content-type introspection in a separate support class.
- Add unit tests to ensure introspection is correct.
Signed-off-by: Day, Jeremy(jday) <jday@paypal.com>
* formats: Add support for protobuf format
Adds support for the Protocol Buffer CloudEvent format defined at
https://github.com/cloudevents/spec/blob/v1.0.1/protobuf-format.md.
Compiles the Proto3 file taken from the spec repo into generated Java
protobuf classes. These classes are used to convert the SDK
representation of a CloudEvent to and from the protobuf format.
Signed-off-by: Erik Paulson <epaulson@apexclearing.com>
* Address feedback in PR #348
- Adds service file for event format autoloading
- Addresses some field access issues
- Treats unset fields as omitted
- Updates and adds documentation
Signed-off-by: Erik Paulson <epaulson@apexclearing.com>
* Add missing attribute writer methods for CloudEventBuilders
Without these methods, binary attributes are interpreted as
Strings instead of byte[].
Signed-off-by: Erik Paulson <epaulson@apexclearing.com>
* Added test data files.
Signed-off-by: Day, Jeremy(jday) <jday@paypal.com>
* - Now executes tests related to wire-format files.
- Supports V03 dialect
Signed-off-by: Day, Jeremy(jday) <jday@paypal.com>
* - Added new ProtoCloudEventData construct to support proto message based data.
- Added some more test files.
- When the PR related to binary context attributes is merged we can extend the
test use-cases appropriately.
Signed-off-by: Day, Jeremy(jday) <jday@paypal.com>
* - Merged changes related to binary context attributes.
- Modified proto format to process binary context attributes
- Added CloudEventData varient to hold proto messages (requires tests)
- Will add further tests once the failing test is addressed
Signed-off-by: Day, Jeremy(jday) <jday@paypal.com>
* Added test for protobuf data
Signed-off-by: Day, Jeremy(jday) <jday@paypal.com>
* Indicate that v0.3 events are supported by Protobuf Format
Even though the protobuf spec came out for v1, the attributes are
fairly easily mapped back to v0.3.
Signed-off-by: Erik Paulson <epaulson@apexclearing.com>
* Add missing comments; fix formatting; minor refactoring
Signed-off-by: Erik Paulson <epaulson@apexclearing.com>
* Create a full Protobuf CloudEventWriter
Converts the ProtoContextWriter class to a ProtoCloudEventWriter class
and modifies the format code to use it instead of manually writing
data to the output.
Signed-off-by: Erik Paulson <epaulson@apexclearing.com>
* - Addressed Review Comments.
- Introduced a default ProtoDataWrapper
- Tests updated.
Signed-off-by: Day, Jeremy(jday) <jday@paypal.com>
* Address Review Comments
Signed-off-by: Day, Jeremy(jday) <jday@paypal.com>
* Test cleanup and timezone testing
This does some tweaking to tests by moving to using assertj and fixing
whitespace. It also adds a new test to ensure that timezones are handled
correctly.
Signed-off-by: Erik Paulson <epaulson@apexclearing.com>
* Formatting cleanup
- Remove unecessary whitespace
- Fix Javadocs
- Delete unused code
Signed-off-by: Erik Paulson <epaulson@apexclearing.com>
Co-authored-by: Day, Jeremy(jday) <jday@paypal.com>
* Introduced support for Binary attribute types.
Added test data example
Added unit-test for JSON Format
Signed-off-by: Day, Jeremy(jday) <jday@paypal.com>
* documentation tweak
Signed-off-by: Day, Jeremy(jday) <jday@paypal.com>
* - Addressed review comment.
- Removed the withContextAttribute(string, Integer).
- This should be a seperate PR, was mixed-in by accident.
Signed-off-by: Day, Jeremy(jday) <jday@paypal.com>
* Address review comments
Signed-off-by: Day, Jeremy(jday) <jday@paypal.com>
* fix: prevent NPE on deserializing JSON containing invalid `specversion` value
Signed-off-by: Mark Scott <mark@codebrewer.org>
* refactor: move test per PR review comment
Signed-off-by: Mark Scott <mark@codebrewer.org>
* Jackson javadocs
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Reverted public constructor and deprecated it
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Halfway through it
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* That should be it
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Prettier run
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Removed code sample
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Suggestions + fixed up the mess made by prettier
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Suggestion
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Messing up stuff
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Collapse CloudEventAttributesWriter and CloudEventAttributesWriter into CloudEventContextWriter
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Rebase fix
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Add the method `BytesCloudEventData#wrap` to be consistent with #289
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Removed all usages of constructor
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Fix poms warnings
Bumped javadoc plugin to latest version
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Dumped back the javadoc version
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Add a static method to wrap a pojo in PojoCloudEventData
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* WIP
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Cleanup
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
* Reverted BytesCloudEventData and moved to a separate PR
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>