object EnvironmentVariables {
// Global - Environment Variables for Jenkins}
val firstPause = Integer.getInteger("firstPause", 1).toInt
val secondPause = sys.env.getOrElse("secondPause", "1").toInt
val thirdPause = sys.env.getOrElse("thirdPause", "1").toInt
// Environment Variables for Jenkins
val userAtOnce = Integer.getInteger("userAtOnce", 1).toInt
val test1 = sys.env.getOrElse("test1", "1").toDouble
val test2 = sys.env.getOrElse("test2", "1").toInt
}
And the simulation class:
setUp(
OpenScenario.inject(
atOnceUsers(userAtOnce),
nothingFor(firstPause seconds),
constantUsersPerSec(test1) during(test2 seconds)
)
)
.protocols(openProtocol)
}
All the "Integer.getInteger()" get invoked, but the "sys.env.getOrElse()" going producing the default?
TNX
That’s not the problem here.
When you’re using Integer.getInteger, you get your values from System Properties, which is what you’re passing using -Dmykey=myValue.
When using sys.env, you get your values from Environment Variables. It’s simply not the same thing.
If you want to have default values for your system properties, use scala.util.Properties.propOrElse(“myProperty”, “defaultValue”).