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

@ -6,6 +6,8 @@ package docs.camel;
import akka.camel.Camel;
import akka.camel.CamelExtension;
import akka.camel.javaapi.UntypedConsumerActor;
import akka.testkit.JavaTestKit;
import akka.testkit.TestKit;
import akka.util.Timeout;
import scala.concurrent.Future;
import scala.concurrent.duration.Duration;
@ -38,7 +40,7 @@ public class ActivationTestBase {
Future<ActorRef> deactivationFuture = camel.deactivationFutureFor(producer,
timeout, system.dispatcher());
//#CamelDeactivation
system.shutdown();
JavaTestKit.shutdownActorSystem(system);
}
public static class MyConsumer extends UntypedConsumerActor {

View file

@ -3,6 +3,7 @@ package docs.camel;
import akka.actor.ActorSystem;
import akka.camel.Camel;
import akka.camel.CamelExtension;
import akka.testkit.JavaTestKit;
import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.junit.Test;
@ -16,7 +17,7 @@ public class CamelExtensionTestBase {
CamelContext camelContext = camel.context();
ProducerTemplate producerTemplate = camel.template();
//#CamelExtension
system.shutdown();
JavaTestKit.shutdownActorSystem(system);
}
public void addActiveMQComponent() {
//#CamelExtensionAddComponent
@ -26,7 +27,7 @@ public class CamelExtensionTestBase {
// camelContext.addComponent("activemq", ActiveMQComponent.activeMQComponent(
// "vm://localhost?broker.persistent=false"));
//#CamelExtensionAddComponent
system.shutdown();
JavaTestKit.shutdownActorSystem(system);
}
}

View file

@ -5,6 +5,7 @@ import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.camel.Camel;
import akka.camel.CamelExtension;
import akka.testkit.JavaTestKit;
public class CustomRouteTestBase {
public void customRoute() throws Exception{
@ -15,6 +16,6 @@ public class CustomRouteTestBase {
camel.context().addRoutes(new CustomRouteBuilder(responder));
//#CustomRoute
system.stop(responder);
system.shutdown();
JavaTestKit.shutdownActorSystem(system);
}
}

View file

@ -1,6 +1,7 @@
package docs.camel;
import akka.actor.*;
import akka.testkit.JavaTestKit;
public class OnRouteResponseTestBase {
@ -17,6 +18,6 @@ public class OnRouteResponseTestBase {
//#RouteResponse
system.stop(receiver);
system.stop(forwardResponse);
system.shutdown();
JavaTestKit.shutdownActorSystem(system);
}
}

View file

@ -3,6 +3,7 @@ package docs.camel;
import java.util.HashMap;
import java.util.Map;
import akka.testkit.JavaTestKit;
import scala.concurrent.Future;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
@ -18,7 +19,7 @@ public class ProducerTestBase {
ActorRef producer = system.actorOf(props, "jmsproducer");
producer.tell("<order amount=\"100\" currency=\"PLN\" itemId=\"12345\"/>", null);
//#TellProducer
system.shutdown();
JavaTestKit.shutdownActorSystem(system);
}
@SuppressWarnings("unused")
@ -30,7 +31,7 @@ public class ProducerTestBase {
Future<Object> future = Patterns.ask(producer, "some request", 1000);
//#AskProducer
system.stop(producer);
system.shutdown();
JavaTestKit.shutdownActorSystem(system);
}
public void correlate(){
@ -44,6 +45,6 @@ public class ProducerTestBase {
"itemId=\"12345\"/>",headers), null);
//#Correlate
system.stop(producer);
system.shutdown();
JavaTestKit.shutdownActorSystem(system);
}
}