2011-01-04 13:24:28 +01:00
|
|
|
package akka.actor;
|
|
|
|
|
|
|
|
|
|
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 {
|
|
|
|
|
|
|
|
|
|
@Test void mustBeAbleToUseUntypedActor() {
|
|
|
|
|
final RemoteSupport remote = Actors.remote();
|
|
|
|
|
assertNotNull(remote);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test void mustInteractWithActorRegistry() {
|
|
|
|
|
final ActorRegistry registry = Actors.registry();
|
|
|
|
|
assertNotNull(registry);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test void mustBeAbleToCreateActorRefFromClass() {
|
|
|
|
|
ActorRef ref = Actors.actorOf(JavaAPITestActor.class);
|
|
|
|
|
assertNotNull(ref);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test void mustBeAbleToCreateActorRefFromFactory() {
|
|
|
|
|
ActorRef ref = Actors.actorOf(new Creator<Actor>() {
|
|
|
|
|
public Actor create() {
|
|
|
|
|
return new JavaAPITestActor();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
assertNotNull(ref);
|
|
|
|
|
}
|
2011-08-03 23:08:38 +02:00
|
|
|
|
|
|
|
|
@Test void mustAcceptSingleArgTryTell() {
|
|
|
|
|
ActorRef ref = Actors.actorOf(JavaAPITestActor.class);
|
|
|
|
|
ref.tryTell("hallo");
|
|
|
|
|
ref.tryTell("hallo", ref);
|
|
|
|
|
}
|
2011-01-04 13:24:28 +01:00
|
|
|
}
|