Search in sources :

Example 1 with ListTransactionsResult

use of org.apache.kafka.clients.admin.ListTransactionsResult in project kafka by apache.

the class TransactionsCommandTest method expectListTransactions.

private void expectListTransactions(ListTransactionsOptions options, Map<Integer, Collection<TransactionListing>> listingsByBroker) {
    ListTransactionsResult listResult = Mockito.mock(ListTransactionsResult.class);
    Mockito.when(admin.listTransactions(options)).thenReturn(listResult);
    List<TransactionListing> allListings = new ArrayList<>();
    listingsByBroker.values().forEach(allListings::addAll);
    Mockito.when(listResult.all()).thenReturn(completedFuture(allListings));
    Mockito.when(listResult.allByBrokerId()).thenReturn(completedFuture(listingsByBroker));
}
Also used : ArrayList(java.util.ArrayList) ListTransactionsResult(org.apache.kafka.clients.admin.ListTransactionsResult) TransactionListing(org.apache.kafka.clients.admin.TransactionListing)

Aggregations

ArrayList (java.util.ArrayList)1 ListTransactionsResult (org.apache.kafka.clients.admin.ListTransactionsResult)1 TransactionListing (org.apache.kafka.clients.admin.TransactionListing)1