-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44330 from gsmet/3.16.2-backports-1
[3.16] 3.16.2 backports 1
- Loading branch information
Showing
92 changed files
with
1,613 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
@@ -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]")); | ||
} | ||
---- | ||
|
||
|
@@ -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] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...nt/src/test/java/io/quarkus/amazon/lambda/deployment/testing/LambdaWithDecoratorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.