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/01/02 12:34:57 UTC
[camel] 03/05: CAMEL-14348 - Camel-AWS Lambda: Add alias operations,
createAlias operation Spring test
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 129a721388fe1d0f47deef9127ec8849e2810111
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Jan 2 13:25:13 2020 +0100
CAMEL-14348 - Camel-AWS Lambda: Add alias operations, createAlias operation Spring test
---
.../aws/lambda/LambdaComponentSpringTest.java | 21 +++++++++++++++++++++
.../lambda/LambdaComponentSpringTest-context.xml | 5 +++++
2 files changed, 26 insertions(+)
diff --git a/components/camel-aws-lambda/src/test/java/org/apache/camel/component/aws/lambda/LambdaComponentSpringTest.java b/components/camel-aws-lambda/src/test/java/org/apache/camel/component/aws/lambda/LambdaComponentSpringTest.java
index 7d9bc23..0ffa06a 100644
--- a/components/camel-aws-lambda/src/test/java/org/apache/camel/component/aws/lambda/LambdaComponentSpringTest.java
+++ b/components/camel-aws-lambda/src/test/java/org/apache/camel/component/aws/lambda/LambdaComponentSpringTest.java
@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import com.amazonaws.services.lambda.model.CreateAliasResult;
import com.amazonaws.services.lambda.model.CreateEventSourceMappingResult;
import com.amazonaws.services.lambda.model.CreateFunctionResult;
import com.amazonaws.services.lambda.model.DeleteEventSourceMappingResult;
@@ -251,6 +252,26 @@ public class LambdaComponentSpringTest extends CamelSpringTestSupport {
assertEquals("GetHelloWithName", result.getVersions().get(0).getFunctionName());
assertEquals("1", result.getVersions().get(0).getVersion());
}
+
+ @Test
+ public void createAliasTest() throws Exception {
+
+ Exchange exchange = template.send("direct:createAlias", ExchangePattern.InOut, new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setHeader(LambdaConstants.FUNCTION_ALIAS_DESCRIPTION, "an alias");
+ exchange.getIn().setHeader(LambdaConstants.FUNCTION_ALIAS_NAME, "alias");
+ exchange.getIn().setHeader(LambdaConstants.FUNCTION_VERSION, "1");
+ }
+ });
+ assertMockEndpointsSatisfied();
+
+ CreateAliasResult result = (CreateAliasResult)exchange.getOut().getBody();
+ assertNotNull(result);
+ assertEquals("an alias", result.getDescription());
+ assertEquals("alias", result.getName());
+ assertEquals("1", result.getFunctionVersion());
+ }
@Override
protected AbstractApplicationContext createApplicationContext() {
diff --git a/components/camel-aws-lambda/src/test/resources/org/apache/camel/component/aws/lambda/LambdaComponentSpringTest-context.xml b/components/camel-aws-lambda/src/test/resources/org/apache/camel/component/aws/lambda/LambdaComponentSpringTest-context.xml
index 0e5598c..49d9bf6 100644
--- a/components/camel-aws-lambda/src/test/resources/org/apache/camel/component/aws/lambda/LambdaComponentSpringTest-context.xml
+++ b/components/camel-aws-lambda/src/test/resources/org/apache/camel/component/aws/lambda/LambdaComponentSpringTest-context.xml
@@ -89,6 +89,11 @@
<from uri="direct:listVersions"/>
<to uri="aws-lambda://GetHelloWithName?awsLambdaClient=#awsLambdaClient&operation=listVersions"/>
</route>
+
+ <route>
+ <from uri="direct:createAlias"/>
+ <to uri="aws-lambda://GetHelloWithName?awsLambdaClient=#awsLambdaClient&operation=createAlias"/>
+ </route>
</camelContext>
<bean id="awsLambdaClient" class="org.apache.camel.component.aws.lambda.AmazonLambdaClientMock"/>