Apache camel 运行camel blueprint测试时加载属性文件

Apache camel 运行camel blueprint测试时加载属性文件,apache-camel,jbossfuse,blueprint-osgi,camel-test,Apache Camel,Jbossfuse,Blueprint Osgi,Camel Test,我正在使用属性占位符标记加载属性,如下所示: <cm:property-placeholder id="myblueprint.test" persistent-id="camel.blueprint"/> @Override protected String[] loadConfigAdminConfigurationFile() { // String[0] = tell Camel the path of the .cfg file to use for OSGi C

我正在使用
属性占位符
标记加载属性,如下所示:

<cm:property-placeholder id="myblueprint.test" persistent-id="camel.blueprint"/>
@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"};
}

在JBOSS Fuse上部署我的项目时,它将从Fuse的
/etc/
目录加载
camel.blueprint.cfg
,当我在结构配置文件上部署项目时,它将从配置文件中创建的属性文件中读取

但是,当我运行时,如何将其配置为从特定位置加载属性文件?

在浏览for
属性占位符后,我得到了解决方案。我们可以在测试用例文件中设置属性文件的位置,如下所示:

<cm:property-placeholder id="myblueprint.test" persistent-id="camel.blueprint"/>
@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"};
}
  • 请确保属性文件具有扩展名
    .cfg
    。否则它将被忽略