You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by davsclaus <ci...@yahoo.dk> on 2010/07/30 11:16:53 UTC

Re: Mail-component, velocity and NullpointerException

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 this message in context: http://camel.465427.n5.nabble.com/Mail-component-velocity-and-NullpointerException-tp2256742p2259340.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Mail-component, velocity and NullpointerException

Posted by Claus Ibsen <cl...@gmail.com>.
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 <tr...@digia.org> 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://smtp.gmail.com?username=messaging@digia.org&password=23R923");
>            }
>        };
>    }
>
>    @Test
>    public void testRoute() throws Exception {
>        MailMessage m = new MailMessage();
>        Map<String, Object> headers = new HashMap<String, Object>();
>        headers.put("To", "my@internet.address");
>        headers.put("From", "source@internet.address");
>        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 <cl...@gmail.com> wrote:
>> On Fri, Jul 30, 2010 at 11:37 AM, Tristan <tr...@digia.org> 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]
>>> <ml...@n5.nabble.com> 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

Re: Mail-component, velocity and NullpointerException

Posted by Tristan Koen <tr...@digia.org>.
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://smtp.gmail.com?username=messaging@digia.org&password=23R923");
            }
        };
    }

    @Test
    public void testRoute() throws Exception {
        MailMessage m = new MailMessage();
        Map<String, Object> headers = new HashMap<String, Object>();
        headers.put("To", "my@internet.address");
        headers.put("From", "source@internet.address");
        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 <cl...@gmail.com> wrote:
> On Fri, Jul 30, 2010 at 11:37 AM, Tristan <tr...@digia.org> 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]
>> <ml...@n5.nabble.com> 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
>

Re: Mail-component, velocity and NullpointerException

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jul 30, 2010 at 11:37 AM, Tristan <tr...@digia.org> 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]
> <ml...@n5.nabble.com> 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

Re: Mail-component, velocity and NullpointerException

Posted by Tristan <tr...@digia.org>.
Thanks.
Somehow I ignored the blue bit. Have now subscribed.


On 30 July 2010 11:16, davsclaus [via Camel]
<ml...@n5.nabble.com> 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.