Fix setPropertyValue and getPropertyValue
authorHabib Virji <habib.virji@samsung.com>
Thu, 5 Jan 2017 14:47:13 +0000 (14:47 +0000)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Tue, 10 Jan 2017 03:28:13 +0000 (03:28 +0000)
Fix an issue in setPropertyValue for not able to set dmv value.
Return value of getPropertyValue fixed.

BUG:https://jira.iotivity.org/browse/IOT-1724
BUG:https://jira.iotivity.org/browse/IOT-1725
Change-Id: I118c48b70ae6605a8ca19a292411898e7f5fa74d
Signed-off-by: Habib Virji <habib.virji@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16163
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
resource/csdk/stack/src/ocresource.c
resource/csdk/stack/test/stacktests.cpp
resource/examples/simpleserver.cpp
resource/include/IServerWrapper.h
resource/include/InProcServerWrapper.h
resource/include/OCPlatform.h
resource/include/OCPlatform_impl.h
resource/src/InProcServerWrapper.cpp
resource/src/OCPlatform.cpp
resource/src/OCPlatform_impl.cpp
resource/unittests/OCPlatformTest.cpp

index 3fd84f5..614c1ac 100755 (executable)
@@ -1469,7 +1469,6 @@ exit:
 
 OCStackResult OCSetDeviceInfo(OCDeviceInfo info)
 {
-    OCStringLL *dataModelVersion = NULL;
     OCResource *resource = FindResourceByUri(OC_RSRVD_DEVICE_URI);
     if (!resource)
     {
@@ -1498,23 +1497,24 @@ OCStackResult OCSetDeviceInfo(OCDeviceInfo info)
     }
     VERIFY_SUCCESS(OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_SPEC_VERSION, info.specVersion ?
         info.specVersion: OC_SPEC_VERSION));
+
     if (info.dataModelVersions)
     {
-        VERIFY_SUCCESS(OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DATA_MODEL_VERSION, info.dataModelVersions));
+        char *dmv = OCCreateString(info.dataModelVersions);
+        VERIFY_PARAM_NON_NULL(TAG, dmv, "Failed allocating dataModelVersions");
+        OCStackResult r = OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DATA_MODEL_VERSION, dmv);
+        OICFree(dmv);
+        VERIFY_SUCCESS(r);
     }
     else
     {
-        dataModelVersion = OCCreateOCStringLL(OC_DATA_MODEL_VERSION);
-        VERIFY_SUCCESS(OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DATA_MODEL_VERSION, dataModelVersion));
+        VERIFY_SUCCESS(OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DATA_MODEL_VERSION,
+            OC_DATA_MODEL_VERSION));
     }
     OIC_LOG(INFO, TAG, "Device parameter initialized successfully.");
     return OC_STACK_OK;
 
 exit:
-    if (dataModelVersion)
-    {
-        OCFreeOCStringLL(dataModelVersion);
-    }
     return OC_STACK_ERROR;
 }
 
@@ -1550,7 +1550,7 @@ OCStackResult OCGetAttribute(const OCResource *resource, const char *attribute,
 
 OCStackResult OCGetPropertyValue(OCPayloadType type, const char *prop, void **value)
 {
-    if (!prop || *value)
+    if (!prop)
     {
         return OC_STACK_INVALID_PARAM;
     }
@@ -1558,6 +1558,10 @@ OCStackResult OCGetPropertyValue(OCPayloadType type, const char *prop, void **va
     {
         return OC_STACK_INVALID_PARAM;
     }
+    if (*value)
+    {
+        *value = NULL;
+    }
     OCStackResult res =  OC_STACK_NO_RESOURCE;
     if (PAYLOAD_TYPE_DEVICE == type || PAYLOAD_TYPE_PLATFORM == type)
     {
@@ -1608,7 +1612,7 @@ OCStackResult OCSetAttribute(OCResource* resource, const char* attribute, const
     // Fill in the new value.
     if (0 == strcmp(OC_RSRVD_DATA_MODEL_VERSION, attribute))
     {
-        resAttrib->attrValue = CloneOCStringLL((OCStringLL *)value);
+        resAttrib->attrValue = OCCreateOCStringLL((char *)value);
     }
     else
     {
index 9f7acfd..3b401c2 100644 (file)
@@ -306,11 +306,12 @@ TEST(StackStart, SetPlatformInfoWithBadPlatformID)
     itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);
     EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_SERVER));
 
+    char invalidId[] = "myDeviceUUID";
     OCPlatformInfo info =
      {
-         "myDeviceUUID",
-         gManufacturerName,
-         0, 0, 0, 0, 0, 0, 0, 0, 0
+        invalidId,
+        gManufacturerName,
+        0, 0, 0, 0, 0, 0, 0, 0, 0
      };
 
     EXPECT_EQ(OC_STACK_INVALID_PARAM, OCSetPlatformInfo(info));
@@ -512,10 +513,8 @@ TEST(StackStart, SetDeviceInfoAPI)
     EXPECT_EQ(OC_STACK_OK, OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DEVICE_NAME, "Sample"));
     EXPECT_EQ(OC_STACK_OK, OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_SPEC_VERSION, "specVersion"));
     EXPECT_EQ(OC_STACK_OK, OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, "x.org.iotivity.newproperty", "value"));
-    OCStringLL *dataModelVersions = OCCreateOCStringLL("Data Model Version");
-    EXPECT_TRUE(dataModelVersions != NULL);
-    EXPECT_EQ(OC_STACK_OK, OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DATA_MODEL_VERSION, dataModelVersions));
-    OCFreeOCStringLL(dataModelVersions);
+    EXPECT_EQ(OC_STACK_OK, OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DATA_MODEL_VERSION,
+        "Data Model Version"));
     OCResourceHandle handle = OCGetResourceHandleAtUri(OC_RSRVD_DEVICE_URI);
     EXPECT_TRUE(handle != NULL);
     EXPECT_EQ(OC_STACK_OK, OCBindResourceTypeToResource(handle, "oic.wk.tv"));
@@ -531,10 +530,8 @@ TEST(StackStart, GetDeviceInfoAPI)
     EXPECT_EQ(OC_STACK_OK, OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DEVICE_NAME, "Sample"));
     EXPECT_EQ(OC_STACK_OK, OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_SPEC_VERSION, "specVersion"));
     EXPECT_EQ(OC_STACK_OK, OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, "x.org.iotivity.newproperty", "value"));
-    OCStringLL *dataModelVersions = OCCreateOCStringLL("Data Model Version");
-    EXPECT_TRUE(dataModelVersions != NULL);
-    EXPECT_EQ(OC_STACK_OK, OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DATA_MODEL_VERSION, dataModelVersions));
-    OCFreeOCStringLL(dataModelVersions);
+    EXPECT_EQ(OC_STACK_OK, OCSetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DATA_MODEL_VERSION,
+        "Data Model Version"));
     OCResourceHandle handle = OCGetResourceHandleAtUri(OC_RSRVD_DEVICE_URI);
     EXPECT_TRUE(handle != NULL);
     EXPECT_EQ(OC_STACK_OK, OCBindResourceTypeToResource(handle, "oic.wk.tv"));
index ae3897a..24aea45 100644 (file)
@@ -508,13 +508,6 @@ void DeletePlatformInfo()
     delete[] platformInfo.systemTime;
 }
 
-void DeleteDeviceInfo()
-{
-    delete[] deviceInfo.deviceName;
-    delete[] deviceInfo.specVersion;
-    OCFreeOCStringLL(deviceInfo.dataModelVersions);
-}
-
 void DuplicateString(char ** targetString, std::string sourceString)
 {
     *targetString = new char[sourceString.length() + 1];
@@ -542,23 +535,6 @@ OCStackResult SetPlatformInfo(std::string platformID, std::string manufacturerNa
     return OC_STACK_OK;
 }
 
-OCStackResult SetDeviceInfo(std::string deviceName, std::string specVersion, std::string dataModelVersions)
-{
-    DuplicateString(&deviceInfo.deviceName, deviceName);
-
-    if (!specVersion.empty())
-    {
-        DuplicateString(&deviceInfo.specVersion, specVersion);
-    }
-
-    if (!dataModelVersions.empty())
-    {
-        OCResourcePayloadAddStringLL(&deviceInfo.dataModelVersions, dataModelVersions.c_str());
-    }
-
-    return OC_STACK_OK;
-}
-
 void * handleSlowResponse (void *param, std::shared_ptr<OCResourceRequest> pRequest)
 {
     // This function handles slow response case
@@ -660,10 +636,15 @@ int main(int argc, char* argv[])
         return -1;
     }
 
-    result = SetDeviceInfo(deviceName, specVersion, dataModelVersions);
-    OCResourcePayloadAddStringLL(&deviceInfo.types, "oic.wk.d");
-
-    result = OCPlatform::registerDeviceInfo(deviceInfo);
+    result = OCPlatform::setPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DEVICE_NAME, deviceName);
+    result = OCPlatform::setPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_SPEC_VERSION, specVersion);
+    result = OCPlatform::setPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DATA_MODEL_VERSION,
+        dataModelVersions);
+    OCResourceHandle handle = OCGetResourceHandleAtUri(OC_RSRVD_DEVICE_URI);
+    if (handle)
+    {
+        OCBindResourceTypeToResource(handle, "oic.wk.tv");
+    }
 
     if (result != OC_STACK_OK)
     {
@@ -686,7 +667,6 @@ int main(int argc, char* argv[])
         std::cout << "Added Interface and Type" << std::endl;
 
         DeletePlatformInfo();
-        DeleteDeviceInfo();
 
         // A condition variable will free the mutex it is given, then do a non-
         // intensive block until 'notify' is called on it.  In this case, since we
index 112ced6..8aee213 100644 (file)
@@ -75,8 +75,12 @@ namespace OC
 
         virtual OCStackResult sendResponse(const std::shared_ptr<OCResourceResponse> pResponse) = 0;
 
-        virtual OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag, const std::string& value) = 0;
-        virtual OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag, std::string& value) = 0;
+        virtual OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag,
+                    const std::string& value) = 0;
+        virtual OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag,
+                    std::string& value) = 0;
+        virtual OCStackResult getPropertyList(OCPayloadType type, const std::string& tag,
+                    std::vector<std::string>& value) = 0;
 
         virtual OCStackResult stop() = 0;
 
index e5dc0cd..98587d3 100644 (file)
@@ -69,9 +69,12 @@ namespace OC
 
         virtual OCStackResult sendResponse(const std::shared_ptr<OCResourceResponse> pResponse);
 
-        virtual OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag, const std::string& value);
-        virtual OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag, std::string& value);
-
+        virtual OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag,
+                    const std::string& value);
+        virtual OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag,
+                    std::string& value);
+        virtual OCStackResult getPropertyList(OCPayloadType type, const std::string& tag,
+                    std::vector<std::string>& value);
         virtual OCStackResult stop();
 
         virtual OCStackResult start();
index ec8e3aa..1242036 100644 (file)
@@ -196,10 +196,14 @@ namespace OC
                     OCConnectivityType connectivityType, FindResListCallback resourceHandler,
                     FindErrorCallback errorHandler, QualityOfService QoS = QualityOfService::LowQos);
 
-        OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag, const std::string& value);
-        OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag, const std::vector<std::string>& value);
-        OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag, std::string& value);
-        OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag, std::vector<std::string>& value);
+        OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag,
+                    const std::string& value);
+        OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag,
+                    const std::vector<std::string>& value);
+        OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag,
+                    std::string& value);
+        OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag,
+                    std::vector<std::string>& value);
         /**
          * API for Device Discovery
          *
index 6b52693..6e0d9db 100644 (file)
@@ -146,9 +146,14 @@ namespace OC
         OCStackResult getPlatformInfo(const std::string& host, const std::string& platformURI,
                     FindPlatformCallback platformInfoHandler, QualityOfService QoS);
 
-        OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag, const std::string& value);
-        OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag, const std::vector<std::string>& value);
-        OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag, std::string& value);
+        OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag,
+            const std::string& value);
+        OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag,
+            const std::vector<std::string>& value);
+        OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag,
+            std::string& value);
+        OCStackResult getPropertyList(OCPayloadType type, const std::string& tag,
+            std::vector<std::string>& value);
 
         /**
         * This API registers a resource with the server
index 391fc23..54f261d 100644 (file)
@@ -36,6 +36,7 @@
 
 #include <OCApi.h>
 #include <oic_malloc.h>
+#include <oic_string.h>
 #include <OCPlatform.h>
 #include <OCUtilities.h>
 #include "logger.h"
@@ -385,15 +386,44 @@ namespace OC
         return result;
     }
 
-    OCStackResult InProcServerWrapper::getPropertyValue(OCPayloadType type, const std::string& propName,
-        std::string& propValue)
+    OCStackResult InProcServerWrapper::getPropertyValue(OCPayloadType type,
+        const std::string& propName, std::string& propValue)
     {
         auto cLock = m_csdkLock.lock();
         OCStackResult result = OC_STACK_ERROR;
         if (cLock)
         {
             std::lock_guard<std::recursive_mutex> lock(*cLock);
-            result = OCGetPropertyValue(type, propName.c_str(), (void **)propValue.c_str());
+            void *value = NULL;
+            result = OCGetPropertyValue(type, propName.c_str(), &value);
+            if (value && OC_STACK_OK == result)
+            {
+                propValue.assign((const char *)value);
+                OICFree(value);
+            }
+        }
+        return result;
+    }
+
+    OCStackResult InProcServerWrapper::getPropertyList(OCPayloadType type,
+        const std::string& propName, std::vector<std::string>& propValue)
+    {
+        auto cLock = m_csdkLock.lock();
+        OCStackResult result = OC_STACK_ERROR;
+        void *value = NULL;
+        if (cLock)
+        {
+            std::lock_guard<std::recursive_mutex> lock(*cLock);
+            result = OCGetPropertyValue(type, propName.c_str(), &value);
+        }
+
+        if (OC_STACK_OK == result)
+        {
+            for (OCStringLL *tmp = (OCStringLL *)value; tmp; tmp = tmp->next)
+            {
+                propValue.push_back(tmp->value);
+            }
+            OCFreeOCStringLL((OCStringLL *)value);
         }
         return result;
     }
index e05820b..80db44b 100644 (file)
@@ -215,21 +215,30 @@ namespace OC
             return OCPlatform_impl::Instance().registerPlatformInfo(platformInfo);
         }
 
-        OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag, const std::string& value)
+        OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag,
+                                       const std::string& value)
         {
             return OCPlatform_impl::Instance().setPropertyValue(type, tag, value);
         }
 
-        OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag, const std::vector<std::string>& value)
+        OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag,
+                                       const std::vector<std::string>& value)
         {
             return OCPlatform_impl::Instance().setPropertyValue(type, tag, value);
         }
 
-        OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag, std::string& value)
+        OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag,
+                                       std::string& value)
         {
             return OCPlatform_impl::Instance().getPropertyValue(type, tag, value);
         }
 
+        OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag,
+                                       std::vector<std::string>& value)
+        {
+            return OCPlatform_impl::Instance().getPropertyList(type, tag, value);
+        }
+
         OCStackResult unregisterResource(const OCResourceHandle& resourceHandle)
         {
             return OCPlatform_impl::Instance().unregisterResource(resourceHandle);
index 0180b7f..7f7d412 100644 (file)
@@ -377,32 +377,43 @@ namespace OC
         return checked_guard(m_server, &IServerWrapper::registerPlatformInfo, platformInfo);
     }
 
-    OCStackResult OCPlatform_impl::setPropertyValue(OCPayloadType type, const std::string& tag, const std::string& value)
+    OCStackResult OCPlatform_impl::setPropertyValue(OCPayloadType type, const std::string& tag,
+                                                    const std::string& value)
     {
-
         return checked_guard(m_server, &IServerWrapper::setPropertyValue, type, tag, value);
     }
 
-    OCStackResult OCPlatform_impl::setPropertyValue(OCPayloadType type, const std::string& tag, const std::vector<std::string>& value)
+    OCStackResult OCPlatform_impl::setPropertyValue(OCPayloadType type, const std::string& tag,
+                                                    const std::vector<std::string>& value)
     {
+        std::string concatString = "";
         for (const auto& h : value)
         {
-           OCStackResult r;
-
-           if (OC_STACK_OK != (r = result_guard(setPropertyValue(type, tag, h))))
-           {
-               return r;
-           }
+            if (std::string::npos == h.find(","))
+            {
+                concatString += h + ",";
+            }
+            else
+            {
+                return OC_STACK_INVALID_PARAM;
+            }
         }
 
-        return OC_STACK_OK;
+        return checked_guard(m_server, &IServerWrapper::setPropertyValue, type, tag, concatString);
     }
 
-    OCStackResult OCPlatform_impl::getPropertyValue(OCPayloadType type, const std::string& tag, std::string& value)
+    OCStackResult OCPlatform_impl::getPropertyValue(OCPayloadType type, const std::string& tag,
+                                                    std::string& value)
     {
         return checked_guard(m_server, &IServerWrapper::getPropertyValue, type, tag, value);
     }
 
+    OCStackResult OCPlatform_impl::getPropertyList(OCPayloadType type, const std::string& tag,
+                                                    std::vector<std::string>& value)
+    {
+        return checked_guard(m_server, &IServerWrapper::getPropertyList, type, tag, value);
+    }
+
     OCStackResult OCPlatform_impl::registerResource(OCResourceHandle& resourceHandle,
                                             const std::shared_ptr< OCResource > resource)
     {
index 415d9c9..05c497d 100644 (file)
@@ -442,7 +442,7 @@ namespace OCPlatformTest
             BATCH_INTERFACE);
         EXPECT_EQ(OC_STACK_OK, result);
     }
-    
+
 #if defined (_MSC_VER)
     TEST(BindInterfaceToResourceTest, DISABLED_BindZeroResourceInterface)
 #else
@@ -463,7 +463,7 @@ namespace OCPlatformTest
             "core.brightlight");
         EXPECT_EQ(OC_STACK_OK, result);
     }
-    
+
 #if defined (_MSC_VER)
     TEST(BindTypeToResourceTest, DISABLED_BindZeroResourceType)
 #else
@@ -817,6 +817,52 @@ namespace OCPlatformTest
         EXPECT_ANY_THROW(OCPlatform::registerDeviceInfo(di));
     }
 
+    TEST(RegisterDeviceInfoTest, RegisterDeviceInfoWithSetPropertyValue)
+    {
+        std::string deviceName = "myDeviceName";
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::setPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DEVICE_NAME,
+            deviceName));
+        std::string specVersion = "mySpecVersion";
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::setPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_SPEC_VERSION,
+            specVersion));
+        std::vector<std::string> dmv;
+        dmv.push_back("myDataModelVersions");
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::setPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DATA_MODEL_VERSION,
+            dmv));
+        OCResourceHandle handle = OCGetResourceHandleAtUri(OC_RSRVD_DEVICE_URI);
+        ASSERT_TRUE(NULL != handle);
+        EXPECT_EQ(OC_STACK_OK, OCBindResourceTypeToResource(handle, "oic.wk.tv"));
+    }
+
+
+    TEST(RegisterDeviceInfoTest, RegisterDeviceInfoWithGetPropertyValue)
+    {
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::setPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DEVICE_NAME,
+            "myDeviceName"));
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::setPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_SPEC_VERSION,
+            "mySpecVersion"));
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::setPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DATA_MODEL_VERSION,
+            "myDataModelVersions"));
+        OCResourceHandle handle = OCGetResourceHandleAtUri(OC_RSRVD_DEVICE_URI);
+        ASSERT_TRUE(NULL != handle);
+        EXPECT_EQ(OC_STACK_OK, OCBindResourceTypeToResource(handle, "oic.wk.tv"));
+
+        std::string value;
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::getPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DEVICE_NAME,
+            value));
+        EXPECT_STREQ("myDeviceName", value.c_str());
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::getPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_SPEC_VERSION,
+            value));
+        EXPECT_STREQ("mySpecVersion", value.c_str());
+        std::vector<std::string> dmv;
+        EXPECT_EQ(OC_STACK_OK, OCPlatform::getPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DATA_MODEL_VERSION,
+            dmv));
+        EXPECT_STREQ("myDataModelVersions", dmv[0].c_str());
+
+        EXPECT_STREQ("oic.wk.d", OCGetResourceTypeName(handle, 0));
+        EXPECT_STREQ("oic.d.tv", OCGetResourceTypeName(handle, 1));
+        EXPECT_STREQ("oic.wk.tv", OCGetResourceTypeName(handle, 2));
+    }
     //SubscribePresence Test
     TEST(SubscribePresenceTest, DISABLED_SubscribePresenceWithValidParameters)
     {