You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/04/20 11:05:37 UTC
[camel] 23/24: CAMEL-14868 - Camel-AWS2-*: Where possible,
give the possiblity to the end user to pass an AWS Request pojo as
body, aws2-lambda added unit and spring tests
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 6789fce72412d80d44b6d0fcf52ef52357c03455
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Apr 20 13:03:13 2020 +0200
CAMEL-14868 - Camel-AWS2-*: Where possible, give the possiblity to the end user to pass an AWS Request pojo as body, aws2-lambda added unit and spring tests
---
.../component/aws2/lambda/LambdaComponentSpringTest.java | 14 ++++++++++++++
.../camel/component/aws2/lambda/LambdaProducerTest.java | 16 ++++++++++++++++
.../aws2/lambda/LambdaComponentSpringTest-context.xml | 5 +++++
3 files changed, 35 insertions(+)
diff --git a/components/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/LambdaComponentSpringTest.java b/components/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/LambdaComponentSpringTest.java
index 5ff9861..f5ec9ba 100644
--- a/components/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/LambdaComponentSpringTest.java
+++ b/components/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/LambdaComponentSpringTest.java
@@ -36,6 +36,7 @@ import software.amazon.awssdk.services.lambda.model.DeleteAliasResponse;
import software.amazon.awssdk.services.lambda.model.DeleteEventSourceMappingResponse;
import software.amazon.awssdk.services.lambda.model.DeleteFunctionResponse;
import software.amazon.awssdk.services.lambda.model.GetAliasResponse;
+import software.amazon.awssdk.services.lambda.model.GetFunctionRequest;
import software.amazon.awssdk.services.lambda.model.GetFunctionResponse;
import software.amazon.awssdk.services.lambda.model.ListAliasesResponse;
import software.amazon.awssdk.services.lambda.model.ListEventSourceMappingsResponse;
@@ -101,6 +102,19 @@ public class LambdaComponentSpringTest extends CamelSpringTestSupport {
GetFunctionResponse result = (GetFunctionResponse)exchange.getMessage().getBody();
assertEquals(result.configuration().functionName(), "GetHelloWithName");
}
+
+ @Test
+ public void lambdaGetFunctionPojoTest() throws Exception {
+
+ Exchange exchange = template.send("direct:getFunctionPojo", ExchangePattern.InOut, new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setBody(GetFunctionRequest.builder().functionName("GetHelloWithName").build());
+ }
+ });
+ GetFunctionResponse result = (GetFunctionResponse)exchange.getMessage().getBody();
+ assertEquals(result.configuration().functionName(), "GetHelloWithName");
+ }
@Test
public void lambdaListFunctionsTest() throws Exception {
diff --git a/components/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/LambdaProducerTest.java b/components/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/LambdaProducerTest.java
index c939f42..bf5d7aa 100644
--- a/components/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/LambdaProducerTest.java
+++ b/components/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/LambdaProducerTest.java
@@ -39,6 +39,7 @@ import software.amazon.awssdk.services.lambda.model.DeleteAliasResponse;
import software.amazon.awssdk.services.lambda.model.DeleteEventSourceMappingResponse;
import software.amazon.awssdk.services.lambda.model.DeleteFunctionResponse;
import software.amazon.awssdk.services.lambda.model.GetAliasResponse;
+import software.amazon.awssdk.services.lambda.model.GetFunctionRequest;
import software.amazon.awssdk.services.lambda.model.GetFunctionResponse;
import software.amazon.awssdk.services.lambda.model.ListAliasesResponse;
import software.amazon.awssdk.services.lambda.model.ListEventSourceMappingsResponse;
@@ -110,6 +111,19 @@ public class LambdaProducerTest extends CamelTestSupport {
GetFunctionResponse result = (GetFunctionResponse)exchange.getMessage().getBody();
assertEquals(result.configuration().functionName(), "GetHelloWithName");
}
+
+ @Test
+ public void lambdaGetFunctionPojoTest() throws Exception {
+
+ Exchange exchange = template.send("direct:getFunctionPojo", ExchangePattern.InOut, new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setBody(GetFunctionRequest.builder().functionName("GetHelloWithName").build());
+ }
+ });
+ GetFunctionResponse result = (GetFunctionResponse)exchange.getMessage().getBody();
+ assertEquals(result.configuration().functionName(), "GetHelloWithName");
+ }
@Test
public void lambdaListFunctionsTest() throws Exception {
@@ -344,6 +358,8 @@ public class LambdaProducerTest extends CamelTestSupport {
from("direct:createFunction").to("aws2-lambda://GetHelloWithName?awsLambdaClient=#awsLambdaClient&operation=createFunction").to("mock:result");
from("direct:getFunction").to("aws2-lambda://GetHelloWithName?awsLambdaClient=#awsLambdaClient&operation=getFunction").to("mock:result");
+
+ from("direct:getFunctionPojo").to("aws2-lambda://GetHelloWithName?awsLambdaClient=#awsLambdaClient&operation=getFunction&pojoRequest=true").to("mock:result");
from("direct:listFunctions").to("aws2-lambda://myFunction?awsLambdaClient=#awsLambdaClient&operation=listFunctions").to("mock:result");
diff --git a/components/camel-aws2-lambda/src/test/resources/org/apache/camel/component/aws2/lambda/LambdaComponentSpringTest-context.xml b/components/camel-aws2-lambda/src/test/resources/org/apache/camel/component/aws2/lambda/LambdaComponentSpringTest-context.xml
index 2e89a26..7de95a6 100644
--- a/components/camel-aws2-lambda/src/test/resources/org/apache/camel/component/aws2/lambda/LambdaComponentSpringTest-context.xml
+++ b/components/camel-aws2-lambda/src/test/resources/org/apache/camel/component/aws2/lambda/LambdaComponentSpringTest-context.xml
@@ -34,6 +34,11 @@
<from uri="direct:getFunction"/>
<to uri="aws2-lambda://GetHelloWithName?awsLambdaClient=#awsLambdaClient&operation=getFunction"/>
</route>
+
+ <route>
+ <from uri="direct:getFunctionPojo"/>
+ <to uri="aws2-lambda://GetHelloWithName?awsLambdaClient=#awsLambdaClient&operation=getFunction&pojoRequest=true"/>
+ </route>
<route>
<from uri="direct:listFunctions"/>