Shekharrajak commented on code in PR #22357:
URL: https://github.com/apache/kafka/pull/22357#discussion_r3409726548


##########
core/src/test/java/kafka/server/share/SharePartitionManagerTest.java:
##########
@@ -3024,6 +3209,86 @@ public void testShareGroupListenerWithEmptyCache() {
         Mockito.verify(partitionCache, 
times(1)).topicIdPartitionsForGroup(groupId);
     }
 
+    @Test
+    public void testAcknowledgeTransactionalDelegatesToSharePartition() {
+        String groupId = "grp";
+        String memberId = Uuid.randomUuid().toString();
+        TopicIdPartition tp = new TopicIdPartition(Uuid.randomUuid(), new 
TopicPartition("foo", 0));
+        SharePartition sp = mock(SharePartition.class);
+        when(sp.stageTxnAcknowledge(ArgumentMatchers.eq(memberId), 
ArgumentMatchers.eq(100L), ArgumentMatchers.eq((short) 1), any()))
+            .thenReturn(CompletableFuture.completedFuture(null));
+
+        SharePartitionCache partitionCache = new SharePartitionCache();
+        partitionCache.put(new SharePartitionKey(groupId, tp), sp);
+        sharePartitionManager = SharePartitionManagerBuilder.builder()
+            
.withPartitionCache(partitionCache).withBrokerTopicStats(brokerTopicStats).build();
+
+        Map<TopicIdPartition, List<ShareAcknowledgementBatch>> ackTopics = 
Map.of(
+            tp, List.of(new ShareAcknowledgementBatch(10, 14, List.of((byte) 
1))));
+        Map<TopicIdPartition, ShareAcknowledgeResponseData.PartitionData> 
result =
+            sharePartitionManager.acknowledgeTransactional(memberId, groupId, 
100L, (short) 1, ackTopics).join();
+
+        assertEquals(Errors.NONE.code(), result.get(tp).errorCode());
+        Mockito.verify(sp).stageTxnAcknowledge(ArgumentMatchers.eq(memberId), 
ArgumentMatchers.eq(100L), ArgumentMatchers.eq((short) 1), any());
+    }
+
+    @Test
+    public void testApplyTxnMarkerBroadcastsToAllSharePartitions() {

Review Comment:
   manager broadcasts to all cached share partitions.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to