2016-12-15 1 views
1

Ich bin mit property-placeholder Tag eine Eigenschaft zu laden, wie folgt:Laden Eigenschaftendatei während Kamel Bauplan Test läuft

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

Während mein Projekt auf JBOSS Sicherung bereitstellen, es camel.blueprint.cfg aus /etc/ Verzeichnis von FUSE geladen werden kann, und wenn Ich stelle das Projekt auf einem Fabric-Profil bereit, es wird von der im Profil erstellten Eigenschaftendatei gelesen.

Aber, wenn ich camel blueprint test ausführen, wie kann ich es konfigurieren, um Eigenschaftendatei von einem bestimmten Ort zu laden?

Antwort

3

Nach dem Durchsuchen der documentation für property-placeholder, habe ich die Lösung. Wir können den Standort festgelegt Objekte in Testfalldatei-Datei wie folgt:

@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"}; 
} 
  • Bitte stellen Sie sicher, dass Immobilien-Datei .cfg Erweiterung mit. Ansonsten wird es ignoriert.
Verwandte Themen