Search in sources :

Example 1 with TxnOffsetCommitResponseData

use of org.apache.kafka.common.message.TxnOffsetCommitResponseData in project kafka by apache.

the class TxnOffsetCommitResponseTest method testParse.

@Test
@Override
public void testParse() {
    TxnOffsetCommitResponseData data = new TxnOffsetCommitResponseData().setThrottleTimeMs(throttleTimeMs).setTopics(Arrays.asList(new TxnOffsetCommitResponseData.TxnOffsetCommitResponseTopic().setPartitions(Collections.singletonList(new TxnOffsetCommitResponseData.TxnOffsetCommitResponsePartition().setPartitionIndex(partitionOne).setErrorCode(errorOne.code()))), new TxnOffsetCommitResponseData.TxnOffsetCommitResponseTopic().setPartitions(Collections.singletonList(new TxnOffsetCommitResponseData.TxnOffsetCommitResponsePartition().setPartitionIndex(partitionTwo).setErrorCode(errorTwo.code())))));
    for (short version : ApiKeys.TXN_OFFSET_COMMIT.allVersions()) {
        TxnOffsetCommitResponse response = TxnOffsetCommitResponse.parse(MessageUtil.toByteBuffer(data, version), version);
        assertEquals(expectedErrorCounts, response.errorCounts());
        assertEquals(throttleTimeMs, response.throttleTimeMs());
        assertEquals(version >= 1, response.shouldClientThrottle(version));
    }
}
Also used : TxnOffsetCommitResponseData(org.apache.kafka.common.message.TxnOffsetCommitResponseData) Test(org.junit.jupiter.api.Test)

Aggregations

TxnOffsetCommitResponseData (org.apache.kafka.common.message.TxnOffsetCommitResponseData)1 Test (org.junit.jupiter.api.Test)1