Correction of Java doc Creating Actors Remotely, see #2537

This commit is contained in:
Patrik Nordwall 2012-09-21 15:08:56 +02:00
parent c0f60da8cc
commit ee65dbf184
5 changed files with 48 additions and 45 deletions

View file

@ -17,7 +17,17 @@ import akka.actor.ActorSystem;
import akka.remote.RemoteScope;
//#import
import akka.actor.UntypedActor;
public class RemoteDeploymentDocTestBase {
//#sample-actor
public static class Echo extends UntypedActor {
public void onReceive(Object message) {
getSender().tell(getSelf(), getSelf());
}
}
//#sample-actor
static ActorSystem system;
@ -38,9 +48,19 @@ public class RemoteDeploymentDocTestBase {
addr = AddressFromURIString.parse("akka://sys@host:1234"); // the same
//#make-address
//#deploy
ActorRef ref = system.actorOf(new Props(RemoteDeploymentDocSpec.Echo.class).withDeploy(new Deploy(new RemoteScope(addr))));
ActorRef ref = system.actorOf(new Props(Echo.class).withDeploy(new Deploy(new RemoteScope(addr))));
//#deploy
assert ref.path().address().equals(addr);
}
@Test
public void demonstrateSampleActor() {
//#sample-actor
ActorRef actor = system.actorOf(new Props(Echo.class), "sampleActor");
actor.tell("Pretty slick", null);
//#sample-actor
}
}