Skip to content

Commit

Permalink
Fix lambda mvn arch and startup bugs
Browse files Browse the repository at this point in the history
fix deprecated refernce
  • Loading branch information
patriot1burke committed Oct 13, 2021
1 parent 939d253 commit 45a8e16
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 13 deletions.
9 changes: 2 additions & 7 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,7 +298,7 @@ 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
There is nothing special about the POM other than the inclusion of the `quarkus-amazon-lambda` extension
as a dependencies. 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
Expand All @@ -309,8 +307,7 @@ to zip up your executable for native deployments, but this is not the case anymo
[[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

0 comments on commit 45a8e16

Please sign in to comment.