Adding DispatcherPrerequisites to hold the common dependencies that a dispatcher needs to be created

This commit is contained in:
Viktor Klang 2011-11-17 16:09:18 +01:00
commit 80d766b07b
139 changed files with 1126 additions and 948 deletions

View file

@ -8,6 +8,8 @@ import akka.actor._
import akka.util._
import com.eaio.uuid.UUID
import akka.actor.ActorSystem
import akka.event.EventStream
import akka.dispatch.{ DispatcherPrerequisites, Mailbox }
/**
* This is a specialised form of the TestActorRef with support for querying and
@ -34,8 +36,13 @@ import akka.actor.ActorSystem
* @author Roland Kuhn
* @since 1.2
*/
class TestFSMRef[S, D, T <: Actor](app: ActorSystem, props: Props, supervisor: ActorRef, name: String)(implicit ev: T <:< FSM[S, D])
extends TestActorRef(app, props, supervisor, name) {
class TestFSMRef[S, D, T <: Actor](
system: ActorSystemImpl,
_prerequisites: DispatcherPrerequisites,
props: Props,
supervisor: ActorRef,
name: String)(implicit ev: T <:< FSM[S, D])
extends TestActorRef(system, _prerequisites, props, supervisor, name) {
private def fsm: T = underlyingActor
@ -80,9 +87,13 @@ class TestFSMRef[S, D, T <: Actor](app: ActorSystem, props: Props, supervisor: A
object TestFSMRef {
def apply[S, D, T <: Actor](factory: T)(implicit ev: T <:< FSM[S, D], app: ActorSystem): TestFSMRef[S, D, T] =
new TestFSMRef(app, Props(creator = () factory), app.guardian, TestActorRef.randomName)
def apply[S, D, T <: Actor](factory: T)(implicit ev: T <:< FSM[S, D], system: ActorSystem): TestFSMRef[S, D, T] = {
val impl = system.asInstanceOf[ActorSystemImpl]
new TestFSMRef(impl, system.dispatcherFactory.prerequisites, Props(creator = () factory), impl.guardian, TestActorRef.randomName)
}
def apply[S, D, T <: Actor](factory: T, name: String)(implicit ev: T <:< FSM[S, D], app: ActorSystem): TestFSMRef[S, D, T] =
new TestFSMRef(app, Props(creator = () factory), app.guardian, name)
def apply[S, D, T <: Actor](factory: T, name: String)(implicit ev: T <:< FSM[S, D], system: ActorSystem): TestFSMRef[S, D, T] = {
val impl = system.asInstanceOf[ActorSystemImpl]
new TestFSMRef(impl, system.dispatcherFactory.prerequisites, Props(creator = () factory), impl.guardian, name)
}
}