Packages

c

akka.remote.transport.TestTransport

SwitchableLoggedBehavior

class SwitchableLoggedBehavior[A, B] extends Behavior[A, B]

Test utility to make behavior of functions that return some Future[B] controllable from tests. This tool is able to overwrite default behavior with any generic behavior, including failure, and exposes control to the timing of the completion of the returned future.

The utility is implemented as a stack of behaviors, where the behavior on the top of the stack represents the currently active behavior. The bottom of the stack always contains the defaultBehavior which can not be popped out.

Source
TestTransport.scala
Linear Supertypes
(A) => Future[B], AnyRef, Any
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SwitchableLoggedBehavior
  2. Function1
  3. AnyRef
  4. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new SwitchableLoggedBehavior(defaultBehavior: Behavior[A, B], logCallback: (A) => Unit)

    defaultBehavior

    The original behavior that might be overwritten. It is always possible to restore this behavior

    logCallback

    Function that will be called independently of the current active behavior type parameter A:

    • Parameter type of the wrapped function. If it takes multiple parameters it must be wrapped in a tuple. type parameter B:
    • Type parameter of the future that the original function returns.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from SwitchableLoggedBehavior[A, B] toany2stringadd[SwitchableLoggedBehavior[A, B]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (SwitchableLoggedBehavior[A, B], B)
    Implicit
    This member is added by an implicit conversion from SwitchableLoggedBehavior[A, B] toArrowAssoc[SwitchableLoggedBehavior[A, B]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. def andThen[A](g: (Future[B]) => A): (A) => A
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  7. def apply(params: A): Future[B]

    Applies the current behavior, and invokes the callback.

    Applies the current behavior, and invokes the callback.

    params

    The parameters of this behavior.

    returns

    The result of this behavior wrapped in a future.

    Definition Classes
    SwitchableLoggedBehavior → Function1
  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  10. def compose[A](g: (A) => A): (A) => Future[B]
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  11. def ensuring(cond: (SwitchableLoggedBehavior[A, B]) => Boolean, msg: => Any): SwitchableLoggedBehavior[A, B]
    Implicit
    This member is added by an implicit conversion from SwitchableLoggedBehavior[A, B] toEnsuring[SwitchableLoggedBehavior[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: (SwitchableLoggedBehavior[A, B]) => Boolean): SwitchableLoggedBehavior[A, B]
    Implicit
    This member is added by an implicit conversion from SwitchableLoggedBehavior[A, B] toEnsuring[SwitchableLoggedBehavior[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: Boolean, msg: => Any): SwitchableLoggedBehavior[A, B]
    Implicit
    This member is added by an implicit conversion from SwitchableLoggedBehavior[A, B] toEnsuring[SwitchableLoggedBehavior[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: Boolean): SwitchableLoggedBehavior[A, B]
    Implicit
    This member is added by an implicit conversion from SwitchableLoggedBehavior[A, B] toEnsuring[SwitchableLoggedBehavior[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  17. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  23. def pop(): Unit

    Restores the previous behavior.

  24. def push(behavior: Behavior[A, B]): Unit

    Changes the current behavior to the provided one.

    Changes the current behavior to the provided one.

    behavior

    Function that takes a parameter type A and returns a Future[B].

  25. def pushConstant(c: B): Unit

    Changes the behavior to return a completed future with the given constant value.

    Changes the behavior to return a completed future with the given constant value.

    c

    The constant the future will be completed with.

  26. def pushDelayed: Promise[Unit]

    Enables control of the completion of the previously active behavior.

    Enables control of the completion of the previously active behavior. Wraps the previous behavior in a new one, returns a control promise that starts the original behavior after the control promise is completed.

    returns

    A promise, which delays the completion of the original future until after this promise is completed.

  27. def pushError(e: Throwable): Unit

    Changes the current behavior to return a failed future containing the given Throwable.

    Changes the current behavior to return a failed future containing the given Throwable.

    e

    The throwable the failed future will contain.

  28. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  29. def toString(): String
    Definition Classes
    Function1 → AnyRef → Any
  30. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  31. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  32. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated
  2. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from SwitchableLoggedBehavior[A, B] toStringFormat[SwitchableLoggedBehavior[A, B]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.12.16) Use formatString.format(value) instead of value.formatted(formatString), or use the f"" string interpolator. In Java 15 and later, formatted resolves to the new method in String which has reversed parameters.

  3. def [B](y: B): (SwitchableLoggedBehavior[A, B], B)
    Implicit
    This member is added by an implicit conversion from SwitchableLoggedBehavior[A, B] toArrowAssoc[SwitchableLoggedBehavior[A, B]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use -> instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

Inherited from (A) => Future[B]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd fromSwitchableLoggedBehavior[A, B] to any2stringadd[SwitchableLoggedBehavior[A, B]]

Inherited by implicit conversion StringFormat fromSwitchableLoggedBehavior[A, B] to StringFormat[SwitchableLoggedBehavior[A, B]]

Inherited by implicit conversion Ensuring fromSwitchableLoggedBehavior[A, B] to Ensuring[SwitchableLoggedBehavior[A, B]]

Inherited by implicit conversion ArrowAssoc fromSwitchableLoggedBehavior[A, B] to ArrowAssoc[SwitchableLoggedBehavior[A, B]]

Ungrouped