Im creating a ServiceMix module that consists of a Camel route.
In my beans.xml, I have:
<osgix:cm-properties id="companyProps"
persistent-id="com.company.integration">
</osgix:cm-properties>
<ctx:property-placeholder location="
file:${karaf.base}/etc/com.company.integration.cfg
" />
This means I can define other items using properties from the file, like:
<http-conf:conduit name="*.http-conduit">
<http-conf:authorization>
<security:UserName>${username}</security:UserName>
<security:Password>${password}</security:Password>
</http-conf:authorization>
</http-conf:conduit>
I can also access the properties in my java classes if I create a bean and inject it:
<bean id="myConfig" class="com.company.integration.MyConfig">
<osgix:managed-properties persistent-id="com.company.integration" />
</bean>
The problem is when Im writing my unit tests. Currently Im using a copy of my beans.xml with test values, but of course I'd like to use the real beans.xml and supply values for the properties.
public class myTest extends CamelSpringTestSupport
{
@Override
protected AbstractXmlApplicationContext createApplicationContext()
{
return new ClassPathXmlApplicationContext(new String[] {
"/META-INF/spring/beans.xml"
, "/META-INF/spring/test.xml"
});
}
}
I'd like to get rid of test.xml and preferably load the test-properties from a property file. I've seen some references to PropertyComponent, but Im unable to get this to work :-(