Skip to content

Commit

Permalink
Merge pull request akka#26831 from akka/wip-26190-actorFor-patriknw
Browse files Browse the repository at this point in the history
 Remove remainings of actorFor, akka#26190
  • Loading branch information
patriknw authored May 2, 2019
2 parents e2fafb9 + 14de568 commit e34a711
Show file tree
Hide file tree
Showing 19 changed files with 69 additions and 743 deletions.
294 changes: 0 additions & 294 deletions akka-actor-tests/src/test/scala/akka/actor/ActorLookupSpec.scala

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ object ActorSystemSpec {
@silent
final case class FastActor(latch: TestLatch, testActor: ActorRef) extends Actor {
val ref1 = context.actorOf(Props.empty)
val ref2 = context.actorFor(ref1.path.toString)
testActor ! ref2.getClass
context.actorSelection(ref1.path.toString).tell(Identify(ref1), testActor)
latch.countDown()

def receive = {
Expand Down Expand Up @@ -293,7 +292,7 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend

"find actors that just have been created" in {
system.actorOf(Props(new FastActor(TestLatch(), testActor)).withDispatcher("slow"))
expectMsgType[Class[_]] should ===(classOf[LocalActorRef])
expectMsgType[ActorIdentity].ref should !==(None)
}

"reliable deny creation of actors while shutting down" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,16 @@ object LocalActorRefProviderSpec {
class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.config) {
"An LocalActorRefProvider" must {

"find actor refs using actorFor" in {
val a = system.actorOf(Props(new Actor { def receive = { case _ => } }))
val b = system.actorFor(a.path)
a should ===(b)
}

"find child actor with URL encoded name using actorFor" in {
"find child actor with URL encoded name" in {
val childName = "akka%3A%2F%2FClusterSystem%40127.0.0.1%3A2552"
val a = system.actorOf(Props(new Actor {
val child = context.actorOf(Props.empty, name = childName)
def receive = {
case "lookup" =>
if (childName == child.path.name) sender() ! context.actorFor(childName)
else sender() ! s"$childName is not ${child.path.name}!"
if (childName == child.path.name) {
val resolved = system.asInstanceOf[ExtendedActorSystem].provider.resolveActorRef(child.path)
sender() ! resolved
} else sender() ! s"$childName is not ${child.path.name}!"
}
}))
a.tell("lookup", testActor)
Expand Down
5 changes: 2 additions & 3 deletions akka-actor-tests/src/test/scala/akka/pattern/AskSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class AskSpec extends AkkaSpec {
}

"return broken promises on DeadLetters" in {
val dead = system.actorFor("/system/deadLetters")
val f = dead.ask(42)(1 second)
val f = system.deadLetters.ask(42)(1 second)
f.isCompleted should ===(true)
f.value.get match {
case Failure(_: AskTimeoutException) =>
Expand All @@ -37,7 +36,7 @@ class AskSpec extends AkkaSpec {

"return broken promises on EmptyLocalActorRefs" in {
implicit val timeout = Timeout(5 seconds)
val empty = system.actorFor("unknown")
val empty = system.asInstanceOf[ExtendedActorSystem].provider.resolveActorRef("/user/unknown")
val f = empty ? 3.14
f.isCompleted should ===(true)
f.value.get match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ class ConfiguredLocalRoutingSpec

"not get confused when trying to wildcard-configure children" in {
system.actorOf(FromConfig.props(routeeProps = Props(classOf[SendRefAtStartup], testActor)), "weird")
val recv = Set() ++ (for (_ <- 1 to 3) yield expectMsgType[ActorRef])
val recv = (for (_ <- 1 to 3) yield expectMsgType[ActorRef].path.elements.mkString("/", "/", "")).toSet
@silent
val expc = Set('a', 'b', 'c').map(i => system.actorFor("/user/weird/$" + i))
val expc = Set('a', 'b', 'c').map(i => "/user/weird/$" + i)
recv should ===(expc)
expectNoMessage(1 second)
}
Expand Down
9 changes: 9 additions & 0 deletions akka-actor/src/main/mima-filters/2.5.x.backwards.excludes
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ ProblemFilters.exclude[MissingClassProblem]("akka.actor.ActorDSL$")
ProblemFilters.exclude[MissingClassProblem]("akka.actor.ActorDSL")
ProblemFilters.exclude[MissingClassProblem]("akka.actor.ActorDSL$*")
ProblemFilters.exclude[MissingClassProblem]("akka.actor.dsl.*")

# #26190 remove actorFor
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.actor.ActorCell.actorFor")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.actor.ActorRefProvider.actorFor")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.actor.LocalActorRefProvider.actorFor")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.actor.ActorRefFactory.actorFor")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.actor.ActorSystem.actorFor")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.actor.ChildActorPath.this")
ProblemFilters.exclude[MissingClassProblem]("akka.actor.dungeon.UndefinedUidActorRef")
2 changes: 1 addition & 1 deletion akka-actor/src/main/scala/akka/actor/ActorCell.scala
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ private[akka] object ActorCell {
// Note that this uid is also used as hashCode in ActorRef, so be careful
// to not break hashing if you change the way uid is generated
val uid = ThreadLocalRandom.current.nextInt()
if (uid == undefinedUid) newUid
if (uid == undefinedUid) newUid()
else uid
}

Expand Down
Loading

0 comments on commit e34a711

Please sign in to comment.