public static class TestTransport.SwitchableLoggedBehavior<A,B>
extends java.lang.Object
implements scala.Function1<A,scala.concurrent.Future<B>>
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.
param: defaultBehavior The original behavior that might be overwritten. It is always possible to restore this behavior
param: 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.
Constructor and Description |
---|
SwitchableLoggedBehavior(scala.Function1<A,scala.concurrent.Future<B>> defaultBehavior,
scala.Function1<A,scala.runtime.BoxedUnit> logCallback) |
Modifier and Type | Method and Description |
---|---|
scala.concurrent.Future<B> |
apply(A params)
Applies the current behavior, and invokes the callback.
|
void |
pop()
Restores the previous behavior.
|
void |
push(scala.Function1<A,scala.concurrent.Future<B>> behavior)
Changes the current behavior to the provided one.
|
void |
pushConstant(B c)
Changes the behavior to return a completed future with the given constant value.
|
scala.concurrent.Promise<scala.runtime.BoxedUnit> |
pushDelayed()
Enables control of the completion of the previously active behavior.
|
void |
pushError(java.lang.Throwable e)
Changes the current behavior to return a failed future containing the given Throwable.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
$init$, andThen, apply$mcDD$sp, apply$mcDF$sp, apply$mcDI$sp, apply$mcDJ$sp, apply$mcFD$sp, apply$mcFF$sp, apply$mcFI$sp, apply$mcFJ$sp, apply$mcID$sp, apply$mcIF$sp, apply$mcII$sp, apply$mcIJ$sp, apply$mcJD$sp, apply$mcJF$sp, apply$mcJI$sp, apply$mcJJ$sp, apply$mcVD$sp, apply$mcVF$sp, apply$mcVI$sp, apply$mcVJ$sp, apply$mcZD$sp, apply$mcZF$sp, apply$mcZI$sp, apply$mcZJ$sp, compose, toString
public void push(scala.Function1<A,scala.concurrent.Future<B>> behavior)
behavior
- Function that takes a parameter type A and returns a Future[B].public void pushConstant(B c)
c
- The constant the future will be completed with.public void pushError(java.lang.Throwable e)
e
- The throwable the failed future will contain.public scala.concurrent.Promise<scala.runtime.BoxedUnit> pushDelayed()
public void pop()