You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tarjei Huse <ta...@scanmine.com> on 2011/05/08 13:44:41 UTC
Append endpoint to route at test-time.
Hi,
I got a route like this:
from(bookKeeperQueue).routeId("BookKeeperRoute")
.process(new BookKeeperProcessor(bookKeeper));
That I would like to test by appending a mock endpoint to the route and
avaiting for it to receive the message.
I could add a .to(log:something) at the end of the route, but I would
find it more pleasing if I could just append an endpoint to the route
using the new adviceWith() functionality.
Is this possible?
--
Regards / Med vennlig hilsen
Tarjei Huse
Mobil: 920 63 413
Re: Append endpoint to route at test-time.
Posted by Claus Ibsen <cl...@gmail.com>.
On Sun, May 8, 2011 at 1:44 PM, Tarjei Huse <ta...@scanmine.com> wrote:
> Hi,
>
> I got a route like this:
> from(bookKeeperQueue).routeId("BookKeeperRoute")
> .process(new BookKeeperProcessor(bookKeeper));
>
> That I would like to test by appending a mock endpoint to the route and
> avaiting for it to receive the message.
>
> I could add a .to(log:something) at the end of the route, but I would
> find it more pleasing if I could just append an endpoint to the route
> using the new adviceWith() functionality.
>
> Is this possible?
>
In Camel 2.8 you can now do
context.getRouteDefinitions().get(0).adviceWith(context, new
AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
// send the outgoing message to mock:output
weaveAddLast().to("mock:output");
}
});
See details at
https://cwiki.apache.org/confluence/display/CAMEL/AdviceWith
> --
> Regards / Med vennlig hilsen
> Tarjei Huse
> Mobil: 920 63 413
>
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: Append endpoint to route at test-time.
Posted by Tarjei Huse <ta...@scanmine.com>.
On 05/09/2011 02:28 PM, Claus Ibsen wrote:
> Hi
>
> I created a ticket to track this idea
> https://issues.apache.org/jira/browse/CAMEL-3958
Great. Thanks for the quick turnaround on this.
T
> On Mon, May 9, 2011 at 8:24 AM, Romain Manni-Bucau
> <rm...@gmail.com> wrote:
>> +1
>>
>> 2011/5/9 Claus Ibsen <cl...@gmail.com>
>>
>>> On Sun, May 8, 2011 at 1:44 PM, Tarjei Huse <ta...@scanmine.com> wrote:
>>>> Hi,
>>>>
>>>> I got a route like this:
>>>> from(bookKeeperQueue).routeId("BookKeeperRoute")
>>>> .process(new BookKeeperProcessor(bookKeeper));
>>>>
>>>> That I would like to test by appending a mock endpoint to the route and
>>>> avaiting for it to receive the message.
>>>>
>>>> I could add a .to(log:something) at the end of the route, but I would
>>>> find it more pleasing if I could just append an endpoint to the route
>>>> using the new adviceWith() functionality.
>>>>
>>>> Is this possible?
>>>>
>>> Yeah there is AdviceWithRouteBuilder that can help with this
>>> http://camel.apache.org/advicewith.html
>>>
>>> But we could probably improve it a bit by adding a method to more
>>> easily addLast, which could be common to do. Eg to add a mock at the
>>> end.
>>>
>>> Likewise you may want to add a mock at the start, so we could have an
>>> addFirst as well.
>>>
>>>
>>>> --
>>>> Regards / Med vennlig hilsen
>>>> Tarjei Huse
>>>> Mobil: 920 63 413
>>>>
>>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> FuseSource
>>> Email: cibsen@fusesource.com
>>> Web: http://fusesource.com
>>> CamelOne 2011: http://fusesource.com/camelone2011/
>>> Twitter: davsclaus
>>> Blog: http://davsclaus.blogspot.com/
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>
>
>
--
Regards / Med vennlig hilsen
Tarjei Huse
Mobil: 920 63 413
Re: Append endpoint to route at test-time.
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
I created a ticket to track this idea
https://issues.apache.org/jira/browse/CAMEL-3958
On Mon, May 9, 2011 at 8:24 AM, Romain Manni-Bucau
<rm...@gmail.com> wrote:
> +1
>
> 2011/5/9 Claus Ibsen <cl...@gmail.com>
>
>> On Sun, May 8, 2011 at 1:44 PM, Tarjei Huse <ta...@scanmine.com> wrote:
>> > Hi,
>> >
>> > I got a route like this:
>> > from(bookKeeperQueue).routeId("BookKeeperRoute")
>> > .process(new BookKeeperProcessor(bookKeeper));
>> >
>> > That I would like to test by appending a mock endpoint to the route and
>> > avaiting for it to receive the message.
>> >
>> > I could add a .to(log:something) at the end of the route, but I would
>> > find it more pleasing if I could just append an endpoint to the route
>> > using the new adviceWith() functionality.
>> >
>> > Is this possible?
>> >
>>
>> Yeah there is AdviceWithRouteBuilder that can help with this
>> http://camel.apache.org/advicewith.html
>>
>> But we could probably improve it a bit by adding a method to more
>> easily addLast, which could be common to do. Eg to add a mock at the
>> end.
>>
>> Likewise you may want to add a mock at the start, so we could have an
>> addFirst as well.
>>
>>
>> > --
>> > Regards / Med vennlig hilsen
>> > Tarjei Huse
>> > Mobil: 920 63 413
>> >
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> CamelOne 2011: http://fusesource.com/camelone2011/
>> Twitter: davsclaus
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: Append endpoint to route at test-time.
Posted by Romain Manni-Bucau <rm...@gmail.com>.
+1
2011/5/9 Claus Ibsen <cl...@gmail.com>
> On Sun, May 8, 2011 at 1:44 PM, Tarjei Huse <ta...@scanmine.com> wrote:
> > Hi,
> >
> > I got a route like this:
> > from(bookKeeperQueue).routeId("BookKeeperRoute")
> > .process(new BookKeeperProcessor(bookKeeper));
> >
> > That I would like to test by appending a mock endpoint to the route and
> > avaiting for it to receive the message.
> >
> > I could add a .to(log:something) at the end of the route, but I would
> > find it more pleasing if I could just append an endpoint to the route
> > using the new adviceWith() functionality.
> >
> > Is this possible?
> >
>
> Yeah there is AdviceWithRouteBuilder that can help with this
> http://camel.apache.org/advicewith.html
>
> But we could probably improve it a bit by adding a method to more
> easily addLast, which could be common to do. Eg to add a mock at the
> end.
>
> Likewise you may want to add a mock at the start, so we could have an
> addFirst as well.
>
>
> > --
> > Regards / Med vennlig hilsen
> > Tarjei Huse
> > Mobil: 920 63 413
> >
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> CamelOne 2011: http://fusesource.com/camelone2011/
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>
Re: Append endpoint to route at test-time.
Posted by Claus Ibsen <cl...@gmail.com>.
On Sun, May 8, 2011 at 1:44 PM, Tarjei Huse <ta...@scanmine.com> wrote:
> Hi,
>
> I got a route like this:
> from(bookKeeperQueue).routeId("BookKeeperRoute")
> .process(new BookKeeperProcessor(bookKeeper));
>
> That I would like to test by appending a mock endpoint to the route and
> avaiting for it to receive the message.
>
> I could add a .to(log:something) at the end of the route, but I would
> find it more pleasing if I could just append an endpoint to the route
> using the new adviceWith() functionality.
>
> Is this possible?
>
Yeah there is AdviceWithRouteBuilder that can help with this
http://camel.apache.org/advicewith.html
But we could probably improve it a bit by adding a method to more
easily addLast, which could be common to do. Eg to add a mock at the
end.
Likewise you may want to add a mock at the start, so we could have an
addFirst as well.
> --
> Regards / Med vennlig hilsen
> Tarjei Huse
> Mobil: 920 63 413
>
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: Append endpoint to route at test-time.
Posted by boday <be...@initekconsulting.com>.
yep, just use http://camel.apache.org/advicewith.html
http://camel.apache.org/advicewith.html and interceptor to decorate with a
mock endpoint that you can assert against...
tarjei wrote:
>
> Hi,
>
> I got a route like this:
> from(bookKeeperQueue).routeId("BookKeeperRoute")
> .process(new BookKeeperProcessor(bookKeeper));
>
> That I would like to test by appending a mock endpoint to the route and
> avaiting for it to receive the message.
>
> I could add a .to(log:something) at the end of the route, but I would
> find it more pleasing if I could just append an endpoint to the route
> using the new adviceWith() functionality.
>
> Is this possible?
>
> --
> Regards / Med vennlig hilsen
> Tarjei Huse
> Mobil: 920 63 413
>
-----
Ben O'Day
IT Consultant -http://benoday.blogspot.com
--
View this message in context: http://camel.465427.n5.nabble.com/Append-endpoint-to-route-at-test-time-tp4379843p4381052.html
Sent from the Camel - Users mailing list archive at Nabble.com.