Hi

You can see the unit tests in camel-mail. We use a MailMock framework.

On Fri, Jul 30, 2010 at 5:06 PM, Tristan Koen <[email protected]> wrote:
> Thanks Claus.
> Works perfectly in 2.5-SNAPSHOT.
>
> As an aside, how would one go about simulating an email received by
> the camel-mail imap component in a unit test? I tried the following,
> but I never got the same results as the real-world test:
>
> public class MailTest extends CamelTestSupport {
> @Override
>    protected RouteBuilder createRouteBuilder() throws Exception {
>        return new RouteBuilder() {
>           �...@override
>            public void configure() throws Exception {
>                from("seda:smtp")
>                    .process(new MailReplyService())
>                    .to("velocity://velocity/DeliveryReport.vm")
>
> .to("smtps://[email protected]&password=23R923");
>            }
>        };
>    }
>
>   �...@test
>    public void testRoute() throws Exception {
>        MailMessage m = new MailMessage();
>        Map<String, Object> headers = new HashMap<String, Object>();
>        headers.put("To", "[email protected]");
>        headers.put("From", "[email protected]");
>        headers.put("Subject", "Test Delivery Report");
>        m.setHeaders(headers);
>        m.setBody("Text Test Content");
>        template.sendBodyAndHeaders("seda:smtp", m, headers);
>    }
> }
>
>
>
> On 30 July 2010 11:45, Claus Ibsen <[email protected]> wrote:
>> On Fri, Jul 30, 2010 at 11:37 AM, Tristan <[email protected]> wrote:
>>>
>>> Thanks.
>>> Somehow I ignored the blue bit. Have now subscribed.
>>>
>>
>> I have created a ticket to track this bug
>> https://issues.apache.org/activemq/browse/CAMEL-3015
>>
>> And commiting a fix in short time. You are welcome to try 2.5-SNAPSHOT
>>
>> As a workaround dont use velocity, or use a processor to send a
>> message to veocity manually using a producer template and set the
>> response on the IN message.
>>
>>
>>
>>>
>>> On 30 July 2010 11:16, davsclaus [via Camel]
>>> <[email protected]> wrote:
>>>> Hi
>>>>
>>>> See this wiki page
>>>> http://camel.apache.org/discussion-forums.html
>>>>
>>>> You need to be a subscriber of the mailinglist to have mails forwarded.
>>>>
>>>> ________________________________
>>>> View message @
>>>> http://camel.465427.n5.nabble.com/Mail-component-velocity-and-NullpointerException-tp2256742p2259340.html
>>>> To unsubscribe from Mail-component, velocity and NullpointerException, 
>>>> click
>>>> here.
>>>>
>>>
>>> --
>>> View this message in context: 
>>> http://camel.465427.n5.nabble.com/Mail-component-velocity-and-NullpointerException-tp2256742p2259354.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to