示例#1
0
 @Test
 public void usePipeWithActorSelection() throws Exception {
   TestProbe probe = new TestProbe(system);
   ActorSelection selection = system.actorSelection(probe.ref().path());
   pipe(Futures.successful("hi!"), system.dispatcher()).to(selection);
   probe.expectMsg("hi!");
 }
示例#2
0
 @Test
 public void testingWithoutParent() {
   TestProbe probe = new TestProbe(system);
   ActorRef child = system.actorOf(Props.create(DependentChild.class, probe.ref()));
   probe.send(child, "ping");
   probe.expectMsg("pong");
 }
示例#3
0
  @Test
  public void fabricatedParentTestsItsChildResponses() throws Exception {
    // didn't put final on these in order to make the parent fit in one line in the html docs
    // #test-fabricated-parent
    TestProbe proxy = new TestProbe(system);
    ActorRef parent = system.actorOf(Props.create(new FabricatedParentCreator(proxy)));

    proxy.send(parent, "ping");
    proxy.expectMsg("pong");
    // #test-fabricated-parent
  }
示例#4
0
 @Test
 public void testingWithChildProbe() throws Exception {
   final TestProbe probe = new TestProbe(system);
   // #child-maker-test
   Function<ActorRefFactory, ActorRef> maker =
       new Function<ActorRefFactory, ActorRef>() {
         @Override
         public ActorRef apply(ActorRefFactory param) throws Exception {
           return probe.ref();
         }
       };
   ActorRef parent = system.actorOf(Props.create(GenericDependentParent.class, maker));
   // #child-maker-test
   probe.send(parent, "pingit");
   probe.expectMsg("ping");
 }
示例#5
0
 @Test
 public void usePipe() throws Exception {
   TestProbe probe = new TestProbe(system);
   pipe(Futures.successful("ho!"), system.dispatcher()).to(probe.ref());
   probe.expectMsg("ho!");
 }