Search in sources :

Example 6 with FindCoordinatorRequest

use of org.apache.kafka.common.requests.FindCoordinatorRequest in project kafka by apache.

the class TransactionManagerTest method testUnsupportedFindCoordinator.

@Test
public void testUnsupportedFindCoordinator() {
    transactionManager.initializeTransactions();
    client.prepareUnsupportedVersionResponse(body -> {
        FindCoordinatorRequest findCoordinatorRequest = (FindCoordinatorRequest) body;
        assertEquals(CoordinatorType.forId(findCoordinatorRequest.data().keyType()), CoordinatorType.TRANSACTION);
        assertEquals(findCoordinatorRequest.data().key(), transactionalId);
        return true;
    });
    runUntil(transactionManager::hasFatalError);
    assertTrue(transactionManager.hasFatalError());
    assertTrue(transactionManager.lastError() instanceof UnsupportedVersionException);
}
Also used : FindCoordinatorRequest(org.apache.kafka.common.requests.FindCoordinatorRequest) UnsupportedVersionException(org.apache.kafka.common.errors.UnsupportedVersionException) Test(org.junit.jupiter.api.Test)

Aggregations

FindCoordinatorRequest (org.apache.kafka.common.requests.FindCoordinatorRequest)6 Test (org.junit.jupiter.api.Test)5 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 MockTime (org.apache.kafka.common.utils.MockTime)3 HashMap (java.util.HashMap)2 MockClient (org.apache.kafka.clients.MockClient)2 ProducerMetadata (org.apache.kafka.clients.producer.internals.ProducerMetadata)2 Node (org.apache.kafka.common.Node)2 DescribeTransactionsResponseData (org.apache.kafka.common.message.DescribeTransactionsResponseData)2 DescribeTransactionsRequest (org.apache.kafka.common.requests.DescribeTransactionsRequest)2 DescribeTransactionsResponse (org.apache.kafka.common.requests.DescribeTransactionsResponse)2 MetadataResponse (org.apache.kafka.common.requests.MetadataResponse)2 StringSerializer (org.apache.kafka.common.serialization.StringSerializer)2 Time (org.apache.kafka.common.utils.Time)2 ExecutorService (java.util.concurrent.ExecutorService)1 Cluster (org.apache.kafka.common.Cluster)1 UnsupportedVersionException (org.apache.kafka.common.errors.UnsupportedVersionException)1 FindCoordinatorResponseData (org.apache.kafka.common.message.FindCoordinatorResponseData)1 FindCoordinatorResponse (org.apache.kafka.common.requests.FindCoordinatorResponse)1