Rename address to name or path where appropriate

- TypedActor: address -> name
- TestActorRef, TestFSMRef: address -> name
- Props.randomAddress -> randomName
- Remote protocol: address -> name
- Address.validate moved to ActorPath
This commit is contained in:
Peter Vlugter 2011-11-08 14:30:33 +01:00
parent 3f7cff141d
commit 7b8a865c00
20 changed files with 284 additions and 287 deletions

View file

@ -41,25 +41,25 @@ class TestActorRef[T <: Actor](_app: AkkaApplication, _props: Props, _supervisor
object TestActorRef {
def apply[T <: Actor](factory: T)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), Props.randomAddress)
def apply[T <: Actor](factory: T)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), Props.randomName)
def apply[T <: Actor](factory: T, address: String)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), address)
def apply[T <: Actor](factory: T, name: String)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), name)
def apply[T <: Actor](props: Props)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](props, Props.randomAddress)
def apply[T <: Actor](props: Props)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](props, Props.randomName)
def apply[T <: Actor](props: Props, address: String)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](props, app.guardian, address)
def apply[T <: Actor](props: Props, name: String)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](props, app.guardian, name)
def apply[T <: Actor](props: Props, supervisor: ActorRef, address: String)(implicit app: AkkaApplication): TestActorRef[T] = {
val name: String = address match {
case null | Props.randomAddress newUuid.toString
case given given
def apply[T <: Actor](props: Props, supervisor: ActorRef, givenName: String)(implicit app: AkkaApplication): TestActorRef[T] = {
val name: String = givenName match {
case null | Props.randomName newUuid.toString
case given given
}
new TestActorRef(app, props, supervisor, name)
}
def apply[T <: Actor](implicit m: Manifest[T], app: AkkaApplication): TestActorRef[T] = apply[T](Props.randomAddress)
def apply[T <: Actor](implicit m: Manifest[T], app: AkkaApplication): TestActorRef[T] = apply[T](Props.randomName)
def apply[T <: Actor](address: String)(implicit m: Manifest[T], app: AkkaApplication): TestActorRef[T] = apply[T](Props({
def apply[T <: Actor](name: String)(implicit m: Manifest[T], app: AkkaApplication): TestActorRef[T] = apply[T](Props({
import ReflectiveAccess.{ createInstance, noParams, noArgs }
createInstance[T](m.erasure, noParams, noArgs) match {
case Right(value) value
@ -69,5 +69,5 @@ object TestActorRef {
"\nif so put it outside the class/trait, f.e. in a companion object," +
"\nOR try to change: 'actorOf[MyActor]' to 'actorOf(new MyActor)'.", exception)
}
}), address)
}), name)
}