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 14:24:29 UTC

[camel] 03/05: CAMEL-14348 - Camel-AWS Lambda: Add alias operations, deleteAlias 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 5c6202d70c69739fa74542cd82ad04e46cc15472
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Jan 2 15:11:48 2020 +0100

    CAMEL-14348 - Camel-AWS Lambda: Add alias operations, deleteAlias operation Spring test
---
 .../component/aws/lambda/LambdaComponentSpringTest.java  | 16 ++++++++++++++++
 .../aws/lambda/LambdaComponentSpringTest-context.xml     |  5 +++++
 2 files changed, 21 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 0ffa06a..9d957f9 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
@@ -25,6 +25,7 @@ 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.DeleteAliasResult;
 import com.amazonaws.services.lambda.model.DeleteEventSourceMappingResult;
 import com.amazonaws.services.lambda.model.DeleteFunctionResult;
 import com.amazonaws.services.lambda.model.GetFunctionResult;
@@ -272,6 +273,21 @@ public class LambdaComponentSpringTest extends CamelSpringTestSupport {
         assertEquals("alias", result.getName());
         assertEquals("1", result.getFunctionVersion());
     }
+    
+    @Test
+    public void deleteAliasTest() throws Exception {
+
+        Exchange exchange = template.send("direct:deleteAlias", ExchangePattern.InOut, new Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(LambdaConstants.FUNCTION_ALIAS_NAME, "alias");
+            }
+        });
+        assertMockEndpointsSatisfied();
+
+        DeleteAliasResult result = (DeleteAliasResult)exchange.getOut().getBody();
+        assertNotNull(result);
+    }
 
     @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 49d9bf6..fae3f3f 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
@@ -94,6 +94,11 @@
             <from uri="direct:createAlias"/>
             <to uri="aws-lambda://GetHelloWithName?awsLambdaClient=#awsLambdaClient&amp;operation=createAlias"/>
         </route>
+        
+        <route>
+            <from uri="direct:deleteAlias"/>
+            <to uri="aws-lambda://GetHelloWithName?awsLambdaClient=#awsLambdaClient&amp;operation=deleteAlias"/>
+        </route>
     </camelContext>
 
     <bean id="awsLambdaClient" class="org.apache.camel.component.aws.lambda.AmazonLambdaClientMock"/>