From b5bcdb081fe5628f5db904563d98bb2a0aeaf8d1 Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Fri, 16 Nov 2012 17:30:27 +0100 Subject: [PATCH] Minor RoutingSpec refactoring --- .../src/test/scala/akka/routing/RoutingSpec.scala | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala b/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala index 6dcb564190..9d7522f950 100644 --- a/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala @@ -101,13 +101,13 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with } "be able to send their routees" in { - + case class TestRun(id: String, names: immutable.Iterable[String], actors: Int) val actor = system.actorOf(Props(new Actor { def receive = { - case (id: String, names: immutable.Iterable[_], actors: Int) ⇒ + case TestRun(id, names, actors) ⇒ val routerProps = Props[TestActor].withRouter( ScatterGatherFirstCompletedRouter( - routees = names collect { case name: String ⇒ context.actorOf(Props(new TestActor), name) }, + routees = names map { context.actorOf(Props(new TestActor), _) }, within = 5 seconds)) 1 to actors foreach { i ⇒ context.actorOf(routerProps, id + i).tell(CurrentRoutees, testActor) } @@ -117,14 +117,13 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with val actors = 15 val names = 1 to 20 map { "routee" + _ } toList - actor ! (("test", names, actors)) + actor ! TestRun("test", names, actors) 1 to actors foreach { _ ⇒ val routees = expectMsgType[RouterRoutees].routees routees.map(_.path.name) must be === names } expectNoMsg(500.millis) - actor ! PoisonPill } "use configured nr-of-instances when FromConfig" in {