1

Issue Overview
When running an arquillian liberty managed container test, the specifiec environment variables are not resolved in the server.xml file. WLPManagedContainer.class can be seen trying to find the server.env, however, a running app in the runtime using server.env is not resolved during testing.

Expected Behaviour
A server.xml file containing e.g. and foo=bar defined in server.env in the running server directory. Should be resolved during the in-container test. When fetching the jndiEntry using @Resource(lookup="env/foo") String foo; should resolve to bar in runtime as well as during arquillian testing See: https://github.com/HasseNasse/liberty-arquillian-envvars

Current Behaviour
Application servlet resolves @Resource(lookup="env/foo") String foo; to bar during application deployment. Whilst during Arquillian testing the @Resource(lookup="env/foo") String foo; resolves to ${env.foo}, as defined in server.xml.

Tested using both Java 11 (Azul Zulu) and Java 8 (Azul Zulu + Oracle JDK)

Steps To Reproduce
Running Arquillian test:

  1. git clone https://github.com/HasseNasse/liberty-arquillian-envvars.git
  2. mvn verify

Deploying Application

  1. git clone https://github.com/HasseNasse/liberty-arquillian-envvars.git
  2. mvn liberty:start-server
  3. cp target/ target/liberty/wlp/user/servers/defaultserver/dropins
  4. Navigate to http://localhost:9080/net_nazarsit_arq_war/foo
Hassan Nazar
  • 69
  • 10
  • 1
    it looks like you've found a valid bug in the liberty-arquillian plugin. Can you please raise an issue on the github repo? https://github.com/OpenLiberty/liberty-arquillian That would be a more appropriate place to track it than on SO – Andy Guibert Jan 31 '19 at 16:37
  • @AndyGuibert Right on! https://github.com/OpenLiberty/liberty-arquillian/issues/40 – Hassan Nazar Jan 31 '19 at 20:45

0 Answers0