public class EffectfulActorContext<T> extends StubbedActorContext<T>
ActorContext
for testing purposes that records the effects performed
on it and otherwise stubs them out like a StubbedActorContext
.Constructor and Description |
---|
EffectfulActorContext(java.lang.String _name,
Props<T> _props,
ActorSystem<scala.runtime.Nothing$> _system) |
Modifier and Type | Method and Description |
---|---|
akka.actor.ActorRef |
actorOf(akka.actor.Props props)
Create an untyped child Actor from the given
Props under a randomly chosen name. |
akka.actor.ActorRef |
actorOf(akka.actor.Props props,
java.lang.String name)
Create an untyped child Actor from the given
Props and with the given name. |
Behavior<T> |
currentBehavior() |
scala.collection.immutable.Seq<Effect> |
getAllEffects() |
Effect |
getEffect() |
boolean |
hasEffects() |
void |
run(T msg) |
<U> akka.actor.Cancellable |
schedule(scala.concurrent.duration.FiniteDuration delay,
ActorRef<U> target,
U msg)
Schedule the sending of the given message to the given target Actor after
the given time period has elapsed.
|
void |
setReceiveTimeout(scala.concurrent.duration.Duration d)
Schedule the sending of a
ReceiveTimeout notification in case no other
message is received during the given period of time. |
void |
signal(Signal signal) |
<U> ActorRef<U> |
spawn(Props<U> props,
java.lang.String name)
Create a child Actor from the given
Props and with the given name. |
<U> ActorRef<U> |
spawnAnonymous(Props<U> props)
Create a child Actor from the given
Props under a randomly chosen name. |
boolean |
stop(ActorRef<scala.runtime.Nothing$> child)
Force the child Actor under the given name to terminate after it finishes
processing its current message.
|
akka.actor.ActorRef |
unwatch(akka.actor.ActorRef other)
Revoke the registration established by
watch . |
<U> ActorRef<U> |
unwatch(ActorRef<U> other)
Revoke the registration established by
watch . |
akka.actor.ActorRef |
watch(akka.actor.ActorRef other)
Register for
Terminated notification once the Actor identified by the
given ActorRef terminates. |
<U> ActorRef<U> |
watch(ActorRef<U> other)
Register for
Terminated notification once the Actor identified by the
given ActorRef terminates. |
child, children, executionContext, getInbox, inbox, name, props, removeInbox, self, spawnAdapter, system
public EffectfulActorContext(java.lang.String _name, Props<T> _props, ActorSystem<scala.runtime.Nothing$> _system)
public Effect getEffect()
public scala.collection.immutable.Seq<Effect> getAllEffects()
public boolean hasEffects()
public void run(T msg)
public void signal(Signal signal)
public <U> ActorRef<U> spawnAnonymous(Props<U> props)
ActorContext
Props
under a randomly chosen name.
It is good practice to name Actors wherever practical.spawnAnonymous
in interface ActorContext<T>
spawnAnonymous
in class StubbedActorContext<T>
props
- (undocumented)public <U> ActorRef<U> spawn(Props<U> props, java.lang.String name)
ActorContext
Props
and with the given name.spawn
in interface ActorContext<T>
spawn
in class StubbedActorContext<T>
props
- (undocumented)name
- (undocumented)public akka.actor.ActorRef actorOf(akka.actor.Props props)
ActorContext
Props
under a randomly chosen name.
It is good practice to name Actors wherever practical.actorOf
in interface ActorContext<T>
actorOf
in class StubbedActorContext<T>
props
- (undocumented)public akka.actor.ActorRef actorOf(akka.actor.Props props, java.lang.String name)
ActorContext
Props
and with the given name.actorOf
in interface ActorContext<T>
actorOf
in class StubbedActorContext<T>
props
- (undocumented)name
- (undocumented)public boolean stop(ActorRef<scala.runtime.Nothing$> child)
ActorContext
stop
in interface ActorContext<T>
stop
in class StubbedActorContext<T>
child
- (undocumented)ActorRef
points to a current child Actorpublic <U> ActorRef<U> watch(ActorRef<U> other)
ActorContext
Terminated
notification once the Actor identified by the
given ActorRef
terminates. This notification is also generated when the
ActorSystem
to which the referenced Actor belongs is declared as
failed (e.g. in reaction to being unreachable).watch
in interface ActorContext<T>
watch
in class StubbedActorContext<T>
other
- (undocumented)public <U> ActorRef<U> unwatch(ActorRef<U> other)
ActorContext
watch
. A Terminated
notification will not subsequently be received for the referenced Actor.unwatch
in interface ActorContext<T>
unwatch
in class StubbedActorContext<T>
other
- (undocumented)public akka.actor.ActorRef watch(akka.actor.ActorRef other)
ActorContext
Terminated
notification once the Actor identified by the
given ActorRef
terminates. This notification is also generated when the
ActorSystem
to which the referenced Actor belongs is declared as
failed (e.g. in reaction to being unreachable).watch
in interface ActorContext<T>
watch
in class StubbedActorContext<T>
other
- (undocumented)public akka.actor.ActorRef unwatch(akka.actor.ActorRef other)
ActorContext
watch
. A Terminated
notification will not subsequently be received for the referenced Actor.unwatch
in interface ActorContext<T>
unwatch
in class StubbedActorContext<T>
other
- (undocumented)public void setReceiveTimeout(scala.concurrent.duration.Duration d)
ActorContext
ReceiveTimeout
notification in case no other
message is received during the given period of time. The timeout starts anew
with each received message. Provide Duration.Undefined
to switch off this
mechanism.setReceiveTimeout
in interface ActorContext<T>
setReceiveTimeout
in class StubbedActorContext<T>
d
- (undocumented)public <U> akka.actor.Cancellable schedule(scala.concurrent.duration.FiniteDuration delay, ActorRef<U> target, U msg)
ActorContext
Cancellable
cancel
on the returned
handle.schedule
in interface ActorContext<T>
schedule
in class StubbedActorContext<T>
delay
- (undocumented)target
- (undocumented)msg
- (undocumented)