fix memory leaks in tests, #20659

This commit is contained in:
Patrik Nordwall 2016-05-30 12:54:27 +02:00
parent 6a13d99bfc
commit be448e9fbb
36 changed files with 144 additions and 153 deletions

View file

@ -151,7 +151,7 @@ public class FaultHandlingTest extends AbstractJavaTest {
@BeforeClass
public static void start() {
system = ActorSystem.create("test");
system = ActorSystem.create("FaultHandlingTest");
}
@AfterClass

View file

@ -22,10 +22,10 @@ import akka.testkit.AkkaJUnitActorSystemResource;
import org.junit.*;
public class SchedulerDocTest extends AbstractJavaTest {
@Rule
public AkkaJUnitActorSystemResource actorSystemResource =
new AkkaJUnitActorSystemResource("SchedulerDocTest", AkkaSpec.testConf());
@ClassRule
public static AkkaJUnitActorSystemResource actorSystemResource = new AkkaJUnitActorSystemResource("SchedulerDocTest",
AkkaSpec.testConf());
private final ActorSystem system = actorSystemResource.getSystem();
private ActorRef testActor = system.actorOf(Props.create(MyUntypedActor.class));

View file

@ -11,11 +11,14 @@ public class CustomRouteTestBase {
public void customRoute() throws Exception{
//#CustomRoute
ActorSystem system = ActorSystem.create("some-system");
Camel camel = CamelExtension.get(system);
ActorRef responder = system.actorOf(Props.create(Responder.class), "TestResponder");
camel.context().addRoutes(new CustomRouteBuilder(responder));
//#CustomRoute
system.stop(responder);
JavaTestKit.shutdownActorSystem(system);
try {
Camel camel = CamelExtension.get(system);
ActorRef responder = system.actorOf(Props.create(Responder.class), "TestResponder");
camel.context().addRoutes(new CustomRouteBuilder(responder));
//#CustomRoute
system.stop(responder);
} finally {
JavaTestKit.shutdownActorSystem(system);
}
}
}

View file

@ -130,6 +130,11 @@ public class SchedulerPatternTest extends AbstractJavaTest {
testSchedule(probe, props, duration("3000 millis"), duration("2500 millis"));
}};
}
@Test
public void doNothing() {
// actorSystemResource.after is not called when all tests are ignored
}
public static class TestSchedule extends JavaTestKit {
private ActorSystem system;