This is an automated email from the ASF dual-hosted git repository. mmerli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git
The following commit(s) were added to refs/heads/master by this push: new 3e04726 Support non persistent topics in C++ client (#1819) 3e04726 is described below commit 3e04726c0074839713d4bf6d93fb8953768530b4 Author: Matteo Merli <mme...@apache.org> AuthorDate: Mon May 21 23:02:32 2018 -0700 Support non persistent topics in C++ client (#1819) * Support non persistent topics in C++ client * Fixed end-to-end test with non-persistent topics --- pulsar-client-cpp/lib/TopicName.cc | 2 +- pulsar-client-cpp/tests/BasicEndToEndTest.cc | 4 ++-- pulsar-client-cpp/tests/TopicNameTest.cc | 10 ++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pulsar-client-cpp/lib/TopicName.cc b/pulsar-client-cpp/lib/TopicName.cc index 0ad1313..2258ba8 100644 --- a/pulsar-client-cpp/lib/TopicName.cc +++ b/pulsar-client-cpp/lib/TopicName.cc @@ -161,7 +161,7 @@ bool TopicName::operator==(const TopicName& other) { bool TopicName::validate() { // check domain matches to "persistent", in future check "memory" when server is ready - if (domain_.compare("persistent") != 0) { + if (domain_.compare("persistent") != 0 && domain_.compare("non-persistent") != 0) { return false; } // cluster_ can be empty diff --git a/pulsar-client-cpp/tests/BasicEndToEndTest.cc b/pulsar-client-cpp/tests/BasicEndToEndTest.cc index 56c1796..d4f6a0b 100644 --- a/pulsar-client-cpp/tests/BasicEndToEndTest.cc +++ b/pulsar-client-cpp/tests/BasicEndToEndTest.cc @@ -253,11 +253,11 @@ TEST(BasicEndToEndTest, testNonPersistentTopic) { Client client(lookupUrl); Producer producer; Result result = client.createProducer(topicName, producer); - ASSERT_EQ(ResultInvalidTopicName, result); + ASSERT_EQ(ResultOk, result); Consumer consumer; result = client.subscribe(topicName, "my-sub-name", consumer); - ASSERT_EQ(ResultInvalidTopicName, result); + ASSERT_EQ(ResultOk, result); } TEST(BasicEndToEndTest, testSingleClientMultipleSubscriptions) { diff --git a/pulsar-client-cpp/tests/TopicNameTest.cc b/pulsar-client-cpp/tests/TopicNameTest.cc index 5c9410a..30fcf3a 100644 --- a/pulsar-client-cpp/tests/TopicNameTest.cc +++ b/pulsar-client-cpp/tests/TopicNameTest.cc @@ -78,6 +78,16 @@ TEST(TopicNameTest, testTopicNameV2) { ASSERT_EQ(TopicName::getEncodedName("short-topic"), tn1->getLocalName()); } +TEST(TopicNameTest, testNonPersistentTopicNameV2) { + // v2 topic names doesn't have "cluster" + boost::shared_ptr<TopicName> tn1 = TopicName::get("non-persistent://tenant/namespace/short-topic"); + ASSERT_EQ("tenant", tn1->getProperty()); + ASSERT_EQ("", tn1->getCluster()); + ASSERT_EQ("namespace", tn1->getNamespacePortion()); + ASSERT_EQ("non-persistent", tn1->getDomain()); + ASSERT_EQ(TopicName::getEncodedName("short-topic"), tn1->getLocalName()); +} + TEST(TopicNameTest, testTopicNameWithSlashes) { // Compare getters and setters boost::shared_ptr<TopicName> topicName = -- To stop receiving notification emails like this one, please contact mme...@apache.org.