Minor RoutingSpec refactoring
This commit is contained in:
parent
ef84352289
commit
b5bcdb081f
1 changed files with 4 additions and 5 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue