camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/7] camel git commit: CAMEL-9473: camel-mail - The from/to/cc/bcc options should be like others and in component docs
Date Mon, 04 Jan 2016 12:44:14 GMT
CAMEL-9473: camel-mail - The from/to/cc/bcc options should be like others and in component
docs


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fb7fecc2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fb7fecc2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fb7fecc2

Branch: refs/heads/master
Commit: fb7fecc230b130c0e97038610904f9ef7dad4bc8
Parents: 409a538
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Jan 4 13:16:26 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Jan 4 13:16:26 2016 +0100

----------------------------------------------------------------------
 .../camel/component/mail/MailConfiguration.java | 34 ++++++++++++++++----
 .../camel/component/mail/MailEndpoint.java      |  4 +--
 .../mail/MailComponentRecipientSetTest.java     |  8 ++---
 ...rOverrulePreConfigurationRecipientsTest.java |  2 +-
 .../mail/MailMultipleRecipientsTest.java        |  2 +-
 .../mail/MailRecipientsPipeIssueTest.java       |  4 +--
 .../component/mail/MailRecipientsTest.java      | 10 +++---
 .../mail/MailToMultipleEndpointsTest.java       |  6 ++--
 8 files changed, 46 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/fb7fecc2/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
index d4d69e4..6f37baa 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
@@ -43,7 +43,7 @@ public class MailConfiguration implements Cloneable {
     private ClassLoader applicationClassLoader;
     private Session session;
     private Properties javaMailProperties;
-    private Properties additionalJavaMailProperties;
+    private Map<Message.RecipientType, String> recipients = new HashMap<Message.RecipientType,
String>();
 
     // protocol is implied by component name so it should not be in UriPath
     private String protocol;
@@ -61,9 +61,15 @@ public class MailConfiguration implements Cloneable {
     private JavaMailSender javaMailSender;
     @UriParam(defaultValue = "true", label = "consumer,advanced")
     private boolean mapMailMessage = true;
-    @UriParam(defaultValue = MailConstants.MAIL_DEFAULT_FROM) @Metadata(label = "producer")
+    @UriParam(defaultValue = MailConstants.MAIL_DEFAULT_FROM, label = "producer")
     private String from = MailConstants.MAIL_DEFAULT_FROM;
-    @UriParam(defaultValue = MailConstants.MAIL_DEFAULT_FOLDER) @Metadata(label = "consumer,advanced")
+    @UriParam(label = "producer")
+    private String to;
+    @UriParam(label = "producer")
+    private String cc;
+    @UriParam(label = "producer")
+    private String bcc;
+    @UriParam(defaultValue = MailConstants.MAIL_DEFAULT_FOLDER, label = "consumer,advanced")
     private String folderName = MailConstants.MAIL_DEFAULT_FOLDER;
     @UriParam @Metadata(label = "consumer")
     private boolean delete;
@@ -73,7 +79,6 @@ public class MailConfiguration implements Cloneable {
     private boolean unseen = true;
     @UriParam(label = "advanced")
     private boolean ignoreUriScheme;
-    private Map<Message.RecipientType, String> recipients = new HashMap<Message.RecipientType,
String>();
     @UriParam @Metadata(label = "producer")
     private String replyTo;
     @UriParam(defaultValue = "-1") @Metadata(label = "consumer,advanced")
@@ -104,6 +109,8 @@ public class MailConfiguration implements Cloneable {
     private boolean handleFailedMessage;
     @UriParam(label = "security")
     private SSLContextParameters sslContextParameters;
+    @UriParam(label = "advanced", prefix = "mail.", multiValue = true)
+    private Properties additionalJavaMailProperties;
 
     public MailConfiguration() {
     }
@@ -466,23 +473,38 @@ public class MailConfiguration implements Cloneable {
      * Sets the <tt>To</tt> email address. Separate multiple email addresses
with comma.
      */
     public void setTo(String address) {
+        this.to = to;
         recipients.put(Message.RecipientType.TO, address);
     }
 
+    public String getTo() {
+        return to;
+    }
+
     /**
      * Sets the <tt>CC</tt> email address. Separate multiple email addresses
with comma.
      */
-    public void setCC(String address) {
+    public void setCc(String address) {
+        this.cc = address;
         recipients.put(Message.RecipientType.CC, address);
     }
 
+    public String getCc() {
+        return cc;
+    }
+
     /**
      * Sets the <tt>BCC</tt> email address. Separate multiple email addresses
with comma.
      */
-    public void setBCC(String address) {
+    public void setBcc(String address) {
+        this.bcc = address;
         recipients.put(Message.RecipientType.BCC, address);
     }
 
+    public String getBcc() {
+        return bcc;
+    }
+
     public Map<Message.RecipientType, String> getRecipients() {
         return recipients;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/fb7fecc2/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
index 08a56e0..f7c8e78 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
@@ -46,9 +46,9 @@ public class MailEndpoint extends ScheduledPollEndpoint {
     private ContentTypeResolver contentTypeResolver;
     @UriParam(label = "consumer")
     private int maxMessagesPerPoll;
-    @UriParam(label = "consumer,filter")
+    @UriParam(label = "consumer,filter", prefix = "searchTerm.", multiValue = true)
     private SearchTerm searchTerm;
-    @UriParam(label = "consumer,sort")
+    @UriParam(label = "consumer,sort", javaType = "java.lang.String")
     private SortTerm[] sortTerm;
     @UriParam(label = "consumer,advanced")
     private MailBoxPostProcessAction postProcessAction;

http://git-wip-us.apache.org/repos/asf/camel/blob/fb7fecc2/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentRecipientSetTest.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentRecipientSetTest.java
b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentRecipientSetTest.java
index a217ddd..2f131dd 100644
--- a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentRecipientSetTest.java
+++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentRecipientSetTest.java
@@ -66,17 +66,17 @@ public class MailComponentRecipientSetTest extends CamelTestSupport {
             @Override
             public void configure() throws Exception {
                 MailConfiguration config = new MailConfiguration();
-                config.setCC("spy@spy.com");
+                config.setCc("spy@spy.com");
                 config.setFrom("me@me.com");
 
                 MailComponent mail = context.getComponent("smtp", MailComponent.class);
                 mail.setConfiguration(config);
 
-                from("direct:a").to("smtp://localhost?username=james2&password=secret&To=a@a.com");
+                from("direct:a").to("smtp://localhost?username=james2&password=secret&to=a@a.com");
 
-                from("direct:b").to("smtp://localhost?username=james&password=secret&To=b@b.com&From=you@you.com");
+                from("direct:b").to("smtp://localhost?username=james&password=secret&to=b@b.com&from=you@you.com");
 
-                from("direct:c").to("smtp://localhost?username=admin&password=secret&To=c@c.com&CC=you@you.com,them@them.com");
+                from("direct:c").to("smtp://localhost?username=admin&password=secret&to=c@c.com&cc=you@you.com,them@them.com");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/fb7fecc2/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailHeaderOverrulePreConfigurationRecipientsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailHeaderOverrulePreConfigurationRecipientsTest.java
b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailHeaderOverrulePreConfigurationRecipientsTest.java
index 6b13aae..f9df11d 100644
--- a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailHeaderOverrulePreConfigurationRecipientsTest.java
+++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailHeaderOverrulePreConfigurationRecipientsTest.java
@@ -54,7 +54,7 @@ public class MailHeaderOverrulePreConfigurationRecipientsTest extends CamelTestS
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("pop3://claus@localhost?To=someone@outhere.com&CC=none@world.com&consumer.delay=1000").to("mock:result");
+                from("pop3://claus@localhost?to=someone@outhere.com&cc=none@world.com&consumer.delay=1000").to("mock:result");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/fb7fecc2/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailMultipleRecipientsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailMultipleRecipientsTest.java
b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailMultipleRecipientsTest.java
index 9bfe19a..56a8410 100644
--- a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailMultipleRecipientsTest.java
+++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailMultipleRecipientsTest.java
@@ -61,7 +61,7 @@ public class MailMultipleRecipientsTest extends CamelTestSupport {
         // START SNIPPET: e2
         // here we have pre configured the to receivers to claus and willem. Notice we use
comma to separate
         // the two recipients. Camel also support using colon as separator char
-        template.sendBody("smtp://localhost?To=claus@localhost,willem@localhost&CC=james@localhost",
"Hello World");
+        template.sendBody("smtp://localhost?to=claus@localhost,willem@localhost&cc=james@localhost",
"Hello World");
         // END SNIPPET: e2
 
         assertMockEndpointsSatisfied();

http://git-wip-us.apache.org/repos/asf/camel/blob/fb7fecc2/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsPipeIssueTest.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsPipeIssueTest.java
b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsPipeIssueTest.java
index d1fbcfe..a140a1e 100644
--- a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsPipeIssueTest.java
+++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsPipeIssueTest.java
@@ -50,9 +50,9 @@ public class MailRecipientsPipeIssueTest extends CamelTestSupport {
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                String recipients = "&To=camel|pipes@riders.org;easy@riders.org";
+                String recipients = "&to=camel|pipes@riders.org;easy@riders.org";
 
-                from("direct:a").to("smtp://you@mymailserver.com?password=secret&From=you@apache.org"
+ recipients);
+                from("direct:a").to("smtp://you@mymailserver.com?password=secret&from=you@apache.org"
+ recipients);
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/fb7fecc2/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsTest.java
b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsTest.java
index e42aa99..0c03c63 100644
--- a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsTest.java
+++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsTest.java
@@ -72,12 +72,12 @@ public class MailRecipientsTest extends CamelTestSupport {
             public void configure() throws Exception {
                 // START SNIPPET: e1
                 // all the recipients of this mail are:
-                // To: camel@riders.org , easy@riders.org
-                // CC: me@you.org
-                // BCC: someone@somewhere.org
-                String recipients = "&To=camel@riders.org,easy@riders.org&CC=me@you.org&BCC=someone@somewhere.org";
+                // to: camel@riders.org , easy@riders.org
+                // cc: me@you.org
+                // bcc: someone@somewhere.org
+                String recipients = "&to=camel@riders.org,easy@riders.org&cc=me@you.org&bcc=someone@somewhere.org";
 
-                from("direct:a").to("smtp://you@mymailserver.com?password=secret&From=you@apache.org"
+ recipients);
+                from("direct:a").to("smtp://you@mymailserver.com?password=secret&from=you@apache.org"
+ recipients);
                 // END SNIPPET: e1
             }
         };

http://git-wip-us.apache.org/repos/asf/camel/blob/fb7fecc2/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailToMultipleEndpointsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailToMultipleEndpointsTest.java
b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailToMultipleEndpointsTest.java
index 38aafe2..710225c 100644
--- a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailToMultipleEndpointsTest.java
+++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailToMultipleEndpointsTest.java
@@ -62,11 +62,11 @@ public class MailToMultipleEndpointsTest extends CamelTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("direct:a").to("smtp://localhost?username=james2&password=secret&To=a@a.com&From=me@me.com");
+                from("direct:a").to("smtp://localhost?username=james2&password=secret&to=a@a.com&from=me@me.com");
 
-                from("direct:b").to("smtp://localhost?username=james&password=secret&To=b@b.com&From=you@you.com");
+                from("direct:b").to("smtp://localhost?username=james&password=secret&to=b@b.com&from=you@you.com");
 
-                from("direct:c").to("smtp://localhost?username=admin&password=secret&To=c@c.com&From=me@me.com&CC=you@you.com,them@them.com");
+                from("direct:c").to("smtp://localhost?username=admin&password=secret&to=c@c.com&from=me@me.com&cc=you@you.com,them@them.com");
             }
         };
     }


Mime
View raw message