rename ActorPath.{pathElemens => elements}

This commit is contained in:
Roland 2011-12-05 15:57:43 +01:00
parent eeca88d674
commit 0b5f8b083d
5 changed files with 29 additions and 29 deletions

View file

@ -61,21 +61,21 @@ class ActorLookupSpec extends AkkaSpec {
}
"find actors by looking up their root-anchored relative path" in {
system.actorFor(c1.path.pathElements.mkString("/", "/", "")) must be === c1
system.actorFor(c2.path.pathElements.mkString("/", "/", "")) must be === c2
system.actorFor(c21.path.pathElements.mkString("/", "/", "")) must be === c21
system.actorFor(c1.path.elements.mkString("/", "/", "")) must be === c1
system.actorFor(c2.path.elements.mkString("/", "/", "")) must be === c2
system.actorFor(c21.path.elements.mkString("/", "/", "")) must be === c21
}
"find actors by looking up their relative path" in {
system.actorFor(c1.path.pathElements.mkString("/")) must be === c1
system.actorFor(c2.path.pathElements.mkString("/")) must be === c2
system.actorFor(c21.path.pathElements.mkString("/")) must be === c21
system.actorFor(c1.path.elements.mkString("/")) must be === c1
system.actorFor(c2.path.elements.mkString("/")) must be === c2
system.actorFor(c21.path.elements.mkString("/")) must be === c21
}
"find actors by looking up their path elements" in {
system.actorFor(c1.path.pathElements) must be === c1
system.actorFor(c2.path.pathElements) must be === c2
system.actorFor(c21.path.pathElements) must be === c21
system.actorFor(c1.path.elements) must be === c1
system.actorFor(c2.path.elements) must be === c2
system.actorFor(c21.path.elements) must be === c21
}
"find system-generated actors" in {
@ -109,10 +109,10 @@ class ActorLookupSpec extends AkkaSpec {
"find temporary actors" in {
val f = c1 ? GetSender(testActor)
val a = expectMsgType[ActorRef]
a.path.pathElements.head must be === "temp"
a.path.elements.head must be === "temp"
system.actorFor(a.path) must be === a
system.actorFor(a.path.toString) must be === a
system.actorFor(a.path.pathElements) must be === a
system.actorFor(a.path.elements) must be === a
system.actorFor(a.path.toString + "/") must be === a
system.actorFor(a.path.toString + "/hallo") must be === system.deadLetters
f.isCompleted must be === false
@ -151,8 +151,8 @@ class ActorLookupSpec extends AkkaSpec {
"find actors by looking up their root-anchored relative path" in {
def check(looker: ActorRef, pathOf: ActorRef, result: ActorRef) {
(looker ? LookupString(pathOf.path.pathElements.mkString("/", "/", ""))).get must be === result
(looker ? LookupString(pathOf.path.pathElements.mkString("/", "/", "/"))).get must be === result
(looker ? LookupString(pathOf.path.elements.mkString("/", "/", ""))).get must be === result
(looker ? LookupString(pathOf.path.elements.mkString("/", "/", "/"))).get must be === result
}
for {
looker all
@ -170,7 +170,7 @@ class ActorLookupSpec extends AkkaSpec {
for {
looker Seq(c1, c2)
target all
} check(looker, target, Seq("..") ++ target.path.pathElements.drop(1): _*)
} check(looker, target, Seq("..") ++ target.path.elements.drop(1): _*)
check(c21, user, "..", "..")
check(c21, root, "..", "..", "..")
check(c21, root, "..", "..", "..", "..")
@ -182,8 +182,8 @@ class ActorLookupSpec extends AkkaSpec {
(looker ? LookupPath(target.path)).get must be === target
(looker ? LookupString(target.path.toString)).get must be === target
(looker ? LookupString(target.path.toString + "/")).get must be === target
(looker ? LookupString(target.path.pathElements.mkString("/", "/", ""))).get must be === target
if (target != root) (looker ? LookupString(target.path.pathElements.mkString("/", "/", "/"))).get must be === target
(looker ? LookupString(target.path.elements.mkString("/", "/", ""))).get must be === target
if (target != root) (looker ? LookupString(target.path.elements.mkString("/", "/", "/"))).get must be === target
}
}
for (target Seq(root, syst, user, system.deadLetters)) check(target)
@ -207,16 +207,16 @@ class ActorLookupSpec extends AkkaSpec {
"find temporary actors" in {
val f = c1 ? GetSender(testActor)
val a = expectMsgType[ActorRef]
a.path.pathElements.head must be === "temp"
a.path.elements.head must be === "temp"
(c2 ? LookupPath(a.path)).get must be === a
(c2 ? LookupString(a.path.toString)).get must be === a
(c2 ? LookupString(a.path.pathElements.mkString("/", "/", ""))).get must be === a
(c2 ? LookupString("../../" + a.path.pathElements.mkString("/"))).get must be === a
(c2 ? LookupString(a.path.elements.mkString("/", "/", ""))).get must be === a
(c2 ? LookupString("../../" + a.path.elements.mkString("/"))).get must be === a
(c2 ? LookupString(a.path.toString + "/")).get must be === a
(c2 ? LookupString(a.path.pathElements.mkString("/", "/", "") + "/")).get must be === a
(c2 ? LookupString("../../" + a.path.pathElements.mkString("/") + "/")).get must be === a
(c2 ? LookupElems(Seq("..", "..") ++ a.path.pathElements)).get must be === a
(c2 ? LookupElems(Seq("..", "..") ++ a.path.pathElements :+ "")).get must be === a
(c2 ? LookupString(a.path.elements.mkString("/", "/", "") + "/")).get must be === a
(c2 ? LookupString("../../" + a.path.elements.mkString("/") + "/")).get must be === a
(c2 ? LookupElems(Seq("..", "..") ++ a.path.elements)).get must be === a
(c2 ? LookupElems(Seq("..", "..") ++ a.path.elements :+ "")).get must be === a
f.isCompleted must be === false
a ! 42
f.isCompleted must be === true

View file

@ -61,7 +61,7 @@ sealed trait ActorPath extends Comparable[ActorPath] {
/**
* Sequence of names for this path. Performance implication: has to allocate a list.
*/
def pathElements: Iterable[String]
def elements: Iterable[String]
/**
* Walk up the tree to obtain and return the RootActorPath.
@ -82,7 +82,7 @@ final case class RootActorPath(address: Address, name: String = ActorPath.separa
def /(child: String): ActorPath = new ChildActorPath(this, child)
val pathElements: Iterable[String] = List("")
val elements: Iterable[String] = List("")
override val toString = address + name
@ -98,7 +98,7 @@ final class ChildActorPath(val parent: ActorPath, val name: String) extends Acto
def /(child: String): ActorPath = new ChildActorPath(this, child)
def pathElements: Iterable[String] = {
def elements: Iterable[String] = {
@tailrec
def rec(p: ActorPath, acc: List[String]): Iterable[String] = p match {
case r: RootActorPath acc

View file

@ -451,7 +451,7 @@ class LocalActorRefProvider(
}
def actorFor(path: ActorPath): InternalActorRef =
if (path.root == rootPath) actorFor(rootGuardian, path.pathElements)
if (path.root == rootPath) actorFor(rootGuardian, path.elements)
else deadLetters
def actorFor(ref: InternalActorRef, path: Iterable[String]): InternalActorRef =

View file

@ -41,7 +41,7 @@ abstract class DurableMailbox(owner: ActorCell) extends Mailbox(owner) with Defa
def system = owner.system
def ownerPath = owner.self.path
val ownerPathString = ownerPath.pathElements.mkString("/")
val ownerPathString = ownerPath.elements.mkString("/")
val name = "mailbox_" + Name.replaceAllIn(ownerPathString, "_")
}

View file

@ -212,7 +212,7 @@ class RemoteActorRefProvider(
.setPayload(ByteString.copyFrom(actorFactoryBytes))
.build()
val connectionFactory = () actorFor(RootActorPath(remoteAddress) / remote.remoteDaemon.path.pathElements)
val connectionFactory = () actorFor(RootActorPath(remoteAddress) / remote.remoteDaemon.path.elements)
// try to get the connection for the remote address, if not already there then create it
val connection = remoteDaemonConnectionManager.putIfAbsent(remoteAddress, connectionFactory)