From 3aabd4c1ab6c46c59ef2599f79b87927583db3fc Mon Sep 17 00:00:00 2001 From: Rolfe Dlugy-Hegwer Date: Tue, 26 Nov 2024 12:28:46 -0500 Subject: [PATCH 1/7] [WIP] Copyedit content for CORS guide --- .../vertx/http/runtime/cors/CORSConfig.java | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSConfig.java index 253ad10984b94..e0ff22093891a 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSConfig.java @@ -13,65 +13,66 @@ public class CORSConfig { /** - * Origins allowed for CORS + * The origins allowed for CORS. * - * Comma separated list of valid URLs, e.g.: http://www.quarkus.io,http://localhost:3000 - * In case an entry of the list is surrounded by forward slashes, - * it is interpreted as a regular expression. + * A comma-separated list of valid URLs, such as `http://www.quarkus.io,http://localhost:3000`. + * URLs enclosed in forward slashes are interpreted as regular expressions. */ @ConfigItem @ConvertWith(TrimmedStringConverter.class) public Optional> origins = Optional.empty(); /** - * HTTP methods allowed for CORS + * The HTTP methods allowed for CORS requests. * - * Comma separated list of valid methods. ex: GET,PUT,POST - * The filter allows any method if this is not set. + * A comma-separated list of valid HTTP methods, such as `GET,PUT,POST`. + * If not set, the filter allows any HTTP method by default. * - * default: returns any requested method as valid + * Default: Any HTTP request method is allowed. */ @ConfigItem @ConvertWith(TrimmedStringConverter.class) public Optional> methods = Optional.empty(); /** - * HTTP headers allowed for CORS + * The HTTP headers allowed for CORS requests. * - * Comma separated list of valid headers. ex: X-Custom,Content-Disposition - * The filter allows any header if this is not set. + * A comma-separated list of valid headers, such as `X-Custom,Content-Disposition`. + * If not set, the filter allows any header by default. * - * default: returns any requested header as valid + * Default: Any HTTP request header is allowed. */ @ConfigItem @ConvertWith(TrimmedStringConverter.class) public Optional> headers = Optional.empty(); /** - * HTTP headers exposed in CORS + * The HTTP headers exposed in CORS responses. * - * Comma separated list of valid headers. ex: X-Custom,Content-Disposition + * A comma-separated list of headers to expose, such as `X-Custom,Content-Disposition`. * - * default: empty + * Default: No headers are exposed. */ @ConfigItem @ConvertWith(TrimmedStringConverter.class) public Optional> exposedHeaders = Optional.empty(); /** - * The `Access-Control-Max-Age` response header value indicating - * how long the results of a pre-flight request can be cached. + * The `Access-Control-Max-Age` response header value in {@link java.time.Duration} format. + * + * Informs the browser how long it can cache the results of a preflight request. */ @ConfigItem public Optional accessControlMaxAge = Optional.empty(); /** - * The `Access-Control-Allow-Credentials` header is used to tell the - * browsers to expose the response to front-end JavaScript code when - * the request’s credentials mode Request.credentials is “include”. + * The `Access-Control-Allow-Credentials` response header. + * + * Tells browsers if front-end JavaScript can be allowed to access credentials when the request's credentials mode, + * `Request.credentials`, is set to `include`. * - * The value of this header will default to `true` if `quarkus.http.cors.origins` property is set and - * there is a match with the precise `Origin` header. + * Default: `true` if the `quarkus.http.cors.origins` property is set + * and matches the precise `Origin` header value. */ @ConfigItem public Optional accessControlAllowCredentials = Optional.empty(); From db8318197739136cc8a2b033f13faf4ae5160a4f Mon Sep 17 00:00:00 2001 From: ogomezdi Date: Wed, 16 Oct 2024 09:50:33 +0200 Subject: [PATCH 2/7] Qute: add JsonEscaper - fixes #43369 --- docs/src/main/asciidoc/qute-reference.adoc | 15 +++- .../quarkus/qute/deployment/EscapingTest.java | 10 ++- .../quarkus/qute/runtime/EngineProducer.java | 4 ++ .../qute/CharReplacementResultMapper.java | 45 ++++++++++++ .../java/io/quarkus/qute/HtmlEscaper.java | 38 +--------- .../java/io/quarkus/qute/JsonEscaper.java | 50 +++++++++++++ .../java/io/quarkus/qute/ResultMapper.java | 2 +- .../java/io/quarkus/qute/JsonEscaperTest.java | 70 +++++++++++++++++++ 8 files changed, 195 insertions(+), 39 deletions(-) create mode 100644 independent-projects/qute/core/src/main/java/io/quarkus/qute/CharReplacementResultMapper.java create mode 100644 independent-projects/qute/core/src/main/java/io/quarkus/qute/JsonEscaper.java create mode 100644 independent-projects/qute/core/src/test/java/io/quarkus/qute/JsonEscaperTest.java diff --git a/docs/src/main/asciidoc/qute-reference.adoc b/docs/src/main/asciidoc/qute-reference.adoc index 4b62a037bd432..f0f204fb9f4fa 100644 --- a/docs/src/main/asciidoc/qute-reference.adoc +++ b/docs/src/main/asciidoc/qute-reference.adoc @@ -457,7 +457,8 @@ First two elements: {#each myArray.take(2)}{it}{/each} <5> ==== Character Escapes -For HTML and XML templates the `'`, `"`, `<`, `>`, `&` characters are escaped by default if a template variant is set. +For HTML and XML templates the `'`, `"`, `<`, `>`, `&` characters are escaped by default if a corresponding template variant is set. +For JSON templates the `"`, `\` and the control characters (`U+0000` through `U+001F`) are escaped by default if a corresponding template variant is set. NOTE: In Quarkus, a variant is set automatically for templates located in the `src/main/resources/templates`. By default, the `java.net.URLConnection#getFileNameMap()` is used to determine the content-type of a template file. The additional map of suffixes to content types can be set via `quarkus.qute.content-types`. @@ -466,6 +467,7 @@ If you need to render the unescaped value: 1. Either use the `raw` or `safe` properties implemented as extension methods of the `java.lang.Object`, 2. Or wrap the `String` value in a `io.quarkus.qute.RawString`. +.HTML Example [source,html] ---- @@ -478,6 +480,17 @@ If you need to render the unescaped value: TIP: By default, a template with one of the following content types is escaped: `text/html`, `text/xml`, `application/xml` and `application/xhtml+xml`. However, it's possible to extend this list via the `quarkus.qute.escape-content-types` configuration property. +.JSON Example +[source,json] +---- +{ + "id": "{valueId.raw}", <1> + "name": "{valueName}" <2> +} +---- +<1> `valueId` that resolves to `\nA12345` will be rendered as `\nA12345` that will result in an invalid JSON Object because of the new line inserted inside the string value for the attribute `id`. +<2> `valueName` that resolves to `\tExpressions \n Escapes` will be rendered as `\\tExpressions \\n Escapes`. + [[virtual_methods]] ==== Virtual Methods diff --git a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/EscapingTest.java b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/EscapingTest.java index a9d4564479892..4e6032fb159f9 100644 --- a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/EscapingTest.java +++ b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/EscapingTest.java @@ -30,7 +30,9 @@ public class EscapingTest { .addAsResource(new StringAsset("{text} {other} {text.raw} {text.safe} {item.foo}"), "templates/bar.txt") .addAsResource(new StringAsset("{@java.lang.String text}{text} {text.raw} {text.safe}"), - "templates/validation.html")) + "templates/validation.html") + .addAsResource(new StringAsset("{ \"strVal\":\"{strVal}\", \"intVal\":{intVal} }"), + "templates/val.json")) .overrideConfigKey("quarkus.qute.content-types.xhtml", "application/xhtml+xml") .overrideConfigKey("quarkus.qute.suffixes", "qute.html,qute.txt,html,txt,xhtml"); @@ -58,6 +60,12 @@ public void testEscaper() { item.data("item", new Item()).render()); } + @Test + public void testJsonEscaper() { + assertEquals("{ \"strVal\":\"\\t Foo \\u000b\", \"intVal\":42 }", + engine.getTemplate("val.json").data("strVal", "\t Foo \u000B").data("intVal", 42).render()); + } + @Test public void testValidation() { assertEquals("<div>
", diff --git a/extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/EngineProducer.java b/extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/EngineProducer.java index cce813dff6155..aeba46a8cd3d8 100644 --- a/extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/EngineProducer.java +++ b/extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/EngineProducer.java @@ -40,6 +40,7 @@ import io.quarkus.qute.EvalContext; import io.quarkus.qute.Expression; import io.quarkus.qute.HtmlEscaper; +import io.quarkus.qute.JsonEscaper; import io.quarkus.qute.NamespaceResolver; import io.quarkus.qute.ParserHook; import io.quarkus.qute.Qute; @@ -157,6 +158,9 @@ public EngineProducer(QuteContext context, QuteConfig config, QuteRuntimeConfig // Escape some characters for HTML/XML templates builder.addResultMapper(new HtmlEscaper(List.copyOf(config.escapeContentTypes))); + // Escape some characters for JSON templates + builder.addResultMapper(new JsonEscaper()); + // Fallback reflection resolver builder.addValueResolver(new ReflectionValueResolver()); diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/CharReplacementResultMapper.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/CharReplacementResultMapper.java new file mode 100644 index 0000000000000..04499e72a8da5 --- /dev/null +++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/CharReplacementResultMapper.java @@ -0,0 +1,45 @@ +package io.quarkus.qute; + +/** + * Makes it possible to replace chars from Basic Multilingual Plane (BMP). + * + * @see Character#isBmpCodePoint(int) + */ +abstract class CharReplacementResultMapper implements ResultMapper { + + @Override + public String map(Object result, Expression expression) { + return escape(result.toString()); + } + + String escape(CharSequence value) { + if (value.length() == 0) { + return value.toString(); + } + for (int i = 0; i < value.length(); i++) { + String replacement = replacementFor(value.charAt(i)); + if (replacement != null) { + // In most cases we will not need to escape the value at all + return doEscape(value, i, new StringBuilder(value.subSequence(0, i)).append(replacement)); + } + } + return value.toString(); + } + + private String doEscape(CharSequence value, int index, StringBuilder builder) { + int length = value.length(); + while (++index < length) { + char c = value.charAt(index); + String replacement = replacementFor(c); + if (replacement != null) { + builder.append(replacement); + } else { + builder.append(c); + } + } + return builder.toString(); + } + + protected abstract String replacementFor(char c); + +} diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/HtmlEscaper.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/HtmlEscaper.java index 194720231f85e..ff21a0742cf7a 100644 --- a/independent-projects/qute/core/src/main/java/io/quarkus/qute/HtmlEscaper.java +++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/HtmlEscaper.java @@ -1,12 +1,11 @@ package io.quarkus.qute; import java.util.List; -import java.util.Objects; import java.util.Optional; import io.quarkus.qute.TemplateNode.Origin; -public class HtmlEscaper implements ResultMapper { +public class HtmlEscaper extends CharReplacementResultMapper { private final List escapedContentTypes; @@ -26,25 +25,6 @@ public boolean appliesTo(Origin origin, Object result) { return false; } - @Override - public String map(Object result, Expression expression) { - return escape(result.toString()); - } - - String escape(CharSequence value) { - if (Objects.requireNonNull(value).length() == 0) { - return value.toString(); - } - for (int i = 0; i < value.length(); i++) { - String replacement = replacementFor(value.charAt(i)); - if (replacement != null) { - // In most cases we will not need to escape the value at all - return doEscape(value, i, new StringBuilder(value.subSequence(0, i)).append(replacement)); - } - } - return value.toString(); - } - private boolean requiresDefaultEscaping(Variant variant) { String contentType = variant.getContentType(); if (contentType == null) { @@ -58,21 +38,7 @@ private boolean requiresDefaultEscaping(Variant variant) { return false; } - private String doEscape(CharSequence value, int index, StringBuilder builder) { - int length = value.length(); - while (++index < length) { - char c = value.charAt(index); - String replacement = replacementFor(c); - if (replacement != null) { - builder.append(replacement); - } else { - builder.append(c); - } - } - return builder.toString(); - } - - private String replacementFor(char c) { + protected String replacementFor(char c) { switch (c) { case '"': return """; diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/JsonEscaper.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/JsonEscaper.java new file mode 100644 index 0000000000000..662adc30c8797 --- /dev/null +++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/JsonEscaper.java @@ -0,0 +1,50 @@ +package io.quarkus.qute; + +import java.util.Optional; + +import io.quarkus.qute.TemplateNode.Origin; + +public class JsonEscaper extends CharReplacementResultMapper { + + @Override + public boolean appliesTo(Origin origin, Object result) { + if (result instanceof RawString) { + return false; + } + Optional variant = origin.getVariant(); + if (variant.isPresent()) { + String contentType = variant.get().getContentType(); + if (contentType != null) { + return contentType.startsWith(Variant.APPLICATION_JSON); + } + } + return false; + } + + protected String replacementFor(char c) { + // All Unicode characters may be placed within the quotation marks, + // except for the characters that MUST be escaped: quotation mark, + // reverse solidus, and the control characters (U+0000 through U+001F). + // See also https://datatracker.ietf.org/doc/html/rfc8259#autoid-10 + switch (c) { + case '"': + return "\\\""; + case '\\': + return "\\\\"; + case '\r': + return "\\r"; + case '\b': + return "\\b"; + case '\n': + return "\\n"; + case '\t': + return "\\t"; + case '\f': + return "\\f"; + case '/': + return "\\/"; + default: + return c < 32 ? String.format("\\u%04x", (int) c) : null; + } + } +} \ No newline at end of file diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/ResultMapper.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/ResultMapper.java index fcefb57b6da42..55e803cb0f479 100644 --- a/independent-projects/qute/core/src/main/java/io/quarkus/qute/ResultMapper.java +++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/ResultMapper.java @@ -25,7 +25,7 @@ default boolean appliesTo(Origin origin, Object result) { /** * - * @param result + * @param result The result, never {@code null} * @param expression The original expression * @return the string value */ diff --git a/independent-projects/qute/core/src/test/java/io/quarkus/qute/JsonEscaperTest.java b/independent-projects/qute/core/src/test/java/io/quarkus/qute/JsonEscaperTest.java new file mode 100644 index 0000000000000..e9fe26418efe6 --- /dev/null +++ b/independent-projects/qute/core/src/test/java/io/quarkus/qute/JsonEscaperTest.java @@ -0,0 +1,70 @@ +package io.quarkus.qute; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.IOException; +import java.util.Optional; + +import org.junit.jupiter.api.Test; + +import io.quarkus.qute.TemplateNode.Origin; + +public class JsonEscaperTest { + + @Test + public void testAppliesTo() { + JsonEscaper json = new JsonEscaper(); + Origin jsonOrigin = new Origin() { + + @Override + public Optional getVariant() { + return Optional.of(Variant.forContentType(Variant.APPLICATION_JSON)); + } + + @Override + public String getTemplateId() { + return null; + } + + @Override + public String getTemplateGeneratedId() { + return null; + } + + @Override + public int getLineCharacterStart() { + return 0; + } + + @Override + public int getLineCharacterEnd() { + return 0; + } + + @Override + public int getLine() { + return 0; + } + }; + assertFalse(json.appliesTo(jsonOrigin, new RawString("foo"))); + assertTrue(json.appliesTo(jsonOrigin, "foo")); + } + + @Test + public void testEscaping() throws IOException { + JsonEscaper json = new JsonEscaper(); + assertEquals("Čolek 1", json.escape("Čolek 1")); + assertEquals("\\rČolek\\n", json.escape("\rČolek\n")); + assertEquals("\\tČolek", json.escape("\tČolek")); + assertEquals("\\\"tČolek", json.escape("\"tČolek")); + assertEquals("\\\\tČolek", json.escape("\\tČolek")); + assertEquals("\\\\u005C", json.escape("\\u005C")); + assertEquals("\\u000bČolek", json.escape("\u000BČolek")); + assertEquals("\\\\u000BČolek", json.escape("\\u000BČolek")); + // Control char - start of Header + assertEquals("\\u0001", json.escape("\u0001")); + } + +} From 6cdb6245f195a11bb8c582b3777190e4434c54c2 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 27 Nov 2024 09:46:48 +0200 Subject: [PATCH 3/7] Move code in rest-jackson-common to a proper package Fixes: #44740 --- .../deployment/RestClientReactiveJacksonProcessor.java | 8 ++++---- .../vertx/VertxJsonArrayBasicMessageBodyReader.java | 2 +- .../vertx/VertxJsonArrayBasicMessageBodyWriter.java | 2 +- .../vertx/VertxJsonObjectBasicMessageBodyReader.java | 2 +- .../vertx/VertxJsonObjectBasicMessageBodyWriter.java | 2 +- .../vertx/VertxJsonArrayMessageBodyReader.java | 1 + .../vertx/VertxJsonArrayMessageBodyWriter.java | 1 + .../vertx/VertxJsonObjectMessageBodyReader.java | 1 + .../vertx/VertxJsonObjectMessageBodyWriter.java | 1 + 9 files changed, 12 insertions(+), 8 deletions(-) rename extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/{ => common}/runtime/serialisers/vertx/VertxJsonArrayBasicMessageBodyReader.java (94%) rename extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/{ => common}/runtime/serialisers/vertx/VertxJsonArrayBasicMessageBodyWriter.java (93%) rename extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/{ => common}/runtime/serialisers/vertx/VertxJsonObjectBasicMessageBodyReader.java (94%) rename extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/{ => common}/runtime/serialisers/vertx/VertxJsonObjectBasicMessageBodyWriter.java (93%) diff --git a/extensions/resteasy-reactive/rest-client-jackson/deployment/src/main/java/io/quarkus/rest/client/reactive/jackson/deployment/RestClientReactiveJacksonProcessor.java b/extensions/resteasy-reactive/rest-client-jackson/deployment/src/main/java/io/quarkus/rest/client/reactive/jackson/deployment/RestClientReactiveJacksonProcessor.java index 0570168c2f50d..5cd58bf806ad5 100644 --- a/extensions/resteasy-reactive/rest-client-jackson/deployment/src/main/java/io/quarkus/rest/client/reactive/jackson/deployment/RestClientReactiveJacksonProcessor.java +++ b/extensions/resteasy-reactive/rest-client-jackson/deployment/src/main/java/io/quarkus/rest/client/reactive/jackson/deployment/RestClientReactiveJacksonProcessor.java @@ -25,11 +25,11 @@ import io.quarkus.rest.client.reactive.jackson.runtime.serialisers.ClientJacksonMessageBodyReader; import io.quarkus.rest.client.reactive.jackson.runtime.serialisers.ClientJacksonMessageBodyWriter; import io.quarkus.rest.client.reactive.jackson.runtime.serialisers.JacksonCleanupRestClientClosingTask; +import io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx.VertxJsonArrayBasicMessageBodyReader; +import io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx.VertxJsonArrayBasicMessageBodyWriter; +import io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx.VertxJsonObjectBasicMessageBodyReader; +import io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx.VertxJsonObjectBasicMessageBodyWriter; import io.quarkus.resteasy.reactive.jackson.deployment.processor.ResteasyReactiveJacksonProviderDefinedBuildItem; -import io.quarkus.resteasy.reactive.jackson.runtime.serialisers.vertx.VertxJsonArrayBasicMessageBodyReader; -import io.quarkus.resteasy.reactive.jackson.runtime.serialisers.vertx.VertxJsonArrayBasicMessageBodyWriter; -import io.quarkus.resteasy.reactive.jackson.runtime.serialisers.vertx.VertxJsonObjectBasicMessageBodyReader; -import io.quarkus.resteasy.reactive.jackson.runtime.serialisers.vertx.VertxJsonObjectBasicMessageBodyWriter; import io.quarkus.resteasy.reactive.spi.MessageBodyReaderBuildItem; import io.quarkus.resteasy.reactive.spi.MessageBodyWriterBuildItem; import io.quarkus.vertx.deployment.ReinitializeVertxJsonBuildItem; diff --git a/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonArrayBasicMessageBodyReader.java b/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/common/runtime/serialisers/vertx/VertxJsonArrayBasicMessageBodyReader.java similarity index 94% rename from extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonArrayBasicMessageBodyReader.java rename to extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/common/runtime/serialisers/vertx/VertxJsonArrayBasicMessageBodyReader.java index 69a5a8bf84f66..5906f0e23f6ad 100644 --- a/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonArrayBasicMessageBodyReader.java +++ b/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/common/runtime/serialisers/vertx/VertxJsonArrayBasicMessageBodyReader.java @@ -1,4 +1,4 @@ -package io.quarkus.resteasy.reactive.jackson.runtime.serialisers.vertx; +package io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx; import java.io.IOException; import java.io.InputStream; diff --git a/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonArrayBasicMessageBodyWriter.java b/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/common/runtime/serialisers/vertx/VertxJsonArrayBasicMessageBodyWriter.java similarity index 93% rename from extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonArrayBasicMessageBodyWriter.java rename to extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/common/runtime/serialisers/vertx/VertxJsonArrayBasicMessageBodyWriter.java index 32e6a485bbdfd..6d996b99b91e3 100644 --- a/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonArrayBasicMessageBodyWriter.java +++ b/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/common/runtime/serialisers/vertx/VertxJsonArrayBasicMessageBodyWriter.java @@ -1,4 +1,4 @@ -package io.quarkus.resteasy.reactive.jackson.runtime.serialisers.vertx; +package io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx; import java.io.IOException; import java.io.OutputStream; diff --git a/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonObjectBasicMessageBodyReader.java b/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/common/runtime/serialisers/vertx/VertxJsonObjectBasicMessageBodyReader.java similarity index 94% rename from extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonObjectBasicMessageBodyReader.java rename to extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/common/runtime/serialisers/vertx/VertxJsonObjectBasicMessageBodyReader.java index 9b81c360dbf36..dda8c6cbd8699 100644 --- a/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonObjectBasicMessageBodyReader.java +++ b/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/common/runtime/serialisers/vertx/VertxJsonObjectBasicMessageBodyReader.java @@ -1,4 +1,4 @@ -package io.quarkus.resteasy.reactive.jackson.runtime.serialisers.vertx; +package io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx; import java.io.IOException; import java.io.InputStream; diff --git a/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonObjectBasicMessageBodyWriter.java b/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/common/runtime/serialisers/vertx/VertxJsonObjectBasicMessageBodyWriter.java similarity index 93% rename from extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonObjectBasicMessageBodyWriter.java rename to extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/common/runtime/serialisers/vertx/VertxJsonObjectBasicMessageBodyWriter.java index e889a8ed22ce5..290b1f6a709d4 100644 --- a/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonObjectBasicMessageBodyWriter.java +++ b/extensions/resteasy-reactive/rest-jackson-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/common/runtime/serialisers/vertx/VertxJsonObjectBasicMessageBodyWriter.java @@ -1,4 +1,4 @@ -package io.quarkus.resteasy.reactive.jackson.runtime.serialisers.vertx; +package io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx; import java.io.IOException; import java.io.OutputStream; diff --git a/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonArrayMessageBodyReader.java b/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonArrayMessageBodyReader.java index e47b3b99f0251..0c1acaaa7910d 100644 --- a/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonArrayMessageBodyReader.java +++ b/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonArrayMessageBodyReader.java @@ -10,6 +10,7 @@ import org.jboss.resteasy.reactive.server.spi.ServerMessageBodyReader; import org.jboss.resteasy.reactive.server.spi.ServerRequestContext; +import io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx.VertxJsonArrayBasicMessageBodyReader; import io.vertx.core.json.JsonArray; public class VertxJsonArrayMessageBodyReader extends VertxJsonArrayBasicMessageBodyReader diff --git a/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonArrayMessageBodyWriter.java b/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonArrayMessageBodyWriter.java index 956901486da12..27ddab5c0ff48 100644 --- a/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonArrayMessageBodyWriter.java +++ b/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonArrayMessageBodyWriter.java @@ -10,6 +10,7 @@ import org.jboss.resteasy.reactive.server.spi.ServerMessageBodyWriter; import org.jboss.resteasy.reactive.server.spi.ServerRequestContext; +import io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx.VertxJsonArrayBasicMessageBodyWriter; import io.vertx.core.json.JsonArray; public class VertxJsonArrayMessageBodyWriter extends VertxJsonArrayBasicMessageBodyWriter diff --git a/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonObjectMessageBodyReader.java b/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonObjectMessageBodyReader.java index 42f6ef06474a2..7f2b59f15919f 100644 --- a/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonObjectMessageBodyReader.java +++ b/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonObjectMessageBodyReader.java @@ -10,6 +10,7 @@ import org.jboss.resteasy.reactive.server.spi.ServerMessageBodyReader; import org.jboss.resteasy.reactive.server.spi.ServerRequestContext; +import io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx.VertxJsonObjectBasicMessageBodyReader; import io.vertx.core.json.JsonObject; public class VertxJsonObjectMessageBodyReader extends VertxJsonObjectBasicMessageBodyReader diff --git a/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonObjectMessageBodyWriter.java b/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonObjectMessageBodyWriter.java index 426f5258378bf..efaf289d14349 100644 --- a/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonObjectMessageBodyWriter.java +++ b/extensions/resteasy-reactive/rest-jackson/runtime/src/main/java/io/quarkus/resteasy/reactive/jackson/runtime/serialisers/vertx/VertxJsonObjectMessageBodyWriter.java @@ -14,6 +14,7 @@ import org.jboss.resteasy.reactive.server.spi.ServerMessageBodyWriter; import org.jboss.resteasy.reactive.server.spi.ServerRequestContext; +import io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx.VertxJsonObjectBasicMessageBodyWriter; import io.vertx.core.json.JsonObject; public class VertxJsonObjectMessageBodyWriter extends VertxJsonObjectBasicMessageBodyWriter From 6725fdc36db2f117c0e0cf878cd794464f88ccf0 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 27 Nov 2024 09:49:13 +0200 Subject: [PATCH 4/7] Move code in rest-jackson-common to a proper package Fixes: #44739 Fixes: #44740 --- .../jackson/deployment/RestClientReactiveJacksonProcessor.java | 2 +- .../ResteasyReactiveJacksonProviderDefinedBuildItem.java | 2 +- .../deployment/processor/ResteasyReactiveJacksonProcessor.java | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) rename extensions/resteasy-reactive/rest-jackson-common/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/{ => common}/deployment/processor/ResteasyReactiveJacksonProviderDefinedBuildItem.java (82%) diff --git a/extensions/resteasy-reactive/rest-client-jackson/deployment/src/main/java/io/quarkus/rest/client/reactive/jackson/deployment/RestClientReactiveJacksonProcessor.java b/extensions/resteasy-reactive/rest-client-jackson/deployment/src/main/java/io/quarkus/rest/client/reactive/jackson/deployment/RestClientReactiveJacksonProcessor.java index 5cd58bf806ad5..ffcb734b3f70e 100644 --- a/extensions/resteasy-reactive/rest-client-jackson/deployment/src/main/java/io/quarkus/rest/client/reactive/jackson/deployment/RestClientReactiveJacksonProcessor.java +++ b/extensions/resteasy-reactive/rest-client-jackson/deployment/src/main/java/io/quarkus/rest/client/reactive/jackson/deployment/RestClientReactiveJacksonProcessor.java @@ -25,11 +25,11 @@ import io.quarkus.rest.client.reactive.jackson.runtime.serialisers.ClientJacksonMessageBodyReader; import io.quarkus.rest.client.reactive.jackson.runtime.serialisers.ClientJacksonMessageBodyWriter; import io.quarkus.rest.client.reactive.jackson.runtime.serialisers.JacksonCleanupRestClientClosingTask; +import io.quarkus.resteasy.reactive.jackson.common.deployment.processor.ResteasyReactiveJacksonProviderDefinedBuildItem; import io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx.VertxJsonArrayBasicMessageBodyReader; import io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx.VertxJsonArrayBasicMessageBodyWriter; import io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx.VertxJsonObjectBasicMessageBodyReader; import io.quarkus.resteasy.reactive.jackson.common.runtime.serialisers.vertx.VertxJsonObjectBasicMessageBodyWriter; -import io.quarkus.resteasy.reactive.jackson.deployment.processor.ResteasyReactiveJacksonProviderDefinedBuildItem; import io.quarkus.resteasy.reactive.spi.MessageBodyReaderBuildItem; import io.quarkus.resteasy.reactive.spi.MessageBodyWriterBuildItem; import io.quarkus.vertx.deployment.ReinitializeVertxJsonBuildItem; diff --git a/extensions/resteasy-reactive/rest-jackson-common/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/ResteasyReactiveJacksonProviderDefinedBuildItem.java b/extensions/resteasy-reactive/rest-jackson-common/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/common/deployment/processor/ResteasyReactiveJacksonProviderDefinedBuildItem.java similarity index 82% rename from extensions/resteasy-reactive/rest-jackson-common/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/ResteasyReactiveJacksonProviderDefinedBuildItem.java rename to extensions/resteasy-reactive/rest-jackson-common/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/common/deployment/processor/ResteasyReactiveJacksonProviderDefinedBuildItem.java index bab510942c126..2a8590bddcb6c 100644 --- a/extensions/resteasy-reactive/rest-jackson-common/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/ResteasyReactiveJacksonProviderDefinedBuildItem.java +++ b/extensions/resteasy-reactive/rest-jackson-common/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/common/deployment/processor/ResteasyReactiveJacksonProviderDefinedBuildItem.java @@ -1,4 +1,4 @@ -package io.quarkus.resteasy.reactive.jackson.deployment.processor; +package io.quarkus.resteasy.reactive.jackson.common.deployment.processor; import io.quarkus.builder.item.MultiBuildItem; diff --git a/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/ResteasyReactiveJacksonProcessor.java b/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/ResteasyReactiveJacksonProcessor.java index b8607985a1bb8..97c6301c69a08 100644 --- a/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/ResteasyReactiveJacksonProcessor.java +++ b/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/ResteasyReactiveJacksonProcessor.java @@ -71,6 +71,7 @@ import io.quarkus.resteasy.reactive.jackson.DisableSecureSerialization; import io.quarkus.resteasy.reactive.jackson.EnableSecureSerialization; import io.quarkus.resteasy.reactive.jackson.SecureField; +import io.quarkus.resteasy.reactive.jackson.common.deployment.processor.ResteasyReactiveJacksonProviderDefinedBuildItem; import io.quarkus.resteasy.reactive.jackson.runtime.ResteasyReactiveServerJacksonRecorder; import io.quarkus.resteasy.reactive.jackson.runtime.mappers.NativeInvalidDefinitionExceptionMapper; import io.quarkus.resteasy.reactive.jackson.runtime.security.RolesAllowedConfigExpStorage; From df602e0adea2e46006aeab636c3d5b25d2eb44ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Vav=C5=99=C3=ADk?= Date: Tue, 26 Nov 2024 17:06:19 +0100 Subject: [PATCH 5/7] feat(oidc): Always set resolved OIDC tenant id and docs it --- docs/src/main/asciidoc/hibernate-orm.adoc | 14 +++++++++---- docs/src/main/asciidoc/mongodb-panache.adoc | 8 ++++---- .../security-openid-connect-multitenancy.adoc | 20 ++++--------------- .../runtime/OidcAuthenticationMechanism.java | 6 +++++- .../it/keycloak/TenantEcho2Resource.java | 3 ++- .../it/keycloak/TenantEchoResource.java | 3 ++- .../keycloak/AnnotationBasedTenantTest.java | 4 ++-- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/docs/src/main/asciidoc/hibernate-orm.adoc b/docs/src/main/asciidoc/hibernate-orm.adoc index b3f6e69e96c04..e369e8ca015c2 100644 --- a/docs/src/main/asciidoc/hibernate-orm.adoc +++ b/docs/src/main/asciidoc/hibernate-orm.adoc @@ -1159,11 +1159,13 @@ From the implementation above, tenants are resolved from the request path so tha [NOTE] ==== -If you also use xref:security-openid-connect-multitenancy.adoc[OIDC multitenancy] and both OIDC and Hibernate ORM tenant IDs are the same and must be extracted from the Vert.x `RoutingContext` then you can pass the tenant id from the OIDC Tenant Resolver to the Hibernate ORM Tenant Resolver as a `RoutingContext` attribute, for example: +If you also use xref:security-openid-connect-multitenancy.adoc[OIDC multitenancy] and both OIDC and Hibernate ORM tenant IDs are the same, +you can get the OIDC tenant id from a `RoutingContext` attribute like in the example below: [source,java] ---- import io.quarkus.hibernate.orm.runtime.tenant.TenantResolver; +import io.quarkus.oidc.runtime.OidcUtils; import io.vertx.ext.web.RoutingContext; @PersistenceUnitExtension @@ -1171,15 +1173,19 @@ import io.vertx.ext.web.RoutingContext; public class CustomTenantResolver implements TenantResolver { @Inject - RoutingContext context; + RoutingContext context; <1> ... @Override public String resolveTenantId() { - // OIDC TenantResolver has already calculated the tenant id and saved it as a RoutingContext `tenantId` attribute: - return context.get("tenantId"); + // OIDC has saved the tenant id as the RoutingContext attribute: + return context.get(OidcUtils.TENANT_ID_ATTRIBUTE); } } ---- +<1> If the Hibernate `TenantResolver` also resolves tenants when there is no active HTTP request, +for example when you query database from a scheduler, the `RoutingContext` CDI bean will not be available. +Please inject the `io.quarkus.vertx.http.runtime.CurrentVertxRequest` CDI bean instead and get the `RoutingContext` from this bean. + ==== === Configuring the application diff --git a/docs/src/main/asciidoc/mongodb-panache.adoc b/docs/src/main/asciidoc/mongodb-panache.adoc index 853f6e27b7dfa..e0f3a15b04c87 100644 --- a/docs/src/main/asciidoc/mongodb-panache.adoc +++ b/docs/src/main/asciidoc/mongodb-panache.adoc @@ -1275,12 +1275,12 @@ and then `quarkus.mongodb.database` property. [NOTE] ==== If you also use xref:security-openid-connect-multitenancy.adoc[OIDC multitenancy], then if the OIDC tenantID and MongoDB -database are the same and must be extracted from the Vert.x `RoutingContext` you can pass the tenant id from the OIDC `TenantResolver` -to the MongoDB with Panache `MongoDatabaseResolver` as a `RoutingContext` attribute, for example: +database are the same, you can access the OIDC tenant id from a `RoutingContext` attribute like in the example below: [source,java] ---- import io.quarkus.mongodb.panache.common.MongoDatabaseResolver; +import io.quarkus.oidc.runtime.OidcUtils; import io.vertx.ext.web.RoutingContext; @RequestScoped @@ -1291,8 +1291,8 @@ public class CustomMongoDatabaseResolver implements MongoDatabaseResolver { ... @Override public String resolve() { - // OIDC TenantResolver has already calculated the tenant id and saved it as a RoutingContext `tenantId` attribute: - return context.get("tenantId"); + // OIDC has saved the tenant id as the RoutingContext attribute: + return context.get(OidcUtils.TENANT_ID_ATTRIBUTE); } } ---- diff --git a/docs/src/main/asciidoc/security-openid-connect-multitenancy.adoc b/docs/src/main/asciidoc/security-openid-connect-multitenancy.adoc index 004d220d7ac11..5d8bcbf630734 100644 --- a/docs/src/main/asciidoc/security-openid-connect-multitenancy.adoc +++ b/docs/src/main/asciidoc/security-openid-connect-multitenancy.adoc @@ -329,22 +329,10 @@ A similar technique can be used with `TenantConfigResolver`, where a `tenant-id` [NOTE] ==== -If you also use xref:hibernate-orm.adoc#multitenancy[Hibernate ORM multitenancy] or xref:mongodb-panache.adoc#multitenancy[MongoDB with Panache multitenancy] and both tenant ids are the same -and must be extracted from the Vert.x `RoutingContext`, you can pass the tenant id from the OIDC Tenant Resolver to the Hibernate ORM Tenant Resolver or MongoDB with Panache Mongo Database Resolver -as a `RoutingContext` attribute, for example: - -[source,java] ----- -public class CustomTenantResolver implements TenantResolver { - - @Override - public String resolve(RoutingContext context) { - String tenantId = extractTenantId(context); - context.put("tenantId", tenantId); - return tenantId; - } -} ----- +If you also use Hibernate ORM multitenancy or MongoDB with Panache multitenancy and both tenant ids are the same, +you can get the tenant id from the `RoutingContext` attribute with `tenant-id`. You can find more information here: +* xref:hibernate-orm.adoc#multitenancy[Hibernate ORM multitenancy] +* xref:mongodb-panache.adoc#multitenancy[MongoDB with Panache multitenancy] ==== == Starting and configuring the Keycloak server diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java index 8f798a68935cf..5725c39c273ce 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java @@ -84,8 +84,12 @@ public OidcTenantConfig apply(OidcTenantConfig oidcTenantConfig) { if (oidcTenantConfig == null) { throw new OIDCException("Tenant configuration has not been resolved"); } - LOG.debugf("Resolved OIDC tenant id: %s", oidcTenantConfig.tenantId.orElse(OidcUtils.DEFAULT_TENANT_ID)); + final String tenantId = oidcTenantConfig.tenantId.orElse(OidcUtils.DEFAULT_TENANT_ID); + LOG.debugf("Resolved OIDC tenant id: %s", tenantId); context.put(OidcTenantConfig.class.getName(), oidcTenantConfig); + if (context.get(OidcUtils.TENANT_ID_ATTRIBUTE) == null) { + context.put(OidcUtils.TENANT_ID_ATTRIBUTE, tenantId); + } return oidcTenantConfig; }; }); diff --git a/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/TenantEcho2Resource.java b/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/TenantEcho2Resource.java index 53bfb8215fe4a..8d95ae0863ba4 100644 --- a/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/TenantEcho2Resource.java +++ b/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/TenantEcho2Resource.java @@ -65,6 +65,7 @@ private String getTenant() { return OidcUtils.TENANT_ID_ATTRIBUTE + "=" + routingContext.get(OidcUtils.TENANT_ID_ATTRIBUTE) + ", static.tenant.id=" + routingContext.get("static.tenant.id") + ", name=" + identity.getPrincipal().getName() - + ", " + OidcUtils.TENANT_ID_SET_BY_ANNOTATION + "=" + routingContext.get(OidcUtils.TENANT_ID_ATTRIBUTE); + + ", " + OidcUtils.TENANT_ID_SET_BY_ANNOTATION + "=" + + routingContext.get(OidcUtils.TENANT_ID_SET_BY_ANNOTATION); } } diff --git a/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/TenantEchoResource.java b/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/TenantEchoResource.java index 4440ddf1a8e4e..43b2b2f4e1326 100644 --- a/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/TenantEchoResource.java +++ b/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/TenantEchoResource.java @@ -71,6 +71,7 @@ private String getTenantInternal() { return OidcUtils.TENANT_ID_ATTRIBUTE + "=" + routingContext.get(OidcUtils.TENANT_ID_ATTRIBUTE) + ", static.tenant.id=" + routingContext.get("static.tenant.id") + ", name=" + identity.getPrincipal().getName() - + ", " + OidcUtils.TENANT_ID_SET_BY_ANNOTATION + "=" + routingContext.get(OidcUtils.TENANT_ID_ATTRIBUTE); + + ", " + OidcUtils.TENANT_ID_SET_BY_ANNOTATION + "=" + + routingContext.get(OidcUtils.TENANT_ID_SET_BY_ANNOTATION); } } diff --git a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/AnnotationBasedTenantTest.java b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/AnnotationBasedTenantTest.java index 9c05debd5e48f..0c533f0b025d0 100644 --- a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/AnnotationBasedTenantTest.java +++ b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/AnnotationBasedTenantTest.java @@ -156,7 +156,7 @@ public void testMethodLevelAnnotation() { RestAssured.given().auth().oauth2(token) .when().get("/api/tenant-echo2/default") .then().statusCode(200) - .body(Matchers.equalTo(("tenant-id=null, static.tenant.id=null, name=alice, " + .body(Matchers.equalTo(("tenant-id=Default, static.tenant.id=null, name=alice, " + OidcUtils.TENANT_ID_SET_BY_ANNOTATION + "=null"))); } finally { server.stop(); @@ -388,7 +388,7 @@ public void testPolicyAppliedBeforeTenantAnnotationMatched() { .when().get("/api/tenant-echo/http-security-policy-applies-all-same") .then().statusCode(200) .body(Matchers - .equalTo("tenant-id=null, static.tenant.id=hr, name=alice, tenant-id-set-by-annotation=null")); + .equalTo("tenant-id=hr, static.tenant.id=hr, name=alice, tenant-id-set-by-annotation=null")); } finally { server.stop(); } From 107e4ea658ec01d911f63f73ddc5bc78e81872c7 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 27 Nov 2024 11:59:57 +0200 Subject: [PATCH 6/7] Address leftovers in testing docs from #44685 --- .../asciidoc/getting-started-testing.adoc | 28 ++++++------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/docs/src/main/asciidoc/getting-started-testing.adoc b/docs/src/main/asciidoc/getting-started-testing.adoc index 6a13199331b05..916b16f57fd08 100644 --- a/docs/src/main/asciidoc/getting-started-testing.adoc +++ b/docs/src/main/asciidoc/getting-started-testing.adoc @@ -1241,25 +1241,15 @@ public @interface WithRepeatableTestResource { While test resources provided by `@QuarkusTestResource` are available either globally or restricted to the annotated test class (`restrictToAnnotatedClass`), the annotation `@WithTestResources` allows to additionally group tests by test resources for execution. `@WithTestResources` has a `scope` property that takes a `TestResourceScope` enum value: -- `TestResourceScope.MATCHING_RESOURCES` (default) + -Quarkus will group tests with the same test resources and run them together. After a group has been executed, all test resources will be stopped, and the next group will be executed. -- `TestResourceScope.RESTRICTED_TO_CLASS` + -The test resource is available only for the annotated test class and will be stopped after the test class has been executed. This is equivalent to using @QuarkusTestResource with restrictToAnnotatedClass = true. -- `TestResourceScope.GLOBAL` + -The test resource is available globally. -This is equivalent to using `@QuarkusTestResource` with `restrictToAnnotatedClass = false`. - -NOTE: `@QuarkusTestResource` is merely a convenient extension of `@WithTestResources` for the use of global test resources - -BELOW TO EDIT: + -I don't know the behaviour when different scopes are mixed 🤷‍♂️Example: -```java -@WithTestResources(value = TestResourceA.class, scope = TestResourceScope.MATCHING_RESOURCES) -@WithTestResources(value = TestResourceB.class, scope = TestResourceScope.RESTRICTED_TO_CLASS) -@WithTestResources(value = TestResourceC.class, scope = TestResourceScope.GLOBAL) -class TestClass(){} -``` -Also maybe add a use case example for why this annotation got introduced and what for the different scopes are useful, as we currently only use GLOBAL because of time reason. +- `TestResourceScope.MATCHING_RESOURCES` (default): Quarkus will group tests with the same test resources and run them together. After a group has been executed, all test resources will be stopped, and the next group will be executed. +- `TestResourceScope.RESTRICTED_TO_CLASS`: The test resource is available only for the annotated test class and will be stopped after the test class has been executed. +- `TestResourceScope.GLOBAL`: Test resources apply to all tests in the testsuite + +Quarkus needs to restart if one of the following is true: + +- At least one the existing test resources is restricted to the test class +- At least one the next test resources is restricted to the test class +- Different {@code MATCHING_RESOURCE} scoped test resources are being used == Hang Detection From 7eac5780b6d3cd8cbadff5f2478f1880d8119a00 Mon Sep 17 00:00:00 2001 From: Auri Munoz Date: Wed, 27 Nov 2024 12:30:14 +0100 Subject: [PATCH 7/7] Renaming packages to avoid split them accross multiple modules Related to #44742 and #44741 --- .../ControllerAdviceExceptionMapperGenerator.java | 4 ++-- .../deployment/SpringWebResteasyClassicProcessor.java | 2 +- .../runtime/ResteasyClassicResponseContentTypeResolver.java | 2 +- .../{ => resteasy/classic}/test/ControllerReloadTest.java | 2 +- .../classic}/test/MissingRestControllerTest.java | 5 +++-- .../test/ResponseStatusAndExceptionHandlerTest.java | 2 +- .../{ => resteasy/classic}/test/SimpleSpringController.java | 2 +- .../classic}/test/SimpleSpringControllerTest.java | 2 +- .../deployment/SpringWebResteasyReactiveProcessor.java | 6 +++--- .../reactive}/runtime/ResponseEntityHandler.java | 2 +- .../reactive}/runtime/ResponseStatusHandler.java | 2 +- .../ResteasyReactiveResponseContentTypeResolver.java | 2 +- .../web/{ => resteasy/reactive}/test/BasicMappingTest.java | 2 +- .../spring/web/{ => resteasy/reactive}/test/Greeting.java | 2 +- .../test/GreetingControllerWithNoRequestMapping.java | 2 +- .../web/{ => resteasy/reactive}/test/RequiredFalseTest.java | 2 +- .../reactive}/test/ResponseEntityController.java | 2 +- .../test/ResponseStatusAndExceptionHandlerTest.java | 2 +- .../reactive}/test/ResponseStatusController.java | 2 +- .../spring/web/{ => resteasy/reactive}/test/SomeClass.java | 2 +- .../web/{ => resteasy/reactive}/test/TestController.java | 2 +- 21 files changed, 26 insertions(+), 25 deletions(-) rename extensions/spring-web/resteasy-classic/deployment/src/main/java/io/quarkus/spring/web/{ => resteasy/classic}/deployment/SpringWebResteasyClassicProcessor.java (99%) rename extensions/spring-web/resteasy-classic/runtime/src/main/java/io/quarkus/spring/web/{ => resteasy/classic}/runtime/ResteasyClassicResponseContentTypeResolver.java (91%) rename extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/{ => resteasy/classic}/test/ControllerReloadTest.java (93%) rename extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/{ => resteasy/classic}/test/MissingRestControllerTest.java (89%) rename extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/{ => resteasy/classic}/test/ResponseStatusAndExceptionHandlerTest.java (96%) rename extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/{ => resteasy/classic}/test/SimpleSpringController.java (86%) rename extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/{ => resteasy/classic}/test/SimpleSpringControllerTest.java (91%) rename extensions/spring-web/resteasy-reactive/deployment/src/main/java/io/quarkus/spring/web/{ => resteasy/reactive}/deployment/SpringWebResteasyReactiveProcessor.java (99%) rename extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/{ => resteasy/reactive}/runtime/ResponseEntityHandler.java (92%) rename extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/{ => resteasy/reactive}/runtime/ResponseStatusHandler.java (95%) rename extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/{ => resteasy/reactive}/runtime/ResteasyReactiveResponseContentTypeResolver.java (91%) rename extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/{ => resteasy/reactive}/test/BasicMappingTest.java (99%) rename extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/{ => resteasy/reactive}/test/Greeting.java (79%) rename extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/{ => resteasy/reactive}/test/GreetingControllerWithNoRequestMapping.java (84%) rename extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/{ => resteasy/reactive}/test/RequiredFalseTest.java (96%) rename extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/{ => resteasy/reactive}/test/ResponseEntityController.java (96%) rename extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/{ => resteasy/reactive}/test/ResponseStatusAndExceptionHandlerTest.java (97%) rename extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/{ => resteasy/reactive}/test/ResponseStatusController.java (93%) rename extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/{ => resteasy/reactive}/test/SomeClass.java (85%) rename extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/{ => resteasy/reactive}/test/TestController.java (98%) diff --git a/extensions/spring-web/core/deployment/src/main/java/io/quarkus/spring/web/deployment/ControllerAdviceExceptionMapperGenerator.java b/extensions/spring-web/core/deployment/src/main/java/io/quarkus/spring/web/deployment/ControllerAdviceExceptionMapperGenerator.java index e3fe977dc9817..cf7d3dfa46bb3 100644 --- a/extensions/spring-web/core/deployment/src/main/java/io/quarkus/spring/web/deployment/ControllerAdviceExceptionMapperGenerator.java +++ b/extensions/spring-web/core/deployment/src/main/java/io/quarkus/spring/web/deployment/ControllerAdviceExceptionMapperGenerator.java @@ -197,8 +197,8 @@ private ResultHandle getResponseContentType(MethodCreator methodCreator, List "io.quarkus.spring.web.deployment.SpringWebResteasyClassicProcessor".equals(r.getLoggerName())); + r -> "io.quarkus.spring.web.resteasy.classic.deployment.SpringWebResteasyClassicProcessor" + .equals(r.getLoggerName())); @ProdBuildResults private ProdModeTestResults prodModeTestResults; diff --git a/extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/test/ResponseStatusAndExceptionHandlerTest.java b/extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/resteasy/classic/test/ResponseStatusAndExceptionHandlerTest.java similarity index 96% rename from extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/test/ResponseStatusAndExceptionHandlerTest.java rename to extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/resteasy/classic/test/ResponseStatusAndExceptionHandlerTest.java index 75d20a7917603..3be7083f51f9a 100644 --- a/extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/test/ResponseStatusAndExceptionHandlerTest.java +++ b/extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/resteasy/classic/test/ResponseStatusAndExceptionHandlerTest.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.test; +package io.quarkus.spring.web.resteasy.classic.test; import static io.restassured.RestAssured.when; diff --git a/extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/test/SimpleSpringController.java b/extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/resteasy/classic/test/SimpleSpringController.java similarity index 86% rename from extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/test/SimpleSpringController.java rename to extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/resteasy/classic/test/SimpleSpringController.java index 91fbaacb716ad..5478ade25abcb 100644 --- a/extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/test/SimpleSpringController.java +++ b/extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/resteasy/classic/test/SimpleSpringController.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.test; +package io.quarkus.spring.web.resteasy.classic.test; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/test/SimpleSpringControllerTest.java b/extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/resteasy/classic/test/SimpleSpringControllerTest.java similarity index 91% rename from extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/test/SimpleSpringControllerTest.java rename to extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/resteasy/classic/test/SimpleSpringControllerTest.java index 92c45b2453d3c..38764a46d88e3 100644 --- a/extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/test/SimpleSpringControllerTest.java +++ b/extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/resteasy/classic/test/SimpleSpringControllerTest.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.test; +package io.quarkus.spring.web.resteasy.classic.test; import static io.restassured.RestAssured.when; import static org.hamcrest.Matchers.is; diff --git a/extensions/spring-web/resteasy-reactive/deployment/src/main/java/io/quarkus/spring/web/deployment/SpringWebResteasyReactiveProcessor.java b/extensions/spring-web/resteasy-reactive/deployment/src/main/java/io/quarkus/spring/web/resteasy/reactive/deployment/SpringWebResteasyReactiveProcessor.java similarity index 99% rename from extensions/spring-web/resteasy-reactive/deployment/src/main/java/io/quarkus/spring/web/deployment/SpringWebResteasyReactiveProcessor.java rename to extensions/spring-web/resteasy-reactive/deployment/src/main/java/io/quarkus/spring/web/resteasy/reactive/deployment/SpringWebResteasyReactiveProcessor.java index 3c01c23dcabe8..55adc53e48711 100644 --- a/extensions/spring-web/resteasy-reactive/deployment/src/main/java/io/quarkus/spring/web/deployment/SpringWebResteasyReactiveProcessor.java +++ b/extensions/spring-web/resteasy-reactive/deployment/src/main/java/io/quarkus/spring/web/resteasy/reactive/deployment/SpringWebResteasyReactiveProcessor.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.deployment; +package io.quarkus.spring.web.resteasy.reactive.deployment; import static org.jboss.jandex.AnnotationInstance.create; import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.DEFAULT_VALUE; @@ -45,8 +45,8 @@ import io.quarkus.resteasy.reactive.spi.AdditionalResourceClassBuildItem; import io.quarkus.resteasy.reactive.spi.ExceptionMapperBuildItem; import io.quarkus.resteasy.server.common.spi.AdditionalJaxRsResourceMethodParamAnnotations; -import io.quarkus.spring.web.runtime.ResponseEntityHandler; -import io.quarkus.spring.web.runtime.ResponseStatusHandler; +import io.quarkus.spring.web.resteasy.reactive.runtime.ResponseEntityHandler; +import io.quarkus.spring.web.resteasy.reactive.runtime.ResponseStatusHandler; import io.quarkus.spring.web.runtime.common.ResponseStatusExceptionMapper; public class SpringWebResteasyReactiveProcessor { diff --git a/extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/runtime/ResponseEntityHandler.java b/extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/resteasy/reactive/runtime/ResponseEntityHandler.java similarity index 92% rename from extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/runtime/ResponseEntityHandler.java rename to extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/resteasy/reactive/runtime/ResponseEntityHandler.java index a365e4f16079d..8e9b26cad6868 100644 --- a/extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/runtime/ResponseEntityHandler.java +++ b/extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/resteasy/reactive/runtime/ResponseEntityHandler.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.runtime; +package io.quarkus.spring.web.resteasy.reactive.runtime; import org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext; import org.jboss.resteasy.reactive.server.spi.ServerRestHandler; diff --git a/extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/runtime/ResponseStatusHandler.java b/extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/resteasy/reactive/runtime/ResponseStatusHandler.java similarity index 95% rename from extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/runtime/ResponseStatusHandler.java rename to extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/resteasy/reactive/runtime/ResponseStatusHandler.java index 23a9f3736b46a..df6a536d1f91c 100644 --- a/extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/runtime/ResponseStatusHandler.java +++ b/extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/resteasy/reactive/runtime/ResponseStatusHandler.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.runtime; +package io.quarkus.spring.web.resteasy.reactive.runtime; import org.jboss.resteasy.reactive.common.jaxrs.ResponseImpl; import org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext; diff --git a/extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/runtime/ResteasyReactiveResponseContentTypeResolver.java b/extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/resteasy/reactive/runtime/ResteasyReactiveResponseContentTypeResolver.java similarity index 91% rename from extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/runtime/ResteasyReactiveResponseContentTypeResolver.java rename to extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/resteasy/reactive/runtime/ResteasyReactiveResponseContentTypeResolver.java index a036095e78f4d..d3f8f780e2b6b 100644 --- a/extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/runtime/ResteasyReactiveResponseContentTypeResolver.java +++ b/extensions/spring-web/resteasy-reactive/runtime/src/main/java/io/quarkus/spring/web/resteasy/reactive/runtime/ResteasyReactiveResponseContentTypeResolver.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.runtime; +package io.quarkus.spring.web.resteasy.reactive.runtime; import java.util.List; diff --git a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/BasicMappingTest.java b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/BasicMappingTest.java similarity index 99% rename from extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/BasicMappingTest.java rename to extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/BasicMappingTest.java index 7f6d45b08b477..28687ca9da20c 100644 --- a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/BasicMappingTest.java +++ b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/BasicMappingTest.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.test; +package io.quarkus.spring.web.resteasy.reactive.test; import static io.restassured.RestAssured.given; import static io.restassured.RestAssured.when; diff --git a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/Greeting.java b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/Greeting.java similarity index 79% rename from extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/Greeting.java rename to extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/Greeting.java index ebe214bd3ae1e..e7421d89f716d 100644 --- a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/Greeting.java +++ b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/Greeting.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.test; +package io.quarkus.spring.web.resteasy.reactive.test; public class Greeting { diff --git a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/GreetingControllerWithNoRequestMapping.java b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/GreetingControllerWithNoRequestMapping.java similarity index 84% rename from extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/GreetingControllerWithNoRequestMapping.java rename to extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/GreetingControllerWithNoRequestMapping.java index e79b2bb3e67dc..fce89405ceead 100644 --- a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/GreetingControllerWithNoRequestMapping.java +++ b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/GreetingControllerWithNoRequestMapping.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.test; +package io.quarkus.spring.web.resteasy.reactive.test; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/RequiredFalseTest.java b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/RequiredFalseTest.java similarity index 96% rename from extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/RequiredFalseTest.java rename to extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/RequiredFalseTest.java index f7cae709aa99e..2de8ab013b1d7 100644 --- a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/RequiredFalseTest.java +++ b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/RequiredFalseTest.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.test; +package io.quarkus.spring.web.resteasy.reactive.test; import static io.restassured.RestAssured.when; import static org.hamcrest.Matchers.is; diff --git a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/ResponseEntityController.java b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/ResponseEntityController.java similarity index 96% rename from extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/ResponseEntityController.java rename to extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/ResponseEntityController.java index 806beeb1464d7..986d9d4588d9c 100644 --- a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/ResponseEntityController.java +++ b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/ResponseEntityController.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.test; +package io.quarkus.spring.web.resteasy.reactive.test; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; diff --git a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/ResponseStatusAndExceptionHandlerTest.java b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/ResponseStatusAndExceptionHandlerTest.java similarity index 97% rename from extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/ResponseStatusAndExceptionHandlerTest.java rename to extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/ResponseStatusAndExceptionHandlerTest.java index 02bc4c08ec683..a2687fef0c03f 100644 --- a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/ResponseStatusAndExceptionHandlerTest.java +++ b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/ResponseStatusAndExceptionHandlerTest.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.test; +package io.quarkus.spring.web.resteasy.reactive.test; import static io.restassured.RestAssured.when; diff --git a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/ResponseStatusController.java b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/ResponseStatusController.java similarity index 93% rename from extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/ResponseStatusController.java rename to extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/ResponseStatusController.java index 4411c4fb134f6..f89a55135ea4e 100644 --- a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/ResponseStatusController.java +++ b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/ResponseStatusController.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.test; +package io.quarkus.spring.web.resteasy.reactive.test; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.GetMapping; diff --git a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/SomeClass.java b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/SomeClass.java similarity index 85% rename from extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/SomeClass.java rename to extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/SomeClass.java index f3617a19beaaf..f915859e7e9de 100644 --- a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/SomeClass.java +++ b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/SomeClass.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.test; +package io.quarkus.spring.web.resteasy.reactive.test; public class SomeClass { diff --git a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/TestController.java b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/TestController.java similarity index 98% rename from extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/TestController.java rename to extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/TestController.java index 26847be09c9d4..305d03f163b10 100644 --- a/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/test/TestController.java +++ b/extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/TestController.java @@ -1,4 +1,4 @@ -package io.quarkus.spring.web.test; +package io.quarkus.spring.web.resteasy.reactive.test; import jakarta.ws.rs.core.MediaType;