9 Replies Latest reply: Oct 28, 2011 6:37 AM by Aslak Knutsen RSS

Environment variable in arquillian.xml

Alexis Hassler Novice

Hi all,

 

Is it possible to use environment variables in the arquillian.xml file ?

Something like

<property name="managementAddress">${JBOSS_HOST}</property>

 

Thanks,

 

Alexis

  • 1. Re: Environment variable in arquillian.xml
    Aslak Knutsen Master

    yes, in Arquillian Core >= 1.0.0.CR5

  • 2. Re: Environment variable in arquillian.xml
    zeeman Novice

    I tried with Arq CR5. It does not work, I have an env variable JBOSS_HOME defined in Ubuntu (.profile file). In pom.xml I have

     

    <JBOSS_HOME>${env.JBOSS_HOME}</JBOSS_HOME>

     

    in arqillian.xml I put

     

    <property name="jbossHome">${JBOSS_HOME}</property>

     

    When I start my test it says ${JBOSS_HOME} does not exist. Variable does not seem to get substituted.

  • 3. Re: Environment variable in arquillian.xml
    Aslak Knutsen Master

    Are you sure JBOSS_HOME is set in the forked surefire vm?

     

    What does mvn dependency:tree show?

  • 4. Re: Environment variable in arquillian.xml
    zeeman Novice

    I define

    <JBOSS_HOME>${env.JBOSS_HOME}</JBOSS_HOME>

     

    once In prop section of my pom (I have only one POM). I have one profile for integeration tests. Does JBOSS_HOME need to be defined again in integeration profile?

  • 5. Re: Environment variable in arquillian.xml
    Aslak Knutsen Master

    <plugin>

      <artifactId>maven-surefire-plugin</artifactId>

        <configuration>

          <systemPropertyVariables>

            <JBOSS_HOME>${env.JBOSS_HOME}</JBOSS_HOME>

          </systemPropertyVariables>

        <skip>false</skip>

      </configuration>

    </plugin>

  • 6. Re: Environment variable in arquillian.xml
    zeeman Novice

    Ok,I can add this xml fragment. But to understand it, if I have JBOSS_HOME as a system variable in my OS. So it should be accessiable by all processes. Why do I need to export it again in surefire plugin?

     

    Thanks for the help Aslak!

  • 7. Re: Environment variable in arquillian.xml
    Alexis Hassler Novice

    If I actually understand, it works with surefire <systemPropertyVariables>, but not with <environmentVariables> and for Arquillian Core >= 1.0.0.CR5.

     

    Here is how I'm using it :

                        <plugin>

                            <artifactId>maven-surefire-plugin</artifactId>

                            <configuration>

                                <systemPropertyVariables>

                                    <JBOSS_HOST>localhost</JBOSS_HOST>

                                </systemPropertyVariables>

                                <systemProperties>

                                    <arquillian.launch>jbossas7</arquillian.launch>

                                </systemProperties>

                            </configuration>

                        </plugin>

    and

        <container qualifier="jbossas7">

            <configuration>

                <property name="managementAddress">${JBOSS_HOST}</property>

                <property name="managementPort">9999</property>

            </configuration>

        </container>

     

    That's fine for me. Thanx again Aslak.

     

    Alexis

  • 8. Re: Environment variable in arquillian.xml
    Aslak Knutsen Master

    it should work with systemProperties as well i believe

  • 9. Re: Environment variable in arquillian.xml
    Aslak Knutsen Master

    It depends on how the forked jvm is launched. I believe you can deviced fully how the new env should look.

     

    Not sure what the rules are for surefire, but 'some' env variables doesn't seem to be passed over.