use of org.apache.kafka.common.metadata.ProducerIdsRecord in project kafka by apache.
the class MetadataNodeManagerTest method testProducerIdsRecord.
@Test
public void testProducerIdsRecord() {
// generate a producerId record
ProducerIdsRecord record1 = new ProducerIdsRecord().setBrokerId(0).setBrokerEpoch(1).setNextProducerId(10000);
metadataNodeManager.handleMessage(record1);
assertEquals("0", metadataNodeManager.getData().root().directory("producerIds").file("lastBlockBrokerId").contents());
assertEquals("1", metadataNodeManager.getData().root().directory("producerIds").file("lastBlockBrokerEpoch").contents());
assertEquals(10000 + "", metadataNodeManager.getData().root().directory("producerIds").file("nextBlockStartId").contents());
// generate another producerId record
ProducerIdsRecord record2 = new ProducerIdsRecord().setBrokerId(1).setBrokerEpoch(2).setNextProducerId(11000);
metadataNodeManager.handleMessage(record2);
assertEquals("1", metadataNodeManager.getData().root().directory("producerIds").file("lastBlockBrokerId").contents());
assertEquals("2", metadataNodeManager.getData().root().directory("producerIds").file("lastBlockBrokerEpoch").contents());
assertEquals(11000 + "", metadataNodeManager.getData().root().directory("producerIds").file("nextBlockStartId").contents());
}
Aggregations