You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by fm...@apache.org on 2023/12/05 16:09:31 UTC

(camel) branch main updated: Fix S3 manual tests

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

fmariani pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 79b2c840ba9 Fix S3 manual tests
79b2c840ba9 is described below

commit 79b2c840ba98675d3f35636fc88f414d8d60f291
Author: Croway <fe...@gmail.com>
AuthorDate: Tue Dec 5 14:51:59 2023 +0100

    Fix S3 manual tests
---
 .../aws2/s3/integration/S3ComponentManualIT.java        | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ComponentManualIT.java b/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ComponentManualIT.java
index 23ab66bec17..67939edfc99 100644
--- a/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ComponentManualIT.java
+++ b/components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ComponentManualIT.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.aws2.s3.integration;
 
+import org.apache.camel.BindToRegistry;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
@@ -29,18 +30,23 @@ import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.condition.EnabledIfSystemProperties;
 import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
+import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
+import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
+import software.amazon.awssdk.regions.Region;
+import software.amazon.awssdk.services.s3.S3Client;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-// Must be manually tested. Provide your own accessKey and secretKey using -Daws.access.key and -Daws.secret.key
 @EnabledIfSystemProperties({
         @EnabledIfSystemProperty(named = "aws.manual.access.key", matches = ".*", disabledReason = "Access key not provided"),
         @EnabledIfSystemProperty(named = "aws.manual.secret.key", matches = ".*", disabledReason = "Secret key not provided")
 })
 public class S3ComponentManualIT extends CamelTestSupport {
+    private static final String ACCESS_KEY = System.getProperty("aws.manual.access.key");
+    private static final String SECRET_KEY = System.getProperty("aws.manual.secret.key");
 
     @EndpointInject("direct:start")
     private ProducerTemplate template;
@@ -48,6 +54,13 @@ public class S3ComponentManualIT extends CamelTestSupport {
     @EndpointInject("mock:result")
     private MockEndpoint result;
 
+    @BindToRegistry("amazonS3Client")
+    S3Client client
+            = S3Client.builder()
+                    .credentialsProvider(StaticCredentialsProvider.create(
+                            AwsBasicCredentials.create(ACCESS_KEY, SECRET_KEY)))
+                    .region(Region.EU_WEST_1).build();
+
     @Test
     public void sendInOnly() throws Exception {
         result.expectedMessageCount(2);
@@ -121,7 +134,7 @@ public class S3ComponentManualIT extends CamelTestSupport {
             @Override
             public void configure() {
                 String s3EndpointUri
-                        = "aws2-s3://mycamelbucket?accessKey={{aws.access.key}}&secretKey={{aws.secret.key}}&region=us-west-1&autoCreateBucket=false";
+                        = "aws2-s3://mycamelbucket?autoCreateBucket=true";
 
                 from("direct:start").to(s3EndpointUri);