pekko/akka-docs/modules/code/akka/docs/actor/mailbox/DurableMailboxDocTestBase.java
Patrik Nordwall 8924080017 Create test-fixture for durable mailboxes. See #2061
* Improved DurableMailboxSpec for stand alone usage
* Changed build to publish DurableMailboxSpec in akka-mailboxes-common-test
* Changed documentation of durable mailboxes and added full example of
  how to implement a durable mailbox, with test
2012-05-15 16:11:00 +02:00

52 lines
1.1 KiB
Java

/**
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.docs.actor.mailbox;
//#imports
import akka.actor.Props;
import akka.actor.ActorRef;
//#imports
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import akka.testkit.AkkaSpec;
import com.typesafe.config.ConfigFactory;
import akka.actor.ActorSystem;
import akka.actor.UntypedActor;
import static org.junit.Assert.*;
public class DurableMailboxDocTestBase {
ActorSystem system;
@Before
public void setUp() {
system = ActorSystem.create("MySystem",
ConfigFactory.parseString(DurableMailboxDocSpec.config()).withFallback(AkkaSpec.testConf()));
}
@After
public void tearDown() {
system.shutdown();
}
@Test
public void configDefinedDispatcher() {
//#dispatcher-config-use
ActorRef myActor = system.actorOf(new Props(MyUntypedActor.class).
withDispatcher("my-dispatcher"), "myactor");
//#dispatcher-config-use
myActor.tell("test");
}
public static class MyUntypedActor extends UntypedActor {
public void onReceive(Object message) {
}
}
}