Class MultiNodeSpec

  • All Implemented Interfaces:
    MultiNodeSpecCallbacks, TestKitBase

    public abstract class MultiNodeSpec
    extends TestKit
    implements MultiNodeSpecCallbacks
    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.
    • Constructor Detail

      • MultiNodeSpec

        public MultiNodeSpec​(RoleName myself,
                             ActorSystem _system,
                             scala.collection.immutable.Seq<RoleName> _roles,
                             scala.Function1<RoleName,​scala.collection.Seq<java.lang.String>> deployments)
      • MultiNodeSpec

        public MultiNodeSpec​(MultiNodeConfig config,
                             scala.Function1<com.typesafe.config.Config,​ActorSystem> actorSystemCreator)
        Constructor for using arbitrary logic to create the actor system used in the multi node spec (the Config passed to the creator must be used in the created actor system for the multi node tests to work)
        config - (undocumented)
        actorSystemCreator - (undocumented)
    • Method Detail

      • maxNodes

        public static int maxNodes()
        Number of nodes node taking part in this test.

      • selfName

        public static java.lang.String selfName()
        Name (or IP address; must be resolvable using InetAddress.getByName) of the host this node is running on.


        InetAddress.getLocalHost.getHostAddress is used if empty or "localhost" is defined as system property "".

      • selfPort

        public static int selfPort()
        Port number of this node. Defaults to 0 which means a random port.

      • serverName

        public 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.

      • serverPort

        public static int serverPort()
        Port number of the node that's running the server system. Defaults to 4711.

      • selfIndex

        public static java.lang.Integer selfIndex()
        Index of this node in the roles sequence. The TestConductor is started in &ldquo;controller&rdquo; mode on selfIndex 0, i.e. there you can inject failures and shutdown other nodes etc.

      • nodeConfig

        public static com.typesafe.config.Config nodeConfig()
      • baseConfig

        public static com.typesafe.config.Config baseConfig()
      • lastSender

        public static ActorRef lastSender()
      • testActorName

        protected static java.lang.String testActorName()
      • ignoreMsg

        public static void ignoreMsg​(scala.PartialFunction<java.lang.Object,​java.lang.Object> f)
      • ignoreNoMsg

        public static void ignoreNoMsg()
      • now

        public static scala.concurrent.duration.FiniteDuration now()
      • remainingOrDefault

        public static scala.concurrent.duration.FiniteDuration remainingOrDefault()
      • remaining

        public static scala.concurrent.duration.FiniteDuration remaining()
      • remainingOr

        public static scala.concurrent.duration.FiniteDuration remainingOr​(scala.concurrent.duration.FiniteDuration duration)
      • msgAvailable

        public static boolean msgAvailable()
      • awaitCond

        public static void awaitCond​(scala.Function0<java.lang.Object> p,
                                     scala.concurrent.duration.Duration max,
                                     scala.concurrent.duration.Duration interval,
                                     java.lang.String message)
      • awaitCond$default$2

        public static scala.concurrent.duration.Duration awaitCond$default$2()
      • awaitCond$default$3

        public static scala.concurrent.duration.Duration awaitCond$default$3()
      • awaitCond$default$4

        public static java.lang.String awaitCond$default$4()
      • awaitAssert

        public static <A> A awaitAssert​(scala.Function0<A> a,
                                        scala.concurrent.duration.Duration max,
                                        scala.concurrent.duration.Duration interval)
      • awaitAssert$default$2

        public static <A> scala.concurrent.duration.Duration awaitAssert$default$2()
      • awaitAssert$default$3

        public static <A> scala.concurrent.duration.Duration awaitAssert$default$3()
      • within

        public static <T> T within​(scala.concurrent.duration.FiniteDuration min,
                                   scala.concurrent.duration.FiniteDuration max,
                                   scala.Function0<T> f)
      • within

        public static <T> T within​(scala.concurrent.duration.FiniteDuration max,
                                   scala.Function0<T> f)
      • expectMsg

        public static <T> T expectMsg​(T obj)
      • expectMsg

        public static <T> T expectMsg​(scala.concurrent.duration.FiniteDuration max,
                                      T obj)
      • expectMsg

        public static <T> T expectMsg​(scala.concurrent.duration.FiniteDuration max,
                                      java.lang.String hint,
                                      T obj)
      • expectMsgPF

        public static <T> T expectMsgPF​(scala.concurrent.duration.Duration max,
                                        java.lang.String hint,
                                        scala.PartialFunction<java.lang.Object,​T> f)
      • expectMsgPF$default$1

        public static <T> scala.concurrent.duration.Duration expectMsgPF$default$1()
      • expectMsgPF$default$2

        public static <T> java.lang.String expectMsgPF$default$2()
      • expectTerminated

        public static Terminated expectTerminated​(ActorRef target,
                                                  scala.concurrent.duration.Duration max)
      • expectTerminated$default$2

        public static scala.concurrent.duration.Duration expectTerminated$default$2()
      • fishForMessage

        public static java.lang.Object fishForMessage​(scala.concurrent.duration.Duration max,
                                                      java.lang.String hint,
                                                      scala.PartialFunction<java.lang.Object,​java.lang.Object> f)
      • fishForMessage$default$1

        public static scala.concurrent.duration.Duration fishForMessage$default$1()
      • fishForMessage$default$2

        public static java.lang.String fishForMessage$default$2()
      • fishForSpecificMessage

        public static <T> T fishForSpecificMessage​(scala.concurrent.duration.Duration max,
                                                   java.lang.String hint,
                                                   scala.PartialFunction<java.lang.Object,​T> f)
      • fishForSpecificMessage$default$1

        public static <T> scala.concurrent.duration.Duration fishForSpecificMessage$default$1()
      • fishForSpecificMessage$default$2

        public static <T> java.lang.String fishForSpecificMessage$default$2()
      • expectMsgType

        public static <T> T expectMsgType​(scala.reflect.ClassTag<T> t)
      • expectMsgType

        public static <T> T expectMsgType​(scala.concurrent.duration.FiniteDuration max,
                                          scala.reflect.ClassTag<T> t)
      • expectMsgClass

        public static <C> C expectMsgClass​(java.lang.Class<C> c)
      • expectMsgClass

        public static <C> C expectMsgClass​(scala.concurrent.duration.FiniteDuration max,
                                           java.lang.Class<C> c)
      • expectMsgAnyOf

        public static <T> T expectMsgAnyOf​(scala.collection.Seq<T> obj)
      • expectMsgAnyOf

        public static <T> T expectMsgAnyOf​(scala.concurrent.duration.FiniteDuration max,
                                           scala.collection.Seq<T> obj)
      • expectMsgAnyClassOf

        public static <C> C expectMsgAnyClassOf​(scala.collection.Seq<java.lang.Class<? extends C>> obj)
      • expectMsgAnyClassOf

        public static <C> C expectMsgAnyClassOf​(scala.concurrent.duration.FiniteDuration max,
                                                scala.collection.Seq<java.lang.Class<? extends C>> obj)
      • expectMsgAllOf

        public static <T> scala.collection.immutable.Seq<T> expectMsgAllOf​(scala.collection.Seq<T> obj)
      • expectMsgAllOf

        public static <T> scala.collection.immutable.Seq<T> expectMsgAllOf​(scala.concurrent.duration.FiniteDuration max,
                                                                           scala.collection.Seq<T> obj)
      • expectMsgAllClassOf

        public static <T> scala.collection.immutable.Seq<T> expectMsgAllClassOf​(scala.collection.Seq<java.lang.Class<? extends T>> obj)
      • expectMsgAllClassOf

        public static <T> scala.collection.immutable.Seq<T> expectMsgAllClassOf​(scala.concurrent.duration.FiniteDuration max,
                                                                                scala.collection.Seq<java.lang.Class<? extends T>> obj)
      • expectMsgAllConformingOf

        public static <T> scala.collection.immutable.Seq<T> expectMsgAllConformingOf​(scala.collection.Seq<java.lang.Class<? extends T>> obj)
      • expectMsgAllConformingOf

        public static <T> scala.collection.immutable.Seq<T> expectMsgAllConformingOf​(scala.concurrent.duration.FiniteDuration max,
                                                                                     scala.collection.Seq<java.lang.Class<? extends T>> obj)
      • expectNoMsg

        public static void expectNoMsg()
      • expectNoMsg

        public static void expectNoMsg​(scala.concurrent.duration.FiniteDuration max)
      • expectNoMessage

        public static void expectNoMessage​(scala.concurrent.duration.FiniteDuration max)
      • expectNoMessage

        public static void expectNoMessage()
      • receiveWhile

        public static <T> scala.collection.immutable.Seq<T> receiveWhile​(scala.concurrent.duration.Duration max,
                                                                         scala.concurrent.duration.Duration idle,
                                                                         int messages,
                                                                         scala.PartialFunction<java.lang.Object,​T> f)
      • receiveWhile$default$1

        public static <T> scala.concurrent.duration.Duration receiveWhile$default$1()
      • receiveWhile$default$2

        public static <T> scala.concurrent.duration.Duration receiveWhile$default$2()
      • receiveWhile$default$3

        public static <T> int receiveWhile$default$3()
      • receiveN

        public static scala.collection.immutable.Seq<java.lang.Object> receiveN​(int n)
      • receiveN

        public static scala.collection.immutable.Seq<java.lang.Object> receiveN​(int n,
                                                                                scala.concurrent.duration.FiniteDuration max)
      • receiveOne

        public static java.lang.Object receiveOne​(scala.concurrent.duration.Duration max)
      • shutdown

        public static void shutdown​(ActorSystem actorSystem,
                                    scala.concurrent.duration.Duration duration,
                                    boolean verifySystemShutdown)
      • shutdown$default$1

        public static ActorSystem shutdown$default$1()
      • shutdown$default$2

        public static scala.concurrent.duration.Duration shutdown$default$2()
      • shutdown$default$3

        public static boolean shutdown$default$3()
      • childActorOf

        public static ActorRef childActorOf​(Props props,
                                            java.lang.String name)
      • childActorOf

        public static ActorRef childActorOf​(Props props)
      • akka$testkit$TestKitBase$$queue

        public static java.util.concurrent.LinkedBlockingDeque<TestActor.Message> akka$testkit$TestKitBase$$queue()
      • testActor

        public static ActorRef testActor()
      • akka$testkit$TestKitBase$$end

        public static scala.concurrent.duration.Duration akka$testkit$TestKitBase$$end()
      • akka$testkit$TestKitBase$$end_$eq

        public static void akka$testkit$TestKitBase$$end_$eq​(scala.concurrent.duration.Duration x$1)
      • akka$testkit$TestKitBase$$lastWasNoMsg

        public static boolean akka$testkit$TestKitBase$$lastWasNoMsg()
      • akka$testkit$TestKitBase$$lastWasNoMsg_$eq

        public static void akka$testkit$TestKitBase$$lastWasNoMsg_$eq​(boolean x$1)
      • akka$testkit$TestKitBase$_setter_$testKitSettings_$eq

        protected static void akka$testkit$TestKitBase$_setter_$testKitSettings_$eq​(TestKitSettings x$1)
      • akka$testkit$TestKitBase$_setter_$akka$testkit$TestKitBase$$queue_$eq

        protected static final void akka$testkit$TestKitBase$_setter_$akka$testkit$TestKitBase$$queue_$eq​(java.util.concurrent.LinkedBlockingDeque<TestActor.Message> x$1)
      • akka$testkit$TestKitBase$_setter_$testActor_$eq

        protected static void akka$testkit$TestKitBase$_setter_$testActor_$eq​(ActorRef x$1)
      • awaitHelper

        public <T> MultiNodeSpec.AwaitHelper<T> awaitHelper​(scala.concurrent.Awaitable<T> w)
        Enrich .await() onto all Awaitables, using remaining duration from the innermost enclosing within block or QueryTimeout.
        w - (undocumented)
      • shutdownTimeout

        public scala.concurrent.duration.FiniteDuration shutdownTimeout()
      • verifySystemShutdown

        public boolean verifySystemShutdown()
        Override this and return true to assert that the shutdown of the ActorSystem was done properly.
      • atStartup

        protected void atStartup()
        Override this method to do something when the whole test is starting up.
      • afterTermination

        protected void afterTermination()
        Override this method to do something when the whole test is terminating.
      • roles

        public scala.collection.immutable.Seq<RoleName> roles()
        All registered roles
      • initialParticipants

        public abstract int initialParticipants()
        TO BE DEFINED BY USER: Defines the number of participants required for starting the test. This might not be equals to the number of nodes available to the test.

        Must be a def:

         def initialParticipants = 5
      • testConductor

        public TestConductorExt testConductor()
        Access to the barriers, failure injection, etc. The extension will have been started either in Conductor or Player mode when the constructor of MultiNodeSpec finishes, i.e. do not call the start*() methods yourself!
      • runOn

        public 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).
        nodes - (undocumented)
        thunk - (undocumented)
      • isNode

        public boolean isNode​(scala.collection.Seq<RoleName> nodes)
        Verify that the running node matches one of the given nodes
        nodes - (undocumented)
      • enterBarrier

        public void enterBarrier​(scala.collection.Seq<java.lang.String> name)
        Enter the named barriers in the order given. Use the remaining duration from the innermost enclosing within block or the default BarrierTimeout
        name - (undocumented)
      • node

        public 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:

         val serviceA = system.actorSelection(node("master") / "user" / "serviceA")
        role - (undocumented)
      • muteDeadLetters

        public void muteDeadLetters​(scala.collection.Seq<java.lang.Class<?>> messageClasses,
                                    ActorSystem sys)
      • muteDeadLetters$default$2

        public ActorSystem muteDeadLetters$default$2​(scala.collection.Seq<java.lang.Class<?>> messageClasses)
      • myAddress

        protected Address myAddress()
      • startNewSystem

        protected ActorSystem startNewSystem()
        This method starts a new ActorSystem with the same configuration as the previous one on the current node, including deployments. It also creates a new TestConductor client and registers itself with the conductor so that it is possible to use barriers etc. normally after this method has been called.

        NOTICE: you MUST start a new system before trying to enter a barrier or otherwise using the TestConductor after having terminated this node&rsquo;s system.