Package akka.testkit
Class TestActorRef<T extends Actor>
- java.lang.Object
-
- akka.actor.ActorRef
-
- akka.actor.InternalActorRef
-
- akka.actor.ActorRefWithCell
-
- akka.actor.LocalActorRef
-
- akka.testkit.TestActorRef<T>
-
- All Implemented Interfaces:
ActorRefScope
,LocalRef
,ScalaActorRef
,java.io.Serializable
,java.lang.Comparable<ActorRef>
,scala.Serializable
- Direct Known Subclasses:
TestFSMRef
public class TestActorRef<T extends Actor> extends LocalActorRef
Directly inject messages into actor receive behavior. Any exceptions thrown will be available to you, while still being able to use become/unbecome.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TestActorRef(ActorSystem _system, Props _props, ActorRef _supervisor, java.lang.String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T extends Actor>
TestActorRef<T>apply(ActorRef supervisor, java.lang.String name, scala.reflect.ClassTag<T> t, ActorSystem system)
static <T extends Actor>
TestActorRef<T>apply(ActorRef supervisor, scala.reflect.ClassTag<T> t, ActorSystem system)
static <T extends Actor>
TestActorRef<T>apply(Props props, ActorRef supervisor, ActorSystem system)
static <T extends Actor>
TestActorRef<T>apply(Props props, ActorRef supervisor, java.lang.String name, ActorSystem system)
static <T extends Actor>
TestActorRef<T>apply(Props props, ActorSystem system)
static <T extends Actor>
TestActorRef<T>apply(Props props, java.lang.String name, ActorSystem system)
static <T extends Actor>
TestActorRef<T>apply(java.lang.String name, scala.reflect.ClassTag<T> t, ActorSystem system)
static <T extends Actor>
TestActorRef<T>apply(scala.Function0<T> factory, java.lang.String name, scala.reflect.ClassTag<T> evidence$2, ActorSystem system)
static <T extends Actor>
TestActorRef<T>apply(scala.Function0<T> factory, scala.reflect.ClassTag<T> evidence$1, ActorSystem system)
static <T extends Actor>
TestActorRef<T>apply(scala.reflect.ClassTag<T> t, ActorSystem system)
static <T extends Actor>
TestActorRef<T>create(ActorSystem system, Props props)
Java API: create a TestActorRef in the given system for the given props, with a random name.static <T extends Actor>
TestActorRef<T>create(ActorSystem system, Props props, ActorRef supervisor)
Java API: create a TestActorRef in the given system for the given props, with the given supervisor and a random name.static <T extends Actor>
TestActorRef<T>create(ActorSystem system, Props props, ActorRef supervisor, java.lang.String name)
Java API: create a TestActorRef in the given system for the given props, with the given supervisor and name.static <T extends Actor>
TestActorRef<T>create(ActorSystem system, Props props, java.lang.String name)
Java API: create a TestActorRef in the given system for the given props, with the given name.MessageDispatcher
dispatcher()
protected ActorCell
newActorCell(ActorSystemImpl system, InternalActorRef ref, Props props, MessageDispatcher dispatcher, InternalActorRef supervisor)
Props
props()
static java.lang.String
randomName()
void
receive(java.lang.Object o)
Directly inject messages into actor receive behavior.void
receive(java.lang.Object o, ActorRef sender)
Directly inject messages into actor receive behavior.java.lang.String
toString()
T
underlyingActor()
Retrieve reference to the underlying actor, where the static type matches the factory used inside the constructor.ActorRef
unwatch(ActorRef subject)
Unregisters this actor from being a death monitor of the provided ActorRef This means that this actor will not get a Terminated()-message when the provided actor is permanently terminated.ActorRef
watch(ActorRef subject)
Registers this actor to be a death monitor of the provided ActorRef This means that this actor will get a Terminated()-message when the provided actor is permanently terminated.-
Methods inherited from class akka.actor.LocalActorRef
$bang, $bang$default$2, actorContext, children, getChild, getParent, getSingleChild, isTerminated, path, provider, restart, resume, sendSystemMessage, start, stop, suspend, underlying, writeReplace
-
Methods inherited from class akka.actor.InternalActorRef
isLocal
-
Methods inherited from class akka.actor.ActorRef
compareTo, equals, forward, hashCode, noSender, tell
-
-
-
-
Constructor Detail
-
TestActorRef
public TestActorRef(ActorSystem _system, Props _props, ActorRef _supervisor, java.lang.String name)
-
-
Method Detail
-
randomName
public static java.lang.String randomName()
-
apply
public static <T extends Actor> TestActorRef<T> apply(scala.Function0<T> factory, scala.reflect.ClassTag<T> evidence$1, ActorSystem system)
-
apply
public static <T extends Actor> TestActorRef<T> apply(scala.Function0<T> factory, java.lang.String name, scala.reflect.ClassTag<T> evidence$2, ActorSystem system)
-
apply
public static <T extends Actor> TestActorRef<T> apply(Props props, ActorSystem system)
-
apply
public static <T extends Actor> TestActorRef<T> apply(Props props, java.lang.String name, ActorSystem system)
-
apply
public static <T extends Actor> TestActorRef<T> apply(Props props, ActorRef supervisor, ActorSystem system)
-
apply
public static <T extends Actor> TestActorRef<T> apply(Props props, ActorRef supervisor, java.lang.String name, ActorSystem system)
-
apply
public static <T extends Actor> TestActorRef<T> apply(scala.reflect.ClassTag<T> t, ActorSystem system)
-
apply
public static <T extends Actor> TestActorRef<T> apply(java.lang.String name, scala.reflect.ClassTag<T> t, ActorSystem system)
-
apply
public static <T extends Actor> TestActorRef<T> apply(ActorRef supervisor, scala.reflect.ClassTag<T> t, ActorSystem system)
-
apply
public static <T extends Actor> TestActorRef<T> apply(ActorRef supervisor, java.lang.String name, scala.reflect.ClassTag<T> t, ActorSystem system)
-
create
public static <T extends Actor> TestActorRef<T> create(ActorSystem system, Props props, ActorRef supervisor, java.lang.String name)
Java API: create a TestActorRef in the given system for the given props, with the given supervisor and name.- Parameters:
system
- (undocumented)props
- (undocumented)supervisor
- (undocumented)name
- (undocumented)- Returns:
- (undocumented)
-
create
public static <T extends Actor> TestActorRef<T> create(ActorSystem system, Props props, ActorRef supervisor)
Java API: create a TestActorRef in the given system for the given props, with the given supervisor and a random name.- Parameters:
system
- (undocumented)props
- (undocumented)supervisor
- (undocumented)- Returns:
- (undocumented)
-
create
public static <T extends Actor> TestActorRef<T> create(ActorSystem system, Props props, java.lang.String name)
Java API: create a TestActorRef in the given system for the given props, with the given name.- Parameters:
system
- (undocumented)props
- (undocumented)name
- (undocumented)- Returns:
- (undocumented)
-
create
public static <T extends Actor> TestActorRef<T> create(ActorSystem system, Props props)
Java API: create a TestActorRef in the given system for the given props, with a random name.- Parameters:
system
- (undocumented)props
- (undocumented)- Returns:
- (undocumented)
-
props
public Props props()
-
dispatcher
public MessageDispatcher dispatcher()
-
newActorCell
protected ActorCell newActorCell(ActorSystemImpl system, InternalActorRef ref, Props props, MessageDispatcher dispatcher, InternalActorRef supervisor)
- Overrides:
newActorCell
in classLocalActorRef
-
receive
public void receive(java.lang.Object o)
Directly inject messages into actor receive behavior. Any exceptions thrown will be available to you, while still being able to use become/unbecome.- Parameters:
o
- (undocumented)
-
receive
public void receive(java.lang.Object o, ActorRef sender)
Directly inject messages into actor receive behavior. Any exceptions thrown will be available to you, while still being able to use become/unbecome.- Parameters:
o
- (undocumented)sender
- (undocumented)
-
underlyingActor
public T underlyingActor()
Retrieve reference to the underlying actor, where the static type matches the factory used inside the constructor. Beware that this reference is discarded by the ActorRef upon restarting the actor (should this reference be linked to a supervisor). The old Actor may of course still be used in post-mortem assertions.- Returns:
- (undocumented)
-
watch
public ActorRef watch(ActorRef subject)
Registers this actor to be a death monitor of the provided ActorRef This means that this actor will get a Terminated()-message when the provided actor is permanently terminated.- Parameters:
subject
- (undocumented)- Returns:
- the same ActorRef that is provided to it, to allow for cleaner invocations
-
unwatch
public ActorRef unwatch(ActorRef subject)
Unregisters this actor from being a death monitor of the provided ActorRef This means that this actor will not get a Terminated()-message when the provided actor is permanently terminated.- Parameters:
subject
- (undocumented)- Returns:
- the same ActorRef that is provided to it, to allow for cleaner invocations
-
-