Modify unittest for ExpectCallNotifyOnConsumerByAcceptIsTrue.
authorjaesick.shin <jaesick.shin@samsung.com>
Mon, 22 Aug 2016 03:45:10 +0000 (12:45 +0900)
committerMadan Lanka <lanka.madan@samsung.com>
Mon, 22 Aug 2016 09:07:46 +0000 (09:07 +0000)
this unittest is sometimes success or fail.

Change-Id: I5db819e90919c9db1281b0853c44214cbf58cc43
Signed-off-by: jaesick.shin <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10701
Reviewed-by: Chihyun Cho <ch79.cho@samsung.com>
Reviewed-by: Hun-je Yeon <hunje.yeon@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
service/notification/unittest/NSProviderTest.cpp

index efb86b5..442739d 100755 (executable)
@@ -244,7 +244,6 @@ TEST_F(NotificationProviderTest, NeverCallNotifyOnConsumerByAcceptIsFalse)
     NSAcceptSubscription(g_consumer, true);
 }
 
-/* TODO coap+tcp case is ERROR, After, will be change code.
 TEST_F(NotificationProviderTest, ExpectCallNotifyOnConsumerByAcceptIsTrue)
 {
     int msgID;
@@ -252,16 +251,18 @@ TEST_F(NotificationProviderTest, ExpectCallNotifyOnConsumerByAcceptIsTrue)
     mocks.ExpectCallFunc(NSMessageCallbackFromConsumerEmpty).Do(
             [&msgID](const int &id, const std::string&, const std::string&, const std::string&)
             {
+                std::cout << "id : " << id << std::endl;
                 if (id == msgID)
                 {
                     std::cout << "ExpectCallNotifyOnConsumerByAcceptIsTrue" << std::endl;
                 }
+                responseCon.notify_all();
             });
 
     NSAcceptSubscription(g_consumer, true);
 
     NSMessage * msg = new NSMessage();
-    msgID = (int)msg->messageId;
+    msgID = 10;
     msg->title = strdup(std::string("Title").c_str());
     msg->contentText = strdup(std::string("ContentText").c_str());
     msg->sourceName = strdup(std::string("OCF").c_str());
@@ -269,7 +270,7 @@ TEST_F(NotificationProviderTest, ExpectCallNotifyOnConsumerByAcceptIsTrue)
 
     std::unique_lock< std::mutex > lock{ mutexForCondition };
     responseCon.wait(lock);
-}*/
+}
 
 TEST_F(NotificationProviderTest, ExpectCallbackSyncOnReadToConsumer)
 {