camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [camel] branch master updated: Use the AWSKMS interface for our AWS Lambda client mock
Date Fri, 02 Mar 2018 08:49:36 GMT
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


The following commit(s) were added to refs/heads/master by this push:
     new c76760e  Use the AWSKMS interface for our AWS Lambda client mock
c76760e is described below

commit c76760e06ce79967447e30b22ca10d36d53306e6
Author: Andrea Cosentino <ancosen@gmail.com>
AuthorDate: Fri Mar 2 09:48:38 2018 +0100

    Use the AWSKMS interface for our AWS Lambda client mock
---
 .../aws/lambda/AmazonLambdaClientMock.java         | 46 +++++++++++++++++-----
 .../component/aws/lambda/LambdaProducerTest.java   |  2 +-
 2 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/lambda/AmazonLambdaClientMock.java
b/components/camel-aws/src/test/java/org/apache/camel/component/aws/lambda/AmazonLambdaClientMock.java
index d9ec9c6..d7599de 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/lambda/AmazonLambdaClientMock.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/lambda/AmazonLambdaClientMock.java
@@ -22,8 +22,8 @@ import java.util.*;
 import com.amazonaws.AmazonServiceException;
 import com.amazonaws.AmazonWebServiceRequest;
 import com.amazonaws.ResponseMetadata;
-import com.amazonaws.auth.BasicAWSCredentials;
-import com.amazonaws.services.lambda.AWSLambdaClient;
+import com.amazonaws.regions.Region;
+import com.amazonaws.services.lambda.AWSLambda;
 import com.amazonaws.services.lambda.model.AddPermissionRequest;
 import com.amazonaws.services.lambda.model.AddPermissionResult;
 import com.amazonaws.services.lambda.model.CreateAliasRequest;
@@ -36,6 +36,8 @@ import com.amazonaws.services.lambda.model.DeleteAliasRequest;
 import com.amazonaws.services.lambda.model.DeleteAliasResult;
 import com.amazonaws.services.lambda.model.DeleteEventSourceMappingRequest;
 import com.amazonaws.services.lambda.model.DeleteEventSourceMappingResult;
+import com.amazonaws.services.lambda.model.DeleteFunctionConcurrencyRequest;
+import com.amazonaws.services.lambda.model.DeleteFunctionConcurrencyResult;
 import com.amazonaws.services.lambda.model.DeleteFunctionRequest;
 import com.amazonaws.services.lambda.model.DeleteFunctionResult;
 import com.amazonaws.services.lambda.model.FunctionConfiguration;
@@ -67,6 +69,8 @@ import com.amazonaws.services.lambda.model.ListVersionsByFunctionRequest;
 import com.amazonaws.services.lambda.model.ListVersionsByFunctionResult;
 import com.amazonaws.services.lambda.model.PublishVersionRequest;
 import com.amazonaws.services.lambda.model.PublishVersionResult;
+import com.amazonaws.services.lambda.model.PutFunctionConcurrencyRequest;
+import com.amazonaws.services.lambda.model.PutFunctionConcurrencyResult;
 import com.amazonaws.services.lambda.model.RemovePermissionRequest;
 import com.amazonaws.services.lambda.model.RemovePermissionResult;
 import com.amazonaws.services.lambda.model.Runtime;
@@ -88,10 +92,10 @@ import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.joda.time.DateTime;
 
-public class AmazonLambdaClientMock extends AWSLambdaClient {
+public class AmazonLambdaClientMock implements AWSLambda {
 
     public AmazonLambdaClientMock() {
-        super(new BasicAWSCredentials("user", "secret"));
+        super();
     }
 
 
@@ -220,11 +224,6 @@ public class AmazonLambdaClientMock extends AWSLambdaClient {
     }
 
     @Override
-    public InvokeAsyncResult invokeAsync(InvokeAsyncRequest invokeAsyncRequest) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
     public ListAliasesResult listAliases(ListAliasesRequest listAliasesRequest) {
         throw new UnsupportedOperationException();
     }
@@ -328,9 +327,36 @@ public class AmazonLambdaClientMock extends AWSLambdaClient {
         throw new UnsupportedOperationException();
     }
 
-
     @Override
     public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest amazonWebServiceRequest)
{
         throw new UnsupportedOperationException();
     }
+
+    @Override
+    public void setEndpoint(String endpoint) {   
+    }
+
+    @Override
+    public void setRegion(Region region) {
+    }
+
+    @Override
+    public DeleteFunctionConcurrencyResult deleteFunctionConcurrency(DeleteFunctionConcurrencyRequest
deleteFunctionConcurrencyRequest) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public InvokeAsyncResult invokeAsync(InvokeAsyncRequest invokeAsyncRequest) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public PutFunctionConcurrencyResult putFunctionConcurrency(PutFunctionConcurrencyRequest
putFunctionConcurrencyRequest) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void shutdown() {
+        throw new UnsupportedOperationException();        
+    }
 }
\ No newline at end of file
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/lambda/LambdaProducerTest.java
b/components/camel-aws/src/test/java/org/apache/camel/component/aws/lambda/LambdaProducerTest.java
index 131767f..0ee2029 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/lambda/LambdaProducerTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/lambda/LambdaProducerTest.java
@@ -159,7 +159,7 @@ public class LambdaProducerTest extends CamelTestSupport {
     protected JndiRegistry createRegistry() throws Exception {
         JndiRegistry registry = super.createRegistry();
 
-        AWSLambdaClient clientMock = new AmazonLambdaClientMock();
+        AmazonLambdaClientMock clientMock = new AmazonLambdaClientMock();
 
         registry.bind("awsLambdaClient", clientMock);
 

-- 
To stop receiving notification emails like this one, please contact
acosentino@apache.org.

Mime
View raw message