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 2021/03/30 07:33:35 UTC

[camel] branch master updated (0f98350 -> 04ce039)

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

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 0f98350  Fixed CS
     new 010e3ea  Camel-AWS2-Lambda: Producer operations refactoring - listFunctions
     new 2ef7b4b  Camel-AWS2-Lambda: Producer operations refactoring - listFunctions
     new 04ce039  Fixed CS

The 3 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:
 .../component/aws2/lambda/Lambda2Producer.java     | 34 +++++++++-------------
 .../aws2/lambda/AmazonLambdaClientMock.java        | 24 +++++++++++++++
 2 files changed, 37 insertions(+), 21 deletions(-)

[camel] 03/03: Fixed CS

Posted by ac...@apache.org.
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 04ce039d0813d89108ed6bf9a9ac0614d2077f19
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 30 09:29:25 2021 +0200

    Fixed CS
---
 .../org/apache/camel/component/aws2/lambda/AmazonLambdaClientMock.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/AmazonLambdaClientMock.java b/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/AmazonLambdaClientMock.java
index 35d06bf..ba22654 100644
--- a/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/AmazonLambdaClientMock.java
+++ b/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/AmazonLambdaClientMock.java
@@ -227,7 +227,7 @@ public class AmazonLambdaClientMock implements LambdaClient {
         result.functions(listFunctions);
         return result.build();
     }
-    
+
     @Override
     public ListFunctionsResponse listFunctions(ListFunctionsRequest request) {
 
@@ -251,7 +251,6 @@ public class AmazonLambdaClientMock implements LambdaClient {
         return result.build();
     }
 
-
     @Override
     public ListTagsResponse listTags(ListTagsRequest listTagsRequest) {
         ListTagsResponse.Builder result = ListTagsResponse.builder();

[camel] 01/03: Camel-AWS2-Lambda: Producer operations refactoring - listFunctions

Posted by ac...@apache.org.
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 010e3ea11473593102d5dcd5bc0759c4466f7142
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 30 09:22:42 2021 +0200

    Camel-AWS2-Lambda: Producer operations refactoring - listFunctions
---
 .../component/aws2/lambda/Lambda2Producer.java     | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
index 1c56c32..29f5ff4 100644
--- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
+++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
@@ -194,30 +194,22 @@ public class Lambda2Producer extends DefaultProducer {
     }
 
     private void listFunctions(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {
+    	ListFunctionsRequest request = null;
+    	ListFunctionsResponse result;
         if (getConfiguration().isPojoRequest()) {
-            Object payload = exchange.getIn().getMandatoryBody();
-            if (payload instanceof ListFunctionsRequest) {
-                ListFunctionsResponse result;
-                try {
-                    result = lambdaClient.listFunctions((ListFunctionsRequest) payload);
-                } catch (AwsServiceException ase) {
-                    LOG.trace("listFunctions command returned the error code {}", ase.awsErrorDetails().errorCode());
-                    throw ase;
-                }
-                Message message = getMessageForResponse(exchange);
-                message.setBody(result);
-            }
+            request = exchange.getIn().getMandatoryBody(ListFunctionsRequest.class);
         } else {
-            ListFunctionsResponse result;
+            ListFunctionsRequest.Builder builder = ListFunctionsRequest.builder();
+            request = builder.build();
+        }
             try {
-                result = lambdaClient.listFunctions();
+                result = lambdaClient.listFunctions(request);
             } catch (AwsServiceException ase) {
                 LOG.trace("listFunctions command returned the error code {}", ase.awsErrorDetails().errorCode());
                 throw ase;
             }
             Message message = getMessageForResponse(exchange);
             message.setBody(result);
-        }
     }
 
     private void invokeFunction(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {

[camel] 02/03: Camel-AWS2-Lambda: Producer operations refactoring - listFunctions

Posted by ac...@apache.org.
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 2ef7b4be486971f722e60979bde6253c0004dee2
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 30 09:26:51 2021 +0200

    Camel-AWS2-Lambda: Producer operations refactoring - listFunctions
---
 .../component/aws2/lambda/Lambda2Producer.java     | 20 ++++++++---------
 .../aws2/lambda/AmazonLambdaClientMock.java        | 25 ++++++++++++++++++++++
 2 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
index 29f5ff4..55054ea 100644
--- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
+++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java
@@ -194,22 +194,22 @@ public class Lambda2Producer extends DefaultProducer {
     }
 
     private void listFunctions(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {
-    	ListFunctionsRequest request = null;
-    	ListFunctionsResponse result;
+        ListFunctionsRequest request = null;
+        ListFunctionsResponse result;
         if (getConfiguration().isPojoRequest()) {
             request = exchange.getIn().getMandatoryBody(ListFunctionsRequest.class);
         } else {
             ListFunctionsRequest.Builder builder = ListFunctionsRequest.builder();
             request = builder.build();
         }
-            try {
-                result = lambdaClient.listFunctions(request);
-            } catch (AwsServiceException ase) {
-                LOG.trace("listFunctions command returned the error code {}", ase.awsErrorDetails().errorCode());
-                throw ase;
-            }
-            Message message = getMessageForResponse(exchange);
-            message.setBody(result);
+        try {
+            result = lambdaClient.listFunctions(request);
+        } catch (AwsServiceException ase) {
+            LOG.trace("listFunctions command returned the error code {}", ase.awsErrorDetails().errorCode());
+            throw ase;
+        }
+        Message message = getMessageForResponse(exchange);
+        message.setBody(result);
     }
 
     private void invokeFunction(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {
diff --git a/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/AmazonLambdaClientMock.java b/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/AmazonLambdaClientMock.java
index 93ff50e..35d06bf 100644
--- a/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/AmazonLambdaClientMock.java
+++ b/components/camel-aws/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/AmazonLambdaClientMock.java
@@ -53,6 +53,7 @@ import software.amazon.awssdk.services.lambda.model.ListAliasesRequest;
 import software.amazon.awssdk.services.lambda.model.ListAliasesResponse;
 import software.amazon.awssdk.services.lambda.model.ListEventSourceMappingsRequest;
 import software.amazon.awssdk.services.lambda.model.ListEventSourceMappingsResponse;
+import software.amazon.awssdk.services.lambda.model.ListFunctionsRequest;
 import software.amazon.awssdk.services.lambda.model.ListFunctionsResponse;
 import software.amazon.awssdk.services.lambda.model.ListTagsRequest;
 import software.amazon.awssdk.services.lambda.model.ListTagsResponse;
@@ -226,6 +227,30 @@ public class AmazonLambdaClientMock implements LambdaClient {
         result.functions(listFunctions);
         return result.build();
     }
+    
+    @Override
+    public ListFunctionsResponse listFunctions(ListFunctionsRequest request) {
+
+        ListFunctionsResponse.Builder result = ListFunctionsResponse.builder();
+        Collection<FunctionConfiguration> listFunctions = new ArrayList<>();
+        FunctionConfiguration.Builder configuration = FunctionConfiguration.builder();
+        configuration.functionName("GetHelloWithName");
+        configuration.functionArn("arn:aws:lambda:eu-central-1:643534317684:function:GetHelloWithName");
+        configuration.runtime("nodejs6.10");
+        configuration.role("arn:aws:iam::643534317684:role/lambda-execution-role");
+        configuration.handler("GetHelloWithName.handler");
+        configuration.codeSize(640L);
+        configuration.codeSha256("PKt5ygvZ6G8vWJASlWIypsBmKzAdmRrvTO/eBH06mBA=");
+        configuration.memorySize(128);
+        configuration.timeout(3);
+        configuration.lastModified(Instant.now().toString());
+        configuration.version("$LATEST");
+        configuration.tracingConfig(TracingConfigResponse.builder().mode(TracingMode.PASS_THROUGH).build());
+        listFunctions.add(configuration.build());
+        result.functions(listFunctions);
+        return result.build();
+    }
+
 
     @Override
     public ListTagsResponse listTags(ListTagsRequest listTagsRequest) {