Class ByteBufReceiveSingleRequestBufferTest
java.lang.Object
org.apache.kafka.common.network.netty.ByteBufReceiveSingleRequestBufferTest
Test class to test ByteBufReceive backed by a single buffer.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic voidvoidvoidIf buffer doesn't contain full request, then test if partial data is correctly read and size of read data is returned correctly.voidCheck 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.voidvoidvoidTest if size of the request is correctly parsedvoidLowering 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.voidSetting the max equal to the already-read request size is valid: requestSize is not strictly greater than the new max.voidRaising the max after construction allows a subsequent setMaxReceivedSize check at the higher value to succeed for the already-read request.voidThe constructor sets an initial max that allows the request to be read.voidtestSize()Test if total size is correct, which is used for metric generation
-
Constructor Details
-
ByteBufReceiveSingleRequestBufferTest
public ByteBufReceiveSingleRequestBufferTest()
-
-
Method Details
-
beforeAll
- 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 viaByteBufReceive.setMaxReceivedSize(int), the already-read request size exceeds the new max, so anInvalidReceiveExceptionis 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.
-