Class ByteBufReceiveSingleRequestBufferTest

java.lang.Object
org.apache.kafka.common.network.netty.ByteBufReceiveSingleRequestBufferTest

public class ByteBufReceiveSingleRequestBufferTest extends Object
Test class to test ByteBufReceive backed by a single buffer.
  • Constructor Details

    • ByteBufReceiveSingleRequestBufferTest

      public ByteBufReceiveSingleRequestBufferTest()
  • Method Details

    • beforeAll

      @BeforeAll public static void beforeAll() throws IOException
      Throws:
      IOException
    • beforeEach

      @BeforeEach public void beforeEach()
    • afterEach

      @AfterEach public void afterEach()
    • testClose

      @Test public void testClose()
      Check when the ByteBufReceive takes ownership of the buffer and calls release when it is closed so that the buffer's reference count goes to zero.
    • testCloseAfterPayloadCalled

      @Test public void testCloseAfterPayloadCalled()
    • testSize

      @Test public void testSize()
      Test if total size is correct, which is used for metric generation
    • testExpectedSize

      @Test public void testExpectedSize()
      Test if size of the request is correctly parsed
    • testComplete

      @Test public void testComplete()
    • testBytesRead

      @Test public void testBytesRead()
      If buffer doesn't contain full request, then test if partial data is correctly read and size of read data is returned correctly.
    • testSetMaxReceivedSizeRejectsAlreadyReadOversizedRequest

      @Test public void testSetMaxReceivedSizeRejectsAlreadyReadOversizedRequest()
      The constructor sets an initial max that allows the request to be read. After lowering the max via ByteBufReceive.setMaxReceivedSize(int), the already-read request size exceeds the new max, so an InvalidReceiveException is thrown.
    • testSetMaxReceivedSizeEqualToRequestSizeIsAllowed

      @Test public void testSetMaxReceivedSizeEqualToRequestSizeIsAllowed()
      Setting the max equal to the already-read request size is valid: requestSize is not strictly greater than the new max.
    • testSetMaxReceivedSizeBeforeSizeReadIsHonoredOnReadFrom

      @Test public void testSetMaxReceivedSizeBeforeSizeReadIsHonoredOnReadFrom()
      Lowering the max before the size has been read does not throw, but the next readFrom triggers the existing size check and throws if the on-the-wire size exceeds the new max.
    • testSetMaxReceivedSizeRaisingMaxIsAllowed

      @Test public void testSetMaxReceivedSizeRaisingMaxIsAllowed()
      Raising the max after construction allows a subsequent setMaxReceivedSize check at the higher value to succeed for the already-read request.