use of org.apache.kafka.common.message.DescribeTransactionsResponseData in project kafka by apache.
the class DescribeTransactionsHandlerTest method testHandleSuccessfulResponse.
@Test
public void testHandleSuccessfulResponse() {
String transactionalId1 = "foo";
String transactionalId2 = "bar";
Set<String> transactionalIds = mkSet(transactionalId1, transactionalId2);
DescribeTransactionsHandler handler = new DescribeTransactionsHandler(logContext);
DescribeTransactionsResponseData.TransactionState transactionState1 = sampleTransactionState1(transactionalId1);
DescribeTransactionsResponseData.TransactionState transactionState2 = sampleTransactionState2(transactionalId2);
Set<CoordinatorKey> keys = coordinatorKeys(transactionalIds);
DescribeTransactionsResponse response = new DescribeTransactionsResponse(new DescribeTransactionsResponseData().setTransactionStates(asList(transactionState1, transactionState2)));
ApiResult<CoordinatorKey, TransactionDescription> result = handler.handleResponse(node, keys, response);
assertEquals(keys, result.completedKeys.keySet());
assertMatchingTransactionState(node.id(), transactionState1, result.completedKeys.get(CoordinatorKey.byTransactionalId(transactionalId1)));
assertMatchingTransactionState(node.id(), transactionState2, result.completedKeys.get(CoordinatorKey.byTransactionalId(transactionalId2)));
}
Aggregations