use of org.apache.kafka.clients.admin.DescribeProducersOptions in project kafka by apache.
the class DescribeProducersHandlerTest method assertRetriableError.
private void assertRetriableError(TopicPartition topicPartition, Errors error) {
ApiResult<TopicPartition, PartitionProducerState> result = handleResponseWithError(new DescribeProducersOptions(), topicPartition, error);
assertEquals(emptyMap(), result.failedKeys);
assertEquals(emptyMap(), result.completedKeys);
assertEquals(emptyList(), result.unmappedKeys);
}
use of org.apache.kafka.clients.admin.DescribeProducersOptions in project kafka by apache.
the class TransactionsCommandTest method testDescribeProducersSpecificReplica.
@Test
public void testDescribeProducersSpecificReplica() throws Exception {
TopicPartition topicPartition = new TopicPartition("foo", 5);
int brokerId = 5;
String[] args = new String[] { "--bootstrap-server", "localhost:9092", "describe-producers", "--topic", topicPartition.topic(), "--partition", String.valueOf(topicPartition.partition()), "--broker-id", String.valueOf(brokerId) };
testDescribeProducers(topicPartition, args, new DescribeProducersOptions().brokerId(brokerId));
}
use of org.apache.kafka.clients.admin.DescribeProducersOptions in project kafka by apache.
the class TransactionsCommandTest method testDescribeProducersLeader.
@Test
public void testDescribeProducersLeader() throws Exception {
TopicPartition topicPartition = new TopicPartition("foo", 5);
String[] args = new String[] { "--bootstrap-server", "localhost:9092", "describe-producers", "--topic", topicPartition.topic(), "--partition", String.valueOf(topicPartition.partition()) };
testDescribeProducers(topicPartition, args, new DescribeProducersOptions());
}
use of org.apache.kafka.clients.admin.DescribeProducersOptions in project kafka by apache.
the class TransactionsCommandTest method testFindHangingLookupTopicPartitionsForTopic.
@Test
public void testFindHangingLookupTopicPartitionsForTopic() throws Exception {
String topic = "foo";
String[] args = new String[] { "--bootstrap-server", "localhost:9092", "find-hanging", "--topic", topic };
Node node0 = new Node(0, "localhost", 9092);
Node node1 = new Node(1, "localhost", 9093);
Node node5 = new Node(5, "localhost", 9097);
TopicPartitionInfo partition0 = new TopicPartitionInfo(0, node0, Arrays.asList(node0, node1), Arrays.asList(node0, node1));
TopicPartitionInfo partition1 = new TopicPartitionInfo(1, node1, Arrays.asList(node1, node5), Arrays.asList(node1, node5));
TopicDescription description = new TopicDescription(topic, false, Arrays.asList(partition0, partition1));
expectDescribeTopics(singletonMap(topic, description));
DescribeProducersResult result = Mockito.mock(DescribeProducersResult.class);
Mockito.when(result.all()).thenReturn(completedFuture(emptyMap()));
Mockito.when(admin.describeProducers(Arrays.asList(new TopicPartition(topic, 0), new TopicPartition(topic, 1)), new DescribeProducersOptions())).thenReturn(result);
execute(args);
assertNormalExit();
assertNoHangingTransactions();
}
Aggregations