camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmcb55 <>
Subject How to mock endpoints taking lots of different query parameters values?
Date Wed, 19 Sep 2012 21:37:32 GMT
So I have a very simple mocking use-case. Basically I want to do the

    Processor emulator = new ServiceEmulator();
    MockEndpoint mock = getMockEndpoint("mock:Service");

This is fine, but if I want to invoke my mock with query parameters my
emulator won't get called:


Instead I have to explicit list the query parameter values in the
'getMockEndpoint()' call:

    MockEndpoint mock = getMockEndpoint("mock:Service?q=test");

But what if I have lots and lots of variations on the query parameters I
want to test? Do I have to predefine them all and register an explicit mock
instance for each of those variations (and get the order of the params
exactly correct when registering, and then call
'mock.whenAnyExchangeReceived(emulator);' on each instance?)?? 

What I really want to do is have my emulator called regardless of the query
parameters, and I thought my first example above would just work (i.e.
getMockEndpoint("mock:Service")). Is there a simple way to specify
'whenAnyExchangeReceived()' for a mocked endpoint taking arbitrary query
parameters, or do I have to move to using 'adviceWith()'?

I really found the above mocking code very intuitive initially, so if
something like 'getMockEndpoint("mock:Service*")' (note the wildcard) could
work that would be cool I think!!



View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message