camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r802102 - in /camel/trunk/components/camel-mail/src/test: java/org/apache/camel/component/mail/MimeMultipartAlternativeTest.java resources/log4j.properties
Date Fri, 07 Aug 2009 17:43:06 GMT
Author: hadrian
Date: Fri Aug  7 17:43:06 2009
New Revision: 802102

URL: http://svn.apache.org/viewvc?rev=802102&view=rev
Log:
Fix test failure in camel-mail

Modified:
    camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MimeMultipartAlternativeTest.java
    camel/trunk/components/camel-mail/src/test/resources/log4j.properties

Modified: camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MimeMultipartAlternativeTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MimeMultipartAlternativeTest.java?rev=802102&r1=802101&r2=802102&view=diff
==============================================================================
--- camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MimeMultipartAlternativeTest.java
(original)
+++ camel/trunk/components/camel-mail/src/test/java/org/apache/camel/component/mail/MimeMultipartAlternativeTest.java
Fri Aug  7 17:43:06 2009
@@ -26,6 +26,7 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.Producer;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
@@ -51,13 +52,11 @@
         in.addAttachment("cid:0001", new DataHandler(new FileDataSource("src/test/data/logo.jpeg")));
 
         // create a producer that can produce the exchange (= send the mail)
-        Producer producer = endpoint.createProducer();
-        // start the producer
-        producer.start();
-        // and let it go (processes the exchange by sending the email)
-        producer.process(exchange); 
-        
-        producer.stop();
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedMessageCount(1);
+        mock.message(0).header(MailConstants.MAIL_ALTERNATIVE_BODY).isNull();
+
+        context.createProducerTemplate().send(endpoint, exchange);
     }
     
     private void verifyTheRecivedEmail(String expectString) throws Exception {
@@ -65,12 +64,9 @@
         Thread.sleep(1000);
 
         MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMessageCount(1);
-        // this header should be removed
-        mock.message(0).header(MailConstants.MAIL_ALTERNATIVE_BODY).isNull();
-        Exchange out = mock.assertExchangeReceived(0);
         mock.assertIsSatisfied();
 
+        Exchange out = mock.assertExchangeReceived(0);
         ByteArrayOutputStream baos = new ByteArrayOutputStream(((MailMessage)out.getIn()).getMessage().getSize());
         ((MailMessage)out.getIn()).getMessage().writeTo(baos);
         String dumpedMessage = baos.toString();

Modified: camel/trunk/components/camel-mail/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mail/src/test/resources/log4j.properties?rev=802102&r1=802101&r2=802102&view=diff
==============================================================================
--- camel/trunk/components/camel-mail/src/test/resources/log4j.properties (original)
+++ camel/trunk/components/camel-mail/src/test/resources/log4j.properties Fri Aug  7 17:43:06
2009
@@ -22,7 +22,7 @@
 
 # uncomment the following to enable camel debugging
 #log4j.logger.org.apache.camel.component.mail=TRACE
-log4j.logger.org.apache.camel=DEBUG
+#log4j.logger.org.apache.camel=DEBUG
 
 # CONSOLE appender not used by default
 log4j.appender.out=org.apache.log4j.ConsoleAppender



Mime
View raw message