Skip to content

Commit

Permalink
QQE-378 compression Brotli4j tp
Browse files Browse the repository at this point in the history
rm QUARKUS-343.md

tweaks and changes

tweaking test scenarios description

Add explanation introductory about this BRotli4J coverage and add some improvements in testing scope
  • Loading branch information
jcarranzan committed Mar 21, 2024
1 parent 0cd68d6 commit c85c52a
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions QQE-378.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# QQE-378 - HTTP module / REST use-cases - Development topic compression Brotli4j
## Links
Jira : [QQE-378](https://issues.redhat.com/browse/QQE-378)

PR: TODO
## Scope of the testing
Within the Quarkus framework, we have the option to leverage various compression strategies, including Gzip, Snappy, and Brotli4j.
Notably, Brotli4J, being a part of Vert.x, is inherently supported by Quarkus.

Given the absence of existing test coverage for Brotli4J within this context,
we have identified a need to encompass this area within our testing scope.
- Test whether Brotli4J compression library functions correctly within Quarkus, particularly in the context of REST endpoints using the Quarkus REST extension.
- The test coverage will be for JVM, native mode and Openshift.
- To use Brotli4J in quarkus compression we will need:
* Utilize Vert.x http server options to add Brotli4J compressor support.
* Ensure that the server is configured to respect the Accept-Encoding header of `br` to automatically
compress the response body with Brotli4j compression and send it back to the client.
### Test scenarios

- Compression Enabled, Response Compressed and Decompressed
* Set up a Quarkus application with the Brotli4J compression library.
* Enable quarkus http configuration compression `quarkus.http.enable-compression=true`.
* The response is compressed if the Content-Type header is set and the value is a compressed media type as configured specification in the next point.
* Specify the media types supported to compress `quarkus.http.compress-media-types`.
* Note that the REST extension also make it possible to enable/disable compression declaratively using the annotations `io.quarkus.vertx.http.Compressed` and `io.quarkus.vertx.http.UnCompressed`.
* Add the Brotli compressor using `.addCompressor(io.netty.handler.codec.compression.StandardCompressionOptions.brotli())`.
* Send a request to a REST endpoint with the `.header("Accept-Encoding", "br")` and verify that the response is compressed using Brotli.
- Compression Disabled, Response Not Compressed (Uncompressed)
* Disable quarkus http configuration compression `quarkus.http.enable-compression=false`.
* Send a request to a REST endpoint and verify that the response is not compressed.
* The resource method is never compressed if is annotated with `@io.quarkus.vertx.http.Uncompressed`.
- JSON Payloads, Compression Works up to 8192 bytes
* Create a JSON payload of varying sizes up to 8192 bytes.
* Send a request to a REST endpoint with the JSON payload and verify that the response is compressed
using Brotli.
* Create a JSON payload of more of 8192 bytes and check the error.
- Different Media Types, Compression Applied Correctly
* Create a plain text payload.
* Create an XML payload.
* Send a request to a REST endpoint with each payload and verify that the response is compressed using Brotli4J.



## Links to the resources
- [Quarkus - http-reference#http-compression](https://quarkus.io/guides/http-reference#http-compression)
- [Quarkus - reactive-routes#http-compressio](https://quarkus.io/guides/reactive-routes#http-compression)
- [Vert.x - http_compression](https://vertx.io/docs/vertx-core/java/#_http_compression )
- [Vert.x - Handling compressed body](https://vertx.io/docs/vertx-core/java/#_handling_compressed_body)
- [Vert.x - http_compression_algorithms](https://vertx.io/docs/vertx-core/java/#_http_compression_algorithms)

## Contacts
- Tester: Jose Carranza <[email protected]>

0 comments on commit c85c52a

Please sign in to comment.