2011-12-19 11:07:59 +01:00
|
|
|
/**
|
|
|
|
|
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
|
|
|
|
|
*/
|
2011-11-22 13:04:10 +01:00
|
|
|
package akka.docs.config
|
|
|
|
|
|
|
|
|
|
import org.scalatest.WordSpec
|
|
|
|
|
import org.scalatest.matchers.MustMatchers
|
|
|
|
|
|
|
|
|
|
//#imports
|
|
|
|
|
import akka.actor.ActorSystem
|
|
|
|
|
import com.typesafe.config.ConfigFactory
|
|
|
|
|
//#imports
|
|
|
|
|
|
2011-12-05 10:41:36 +01:00
|
|
|
class ConfigDocSpec extends WordSpec with MustMatchers {
|
2011-11-22 13:04:10 +01:00
|
|
|
|
|
|
|
|
"programmatically configure ActorSystem" in {
|
|
|
|
|
//#custom-config
|
|
|
|
|
val customConf = ConfigFactory.parseString("""
|
|
|
|
|
akka.actor.deployment {
|
2011-12-15 14:26:17 +01:00
|
|
|
/my-service {
|
2011-11-22 13:04:10 +01:00
|
|
|
router = round-robin
|
|
|
|
|
nr-of-instances = 3
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-11-29 11:50:22 +01:00
|
|
|
""")
|
2011-12-05 10:41:36 +01:00
|
|
|
// ConfigFactory.load sandwiches customConfig between default reference
|
|
|
|
|
// config and default overrides, and then resolves it.
|
|
|
|
|
val system = ActorSystem("MySystem", ConfigFactory.load(customConf))
|
2011-11-22 13:04:10 +01:00
|
|
|
//#custom-config
|
|
|
|
|
|
2011-12-14 01:06:20 +01:00
|
|
|
system.shutdown()
|
2011-11-22 13:04:10 +01:00
|
|
|
}
|
|
|
|
|
}
|