camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1067630 - /camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailPollEnrichTest.java
Date Sun, 06 Feb 2011 10:33:37 GMT
Author: davsclaus
Date: Sun Feb  6 10:33:37 2011
New Revision: 1067630

URL: http://svn.apache.org/viewvc?rev=1067630&view=rev
Log:
Added test for mail poll enrich.

Added:
    camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailPollEnrichTest.java
      - copied, changed from r1067628, camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailFetchSizeZeroTest.java

Copied: camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailPollEnrichTest.java
(from r1067628, camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailFetchSizeZeroTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailPollEnrichTest.java?p2=camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailPollEnrichTest.java&p1=camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailFetchSizeZeroTest.java&r1=1067628&r2=1067630&rev=1067630&view=diff
==============================================================================
--- camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailFetchSizeZeroTest.java
(original)
+++ camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailPollEnrichTest.java
Sun Feb  6 10:33:37 2011
@@ -31,7 +31,7 @@ import org.springframework.mail.javamail
 /**
  * Unit test for a special corner case with fetchSize=0
  */
-public class MailFetchSizeZeroTest extends CamelTestSupport {
+public class MailPollEnrichTest extends CamelTestSupport {
 
     @Override
     public void setUp() throws Exception {
@@ -40,18 +40,16 @@ public class MailFetchSizeZeroTest exten
     }
 
     @Test
-    public void testFetchSize() throws Exception {
+    public void testPollEnrich() throws Exception {
         Mailbox mailbox = Mailbox.get("bill@localhost");
         assertEquals(5, mailbox.size());
 
         MockEndpoint mock = getMockEndpoint("mock:result");
-        // no messages expected as we have a fetch size of zero
-        mock.expectedMessageCount(0);
-        // should be done within 2 seconds as no delay when started
-        mock.setResultWaitTime(2000L);
-        mock.assertIsSatisfied();
+        mock.expectedBodiesReceived("Message 0");
 
-        assertEquals(5, mailbox.size());
+        template.sendBody("direct:start", "");
+
+        mock.assertIsSatisfied();
     }
 
     private void prepareMailbox() throws Exception {
@@ -77,7 +75,9 @@ public class MailFetchSizeZeroTest exten
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("pop3://bill@localhost?password=secret&fetchSize=0&consumer.delay=1000").to("mock:result");
+                from("direct:start")
+                    .pollEnrich("pop3://bill@localhost?password=secret", 5000)
+                    .to("log:mail", "mock:result");
             }
         };
     }



Mime
View raw message