Added preprocessor WITH_CLOUD for Subscribe device presence.
[platform/upstream/iotivity.git] / resource / unittests / OCPlatformTest.cpp
index 1ef5c02..d7e2cf2 100644 (file)
 
 #include <OCPlatform.h>
 #include <OCApi.h>
+#include <oic_malloc.h>
 #include <gtest/gtest.h>
 
 namespace OCPlatformTest
 {
     using namespace OC;
 
+    static const char* SVR_DB_FILE_NAME = "./oic_svr_db_server.dat";
     const OCResourceHandle HANDLE_ZERO = 0;
     const std::string gResourceTypeName = "core.res";
     const std::string gResourceInterface = DEFAULT_INTERFACE;
     const uint8_t gResourceProperty = OC_DISCOVERABLE | OC_OBSERVABLE;
     OCResourceHandle resourceHandle;
 
+    //OCPersistent Storage Handlers
+    static FILE* client_open(const char * /*path*/, const char *mode)
+    {
+        std::cout << "<===Opening SVR DB file = './oic_svr_db_client.dat' with mode = '" << mode
+                << "' " << std::endl;
+        return fopen(SVR_DB_FILE_NAME, mode);
+    }
+    OCPersistentStorage gps {client_open, fread, fwrite, fclose, unlink };
+
     // Callbacks
-    OCEntityHandlerResult entityHandler(std::shared_ptr<OCResourceRequest> request)
+    OCEntityHandlerResult entityHandler(std::shared_ptr<OCResourceRequest> /*request*/)
     {
         return OC_EH_OK;
     }
 
-    void foundResource(std::shared_ptr<OCResource> resource)
+    void foundResource(std::shared_ptr<OCResource> /*resource*/)
+    {
+    }
+
+    void receivedDeviceInfo(const OCRepresentation& /*rep*/)
+    {
+    }
+
+    void presenceHandler(OCStackResult /*result*/,
+            const unsigned int /*nonce*/, const std::string& /*hostAddress*/)
     {
     }
 
-    void receivedDeviceInfo(const OCRepresentation& rep)
+#ifdef WITH_CLOUD
+    void onObserve(const HeaderOptions, const OCRepresentation&, const int&, const int&)
     {
     }
+#endif
 
-    void presenceHandler(OCStackResult result,
-            const unsigned int nonce, const std::string& hostAddress)
+    void directPairHandler(std::shared_ptr<OCDirectPairing> /*dev*/, OCStackResult /*res*/)
     {
     }
 
+    void pairedHandler(const PairedDevices& /*list*/)
+    {
+    }
+#ifdef WITH_CLOUD
+    void accountHandler(const HeaderOptions& /*headerOptions*/, const OCRepresentation& /*rep*/,
+            const int /*eCode*/)
+    {
+    }
+#endif
     //Helper methods
+    void DeleteStringLL(OCStringLL* ll)
+    {
+        if (!ll)
+        {
+            return;
+        }
+
+        DeleteStringLL(ll->next);
+        delete[] ll->value;
+        OICFree(ll);
+    }
+
     void DeleteDeviceInfo(OCDeviceInfo deviceInfo)
     {
-        delete[] deviceInfo.contentType;
-        delete[] deviceInfo.dateOfManufacture;
         delete[] deviceInfo.deviceName;
-        delete[] deviceInfo.deviceUUID;
-        delete[] deviceInfo.firmwareVersion;
-        delete[] deviceInfo.hostName;
-        delete[] deviceInfo.manufacturerName;
-        delete[] deviceInfo.manufacturerUrl;
-        delete[] deviceInfo.modelNumber;
-        delete[] deviceInfo.platformVersion;
-        delete[] deviceInfo.supportUrl;
-        delete[] deviceInfo.version;
+        DeleteStringLL(deviceInfo.types);
+        delete[] deviceInfo.specVersion;
+        DeleteStringLL(deviceInfo.dataModelVersions);
     }
 
     void DuplicateString(char ** targetString, std::string sourceString)
@@ -74,9 +108,35 @@ namespace OCPlatformTest
         strncpy(*targetString, sourceString.c_str(), (sourceString.length() + 1));
     }
 
+    bool OCResourcePayloadAddStringLL(OCStringLL **stringLL, std::string value)
+    {
+        char *dup = NULL;
+        DuplicateString(&dup, value);
+        if (!*stringLL)
+        {
+            *stringLL = (OCStringLL *)OICCalloc(1, sizeof(OCStringLL));
+            (*stringLL)->value = dup;
+            return true;
+        }
+        else
+        {
+            OCStringLL *temp = *stringLL;
+            while(temp->next)
+            {
+                temp = temp->next;
+            }
+            temp->next = (OCStringLL *)OICCalloc(1, sizeof(OCStringLL));
+            temp->next->value = dup;
+            return true;
+        }
+        return false;
+    }
+
     OCResourceHandle RegisterResource(std::string uri, std::string type, std::string iface)
     {
-        PlatformConfig cfg = {};
+        PlatformConfig cfg
+        { OC::ServiceType::OutOfProc, OC::ModeType::Server, "0.0.0.0", 0,
+                OC::QualityOfService::LowQos, &gps };
         OCPlatform::Configure(cfg);
         EXPECT_EQ(OC_STACK_OK,OCPlatform::registerResource(
                                         resourceHandle, uri, type,
@@ -86,7 +146,9 @@ namespace OCPlatformTest
 
     OCResourceHandle RegisterResource(std::string uri, std::string type)
     {
-        PlatformConfig cfg = {};
+        PlatformConfig cfg
+        { OC::ServiceType::OutOfProc, OC::ModeType::Server, "0.0.0.0", 0,
+                OC::QualityOfService::LowQos, &gps };
         OCPlatform::Configure(cfg);
         EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
                                         resourceHandle, uri, type,
@@ -96,7 +158,9 @@ namespace OCPlatformTest
 
     OCResourceHandle RegisterResource(std::string uri)
     {
-        PlatformConfig cfg = {};
+        PlatformConfig cfg
+        { OC::ServiceType::OutOfProc, OC::ModeType::Server, "0.0.0.0", 0,
+                OC::QualityOfService::LowQos, &gps };
         OCPlatform::Configure(cfg);
         EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
                                         resourceHandle, uri, gResourceTypeName,
@@ -157,12 +221,13 @@ namespace OCPlatformTest
 
     TEST(ConfigureTest, ConfigureServerOutProc)
     {
-        PlatformConfig cfg {
+        PlatformConfig cfg
+        {
             OC::ServiceType::OutOfProc,
             OC::ModeType::Server,
             "0.0.0.0",
             0,
-            OC::QualityOfService::LowQos
+            OC::QualityOfService::LowQos, &gps
         };
         std::string uri = "/a/light67";
         std::string type = "core.light";
@@ -197,7 +262,7 @@ namespace OCPlatformTest
             OC::ModeType::Server,
             "0.0.0.0",
             0,
-            OC::QualityOfService::LowQos
+            OC::QualityOfService::LowQos, &gps
         };
         OCPlatform::Configure(cfg);
 
@@ -211,19 +276,79 @@ namespace OCPlatformTest
         std::string uri = "/a/light70";
         std::string type = "core.light";
         uint8_t gResourceProperty = 0;
-        PlatformConfig cfg {
+        PlatformConfig cfg
+        {
             OC::ServiceType::InProc,
             OC::ModeType::Client,
             "0.0.0.0",
             0,
-            OC::QualityOfService::LowQos
+            OC::QualityOfService::LowQos,
+            &gps
         };
-        OCPlatform::Configure(cfg);
 
         EXPECT_NO_THROW(OCPlatform::registerResource(
                  resourceHandle, uri, type,
                  gResourceInterface, entityHandler, gResourceProperty));
     }
+    //PersistentStorageTest
+    TEST(ConfigureTest, ConfigureDefaultNULLPersistentStorage)
+    {
+        PlatformConfig cfg {
+             OC::ServiceType::InProc,
+             OC::ModeType::Both,
+             "0.0.0.0",
+             0,
+             OC::QualityOfService::LowQos
+         };
+         OCPlatform::Configure(cfg);
+         EXPECT_NO_THROW(OCPlatform::setDefaultDeviceEntityHandler(nullptr));
+     }
+
+    //PersistentStorageTest
+    TEST(ConfigureTest, ConfigureNULLPersistentStorage)
+    {
+        PlatformConfig cfg {
+             OC::ServiceType::InProc,
+             OC::ModeType::Both,
+             "0.0.0.0",
+             0,
+             OC::QualityOfService::LowQos,
+             nullptr
+         };
+         OCPlatform::Configure(cfg);
+         EXPECT_NO_THROW(OCPlatform::setDefaultDeviceEntityHandler(nullptr));
+     }
+
+    //PersistentStorageTest
+    TEST(ConfigureTest, ConfigurePersistentStorage)
+    {
+         PlatformConfig cfg {
+             OC::ServiceType::InProc,
+             OC::ModeType::Both,
+             "0.0.0.0",
+             0,
+             OC::QualityOfService::LowQos,
+             &gps
+         };
+         OCPlatform::Configure(cfg);
+         EXPECT_NO_THROW(OCPlatform::setDefaultDeviceEntityHandler(nullptr));
+     }
+
+    //PersistentStorageTest
+    TEST(ConfigureTest, ConfigureNULLHandlersPersistentStorage)
+    {
+        PlatformConfig cfg {
+             OC::ServiceType::InProc,
+             OC::ModeType::Both,
+             "0.0.0.0",
+             0,
+             OC::QualityOfService::LowQos,
+             &gps
+         };
+         OCPlatform::Configure(cfg);
+         EXPECT_NO_THROW(OCPlatform::setDefaultDeviceEntityHandler(nullptr));
+     }
+
 
     //RegisterResourceTest
     TEST(RegisterResourceTest, RegisterSingleResource)
@@ -356,7 +481,7 @@ namespace OCPlatformTest
     }
 
     //PresenceTest
-    TEST(PresenceTest, StartAndStopPresence)
+    TEST(PresenceTest, DISABLED_StartAndStopPresence)
     {
         EXPECT_EQ(OC_STACK_OK, OCPlatform::startPresence(30));
         EXPECT_NE(HANDLE_ZERO, RegisterResource( std::string("/a/Presence"),
@@ -473,90 +598,90 @@ namespace OCPlatformTest
 
 
     //FindResource test
-    TEST(FindResourceTest, FindResourceValid)
+    TEST(FindResourceTest, DISABLED_FindResourceValid)
     {
       std::ostringstream requestURI;
-      requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
+      requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
       EXPECT_EQ(OC_STACK_OK, OCPlatform::findResource("", requestURI.str(),
-              OC_WIFI, &foundResource));
+              CT_DEFAULT, &foundResource));
     }
 
     TEST(FindResourceTest, FindResourceNullResourceURI)
     {
       EXPECT_ANY_THROW(OCPlatform::findResource("", nullptr,
-              OC_WIFI, &foundResource));
+              CT_DEFAULT, &foundResource));
     }
 
     TEST(FindResourceTest, FindResourceNullResourceURI1)
     {
       std::ostringstream requestURI;
-      requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
+      requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
       EXPECT_ANY_THROW(OCPlatform::findResource(nullptr, requestURI.str(),
-              OC_WIFI, &foundResource));
+              CT_DEFAULT, &foundResource));
     }
 
     TEST(FindResourceTest, FindResourceNullHost)
     {
       std::ostringstream requestURI;
-      requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
+      requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
       EXPECT_ANY_THROW(OCPlatform::findResource(nullptr, requestURI.str(),
-              OC_WIFI, &foundResource));
+              CT_DEFAULT, &foundResource));
     }
 
     TEST(FindResourceTest, FindResourceNullresourceHandler)
     {
       std::ostringstream requestURI;
-      requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
+      requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
       EXPECT_THROW(OCPlatform::findResource("", requestURI.str(),
-              OC_WIFI, NULL), OC::OCException);
+              CT_DEFAULT, NULL), OC::OCException);
     }
 
-    TEST(FindResourceTest, FindResourceWithLowQoS)
+    TEST(FindResourceTest, DISABLED_FindResourceWithLowQoS)
     {
         std::ostringstream requestURI;
-        requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
+        requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
         EXPECT_EQ(OC_STACK_OK,
-                OCPlatform::findResource("", requestURI.str(), OC_WIFI, &foundResource,
+                OCPlatform::findResource("", requestURI.str(), CT_DEFAULT, &foundResource,
                         OC::QualityOfService::LowQos));
     }
 
-    TEST(FindResourceTest, FindResourceWithMidQos)
+    TEST(FindResourceTest, DISABLED_FindResourceWithMidQos)
     {
         std::ostringstream requestURI;
-        requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
+        requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
         EXPECT_EQ(OC_STACK_OK,
-                OCPlatform::findResource("", requestURI.str(), OC_WIFI, &foundResource,
+                OCPlatform::findResource("", requestURI.str(), CT_DEFAULT, &foundResource,
                         OC::QualityOfService::MidQos));
     }
 
-    TEST(FindResourceTest, FindResourceWithHighQos)
+    TEST(FindResourceTest, DISABLED_FindResourceWithHighQos)
     {
         std::ostringstream requestURI;
-        requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
+        requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
         EXPECT_EQ(OC_STACK_OK,
-                OCPlatform::findResource("", requestURI.str(), OC_WIFI, &foundResource,
+                OCPlatform::findResource("", requestURI.str(), CT_DEFAULT, &foundResource,
                         OC::QualityOfService::HighQos));
     }
 
-    TEST(FindResourceTest, FindResourceWithNaQos)
+    TEST(FindResourceTest, DISABLED_FindResourceWithNaQos)
     {
         std::ostringstream requestURI;
-        requestURI << OC_WELL_KNOWN_QUERY << "?rt=core.light";
+        requestURI << OC_RSRVD_WELL_KNOWN_URI << "?rt=core.light";
         EXPECT_EQ(OC_STACK_OK,
-                OCPlatform::findResource("", requestURI.str(), OC_WIFI, &foundResource,
+                OCPlatform::findResource("", requestURI.str(), CT_DEFAULT, &foundResource,
                         OC::QualityOfService::NaQos));
     }
 
     //GetDeviceInfo Test
-    TEST(GetDeviceInfoTest, GetDeviceInfoWithValidParameters)
+    TEST(GetDeviceInfoTest, DISABLED_GetDeviceInfoWithValidParameters)
     {
-        std::string deviceDiscoveryURI = "/oc/core/d";
+        std::string deviceDiscoveryURI = "/oic/d";
         PlatformConfig cfg;
         OCPlatform::Configure(cfg);
         std::ostringstream requestURI;
         requestURI << OC_MULTICAST_PREFIX << deviceDiscoveryURI;
         EXPECT_EQ(OC_STACK_OK,
-                OCPlatform::getDeviceInfo("", requestURI.str(), OC_WIFI, &receivedDeviceInfo));
+                OCPlatform::getDeviceInfo("", requestURI.str(), CT_DEFAULT, &receivedDeviceInfo));
     }
 
     TEST(GetDeviceInfoTest, GetDeviceInfoNullDeviceURI)
@@ -564,66 +689,66 @@ namespace OCPlatformTest
         PlatformConfig cfg;
         OCPlatform::Configure(cfg);
         EXPECT_ANY_THROW(
-                OCPlatform::getDeviceInfo("", nullptr, OC_WIFI, &receivedDeviceInfo));
+                OCPlatform::getDeviceInfo("", nullptr, CT_DEFAULT, &receivedDeviceInfo));
     }
 
     TEST(GetDeviceInfoTest, GetDeviceInfoWithNullDeviceInfoHandler)
     {
-        std::string deviceDiscoveryURI = "/oc/core/d";
+        std::string deviceDiscoveryURI = "/oic/d";
         PlatformConfig cfg;
         OCPlatform::Configure(cfg);
         std::ostringstream requestURI;
         requestURI << OC_MULTICAST_PREFIX << deviceDiscoveryURI;
         EXPECT_THROW(
-                OCPlatform::getDeviceInfo("", requestURI.str(), OC_WIFI, NULL),
+                OCPlatform::getDeviceInfo("", requestURI.str(), CT_DEFAULT, NULL),
                 OC::OCException);
     }
 
-    TEST(GetDeviceInfoTest, GetDeviceInfoWithLowQos)
+    TEST(GetDeviceInfoTest, DISABLED_GetDeviceInfoWithLowQos)
     {
-        std::string deviceDiscoveryURI = "/oc/core/d";
+        std::string deviceDiscoveryURI = "/oic/d";
         PlatformConfig cfg;
         OCPlatform::Configure(cfg);
         std::ostringstream requestURI;
         requestURI << OC_MULTICAST_PREFIX << deviceDiscoveryURI;
         EXPECT_EQ(OC_STACK_OK,
-                OCPlatform::getDeviceInfo("", requestURI.str(), OC_WIFI, &receivedDeviceInfo,
+                OCPlatform::getDeviceInfo("", requestURI.str(), CT_DEFAULT, &receivedDeviceInfo,
                         OC::QualityOfService::LowQos));
     }
 
-    TEST(GetDeviceInfoTest, GetDeviceInfoWithMidQos)
+    TEST(GetDeviceInfoTest, DISABLED_GetDeviceInfoWithMidQos)
     {
-        std::string deviceDiscoveryURI = "/oc/core/d";
+        std::string deviceDiscoveryURI = "/oic/d";
         PlatformConfig cfg;
         OCPlatform::Configure(cfg);
         std::ostringstream requestURI;
         requestURI << OC_MULTICAST_PREFIX << deviceDiscoveryURI;
         EXPECT_EQ(OC_STACK_OK,
-                OCPlatform::getDeviceInfo("", requestURI.str(), OC_WIFI, &receivedDeviceInfo,
+                OCPlatform::getDeviceInfo("", requestURI.str(), CT_DEFAULT, &receivedDeviceInfo,
                         OC::QualityOfService::MidQos));
     }
 
-    TEST(GetDeviceInfoTest, GetDeviceInfoWithHighQos)
+    TEST(GetDeviceInfoTest, DISABLED_GetDeviceInfoWithHighQos)
     {
-        std::string deviceDiscoveryURI = "/oc/core/d";
+        std::string deviceDiscoveryURI = "/oic/d";
         PlatformConfig cfg;
         OCPlatform::Configure(cfg);
         std::ostringstream requestURI;
         requestURI << OC_MULTICAST_PREFIX << deviceDiscoveryURI;
         EXPECT_EQ(OC_STACK_OK,
-                OCPlatform::getDeviceInfo("", requestURI.str(), OC_WIFI, &receivedDeviceInfo,
+                OCPlatform::getDeviceInfo("", requestURI.str(), CT_DEFAULT, &receivedDeviceInfo,
                         OC::QualityOfService::HighQos));
     }
 
-    TEST(GetDeviceInfoTest, GetDeviceInfoWithNaQos)
+    TEST(GetDeviceInfoTest, DISABLED_GetDeviceInfoWithNaQos)
     {
-        std::string deviceDiscoveryURI = "/oc/core/d";
+        std::string deviceDiscoveryURI = "/oic/d";
         PlatformConfig cfg;
         OCPlatform::Configure(cfg);
         std::ostringstream requestURI;
         requestURI << OC_MULTICAST_PREFIX << deviceDiscoveryURI;
         EXPECT_EQ(OC_STACK_OK,
-                OCPlatform::getDeviceInfo("", requestURI.str(), OC_WIFI, &receivedDeviceInfo,
+                OCPlatform::getDeviceInfo("", requestURI.str(), CT_DEFAULT, &receivedDeviceInfo,
                         OC::QualityOfService::NaQos));
     }
 
@@ -631,78 +756,71 @@ namespace OCPlatformTest
     TEST(RegisterDeviceInfoTest, RegisterDeviceInfoWithValidParameters)
     {
         OCDeviceInfo deviceInfo;
-
-        DuplicateString(&deviceInfo.contentType, "myContentType");
-        DuplicateString(&deviceInfo.dateOfManufacture, "myDateOfManufacture");
         DuplicateString(&deviceInfo.deviceName, "myDeviceName");
-        DuplicateString(&deviceInfo.deviceUUID, "myDeviceUUID");
-        DuplicateString(&deviceInfo.firmwareVersion, "myFirmwareVersion");
-        DuplicateString(&deviceInfo.hostName, "myHostName");
-        DuplicateString(&deviceInfo.manufacturerName, "myManufacturerNa");
-        DuplicateString(&deviceInfo.manufacturerUrl, "myManufacturerUrl");
-        DuplicateString(&deviceInfo.modelNumber, "myModelNumber");
-        DuplicateString(&deviceInfo.platformVersion, "myPlatformVersion");
-        DuplicateString(&deviceInfo.supportUrl, "mySupportUrl");
-        DuplicateString(&deviceInfo.version, "myVersion");
-
+        deviceInfo.types = NULL;
+        OCResourcePayloadAddStringLL(&deviceInfo.types, "oic.wk.d");
+        OCResourcePayloadAddStringLL(&deviceInfo.types, "oic.d.tv");
+        DuplicateString(&deviceInfo.specVersion, "mySpecVersion");
+        deviceInfo.dataModelVersions = nullptr;
+        OCResourcePayloadAddStringLL(&deviceInfo.dataModelVersions, "myDataModelVersions");
         EXPECT_EQ(OC_STACK_OK, OCPlatform::registerDeviceInfo(deviceInfo));
         EXPECT_NO_THROW(DeleteDeviceInfo(deviceInfo));
     }
 
     TEST(RegisterDeviceInfoTest, RegisterDeviceInfoWithEmptyObject)
     {
-        OCDeviceInfo di = {};
-        EXPECT_EQ(OC_STACK_OK, OCPlatform::registerDeviceInfo(di));
+        OCDeviceInfo di = {0, 0, 0, 0};
+        EXPECT_ANY_THROW(OCPlatform::registerDeviceInfo(di));
     }
 
     //SubscribePresence Test
-    TEST(SubscribePresenceTest,SubscribePresenceWithValidParameters)
+    TEST(SubscribePresenceTest, DISABLED_SubscribePresenceWithValidParameters)
     {
         std::string hostAddress = "192.168.1.2:5000";
         OCPlatform::OCPresenceHandle presenceHandle = nullptr;
 
         EXPECT_EQ(OC_STACK_OK, OCPlatform::subscribePresence(presenceHandle, hostAddress,
-                 OC_WIFI, &presenceHandler));
+                 CT_DEFAULT, &presenceHandler));
     }
 
-    TEST(SubscribePresenceTest,SubscribePresenceWithNullHost)
+    TEST(SubscribePresenceTest, SubscribePresenceWithNullHost)
     {
         OCPlatform::OCPresenceHandle presenceHandle = nullptr;
 
         EXPECT_ANY_THROW(OCPlatform::subscribePresence(presenceHandle, nullptr,
-                 OC_WIFI, &presenceHandler));
+                 CT_DEFAULT, &presenceHandler));
     }
 
-    TEST(SubscribePresenceTest,SubscribePresenceWithNullPresenceHandler)
+    TEST(SubscribePresenceTest, SubscribePresenceWithNullPresenceHandler)
     {
         OCPlatform::OCPresenceHandle presenceHandle = nullptr;
 
         EXPECT_ANY_THROW(OCPlatform::subscribePresence(presenceHandle, nullptr,
-                 OC_WIFI, NULL));
+                 CT_DEFAULT, NULL));
     }
 
-    TEST(SubscribePresenceTest,SubscribePresenceWithResourceType)
+    TEST(SubscribePresenceTest, DISABLED_SubscribePresenceWithResourceType)
     {
         OCPlatform::OCPresenceHandle presenceHandle = nullptr;
 
         EXPECT_EQ(OC_STACK_OK, OCPlatform::subscribePresence(presenceHandle,
-                OC_MULTICAST_IP, "core.light", OC_WIFI, &presenceHandler));
+                OC_MULTICAST_IP, "core.light", CT_DEFAULT, &presenceHandler));
     }
 
-    TEST(SubscribePresenceTest,SubscribePresenceWithNullResourceType)
+    TEST(SubscribePresenceTest, SubscribePresenceWithNullResourceType)
     {
         OCPlatform::OCPresenceHandle presenceHandle = nullptr;
 
         EXPECT_ANY_THROW(OCPlatform::subscribePresence(presenceHandle,
-                OC_MULTICAST_IP, nullptr, OC_WIFI, &presenceHandler));
+                OC_MULTICAST_IP, nullptr, CT_DEFAULT, &presenceHandler));
     }
 
-    TEST(SubscribePresenceTest, UnsubscribePresenceWithValidHandleAndRT)
+    TEST(SubscribePresenceTest, DISABLED_UnsubscribePresenceWithValidHandleAndRT)
     {
         OCPlatform::OCPresenceHandle presenceHandle = nullptr;
 
         EXPECT_EQ(OC_STACK_OK, OCPlatform::subscribePresence(presenceHandle,
-                OC_MULTICAST_IP, "core.light", OC_WIFI, &presenceHandler));
+                OC_MULTICAST_IP, "core.light", CT_DEFAULT, &presenceHandler));
         EXPECT_EQ(OC_STACK_OK, OCPlatform::unsubscribePresence(presenceHandle));
     }
 
@@ -712,13 +830,163 @@ namespace OCPlatformTest
         EXPECT_ANY_THROW(OCPlatform::unsubscribePresence(presenceHandle));
     }
 
-    TEST(SubscribePresenceTest, UnsubscribePresenceWithValidHandle)
+    TEST(SubscribePresenceTest, DISABLED_UnsubscribePresenceWithValidHandle)
     {
         OCPlatform::OCPresenceHandle presenceHandle = nullptr;
 
         EXPECT_EQ(OC_STACK_OK, OCPlatform::subscribePresence(presenceHandle,
-                OC_MULTICAST_IP, OC_WIFI, &presenceHandler));
+                OC_MULTICAST_IP, CT_DEFAULT, &presenceHandler));
         EXPECT_EQ(OC_STACK_OK, OCPlatform::unsubscribePresence(presenceHandle));
     }
 
+#ifdef WITH_CLOUD
+    //SubscribeDevicePresence Test
+    TEST(SubscribeDevicePresenceTest, DISABLED_SubscribeDevicePresenceWithValidParameters)
+    {
+        std::string hostAddress = "192.168.1.2:5000";
+        OCPlatform::OCPresenceHandle presenceHandle = nullptr;
+        QueryParamsList queryParams = {};
+
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::subscribeDevicePresence(presenceHandle,
+                hostAddress, queryParams, CT_DEFAULT, &onObserve));
+    }
+
+    TEST(SubscribeDevicePresenceTest, SubscribeDevicePresenceWithNullHost)
+    {
+        OCPlatform::OCPresenceHandle presenceHandle = nullptr;
+        QueryParamsList queryParams = {};
+
+        EXPECT_ANY_THROW(OCPlatform::subscribeDevicePresence(presenceHandle,
+                        nullptr, queryParams, CT_DEFAULT, &onObserve));
+    }
+
+    TEST(SubscribeDevicePresenceTest, SubscribeDevicePresenceWithNullOnObserve)
+    {
+        std::string hostAddress = "192.168.1.2:5000";
+        OCPlatform::OCPresenceHandle presenceHandle = nullptr;
+        QueryParamsList queryParams = {};
+
+        EXPECT_ANY_THROW(OCPlatform::subscribeDevicePresence(presenceHandle,
+                        hostAddress, queryParams, CT_DEFAULT, NULL));
+    }
+
+    TEST(SubscribeDevicePresenceTest, DISABLED_UnsubscribePresenceWithValidHandle)
+    {
+        std::string hostAddress = "192.168.1.2:5000";
+        OCPlatform::OCPresenceHandle presenceHandle = nullptr;
+        QueryParamsList queryParams = {};
+
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::subscribeDevicePresence(presenceHandle,
+                hostAddress, queryParams, CT_DEFAULT, &onObserve));
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::unsubscribePresence(presenceHandle));
+    }
+#endif
+
+    TEST(FindDirectPairingTest, FindDirectPairingNullCallback)
+    {
+        EXPECT_ANY_THROW(OCPlatform::findDirectPairingDevices(1, nullptr));
+    }
+
+    TEST(FindDirectPairingTest, FindDirectPairingZeroTimeout)
+    {
+        EXPECT_ANY_THROW(OCPlatform::findDirectPairingDevices(0, &pairedHandler));
+    }
+
+    TEST(GetDirectPairedTest, GetDirectPairedNullCallback)
+    {
+        EXPECT_ANY_THROW(OCPlatform::getDirectPairedDevices(nullptr));
+    }
+
+    TEST(DoDirectPairingTest, DoDirectPairingNullCallback)
+    {
+        OCDPDev_t peer;
+        OCPrm_t pmSel = DP_PRE_CONFIGURED;
+        std::string pin("");
+        std::shared_ptr<OCDirectPairing> s_dp(new OCDirectPairing(&peer));
+        EXPECT_ANY_THROW(OCPlatform::doDirectPairing(s_dp, pmSel, pin, nullptr));
+    }
+
+    TEST(DoDirectPairingTest, DoDirectPairingNullPeer)
+    {
+        OCDPDev_t peer;
+        OCPrm_t pmSel = DP_PRE_CONFIGURED;
+        std::string pin("");
+        std::shared_ptr<OCDirectPairing> s_dp(new OCDirectPairing(&peer));
+        EXPECT_ANY_THROW(OCPlatform::doDirectPairing(nullptr, pmSel, pin, &directPairHandler));
+    }
+
+    TEST(DoDirectPairingTest, DoDirectPairingNullPeerNullCallback)
+    {
+        OCDPDev_t peer;
+        OCPrm_t pmSel = DP_PRE_CONFIGURED;
+        std::string pin("");
+        std::shared_ptr<OCDirectPairing> s_dp(new OCDirectPairing(&peer));
+        EXPECT_ANY_THROW(OCPlatform::doDirectPairing(nullptr, pmSel, pin, nullptr));
+    }
+#ifdef WITH_CLOUD
+    //SignUp Test
+    TEST(SignUpTest, DISABLED_SignUpWithValidParameters)
+    {
+        std::string host("coap+tcp://192.168.1.2:5000");
+        std::string authProvider("AnyAuthProvider");
+        std::string authCode("AnyAuthCode");
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::signUp(host, authProvider, authCode,
+                                                  CT_DEFAULT, &accountHandler));
+    }
+
+    TEST(SignUpTest, SignUpWithNullCallback)
+    {
+        std::string host("coap+tcp://192.168.1.2:5000");
+        std::string authProvider("AnyAuthProvider");
+        std::string authCode("AnyAuthCode");
+        EXPECT_ANY_THROW(OCPlatform::signUp(host, authProvider, authCode, CT_DEFAULT, nullptr));
+    }
+
+    //SignIn Test
+    TEST(SignInTest, DISABLED_SignInWithValidParameters)
+    {
+        std::string host("coap+tcp://192.168.1.2:5000");
+        std::string accessToken("AnyAccessToken");
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::signIn(host, accessToken, CT_DEFAULT, &accountHandler));
+    }
+
+    TEST(SignInTest, SignInWithNullCallback)
+    {
+        std::string host("coap+tcp://192.168.1.2:5000");
+        std::string accessToken("AnyAccessToken");
+        EXPECT_ANY_THROW(OCPlatform::signIn(host, accessToken, CT_DEFAULT, nullptr));
+    }
+
+    //SignOut Test
+    TEST(SignOutTest, DISABLED_SignOutWithValidParameters)
+    {
+        std::string host("coap+tcp://192.168.1.2:5000");
+        std::string accessToken("AnyAccessToken");
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::signOut(host, accessToken,
+                                                   CT_DEFAULT, &accountHandler));
+    }
+
+    TEST(SignOutTest, SignOutWithNullCallback)
+    {
+        std::string host("coap+tcp://192.168.1.2:5000");
+        std::string accessToken("AnyAccessToken");
+        EXPECT_ANY_THROW(OCPlatform::signOut(host, accessToken, CT_DEFAULT, nullptr));
+    }
+
+    //RefreshAccessToken Test
+    TEST(RefreshAccessTokenTest, DISABLED_RefreshAccessTokenWithValidParameters)
+    {
+        std::string host("coap+tcp://192.168.1.2:5000");
+        std::string refreshToken("AnyRefreshToken");
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::refreshAccessToken(host, refreshToken,
+                                                              CT_DEFAULT, &accountHandler));
+    }
+
+    TEST(RefreshAccessTokenTest, RefreshAccessTokenWithNullCallback)
+    {
+        std::string host("coap+tcp://192.168.1.2:5000");
+        std::string refreshToken("AnyRefreshToken");
+        EXPECT_ANY_THROW(OCPlatform::refreshAccessToken(host, refreshToken, CT_DEFAULT, nullptr));
+    }
+#endif // WITH_CLOUD
 }