Class StreamRecorder<T>
java.lang.Object
io.grpc.internal.testing.StreamRecorder<T>
- All Implemented Interfaces:
io.grpc.stub.StreamObserver<T>
Utility implementation of
StreamObserver used in testing. Records all the observed
values produced by the stream as well as any errors.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Throwableprivate final com.google.common.util.concurrent.SettableFuture<T> private final CountDownLatch -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidWaits for the stream to terminate.booleanawaitCompletion(int timeout, TimeUnit unit) Waits a fixed timeout for the stream to terminate.static <T> StreamRecorder<T> create()Creates a new recorder.com.google.common.util.concurrent.ListenableFuture<T> Returns aListenableFuturefor the first value received from the stream.getError()Returns the stream terminating error.Returns the current set of received values.voidvoidvoid
-
Field Details
-
latch
-
results
-
error
-
firstValue
-
-
Constructor Details
-
StreamRecorder
private StreamRecorder()
-
-
Method Details
-
create
Creates a new recorder. -
onNext
-
onError
-
onCompleted
public void onCompleted()- Specified by:
onCompletedin interfaceio.grpc.stub.StreamObserver<T>
-
awaitCompletion
-
awaitCompletion
-
getValues
-
getError
-
firstValue
Returns aListenableFuturefor the first value received from the stream. Useful for testing unary call patterns.
-