Hi Willem,

Thanks for the comment - and yes, I probably could add a custom
MockComponent like you say, but that's a lot more work than I think a
developer should have to do.

The reason to have a single mock to handle numerous query parameters is
simply that the actual thing I'm mocking is a complex Web Service that in
the real world is a HTTP endpoint that takes it's input via URI query
parameters (and it can take lots of different params with lots of different
values). So I'm trying to mock this complex component so I can run unit test
easily without having to go through HTTP to the real service.

So as I posted originally, I just want to write something really simple and
intuitive like:
  Processor emulator = new EmulatorThatActsLikeTheComplexHttpService(); 
  MockEndpoint mock = getMockEndpoint("mock:Service"); 
  mock.whenAnyExchangeReceived(emulator);

As you can see I want my emulator to handle 'any' exchange that is fired at
the mock, so I can setup tests to fire all kinds of requests like this:
  from("direct:start").to("mock:Service?q=test");
  from("direct:start").to("mock:Service?UserCategory=HighPriority&q=test");
  from("direct:start").to("mock:Service?UserCategory=LowPriority&q=test");
 
from("direct:start").to("mock:Service?UserCategory=HighPriority&Country=France&q=test");
 
from("direct:start").to("mock:Service?UserCategory=HighPriority&Country=Ireland&q=test");

Thanks,

Pat.




--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-mock-endpoints-taking-lots-of-different-query-parameters-values-tp5719629p5719642.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to