The forwarding actor is actually included in
akka.testkit.TestActors.ForwardActor
<https://github.com/akka/akka/blob/v2.4-M1/akka-testkit/src/main/scala/akka/testkit/TestActors.scala#L27-L31>
in
Akka 2.4-M1.
/Patrik

On Fri, May 22, 2015 at 3:16 PM, Konstantinos Kougios <
[email protected]> wrote:

>  Thanks Patrik, I actually thought of that too but was wondering if there
> is any testkit support for it. Then ended up impl a test-only actor that
> gathers all received messages and my test suite can get them as a stream
> (blocking if the stream is empty in order to wait for the threading bit to
> work). Since this is a normal actor, I can create it as I wish and also I
> can assert on the messages via normal testActor.messages should contain().
> I am in the process of writing that code and will replace some of my
> testcases/TestProbe's with it.
>
>
> On 22/05/15 14:09, Patrik Nordwall wrote:
>
> 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 a topic in the
> Google Groups "Akka User List" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/akka-user/DK0evQ1utCA/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
>
>
>  --
> >>>>>>>>>> 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