Integration Testing In Maven
It is very useful to be able to run integration tests of JBI artefacts being deployed within ServiceMix inside a JUnit test case. Form version 3.2.2 onwards of ServiceMix you can accomplish this using a simple Spring.xml as follows...
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sm="http://servicemix.apache.org/config/1.0" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://servicemix.apache.org/config/1.0 http://incubator.apache.org/servicemix/schema/core/servicemix-core.xsd"> <sm:container generateRootDir="true"> <sm:deployments> <sm:installSharedLibrary groupId="org.apache.servicemix" artifactId="servicemix-shared"/> <sm:installComponent groupId="org.apache.servicemix" artifactId="servicemix-camel"/> <sm:deployServiceAssembly groupId="org.apache.servicemix.samples" artifactId="camel-sa"/> </sm:deployments> </sm:container> </beans>
This example will deploy a shared library, a component and a service assembly in a temporary ServiceMix installation; which can then be further integration tested, such as by sending messages into the NMR via Camel Mock Testing.
For more details on this example, see the Camel Example