Search in sources :

Example 11 with FindCoordinatorResponseData

use of org.apache.kafka.common.message.FindCoordinatorResponseData in project kafka by apache.

the class CoordinatorStrategyTest method assertFatalOldLookup.

public Throwable assertFatalOldLookup(CoordinatorKey key, Errors error) {
    FindCoordinatorResponseData responseData = new FindCoordinatorResponseData().setErrorCode(error.code());
    AdminApiLookupStrategy.LookupResult<CoordinatorKey> result = runOldLookup(key, responseData);
    assertEquals(emptyMap(), result.mappedKeys);
    assertEquals(singleton(key), result.failedKeys.keySet());
    Throwable throwable = result.failedKeys.get(key);
    assertTrue(error.exception().getClass().isInstance(throwable));
    return throwable;
}
Also used : FindCoordinatorResponseData(org.apache.kafka.common.message.FindCoordinatorResponseData)

Example 12 with FindCoordinatorResponseData

use of org.apache.kafka.common.message.FindCoordinatorResponseData in project kafka by apache.

the class FindCoordinatorResponse method prepareResponse.

public static FindCoordinatorResponse prepareResponse(Errors error, String key, Node node) {
    FindCoordinatorResponseData data = new FindCoordinatorResponseData();
    data.setCoordinators(Collections.singletonList(new FindCoordinatorResponseData.Coordinator().setErrorCode(error.code()).setErrorMessage(error.message()).setKey(key).setHost(node.host()).setPort(node.port()).setNodeId(node.id())));
    return new FindCoordinatorResponse(data);
}
Also used : FindCoordinatorResponseData(org.apache.kafka.common.message.FindCoordinatorResponseData) Coordinator(org.apache.kafka.common.message.FindCoordinatorResponseData.Coordinator)

Aggregations

FindCoordinatorResponseData (org.apache.kafka.common.message.FindCoordinatorResponseData)12 Test (org.junit.jupiter.api.Test)4 Coordinator (org.apache.kafka.common.message.FindCoordinatorResponseData.Coordinator)2 FindCoordinatorResponse (org.apache.kafka.common.requests.FindCoordinatorResponse)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Cluster (org.apache.kafka.common.Cluster)1 Node (org.apache.kafka.common.Node)1 DescribeTransactionsResponseData (org.apache.kafka.common.message.DescribeTransactionsResponseData)1 Errors (org.apache.kafka.common.protocol.Errors)1 DescribeTransactionsRequest (org.apache.kafka.common.requests.DescribeTransactionsRequest)1 DescribeTransactionsResponse (org.apache.kafka.common.requests.DescribeTransactionsResponse)1 FindCoordinatorRequest (org.apache.kafka.common.requests.FindCoordinatorRequest)1 LogContext (org.apache.kafka.common.utils.LogContext)1 MockTime (org.apache.kafka.common.utils.MockTime)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1