From fb690607d8dcd9e05800dc55e97c776d3f0636ed Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Fri, 17 May 2024 17:40:32 +0200 Subject: [PATCH 01/31] Fix XA support for Oracle in native We need to register a few more classes for reflection and also all their nested classes, which is why I use `@RegisterForReflection` instead of the usual build item. Fixes #23341 (cherry picked from commit f69176f023e8d049ece297cc121cab85980930ad) --- .../jdbc/oracle/deployment/OracleNativeImage.java | 8 +++++++- .../oracle/runtime/graal/OracleReflections.java | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 extensions/jdbc/jdbc-oracle/runtime/src/main/java/io/quarkus/jdbc/oracle/runtime/graal/OracleReflections.java diff --git a/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleNativeImage.java b/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleNativeImage.java index 9bfd954d11e47..8167b900a952e 100644 --- a/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleNativeImage.java +++ b/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleNativeImage.java @@ -2,6 +2,7 @@ import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.AdditionalIndexedClassesBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; /** @@ -14,7 +15,8 @@ public final class OracleNativeImage { * by reflection, as commonly expected. */ @BuildStep - void reflection(BuildProducer reflectiveClass) { + void reflection(BuildProducer reflectiveClass, + BuildProducer additionalIndexedClasses) { //Not strictly necessary when using Agroal, as it also registers //any JDBC driver being configured explicitly through its configuration. //We register it for the sake of people not using Agroal. @@ -23,6 +25,10 @@ void reflection(BuildProducer reflectiveClass) { final String driverName = "oracle.jdbc.driver.OracleDriver"; reflectiveClass.produce(ReflectiveClassBuildItem.builder(driverName).build()); + // This is needed when using XA and we use the `@RegisterForReflection` trick to make sure all nested classes are registered for reflection + additionalIndexedClasses + .produce(new AdditionalIndexedClassesBuildItem("io.quarkus.jdbc.oracle.runtime.graal.OracleReflections")); + // for ldap style jdbc urls. e.g. jdbc:oracle:thin:@ldap://oid:5000/mydb1,cn=OracleContext,dc=myco,dc=com // // Note that all JDK provided InitialContextFactory impls from the JDK registered via module descriptors diff --git a/extensions/jdbc/jdbc-oracle/runtime/src/main/java/io/quarkus/jdbc/oracle/runtime/graal/OracleReflections.java b/extensions/jdbc/jdbc-oracle/runtime/src/main/java/io/quarkus/jdbc/oracle/runtime/graal/OracleReflections.java new file mode 100644 index 0000000000000..f489dc605beea --- /dev/null +++ b/extensions/jdbc/jdbc-oracle/runtime/src/main/java/io/quarkus/jdbc/oracle/runtime/graal/OracleReflections.java @@ -0,0 +1,13 @@ +package io.quarkus.jdbc.oracle.runtime.graal; + +import io.quarkus.runtime.annotations.RegisterForReflection; + +/** + * We don't use a build item here as we also need to register all the nested classes and there's no way to do it easily with the + * build item for now. + */ +@RegisterForReflection(targets = { oracle.jdbc.xa.OracleXADataSource.class, + oracle.jdbc.datasource.impl.OracleDataSource.class }) +public class OracleReflections { + +} From dcc6b80bb6fa0e291cb8335b052f0912b251b2cd Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Fri, 17 May 2024 17:41:21 +0200 Subject: [PATCH 02/31] Fix an invalid configuration property in datasource.adoc (cherry picked from commit 13d163c9a491a1c531a2e672c8d6c018e0089257) --- docs/src/main/asciidoc/datasource.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/datasource.adoc b/docs/src/main/asciidoc/datasource.adoc index 8c40a26fe3580..5924e3b1b9b03 100644 --- a/docs/src/main/asciidoc/datasource.adoc +++ b/docs/src/main/asciidoc/datasource.adoc @@ -543,7 +543,7 @@ All <>, but <> might not. . Make sure your database server is configured to enable XA. . Enable XA support explicitly for each relevant datasource by setting -<> to `xa`. +<> to `xa`. Using XA, a rollback in one datasource will trigger a rollback in every other datasource enrolled in the transaction. From ebb22d7683fd3dd51518d757866ebd17f05c1ba0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 May 2024 21:36:04 +0000 Subject: [PATCH 03/31] --- updated-dependencies: - dependency-name: org.jboss.resteasy:resteasy-bom dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jboss.resteasy:resteasy-core dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jboss.resteasy:resteasy-core-spi dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jboss.resteasy:resteasy-json-binding-provider dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jboss.resteasy:resteasy-json-p-provider dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jboss.resteasy:resteasy-jaxb-provider dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jboss.resteasy:resteasy-jackson2-provider dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jboss.resteasy:resteasy-rxjava2 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jboss.resteasy:resteasy-links dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] (cherry picked from commit 30442d9ac7cc09ee6b8f93ca41584fc7b2a0f5b0) --- 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 32af340e2dfcc..9d93dc0a6d4ac 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -26,7 +26,7 @@ 1.1.6 2.1.5.Final 3.1.2.Final - 6.2.8.Final + 6.2.9.Final 0.33.0 0.2.4 0.1.15 From 31de9fab997d3cd21f01ae40af67f403ae207c6f Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Tue, 21 May 2024 17:01:49 +0200 Subject: [PATCH 04/31] Avoid StringIndexOutOfBoundsException in KafkaRuntimeConfigProducer Fixes #40677 (cherry picked from commit 46b1e2739a2faa1f5bf72c6f12f2e1223525ad43) --- .../kafka/client/runtime/KafkaRuntimeConfigProducer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaRuntimeConfigProducer.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaRuntimeConfigProducer.java index 504bc66168f4e..ba0f407ea5dec 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaRuntimeConfigProducer.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaRuntimeConfigProducer.java @@ -35,6 +35,9 @@ public Map createKafkaRuntimeConfig(Config config, ApplicationCo if (!propertyNameLowerCase.startsWith(CONFIG_PREFIX) || propertyNameLowerCase.startsWith(UI_CONFIG_PREFIX)) { continue; } + if (propertyNameLowerCase.length() <= CONFIG_PREFIX.length()) { + continue; + } // Replace _ by . - This is because Kafka properties tend to use . and env variables use _ for every special // character. So, replace _ with . String effectivePropertyName = propertyNameLowerCase.substring(CONFIG_PREFIX.length() + 1).toLowerCase() From 5f66d57243c8a2f2939b246d30e6701d7e62de1d Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Wed, 22 May 2024 17:48:26 +0200 Subject: [PATCH 05/31] Fix javadoc for TransactionManagerBuildTimeConfig (cherry picked from commit db0ead83dd66786a9a6fd4e8b48e25fc810f3bb9) --- .../jta/runtime/TransactionManagerBuildTimeConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/TransactionManagerBuildTimeConfig.java b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/TransactionManagerBuildTimeConfig.java index dced5709b63cc..91cbeccf433d6 100644 --- a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/TransactionManagerBuildTimeConfig.java +++ b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/TransactionManagerBuildTimeConfig.java @@ -12,7 +12,7 @@ public final class TransactionManagerBuildTimeConfig { * Define the behavior when using multiple XA unaware resources in the same transactional demarcation. *

* Defaults to {@code fail}. - * {@code warn} and {@code allow} are UNSAFE and should only be used for compatibility. + * {@code warn-each}, {@code warn-first}, and {@code allow} are UNSAFE and should only be used for compatibility. * Either use XA for all resources if you want consistency, or split the code into separate * methods with separate transactions. *

@@ -58,7 +58,7 @@ public enum UnsafeMultipleLastResourcesMode { */ FAIL; - // The default is WARN in Quarkus 3.8, FAIL in Quarkus 3.9+ + // The default is WARN_FIRST in Quarkus 3.8, FAIL in Quarkus 3.9+ // Make sure to update defaultValueDocumentation on unsafeMultipleLastResources when changing this. public static final UnsafeMultipleLastResourcesMode DEFAULT = FAIL; } From c1f23b5a62399e82bf22c634625fdf3f2e434efd Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Wed, 22 May 2024 11:05:35 +0200 Subject: [PATCH 06/31] Fix collapsing when there are several keys (cherry picked from commit 7d76d6dab0728372b60e42ae9e2bbea781939d25) --- docs/src/main/asciidoc/javascript/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/javascript/config.js b/docs/src/main/asciidoc/javascript/config.js index 430d85b7318d5..26107d70d9b52 100644 --- a/docs/src/main/asciidoc/javascript/config.js +++ b/docs/src/main/asciidoc/javascript/config.js @@ -24,7 +24,7 @@ if(tables){ const decoration = td.firstElementChild.lastElementChild.firstElementChild; const iconDecoration = decoration.children.item(0); const collapsibleSpan = decoration.children.item(1); - const descDiv = td.firstElementChild.children.item(1); + const descDiv = td.firstElementChild.querySelector(".description"); const collapsibleHandler = makeCollapsibleHandler(descDiv, td, row, collapsibleSpan, iconDecoration); row.addEventListener('click', collapsibleHandler); } From 47a25a3d720d9161c16047a36df68c21499e9d5c Mon Sep 17 00:00:00 2001 From: Ozan Gunalp Date: Thu, 16 May 2024 14:33:58 +0200 Subject: [PATCH 07/31] Podman on linux doc: prefix the remote socket path with unix:// (cherry picked from commit 0b776eac25a997db20795a85da23a957b3b4a344) --- docs/src/main/asciidoc/podman.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/podman.adoc b/docs/src/main/asciidoc/podman.adoc index a8eae2551625d..05a21f8faeb26 100644 --- a/docs/src/main/asciidoc/podman.adoc +++ b/docs/src/main/asciidoc/podman.adoc @@ -73,7 +73,7 @@ With the above rootless setup on Linux, you will need to configure clients, such [source,bash] ---- -export DOCKER_HOST=$(podman info --format '{{.Host.RemoteSocket.Path}}') +export DOCKER_HOST=unix://$(podman info --format '{{.Host.RemoteSocket.Path}}') ---- == Other Linux settings From 5d7e3e66cef306fad282178b39949c90a687d0a4 Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Wed, 22 May 2024 15:21:11 -0300 Subject: [PATCH 08/31] Control data used in path expression when running remote-dev (cherry picked from commit 8fe16d405fd677869dc891c824dfbea6ce0e77fd) --- .../deployment/dev/IsolatedRemoteDevModeMain.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedRemoteDevModeMain.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedRemoteDevModeMain.java index 6f54adaa0dd11..1ec369cd140fb 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedRemoteDevModeMain.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedRemoteDevModeMain.java @@ -253,14 +253,19 @@ private Closeable doConnect() { @Override public Map apply(Set fileNames) { Map ret = new HashMap<>(); - for (String i : fileNames) { + for (String filename : fileNames) { try { - Path resolvedPath = appRoot.resolve(i); + Path resolvedPath = appRoot.resolve(filename); + // Ensure that path stays inside appRoot + if (!resolvedPath.startsWith(appRoot)) { + log.errorf("Attempted to access %s outside of %s", resolvedPath, appRoot); + continue; + } if (!Files.isDirectory(resolvedPath)) { - ret.put(i, Files.readAllBytes(resolvedPath)); + ret.put(filename, Files.readAllBytes(resolvedPath)); } } catch (IOException e) { - log.error("Failed to read file " + i, e); + log.error("Failed to read file " + filename, e); } } return ret; From ec8232e879084f48527c5171d4f3d573e811d017 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Wed, 22 May 2024 18:07:27 +0200 Subject: [PATCH 09/31] Revert "Bump jakarta.authorization:jakarta.authorization-api from 2.1.0 to 3.0.0" This reverts commit 1c8d9f36c435344c8c13065ced57536929f61ce9. As stated in https://github.com/quarkusio/quarkus/pull/40607, I think we should update all the Jakarta EE dependencies in one go when they are all ready. Unfortunately, this will hit 3.11.0 but better fixing it for 3.11.1 anyway. (cherry picked from commit 3da097f68f805930bfdb644f26c0960cc3577b01) --- 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 9d93dc0a6d4ac..7dd2c27b67fd1 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -67,7 +67,7 @@ 2.1.3 3.0.0 3.0.0 - 3.0.0 + 2.1.0 5.0.1 4.1.0 2.0.1 From ed9a7ec6d207b3e00c84cb886a441b802bfc9f87 Mon Sep 17 00:00:00 2001 From: Holly Cummins Date: Wed, 22 May 2024 17:56:11 +0100 Subject: [PATCH 10/31] Update matcher to catch single test case (cherry picked from commit 32d011ed655b38ddf9bb5ed36e7a36632838e42f) --- .../src/main/java/io/quarkus/test/ProdModeTestBuildStep.java | 2 +- .../TestModeContinuousTestingMavenTestUtils.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test-framework/junit5-internal/src/main/java/io/quarkus/test/ProdModeTestBuildStep.java b/test-framework/junit5-internal/src/main/java/io/quarkus/test/ProdModeTestBuildStep.java index 53e649fad5126..f87c76b549161 100644 --- a/test-framework/junit5-internal/src/main/java/io/quarkus/test/ProdModeTestBuildStep.java +++ b/test-framework/junit5-internal/src/main/java/io/quarkus/test/ProdModeTestBuildStep.java @@ -4,7 +4,7 @@ import io.quarkus.builder.BuildStep; -// needs to be in a class of it's own in order to avoid java.lang.IncompatibleClassChangeError +// needs to be in a class of its own in order to avoid java.lang.IncompatibleClassChangeError public abstract class ProdModeTestBuildStep implements BuildStep { private final Map testContext; diff --git a/test-framework/maven/src/main/java/io/quarkus/maven/it/continuoustesting/TestModeContinuousTestingMavenTestUtils.java b/test-framework/maven/src/main/java/io/quarkus/maven/it/continuoustesting/TestModeContinuousTestingMavenTestUtils.java index 15b4530ea586b..d08e2c7cf7b1d 100644 --- a/test-framework/maven/src/main/java/io/quarkus/maven/it/continuoustesting/TestModeContinuousTestingMavenTestUtils.java +++ b/test-framework/maven/src/main/java/io/quarkus/maven/it/continuoustesting/TestModeContinuousTestingMavenTestUtils.java @@ -22,10 +22,11 @@ public class TestModeContinuousTestingMavenTestUtils extends ContinuousTestingMa // Example output we look for // 1 test failed (1 passing, 0 skipped), 1 test was run in 217ms. Tests completed at 21:22:34 due to changes to HelloResource$Blah.class and 1 other files. // All 2 tests are passing (0 skipped), 2 tests were run in 1413ms. Tests completed at 21:22:33. + // All 1 test is passing (0 skipped), ... // Windows log, despite `quarkus.console.basic=true', might contain terminal control symbols, colour decorations. // e.g. the matcher is then fighting: 1 test failed (1 passing, 0 skipped) private static final Pattern ALL_PASSING = Pattern.compile( - "(?:\\e\\[[\\d;]+m)*All (\\d+) tests are passing \\((\\d+) skipped\\)", + "(?:\\e\\[[\\d;]+m)*All (\\d+) tests? (?:are|is) passing \\((\\d+) skipped\\)", Pattern.MULTILINE); private static final Pattern SOME_PASSING = Pattern .compile( From a61efdafbe2e8f62602e7874a016dc1b37017af9 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Thu, 23 May 2024 09:11:08 +0200 Subject: [PATCH 11/31] Move allowUnsafeMultipleLastResources call to runtime init And after the properties have been set. (cherry picked from commit 0f23c248827e7c6d924f36f1f1dfa090f5e4b3c7) --- .../jta/deployment/NarayanaJtaProcessor.java | 72 ++++++++++--------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/extensions/narayana-jta/deployment/src/main/java/io/quarkus/narayana/jta/deployment/NarayanaJtaProcessor.java b/extensions/narayana-jta/deployment/src/main/java/io/quarkus/narayana/jta/deployment/NarayanaJtaProcessor.java index 51cce765f1fa9..c661f5ea866b6 100644 --- a/extensions/narayana-jta/deployment/src/main/java/io/quarkus/narayana/jta/deployment/NarayanaJtaProcessor.java +++ b/extensions/narayana-jta/deployment/src/main/java/io/quarkus/narayana/jta/deployment/NarayanaJtaProcessor.java @@ -1,7 +1,6 @@ package io.quarkus.narayana.jta.deployment; import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT; -import static io.quarkus.deployment.annotations.ExecutionTime.STATIC_INIT; import java.util.List; import java.util.Map; @@ -101,8 +100,11 @@ public void build(NarayanaJtaRecorder recorder, BuildProducer reflectiveClass, BuildProducer runtimeInit, BuildProducer feature, + BuildProducer logCleanupFilters, + BuildProducer nativeImageFeatures, TransactionManagerConfiguration transactions, TransactionManagerBuildTimeConfig transactionManagerBuildTimeConfig, - ShutdownContextBuildItem shutdownContextBuildItem) { + ShutdownContextBuildItem shutdownContextBuildItem, + Capabilities capabilities) { recorder.handleShutdown(shutdownContextBuildItem, transactions); feature.produce(new FeatureBuildItem(Feature.NARAYANA_JTA)); additionalBeans.produce(new AdditionalBeanBuildItem(NarayanaJtaProducers.class)); @@ -163,44 +165,13 @@ public void build(NarayanaJtaRecorder recorder, recorder.setDefaultProperties(defaultProperties); // This must be done before setNodeName as the code in setNodeName will create a TSM based on the value of this property recorder.disableTransactionStatusManager(); + allowUnsafeMultipleLastResources(recorder, transactionManagerBuildTimeConfig, capabilities, logCleanupFilters, + nativeImageFeatures); recorder.setNodeName(transactions); recorder.setDefaultTimeout(transactions); recorder.setConfig(transactions); } - @BuildStep - @Record(STATIC_INIT) - public void allowUnsafeMultipleLastResources(NarayanaJtaRecorder recorder, - TransactionManagerBuildTimeConfig transactionManagerBuildTimeConfig, - Capabilities capabilities, BuildProducer logCleanupFilters, - BuildProducer nativeImageFeatures) { - switch (transactionManagerBuildTimeConfig.unsafeMultipleLastResources - .orElse(UnsafeMultipleLastResourcesMode.DEFAULT)) { - case ALLOW -> { - recorder.allowUnsafeMultipleLastResources(capabilities.isPresent(Capability.AGROAL), true); - // we will handle the warnings ourselves at runtime init when the option is set explicitly - logCleanupFilters.produce( - new LogCleanupFilterBuildItem("com.arjuna.ats.arjuna", "ARJUNA012139", "ARJUNA012141", "ARJUNA012142")); - } - case WARN_FIRST -> { - recorder.allowUnsafeMultipleLastResources(capabilities.isPresent(Capability.AGROAL), true); - // we will handle the warnings ourselves at runtime init when the option is set explicitly - // but we still want Narayana to produce a warning on the first offending transaction - logCleanupFilters.produce( - new LogCleanupFilterBuildItem("com.arjuna.ats.arjuna", "ARJUNA012139", "ARJUNA012142")); - } - case WARN_EACH -> { - recorder.allowUnsafeMultipleLastResources(capabilities.isPresent(Capability.AGROAL), false); - // we will handle the warnings ourselves at runtime init when the option is set explicitly - // but we still want Narayana to produce one warning per offending transaction - logCleanupFilters.produce( - new LogCleanupFilterBuildItem("com.arjuna.ats.arjuna", "ARJUNA012139", "ARJUNA012142")); - } - case FAIL -> { // No need to do anything, this is the default behavior of Narayana - } - } - } - @BuildStep(onlyIf = NativeOrNativeSourcesBuild.class) public void nativeImageFeature(TransactionManagerBuildTimeConfig transactionManagerBuildTimeConfig, BuildProducer nativeImageFeatures) { @@ -271,4 +242,35 @@ void unremovableBean(BuildProducer unremovableBeans) { void logCleanupFilters(BuildProducer logCleanupFilters) { logCleanupFilters.produce(new LogCleanupFilterBuildItem("com.arjuna.ats.jbossatx", "ARJUNA032010:", "ARJUNA032013:")); } + + private void allowUnsafeMultipleLastResources(NarayanaJtaRecorder recorder, + TransactionManagerBuildTimeConfig transactionManagerBuildTimeConfig, + Capabilities capabilities, BuildProducer logCleanupFilters, + BuildProducer nativeImageFeatures) { + switch (transactionManagerBuildTimeConfig.unsafeMultipleLastResources + .orElse(UnsafeMultipleLastResourcesMode.DEFAULT)) { + case ALLOW -> { + recorder.allowUnsafeMultipleLastResources(capabilities.isPresent(Capability.AGROAL), true); + // we will handle the warnings ourselves at runtime init when the option is set explicitly + logCleanupFilters.produce( + new LogCleanupFilterBuildItem("com.arjuna.ats.arjuna", "ARJUNA012139", "ARJUNA012141", "ARJUNA012142")); + } + case WARN_FIRST -> { + recorder.allowUnsafeMultipleLastResources(capabilities.isPresent(Capability.AGROAL), true); + // we will handle the warnings ourselves at runtime init when the option is set explicitly + // but we still want Narayana to produce a warning on the first offending transaction + logCleanupFilters.produce( + new LogCleanupFilterBuildItem("com.arjuna.ats.arjuna", "ARJUNA012139", "ARJUNA012142")); + } + case WARN_EACH -> { + recorder.allowUnsafeMultipleLastResources(capabilities.isPresent(Capability.AGROAL), false); + // we will handle the warnings ourselves at runtime init when the option is set explicitly + // but we still want Narayana to produce one warning per offending transaction + logCleanupFilters.produce( + new LogCleanupFilterBuildItem("com.arjuna.ats.arjuna", "ARJUNA012139", "ARJUNA012142")); + } + case FAIL -> { // No need to do anything, this is the default behavior of Narayana + } + } + } } From 730cbfc92ba947c055250a61a2112568fdab80f8 Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Wed, 22 May 2024 11:14:46 -0300 Subject: [PATCH 12/31] Bump Agroal from 2.3 to 2.4 (cherry picked from commit 7fa51f01894490510caff7273322738531f2c7d6) --- 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 7dd2c27b67fd1..3ad6f6ad755a2 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -109,7 +109,7 @@ 7.1.1.Final 7.0.1.Final - 2.3 + 2.4 8.0.0.Final 8.13.4 2.2.21 From 555f2c2ab1dab5c5183c35bea91e473c4ec11185 Mon Sep 17 00:00:00 2001 From: Harsh Bhagat <93080554+BhagatHarsh@users.noreply.github.com> Date: Thu, 23 May 2024 21:00:28 +0530 Subject: [PATCH 13/31] fix: typo hibernate-reactive.adoc (cherry picked from commit c88fcdeac3585ccc2c530d787d8b9e122c260da1) --- docs/src/main/asciidoc/hibernate-reactive.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/hibernate-reactive.adoc b/docs/src/main/asciidoc/hibernate-reactive.adoc index 52d2f412e0d66..c0e32ee9b0475 100644 --- a/docs/src/main/asciidoc/hibernate-reactive.adoc +++ b/docs/src/main/asciidoc/hibernate-reactive.adoc @@ -191,7 +191,7 @@ and will have it use the default datasource. The configuration properties listed here allow you to override such defaults, and customize and tune various aspects. Hibernate Reactive uses the same properties you would use for Hibernate ORM. You will notice that some properties -contain `jdbc` in the name but there is not JDBC in Hibernate Reactive, these are simply legacy property names. +contain `jdbc` in the name but there is no JDBC in Hibernate Reactive, these are simply legacy property names. include::{generated-dir}/config/quarkus-hibernate-orm.adoc[opts=optional, leveloffset=+2] From c39f96b7c15d62d3d8a036e168dc6e4d9783786a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Vav=C5=99=C3=ADk?= Date: Thu, 23 May 2024 22:17:04 +0200 Subject: [PATCH 14/31] Improve @SecureField detection lookup exclusion (cherry picked from commit 0a6c50ba271c2d09c20a2d5631aa5495fc85ab4b) --- .../ResteasyReactiveJacksonProcessor.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/ResteasyReactiveJacksonProcessor.java b/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/ResteasyReactiveJacksonProcessor.java index 38f5ee6411377..b589e330ee903 100644 --- a/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/ResteasyReactiveJacksonProcessor.java +++ b/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/ResteasyReactiveJacksonProcessor.java @@ -490,16 +490,19 @@ private static boolean hasSecureFields(IndexView indexView, ClassInfo currentCla final boolean hasSecureFields; if (currentClassInfo.isInterface()) { - // check interface implementors as anyone of them can be returned - hasSecureFields = indexView.getAllKnownImplementors(currentClassInfo.name()).stream() - .anyMatch(ci -> hasSecureFields(indexView, ci, typeToHasSecureField, needToDeleteCache)); + if (isExcludedFromSecureFieldLookup(currentClassInfo.name())) { + hasSecureFields = false; + } else { + // check interface implementors as anyone of them can be returned + hasSecureFields = indexView.getAllKnownImplementors(currentClassInfo.name()).stream() + .anyMatch(ci -> hasSecureFields(indexView, ci, typeToHasSecureField, needToDeleteCache)); + } } else { // figure if any field or parent / subclass field is secured if (hasSecureFields(currentClassInfo)) { hasSecureFields = true; } else { - Predicate ignoredTypesPredicate = QuarkusResteasyReactiveDotNames.IGNORE_TYPE_FOR_REFLECTION_PREDICATE; - if (ignoredTypesPredicate.test(currentClassInfo.name())) { + if (isExcludedFromSecureFieldLookup(currentClassInfo.name())) { hasSecureFields = false; } else { hasSecureFields = anyFieldHasSecureFields(indexView, currentClassInfo, typeToHasSecureField, @@ -514,6 +517,10 @@ private static boolean hasSecureFields(IndexView indexView, ClassInfo currentCla return hasSecureFields; } + private static boolean isExcludedFromSecureFieldLookup(DotName name) { + return ((Predicate) QuarkusResteasyReactiveDotNames.IGNORE_TYPE_FOR_REFLECTION_PREDICATE).test(name); + } + private static boolean hasSecureFields(ClassInfo classInfo) { return classInfo.annotationsMap().containsKey(SECURE_FIELD); } @@ -548,7 +555,7 @@ private static boolean fieldTypeHasSecureFields(Type fieldType, IndexView indexV Map typeToHasSecureField, AtomicBoolean needToDeleteCache) { // this is the best effort and does not cover every possibility (e.g. type variables, wildcards) if (fieldType.kind() == Type.Kind.CLASS) { - if (fieldType.name().packagePrefix() != null && fieldType.name().packagePrefix().startsWith("java.")) { + if (isExcludedFromSecureFieldLookup(fieldType.name())) { return false; } final ClassInfo fieldClass = indexView.getClassByName(fieldType.name()); From 46c134fe29993e846e75b4b0e355ddf53ef536bd Mon Sep 17 00:00:00 2001 From: Fabrice Bauzac-Stehly Date: Sat, 25 May 2024 22:44:07 +0200 Subject: [PATCH 15/31] getting-started: grammar: append->appended (cherry picked from commit 43b2e272119d668f441b9895404bbe9c1738045b) --- docs/src/main/asciidoc/getting-started.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/getting-started.adoc b/docs/src/main/asciidoc/getting-started.adoc index 7c03569b67e82..7eab23affaae3 100644 --- a/docs/src/main/asciidoc/getting-started.adoc +++ b/docs/src/main/asciidoc/getting-started.adoc @@ -481,7 +481,7 @@ but users can also choose to expose one that might present a security risk under If the application contains the `quarkus-info` extension, then Quarkus will by default expose the `/q/info` endpoint which provides information about the build, java version, version control, and operating system. The level of detail of the exposed information is configurable. -All CDI beans implementing the `InfoContributor` will be picked up and their data will be append to the endpoint. +All CDI beans implementing the `InfoContributor` will be picked up and their data will be appended to the endpoint. ==== Configuration Reference From 7438837154ae7513a78f632a462fb47aa716558f Mon Sep 17 00:00:00 2001 From: Davide D'Alto Date: Mon, 27 May 2024 18:01:31 +0200 Subject: [PATCH 16/31] Bump Hibernate Reactive to 2.3.1.Final (cherry picked from commit 61f5c3741a2185566268d3e7f768a04785bd6671) --- 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 3ad6f6ad755a2..cdf70e2165d36 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -104,7 +104,7 @@ 6.5.2.Final 1.14.15 6.0.6.Final - 2.3.0.Final + 2.3.1.Final 8.0.1.Final 7.1.1.Final From cc5974ef252683e52a28f2e8a905157e8e1f32ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Tue, 28 May 2024 09:12:11 +0200 Subject: [PATCH 17/31] Move hibernate-orm/deployment devmode tests to a separate surefire execution In the hope this will reduce the impact of QuarkusDevModeTest metaspace memory leaks. (cherry picked from commit 7fb9a40b466fa619740ea98ccb0048f2db157201) --- extensions/hibernate-orm/deployment/pom.xml | 29 +++++++++++++++++++ ...ava => HibernateHotReloadDevModeTest.java} | 4 ++- ...rnateSchemaRecreateDevConsoleTestCase.java | 2 ++ .../io/quarkus/hibernate/orm/TestTags.java | 10 +++++++ ...ontrollerFailingDDLGenerationTestCase.java | 3 ++ .../HibernateOrmDevControllerTestCase.java | 3 ++ ...enceUnitsImportSqlHotReloadScriptTest.java | 3 ++ .../JPAQuotedIdentifiersTest.java | 3 ++ .../JPAQuotedKeywordsTest.java | 3 ++ .../GenerateScriptNotAppendedTestCase.java | 3 ++ .../AddNewSqlLoadScriptTestCase.java | 3 ++ .../ImportSqlHotReloadScriptTestCase.java | 3 ++ ...ntroducingDefaultImportScriptTestCase.java | 3 ++ .../HbmXmlHotReloadExplicitFileTestCase.java | 3 ++ .../OrmXmlHotReloadExplicitFileTestCase.java | 3 ++ .../OrmXmlHotReloadImplicitFileTestCase.java | 3 ++ 16 files changed, 80 insertions(+), 1 deletion(-) rename extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/{HibernateHotReloadTestCase.java => HibernateHotReloadDevModeTest.java} (98%) create mode 100644 extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/TestTags.java diff --git a/extensions/hibernate-orm/deployment/pom.xml b/extensions/hibernate-orm/deployment/pom.xml index 193ff06b92316..50e05c8cb1d84 100644 --- a/extensions/hibernate-orm/deployment/pom.xml +++ b/extensions/hibernate-orm/deployment/pom.xml @@ -118,6 +118,35 @@ + + maven-surefire-plugin + + + default-test + + test + + + + devmode + + + + devmode-test + + test + + + + devmode + + + + + maven-compiler-plugin diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/HibernateHotReloadTestCase.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/HibernateHotReloadDevModeTest.java similarity index 98% rename from extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/HibernateHotReloadTestCase.java rename to extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/HibernateHotReloadDevModeTest.java index f391a789273f3..c995d372deecc 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/HibernateHotReloadTestCase.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/HibernateHotReloadDevModeTest.java @@ -8,6 +8,7 @@ import org.jboss.shrinkwrap.api.asset.StringAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -16,7 +17,8 @@ import io.quarkus.test.QuarkusDevModeTest; import io.restassured.RestAssured; -public class HibernateHotReloadTestCase { +@Tag(TestTags.DEVMODE) +public class HibernateHotReloadDevModeTest { @RegisterExtension final static QuarkusDevModeTest TEST = new QuarkusDevModeTest() diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/HibernateSchemaRecreateDevConsoleTestCase.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/HibernateSchemaRecreateDevConsoleTestCase.java index edcf67f16c675..5ee5a89145681 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/HibernateSchemaRecreateDevConsoleTestCase.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/HibernateSchemaRecreateDevConsoleTestCase.java @@ -5,6 +5,7 @@ import java.util.Map; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -14,6 +15,7 @@ import io.quarkus.test.QuarkusDevModeTest; import io.restassured.RestAssured; +@Tag(TestTags.DEVMODE) public class HibernateSchemaRecreateDevConsoleTestCase extends DevUIJsonRPCTest { @RegisterExtension diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/TestTags.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/TestTags.java new file mode 100644 index 0000000000000..bf774e0893ff8 --- /dev/null +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/TestTags.java @@ -0,0 +1,10 @@ +package io.quarkus.hibernate.orm; + +public class TestTags { + /** + * Tag for tests that use {@link io.quarkus.test.QuarkusDevModeTest}, + * so that surefire config can run them in a different execution + * and keep the metaspace memory leaks there. + */ + public static final String DEVMODE = "devmode"; +} diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/dev/HibernateOrmDevControllerFailingDDLGenerationTestCase.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/dev/HibernateOrmDevControllerFailingDDLGenerationTestCase.java index 29a9b2312cf16..797becb515aa1 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/dev/HibernateOrmDevControllerFailingDDLGenerationTestCase.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/dev/HibernateOrmDevControllerFailingDDLGenerationTestCase.java @@ -2,12 +2,15 @@ import static org.hamcrest.Matchers.is; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +import io.quarkus.hibernate.orm.TestTags; import io.quarkus.test.QuarkusDevModeTest; import io.restassured.RestAssured; +@Tag(TestTags.DEVMODE) public class HibernateOrmDevControllerFailingDDLGenerationTestCase { @RegisterExtension final static QuarkusDevModeTest TEST = new QuarkusDevModeTest() diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/dev/HibernateOrmDevControllerTestCase.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/dev/HibernateOrmDevControllerTestCase.java index 8bf6e4c2e738b..afaaa2c2bbd95 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/dev/HibernateOrmDevControllerTestCase.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/dev/HibernateOrmDevControllerTestCase.java @@ -2,12 +2,15 @@ import static org.hamcrest.Matchers.is; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +import io.quarkus.hibernate.orm.TestTags; import io.quarkus.test.QuarkusDevModeTest; import io.restassured.RestAssured; +@Tag(TestTags.DEVMODE) public class HibernateOrmDevControllerTestCase { @RegisterExtension final static QuarkusDevModeTest TEST = new QuarkusDevModeTest() diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/multiplepersistenceunits/MultiplePersistenceUnitsImportSqlHotReloadScriptTest.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/multiplepersistenceunits/MultiplePersistenceUnitsImportSqlHotReloadScriptTest.java index 4c057940328d8..d5944ad3aec70 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/multiplepersistenceunits/MultiplePersistenceUnitsImportSqlHotReloadScriptTest.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/multiplepersistenceunits/MultiplePersistenceUnitsImportSqlHotReloadScriptTest.java @@ -4,9 +4,11 @@ import java.util.function.Function; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +import io.quarkus.hibernate.orm.TestTags; import io.quarkus.hibernate.orm.multiplepersistenceunits.model.annotation.inventory.Plane; import io.quarkus.hibernate.orm.multiplepersistenceunits.model.annotation.shared.SharedEntity; import io.quarkus.hibernate.orm.multiplepersistenceunits.model.annotation.user.User; @@ -17,6 +19,7 @@ /** * See https://github.com/quarkusio/quarkus/issues/13722 */ +@Tag(TestTags.DEVMODE) public class MultiplePersistenceUnitsImportSqlHotReloadScriptTest { @RegisterExtension final static QuarkusDevModeTest TEST = new QuarkusDevModeTest() diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/quoting_strategies/JPAQuotedIdentifiersTest.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/quoting_strategies/JPAQuotedIdentifiersTest.java index 607189716a5c5..4845ebab91e83 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/quoting_strategies/JPAQuotedIdentifiersTest.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/quoting_strategies/JPAQuotedIdentifiersTest.java @@ -1,7 +1,9 @@ package io.quarkus.hibernate.orm.quoting_strategies; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.extension.RegisterExtension; +import io.quarkus.hibernate.orm.TestTags; import io.quarkus.test.QuarkusDevModeTest; /** @@ -9,6 +11,7 @@ *

* To resolve the simulated situation, this test uses the quoting strategy {@code all-except-column-definitions}. */ +@Tag(TestTags.DEVMODE) public class JPAQuotedIdentifiersTest extends AbstractJPAQuotedTest { @RegisterExtension diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/quoting_strategies/JPAQuotedKeywordsTest.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/quoting_strategies/JPAQuotedKeywordsTest.java index e9f3e285fd3c4..79e2b47398215 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/quoting_strategies/JPAQuotedKeywordsTest.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/quoting_strategies/JPAQuotedKeywordsTest.java @@ -1,7 +1,9 @@ package io.quarkus.hibernate.orm.quoting_strategies; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.extension.RegisterExtension; +import io.quarkus.hibernate.orm.TestTags; import io.quarkus.test.QuarkusDevModeTest; /** @@ -9,6 +11,7 @@ *

* To resolve the simulated situation, this test uses the quoting strategy {@code auto-keywords}. */ +@Tag(TestTags.DEVMODE) public class JPAQuotedKeywordsTest extends AbstractJPAQuotedTest { @RegisterExtension diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/scripts/GenerateScriptNotAppendedTestCase.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/scripts/GenerateScriptNotAppendedTestCase.java index 2775567f5b77b..300e1ab7f32ac 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/scripts/GenerateScriptNotAppendedTestCase.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/scripts/GenerateScriptNotAppendedTestCase.java @@ -7,11 +7,14 @@ import java.util.regex.Pattern; import org.junit.jupiter.api.RepeatedTest; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.hibernate.orm.MyEntity; +import io.quarkus.hibernate.orm.TestTags; import io.quarkus.test.QuarkusDevModeTest; +@Tag(TestTags.DEVMODE) public class GenerateScriptNotAppendedTestCase { @RegisterExtension diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/sql_load_script/AddNewSqlLoadScriptTestCase.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/sql_load_script/AddNewSqlLoadScriptTestCase.java index 0d893b98158e5..a345c710d9b49 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/sql_load_script/AddNewSqlLoadScriptTestCase.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/sql_load_script/AddNewSqlLoadScriptTestCase.java @@ -1,13 +1,16 @@ package io.quarkus.hibernate.orm.sql_load_script; import org.hamcrest.Matchers; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.hibernate.orm.MyEntity; +import io.quarkus.hibernate.orm.TestTags; import io.quarkus.test.QuarkusDevModeTest; import io.restassured.RestAssured; +@Tag(TestTags.DEVMODE) public class AddNewSqlLoadScriptTestCase { @RegisterExtension static QuarkusDevModeTest runner = new QuarkusDevModeTest() diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/sql_load_script/ImportSqlHotReloadScriptTestCase.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/sql_load_script/ImportSqlHotReloadScriptTestCase.java index ed45e19fe68ae..f391b973d5173 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/sql_load_script/ImportSqlHotReloadScriptTestCase.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/sql_load_script/ImportSqlHotReloadScriptTestCase.java @@ -4,13 +4,16 @@ import java.util.function.Function; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.hibernate.orm.MyEntity; +import io.quarkus.hibernate.orm.TestTags; import io.quarkus.test.QuarkusDevModeTest; import io.restassured.RestAssured; +@Tag(TestTags.DEVMODE) public class ImportSqlHotReloadScriptTestCase { @RegisterExtension final static QuarkusDevModeTest TEST = new QuarkusDevModeTest() diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/sql_load_script/IntroducingDefaultImportScriptTestCase.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/sql_load_script/IntroducingDefaultImportScriptTestCase.java index 176144c78b165..51d6e4de341cb 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/sql_load_script/IntroducingDefaultImportScriptTestCase.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/sql_load_script/IntroducingDefaultImportScriptTestCase.java @@ -1,13 +1,16 @@ package io.quarkus.hibernate.orm.sql_load_script; import org.hamcrest.Matchers; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.hibernate.orm.MyEntity; +import io.quarkus.hibernate.orm.TestTags; import io.quarkus.test.QuarkusDevModeTest; import io.restassured.RestAssured; +@Tag(TestTags.DEVMODE) public class IntroducingDefaultImportScriptTestCase { @RegisterExtension diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/xml/hbm/HbmXmlHotReloadExplicitFileTestCase.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/xml/hbm/HbmXmlHotReloadExplicitFileTestCase.java index bd2667c0ab7bf..1aee8cc5dfd56 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/xml/hbm/HbmXmlHotReloadExplicitFileTestCase.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/xml/hbm/HbmXmlHotReloadExplicitFileTestCase.java @@ -3,13 +3,16 @@ import static io.restassured.RestAssured.when; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.hibernate.orm.SchemaUtil; import io.quarkus.hibernate.orm.SmokeTestUtils; +import io.quarkus.hibernate.orm.TestTags; import io.quarkus.test.QuarkusDevModeTest; +@Tag(TestTags.DEVMODE) public class HbmXmlHotReloadExplicitFileTestCase { @RegisterExtension final static QuarkusDevModeTest TEST = new QuarkusDevModeTest() diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/xml/orm/OrmXmlHotReloadExplicitFileTestCase.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/xml/orm/OrmXmlHotReloadExplicitFileTestCase.java index 40a300082fcb3..df4ffb31288ff 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/xml/orm/OrmXmlHotReloadExplicitFileTestCase.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/xml/orm/OrmXmlHotReloadExplicitFileTestCase.java @@ -3,13 +3,16 @@ import static io.restassured.RestAssured.when; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.hibernate.orm.SchemaUtil; import io.quarkus.hibernate.orm.SmokeTestUtils; +import io.quarkus.hibernate.orm.TestTags; import io.quarkus.test.QuarkusDevModeTest; +@Tag(TestTags.DEVMODE) public class OrmXmlHotReloadExplicitFileTestCase { @RegisterExtension final static QuarkusDevModeTest TEST = new QuarkusDevModeTest() diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/xml/orm/OrmXmlHotReloadImplicitFileTestCase.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/xml/orm/OrmXmlHotReloadImplicitFileTestCase.java index c5666f1d72d2b..bea23ae61d200 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/xml/orm/OrmXmlHotReloadImplicitFileTestCase.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/xml/orm/OrmXmlHotReloadImplicitFileTestCase.java @@ -3,13 +3,16 @@ import static io.restassured.RestAssured.when; import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.hibernate.orm.SchemaUtil; import io.quarkus.hibernate.orm.SmokeTestUtils; +import io.quarkus.hibernate.orm.TestTags; import io.quarkus.test.QuarkusDevModeTest; +@Tag(TestTags.DEVMODE) public class OrmXmlHotReloadImplicitFileTestCase { @RegisterExtension final static QuarkusDevModeTest TEST = new QuarkusDevModeTest() From e24a909b20cbeb136959adee40bdd1d4dbf8a5f6 Mon Sep 17 00:00:00 2001 From: "David M. Lloyd" Date: Wed, 29 May 2024 02:56:00 -0500 Subject: [PATCH 18/31] Fix error in fix for decompiler config Fixes #40874. #40277 had a mistake in it. (cherry picked from commit a9c04c4399bd58d761b77742a49b7bf64c18d163) --- .../quarkus/deployment/configuration/ConfigCompatibility.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/configuration/ConfigCompatibility.java b/core/deployment/src/main/java/io/quarkus/deployment/configuration/ConfigCompatibility.java index 8710a0211c4cb..5114150a8ae47 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/configuration/ConfigCompatibility.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/configuration/ConfigCompatibility.java @@ -285,12 +285,12 @@ private static List quarkusPackageDecompilerVersion(ConfigSourceIntercep private static List quarkusPackageDecompilerEnabled(ConfigSourceInterceptorContext ctxt, NameIterator ni) { // simple mapping to a new name - return List.of("quarkus.package.decompiler.enabled"); + return List.of("quarkus.package.jar.decompiler.enabled"); } private static List quarkusPackageDecompilerJarDirectory(ConfigSourceInterceptorContext ctxt, NameIterator ni) { // simple mapping to a new name - return List.of("quarkus.package.decompiler.jar-directory"); + return List.of("quarkus.package.jar.decompiler.jar-directory"); } private static List quarkusPackageManifestAttributes(ConfigSourceInterceptorContext ctxt, NameIterator ni) { From b30db92d32ce1309786898ad3366ba23f0982a2a Mon Sep 17 00:00:00 2001 From: Alex Martel <13215031+manofthepeace@users.noreply.github.com> Date: Wed, 29 May 2024 15:52:47 -0400 Subject: [PATCH 19/31] use right decompiler prop name in docs (cherry picked from commit 2a0523ee7b6160e17032d2a82bf4e45c310479ac) --- docs/src/main/asciidoc/writing-extensions.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/writing-extensions.adoc b/docs/src/main/asciidoc/writing-extensions.adoc index a01078cfe0d19..f47ed3ac6f318 100644 --- a/docs/src/main/asciidoc/writing-extensions.adoc +++ b/docs/src/main/asciidoc/writing-extensions.adoc @@ -2252,7 +2252,7 @@ The only particular aspect of writing Quarkus extensions in Eclipse is that APT Quarkus generates a lot of classes during the build phase and in many cases also transforms existing classes. It is often extremely useful to see the generated bytecode and transformed classes during the development of an extension. -If you set the `quarkus.package.decompiler.enabled` property to `true` then Quarkus will download and invoke the https://github.com/Vineflower/vineflower[Vineflower decompiler] and dump the result in the `decompiled` directory of the build tool output (`target/decompiled` for Maven for example). +If you set the `quarkus.package.jar.decompiler.enabled` property to `true` then Quarkus will download and invoke the https://github.com/Vineflower/vineflower[Vineflower decompiler] and dump the result in the `decompiled` directory of the build tool output (`target/decompiled` for Maven for example). NOTE: This property only works during a normal production build (i.e. not for dev mode/tests) and when `fast-jar` packaging type is used (the default behavior). From 79c56140d8f9af2b95b9499295141822b27f0069 Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Tue, 28 May 2024 11:17:37 -0300 Subject: [PATCH 20/31] Set the target file in the Model This is necessary so `maven-model-helper` can know which pom.xml the change refers to. - Fixes #40853 (cherry picked from commit 41ae1b3a8024ef8c4357e21e05915b288b05da56) --- .../bootstrap/resolver/maven/workspace/ModelUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java index 97f6c8f1456d4..556407a142017 100644 --- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java +++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java @@ -232,7 +232,9 @@ private static Properties loadPomProps(Path appJar, Path artifactIdPath) throws } public static Model readModel(final Path pomXml) throws IOException { - return readModel(Files.newInputStream(pomXml)); + Model model = readModel(Files.newInputStream(pomXml)); + model.setPomFile(pomXml.toFile()); + return model; } public static Model readModel(InputStream stream) throws IOException { From 58b0668ba614a33385a611d09ecebf403d4b7364 Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Wed, 29 May 2024 10:24:00 -0300 Subject: [PATCH 21/31] Use MojoUtils.readPom to read POM - As discussed in https://github.com/quarkusio/quarkus/pull/40869/files/2bb3087a2d14fdcf807d3d7e80d83c9a753a8929#r1617860660 (cherry picked from commit 5a65e49a58227cefb4346ae9573b60fdaa67e23b) --- .../devtools/project/buildfile/MavenProjectBuildFile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenProjectBuildFile.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenProjectBuildFile.java index cc0a2169469c6..8cecb28fedae0 100644 --- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenProjectBuildFile.java +++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenProjectBuildFile.java @@ -381,7 +381,7 @@ protected void refreshData() { return; } try { - model = ModelUtils.readModel(projectPom); + model = MojoUtils.readPom(projectPom.toFile()); } catch (IOException e) { throw new RuntimeException("Failed to read " + projectPom, e); } From 31c20884529d2d2905ae7b5e2272ace81790cf9c Mon Sep 17 00:00:00 2001 From: Phillip Kruger Date: Thu, 30 May 2024 11:42:09 +0300 Subject: [PATCH 22/31] Fix onError for Dev UI streaming Signed-off-by: Phillip Kruger (cherry picked from commit 000f6c7d76fac5683cb67291df851432b6e927b4) --- .../deployment/BuildTimeContentProcessor.java | 9 ++--- .../quarkus/devui/deployment/DevUIConfig.java | 6 ++++ .../resources/dev-ui/controller/jsonrpc.js | 35 ++++++++++--------- 3 files changed, 30 insertions(+), 20 deletions(-) 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 86c18954b1cf2..26177f8ec97a8 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 @@ -423,13 +423,14 @@ void createBuildTimeData(BuildProducer buildTimeConstPr ExtensionsBuildItem extensionsBuildItem, NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem, LaunchModeBuildItem launchModeBuildItem, - Optional effectiveIdeBuildItem) { + Optional effectiveIdeBuildItem, + DevUIConfig devUIConfig) { BuildTimeConstBuildItem internalBuildTimeData = new BuildTimeConstBuildItem(AbstractDevUIBuildItem.DEV_UI); addThemeBuildTimeData(internalBuildTimeData, themeVarsProducer); addMenuSectionBuildTimeData(internalBuildTimeData, internalPages, extensionsBuildItem); - addFooterTabBuildTimeData(internalBuildTimeData, extensionsBuildItem); + addFooterTabBuildTimeData(internalBuildTimeData, extensionsBuildItem, devUIConfig); addVersionInfoBuildTimeData(internalBuildTimeData, curateOutcomeBuildItem, nonApplicationRootPathBuildItem); addIdeBuildTimeData(internalBuildTimeData, effectiveIdeBuildItem, launchModeBuildItem); buildTimeConstProducer.produce(internalBuildTimeData); @@ -490,7 +491,7 @@ private void addMenuSectionBuildTimeData(BuildTimeConstBuildItem internalBuildTi } private void addFooterTabBuildTimeData(BuildTimeConstBuildItem internalBuildTimeData, - ExtensionsBuildItem extensionsBuildItem) { + ExtensionsBuildItem extensionsBuildItem, DevUIConfig devUIConfig) { // Add the Footer tabs @SuppressWarnings("unchecked") List footerTabs = new ArrayList(); @@ -509,7 +510,7 @@ private void addFooterTabBuildTimeData(BuildTimeConstBuildItem internalBuildTime footerTabs.add(testLog); // This is only needed when extension developers work on an extension, so we only included it if you build from source. - if (Version.getVersion().equalsIgnoreCase("999-SNAPSHOT")) { + if (Version.getVersion().equalsIgnoreCase("999-SNAPSHOT") || devUIConfig.showJsonRpcLog) { Page devUiLog = Page.webComponentPageBuilder().internal() .namespace("devui-jsonrpcstream") .title("Dev UI") diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/DevUIConfig.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/DevUIConfig.java index 9b9415a33688d..174a7e17088ff 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/DevUIConfig.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/DevUIConfig.java @@ -13,6 +13,12 @@ public class DevUIConfig { @ConfigItem(defaultValue = "50") public int historySize; + /** + * Show the JsonRPC Log. Useful for extension developers + */ + @ConfigItem(defaultValue = "false") + public boolean showJsonRpcLog; + /** * CORS configuration. */ diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/jsonrpc.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/jsonrpc.js index f17647f35c340..bfd86942f2612 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/jsonrpc.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/jsonrpc.js @@ -249,19 +249,22 @@ export class JsonRpc { JsonRpc.webSocket.onmessage = function (event) { var response = JSON.parse(event.data); var devUiResponse = response.result; - + var devUiError = response.error; if (!devUiResponse && response.error) { if (JsonRpc.promiseQueue.has(response.id)) { var saved = JsonRpc.promiseQueue.get(response.id); var promise = saved.promise; - var log = saved.log; - promise.reject_ex(response); JsonRpc.promiseQueue.delete(response.id); - if (log) { - var jsonrpcpayload = JSON.stringify(response); - JsonRpc.dispatchMessageLogEntry(Level.Error, MessageDirection.Down, jsonrpcpayload); + JsonRpc.log(saved,response); + }else if(JsonRpc.observerQueue.has(response.id)){ + var saved = JsonRpc.observerQueue.get(response.id); + var observer = saved.observer; + response.error = devUiError; + if (typeof observer.onErrorCallback === "function") { + observer.onErrorCallback(response); } + JsonRpc.log(saved,response); } return; @@ -279,16 +282,12 @@ export class JsonRpc { if (JsonRpc.promiseQueue.has(response.id)) { var saved = JsonRpc.promiseQueue.get(response.id); var promise = saved.promise; - var log = saved.log; var userData = devUiResponse.object; response.result = userData; promise.resolve_ex(response); JsonRpc.promiseQueue.delete(response.id); - if(log){ - var jsonrpcpayload = JSON.stringify(response); - JsonRpc.dispatchMessageLogEntry(Level.Info, MessageDirection.Down, jsonrpcpayload); - } + JsonRpc.log(saved,response); } else { JsonRpc.dispatchMessageLogEntry(Level.Warning, MessageDirection.Down, "Initial normal request not found [ " + devUiResponse.messageType + "], " + event.data); } @@ -296,14 +295,10 @@ export class JsonRpc { if (JsonRpc.observerQueue.has(response.id)) { var saved = JsonRpc.observerQueue.get(response.id); var observer = saved.observer; - var log = saved.log; var userData = devUiResponse.object; response.result = userData; observer.onNextCallback(response); - if(log){ - var jsonrpcpayload = JSON.stringify(response); - JsonRpc.dispatchMessageLogEntry(Level.Info, MessageDirection.Down, jsonrpcpayload); - } + JsonRpc.log(saved,response); } else { // Let's cancel as we do not have someone interested in this anymore JsonRpc.cancelSubscription(response.id); @@ -342,4 +337,12 @@ export class JsonRpc { const event = new CustomEvent('jsonRPCLogEntryEvent', {detail: logEntry}); document.dispatchEvent(event); } + + static log(o, response){ + var log = o.log; + if(log){ + var jsonrpcpayload = JSON.stringify(response); + JsonRpc.dispatchMessageLogEntry(Level.Info, MessageDirection.Down, jsonrpcpayload); + } + } } \ No newline at end of file From 4c7fbb9cef3cb4b6c2a4da567247739de873fd1f Mon Sep 17 00:00:00 2001 From: Yoshikazu Nojima Date: Fri, 31 May 2024 00:13:19 +0900 Subject: [PATCH 23/31] Correct broken markup in the security-customization.adoc (cherry picked from commit 3705b43b4bcaba8a4c8190745d1457ebc6e74c74) --- docs/src/main/asciidoc/security-customization.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/main/asciidoc/security-customization.adoc b/docs/src/main/asciidoc/security-customization.adoc index 783e286622aea..5a0ee041e6672 100644 --- a/docs/src/main/asciidoc/security-customization.adoc +++ b/docs/src/main/asciidoc/security-customization.adoc @@ -74,7 +74,7 @@ public class CustomAwareJWTAuthMechanism implements HttpAuthenticationMechanism TIP: The `HttpAuthenticationMechanism` should transform incoming HTTP request with suitable authentication credentials into an `io.quarkus.security.identity.request.AuthenticationRequest` instance and delegate the authentication to the `io.quarkus.security.identity.IdentityProviderManager`. -Leaving authentication to the `io.quarkus.security.identity.IdentityProvider`s gives you more options for credentials verifications, +Leaving authentication to the ``io.quarkus.security.identity.IdentityProvider``s gives you more options for credentials verifications, as well as convenient way to perform blocking tasks. Nevertheless, the `io.quarkus.security.identity.IdentityProvider` can be omitted and the `HttpAuthenticationMechanism` is free to authenticate request on its own in trivial use cases. @@ -744,4 +744,4 @@ For that reason, asynchronous processing can have positive effect on performance * xref:security-overview.adoc[Quarkus Security overview] * xref:security-architecture.adoc[Quarkus Security architecture] * xref:security-authentication-mechanisms.adoc#other-supported-authentication-mechanisms[Authentication mechanisms in Quarkus] -* xref:security-identity-providers.adoc[Identity providers] \ No newline at end of file +* xref:security-identity-providers.adoc[Identity providers] From 898f93aaf50c08c7e5df03a4eff5e63c73247075 Mon Sep 17 00:00:00 2001 From: Sergey Beryozkin Date: Wed, 29 May 2024 19:14:52 +0100 Subject: [PATCH 24/31] Fix a disabled OidcClient REST client issue (cherry picked from commit 02a1660eece8a0a4290c717d2ad4a1612ad09aeb) --- .../client/runtime/OidcClientRecorder.java | 6 +++--- .../quarkus/it/keycloak/FrontendResource.java | 13 ++++++++++++ ...rotectedResourceServiceDisabledClient.java | 21 +++++++++++++++++++ .../src/main/resources/application.properties | 9 ++++++++ .../quarkus/it/keycloak/OidcClientTest.java | 9 ++++++++ 5 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 integration-tests/oidc-client-reactive/src/main/java/io/quarkus/it/keycloak/ProtectedResourceServiceDisabledClient.java diff --git a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java index 23a3399214086..de3b721cc2c5b 100644 --- a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java +++ b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java @@ -248,17 +248,17 @@ private static class DisabledOidcClient implements OidcClient { @Override public Uni getTokens(Map additionalGrantParameters) { - throw new DisabledOidcClientException(message); + return Uni.createFrom().failure(new DisabledOidcClientException(message)); } @Override public Uni refreshTokens(String refreshToken, Map additionalGrantParameters) { - throw new DisabledOidcClientException(message); + return Uni.createFrom().failure(new DisabledOidcClientException(message)); } @Override public Uni revokeAccessToken(String accessToken, Map additionalParameters) { - throw new DisabledOidcClientException(message); + return Uni.createFrom().failure(new DisabledOidcClientException(message)); } @Override diff --git a/integration-tests/oidc-client-reactive/src/main/java/io/quarkus/it/keycloak/FrontendResource.java b/integration-tests/oidc-client-reactive/src/main/java/io/quarkus/it/keycloak/FrontendResource.java index 9e3b2a559fc0c..7ef96822ce78f 100644 --- a/integration-tests/oidc-client-reactive/src/main/java/io/quarkus/it/keycloak/FrontendResource.java +++ b/integration-tests/oidc-client-reactive/src/main/java/io/quarkus/it/keycloak/FrontendResource.java @@ -6,6 +6,7 @@ import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; +import jakarta.ws.rs.WebApplicationException; import org.eclipse.microprofile.rest.client.inject.RestClient; @@ -25,6 +26,10 @@ public class FrontendResource { @RestClient ProtectedResourceServiceNamedFilter protectedResourceServiceNamedFilter; + @Inject + @RestClient + ProtectedResourceServiceDisabledClient protectedResourceServiceDisabledClient; + @Inject @RestClient MisconfiguredClientFilter misconfiguredClientFilter; @@ -50,6 +55,14 @@ public Uni userNameNamedFilter() { return protectedResourceServiceNamedFilter.getUserName(); } + @GET + @Path("userNameDisabledClient") + @Produces("text/plain") + public Uni userNameDisabledClient() { + return protectedResourceServiceDisabledClient.getUserName() + .onFailure(WebApplicationException.class).recoverWithItem(t -> t.getMessage()); + } + @GET @Path("userNameMisconfiguredClientFilter") @Produces("text/plain") diff --git a/integration-tests/oidc-client-reactive/src/main/java/io/quarkus/it/keycloak/ProtectedResourceServiceDisabledClient.java b/integration-tests/oidc-client-reactive/src/main/java/io/quarkus/it/keycloak/ProtectedResourceServiceDisabledClient.java new file mode 100644 index 0000000000000..6d7ca4fb228b4 --- /dev/null +++ b/integration-tests/oidc-client-reactive/src/main/java/io/quarkus/it/keycloak/ProtectedResourceServiceDisabledClient.java @@ -0,0 +1,21 @@ +package io.quarkus.it.keycloak; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; + +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +import io.quarkus.oidc.client.filter.OidcClientFilter; +import io.smallrye.mutiny.Uni; + +@RegisterRestClient +@OidcClientFilter("disabled-client") +@Path("/") +public interface ProtectedResourceServiceDisabledClient { + + @GET + @Produces("text/plain") + @Path("userNameReactive") + Uni getUserName(); +} diff --git a/integration-tests/oidc-client-reactive/src/main/resources/application.properties b/integration-tests/oidc-client-reactive/src/main/resources/application.properties index 3b9c72d07700c..f1280b96a5b3b 100644 --- a/integration-tests/oidc-client-reactive/src/main/resources/application.properties +++ b/integration-tests/oidc-client-reactive/src/main/resources/application.properties @@ -10,6 +10,14 @@ quarkus.oidc-client.grant.type=password quarkus.oidc-client.grant-options.password.username=alice quarkus.oidc-client.grant-options.password.password=alice +quarkus.oidc-client.disabled-client.auth-server-url=${quarkus.oidc.auth-server-url} +quarkus.oidc-client.disabled-client.client-id=${quarkus.oidc.client-id} +quarkus.oidc-client.disabled-client.client-enabled=false +quarkus.oidc-client.disabled-client.credentials.secret=${quarkus.oidc.credentials.secret} +quarkus.oidc-client.disabled-client.grant.type=password +quarkus.oidc-client.disabled-client.grant-options.password.username=alice +quarkus.oidc-client.disabled-client.grant-options.password.password=alice + quarkus.oidc-client.named-client.auth-server-url=${quarkus.oidc.auth-server-url} quarkus.oidc-client.named-client.client-id=${quarkus.oidc.client-id} quarkus.oidc-client.named-client.credentials.secret=${quarkus.oidc.credentials.secret} @@ -27,6 +35,7 @@ quarkus.oidc-client.misconfigured-client.grant-options.password.password=bob io.quarkus.it.keycloak.ProtectedResourceServiceCustomFilter/mp-rest/url=http://localhost:8081/protected io.quarkus.it.keycloak.ProtectedResourceServiceReactiveFilter/mp-rest/url=http://localhost:8081/protected io.quarkus.it.keycloak.ProtectedResourceServiceNamedFilter/mp-rest/url=http://localhost:8081/protected +io.quarkus.it.keycloak.ProtectedResourceServiceDisabledClient/mp-rest/url=http://localhost:8081/protected io.quarkus.it.keycloak.MisconfiguredClientFilter/mp-rest/url=http://localhost:8081/protected quarkus.log.category."io.quarkus.oidc.client.runtime.OidcClientImpl".min-level=TRACE diff --git a/integration-tests/oidc-client-reactive/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java b/integration-tests/oidc-client-reactive/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java index b6c18b9853d89..34843128d033f 100644 --- a/integration-tests/oidc-client-reactive/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java +++ b/integration-tests/oidc-client-reactive/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java @@ -54,6 +54,15 @@ public void testGetUserNameNamedFilter() { .body(equalTo("jdoe")); } + @Test + public void testGetUserNameDisabledClient() { + RestAssured.given().header("Accept", "text/plain") + .when().get("/frontend/userNameDisabledClient") + .then() + .statusCode(200) + .body(containsString("Unauthorized, status code 401")); + } + @Test public void testGetUserNameMisconfiguredClientFilter() { RestAssured.given().header("Accept", "text/plain") From d0a4e49bb54fb20bd8ab54c7a6679f587512cc1c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 30 May 2024 21:28:59 +0000 Subject: [PATCH 25/31] Bump com.nimbusds:nimbus-jose-jwt from 9.39.1 to 9.39.3 Bumps [com.nimbusds:nimbus-jose-jwt](https://bitbucket.org/connect2id/nimbus-jose-jwt) from 9.39.1 to 9.39.3. - [Changelog](https://bitbucket.org/connect2id/nimbus-jose-jwt/src/master/CHANGELOG.txt) - [Commits](https://bitbucket.org/connect2id/nimbus-jose-jwt/branches/compare/9.39.3..9.39.1) --- updated-dependencies: - dependency-name: com.nimbusds:nimbus-jose-jwt dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] (cherry picked from commit 01a777ddaeb724a05a4ac9ad3e66f0166ad83e34) --- 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 cdf70e2165d36..92da07624a0a8 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -216,7 +216,7 @@ 6.9.0.202403050737-r 0.15.0 - 9.39 + 9.39.3 0.9.6 0.0.6 0.1.3 From 9bee30da9e77ff1ded69a7f0bb885eeec50522e3 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Mon, 3 Jun 2024 08:28:31 +0300 Subject: [PATCH 26/31] Move Infinispan DevService logging Prior to this, InfinispanDevServiceProcessor logged a misleading message about starting a DevService. (cherry picked from commit c995ded7e0ec03d6a2e11fea5a992e48de10af36) --- .../devservices/InfinispanDevServiceProcessor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java index 45afb622a8c82..febed81192857 100644 --- a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java +++ b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java @@ -160,9 +160,8 @@ private void runInfinispanDevService(String clientName, Map newDevServices, Map properties) { try { - log.infof("Starting Dev Service for connection %s", clientName); + InfinispanDevServicesConfig namedDevServiceConfig = config.devService.devservices; - log.infof("Apply Dev Services config %s", namedDevServiceConfig); RunningDevService devService = startContainer(clientName, dockerStatusBuildItem, namedDevServiceConfig, launchMode.getLaunchMode(), !devServicesSharedNetworkBuildItem.isEmpty(), globalDevServicesConfig.timeout, properties); @@ -205,6 +204,8 @@ private RunningDevService startContainer(String clientName, DockerStatusBuildIte "Please configure 'quarkus.infinispan-client.hosts' or 'quarkus.infinispan-client.uri' or get a working docker instance"); return null; } + log.infof("Starting Dev Service for connection %s", clientName); + log.infof("Apply Dev Services config %s", devServicesConfig); Supplier infinispanServerSupplier = () -> { QuarkusInfinispanContainer infinispanContainer = new QuarkusInfinispanContainer(clientName, devServicesConfig, From e7c7ba04d0cd6b9acdd8bbfe972e2aaebffa4a8b Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Mon, 3 Jun 2024 08:30:04 +0300 Subject: [PATCH 27/31] Remove useless logging in InfinispanDevServiceProcessor (cherry picked from commit 08b6d4fe67c3e0cc5a187c34f51b48258dd617ae) --- .../deployment/devservices/InfinispanDevServiceProcessor.java | 1 - 1 file changed, 1 deletion(-) diff --git a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java index febed81192857..ae49676cb305f 100644 --- a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java +++ b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java @@ -189,7 +189,6 @@ private RunningDevService startContainer(String clientName, DockerStatusBuildIte } String configPrefix = getConfigPrefix(clientName); - log.info("Config prefix " + configPrefix); boolean needToStart = !ConfigUtils.isPropertyPresent(configPrefix + "hosts") && !ConfigUtils.isPropertyPresent(configPrefix + "server-list"); From ed83732b10b7cdc0dc3f6d3e49d46670db4b0133 Mon Sep 17 00:00:00 2001 From: Alexey Loubyansky Date: Fri, 31 May 2024 23:30:26 +0200 Subject: [PATCH 28/31] Support annotationProcessorPathsUseDepMgmt in quarkus:dev (cherry picked from commit dcffc7dc1e23cbba9b048b001de50f4135dba1af) --- .../main/java/io/quarkus/maven/DevMojo.java | 69 +++++++++++-------- 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java index 696742ca1e9da..409700ecb15ef 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -25,7 +25,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; @@ -746,15 +745,15 @@ private void executeGoal(PluginExec pluginExec, String goal, Map private List readAnnotationProcessors(Xpp3Dom pluginConfig) { if (pluginConfig == null) { - return Collections.emptyList(); + return List.of(); } Xpp3Dom annotationProcessors = pluginConfig.getChild("annotationProcessors"); if (annotationProcessors == null) { - return Collections.emptyList(); + return List.of(); } Xpp3Dom[] processors = annotationProcessors.getChildren("annotationProcessor"); if (processors.length == 0) { - return Collections.emptyList(); + return List.of(); } List ret = new ArrayList<>(processors.length); for (Xpp3Dom processor : processors) { @@ -765,21 +764,18 @@ private List readAnnotationProcessors(Xpp3Dom pluginConfig) { private Set readAnnotationProcessorPaths(Xpp3Dom pluginConfig) throws MojoExecutionException { if (pluginConfig == null) { - return Collections.emptySet(); + return Set.of(); } Xpp3Dom annotationProcessorPaths = pluginConfig.getChild("annotationProcessorPaths"); if (annotationProcessorPaths == null) { - return Collections.emptySet(); + return Set.of(); } + var versionConstraints = getAnnotationProcessorPathsDepMgmt(pluginConfig); Xpp3Dom[] paths = annotationProcessorPaths.getChildren("path"); Set elements = new LinkedHashSet<>(); try { List dependencies = convertToDependencies(paths); - // NOTE: The Maven Compiler Plugin also supports a flag (disabled by default) for applying managed dependencies to - // the dependencies of the APT plugins (not them directly), which we don't support yet here - // you can find the implementation at https://github.com/apache/maven-compiler-plugin/pull/180/files#diff-d4bac42d8f4c68d397ddbaa05c1cbbed7984ef6dc0bb9ea60739df78997e99eeR1610 - // when/if we need it - CollectRequest collectRequest = new CollectRequest(dependencies, Collections.emptyList(), + CollectRequest collectRequest = new CollectRequest(dependencies, versionConstraints, project.getRemoteProjectRepositories()); DependencyRequest dependencyRequest = new DependencyRequest(); dependencyRequest.setCollectRequest(collectRequest); @@ -796,6 +792,18 @@ private Set readAnnotationProcessorPaths(Xpp3Dom pluginConfig) throws Mojo } } + private List getAnnotationProcessorPathsDepMgmt(Xpp3Dom pluginConfig) { + final Xpp3Dom useDepMgmt = pluginConfig.getChild("annotationProcessorPathsUseDepMgmt"); + if (useDepMgmt == null || !Boolean.parseBoolean(useDepMgmt.getValue())) { + return List.of(); + } + var dm = project.getDependencyManagement(); + if (dm == null) { + return List.of(); + } + return getProjectAetherDependencyManagement(); + } + private List convertToDependencies(Xpp3Dom[] paths) throws MojoExecutionException { List dependencies = new ArrayList<>(); for (Xpp3Dom path : paths) { @@ -848,7 +856,7 @@ private String toNullIfEmpty(String value) { private List getProjectManagedDependencies() { DependencyManagement dependencyManagement = project.getDependencyManagement(); if (dependencyManagement == null || dependencyManagement.getDependencies() == null) { - return Collections.emptyList(); + return List.of(); } return dependencyManagement.getDependencies(); } @@ -864,7 +872,7 @@ private String getValue(Xpp3Dom path, String element, String defaultValue) { private Set convertToAetherExclusions(Xpp3Dom exclusions) { if (exclusions == null) { - return Collections.emptySet(); + return Set.of(); } Set aetherExclusions = new HashSet<>(); for (Xpp3Dom exclusion : exclusions.getChildren("exclusion")) { @@ -1489,21 +1497,6 @@ private void addQuarkusDevModeDeps(MavenDevModeLauncher.Builder builder, Applica throw new MojoExecutionException("Classpath resource " + pomPropsPath + " is missing version"); } - final List managed = new ArrayList<>( - project.getDependencyManagement().getDependencies().size()); - project.getDependencyManagement().getDependencies().forEach(d -> { - final List exclusions; - if (!d.getExclusions().isEmpty()) { - exclusions = new ArrayList<>(d.getExclusions().size()); - d.getExclusions().forEach(e -> exclusions.add(new Exclusion(e.getGroupId(), e.getArtifactId(), "*", "*"))); - } else { - exclusions = List.of(); - } - managed.add(new org.eclipse.aether.graph.Dependency( - new DefaultArtifact(d.getGroupId(), d.getArtifactId(), d.getClassifier(), d.getType(), d.getVersion()), - d.getScope(), d.isOptional(), exclusions)); - }); - final DefaultArtifact devModeJar = new DefaultArtifact(devModeGroupId, devModeArtifactId, ArtifactCoords.TYPE_JAR, devModeVersion); final DependencyResult cpRes = repoSystem.resolveDependencies(repoSession, @@ -1513,7 +1506,7 @@ private void addQuarkusDevModeDeps(MavenDevModeLauncher.Builder builder, Applica // it doesn't matter what the root artifact is, it's an alias .setRootArtifact(new DefaultArtifact(IO_QUARKUS, "quarkus-devmode-alias", ArtifactCoords.TYPE_JAR, "1.0")) - .setManagedDependencies(managed) + .setManagedDependencies(getProjectAetherDependencyManagement()) .setDependencies(List.of( new org.eclipse.aether.graph.Dependency(devModeJar, JavaScopes.RUNTIME), new org.eclipse.aether.graph.Dependency(new DefaultArtifact( @@ -1539,6 +1532,24 @@ private void addQuarkusDevModeDeps(MavenDevModeLauncher.Builder builder, Applica } } + private List getProjectAetherDependencyManagement() { + final List managed = new ArrayList<>( + project.getDependencyManagement().getDependencies().size()); + project.getDependencyManagement().getDependencies().forEach(d -> { + final List exclusions; + if (!d.getExclusions().isEmpty()) { + exclusions = new ArrayList<>(d.getExclusions().size()); + d.getExclusions().forEach(e -> exclusions.add(new Exclusion(e.getGroupId(), e.getArtifactId(), "*", "*"))); + } else { + exclusions = List.of(); + } + managed.add(new org.eclipse.aether.graph.Dependency( + new DefaultArtifact(d.getGroupId(), d.getArtifactId(), d.getClassifier(), d.getType(), d.getVersion()), + d.getScope(), d.isOptional(), exclusions)); + }); + return managed; + } + private void setKotlinSpecificFlags(MavenDevModeLauncher.Builder builder) { Plugin kotlinMavenPlugin = null; for (Plugin plugin : project.getBuildPlugins()) { From 2a92c8275baae09ff124ce0cb68d9ab30704e0f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Tue, 4 Jun 2024 12:01:05 +0200 Subject: [PATCH 29/31] Use Hibernate ORM Jpamodelgen 6.5 for Panache static metamodel (cherry picked from commit 9ec13762ba964ea7b24e417f3502880e78e30342) --- build-parent/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-parent/pom.xml b/build-parent/pom.xml index aaa551740eba3..a08161ef3b3c4 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -75,7 +75,7 @@ and unfortunately annotation processors are not covered by dependency management in kotlin-maven-plugin; see https://github.com/quarkusio/quarkus/issues/37477#issuecomment-1923662964 --> - 6.4.4.Final + 6.5.2.Final 4.13.0 From 99878851093b7eb146fd8365f370e595c7d8fd66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Tue, 4 Jun 2024 12:02:49 +0200 Subject: [PATCH 30/31] Fix version of Hibernate ORM/Search in documentation (cherry picked from commit 00986f4511894c1d919d5b73728971605f8c7a05) --- docs/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/pom.xml b/docs/pom.xml index bc89de3357558..0dbcd8bfdb80d 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -39,8 +39,8 @@ docker.io/jdkato/vale:v2.15.5 - 6.4 - 7.0 + 6.5 + 7.1 Quarkus - Documentation From c912b0cfca9530486c4dfc35b466fb03e445a122 Mon Sep 17 00:00:00 2001 From: Cody Moore Date: Tue, 4 Jun 2024 13:38:50 -0500 Subject: [PATCH 31/31] Update opentelemetry.adoc (cherry picked from commit 9a5f5512d4a6a5300581153d00df7952566d6bcd) --- docs/src/main/asciidoc/opentelemetry.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/opentelemetry.adoc b/docs/src/main/asciidoc/opentelemetry.adoc index 5462114043b5b..9244840ac8ab9 100644 --- a/docs/src/main/asciidoc/opentelemetry.adoc +++ b/docs/src/main/asciidoc/opentelemetry.adoc @@ -177,7 +177,7 @@ We have 2 options: * Take a look at: xref:observability-devservices-lgtm.adoc[Getting Started with Grafana-OTel-LGTM]. -This features a Quarkus Dev service including a Grafana for visualizing data, Loky to store logs, Tempo to store traces and Prometheus to store metrics. Also provides and OTel collector to receive the data. +This features a Quarkus Dev service including a Grafana for visualizing data, Loki to store logs, Tempo to store traces and Prometheus to store metrics. Also provides and OTel collector to receive the data. === Jaeger to see traces option