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

Fix lambda maven archtetypes, startup bugs, and docs #20747

Merged
merged 1 commit into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 3 additions & 8 deletions docs/src/main/asciidoc/amazon-lambda.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ Copy the build.gradle, gradle.properties and settings.gradle into the above gene

Execute: gradle wrapper to setup the gradle wrapper (recommended).

The dependency for `quarkus-test-amazon-lambda` will also need to be added to your build.gradle.

For full Gradle details <<gradle, see below>>.
====

Expand Down Expand Up @@ -300,17 +298,16 @@ call must set a specific environment variable:

== Examine the POM and Gradle build

There is nothing special about the POM other than the inclusion of the `quarkus-amazon-lambda` and `quarkus-test-amazon-lambda` extensions
as a dependencies. The extension automatically generates everything you might need for your lambda deployment.
There is nothing special about the POM other than the inclusion of the `quarkus-amazon-lambda` extension
as a dependency. The extension automatically generates everything you might need for your lambda deployment.

NOTE: In previous versions of this extension you had to set up your pom or gradle
to zip up your executable for native deployments, but this is not the case anymore.

[[gradle]]
== Gradle build

Similarly for Gradle projects, you also just have to add the `quarkus-amazon-lambda` and
`quarkus-test-amazon-lambda` dependencies. The extension automatically generates everything you might need
Similarly for Gradle projects, you also just have to add the `quarkus-amazon-lambda` dependency. The extension automatically generates everything you might need
for your lambda deployment.

Example Gradle dependencies:
Expand All @@ -322,8 +319,6 @@ dependencies {
implementation 'io.quarkus:quarkus-resteasy'
implementation 'io.quarkus:quarkus-amazon-lambda'

testImplementation "io.quarkus:quarkus-test-amazon-lambda"

testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.rest-assured:rest-assured'
}
Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/funqy-amazon-lambda.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ call must set a specific environment variable:

== Examine the POM

There is nothing special about the POM other than the inclusion of the `quarkus-funqy-amazon-lambda` and `quarkus-test-amazon-lambda` extensions
as a dependencies. The extension automatically generates everything you might need for your lambda deployment.
There is nothing special about the POM other than the inclusion of the `quarkus-funqy-amazon-lambda` extension
as a dependency. The extension automatically generates everything you might need for your lambda deployment.

== Integration Testing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,29 @@
<name>native</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>\${surefire-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemPropertyVariables>
<native.image.path>\${project.build.directory}/\${project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>\${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<quarkus.package.type>native</quarkus.package.type>
</properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package ${package};

import io.quarkus.test.junit.NativeImageTest;

@NativeImageTest
public class GreetingIT extends GreetingTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,29 @@
<name>native</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>\${surefire-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemPropertyVariables>
<native.image.path>\${project.build.directory}/\${project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>\${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<quarkus.package.type>native</quarkus.package.type>
</properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package ${package};

import io.quarkus.test.junit.NativeImageTest;

@NativeImageTest
public class GreetingIT extends GreetingTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ public void startPollLoop(ShutdownContext context) {
@Override
public void run() {
try {
if (!LambdaHotReplacementRecorder.enabled && launchMode == LaunchMode.DEVELOPMENT) {
if (!LambdaHotReplacementRecorder.enabled
&& (launchMode == LaunchMode.DEVELOPMENT || launchMode == LaunchMode.NORMAL)) {
// when running with continuous testing, this method fails
// because currentApplication is not set when running as an
// auxiliary application. So, just skip it if hot replacement enabled.
// this is only needed in lambda JVM mode anyways to make sure
// quarkus has started.
// This method is called to determine if Quarkus is started and ready to receive requests.
checkQuarkusBootstrapped();
}
URL requestUrl = AmazonLambdaApi.invocationNext(baseUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,29 @@
<name>native</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>\${surefire-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemPropertyVariables>
<native.image.path>\${project.build.directory}/\${project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>\${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<quarkus.package.type>native</quarkus.package.type>
</properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package ${package};

import io.quarkus.test.junit.NativeImageTest;

@NativeImageTest
public class LambdaHandlerIT extends LambdaHandlerTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ public void testSimpleLambdaSuccess() throws Exception {
// you test your lambas by invoking on http://localhost:8081
// this works in dev mode too

Person in = new Person();
InputObject in = new InputObject();
in.setName("Stu");
in.setGreeting("Hello");
given()
.contentType("application/json")
.accept("application/json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,29 @@
<name>native</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>\${surefire-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemPropertyVariables>
<native.image.path>\${project.build.directory}/\${project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>\${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<quarkus.package.type>native</quarkus.package.type>
</properties>
Expand Down