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/02/12 14:07:20 UTC

[camel] 03/03: CAMEL-16189 - AWS2S3Producer not setting serverside encryption values, improved the test with a getObject

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

acosentino pushed a commit to branch CAMEL-16189
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0f773e5fe248b385901ea727447a12fe60f92978
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Feb 12 15:05:06 2021 +0100

    CAMEL-16189 - AWS2S3Producer not setting serverside encryption values, improved the test with a getObject
---
 .../S3SimpleEncryptedUploadOperationLocalstackTest.java | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/localstack/S3SimpleEncryptedUploadOperationLocalstackTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/localstack/S3SimpleEncryptedUploadOperationLocalstackTest.java
index e0e03e7..2625e16 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/localstack/S3SimpleEncryptedUploadOperationLocalstackTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/localstack/S3SimpleEncryptedUploadOperationLocalstackTest.java
@@ -39,9 +39,13 @@ public class S3SimpleEncryptedUploadOperationLocalstackTest extends Aws2S3BaseTe
     @EndpointInject("mock:result")
     private MockEndpoint result;
 
+    @EndpointInject("mock:resultGet")
+    private MockEndpoint resultGet;
+
     @Test
     public void sendIn() throws Exception {
         result.expectedMessageCount(1);
+        resultGet.expectedMessageCount(1);
 
         template.send("direct:putObject", new Processor() {
 
@@ -61,10 +65,21 @@ public class S3SimpleEncryptedUploadOperationLocalstackTest extends Aws2S3BaseTe
             }
         });
 
+        Exchange c = template.request("direct:getObject", new Processor() {
+
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(AWS2S3Constants.KEY, "camel.txt");
+                exchange.getIn().setHeader(AWS2S3Constants.S3_OPERATION, AWS2S3Operations.getObject);
+            }
+        });
+
         List<S3Object> resp = result.getExchanges().get(0).getMessage().getBody(List.class);
         assertEquals(1, resp.size());
         assertEquals("camel.txt", resp.get(0).key());
 
+        assertEquals("Camel rocks!", c.getIn().getBody(String.class));
+
         assertMockEndpointsSatisfied();
     }
 
@@ -80,6 +95,8 @@ public class S3SimpleEncryptedUploadOperationLocalstackTest extends Aws2S3BaseTe
 
                 from("direct:listObjects").to(awsEndpoint).to("mock:result");
 
+                from("direct:getObject").to("aws2-s3://mycamel?autoCreateBucket=true").to("mock:resultGet");
+
             }
         };
     }