+tes #17023 Adding ForwardActor among test-kit actors

This commit is contained in:
Ekin Gecikligun 2015-03-24 18:39:43 +02:00
parent 823ccdd3ca
commit 6b1b8316c7
2 changed files with 25 additions and 2 deletions

View file

@ -3,7 +3,7 @@
*/
package akka.testkit
import akka.actor.{ Props, Actor }
import akka.actor.{ Props, Actor, ActorRef }
/**
* A collection of common actor patterns used in tests.
@ -19,6 +19,18 @@ object TestActors {
}
}
/**
* ForwardActor forwards all messages as-is to specified ActorRef.
*
* @param ref target ActorRef to forward messages to
*/
class ForwardActor(ref: ActorRef) extends Actor {
override def receive = {
case message ref forward message
}
}
val echoActorProps = Props[EchoActor]()
def forwardActorProps(ref: ActorRef) = Props(classOf[ForwardActor], ref)
}