vendredi 25 mars 2016

Unit test with CamelTestSuport never satisfies MockEndpoint

I'm replacing a call to an external RESTful web service with a mock endpoint in my unit test. This endpoint in my route:

.to("{{melissa.data.service.uri}}")

Gets replaced with an endpoint with this uri "mock:dontReallySendTheRequest" in the unit test by overriding the properties:

@Override
protected  Properties useOverridePropertiesWithPropertiesComponent() {

    Properties results = new Properties();
    results.setProperty("melissa.data.service.uri", "mock:dontReallySendTheRequest");

    return results;
}

However, when I assert that the endpoint is satisfied, it fails, I get this in the debugging console:

2016-03-25 14:50:14,972 [main] INFO  MockEndpoint - Asserting: Endpoint[mock://dontReallySendTheRequest] is satisfied
2016-03-25 14:50:14,972 [main] DEBUG MockEndpoint - Waiting on the latch for: 0 millis
2016-03-25 14:50:24,973 [main] DEBUG MockEndpoint - Took 10001 millis to complete latch

I have another route unit test following almost the exact same recipe, but with that one (which passes, btw), I don't get this "waiting for latch" message.

Also, in debugging console, I also see this:

2016-03-25 15:03:00,915 [main] DEBUG SendProcessor - >>>> Endpoint[mock://dontReallySendTheRequest] Exchange[Message:
2016-03-25 15:03:00,916 [main] DEBUG MockEndpoint - mock://dontReallySendTheRequest >>>> 0 : Exchange[Message:

So it looks to me like it's trying to send to the mock endpoint.

Any ideas what I'm doing wrong? Thanks!

Aucun commentaire:

Enregistrer un commentaire