Package io.grpc.internal.testing
Class TestClientStreamTracer
java.lang.Object
io.grpc.StreamTracer
io.grpc.ClientStreamTracer
io.grpc.internal.testing.TestClientStreamTracer
- All Implemented Interfaces:
TestStreamTracer
A
ClientStreamTracer suitable for testing.-
Nested Class Summary
Nested classes/interfaces inherited from class io.grpc.ClientStreamTracer
io.grpc.ClientStreamTracer.Factory, io.grpc.ClientStreamTracer.StreamInfoNested classes/interfaces inherited from interface io.grpc.internal.testing.TestStreamTracer
TestStreamTracer.TestBaseStreamTracer -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TestStreamTracer.TestBaseStreamTracerprotected final AtomicReference<Throwable> protected final AtomicReference<io.grpc.Metadata> protected final AtomicReference<Throwable> protected final CountDownLatchFields inherited from class io.grpc.ClientStreamTracer
NAME_RESOLUTION_DELAYED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidawait()Waits for the stream to be done.booleanWaits for the stream to be done.booleanawaitOutboundHeaders(int timeout, TimeUnit unit) Allow tests to await the outbound header event, which depending on the test case may be necessary (e.g., if we test for a Netty client's outbound headers upon receiving the start of stream on the server side, the tracer won't know that headers were sent until a channel future executes).booleanReturns ifClientStreamTracer.inboundHeaders()has been called.io.grpc.MetadataReturns the inbound trailers ifClientStreamTracer.inboundTrailers(io.grpc.Metadata)has been called, ornull.longReturns to sum of all sizes passed toStreamTracer.inboundUncompressedSize(long).longReturns to sum of all sizes passed toStreamTracer.inboundWireSize(long).booleanReturns ifClientStreamTracer.outboundHeaders()has been called.longReturns to sum of al sizes passed toStreamTracer.outboundUncompressedSize(long).longReturns to sum of all sizes passed toStreamTracer.outboundWireSize(long).io.grpc.StatusReturns the status passed toStreamTracer.streamClosed(io.grpc.Status).voidvoidinboundMessage(int seqNo) voidinboundMessageRead(int seqNo, long optionalWireSize, long optionalUncompressedSize) voidinboundTrailers(io.grpc.Metadata trailers) voidinboundUncompressedSize(long bytes) voidinboundWireSize(long bytes) Returns the next captured outbound message event.Returns the next captured outbound message event.voidvoidoutboundMessage(int seqNo) voidoutboundMessageSent(int seqNo, long optionalWireSize, long optionalUncompressedSize) voidoutboundUncompressedSize(long bytes) voidoutboundWireSize(long bytes) voidsetFailDuplicateCallbacks(boolean fail) Sets whether to fail on unexpected duplicate calls to callback methods.voidstreamClosed(io.grpc.Status status) Methods inherited from class io.grpc.ClientStreamTracer
addOptionalLabel, createPendingStream, inboundHeaders, streamCreated
-
Field Details
-
delegate
-
outboundHeadersLatch
-
outboundHeadersCalled
-
inboundHeadersCalled
-
inboundTrailers
-
-
Constructor Details
-
TestClientStreamTracer
public TestClientStreamTracer()
-
-
Method Details
-
await
Description copied from interface:TestStreamTracerWaits for the stream to be done.- Specified by:
awaitin interfaceTestStreamTracer- Throws:
InterruptedException
-
await
Description copied from interface:TestStreamTracerWaits for the stream to be done.- Specified by:
awaitin interfaceTestStreamTracer- Throws:
InterruptedException
-
getInboundHeaders
public boolean getInboundHeaders()Returns ifClientStreamTracer.inboundHeaders()has been called. -
getInboundTrailers
Returns the inbound trailers ifClientStreamTracer.inboundTrailers(io.grpc.Metadata)has been called, ornull. -
getOutboundHeaders
public boolean getOutboundHeaders()Returns ifClientStreamTracer.outboundHeaders()has been called. -
awaitOutboundHeaders
Allow tests to await the outbound header event, which depending on the test case may be necessary (e.g., if we test for a Netty client's outbound headers upon receiving the start of stream on the server side, the tracer won't know that headers were sent until a channel future executes).- Throws:
Exception
-
getStatus
public io.grpc.Status getStatus()Description copied from interface:TestStreamTracerReturns the status passed toStreamTracer.streamClosed(io.grpc.Status).- Specified by:
getStatusin interfaceTestStreamTracer
-
getInboundWireSize
public long getInboundWireSize()Description copied from interface:TestStreamTracerReturns to sum of all sizes passed toStreamTracer.inboundWireSize(long).- Specified by:
getInboundWireSizein interfaceTestStreamTracer
-
getInboundUncompressedSize
public long getInboundUncompressedSize()Description copied from interface:TestStreamTracerReturns to sum of all sizes passed toStreamTracer.inboundUncompressedSize(long).- Specified by:
getInboundUncompressedSizein interfaceTestStreamTracer
-
getOutboundWireSize
public long getOutboundWireSize()Description copied from interface:TestStreamTracerReturns to sum of all sizes passed toStreamTracer.outboundWireSize(long).- Specified by:
getOutboundWireSizein interfaceTestStreamTracer
-
getOutboundUncompressedSize
public long getOutboundUncompressedSize()Description copied from interface:TestStreamTracerReturns to sum of al sizes passed toStreamTracer.outboundUncompressedSize(long).- Specified by:
getOutboundUncompressedSizein interfaceTestStreamTracer
-
setFailDuplicateCallbacks
public void setFailDuplicateCallbacks(boolean fail) Description copied from interface:TestStreamTracerSets whether to fail on unexpected duplicate calls to callback methods.- Specified by:
setFailDuplicateCallbacksin interfaceTestStreamTracer
-
nextOutboundEvent
Description copied from interface:TestStreamTracerReturns the next captured outbound message event.- Specified by:
nextOutboundEventin interfaceTestStreamTracer
-
nextInboundEvent
Description copied from interface:TestStreamTracerReturns the next captured outbound message event.- Specified by:
nextInboundEventin interfaceTestStreamTracer
-
outboundWireSize
public void outboundWireSize(long bytes) - Overrides:
outboundWireSizein classio.grpc.StreamTracer
-
inboundWireSize
public void inboundWireSize(long bytes) - Overrides:
inboundWireSizein classio.grpc.StreamTracer
-
outboundUncompressedSize
public void outboundUncompressedSize(long bytes) - Overrides:
outboundUncompressedSizein classio.grpc.StreamTracer
-
inboundUncompressedSize
public void inboundUncompressedSize(long bytes) - Overrides:
inboundUncompressedSizein classio.grpc.StreamTracer
-
streamClosed
public void streamClosed(io.grpc.Status status) - Overrides:
streamClosedin classio.grpc.StreamTracer
-
inboundMessage
public void inboundMessage(int seqNo) - Overrides:
inboundMessagein classio.grpc.StreamTracer
-
outboundMessage
public void outboundMessage(int seqNo) - Overrides:
outboundMessagein classio.grpc.StreamTracer
-
outboundMessageSent
public void outboundMessageSent(int seqNo, long optionalWireSize, long optionalUncompressedSize) - Overrides:
outboundMessageSentin classio.grpc.StreamTracer
-
inboundMessageRead
public void inboundMessageRead(int seqNo, long optionalWireSize, long optionalUncompressedSize) - Overrides:
inboundMessageReadin classio.grpc.StreamTracer
-
outboundHeaders
public void outboundHeaders()- Overrides:
outboundHeadersin classio.grpc.ClientStreamTracer
-
inboundHeaders
public void inboundHeaders()- Overrides:
inboundHeadersin classio.grpc.ClientStreamTracer
-
inboundTrailers
public void inboundTrailers(io.grpc.Metadata trailers) - Overrides:
inboundTrailersin classio.grpc.ClientStreamTracer
-