Thanks Claus! Didn't know I had to add the option to the "isMockEndpointsAndSkip" method as well...
Kind regards, Geert On Thu, Nov 6, 2014 at 9:16 AM, Claus Ibsen <claus.ib...@gmail.com> wrote: > Your regexp pattern does not match direct-vm:out2 as you have a > parameter, so adjust the regular exp to match using wildcards etc. > > On Thu, Nov 6, 2014 at 9:10 AM, Geert Vanheusden <geer...@aviovision.com> > wrote: > > Any thoughts on this issue or should I just create a ticket for it? > > > > Kind regards, > > > > Geert > > > > On Tue, Nov 4, 2014 at 11:13 AM, Geert Vanheusden < > geer...@aviovision.com> > > wrote: > > > >> Hi Guys, > >> > >> I wanted to mock a "direct-vm" endpoint with the "block=true" option > >> but it fails. > >> > >> Here you can find a unit test to reproduce this: > >> > >> =================================== > >> > >> import org.apache.camel.builder.RouteBuilder; > >> import org.apache.camel.component.mock.MockEndpoint; > >> import org.apache.camel.impl.DefaultExchange; > >> import org.apache.camel.test.junit4.CamelTestSupport; > >> import org.junit.Test; > >> > >> public class DirectVmTest extends CamelTestSupport { > >> > >> @Override > >> protected RouteBuilder createRouteBuilder() throws Exception { > >> return new RouteBuilder() { > >> > >> @Override > >> public void configure() throws Exception { > >> from("direct:in1") > >> .to("direct-vm:out1"); > >> > >> from("direct:in2") > >> .to("direct-vm:out2?block=true"); > >> } > >> > >> }; > >> } > >> > >> @Override > >> public String isMockEndpointsAndSkip() { > >> return "(direct-vm:out1|direct-vm:out2)"; > >> } > >> > >> // @Override > >> // public String isMockEndpointsAndSkip() { > >> // return "*"; > >> // } > >> > >> // @Override > >> // public String isMockEndpoints() { > >> // return "(direct-vm:out1|direct-vm:out2)"; > >> // } > >> > >> // @Override > >> // public String isMockEndpoints() { > >> // return "*"; > >> // } > >> > >> @Test > >> public void directVmEndpointShouldBeMocked() throws > >> InterruptedException { > >> MockEndpoint mockEndpoint = > getMockEndpoint("mock:direct-vm:out1"); > >> mockEndpoint.expectedMessageCount(1); > >> > >> template.send("direct:in1", new DefaultExchange(context)); > >> > >> mockEndpoint.assertIsSatisfied(); > >> } > >> > >> @Test > >> public void directVmEndpointWithBlockShouldBeMocked() throws > >> InterruptedException { > >> MockEndpoint mockEndpoint = > getMockEndpoint("mock:direct-vm:out2"); > >> mockEndpoint.expectedMessageCount(1); > >> > >> template.send("direct:in2", new DefaultExchange(context)); > >> > >> mockEndpoint.assertIsSatisfied(); > >> } > >> } > >> > >> =================================== > >> > >> The first test without the block succeeds but the second one with the > >> block option fails. > >> > >> I tested it on version 2.14.0. > >> > >> Please also try to uncomment the code block to enable auto mocking and > >> see the different test results. > >> > >> Seems to me like a bug. What do you guys think? > >> > >> Kind regards, > >> > >> Geert > >> > > > > -- > Claus Ibsen > ----------------- > Red Hat, Inc. > Email: cib...@redhat.com > Twitter: davsclaus > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen > hawtio: http://hawt.io/ > fabric8: http://fabric8.io/ >