2011-03-08 04:58:57 +01:00
|
|
|
/**
|
2012-01-19 18:21:06 +01:00
|
|
|
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
|
2011-03-08 04:58:57 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package akka.config
|
|
|
|
|
|
2011-10-11 16:05:48 +02:00
|
|
|
import akka.testkit.AkkaSpec
|
2011-11-15 11:34:39 +01:00
|
|
|
import com.typesafe.config.ConfigFactory
|
|
|
|
|
import scala.collection.JavaConverters._
|
2011-11-23 15:15:44 +01:00
|
|
|
import akka.util.duration._
|
2011-11-15 11:34:39 +01:00
|
|
|
import akka.util.Duration
|
2012-03-01 17:24:29 +01:00
|
|
|
import akka.actor.ActorSystem
|
2011-03-08 04:58:57 +01:00
|
|
|
|
2011-10-21 17:01:22 +02:00
|
|
|
@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner])
|
2012-03-01 17:24:29 +01:00
|
|
|
class ConfigSpec extends AkkaSpec(ConfigFactory.defaultReference(ActorSystem.findClassLoader())) {
|
2011-03-08 04:58:57 +01:00
|
|
|
|
2011-12-07 11:25:35 +01:00
|
|
|
"The default configuration file (i.e. reference.conf)" must {
|
2011-03-08 04:58:57 +01:00
|
|
|
"contain all configuration properties for akka-actor that are used in code with their correct defaults" in {
|
2011-10-11 16:05:48 +02:00
|
|
|
|
2011-11-15 11:34:39 +01:00
|
|
|
val settings = system.settings
|
|
|
|
|
val config = settings.config
|
2012-01-30 13:44:56 +01:00
|
|
|
|
|
|
|
|
{
|
|
|
|
|
import config._
|
|
|
|
|
|
|
|
|
|
getString("akka.version") must equal("2.0-SNAPSHOT")
|
|
|
|
|
settings.ConfigVersion must equal("2.0-SNAPSHOT")
|
|
|
|
|
|
|
|
|
|
getBoolean("akka.daemonic") must equal(false)
|
|
|
|
|
getBoolean("akka.actor.serialize-messages") must equal(false)
|
|
|
|
|
settings.SerializeAllMessages must equal(false)
|
|
|
|
|
|
2012-02-09 20:40:09 +01:00
|
|
|
getInt("akka.scheduler.ticks-per-wheel") must equal(512)
|
2012-01-30 13:44:56 +01:00
|
|
|
settings.SchedulerTicksPerWheel must equal(512)
|
|
|
|
|
|
2012-02-09 20:40:09 +01:00
|
|
|
getMilliseconds("akka.scheduler.tick-duration") must equal(100)
|
2012-01-30 13:44:56 +01:00
|
|
|
settings.SchedulerTickDuration must equal(100 millis)
|
2012-02-07 12:00:50 +01:00
|
|
|
|
|
|
|
|
settings.Daemonicity must be(false)
|
|
|
|
|
settings.JvmExitOnFatalError must be(true)
|
2012-01-30 13:44:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
val c = config.getConfig("akka.actor.default-dispatcher")
|
|
|
|
|
|
2012-01-31 10:12:45 +01:00
|
|
|
//General dispatcher config
|
|
|
|
|
|
2012-01-30 13:44:56 +01:00
|
|
|
{
|
|
|
|
|
c.getString("type") must equal("Dispatcher")
|
2012-01-31 10:12:45 +01:00
|
|
|
c.getString("executor") must equal("fork-join-executor")
|
2012-01-30 13:44:56 +01:00
|
|
|
c.getInt("mailbox-capacity") must equal(-1)
|
|
|
|
|
c.getMilliseconds("mailbox-push-timeout-time") must equal(10 * 1000)
|
2012-02-09 20:40:09 +01:00
|
|
|
c.getString("mailbox-type") must be("")
|
2012-01-30 13:44:56 +01:00
|
|
|
c.getMilliseconds("shutdown-timeout") must equal(1 * 1000)
|
|
|
|
|
c.getInt("throughput") must equal(5)
|
|
|
|
|
c.getMilliseconds("throughput-deadline-time") must equal(0)
|
2012-02-13 20:42:14 +01:00
|
|
|
c.getBoolean("attempt-teamwork") must equal(true)
|
2012-01-30 13:44:56 +01:00
|
|
|
}
|
|
|
|
|
|
2012-01-31 10:12:45 +01:00
|
|
|
//Fork join executor config
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
val pool = c.getConfig("fork-join-executor")
|
|
|
|
|
pool.getInt("parallelism-min") must equal(8)
|
|
|
|
|
pool.getDouble("parallelism-factor") must equal(3.0)
|
|
|
|
|
pool.getInt("parallelism-max") must equal(64)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Thread pool executor config
|
|
|
|
|
|
2012-01-30 13:44:56 +01:00
|
|
|
{
|
|
|
|
|
val pool = c.getConfig("thread-pool-executor")
|
|
|
|
|
import pool._
|
|
|
|
|
getMilliseconds("keep-alive-time") must equal(60 * 1000)
|
|
|
|
|
getDouble("core-pool-size-factor") must equal(3.0)
|
|
|
|
|
getDouble("max-pool-size-factor") must equal(3.0)
|
|
|
|
|
getInt("task-queue-size") must equal(-1)
|
|
|
|
|
getString("task-queue-type") must equal("linked")
|
|
|
|
|
getBoolean("allow-core-timeout") must equal(true)
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-03-08 04:58:57 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|