4

I have a bunch of systemproperties defined in my maven pom.xml, that i need to acccess from Arquillian-tests, running on a remote glassfish instance.

What's the easiest way to push the systemproperties to the container?

hhravn
  • 1,701
  • 1
  • 10
  • 22
  • Did you get any solution for this ?. Seems to be same as https://stackoverflow.com/questions/26358790/jvm-parameters-not-visible-with-in-arquillian-testcase-on-jboss – Abdul Razak AK Nov 15 '17 at 12:41

2 Answers2

4

There is an Arquillian Extension in the Arquillian Showcase that demo how this could be done 'automatically'.

https://github.com/arquillian/arquillian-showcase/tree/master/extensions/systemproperties

Aslak Knutsen
  • 706
  • 3
  • 4
  • Will this be included into Arquillian? It's an important feature for adding dynamic configurations to the deploy artifact, e.g., a randomly selected port of a mocked dependency – stackoverflower Jul 15 '16 at 09:14
  • Indeed the arquillian extension systemproperties actually uses some classes into main/java. The ideal situation would be to include it into Arquillian – Fabrizio Stellato Oct 14 '16 at 08:34
2

You could write these properties out to a file that is added to your ShrinkWrap @Deployment.

You could then read this file in your @Before setup method that executes server-side, and set the System properties using System.setProperty(...). This assumes the SecurityManager on the server will allow you to set the properties.

If you don't want to pollute your test code with all of this, you could write this harness into an Arquillian extension that does something similar.

Vineet Reynolds
  • 76,006
  • 17
  • 150
  • 174