Merge test folder of test branch
[iotivity.git] / test / src / tc / ri / gtest / cpp / src / stc / RICppIntegrationTest.cpp
1 /******************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  *
20  ******************************************************************/
21
22 #include "RIHelper.h"
23
24 #define KEY_PLATFORM_ID "pi"
25 #define KEY_MANUFACTURER_NAME "mnmn"
26 #define KEY_MANUFACTURER_URL "mnml"
27 #define KEY_MODEL_NO "mnmo"
28 #define KEY_MANUFACTURE_DATE "mndt"
29 #define KEY_PLATFORM_VERSION "mnpv"
30 #define KEY_OS_VERSION "mnos"
31 #define KEY_HW_VERSION "mnhw"
32 #define KEY_FIRMWARE_VERSION "mnfv"
33 #define KEY_SUPPORT_URL "mnsl"
34 #define KEY_SYSTEM_TIME "st"
35
36 class RICppIntegrationTest_stc: public ::testing::Test
37 {
38 protected:
39     RIHelper *m_RIHelper;
40     const std::string m_DeviceDiscoveryURI = "/oic/d";
41     const std::string m_PlatformDiscoveryURI = "/oic/p";
42     const std::string m_ResourceInterface = DEFAULT_INTERFACE;
43     typedef std::map< OCResourceIdentifier, std::shared_ptr< OCResource > > m_discoveredResourceMap;
44     m_discoveredResourceMap m_discoveredResources;
45     std::shared_ptr< OCResource > m_temperatureResource;
46     std::mutex m_curResourceLock;
47     OCResourceHandle m_ResourceHandle;
48     const string m_TemperatureUri = TEMPERATURE_URI;
49     const string m_TemperatureType = TEMPERATURE_TYPE;
50     OCResourceHandle m_temperatureHandle;bool m_foundResourceCheck = false;bool m_deviceDiscoveryCheck =
51             false;bool m_PlatformDiscoveryCheck = false;bool m_foundAllPlatformInfo = true;bool m_foundAllDeviceInfo =
52             true;bool isGetCorrect = false;bool isPutCorrect = false;bool isPostCorrect = false;bool isDeleteCorrect =
53             false;bool isObserveCorrect = false;
54     int m_temp = 20;
55     int m_hour = 20;
56     std::string m_temperatureResourceQuery = "/oic/res?rt=";
57
58     virtual void SetUp()
59     {
60
61         m_temperatureResourceQuery += std::string(TEMPERATURE_TYPE);
62         CommonTestUtil::runCommonTCSetUpPart();
63         m_RIHelper = RIHelper::getInstance();
64         m_foundAllDeviceInfo = true;
65         m_foundAllPlatformInfo = true;
66     }
67
68     virtual void TearDown()
69     {
70         CommonTestUtil::runCommonTCTearDownPart();
71     }
72
73 public:
74     void onDeviceInfoReceived(const OCRepresentation& rep)
75     {
76         m_deviceDiscoveryCheck = true;
77         IOTIVITYTEST_LOG(INFO, "Device Information received----->");
78         std::string value;
79         std::string values[] =
80         { "di", "Device ID        ", "n", "Device name      ", "lcv", "Spec version url ", "dmv",
81                 "Data Model Version ", };
82
83         if (!m_foundAllDeviceInfo){
84             for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
85             {
86                 if (rep.getValue(values[i], value))
87                 {
88                     if (values[i] == "n")
89                     {
90                         if (value != DEVICE_NAME)
91                         {
92                             m_foundAllDeviceInfo = false;
93                         }
94                     }
95                     IOTIVITYTEST_LOG(INFO, "%s : %s", values[i + 1].c_str(), value.c_str());
96                 }
97             }
98         }
99     }
100
101     void onPlatformInfoReceived(const OCRepresentation& rep)
102     {
103         m_PlatformDiscoveryCheck = true;
104         IOTIVITYTEST_LOG(INFO, "Platform Information received ---->");
105         std::string value;
106         std::string values[] =
107         { "pi", "Platform ID                    ", "mnmn", "Manufacturer name              ",
108                 "mnml", "Manufacturer url               ", "mnmo",
109                 "Manufacturer Model No          ", "mndt", "Manufactured Date              ",
110                 "mnpv", "Manufacturer Platform Version  ", "mnos",
111                 "Manufacturer OS version        ", "mnhw", "Manufacturer hardware version  ",
112                 "mnfv", "Manufacturer firmware version  ", "mnsl",
113                 "Manufacturer support url       ", "st", "Manufacturer system time       " };
114
115         for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
116         {
117             if (rep.getValue(values[i], value))
118             {
119                 IOTIVITYTEST_LOG(INFO, "%s : %s", values[i + 1].c_str(), value.c_str());
120
121                 if ((values[i].compare(KEY_PLATFORM_ID)) == 0)
122                 {
123                     if (value != PLATFORM_ID)
124                     {
125                         m_foundAllPlatformInfo = false;
126                         IOTIVITYTEST_LOG(INFO, "%s did not match", values[i].c_str());
127                     }
128                 }
129                 else if ((values[i].compare(KEY_MANUFACTURER_NAME)) == 0)
130                 {
131                     if (value != MANUFACTURER_NAME)
132                     {
133                         m_foundAllPlatformInfo = false;
134                         IOTIVITYTEST_LOG(INFO, "%s did not match", values[i].c_str());
135                     }
136                 }
137                 else if ((values[i].compare(KEY_MANUFACTURER_URL)) == 0)
138                 {
139                     if (value != MANUFACTURER_URL)
140                     {
141                         m_foundAllPlatformInfo = false;
142                         IOTIVITYTEST_LOG(INFO, "%s did not match", values[i].c_str());
143                     }
144                 }
145                 else if ((values[i].compare(KEY_MODEL_NO)) == 0)
146                 {
147                     if (value != MODEL_NO)
148                     {
149                         m_foundAllPlatformInfo = false;
150                         IOTIVITYTEST_LOG(INFO, "%s did not match", values[i].c_str());
151                     }
152                 }
153                 else if ((values[i].compare(KEY_MANUFACTURE_DATE)) == 0)
154                 {
155                     if (value != MANUFACTURE_DATE)
156                     {
157                         m_foundAllPlatformInfo = false;
158                         IOTIVITYTEST_LOG(INFO, "%s did not match", values[i].c_str());
159                     }
160                 }
161                 else if ((values[i].compare(KEY_PLATFORM_VERSION)) == 0)
162                 {
163                     if (value != PLATFORM_VERSION)
164                     {
165                         m_foundAllPlatformInfo = false;
166                         IOTIVITYTEST_LOG(INFO, "%s did not match", values[i].c_str());
167                     }
168                 }
169                 else if ((values[i].compare(KEY_OS_VERSION)) == 0)
170                 {
171                     if (value != OS_VERSION)
172                     {
173                         m_foundAllPlatformInfo = false;
174                         IOTIVITYTEST_LOG(INFO, "%s did not match", values[i].c_str());
175                     }
176                 }
177                 else if ((values[i].compare(KEY_HW_VERSION)) == 0)
178                 {
179                     if (value != HW_VERSION)
180                     {
181                         m_foundAllPlatformInfo = false;
182                         IOTIVITYTEST_LOG(INFO, "%s did not match", values[i].c_str());
183                     }
184                 }
185                 else if ((values[i].compare(KEY_FIRMWARE_VERSION)) == 0)
186                 {
187                     if (value != FIRMWARE_VERSION)
188                     {
189                         m_foundAllPlatformInfo = false;
190                         IOTIVITYTEST_LOG(INFO, "%s did not match", values[i].c_str());
191                     }
192                 }
193                 else if ((values[i].compare(KEY_SUPPORT_URL)) == 0)
194                 {
195                     if (value != SUPPORT_URL)
196                     {
197                         m_foundAllPlatformInfo = false;
198                         IOTIVITYTEST_LOG(INFO, "%s did not match", values[i].c_str());
199                     }
200                 }
201                 else if ((values[i].compare(KEY_SYSTEM_TIME)) == 0)
202                 {
203                     if (value != SYSTEM_TIME)
204                     {
205                         m_foundAllPlatformInfo = false;
206                         IOTIVITYTEST_LOG(INFO, "%s did not match", values[i].c_str());
207                     }
208                 }
209             }
210         }
211     }
212
213     void foundResource(std::shared_ptr< OCResource > resource)
214     {
215         IOTIVITYTEST_LOG(INFO, "In foundResource");
216         std::string resourceURI;
217         std::string hostAddress;
218
219         try
220         {
221             m_foundResourceCheck = true;
222             std::lock_guard< std::mutex > lock(m_curResourceLock);
223
224             // Do some operations with resource object.
225             if (resource)
226             {
227                 IOTIVITYTEST_LOG(INFO, "DISCOVERED Resource:");
228                 // Get the resource URI
229                 resourceURI = resource->uri();
230                 IOTIVITYTEST_LOG(INFO, "\ttURI of the resource: %s", resourceURI.c_str());
231
232                 // Get the resource host address
233                 hostAddress = resource->host();
234                 IOTIVITYTEST_LOG(INFO, "\tHost address of the resource: %s", hostAddress.c_str());
235
236                 // Get the resource types
237                 IOTIVITYTEST_LOG(INFO, "\tList of resource types:");
238                 for (std::string resourceTypes : resource->getResourceTypes())
239                 {
240                     IOTIVITYTEST_LOG(INFO, "\t\t\t%s", resourceTypes.c_str());
241                     if (resourceTypes == m_TemperatureType && resourceURI == TEMPERATURE_URI)
242                     {
243                         IOTIVITYTEST_LOG(INFO, "Found temperature resource");
244                         m_temperatureResource = resource;
245                     }
246                 }
247             }
248             else
249             {
250                 // Resource is invalid
251                 IOTIVITYTEST_LOG(INFO, "Resource is invalid");
252             }
253         }
254         catch (std::exception& e)
255         {
256             IOTIVITYTEST_LOG(DEBUG, "Exception in foundResource: %s", e.what());
257         }
258     }
259
260     void onGet(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep, const int eCode)
261     {
262         try
263         {
264             if (eCode == OC_STACK_OK)
265             {
266                 int temperature;
267                 int hour;
268                 IOTIVITYTEST_LOG(INFO, "GET request was successful");
269                 rep.getValue("temperature", temperature);
270                 rep.getValue("hour", hour);
271
272                 IOTIVITYTEST_LOG(INFO, "\thour: %d", hour);
273                 IOTIVITYTEST_LOG(INFO, "\ttemperature: %d", temperature);
274
275                 if (temperature == m_RIHelper->m_temp && hour == m_RIHelper->m_hour)
276                 {
277                     isGetCorrect = true;
278                 }
279             }
280             else
281             {
282                 IOTIVITYTEST_LOG(INFO, "onGet Response error: %d", eCode);
283             }
284         }
285         catch (std::exception& e)
286         {
287             IOTIVITYTEST_LOG(INFO, "Exception in onGet: %s", eCode);
288         }
289     }
290
291     void onPut(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep, const int eCode)
292     {
293         try
294         {
295             if (eCode == OC_STACK_OK || eCode == OC_STACK_RESOURCE_CHANGED)
296             {
297                 int temperature;
298                 int hour;
299                 IOTIVITYTEST_LOG(INFO, "PUT request was successful");
300                 rep.getValue("temperature", temperature);
301                 rep.getValue("hour", hour);
302
303                 IOTIVITYTEST_LOG(INFO, "\thour: %d", hour);
304                 IOTIVITYTEST_LOG(INFO, "\ttemperature: %d", temperature);
305
306                 if (temperature == m_temp && hour == m_hour)
307                 {
308                     isPutCorrect = true;
309                 }
310             }
311             else
312             {
313                 IOTIVITYTEST_LOG(INFO, "onPut Response error: %d", eCode);
314             }
315         }
316         catch (std::exception& e)
317         {
318             IOTIVITYTEST_LOG(INFO, "Exception in onPut: %s", eCode);
319         }
320     }
321
322     void onPost(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep,
323             const int eCode)
324     {
325         try
326         {
327             if (eCode == OC_STACK_OK || eCode == OC_STACK_RESOURCE_CHANGED)
328             {
329                 int temperature;
330                 int hour;
331                 IOTIVITYTEST_LOG(INFO, "POST request was successful");
332                 rep.getValue("temperature", temperature);
333                 rep.getValue("hour", hour);
334
335                 IOTIVITYTEST_LOG(INFO, "\thour: %d", hour);
336                 IOTIVITYTEST_LOG(INFO, "\ttemperature: %d", temperature);
337
338                 if (temperature == m_temp && hour == m_hour)
339                 {
340                     isPostCorrect = true;
341                 }
342             }
343             else
344             {
345                 IOTIVITYTEST_LOG(INFO, "onPut Response error: %d", eCode);
346             }
347         }
348         catch (std::exception& e)
349         {
350             IOTIVITYTEST_LOG(INFO, "Exception in onPut: %s", eCode);
351         }
352     }
353
354     void onDelete(const HeaderOptions &headerOptions, const int eCode)
355     {
356         if (eCode == 0 || eCode == 2)
357         {
358             IOTIVITYTEST_LOG(INFO, "Delete request was successful");
359             isDeleteCorrect = true;
360         }
361         else
362         {
363             IOTIVITYTEST_LOG(INFO, "onDelete Response error: %d", eCode);
364         }
365     }
366 };
367
368 /**
369  * @since 2016-08-04
370  * @see void Configure (const PlatformConfig &config)
371  * @objective Test  registerResource() API and findResource() API positively to check
372  *      if registered resource is found and foundResource callback is called
373  * @target OCStackResult registerResource(OCResourceHandle& resourceHandle,
374  *                       std::string& resourceURI,
375  *                       const std::string& resourceTypeName,
376  *                       const std::string& resourceInterface,
377  *                       EntityHandler entityHandler,
378  *                       uint8_t resourceProperty)
379  * @target OCStackResult findResource(const std::string& host, const std::string& resourceURI,
380  *                   OCConnectivityType connectivityType, FindCallback resourceHandler)
381  * @test_data     1. OCResourceHandle pointer to the created resource
382  *                2. resourceURI "/a/temperature"
383  *                3. resourceTypeName "oic.r.temperature"
384  *                4. resourceInterface DEFAULT_INTERFACE
385  *                5. EntityHandler callback to be called
386  *                6. resourceProperty indicates the property of the resource
387  *                7. host Host IP Address of the resource
388  *                8. resourceURI OC_RSRVD_WELL_KNOWN_URI
389  *                9. OCConnectivityType CT_DEFAULT
390  *                10. FindCallback callback to be called when found resource
391  * @pre_condition Configure platform for client server mode
392  * @procedure     1. Perform registerResource() API
393  *                2. Perform findResource() API
394  *                3. Check if callback is called
395  *                4. Check if temperature resource is found
396  * @post_condition None
397  * @expected Resource should be found successfully and callback should be called
398  */
399 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
400 TEST_F(RICppIntegrationTest_stc, CreateAndFindResource_SQV_CV_P)
401 {
402     try
403     {
404         m_temperatureHandle = m_RIHelper->registerResource(m_TemperatureUri, m_TemperatureType,
405                 m_ResourceInterface);
406         ASSERT_NE(m_temperatureHandle,(OCResourceHandle)NULL) << "Register Resource failed";
407
408         std::ostringstream requestURI;
409         requestURI << OC_RSRVD_WELL_KNOWN_URI;
410         IOTIVITYTEST_LOG(INFO, "Finding Resource...");
411         ASSERT_EQ(OC_STACK_OK,
412                 OCPlatform::findResource("", requestURI.str(), CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1), QualityOfService::HighQos))
413         << "findResource does not return success";
414         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
415         if(!m_foundResourceCheck)
416         {
417             SET_FAILURE("onFoundResource Callback is not Invoked!");
418             return;
419         }
420         if(m_temperatureResource == nullptr)
421         {
422             SET_FAILURE("Temperature resource was not found");
423         }
424     }
425     catch (exception &e)
426     {
427         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
428     }
429 }
430 #endif
431
432 /**
433  * @since 2016-08-04
434  * @see void Configure (const PlatformConfig &config)
435  * @objective Test  registerResource() API and findResource() API (with resource type) positively to check
436  *      if foundResource callback is called
437  * @target OCStackResult registerResource(OCResourceHandle& resourceHandle,
438  *                       std::string& resourceURI,
439  *                       const std::string& resourceTypeName,
440  *                       const std::string& resourceInterface,
441  *                       EntityHandler entityHandler,
442  *                       uint8_t resourceProperty)
443  * @target OCStackResult findResource(const std::string& host, const std::string& resourceURI,
444  *                   OCConnectivityType connectivityType, FindCallback resourceHandler)
445  * @test_data     1. OCResourceHandle pointer to the created resource
446  *                2. resourceURI "/a/temperature"
447  *                3. resourceTypeName "oic.r.temperature"
448  *                4. resourceInterface DEFAULT_INTERFACE
449  *                5. EntityHandler callback to be called
450  *                6. resourceProperty indicates the property of the resource
451  *                7. host Host IP Address of the resource
452  *                8. resourceURI "/oic/res/?rt=oic.r.temperature"
453  *                9. OCConnectivityType CT_DEFAULT
454  *                10. FindCallback callback to be called when found resource
455  * @pre_condition Configure platform for client server mode
456  * @procedure     1. Perform registerResource() API
457  *                2. Perform findResource() API with resource type in query
458  *                3. Check if callback is called
459  *                4. Check if temperature resource is found
460  * @post_condition None
461  * @expected Resource should be found successfully and callback should be called
462  */
463 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
464 TEST_F(RICppIntegrationTest_stc, CreateAndFindResourceUsingResourceType_SQV_CV_P)
465 {
466     try
467     {
468         m_temperatureHandle = m_RIHelper->registerResource(m_TemperatureUri, m_TemperatureType,
469                 m_ResourceInterface);
470         ASSERT_NE(m_temperatureHandle,(OCResourceHandle)NULL) << "Register Resource failed";
471
472         IOTIVITYTEST_LOG(INFO, "Finding Temperature Resource...");
473         ASSERT_EQ(OC_STACK_OK,
474                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1)))
475         << "findResource does not return success";
476         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
477         if(!m_foundResourceCheck)
478         {
479             SET_FAILURE("onFoundResource Callback is not Invoked!");
480             return;
481         }
482         if(m_temperatureResource == nullptr)
483         {
484             SET_FAILURE("Temperature resource was not found");
485         }
486     }
487     catch (exception &e)
488     {
489         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
490     }
491 }
492 #endif
493
494 /**
495  * @since 2016-08-04
496  * @see void Configure (const PlatformConfig &config)
497  * @objective Test  registerResource() API and findResource() API (with resource type) for two times to check
498  *      if foundResource callback is called
499  * @target OCStackResult registerResource(OCResourceHandle& resourceHandle,
500  *                       std::string& resourceURI,
501  *                       const std::string& resourceTypeName,
502  *                       const std::string& resourceInterface,
503  *                       EntityHandler entityHandler,
504  *                       uint8_t resourceProperty)
505  * @target OCStackResult findResource(const std::string& host, const std::string& resourceURI,
506  *                   OCConnectivityType connectivityType, FindCallback resourceHandler)
507  * @test_data     1. OCResourceHandle pointer to the created resource
508  *                2. resourceURI "/a/temperature"
509  *                3. resourceTypeName "oic.r.temperature"
510  *                4. resourceInterface DEFAULT_INTERFACE
511  *                5. EntityHandler callback to be called
512  *                6. resourceProperty indicates the property of the resource
513  *                7. host Host IP Address of the resource
514  *                8. resourceURI "/oic/res/?rt=oic.r.temperature"
515  *                9. OCConnectivityType CT_DEFAULT
516  *                10. FindCallback callback to be called when found resource
517  * @pre_condition Configure platform for client server mode
518  * @procedure     1. Perform registerResource() API
519  *                2. Perform findResource() API with resource type in query
520  *                3. Check if callback is called
521  *                4. Check if temperature resource is found
522  *                5. Perform findResource() API again with resource type in query
523  *                6. Check if callback is called
524  *                7. Check if temperature resource is found
525  * @post_condition None
526  * @expected Resource should be found successfully and callback should be called for both times
527  */
528 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
529 TEST_F(RICppIntegrationTest_stc, CreateAndFindResourceTwice_VLCC_P)
530 {
531     try
532     {
533         m_temperatureHandle = m_RIHelper->registerResource(m_TemperatureUri, m_TemperatureType,
534                 m_ResourceInterface);
535         ASSERT_NE(m_temperatureHandle,(OCResourceHandle)NULL) << "Register Resource failed";
536
537         IOTIVITYTEST_LOG(INFO, "Finding Temperature Resource...");
538         ASSERT_EQ(OC_STACK_OK,
539                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1)))
540         << "findResource does not return success";
541         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
542         if(!m_foundResourceCheck)
543         {
544             SET_FAILURE("onFoundResource Callback is not Invoked at the first attempt!");
545             return;
546         }
547         if(m_temperatureResource == nullptr)
548         {
549             SET_FAILURE("Temperature resource was not found");
550             return;
551         }
552
553         m_foundResourceCheck = false;
554         m_temperatureResource = nullptr;
555
556         IOTIVITYTEST_LOG(INFO, "Finding Resource for second time...");
557         ASSERT_EQ(OC_STACK_OK,
558                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1)))
559         << "findResource does not return success";
560         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
561         if(!m_foundResourceCheck)
562         {
563             SET_FAILURE("onFoundResource Callback is not Invoked at the second attempt!");
564             return;
565         }
566         if(m_temperatureResource == nullptr)
567         {
568             SET_FAILURE("Temperature resource was not found");
569             return;
570         }
571     }
572     catch (exception &e)
573     {
574         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
575     }
576 }
577 #endif
578
579 /**
580  * @since 2016-08-04
581  * @see void Configure (const PlatformConfig &config)
582  * @objective Test  registerResource() API and findResource() API (with resource type and with QOS) to check
583  *      if foundResource callback is called
584  * @target OCStackResult registerResource(OCResourceHandle& resourceHandle,
585  *                       std::string& resourceURI,
586  *                       const std::string& resourceTypeName,
587  *                       const std::string& resourceInterface,
588  *                       EntityHandler entityHandler,
589  *                       uint8_t resourceProperty)
590  * @target OCStackResult findResource(const std::string& host, const std::string& resourceURI,
591  *                   OCConnectivityType connectivityType, FindCallback resourceHandler,QualityOfService QoS)
592  * @test_data     1. OCResourceHandle pointer to the created resource
593  *                2. resourceURI "/a/temperature"
594  *                3. resourceTypeName "oic.r.temperature"
595  *                4. resourceInterface DEFAULT_INTERFACE
596  *                5. EntityHandler callback to be called
597  *                6. resourceProperty indicates the property of the resource
598  *                7. host Host IP Address of the resource
599  *                8. resourceURI "/oic/res/?rt=oic.r.temperature"
600  *                9. OCConnectivityType CT_DEFAULT
601  *                10. FindCallback callback to be called when found resource
602  *                11. QualityOfService HighQos
603  * @pre_condition Configure platform for client server mode
604  * @procedure     1. Perform registerResource() API
605  *                2. Perform findResource() API with resource type in query and QOS
606  *                3. Check if callback is called
607  *                4. Check if temperature resource is found
608  * @post_condition None
609  * @expected Resource should be found successfully and callback should be called
610  */
611 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
612 TEST_F(RICppIntegrationTest_stc, CreateAndFindResourceWithQos_SQV_CV_P)
613 {
614     try
615     {
616         m_temperatureHandle = m_RIHelper->registerResource(m_TemperatureUri, m_TemperatureType,
617                 m_ResourceInterface);
618         ASSERT_NE(m_temperatureHandle,(OCResourceHandle)NULL) << "Register Resource failed";
619
620         IOTIVITYTEST_LOG(INFO, "Finding Temperature Resource...");
621
622         ASSERT_EQ(OC_STACK_OK,
623                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1), QualityOfService::HighQos))
624         << "findResource does not return success";
625         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
626         if(!m_foundResourceCheck)
627         {
628             SET_FAILURE("onFoundResource Callback is not Invoked!");
629             return;
630         }
631         if(m_temperatureResource == nullptr)
632         {
633             SET_FAILURE("Temperature resource was not found");
634         }
635     }
636     catch (exception &e)
637     {
638         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
639     }
640 }
641 #endif
642
643 /**
644  * @since 2016-08-04
645  * @see void Configure (const PlatformConfig &config)
646  * @objective Test  registerResource() API and findResource() API (with resource type and QOS) for two times to check
647  *      if foundResource callback is called
648  * @target OCStackResult registerResource(OCResourceHandle& resourceHandle,
649  *                       std::string& resourceURI,
650  *                       const std::string& resourceTypeName,
651  *                       const std::string& resourceInterface,
652  *                       EntityHandler entityHandler,
653  *                       uint8_t resourceProperty)
654  * @target OCStackResult findResource(const std::string& host, const std::string& resourceURI,
655  *                   OCConnectivityType connectivityType, FindCallback resourceHandler,QualityOfService QoS)
656  * @test_data     1. OCResourceHandle pointer to the created resource
657  *                2. resourceURI "/a/temperature"
658  *                3. resourceTypeName "oic.r.temperature"
659  *                4. resourceInterface DEFAULT_INTERFACE
660  *                5. EntityHandler callback to be called
661  *                6. resourceProperty indicates the property of the resource
662  *                7. host Host IP Address of the resource
663  *                8. resourceURI "/oic/res/?rt=oic.r.temperature"
664  *                9. OCConnectivityType CT_DEFAULT
665  *                10. FindCallback callback to be called when found resource
666  *                11. QualityOfService HighQos
667  * @pre_condition Configure platform for client server mode
668  * @procedure     1. Perform registerResource() API
669  *                2. Perform findResource() API with resource type in query and QOS
670  *                3. Check if callback is called
671  *                4. Check if temperature resource is found
672  *                5. Perform findResource() API again with resource type in query
673  *                6. Check if callback is called
674  *                7. Check if temperature resource is found
675  * @post_condition None
676  * @expected Resource should be found successfully and callback should be called for both times
677  */
678 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
679 TEST_F(RICppIntegrationTest_stc, CreateAndFindResourceWithQosTwice_VLCC_P)
680 {
681     try
682     {
683         m_temperatureHandle = m_RIHelper->registerResource(m_TemperatureUri, m_TemperatureType,
684                 m_ResourceInterface);
685         ASSERT_NE(m_temperatureHandle,(OCResourceHandle)NULL) << "Register Resource failed";
686
687         IOTIVITYTEST_LOG(INFO, "Finding Resource with Qos...");
688         ASSERT_EQ(OC_STACK_OK,
689                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1), QualityOfService::HighQos))
690         << "findResource does not return success";
691         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
692         if(!m_foundResourceCheck)
693         {
694             SET_FAILURE("onFoundResource Callback is not Invoked!");
695             return;
696         }
697         if(m_temperatureResource == nullptr)
698         {
699             SET_FAILURE("Temperature resource was not found");
700             return;
701         }
702
703         IOTIVITYTEST_LOG(INFO, "Finding Resource with Qos for second time...");
704         ASSERT_EQ(OC_STACK_OK,
705                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1)))
706         << "findResource does not return success";
707         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
708         if(!m_foundResourceCheck)
709         {
710             SET_FAILURE("onFoundResource Callback is not Invoked!");
711             return;
712         }
713         if(m_temperatureResource == nullptr)
714         {
715             SET_FAILURE("Temperature resource was not found");
716         }
717
718     }
719     catch (exception &e)
720     {
721         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
722     }
723 }
724 #endif
725
726 /**
727  * @since 2016-08-04
728  * @see None
729  * @objective Test registerDeviceInfo() API and getDeviceInfo() API to check if
730  *      registered device information is get
731  * @target OCStackResult registerDeviceInfo(const OCDeviceInfo deviceInfo)
732  * @target OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
733  *                   OCConnectivityType connectivityType, FindDeviceCallback deviceInfoHandler)
734  * @test_data   1. OCDeviceInfo structure containing all the device specific information
735  *              2. host Host IP Address
736  *              3. deviceURI "/oic/d"
737  *              4. connectivityType CT_DEFAULT
738  *              5. FindDeviceCallback callback to be called
739  * @pre_condition Configure platform for client server mode
740  * @procedure   1. Perform registerDeviceInfo() API
741  *              2. Perform getDeviceInfo() API
742  *              3. Check if onDeviceInfoReceived callback is called
743  *              4. Check if registered information is received
744  * @post_condition None
745  * @expected Received device info should be matched with Set device info
746  */
747 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
748 TEST_F(RICppIntegrationTest_stc, RegisterAndGetDeviceInfo_GSRV_CV_P)
749 {
750     try
751     {
752         static OCDeviceInfo deviceInfo = m_RIHelper->getDeviceInfo();
753         ASSERT_EQ(OC_STACK_OK,OCPlatform::registerDeviceInfo(deviceInfo)) << "registerDeviceInfo does not return success";
754
755         std::ostringstream deviceDiscoveryRequest;
756         deviceDiscoveryRequest << OC_MULTICAST_PREFIX << m_DeviceDiscoveryURI;
757         IOTIVITYTEST_LOG(INFO, "Querying for device information...");
758         ASSERT_EQ(OC_STACK_OK,
759                 OCPlatform::getDeviceInfo("", deviceDiscoveryRequest.str(), CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::onDeviceInfoReceived, this, PH::_1)))
760         << "getDeviceInfo does not return success";
761         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
762         if(!m_deviceDiscoveryCheck)
763         {
764             SET_FAILURE("onDeviceInfoReceived Callback is not Invoked!");
765             return;
766         }
767         if(!m_foundAllDeviceInfo)
768         {
769             SET_FAILURE("All the set device info does not match with received info");
770         }
771     }
772     catch (exception &e)
773     {
774         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
775     }
776 }
777 #endif
778
779 /**
780  * @since 2016-08-04
781  * @see None
782  * @objective Test registerDeviceInfo() API and getDeviceInfo() API (with Qos) to check if
783  *      registered device information is get
784  * @target OCStackResult registerDeviceInfo(const OCDeviceInfo deviceInfo)
785  * @target OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
786  *                   OCConnectivityType connectivityType, FindDeviceCallback deviceInfoHandler,
787  *                   QualityOfService QoS)
788  * @test_data   1. OCDeviceInfo structure containing all the device specific information
789  *              2. host Host IP Address
790  *              3. deviceURI "/oic/d"
791  *              4. connectivityType CT_DEFAULT
792  *              5. FindDeviceCallback callback to be called
793  *              6. QualityOfService HighQos
794  * @pre_condition Configure platform for client server mode
795  * @procedure   1. Perform registerDeviceInfo() API
796  *              2. Perform getDeviceInfo() API(with Qos)
797  *              3. Check if onDeviceInfoReceived callback is called
798  *              4. Check if registered information is received
799  * @post_condition None
800  * @expected Received device info should be matched with Set device info
801  */
802 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
803 TEST_F(RICppIntegrationTest_stc, RegisterAndGetDeviceInfoWithQos_GSRV_CV_P)
804 {
805     try
806     {
807         static OCDeviceInfo deviceInfo = m_RIHelper->getDeviceInfo();
808         ASSERT_EQ(OC_STACK_OK,OCPlatform::registerDeviceInfo(deviceInfo)) << "registerDeviceInfo does not return success";
809
810         std::ostringstream deviceDiscoveryRequest;
811         deviceDiscoveryRequest << OC_MULTICAST_PREFIX << m_DeviceDiscoveryURI;
812         IOTIVITYTEST_LOG(INFO, "Querying for device information...");
813         ASSERT_EQ(OC_STACK_OK,
814                 OCPlatform::getDeviceInfo("", deviceDiscoveryRequest.str(), CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::onDeviceInfoReceived, this, PH::_1),
815                         QualityOfService::HighQos)) << "getDeviceInfo does not return success";
816         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
817         if(!m_deviceDiscoveryCheck)
818         {
819             SET_FAILURE("onDeviceInfoReceived Callback is not Invoked!");
820             return;
821         }
822         if(!m_foundAllDeviceInfo)
823         {
824             SET_FAILURE("All the set device info does not match with received info");
825         }
826     }
827     catch (exception &e)
828     {
829         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
830     }
831 }
832 #endif
833
834 /**
835  * @since 2016-08-04
836  * @see None
837  * @objective Test registerPlatformInfo() API and getPlatformInfo() API to check if
838  *      registered platform information is get
839  * @target OCStackResult registerPlatformInfo(const OCPlatformInfo platformInfo)
840  * @target OCStackResult getPlatformInfo(const std::string& host, const std::string& platformURI,
841  *                   OCConnectivityType connectivityType, FindPlatformCallback platformInfoHandler)
842  * @test_data   1. OCPlatformInfo structure containing all the platform specific information
843  *              2. host Host IP Address
844  *              3. platformURI "/oic/p"
845  *              4. connectivityType CT_DEFAULT
846  *              5. FindPlatformCallback callback to be called
847  * @pre_condition Configure platform for client server mode
848  * @procedure   1. Perform registerPlatformInfo() API
849  *              2. Perform getPlatformInfo() API
850  *              3. Check if onPlatformInfoReceived callback is called
851  *              4. Check if registered information is received
852  * @post_condition None
853  * @expected Received platform info should be matched with Set platform info
854  */
855 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
856 TEST_F(RICppIntegrationTest_stc, RegisterAndGetPlatformInfo_GSRV_CV_P)
857 {
858     try
859     {
860         ASSERT_EQ(OC_STACK_OK, OCPlatform::registerPlatformInfo(m_RIHelper->getPlatformInfo())) << "Platform Info is not registered";
861
862         std::ostringstream platformDiscoveryRequest;
863         platformDiscoveryRequest << OC_MULTICAST_PREFIX << m_PlatformDiscoveryURI;
864
865         IOTIVITYTEST_LOG(INFO, "Querying for platform information...");
866         ASSERT_EQ(OC_STACK_OK,
867                 OCPlatform::getPlatformInfo("", platformDiscoveryRequest.str(), CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::onPlatformInfoReceived, this, PH::_1)
868                         ,QualityOfService::HighQos)) << "getPlatformInfo does not return success";
869         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
870         if(!m_PlatformDiscoveryCheck)
871         {
872             SET_FAILURE("onPlatformInfoReceived Callback is not Invoked!");
873         }
874         if(!m_foundAllPlatformInfo)
875         {
876             SET_FAILURE("All the set platform informations is not received correctly");
877         }
878     }
879     catch (exception &e)
880     {
881         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
882     }
883 }
884 #endif
885
886 /**
887  * @since 2016-08-04
888  * @see None
889  * @objective Test registerPlatformInfo() API and getPlatformInfo() API(with Qos) to check if
890  *      registered platform information is get
891  * @target OCStackResult registerPlatformInfo(const OCPlatformInfo platformInfo)
892  * @target OCStackResult getPlatformInfo(const std::string& host, const std::string& platformURI,
893  *                   OCConnectivityType connectivityType, FindPlatformCallback platformInfoHandler,
894  *                   QualityOfService QoS)
895  * @test_data   1. OCPlatformInfo structure containing all the platform specific information
896  *              2. host Host IP Address
897  *              3. platformURI "/oic/p"
898  *              4. connectivityType CT_DEFAULT
899  *              5. FindPlatformCallback callback to be called
900  *              6. QualityOfService HighQos
901  * @pre_condition Configure platform for client server mode
902  * @procedure   1. Perform registerPlatformInfo() API(with Qos)
903  *              2. Perform getPlatformInfo() API
904  *              3. Check if onPlatformInfoReceived callback is called
905  *              4. Check if registered information is received
906  * @post_condition None
907  * @expected Received platform info should be matched with Set platform info
908  */
909 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
910 TEST_F(RICppIntegrationTest_stc, RegisterAndGetPlatformInfoWithQos_SQV_CV_P)
911 {
912     try
913     {
914         ASSERT_EQ(OC_STACK_OK, OCPlatform::registerPlatformInfo(m_RIHelper->getPlatformInfo())) << "Platform Info is not registered";
915
916         std::ostringstream platformDiscoveryRequest;
917         platformDiscoveryRequest << OC_MULTICAST_PREFIX << m_PlatformDiscoveryURI;
918
919         IOTIVITYTEST_LOG(INFO, "Querying for platform information...");
920         ASSERT_EQ(OC_STACK_OK,
921                 OCPlatform::getPlatformInfo("", platformDiscoveryRequest.str(), CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::onPlatformInfoReceived, this, PH::_1)
922                         ,QualityOfService::HighQos)) << "getPlatformInfo does not return success";
923         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
924         if(!m_PlatformDiscoveryCheck)
925         {
926             SET_FAILURE("onPlatformInfoReceived Callback is not Invoked!");
927         }
928         if(!m_foundAllPlatformInfo)
929         {
930             SET_FAILURE("All the set platform informations is not received correctly");
931         }
932     }
933     catch (exception &e)
934     {
935         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
936     }
937 }
938 #endif
939
940 /**
941  * @since 2016-08-04
942  * @see void Configure (const PlatformConfig &config)
943  * @see OCStackResult findResource(const std::string& host, const std::string& resourceURI,
944  *                   OCConnectivityType connectivityType, FindCallback resourceHandler)
945  * @objective Test registerResource() API and get() API positively to check
946  *      if get request is done successfully
947  * @target OCStackResult registerResource(OCResourceHandle& resourceHandle,
948  *                       std::string& resourceURI,
949  *                       const std::string& resourceTypeName,
950  *                       const std::string& resourceInterface,
951  *                       EntityHandler entityHandler,
952  *                       uint8_t resourceProperty)
953  * @target OCStackResult get(const QueryParamsMap& queryParametersMap, GetCallback attributeHandler)
954  * @test_data     1. OCResourceHandle pointer to the created resource
955  *                2. resourceURI "/a/temperature"
956  *                3. resourceTypeName "oic.r.temperature"
957  *                4. resourceInterface DEFAULT_INTERFACE
958  *                5. EntityHandler callback to be called
959  *                6. resourceProperty indicates the property of the resource
960  *                7. queryParametersMap map which can have the query parameter name and value
961  *                8. GetCallback callback to be called
962  * @pre_condition Configure platform for client server mode
963  * @procedure     1. Perform registerResource() API
964  *                2. Perform findResource() API with resource type in query
965  *                3. Check if callback is called
966  *                4. Check if temperature resource is found
967  *                5. Perform get() API on the found temperature resource
968  *                6. Check if server can get the get request and send response correctly
969  *                7. Check if client's onGet callback is called and resource attributes are found correctly in response
970  * @post_condition None
971  * @expected onGet callback is called and response is found correctly
972  */
973 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
974 TEST_F(RICppIntegrationTest_stc, CreateResourceAndSendGetRequest_SQV_CV_P)
975 {
976     try
977     {
978         m_temperatureHandle = m_RIHelper->registerResource(m_TemperatureUri, m_TemperatureType,
979                 m_ResourceInterface);
980         ASSERT_NE(m_temperatureHandle,(OCResourceHandle)NULL) << "Register Resource failed";
981
982         IOTIVITYTEST_LOG(INFO, "Finding Temperature Resource...");
983         ASSERT_EQ(OC_STACK_OK,
984                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1)))
985         << "findResource does not return success";
986         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
987         if(!m_foundResourceCheck)
988         {
989             SET_FAILURE("onFoundResource Callback is not Invoked!");
990         }
991         if(m_temperatureResource)
992         {
993             QueryParamsMap test;
994             ASSERT_EQ(OC_STACK_OK, m_temperatureResource->get(test, std::bind(&RICppIntegrationTest_stc::onGet, this, PH::_1, PH::_2, PH::_3)))
995             << "Get does not return success";
996             CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
997         }
998         else
999         {
1000             SET_FAILURE("Temperature resource was not found");
1001             return;
1002         }
1003         if(!m_RIHelper->isServerOk)
1004         {
1005             SET_FAILURE(m_RIHelper->getFailure());
1006             return;
1007         }
1008         if(!isGetCorrect)
1009         {
1010             SET_FAILURE("onGet Callback values are not correct");
1011         }
1012     }
1013     catch (exception &e)
1014     {
1015         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
1016     }
1017 }
1018 #endif
1019
1020 /**
1021  * @since 2016-08-04
1022  * @see void Configure (const PlatformConfig &config)
1023  * @see OCStackResult findResource(const std::string& host, const std::string& resourceURI,
1024  *                   OCConnectivityType connectivityType, FindCallback resourceHandler)
1025  * @objective Test registerResource() API and get() API (with Qos) positively to check
1026  *      if get request is done successfully
1027  * @target OCStackResult registerResource(OCResourceHandle& resourceHandle,
1028  *                       std::string& resourceURI,
1029  *                       const std::string& resourceTypeName,
1030  *                       const std::string& resourceInterface,
1031  *                       EntityHandler entityHandler,
1032  *                       uint8_t resourceProperty)
1033  * @target OCStackResult get(const QueryParamsMap& queryParametersMap, GetCallback attributeHandler)
1034  * @test_data     1. OCResourceHandle pointer to the created resource
1035  *                2. resourceURI "/a/temperature"
1036  *                3. resourceTypeName "oic.r.temperature"
1037  *                4. resourceInterface DEFAULT_INTERFACE
1038  *                5. EntityHandler callback to be called
1039  *                6. resourceProperty indicates the property of the resource
1040  *                7. queryParametersMap map which can have the query parameter name and value
1041  *                8. GetCallback callback to be called
1042  * @pre_condition Configure platform for client server mode
1043  * @procedure     1. Perform registerResource() API
1044  *                2. Perform findResource() API with resource type in query
1045  *                3. Check if callback is called
1046  *                4. Check if temperature resource is found
1047  *                5. Perform get() API(with Qos) on the found temperature resource
1048  *                6. Check if server can get the get request and send response correctly
1049  *                7. Check if client's onGet callback is called and resource attributes are found correctly in response
1050  * @post_condition None
1051  * @expected onGet callback is called and response is found correctly
1052  */
1053 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
1054 TEST_F(RICppIntegrationTest_stc, CreateResourceAndSendGetRequestWithQos_SQV_CV_P)
1055 {
1056     try
1057     {
1058         m_temperatureHandle = m_RIHelper->registerResource(m_TemperatureUri, m_TemperatureType,
1059                 m_ResourceInterface);
1060         ASSERT_NE(m_temperatureHandle,(OCResourceHandle)NULL) << "Register Resource failed";
1061
1062         IOTIVITYTEST_LOG(INFO, "Finding Temperature Resource...");
1063         ASSERT_EQ(OC_STACK_OK,
1064                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1)))
1065         << "findResource does not return success";
1066         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1067         if(!m_foundResourceCheck)
1068         {
1069             SET_FAILURE("onFoundResource Callback is not Invoked!");
1070         }
1071         if(m_temperatureResource)
1072         {
1073             QueryParamsMap test;
1074             ASSERT_EQ(OC_STACK_OK, m_temperatureResource->get(test, std::bind(&RICppIntegrationTest_stc::onGet, this, PH::_1, PH::_2, PH::_3)
1075                             ,QualityOfService::HighQos))
1076             << "Get does not return success";
1077             CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1078         }
1079         else
1080         {
1081             SET_FAILURE("Temperature resource was not found");
1082             return;
1083         }
1084         if(!m_RIHelper->isServerOk)
1085         {
1086             SET_FAILURE(m_RIHelper->getFailure());
1087             return;
1088         }
1089         if(!isGetCorrect)
1090         {
1091             SET_FAILURE("onGet Callback values are not correct");
1092         }
1093     }
1094     catch (exception &e)
1095     {
1096         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
1097     }
1098 }
1099 #endif
1100
1101 /**
1102  * @since 2016-08-04
1103  * @see void Configure (const PlatformConfig &config)
1104  * @see OCStackResult findResource(const std::string& host, const std::string& resourceURI,
1105  *                   OCConnectivityType connectivityType, FindCallback resourceHandler)
1106  * @objective Test registerResource() API and put() API positively to check
1107  *      if put request is done successfully
1108  * @target OCStackResult registerResource(OCResourceHandle& resourceHandle,
1109  *                       std::string& resourceURI,
1110  *                       const std::string& resourceTypeName,
1111  *                       const std::string& resourceInterface,
1112  *                       EntityHandler entityHandler,
1113  *                       uint8_t resourceProperty)
1114  * @target OCStackResult put(const OCRepresentation& representation,
1115  *                        const QueryParamsMap& queryParametersMap, PutCallback attributeHandler)
1116  * @test_data     1. OCResourceHandle pointer to the created resource
1117  *                2. resourceURI "/a/temperature"
1118  *                3. resourceTypeName "oic.r.temperature"
1119  *                4. resourceInterface DEFAULT_INTERFACE
1120  *                5. EntityHandler callback to be called
1121  *                6. resourceProperty indicates the property of the resource
1122  *                7. representation representation with attribute's names and value
1123  *                8. queryParametersMap map which can have the query parameter name and value
1124  *                9. PutCallback callback to be called
1125  * @pre_condition Configure platform for client server mode
1126  * @procedure     1. Perform registerResource() API
1127  *                2. Perform findResource() API with resource type in query
1128  *                3. Check if callback is called
1129  *                4. Check if temperature resource is found
1130  *                5. Perform put() API on the found temperature resource
1131  *                6. Check if server can get the put request and send response correctly
1132  *                7. Check if client's onPut callback is called and resource attributes are found correctly in response
1133  * @post_condition None
1134  * @expected onPut callback is called and response is found correctly
1135  */
1136 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
1137 TEST_F(RICppIntegrationTest_stc, CreateResourceAndSendPutRequest_SQV_CV_P)
1138 {
1139     try
1140     {
1141         m_temperatureHandle = m_RIHelper->registerResource(m_TemperatureUri, m_TemperatureType,
1142                 m_ResourceInterface);
1143         ASSERT_NE(m_temperatureHandle,(OCResourceHandle)NULL) << "Register Resource failed";
1144
1145         IOTIVITYTEST_LOG(INFO, "Finding Temperature Resource...");
1146         ASSERT_EQ(OC_STACK_OK,
1147                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1)))
1148         << "findResource does not return success";
1149         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1150         if(!m_foundResourceCheck)
1151         {
1152             SET_FAILURE("onFoundResource Callback is not Invoked!");
1153         }
1154         if(m_temperatureResource)
1155         {
1156             QueryParamsMap test;
1157             OCRepresentation rep;
1158             rep.setValue("temperature",m_temp);
1159             rep.setValue("hour",m_hour);
1160
1161             ASSERT_EQ(OC_STACK_OK, m_temperatureResource->put(rep,test,std::bind(&RICppIntegrationTest_stc::onPut, this, PH::_1, PH::_2, PH::_3)))
1162             << "Put does not return success";
1163             CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1164         }
1165         else
1166         {
1167             SET_FAILURE("Temperature resource was not found");
1168             return;
1169         }
1170         if(!m_RIHelper->isServerOk)
1171         {
1172             SET_FAILURE(m_RIHelper->getFailure());
1173             return;
1174         }
1175         if(!isPutCorrect)
1176         {
1177             SET_FAILURE("onPut Callback values are not correct");
1178         }
1179     }
1180     catch (exception &e)
1181     {
1182         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
1183     }
1184 }
1185 #endif
1186
1187 /**
1188  * @since 2016-08-04
1189  * @see void Configure (const PlatformConfig &config)
1190  * @see OCStackResult findResource(const std::string& host, const std::string& resourceURI,
1191  *                   OCConnectivityType connectivityType, FindCallback resourceHandler)
1192  * @objective Test registerResource() API and put() API(with Qos) positively to check
1193  *      if put request is done successfully
1194  * @target OCStackResult registerResource(OCResourceHandle& resourceHandle,
1195  *                       std::string& resourceURI,
1196  *                       const std::string& resourceTypeName,
1197  *                       const std::string& resourceInterface,
1198  *                       EntityHandler entityHandler,
1199  *                       uint8_t resourceProperty)
1200  * @target OCStackResult put(const OCRepresentation& representation,
1201  *                        const QueryParamsMap& queryParametersMap, PutCallback attributeHandler)
1202  * @test_data     1. OCResourceHandle pointer to the created resource
1203  *                2. resourceURI "/a/temperature"
1204  *                3. resourceTypeName "oic.r.temperature"
1205  *                4. resourceInterface DEFAULT_INTERFACE
1206  *                5. EntityHandler callback to be called
1207  *                6. resourceProperty indicates the property of the resource
1208  *                7. representation representation with attribute's names and value
1209  *                8. queryParametersMap map which can have the query parameter name and value
1210  *                9. PutCallback callback to be called
1211  * @pre_condition Configure platform for client server mode
1212  * @procedure     1. Perform registerResource() API
1213  *                2. Perform findResource() API with resource type in query
1214  *                3. Check if callback is called
1215  *                4. Check if temperature resource is found
1216  *                5. Perform put() API(with Qos) on the found temperature resource
1217  *                6. Check if server can get the put request and send response correctly
1218  *                7. Check if client's onPut callback is called and resource attributes are found correctly in response
1219  * @post_condition None
1220  * @expected onPut callback is called and response is found correctly
1221  */
1222 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
1223 TEST_F(RICppIntegrationTest_stc, CreateResourceAndSendPutRequestWithQos_SQV_CV_P)
1224 {
1225     try
1226     {
1227         m_temperatureHandle = m_RIHelper->registerResource(m_TemperatureUri, m_TemperatureType,
1228                 m_ResourceInterface);
1229         ASSERT_NE(m_temperatureHandle,(OCResourceHandle)NULL) << "Register Resource failed";
1230
1231         IOTIVITYTEST_LOG(INFO, "Finding Temperature Resource...");
1232         ASSERT_EQ(OC_STACK_OK,
1233                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1)))
1234         << "findResource does not return success";
1235         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1236         if(!m_foundResourceCheck)
1237         {
1238             SET_FAILURE("onFoundResource Callback is not Invoked!");
1239         }
1240         if(m_temperatureResource)
1241         {
1242             QueryParamsMap test;
1243             OCRepresentation rep;
1244             rep.setValue("temperature",m_temp);
1245             rep.setValue("hour",m_hour);
1246
1247             ASSERT_EQ(OC_STACK_OK, m_temperatureResource->put(rep,test,std::bind(&RICppIntegrationTest_stc::onPut, this, PH::_1, PH::_2, PH::_3)
1248                             ,QualityOfService::HighQos))
1249             << "Put does not return success";
1250             CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1251         }
1252         else
1253         {
1254             SET_FAILURE("Temperature resource was not found");
1255             return;
1256         }
1257         if(!m_RIHelper->isServerOk)
1258         {
1259             SET_FAILURE(m_RIHelper->getFailure());
1260             return;
1261         }
1262         if(!isPutCorrect)
1263         {
1264             SET_FAILURE("onPut Callback values are not correct");
1265         }
1266     }
1267     catch (exception &e)
1268     {
1269         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
1270     }
1271 }
1272 #endif
1273
1274 /**
1275  * @since 2016-08-04
1276  * @see void Configure (const PlatformConfig &config)
1277  * @see OCStackResult findResource(const std::string& host, const std::string& resourceURI,
1278  *                   OCConnectivityType connectivityType, FindCallback resourceHandler)
1279  * @objective Test registerResource() API and post() API positively to check
1280  *      if post request is done successfully
1281  * @target OCStackResult registerResource(OCResourceHandle& resourceHandle,
1282  *                       std::string& resourceURI,
1283  *                       const std::string& resourceTypeName,
1284  *                       const std::string& resourceInterface,
1285  *                       EntityHandler entityHandler,
1286  *                       uint8_t resourceProperty)
1287  * @target OCStackResult post(const OCRepresentation& representation,
1288  *                        const QueryParamsMap& queryParametersMap, PostCallback attributeHandler)
1289  * @test_data     1. OCResourceHandle pointer to the created resource
1290  *                2. resourceURI "/a/temperature"
1291  *                3. resourceTypeName "oic.r.temperature"
1292  *                4. resourceInterface DEFAULT_INTERFACE
1293  *                5. EntityHandler callback to be called
1294  *                6. resourceProperty indicates the property of the resource
1295  *                7. representation representation with attribute's names and value
1296  *                8. queryParametersMap map which can have the query parameter name and value
1297  *                9. PostCallback callback to be called
1298  * @pre_condition Configure platform for client server mode
1299  * @procedure     1. Perform registerResource() API
1300  *                2. Perform findResource() API with resource type in query
1301  *                3. Check if callback is called
1302  *                4. Check if temperature resource is found
1303  *                5. Perform post() API on the found temperature resource
1304  *                6. Check if server can get the post request and send response correctly
1305  *                7. Check if client's onPost callback is called and resource attributes are found correctly in response
1306  * @post_condition None
1307  * @expected onPost callback is called and response is found correctly
1308  */
1309 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
1310 TEST_F(RICppIntegrationTest_stc, CreateResourceAndSendPostRequest_SQV_CV_P)
1311 {
1312     try
1313     {
1314         m_temperatureHandle = m_RIHelper->registerResource(m_TemperatureUri, m_TemperatureType,
1315                 m_ResourceInterface);
1316         ASSERT_NE(m_temperatureHandle,(OCResourceHandle)NULL) << "Register Resource failed";
1317
1318         IOTIVITYTEST_LOG(INFO, "Finding Temperature Resource...");
1319         ASSERT_EQ(OC_STACK_OK,
1320                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1)))
1321         << "findResource does not return success";
1322         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1323         if(!m_foundResourceCheck)
1324         {
1325             SET_FAILURE("onFoundResource Callback is not Invoked!");
1326         }
1327         if(m_temperatureResource)
1328         {
1329             QueryParamsMap test;
1330             OCRepresentation rep;
1331             rep.setValue("temperature",m_temp);
1332             rep.setValue("hour",m_hour);
1333
1334             ASSERT_EQ(OC_STACK_OK, m_temperatureResource->post(rep,test,std::bind(&RICppIntegrationTest_stc::onPost, this, PH::_1, PH::_2, PH::_3)))
1335             << "Post does not return success";
1336             CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1337         }
1338         else
1339         {
1340             SET_FAILURE("Temperature resource was not found");
1341             return;
1342         }
1343         if(!m_RIHelper->isServerOk)
1344         {
1345             SET_FAILURE(m_RIHelper->getFailure());
1346             return;
1347         }
1348         if(!isPostCorrect)
1349         {
1350             SET_FAILURE("onPost Callback values are not correct");
1351         }
1352     }
1353     catch (exception &e)
1354     {
1355         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
1356     }
1357 }
1358 #endif
1359
1360 /**
1361  * @since 2016-08-04
1362  * @see void Configure (const PlatformConfig &config)
1363  * @see OCStackResult findResource(const std::string& host, const std::string& resourceURI,
1364  *                   OCConnectivityType connectivityType, FindCallback resourceHandler)
1365  * @objective Test registerResource() API and post() API(with Qos) positively to check
1366  *      if post request is done successfully
1367  * @target OCStackResult registerResource(OCResourceHandle& resourceHandle,
1368  *                       std::string& resourceURI,
1369  *                       const std::string& resourceTypeName,
1370  *                       const std::string& resourceInterface,
1371  *                       EntityHandler entityHandler,
1372  *                       uint8_t resourceProperty)
1373  * @target OCStackResult post(const OCRepresentation& representation,
1374  *                        const QueryParamsMap& queryParametersMap, PostCallback attributeHandler)
1375  * @test_data     1. OCResourceHandle pointer to the created resource
1376  *                2. resourceURI "/a/temperature"
1377  *                3. resourceTypeName "oic.r.temperature"
1378  *                4. resourceInterface DEFAULT_INTERFACE
1379  *                5. EntityHandler callback to be called
1380  *                6. resourceProperty indicates the property of the resource
1381  *                7. representation representation with attribute's names and value
1382  *                8. queryParametersMap map which can have the query parameter name and value
1383  *                9. PostCallback callback to be called
1384  * @pre_condition Configure platform for client server mode
1385  * @procedure     1. Perform registerResource() API
1386  *                2. Perform findResource() API with resource type in query
1387  *                3. Check if callback is called
1388  *                4. Check if temperature resource is found
1389  *                5. Perform post() API(with Qos) on the found temperature resource
1390  *                6. Check if server can get the post request and send response correctly
1391  *                7. Check if client's onPost callback is called and resource attributes are found correctly in response
1392  * @post_condition None
1393  * @expected onPost callback is called and response is found correctly
1394  */
1395 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
1396 TEST_F(RICppIntegrationTest_stc, CreateResourceAndSendPostRequestWithQos_SQV_CV_P)
1397 {
1398     try
1399     {
1400         m_temperatureHandle = m_RIHelper->registerResource(m_TemperatureUri, m_TemperatureType,
1401                 m_ResourceInterface);
1402         ASSERT_NE(m_temperatureHandle,(OCResourceHandle)NULL) << "Register Resource failed";
1403
1404         IOTIVITYTEST_LOG(INFO, "Finding Temperature Resource...");
1405         ASSERT_EQ(OC_STACK_OK,
1406                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1)))
1407         << "findResource does not return success";
1408         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1409         if(!m_foundResourceCheck)
1410         {
1411             SET_FAILURE("onFoundResource Callback is not Invoked!");
1412         }
1413         if(m_temperatureResource)
1414         {
1415             QueryParamsMap test;
1416             OCRepresentation rep;
1417             rep.setValue("temperature",m_temp);
1418             rep.setValue("hour",m_hour);
1419
1420             ASSERT_EQ(OC_STACK_OK, m_temperatureResource->post(rep,test,std::bind(&RICppIntegrationTest_stc::onPost, this, PH::_1, PH::_2, PH::_3)
1421                             ,QualityOfService::HighQos))
1422             << "Post does not return success";
1423             CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1424         }
1425         else
1426         {
1427             SET_FAILURE("Temperature resource was not found");
1428             return;
1429         }
1430         if(!m_RIHelper->isServerOk)
1431         {
1432             SET_FAILURE(m_RIHelper->getFailure());
1433             return;
1434         }
1435         if(!isPostCorrect)
1436         {
1437             SET_FAILURE("onPost Callback values are not correct");
1438         }
1439     }
1440     catch (exception &e)
1441     {
1442         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
1443     }
1444 }
1445 #endif
1446
1447 /**
1448  * @since 2016-08-04
1449  * @see void Configure (const PlatformConfig &config)
1450  * @see OCStackResult findResource(const std::string& host, const std::string& resourceURI,
1451  *                   OCConnectivityType connectivityType, FindCallback resourceHandler)
1452  * @objective Test registerResource() API and delete() API positively to check
1453  *      if delete request is done successfully
1454  * @target OCStackResult registerResource(OCResourceHandle& resourceHandle,
1455  *                       std::string& resourceURI,
1456  *                       const std::string& resourceTypeName,
1457  *                       const std::string& resourceInterface,
1458  *                       EntityHandler entityHandler,
1459  *                       uint8_t resourceProperty)
1460  * @target OCStackResult deleteResource(DeleteCallback deleteHandler)
1461  * @target OCStackResult unregisterResource(const OCResourceHandle& resourceHandle)
1462  * @test_data     1. OCResourceHandle pointer to the created resource
1463  *                2. resourceURI "/a/temperature"
1464  *                3. resourceTypeName "oic.r.temperature"
1465  *                4. resourceInterface DEFAULT_INTERFACE
1466  *                5. EntityHandler callback to be called
1467  *                6. resourceProperty indicates the property of the resource
1468  *                7. DeleteCallback callback to be called
1469  * @pre_condition Configure platform for client server mode
1470  * @procedure     1. Perform registerResource() API
1471  *                2. Perform findResource() API with resource type in query
1472  *                3. Check if callback is called
1473  *                4. Check if temperature resource is found
1474  *                5. Perform delete() API on the found temperature resource
1475  *                6. Check if server can get the delete request and send response correctly
1476  *                7. Call unregisterResource() API inside server's entity handler
1477  *                8. Check if client's onDelete callback is called
1478  *                9. Call findResource() API again with resource type in query
1479  *                10. Check if resource is not found now(after delete operation)
1480  * @post_condition None
1481  * @expected onDelete callback is called and response is found correctly and resource is not found after delete operation
1482  */
1483 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
1484 TEST_F(RICppIntegrationTest_stc, CreateResourceAndSendDeleteRequest_SQV_CV_P)
1485 {
1486     try
1487     {
1488         m_temperatureHandle = m_RIHelper->registerResource(m_TemperatureUri, m_TemperatureType,
1489                 m_ResourceInterface);
1490         ASSERT_NE(m_temperatureHandle,(OCResourceHandle)NULL) << "Register Resource failed";
1491
1492         IOTIVITYTEST_LOG(INFO, "Finding Temperature Resource...");
1493         ASSERT_EQ(OC_STACK_OK,
1494                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1)))
1495         << "findResource does not return success";
1496         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1497         if(!m_foundResourceCheck)
1498         {
1499             SET_FAILURE("onFoundResource Callback is not Invoked!");
1500         }
1501         if(m_temperatureResource)
1502         {
1503             ASSERT_EQ(OC_STACK_OK, m_temperatureResource->deleteResource(std::bind(&RICppIntegrationTest_stc::onDelete, this, PH::_1, PH::_2)))
1504             << "Delete does not return success";
1505             CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1506         }
1507         else
1508         {
1509             SET_FAILURE("Temperature resource was not found");
1510             return;
1511         }
1512         if(!m_RIHelper->isServerOk)
1513         {
1514             SET_FAILURE(m_RIHelper->getFailure());
1515             return;
1516         }
1517         if(!isDeleteCorrect)
1518         {
1519             SET_FAILURE("onDelete Callback values are not correct");
1520             return;
1521         }
1522
1523         m_temperatureResource = nullptr;
1524
1525         IOTIVITYTEST_LOG(INFO, "Trying to Find Resource Again...");
1526         ASSERT_EQ(OC_STACK_OK,
1527                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1)));
1528         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1529         if(m_temperatureResource)
1530         {
1531             SET_FAILURE("Resource should not be found after delete operation");
1532         }
1533         else
1534         {
1535             IOTIVITYTEST_LOG(INFO, "Resource not found as it was deleted");
1536         }
1537     }
1538     catch (exception &e)
1539     {
1540         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
1541     }
1542 }
1543 #endif
1544
1545 /**
1546  * @since 2016-08-04
1547  * @see void Configure (const PlatformConfig &config)
1548  * @see OCStackResult findResource(const std::string& host, const std::string& resourceURI,
1549  *                   OCConnectivityType connectivityType, FindCallback resourceHandler)
1550  * @objective Test registerResource() API and delete() API(with Qos) positively to check
1551  *      if delete request is done successfully
1552  * @target OCStackResult registerResource(OCResourceHandle& resourceHandle,
1553  *                       std::string& resourceURI,
1554  *                       const std::string& resourceTypeName,
1555  *                       const std::string& resourceInterface,
1556  *                       EntityHandler entityHandler,
1557  *                       uint8_t resourceProperty)
1558  * @target OCStackResult deleteResource(DeleteCallback deleteHandler)
1559  * @target OCStackResult unregisterResource(const OCResourceHandle& resourceHandle)
1560  * @test_data     1. OCResourceHandle pointer to the created resource
1561  *                2. resourceURI "/a/temperature"
1562  *                3. resourceTypeName "oic.r.temperature"
1563  *                4. resourceInterface DEFAULT_INTERFACE
1564  *                5. EntityHandler callback to be called
1565  *                6. resourceProperty indicates the property of the resource
1566  *                7. DeleteCallback callback to be called
1567  * @pre_condition Configure platform for client server mode
1568  * @procedure     1. Perform registerResource() API
1569  *                2. Perform findResource() API with resource type in query
1570  *                3. Check if callback is called
1571  *                4. Check if temperature resource is found
1572  *                5. Perform delete() API(with Qos) on the found temperature resource
1573  *                6. Check if server can get the delete request and send response correctly
1574  *                7. Call unregisterResource() API inside server's entity handler
1575  *                8. Check if client's onDelete callback is called
1576  *                9. Call findResource() API again with resource type in query
1577  *                10. Check if resource is not found now(after delete operation)
1578  * @post_condition None
1579  * @expected onDelete callback is called and response is found correctly and resource is not found after delete operation
1580  */
1581 #if defined(__LINUX__) || defined(__TIZEN__) || defined(__WINDOWS__)
1582 TEST_F(RICppIntegrationTest_stc, CreateResourceAndSendDeleteRequestWithQos_SQV_CV_P)
1583 {
1584     try
1585     {
1586         m_temperatureHandle = m_RIHelper->registerResource(m_TemperatureUri, m_TemperatureType,
1587                 m_ResourceInterface);
1588         ASSERT_NE(m_temperatureHandle,(OCResourceHandle)NULL) << "Register Resource failed";
1589
1590         IOTIVITYTEST_LOG(INFO, "Finding Temperature Resource...");
1591         ASSERT_EQ(OC_STACK_OK,
1592                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1)))
1593         << "findResource does not return success";
1594         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1595         if(!m_foundResourceCheck)
1596         {
1597             SET_FAILURE("onFoundResource Callback is not Invoked!");
1598         }
1599         if(m_temperatureResource)
1600         {
1601             ASSERT_EQ(OC_STACK_OK, m_temperatureResource->deleteResource(std::bind(&RICppIntegrationTest_stc::onDelete, this, PH::_1, PH::_2)
1602                             ,QualityOfService::HighQos))
1603             << "Delete does not return success";
1604             CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1605         }
1606         else
1607         {
1608             SET_FAILURE("Temperature resource was not found");
1609             return;
1610         }
1611         if(!m_RIHelper->isServerOk)
1612         {
1613             SET_FAILURE(m_RIHelper->getFailure());
1614             return;
1615         }
1616         if(!isDeleteCorrect)
1617         {
1618             SET_FAILURE("onDelete Callback values are not correct");
1619             return;
1620         }
1621
1622         m_temperatureResource = nullptr;
1623
1624         IOTIVITYTEST_LOG(INFO, "Trying to Find Resource Again...");
1625         ASSERT_EQ(OC_STACK_OK,
1626                 OCPlatform::findResource("", m_temperatureResourceQuery, CT_DEFAULT, std::bind(&RICppIntegrationTest_stc::foundResource, this, PH::_1)))
1627         << "findResource does not return success";
1628         CommonUtil::waitInSecond(CALLBACK_WAIT_DEFAULT);
1629         if(m_temperatureResource)
1630         {
1631             SET_FAILURE("Resource should not be found after delete operation");
1632         }
1633         else
1634         {
1635             IOTIVITYTEST_LOG(INFO, "Resource not found as it was deleted");
1636         }
1637     }
1638     catch (exception &e)
1639     {
1640         SET_FAILURE("Exception occured. Exception is " + std::string(e.what()));
1641     }
1642 }
1643 #endif