Package akka.testkit

Examples of akka.testkit.JavaTestKit$AwaitCond


    }};
  }

  @Test
  public void TheArithmeticServiceShouldCalculateMultiplicationAndDivisionProperly(){
    new JavaTestKit(system) {{
      final ActorRef service =
        system.actorOf(Props.create(ArithmeticService.class));
      final ActorRef probe = getRef();
      IntStream.range(-2, 3).forEach(x ->
        IntStream.range(-2, 3).forEach(y -> {
View Full Code Here


    }};
  }

  @Test
  public void TheArithmeticServiceShouldSurviveIllegalExpressions(){
    new JavaTestKit(system) {{
      final ActorRef service =
        system.actorOf(Props.create(ArithmeticService.class));
      final ActorRef probe = getRef();

      service.tell(new Divide(new Const(1), new Const(0)), probe);
View Full Code Here

    final ActorSystem system = ActorSystem.create("MySystem");
    final ActorRef myActor = system.actorOf(Props.create(MyUntypedActor.class),
      "myactor");
    //#system-actorOf
    try {
      new JavaTestKit(system) {
        {
          myActor.tell("hello", getRef());
          expectMsgEquals("hello");
        }
      };
View Full Code Here

  private final ActorSystem system = actorSystemResource.getSystem();

  @Test
  public void shouldHandleExceptionThrownByActorAndGenerateCustomResponse() throws Exception {
    new JavaTestKit(system) {{
      String result = new EventFilter<String>(Exception.class) {
        protected String run() {
          FiniteDuration duration = Duration.create(1, TimeUnit.SECONDS);
          Timeout timeout = new Timeout(duration);
          Camel camel = CamelExtension.get(system);
View Full Code Here

  private final ActorSystem system = actorSystemResource.getSystem();
 
  @Test
  public void demonstrateLookupClassification() {
    new JavaTestKit(system) {{
      //#lookup-bus-test
      LookupBusImpl lookupBus = new LookupBusImpl();
      lookupBus.subscribe(getTestActor(), "greetings");
      lookupBus.publish(new MsgEnvelope("time", System.currentTimeMillis()));
      lookupBus.publish(new MsgEnvelope("greetings", "hello"));
View Full Code Here

    }};
  }
 
  @Test
  public void demonstrateSubchannelClassification() {
    new JavaTestKit(system) {{
      //#subchannel-bus-test
      SubchannelBusImpl subchannelBus = new SubchannelBusImpl();
      subchannelBus.subscribe(getTestActor(), "abc");
      subchannelBus.publish(new MsgEnvelope("xyzabc", "x"));
      subchannelBus.publish(new MsgEnvelope("bcdef", "b"));
View Full Code Here

    }};
  }
 
  @Test
  public void demonstrateScanningClassification() {
    new JavaTestKit(system) {{
      //#scanning-bus-test
      ScanningBusImpl scanningBus = new ScanningBusImpl();
      scanningBus.subscribe(getTestActor(), 3);
      scanningBus.publish("xyzabc");
      scanningBus.publish("ab");
View Full Code Here

  }
 
  @Test
  public void demonstrateActorClassification() {
      //#actor-bus-test
      ActorRef observer1 = new JavaTestKit(system).getRef();
      ActorRef observer2 = new JavaTestKit(system).getRef();
      JavaTestKit probe1 = new JavaTestKit(system);
      JavaTestKit probe2 = new JavaTestKit(system);
      ActorRef subscriber1 = probe1.getRef();
      ActorRef subscriber2 = probe2.getRef();
      ActorBusImpl actorBus = new ActorBusImpl(system);
      actorBus.subscribe(subscriber1, observer1);
      actorBus.subscribe(subscriber2, observer1);
      actorBus.subscribe(subscriber2, observer2);
      Notification n1 = new Notification(observer1, 100);
      actorBus.publish(n1);
      probe1.expectMsgEquals(n1);
      probe2.expectMsgEquals(n1);
      Notification n2 = new Notification(observer2, 101);
      actorBus.publish(n2);
      probe2.expectMsgEquals(n2);
      probe1.expectNoMsg(FiniteDuration.create(500, TimeUnit.MILLISECONDS));
      //#actor-bus-test
  }
View Full Code Here

        system = ActorSystem.create("JavaUdpMulticastTest");
    }

    @Test
    public void testUdpMulticast() throws Exception {
        new JavaTestKit(system) {{
            NetworkInterface ipv6Iface = null;
            for (Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); interfaces.hasMoreElements() && ipv6Iface == null;) {
                NetworkInterface interf = interfaces.nextElement();
                for (Enumeration<InetAddress> addresses = interf.getInetAddresses(); addresses.hasMoreElements() && ipv6Iface == null;) {
                    InetAddress address = addresses.nextElement();
View Full Code Here

TOP

Related Classes of akka.testkit.JavaTestKit$AwaitCond

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.