Ejemplo n.º 1
0
    public void testSchedule(
        final JavaTestKit probe,
        Props props,
        FiniteDuration startDuration,
        FiniteDuration afterRestartDuration) {
      Iterable<akka.testkit.EventFilter> filter =
          Arrays.asList(
              new akka.testkit.EventFilter[] {
                (akka.testkit.EventFilter) new ErrorFilter(ArithmeticException.class)
              });
      try {
        system.eventStream().publish(new Mute(filter));

        final ActorRef actor = system.actorOf(props);
        new Within(startDuration) {
          protected void run() {
            probe.expectMsgEquals("tick");
            probe.expectMsgEquals("tick");
            probe.expectMsgEquals("tick");
          }
        };
        actor.tell("restart", getRef());
        new Within(afterRestartDuration) {
          protected void run() {
            probe.expectMsgEquals("tick");
            probe.expectMsgEquals("tick");
          }
        };
        system.stop(actor);
      } finally {
        system.eventStream().publish(new UnMute(filter));
      }
    }
Ejemplo n.º 2
0
 @AfterClass
 public static void tearDown() {
   system.shutdown();
 }
Ejemplo n.º 3
0
 @BeforeClass
 public static void setUp() {
   system = ActorSystem.create("SchedulerPatternTest", AkkaSpec.testConf());
 }