-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
ConfigSpec.scala
151 lines (114 loc) · 5.32 KB
/
ConfigSpec.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.config
import language.postfixOps
import akka.testkit.AkkaSpec
import com.typesafe.config.ConfigFactory
import scala.collection.JavaConverters._
import scala.concurrent.duration._
import akka.actor.ActorSystem
import akka.event.Logging.DefaultLogger
import java.util.concurrent.TimeUnit
@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner])
class ConfigSpec extends AkkaSpec(ConfigFactory.defaultReference(ActorSystem.findClassLoader())) {
"The default configuration file (i.e. reference.conf)" must {
"contain all configuration properties for akka-actor that are used in code with their correct defaults" in {
val settings = system.settings
val config = settings.config
{
import config._
getString("akka.version") should be("2.3.0")
settings.ConfigVersion should be("2.3.0")
getBoolean("akka.daemonic") should be(false)
// WARNING: This setting should be off in the default reference.conf, but should be on when running
// the test suite.
getBoolean("akka.actor.serialize-messages") should be(true)
settings.SerializeAllMessages should be(true)
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")
getBoolean("akka.daemonic") should be(false)
settings.Daemonicity should be(false)
getBoolean("akka.jvm-exit-on-fatal-error") should be(true)
settings.JvmExitOnFatalError should be(true)
getInt("akka.actor.deployment.default.virtual-nodes-factor") should be(10)
settings.DefaultVirtualNodesFactor should be(10)
getDuration("akka.actor.unstarted-push-timeout", TimeUnit.MILLISECONDS) should be(10.seconds.toMillis)
settings.UnstartedPushTimeout.duration should be(10.seconds)
settings.Loggers.size should be(1)
settings.Loggers.head should be(classOf[DefaultLogger].getName)
getStringList("akka.loggers").get(0) should be(classOf[DefaultLogger].getName)
getDuration("akka.logger-startup-timeout", TimeUnit.MILLISECONDS) should be(5.seconds.toMillis)
settings.LoggerStartTimeout.duration should be(5.seconds)
getInt("akka.log-dead-letters") should be(10)
settings.LogDeadLetters should be(10)
getBoolean("akka.log-dead-letters-during-shutdown") should be(true)
settings.LogDeadLettersDuringShutdown should be(true)
}
{
val c = config.getConfig("akka.actor.default-dispatcher")
//General dispatcher config
{
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)
}
//Default executor config
{
val pool = c.getConfig("default-executor")
pool.getString("fallback") should be("fork-join-executor")
}
//Fork join executor config
{
val pool = c.getConfig("fork-join-executor")
pool.getInt("parallelism-min") should be(8)
pool.getDouble("parallelism-factor") should be(3.0)
pool.getInt("parallelism-max") should be(64)
}
//Thread pool executor config
{
val pool = c.getConfig("thread-pool-executor")
import pool._
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)
}
// Debug config
{
val debug = config.getConfig("akka.actor.debug")
import debug._
getBoolean("receive") should be(false)
settings.AddLoggingReceive should be(false)
getBoolean("autoreceive") should be(false)
settings.DebugAutoReceive should be(false)
getBoolean("lifecycle") should be(false)
settings.DebugLifecycle should be(false)
getBoolean("fsm") should be(false)
settings.FsmDebugEvent should be(false)
getBoolean("event-stream") should be(false)
settings.DebugEventStream should be(false)
getBoolean("unhandled") should be(false)
settings.DebugUnhandledMessage should be(false)
getBoolean("router-misconfiguration") should be(false)
settings.DebugRouterMisconfiguration should be(false)
}
}
{
val c = config.getConfig("akka.actor.default-mailbox")
// general mailbox config
{
c.getInt("mailbox-capacity") should be(1000)
c.getDuration("mailbox-push-timeout-time", TimeUnit.MILLISECONDS) should be(10 * 1000)
c.getString("mailbox-type") should be("akka.dispatch.UnboundedMailbox")
}
}
}
}
}