From 59dce7c6b6368b6e8e7f375f4504bb514361045b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Andre=CC=81n?= Date: Mon, 23 Jan 2017 16:12:56 +0100 Subject: [PATCH] Custom ActorSystem creation in MultiNodeSpec #22180 --- .../scala/akka/remote/testkit/MultiNodeSpec.scala | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/akka-multi-node-testkit/src/main/scala/akka/remote/testkit/MultiNodeSpec.scala b/akka-multi-node-testkit/src/main/scala/akka/remote/testkit/MultiNodeSpec.scala index fa9b723c3f..ed907d4418 100644 --- a/akka-multi-node-testkit/src/main/scala/akka/remote/testkit/MultiNodeSpec.scala +++ b/akka-multi-node-testkit/src/main/scala/akka/remote/testkit/MultiNodeSpec.scala @@ -255,9 +255,16 @@ abstract class MultiNodeSpec(val myself: RoleName, _system: ActorSystem, _roles: import MultiNodeSpec._ + /** + * Constructor for using arbitrary logic to create the actor system used in + * the multi node spec (the `Config` passed to the creator must be used in + * the created actor system for the multi node tests to work) + */ + def this(config: MultiNodeConfig, actorSystemCreator: Config ⇒ ActorSystem) = + this(config.myself, actorSystemCreator(ConfigFactory.load(config.config)), config.roles, config.deployments) + def this(config: MultiNodeConfig) = - this(config.myself, ActorSystem(MultiNodeSpec.getCallerName(classOf[MultiNodeSpec]), ConfigFactory.load(config.config)), - config.roles, config.deployments) + this(config, config ⇒ ActorSystem(MultiNodeSpec.getCallerName(classOf[MultiNodeSpec]), config)) val log: LoggingAdapter = Logging(system, this.getClass)