You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2021/08/16 15:27:35 UTC

[camel-quarkus-examples] branch camel-quarkus-main updated (0c702ff -> e85b509)

This is an automated email from the ASF dual-hosted git repository.

aldettinger pushed a change to branch camel-quarkus-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus-examples.git.


    from 0c702ff  Next is 2.2.0 (#51)
     new 6839e73  Added the module Deploying a Camel Route in AWS Lambda to the examples
     new 62a509d  Fix aws-lambda license check issues and shrink example
     new 9e81bcd  Upgrade quarkus to 2.1.1.Final
     new e85b509  aws-lambda: fix native test

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/test-categories.yaml                       |   1 +
 aws-lambda/README.adoc                             | 219 ++++++++++++++++
 aws-lambda/payload.json                            |   3 +
 aws-lambda/pom.xml                                 | 292 +++++++++++++++++++++
 aws-lambda/results.png                             | Bin 0 -> 27634 bytes
 .../src/main/docker/Dockerfile.jvm                 |  13 +-
 .../src/main/docker/Dockerfile.native              |  10 +-
 .../src/main/docker/Dockerfile.native-distroless   |  20 +-
 .../camel/quarkus/examples/AWSLambdaHandler.java   |  27 +-
 .../apache/camel/quarkus/examples/CamelRoute.java  |  21 +-
 .../camel/quarkus/examples/GreetService.java       |  13 +-
 .../org/apache/camel/quarkus/examples/Person.java  |  20 +-
 .../quarkus/examples/AWSLambdaHandlerTest.java     |  21 +-
 .../quarkus/examples/AWSLambdaHandlerTestIT.java   |   5 +-
 .../src/test}/resources/application.properties     |  12 +-
 docs/modules/ROOT/attachments/examples.json        |   5 +
 file-bindy-ftp/pom.xml                             |   2 +-
 file-split-log-xml/pom.xml                         |   2 +-
 health/pom.xml                                     |   2 +-
 http-log/pom.xml                                   |   2 +-
 kafka/pom.xml                                      |   2 +-
 kamelet-chucknorris/pom.xml                        |   2 +-
 observability/pom.xml                              |   2 +-
 rest-json/pom.xml                                  |   2 +-
 timer-log-cdi/pom.xml                              |   2 +-
 timer-log-kotlin/pom.xml                           |   2 +-
 timer-log-main/pom.xml                             |   2 +-
 timer-log-spring/pom.xml                           |   2 +-
 timer-log-xml/pom.xml                              |   2 +-
 timer-log/pom.xml                                  |   2 +-
 30 files changed, 609 insertions(+), 101 deletions(-)
 create mode 100644 aws-lambda/README.adoc
 create mode 100644 aws-lambda/payload.json
 create mode 100644 aws-lambda/pom.xml
 create mode 100644 aws-lambda/results.png
 copy {kafka => aws-lambda}/src/main/docker/Dockerfile.jvm (89%)
 copy {kafka => aws-lambda}/src/main/docker/Dockerfile.native (82%)
 copy kafka/src/main/docker/Dockerfile.native => aws-lambda/src/main/docker/Dockerfile.native-distroless (65%)
 copy timer-log-main/src/main/java/org/acme/timer/TimerRoute.java => aws-lambda/src/main/java/org/apache/camel/quarkus/examples/AWSLambdaHandler.java (58%)
 copy timer-log-main/src/main/java/org/acme/timer/TimerRoute.java => aws-lambda/src/main/java/org/apache/camel/quarkus/examples/CamelRoute.java (72%)
 copy timer-log/src/main/java/org/acme/timer/TimerRoute.java => aws-lambda/src/main/java/org/apache/camel/quarkus/examples/GreetService.java (75%)
 copy kamelet-chucknorris/src/main/java/org/acme/kamelet/MyRoute.java => aws-lambda/src/main/java/org/apache/camel/quarkus/examples/Person.java (71%)
 copy kafka/src/test/java/org/apache/camel/example/KafkaTest.java => aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTest.java (67%)
 copy file-bindy-ftp/src/test/java/org/apache/camel/example/FileToFtpIT.java => aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTestIT.java (84%)
 copy {rest-json/src/main => aws-lambda/src/test}/resources/application.properties (89%)

[camel-quarkus-examples] 01/04: Added the module Deploying a Camel Route in AWS Lambda to the examples

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aldettinger pushed a commit to branch camel-quarkus-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus-examples.git

commit 6839e730e6c37b30506d314fc6d28bbfb9d8f893
Author: ravishankarhassain <ra...@gmail.com>
AuthorDate: Tue Aug 10 00:34:23 2021 +0100

    Added the module Deploying a Camel Route in AWS Lambda to the examples
---
 aws-lambda/README.md                               | 197 ++++++++++++++
 aws-lambda/payload.json                            |   3 +
 aws-lambda/pom.xml                                 | 287 +++++++++++++++++++++
 aws-lambda/results.png                             | Bin 0 -> 27634 bytes
 aws-lambda/src/main/docker/Dockerfile.jvm          |  55 ++++
 aws-lambda/src/main/docker/Dockerfile.native       |  27 ++
 .../src/main/docker/Dockerfile.native-distroless   |  23 ++
 .../camel/quarkus/examples/AWSLambdaHandler.java   |  39 +++
 .../apache/camel/quarkus/examples/CamelRoute.java  |  37 +++
 .../camel/quarkus/examples/GreetService.java       |  27 ++
 .../org/apache/camel/quarkus/examples/Person.java  |  36 +++
 .../quarkus/examples/AWSLambdaHandlerTest.java     |  45 ++++
 .../quarkus/examples/AWSLambdaHandlerTestIT.java   |  25 ++
 .../src/test/resources/application.properties      |  17 ++
 docs/modules/ROOT/attachments/examples.json        |   5 +
 15 files changed, 823 insertions(+)

diff --git a/aws-lambda/README.md b/aws-lambda/README.md
new file mode 100644
index 0000000..49673f7
--- /dev/null
+++ b/aws-lambda/README.md
@@ -0,0 +1,197 @@
+# Deploying a Camel Route in AWS Lambda : A Camel Quarkus example
+
+This example uses the following framework 
+
+ * **Quarkus** - *The Supersonic Subatomic Java Framework for building Cloud Native Applications*
+ * **Apache Camel** - *The Swiss Army Knife of Enterprise Application Integration for integrating heterogeneous systems*
+ * **AWS Lambda** - *Event-driven, serverless computing platform provided by Amazon as a part of Amazon Web Services*
+
+If you want to learn more about 
+
+* *Quarkus - please visit its website: https://quarkus.io/*
+* *Apache Camel - please visit its website: https://camel.apache.org/*
+* *AWS Lambda - please visit its website: https://aws.amazon.com/lambda/*
+
+## Provided Code
+
+### Quarkus Camel Amazon Lambda Integration example
+
+This example contains a sample Greeter service build using Quarkus & Camel framework implementing Dependency Injection design principle which can be deployed as functions into the Amazon Lambda.
+
+> :warning: **INCOMPATIBLE WITH DEV MODE**: Amazon Lambda Binding is not compatible with dev mode yet!
+
+
+#### Quarkus Extensions / Dependencies Used
+
+1. **[Apache Camel](https://quarkus.io/guides/camel)**
+    * [camel-quarkus-core](https://camel.apache.org/camel-quarkus/latest/reference/extensions/core.html)
+    * [camel-quarkus-direct](https://camel.apache.org/camel-quarkus/latest/reference/extensions/direct.html)
+    * [camel-quarkus-log](https://camel.apache.org/camel-quarkus/latest/reference/extensions/log.html)
+
+2. **Amazon Lambda**
+    * [quarkus-amazon-lambda](https://quarkus.io/guides/amazon-lambda)
+    
+3. **[Context Dependency Injection](https://quarkus.io/guides/cdi)**
+    * [quarkus-arc](https://quarkus.io/guides/cdi-reference)
+    
+4. **[Testing](https://quarkus.io/guides/getting-started-testing)**
+    * quarkus-junit5
+    * [quarkus-junit5-mockito](https://quarkus.io/blog/mocking/)
+    * quarkus-test-amazon-lambda
+
+## Running the application in dev mode
+
+You can run your application in dev mode that enables live coding using:
+```shell script
+mvn compile quarkus:dev
+```
+
+> **_NOTE:_**  Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/.
+
+## Building and Packaging the Java code as Quarkus JVM application
+
+The application can be packaged using:
+```shell script
+mvn clean package
+```
+This will compile and package your code. 
+
+It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory.
+Be aware that it’s not an _uber-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory.
+
+If you want to build an _uber-jar_, execute the following command:
+```shell script
+mvn package -Dquarkus.package.type=uber-jar
+```
+
+The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`.
+
+It also generates a zip file `target/function.zip`. This zip file contains your java code along with the dependencies.
+
+<a name="native"> </a>
+
+## Building and Packaging the Java code as Quarkus Native executable
+
+If you want a lower memory footprint and faster initialization times for your lambda, you can compile your Java code to a native executable. Just make sure to rebuild your project with the -Pnative switch.
+> :warning: **Building Native Executables will take much longer time and depends on the underlying system**
+```shell script
+mvn package -Pnative
+```
+> :information_source: If you are building on a non-Linux system Or, if you don't have GraalVM installed, you can run the native executable build using docker container. You need to pass in a property instructing quarkus to use a docker build as Amazon Lambda requires linux binaries. 
+>You can do this by passing this property to your Maven build: `-Dquarkus.native.container-build=true`. However, This requires to have docker installed locally.
+
+```shell script
+mvn package -Pnative -Dquarkus.native.container-build=true
+```
+
+Either of these commands will compile and create a native executable image. 
+You can then execute your native executable with: `./target/code-with-quarkus-1.0.0-SNAPSHOT-runner`
+
+It also generates a zip file `target/function.zip`. This zip file contains your native executable image renamed to bootstrap. This is a requirement of the AWS Lambda Custom (Provided) Runtime.
+
+If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.html.
+
+## Extra Build Generated Files
+ **_NOTE:_** After you run the build, there are a few extra files generated by the quarkus-amazon-lambda extension. These files are in the build directory: `target/`
+
+* function.zip - lambda deployment file
+
+* manage.sh - wrapper around aws lambda cli calls
+
+* bootstrap-example.sh - example bootstrap script for native deployments
+
+* sam.jvm.yaml - (optional) for use with sam cli and local testing
+
+* sam.native.yaml - (optional) for use with sam cli and native local testing
+
+> :information_source: [Please click here to know more on how to use these scripts for automated deployment](https://quarkus.io/guides/amazon-lambda#extra-build-generated-files)
+
+## Deploying the Quarkus JVM application to AWS Lambda via AWS Web Console
+
+1. Go to AWS Web console and search for Lambda Service
+ 
+2. Click Create Function and select Author From Scratch 
+
+3. Give the name for your function which should be unique
+
+4. Select Java 11 (Corretto) as Runtime 
+
+5. Under Permission feel free to create / use existing role to give the required permission for your lambda function
+
+6. Once the function is created click the function name to upload the generated function.zip file and configure it. 
+
+7. Scroll down and select the Code tab. Click the upload from dropdown on right-hand side of the screen and select .zip or .jar file 
+
+8. Click upload and browse to the path where the generated zip file `target/function.zip` was created and select the function.zip file and click save
+
+9. Under the Code tab scroll down to the Runtime settings and click edit 
+
+10. For the Handler details please provide the Quarkus Handler 
+
+```shell script
+io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::handleRequest
+```
+
+### Testing the AWS Lamda Function
+
+1. Now select the Test tab for executing a quick test. Copy paste the below json payload and hit Test 
+
+    ```shell script
+    {
+     "name": "Ravishankar"
+    }
+    ```
+2. If everything goes fine you should get the below response along with the lambda execution logs & stats
+
+    ```shell script
+    Hello Ravishankar ! How are you? from GreetService
+    ```
+## Deploying the Quarkus Native executable to AWS Lambda via AWS Web Console
+
+**_NOTE:_** [Please ensure that you have built your Java code as Quarkus Native executable](#native)
+
+1. Go to AWS Web console and search for Lambda Service
+ 
+2. Click Create Function and select Author From Scratch 
+
+3. Give the name for your function which should be unique
+
+4. For Runtime please scroll down and Select Provide your own bootstrap on Amazon Linux 2 under Custom Runtime 
+
+5. Under Permission feel free to create / use existing role to give the required permission for your lambda function
+
+6. Once the function is created click the function name to upload the generated function.zip file and configure it. 
+
+7. Scroll down and select the Code tab. Click the upload from dropdown on right-hand side of the screen and select .zip or .jar file 
+
+8. Click upload and browse to the path where the generated zip file `target/function.zip` was created and select the function.zip file and click save
+
+9. Under the Code tab scroll down to the Runtime settings and click edit 
+
+10. For the Handler details please provide the below Handler 
+
+    ```shell script
+        not.used.in.provided.runtime
+    ```
+
+11. Then Select the Configuration tab and click Environment Variables 
+
+12. For Key enter `DISABLE_SIGNAL_HANDLERS`	& for Value enter `true`
+
+### Testing the AWS Lamda Function
+
+1. Now select the Test tab for executing a quick test. Copy paste the below json payload and hit Test 
+
+    ```shell script
+    {
+     "name": "Ravishankar"
+    }
+    ```
+2. If everything goes fine you should get the below response along with the lambda execution logs & stats
+
+    ```shell script
+    Hello Ravishankar ! How are you? from GreetService
+    ```
+
+## JVM vs Native : Results based on lambda execution logs & stats
+![JVM vs Native Results](results.png?raw=true "JVM vs Native Results")
\ No newline at end of file
diff --git a/aws-lambda/payload.json b/aws-lambda/payload.json
new file mode 100644
index 0000000..192c26b
--- /dev/null
+++ b/aws-lambda/payload.json
@@ -0,0 +1,3 @@
+{
+  "name": "Ravishankar"
+}
\ No newline at end of file
diff --git a/aws-lambda/pom.xml b/aws-lambda/pom.xml
new file mode 100644
index 0000000..25e7072
--- /dev/null
+++ b/aws-lambda/pom.xml
@@ -0,0 +1,287 @@
+<?xml version="1.0"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+         http://www.apache.org/licenses/LICENSE-2.0
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.camel.quarkus.examples</groupId>
+  <artifactId>camel-quarkus-examples-aws-lambda</artifactId>
+  <version>2.2.0-SNAPSHOT</version>
+
+  <name>Camel Quarkus :: Examples :: AWS Lambda</name>
+  <description>Camel Quarkus Example :: Deploying a Camel Route in AWS Lambda</description>
+
+  <properties>
+    <camel-quarkus.version>2.1.0</camel-quarkus.version>
+    <quarkus.version>2.1.0.Final</quarkus.version>
+
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+    <maven.compiler.target>11</maven.compiler.target>
+    <maven.compiler.source>11</maven.compiler.source>
+    <maven.compiler.testTarget>${maven.compiler.target}</maven.compiler.testTarget>
+    <maven.compiler.testSource>${maven.compiler.source}</maven.compiler.testSource>
+
+    <formatter-maven-plugin.version>2.11.0</formatter-maven-plugin.version>
+    <impsort-maven-plugin.version>1.3.2</impsort-maven-plugin.version>
+    <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
+    <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
+    <maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
+    <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
+    <mycila-license.version>3.0</mycila-license.version>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-bom</artifactId>
+        <version>${camel-quarkus.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.camel.quarkus</groupId>
+      <artifactId>camel-quarkus-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel.quarkus</groupId>
+      <artifactId>camel-quarkus-direct</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel.quarkus</groupId>
+      <artifactId>camel-quarkus-log</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.quarkus</groupId>
+      <artifactId>quarkus-amazon-lambda</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.quarkus</groupId>
+      <artifactId>quarkus-arc</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.quarkus</groupId>
+      <artifactId>quarkus-junit5</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>io.quarkus</groupId>
+      <artifactId>quarkus-junit5-mockito</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>io.quarkus</groupId>
+      <artifactId>quarkus-test-amazon-lambda</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>net.revelc.code.formatter</groupId>
+          <artifactId>formatter-maven-plugin</artifactId>
+          <version>${formatter-maven-plugin.version}</version>
+          <configuration>
+            <configFile>${maven.multiModuleProjectDirectory}/eclipse-formatter-config.xml</configFile>
+          </configuration>
+        </plugin>
+
+        <plugin>
+          <groupId>net.revelc.code</groupId>
+          <artifactId>impsort-maven-plugin</artifactId>
+          <version>${impsort-maven-plugin.version}</version>
+          <configuration>
+            <groups>java.,javax.,org.w3c.,org.xml.,junit.</groups>
+            <removeUnused>true</removeUnused>
+            <staticAfter>true</staticAfter>
+            <staticGroups>java.,javax.,org.w3c.,org.xml.,junit.</staticGroups>
+          </configuration>
+        </plugin>
+
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>${maven-compiler-plugin.version}</version>
+          <configuration>
+            <parameters>true</parameters>
+            <showDeprecation>true</showDeprecation>
+            <showWarnings>true</showWarnings>
+            <compilerArgs>
+              <arg>-Xlint:unchecked</arg>
+            </compilerArgs>
+          </configuration>
+        </plugin>
+
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>${maven-surefire-plugin.version}</version>
+          <configuration>
+            <failIfNoTests>false</failIfNoTests>
+            <systemProperties>
+              <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
+              <maven.home>${maven.home}</maven.home>
+            </systemProperties>
+          </configuration>
+        </plugin>
+
+        <plugin>
+          <groupId>io.quarkus</groupId>
+          <artifactId>quarkus-maven-plugin</artifactId>
+          <version>${quarkus.version}</version>
+          <extensions>true</extensions>
+          <executions>
+            <execution>
+              <goals>
+                <goal>build</goal>
+                <goal>generate-code</goal>
+                <goal>generate-code-tests</goal>
+              </goals>
+            </execution>
+          </executions>
+        </plugin>
+
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-failsafe-plugin</artifactId>
+          <version>${maven-surefire-plugin.version}</version>
+        </plugin>
+
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-jar-plugin</artifactId>
+          <version>${maven-jar-plugin.version}</version>
+        </plugin>
+
+        <plugin>
+          <groupId>com.mycila</groupId>
+          <artifactId>license-maven-plugin</artifactId>
+          <version>${mycila-license.version}</version>
+          <configuration>
+            <failIfUnknown>true</failIfUnknown>
+            <header>${maven.multiModuleProjectDirectory}/header.txt</header>
+            <excludes>
+              <exclude>**/*.adoc</exclude>
+              <exclude>**/*.txt</exclude>
+              <exclude>**/LICENSE.txt</exclude>
+              <exclude>**/LICENSE</exclude>
+              <exclude>**/NOTICE.txt</exclude>
+              <exclude>**/NOTICE</exclude>
+              <exclude>**/README</exclude>
+              <exclude>**/pom.xml.versionsBackup</exclude>
+            </excludes>
+            <mapping>
+              <java>SLASHSTAR_STYLE</java>
+              <properties>CAMEL_PROPERTIES_STYLE</properties>
+              <kt>SLASHSTAR_STYLE</kt>
+            </mapping>
+            <headerDefinitions>
+              <headerDefinition>${maven.multiModuleProjectDirectory}/license-properties-headerdefinition.xml</headerDefinition>
+            </headerDefinitions>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+
+    <plugins>
+      <plugin>
+        <groupId>io.quarkus</groupId>
+        <artifactId>quarkus-maven-plugin</artifactId>
+        <version>${quarkus.version}</version>
+        <extensions>true</extensions>
+        <executions>
+          <execution>
+            <goals>
+              <goal>build</goal>
+              <goal>generate-code</goal>
+              <goal>generate-code-tests</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>net.revelc.code.formatter</groupId>
+        <artifactId>formatter-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>format</id>
+            <goals>
+              <goal>format</goal>
+            </goals>
+            <phase>process-sources</phase>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>net.revelc.code</groupId>
+        <artifactId>impsort-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>sort-imports</id>
+            <goals>
+              <goal>sort</goal>
+            </goals>
+            <phase>process-sources</phase>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>native</id>
+      <activation>
+        <property>
+          <name>native</name>
+        </property>
+      </activation>
+      <properties>
+        <quarkus.package.type>native</quarkus.package.type>
+      </properties>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-failsafe-plugin</artifactId>
+            <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>
+    </profile>
+  </profiles>
+</project>
\ No newline at end of file
diff --git a/aws-lambda/results.png b/aws-lambda/results.png
new file mode 100644
index 0000000..a806e20
Binary files /dev/null and b/aws-lambda/results.png differ
diff --git a/aws-lambda/src/main/docker/Dockerfile.jvm b/aws-lambda/src/main/docker/Dockerfile.jvm
new file mode 100644
index 0000000..90bc63f
--- /dev/null
+++ b/aws-lambda/src/main/docker/Dockerfile.jvm
@@ -0,0 +1,55 @@
+####
+# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
+#
+# Before building the container image run:
+#
+# mvn package
+#
+# Then, build the image with:
+#
+# docker build -f src/main/docker/Dockerfile.jvm -t  camel-quarkus-examples/aws-lambda-jvm .
+#
+# Then run the container using:
+#
+# docker run -i --rm -p 8080:8080 qcamel-quarkus-examples/aws-lambda-jvm
+#
+# If you want to include the debug port into your docker image
+# you will have to expose the debug port (default 5005) like this :  EXPOSE 8080 5005
+#
+# Then run the container using :
+#
+# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" camel-quarkus-examples/aws-lambda-jvm
+#
+###
+FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 
+
+ARG JAVA_PACKAGE=java-11-openjdk-headless
+ARG RUN_JAVA_VERSION=1.3.8
+ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
+# Install java and the run-java script
+# Also set up permissions for user `1001`
+RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
+    && microdnf update \
+    && microdnf clean all \
+    && mkdir /deployments \
+    && chown 1001 /deployments \
+    && chmod "g+rwX" /deployments \
+    && chown 1001:root /deployments \
+    && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \
+    && chown 1001 /deployments/run-java.sh \
+    && chmod 540 /deployments/run-java.sh \
+    && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security
+
+# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size.
+ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
+# We make four distinct layers so if there are application changes the library layers can be re-used
+COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/
+COPY --chown=1001 target/quarkus-app/*.jar /deployments/
+COPY --chown=1001 target/quarkus-app/app/ /deployments/app/
+COPY --chown=1001 target/quarkus-app/quarkus/ /deployments/quarkus/
+
+EXPOSE 8080
+USER 1001
+
+ENTRYPOINT [ "/deployments/run-java.sh" ]
+
diff --git a/aws-lambda/src/main/docker/Dockerfile.native b/aws-lambda/src/main/docker/Dockerfile.native
new file mode 100644
index 0000000..ab14aa2
--- /dev/null
+++ b/aws-lambda/src/main/docker/Dockerfile.native
@@ -0,0 +1,27 @@
+####
+# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode
+#
+# Before building the container image run:
+#
+# mvn package -Pnative
+#
+# Then, build the image with:
+#
+# docker build -f src/main/docker/Dockerfile.native -t camel-quarkus-examples/aws-lambda .
+#
+# Then run the container using:
+#
+# docker run -i --rm -p 8080:8080 camel-quarkus-examples/aws-lambda
+#
+###
+FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4
+WORKDIR /work/
+RUN chown 1001 /work \
+    && chmod "g+rwX" /work \
+    && chown 1001:root /work
+COPY --chown=1001:root target/*-runner /work/application
+
+EXPOSE 8080
+USER 1001
+
+CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
diff --git a/aws-lambda/src/main/docker/Dockerfile.native-distroless b/aws-lambda/src/main/docker/Dockerfile.native-distroless
new file mode 100644
index 0000000..08f3de7
--- /dev/null
+++ b/aws-lambda/src/main/docker/Dockerfile.native-distroless
@@ -0,0 +1,23 @@
+####
+# This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode
+#
+# Before building the container image run:
+#
+# mvn package -Pnative
+#
+# Then, build the image with:
+#
+# docker build -f src/main/docker/Dockerfile.native-distroless -t camel-quarkus-examples/aws-lambda .
+#
+# Then run the container using:
+#
+# docker run -i --rm -p 8080:8080 camel-quarkus-examples/aws-lambda
+#
+###
+FROM quay.io/quarkus/quarkus-distroless-image:1.0
+COPY target/*-runner /application
+
+EXPOSE 8080
+USER nonroot
+
+CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
diff --git a/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/AWSLambdaHandler.java b/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/AWSLambdaHandler.java
new file mode 100644
index 0000000..ce45e3a
--- /dev/null
+++ b/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/AWSLambdaHandler.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.examples;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import com.amazonaws.services.lambda.runtime.Context;
+import com.amazonaws.services.lambda.runtime.LambdaLogger;
+import com.amazonaws.services.lambda.runtime.RequestHandler;
+import org.apache.camel.ProducerTemplate;
+
+@Named("awsLambdaHandler")
+public class AWSLambdaHandler implements RequestHandler<Person, String> {
+
+    @Inject
+    ProducerTemplate template;
+
+    @Override
+    public String handleRequest(Person input, Context context) {
+        LambdaLogger logger = context.getLogger();
+        logger.log("Calling Camel Route :)");
+        return template.requestBody("direct:input", input, String.class);
+    }
+}
diff --git a/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/CamelRoute.java b/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/CamelRoute.java
new file mode 100644
index 0000000..b8c569f
--- /dev/null
+++ b/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/CamelRoute.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.examples;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+import org.apache.camel.builder.RouteBuilder;
+
+@ApplicationScoped
+public class CamelRoute extends RouteBuilder {
+
+    @Inject
+    GreetService greetService;
+
+    @Override
+    public void configure() throws Exception {
+        from("direct:input").routeId("Test")
+                .log("Inside Camel Route Received Payload ==> ${body}")
+                .setBody().body(Person.class, p -> greetService.greet(p.getName()))
+                .end();
+    }
+}
diff --git a/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/GreetService.java b/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/GreetService.java
new file mode 100644
index 0000000..0d46f67
--- /dev/null
+++ b/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/GreetService.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.examples;
+
+import javax.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+public class GreetService {
+
+    public String greet(String name) {
+        return String.format("Hello %s ! How are you? from GreetService", name);
+    }
+}
diff --git a/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/Person.java b/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/Person.java
new file mode 100644
index 0000000..cd6553e
--- /dev/null
+++ b/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/Person.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.examples;
+
+public class Person {
+
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public Person setName(String name) {
+        this.name = name;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("Person[name= %s]", this.name);
+    }
+}
diff --git a/aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTest.java b/aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTest.java
new file mode 100644
index 0000000..4f3364f
--- /dev/null
+++ b/aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.examples;
+
+import io.quarkus.amazon.lambda.test.LambdaClient;
+import io.quarkus.test.junit.QuarkusMock;
+import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
+@QuarkusTest
+public class AWSLambdaHandlerTest {
+
+    @BeforeAll
+    public static void setup() {
+
+        GreetService mock = Mockito.mock(GreetService.class);
+        Mockito.when(mock.greet("Stu")).thenReturn("Hello Stu ! How are you? from GreetService");
+        QuarkusMock.installMockForType(mock, GreetService.class);
+    }
+
+    @Test
+    public void testSimpleLambdaSuccess() throws Exception {
+        Person in = new Person();
+        in.setName("Stu");
+        String out = LambdaClient.invoke(String.class, in);
+        Assertions.assertEquals("Hello Stu ! How are you? from GreetService", out);
+    }
+}
diff --git a/aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTestIT.java b/aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTestIT.java
new file mode 100644
index 0000000..6debf16
--- /dev/null
+++ b/aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTestIT.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.examples;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+public class AWSLambdaHandlerTestIT extends AWSLambdaHandlerTest {
+
+    // Execute the same tests but in native mode.
+}
diff --git a/aws-lambda/src/test/resources/application.properties b/aws-lambda/src/test/resources/application.properties
new file mode 100644
index 0000000..3db48e4
--- /dev/null
+++ b/aws-lambda/src/test/resources/application.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+quarkus.lambda.enable-polling-jvm-mode=true
diff --git a/docs/modules/ROOT/attachments/examples.json b/docs/modules/ROOT/attachments/examples.json
index 6875aa8..56bb1ae 100644
--- a/docs/modules/ROOT/attachments/examples.json
+++ b/docs/modules/ROOT/attachments/examples.json
@@ -68,5 +68,10 @@
     "title": "XML Hello World",
     "description": "Shows how to define Camel routes using XML.",
     "link": "https://github.com/apache/camel-quarkus-examples/tree/main/timer-log-xml"
+  },
+  {
+    "title": "Deploying a Camel Route in AWS Lambda",
+    "description": "Demonstrates how to define Camel routes using CDI and deployed as functions into the Amazon Lambda",
+    "link": "https://github.com/apache/camel-quarkus-examples/tree/main/aws-lambda"
   }
 ]
\ No newline at end of file

[camel-quarkus-examples] 03/04: Upgrade quarkus to 2.1.1.Final

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aldettinger pushed a commit to branch camel-quarkus-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus-examples.git

commit 9e81bcd55d2d57cd0c2bda7a98823f77d9f2d5b1
Author: aldettinger <al...@gmail.com>
AuthorDate: Mon Aug 16 15:57:29 2021 +0200

    Upgrade quarkus to 2.1.1.Final
---
 file-bindy-ftp/pom.xml      | 2 +-
 file-split-log-xml/pom.xml  | 2 +-
 health/pom.xml              | 2 +-
 http-log/pom.xml            | 2 +-
 kafka/pom.xml               | 2 +-
 kamelet-chucknorris/pom.xml | 2 +-
 observability/pom.xml       | 2 +-
 rest-json/pom.xml           | 2 +-
 timer-log-cdi/pom.xml       | 2 +-
 timer-log-kotlin/pom.xml    | 2 +-
 timer-log-main/pom.xml      | 2 +-
 timer-log-spring/pom.xml    | 2 +-
 timer-log-xml/pom.xml       | 2 +-
 timer-log/pom.xml           | 2 +-
 14 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/file-bindy-ftp/pom.xml b/file-bindy-ftp/pom.xml
index 16f5bf8..2700f0e 100644
--- a/file-bindy-ftp/pom.xml
+++ b/file-bindy-ftp/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.2.0-SNAPSHOT</camel-quarkus.version>
-        <quarkus.version>2.1.0.Final</quarkus.version>
+        <quarkus.version>2.1.1.Final</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/file-split-log-xml/pom.xml b/file-split-log-xml/pom.xml
index 9ae4f24..ad319cf 100644
--- a/file-split-log-xml/pom.xml
+++ b/file-split-log-xml/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.2.0-SNAPSHOT</camel-quarkus.version>
-        <quarkus.version>2.1.0.Final</quarkus.version>
+        <quarkus.version>2.1.1.Final</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/health/pom.xml b/health/pom.xml
index 5310d4d..9fe22c7 100644
--- a/health/pom.xml
+++ b/health/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.2.0-SNAPSHOT</camel-quarkus.version>
-        <quarkus.version>2.1.0.Final</quarkus.version>
+        <quarkus.version>2.1.1.Final</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/http-log/pom.xml b/http-log/pom.xml
index d74bc1a..453e710 100644
--- a/http-log/pom.xml
+++ b/http-log/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.2.0-SNAPSHOT</camel-quarkus.version>
-        <quarkus.version>2.1.0.Final</quarkus.version>
+        <quarkus.version>2.1.1.Final</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/kafka/pom.xml b/kafka/pom.xml
index d0cab55..92567b5 100644
--- a/kafka/pom.xml
+++ b/kafka/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.2.0-SNAPSHOT</camel-quarkus.version>
-        <quarkus.version>2.1.0.Final</quarkus.version>
+        <quarkus.version>2.1.1.Final</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/kamelet-chucknorris/pom.xml b/kamelet-chucknorris/pom.xml
index a064602..ba1c4d6 100644
--- a/kamelet-chucknorris/pom.xml
+++ b/kamelet-chucknorris/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.2.0-SNAPSHOT</camel-quarkus.version>
-        <quarkus.version>2.1.0.Final</quarkus.version>
+        <quarkus.version>2.1.1.Final</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/observability/pom.xml b/observability/pom.xml
index 62dbcba..f23c367 100644
--- a/observability/pom.xml
+++ b/observability/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.2.0-SNAPSHOT</camel-quarkus.version>
-        <quarkus.version>2.1.0.Final</quarkus.version>
+        <quarkus.version>2.1.1.Final</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/rest-json/pom.xml b/rest-json/pom.xml
index 0d9e562..cbd5b56 100644
--- a/rest-json/pom.xml
+++ b/rest-json/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.2.0-SNAPSHOT</camel-quarkus.version>
-        <quarkus.version>2.1.0.Final</quarkus.version>
+        <quarkus.version>2.1.1.Final</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/timer-log-cdi/pom.xml b/timer-log-cdi/pom.xml
index e7afda9..743c6e5 100644
--- a/timer-log-cdi/pom.xml
+++ b/timer-log-cdi/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.2.0-SNAPSHOT</camel-quarkus.version>
-        <quarkus.version>2.1.0.Final</quarkus.version>
+        <quarkus.version>2.1.1.Final</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/timer-log-kotlin/pom.xml b/timer-log-kotlin/pom.xml
index f110775..6d32fe1 100644
--- a/timer-log-kotlin/pom.xml
+++ b/timer-log-kotlin/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.2.0-SNAPSHOT</camel-quarkus.version>
-        <quarkus.version>2.1.0.Final</quarkus.version>
+        <quarkus.version>2.1.1.Final</quarkus.version>
         <kotlin.version>1.5.21</kotlin.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
diff --git a/timer-log-main/pom.xml b/timer-log-main/pom.xml
index 2ecd092..9413ef9 100644
--- a/timer-log-main/pom.xml
+++ b/timer-log-main/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.2.0-SNAPSHOT</camel-quarkus.version>
-        <quarkus.version>2.1.0.Final</quarkus.version>
+        <quarkus.version>2.1.1.Final</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/timer-log-spring/pom.xml b/timer-log-spring/pom.xml
index ab952f9..354ce5e 100644
--- a/timer-log-spring/pom.xml
+++ b/timer-log-spring/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.2.0-SNAPSHOT</camel-quarkus.version>
-        <quarkus.version>2.1.0.Final</quarkus.version>
+        <quarkus.version>2.1.1.Final</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/timer-log-xml/pom.xml b/timer-log-xml/pom.xml
index 582c3a9..22b047d 100644
--- a/timer-log-xml/pom.xml
+++ b/timer-log-xml/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.2.0-SNAPSHOT</camel-quarkus.version>
-        <quarkus.version>2.1.0.Final</quarkus.version>
+        <quarkus.version>2.1.1.Final</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/timer-log/pom.xml b/timer-log/pom.xml
index c819dd1..45910d8 100644
--- a/timer-log/pom.xml
+++ b/timer-log/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.2.0-SNAPSHOT</camel-quarkus.version>
-        <quarkus.version>2.1.0.Final</quarkus.version>
+        <quarkus.version>2.1.1.Final</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

[camel-quarkus-examples] 02/04: Fix aws-lambda license check issues and shrink example

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aldettinger pushed a commit to branch camel-quarkus-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus-examples.git

commit 62a509d6d60e34d9b40334d8addd660641473b3e
Author: aldettinger <al...@gmail.com>
AuthorDate: Mon Aug 16 11:02:26 2021 +0200

    Fix aws-lambda license check issues and shrink example
---
 .github/test-categories.yaml                       |   1 +
 aws-lambda/{README.md => README.adoc}              | 108 +++++++++++++--------
 aws-lambda/pom.xml                                 |  11 ++-
 aws-lambda/src/main/docker/Dockerfile.jvm          |  17 ++++
 aws-lambda/src/main/docker/Dockerfile.native       |  17 ++++
 .../src/main/docker/Dockerfile.native-distroless   |  17 ++++
 .../apache/camel/quarkus/examples/CamelRoute.java  |   2 +-
 .../quarkus/examples/AWSLambdaHandlerTest.java     |  19 ++--
 docs/modules/ROOT/attachments/examples.json        |  10 +-
 9 files changed, 139 insertions(+), 63 deletions(-)

diff --git a/.github/test-categories.yaml b/.github/test-categories.yaml
index c6b5405..00279ed 100644
--- a/.github/test-categories.yaml
+++ b/.github/test-categories.yaml
@@ -27,6 +27,7 @@ group-03:
   - http-log
   - rest-json
 group-04:
+  - aws-lambda
   - timer-log
   - timer-log-cdi
 group-05:
diff --git a/aws-lambda/README.md b/aws-lambda/README.adoc
similarity index 68%
rename from aws-lambda/README.md
rename to aws-lambda/README.adoc
index 49673f7..835df95 100644
--- a/aws-lambda/README.md
+++ b/aws-lambda/README.adoc
@@ -1,4 +1,9 @@
-# Deploying a Camel Route in AWS Lambda : A Camel Quarkus example
+= Deploying a Camel Route in AWS Lambda : A Camel Quarkus example
+:cq-example-description: An example that shows how to deploy a Camel Quarkus route as an AWS Lambda function
+
+{cq-description}
+
+== Introduction
 
 This example uses the following framework 
 
@@ -12,43 +17,48 @@ If you want to learn more about
 * *Apache Camel - please visit its website: https://camel.apache.org/*
 * *AWS Lambda - please visit its website: https://aws.amazon.com/lambda/*
 
-## Provided Code
+== Provided Code
 
-### Quarkus Camel Amazon Lambda Integration example
+=== Quarkus Camel Amazon Lambda Integration example
 
 This example contains a sample Greeter service build using Quarkus & Camel framework implementing Dependency Injection design principle which can be deployed as functions into the Amazon Lambda.
 
-> :warning: **INCOMPATIBLE WITH DEV MODE**: Amazon Lambda Binding is not compatible with dev mode yet!
-
+[WARNING]
+====
+*INCOMPATIBLE WITH DEV MODE*: Amazon Lambda Binding is not compatible with dev mode yet!
+====
 
-#### Quarkus Extensions / Dependencies Used
+==== Quarkus Extensions / Dependencies Used
 
-1. **[Apache Camel](https://quarkus.io/guides/camel)**
-    * [camel-quarkus-core](https://camel.apache.org/camel-quarkus/latest/reference/extensions/core.html)
-    * [camel-quarkus-direct](https://camel.apache.org/camel-quarkus/latest/reference/extensions/direct.html)
-    * [camel-quarkus-log](https://camel.apache.org/camel-quarkus/latest/reference/extensions/log.html)
+1. **https://quarkus.io/guides/camel[Apache Camel]**
+    * https://camel.apache.org/camel-quarkus/latest/reference/extensions/core.html[camel-quarkus-core]
+    * https://camel.apache.org/camel-quarkus/latest/reference/extensions/direct.html[camel-quarkus-direct]
+    * https://camel.apache.org/camel-quarkus/latest/reference/extensions/log.html[camel-quarkus-log]
 
 2. **Amazon Lambda**
-    * [quarkus-amazon-lambda](https://quarkus.io/guides/amazon-lambda)
+    * https://quarkus.io/guides/amazon-lambda[quarkus-amazon-lambda]
     
-3. **[Context Dependency Injection](https://quarkus.io/guides/cdi)**
-    * [quarkus-arc](https://quarkus.io/guides/cdi-reference)
+3. **https://quarkus.io/guides/cdi[Context Dependency Injection]**
+    * https://quarkus.io/guides/cdi-reference[quarkus-arc]
     
-4. **[Testing](https://quarkus.io/guides/getting-started-testing)**
+4. **https://quarkus.io/guides/getting-started-testing[Testing]**
     * quarkus-junit5
-    * [quarkus-junit5-mockito](https://quarkus.io/blog/mocking/)
+    * https://quarkus.io/blog/mocking/[quarkus-junit5-mockito]
     * quarkus-test-amazon-lambda
 
-## Running the application in dev mode
+== Running the application in dev mode
 
 You can run your application in dev mode that enables live coding using:
 ```shell script
 mvn compile quarkus:dev
 ```
 
-> **_NOTE:_**  Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/.
+[NOTE]
+====
+Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/.
+====
 
-## Building and Packaging the Java code as Quarkus JVM application
+== Building and Packaging the Java code as Quarkus JVM jar
 
 The application can be packaged using:
 ```shell script
@@ -68,17 +78,25 @@ The application is now runnable using `java -jar target/quarkus-app/quarkus-run.
 
 It also generates a zip file `target/function.zip`. This zip file contains your java code along with the dependencies.
 
-<a name="native"> </a>
-
-## Building and Packaging the Java code as Quarkus Native executable
+[#package_native_executable]
+== Building and Packaging the Java code as Quarkus Native executable
 
 If you want a lower memory footprint and faster initialization times for your lambda, you can compile your Java code to a native executable. Just make sure to rebuild your project with the -Pnative switch.
-> :warning: **Building Native Executables will take much longer time and depends on the underlying system**
+
+[WARNING]
+====
+*Building Native Executables will take much longer time and depends on the underlying system*
+====
+
 ```shell script
 mvn package -Pnative
 ```
-> :information_source: If you are building on a non-Linux system Or, if you don't have GraalVM installed, you can run the native executable build using docker container. You need to pass in a property instructing quarkus to use a docker build as Amazon Lambda requires linux binaries. 
+
+[NOTE]
+====
+If you are building on a non-Linux system Or, if you don't have GraalVM installed, you can run the native executable build using docker container. You need to pass in a property instructing quarkus to use a docker build as Amazon Lambda requires linux binaries. 
 >You can do this by passing this property to your Maven build: `-Dquarkus.native.container-build=true`. However, This requires to have docker installed locally.
+====
 
 ```shell script
 mvn package -Pnative -Dquarkus.native.container-build=true
@@ -91,8 +109,11 @@ It also generates a zip file `target/function.zip`. This zip file contains your
 
 If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.html.
 
-## Extra Build Generated Files
- **_NOTE:_** After you run the build, there are a few extra files generated by the quarkus-amazon-lambda extension. These files are in the build directory: `target/`
+== Extra Build Generated Files
+[NOTE]
+====
+After you run the build, there are a few extra files generated by the quarkus-amazon-lambda extension. These files are in the build directory: `target/`
+====
 
 * function.zip - lambda deployment file
 
@@ -104,9 +125,12 @@ If you want to learn more about building native executables, please consult http
 
 * sam.native.yaml - (optional) for use with sam cli and native local testing
 
-> :information_source: [Please click here to know more on how to use these scripts for automated deployment](https://quarkus.io/guides/amazon-lambda#extra-build-generated-files)
+[NOTE]
+====
+https://quarkus.io/guides/amazon-lambda#extra-build-generated-files[Please click here to know more on how to use these scripts for automated deployment]
+====
 
-## Deploying the Quarkus JVM application to AWS Lambda via AWS Web Console
+== Deploying the Quarkus JVM application to AWS Lambda via AWS Web Console
 
 1. Go to AWS Web console and search for Lambda Service
  
@@ -132,23 +156,24 @@ If you want to learn more about building native executables, please consult http
 io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::handleRequest
 ```
 
-### Testing the AWS Lamda Function
+=== Testing the AWS Lamda Function
 
 1. Now select the Test tab for executing a quick test. Copy paste the below json payload and hit Test 
 
-    ```shell script
     {
      "name": "Ravishankar"
     }
-    ```
+
 2. If everything goes fine you should get the below response along with the lambda execution logs & stats
 
-    ```shell script
     Hello Ravishankar ! How are you? from GreetService
-    ```
-## Deploying the Quarkus Native executable to AWS Lambda via AWS Web Console
 
-**_NOTE:_** [Please ensure that you have built your Java code as Quarkus Native executable](#native)
+== Deploying the Quarkus Native executable to AWS Lambda via AWS Web Console
+
+[NOTE]
+====
+<<package_native_executable,Please ensure that you have built your Java code as Quarkus Native executable>>
+====
 
 1. Go to AWS Web console and search for Lambda Service
  
@@ -170,28 +195,25 @@ io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::handleRequest
 
 10. For the Handler details please provide the below Handler 
 
-    ```shell script
         not.used.in.provided.runtime
-    ```
 
 11. Then Select the Configuration tab and click Environment Variables 
 
 12. For Key enter `DISABLE_SIGNAL_HANDLERS`	& for Value enter `true`
 
-### Testing the AWS Lamda Function
+=== Testing the AWS Lamda Function
 
 1. Now select the Test tab for executing a quick test. Copy paste the below json payload and hit Test 
 
-    ```shell script
     {
      "name": "Ravishankar"
     }
-    ```
+
 2. If everything goes fine you should get the below response along with the lambda execution logs & stats
 
-    ```shell script
+
     Hello Ravishankar ! How are you? from GreetService
-    ```
 
-## JVM vs Native : Results based on lambda execution logs & stats
-![JVM vs Native Results](results.png?raw=true "JVM vs Native Results")
\ No newline at end of file
+
+== JVM vs Native : Results based on lambda execution logs & stats
+image::results.png[JVM vs Native Results]
\ No newline at end of file
diff --git a/aws-lambda/pom.xml b/aws-lambda/pom.xml
index 25e7072..546d80b 100644
--- a/aws-lambda/pom.xml
+++ b/aws-lambda/pom.xml
@@ -1,17 +1,21 @@
 <?xml version="1.0"?>
 <!--
+
     Licensed to the Apache Software Foundation (ASF) under one or more
     contributor license agreements.  See the NOTICE file distributed with
     this work for additional information regarding copyright ownership.
     The ASF licenses this file to You under the Apache License, Version 2.0
     (the "License"); you may not use this file except in compliance with
     the License.  You may obtain a copy of the License at
+
          http://www.apache.org/licenses/LICENSE-2.0
+
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
+
 -->
 
 <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
@@ -191,8 +195,10 @@
             <mapping>
               <java>SLASHSTAR_STYLE</java>
               <properties>CAMEL_PROPERTIES_STYLE</properties>
-              <kt>SLASHSTAR_STYLE</kt>
-            </mapping>
+              <Dockerfile.jvm>CAMEL_PROPERTIES_STYLE</Dockerfile.jvm>
+              <Dockerfile.native>CAMEL_PROPERTIES_STYLE</Dockerfile.native>
+              <Dockerfile.native-distroless>CAMEL_PROPERTIES_STYLE</Dockerfile.native-distroless>
+              </mapping>
             <headerDefinitions>
               <headerDefinition>${maven.multiModuleProjectDirectory}/license-properties-headerdefinition.xml</headerDefinition>
             </headerDefinitions>
@@ -205,7 +211,6 @@
       <plugin>
         <groupId>io.quarkus</groupId>
         <artifactId>quarkus-maven-plugin</artifactId>
-        <version>${quarkus.version}</version>
         <extensions>true</extensions>
         <executions>
           <execution>
diff --git a/aws-lambda/src/main/docker/Dockerfile.jvm b/aws-lambda/src/main/docker/Dockerfile.jvm
index 90bc63f..5f05d76 100644
--- a/aws-lambda/src/main/docker/Dockerfile.jvm
+++ b/aws-lambda/src/main/docker/Dockerfile.jvm
@@ -1,3 +1,20 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
 ####
 # This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
 #
diff --git a/aws-lambda/src/main/docker/Dockerfile.native b/aws-lambda/src/main/docker/Dockerfile.native
index ab14aa2..bde9db1 100644
--- a/aws-lambda/src/main/docker/Dockerfile.native
+++ b/aws-lambda/src/main/docker/Dockerfile.native
@@ -1,3 +1,20 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
 ####
 # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode
 #
diff --git a/aws-lambda/src/main/docker/Dockerfile.native-distroless b/aws-lambda/src/main/docker/Dockerfile.native-distroless
index 08f3de7..b80011d 100644
--- a/aws-lambda/src/main/docker/Dockerfile.native-distroless
+++ b/aws-lambda/src/main/docker/Dockerfile.native-distroless
@@ -1,3 +1,20 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
 ####
 # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode
 #
diff --git a/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/CamelRoute.java b/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/CamelRoute.java
index b8c569f..b9709a8 100644
--- a/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/CamelRoute.java
+++ b/aws-lambda/src/main/java/org/apache/camel/quarkus/examples/CamelRoute.java
@@ -28,7 +28,7 @@ public class CamelRoute extends RouteBuilder {
     GreetService greetService;
 
     @Override
-    public void configure() throws Exception {
+    public void configure() {
         from("direct:input").routeId("Test")
                 .log("Inside Camel Route Received Payload ==> ${body}")
                 .setBody().body(Person.class, p -> greetService.greet(p.getName()))
diff --git a/aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTest.java b/aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTest.java
index 4f3364f..28901dc 100644
--- a/aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTest.java
+++ b/aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTest.java
@@ -17,26 +17,23 @@
 package org.apache.camel.quarkus.examples;
 
 import io.quarkus.amazon.lambda.test.LambdaClient;
-import io.quarkus.test.junit.QuarkusMock;
 import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.mockito.InjectMock;
 import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
-import org.mockito.Mockito;
+
+import static org.mockito.Mockito.when;
 
 @QuarkusTest
 public class AWSLambdaHandlerTest {
 
-    @BeforeAll
-    public static void setup() {
-
-        GreetService mock = Mockito.mock(GreetService.class);
-        Mockito.when(mock.greet("Stu")).thenReturn("Hello Stu ! How are you? from GreetService");
-        QuarkusMock.installMockForType(mock, GreetService.class);
-    }
+    @InjectMock
+    GreetService mockGreetingService;
 
     @Test
-    public void testSimpleLambdaSuccess() throws Exception {
+    public void testSimpleLambdaSuccess() {
+        when(mockGreetingService.greet("Stu")).thenReturn("Hello Stu ! How are you? from GreetService");
+
         Person in = new Person();
         in.setName("Stu");
         String out = LambdaClient.invoke(String.class, in);
diff --git a/docs/modules/ROOT/attachments/examples.json b/docs/modules/ROOT/attachments/examples.json
index 56bb1ae..a5ec778 100644
--- a/docs/modules/ROOT/attachments/examples.json
+++ b/docs/modules/ROOT/attachments/examples.json
@@ -10,6 +10,11 @@
     "link": "https://github.com/apache/camel-quarkus-examples/tree/main/timer-log-main"
   },
   {
+    "title": "Deploying a Camel Route in AWS Lambda ",
+    "description": "Shows how to deploy a Camel Quarkus route as an AWS Lambda function",
+    "link": "https://github.com/apache/camel-quarkus-examples/tree/main/aws-lambda"
+  },
+  {
     "title": "File consumer with Bindy \u0026 FTP",
     "description": "Shows how to consume CSV files, marshal \u0026 unmarshal the data and send it onwards via FTP",
     "link": "https://github.com/apache/camel-quarkus-examples/tree/main/file-bindy-ftp"
@@ -68,10 +73,5 @@
     "title": "XML Hello World",
     "description": "Shows how to define Camel routes using XML.",
     "link": "https://github.com/apache/camel-quarkus-examples/tree/main/timer-log-xml"
-  },
-  {
-    "title": "Deploying a Camel Route in AWS Lambda",
-    "description": "Demonstrates how to define Camel routes using CDI and deployed as functions into the Amazon Lambda",
-    "link": "https://github.com/apache/camel-quarkus-examples/tree/main/aws-lambda"
   }
 ]
\ No newline at end of file

[camel-quarkus-examples] 04/04: aws-lambda: fix native test

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aldettinger pushed a commit to branch camel-quarkus-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus-examples.git

commit e85b509220ade127cd826bac5e0366b6b9b8bc14
Author: aldettinger <al...@gmail.com>
AuthorDate: Mon Aug 16 16:49:52 2021 +0200

    aws-lambda: fix native test
---
 .../apache/camel/quarkus/examples/AWSLambdaHandlerTest.java    | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTest.java b/aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTest.java
index 28901dc..8bda558 100644
--- a/aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTest.java
+++ b/aws-lambda/src/test/java/org/apache/camel/quarkus/examples/AWSLambdaHandlerTest.java
@@ -18,22 +18,14 @@ package org.apache.camel.quarkus.examples;
 
 import io.quarkus.amazon.lambda.test.LambdaClient;
 import io.quarkus.test.junit.QuarkusTest;
-import io.quarkus.test.junit.mockito.InjectMock;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
-import static org.mockito.Mockito.when;
-
 @QuarkusTest
 public class AWSLambdaHandlerTest {
 
-    @InjectMock
-    GreetService mockGreetingService;
-
     @Test
-    public void testSimpleLambdaSuccess() {
-        when(mockGreetingService.greet("Stu")).thenReturn("Hello Stu ! How are you? from GreetService");
-
+    public void invokeLambdaForStuShouldReturnStuGreeting() {
         Person in = new Person();
         in.setName("Stu");
         String out = LambdaClient.invoke(String.class, in);