0 Replies Latest reply on Aug 15, 2013 10:38 AM by striplight

    FUSE ESB - DAO unit testing question

    striplight Newbie

      We are working on some spikes using Fuse ESB to build some components. We have an architecture mandated by our EAs which is:  REST controller uses a route to call a CXF WS. This calls a local java class as a service to, for example, perform CRUD actions. These services use JPA (openjpa) enabled DAO/entities. All seems a  bit academic in design rather than real world but thats another story.

       

      Question is about testing. Normally I would actually test this service tier using H2 to provide the DB, wiring the DAO,  entitymanager etc together with spring. But we will use blueprint for fuse. How can I unit test this tier? Getting my tests to subclass CamelBlueprintTestSupport doesn’t work, this expects a route.

       

      So I have set up the junit classes with SpringJUnit4ClassRunner, I have a local context.xml which has the wiring info. I have not annotated any of the DAO/service code (beyond jpa stuff), but just specified the context in my test. I have flagged the spring dependencies in my POM as test scope.

       

      So this works, and the code has no spring specific stuff, so this should work with blueprint wiring it in the container. But it seems wrong somehow. Is there a way of unit testing this tier outside the container without using spring?

       

      Thanks, Chris