2012-06-15 13:04:10 +02:00
|
|
|
/**
|
2013-01-09 01:47:48 +01:00
|
|
|
* Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
|
2012-06-15 13:04:10 +02:00
|
|
|
*/
|
|
|
|
|
|
2011-01-04 13:24:28 +01:00
|
|
|
package akka.actor;
|
|
|
|
|
|
2012-04-10 12:07:14 +02:00
|
|
|
import akka.event.Logging;
|
|
|
|
|
import akka.event.Logging.LoggerInitialized;
|
2011-01-04 13:24:28 +01:00
|
|
|
import akka.japi.Creator;
|
2012-04-10 12:07:14 +02:00
|
|
|
import akka.routing.CurrentRoutees;
|
|
|
|
|
import akka.routing.FromConfig;
|
|
|
|
|
import akka.routing.NoRouter;
|
2013-05-02 17:12:36 +02:00
|
|
|
import akka.testkit.AkkaJUnitActorSystemResource;
|
2011-11-30 15:16:20 +01:00
|
|
|
import akka.testkit.AkkaSpec;
|
|
|
|
|
|
2013-05-02 17:12:36 +02:00
|
|
|
import org.junit.ClassRule;
|
2011-01-04 13:24:28 +01:00
|
|
|
import org.junit.Test;
|
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
|
|
|
|
|
|
public class JavaAPI {
|
|
|
|
|
|
2013-05-02 17:12:36 +02:00
|
|
|
@ClassRule
|
|
|
|
|
public static AkkaJUnitActorSystemResource actorSystemResource =
|
|
|
|
|
new AkkaJUnitActorSystemResource("JAvaAPI", AkkaSpec.testConf());
|
2011-11-30 15:16:20 +01:00
|
|
|
|
2013-05-02 17:12:36 +02:00
|
|
|
private final ActorSystem system = actorSystemResource.getSystem();
|
2011-11-30 15:16:20 +01:00
|
|
|
|
2012-04-10 12:07:14 +02:00
|
|
|
// compilation tests
|
|
|
|
|
@SuppressWarnings("unused")
|
|
|
|
|
public void mustCompile() {
|
2012-04-10 16:49:29 +02:00
|
|
|
final Kill kill = Kill.getInstance();
|
|
|
|
|
final PoisonPill pill = PoisonPill.getInstance();
|
|
|
|
|
final ReceiveTimeout t = ReceiveTimeout.getInstance();
|
2012-04-10 12:07:14 +02:00
|
|
|
|
2012-04-10 16:49:29 +02:00
|
|
|
final LocalScope ls = LocalScope.getInstance();
|
|
|
|
|
final NoScopeGiven noscope = NoScopeGiven.getInstance();
|
2012-04-10 12:07:14 +02:00
|
|
|
|
|
|
|
|
final LoggerInitialized x = Logging.loggerInitialized();
|
|
|
|
|
|
2012-04-10 16:49:29 +02:00
|
|
|
final CurrentRoutees r = CurrentRoutees.getInstance();
|
|
|
|
|
final NoRouter nr = NoRouter.getInstance();
|
|
|
|
|
final FromConfig fc = FromConfig.getInstance();
|
2012-04-10 12:07:14 +02:00
|
|
|
}
|
2011-10-13 13:41:44 +02:00
|
|
|
|
2011-11-15 11:34:39 +01:00
|
|
|
@Test
|
2011-11-30 15:16:20 +01:00
|
|
|
public void mustBeAbleToCreateActorRefFromClass() {
|
2013-05-02 17:00:44 +02:00
|
|
|
ActorRef ref = system.actorOf(Props.create(JavaAPITestActor.class));
|
2011-11-15 11:34:39 +01:00
|
|
|
assertNotNull(ref);
|
2011-01-04 13:24:28 +01:00
|
|
|
}
|
|
|
|
|
|
2011-11-15 11:34:39 +01:00
|
|
|
@Test
|
2011-11-30 15:16:20 +01:00
|
|
|
public void mustBeAbleToCreateActorRefFromFactory() {
|
2013-05-02 17:00:44 +02:00
|
|
|
ActorRef ref = system.actorOf(Props.empty().withCreator(new Creator<Actor>() {
|
2011-11-15 11:34:39 +01:00
|
|
|
public Actor create() {
|
|
|
|
|
return new JavaAPITestActor();
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
assertNotNull(ref);
|
2011-01-04 13:24:28 +01:00
|
|
|
}
|
|
|
|
|
}
|