Search code examples
apache-cameljbossfuseblueprint-osgicamel-test

Loading properties file while running camel blueprint test


I am using property-placeholder tag to load a properties as follows:

<cm:property-placeholder id="myblueprint.test" persistent-id="camel.blueprint"/>

While deploying my project on JBOSS Fuse, it will load camel.blueprint.cfg from /etc/ directory of FUSE, and when I deploy project on a fabric profile, it will read from properties file created in profile.

But, when I run camel blueprint test, how can I configure it to load properties file from a particular location?


Solution

  • After browsing the documentation for property-placeholder, I got the solution. We can set the location for properties file in test case file as follows:

    @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"};
    }
    
    • Please ensure that, property file is having extension .cfg. otherwise it will be ignored.