|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectakka.testkit.TestKit
akka.remote.testkit.MultiNodeSpec
public abstract class MultiNodeSpec
Note: To be able to run tests with everything ignored or excluded by tags
you must not use testconductor
, or helper methods that use testconductor
,
from the constructor of your test class. Otherwise the controller node might
be shutdown before other nodes have completed and you will see errors like:
AskTimeoutException: sending to terminated ref breaks promises
. Using lazy
val is fine.
Nested Class Summary | |
---|---|
class |
MultiNodeSpec.AwaitHelper<T>
|
Constructor Summary | |
---|---|
MultiNodeSpec(MultiNodeConfig config)
|
|
MultiNodeSpec(RoleName myself,
ActorSystem _system,
scala.collection.immutable.Seq<RoleName> _roles,
scala.Function1<RoleName,scala.collection.Seq<java.lang.String>> deployments)
|
Method Summary | ||
---|---|---|
protected void |
afterTermination()
Override this method to do something when the whole test is terminating. |
|
protected void |
atStartup()
Override this method to do something when the whole test is starting up. |
|
protected void |
attachConductor(TestConductorExt tc)
|
|
|
awaitHelper(scala.concurrent.Awaitable<T> w)
Enrich .await() onto all Awaitables, using remaining duration from the innermost
enclosing within block or QueryTimeout. |
|
static com.typesafe.config.Config |
baseConfig()
|
|
void |
enterBarrier(scala.collection.Seq<java.lang.String> name)
Enter the named barriers in the order given. |
|
abstract int |
initialParticipants()
TO BE DEFINED BY USER: Defines the number of participants required for starting the test. |
|
protected void |
injectDeployments(ActorSystem sys,
RoleName role)
|
|
boolean |
isNode(scala.collection.Seq<RoleName> nodes)
Verify that the running node matches one of the given nodes |
|
LoggingAdapter |
log()
|
|
static int |
maxNodes()
Number of nodes node taking part in this test. |
|
void |
multiNodeSpecAfterAll()
Call this after the all test cases have run. |
|
void |
multiNodeSpecBeforeAll()
Call this before the start of the test run. |
|
void |
muteDeadLetters(scala.collection.Seq<java.lang.Class<?>> messageClasses,
ActorSystem sys)
|
|
protected Address |
myAddress()
|
|
RoleName |
myself()
|
|
ActorPath |
node(RoleName role)
Query the controller for the transport address of the given node (by role name) and return that as an ActorPath for easy composition: |
|
static com.typesafe.config.Config |
nodeConfig()
|
|
scala.collection.immutable.Seq<RoleName> |
roles()
All registered roles |
|
void |
runOn(scala.collection.Seq<RoleName> nodes,
scala.Function0<scala.runtime.BoxedUnit> thunk)
Execute the given block of code only on the given nodes (names according to the roleMap ). |
|
static java.lang.Integer |
selfIndex()
Index of this node in the roles sequence. |
|
static java.lang.String |
selfName()
Name (or IP address; must be resolvable using InetAddress.getByName) of the host this node is running on. |
|
static int |
selfPort()
Port number of this node. |
|
static java.lang.String |
serverName()
Name (or IP address; must be resolvable using InetAddress.getByName) of the host that the server node is running on. |
|
static int |
serverPort()
Port number of the node that's running the server system. |
|
scala.concurrent.duration.FiniteDuration |
shutdownTimeout()
|
|
protected ActorSystem |
startNewSystem()
This method starts a new ActorSystem with the same configuration as the previous one on the current node, including deployments. |
|
TestConductorExt |
testConductor()
Access to the barriers, failure injection, etc. |
|
boolean |
verifySystemShutdown()
Override this and return true to assert that the
shutdown of the ActorSystem was done properly. |
Methods inherited from class akka.testkit.TestKit |
---|
awaitCond, dilated, now, shutdownActorSystem, system, testActorId |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MultiNodeSpec(RoleName myself, ActorSystem _system, scala.collection.immutable.Seq<RoleName> _roles, scala.Function1<RoleName,scala.collection.Seq<java.lang.String>> deployments)
public MultiNodeSpec(MultiNodeConfig config)
Method Detail |
---|
public static int maxNodes()
-Dmultinode.max-nodes=4
public static java.lang.String selfName()
-Dmultinode.host=host.example.com
InetAddress.getLocalHost.getHostAddress is used if empty or "localhost" is defined as system property "multinode.host".
public static int selfPort()
-Dmultinode.port=0
public static java.lang.String serverName()
-Dmultinode.server-host=server.example.com
public static int serverPort()
-Dmultinode.server-port=4711
public static java.lang.Integer selfIndex()
-Dmultinode.index=0
public static com.typesafe.config.Config nodeConfig()
public static com.typesafe.config.Config baseConfig()
public RoleName myself()
public LoggingAdapter log()
public <T> MultiNodeSpec.AwaitHelper<T> awaitHelper(scala.concurrent.Awaitable<T> w)
.await()
onto all Awaitables, using remaining duration from the innermost
enclosing within
block or QueryTimeout.
w
- (undocumented)
public final void multiNodeSpecBeforeAll()
MultiNodeSpecCallbacks
multiNodeSpecBeforeAll
in interface MultiNodeSpecCallbacks
public final void multiNodeSpecAfterAll()
MultiNodeSpecCallbacks
multiNodeSpecAfterAll
in interface MultiNodeSpecCallbacks
public scala.concurrent.duration.FiniteDuration shutdownTimeout()
public boolean verifySystemShutdown()
true
to assert that the
shutdown of the ActorSystem
was done properly.
protected void atStartup()
protected void afterTermination()
public scala.collection.immutable.Seq<RoleName> roles()
public abstract int initialParticipants()
Must be a def
:
def initialParticipants = 5
public TestConductorExt testConductor()
public void runOn(scala.collection.Seq<RoleName> nodes, scala.Function0<scala.runtime.BoxedUnit> thunk)
roleMap
).
nodes
- (undocumented)thunk
- (undocumented)public boolean isNode(scala.collection.Seq<RoleName> nodes)
nodes
- (undocumented)
public void enterBarrier(scala.collection.Seq<java.lang.String> name)
within
block or the default BarrierTimeout
name
- (undocumented)public ActorPath node(RoleName role)
val serviceA = system.actorSelection(node("master") / "user" / "serviceA")
role
- (undocumented)
public void muteDeadLetters(scala.collection.Seq<java.lang.Class<?>> messageClasses, ActorSystem sys)
protected void attachConductor(TestConductorExt tc)
protected void injectDeployments(ActorSystem sys, RoleName role)
protected Address myAddress()
protected ActorSystem startNewSystem()
NOTICE: you MUST start a new system before trying to enter a barrier or otherwise using the TestConductor after having terminated this node’s system.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |