camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r682583 - in /activemq/camel/trunk/components/camel-mail/src: main/java/org/apache/camel/component/mail/ test/java/org/apache/camel/component/mail/
Date Tue, 05 Aug 2008 05:13:03 GMT
Author: davsclaus
Date: Mon Aug  4 22:13:02 2008
New Revision: 682583

URL: http://svn.apache.org/viewvc?rev=682583&view=rev
Log:
CAMEL-778: Added contentType as option to camel-mail. Use text/html to send html mails.

Added:
    activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailContentTypeTest.java
      - copied, changed from r682336, activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailProcessOnlyUnseenMessagesTest.java
    activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailHtmlAttachmentTest.java
      - copied, changed from r682336, activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailAttachmentTest.java
Modified:
    activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
    activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
    activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentTest.java
    activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailFetchSizeTest.java
    activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailFetchSizeZeroTest.java
    activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailProcessOnlyUnseenMessagesTest.java
    activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsTest.java
    activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRouteTest.java
    activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailSubjectTest.java
    activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MultipleDestinationConsumeTest.java

Modified: activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java?rev=682583&r1=682582&r2=682583&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
(original)
+++ activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
Mon Aug  4 22:13:02 2008
@@ -16,10 +16,11 @@
  */
 package org.apache.camel.component.mail;
 
+import java.io.IOException;
 import java.util.Iterator;
 import java.util.Map;
-
 import javax.activation.DataHandler;
+import javax.activation.DataSource;
 import javax.mail.Address;
 import javax.mail.BodyPart;
 import javax.mail.Message;
@@ -29,6 +30,7 @@
 import javax.mail.internet.MimeBodyPart;
 import javax.mail.internet.MimeMessage;
 import javax.mail.internet.MimeMultipart;
+import javax.mail.util.ByteArrayDataSource;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.RuntimeCamelException;
@@ -43,7 +45,7 @@
 public class MailBinding {
 
     public void populateMailMessage(MailEndpoint endpoint, MimeMessage mimeMessage, Exchange
exchange)
-        throws MessagingException {
+        throws MessagingException, IOException {
 
         appendHeadersFromCamel(mimeMessage, exchange, exchange.getIn());
 
@@ -71,9 +73,15 @@
         }
 
         if (exchange.getIn().hasAttachments()) {
-            appendAttachmentsFromCamel(mimeMessage, exchange, exchange.getIn());
+            appendAttachmentsFromCamel(mimeMessage, exchange.getIn(), endpoint.getConfiguration());
         } else {
-            mimeMessage.setText(exchange.getIn().getBody(String.class));
+            if ("text/html".equals(endpoint.getConfiguration().getContentType())) {
+                DataSource ds = new ByteArrayDataSource(exchange.getIn().getBody(String.class),
"text/html");
+                mimeMessage.setDataHandler(new DataHandler(ds));
+            } else {
+                // its just text/plain
+                mimeMessage.setText(exchange.getIn().getBody(String.class));
+            }
         }
     }
 
@@ -120,8 +128,8 @@
     /**
      * Appends the Mail attachments from the Camel {@link MailMessage}
      */
-    protected void appendAttachmentsFromCamel(MimeMessage mimeMessage, Exchange exchange,
-                                              org.apache.camel.Message camelMessage)
+    protected void appendAttachmentsFromCamel(MimeMessage mimeMessage, org.apache.camel.Message
camelMessage,
+                                              MailConfiguration configuration)
         throws MessagingException {
 
         // Create a Multipart
@@ -130,7 +138,7 @@
         // fill the body with text
         multipart.setSubType("mixed");
         MimeBodyPart textBodyPart = new MimeBodyPart();
-        textBodyPart.setContent(exchange.getIn().getBody(String.class), "text/plain");
+        textBodyPart.setContent(camelMessage.getBody(String.class), configuration.getContentType());
         multipart.addBodyPart(textBodyPart);
 
         for (Map.Entry<String, DataHandler> entry : camelMessage.getAttachments().entrySet())
{

Modified: activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java?rev=682583&r1=682582&r2=682583&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
(original)
+++ activemq/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java
Mon Aug  4 22:13:02 2008
@@ -58,6 +58,7 @@
     private boolean debugMode;
     private long connectionTimeout = DEFAULT_CONNECTION_TIMEOUT;
     private boolean dummyTrustManager;
+    private String contentType = "text/plain";
 
     public MailConfiguration() {
     }
@@ -385,4 +386,12 @@
     public void setDummyTrustManager(boolean dummyTrustManager) {
         this.dummyTrustManager = dummyTrustManager;
     }
+
+    public String getContentType() {
+        return contentType;
+    }
+
+    public void setContentType(String contentType) {
+        this.contentType = contentType;
+    }
 }

Modified: activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentTest.java?rev=682583&r1=682582&r2=682583&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentTest.java
(original)
+++ activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentTest.java
Mon Aug  4 22:13:02 2008
@@ -72,6 +72,7 @@
         assertEquals(true, config.isDeleteProcessedMessages());
         assertEquals(false, config.isIgnoreUriScheme());
         assertEquals("fetchSize", -1, config.getFetchSize());
+        assertEquals("contentType", "text/plain", config.getContentType());
     }
 
     public void testDefaultPOP3Configuration() throws Exception {
@@ -89,6 +90,7 @@
         assertEquals(true, config.isDeleteProcessedMessages());
         assertEquals(false, config.isIgnoreUriScheme());
         assertEquals("fetchSize", -1, config.getFetchSize());
+        assertEquals("contentType", "text/plain", config.getContentType());
     }
 
     public void testDefaultIMAPConfiguration() throws Exception {
@@ -106,11 +108,12 @@
         assertEquals(true, config.isDeleteProcessedMessages());
         assertEquals(false, config.isIgnoreUriScheme());
         assertEquals("fetchSize", -1, config.getFetchSize());
+        assertEquals("contentType", "text/plain", config.getContentType());
     }
 
     public void testManyConfigurations() throws Exception {
         MailEndpoint endpoint = resolveMandatoryEndpoint("smtp://james@myhost:30/subject?password=secret"
-            + "&from=me@camelriders.org&deleteProcessedMessages=false&defaultEncoding=iso-8859-1&folderName=riders");
+            + "&from=me@camelriders.org&deleteProcessedMessages=false&defaultEncoding=iso-8859-1&folderName=riders&contentType=text/html");
         MailConfiguration config = endpoint.getConfiguration();
         assertEquals("getProtocol()", "smtp", config.getProtocol());
         assertEquals("getHost()", "myhost", config.getHost());
@@ -124,6 +127,7 @@
         assertEquals(false, config.isDeleteProcessedMessages());
         assertEquals(false, config.isIgnoreUriScheme());
         assertEquals("fetchSize", -1, config.getFetchSize());
+        assertEquals("contentType", "text/html", config.getContentType());
     }
 
     public void testDestination() {

Copied: activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailContentTypeTest.java
(from r682336, activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailProcessOnlyUnseenMessagesTest.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailContentTypeTest.java?p2=activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailContentTypeTest.java&p1=activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailProcessOnlyUnseenMessagesTest.java&r1=682336&r2=682583&rev=682583&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailProcessOnlyUnseenMessagesTest.java
(original)
+++ activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailContentTypeTest.java
Mon Aug  4 22:13:02 2008
@@ -16,71 +16,47 @@
  */
 package org.apache.camel.component.mail;
 
-import javax.mail.Flags;
-import javax.mail.Folder;
 import javax.mail.Message;
-import javax.mail.Store;
-import javax.mail.internet.MimeMessage;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.springframework.mail.javamail.JavaMailSenderImpl;
+import org.jvnet.mock_javamail.Mailbox;
 
 /**
- * Unit test for processOnlyUnseenMessages option.
+ * Unit test for contentType option.
  */
-public class MailProcessOnlyUnseenMessagesTest extends ContextTestSupport {
+public class MailContentTypeTest extends ContextTestSupport {
 
-    public void testProcessOnlyUnseenMessages() throws Exception {
-        prepareMailbox();
+    public void testSendHtmlMail() throws Exception {
+        Mailbox.clearAll();
 
-        sendBody("direct:a", "Message 3");
+        sendBody("direct:a", "<html><body><h1>Hello</h1>World</body></html>");
 
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMessageCount(1);
-        mock.expectedBodiesReceived("Message 3");
-        mock.assertIsSatisfied();
-
-        // reset mock so we can make new assertions
-        mock.reset();
-
-        // send a new message, now we should only receive this new massages as all the others
has been SEEN
-        sendBody("direct:a", "Message 4");
-        mock.expectedMessageCount(1);
-        mock.expectedBodiesReceived("Message 4");
-        mock.assertIsSatisfied();
+        Mailbox box = Mailbox.get("claus@localhost");
+        Message msg = box.get(0);
+
+        assertTrue(msg.getContentType().startsWith("text/html"));
+        assertEquals("<html><body><h1>Hello</h1>World</body></html>",
msg.getContent());
     }
 
-    private void prepareMailbox() throws Exception {
-        // connect to mailbox
-        JavaMailSenderImpl sender = new JavaMailSenderImpl();
-        Store store = sender.getSession().getStore("imap");
-        store.connect("localhost", 25, "claus", "secret");
-        Folder folder = store.getFolder("INBOX");
-        folder.open(Folder.READ_WRITE);
-        folder.expunge();
-
-        // inserts two messages with the SEEN flag
-        Message[] msg = new Message[2];
-        msg[0] = new MimeMessage(sender.getSession());
-        msg[0].setText("Message 1");
-        msg[0].setFlag(Flags.Flag.SEEN, true);
-        msg[1] = new MimeMessage(sender.getSession());
-        msg[1].setText("Message 2");
-        msg[1].setFlag(Flags.Flag.SEEN, true);
-        folder.appendMessages(msg);
-        folder.close(true);
+    public void testSendPlainMail() throws Exception {
+        Mailbox.clearAll();
+
+        sendBody("direct:b", "Hello World");
+
+        Mailbox box = Mailbox.get("claus@localhost");
+        Message msg = box.get(0);
+        assertTrue(msg.getContentType().startsWith("text/plain"));
+        assertEquals("Hello World", msg.getContent());
     }
 
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("direct:a").to("smtp://claus@localhost");
-
-                from("imap://localhost?username=claus&password=secret&processOnlyUnseenMessages=true&consumer.delay=1000").to("mock:result");
+                from("direct:a").to("smtp://claus@localhost?contentType=text/html");
+                from("direct:b").to("smtp://claus@localhost?contentType=text/plain");
             }
         };
     }
 
-}
+}
\ No newline at end of file

Modified: activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailFetchSizeTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailFetchSizeTest.java?rev=682583&r1=682582&r2=682583&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailFetchSizeTest.java
(original)
+++ activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailFetchSizeTest.java
Mon Aug  4 22:13:02 2008
@@ -67,6 +67,7 @@
 
     private void prepareMailbox() throws Exception {
         // connect to mailbox
+        Mailbox.clearAll();
         JavaMailSenderImpl sender = new JavaMailSenderImpl();
         Store store = sender.getSession().getStore("pop3");
         store.connect("localhost", 25, "jones", "secret");

Modified: activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailFetchSizeZeroTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailFetchSizeZeroTest.java?rev=682583&r1=682582&r2=682583&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailFetchSizeZeroTest.java
(original)
+++ activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailFetchSizeZeroTest.java
Mon Aug  4 22:13:02 2008
@@ -49,6 +49,7 @@
 
     private void prepareMailbox() throws Exception {
         // connect to mailbox
+        Mailbox.clearAll();
         JavaMailSenderImpl sender = new JavaMailSenderImpl();
         Store store = sender.getSession().getStore("pop3");
         store.connect("localhost", 25, "bill", "secret");

Copied: activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailHtmlAttachmentTest.java
(from r682336, activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailAttachmentTest.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailHtmlAttachmentTest.java?p2=activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailHtmlAttachmentTest.java&p1=activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailAttachmentTest.java&r1=682336&r2=682583&rev=682583&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailAttachmentTest.java
(original)
+++ activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailHtmlAttachmentTest.java
Mon Aug  4 22:13:02 2008
@@ -30,20 +30,20 @@
 import org.apache.camel.component.mock.MockEndpoint;
 
 /**
- * Unit test for Camel attachments and Mail attachments.
+ * Unit test for Camel html attachments and Mail attachments.
  */
-public class MailAttachmentTest extends ContextTestSupport {
+public class MailHtmlAttachmentTest extends ContextTestSupport {
 
     public void testSendAndRecieveMailWithAttachments() throws Exception {
         // START SNIPPET: e1
 
         // create an exchange with a normal body and attachment to be produced as email
-        Endpoint endpoint = context.getEndpoint("smtp://james@mymailserver.com?password=secret");
+        Endpoint endpoint = context.getEndpoint("smtp://james@mymailserver.com?password=secret&contentType=text/html");
 
         // create the exchange with the mail message that is multipart with a file and a
Hello World text/plain message.
         Exchange exchange = endpoint.createExchange();
         Message in = exchange.getIn();
-        in.setBody("Hello World");
+        in.setBody("<html><body><h1>Hello</h1>World</body></html>");
         in.addAttachment("logo.jpeg", new DataHandler(new FileDataSource("src/test/data/logo.jpeg")));
 
         // create a producer that can produce the exchange (= send the mail)
@@ -64,7 +64,7 @@
         mock.assertIsSatisfied();
 
         // plain text
-        assertEquals("Hello World", out.getIn().getBody(String.class));
+        assertEquals("<html><body><h1>Hello</h1>World</body></html>",
out.getIn().getBody(String.class));
 
         // attachment
         Map<String, DataHandler> attachments = out.getIn().getAttachments();
@@ -85,4 +85,4 @@
             }
         };
     }
-}
+}
\ No newline at end of file

Modified: activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailProcessOnlyUnseenMessagesTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailProcessOnlyUnseenMessagesTest.java?rev=682583&r1=682582&r2=682583&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailProcessOnlyUnseenMessagesTest.java
(original)
+++ activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailProcessOnlyUnseenMessagesTest.java
Mon Aug  4 22:13:02 2008
@@ -26,6 +26,7 @@
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.springframework.mail.javamail.JavaMailSenderImpl;
+import org.jvnet.mock_javamail.Mailbox;
 
 /**
  * Unit test for processOnlyUnseenMessages option.
@@ -54,6 +55,7 @@
 
     private void prepareMailbox() throws Exception {
         // connect to mailbox
+        Mailbox.clearAll();
         JavaMailSenderImpl sender = new JavaMailSenderImpl();
         Store store = sender.getSession().getStore("imap");
         store.connect("localhost", 25, "claus", "secret");

Modified: activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsTest.java?rev=682583&r1=682582&r2=682583&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsTest.java
(original)
+++ activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRecipientsTest.java
Mon Aug  4 22:13:02 2008
@@ -28,6 +28,8 @@
 public class MailRecipientsTest extends ContextTestSupport {
 
     public void testMultiRecipients() throws Exception {
+        Mailbox.clearAll();
+
         sendBody("direct:a", "Camel does really rock");
 
         Mailbox inbox = Mailbox.get("camel@riders.org");

Modified: activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRouteTest.java?rev=682583&r1=682582&r2=682583&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRouteTest.java
(original)
+++ activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailRouteTest.java
Mon Aug  4 22:13:02 2008
@@ -34,6 +34,8 @@
 public class MailRouteTest extends ContextTestSupport {
 
     public void testSendAndReceiveMails() throws Exception {
+        Mailbox.clearAll();
+
         MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
         resultEndpoint.expectedBodiesReceived("hello world!");
 

Modified: activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailSubjectTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailSubjectTest.java?rev=682583&r1=682582&r2=682583&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailSubjectTest.java
(original)
+++ activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailSubjectTest.java
Mon Aug  4 22:13:02 2008
@@ -19,6 +19,7 @@
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.jvnet.mock_javamail.Mailbox;
 
 /**
  * Unit test for Mail subject support.
@@ -27,6 +28,8 @@
     private String subject = "Camel rocks";
 
     public void testMailSubject() throws Exception {
+        Mailbox.clearAll();
+
         String body = "Hello Claus.\nYes it does.\n\nRegards James.";
         template.sendBody("direct:a", body);
 

Modified: activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MultipleDestinationConsumeTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MultipleDestinationConsumeTest.java?rev=682583&r1=682582&r2=682583&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MultipleDestinationConsumeTest.java
(original)
+++ activemq/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MultipleDestinationConsumeTest.java
Mon Aug  4 22:13:02 2008
@@ -32,6 +32,7 @@
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.util.ObjectHelper;
+import org.jvnet.mock_javamail.Mailbox;
 
 /**
  * @version $Revision$
@@ -41,6 +42,8 @@
     private Session mailSession;
 
     public void testSendAndReceiveMails() throws Exception {
+        Mailbox.clearAll();
+
         MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
         resultEndpoint.expectedMinimumMessageCount(1);
 



Mime
View raw message