Search code examples
xmljunitosgifuseesbpax-exam

Is it possible to change an XML config file using Pax Exam?


I want to run multiple Fuse instances using Pax Exam on the same machine, and I want to reconfigure all used ports to make this possible. Unfortunately one port is defined in the etc/jetty.xml. Is there a way to have it changed somehow? I see that there is a set of options called KarafDistributionOption.editConfigurationFile* but they work only with property files.

  • Is there any Option implementation to use?
  • Is there any event hook like "here is the fuse installation, do what you want before I start that" ?

Solution

  • Hmm. Got it:

    KarafDistributionOption.replaceConfigurationFile(configurationFilePath, source)
    

    So what I do is:

    • I save the original XML into my unit test jar as resource
    • in the configuration phase I change the port
    • with the Option above I replace the config file in the target Fuse.