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 2018/02/07 09:45:04 UTC

[camel] 07/10: CAMEL-12234 - Camel-AWS: Since we are using builders, we need to remove the AWS endpoint options on the components that are using them - AWS SES

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 6e1b92642e64e5cddc1470edef97edf134454696
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Feb 7 10:17:59 2018 +0100

    CAMEL-12234 - Camel-AWS: Since we are using builders, we need to remove the AWS endpoint options on the components that are using them - AWS SES
---
 components/camel-aws/src/main/docs/aws-ses-component.adoc   |  5 ++---
 .../apache/camel/component/aws/ses/SesConfiguration.java    | 13 -------------
 .../org/apache/camel/component/aws/ses/SesEndpoint.java     | 10 +++-------
 .../component/aws/ses/SesComponentConfigurationTest.java    |  6 +-----
 .../aws/ses/springboot/SesComponentConfiguration.java       | 12 ------------
 5 files changed, 6 insertions(+), 40 deletions(-)

diff --git a/components/camel-aws/src/main/docs/aws-ses-component.adoc b/components/camel-aws/src/main/docs/aws-ses-component.adoc
index d6c5631..bd0e52c 100644
--- a/components/camel-aws/src/main/docs/aws-ses-component.adoc
+++ b/components/camel-aws/src/main/docs/aws-ses-component.adoc
@@ -61,13 +61,12 @@ with the following path and query parameters:
 | *from* | *Required* The sender's email address. |  | String
 |===
 
-==== Query Parameters (12 parameters):
+==== Query Parameters (11 parameters):
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
 | *amazonSESClient* (producer) | To use the AmazonSimpleEmailService as the client |  | AmazonSimpleEmail Service
-| *amazonSESEndpoint* (producer) | The region with which the AWS-SES client wants to work with. |  | String
 | *proxyHost* (producer) | To define a proxy host when instantiating the SES client |  | String
 | *proxyPort* (producer) | To define a proxy port when instantiating the SES client |  | Integer
 | *region* (producer) | The region in which SES client needs to work |  | String
@@ -172,4 +171,4 @@ where `${camel-version`} must be replaced by the actual version of Camel
 * link:endpoint.html[Endpoint]
 * link:getting-started.html[Getting Started]
 
-* link:aws.html[AWS Component]
\ No newline at end of file
+* link:aws.html[AWS Component]
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesConfiguration.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesConfiguration.java
index 3616b69..ffc69f3 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesConfiguration.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesConfiguration.java
@@ -39,8 +39,6 @@ public class SesConfiguration implements Cloneable {
     @UriParam(label = "security", secret = true)
     private String secretKey;
     @UriParam
-    private String amazonSESEndpoint;
-    @UriParam
     private String subject;
     @UriParam
     private List<String> to;
@@ -154,17 +152,6 @@ public class SesConfiguration implements Cloneable {
         this.replyToAddresses = Arrays.asList(replyToAddresses.split(","));
     }
     
-    public String getAmazonSESEndpoint() {
-        return amazonSESEndpoint;
-    }
-
-    /**
-     * The region with which the AWS-SES client wants to work with.
-     */
-    public void setAmazonSESEndpoint(String amazonSesEndpoint) {
-        this.amazonSESEndpoint = amazonSesEndpoint;
-    }
-    
     /**
      * To define a proxy host when instantiating the SES client
      */
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesEndpoint.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesEndpoint.java
index f65db60..b4f5dbc 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesEndpoint.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ses/SesEndpoint.java
@@ -22,6 +22,7 @@ import com.amazonaws.auth.AWSCredentialsProvider;
 import com.amazonaws.auth.AWSStaticCredentialsProvider;
 import com.amazonaws.auth.BasicAWSCredentials;
 import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
+import com.amazonaws.regions.Regions;
 import com.amazonaws.services.simpleemail.AmazonSimpleEmailService;
 import com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient;
 import com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClientBuilder;
@@ -63,10 +64,6 @@ public class SesEndpoint extends DefaultEndpoint {
         sesClient = configuration.getAmazonSESClient() != null
             ? configuration.getAmazonSESClient()
             : createSESClient();
-            
-        if (ObjectHelper.isNotEmpty(configuration.getAmazonSESEndpoint())) {
-            sesClient.setEndpoint(configuration.getAmazonSESEndpoint());
-        }
     }
 
     public Consumer createConsumer(Processor processor) throws Exception {
@@ -115,9 +112,8 @@ public class SesEndpoint extends DefaultEndpoint {
                 clientBuilder = AmazonSimpleEmailServiceClientBuilder.standard().withClientConfiguration(clientConfiguration);
             }
         }
-        if (ObjectHelper.isNotEmpty(configuration.getAmazonSESEndpoint()) && ObjectHelper.isNotEmpty(configuration.getRegion())) {
-            EndpointConfiguration endpointConfiguration = new EndpointConfiguration(configuration.getAmazonSESEndpoint(), configuration.getRegion());
-            clientBuilder = clientBuilder.withEndpointConfiguration(endpointConfiguration);
+        if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
+            clientBuilder = clientBuilder.withRegion(Regions.valueOf(configuration.getRegion()));
         }
         client = clientBuilder.build();
         return client;
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/SesComponentConfigurationTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/SesComponentConfigurationTest.java
index 9c118aa..3d66aeb 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/SesComponentConfigurationTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/SesComponentConfigurationTest.java
@@ -38,7 +38,6 @@ public class SesComponentConfigurationTest extends CamelTestSupport {
         assertEquals("from@example.com", endpoint.getConfiguration().getFrom());
         assertEquals("xxx", endpoint.getConfiguration().getAccessKey());
         assertEquals("yyy", endpoint.getConfiguration().getSecretKey());
-        assertNull(endpoint.getConfiguration().getAmazonSESEndpoint());
         assertNotNull(endpoint.getConfiguration().getAmazonSESClient());
         assertNull(endpoint.getConfiguration().getTo());
         assertNull(endpoint.getConfiguration().getSubject());
@@ -54,7 +53,6 @@ public class SesComponentConfigurationTest extends CamelTestSupport {
         assertEquals("from@example.com", endpoint.getConfiguration().getFrom());
         assertEquals("xxx", endpoint.getConfiguration().getAccessKey());
         assertEquals("yyy", endpoint.getConfiguration().getSecretKey());
-        assertNull(endpoint.getConfiguration().getAmazonSESEndpoint());
         assertNull(endpoint.getConfiguration().getAmazonSESClient());
         assertNull(endpoint.getConfiguration().getTo());
         assertNull(endpoint.getConfiguration().getSubject());
@@ -76,7 +74,6 @@ public class SesComponentConfigurationTest extends CamelTestSupport {
         assertEquals("from@example.com", endpoint.getConfiguration().getFrom());
         assertNull(endpoint.getConfiguration().getAccessKey());
         assertNull(endpoint.getConfiguration().getSecretKey());
-        assertNull(endpoint.getConfiguration().getAmazonSESEndpoint());
         assertSame(mock, endpoint.getConfiguration().getAmazonSESClient());
         assertNull(endpoint.getConfiguration().getTo());
         assertNull(endpoint.getConfiguration().getSubject());
@@ -93,13 +90,12 @@ public class SesComponentConfigurationTest extends CamelTestSupport {
         
         SesComponent component = new SesComponent(context);
         SesEndpoint endpoint = (SesEndpoint) component.createEndpoint("aws-ses://from@example.com?amazonSESClient=#amazonSESClient&accessKey=xxx"
-            + "&secretKey=yyy&to=to1@example.com,to2@example.com&amazonSESEndpoint=us-east-1&subject=Subject"
+            + "&secretKey=yyy&to=to1@example.com,to2@example.com&subject=Subject"
             + "&returnPath=bounce@example.com&replyToAddresses=replyTo1@example.com,replyTo2@example.com");
         
         assertEquals("from@example.com", endpoint.getConfiguration().getFrom());
         assertEquals("xxx", endpoint.getConfiguration().getAccessKey());
         assertEquals("yyy", endpoint.getConfiguration().getSecretKey());
-        assertEquals("us-east-1", endpoint.getConfiguration().getAmazonSESEndpoint());
         assertNotNull(endpoint.getConfiguration().getAmazonSESClient());
         assertEquals(2, endpoint.getConfiguration().getTo().size());
         assertTrue(endpoint.getConfiguration().getTo().contains("to1@example.com"));
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ses/springboot/SesComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ses/springboot/SesComponentConfiguration.java
index 42c61a0..8044df1 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ses/springboot/SesComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ses/springboot/SesComponentConfiguration.java
@@ -136,10 +136,6 @@ public class SesComponentConfiguration
          * 'CamelAwsSesReplyToAddresses' header.
          */
         private List replyToAddresses;
-        /**
-         * The region with which the AWS-SES client wants to work with.
-         */
-        private String amazonSESEndpoint;
         private String proxyHost;
         private Integer proxyPort;
         private String region;
@@ -208,14 +204,6 @@ public class SesComponentConfiguration
             this.replyToAddresses = replyToAddresses;
         }
 
-        public String getAmazonSESEndpoint() {
-            return amazonSESEndpoint;
-        }
-
-        public void setAmazonSESEndpoint(String amazonSESEndpoint) {
-            this.amazonSESEndpoint = amazonSESEndpoint;
-        }
-
         public String getProxyHost() {
             return proxyHost;
         }

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