ivankelly commented on a change in pull request #1996: Cpp client: add 
multiTopicsConsumer
URL: https://github.com/apache/incubator-pulsar/pull/1996#discussion_r197732611
 
 

 ##########
 File path: pulsar-client-cpp/tests/BasicEndToEndTest.cc
 ##########
 @@ -1397,3 +1397,172 @@ TEST(BasicEndToEndTest, testSeek) {
     ASSERT_EQ(ResultOk, producer.close());
     ASSERT_EQ(ResultOk, client.close());
 }
+
+TEST(BasicEndToEndTest, testMultiTopicsConsumerTopicNameInvalid) {
+    Client client(lookupUrl);
+    std::vector<std::string> topicNames;
+    topicNames.reserve(3);
+    std::string subName = "testMultiTopicsTopicNameInvalid";
+    // cluster empty
+    std::string topicName1 = 
"persistent://prop/testMultiTopicsTopicNameInvalid";
+
+    // empty topics
+    ASSERT_EQ(0, topicNames.size());
+    ConsumerConfiguration consConfig;
+    consConfig.setConsumerType(ConsumerShared);
+    Consumer consumer;
+    Promise<Result, Consumer> consumerPromise;
+    client.subscribeAsync(topicNames, subName, consConfig, 
WaitForCallbackValue<Consumer>(consumerPromise));
+    Future<Result, Consumer> consumerFuture = consumerPromise.getFuture();
+    Result result = consumerFuture.get(consumer);
+    ASSERT_EQ(ResultOk, result);
+    LOG_INFO("subscribe on empty topics");
+    consumer.close();
+
+    // Invalid topic names
+    Consumer consumer1;
+    std::string subName1 = "testMultiTopicsTopicNameInvalid";
+    topicNames.push_back(topicName1);
+    Promise<Result, Consumer> consumerPromise1;
+    client.subscribeAsync(topicNames, subName1, consConfig, 
WaitForCallbackValue<Consumer>(consumerPromise1));
+    Future<Result, Consumer> consumerFuture1 = consumerPromise1.getFuture();
+    result = consumerFuture1.get(consumer1);
+    ASSERT_EQ(ResultInvalidTopicName, result);
+    LOG_INFO("subscribe on TopicName1 failed");
+    consumer1.close();
+
+    client.shutdown();
+}
+
+TEST(BasicEndToEndTest, testMultiTopicsConsumerDifferentNamespace) {
+    Client client(lookupUrl);
+    std::vector<std::string> topicNames;
+    topicNames.reserve(3);
+    std::string subName = "testMultiTopicsDifferentNamespace";
+    std::string topicName1 = 
"persistent://prop/unit/ns1/testMultiTopicsConsumerDifferentNamespace1";
+    std::string topicName2 = 
"persistent://prop/unit/ns2/testMultiTopicsConsumerDifferentNamespace2";
+    std::string topicName3 = 
"persistent://prop/unit/ns3/testMultiTopicsConsumerDifferentNamespace3";
+
+    topicNames.push_back(topicName1);
+    topicNames.push_back(topicName2);
+    topicNames.push_back(topicName3);
+
+    // call admin api to make topics partitioned
+    std::string url1 =
+        adminUrl + 
"admin/persistent/prop/unit/ns1/testMultiTopicsConsumerDifferentNamespace1/partitions";
+    std::string url2 =
+        adminUrl + 
"admin/persistent/prop/unit/ns2/testMultiTopicsConsumerDifferentNamespace2/partitions";
+    std::string url3 =
+        adminUrl + 
"admin/persistent/prop/unit/ns3/testMultiTopicsConsumerDifferentNamespace3/partitions";
+
+    int res = makePutRequest(url1, "2");
 
 Review comment:
   In form these tests are verify similar to the integration tests (i.e. Pulsar 
is running somewhere else). They should be able to use the commandline for 
doing stuff like this. Not something for this patch, but something to think 
about.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to