Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hierarchy Lookup for Expression Resolver #163

Open
dipak-pawar opened this issue Feb 21, 2018 · 1 comment
Open

Hierarchy Lookup for Expression Resolver #163

dipak-pawar opened this issue Feb 21, 2018 · 1 comment

Comments

@dipak-pawar
Copy link
Contributor

Problem:

Currently we have StringPropertyReplacer to resolve expression ${p}.

I am running my tests with failsafe configuration like

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-failsafe-plugin</artifactId>
    <configuration>
       <systemPropertyVariables>
         <APP_NAME>${project.artifactId}</APP_NAME>
       </systemPropertyVariables>
     </configuration>
</plugin>

If I am using expression language to resolve ${APP_NAME} , I will use

 @RouteURL("${APP_NAME}")
 private URL baseURL;

It works fine from mvn build. But if I tries to run if from IDE(che), it doesn't resolve this property which is fine becuase we don't have system property or env variable set. But even if I set env variable by name APP_NAME, it won't resolve it because during test execution core will set all env vars to system properties by prefixing it with env., which mean APP_NAME env variable will be available in system properties by name env.APP_NAME.

To make it workable I have to change code to following

 @RouteURL("${env.APP_NAME}")
 private URL baseURL;

Proposed Solution:

It'll be good if we provide some hierarchy for lookup `System.getProperty(APP_NAME) - > System.getenv(APP_NAME) -> System.getProperty("env.APP_NAME"), so user can easily use same code for both the cases(through system property and env var)

 @RouteURL("${APP_NAME}")
 private URL baseURL;
@bartoszmajsak
Copy link
Member

Just remember to keep env.APP_NAME logic for backward compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants