Skip to content

Commit

Permalink
Fix compression test failures as default compressed types changed
Browse files Browse the repository at this point in the history
  • Loading branch information
michalvavrik committed Sep 27, 2024
1 parent 8ef4db7 commit 2dff7f3
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,16 @@ public Uni<String> smallCompressionCustomType() {
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("/small/default_no_compression_json")
public Uni<String> defaultNoCompressionJson() {
@Path("/small/default_compression_json")
public Uni<String> defaultCompressionJson() {
return defaultSmallResponse();
}

@GET
@Consumes(MediaType.APPLICATION_XHTML_XML)
@Produces(MediaType.APPLICATION_XHTML_XML)
@Path("/small/default_compression_xhtml_xml")
public Uni<String> defaultCompressionXhtmlXml() {
return defaultSmallResponse();
}

Expand All @@ -103,8 +111,8 @@ public Uni<String> defaultNoCompressionFormData() {
}

@GET
@Consumes({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN })
@Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN })
@Consumes({ MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@Produces({ MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@Path("/small/mixing_types")
public Uni<String> mixingContentTypes() {
return defaultSmallResponse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ public class CompressionHandlerIT {
BASE_PATH + "/default_compression_text_plain", MediaType.TEXT_PLAIN,
BASE_PATH + "/default_compression_text_html", MediaType.TEXT_HTML,
BASE_PATH + "/default_compression_text_xml", MediaType.TEXT_XML,
BASE_PATH + "/default_compression_json", MediaType.APPLICATION_JSON,
BASE_PATH + "/default_compression_xhtml_xml", MediaType.APPLICATION_XHTML_XML,
BASE_PATH + "/default_compression_text_css", "text/css",
BASE_PATH + "/default_compression_text_js", "text/javascript",
BASE_PATH + "/default_compression_app_js", "application/javascript");

private static final Map<String, String> DEFAULT_SMALL_NO_GZIP_ENDPOINTS = Map.of(
BASE_PATH + "/default_no_compression_json", MediaType.APPLICATION_JSON,
BASE_PATH + "/default_no_compression_xml", MediaType.APPLICATION_XML,
BASE_PATH + "/default_no_compression_form_data", MediaType.MULTIPART_FORM_DATA);

Expand Down Expand Up @@ -64,7 +65,7 @@ public void forceNoCompression() {

@Test
public void mixingTypes() {
assertUnCompressed(BASE_PATH + "/mixing_types", MediaType.APPLICATION_JSON);
assertUnCompressed(BASE_PATH + "/mixing_types", MediaType.APPLICATION_XML);
assertUnCompressed(BASE_PATH + "/mixing_types", MediaType.TEXT_PLAIN);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,15 @@ public void smallCompressionCustomType(RoutingContext rc) {
defaultSmallResponse(rc);
}

@Route(path = "/default_no_compression_json", consumes = { MediaType.APPLICATION_JSON }, produces = {
@Route(path = "/default_compression_json", consumes = { MediaType.APPLICATION_JSON }, produces = {
MediaType.APPLICATION_JSON })
public void defaultNoCompressionJson(RoutingContext rc) {
public void defaultCompressionJson(RoutingContext rc) {
defaultSmallResponse(rc);
}

@Route(path = "/default_compression_xhtml_xml", consumes = { MediaType.APPLICATION_XHTML_XML }, produces = {
MediaType.APPLICATION_XHTML_XML })
public void defaultCompressionXhtmlXml(RoutingContext rc) {
defaultSmallResponse(rc);
}

Expand All @@ -74,8 +80,8 @@ public void defaultNoCompressionFormData(RoutingContext rc) {
defaultSmallResponse(rc);
}

@Route(path = "/mixing_types", consumes = { MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }, produces = {
MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN })
@Route(path = "/mixing_types", consumes = { MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }, produces = {
MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
public void mixingContentTypes(RoutingContext rc) {
defaultSmallResponse(rc);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ public class CompressionHandlerIT {
BASE_PATH + "/default_compression_text_plain", MediaType.TEXT_PLAIN,
BASE_PATH + "/default_compression_text_html", MediaType.TEXT_HTML,
BASE_PATH + "/default_compression_text_xml", MediaType.TEXT_XML,
BASE_PATH + "/default_compression_json", MediaType.APPLICATION_JSON,
BASE_PATH + "/default_compression_xhtml_xml", MediaType.APPLICATION_XHTML_XML,
BASE_PATH + "/default_compression_text_css", "text/css",
BASE_PATH + "/default_compression_text_js", "text/javascript",
BASE_PATH + "/default_compression_app_js", "application/javascript");

private static final Map<String, String> DEFAULT_SMALL_NO_GZIP_ENDPOINTS = Map.of(
BASE_PATH + "/default_no_compression_json", MediaType.APPLICATION_JSON,
BASE_PATH + "/default_no_compression_xml", MediaType.APPLICATION_XML,
BASE_PATH + "/default_no_compression_form_data", MediaType.MULTIPART_FORM_DATA);

Expand Down Expand Up @@ -77,7 +78,7 @@ public void forceNoCompression() {

@Test
public void mixingTypes() {
assertUnCompressed(BASE_PATH + "/mixing_types", MediaType.APPLICATION_JSON);
assertUnCompressed(BASE_PATH + "/mixing_types", MediaType.APPLICATION_XML);
assertUnCompressed(BASE_PATH + "/mixing_types", MediaType.TEXT_PLAIN);
}

Expand Down

0 comments on commit 2dff7f3

Please sign in to comment.