I would start an actor on that path that forwards all messages to the test
probe.
/Patrik

On Thu, May 21, 2015 at 7:22 AM, Kostas kougios <
[email protected]> wrote:

> Hi, I am trying to test actor code that uses actorSelection:
>
> val path = RootActorPath(member.address, name = "/user/clusterKeeper")
> context.actorSelection(path).resolveOne(5 seconds).foreach {
>     clusterKeeper =>
>       clusterKeeper ! msg
> }
>
>
> member.address comes from akka clusters and has the address of the remote
> actor.
>
> Now I need to mock/probe the clusterKeeper actor but TestProbe() doesn't
> have a way of defining the name of the actor or it's path. In fact it goes
> down to TestKitBase where it is hardcoded:
>
> val testActor: ActorRef = {
>   val impl = system.asInstanceOf[ExtendedActorSystem]
>   val ref = impl.systemActorOf(TestActor.props(queue)
>     .withDispatcher(CallingThreadDispatcher.Id),
>
> *"testActor" + TestKit.testActorId.incrementAndGet) * awaitCond(ref match {
>     case r: RepointableRef ⇒ r.isStarted
>     case _                 ⇒ true
>   }, 1 second, 10 millis)
>   ref
> }
>
>
> Is there a way with the testkit to test this? Ofcourse I could create an
> actor myself but then I would have to reimpl all expectMsg or maybe have it
> forward the messages to testkit.
>
> Similar post :
>
> https://groups.google.com/forum/#!searchin/akka-user/testprobe$20actorSelection/akka-user/ETL4XQr1Sj4/N9lo_6gc8voJ
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Patrik Nordwall
Typesafe <http://typesafe.com/> -  Reactive apps on the JVM
Twitter: @patriknw

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to