Hi Romain,

what exactly does not work? Please share a self-contained excerpt from your 
tests together with the expected and the actual output.

Regards,

Roland

5 jan 2014 kl. 14:22 skrev Romain Gilles <[email protected]>:

> Hi Roland,
> 
> First of all thank you for your help and sorry for the delay...
> So I decide to use the third option because it look like less intrusive but 
> even if I configure this it does not works:
> 
>     @BeforeClass
>     public static void setupClass() throws Exception {
>         final Config config = ConfigFactory.parseString(
>                 "  akka.actor.deployment {\n" +
>                         "    default {\n" +
>                         "        dispatcher = 
> \"akka.test.calling-thread-dispatcher\"" +
>                         "    }\n" +
>                         "    default-dispatcher {\n" +
>                         "        
> type=\"akka.testkit.CallingThreadDispatcher\"\n" +
>                         "    }\n" +
>                         "    \"/*/*\"  {\n" +
>                         "        dispatcher = 
> \"akka.test.calling-thread-dispatcher\"\n" +
>                         "    }\n" +
>                         "}");
>         system = ActorSystem.create("test", 
> config.withFallback(ConfigFactory.load()));
>     }
> 
> So I fallback to the first option where I provide a constructor with an 
> optional dispatcher Id and then us it on props at actor creation time on the 
> context.
> 
> Any Ideas?
> 
> Thanks in advance,
> 
> Romain.
> 
> Le samedi 4 janvier 2014 14:31:45 UTC+1, rkuhn a écrit :
> Hi Romain,
> 
> 4 jan 2014 kl. 02:23 skrev Romain Gilles <[email protected]>:
> 
>> Hi all,
>> I'm a beginner in akka. And I found it great so first of all thank you for 
>> this great job!
>> I'm would like to test my actor in Java and I would like to use the unit 
>> test approach as describe in the documentation. Therefore I'm using the 
>> TestActorRef.create(...) method to create my Actor under testing.
>> But unfortunately this actor create child actor for its context: 
>> getContext().actorOf(...).
>> I the second case the actor creation does not use the Calling thread 
>> dispatcher strategy. 
>> Is there a way to make this strategy global for all actor creation? For the 
>> moment I use a workaround by delegating the creation of the actor to a third 
>> component that I switch the implementation for the test cases.
> 
> There are two ways to achieve that: you can use 
> .withDispatcher(context.props.dispatcher) when creating the child, or you can 
> use a configuration file in your tests (typically 
> src/test/resources/application.conf) which configures the 
> CallingThreadDispatcher for "/*/childName" if the children are named 
> uniformly; otherwise you can add the deployment section to the configuration 
> you use when creating the ActorSystem in your test:
> 
> final Config config = ConfigFactory.parseString(
> "  akka.actor.deployment {\n" +
> "    /*/* {\n" +
> "      dispatcher = \"akka.test.calling-thread-dispatcher\"\n" +
> "    }}");
> final ActorSystem system = ActorSystem.create("MyTest", 
> config.withFallback(ConfigFactory.load()));
> 
> Regards,
> 
> Roland
> 
>> 
>> Thanks in advance,
>> 
>> Romain.
>> 
>> -- 
>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ: http://akka.io/faq/
>> >>>>>>>>>> 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/groups/opt_out.
> 
> 
> 
> Dr. Roland Kuhn
> Akka Tech Lead
> Typesafe – Reactive apps on the JVM.
> twitter: @rolandkuhn
> 
> 
> 
> -- 
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://akka.io/faq/
> >>>>>>>>>> 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/groups/opt_out.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Reactive apps on the JVM.
twitter: @rolandkuhn


-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: http://akka.io/faq/
>>>>>>>>>>      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/groups/opt_out.

Reply via email to