Skip to content

Commit

Permalink
Merge pull request #44330 from gsmet/3.16.2-backports-1
Browse files Browse the repository at this point in the history
[3.16] 3.16.2 backports 1
  • Loading branch information
gsmet authored Nov 6, 2024
2 parents 81a24d9 + 54ff252 commit 1ab8406
Show file tree
Hide file tree
Showing 92 changed files with 1,613 additions and 341 deletions.
2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<extension>
<groupId>io.quarkus.develocity</groupId>
<artifactId>quarkus-project-develocity-extension</artifactId>
<version>1.1.6</version>
<version>1.1.7</version>
</extension>
</extensions>
4 changes: 2 additions & 2 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<properties>
<angus-activation.version>2.0.2</angus-activation.version>
<angus-mail.version>2.0.3</angus-mail.version> <!-- keep in sync with angus-activation (mail depends on activation) -->
<bouncycastle.version>1.78.1</bouncycastle.version>
<bouncycastle.version>1.79</bouncycastle.version>
<bouncycastle.fips.version>1.0.2.5</bouncycastle.fips.version>
<bouncycastle.tls.fips.version>1.0.19</bouncycastle.tls.fips.version>
<cyclonedx.version>9.0.5</cyclonedx.version>
Expand Down Expand Up @@ -94,7 +94,7 @@
<!-- GraalVM sdk 23.1.2 has a minimum JDK requirement of 17+ at runtime -->
<graal-sdk.version>23.1.2</graal-sdk.version>
<gizmo.version>1.8.0</gizmo.version>
<jackson-bom.version>2.18.0</jackson-bom.version>
<jackson-bom.version>2.18.1</jackson-bom.version>
<commons-logging-jboss-logging.version>1.0.0.Final</commons-logging-jboss-logging.version>
<commons-lang3.version>3.17.0</commons-lang3.version>
<commons-codec.version>1.17.1</commons-codec.version>
Expand Down
2 changes: 1 addition & 1 deletion build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<junit-pioneer.version>2.2.0</junit-pioneer.version>

<!-- Database images for JDBC/Reactive/Hibernate tests and devservices -->
<postgres.image>docker.io/postgres:14</postgres.image>
<postgres.image>docker.io/postgres:17</postgres.image>
<mariadb.image>docker.io/mariadb:10.11</mariadb.image>
<db2.image>icr.io/db2_community/db2:11.5.9.0</db2.image>
<mssql.image>mcr.microsoft.com/mssql/server:2022-latest</mssql.image>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public TemplateHtmlBuilder(String baseUrl, String title, String subTitle, String
public TemplateHtmlBuilder(String title, String subTitle, String details, List<ErrorPageAction> actions,
String redirect,
List<CurrentConfig> config) {
this(true, null, title, subTitle, details, actions, null, Collections.emptyList());
this(true, null, title, subTitle, details, actions, redirect, config);
}

public TemplateHtmlBuilder(boolean showStack, String baseUrl, String title, String subTitle, String details,
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/_attributes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
:quarkus-blob-url: ${quarkus-base-url}/blob/main
:quarkus-tree-url: ${quarkus-base-url}/tree/main
:quarkus-issues-url: ${quarkus-base-url}/issues
:quarkus-images-url: https://github.com/quarkusio/quarkus-images/tree
:quarkus-images-url: https://github.com/quarkusio/quarkus-images
:quarkus-chat-url: https://quarkusio.zulipchat.com
:quarkus-mailing-list-subscription-email: [email protected]
:quarkus-mailing-list-index: https://groups.google.com/d/forum/quarkus-dev
Expand Down
6 changes: 3 additions & 3 deletions docs/src/main/asciidoc/deploying-to-google-cloud.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ Then, you will need to create a `src/main/appengine/app.yaml` file, let's keep i

[source, yaml]
----
runtime: java11
runtime: java21
----

This will create a default service for your App Engine application.

[NOTE]
====
You can also use the new Java 17 runtime by defining `runtime: java17` instead.
You can also use another Java runtime supported by App Engine, for example, for Java 17, use `runtime: java17` instead.
====

App Engine Standard does not support the default Quarkus' specific packaging layout, therefore, you must set up your application to be packaged as an uber-jar via your `application.properties` file:
Expand Down Expand Up @@ -114,7 +114,7 @@ First, add the plugin to your `pom.xml`:
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>2.4.4</version>
<version>2.7.0</version>
<configuration>
<projectId>GCLOUD_CONFIG</projectId> <1>
<version>gettingstarted</version>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/dev-ui.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ import 'qui-ide-link';
<qui-ide-link title='Source full class name'
class='text-source'
fileName='${sourceClassNameFull}'
lineNumber=${sourceLineNumber}>[${sourceClassNameFull}]</qui-ide-link>;
lineNumber='${sourceLineNumber}'>[${sourceClassNameFull}]</qui-ide-link>;
----

https://github.com/quarkusio/quarkus/blob/582f1f78806d2268885faea7aa8f5a4d2b3f5b98/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-server-log.js#L315[Example code]
Expand Down
4 changes: 4 additions & 0 deletions docs/src/main/asciidoc/getting-started-reactive.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ Create the `src/main/java/org/acme/hibernate/orm/panache/FruitResource.java` fil
----
package org.acme.hibernate.orm.panache;
import java.util.List;
import io.quarkus.panache.common.Sort;
import io.smallrye.mutiny.Uni;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.ws.rs.Path;
Expand Down
Binary file modified docs/src/main/asciidoc/images/oidc-facebook-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/main/asciidoc/images/oidc-facebook-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/main/asciidoc/images/oidc-facebook-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/main/asciidoc/images/oidc-facebook-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/main/asciidoc/images/oidc-facebook-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/main/asciidoc/images/oidc-facebook-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 18 additions & 4 deletions docs/src/main/asciidoc/mailer-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ To send a simple email, proceed as follows:
[source, java]
----
// Imperative API:
mailer.send(Mail.withText("[email protected]", "A simple email from quarkus", "This is my body."));
mailer.send(Mail.withText("[email protected]", "A simple email from quarkus", "This is my body.").setFrom("[email protected]"));
// Reactive API:
Uni<Void> stage = reactiveMailer.send(Mail.withText("[email protected]", "A reactive email from quarkus", "This is my body."));
Uni<Void> stage = reactiveMailer.send(Mail.withText("[email protected]", "A reactive email from quarkus", "This is my body.").setFrom("[email protected]"));
----

For example, you can use the `Mailer` in an HTTP endpoint as follows:
Expand All @@ -78,14 +78,14 @@ For example, you can use the `Mailer` in an HTTP endpoint as follows:
@GET
@Path("/imperative")
public void sendASimpleEmail() {
mailer.send(Mail.withText("[email protected]", "A simple email from quarkus", "This is my body"));
mailer.send(Mail.withText("[email protected]", "A simple email from quarkus", "This is my body").setFrom("[email protected]"));
}
@GET
@Path("/reactive")
public Uni<Void> sendASimpleEmailAsync() {
return reactiveMailer.send(
Mail.withText("[email protected]", "A reactive email from quarkus", "This is my body"));
Mail.withText("[email protected]", "A reactive email from quarkus", "This is my body").setFrom("[email protected]"));
}
----

Expand All @@ -96,6 +96,20 @@ You can create new `io.quarkus.mailer.Mail` instances from the constructor or fr
`Mail.withHtml` helper methods.
The `Mail` instance lets you add recipients (to, cc, or bcc), set the subject, headers, sender (from) address...

Most of these properties are optional, but the sender address is required. It can either be set on an individual `Mail` instances using

[source,java]
----
.setFrom("[email protected]");
----

or a global default can be configured, using

[source,properties]
----
[email protected]
----

You can also send several `Mail` objects in one call:

[source, java]
Expand Down
3 changes: 2 additions & 1 deletion docs/src/main/asciidoc/mongodb-panache.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ TIP: Using `@BsonProperty` is not needed to define custom column mappings, as th

TIP: You can have your projection class extends from another class. In this case, the parent class also needs to have use `@ProjectionFor` annotation.

TIP: If you run Java 17+, records are a good fit for projection classes.
TIP: Records are a good fit for projection classes.

== Query debugging

Expand All @@ -724,6 +724,7 @@ quarkus.log.category."io.quarkus.mongodb.panache.common.runtime".level=DEBUG

MongoDB with Panache uses the link:{mongodb-doc-root-url}/fundamentals/data-formats/document-data-format-pojo/[PojoCodecProvider], with link:{mongodb-doc-root-url}/fundamentals/data-formats/document-data-format-pojo/#configure-the-driver-for-pojos[automatic POJO support],
to automatically convert your object to a BSON document.
This codec also supports Java records so you can use them for your entities or an attribute of your entities.

In case you encounter the `org.bson.codecs.configuration.CodecConfigurationException` exception, it means the codec is not able to
automatically convert your object.
Expand Down
3 changes: 2 additions & 1 deletion docs/src/main/asciidoc/mongodb.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,8 @@ public class CodecFruitService {
== The POJO Codec

The link:https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/data-formats/document-data-format-pojo/[POJO Codec] provides a set of annotations that enable the customization of
the way a POJO is mapped to a MongoDB collection and this codec is initialized automatically by Quarkus
the way a POJO is mapped to a MongoDB collection and this codec is initialized automatically by Quarkus.
This codec also supports Java records so you can use them for your POJOs or an attribute of your POJOs.

One of these annotations is the `@BsonDiscriminator` annotation that allows to storage multiple Java types in a single MongoDB collection by adding
a discriminator field inside the document. It can be useful when working with abstract types or interfaces.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,7 @@ public interface ProtectedResourceService {

Additionally, `AccessTokenRequestReactiveFilter` can support a complex application that needs to exchange the tokens before propagating them.

If you work with link:https://www.keycloak.org/docs/latest/securing_apps/#_token-exchange[Keycloak] or another OIDC provider that supports a link:https://tools.ietf.org/html/rfc8693[Token Exchange] token grant, then you can configure `AccessTokenRequestReactiveFilter` to exchange the token like this:
If you work with link:https://www.keycloak.org/securing-apps/token-exchange[Keycloak] or another OIDC provider that supports a link:https://tools.ietf.org/html/rfc8693[Token Exchange] token grant, then you can configure `AccessTokenRequestReactiveFilter` to exchange the token like this:

[source,properties]
----
Expand Down Expand Up @@ -1369,7 +1369,7 @@ Alternatively, `AccessTokenRequestFilter` can be registered automatically with a

==== Exchange token before propagation

If the current access token needs to be exchanged before propagation and you work with link:https://www.keycloak.org/docs/latest/securing_apps/#_token-exchange[Keycloak] or other OpenID Connect Provider which supports a link:https://tools.ietf.org/html/rfc8693[Token Exchange] token grant, then you can configure `AccessTokenRequestFilter` like this:
If the current access token needs to be exchanged before propagation and you work with link:https://www.keycloak.org/securing-apps/token-exchange[Keycloak] or other OpenID Connect Provider which supports a link:https://tools.ietf.org/html/rfc8693[Token Exchange] token grant, then you can configure `AccessTokenRequestFilter` like this:

[source,properties]
----
Expand Down
9 changes: 5 additions & 4 deletions docs/src/main/asciidoc/security-openid-connect-providers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -165,23 +165,24 @@ Facebook you will not be let you test your application on `localhost` like most
you will need to run it over HTTPS and make it publicly accessible, so for development purposes
you may want to use a service such as https://ngrok.com.

In order to set up OIDC for Facebook start by https://developers.facebook.com/apps/create/[Creating an application], select `None` as an app type, and press `Next`:
In order to set up OIDC for Facebook start by https://developers.facebook.com/apps/create/[Creating an application], select `Other` as an app type, and click `Next`.

image::oidc-facebook-1.png[role="thumb"]

Now enter an application name, and contact email, and press `Create app`:
Now choose your application type. For this guide choose `Consumer` and click `Next` until you reach the screen below. Now enter an application name, and contact email, and press `Create app`:

image::oidc-facebook-2.png[role="thumb"]

On the app page, click `Set up` on the `Facebook login` product:

image::oidc-facebook-3.png[role="thumb"]

Quick the `Quickstarts` page and click on `Facebook login > Settings` on the left menu:
On the `Quickstart` page click on `Facebook login > Settings` on the left menu:

image::oidc-facebook-4.png[role="thumb"]

Enter your `Redirect URIs` (set to `<host>/_renarde/security/oidc-success`) and press `Save changes`:
First click on `Get Advanced Access` to switch `public_profile` to advanced access.
Then enter your `Redirect URIs` (set to `<host>/facebook`) and press `Save changes`:

image::oidc-facebook-5.png[role="thumb"]

Expand Down
5 changes: 5 additions & 0 deletions extensions/amazon-lambda/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;

import jakarta.inject.Named;

Expand All @@ -29,6 +29,7 @@
import io.quarkus.amazon.lambda.runtime.LambdaBuildTimeConfig;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.BeanContainerBuildItem;
import io.quarkus.arc.processor.DotNames;
import io.quarkus.builder.BuildException;
import io.quarkus.deployment.Feature;
import io.quarkus.deployment.annotations.BuildProducer;
Expand Down Expand Up @@ -58,6 +59,18 @@ public final class AmazonLambdaProcessor {
private static final DotName NAMED = DotName.createSimple(Named.class.getName());
private static final Logger log = Logger.getLogger(AmazonLambdaProcessor.class);

private static final Predicate<ClassInfo> INCLUDE_HANDLER_PREDICATE = new Predicate<>() {

@Override
public boolean test(ClassInfo classInfo) {
if (classInfo.isAbstract() || classInfo.hasAnnotation(DotNames.DECORATOR)) {
return false;
}

return true;
}
};

@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(Feature.AMAZON_LAMBDA);
Expand All @@ -75,11 +88,13 @@ List<AmazonLambdaBuildItem> discover(CombinedIndexBuildItem combinedIndexBuildIt
BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy,
BuildProducer<ReflectiveClassBuildItem> reflectiveClassBuildItemBuildProducer) throws BuildException {

Collection<ClassInfo> allKnownImplementors = combinedIndexBuildItem.getIndex().getAllKnownImplementors(REQUEST_HANDLER);
List<ClassInfo> allKnownImplementors = new ArrayList<>(
combinedIndexBuildItem.getIndex().getAllKnownImplementors(REQUEST_HANDLER)
.stream().filter(INCLUDE_HANDLER_PREDICATE).toList());
allKnownImplementors.addAll(combinedIndexBuildItem.getIndex()
.getAllKnownImplementors(REQUEST_STREAM_HANDLER));
.getAllKnownImplementors(REQUEST_STREAM_HANDLER).stream().filter(INCLUDE_HANDLER_PREDICATE).toList());
allKnownImplementors.addAll(combinedIndexBuildItem.getIndex()
.getAllKnownSubclasses(SKILL_STREAM_HANDLER));
.getAllKnownSubclasses(SKILL_STREAM_HANDLER).stream().filter(INCLUDE_HANDLER_PREDICATE).toList());

if (allKnownImplementors.size() > 0 && providedLambda.isPresent()) {
throw new BuildException(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package io.quarkus.amazon.lambda.deployment.testing;

import static io.restassured.RestAssured.given;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.CoreMatchers.containsString;

import java.util.logging.Level;
import java.util.logging.LogRecord;

import jakarta.annotation.Priority;
import jakarta.decorator.Decorator;
import jakarta.decorator.Delegate;
import jakarta.enterprise.inject.Any;
import jakarta.inject.Inject;

import org.jboss.logging.Logger;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;

import io.quarkus.amazon.lambda.deployment.testing.model.InputPerson;
import io.quarkus.test.QuarkusUnitTest;

class LambdaWithDecoratorTest {

@RegisterExtension
static final QuarkusUnitTest test = new QuarkusUnitTest().setArchiveProducer(() -> ShrinkWrap
.create(JavaArchive.class)
.addClasses(LambdaWithDecorator.class, RequestHandlerDecorator.class, InputPerson.class))
.setLogRecordPredicate(record -> record.getLevel().intValue() == Level.INFO.intValue()
&& record.getMessage().contains("handling request with id"))
.assertLogRecords(records -> assertThat(records)
.extracting(LogRecord::getMessage)
.isNotEmpty());

@Test
public void testLambdaWithDecorator() throws Exception {
// you test your lambdas by invoking on http://localhost:8081
// this works in dev mode too

InputPerson in = new InputPerson("Stu");
given()
.contentType("application/json")
.accept("application/json")
.body(in)
.when()
.post()
.then()
.statusCode(200)
.body(containsString("Hey Stu"));
}

public static class LambdaWithDecorator implements RequestHandler<InputPerson, String> {

@Override
public String handleRequest(InputPerson input, Context context) {
return "Hey " + input.getName();
}
}

@Priority(10)
@Decorator
public static class RequestHandlerDecorator<I, O> implements RequestHandler<I, O> {

@Inject
Logger logger;

@Inject
@Any
@Delegate
RequestHandler<I, O> delegate;

@Override
public O handleRequest(I i, Context context) {
logger.info("handling request with id " + context.getAwsRequestId());
return delegate.handleRequest(i, context);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ export class QwcArcBeans extends LitElement {
${bean.nonDefaultQualifiers.map(qualifier =>
html`${this._qualifierRenderer(qualifier)}`
)}
<qui-ide-link fileName='${bean.providerType.name}'
lineNumber=0><code>${bean.providerType.name}</code></qui-ide-link>
<qui-ide-link fileName='${bean.providerType.name}'><code>${bean.providerType.name}</code></qui-ide-link>
</vaadin-vertical-layout>`;
}
Expand Down Expand Up @@ -213,4 +212,4 @@ export class QwcArcBeans extends LitElement {
});
}
}
customElements.define('qwc-arc-beans', QwcArcBeans);
customElements.define('qwc-arc-beans', QwcArcBeans);
Loading

0 comments on commit 1ab8406

Please sign in to comment.