Well, in my case, I'm creating TestProbes and passing them into the actor
under test so that I can verify what it does with them.
For example, I have one class which communicates with 3 other actors and I
mock out all of them with TestProbes.

However, it does feel like a lot of work which is a clue I may be not doing
this the best way.

Cheers,
Edward


On Thu, May 22, 2014 at 2:48 PM, Filippo De Luca <m...@filippodeluca.com>wrote:

> Hi Edward,
> In that case it is easy: When an actor need to start a child, I'll pass a
> Props instance for that actor. So that the actor will be supervised by the
> parent but the dependencies of the constructor for the child are hidden.
>
> ex:
> class ParentActor(childProps: Props) {
>
>    val child = context.actorOf(childProps.withRouter(...), "child")
>
>    ...
> }
>
> object ParentActor {
>
>   def props(childProps: Props) = Props(classOf[ParentActor], childProps)
>
> }
>
> class ChildActor(mailServer: MailServer, ....) {
>
>   ....
> }
>
> object ChildActor {
>
>   def props(mailServer: MailServer, ....) = Props(classOf[ChildActor],
> mailServer, ....)
>
> }
>
> val childProps = ChildActor.props(mailServer, ....)
>
> ....
>
> val toTest = system.actorOf(ParentActor.props(childProps), "parent")
>
>
>
>
> On 22 May 2014 21:48, Edward Sargisson <ejsa...@gmail.com> wrote:
>
>> I'd love to hear the answer to this too!
>> I've solved the problem by injecting actorRefs but it does seem to lose
>> the point of actor supervision.
>> The other technique I've tried in one spot is to use the TestActorRef to
>> get the underlyingActor and then set the actorRef on that. This means that
>> actor construction can do things normally - and then I override it.
>>
>> Cheers,
>> Edward
>>
>>
>> On Thursday, May 22, 2014 3:30:10 AM UTC-7, Filippo De Luca wrote:
>>
>>> Hi Guys,
>>> I am wondering if is it possible to use a probe to test an actor that
>>> reference the other actor by actor path.
>>>
>>> For example it can use actorFor("/user/foo/bar") or
>>> actorFor("../my-sibling-actor") is there a way to inject a probe inside
>>> the actor-system.
>>>
>>> This bring to my mind another question, is it a good practice to
>>> reference an actor by the path, or is better to pass the actorRef as
>>> parameter when possible?
>>>
>>> Thanks for your help.
>>> --
>>> *Filippo De Luca*
>>> ---------------------
>>> WWW: http://filippodeluca.com
>>> IM:  filosg...@gmail.com
>>>
>>  --
>> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to akka-user@googlegroups.com.
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> *Filippo De Luca*
> ---------------------
> WWW: http://filippodeluca.com
> IM:  filosgang...@gmail.com
>
> --
> >>>>>>>>>> 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/v0SZ6C9l4uQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> 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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
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