Class SenderTest

java.lang.Object
org.apache.kafka.clients.producer.internals.SenderTest

public class SenderTest extends Object
  • Constructor Details

    • SenderTest

      public SenderTest()
  • Method Details

    • setup

      @BeforeEach public void setup()
    • tearDown

      @AfterEach public void tearDown()
    • testSimple

      @Test public void testSimple() throws Exception
      Throws:
      Exception
    • testQuotaMetrics

      @Test public void testQuotaMetrics()
    • testSenderMetricsTemplates

      @Test public void testSenderMetricsTemplates() throws Exception
      Throws:
      Exception
    • testRetries

      @Test public void testRetries() throws Exception
      Throws:
      Exception
    • testSendInOrder

      @Test public void testSendInOrder() throws Exception
      Throws:
      Exception
    • testAppendInExpiryCallback

      @Test public void testAppendInExpiryCallback() throws InterruptedException
      Throws:
      InterruptedException
    • testMetadataTopicExpiry

      @Test public void testMetadataTopicExpiry() throws Exception
      Tests that topics are added to the metadata list when messages are available to send and expired if not used during a metadata refresh interval.
      Throws:
      Exception
    • senderThreadShouldNotGetStuckWhenThrottledAndAddingPartitionsToTxn

      @Test public void senderThreadShouldNotGetStuckWhenThrottledAndAddingPartitionsToTxn()
    • testNodeLatencyStats

      @Test public void testNodeLatencyStats() throws Exception
      Throws:
      Exception
    • testInitProducerIdRequest

      @Test public void testInitProducerIdRequest()
    • testInitProducerIdWithMaxInFlightOne

      @Test public void testInitProducerIdWithMaxInFlightOne()
      Verifies that InitProducerId of transactional producer succeeds even if metadata requests are pending with only one bootstrap node available and maxInFlight=1, where multiple polls are necessary to send requests.
    • testIdempotentInitProducerIdWithMaxInFlightOne

      @Test public void testIdempotentInitProducerIdWithMaxInFlightOne()
      Verifies that InitProducerId of idempotent producer succeeds even if metadata requests are pending with only one bootstrap node available and maxInFlight=1, where multiple polls are necessary to send requests.
    • testNodeNotReady

      @Test public void testNodeNotReady()
      Tests the code path where the target node to send FindCoordinator or InitProducerId is not ready.
    • testClusterAuthorizationExceptionInInitProducerIdRequest

      @Test public void testClusterAuthorizationExceptionInInitProducerIdRequest() throws Exception
      Throws:
      Exception
    • testCanRetryWithoutIdempotence

      @Test public void testCanRetryWithoutIdempotence() throws Exception
      Throws:
      Exception
    • testIdempotenceWithMultipleInflights

      @Test public void testIdempotenceWithMultipleInflights() throws Exception
      Throws:
      Exception
    • testIdempotenceWithMultipleInflightsRetriedInOrder

      @Test public void testIdempotenceWithMultipleInflightsRetriedInOrder() throws Exception
      Throws:
      Exception
    • testIdempotenceWithMultipleInflightsWhereFirstFailsFatallyAndSequenceOfFutureBatchesIsAdjusted

      @Test public void testIdempotenceWithMultipleInflightsWhereFirstFailsFatallyAndSequenceOfFutureBatchesIsAdjusted() throws Exception
      Throws:
      Exception
    • testEpochBumpOnOutOfOrderSequenceForNextBatch

      @Test public void testEpochBumpOnOutOfOrderSequenceForNextBatch() throws Exception
      Throws:
      Exception
    • testEpochBumpOnOutOfOrderSequenceForNextBatchWhenThereIsNoBatchInFlight

      @Test public void testEpochBumpOnOutOfOrderSequenceForNextBatchWhenThereIsNoBatchInFlight() throws Exception
      Throws:
      Exception
    • testEpochBumpOnOutOfOrderSequenceForNextBatchWhenBatchInFlightFails

      @Test public void testEpochBumpOnOutOfOrderSequenceForNextBatchWhenBatchInFlightFails() throws Exception
      Throws:
      Exception
    • testCorrectHandlingOfOutOfOrderResponses

      @Test public void testCorrectHandlingOfOutOfOrderResponses() throws Exception
      Throws:
      Exception
    • testCorrectHandlingOfOutOfOrderResponsesWhenSecondSucceeds

      @Test public void testCorrectHandlingOfOutOfOrderResponsesWhenSecondSucceeds() throws Exception
      Throws:
      Exception
    • testExpiryOfUnsentBatchesShouldNotCauseUnresolvedSequences

      @Test public void testExpiryOfUnsentBatchesShouldNotCauseUnresolvedSequences() throws Exception
      Throws:
      Exception
    • testExpiryOfFirstBatchShouldNotCauseUnresolvedSequencesIfFutureBatchesSucceed

      @Test public void testExpiryOfFirstBatchShouldNotCauseUnresolvedSequencesIfFutureBatchesSucceed() throws Exception
      Throws:
      Exception
    • testExpiryOfFirstBatchShouldCauseEpochBumpIfFutureBatchesFail

      @Test public void testExpiryOfFirstBatchShouldCauseEpochBumpIfFutureBatchesFail() throws Exception
      Throws:
      Exception
    • testUnresolvedSequencesAreNotFatal

      @Test public void testUnresolvedSequencesAreNotFatal() throws Exception
      Throws:
      Exception
    • testExpiryOfAllSentBatchesShouldCauseUnresolvedSequences

      @Test public void testExpiryOfAllSentBatchesShouldCauseUnresolvedSequences() throws Exception
      Throws:
      Exception
    • testResetOfProducerStateShouldAllowQueuedBatchesToDrain

      @Test public void testResetOfProducerStateShouldAllowQueuedBatchesToDrain() throws Exception
      Throws:
      Exception
    • testCloseWithProducerIdReset

      @Test public void testCloseWithProducerIdReset() throws Exception
      Throws:
      Exception
    • testForceCloseWithProducerIdReset

      @Test public void testForceCloseWithProducerIdReset() throws Exception
      Throws:
      Exception
    • testBatchesDrainedWithOldProducerIdShouldSucceedOnSubsequentRetry

      @Test public void testBatchesDrainedWithOldProducerIdShouldSucceedOnSubsequentRetry() throws Exception
      Throws:
      Exception
    • testCorrectHandlingOfDuplicateSequenceError

      @Test public void testCorrectHandlingOfDuplicateSequenceError() throws Exception
      Throws:
      Exception
    • testTransactionalUnknownProducerHandlingWhenRetentionLimitReached

      @Test public void testTransactionalUnknownProducerHandlingWhenRetentionLimitReached() throws Exception
      Throws:
      Exception
    • testIdempotentUnknownProducerHandlingWhenRetentionLimitReached

      @Test public void testIdempotentUnknownProducerHandlingWhenRetentionLimitReached() throws Exception
      Throws:
      Exception
    • testUnknownProducerErrorShouldBeRetriedWhenLogStartOffsetIsUnknown

      @Test public void testUnknownProducerErrorShouldBeRetriedWhenLogStartOffsetIsUnknown() throws Exception
      Throws:
      Exception
    • testUnknownProducerErrorShouldBeRetriedForFutureBatchesWhenFirstFails

      @Test public void testUnknownProducerErrorShouldBeRetriedForFutureBatchesWhenFirstFails() throws Exception
      Throws:
      Exception
    • testShouldRaiseOutOfOrderSequenceExceptionToUserIfLogWasNotTruncated

      @Test public void testShouldRaiseOutOfOrderSequenceExceptionToUserIfLogWasNotTruncated() throws Exception
      Throws:
      Exception
    • testClusterAuthorizationExceptionInProduceRequest

      @Test public void testClusterAuthorizationExceptionInProduceRequest() throws Exception
      Throws:
      Exception
    • testCancelInFlightRequestAfterFatalError

      @Test public void testCancelInFlightRequestAfterFatalError() throws Exception
      Throws:
      Exception
    • testUnsupportedForMessageFormatInProduceRequest

      @Test public void testUnsupportedForMessageFormatInProduceRequest() throws Exception
      Throws:
      Exception
    • testUnsupportedVersionInProduceRequest

      @Test public void testUnsupportedVersionInProduceRequest() throws Exception
      Throws:
      Exception
    • testSequenceNumberIncrement

      @Test public void testSequenceNumberIncrement() throws InterruptedException
      Throws:
      InterruptedException
    • testRetryWhenProducerIdChanges

      @Test public void testRetryWhenProducerIdChanges() throws InterruptedException
      Throws:
      InterruptedException
    • testBumpEpochWhenOutOfOrderSequenceReceived

      @Test public void testBumpEpochWhenOutOfOrderSequenceReceived() throws InterruptedException
      Throws:
      InterruptedException
    • testIdempotentSplitBatchAndSend

      @Test public void testIdempotentSplitBatchAndSend() throws Exception
      Throws:
      Exception
    • testTransactionalSplitBatchAndSend

      @Test public void testTransactionalSplitBatchAndSend() throws Exception
      Throws:
      Exception
    • testNoDoubleDeallocation

      @Test public void testNoDoubleDeallocation() throws Exception
      Throws:
      Exception
    • testInflightBatchesExpireOnDeliveryTimeout

      @Test public void testInflightBatchesExpireOnDeliveryTimeout() throws InterruptedException
      Throws:
      InterruptedException
    • testRecordErrorPropagatedToApplication

      @Test public void testRecordErrorPropagatedToApplication() throws InterruptedException
      Throws:
      InterruptedException
    • testWhenFirstBatchExpireNoSendSecondBatchIfGuaranteeOrder

      @Test public void testWhenFirstBatchExpireNoSendSecondBatchIfGuaranteeOrder() throws InterruptedException
      Throws:
      InterruptedException
    • testExpiredBatchDoesNotRetry

      @Test public void testExpiredBatchDoesNotRetry() throws Exception
      Throws:
      Exception
    • testExpiredBatchDoesNotSplitOnMessageTooLargeError

      @Test public void testExpiredBatchDoesNotSplitOnMessageTooLargeError() throws Exception
      Throws:
      Exception
    • testResetNextBatchExpiry

      @Test public void testResetNextBatchExpiry() throws Exception
      Throws:
      Exception
    • testExpiredBatchesInMultiplePartitions

      @Test public void testExpiredBatchesInMultiplePartitions() throws Exception
      Throws:
      Exception
    • testTransactionalRequestsSentOnShutdown

      @Test public void testTransactionalRequestsSentOnShutdown()
    • testRecordsFlushedImmediatelyOnTransactionCompletion

      @Test public void testRecordsFlushedImmediatelyOnTransactionCompletion() throws Exception
      Throws:
      Exception
    • testAwaitPendingRecordsBeforeCommittingTransaction

      @Test public void testAwaitPendingRecordsBeforeCommittingTransaction() throws Exception
      Throws:
      Exception
    • testIncompleteTransactionAbortOnShutdown

      @Test public void testIncompleteTransactionAbortOnShutdown()
    • testForceShutdownWithIncompleteTransaction

      @Timeout(10L) @Test public void testForceShutdownWithIncompleteTransaction()
    • testTransactionAbortedExceptionOnAbortWithoutError

      @Test public void testTransactionAbortedExceptionOnAbortWithoutError() throws InterruptedException
      Throws:
      InterruptedException
    • testDoNotPollWhenNoRequestSent

      @Test public void testDoNotPollWhenNoRequestSent()
    • testTooLargeBatchesAreSafelyRemoved

      @Test public void testTooLargeBatchesAreSafelyRemoved() throws InterruptedException
      Throws:
      InterruptedException
    • testDefaultErrorMessage

      @Test public void testDefaultErrorMessage() throws Exception
      Throws:
      Exception
    • testCustomErrorMessage

      @Test public void testCustomErrorMessage() throws Exception
      Throws:
      Exception
    • testTransactionShouldTransitionToAbortableForSenderAPI

      @ParameterizedTest @EnumSource(value=org.apache.kafka.common.protocol.Errors.class, names={"COORDINATOR_LOAD_IN_PROGRESS","INVALID_TXN_STATE"}) public void testTransactionShouldTransitionToAbortableForSenderAPI(org.apache.kafka.common.protocol.Errors error) throws InterruptedException
      Throws:
      InterruptedException
    • testSenderShouldRetryWithBackoffOnRetriableError

      @Test public void testSenderShouldRetryWithBackoffOnRetriableError() throws InterruptedException
      Throws:
      InterruptedException
    • testReceiveFailedBatchTwiceWithTransactions

      @Test public void testReceiveFailedBatchTwiceWithTransactions() throws Exception
      Throws:
      Exception
    • testInvalidTxnStateIsAnAbortableError

      @Test public void testInvalidTxnStateIsAnAbortableError() throws Exception
      Throws:
      Exception
    • testTransactionAbortableExceptionIsAnAbortableError

      @Test public void testTransactionAbortableExceptionIsAnAbortableError() throws Exception
      Throws:
      Exception
    • testAbortableErrorIsConvertedToFatalErrorDuringAbort

      @Test public void testAbortableErrorIsConvertedToFatalErrorDuringAbort() throws Exception
      Throws:
      Exception
    • testProducerBatchRetriesWhenPartitionLeaderChanges

      @Test public void testProducerBatchRetriesWhenPartitionLeaderChanges() throws Exception
      Throws:
      Exception
    • testSenderShouldCloseWhenTransactionManagerInErrorState

      @Timeout(5L) @Test public void testSenderShouldCloseWhenTransactionManagerInErrorState()
    • testWhenProduceResponseReturnsWithALeaderShipChangeErrorButNoNewLeaderInformation

      @Test public void testWhenProduceResponseReturnsWithALeaderShipChangeErrorButNoNewLeaderInformation() throws InterruptedException
      Test the scenario that ProduceResponse returns NOT_LEADER_OR_FOLLOWER, indicating change in leadership, but it does not contain new leader info(defined in KIP-951).
      Throws:
      InterruptedException
    • testWhenProduceResponseReturnsWithALeaderShipChangeErrorAndNewLeaderInformation

      @Test public void testWhenProduceResponseReturnsWithALeaderShipChangeErrorAndNewLeaderInformation() throws InterruptedException
      Test the scenario that ProduceResponse returns NOT_LEADER_OR_FOLLOWER, indicating change in leadership, along with new leader info(defined in KIP-951).
      Throws:
      InterruptedException
    • testNoBufferReuseWhenBatchExpires

      @Test public void testNoBufferReuseWhenBatchExpires() throws Exception
      Throws:
      Exception