brandboat commented on code in PR #17914: URL: https://github.com/apache/kafka/pull/17914#discussion_r1858517849
########## core/src/test/scala/unit/kafka/server/GroupCoordinatorBaseRequestTest.scala: ########## @@ -194,6 +194,68 @@ class GroupCoordinatorBaseRequestTest(cluster: ClusterInstance) { assertEquals(expectedResponse, response.data) } + protected def commitTxnOffset( + groupId: String, + memberId: String, + generationId: Int, + producerId: Int, + producerEpoch: Short, + transactionalId: String, + topic: String, + partition: Int, + offset: Long, + expectedError: Errors, + version: Short = ApiKeys.TXN_OFFSET_COMMIT.latestVersion(isUnstableApiEnabled)): Unit = { + val request = new TxnOffsetCommitRequest.Builder( + new TxnOffsetCommitRequestData() + .setGroupId(groupId) + .setMemberId(memberId) + .setGenerationId(generationId) + .setProducerId(producerId) + .setProducerEpoch(producerEpoch) + .setTransactionalId(transactionalId) + .setTopics(List( + new TxnOffsetCommitRequestData.TxnOffsetCommitRequestTopic() + .setName(topic) + .setPartitions(List( + new TxnOffsetCommitRequestData.TxnOffsetCommitRequestPartition() + .setPartitionIndex(partition) + .setCommittedOffset(offset) + ).asJava) + ).asJava) + ).build(version) + + val expectedResponse = new TxnOffsetCommitResponseData() + .setTopics(List( + new TxnOffsetCommitResponseData.TxnOffsetCommitResponseTopic() + .setName(topic) + .setPartitions(List( + new TxnOffsetCommitResponseData.TxnOffsetCommitResponsePartition() + .setPartitionIndex(partition) + .setErrorCode(expectedError.code) + ).asJava) + ).asJava) + + val response = connectAndReceive[TxnOffsetCommitResponse](request) + assertEquals(expectedResponse, response.data) + } + + protected def addOffsetsToTxn(groupId: String, + producerId: Int, + producerEpoch: Short, + transactionalId: String, + version: Short): Unit = { Review Comment: Sorry, that comes from my auto format... I forgot to set the scala code style, thanks -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org