【问题标题】:Loading properties file while running camel blueprint test运行骆驼蓝图测试时加载属性文件
【发布时间】:2017-04-30 16:24:33
【问题描述】:
我正在使用property-placeholder 标签来加载如下属性:
<cm:property-placeholder id="myblueprint.test" persistent-id="camel.blueprint"/>
在 JBOSS Fuse 上部署我的项目时,它将从 FUSE 的 /etc/ 目录加载 camel.blueprint.cfg,当我在结构配置文件上部署项目时,它将从配置文件中创建的属性文件中读取。
但是,当我运行camel blueprint test 时,如何配置它以从特定位置加载属性文件?
【问题讨论】:
标签:
apache-camel
jbossfuse
blueprint-osgi
camel-test
【解决方案1】:
在浏览documentation for property-placeholder 后,我得到了解决方案。我们可以在测试用例文件中设置属性文件的位置如下:
@Override
protected String[] loadConfigAdminConfigurationFile() {
// String[0] = tell Camel the path of the .cfg file to use for OSGi ConfigAdmin in the blueprint XML file
// String[1] = tell Camel the persistence-id of the cm:property-placeholder in the blueprint XML file
return new String[]{"src/test/resources/etc/stuff.cfg", "stuff"};
}