Nicholas
Nicholas

Reputation: 7521

FunctionalTestCase in Mule - How do I load one flow before another?

I have a Mule application, and I'm creating some unit tests including some Mock Web Services to test certain functionality. The Mock Web Services I'm creating using a test mule flow, so I'm registering an HTTP inbound endpoint.

When I run my test, I get a failure because one of my Spring objects fails to load due to the fact that it cannot reach my mock web service(The web service is loaded dynamically, so when doing the test, it resolves to localhost, otherwise it is usually an external service). I've made sure that when I do my getConfigResources() I load my mock web service flow file before I load my spring context beans, however I still get the error.

Is there a way to make Mule/Spring load my flow file and start up my http:inbound-endpoint before my Spring beans?

Upvotes: 1

Views: 350

Answers (1)

David Dossot
David Dossot

Reputation: 33413

You could try setting the depends-on attribute on your Spring bean to the name of the Mule flow, but I doubt it will work and I'm not convinced it's something desirable anyway.

Otherwise, the only thing I can think of is that you initialize the Spring bean factory yourself in a @Before method of your functional test case. This will give you an opportunity to pass the value of the dynamic port you're using with your mock HTTP inbound endpoint (assuming you do use a dynamic port, which is the recommended approach).

Upvotes: 1

Related Questions