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/03/10 15:59:04 UTC
[camel] branch master updated (0b72810 -> f4704f4)
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 0b72810 CAMEL-11807: Migrated camel-mustache tests to JUnit 5
new d8a51ce Camel-AWS2-Lambda: Better integration tests
new f4704f4 Camel-AWS2-Lambda: Back to info logging level
The 2 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:
.../LambdaComponentIntegrationTest.java | 73 ++--------------------
1 file changed, 6 insertions(+), 67 deletions(-)
[camel] 01/02: Camel-AWS2-Lambda: Better integration tests
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 d8a51ce95684c7e67f821ff9d255055015590feb
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 10 16:56:49 2020 +0100
Camel-AWS2-Lambda: Better integration tests
---
.../LambdaComponentIntegrationTest.java | 73 ++--------------------
.../src/test/resources/log4j2.properties | 2 +-
2 files changed, 7 insertions(+), 68 deletions(-)
diff --git a/components/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/integration/LambdaComponentIntegrationTest.java b/components/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/integration/LambdaComponentIntegrationTest.java
index 2322ca7..26075e3 100644
--- a/components/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/integration/LambdaComponentIntegrationTest.java
+++ b/components/camel-aws2-lambda/src/test/java/org/apache/camel/component/aws2/lambda/integration/LambdaComponentIntegrationTest.java
@@ -16,21 +16,16 @@
*/
package org.apache.camel.component.aws2.lambda.integration;
-import java.io.*;
-
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.aws2.lambda.Lambda2Constants;
import org.apache.camel.test.junit5.CamelTestSupport;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-import software.amazon.awssdk.core.SdkBytes;
-import software.amazon.awssdk.services.lambda.model.CreateFunctionResponse;
-import software.amazon.awssdk.services.lambda.model.DeleteFunctionResponse;
import software.amazon.awssdk.services.lambda.model.GetFunctionResponse;
import software.amazon.awssdk.services.lambda.model.ListFunctionsResponse;
+import software.amazon.awssdk.services.lambda.model.Runtime;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -39,27 +34,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
public class LambdaComponentIntegrationTest extends CamelTestSupport {
@Test
- public void lambdaCreateFunctionTest() throws Exception {
- Exchange exchange = template.send("direct:createFunction", ExchangePattern.InOut, new Processor() {
-
- @Override
- public void process(Exchange exchange) throws Exception {
- exchange.getIn().setHeader(Lambda2Constants.RUNTIME, "nodejs6.10");
- exchange.getIn().setHeader(Lambda2Constants.HANDLER, "GetHelloWithName.handler");
- exchange.getIn().setHeader(Lambda2Constants.DESCRIPTION, "Hello with node.js on Lambda");
- exchange.getIn().setHeader(Lambda2Constants.ROLE, "arn:aws:iam::643534317684:role/lambda-execution-role");
-
- ClassLoader classLoader = getClass().getClassLoader();
- File file = new File(classLoader.getResource("org/apache/camel/component/aws/lambda/function/node/GetHelloWithName.zip").getFile());
- FileInputStream inputStream = new FileInputStream(file);
- exchange.getIn().setBody(SdkBytes.fromInputStream(inputStream));
- }
- });
- assertNotNull(exchange.getMessage().getBody(CreateFunctionResponse.class));
- assertEquals(exchange.getMessage().getBody(CreateFunctionResponse.class).functionName(), "GetHelloWithName");
- }
-
- @Test
public void lambdaListFunctionsTest() throws Exception {
Exchange exchange = template.send("direct:listFunctions", ExchangePattern.InOut, new Processor() {
@@ -69,7 +43,7 @@ public class LambdaComponentIntegrationTest extends CamelTestSupport {
}
});
assertNotNull(exchange.getMessage().getBody(ListFunctionsResponse.class));
- assertEquals(exchange.getMessage().getBody(ListFunctionsResponse.class).functions().size(), 3);
+ assertEquals(exchange.getMessage().getBody(ListFunctionsResponse.class).functions().size(), 2);
}
@Test
@@ -83,57 +57,22 @@ public class LambdaComponentIntegrationTest extends CamelTestSupport {
});
GetFunctionResponse result = exchange.getMessage().getBody(GetFunctionResponse.class);
assertNotNull(result);
- assertEquals(result.configuration().functionName(), "GetHelloWithName");
- assertEquals(result.configuration().runtime(), "nodejs6.10");
+ assertEquals(result.configuration().functionName(), "twitterTrends");
+ assertEquals(result.configuration().runtime(), Runtime.JAVA8);
}
- @Test
- public void lambdaInvokeFunctionTest() throws Exception {
- Exchange exchange = template.send("direct:invokeFunction", ExchangePattern.InOut, new Processor() {
-
- @Override
- public void process(Exchange exchange) throws Exception {
- exchange.getIn().setBody("{\"name\":\"Camel\"}");
- }
- });
-
- assertNotNull(exchange.getMessage().getBody(String.class));
- assertEquals(exchange.getMessage().getBody(String.class), "{\"Hello\":\"Camel\"}");
- }
-
- @Test
- public void lambdaDeleteFunctionTest() throws Exception {
-
- Exchange exchange = template.send("direct:deleteFunction", ExchangePattern.InOut, new Processor() {
-
- @Override
- public void process(Exchange exchange) throws Exception {
- }
- });
- assertNotNull(exchange.getMessage().getBody(DeleteFunctionResponse.class));
- }
-
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("direct:createFunction")
- .to("aws2-lambda://GetHelloWithName?operation=createFunction&accessKey=xxxx&secretKey=xxxx&awsLambdaEndpoint=lambda.eu-central-1.amazonaws.com");
-
from("direct:listFunctions")
- .to("aws2-lambda://myFunction?operation=listFunctions&accessKey=xxxx&secretKey=xxxx&awsLambdaEndpoint=lambda.eu-central-1.amazonaws.com");
+ .to("aws2-lambda://myFunction?operation=listFunctions&accessKey=xxx&secretKey=yyy®ion=eu-west-1");
from("direct:getFunction")
- .to("aws2-lambda://GetHelloWithName?operation=getFunction&accessKey=xxxx&secretKey=xxxx&awsLambdaEndpoint=lambda.eu-central-1.amazonaws.com");
-
- from("direct:invokeFunction")
- .to("aws2-lambda://GetHelloWithName?operation=invokeFunction&accessKey=xxxx&secretKey=xxxx&awsLambdaEndpoint=lambda.eu-central-1.amazonaws.com");
-
- from("direct:deleteFunction")
- .to("aws2-lambda://GetHelloWithName?operation=deleteFunction&accessKey=xxxx&secretKey=xxxx&awsLambdaEndpoint=lambda.eu-central-1.amazonaws.com");
+ .to("aws2-lambda://twitterTrends?operation=getFunction&accessKey=xxx&secretKey=yyy®ion=eu-west-1");
}
};
diff --git a/components/camel-aws2-lambda/src/test/resources/log4j2.properties b/components/camel-aws2-lambda/src/test/resources/log4j2.properties
index 72c73f6..81167e1 100644
--- a/components/camel-aws2-lambda/src/test/resources/log4j2.properties
+++ b/components/camel-aws2-lambda/src/test/resources/log4j2.properties
@@ -24,5 +24,5 @@ appender.out.type = Console
appender.out.name = out
appender.out.layout.type = PatternLayout
appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
-rootLogger.level = INFO
+rootLogger.level = DEBUG
rootLogger.appenderRef.file.ref = file
[camel] 02/02: Camel-AWS2-Lambda: Back to info logging level
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 f4704f4542af31a19394745b89f49d978b44247f
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 10 16:57:15 2020 +0100
Camel-AWS2-Lambda: Back to info logging level
---
components/camel-aws2-lambda/src/test/resources/log4j2.properties | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/camel-aws2-lambda/src/test/resources/log4j2.properties b/components/camel-aws2-lambda/src/test/resources/log4j2.properties
index 81167e1..72c73f6 100644
--- a/components/camel-aws2-lambda/src/test/resources/log4j2.properties
+++ b/components/camel-aws2-lambda/src/test/resources/log4j2.properties
@@ -24,5 +24,5 @@ appender.out.type = Console
appender.out.name = out
appender.out.layout.type = PatternLayout
appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
-rootLogger.level = DEBUG
+rootLogger.level = INFO
rootLogger.appenderRef.file.ref = file