2011-12-19 11:07:59 +01:00
|
|
|
/**
|
2013-01-09 01:47:48 +01:00
|
|
|
* Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
|
2011-12-19 11:07:59 +01:00
|
|
|
*/
|
2012-05-22 11:37:09 +02:00
|
|
|
package docs.actor.mailbox;
|
2011-12-12 08:37:18 +01:00
|
|
|
|
|
|
|
|
//#imports
|
|
|
|
|
import akka.actor.Props;
|
2012-05-15 16:01:32 +02:00
|
|
|
import akka.actor.ActorRef;
|
2011-12-12 08:37:18 +01:00
|
|
|
|
|
|
|
|
//#imports
|
|
|
|
|
|
2013-05-02 17:12:36 +02:00
|
|
|
import akka.testkit.AkkaJUnitActorSystemResource;
|
|
|
|
|
import org.junit.ClassRule;
|
2011-12-12 08:37:18 +01:00
|
|
|
import org.junit.Test;
|
|
|
|
|
|
2011-12-19 20:36:06 +01:00
|
|
|
import akka.testkit.AkkaSpec;
|
|
|
|
|
import com.typesafe.config.ConfigFactory;
|
2011-12-12 08:37:18 +01:00
|
|
|
import akka.actor.ActorSystem;
|
2012-05-15 16:01:32 +02:00
|
|
|
import akka.actor.UntypedActor;
|
2011-12-12 08:37:18 +01:00
|
|
|
|
|
|
|
|
public class DurableMailboxDocTestBase {
|
|
|
|
|
|
2013-05-02 17:12:36 +02:00
|
|
|
@ClassRule
|
|
|
|
|
public static AkkaJUnitActorSystemResource actorSystemResource =
|
|
|
|
|
new AkkaJUnitActorSystemResource("DurableMailboxDocTest",
|
|
|
|
|
ConfigFactory.parseString(DurableMailboxDocSpec.config()).withFallback(AkkaSpec.testConf()));
|
2011-12-19 20:36:06 +01:00
|
|
|
|
2013-05-02 17:12:36 +02:00
|
|
|
private final ActorSystem system = actorSystemResource.getSystem();
|
2011-12-19 20:36:06 +01:00
|
|
|
|
2011-12-12 08:37:18 +01:00
|
|
|
@Test
|
2011-12-19 20:36:06 +01:00
|
|
|
public void configDefinedDispatcher() {
|
|
|
|
|
//#dispatcher-config-use
|
2013-04-14 22:56:41 +02:00
|
|
|
ActorRef myActor = system.actorOf(Props.create(MyUntypedActor.class).
|
2012-05-15 16:01:32 +02:00
|
|
|
withDispatcher("my-dispatcher"), "myactor");
|
2011-12-19 20:36:06 +01:00
|
|
|
//#dispatcher-config-use
|
2012-09-19 23:55:53 +02:00
|
|
|
myActor.tell("test", null);
|
2011-12-19 20:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
2011-12-12 08:37:18 +01:00
|
|
|
public static class MyUntypedActor extends UntypedActor {
|
|
|
|
|
public void onReceive(Object message) {
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-12-20 09:19:34 +01:00
|
|
|
|
2011-12-12 08:37:18 +01:00
|
|
|
}
|