Java Code Examples for akka.testkit.JavaTestKit#duration()

The following examples show how to use akka.testkit.JavaTestKit#duration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 2
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 3
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 4
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 5
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 6
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 7
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 8
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 9
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 10
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 11
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 12
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 13
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 14
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 15
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 16
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}
 
Example 17
Source File: BaseAkkaTestCase.java    From oreilly-reactive-architecture-student with Apache License 2.0 5 votes vote down vote up
public ActorRef expectActor(JavaTestKit kit, String path) {
    final ActorRef[] actor = {null};
    kit.new AwaitCond(kit.duration("3 seconds"), kit.duration("150 millis"), "No actor found with " + path) {
        @Override
        protected boolean cond() {
            TestProbe probe = new TestProbe(system);
            system.actorSelection(path).tell(new akka.actor.Identify(101), probe.ref());
            ActorIdentity i = probe.expectMsgClass(kit.duration("100 millis"), ActorIdentity.class);
            actor[0] = i.getRef();
            return i.getRef() != null;
        }
    };
    return actor[0];
}