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 14:10:25 UTC

[camel] branch master updated (e9e3681 -> 15c07da)

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 e9e3681  Regen docs
     new 85b7f35  CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, S3 component
     new 98e2d88  Camel-AWS2-S3: Fixed CS
     new 15c07da  Camel-AWS2-S3: No need to specify client as endpoint option in IT test, since it's already bind in the registry

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:
 .../camel/component/aws2/s3/AWS2S3Component.java   | 23 +++++++++++++++++-----
 .../S3CopyObjectOperationIntegrationTest.java      |  2 +-
 .../S3DeleteBucketOperationIntegrationTest.java    |  2 +-
 .../S3ListObjectsOperationIntegrationTest.java     |  2 +-
 .../S3ObjectRangeOperationIntegrationTest.java     |  2 +-
 5 files changed, 22 insertions(+), 9 deletions(-)


[camel] 01/03: CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, S3 component

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 85b7f35963914f36a63e6419ef3eccbf3b6db56e
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 10 15:04:33 2020 +0100

    CAMEL-14690 - Camel-AWS2: Better logging when checking client instance in the registry, S3 component
---
 .../camel/component/aws2/s3/AWS2S3Component.java   | 24 +++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Component.java b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Component.java
index 87fb256..0f15d3b 100644
--- a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Component.java
+++ b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Component.java
@@ -24,10 +24,16 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import software.amazon.awssdk.services.s3.S3Client;
 
 @Component("aws2-s3")
 public class AWS2S3Component extends DefaultComponent {
+    
+    private static final Logger LOG = LoggerFactory.getLogger(AWS2S3Component.class);
 
     @Metadata
     private AWS2S3Configuration configuration = new AWS2S3Configuration();
@@ -55,7 +61,7 @@ public class AWS2S3Component extends DefaultComponent {
         configuration.setBucketName(remaining);
         AWS2S3Endpoint endpoint = new AWS2S3Endpoint(uri, this, configuration);
         setProperties(endpoint, parameters);
-        checkAndSetRegistryClient(configuration);
+        checkAndSetRegistryClient(configuration, endpoint);
         if (!configuration.isUseIAMCredentials() && configuration.getAmazonS3Client() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
             throw new IllegalArgumentException("useIAMCredentials is set to false, AmazonS3Client or accessKey and secretKey must be specified");
         }
@@ -74,10 +80,18 @@ public class AWS2S3Component extends DefaultComponent {
         this.configuration = configuration;
     }
 
-    private void checkAndSetRegistryClient(AWS2S3Configuration configuration) {
-        Set<S3Client> clients = getCamelContext().getRegistry().findByType(S3Client.class);
-        if (clients.size() == 1) {
-            configuration.setAmazonS3Client(clients.stream().findFirst().get());
+    private void checkAndSetRegistryClient(AWS2S3Configuration configuration, AWS2S3Endpoint endpoint) {
+        if (ObjectHelper.isEmpty(endpoint.getConfiguration().getAmazonS3Client())) {
+            LOG.debug("Looking for an S3Client instance in the registry");
+            Set<S3Client> clients = getCamelContext().getRegistry().findByType(S3Client.class);
+            if (clients.size() == 1) {
+                LOG.debug("Found exactly one S3Client instance in the registry");
+                configuration.setAmazonS3Client(clients.stream().findFirst().get());
+            } else {
+                LOG.debug("No S3Client instance in the registry");
+            }
+        } else {
+            LOG.debug("S3Client instance is already set at endpoint level: skipping the check in the registry");
         }
     }
 }


[camel] 03/03: Camel-AWS2-S3: No need to specify client as endpoint option in IT test, since it's already bind in the registry

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 15c07dafc25be2ec73afc7277e5d0afabda46bad
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 10 15:08:10 2020 +0100

    Camel-AWS2-S3: No need to specify client as endpoint option in IT test, since it's already bind in the registry
---
 .../aws2/s3/integration/S3CopyObjectOperationIntegrationTest.java       | 2 +-
 .../aws2/s3/integration/S3DeleteBucketOperationIntegrationTest.java     | 2 +-
 .../aws2/s3/integration/S3ListObjectsOperationIntegrationTest.java      | 2 +-
 .../aws2/s3/integration/S3ObjectRangeOperationIntegrationTest.java      | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectOperationIntegrationTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectOperationIntegrationTest.java
index 3b83e51..a2bd8a5 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectOperationIntegrationTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectOperationIntegrationTest.java
@@ -78,7 +78,7 @@ public class S3CopyObjectOperationIntegrationTest extends CamelTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                String awsEndpoint = "aws2-s3://mycamel?amazonS3Client=#amazonS3Client&autoCreateBucket=false";
+                String awsEndpoint = "aws2-s3://mycamel?autoCreateBucket=false";
               
                 from("direct:putObject").to(awsEndpoint);
                 
diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3DeleteBucketOperationIntegrationTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3DeleteBucketOperationIntegrationTest.java
index f6c11d2..71191c2 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3DeleteBucketOperationIntegrationTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3DeleteBucketOperationIntegrationTest.java
@@ -75,7 +75,7 @@ public class S3DeleteBucketOperationIntegrationTest extends CamelTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                String awsEndpoint = "aws2-s3://mycamel2?amazonS3Client=#amazonS3Client&autoCreateBucket=true";
+                String awsEndpoint = "aws2-s3://mycamel2?autoCreateBucket=true";
               
                 from("direct:listBucket").to(awsEndpoint);
                 
diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ListObjectsOperationIntegrationTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ListObjectsOperationIntegrationTest.java
index b712ede..ea67658 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ListObjectsOperationIntegrationTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ListObjectsOperationIntegrationTest.java
@@ -107,7 +107,7 @@ public class S3ListObjectsOperationIntegrationTest extends CamelTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                String awsEndpoint = "aws2-s3://mycamel2?amazonS3Client=#amazonS3Client&autoCreateBucket=true";
+                String awsEndpoint = "aws2-s3://mycamel2?autoCreateBucket=true";
               
                 from("direct:listBucket").to(awsEndpoint);
                 
diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ObjectRangeOperationIntegrationTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ObjectRangeOperationIntegrationTest.java
index 19e9a8e..cb4bf71 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ObjectRangeOperationIntegrationTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ObjectRangeOperationIntegrationTest.java
@@ -79,7 +79,7 @@ public class S3ObjectRangeOperationIntegrationTest extends CamelTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                String awsEndpoint = "aws2-s3://mycamelbucket?amazonS3Client=#amazonS3Client&operation=getObjectRange&autoCreateBucket=false";
+                String awsEndpoint = "aws2-s3://mycamelbucket?operation=getObjectRange&autoCreateBucket=false";
 
                 from("direct:getObjectRange").to(awsEndpoint).process(new Processor() {
 


[camel] 02/03: Camel-AWS2-S3: 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 98e2d886f1431c4f7bc2b46508e696edc3560e6f
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 10 15:05:35 2020 +0100

    Camel-AWS2-S3: Fixed CS
---
 .../main/java/org/apache/camel/component/aws2/s3/AWS2S3Component.java    | 1 -
 1 file changed, 1 deletion(-)

diff --git a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Component.java b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Component.java
index 0f15d3b..a6cdbac 100644
--- a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Component.java
+++ b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Component.java
@@ -27,7 +27,6 @@ import org.apache.camel.support.DefaultComponent;
 import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import software.amazon.awssdk.services.s3.S3Client;
 
 @Component("aws2-s3")