In play framework (2.2.1 & sbt 0.13) I have an IntegrationSpec
that brings up a TestServer
. I need to be able to set SSL specific System Properties for the TestServer
. So far the only way I have been able to set it up correctly is passing them as command line properties like below
play -Djavax.net.ssl.keyStore=... -Djavax.net.ssl.keyStorePassword=.... -D... test
I want the tests to run simply using play test
. For that in Build.scala I configured SBT javaOptions as follows
val main = play.Project(appName, appVersion, appDependencies).settings(
Keys.fork in Test := false,
javaOptions in Test += "-Dconfig.file=conf/application.test.conf")
And in application.test.conf I set all the system properties. With this the TestServer
is not even using application.test.conf
. I was not able to figure out why. So I thought I will try the following:
play -Dconfig.file=conf/application.test.conf test
The TestServer
did use application.test.conf
but none of the system properties (javax.net.ssl.keyStore="..." etc.) configured in the file were being used.
So I have two questions
play test
? . (I do not want to pass a long Map of properties to FakeApplication
in TestServer
). play -Dconfig.file=conf/application.test.conf test
, why are the system properties configured in application.test.conf
not being used?I'm not sure if this works for setting a property for reading the configuration file, but you can set your individual properties with System.setProperty
like this:
System.setProperty("application.secret","psssst!")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With