-
Notifications
You must be signed in to change notification settings - Fork 36
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
RESTEasy Reactive - Test selecting from multiple media types #960
RESTEasy Reactive - Test selecting from multiple media types #960
Conversation
Backport comment - only works with 2.13.6. |
Hello @rsvoboda , @mjurc , @afalhambra I've added you all as reviewers for I don't know who is still available. First one to review win! |
Hmm, I just thought of the way how to make the PR more interesting, give me 30 minutes. |
f3c646c
to
6224ddf
Compare
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.
Slight changes needed, see the comments from review.
I would add some "bad user" cases. For example sending just atom
content type instead of atom+xml
, text/xml-foo
.
http/jaxrs-reactive/src/main/java/io/quarkus/ts/http/jaxrs/reactive/MediaTypeResource.java
Show resolved
Hide resolved
http/jaxrs-reactive/src/test/java/io/quarkus/ts/http/jaxrs/reactive/MediaTypeSelectionIT.java
Outdated
Show resolved
Hide resolved
http/jaxrs-reactive/src/main/java/io/quarkus/ts/http/jaxrs/reactive/MediaTypeResource.java
Show resolved
Hide resolved
http/jaxrs-reactive/src/test/java/io/quarkus/ts/http/jaxrs/reactive/MediaTypeSelectionIT.java
Show resolved
Hide resolved
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.
minor comments, otherwise looks good to me!
Nice work @michalvavrik
http/jaxrs-reactive/src/test/java/io/quarkus/ts/http/jaxrs/reactive/MediaTypeSelectionIT.java
Outdated
Show resolved
Hide resolved
6224ddf
to
15a87c3
Compare
Added suggest "bad user" cases to |
15a87c3
to
f0c4846
Compare
Tests [matching requests to resource methods](https://jakarta.ee/specifications/restful-ws/3.1/jakarta-restful-ws-spec-3.1.html#mapping_requests_to_java_methods) with multiple [media types](https://www.iana.org/assignments/media-types/media-types.xhtml). I combined it with [content negotiation and wildcards](https://www.rfc-editor.org/rfc/rfc9110.html#section-12.4.2) as they are handled by the same [MediaTypeMapper](https://github.com/quarkusio/quarkus/blob/main/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/MediaTypeMapper.java#L38), however I didn't dig every hole (e.g. left out quality values and so on). Main purpose of this PR is to verify quarkusio/quarkus#29732, intention is not to cover all scenarios (f.e. I didn't cover HTTP status 416) as these situations are very rare and users are unlikely to expose multiple endpoints that needs this mapper, it is also not efficient as the mapper is not optimized. succees: `mvn clean verify -Dit.test=MediaTypeSelectionIT -Dquarkus.platform.group-id=io.quarkus.platform -Dquarkus.platform.version=2.13.6.Final` failure: `mvn clean verify -Dit.test=MediaTypeSelectionIT -Dquarkus.platform.group-id=io.quarkus.platform -Dquarkus.platform.version=2.13.5.Final`
f0c4846
to
3889f75
Compare
Fixed 2 comment typos. |
One test failure is in |
Summary
Tests matching requests to resource methods with multiple media types. I combined it with content negotiation and wildcards as they are handled by the same MediaTypeMapper. Main purpose of this PR is to verify quarkusio/quarkus#29732, intention is not to cover all scenarios (f.e. I didn't cover HTTP status 416) as these situations are very rare and users are unlikely to expose multiple endpoints that needs this mapper, it is also not efficient as the mapper is not optimized. There is no point to run added tests on OpenShift (no relation). I also didn't find any related JIRA ticket.
TCKS RESTEasy Reactive tests that are part of Quarkus covers JAX-RS specs media type selection very well, therefore this PR only concentrates on the parts that could have been affected by quarkusio/quarkus#29734.
succees:
mvn clean verify -Dit.test=MediaTypeSelectionIT -Dquarkus.platform.group-id=io.quarkus.platform -Dquarkus.platform.version=2.13.6.Final
failure:
mvn clean verify -Dit.test=MediaTypeSelectionIT -Dquarkus.platform.group-id=io.quarkus.platform -Dquarkus.platform.version=2.13.5.Final
Please select the relevant options.
run tests
phrase in comment)Checklist: