Forum Discussion

TNeuschwanger's avatar
TNeuschwanger
Champion Level 1
13 years ago

How to change Hermes Config Project Property from cmdLine?

Hello,

I would like to change the value of the SoapUI supplied "Hermes Config" property as found in the Project Properties tab when SoapUI is launched from the command line.

I have tried -P"Hermes Config"=/usr
I have tried -G"Hermes Config"=/usr
I have tried -D"Hermes Config"=/usr

None of the above attempts override the default that is "c:\.hermes" when launched from the command line.

I am trying to do this because everything works fine when run on Windows on my local computer, but when attempting to run on a Linux, I would like to override the value of my Windows computer with the Hermes Config location on Linux computer without needing to go into SoapUI to change it for the Linux computer.

Regards
  • SOLVED:

    Add a custom project property using the -P directive on the command line. Using the name and value from that directive, use property expansion in the "Project Properties" tab to change the "Hermes Config" value...

    So, on the command line add a -P directive such as -P"HermesConfigPath=file:///C:/.hermes" as a Windows OS example.
    Within the SoapUI "Project Properties" tab, find the "Hermes Config" Property and make it's value be ${#Project#HermesConfigPath}
    Within the SoapUI "Custom Properties" tab, add a "Name" of HermesConfigPath and a "Value" of file:///C:/.hermes

    That "Value" should be the path that you normally use and you won't have to adjust it on the command line unless you need to. When you run the project on a remote Linux computer however, you can then point it to the Linux file structure path when run from a command line without needing to adjust the SoapUI project.

    Note the use of the "file:///..." syntax. The loading of the hermes-config.xml file location expects a URL, so if you provide this syntax to the file path, you will eliminate a warning in the soapui-log file that is generated when it cannot load from a URL. The warning information is a little alarming as it attempts file mode operation if it does not find URL mode to its satisfaction to the valid hermes-config.xml file.

    Warning generated when value is: c:/.hermes
    No warning generated when value is: file:///c:/.hermes

    This comes in handy when you are developing your SoapUI projects on a local windows box and use a continuous integration scheduler such as Jenkins running on a Linux computer. You want to have the same SoapUI project be able to run from either OS without maintenance.
    • MatthiasBuck's avatar
      MatthiasBuck
      Occasional Contributor

      Hi Todd, 

       

      We tried to follow the same approach but when trying to reference the project custom property within the SoapUI "Project Properties" tab, we're getting following error: 

       

      javax.naming.NamingException: Session name 'QM_BUILD_DEV' does not exist in Hermes configuration or path to Hermes config ( ${#Project#HermesConfigPath} )is not valid! 
      error at line: 8 

       

      We are positive that the session name exists in the hermes config xml file. 

       

      To be clear, besides referencing the project custom property in the "Project Properties" tab, we're then also trying to overwrite the project custom property via -P option on the command line testrunner.sh call. This seems irrelevant to the issue because the reference to the path variable doesn't seem valid in the first place. 

       

      Any ideas? How did it work for you? Are you truly referencing it successfully?

       

      Thanks in advance!

  • Aaronliu's avatar
    Aaronliu
    Frequent Contributor
    try to use
    project.setHermesConfig("xxxxxx")
    in project level

    default directory:
    System.getenv("SystemDrive")




    thanks,
    Aaron