use of io.streamnative.pulsar.handlers.kop.KafkaProtocolHandler in project starlight-for-kafka by datastax.
the class GroupMetadataManagerTest method testOffsetTopicNumPartitionsModify.
@Test
public void testOffsetTopicNumPartitionsModify() {
int consumerGroupPartitionId = GroupMetadataManager.getPartitionId(groupId, conf.getOffsetsTopicNumPartitions());
conf.setOffsetsTopicNumPartitions(100);
KafkaProtocolHandler handler = (KafkaProtocolHandler) pulsar.getProtocolHandlers().protocol("kafka");
// remove here to trigger a new creating for GroupCoordinator
handler.getGroupCoordinators().remove(conf.getKafkaMetadataTenant());
GroupMetadataManager newMetaManager = handler.getGroupCoordinator(conf.getKafkaMetadataTenant()).getGroupManager();
int newPartitionsId = GroupMetadataManager.getPartitionId(groupId, newMetaManager.offsetConfig().offsetsTopicNumPartitions());
assertEquals(consumerGroupPartitionId, newPartitionsId);
}
use of io.streamnative.pulsar.handlers.kop.KafkaProtocolHandler in project starlight-for-kafka by datastax.
the class TransactionCoordinatorTest method initializeState.
@BeforeMethod
protected void initializeState() {
ProtocolHandler handler = pulsar.getProtocolHandlers().protocol("kafka");
KafkaProtocolHandler kafkaProtocolHandler = (KafkaProtocolHandler) handler;
OrderedScheduler scheduler = OrderedScheduler.newSchedulerBuilder().name("test-txn-coordinator-scheduler").numThreads(1).build();
initMockPidManager();
initTransactionManager();
initTransactionMarkerChannelManager();
transactionCoordinator = new TransactionCoordinator(TransactionConfig.builder().abortTimedOutTransactionsIntervalMs(DefaultAbortTimedOutTransactionsIntervalMs).build(), transactionMarkerChannelManager, scheduler, producerIdManager, transactionManager, time, METADATA_NAMESPACE_PREFIX, NAMESPACE_PREFIX);
result = null;
error = Errors.NONE;
capturedTxn = ArgumentCaptor.forClass(TransactionMetadata.class);
capturedErrorsCallback = ArgumentCaptor.forClass(TransactionStateManager.ResponseCallback.class);
capturedTxnTransitMetadata = ArgumentCaptor.forClass(TransactionMetadata.TxnTransitMetadata.class);
}
use of io.streamnative.pulsar.handlers.kop.KafkaProtocolHandler in project kop by streamnative.
the class GroupMetadataManagerTest method testOffsetTopicNumPartitionsModify.
@Test
public void testOffsetTopicNumPartitionsModify() {
int consumerGroupPartitionId = GroupMetadataManager.getPartitionId(groupId, conf.getOffsetsTopicNumPartitions());
conf.setOffsetsTopicNumPartitions(100);
KafkaProtocolHandler handler = (KafkaProtocolHandler) pulsar.getProtocolHandlers().protocol("kafka");
// remove here to trigger a new creating for GroupCoordinator
handler.getGroupCoordinators().remove(conf.getKafkaMetadataTenant());
GroupMetadataManager newMetaManager = handler.getGroupCoordinator(conf.getKafkaMetadataTenant()).getGroupManager();
int newPartitionsId = GroupMetadataManager.getPartitionId(groupId, newMetaManager.offsetConfig().offsetsTopicNumPartitions());
assertEquals(consumerGroupPartitionId, newPartitionsId);
}
use of io.streamnative.pulsar.handlers.kop.KafkaProtocolHandler in project kop by streamnative.
the class TransactionCoordinatorTest method initializeState.
@BeforeMethod
protected void initializeState() {
ProtocolHandler handler = pulsar.getProtocolHandlers().protocol("kafka");
KafkaProtocolHandler kafkaProtocolHandler = (KafkaProtocolHandler) handler;
OrderedScheduler scheduler = OrderedScheduler.newSchedulerBuilder().name("test-txn-coordinator-scheduler").numThreads(1).build();
initMockPidManager();
initTransactionManager();
initTransactionMarkerChannelManager();
transactionCoordinator = new TransactionCoordinator(TransactionConfig.builder().abortTimedOutTransactionsIntervalMs(DefaultAbortTimedOutTransactionsIntervalMs).build(), transactionMarkerChannelManager, scheduler, producerIdManager, transactionManager, time, METADATA_NAMESPACE_PREFIX, NAMESPACE_PREFIX);
result = null;
error = Errors.NONE;
capturedTxn = ArgumentCaptor.forClass(TransactionMetadata.class);
capturedErrorsCallback = ArgumentCaptor.forClass(TransactionStateManager.ResponseCallback.class);
capturedTxnTransitMetadata = ArgumentCaptor.forClass(TransactionMetadata.TxnTransitMetadata.class);
}
Aggregations