2011-01-04 13:24:28 +01:00
|
|
|
package akka.actor;
|
|
|
|
|
|
2011-11-10 20:08:00 +01:00
|
|
|
import akka.actor.ActorSystem;
|
2011-01-04 13:24:28 +01:00
|
|
|
import akka.japi.Creator;
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
import akka.actor.Actors;
|
2011-09-20 21:44:50 +02:00
|
|
|
import akka.remote.RemoteSupport;
|
2011-01-04 13:24:28 +01:00
|
|
|
import static org.junit.Assert.*;
|
|
|
|
|
|
|
|
|
|
public class JavaAPI {
|
|
|
|
|
|
2011-11-17 12:36:35 +01:00
|
|
|
private ActorSystem system = ActorSystem.create();
|
2011-10-13 13:41:44 +02:00
|
|
|
|
2011-01-04 13:24:28 +01:00
|
|
|
@Test void mustBeAbleToCreateActorRefFromClass() {
|
2011-11-17 12:36:35 +01:00
|
|
|
ActorRef ref = system.actorOf(JavaAPITestActor.class);
|
2011-01-04 13:24:28 +01:00
|
|
|
assertNotNull(ref);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test void mustBeAbleToCreateActorRefFromFactory() {
|
2011-11-17 12:36:35 +01:00
|
|
|
ActorRef ref = system.actorOf(new Props().withCreator(new Creator<Actor>() {
|
2011-01-04 13:24:28 +01:00
|
|
|
public Actor create() {
|
|
|
|
|
return new JavaAPITestActor();
|
|
|
|
|
}
|
2011-10-11 16:05:48 +02:00
|
|
|
}));
|
2011-01-04 13:24:28 +01:00
|
|
|
assertNotNull(ref);
|
|
|
|
|
}
|
2011-08-03 23:08:38 +02:00
|
|
|
|
2011-10-29 11:35:01 +02:00
|
|
|
@Test void mustAcceptSingleArgTell() {
|
2011-11-17 12:36:35 +01:00
|
|
|
ActorRef ref = system.actorOf(JavaAPITestActor.class);
|
2011-10-22 16:06:20 +02:00
|
|
|
ref.tell("hallo");
|
|
|
|
|
ref.tell("hallo", ref);
|
2011-08-03 23:08:38 +02:00
|
|
|
}
|
2011-01-04 13:24:28 +01:00
|
|
|
}
|