From c9a286260a658a9e4a29d233cdd85b8c8ae874e0 Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Mon, 15 May 2023 11:45:18 +0300 Subject: [PATCH 01/33] Do not attempt to detect container runtime in native-sources build Closes: #33161 (cherry picked from commit db9ffd71f3a94108ee8a64b57859c9eee1c250f4) --- .../pkg/steps/NativeImageBuildStep.java | 12 ++++++- .../pkg/steps/NoopNativeImageBuildRunner.java | 34 +++++++++++++++++++ .../main/asciidoc/building-native-image.adoc | 5 +-- 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NoopNativeImageBuildRunner.java diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java index e4c313fcb650f..0f84c2abd2dbd 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java @@ -329,7 +329,7 @@ private String getResultingExecutableName(String nativeImageName, boolean isCont /** * Resolves the runner factory. Happens quite early, *before* the build. */ - @BuildStep + @BuildStep(onlyIf = NativeBuild.class) public NativeImageRunnerBuildItem resolveNativeImageBuildRunner(NativeConfig nativeConfig) { boolean isExplicitContainerBuild = nativeConfig.containerBuild() .orElse(nativeConfig.containerRuntime().isPresent() || nativeConfig.remoteContainerBuild()); @@ -353,6 +353,16 @@ public NativeImageRunnerBuildItem resolveNativeImageBuildRunner(NativeConfig nat return new NativeImageRunnerBuildItem(new NativeImageBuildLocalContainerRunner(nativeConfig)); } + /** + * Creates a dummy runner for native-sources builds. This allows the creation of native-source jars without + * requiring podman/docker or a local native-image installation. + */ + @BuildStep(onlyIf = NativeSourcesBuild.class) + public NativeImageRunnerBuildItem dummyNativeImageBuildRunner(NativeConfig nativeConfig) { + boolean explicitContainerBuild = nativeConfig.isExplicitContainerBuild(); + return new NativeImageRunnerBuildItem(new NoopNativeImageBuildRunner(explicitContainerBuild)); + } + private void copyJarSourcesToLib(OutputTargetBuildItem outputTargetBuildItem, CurateOutcomeBuildItem curateOutcomeBuildItem) { Path targetDirectory = outputTargetBuildItem.getOutputDirectory() diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NoopNativeImageBuildRunner.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NoopNativeImageBuildRunner.java new file mode 100644 index 0000000000000..f1c289b1f3852 --- /dev/null +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NoopNativeImageBuildRunner.java @@ -0,0 +1,34 @@ +package io.quarkus.deployment.pkg.steps; + +import java.nio.file.Path; +import java.util.List; + +public class NoopNativeImageBuildRunner extends NativeImageBuildRunner { + + private static final String MESSAGE = "NoopNativeImageBuildRunner is not meant to be used to perform an actual build."; + private final boolean isContainer; + + public NoopNativeImageBuildRunner(boolean isContainer) { + this.isContainer = isContainer; + } + + @Override + public boolean isContainer() { + return isContainer; + } + + @Override + protected String[] getGraalVMVersionCommand(List args) { + throw new UnsupportedOperationException(MESSAGE); + } + + @Override + protected String[] getBuildCommand(Path outputDir, List args) { + throw new UnsupportedOperationException(MESSAGE); + } + + @Override + protected void objcopy(Path outputDir, String... args) { + throw new UnsupportedOperationException(MESSAGE); + } +} diff --git a/docs/src/main/asciidoc/building-native-image.adoc b/docs/src/main/asciidoc/building-native-image.adoc index 8620002a85b7a..3e0243d52d816 100644 --- a/docs/src/main/asciidoc/building-native-image.adoc +++ b/docs/src/main/asciidoc/building-native-image.adoc @@ -786,10 +786,11 @@ $ ./mvnw clean package -Dquarkus.package.type=native-sources -Dquarkus.native.co cd target/native-sources docker run \ -it \ + --user $(id -ur):$(id -gr) \ --rm \ - --v $(pwd):/work \# <1> + -v $(pwd):/work \# <1> -w /work \# <2> - --entrypoint bin/sh \ + --entrypoint /bin/sh \ $(cat native-builder.image) \# <3> -c "native-image $(cat native-image.args) -J-Xmx4g"# <4> ---- From 679884bf486a1296db8742a5f026f9bc04d04c39 Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Tue, 16 May 2023 15:22:02 +0300 Subject: [PATCH 02/33] Only run KafkaStreamsProcessor when building native/native-sources (cherry picked from commit 4bd0553402aa0b6009d7b36e84fc70df385db572) --- .../kafka/streams/deployment/KafkaStreamsProcessor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/kafka-streams/deployment/src/main/java/io/quarkus/kafka/streams/deployment/KafkaStreamsProcessor.java b/extensions/kafka-streams/deployment/src/main/java/io/quarkus/kafka/streams/deployment/KafkaStreamsProcessor.java index 25f65ebca6ab0..4cc5b52d0b422 100644 --- a/extensions/kafka-streams/deployment/src/main/java/io/quarkus/kafka/streams/deployment/KafkaStreamsProcessor.java +++ b/extensions/kafka-streams/deployment/src/main/java/io/quarkus/kafka/streams/deployment/KafkaStreamsProcessor.java @@ -32,6 +32,7 @@ import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem; import io.quarkus.deployment.pkg.builditem.NativeImageRunnerBuildItem; +import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild; import io.quarkus.kafka.streams.runtime.KafkaStreamsProducer; import io.quarkus.kafka.streams.runtime.KafkaStreamsRecorder; import io.quarkus.kafka.streams.runtime.KafkaStreamsRuntimeConfig; @@ -42,7 +43,7 @@ class KafkaStreamsProcessor { public static final String DEFAULT_PARTITION_GROUPER = "org.apache.kafka.streams.processor.DefaultPartitionGrouper"; - @BuildStep + @BuildStep(onlyIf = NativeOrNativeSourcesBuild.class) void build(BuildProducer feature, BuildProducer reflectiveClasses, BuildProducer jniRuntimeAccessibleClasses, From 96d5248e34f962da0d6e208d5ff5be1314bcafbf Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 17 May 2023 10:25:40 +0300 Subject: [PATCH 03/33] Revert "Let `ProcessBuilder` do the IO redirection" This reverts commit 74c0063c9e5e9e0f07df00d5ba7bf2a2feb756ca. (cherry picked from commit ee7ae8cc515f709bde46d0593cc5fdb1e8c03529) --- .../io/quarkus/test/common/LauncherUtil.java | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/LauncherUtil.java b/test-framework/common/src/main/java/io/quarkus/test/common/LauncherUtil.java index 70ba20715bb64..e6fe3df54729d 100644 --- a/test-framework/common/src/main/java/io/quarkus/test/common/LauncherUtil.java +++ b/test-framework/common/src/main/java/io/quarkus/test/common/LauncherUtil.java @@ -3,6 +3,8 @@ import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.time.Duration; @@ -51,10 +53,10 @@ public static Config installAndGetSomeConfig() { * Launches a process using the supplied arguments and makes sure the process's output is drained to standard out */ static Process launchProcess(List args) throws IOException { - return new ProcessBuilder(args) - .redirectErrorStream(true) - .redirectOutput(ProcessBuilder.Redirect.INHERIT) - .start(); + Process process = Runtime.getRuntime().exec(args.toArray(new String[0])); + new Thread(new ProcessReader(process.getInputStream())).start(); + new Thread(new ProcessReader(process.getErrorStream())).start(); + return process; } /** @@ -307,6 +309,31 @@ private void unableToDetermineData(String errorMessage) { } } + /** + * Used to drain the input of a launched process + */ + private static class ProcessReader implements Runnable { + + private final InputStream inputStream; + + private ProcessReader(InputStream inputStream) { + this.inputStream = inputStream; + } + + @Override + public void run() { + byte[] b = new byte[100]; + int i; + try { + while ((i = inputStream.read(b)) > 0) { + System.out.print(new String(b, 0, i, StandardCharsets.UTF_8)); + } + } catch (IOException e) { + //ignore + } + } + } + private static class SimpleContext implements IntegrationTestStartedNotifier.Context { private final Path logFile; From b64fa0afe127a4fdec9d2678fa32c004b25bd3f0 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 17 May 2023 10:28:39 +0300 Subject: [PATCH 04/33] Add note about LauncherUtil#launchProcess Co-authored-by: George Gastaldi (cherry picked from commit 8c74964bcde1fb121981933d48a3c443d184e9e9) --- .../src/main/java/io/quarkus/test/common/LauncherUtil.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/LauncherUtil.java b/test-framework/common/src/main/java/io/quarkus/test/common/LauncherUtil.java index e6fe3df54729d..baea0de7847b6 100644 --- a/test-framework/common/src/main/java/io/quarkus/test/common/LauncherUtil.java +++ b/test-framework/common/src/main/java/io/quarkus/test/common/LauncherUtil.java @@ -51,6 +51,9 @@ public static Config installAndGetSomeConfig() { /** * Launches a process using the supplied arguments and makes sure the process's output is drained to standard out + *

+ * Implementation detail: Avoid using ProcessBuilder's redirect here because it causes problems with Maven Failsafe + * as can be seen in here */ static Process launchProcess(List args) throws IOException { Process process = Runtime.getRuntime().exec(args.toArray(new String[0])); From 18f7fa385346eb23e05171e0f4f88b354a3b7369 Mon Sep 17 00:00:00 2001 From: Jose Date: Wed, 17 May 2023 15:11:25 +0200 Subject: [PATCH 05/33] Fix location and content location headers in Resteasy Reactive When providing a location, the URI was being decoded, so the value was being altered from what users set. Note that these changes are based on what Resteasy already does: https://github.com/resteasy/resteasy/blob/dadddfb699a875c44ba05c0abe176873acbd9aa2/resteasy-core/src/main/java/org/jboss/resteasy/specimpl/ResponseBuilderImpl.java#L187 Fix https://github.com/quarkusio/quarkus/issues/33419 (cherry picked from commit ced8b0a739651f312744e721ca9f11c49f1834f0) --- .../server/jaxrs/ResponseBuilderImpl.java | 19 ++++++++++++------- .../server/jaxrs/RestResponseBuilderImpl.java | 19 ++++++++++++------- .../vertx/test/response/ResponseTest.java | 17 +++++++++++++++++ .../test/response/RestResponseResource.java | 19 +++++++++++++++++++ .../vertx/test/response/RestResponseTest.java | 8 ++++++++ 5 files changed, 68 insertions(+), 14 deletions(-) diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/ResponseBuilderImpl.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/ResponseBuilderImpl.java index c4c2847152c43..208c1093d4fd8 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/ResponseBuilderImpl.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/ResponseBuilderImpl.java @@ -40,10 +40,12 @@ public Response.ResponseBuilder location(URI location) { prefix = deployment.getPrefix(); } // Spec says relative to request, but TCK tests relative to Base URI, so we do that - location = new URI(req.getRequestScheme(), null, host, port, - prefix + - (location.getPath().startsWith("/") ? location.getPath() : "/" + location.getPath()), - location.getQuery(), null); + String path = location.toString(); + if (!path.startsWith("/")) { + path = "/" + path; + } + URI baseUri = new URI(req.getRequestScheme(), null, host, port, null, null, null); + location = baseUri.resolve(prefix + path); } catch (URISyntaxException e) { throw new RuntimeException(e); } @@ -72,9 +74,12 @@ public Response.ResponseBuilder contentLocation(URI location) { port = Integer.parseInt(host.substring(index + 1)); host = host.substring(0, index); } - location = new URI(req.getRequestScheme(), null, host, port, - location.getPath().startsWith("/") ? location.getPath() : "/" + location.getPath(), - location.getQuery(), null); + String path = location.toString(); + if (!path.startsWith("/")) { + path = "/" + path; + } + location = new URI(req.getRequestScheme(), null, host, port, null, null, null) + .resolve(path); } catch (URISyntaxException e) { throw new RuntimeException(e); } diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/RestResponseBuilderImpl.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/RestResponseBuilderImpl.java index 21d74d4b9f828..a62003cbef6a5 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/RestResponseBuilderImpl.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/RestResponseBuilderImpl.java @@ -40,10 +40,12 @@ public RestResponse.ResponseBuilder location(URI location) { prefix = deployment.getPrefix(); } // Spec says relative to request, but TCK tests relative to Base URI, so we do that - location = new URI(req.getRequestScheme(), null, host, port, - prefix + - (location.getPath().startsWith("/") ? location.getPath() : "/" + location.getPath()), - location.getQuery(), null); + String path = location.toString(); + if (!path.startsWith("/")) { + path = "/" + path; + } + URI baseUri = new URI(req.getRequestScheme(), null, host, port, null, null, null); + location = baseUri.resolve(prefix + path); } catch (URISyntaxException e) { throw new RuntimeException(e); } @@ -72,9 +74,12 @@ public RestResponse.ResponseBuilder contentLocation(URI location) { port = Integer.parseInt(host.substring(index + 1)); host = host.substring(0, index); } - location = new URI(req.getRequestScheme(), null, host, port, - location.getPath().startsWith("/") ? location.getPath() : "/" + location.getPath(), - location.getQuery(), null); + String path = location.toString(); + if (!path.startsWith("/")) { + path = "/" + path; + } + location = new URI(req.getRequestScheme(), null, host, port, null, null, null) + .resolve(path); } catch (URISyntaxException e) { throw new RuntimeException(e); } diff --git a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/ResponseTest.java b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/ResponseTest.java index 40af3653860a6..849646f9eb373 100644 --- a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/ResponseTest.java +++ b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/ResponseTest.java @@ -2,6 +2,7 @@ import jakarta.ws.rs.core.HttpHeaders; import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.UriBuilder; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -16,4 +17,20 @@ public void testCaseInsensitivity() { Assertions.assertEquals("HEAD", response.getHeaders().getFirst("allow")); Assertions.assertEquals("HEAD", response.getHeaders().getFirst(HttpHeaders.ALLOW)); } + + @Test + public void testLocation() { + final var location = UriBuilder.fromUri("http://localhost:8080").path("{language}") + .build("en/us"); + Response response = Response.ok("Hello").location(location).build(); + Assertions.assertEquals("http://localhost:8080/en%2Fus", response.getLocation().toString()); + } + + @Test + public void testContentLocation() { + final var location = UriBuilder.fromUri("http://localhost:8080").path("{language}") + .build("en/us"); + Response response = Response.ok("Hello").contentLocation(location).build(); + Assertions.assertEquals("http://localhost:8080/en%2Fus", response.getHeaderString("Content-Location")); + } } diff --git a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseResource.java b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseResource.java index 1c2f8f1e5a8b0..d72fdf301ac5e 100644 --- a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseResource.java +++ b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseResource.java @@ -13,6 +13,7 @@ import jakarta.ws.rs.core.CacheControl; import jakarta.ws.rs.core.NewCookie; import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.UriBuilder; import jakarta.ws.rs.core.Variant; import org.jboss.resteasy.reactive.RestResponse; @@ -47,6 +48,24 @@ public RestResponse wildcard() { return RestResponse.ResponseBuilder.ok("Hello").header("content-type", "text/plain").build(); } + @GET + @Path("rest-response-location") + public RestResponse location() { + final var location = UriBuilder.fromResource(RestResponseResource.class).path("{language}") + .queryParam("user", "John") + .build("en/us"); + return RestResponse.ResponseBuilder.ok("Hello").location(location).build(); + } + + @GET + @Path("rest-response-content-location") + public RestResponse contentLocation() { + final var location = UriBuilder.fromResource(RestResponseResource.class).path("{language}") + .queryParam("user", "John") + .build("en/us"); + return RestResponse.ResponseBuilder.ok("Hello").contentLocation(location).build(); + } + @GET @Path("rest-response-full") @SuppressWarnings("deprecation") diff --git a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseTest.java b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseTest.java index 03d83f208b2c9..2563091c4f076 100644 --- a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseTest.java +++ b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseTest.java @@ -1,5 +1,7 @@ package org.jboss.resteasy.reactive.server.vertx.test.response; +import static org.hamcrest.CoreMatchers.endsWith; + import java.util.function.Supplier; import org.hamcrest.Matchers; @@ -107,5 +109,11 @@ public void test() { .then().statusCode(200) .and().body(Matchers.equalTo("Uni request filter")) .and().contentType("text/plain"); + RestAssured.get("/rest-response-location") + .then().statusCode(200) + .header("Location", endsWith("/en%2Fus?user=John")); + RestAssured.get("/rest-response-content-location") + .then().statusCode(200) + .header("Content-Location", endsWith("/en%2Fus?user=John")); } } From 99d750ef7a720eaefa92f36eb3b5b3951d992d48 Mon Sep 17 00:00:00 2001 From: Holly Cummins Date: Wed, 17 May 2023 21:40:02 +0100 Subject: [PATCH 06/33] Fix malformed sentence (cherry picked from commit e03b7e534a53a7129c12ae9aa0e7f817e6fa8d24) --- docs/src/main/asciidoc/getting-started-testing.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/getting-started-testing.adoc b/docs/src/main/asciidoc/getting-started-testing.adoc index 628392be3c429..50673af86f6d6 100644 --- a/docs/src/main/asciidoc/getting-started-testing.adoc +++ b/docs/src/main/asciidoc/getting-started-testing.adoc @@ -883,7 +883,7 @@ public class MockTestCase { } } ---- -<1> `@InjectMock` results in a mock being and is available in test methods of the test class (other test classes are *not* affected by this) +<1> `@InjectMock` results in a Mockito mock being created, which is then available in test methods of the test class (other test classes are *not* affected by this) <2> The `mockableBean1` is configured here for every test method of the class <3> Since the `mockableBean2` mock has not been configured, it will return the default Mockito response. <4> In this test the `mockableBean2` is configured, so it returns the configured response. From d068569a88c37936831fd16842de449a4b28dd01 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Tue, 16 May 2023 15:30:46 +0300 Subject: [PATCH 07/33] Improve documentation of DockerConfig As shown in #33406, the current Javadoc caused some confusion. Co-authored-by: Guillaume Smet Co-authored-by: Manyanda Chitimbo (cherry picked from commit cd7b5378725b844011fef82f8bc805534cebbfd0) --- .../image/docker/deployment/DockerConfig.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/extensions/container-image/container-image-docker/deployment/src/main/java/io/quarkus/container/image/docker/deployment/DockerConfig.java b/extensions/container-image/container-image-docker/deployment/src/main/java/io/quarkus/container/image/docker/deployment/DockerConfig.java index 6e10784ef2a04..b9b06ee6bfe83 100644 --- a/extensions/container-image/container-image-docker/deployment/src/main/java/io/quarkus/container/image/docker/deployment/DockerConfig.java +++ b/extensions/container-image/container-image-docker/deployment/src/main/java/io/quarkus/container/image/docker/deployment/DockerConfig.java @@ -4,6 +4,7 @@ import java.util.Map; import java.util.Optional; +import io.quarkus.runtime.annotations.ConfigDocDefault; import io.quarkus.runtime.annotations.ConfigDocSection; import io.quarkus.runtime.annotations.ConfigGroup; import io.quarkus.runtime.annotations.ConfigItem; @@ -15,20 +16,22 @@ public class DockerConfig { /** * Path to the JVM Dockerfile. - * If not set ${project.root}/src/main/docker/Dockerfile.jvm will be used * If set to an absolute path then the absolute path will be used, otherwise the path - * will be considered relative to the project root + * will be considered relative to the project root. + * If not set src/main/docker/Dockerfile.jvm will be used. */ @ConfigItem + @ConfigDocDefault("src/main/docker/Dockerfile.jvm") public Optional dockerfileJvmPath; /** - * Path to the JVM Dockerfile. - * If not set ${project.root}/src/main/docker/Dockerfile.native will be used + * Path to the native Dockerfile. * If set to an absolute path then the absolute path will be used, otherwise the path - * will be considered relative to the project root + * will be considered relative to the project root. + * If not set src/main/docker/Dockerfile.native will be used. */ @ConfigItem + @ConfigDocDefault("src/main/docker/Dockerfile.native") public Optional dockerfileNativePath; /** @@ -100,4 +103,4 @@ boolean useBuildx() { progress.isPresent(); } } -} \ No newline at end of file +} From 18585393d07b0b13936339bb7bf2b9b0d9a2aec6 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 10 May 2023 14:40:53 +0300 Subject: [PATCH 08/33] Ensure that Google Cloud Functions and Jib extensions work together Fixes: #33011 (cherry picked from commit cfe9a1903fb8492593cbe89bf9b469289f45c3d9) --- .../quarkus/container/image/jib/deployment/JibProcessor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java index 3bca893339175..f0bb17db06bea 100644 --- a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java +++ b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java @@ -74,6 +74,7 @@ import io.quarkus.deployment.pkg.builditem.JarBuildItem; import io.quarkus.deployment.pkg.builditem.NativeImageBuildItem; import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem; +import io.quarkus.deployment.pkg.builditem.UberJarRequiredBuildItem; import io.quarkus.deployment.pkg.builditem.UpxCompressedBuildItem; import io.quarkus.deployment.pkg.steps.JarResultBuildStep; import io.quarkus.deployment.pkg.steps.NativeBuild; @@ -150,6 +151,7 @@ public void buildFromJar(ContainerImageConfig containerImageConfig, JibConfig ji Optional pushRequest, List containerImageLabels, Optional appCDSResult, + List uberJarRequired, BuildProducer artifactResultProducer, BuildProducer containerImageBuilder) { @@ -161,7 +163,8 @@ public void buildFromJar(ContainerImageConfig containerImageConfig, JibConfig ji JibContainerBuilder jibContainerBuilder; String packageType = packageConfig.type; - if (packageConfig.isLegacyJar() || packageType.equalsIgnoreCase(PackageConfig.BuiltInType.UBER_JAR.getValue())) { + if (packageConfig.isLegacyJar() || packageType.equalsIgnoreCase(PackageConfig.BuiltInType.UBER_JAR.getValue()) + || !uberJarRequired.isEmpty()) { jibContainerBuilder = createContainerBuilderFromLegacyJar(determineBaseJvmImage(jibConfig, compiledJavaVersion), jibConfig, containerImageConfig, sourceJar, outputTarget, mainClass, containerImageLabels); From 9fb38f02e1a569e97280e09efe46b4b9095228f4 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Wed, 17 May 2023 18:11:14 +0200 Subject: [PATCH 09/33] Create all the required directories before copying native JSON files Fix #33450 (cherry picked from commit fe93f9f486b9f3b7be7167caa0f5711f39efbcbb) --- .../java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java index 9fac9e84a2560..3936e20529b2e 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java @@ -1030,6 +1030,7 @@ private void copyJsonConfigFiles(ApplicationArchivesBuildItem applicationArchive @Override public void accept(Path jsonPath) { try { + Files.createDirectories(thinJarDirectory); Files.copy(jsonPath, thinJarDirectory.resolve(jsonPath.getFileName().toString())); } catch (IOException e) { throw new UncheckedIOException( From 92a9a190cd2e1993789cb5a167ba874ddafafe3a Mon Sep 17 00:00:00 2001 From: Jan Martiska Date: Thu, 18 May 2023 09:00:39 +0200 Subject: [PATCH 10/33] Disable flaky OTel-GraphQL test for now (cherry picked from commit 05e43b2cbcedd91efa5357062c10482349066f45) --- .../deployment/instrumentation/GraphQLOpenTelemetryTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GraphQLOpenTelemetryTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GraphQLOpenTelemetryTest.java index 74a7705427553..765d5e5ca9284 100644 --- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GraphQLOpenTelemetryTest.java +++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/instrumentation/GraphQLOpenTelemetryTest.java @@ -38,6 +38,7 @@ import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.asset.StringAsset; import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -116,6 +117,7 @@ void multipleResultQueryTraceTest() { } @Test + @Disabled // TODO: flaky test, find out how to fix it void nestedCdiBeanInsideQueryTraceTest() throws ExecutionException, InterruptedException { String request = getPayload("query {\n" + " helloAfterSecond\n" + From 7b1d0abfe1615f726a7ae5228f1f0d394735fcd3 Mon Sep 17 00:00:00 2001 From: Jose Date: Thu, 18 May 2023 13:37:47 +0200 Subject: [PATCH 11/33] Ensure the classes to be bound in JAXB are cleared in DEV mode The classes in the recorder were not cleared when restaring the app, so the classes to be bound were accumulated in each iteration. Fix https://github.com/quarkusio/quarkus/issues/33441 (cherry picked from commit 4a5006e3240c65688c19e48bb22a04c65272bdfa) --- .../main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java | 1 + .../io/quarkus/jaxb/runtime/JaxbContextConfigRecorder.java | 4 ++++ .../java/io/quarkus/jaxb/runtime/JaxbContextProducer.java | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java b/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java index 22ce22a0d4643..17768f6d8e62b 100644 --- a/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java +++ b/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java @@ -322,6 +322,7 @@ void bindClassesToJaxbContext( SynthesisFinishedBuildItem beanContainerState, JaxbContextConfigRecorder jaxbContextConfig /* Force the build time container to invoke this method */) { + jaxbContextConfig.reset(); final BeanResolver beanResolver = beanContainerState.getBeanResolver(); final Set beans = beanResolver .resolveBeans(Type.create(DotName.createSimple(JAXBContext.class), org.jboss.jandex.Type.Kind.CLASS)); diff --git a/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextConfigRecorder.java b/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextConfigRecorder.java index 30ef87780cda1..f0a6e4587a500 100644 --- a/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextConfigRecorder.java +++ b/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextConfigRecorder.java @@ -15,6 +15,10 @@ public void addClassesToBeBound(Collection> classes) { this.classesToBeBound.addAll(classes); } + public void reset() { + classesToBeBound.clear(); + } + public static Set> getClassesToBeBound() { return Collections.unmodifiableSet(classesToBeBound); } diff --git a/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextProducer.java b/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextProducer.java index 8bfb0c6f1afd1..3b2dbc7cf4cb3 100644 --- a/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextProducer.java +++ b/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextProducer.java @@ -4,8 +4,10 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.context.RequestScoped; @@ -71,7 +73,7 @@ public JAXBContext createJAXBContext(Instance customizers customizer.customizeContextProperties(properties); } - List classes = new ArrayList<>(); + Set classes = new HashSet<>(); classes.addAll(Arrays.asList(extraClasses)); classes.addAll(JaxbContextConfigRecorder.getClassesToBeBound()); From f4bdd3b75a8757febac8d182ab37620360c7d7d2 Mon Sep 17 00:00:00 2001 From: Martin Kouba Date: Thu, 18 May 2023 08:58:23 +0200 Subject: [PATCH 12/33] Fix config mapping and config properties synthetic beans - register synthetic injection point for InjectionPoint metadata (cherry picked from commit c411487b46d0fbb156b5a55b74eecc6b11cf5f9d) --- .../io/quarkus/arc/deployment/ConfigBuildStep.java | 3 +++ .../quarkus/arc/runtime/ConfigMappingCreator.java | 13 ++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java index 3485fb2959f7b..af7ad71af9a81 100644 --- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java +++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java @@ -38,6 +38,7 @@ import org.jboss.jandex.AnnotationTarget; import org.jboss.jandex.AnnotationValue; import org.jboss.jandex.ClassInfo; +import org.jboss.jandex.ClassType; import org.jboss.jandex.DotName; import org.jboss.jandex.FieldInfo; import org.jboss.jandex.MethodInfo; @@ -320,6 +321,7 @@ void registerConfigMappingsBean( .configure(configClass.getConfigClass()) .types(configClass.getTypes().toArray(new Type[] {})) .creator(ConfigMappingCreator.class) + .addInjectionPoint(ClassType.create(DotNames.INJECTION_POINT)) .param("type", configClass.getConfigClass()) .param("prefix", configClass.getPrefix()); @@ -367,6 +369,7 @@ void registerConfigPropertiesBean( createStringValue("prefix", configClass.getPrefix()) })) .creator(ConfigMappingCreator.class) + .addInjectionPoint(ClassType.create(DotNames.INJECTION_POINT)) .param("type", configClass.getConfigClass()) .param("prefix", configClass.getPrefix()))); } diff --git a/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ConfigMappingCreator.java b/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ConfigMappingCreator.java index d59f8f67df12c..98d572aadfc9f 100644 --- a/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ConfigMappingCreator.java +++ b/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ConfigMappingCreator.java @@ -1,10 +1,8 @@ package io.quarkus.arc.runtime; import java.lang.annotation.Annotation; -import java.util.Map; import java.util.Optional; -import jakarta.enterprise.context.spi.CreationalContext; import jakarta.enterprise.inject.spi.Annotated; import jakarta.enterprise.inject.spi.InjectionPoint; @@ -12,20 +10,21 @@ import org.eclipse.microprofile.config.inject.ConfigProperties; import io.quarkus.arc.BeanCreator; -import io.quarkus.arc.impl.InjectionPointProvider; +import io.quarkus.arc.SyntheticCreationalContext; import io.smallrye.config.ConfigMapping; import io.smallrye.config.SmallRyeConfig; public class ConfigMappingCreator implements BeanCreator { + @Override - public Object create(CreationalContext creationalContext, Map params) { - InjectionPoint injectionPoint = InjectionPointProvider.get(); + public Object create(SyntheticCreationalContext context) { + InjectionPoint injectionPoint = context.getInjectedReference(InjectionPoint.class); if (injectionPoint == null) { throw new IllegalStateException("No current injection point found"); } - Class interfaceType = (Class) params.get("type"); - String prefix = (String) params.get("prefix"); + Class interfaceType = (Class) context.getParams().get("type"); + String prefix = (String) context.getParams().get("prefix"); SmallRyeConfig config = (SmallRyeConfig) ConfigProvider.getConfig(); return config.getConfigMapping(interfaceType, getPrefixFromInjectionPoint(injectionPoint).orElse(prefix)); From bba42718bf9bffe91391d5660699c276f1092d7f Mon Sep 17 00:00:00 2001 From: Martin Kouba Date: Thu, 18 May 2023 09:01:24 +0200 Subject: [PATCH 13/33] ArC - fix observer method injection for dependent synthetic beans - always wrap the injection point that resolves to a dependent synthetic bean - unify the logic for regular injection points and observer injection points - fixes #33449 (cherry picked from commit bb54ac5e2ca4354f46e8d9db0797d633ca7d3072) --- ...ependentSyntheticBeanWithMetadataTest.java | 46 +++++++++++++++++++ .../arc/processor/BeanConfiguratorBase.java | 7 ++- .../quarkus/arc/processor/BeanGenerator.java | 8 +--- .../io/quarkus/arc/processor/BeanInfo.java | 9 ++++ .../arc/processor/InjectionPointInfo.java | 14 ++++++ .../arc/processor/ObserverGenerator.java | 5 +- 6 files changed, 74 insertions(+), 15 deletions(-) create mode 100644 extensions/arc/deployment/src/test/java/io/quarkus/arc/test/observer/injectionpoint/ObserverInjectingDependentSyntheticBeanWithMetadataTest.java diff --git a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/observer/injectionpoint/ObserverInjectingDependentSyntheticBeanWithMetadataTest.java b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/observer/injectionpoint/ObserverInjectingDependentSyntheticBeanWithMetadataTest.java new file mode 100644 index 0000000000000..ae3c4dd919bcc --- /dev/null +++ b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/observer/injectionpoint/ObserverInjectingDependentSyntheticBeanWithMetadataTest.java @@ -0,0 +1,46 @@ +package io.quarkus.arc.test.observer.injectionpoint; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import jakarta.enterprise.event.Observes; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import io.quarkus.runtime.StartupEvent; +import io.quarkus.test.QuarkusUnitTest; +import io.smallrye.config.ConfigMapping; +import io.smallrye.config.WithDefault; + +public class ObserverInjectingDependentSyntheticBeanWithMetadataTest { + + @RegisterExtension + static final QuarkusUnitTest config = new QuarkusUnitTest() + .withApplicationRoot(root -> root.addClasses(MyConfig.class)).overrideConfigKey("my.config.value1", "42"); + + @Test + public void testInjection() { + + } + + @ConfigMapping(prefix = "my.config") + public interface MyConfig { + + int value1(); + + @WithDefault("baz") + String value2(); + + } + + public static class MyBean { + + void onStart(@Observes StartupEvent event, MyConfig config) { + // A @Dependent synthetic bean is registered for MyConfig, and it attempts to obtain InjectionPoint in its create() method + assertEquals(42, config.value1()); + assertEquals("baz", config.value2()); + } + + } + +} diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java index 8e994d19333a6..05526bf52f0bc 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java @@ -257,10 +257,9 @@ public THIS providerType(Type providerType) { * @see SyntheticCreationalContext */ public THIS addInjectionPoint(Type requiredType, AnnotationInstance... requiredQualifiers) { - if (requiredQualifiers.length == 0) { - requiredQualifiers = new AnnotationInstance[] { AnnotationInstance.builder(Default.class).build() }; - } - this.injectionPoints.add(new TypeAndQualifiers(requiredType, Set.of(requiredQualifiers))); + this.injectionPoints.add(new TypeAndQualifiers(requiredType, + requiredQualifiers.length == 0 ? Set.of(AnnotationInstance.builder(Default.class).build()) + : Set.of(requiredQualifiers))); return self(); } diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java index 491a5855b0f39..7b0ace32b5150 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java @@ -715,13 +715,7 @@ protected MethodCreator initConstructor(ClassOutput classOutput, ClassCreator be reflectionRegistration, injectionPointAnnotationsPredicate)); } else { // Not a built-in bean - if (BuiltinScope.DEPENDENT.is(injectionPoint.getResolvedBean().getScope()) - && (injectionPoint.getResolvedBean() - .getAllInjectionPoints().stream() - .anyMatch(ip -> BuiltinBean.INJECTION_POINT.hasRawTypeDotName(ip.getRequiredType().name())) - || injectionPoint.getResolvedBean().isSynthetic())) { - // Injection point resolves to a dependent bean that injects InjectionPoint metadata and so we need to wrap the injectable - // reference provider + if (injectionPoint.isCurrentInjectionPointWrapperNeeded()) { ResultHandle wrapHandle = wrapCurrentInjectionPoint(classOutput, beanCreator, bean, constructor, injectionPoint, paramIdx++, tccl, reflectionRegistration); ResultHandle wrapSupplierHandle = constructor.newInstance( diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanInfo.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanInfo.java index 93803ee8fff08..fcf2b7e5b754d 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanInfo.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanInfo.java @@ -279,6 +279,15 @@ public List getAllInjectionPoints() { return injectionPoints; } + boolean requiresInjectionPointMetadata() { + for (InjectionPointInfo injectionPoint : getAllInjectionPoints()) { + if (DotNames.INJECTION_POINT.equals(injectionPoint.getRequiredType().name())) { + return true; + } + } + return false; + } + Optional getConstructorInjection() { return injections.isEmpty() ? Optional.empty() : injections.stream().filter(Injection::isConstructor).findAny(); } diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java index c02cb407a7026..67997481ce130 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java @@ -304,6 +304,20 @@ public boolean isSynthetic() { return target == null; } + /** + * If an injection point resolves to a dependent bean that (A) injects the InjectionPoint metadata or (2) is synthetic, then + * we need to wrap the injectable reference provider. + * + * @return {@code true} if a wrapper is needed, {@code false} otherwise + */ + boolean isCurrentInjectionPointWrapperNeeded() { + BeanInfo bean = getResolvedBean(); + if (bean != null && BuiltinScope.DEPENDENT.is(bean.getScope())) { + return bean.isSynthetic() || bean.requiresInjectionPointMetadata(); + } + return false; + } + @Override public String toString() { return "InjectionPointInfo [requiredType=" + typeAndQualifiers.type + ", requiredQualifiers=" diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ObserverGenerator.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ObserverGenerator.java index 1564231fffe47..45407549f2781 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ObserverGenerator.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ObserverGenerator.java @@ -551,10 +551,7 @@ protected void createConstructor(ClassOutput classOutput, ClassCreator observerC injectionPointToProviderField.get(injectionPoint), annotationLiterals, observer, reflectionRegistration, injectionPointAnnotationsPredicate)); } else { - if (injectionPoint.getResolvedBean().getAllInjectionPoints().stream() - .anyMatch(ip -> BuiltinBean.INJECTION_POINT.hasRawTypeDotName(ip.getRequiredType().name()))) { - // IMPL NOTE: Injection point resolves to a dependent bean that injects InjectionPoint metadata and so we need to wrap the injectable - // reference provider + if (injectionPoint.isCurrentInjectionPointWrapperNeeded()) { ResultHandle requiredQualifiersHandle = BeanGenerator.collectInjectionPointQualifiers(classOutput, observerCreator, observer.getDeclaringBean().getDeployment(), constructor, From 0d41823df3b76ac7aac7baa14a853b4e66a97557 Mon Sep 17 00:00:00 2001 From: Sergey Beryozkin Date: Wed, 17 May 2023 18:19:17 +0100 Subject: [PATCH 14/33] Disable non configured default OIDC tenant if TenantConfigResolver is available (cherry picked from commit c8c60c1b0ab083084ffb7cf78feff323cceb2114) --- .../security-openid-connect-multitenancy.adoc | 3 +- .../resources/application-dev-mode.properties | 1 - .../io/quarkus/oidc/OidcTenantConfig.java | 4 ++ .../io/quarkus/oidc/runtime/OidcRecorder.java | 46 ++++++++++++------- 4 files changed, 35 insertions(+), 19 deletions(-) diff --git a/docs/src/main/asciidoc/security-openid-connect-multitenancy.adoc b/docs/src/main/asciidoc/security-openid-connect-multitenancy.adoc index a2f21633539e0..8c1c0208280e4 100644 --- a/docs/src/main/asciidoc/security-openid-connect-multitenancy.adoc +++ b/docs/src/main/asciidoc/security-openid-connect-multitenancy.adoc @@ -637,6 +637,7 @@ import jakarta.enterprise.context.ApplicationScoped; import java.util.function.Supplier; import io.smallrye.mutiny.Uni; +import io.quarkus.oidc.OidcRequestContext; import io.quarkus.oidc.OidcTenantConfig; import io.quarkus.oidc.TenantConfigResolver; import io.vertx.ext.web.RoutingContext; @@ -645,7 +646,7 @@ import io.vertx.ext.web.RoutingContext; public class CustomTenantConfigResolver implements TenantConfigResolver { @Override - public Uni resolve(RoutingContext context, TenantConfigResolver.TenantConfigRequestContext requestContext) { + public Uni resolve(RoutingContext context, OidcRequestContext requestContext) { String path = context.request().path(); String[] parts = path.split("/"); diff --git a/extensions/oidc/deployment/src/test/resources/application-dev-mode.properties b/extensions/oidc/deployment/src/test/resources/application-dev-mode.properties index b1b8048e09fd2..fad0040fdfdbb 100644 --- a/extensions/oidc/deployment/src/test/resources/application-dev-mode.properties +++ b/extensions/oidc/deployment/src/test/resources/application-dev-mode.properties @@ -8,4 +8,3 @@ quarkus.oidc.application-type=web-app quarkus.oidc.logout.path=/protected/logout quarkus.log.category."com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleSheet".level=FATAL - diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java index 58f8479206ef2..135d154839a42 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java @@ -30,6 +30,10 @@ public class OidcTenantConfig extends OidcCommonConfig { /** * If this tenant configuration is enabled. + * + * Note that the default tenant will be disabled if it is not configured + * but either {@link TenantResolver} or {@link TenantConfigResolver} are registered. + * You do not have to disable the default tenant in this case. */ @ConfigItem(defaultValue = "true") public boolean tenantEnabled = true; diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java index 0d5e48cc58f93..42ffc9ea3a155 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java @@ -16,12 +16,15 @@ import org.jose4j.jwk.PublicJsonWebKey; import io.quarkus.arc.Arc; +import io.quarkus.arc.ArcContainer; import io.quarkus.oidc.OIDCException; import io.quarkus.oidc.OidcConfigurationMetadata; import io.quarkus.oidc.OidcTenantConfig; import io.quarkus.oidc.OidcTenantConfig.ApplicationType; import io.quarkus.oidc.OidcTenantConfig.Roles.Source; import io.quarkus.oidc.OidcTenantConfig.TokenStateManager.Strategy; +import io.quarkus.oidc.TenantConfigResolver; +import io.quarkus.oidc.TenantResolver; import io.quarkus.oidc.common.runtime.OidcCommonConfig; import io.quarkus.oidc.common.runtime.OidcCommonUtils; import io.quarkus.runtime.ExecutorRecorder; @@ -58,14 +61,14 @@ public Supplier setup(OidcConfig config, Supplier vertx final Vertx vertxValue = vertx.get(); String defaultTenantId = config.defaultTenant.getTenantId().orElse(OidcUtils.DEFAULT_TENANT_ID); - TenantConfigContext defaultTenantContext = createStaticTenantContext(vertxValue, config.defaultTenant, tlsConfig, - defaultTenantId); + TenantConfigContext defaultTenantContext = createStaticTenantContext(vertxValue, config.defaultTenant, + !config.namedTenants.isEmpty(), tlsConfig, defaultTenantId); Map staticTenantsConfig = new HashMap<>(); for (Map.Entry tenant : config.namedTenants.entrySet()) { OidcCommonUtils.verifyConfigurationId(defaultTenantId, tenant.getKey(), tenant.getValue().getTenantId()); staticTenantsConfig.put(tenant.getKey(), - createStaticTenantContext(vertxValue, tenant.getValue(), tlsConfig, tenant.getKey())); + createStaticTenantContext(vertxValue, tenant.getValue(), false, tlsConfig, tenant.getKey())); } return new Supplier() { @@ -91,7 +94,7 @@ private Uni createDynamicTenantContext(Vertx vertx, "BackChannel Logout is currently not supported for dynamic tenants"); } if (!dynamicTenantsConfig.containsKey(tenantId)) { - Uni uniContext = createTenantContext(vertx, oidcConfig, tlsConfig, tenantId); + Uni uniContext = createTenantContext(vertx, oidcConfig, false, tlsConfig, tenantId); uniContext.onFailure().transform(new Function() { @Override public Throwable apply(Throwable t) { @@ -112,9 +115,9 @@ public TenantConfigContext apply(TenantConfigContext t) { } private TenantConfigContext createStaticTenantContext(Vertx vertx, - OidcTenantConfig oidcConfig, TlsConfig tlsConfig, String tenantId) { + OidcTenantConfig oidcConfig, boolean checkTenantResolver, TlsConfig tlsConfig, String tenantId) { - Uni uniContext = createTenantContext(vertx, oidcConfig, tlsConfig, tenantId); + Uni uniContext = createTenantContext(vertx, oidcConfig, checkTenantResolver, tlsConfig, tenantId); return uniContext.onFailure() .recoverWithItem(new Function() { @Override @@ -148,8 +151,9 @@ private static Throwable logTenantConfigContextFailure(Throwable t, String tenan } @SuppressWarnings("resource") - private Uni createTenantContext(Vertx vertx, OidcTenantConfig oidcTenantConfig, TlsConfig tlsConfig, - String tenantId) { + private Uni createTenantContext(Vertx vertx, OidcTenantConfig oidcTenantConfig, + boolean checkTenantResolver, + TlsConfig tlsConfig, String tenantId) { if (!oidcTenantConfig.tenantId.isPresent()) { oidcTenantConfig.tenantId = Optional.of(tenantId); } @@ -166,7 +170,23 @@ private Uni createTenantContext(Vertx vertx, OidcTenantConf } try { - verifyAuthServerUrl(oidcConfig); + if (!oidcConfig.getAuthServerUrl().isPresent()) { + if (OidcUtils.DEFAULT_TENANT_ID.equals(oidcConfig.tenantId.get())) { + ArcContainer container = Arc.container(); + if (container != null + && (container.instance(TenantConfigResolver.class).isAvailable() + || (checkTenantResolver && container.instance(TenantResolver.class).isAvailable()))) { + LOG.debugf("Default tenant is not configured and will be disabled" + + " because either 'TenantConfigResolver' or `TenantResolver`which will resolve" + + " tenant configurations are registered"); + oidcConfig.setTenantEnabled(false); + return Uni.createFrom() + .item(new TenantConfigContext(new OidcProvider(null, null, null, null), oidcConfig)); + } + } + throw new ConfigurationException("'quarkus.oidc.auth-server-url' property must be configured"); + } + OidcCommonUtils.verifyEndpointUrl(oidcConfig.getAuthServerUrl().get()); OidcCommonUtils.verifyCommonConfiguration(oidcConfig, isServiceApp(oidcConfig), true); } catch (ConfigurationException t) { return Uni.createFrom().failure(t); @@ -447,12 +467,4 @@ private static boolean isServiceApp(OidcTenantConfig oidcConfig) { private static boolean isWebApp(OidcTenantConfig oidcConfig) { return ApplicationType.WEB_APP.equals(oidcConfig.applicationType.orElse(ApplicationType.SERVICE)); } - - private static void verifyAuthServerUrl(OidcCommonConfig oidcConfig) { - if (!oidcConfig.getAuthServerUrl().isPresent()) { - throw new ConfigurationException("'quarkus.oidc.auth-server-url' property must be configured"); - } - OidcCommonUtils.verifyEndpointUrl(oidcConfig.getAuthServerUrl().get()); - } - } From ee42fcaaf3b0eb70fc089965f5ee1f1c2fa53a0f Mon Sep 17 00:00:00 2001 From: Fouad Almalki Date: Thu, 18 May 2023 15:39:48 +0300 Subject: [PATCH 15/33] Add support of signature algorithms (PSxxx, EdDSA) in quarkus-oidc (cherry picked from commit 8a04d1c9d4bf21437c48f7b2aa4f8233b234c17d) --- .../src/main/java/io/quarkus/oidc/runtime/OidcProvider.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProvider.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProvider.java index b6a16df6e1a88..71874a4d74359 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProvider.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProvider.java @@ -47,7 +47,11 @@ public class OidcProvider implements Closeable { SignatureAlgorithm.RS512.getAlgorithm(), SignatureAlgorithm.ES256.getAlgorithm(), SignatureAlgorithm.ES384.getAlgorithm(), - SignatureAlgorithm.ES512.getAlgorithm() }; + SignatureAlgorithm.ES512.getAlgorithm(), + SignatureAlgorithm.PS256.getAlgorithm(), + SignatureAlgorithm.PS384.getAlgorithm(), + SignatureAlgorithm.PS512.getAlgorithm(), + SignatureAlgorithm.EDDSA.getAlgorithm() }; private static final AlgorithmConstraints ASYMMETRIC_ALGORITHM_CONSTRAINTS = new AlgorithmConstraints( AlgorithmConstraints.ConstraintType.PERMIT, ASYMMETRIC_SUPPORTED_ALGORITHMS); private static final AlgorithmConstraints SYMMETRIC_ALGORITHM_CONSTRAINTS = new AlgorithmConstraints( From d338bcfa808447558f9efb95bd4bded6fd3da7ac Mon Sep 17 00:00:00 2001 From: Sergey Beryozkin Date: Thu, 18 May 2023 19:47:41 +0100 Subject: [PATCH 16/33] Optionally enforce signature algorithm and add a test (cherry picked from commit 7b77da237f539712f04726ceeb86f0515fcc0279) --- .../io/quarkus/oidc/OidcTenantConfig.java | 40 +++++++++++++++++++ .../quarkus/oidc/runtime/JsonWebKeySet.java | 11 +++-- .../io/quarkus/oidc/runtime/OidcProvider.java | 15 ++++++- .../io/quarkus/it/keycloak/AdminResource.java | 8 ++++ .../it/keycloak/CustomTenantResolver.java | 3 ++ .../src/main/resources/application.properties | 5 +++ .../BearerTokenAuthorizationTest.java | 21 ++++++++++ 7 files changed, 99 insertions(+), 4 deletions(-) diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java index 135d154839a42..afa71a5ed1790 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java @@ -1085,6 +1085,30 @@ public void setHeaders(Map headers) { } } + /** + * Supported asymmetric signature algorithms + */ + public static enum SignatureAlgorithm { + RS256, + RS384, + RS512, + PS256, + PS384, + PS512, + ES256, + ES384, + ES512, + EDDSA; + + private static String EDDSA_ALG = "EDDSA"; + private static String REQUIRED_EDDSA_ALG = "EdDSA"; + + public String getAlgorithm() { + String name = name(); + return EDDSA_ALG.equals(name) ? REQUIRED_EDDSA_ALG : name; + } + } + @ConfigGroup public static class Token { @@ -1220,6 +1244,14 @@ public static Token fromAudience(String... audience) { @ConfigItem public Optional header = Optional.empty(); + /** + * Required signature algorithm. + * OIDC providers support many signature algorithms but if necessary you can restrict + * Quarkus application to accept tokens signed only using an algorithm configured with this property. + */ + @ConfigItem + public Optional signatureAlgorithm = Optional.empty(); + /** * Decryption key location. * JWT tokens can be inner-signed and encrypted by OpenId Connect providers. @@ -1398,6 +1430,14 @@ public boolean isRequireJwtIntrospectionOnly() { public void setRequireJwtIntrospectionOnly(boolean requireJwtIntrospectionOnly) { this.requireJwtIntrospectionOnly = requireJwtIntrospectionOnly; } + + public Optional getSignatureAlgorithm() { + return signatureAlgorithm; + } + + public void setSignatureAlgorithm(SignatureAlgorithm signatureAlgorithm) { + this.signatureAlgorithm = Optional.of(signatureAlgorithm); + } } public static enum ApplicationType { diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/JsonWebKeySet.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/JsonWebKeySet.java index 54c1a94817e44..eca7848c56faf 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/JsonWebKeySet.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/JsonWebKeySet.java @@ -3,6 +3,7 @@ import java.security.Key; import java.util.HashMap; import java.util.Map; +import java.util.Set; import org.jose4j.jwk.JsonWebKey; import org.jose4j.jwk.PublicJsonWebKey; @@ -11,8 +12,13 @@ import io.quarkus.oidc.OIDCException; public class JsonWebKeySet { + private static final String RSA_KEY_TYPE = "RSA"; - private static final String EC_KEY_TYPE = "EC"; + private static final String ELLIPTIC_CURVE_KEY_TYPE = "EC"; + // This key type is used when EdDSA algorithm is used + private static final String OCTET_KEY_PAIR_TYPE = "OKP"; + private static final Set KEY_TYPES = Set.of(RSA_KEY_TYPE, ELLIPTIC_CURVE_KEY_TYPE, OCTET_KEY_PAIR_TYPE); + private static final String SIGNATURE_USE = "sig"; private Map keysWithKeyId = new HashMap<>(); @@ -49,8 +55,7 @@ && isSupportedJwkKey(jwkSet.getJsonWebKeys().get(0))) { } private static boolean isSupportedJwkKey(JsonWebKey jwkKey) { - return (RSA_KEY_TYPE.equals(jwkKey.getKeyType()) || EC_KEY_TYPE.equals(jwkKey.getKeyType()) - || jwkKey.getKeyType() == null) + return (jwkKey.getKeyType() == null || KEY_TYPES.contains(jwkKey.getKeyType())) && (SIGNATURE_USE.equals(jwkKey.getUse()) || jwkKey.getUse() == null); } diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProvider.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProvider.java index 71874a4d74359..1e915dbab725d 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProvider.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProvider.java @@ -64,6 +64,7 @@ public class OidcProvider implements Closeable { final String[] audience; final Map requiredClaims; final Key tokenDecryptionKey; + final AlgorithmConstraints requiredAlgorithmConstraints; public OidcProvider(OidcProviderClient client, OidcTenantConfig oidcConfig, JsonWebKeySet jwks, Key tokenDecryptionKey) { this.client = client; @@ -75,6 +76,7 @@ public OidcProvider(OidcProviderClient client, OidcTenantConfig oidcConfig, Json this.audience = checkAudienceProp(); this.requiredClaims = checkRequiredClaimsProp(); this.tokenDecryptionKey = tokenDecryptionKey; + this.requiredAlgorithmConstraints = checkSignatureAlgorithm(); } public OidcProvider(String publicKeyEnc, OidcTenantConfig oidcConfig, Key tokenDecryptionKey) { @@ -85,6 +87,16 @@ public OidcProvider(String publicKeyEnc, OidcTenantConfig oidcConfig, Key tokenD this.audience = checkAudienceProp(); this.requiredClaims = checkRequiredClaimsProp(); this.tokenDecryptionKey = tokenDecryptionKey; + this.requiredAlgorithmConstraints = checkSignatureAlgorithm(); + } + + private AlgorithmConstraints checkSignatureAlgorithm() { + if (oidcConfig != null && oidcConfig.token.signatureAlgorithm.isPresent()) { + String configuredAlg = oidcConfig.token.signatureAlgorithm.get().getAlgorithm(); + return new AlgorithmConstraints(AlgorithmConstraints.ConstraintType.PERMIT, configuredAlg); + } else { + return null; + } } private String checkIssuerProp() { @@ -113,7 +125,8 @@ public TokenVerificationResult verifySelfSignedJwtToken(String token) throws Inv public TokenVerificationResult verifyJwtToken(String token, boolean enforceAudienceVerification) throws InvalidJwtException { - return verifyJwtTokenInternal(token, enforceAudienceVerification, ASYMMETRIC_ALGORITHM_CONSTRAINTS, + return verifyJwtTokenInternal(token, enforceAudienceVerification, + requiredAlgorithmConstraints != null ? requiredAlgorithmConstraints : ASYMMETRIC_ALGORITHM_CONSTRAINTS, asymmetricKeyResolver, true); } diff --git a/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/AdminResource.java b/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/AdminResource.java index 298096b871fd5..078878f0b6417 100644 --- a/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/AdminResource.java +++ b/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/AdminResource.java @@ -26,6 +26,14 @@ public String admin() { return "granted:" + identity.getRoles(); } + @Path("bearer-required-algorithm") + @GET + @RolesAllowed("admin") + @Produces(MediaType.APPLICATION_JSON) + public String adminRequiredAlgorithm() { + return "granted:" + identity.getRoles(); + } + @Path("bearer-no-introspection") @GET @RolesAllowed("admin") diff --git a/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CustomTenantResolver.java b/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CustomTenantResolver.java index c6c0d806461dd..eb053dd60814b 100644 --- a/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CustomTenantResolver.java +++ b/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CustomTenantResolver.java @@ -44,6 +44,9 @@ public String resolve(RoutingContext context) { if (path.endsWith("bearer")) { return "bearer"; } + if (path.endsWith("bearer-required-algorithm")) { + return "bearer-required-algorithm"; + } if (path.endsWith("bearer-no-introspection")) { return "bearer-no-introspection"; } diff --git a/integration-tests/oidc-wiremock/src/main/resources/application.properties b/integration-tests/oidc-wiremock/src/main/resources/application.properties index 827cbefb174d8..e05799cb38d5b 100644 --- a/integration-tests/oidc-wiremock/src/main/resources/application.properties +++ b/integration-tests/oidc-wiremock/src/main/resources/application.properties @@ -121,6 +121,11 @@ quarkus.oidc.bearer.credentials.secret=secret quarkus.oidc.bearer.token.audience=https://service.example.com quarkus.oidc.bearer.allow-token-introspection-cache=false +quarkus.oidc.bearer-required-algorithm.auth-server-url=${keycloak.url}/realms/quarkus/ +quarkus.oidc.bearer-required-algorithm.client-id=quarkus-app +quarkus.oidc.bearer-required-algorithm.credentials.secret=secret +quarkus.oidc.bearer-required-algorithm.token.signature-algorithm=PS256 + quarkus.oidc.bearer-role-claim-path.auth-server-url=${keycloak.url}/realms/quarkus/ quarkus.oidc.bearer-role-claim-path.client-id=quarkus-app quarkus.oidc.bearer-role-claim-path.credentials.secret=secret diff --git a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java index be3f542bda73e..7e9d08055cf0d 100644 --- a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java +++ b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java @@ -19,6 +19,7 @@ import io.quarkus.test.oidc.server.OidcWireMock; import io.quarkus.test.oidc.server.OidcWiremockTestResource; import io.restassured.RestAssured; +import io.smallrye.jwt.algorithm.SignatureAlgorithm; import io.smallrye.jwt.build.Jwt; @QuarkusTest @@ -48,6 +49,21 @@ public void testAccessAdminResource() { .body(Matchers.containsString("admin")); } + @Test + public void testAccessAdminResourceRequiredAlgorithm() { + // RS256 is rejected + RestAssured.given().auth().oauth2(getAccessToken("admin", Set.of("admin"))) + .when().get("/api/admin/bearer-required-algorithm") + .then() + .statusCode(401); + // PS256 is OK + RestAssured.given().auth().oauth2(getAccessToken("admin", Set.of("admin"), SignatureAlgorithm.PS256)) + .when().get("/api/admin/bearer-required-algorithm") + .then() + .statusCode(200) + .body(Matchers.containsString("admin")); + } + @Test public void testAccessAdminResourceWithCertThumbprint() { RestAssured.given().auth().oauth2(getAccessTokenWithThumbprint("admin", Set.of("admin"))) @@ -189,10 +205,15 @@ public void testInvalidBearerToken() { } private String getAccessToken(String userName, Set groups) { + return getAccessToken(userName, groups, SignatureAlgorithm.RS256); + } + + private String getAccessToken(String userName, Set groups, SignatureAlgorithm alg) { return Jwt.preferredUserName(userName) .groups(groups) .issuer("https://server.example.com") .audience("https://service.example.com") + .jws().algorithm(alg) .sign(); } From 4ef36771a80a7dacc4911ff35beb965be198a4c8 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira da Silva Date: Tue, 16 May 2023 13:35:28 -0300 Subject: [PATCH 17/33] Bump GraalVM to 22.3.2 Closes #33423 (cherry picked from commit 6d6b01ff066c689e3bc27c9ec03d6dfcf0f64970) --- bom/application/pom.xml | 2 +- .../src/main/java/io/quarkus/deployment/pkg/steps/GraalVM.java | 3 ++- independent-projects/bootstrap/pom.xml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bom/application/pom.xml b/bom/application/pom.xml index d67c85aa6ae1d..8037f8a393013 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -89,7 +89,7 @@ 16.0.0.Final 3.0-alpha-2 2.1.0 - 22.3.0 + 22.3.2 ${graal-sdk.version} 1.6.1.Final 2.15.0 diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/GraalVM.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/GraalVM.java index 35977c000ca4f..7ef84c9b0303e 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/GraalVM.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/GraalVM.java @@ -132,12 +132,13 @@ public static final class Version implements Comparable { static final Version UNVERSIONED = new Version("Undefined", "snapshot", Distribution.ORACLE); static final Version VERSION_21_3 = new Version("GraalVM 21.3", "21.3", Distribution.ORACLE); static final Version VERSION_21_3_0 = new Version("GraalVM 21.3.0", "21.3.0", Distribution.ORACLE); + public static final Version VERSION_22_3_2 = new Version("GraalVM 22.3.2", "22.3.2", Distribution.ORACLE); public static final Version VERSION_22_3_0 = new Version("GraalVM 22.3.0", "22.3.0", Distribution.ORACLE); public static final Version VERSION_22_2_0 = new Version("GraalVM 22.2.0", "22.2.0", Distribution.ORACLE); public static final Version VERSION_23_0_0 = new Version("GraalVM 23.0.0", "23.0.0", Distribution.ORACLE); public static final Version MINIMUM = VERSION_22_2_0; - public static final Version CURRENT = VERSION_22_3_0; + public static final Version CURRENT = VERSION_22_3_2; public static final int UNDEFINED = -1; final String fullVersion; diff --git a/independent-projects/bootstrap/pom.xml b/independent-projects/bootstrap/pom.xml index 730366f50975a..190bd5d6e7d37 100644 --- a/independent-projects/bootstrap/pom.xml +++ b/independent-projects/bootstrap/pom.xml @@ -71,7 +71,7 @@ 1.0.11 1.1.0.Final 1.7.36 - 22.3.0 + 22.3.2 2.6.0 1.7 3.5.1 From b67d5341686be4d9a22aa3d112c2edf03d92a0ae Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Fri, 19 May 2023 14:17:48 +0300 Subject: [PATCH 18/33] Ensure that cookies added in filters are visible to resource methods Fixes: #33490 (cherry picked from commit 196b7425ee37d0b74fac3d8209c59028c120c5da) --- .../server/jaxrs/HttpHeadersImpl.java | 6 +- .../vertx/test/CookiesSetInFilterTest.java | 66 +++++++++++++++++++ 2 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/CookiesSetInFilterTest.java diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/HttpHeadersImpl.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/HttpHeadersImpl.java index b6cb4e3500d44..35185cb1ed0d8 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/HttpHeadersImpl.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/HttpHeadersImpl.java @@ -23,7 +23,6 @@ public class HttpHeadersImpl implements HttpHeaders { private final MultivaluedMap requestHeaders; private final MultivaluedMap unmodifiableRequestHeaders; - private Map cookies; public HttpHeadersImpl(Iterable> vertxHeaders) { requestHeaders = new CaseInsensitiveMap<>(); @@ -50,10 +49,7 @@ public List getRequestHeader(String name) { @Override public Map getCookies() { - if (cookies == null) { - cookies = Collections.unmodifiableMap(HeaderUtil.getCookies(requestHeaders)); - } - return cookies; + return Collections.unmodifiableMap(HeaderUtil.getCookies(requestHeaders)); } @Override diff --git a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/CookiesSetInFilterTest.java b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/CookiesSetInFilterTest.java new file mode 100644 index 0000000000000..5c367f1998859 --- /dev/null +++ b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/CookiesSetInFilterTest.java @@ -0,0 +1,66 @@ +package org.jboss.resteasy.reactive.server.vertx.test; + +import static io.restassured.RestAssured.given; +import static io.restassured.RestAssured.when; +import static org.hamcrest.Matchers.is; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.NewCookie; + +import org.jboss.resteasy.reactive.RestCookie; +import org.jboss.resteasy.reactive.common.headers.NewCookieHeaderDelegate; +import org.jboss.resteasy.reactive.server.ServerRequestFilter; +import org.jboss.resteasy.reactive.server.vertx.test.framework.ResteasyReactiveUnitTest; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +public class CookiesSetInFilterTest { + + @RegisterExtension + static ResteasyReactiveUnitTest test = new ResteasyReactiveUnitTest() + .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) + .addClasses(TestResource.class, Filters.class)); + + @Test + void requestDoesNotContainCookie() { + when().get("/test") + .then() + .statusCode(200) + .body(is("foo")); + } + + @Test + void requestContainsCookie() { + given() + .cookie("dummy", "bar") + .when().get("/test") + .then() + .statusCode(200) + .body(is("bar")); + } + + @Path("test") + public static class TestResource { + + @GET + public String get(@RestCookie String dummy) { + return dummy; + } + } + + public static class Filters { + + @ServerRequestFilter + public void setCookieIfMissing(ContainerRequestContext context) { + if (!context.getCookies().containsKey("dummy")) { + context.getHeaders().add(HttpHeaders.COOKIE, + NewCookieHeaderDelegate.INSTANCE.toString(new NewCookie.Builder("dummy").value("foo").build())); + } + } + } +} From 72c9bca98fb046510c961f03d68474fda72df789 Mon Sep 17 00:00:00 2001 From: Sergey Beryozkin Date: Thu, 18 May 2023 15:43:58 +0100 Subject: [PATCH 19/33] Do not create session and PKCE encryption keys if only bearer tokens are expected (cherry picked from commit 77d1bb97de286cd5a2d2e04adc0d3ecb6ef482c4) --- .../io/quarkus/oidc/runtime/OidcRecorder.java | 19 ++++++------------- .../io/quarkus/oidc/runtime/OidcUtils.java | 9 +++++++++ .../oidc/runtime/TenantConfigContext.java | 5 +++-- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java index 42ffc9ea3a155..936cae8f81c75 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java @@ -187,7 +187,7 @@ private Uni createTenantContext(Vertx vertx, OidcTenantConf throw new ConfigurationException("'quarkus.oidc.auth-server-url' property must be configured"); } OidcCommonUtils.verifyEndpointUrl(oidcConfig.getAuthServerUrl().get()); - OidcCommonUtils.verifyCommonConfiguration(oidcConfig, isServiceApp(oidcConfig), true); + OidcCommonUtils.verifyCommonConfiguration(oidcConfig, OidcUtils.isServiceApp(oidcConfig), true); } catch (ConfigurationException t) { return Uni.createFrom().failure(t); } @@ -196,7 +196,7 @@ private Uni createTenantContext(Vertx vertx, OidcTenantConf throw new ConfigurationException( "UserInfo is not required but UserInfo is expected to be the source of authorization roles"); } - if (oidcConfig.token.verifyAccessTokenWithUserInfo.orElse(false) && !isWebApp(oidcConfig) + if (oidcConfig.token.verifyAccessTokenWithUserInfo.orElse(false) && !OidcUtils.isWebApp(oidcConfig) && !enableUserInfo(oidcConfig)) { throw new ConfigurationException( "UserInfo is not required but 'verifyAccessTokenWithUserInfo' is enabled"); @@ -207,7 +207,7 @@ private Uni createTenantContext(Vertx vertx, OidcTenantConf } if (!oidcConfig.discoveryEnabled.orElse(true)) { - if (!isServiceApp(oidcConfig)) { + if (!OidcUtils.isServiceApp(oidcConfig)) { if (!oidcConfig.authorizationPath.isPresent() || !oidcConfig.tokenPath.isPresent()) { throw new ConfigurationException( "'web-app' applications must have 'authorization-path' and 'token-path' properties " @@ -228,7 +228,7 @@ private Uni createTenantContext(Vertx vertx, OidcTenantConf } } - if (isServiceApp(oidcConfig)) { + if (OidcUtils.isServiceApp(oidcConfig)) { if (oidcConfig.token.refreshExpired) { throw new ConfigurationException( "The 'token.refresh-expired' property can only be enabled for " + ApplicationType.WEB_APP @@ -294,7 +294,7 @@ private static boolean enableUserInfo(OidcTenantConfig oidcConfig) { } private static TenantConfigContext createTenantContextFromPublicKey(OidcTenantConfig oidcConfig) { - if (!isServiceApp(oidcConfig)) { + if (!OidcUtils.isServiceApp(oidcConfig)) { throw new ConfigurationException("'public-key' property can only be used with the 'service' applications"); } LOG.debug("'public-key' property for the local token verification is set," @@ -443,6 +443,7 @@ public Uni apply(OidcConfigurationMetadata metadata, Throwab } return Uni.createFrom().item(new OidcProviderClient(client, metadata, oidcConfig)); } + }); } @@ -459,12 +460,4 @@ private static OidcConfigurationMetadata createLocalMetadata(OidcTenantConfig oi introspectionUri, authorizationUri, jwksUri, userInfoUri, endSessionUri, oidcConfig.token.issuer.orElse(null)); } - - private static boolean isServiceApp(OidcTenantConfig oidcConfig) { - return ApplicationType.SERVICE.equals(oidcConfig.applicationType.orElse(ApplicationType.SERVICE)); - } - - private static boolean isWebApp(OidcTenantConfig oidcConfig) { - return ApplicationType.WEB_APP.equals(oidcConfig.applicationType.orElse(ApplicationType.SERVICE)); - } } diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcUtils.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcUtils.java index 8aa82db7da36b..d8c9995300588 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcUtils.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcUtils.java @@ -29,6 +29,7 @@ import io.quarkus.oidc.AuthorizationCodeTokens; import io.quarkus.oidc.OIDCException; import io.quarkus.oidc.OidcTenantConfig; +import io.quarkus.oidc.OidcTenantConfig.ApplicationType; import io.quarkus.oidc.OidcTenantConfig.Authentication; import io.quarkus.oidc.RefreshToken; import io.quarkus.oidc.TokenIntrospection; @@ -78,6 +79,14 @@ private OidcUtils() { } + public static boolean isServiceApp(OidcTenantConfig oidcConfig) { + return ApplicationType.SERVICE.equals(oidcConfig.applicationType.orElse(ApplicationType.SERVICE)); + } + + public static boolean isWebApp(OidcTenantConfig oidcConfig) { + return ApplicationType.WEB_APP.equals(oidcConfig.applicationType.orElse(ApplicationType.SERVICE)); + } + public static boolean isEncryptedToken(String token) { return new StringTokenizer(token, ".").countTokens() == 5; } diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/TenantConfigContext.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/TenantConfigContext.java index 9ff389f5acd2f..d748c56035fb7 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/TenantConfigContext.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/TenantConfigContext.java @@ -47,8 +47,9 @@ public TenantConfigContext(OidcProvider client, OidcTenantConfig config, boolean this.oidcConfig = config; this.ready = ready; - pkceSecretKey = provider != null && provider.client != null ? createPkceSecretKey(config) : null; - tokenEncSecretKey = provider != null && provider.client != null ? createTokenEncSecretKey(config) : null; + boolean isService = OidcUtils.isServiceApp(config); + pkceSecretKey = !isService && provider != null && provider.client != null ? createPkceSecretKey(config) : null; + tokenEncSecretKey = !isService && provider != null && provider.client != null ? createTokenEncSecretKey(config) : null; } private static SecretKey createPkceSecretKey(OidcTenantConfig config) { From a6f419f5600acd6998a0739e5573819a5b3c8f34 Mon Sep 17 00:00:00 2001 From: Maximilian Zellhofer Date: Fri, 19 May 2023 12:29:17 +0200 Subject: [PATCH 20/33] Bump resteasy version to 6.2.4 (cherry picked from commit dc50812e4a3605a7742fb65689b6e485f9b07b79) --- bom/application/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 8037f8a393013..738b5e29fce5b 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -31,7 +31,7 @@ 1.1.1 2.1.1.Final 3.0.2.Final - 6.2.3.Final + 6.2.4.Final 0.33.0 0.2.4 0.1.15 From ff3055efdca973b789839333a70aac8e10c32f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Vav=C5=99=C3=ADk?= Date: Sun, 14 May 2023 14:20:48 +0200 Subject: [PATCH 21/33] Fix blank DEV UI extension pages when loading (cherry picked from commit 89d5578915876650c5f1177d35eb4f964be07ca7) --- .../resources/dev-ui/qwc-arc-fired-events.js | 10 +++--- .../dev-ui/qwc-arc-invocation-trees.js | 11 +++--- .../main/resources/dev-ui/qwc-cache-caches.js | 13 +++---- .../dev-ui/qwc-container-image-build.js | 5 --- .../resources/dev-ui/qwc-datasources-reset.js | 11 +++--- .../dev-ui/hibernate-orm-entity-types.js | 15 ++++---- .../dev-ui/hibernate-orm-named-queries.js | 15 ++++---- .../dev-ui/hibernate-orm-persistence-units.js | 15 ++++---- ...-orm-elasticsearch-indexed-entity-types.js | 15 ++++---- .../dev-ui/qwc-openshift-deployment.js | 5 --- .../dev-ui/qwc-liquibase-datasources.js | 19 +++++----- .../dev-ui/qwc-rest-client-clients.js | 11 +++--- .../dev-ui/qwc-scheduler-scheduled-methods.js | 35 ++++++++++--------- .../dev-ui/qwc-fault-tolerance-methods.js | 11 +++--- ...wc-smallrye-reactive-messaging-channels.js | 11 +++--- .../resources/dev-ui/qwc/qwc-configuration.js | 11 +++--- 16 files changed, 109 insertions(+), 104 deletions(-) diff --git a/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-fired-events.js b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-fired-events.js index 64fdf4ccd1328..708cf0bc7502a 100644 --- a/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-fired-events.js +++ b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-fired-events.js @@ -1,5 +1,4 @@ import { LitElement, html, css} from 'lit'; -import { until } from 'lit/directives/until.js'; import { JsonRpc } from 'jsonrpc'; import '@vaadin/grid'; import { columnBodyRenderer } from '@vaadin/grid/lit.js'; @@ -54,12 +53,15 @@ export class QwcArcFiredEvents extends LitElement { } render() { - return html`${until(this._renderFiredEvents(), html`Loading ArC fired event...`)}`; + if(this._firedEvents){ + return this._renderFiredEvents(); + } else { + return html`Loading ArC fired event...`; + } } _renderFiredEvents(){ - if(this._firedEvents){ - return html` `)} `; - } } _renderEntityTypesTable(pu) { diff --git a/extensions/kubernetes/openshift/deployment/src/main/resources/dev-ui/qwc-openshift-deployment.js b/extensions/kubernetes/openshift/deployment/src/main/resources/dev-ui/qwc-openshift-deployment.js index 43d58856e0c71..f956f3fc569eb 100644 --- a/extensions/kubernetes/openshift/deployment/src/main/resources/dev-ui/qwc-openshift-deployment.js +++ b/extensions/kubernetes/openshift/deployment/src/main/resources/dev-ui/qwc-openshift-deployment.js @@ -2,7 +2,6 @@ import {LitElement, html, css, render} from 'lit'; import {JsonRpc} from 'jsonrpc'; import '@vaadin/icon'; import '@vaadin/button'; -import {until} from 'lit/directives/until.js'; import '@vaadin/grid'; import '@vaadin/grid/vaadin-grid-sort-column.js'; import {builderTypes} from 'build-time-data'; @@ -68,10 +67,6 @@ export class QwcOpenshiftDeployment extends LitElement { * @returns {*} */ render() { - return html`${until(this._renderForm(), html`Loading...`)}`; - } - - _renderForm() { const _builders = []; let _defaultBuilder = ""; if (this.builders) { diff --git a/extensions/liquibase/deployment/src/main/resources/dev-ui/qwc-liquibase-datasources.js b/extensions/liquibase/deployment/src/main/resources/dev-ui/qwc-liquibase-datasources.js index 5fb063785b80c..85b9e89405879 100644 --- a/extensions/liquibase/deployment/src/main/resources/dev-ui/qwc-liquibase-datasources.js +++ b/extensions/liquibase/deployment/src/main/resources/dev-ui/qwc-liquibase-datasources.js @@ -11,7 +11,6 @@ import '@vaadin/checkbox'; import '@vaadin/grid'; import '@vaadin/grid/vaadin-grid-sort-column.js'; import 'qui-alert'; -import { until } from 'lit/directives/until.js'; import { columnBodyRenderer } from '@vaadin/grid/lit.js'; export class QwcLiquibaseDatasources extends LitElement { @@ -54,12 +53,15 @@ export class QwcLiquibaseDatasources extends LitElement { } render() { - return html`${until(this._renderDataSourceTable(), html`Loading datasources...`)}`; + if (this._factories) { + return this._renderDataSourceTable(); + } else { + return html`Loading datasources...`; + } } _renderDataSourceTable() { - if (this._factories) { - return html` + return html` ${this._message} This will drop all objects (tables, views, procedures, triggers, ...) in the configured schema. Do you want to continue? `; - } } _actionRenderer(ds) { diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/resources/dev-ui/qwc-rest-client-clients.js b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/resources/dev-ui/qwc-rest-client-clients.js index 5e914d2a2be3a..27f684bc8000e 100644 --- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/resources/dev-ui/qwc-rest-client-clients.js +++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/resources/dev-ui/qwc-rest-client-clients.js @@ -3,7 +3,6 @@ import { JsonRpc } from 'jsonrpc'; import '@vaadin/icon'; import '@vaadin/progress-bar'; import '@vaadin/checkbox'; -import { until } from 'lit/directives/until.js'; import '@vaadin/grid'; import { columnBodyRenderer } from '@vaadin/grid/lit.js'; import '@vaadin/grid/vaadin-grid-sort-column.js'; @@ -45,14 +44,17 @@ export class QwcRestClientClients extends LitElement { * @returns {*} */ render() { - return html`${until(this._renderClientsTable(), html`Loading REST Clients...`)}`; + if (this._clients) { + return this._renderClientsTable(); + } else { + return html`Loading REST Clients...`; + } } // View / Templates _renderClientsTable() { - if (this._clients) { - return html` + return html` `; - } } _clientInterfaceRenderer(client){ diff --git a/extensions/scheduler/deployment/src/main/resources/dev-ui/qwc-scheduler-scheduled-methods.js b/extensions/scheduler/deployment/src/main/resources/dev-ui/qwc-scheduler-scheduled-methods.js index da36b6f3f4e50..b0a93f49fc3b5 100644 --- a/extensions/scheduler/deployment/src/main/resources/dev-ui/qwc-scheduler-scheduled-methods.js +++ b/extensions/scheduler/deployment/src/main/resources/dev-ui/qwc-scheduler-scheduled-methods.js @@ -1,6 +1,5 @@ import { LitElement, html, css} from 'lit'; import { columnBodyRenderer } from '@vaadin/grid/lit.js'; -import { until } from 'lit/directives/until.js'; import { notifier } from 'notifier'; import { JsonRpc } from 'jsonrpc'; import '@vaadin/grid'; @@ -89,35 +88,38 @@ export class QwcSchedulerScheduledMethods extends LitElement { } render() { - return html`${until(this._renderScheduledMethods(), html`Loading scheduled methods...`)}`; + if (this._scheduledMethods){ + return this._renderScheduledMethods(); + } else { + return html`Loading scheduled methods...`; + } } _renderScheduledMethods(){ - if (this._scheduledMethods){ - let schedulerButton; - if (this._schedulerRunning) { - schedulerButton = html` this._pauseScheduler()}> + let schedulerButton; + if (this._schedulerRunning) { + schedulerButton = html` this._pauseScheduler()}> Pause scheduler`; - } else { - schedulerButton = html` this._resumeScheduler()}> + } else { + schedulerButton = html` this._resumeScheduler()}> Resume scheduler`; - } - - const searchBox = html` + } + + const searchBox = html` this._matchesTerm(method, searchTerm)); + }}" > ` - - return html` + + return html`
${searchBox} ${schedulerButton} @@ -135,7 +137,6 @@ export class QwcSchedulerScheduledMethods extends LitElement { `; - } } _scheduleRenderer(scheduledMethod) { diff --git a/extensions/smallrye-fault-tolerance/deployment/src/main/resources/dev-ui/qwc-fault-tolerance-methods.js b/extensions/smallrye-fault-tolerance/deployment/src/main/resources/dev-ui/qwc-fault-tolerance-methods.js index 2ea5e05e9c107..30dfbb9ab9cf9 100644 --- a/extensions/smallrye-fault-tolerance/deployment/src/main/resources/dev-ui/qwc-fault-tolerance-methods.js +++ b/extensions/smallrye-fault-tolerance/deployment/src/main/resources/dev-ui/qwc-fault-tolerance-methods.js @@ -1,5 +1,4 @@ import {css, html, LitElement} from 'lit'; -import {until} from 'lit/directives/until.js'; import {JsonRpc} from 'jsonrpc'; import '@vaadin/grid'; import {columnBodyRenderer} from '@vaadin/grid/lit.js'; @@ -29,12 +28,15 @@ export class QwcFaultToleranceMethods extends LitElement { } render() { - return html`${until(this._renderGuardedMethods(), html`Loading guarded methods...`)}`; + if (this._guardedMethods) { + return this._renderGuardedMethods(); + } else { + return html`Loading guarded methods...`; + } } _renderGuardedMethods() { - if (this._guardedMethods) { - return html` + return html` `; - } } _renderBeanClass(guardedMethod) { diff --git a/extensions/smallrye-reactive-messaging/deployment/src/main/resources/dev-ui/qwc-smallrye-reactive-messaging-channels.js b/extensions/smallrye-reactive-messaging/deployment/src/main/resources/dev-ui/qwc-smallrye-reactive-messaging-channels.js index 2f3afc6022f1b..e2cef7692aff2 100644 --- a/extensions/smallrye-reactive-messaging/deployment/src/main/resources/dev-ui/qwc-smallrye-reactive-messaging-channels.js +++ b/extensions/smallrye-reactive-messaging/deployment/src/main/resources/dev-ui/qwc-smallrye-reactive-messaging-channels.js @@ -2,7 +2,6 @@ import { LitElement, html, css} from 'lit'; import { JsonRpc } from 'jsonrpc'; import '@vaadin/icon'; import '@vaadin/button'; -import { until } from 'lit/directives/until.js'; import '@vaadin/grid'; import { columnBodyRenderer } from '@vaadin/grid/lit.js'; import '@vaadin/grid/vaadin-grid-sort-column.js'; @@ -46,12 +45,15 @@ export class QwcSmallryeReactiveMessagingChannels extends LitElement { * @returns {*} */ render() { - return html`${until(this._renderChannelTable(), html`Loading channels...`)}`; + if (this._channels) { + return this._renderChannelTable(); + } else { + return html`Loading channels...`; + } } _renderChannelTable() { - if (this._channels) { - return html` + return html` `; - } } _channelNameRenderer(channel) { diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-configuration.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-configuration.js index 114c84c75e924..36cc482fe1e84 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-configuration.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-configuration.js @@ -1,7 +1,6 @@ import { LitElement, html, css } from 'lit'; import { JsonRpc } from 'jsonrpc'; import { RouterController } from 'router-controller'; -import { until } from 'lit/directives/until.js'; import '@vaadin/grid'; import 'qui/qui-alert.js'; import { columnBodyRenderer } from '@vaadin/grid/lit.js'; @@ -106,7 +105,11 @@ export class QwcConfiguration extends observeState(LitElement) { } render() { - return html`${until(this._render(), html`Loading configuration properties...`)}`; + if (this._filtered && this._values) { + return this._render(); + } else { + return html`Loading configuration properties...`; + } } _match(value, term) { @@ -138,8 +141,7 @@ export class QwcConfiguration extends observeState(LitElement) { } _render() { - if (this._filtered && this._values) { - return html`
+ return html`
${this._renderGrid()}
`; - } } _renderGrid(){ From 5847e650366942e9b4e5a2636ada53a6e8fb8d69 Mon Sep 17 00:00:00 2001 From: Matej Novotny Date: Thu, 18 May 2023 17:29:46 +0200 Subject: [PATCH 22/33] Arc - remove logging when discovering a an illegal bean type in producer type hierarchy (cherry picked from commit d6d78732174f8ca225f189ad538cf2242599401e) --- .../main/java/io/quarkus/arc/processor/Types.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java index 4002918a6815a..3b676aa46745e 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java @@ -507,7 +507,7 @@ static void checkArrayType(ArrayType arrayType, AnnotationTarget producerFieldOr /** * Detects wildcard for given type. - * In case this is related to a producer field or method, it either logs or throws a {@link DefinitionException} + * In case the annotation target is a producer and the boolean parameter is true, throws a {@link DefinitionException} * based on the boolean parameter. * Returns true if a wildcard is detected, false otherwise. */ @@ -525,16 +525,9 @@ static boolean containsWildcard(Type type, AnnotationTarget producerFieldOrMetho + " contains a parameterized type with a wildcard. This type is not a legal bean type" + " according to CDI specification."); - } else if (producerFieldOrMethod != null) { - // a producer method with wildcard in the type hierarchy of the return type - LOGGER.info("Producer " + - (producerFieldOrMethod.kind().equals(AnnotationTarget.Kind.FIELD) ? "field " : "method ") + - producerFieldOrMethod + - " contains a parameterized typed with a wildcard. This type is not a legal bean type" + - " according to CDI specification and will be ignored during bean resolution."); - return true; } else { - // wildcard detection for class-based beans, these still need to be skipped as they aren't valid bean types + // a producer method with wildcard in the type hierarchy of the return type + // OR wildcard detection for class-based beans, these still need to be skipped as they aren't valid bean types return true; } } else if (type.kind().equals(Kind.PARAMETERIZED_TYPE)) { From 3c325c9d3321c87ae1ec54493674eeaa78a6b6e7 Mon Sep 17 00:00:00 2001 From: Clement Escoffier Date: Sun, 14 May 2023 18:44:21 +0200 Subject: [PATCH 23/33] Update to Vert.x 4.4.2 and netty 4.1.92 (cherry picked from commit 4d4502f8886326853ba9a64157f3d7fec791a6ea) --- bom/application/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 738b5e29fce5b..018c8f311ea7b 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -119,7 +119,7 @@ 1.0.1.Final 2.1.0.Final 3.5.0.Final - 4.4.1 + 4.4.2 4.5.14 4.4.16 4.1.5 @@ -141,7 +141,7 @@ 14.0.9.Final 4.6.2.Final 3.1.5 - 4.1.90.Final + 4.1.92.Final 1.11.0 1.0.4 3.5.0.Final From 2bb7068d4e8fc3def17ee33d11b487ec74b8eb9d Mon Sep 17 00:00:00 2001 From: Clement Escoffier Date: Tue, 16 May 2023 10:14:47 +0200 Subject: [PATCH 24/33] Replace the usage of the JDBC Vert.x SQL client with the PostGreSQL client to actually verify that opentelemetry works with reactive SQL clients (cherry picked from commit e96ae72f8f3bfce6eb3099ee7dc1e199e748d3f0) --- integration-tests/opentelemetry-vertx/pom.xml | 77 +++++++-------- .../it/opentelemetry/vertx/SqlClientTest.java | 94 ++++++++----------- 2 files changed, 79 insertions(+), 92 deletions(-) diff --git a/integration-tests/opentelemetry-vertx/pom.xml b/integration-tests/opentelemetry-vertx/pom.xml index 47673ea3d47ea..762d2227ba8ec 100644 --- a/integration-tests/opentelemetry-vertx/pom.xml +++ b/integration-tests/opentelemetry-vertx/pom.xml @@ -22,10 +22,6 @@ io.quarkus quarkus-vertx-http - - io.quarkus - quarkus-agroal - io.quarkus quarkus-micrometer @@ -57,26 +53,9 @@ com.fasterxml.jackson.core jackson-databind - - - io.quarkus - quarkus-jdbc-h2 - test - io.quarkus - quarkus-test-h2 - test - - - io.vertx - vertx-sql-client - test - - - io.vertx - vertx-jdbc-client - test + quarkus-reactive-pg-client @@ -108,20 +87,7 @@ io.quarkus - quarkus-agroal-deployment - ${project.version} - pom - test - - - * - * - - - - - io.quarkus - quarkus-jdbc-h2-deployment + quarkus-micrometer-deployment ${project.version} pom test @@ -134,7 +100,7 @@ io.quarkus - quarkus-micrometer-deployment + quarkus-reactive-pg-client-deployment ${project.version} pom test @@ -149,6 +115,18 @@ + + maven-surefire-plugin + + true + + + + maven-failsafe-plugin + + true + + io.quarkus quarkus-maven-plugin @@ -164,6 +142,31 @@ + + test-postgresql + + + test-containers + + + + + + maven-surefire-plugin + + false + + + + maven-failsafe-plugin + + false + + + + + + native-image diff --git a/integration-tests/opentelemetry-vertx/src/test/java/io/quarkus/it/opentelemetry/vertx/SqlClientTest.java b/integration-tests/opentelemetry-vertx/src/test/java/io/quarkus/it/opentelemetry/vertx/SqlClientTest.java index a9296ce2cbb5a..ce5b827923b5a 100644 --- a/integration-tests/opentelemetry-vertx/src/test/java/io/quarkus/it/opentelemetry/vertx/SqlClientTest.java +++ b/integration-tests/opentelemetry-vertx/src/test/java/io/quarkus/it/opentelemetry/vertx/SqlClientTest.java @@ -4,21 +4,18 @@ import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DB_CONNECTION_STRING; import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DB_OPERATION; import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DB_STATEMENT; -import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DB_SYSTEM; import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DB_USER; import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_STATUS_CODE; import static io.restassured.RestAssured.given; import static java.net.HttpURLConnection.HTTP_OK; import static org.awaitility.Awaitility.await; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; import java.util.concurrent.TimeUnit; -import javax.sql.DataSource; - import jakarta.inject.Inject; import org.junit.jupiter.api.AfterEach; @@ -27,57 +24,31 @@ import io.opentelemetry.sdk.testing.exporter.InMemorySpanExporter; import io.opentelemetry.sdk.trace.data.SpanData; -import io.quarkus.agroal.runtime.DataSourcesJdbcRuntimeConfig; -import io.quarkus.datasource.runtime.DataSourcesBuildTimeConfig; -import io.quarkus.datasource.runtime.DataSourcesRuntimeConfig; -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.h2.H2DatabaseTestResource; import io.quarkus.test.junit.QuarkusTest; -import io.vertx.core.Vertx; -import io.vertx.core.json.JsonObject; -import io.vertx.ext.jdbc.spi.DataSourceProvider; import io.vertx.ext.web.Router; -import io.vertx.jdbcclient.JDBCPool; +import io.vertx.mutiny.pgclient.PgPool; -// H2 is not supported in native mode @QuarkusTest -@QuarkusTestResource(H2DatabaseTestResource.class) public class SqlClientTest { @Inject Router router; + @Inject - Vertx vertx; - @Inject - DataSource dataSource; - @Inject - DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig; - @Inject - DataSourcesRuntimeConfig dataSourcesRuntimeConfig; - @Inject - DataSourcesJdbcRuntimeConfig dataSourcesJdbcRuntimeConfig; + PgPool pool; @Inject InMemorySpanExporter inMemorySpanExporter; @Test void sqlClient() { - router.get("/sqlClient").handler(rc -> { - JsonObject config = new JsonObject() - .put("jdbcUrl", dataSourcesJdbcRuntimeConfig.jdbc.url.orElse("")) - .put("username", dataSourcesRuntimeConfig.defaultDataSource.username.orElse("")) - .put("database", dataSourcesBuildTimeConfig.defaultDataSource.dbKind.orElse("")); + pool.query("CREATE TABLE IF NOT EXISTS USERS (id INT, name VARCHAR(100));") + .execute().await().indefinitely(); - JDBCPool pool = JDBCPool.pool(vertx, DataSourceProvider.create(dataSource, config)); + router.get("/sqlClient").handler(rc -> { pool .query("SELECT * FROM USERS") .execute() - .onSuccess(event -> { - }) - .onFailure(event -> { - }) - .compose(rows -> pool.close()) - // onComplete is executed before the end of Sql Telemetry data. This causes warnings in Scope.close - .onComplete(event -> rc.response().end()); + .subscribe().with(event -> rc.response().end()); }); @@ -86,25 +57,38 @@ void sqlClient() { .then() .statusCode(HTTP_OK); - await().atMost(5, TimeUnit.SECONDS).until(() -> inMemorySpanExporter.getFinishedSpanItems().size() == 2); + // Why 3 spans: + // Table creation + HTTP + Query = 3 + + await().atMost(5, TimeUnit.SECONDS).until(() -> inMemorySpanExporter.getFinishedSpanItems().size() == 3); List spans = inMemorySpanExporter.getFinishedSpanItems(); - assertEquals(2, spans.size()); - - assertEquals(spans.get(0).getTraceId(), spans.get(1).getTraceId()); - assertEquals(spans.get(0).getSpanId(), spans.get(1).getParentSpanId()); - - assertEquals("GET /sqlClient", spans.get(0).getName()); - assertEquals(HTTP_OK, spans.get(0).getAttributes().get(HTTP_STATUS_CODE)); - - assertEquals("SELECT USERS", spans.get(1).getName()); - assertEquals(CLIENT, spans.get(1).getKind()); - assertEquals("h2", spans.get(1).getAttributes().get(DB_SYSTEM)); - assertEquals("SELECT", spans.get(1).getAttributes().get(DB_OPERATION)); - assertEquals("SELECT * FROM USERS", spans.get(1).getAttributes().get(DB_STATEMENT)); - assertEquals("quarkus", spans.get(1).getAttributes().get(DB_USER)); - assertNotNull(spans.get(1).getAttributes().get(DB_CONNECTION_STRING)); - //noinspection ConstantConditions - assertTrue(spans.get(1).getAttributes().get(DB_CONNECTION_STRING).startsWith("jdbc:h2:tcp://localhost")); + assertEquals(3, spans.size()); + + // We cannot rely on the order, we must identify the spans. + SpanData tableCreation = inMemorySpanExporter.getFinishedSpanItems().stream() + .filter(sd -> sd.getName().contains("DB Query")).findFirst().orElseThrow(); + SpanData httpSpan = inMemorySpanExporter.getFinishedSpanItems().stream() + .filter(sd -> sd.getName().contains("GET /sqlClient")).findFirst().orElseThrow(); + SpanData querySpan = inMemorySpanExporter.getFinishedSpanItems().stream() + .filter(sd -> sd.getName().contains("SELECT USERS")).findFirst().orElseThrow(); + + assertNotEquals(httpSpan.getTraceId(), tableCreation.getTraceId()); // No relationship + assertEquals(httpSpan.getTraceId(), querySpan.getTraceId()); + assertEquals(httpSpan.getSpanId(), querySpan.getParentSpanId()); + + assertEquals("GET /sqlClient", httpSpan.getName()); + assertEquals(HTTP_OK, httpSpan.getAttributes().get(HTTP_STATUS_CODE)); + + assertEquals("SELECT USERS", querySpan.getName()); + assertEquals(CLIENT, querySpan.getKind()); + assertEquals("SELECT", querySpan.getAttributes().get(DB_OPERATION)); + assertEquals("SELECT * FROM USERS", querySpan.getAttributes().get(DB_STATEMENT)); + assertEquals("quarkus", querySpan.getAttributes().get(DB_USER)); + assertNotNull(querySpan.getAttributes().get(DB_CONNECTION_STRING)); + + assertEquals("CREATE TABLE IF NOT EXISTS USERS (id INT, name VARCHAR(?));", + tableCreation.getAttributes().get(DB_STATEMENT)); + assertEquals("quarkus", tableCreation.getAttributes().get(DB_USER)); } @BeforeEach From eef9bc502d57315eebff4e66dd6745b37471adac Mon Sep 17 00:00:00 2001 From: Phillip Kruger Date: Mon, 22 May 2023 10:18:24 +1000 Subject: [PATCH 25/33] Fix paths when custom Signed-off-by: Phillip Kruger (cherry picked from commit 4027e96759d046dfbc69b1039a2267527fcbebc8) --- .../deployment/devui/OpenApiDevUIProcessor.java | 12 ++++++++---- .../swaggerui/deployment/SwaggerUiConfig.java | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/devui/OpenApiDevUIProcessor.java b/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/devui/OpenApiDevUIProcessor.java index e98b6a9f9f230..3e5cc8b608051 100644 --- a/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/devui/OpenApiDevUIProcessor.java +++ b/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/devui/OpenApiDevUIProcessor.java @@ -4,24 +4,28 @@ import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.devui.spi.page.CardPageBuildItem; import io.quarkus.devui.spi.page.Page; +import io.quarkus.smallrye.openapi.common.deployment.SmallRyeOpenApiConfig; +import io.quarkus.swaggerui.deployment.SwaggerUiConfig; import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem; public class OpenApiDevUIProcessor { @BuildStep(onlyIf = IsDevelopment.class) - public CardPageBuildItem pages(NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem) { + public CardPageBuildItem pages(NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem, + SwaggerUiConfig swaggerUiConfig, SmallRyeOpenApiConfig openApiConfig) { - String uiPath = nonApplicationRootPathBuildItem.resolvePath("swagger-ui"); + String uiPath = nonApplicationRootPathBuildItem.resolvePath(swaggerUiConfig.path); + String schemaPath = nonApplicationRootPathBuildItem.resolvePath(openApiConfig.path); CardPageBuildItem cardPageBuildItem = new CardPageBuildItem(); cardPageBuildItem.addPage(Page.externalPageBuilder("Schema yaml") - .url(nonApplicationRootPathBuildItem.resolvePath("openapi")) + .url(nonApplicationRootPathBuildItem.resolvePath(schemaPath)) .isYamlContent() .icon("font-awesome-solid:file-lines")); cardPageBuildItem.addPage(Page.externalPageBuilder("Schema json") - .url(nonApplicationRootPathBuildItem.resolvePath("openapi") + "?format=json") + .url(nonApplicationRootPathBuildItem.resolvePath(schemaPath) + "?format=json") .isJsonContent() .icon("font-awesome-solid:file-code")); diff --git a/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiConfig.java b/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiConfig.java index b8d2180832a19..deb0ad261eef9 100644 --- a/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiConfig.java +++ b/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiConfig.java @@ -21,7 +21,7 @@ public class SwaggerUiConfig { * By default, this value will be resolved as a path relative to `${quarkus.http.non-application-root-path}`. */ @ConfigItem(defaultValue = "swagger-ui") - String path; + public String path; /** * If this should be included every time. By default, this is only included when the application is running From c8d802b882ffe7bf2a4c739d3bafada61411b26e Mon Sep 17 00:00:00 2001 From: Manyanda Chitimbo Date: Fri, 19 May 2023 17:18:01 +0200 Subject: [PATCH 26/33] fix(quartz): ensure that invoker is properly initialized in QuartzJobDefinition#schedule (cherry picked from commit e29869d11a6244c7ae7235d92a9e18544a9354ab) --- .../java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java b/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java index e0207272ec9a1..e8a44f7a16ddc 100644 --- a/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java +++ b/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java @@ -807,6 +807,8 @@ public boolean isBlocking() { Optional> triggerBuilder = createTrigger(identity, scheduled, cronType, runtimeConfig, jobDetail); if (triggerBuilder.isPresent()) { + invoker = SimpleScheduler.initInvoker(invoker, skippedExecutionEvent, successExecutionEvent, + failedExecutionEvent, concurrentExecution, skipPredicate); org.quartz.Trigger trigger = triggerBuilder.get().build(); QuartzTrigger existing = scheduledTasks.putIfAbsent(identity, new QuartzTrigger(trigger.getKey(), new Function<>() { @@ -826,8 +828,6 @@ public org.quartz.Trigger apply(TriggerKey triggerKey) { throw new IllegalStateException("A job with this identity is already scheduled: " + identity); } - invoker = SimpleScheduler.initInvoker(invoker, skippedExecutionEvent, successExecutionEvent, - failedExecutionEvent, concurrentExecution, skipPredicate); try { scheduler.scheduleJob(jobDetail, trigger); } catch (SchedulerException e) { From ffbc77bc468d421b697f645b7b892a7822e26294 Mon Sep 17 00:00:00 2001 From: Phillip Kruger Date: Mon, 22 May 2023 11:50:36 +1000 Subject: [PATCH 27/33] Move Status tag to footer Signed-off-by: Phillip Kruger (cherry picked from commit 27f8c3676f8c9422e0dbb52b7255ddd689237362) --- .../resources/dev-ui/qwc/qwc-extension.js | 41 +++++++++++++++---- .../resources/dev-ui/qwc/qwc-extensions.js | 10 ----- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extension.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extension.js index 931ad190ec6be..d6162d2d9b7c9 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extension.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extension.js @@ -2,6 +2,7 @@ import { LitElement, html, css} from 'lit'; import '@vaadin/icon'; import '@vaadin/dialog'; import { dialogHeaderRenderer, dialogRenderer } from '@vaadin/dialog/lit.js'; +import 'qui-badge'; /** * This component represent one extension @@ -41,7 +42,6 @@ export class QwcExtension extends LitElement { display: flex; flex-direction: row; justify-content: space-between; - visibility:hidden; } .card-footer a { @@ -60,15 +60,15 @@ export class QwcExtension extends LitElement { color: var(--lumo-contrast-70pct); } - .active:hover .card-footer, .active:hover .guide { + .active:hover .config, .active:hover .more, .active:hover .guide { visibility:visible; } - .inactive:hover .card-footer, .inactive:hover .guide { + .inactive:hover .config, .inactive:hover .more, .inactive:hover .guide { visibility:visible; } - .guide{ + .guide, .more, .config { visibility:hidden; } @@ -141,14 +141,39 @@ export class QwcExtension extends LitElement { _footerTemplate() { return html` `; } + _renderStatus(){ + var l = this._statusLevelOnCard(); + + if(l) { + return html`${this.status.toUpperCase()}`; + } + } + + _statusLevelOnCard(){ + if(this.status === "experimental") { + return "warning"; + } else if(this.status === "preview") { + return "contrast"; + } + return null; + } + + _statusLevel(){ + if(this.status === "stable") { + return "success"; + } + return this._statusLevelOnCard(); + } + _renderDialog(){ return html` @@ -181,7 +206,7 @@ export class QwcExtension extends LitElement { - + diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extensions.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extensions.js index bbe779ac6069d..6b845302c3c86 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extensions.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extensions.js @@ -5,7 +5,6 @@ import { devuiState } from 'devui-state'; import { observeState } from 'lit-element-state'; import 'qwc/qwc-extension.js'; import 'qwc/qwc-extension-link.js'; -import 'qui-badge'; /** @@ -115,7 +114,6 @@ export class QwcExtensions extends observeState(LitElement) { return html`
- ${this._renderExperimentalBadge(extension)} ${extension.description} ${this._renderCardLinks(extension)} @@ -161,18 +159,10 @@ export class QwcExtensions extends observeState(LitElement) { providesCapabilities="${extension.providesCapabilities}" extensionDependencies="${extension.extensionDependencies}">
- ${this._renderExperimentalBadge(extension)} ${extension.description}
`; } } - - _renderExperimentalBadge(extension){ - if(extension.status === "experimental") { - return html`EXPERIMENTAL`; - } - } - } customElements.define('qwc-extensions', QwcExtensions); From 565268512e4a160d812f3c295533a84c72143077 Mon Sep 17 00:00:00 2001 From: kdnakt Date: Tue, 23 May 2023 12:59:15 +0900 Subject: [PATCH 28/33] fix typo in grpc-service-consumption.adoc (cherry picked from commit bf0cc008c1e3142bf1a9dd5e5e4d87496f15a98d) --- docs/src/main/asciidoc/grpc-service-consumption.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/grpc-service-consumption.adoc b/docs/src/main/asciidoc/grpc-service-consumption.adoc index c5ab94b411a5c..58728faf34e8a 100644 --- a/docs/src/main/asciidoc/grpc-service-consumption.adoc +++ b/docs/src/main/asciidoc/grpc-service-consumption.adoc @@ -455,7 +455,7 @@ include::{generated-dir}/config/quarkus-grpc-config-group-grpc-dev-mode-config.a == Inject mock clients -In your `@QuarkuTest`, you can use `@InjectMock` to inject the Mutiny client of a gRPC service: +In your `@QuarkusTest`, you can use `@InjectMock` to inject the Mutiny client of a gRPC service: [source, java] ---- From 28448db7ed422bbf5064e8b9f262505cf6107f90 Mon Sep 17 00:00:00 2001 From: Phillip Kruger Date: Tue, 23 May 2023 12:58:47 +1000 Subject: [PATCH 29/33] Fix the custom card for Dev UI Rabbit MQ Signed-off-by: Phillip Kruger (cherry picked from commit 3da629648d311d9655321365d980f96a7b26fa39) --- .../resources/dev-ui/qwc-rabbitmq-card.js | 37 ++++++++----------- .../deployment/BuildTimeContentProcessor.java | 1 + .../dev-ui/qwc/qwc-extension-link.js | 10 ++--- 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/extensions/smallrye-reactive-messaging-rabbitmq/deployment/src/main/resources/dev-ui/qwc-rabbitmq-card.js b/extensions/smallrye-reactive-messaging-rabbitmq/deployment/src/main/resources/dev-ui/qwc-rabbitmq-card.js index d9040de5d2550..0b9da2135fb4a 100644 --- a/extensions/smallrye-reactive-messaging-rabbitmq/deployment/src/main/resources/dev-ui/qwc-rabbitmq-card.js +++ b/extensions/smallrye-reactive-messaging-rabbitmq/deployment/src/main/resources/dev-ui/qwc-rabbitmq-card.js @@ -1,7 +1,7 @@ import { LitElement, html, css} from 'lit'; import { pages } from 'build-time-data'; import { JsonRpc } from 'jsonrpc'; -import 'qwc/qwc-extension-link.js'; +import 'qwc-extension-link'; const NAME = "Reactive Messaging - RabbitMQ"; export class QwcRabbitMqCard extends LitElement { @@ -44,13 +44,6 @@ export class QwcRabbitMqCard extends LitElement { _externalUrl: {state: true} }; - constructor() { - super(); - if(!this.extensionName){ - this.extensionName = NAME; - } - } - connectedCallback() { super.connectedCallback(); this.jsonRpc.getRabbitMqPort().then(jsonRpcResponse => { @@ -64,8 +57,8 @@ export class QwcRabbitMqCard extends LitElement {
@@ -77,17 +70,19 @@ export class QwcRabbitMqCard extends LitElement { } _renderCardLinks(){ - return html` - - - `; + if(this._port){ + return html` + + + `; + } } } diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeContentProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeContentProcessor.java index e95d614d3389a..cc92602140a74 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeContentProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeContentProcessor.java @@ -83,6 +83,7 @@ InternalImportMapBuildItem createKnownInternalImportMap(NonApplicationRootPathBu internalImportMapBuildItem.add("qwc/", contextRoot + "qwc/"); internalImportMapBuildItem.add("qwc-hot-reload-element", contextRoot + "qwc/qwc-hot-reload-element.js"); internalImportMapBuildItem.add("qwc-server-log", contextRoot + "qwc/qwc-server-log.js"); + internalImportMapBuildItem.add("qwc-extension-link", contextRoot + "qwc/qwc-extension-link.js"); // Quarkus UI internalImportMapBuildItem.add("qui/", contextRoot + "qui/"); internalImportMapBuildItem.add("qui-card", contextRoot + "qui/qui-card.js"); diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extension-link.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extension-link.js index c802d6126c788..c5d670deb9e5e 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extension-link.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extension-link.js @@ -180,12 +180,10 @@ export class QwcExtensionLink extends QwcHotReloadElement { } render() { - if(this.path){ - if(!this.embed) { - return html`${this.renderLink(this._effectiveExternalUrl, true, "_blank")}`; - }else{ - return html`${this.renderLink(this.path, false, "_self")}`; - } + if(!this.embed && this._effectiveExternalUrl) { + return html`${this.renderLink(this._effectiveExternalUrl, true, "_blank")}`; + }else if(this.path){ + return html`${this.renderLink(this.path, false, "_self")}`; } } From 5ebbf9c9b954a7fc1148fefa7e6c43838a83eaab Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Wed, 10 May 2023 10:36:20 -0300 Subject: [PATCH 30/33] Replace `jboss-parent` with `quarkus-parent` - This renames the root pom.xml artifactId to `quarkus-project` and introduces `quarkus-parent` as an independent project (cherry picked from commit f1953b386097962c4670c5e0a50bdc1d59f5211f) --- bom/application/pom.xml | 2 +- bom/test/pom.xml | 2 +- build-parent/pom.xml | 3 +- independent-projects/arc/pom.xml | 7 +- independent-projects/bootstrap/pom.xml | 9 +- independent-projects/enforcer-rules/pom.xml | 8 +- .../extension-maven-plugin/pom.xml | 8 +- independent-projects/ide-config/pom.xml | 8 +- independent-projects/parent/pom.xml | 434 ++++++++++++++++++ independent-projects/qute/pom.xml | 7 +- .../resteasy-reactive/pom.xml | 7 +- independent-projects/revapi/pom.xml | 12 +- independent-projects/tools/pom.xml | 8 +- pom.xml | 14 +- 14 files changed, 483 insertions(+), 46 deletions(-) create mode 100644 independent-projects/parent/pom.xml diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 018c8f311ea7b..de33890b66245 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -3,8 +3,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - quarkus-parent io.quarkus + quarkus-project 999-SNAPSHOT ../../pom.xml diff --git a/bom/test/pom.xml b/bom/test/pom.xml index 9925ebedf03a3..2933c5fb998de 100644 --- a/bom/test/pom.xml +++ b/bom/test/pom.xml @@ -3,8 +3,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - quarkus-parent io.quarkus + quarkus-project 999-SNAPSHOT ../../pom.xml diff --git a/build-parent/pom.xml b/build-parent/pom.xml index 687c363c448cd..aecfcfa96f848 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -3,9 +3,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - quarkus-parent io.quarkus + quarkus-project 999-SNAPSHOT + ../pom.xml 4.0.0 diff --git a/independent-projects/arc/pom.xml b/independent-projects/arc/pom.xml index 697550659c77f..fa9dc00ae202f 100644 --- a/independent-projects/arc/pom.xml +++ b/independent-projects/arc/pom.xml @@ -6,9 +6,10 @@ 4.0.0 - org.jboss - jboss-parent - 39 + io.quarkus + quarkus-parent + 999-SNAPSHOT + ../parent/pom.xml io.quarkus.arc arc-parent diff --git a/independent-projects/bootstrap/pom.xml b/independent-projects/bootstrap/pom.xml index 190bd5d6e7d37..6f1ef3fff22fe 100644 --- a/independent-projects/bootstrap/pom.xml +++ b/independent-projects/bootstrap/pom.xml @@ -4,16 +4,15 @@ child.project.url.inherit.append.path="false"> 4.0.0 - org.jboss - jboss-parent - 39 + io.quarkus + quarkus-parent + 999-SNAPSHOT + ../parent/pom.xml - io.quarkus quarkus-bootstrap-parent Quarkus - Bootstrap - Parent https://github.com/quarkusio/quarkus pom - 999-SNAPSHOT Apache License, Version 2.0 diff --git a/independent-projects/enforcer-rules/pom.xml b/independent-projects/enforcer-rules/pom.xml index 8a47259e60290..a9082af2a07f7 100644 --- a/independent-projects/enforcer-rules/pom.xml +++ b/independent-projects/enforcer-rules/pom.xml @@ -5,11 +5,11 @@ child.project.url.inherit.append.path="false"> 4.0.0 - org.jboss - jboss-parent - 39 + io.quarkus + quarkus-parent + 999-SNAPSHOT + ../parent/pom.xml - io.quarkus quarkus-enforcer-rules Quarkus - Enforcer Rules https://github.com/quarkusio/quarkus diff --git a/independent-projects/extension-maven-plugin/pom.xml b/independent-projects/extension-maven-plugin/pom.xml index fb63ce98d42e7..c9be0f5ffb148 100644 --- a/independent-projects/extension-maven-plugin/pom.xml +++ b/independent-projects/extension-maven-plugin/pom.xml @@ -3,11 +3,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.jboss - jboss-parent - 39 + io.quarkus + quarkus-parent + 999-SNAPSHOT + ../parent/pom.xml - io.quarkus quarkus-extension-maven-plugin 999-SNAPSHOT Quarkus - Extension Maven plugin diff --git a/independent-projects/ide-config/pom.xml b/independent-projects/ide-config/pom.xml index 4e061069173af..c5a6117d220f6 100644 --- a/independent-projects/ide-config/pom.xml +++ b/independent-projects/ide-config/pom.xml @@ -4,13 +4,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" child.project.url.inherit.append.path="false"> - org.jboss - jboss-parent - 39 + io.quarkus + quarkus-parent + 999-SNAPSHOT + ../parent/pom.xml 4.0.0 - io.quarkus quarkus-ide-config Quarkus - IDE/Tools - Config https://github.com/quarkusio/quarkus diff --git a/independent-projects/parent/pom.xml b/independent-projects/parent/pom.xml new file mode 100644 index 0000000000000..5b7d957eba1a7 --- /dev/null +++ b/independent-projects/parent/pom.xml @@ -0,0 +1,434 @@ + + + 4.0.0 + io.quarkus + quarkus-parent + 999-SNAPSHOT + + Quarkus - Parent POM + Quarkus Parent POM + https://quarkus.io + + 2020 + + pom + + + + 3.3.0 + 3.0.0 + 3.2.0 + 3.11.0 + 3.1.1 + 3.3.0 + 3.1.0 + 3.1.0 + 2.22.0 + 3.0.1 + 1.8.0 + 3.1.1 + 3.5.0 + 3.3.0 + 1.6.13 + 3.0.0 + 3.3.1 + 3.4.1 + 3.2.1 + ${version.failsafe.plugin} + 1.1.3 + + + false + + + true + 11 + ${maven.compiler.release} + ${maven.compiler.release} + ${maven.compiler.target} + ${maven.compiler.source} + false + + + UTF-8 + UTF-8 + + + ${maven.compiler.target} + ${maven.compiler.source} + ${maven.compiler.testTarget} + ${maven.compiler.testSource} + + + 3.8.6 + ${maven.compiler.argument.source} + ERROR + + + false + + + + + Apache License, Version 2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + GitHub + https://github.com/quarkusio/quarkus/issues + + + + + quarkus + Quarkus Community + + + + + scm:git:git@github.com:quarkusio/quarkus.git + scm:git:git@github.com:quarkusio/quarkus.git + https://github.com/quarkusio/quarkus + HEAD + + + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots/ + + + oss.sonatype + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-java-version + + enforce + + + + + To build this project, don't use maven repositories over HTTP. Please use + HTTPS in your settings.xml or run the build with property + insecure.repositories=WARN + + ${insecure.repositories} + + http://* + + + http://* + + + + To build this project JDK ${jdk.min.version} (or greater) is required. + Please install it. + + ${jdk.min.version} + + + + + + enforce-maven-version + + enforce + + + + + To build this project Maven ${maven.min.version} (or greater) is required. + Please install it. + + ${maven.min.version} + + + + + + + + + + org.codehaus.mojo + buildnumber-maven-plugin + + + get-scm-revision + initialize + + create + + + false + false + UNKNOWN + true + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + true + true + ${maven.compiler.argument.source} + ${maven.compiler.argument.target} + ${maven.compiler.argument.testSource} + ${maven.compiler.argument.testTarget} + true + + -Xlint:unchecked + + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar-no-fork + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${version.compiler.plugin} + + + org.apache.maven.plugins + maven-gpg-plugin + ${version.gpg.plugin} + + + org.codehaus.mojo + build-helper-maven-plugin + ${version.buildhelper.plugin} + + + org.codehaus.mojo + buildnumber-maven-plugin + ${version.buildnumber.plugin} + + + org.apache.maven.plugins + maven-clean-plugin + ${version.clean.plugin} + + + org.apache.maven.plugins + maven-enforcer-plugin + ${version.enforcer.plugin} + + + org.apache.maven.plugins + maven-install-plugin + ${version.install.plugin} + + + org.apache.maven.plugins + maven-javadoc-plugin + ${version.javadoc.plugin} + + + org.apache.maven.plugins + maven-jar-plugin + ${version.jar.plugin} + + + org.apache.maven.plugins + maven-deploy-plugin + ${version.deploy.plugin} + + + org.apache.maven.plugins + maven-shade-plugin + ${version.shade.plugin} + + + org.apache.maven.plugins + maven-release-plugin + ${version.release.plugin} + + clean install + true + @{project.version} + false + true + false + + + + org.apache.maven.plugins + maven-resources-plugin + ${version.resources.plugin} + + + org.apache.maven.plugins + maven-source-plugin + ${version.source.plugin} + + + true + + + true + + + true + + + + ${project.url} + ${java.version} + ${java.vendor} + ${os.name} + ${os.arch} + ${os.version} + ${project.scm.url} + ${project.scm.connection} + ${buildNumber} + + + + + + net.revelc.code.formatter + formatter-maven-plugin + ${version.formatter.plugin} + + LF + ${format.skip} + + + + net.revelc.code + impsort-maven-plugin + ${version.impsort.plugin} + + java.,javax.,jakarta.,org.,com. + * + ${format.skip} + true + + + + org.apache.maven.plugins + maven-surefire-plugin + ${version.surefire.plugin} + + + org.jboss.logmanager.LogManager + ${maven.home} + ${settings.localRepository} + ${session.request.userSettingsFile.path} + ${project.build.directory} + + + + + org.apache.maven.plugins + maven-failsafe-plugin + ${version.failsafe.plugin} + + + org.jboss.logmanager.LogManager + ${maven.home} + ${settings.localRepository} + ${session.request.userSettingsFile.path} + + + + + it.ozimov + yaml-properties-maven-plugin + ${version.yaml-properties.plugin} + + + org.sonatype.plugins + nexus-staging-maven-plugin + ${version.nexus-staging.plugin} + + + org.codehaus.mojo + exec-maven-plugin + ${version.exec.plugin} + + + + + + + release + + + + org.apache.maven.plugins + maven-gpg-plugin + + + sign-artifacts + verify + + sign + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + package + + jar + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + true + + https://s01.oss.sonatype.org/ + ossrh + 60 + + + + + + + diff --git a/independent-projects/qute/pom.xml b/independent-projects/qute/pom.xml index 0d28e7ff5f35d..048276809e653 100644 --- a/independent-projects/qute/pom.xml +++ b/independent-projects/qute/pom.xml @@ -6,9 +6,10 @@ child.project.url.inherit.append.path="false"> 4.0.0 - org.jboss - jboss-parent - 39 + io.quarkus + quarkus-parent + 999-SNAPSHOT + ../parent/pom.xml io.quarkus.qute qute-parent diff --git a/independent-projects/resteasy-reactive/pom.xml b/independent-projects/resteasy-reactive/pom.xml index 4d8c4138af963..061fa8f88bf4f 100644 --- a/independent-projects/resteasy-reactive/pom.xml +++ b/independent-projects/resteasy-reactive/pom.xml @@ -6,9 +6,10 @@ 4.0.0 - org.jboss - jboss-parent - 39 + io.quarkus + quarkus-parent + 999-SNAPSHOT + ../parent/pom.xml io.quarkus.resteasy.reactive resteasy-reactive-parent diff --git a/independent-projects/revapi/pom.xml b/independent-projects/revapi/pom.xml index 8d37ec70c0168..763f581599ac8 100644 --- a/independent-projects/revapi/pom.xml +++ b/independent-projects/revapi/pom.xml @@ -3,16 +3,16 @@ child.project.url.inherit.append.path="false"> 4.0.0 - org.jboss - jboss-parent - 39 + io.quarkus + quarkus-parent + 999-SNAPSHOT + ../parent/pom.xml - io.quarkus quarkus-revapi-config Quarkus - Revapi Configuration - 999-SNAPSHOT - Contains the configuration of the Revapi API checker and the list of the API changes + 999-SNAPSHOT + Contains the configuration of the Revapi API checker and the list of the API changes in the Quarkus APIs. https://github.com/quarkusio/quarkus diff --git a/independent-projects/tools/pom.xml b/independent-projects/tools/pom.xml index 0af8f7ff8bb34..2b02c489716d0 100644 --- a/independent-projects/tools/pom.xml +++ b/independent-projects/tools/pom.xml @@ -4,11 +4,11 @@ child.project.url.inherit.append.path="false"> 4.0.0 - org.jboss - jboss-parent - 39 + io.quarkus + quarkus-parent + 999-SNAPSHOT + ../parent/pom.xml - io.quarkus quarkus-tools-parent Quarkus - Dev tools - Parent https://github.com/quarkusio/quarkus diff --git a/pom.xml b/pom.xml index 7de7c975e25d9..3498b1123303f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,15 +5,14 @@ child.project.url.inherit.append.path="false"> 4.0.0 - org.jboss - jboss-parent - 39 + io.quarkus + quarkus-parent + 999-SNAPSHOT + independent-projects/parent/pom.xml - io.quarkus - quarkus-parent - Quarkus - Parent pom - 999-SNAPSHOT + quarkus-project + Quarkus - Project pom pom Quarkus - Kubernetes Native Java stack tailored for OpenJDK HotSpot and GraalVM @@ -86,6 +85,7 @@ + independent-projects/parent independent-projects/ide-config independent-projects/revapi independent-projects/arc From cab6d7565efe4f46ddf50a7c601c0910fe918f7b Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Tue, 23 May 2023 10:15:22 +0300 Subject: [PATCH 31/33] Limit subclass codec registration to known working codecs Fixes: #33458 (cherry picked from commit 827dfa0e48ee6044670d67caed312f6d171c882f) --- .../vertx/deployment/EventBusCodecProcessor.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/EventBusCodecProcessor.java b/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/EventBusCodecProcessor.java index f64a54cdab508..8dd0ee0830df5 100644 --- a/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/EventBusCodecProcessor.java +++ b/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/EventBusCodecProcessor.java @@ -29,6 +29,7 @@ import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; +import io.quarkus.vertx.LocalEventBusCodec; import io.vertx.core.buffer.Buffer; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; @@ -38,6 +39,7 @@ public class EventBusCodecProcessor { private static final Logger LOGGER = Logger.getLogger(EventBusCodecProcessor.class.getName()); private static final DotName OBJECT = DotName.createSimple(Object.class); + private static final DotName LOCAL_EVENT_BUT_CODEC = DotName.createSimple(LocalEventBusCodec.class); @BuildStep public void registerCodecs( @@ -101,17 +103,25 @@ public void registerCodecs( // But do not override the existing ones for (Map.Entry entry : codecByTypes.entrySet()) { // we do not consider Object as it would be a mess - if (OBJECT.equals(entry.getKey())) { + DotName typeDotName = entry.getKey(); + if (OBJECT.equals(typeDotName)) { continue; } - Set subclasses = combinedIndex.getIndex().getAllKnownSubclasses(entry.getKey()).stream() + DotName codecDotName = entry.getValue(); + // we have to limit subclasses to codecs we know that have unique name per-instance + // see: https://github.com/quarkusio/quarkus/issues/33458 + if (!LOCAL_EVENT_BUT_CODEC.equals(codecDotName)) { + continue; + } + + Set subclasses = combinedIndex.getIndex().getAllKnownSubclasses(typeDotName).stream() .map(ci -> ci.name()) .filter(d -> !codecByTypes.containsKey(d)) .collect(Collectors.toSet()); for (DotName subclass : subclasses) { - messageCodecs.produce(new MessageCodecBuildItem(subclass.toString(), entry.getValue().toString())); + messageCodecs.produce(new MessageCodecBuildItem(subclass.toString(), codecDotName.toString())); } } From 14bff6240a6da03322cf9652487944ad09591a2d Mon Sep 17 00:00:00 2001 From: Phillip Kruger Date: Tue, 23 May 2023 11:08:50 +1000 Subject: [PATCH 32/33] Add some media queries for dev ui to render beter on smaller screens Signed-off-by: Phillip Kruger (cherry picked from commit 92965eb6ca0ae958e3eafbe93a81f731e4a2139d) --- .../main/resources/dev-ui/qwc/qwc-footer.js | 68 ++++++++++++++++--- .../src/main/resources/dev-ui/qwc/qwc-menu.js | 13 ++++ 2 files changed, 73 insertions(+), 8 deletions(-) diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-footer.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-footer.js index 316822a22cffe..fa293774b4938 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-footer.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-footer.js @@ -20,12 +20,6 @@ export class QwcFooter extends observeState(LitElement) { static styles = css` - vaadin-menu-bar { - --lumo-size-m: 10px; - --lumo-space-xs: 0.7rem; - --_lumo-button-background-color: transparent; - } - .openIcon { cursor: pointer; font-size: var(--lumo-font-size-s); @@ -54,10 +48,61 @@ export class QwcFooter extends observeState(LitElement) { .dragOpen { overflow: hidden; - height: 3px; + height: 4px; cursor: row-resize; background: var(--lumo-contrast-10pct); } + + .resizeIcon { + display: none; + } + + @media screen and (max-width: 1600px) { + .dragOpen { + height: 5px; + background: var(--lumo-contrast-10pct); + } + } + + @media screen and (max-width: 1280px) { + .dragOpen { + height: 6px; + background: var(--lumo-contrast-20pct); + } + #footer { + margin-right: 0px; + margin-left: 0px; + border-radius: 0px 0px 0px 0px; + } + .resizeIcon { + display: inline; + } + } + + @media screen and (max-width: 1152px) { + .dragOpen { + height: 7px; + background: var(--lumo-contrast-20pct); + } + } + + @media screen and (max-width: 1024px) { + .dragOpen { + height: 7px; + background: var(--lumo-contrast-30pct); + } + } + + @media screen and (max-width: 900px) { + .dragOpen { + height: 8px; + background: var(--lumo-contrast-30pct); + } + } + + vaadin-menu-bar-button { + background: var(--lumo-contrast-5pct); + } .dragOpen:hover { background: var(--quarkus-blue); @@ -211,6 +256,8 @@ export class QwcFooter extends observeState(LitElement) { ${this._renderControls()}
+ ${this._renderResizeIcon()} +
`; } @@ -227,7 +274,8 @@ export class QwcFooter extends observeState(LitElement) { } _renderControls(){ - return html` `; @@ -259,6 +307,10 @@ export class QwcFooter extends observeState(LitElement) { this.storageControl.set('selected-tab', this._selectedTab); } + _renderResizeIcon(){ + return html``; + } + _mousedown(e){ this._originalHeight = this._height; this._originalMouseY = e.y; diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-menu.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-menu.js index 4632b74ba1f26..1050f1e5da2df 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-menu.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-menu.js @@ -41,6 +41,19 @@ export class QwcMenu extends observeState(LitElement) { color: var(--lumo-primary-color-50pct); } + @media screen and (max-width: 1280px) { + .menuSizeControl, .quarkusVersion, .item-text { + display: none; + } + .menu, .left { + width: 35px!important; + } + vaadin-icon { + width: var(--lumo-icon-size-s); + height: var(--lumo-icon-size-s); + } + } + .item { display: flex; flex-direction: row; From ba54a59f152a729994826ecb74b7c6de5ad719ad Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Tue, 23 May 2023 14:19:09 +0300 Subject: [PATCH 33/33] Properly include Prometheus related code The way the test was being done previously was checking the build time classpath instead of the runtime class for the presence of the Prometheus Registry. Fixes: #33547 (cherry picked from commit a42d2de0e791951288cab8507b36bcd14061ab56) --- .../deployment/export/PrometheusRegistryProcessor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/PrometheusRegistryProcessor.java b/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/PrometheusRegistryProcessor.java index 4fcd30d4ce294..10ed43b3dca42 100644 --- a/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/PrometheusRegistryProcessor.java +++ b/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/PrometheusRegistryProcessor.java @@ -39,7 +39,8 @@ public static class PrometheusEnabled implements BooleanSupplier { MicrometerConfig mConfig; public boolean getAsBoolean() { - return REGISTRY_CLASS != null && mConfig.checkRegistryEnabledWithDefault(mConfig.export.prometheus); + return (REGISTRY_CLASS != null) && QuarkusClassLoader.isClassPresentAtRuntime(REGISTRY_CLASS_NAME) + && mConfig.checkRegistryEnabledWithDefault(mConfig.export.prometheus); } }
Status${this.status}${this.status.toUpperCase()}
Config Filter