You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/05/22 06:02:34 UTC

[GitHub] merlimat closed pull request #1819: Support non persistent topics in C++ client

merlimat closed pull request #1819: Support non persistent topics in C++ client
URL: https://github.com/apache/incubator-pulsar/pull/1819
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pulsar-client-cpp/lib/TopicName.cc b/pulsar-client-cpp/lib/TopicName.cc
index 0ad131396b..2258ba80d7 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 56c1796835..d4f6a0b058 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 5c9410a303..30fcf3a041 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 =


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services