Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from quarkusio:main #50

Merged
merged 29 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ebb2c0c
Use CertificateGenerator in OIDC Wiremock tests
sberyozkin Nov 27, 2024
8e19875
SmallRye Fault Tolerance: upgrade to 6.7.0
Ladicek Nov 27, 2024
64f0108
Fix off-by-one error in exception decoration code
gsmet Nov 29, 2024
b0c3678
Merge pull request #44831 from Ladicek/fault-tolerance-6.7.0
gsmet Nov 29, 2024
a576c24
Add OidcTestSecurityAugmentor UserInfo unit test
sberyozkin Nov 29, 2024
8ddbb76
Remove use of Json in JWT and OIDC test security
sberyozkin Nov 29, 2024
ca98b70
Merge pull request #44835 from sberyozkin/oidc_security_userinfo_test
sberyozkin Nov 29, 2024
e3ab6bd
Merge pull request #44836 from sberyozkin/remove_json_in_test_security
sberyozkin Nov 29, 2024
212985b
Bump org.wiremock:wiremock-standalone from 3.9.2 to 3.10.0
dependabot[bot] Nov 29, 2024
7edb6c3
Bump org.htmlunit:htmlunit from 4.5.0 to 4.7.0
dependabot[bot] Nov 29, 2024
41ed342
Merge pull request #44834 from gsmet/fix-off-by-one-logging
gastaldi Nov 30, 2024
9b4f338
More appropriate test application module initialization in QuarkusDev…
Nov 29, 2024
70e6965
Merge pull request #44842 from quarkusio/dependabot/maven/org.wiremoc…
gsmet Nov 30, 2024
b1049b8
Use 'Microsoft Entra ID' in OIDC DevUI
sberyozkin Nov 30, 2024
2704a77
Merge pull request #44825 from aloubyansky/dev-mode-test-proper-app-m…
aloubyansky Nov 30, 2024
8ed00f4
Update SmallRye Config to 3.10.2
radcortez Nov 29, 2024
2649fa7
Merge pull request #44838 from radcortez/srconfig-3.10.2
gsmet Nov 30, 2024
2d19846
Merge pull request #44808 from sberyozkin/fix_oidc_wiremock_tests
sberyozkin Dec 1, 2024
4147c6d
Redis Cache - Allow usage of cache name when prefix is defined
thibaultmeyer Dec 1, 2024
4a21abe
Fix Form Post OIDC tests
sberyozkin Dec 1, 2024
cf06d7e
Allow using MongoDb Driver authentication mechanisms when username an…
tomas1885 Dec 1, 2024
2c31260
Merge pull request #44856 from thibaultmeyer/feature/44693-cache_redi…
cescoffier Dec 2, 2024
6ca76ec
Introduce property to disable default mapper per REST Client
geoand Nov 28, 2024
c10465e
Merge pull request #44816 from geoand/#44813
geoand Dec 2, 2024
c977d51
Disable Sonarcloud analysis on forks
yrodiere Dec 2, 2024
52aee64
Merge pull request #44843 from quarkusio/dependabot/maven/org.htmluni…
sberyozkin Dec 2, 2024
8bfec22
Merge pull request #44865 from yrodiere/sonar-cloud-on-forks
yrodiere Dec 2, 2024
cce6e31
Merge pull request #44845 from sberyozkin/oidc_devui_entraid_text
sberyozkin Dec 2, 2024
e3aec53
Merge pull request #44858 from tomas1885/mongodb_auth_mechanism
loicmathieu Dec 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
build:
name: Build
runs-on: ubuntu-latest
if: github.repository == 'quarkusio/quarkus'

steps:
- uses: actions/checkout@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
<microprofile-lra.version>2.0</microprofile-lra.version>
<microprofile-openapi.version>4.0.2</microprofile-openapi.version>
<smallrye-common.version>2.8.0</smallrye-common.version>
<smallrye-config.version>3.10.1</smallrye-config.version>
<smallrye-config.version>3.10.2</smallrye-config.version>
<smallrye-health.version>4.1.0</smallrye-health.version>
<smallrye-metrics.version>4.0.0</smallrye-metrics.version>
<smallrye-open-api.version>4.0.3</smallrye-open-api.version>
<smallrye-graphql.version>2.11.0</smallrye-graphql.version>
<smallrye-fault-tolerance.version>6.6.3</smallrye-fault-tolerance.version>
<smallrye-fault-tolerance.version>6.7.0</smallrye-fault-tolerance.version>
<smallrye-jwt.version>4.6.1</smallrye-jwt.version>
<smallrye-context-propagation.version>2.1.2</smallrye-context-propagation.version>
<smallrye-reactive-streams-operators.version>1.0.13</smallrye-reactive-streams-operators.version>
Expand Down
4 changes: 2 additions & 2 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<jandex-gradle-plugin.version>1.0.0</jandex-gradle-plugin.version>

<asciidoctorj.version>2.5.13</asciidoctorj.version>
<htmlunit.version>4.5.0</htmlunit.version>
<htmlunit.version>4.7.0</htmlunit.version>
<javaparser-core.version>3.26.2</javaparser-core.version>
<jdeparser.version>2.0.3.Final</jdeparser.version>
<subethasmtp.version>6.0.1</subethasmtp.version>
Expand Down Expand Up @@ -105,7 +105,7 @@

<assertj.version>3.26.3</assertj.version>

<wiremock.version>3.9.2</wiremock.version>
<wiremock.version>3.10.0</wiremock.version>
<wiremock-maven-plugin.version>7.3.0</wiremock-maven-plugin.version>

<!-- Artemis test dependencies -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.ObjectInputStream;
import java.io.PrintStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.FileSystemException;
import java.nio.file.Files;
Expand All @@ -24,6 +25,7 @@

import io.quarkus.bootstrap.app.CuratedApplication;
import io.quarkus.bootstrap.app.QuarkusBootstrap;
import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.deployment.util.ProcessUtil;
import io.quarkus.dev.appstate.ApplicationStateNotification;
import io.quarkus.dev.spi.DevModeType;
Expand All @@ -39,12 +41,18 @@ public class DevModeMain implements Closeable {
private static final Logger log = Logger.getLogger(DevModeMain.class);

private final DevModeContext context;
private final ApplicationModel appModel;

private volatile CuratedApplication curatedApplication;
private Closeable realCloseable;

public DevModeMain(DevModeContext context) {
this(context, null);
}

public DevModeMain(DevModeContext context, ApplicationModel appModel) {
this.context = context;
this.appModel = appModel;
}

public static void main(String... args) throws Exception {
Expand All @@ -65,47 +73,15 @@ public static void main(String... args) throws Exception {

public void start() throws Exception {
//propagate system props
for (Map.Entry<String, String> i : context.getSystemProperties().entrySet()) {
if (!System.getProperties().containsKey(i.getKey())) {
System.setProperty(i.getKey(), i.getValue());
}
}
propagateSystemProperties();

try {
URL thisArchive = getClass().getResource(DevModeMain.class.getSimpleName() + ".class");
int endIndex = thisArchive.getPath().indexOf("!");
Path path;
if (endIndex != -1) {
path = Paths.get(new URI(thisArchive.getPath().substring(0, endIndex)));
} else {
path = Paths.get(thisArchive.toURI());
path = path.getParent();
for (char i : DevModeMain.class.getName().toCharArray()) {
if (i == '.') {
path = path.getParent();
}
}
}
final PathList.Builder appRootsBuilder = PathList.builder();
final Path classesPath = Path.of(context.getApplicationRoot().getMain().getClassesPath());
if (Files.exists(classesPath)) {
appRootsBuilder.add(classesPath);
}
if (context.getApplicationRoot().getMain().getResourcesOutputPath() != null
&& !context.getApplicationRoot().getMain().getResourcesOutputPath()
.equals(context.getApplicationRoot().getMain().getClassesPath())) {
final Path resourcesOutputPath = Paths.get(context.getApplicationRoot().getMain().getResourcesOutputPath());
if (Files.exists(resourcesOutputPath)) {
appRootsBuilder.add(resourcesOutputPath);
}
}

final PathList appRoots = appRootsBuilder.build();
QuarkusBootstrap.Builder bootstrapBuilder = QuarkusBootstrap.builder()
.setApplicationRoot(appRoots)
.setApplicationRoot(getApplicationBuildDirs())
.setExistingModel(appModel)
.setIsolateDeployment(true)
.setLocalProjectDiscovery(context.isLocalProjectDiscovery())
.addAdditionalDeploymentArchive(path)
.addAdditionalDeploymentArchive(getThisClassOrigin())
.setBaseName(context.getBaseName())
.setMode(context.getMode());
if (context.getDevModeRunnerJarFile() != null) {
Expand Down Expand Up @@ -139,6 +115,59 @@ public void start() throws Exception {
}
}

private PathList getApplicationBuildDirs() {
final String classesDir = context.getApplicationRoot().getMain().getClassesPath();
final String resourcesOutputDir = context.getApplicationRoot().getMain().getResourcesOutputPath();
if (resourcesOutputDir == null || resourcesOutputDir.equals(classesDir)) {
return toListOfExistingOrEmpty(Path.of(classesDir));
}
return toListOfExistingOrEmpty(Path.of(classesDir), Path.of(resourcesOutputDir));
}

private static PathList toListOfExistingOrEmpty(Path p1, Path p2) {
return !Files.exists(p1) ? toListOfExistingOrEmpty(p2)
: (!Files.exists(p2) ? toListOfExistingOrEmpty(p1) : PathList.of(p1, p2));
}

/**
* Returns a {@link PathList} containing the path if it exists, otherwise returns an empty {@link PathList}.
*
* @param path path
* @return {@link PathList} containing the path if it exists, otherwise returns an empty {@link PathList}
*/
private static PathList toListOfExistingOrEmpty(Path path) {
return Files.exists(path) ? PathList.of(path) : PathList.empty();
}

/**
* Returns the classpath element containing this class
*
* @return classpath element containing this class
* @throws URISyntaxException in case of a failure
*/
private Path getThisClassOrigin() throws URISyntaxException {
URL thisArchive = getClass().getResource(DevModeMain.class.getSimpleName() + ".class");
int endIndex = thisArchive.getPath().indexOf("!");
if (endIndex != -1) {
return Path.of(new URI(thisArchive.getPath().substring(0, endIndex)));
}
Path path = Path.of(thisArchive.toURI());
path = path.getParent();
for (char i : DevModeMain.class.getName().toCharArray()) {
if (i == '.') {
path = path.getParent();
}
}

return path;
}

private void propagateSystemProperties() {
for (Map.Entry<String, String> i : context.getSystemProperties().entrySet()) {
System.getProperties().putIfAbsent(i.getKey(), i.getValue());
}
}

private Path resolveProjectRoot() {
final Path projectRoot;
if (context.getProjectDir() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ public void accept(LogRecord logRecord, Consumer<LogRecord> logRecordConsumer) {
Object[] np = p != null ? Arrays.copyOf(p, p.length + 1) : new Object[1];
np[np.length - 1] = decoratedString;
elr.setParameters(np);
elr.setMessage(elr.getMessage() + "\n\n%" + (np.length - 1) + "$s",
elr.setMessage(elr.getMessage() + "\n\n%" + np.length + "$s",
ExtLogRecord.FormatStyle.PRINTF);
}
case NO_FORMAT -> {
Expand Down
2 changes: 1 addition & 1 deletion devtools/gradle/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugin-publish = "1.3.0"

# updating Kotlin here makes QuarkusPluginTest > shouldNotFailOnProjectDependenciesWithoutMain(Path) fail
kotlin = "2.0.21"
smallrye-config = "3.10.1"
smallrye-config = "3.10.2"

junit5 = "5.10.5"
assertj = "3.26.3"
Expand Down
19 changes: 15 additions & 4 deletions docs/src/main/asciidoc/cache-redis-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ include::{includes}/extension-status.adoc[]
When using Redis as the backend for Quarkus cache, each cached item will be stored in Redis:

- The backend uses the _<default>_ Redis client (if not configured otherwise), so make sure it's configured (or use the xref:redis-dev-services.adoc[Redis Dev Service])
- the Redis key is built as follows: `cache:$cache-name:$cache-key`, where `cache-key` is the key the application uses.
- the Redis key is built as follows: `cache:{cache-name}:{cache-key}`, where `cache-key` is the key the application uses and `cache:{cache-name}` the prefix.
- the value is encoded to JSON if needed


Expand Down Expand Up @@ -118,10 +118,11 @@ include::{generated-dir}/config/quarkus-redis-cache.adoc[opts=optional, leveloff

== Configure the Redis key

By default, the Redis backend stores the entry using the following keys: `cache:$cache-name:$cache-key`, where `cache-key` is the key the application uses.
So, you can find all the entries for a single cache using the Redis `KEYS` command: `KEYS cache:$cache-name:*`
By default, the Redis backend stores the entry using the following keys pattern: `cache:{cache-name}:{cache-key}`, where `cache-key` is the key the application uses and `cache:{cache-name}` the prefix. The variable `{cache-name}` is resolved from the value set in the cache annotations.
So, you can find all the entries for a single cache using the Redis `KEYS` command: `KEYS cache:{cache-name}:*`

The prefix can be configured by using the `prefix` property:

The `cache:$cache-name:` segment can be configured using the `prefix` property:


[source, properties]
Expand All @@ -135,6 +136,16 @@ quarkus.cache.redis.expensiveResourceCache.prefix=my-expensive-cache

In these cases, you can find all the keys managed by the default cache using `KEYS my-cache:*`, and all the keys managed by the `expensiveResourceCache` cache using: `KEYS my-expensive-cache:*`.


----
# Default configuration
# The variable "{cache-name}" is resolved from the value set in the cache annotations.
quarkus.cache.redis.prefix=my-cache-{cache-name}
----

In this latest example, you can find all the keys managed by the default cache using `KEYS my-cache-{cache-name}:*`.


== Enable optimistic locking

The access to the cache can be _direct_ or use https://redis.io/docs/manual/transactions/#optimistic-locking-using-check-and-set[optimistic locking].
Expand Down
28 changes: 28 additions & 0 deletions docs/src/main/asciidoc/rest-client.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,34 @@ public interface EchoClient {
}
----

=== Disabling the default mapper

As mandated by the REST Client specification, a default exception mapper is included, that throws an exception when HTTP status code is higher than 400.
While this behavior is fine when the client returns a regular object, it is however very unintuitive when the client needs to return a `jakarta.ws.rs.core.Response`
(with the intention of allowing the caller to decide how to handle the HTTP status code).

For this reason, the REST Client includes a property named `disable-default-mapper` which can be used to disable the default mapper when using a REST client in a declarative manner.

For example, with a client like so:

[source, java]
----
@Path("foo")
@RegisterRestClient(configKey = "bar")
public interface Client {
@GET
Response get();
}
----

The default exception mapper can be disabled by setting `quarkus.rest-client.bar.disable-default-mapper=true` to disable the exception mapper for the REST Client configured with the key `bar`.

[NOTE]
====
When using the programmatic approach for creating a REST Client, `QuarkusRestClientBuilder` provides a method named `disableDefaultMapper`
that provides the same feature.
====

[[multipart]]
== Multipart Form support

Expand Down
57 changes: 50 additions & 7 deletions docs/src/main/asciidoc/smallrye-fault-tolerance.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,14 @@ public class CoffeeResource {
We can override the `maxRetries` parameter with 6 retries instead of 4 by the following configuration item:
[source,properties]
----
quarkus.fault-tolerance."org.acme.CoffeeResource/coffees".retry.max-retries=6

# alternatively, a specification-defined property can be used
org.acme.CoffeeResource/coffees/Retry/maxRetries=6
----

NOTE: The format is `fully-qualified-class-name/method-name/annotation-name/property-name=value`.
You can also configure a property for all the annotation via `annotation-name/property-name=value`.
The full set of Quarkus-native configuration properties is detailed in the <<configuration-reference>>.
The specification-defined configuration properties are still supported, but the Quarkus-native configuration takes priority.

== Conclusion

Expand Down Expand Up @@ -573,7 +576,7 @@ implementation("io.quarkus:quarkus-smallrye-fault-tolerance")
== Additional resources

SmallRye Fault Tolerance has more features than shown here.
Please check the link:https://smallrye.io/docs/smallrye-fault-tolerance/6.3.0/index.html[SmallRye Fault Tolerance documentation] to learn about them.
Please check the link:https://smallrye.io/docs/smallrye-fault-tolerance/6.7.0/index.html[SmallRye Fault Tolerance documentation] to learn about them.

In Quarkus, you can use the SmallRye Fault Tolerance optional features out of the box.

Expand All @@ -591,7 +594,7 @@ The entire point of context propagation is to make sure the new thread has the s
====

Non-compatible mode is enabled by default.
This means that methods that return `CompletionStage` (or `Uni`) have asynchronous fault tolerance applied without any `@Asynchronous`, `@AsynchronousNonBlocking`, `@Blocking` or `@NonBlocking` annotation.
This means that methods that return `CompletionStage` (or `Uni`) have asynchronous fault tolerance applied without the `@Asynchronous` or `@AsynchronousNonBlocking` annotation.
It also means that circuit breaker, fallback and retry automatically inspect the exception cause chain if the exception itself is insufficient to decide what should happen.

[NOTE]
Expand All @@ -601,16 +604,56 @@ To restore full compatibility, add this configuration property:

[source,properties]
----
smallrye.faulttolerance.mp-compatibility=true
quarkus.fault-tolerance.mp-compatibility=true
----
====

The link:https://smallrye.io/docs/smallrye-fault-tolerance/6.3.0/reference/programmatic-api.html[programmatic API] is present, including Mutiny support, and integrated with the declarative, annotation-based API.
You can use the `FaultTolerance` and `MutinyFaultTolerance` APIs out of the box.
The link:https://smallrye.io/docs/smallrye-fault-tolerance/6.7.0/reference/programmatic-api.html[programmatic API] is present and integrated with the declarative, annotation-based API.
You can use the `Guard`, `TypedGuard` and `@ApplyGuard` APIs out of the box.

Support for Kotlin is present (assuming you use the Quarkus extension for Kotlin), so you can guard your `suspend` functions with fault tolerance annotations.

Metrics are automatically discovered and integrated.
If your application uses the Quarkus extension for Micrometer, SmallRye Fault Tolerance will emit metrics to Micrometer.
If your application uses the Quarkus extension for SmallRye Metrics, SmallRye Fault Tolerance will emit metrics to MicroProfile Metrics.
Otherwise, SmallRye Fault Tolerance metrics will be disabled.

[[configuration-reference]]
== Configuration reference

The `"<identifier>"` below is:

* `"<classname>/<methodname>"` for per method configuration
* `"<classname>"` for per class configuration
* `global` for global configuration

include::{generated-dir}/config/quarkus-smallrye-fault-tolerance.adoc[opts=optional, leveloffset=+1]

This is how the specification-defined properties are mapped to the Quarkus-native configuration:

[%header,cols="1,1"]
|===
|Specification-defined config property
|Quarkus-native config property

|`<classname>/<methodname>/<annotation>/<member>`
|`quarkus.fault-tolerance."<classname>/<methodname>".<annotation>.<member>`

|`<classname>/<annotation>/<member>`
|`quarkus.fault-tolerance."<classname>".<annotation>.<member>`

|`<annotation>/<member>`
|`quarkus.fault-tolerance.global.<annotation>.<member>`

|`MP_Fault_Tolerance_NonFallback_Enabled`
|`quarkus.fault-tolerance.enabled`

|`MP_Fault_Tolerance_Metrics_Enabled`
|`quarkus.fault-tolerance.metrics.enabled`
|===

All the `<annotation>` and `<member>` parts are changed from camel case (`BeforeRetry`, `methodName`) to kebab case (`before-retry`, `method-name`).
Two annotation members are special cased to improve consistency:

- `Retry/durationUnit` moves to `retry.max-duration-unit`
- `Retry/jitterDelayUnit` moves to `retry.jitter-unit`
Loading
Loading