Class TestClientStreamTracer

java.lang.Object
io.grpc.StreamTracer
io.grpc.ClientStreamTracer
io.grpc.internal.testing.TestClientStreamTracer
All Implemented Interfaces:
TestStreamTracer

public class TestClientStreamTracer extends io.grpc.ClientStreamTracer implements TestStreamTracer
A ClientStreamTracer suitable for testing.
  • Field Details

  • Constructor Details

    • TestClientStreamTracer

      public TestClientStreamTracer()
  • Method Details

    • await

      public void await() throws InterruptedException
      Description copied from interface: TestStreamTracer
      Waits for the stream to be done.
      Specified by:
      await in interface TestStreamTracer
      Throws:
      InterruptedException
    • await

      public boolean await(long timeout, TimeUnit timeUnit) throws InterruptedException
      Description copied from interface: TestStreamTracer
      Waits for the stream to be done.
      Specified by:
      await in interface TestStreamTracer
      Throws:
      InterruptedException
    • getInboundHeaders

      public boolean getInboundHeaders()
      Returns if ClientStreamTracer.inboundHeaders() has been called.
    • getInboundTrailers

      @Nullable public io.grpc.Metadata getInboundTrailers()
      Returns the inbound trailers if ClientStreamTracer.inboundTrailers(io.grpc.Metadata) has been called, or null.
    • getOutboundHeaders

      public boolean getOutboundHeaders()
      Returns if ClientStreamTracer.outboundHeaders() has been called.
    • awaitOutboundHeaders

      public boolean awaitOutboundHeaders(int timeout, TimeUnit unit) throws Exception
      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: TestStreamTracer
      Returns the status passed to StreamTracer.streamClosed(io.grpc.Status).
      Specified by:
      getStatus in interface TestStreamTracer
    • getInboundWireSize

      public long getInboundWireSize()
      Description copied from interface: TestStreamTracer
      Returns to sum of all sizes passed to StreamTracer.inboundWireSize(long).
      Specified by:
      getInboundWireSize in interface TestStreamTracer
    • getInboundUncompressedSize

      public long getInboundUncompressedSize()
      Description copied from interface: TestStreamTracer
      Returns to sum of all sizes passed to StreamTracer.inboundUncompressedSize(long).
      Specified by:
      getInboundUncompressedSize in interface TestStreamTracer
    • getOutboundWireSize

      public long getOutboundWireSize()
      Description copied from interface: TestStreamTracer
      Returns to sum of all sizes passed to StreamTracer.outboundWireSize(long).
      Specified by:
      getOutboundWireSize in interface TestStreamTracer
    • getOutboundUncompressedSize

      public long getOutboundUncompressedSize()
      Description copied from interface: TestStreamTracer
      Returns to sum of al sizes passed to StreamTracer.outboundUncompressedSize(long).
      Specified by:
      getOutboundUncompressedSize in interface TestStreamTracer
    • setFailDuplicateCallbacks

      public void setFailDuplicateCallbacks(boolean fail)
      Description copied from interface: TestStreamTracer
      Sets whether to fail on unexpected duplicate calls to callback methods.
      Specified by:
      setFailDuplicateCallbacks in interface TestStreamTracer
    • nextOutboundEvent

      public String nextOutboundEvent()
      Description copied from interface: TestStreamTracer
      Returns the next captured outbound message event.
      Specified by:
      nextOutboundEvent in interface TestStreamTracer
    • nextInboundEvent

      public String nextInboundEvent()
      Description copied from interface: TestStreamTracer
      Returns the next captured outbound message event.
      Specified by:
      nextInboundEvent in interface TestStreamTracer
    • outboundWireSize

      public void outboundWireSize(long bytes)
      Overrides:
      outboundWireSize in class io.grpc.StreamTracer
    • inboundWireSize

      public void inboundWireSize(long bytes)
      Overrides:
      inboundWireSize in class io.grpc.StreamTracer
    • outboundUncompressedSize

      public void outboundUncompressedSize(long bytes)
      Overrides:
      outboundUncompressedSize in class io.grpc.StreamTracer
    • inboundUncompressedSize

      public void inboundUncompressedSize(long bytes)
      Overrides:
      inboundUncompressedSize in class io.grpc.StreamTracer
    • streamClosed

      public void streamClosed(io.grpc.Status status)
      Overrides:
      streamClosed in class io.grpc.StreamTracer
    • inboundMessage

      public void inboundMessage(int seqNo)
      Overrides:
      inboundMessage in class io.grpc.StreamTracer
    • outboundMessage

      public void outboundMessage(int seqNo)
      Overrides:
      outboundMessage in class io.grpc.StreamTracer
    • outboundMessageSent

      public void outboundMessageSent(int seqNo, long optionalWireSize, long optionalUncompressedSize)
      Overrides:
      outboundMessageSent in class io.grpc.StreamTracer
    • inboundMessageRead

      public void inboundMessageRead(int seqNo, long optionalWireSize, long optionalUncompressedSize)
      Overrides:
      inboundMessageRead in class io.grpc.StreamTracer
    • outboundHeaders

      public void outboundHeaders()
      Overrides:
      outboundHeaders in class io.grpc.ClientStreamTracer
    • inboundHeaders

      public void inboundHeaders()
      Overrides:
      inboundHeaders in class io.grpc.ClientStreamTracer
    • inboundTrailers

      public void inboundTrailers(io.grpc.Metadata trailers)
      Overrides:
      inboundTrailers in class io.grpc.ClientStreamTracer