2011-03-08 04:58:57 +01:00
|
|
|
/**
|
2014-02-02 19:05:45 -06:00
|
|
|
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
|
2011-03-08 04:58:57 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package akka.config
|
|
|
|
|
|
2012-06-21 16:09:14 +02:00
|
|
|
import language.postfixOps
|
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._
|
2012-09-21 14:50:06 +02:00
|
|
|
import scala.concurrent.duration._
|
2013-10-16 15:11:00 +02:00
|
|
|
import akka.actor.ActorSystem
|
2013-02-01 08:02:53 +01:00
|
|
|
import akka.event.Logging.DefaultLogger
|
2014-01-09 14:09:52 +01:00
|
|
|
import java.util.concurrent.TimeUnit
|
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._
|
|
|
|
|
|
2014-01-31 11:14:13 +01:00
|
|
|
getString("akka.version") should be("2.3-SNAPSHOT")
|
|
|
|
|
settings.ConfigVersion should be("2.3-SNAPSHOT")
|
2012-01-30 13:44:56 +01:00
|
|
|
|
2014-01-31 11:14:13 +01:00
|
|
|
getBoolean("akka.daemonic") should be(false)
|
2013-08-23 14:39:21 +02:00
|
|
|
|
2013-12-17 14:25:56 +01:00
|
|
|
// WARNING: This setting should be off in the default reference.conf, but should be on when running
|
2013-08-23 14:39:21 +02:00
|
|
|
// the test suite.
|
2014-01-31 11:14:13 +01:00
|
|
|
getBoolean("akka.actor.serialize-messages") should be(true)
|
|
|
|
|
settings.SerializeAllMessages should be(true)
|
2012-01-30 13:44:56 +01:00
|
|
|
|
2014-01-31 11:14:13 +01:00
|
|
|
getInt("akka.scheduler.ticks-per-wheel") should be(512)
|
|
|
|
|
getDuration("akka.scheduler.tick-duration", TimeUnit.MILLISECONDS) should be(10)
|
|
|
|
|
getString("akka.scheduler.implementation") should be("akka.actor.LightArrayRevolverScheduler")
|
2012-02-07 12:00:50 +01:00
|
|
|
|
2013-12-17 14:25:56 +01:00
|
|
|
getBoolean("akka.daemonic") should be(false)
|
|
|
|
|
settings.Daemonicity should be(false)
|
2012-07-13 12:21:55 +02:00
|
|
|
|
2013-12-17 14:25:56 +01:00
|
|
|
getBoolean("akka.jvm-exit-on-fatal-error") should be(true)
|
|
|
|
|
settings.JvmExitOnFatalError should be(true)
|
2012-09-13 18:06:35 +02:00
|
|
|
|
2013-12-17 14:25:56 +01:00
|
|
|
getInt("akka.actor.deployment.default.virtual-nodes-factor") should be(10)
|
|
|
|
|
settings.DefaultVirtualNodesFactor should be(10)
|
2012-11-16 14:11:02 +01:00
|
|
|
|
2014-01-09 14:09:52 +01:00
|
|
|
getDuration("akka.actor.unstarted-push-timeout", TimeUnit.MILLISECONDS) should be(10.seconds.toMillis)
|
2013-12-17 14:25:56 +01:00
|
|
|
settings.UnstartedPushTimeout.duration should be(10.seconds)
|
2013-02-01 08:02:53 +01:00
|
|
|
|
2013-12-17 14:25:56 +01:00
|
|
|
settings.Loggers.size should be(1)
|
|
|
|
|
settings.Loggers.head should be(classOf[DefaultLogger].getName)
|
|
|
|
|
getStringList("akka.loggers").get(0) should be(classOf[DefaultLogger].getName)
|
2013-02-01 08:02:53 +01:00
|
|
|
|
2014-01-09 14:09:52 +01:00
|
|
|
getDuration("akka.logger-startup-timeout", TimeUnit.MILLISECONDS) should be(5.seconds.toMillis)
|
2013-12-17 14:25:56 +01:00
|
|
|
settings.LoggerStartTimeout.duration should be(5.seconds)
|
2013-06-19 18:28:51 +02:00
|
|
|
|
2013-12-17 14:25:56 +01:00
|
|
|
getInt("akka.log-dead-letters") should be(10)
|
|
|
|
|
settings.LogDeadLetters should be(10)
|
2013-06-19 18:28:51 +02:00
|
|
|
|
2013-12-17 14:25:56 +01:00
|
|
|
getBoolean("akka.log-dead-letters-during-shutdown") should be(true)
|
|
|
|
|
settings.LogDeadLettersDuringShutdown should 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
|
|
|
{
|
2014-01-31 11:14:13 +01:00
|
|
|
c.getString("type") should be("Dispatcher")
|
|
|
|
|
c.getString("executor") should be("default-executor")
|
|
|
|
|
c.getDuration("shutdown-timeout", TimeUnit.MILLISECONDS) should be(1 * 1000)
|
|
|
|
|
c.getInt("throughput") should be(5)
|
|
|
|
|
c.getDuration("throughput-deadline-time", TimeUnit.MILLISECONDS) should be(0)
|
|
|
|
|
c.getBoolean("attempt-teamwork") should be(true)
|
2012-01-30 13:44:56 +01:00
|
|
|
}
|
|
|
|
|
|
2014-01-16 23:24:06 +01:00
|
|
|
//Default executor config
|
|
|
|
|
{
|
|
|
|
|
val pool = c.getConfig("default-executor")
|
2014-01-31 11:14:13 +01:00
|
|
|
pool.getString("fallback") should be("fork-join-executor")
|
2014-01-16 23:24:06 +01:00
|
|
|
}
|
|
|
|
|
|
2012-01-31 10:12:45 +01:00
|
|
|
//Fork join executor config
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
val pool = c.getConfig("fork-join-executor")
|
2014-01-31 11:14:13 +01:00
|
|
|
pool.getInt("parallelism-min") should be(8)
|
|
|
|
|
pool.getDouble("parallelism-factor") should be(3.0)
|
|
|
|
|
pool.getInt("parallelism-max") should be(64)
|
2012-01-31 10:12:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Thread pool executor config
|
|
|
|
|
|
2012-01-30 13:44:56 +01:00
|
|
|
{
|
|
|
|
|
val pool = c.getConfig("thread-pool-executor")
|
|
|
|
|
import pool._
|
2014-01-31 11:14:13 +01:00
|
|
|
getDuration("keep-alive-time", TimeUnit.MILLISECONDS) should be(60 * 1000)
|
|
|
|
|
getDouble("core-pool-size-factor") should be(3.0)
|
|
|
|
|
getDouble("max-pool-size-factor") should be(3.0)
|
|
|
|
|
getInt("task-queue-size") should be(-1)
|
|
|
|
|
getString("task-queue-type") should be("linked")
|
|
|
|
|
getBoolean("allow-core-timeout") should be(true)
|
2012-01-30 13:44:56 +01:00
|
|
|
}
|
2012-07-13 12:21:55 +02:00
|
|
|
|
|
|
|
|
// Debug config
|
|
|
|
|
{
|
|
|
|
|
val debug = config.getConfig("akka.actor.debug")
|
|
|
|
|
import debug._
|
2013-12-17 14:25:56 +01:00
|
|
|
getBoolean("receive") should be(false)
|
|
|
|
|
settings.AddLoggingReceive should be(false)
|
2012-07-13 12:21:55 +02:00
|
|
|
|
2013-12-17 14:25:56 +01:00
|
|
|
getBoolean("autoreceive") should be(false)
|
|
|
|
|
settings.DebugAutoReceive should be(false)
|
2012-07-13 12:21:55 +02:00
|
|
|
|
2013-12-17 14:25:56 +01:00
|
|
|
getBoolean("lifecycle") should be(false)
|
|
|
|
|
settings.DebugLifecycle should be(false)
|
2012-07-13 12:21:55 +02:00
|
|
|
|
2013-12-17 14:25:56 +01:00
|
|
|
getBoolean("fsm") should be(false)
|
|
|
|
|
settings.FsmDebugEvent should be(false)
|
2012-07-13 12:21:55 +02:00
|
|
|
|
2013-12-17 14:25:56 +01:00
|
|
|
getBoolean("event-stream") should be(false)
|
|
|
|
|
settings.DebugEventStream should be(false)
|
2012-07-13 12:21:55 +02:00
|
|
|
|
2013-12-17 14:25:56 +01:00
|
|
|
getBoolean("unhandled") should be(false)
|
|
|
|
|
settings.DebugUnhandledMessage should be(false)
|
2012-07-13 12:21:55 +02:00
|
|
|
|
2013-12-17 14:25:56 +01:00
|
|
|
getBoolean("router-misconfiguration") should be(false)
|
|
|
|
|
settings.DebugRouterMisconfiguration should be(false)
|
2012-07-13 12:21:55 +02:00
|
|
|
}
|
2012-08-09 17:08:44 +02:00
|
|
|
|
2012-01-30 13:44:56 +01:00
|
|
|
}
|
2013-06-01 21:58:34 +02:00
|
|
|
|
|
|
|
|
{
|
|
|
|
|
val c = config.getConfig("akka.actor.default-mailbox")
|
|
|
|
|
|
|
|
|
|
// general mailbox config
|
|
|
|
|
|
|
|
|
|
{
|
2014-01-31 11:14:13 +01:00
|
|
|
c.getInt("mailbox-capacity") should be(1000)
|
|
|
|
|
c.getDuration("mailbox-push-timeout-time", TimeUnit.MILLISECONDS) should be(10 * 1000)
|
2013-12-17 14:25:56 +01:00
|
|
|
c.getString("mailbox-type") should be("akka.dispatch.UnboundedMailbox")
|
2013-06-01 21:58:34 +02:00
|
|
|
}
|
|
|
|
|
}
|
2011-03-08 04:58:57 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|