Wait on shutdown of extra actor systems in tests. See #3217

This commit is contained in:
Björn Antonsson 2013-05-02 17:12:36 +02:00
parent 3bc661bed6
commit e00ab533bb
84 changed files with 762 additions and 845 deletions

View file

@ -3,8 +3,8 @@
*/
package docs.jrouting;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import akka.testkit.AkkaJUnitActorSystemResource;
import org.junit.ClassRule;
import org.junit.Test;
import akka.testkit.JavaTestKit;
import akka.actor.ActorSystem;
@ -27,17 +27,11 @@ import akka.routing.ConsistentHashingRouter.ConsistentHashableEnvelope;
public class ConsistentHashingRouterDocTestBase {
static ActorSystem system;
@BeforeClass
public static void setup() {
system = ActorSystem.create();
}
@AfterClass
public static void teardown() {
system.shutdown();
}
@ClassRule
public static AkkaJUnitActorSystemResource actorSystemResource =
new AkkaJUnitActorSystemResource("ConsistentHashingRouterDocTest");
private final ActorSystem system = actorSystemResource.getSystem();
static
//#cache-actor

View file

@ -14,9 +14,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import akka.testkit.AkkaJUnitActorSystemResource;
import org.junit.*;
import scala.concurrent.Await;
import scala.concurrent.Future;
@ -38,17 +37,11 @@ import akka.util.Timeout;
public class CustomRouterDocTestBase {
ActorSystem system;
@ClassRule
public static AkkaJUnitActorSystemResource actorSystemResource =
new AkkaJUnitActorSystemResource("CustomRouterDocTest", AkkaSpec.testConf());
@Before
public void setUp() {
system = ActorSystem.create("MySystem", AkkaSpec.testConf());
}
@After
public void tearDown() {
system.shutdown();
}
private final ActorSystem system = actorSystemResource.getSystem();
public static class MyActor extends UntypedActor {
@Override public void onReceive(Object o) {}

View file

@ -5,8 +5,8 @@ package docs.jrouting;
import java.util.Arrays;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import akka.testkit.AkkaJUnitActorSystemResource;
import org.junit.ClassRule;
import org.junit.Test;
import akka.actor.ActorRef;
@ -23,17 +23,11 @@ import docs.routing.RouterViaProgramDocSpec.Echo;
public class RouterViaProgramDocTestBase {
static ActorSystem system;
@BeforeClass
public static void setup() {
system = ActorSystem.create();
}
@AfterClass
public static void teardown() {
system.shutdown();
}
@ClassRule
public static AkkaJUnitActorSystemResource actorSystemResource =
new AkkaJUnitActorSystemResource("RouterViaProgramDocTest");
private final ActorSystem system = actorSystemResource.getSystem();
private static class JavaTestKitWithSelf extends JavaTestKit {
public JavaTestKitWithSelf(ActorSystem system) {