mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2025-11-01 19:18:04 +00:00
Rename TopicMetadata::get_topic to TopicMetadata::get_name
This commit is contained in:
@@ -91,7 +91,7 @@ public:
|
||||
/**
|
||||
* Gets the topic name
|
||||
*/
|
||||
const std::string& get_topic() const;
|
||||
const std::string& get_name() const;
|
||||
|
||||
/**
|
||||
* Gets the topic error
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
*/
|
||||
const std::vector<PartitionMetadata>& get_partitions() const;
|
||||
private:
|
||||
std::string topic_;
|
||||
std::string name_;
|
||||
rd_kafka_resp_err_t error_;
|
||||
std::vector<PartitionMetadata> partitions_;
|
||||
};
|
||||
|
||||
@@ -71,14 +71,14 @@ const vector<int32_t>& PartitionMetadata::get_in_sync_replica_brokers() const {
|
||||
// TopicMetadata
|
||||
|
||||
TopicMetadata::TopicMetadata(const rd_kafka_metadata_topic& topic)
|
||||
: topic_(topic.topic), error_(topic.err) {
|
||||
: name_(topic.topic), error_(topic.err) {
|
||||
for (int i = 0; i < topic.partition_cnt; ++i) {
|
||||
partitions_.emplace_back(topic.partitions[i]);
|
||||
}
|
||||
}
|
||||
|
||||
const string& TopicMetadata::get_topic() const {
|
||||
return topic_;
|
||||
const string& TopicMetadata::get_name() const {
|
||||
return name_;
|
||||
}
|
||||
|
||||
Error TopicMetadata::get_error() const {
|
||||
|
||||
@@ -70,7 +70,7 @@ TEST_F(KafkaHandleBaseTest, TopicsMetadata) {
|
||||
ASSERT_GE(topics.size(), 2);
|
||||
|
||||
for (const auto& topic : topics) {
|
||||
if (topic_names.count(topic.get_topic()) == 1) {
|
||||
if (topic_names.count(topic.get_name()) == 1) {
|
||||
const vector<PartitionMetadata>& partitions = topic.get_partitions();
|
||||
EXPECT_EQ(3, partitions.size());
|
||||
set<int32_t> expected_ids = { 0, 1, 2 };
|
||||
@@ -95,5 +95,5 @@ TEST_F(KafkaHandleBaseTest, TopicsMetadata) {
|
||||
|
||||
// Now get the whole metadata only for this topic
|
||||
Topic topic = producer.get_topic(KAFKA_TOPIC);
|
||||
EXPECT_EQ(KAFKA_TOPIC, producer.get_metadata(topic).get_topic());
|
||||
EXPECT_EQ(KAFKA_TOPIC, producer.get_metadata(topic).get_name());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user