[MobApp,ServiceSide] Device Management APIs stubs
authorDmytro Logachev <d.logachev@samsung.com>
Mon, 24 Apr 2017 13:38:56 +0000 (16:38 +0300)
committerDmytro Logachev <d.logachev@samsung.com>
Mon, 24 Apr 2017 13:38:56 +0000 (16:38 +0300)
13 files changed:
iot-manager-service/inc/device.h [new file with mode: 0644]
iot-manager-service/inc/i_model_observer.h [new file with mode: 0644]
iot-manager-service/inc/i_presenter.h
iot-manager-service/inc/i_view.h
iot-manager-service/inc/model.h
iot-manager-service/inc/presenter.h
iot-manager-service/inc/utils/json_utils.h [new file with mode: 0644]
iot-manager-service/inc/web_view.h
iot-manager-service/src/json_utils.cpp [new file with mode: 0644]
iot-manager-service/src/model.cpp
iot-manager-service/src/presenter.cpp
iot-manager-service/src/web_view.cpp
iot-manager-service/tests/web_view_test/web_view_tests.cpp

diff --git a/iot-manager-service/inc/device.h b/iot-manager-service/inc/device.h
new file mode 100644 (file)
index 0000000..f07f3c1
--- /dev/null
@@ -0,0 +1,98 @@
+/**
+    @device.h
+    @brief 
+    @author Dmytro Logachev (d.logachev@samsung.com)
+    @date Created Apr 24, 2017
+    @par In Samsung Ukraine R&D Center (SRK) under a contract between
+    @par LLC "Samsung Electronics Ukraine Company" (Kyiv, Ukraine)
+    @par and "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
+    @par Copyright: (c) Samsung Electronics Co, Ltd 2017. All rights reserved.
+**/
+
+#ifndef IOT_SWC_DEVICE_H_
+#define IOT_SWC_DEVICE_H_
+
+#include <string>
+#include <vector>
+#include <memory>
+
+namespace iotswsec
+{
+class Device
+{
+public:
+    Device(const std::string& id = std::string(), const std::string& name = std::string(),
+           const std::string& type = std::string(),
+           const std::string& description = std::string(), int status = 0):
+        m_id(id),
+        m_name(name),
+        m_type(type),
+        m_description(description),
+        m_status(status)
+    {}
+
+    const std::string& GetDescription() const
+    {
+        return m_description;
+    }
+
+    void SetDescription(const std::string& description)
+    {
+        m_description = description;
+    }
+
+    const std::string& GetId() const
+    {
+        return m_id;
+    }
+
+    void SetId(const std::string& id)
+    {
+        m_id = id;
+    }
+
+    const std::string& GetName() const
+    {
+        return m_name;
+    }
+
+    void SetName(const std::string& name)
+    {
+        m_name = name;
+    }
+
+    const std::string& GetType() const
+    {
+        return m_type;
+    }
+
+    void SetType(const std::string& type)
+    {
+        m_type = type;
+    }
+
+    int GetStatus() const
+    {
+        return m_status;
+    }
+
+    void SetStatus(int status)
+    {
+        m_status = status;
+    }
+
+private:
+    std::string m_id;
+    std::string m_name;
+    std::string m_type;
+    std::string m_description;
+    int m_status;
+};
+
+using DevicePtr = std::shared_ptr<Device>;
+using DeviceList = std::vector<DevicePtr>;
+
+}
+
+
+#endif /* IOT_SWC_DEVICE_H_ */
diff --git a/iot-manager-service/inc/i_model_observer.h b/iot-manager-service/inc/i_model_observer.h
new file mode 100644 (file)
index 0000000..9fbdf5e
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+    @i_model_observer.h
+    @brief Contains declaraion of interface for model observer.
+    @author Dmytro Logachev (d.logachev@samsung.com)
+    @date Created Apr 19, 2017
+    @par In Samsung Ukraine R&D Center (SRK) under a contract between
+    @par LLC "Samsung Electronics Ukraine Company" (Kyiv, Ukraine)
+    @par and "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
+    @par Copyright: (c) Samsung Electronics Co, Ltd 2017. All rights reserved.
+**/
+
+#ifndef I_MODEL_OBSERVER_H_
+#define I_MODEL_OBSERVER_H_
+
+#include "common_types.h"
+
+#include <memory>
+
+namespace iotswsec
+{
+
+class IModelObserver
+{
+public:
+
+    virtual ~IModelObserver(){}
+
+    virtual void UpdateSessionState(SessionState) = 0;
+    //TODO: define interface for other functions
+
+};
+
+using IModelObserverWPtr = std::weak_ptr<IModelObserver>;
+
+} //namespave iotswsec
+
+#endif /* I_MODEL_OBSERVER_H_ */
index 7936e10..9cfa832 100644 (file)
@@ -16,6 +16,7 @@
 #include "common_types.h"
 
 #include <memory>
+#include "device.h"
 
 namespace iotswsec
 {
@@ -33,6 +34,14 @@ public:
 
     virtual SessionState GetSessionState() = 0;
 
+    virtual DeviceList GetOwnedDeviceList() = 0;
+
+    virtual DeviceList GetUnownedDeviceList() = 0;
+
+    virtual ErrorCode UnownDevice(const std::string& deviceId) = 0;
+
+    virtual ErrorCode OwnDevice(const std::string& deviceId) = 0;
+
 private:
 };
 
index eceb7c3..40d752e 100644 (file)
@@ -12,6 +12,7 @@
 #ifndef IOTSWC_I_VIEW_H_
 #define IOTSWC_I_VIEW_H_
 
+#include <string>
 #include <memory>
 #include <vector>
 
@@ -24,8 +25,13 @@ namespace iotswsec
 class IView
 {
 public:
-    //TODO: define interface of this function;
-    virtual void Update() = 0;
+
+    /**
+        @brief This function is used to notify View about update.
+        @param[in] command - describes target to be updated.
+        @param[in] message - contains extra information of update.
+    */
+    virtual void Update(const std::string& command, const std::string& message) = 0;
 
     virtual ~IView()
     {}
index 9a53972..bdfd2ab 100644 (file)
 
 #include "common_types.h"
 #include "userinfo.h"
+#include "i_model_observer.h"
 
 #include <memory>
+#include <vector>
 
 namespace iotswsec
 {
@@ -23,7 +25,8 @@ class Model
 {
 public:
     Model():
-        m_sessionState(false)
+        m_sessionState(false),
+        m_observers()
     {}
 
     virtual ~Model()
@@ -34,8 +37,14 @@ public:
     virtual ErrorCode LogOut();
 
     virtual SessionState GetSessionState();
+
+    using ModelObserversList = std::vector<IModelObserverWPtr>;
+
+    virtual void AddObserver(IModelObserverWPtr observer);
+
 private:
     bool m_sessionState;
+    ModelObserversList m_observers;
 };
 
 typedef std::shared_ptr<Model>  ModelPtr;
index 4c21247..1e0d6ce 100644 (file)
 #define IOTSWC_PRESENTER_H_
 
 #include "i_presenter.h"
+#include "i_model_observer.h"
 #include "i_view.h"
 #include "model.h"
 
 namespace iotswsec
 {
 
-class Presenter : public IPresenter, /*public IModelObserver,*/ public std::enable_shared_from_this<Presenter>
+class Presenter : public IPresenter, public IModelObserver, public std::enable_shared_from_this<Presenter>
 {
 public:
     Presenter():
@@ -44,6 +45,17 @@ public:
     ErrorCode LogOut() override;
 
     SessionState GetSessionState() override;
+
+    void UpdateSessionState(SessionState) override;
+
+    DeviceList GetOwnedDeviceList() override;
+
+    DeviceList GetUnownedDeviceList() override;
+
+    ErrorCode UnownDevice(const std::string& deviceId) override;
+
+    ErrorCode OwnDevice(const std::string& deviceId) override;
+
 private:
     ModelPtr m_model;
     ViewList m_views;
diff --git a/iot-manager-service/inc/utils/json_utils.h b/iot-manager-service/inc/utils/json_utils.h
new file mode 100644 (file)
index 0000000..c42cefb
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+    @json_utils.h
+    @brief 
+    @author Dmytro Logachev (d.logachev@samsung.com)
+    @date Created Apr 24, 2017
+    @par In Samsung Ukraine R&D Center (SRK) under a contract between
+    @par LLC "Samsung Electronics Ukraine Company" (Kyiv, Ukraine)
+    @par and "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
+    @par Copyright: (c) Samsung Electronics Co, Ltd 2017. All rights reserved.
+**/
+
+#ifndef UTILS_JSON_UTILS_H_
+#define UTILS_JSON_UTILS_H_
+
+#include "device.h"
+#include "JSONOptions.h"
+#include "libjson.h"
+#include "_internal/Source/JSONNode.h"
+
+namespace iotswsec
+{
+
+JSONNode ToJson(const DevicePtr& device);
+
+JSONNode ToJson(const DeviceList& deviceList);
+
+}
+
+
+#endif /* UTILS_JSON_UTILS_H_ */
index c560cba..46e0462 100644 (file)
@@ -16,6 +16,8 @@
 #include "i_view.h"
 #include "i_presenter.h"
 
+#include "JSONOptions.h"
+#include "libjson.h"
 #include "_internal/Source/JSONNode.h"
 #include <string>
 #include <unordered_map>
@@ -37,7 +39,7 @@ public:
     WebView(const IPresenterPtr& presenter, UpdateCallback updateCallback);
 
     //IView implementation.
-    void Update() override;
+    void Update(const std::string& command, const std::string& message) override;
 
     /**
         @brief Processes request from UI.
@@ -64,6 +66,18 @@ public:
     MessageProcessResult GetSessionState(const JSONNode& request, JSONNode& response,
             std::string& errDescription) const;
 
+    MessageProcessResult GetOwnedDevices(const JSONNode& request, JSONNode& response,
+            std::string& errDescription) const;
+
+    MessageProcessResult GetUnownedDevices(const JSONNode& request, JSONNode& response,
+            std::string& errDescription) const;
+
+    MessageProcessResult OwnDevice(const JSONNode& request, JSONNode& response,
+            std::string& errDescription) const;
+
+    MessageProcessResult UnownDevice(const JSONNode& request, JSONNode& response,
+            std::string& errDescription) const;
+
 private:
 
     typedef std::unordered_map<std::string, Callback> CallbackMap;
diff --git a/iot-manager-service/src/json_utils.cpp b/iot-manager-service/src/json_utils.cpp
new file mode 100644 (file)
index 0000000..d263683
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+    @json_utils.cpp
+    @brief 
+    @author Dmytro Logachev (d.logachev@samsung.com)
+    @date Created Apr 24, 2017
+    @par In Samsung Ukraine R&D Center (SRK) under a contract between
+    @par LLC "Samsung Electronics Ukraine Company" (Kyiv, Ukraine)
+    @par and "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
+    @par Copyright: (c) Samsung Electronics Co, Ltd 2017. All rights reserved.
+**/
+
+#include "utils/json_utils.h"
+
+namespace iotswsec
+{
+
+JSONNode ToJson(const DevicePtr& device)
+{
+    JSONNode json(JSON_NODE);
+
+    json.push_back(JSONNode("id", device->GetId()));
+    json.push_back(JSONNode("name", device->GetName()));
+    json.push_back(JSONNode("type", device->GetType()));
+    json.push_back(JSONNode("status", device->GetStatus()));
+    json.push_back(JSONNode("description", device->GetDescription()));
+
+    return json;
+}
+
+JSONNode ToJson(const DeviceList& deviceList)
+{
+    JSONNode json(JSON_ARRAY);
+
+    for (const auto& device : deviceList)
+    {
+        json.push_back(ToJson(device));
+    }
+
+    return json;
+}
+
+}
+
index 568796d..c5409bf 100644 (file)
@@ -16,6 +16,7 @@ namespace iotswsec
 
 ErrorCode Model::LogIn(const UserInfo& userInfo, const std::string& psswd)
 {
+    //TODO: implement
     if (userInfo.GetUserLogin().compare("iotgod")
         || psswd.compare("1234"))
     {
@@ -28,6 +29,7 @@ ErrorCode Model::LogIn(const UserInfo& userInfo, const std::string& psswd)
 
 ErrorCode Model::LogOut()
 {
+    //TODO: implement
     if (!m_sessionState)
     {
        return ErrorCode::NotLoggedIn;
@@ -43,5 +45,10 @@ SessionState Model::GetSessionState()
     return m_sessionState ? SessionState::Open : SessionState::Closed;
 }
 
+void Model::AddObserver(IModelObserverWPtr observer)
+{
+    m_observers.push_back(observer);
+}
+
 }
 
index 384856d..bc7762e 100644 (file)
@@ -42,4 +42,39 @@ SessionState Presenter::GetSessionState()
 {
     return m_model->GetSessionState();
 }
+
+void Presenter::UpdateSessionState(SessionState sessionState)
+{
+}
+
+DeviceList Presenter::GetOwnedDeviceList()
+{
+    //TODO: implement this function here and on model side.
+
+    DeviceList list({std::make_shared<Device>("123456789", "My TV", "smart-tv", "TV device", 0),
+                    std::make_shared<Device>("1234567890", "My Smartphone", "smartphone", "Smartphone device", 1)});
+
+    return list;
+}
+
+DeviceList Presenter::GetUnownedDeviceList()
+{
+    //TODO: implement this function here and on model side.
+
+    DeviceList list({std::make_shared<Device>("123456789", "My TV", "smart-tv", "TV device", 0),
+                    std::make_shared<Device>("1234567890", "My Smartphone", "smartphone", "Smartphone device", 1)});
+
+    return list;
+}
+
+ErrorCode Presenter::UnownDevice(const std::string& deviceId)
+{
+    return ErrorCode::Success;
+}
+
+ErrorCode Presenter::OwnDevice(const std::string& deviceId)
+{
+    return ErrorCode::Success;
+}
+
 }
index c4451d9..e0a039e 100644 (file)
 #include "web_view.h"
 #include "utils/to_string.h"
 #include "utils/log.h"
+#include "utils/json_utils.h"
 
 namespace iotswsec
 {
 
 //Command names:
-const std::string LogInCommand        = "Authorization.login";
-const std::string LogOutCommand       = "Authorization.logout";
-const std::string SessionStateCommand = "Authorization.session.get";
+const std::string LogInCommand              = "Authorization.login";
+const std::string LogOutCommand             = "Authorization.logout";
+const std::string SessionStateCommand       = "Authorization.session.get";
+const std::string GetOwnedDevicesCommand    = "devices.owned.get";
+const std::string GetUnownedDevicesCommand  = "devices.unowned.get";
+const std::string OwnDeviceCommand          = "devices.owned.add";
+const std::string UnownDeviceCommand        = "devices.owned.remove";
 
 //node names:
 const std::string ErrorCodeNodeName           = "error_code";
@@ -39,18 +44,29 @@ WebView::WebView(const IPresenterPtr& presenter, UpdateCallback updateCallback):
     m_updateCallback(updateCallback)
 {
     Callback logInCallback = std::bind(&WebView::LogIn, this, std::placeholders::_1,
-             std::placeholders::_2, std::placeholders::_3);
+            std::placeholders::_2, std::placeholders::_3);
     RegisterCallback(LogInCommand, logInCallback);
     Callback logOutCallback = std::bind(&WebView::LogOut, this, std::placeholders::_1,
-                 std::placeholders::_2, std::placeholders::_3);
+            std::placeholders::_2, std::placeholders::_3);
     RegisterCallback(LogOutCommand, logOutCallback);
     Callback getSessionStateCallback = std::bind(&WebView::GetSessionState, this, std::placeholders::_1,
-                     std::placeholders::_2, std::placeholders::_3);
+            std::placeholders::_2, std::placeholders::_3);
     RegisterCallback(SessionStateCommand, getSessionStateCallback);
-
+    Callback getOwnedDevicesCallback = std::bind(&WebView::GetOwnedDevices, this, std::placeholders::_1,
+            std::placeholders::_2, std::placeholders::_3);
+    RegisterCallback(GetOwnedDevicesCommand, getOwnedDevicesCallback);
+    Callback getUnownedDevicesCallback = std::bind(&WebView::GetUnownedDevices, this, std::placeholders::_1,
+            std::placeholders::_2, std::placeholders::_3);
+    RegisterCallback(GetUnownedDevicesCommand, getUnownedDevicesCallback);
+    Callback ownDeviceCallback = std::bind(&WebView::OwnDevice, this, std::placeholders::_1,
+            std::placeholders::_2, std::placeholders::_3);
+    RegisterCallback(OwnDeviceCommand, ownDeviceCallback);
+    Callback unownDeviceCallback = std::bind(&WebView::UnownDevice, this, std::placeholders::_1,
+            std::placeholders::_2, std::placeholders::_3);
+    RegisterCallback(UnownDeviceCommand, unownDeviceCallback);
 }
 
-void WebView::Update()
+void WebView::Update(const std::string& command, const std::string& message)
 {}
 
 std::string WebView::ProcessRequest(const std::string& command, const JSONNode& attachedObject)
@@ -183,6 +199,109 @@ MessageProcessResult WebView::GetSessionState(const JSONNode& request, JSONNode&
     return MessageProcessResult::Success;
 }
 
+MessageProcessResult WebView::GetOwnedDevices(const JSONNode& request,
+        JSONNode& response, std::string& errDescription) const
+{
+    //Expected JSON:
+    // {}
+    //Expected response:
+    // "devices" : [{"id":"123456789","name":"My TV","type":"smart-tv","status":0,"description":"TV device"},
+    //              {"id":"1234567890","name":"My Smartphone","type":"smartphone","status":1,
+    //               "description":"Smartphone device"}]
+    IPresenterPtr presenter = m_presenter.lock();
+
+    if (!presenter)
+    {
+        return MessageProcessResult::ErrorInternalConnectionFailed;
+    }
+
+    response.push_back(SetJSONNodeName("devices", ToJson(presenter->GetOwnedDeviceList())));
+
+    return MessageProcessResult::Success;
+}
+
+MessageProcessResult WebView::GetUnownedDevices(const JSONNode& request,
+        JSONNode& response, std::string& errDescription) const
+{
+    //Expected JSON:
+    // {}
+    //Expected response:
+    // "devices" : [{"id":"123456789","name":"My TV","type":"smart-tv","status":0,"description":"TV device"},
+    //              {"id":"1234567890","name":"My Smartphone","type":"smartphone","status":1,
+    //               "description":"Smartphone device"}]
+    IPresenterPtr presenter = m_presenter.lock();
+
+    if (!presenter)
+    {
+        return MessageProcessResult::ErrorInternalConnectionFailed;
+    }
+
+    response.push_back(SetJSONNodeName("devices", ToJson(presenter->GetUnownedDeviceList())));
+
+    return MessageProcessResult::Success;
+}
+
+MessageProcessResult WebView::OwnDevice(const JSONNode& request,
+        JSONNode& response, std::string& errDescription) const
+{
+    //Expected JSON:
+    // {"id":123}
+    //Expected response in case of success:
+    // {"id":123}
+    IPresenterPtr presenter = m_presenter.lock();
+
+    if (!presenter)
+    {
+        return MessageProcessResult::ErrorInternalConnectionFailed;
+    }
+
+    auto iteratorId = request.find("id");
+
+    if (iteratorId == request.end())
+    {
+        return MessageProcessResult::ErrorBadMessageFormat;
+    }
+
+    if (presenter->OwnDevice(iteratorId->as_string()) == ErrorCode::Success)
+    {
+        response.push_back(JSONNode("id", iteratorId->as_string()));
+
+        return MessageProcessResult::Success;
+    }
+
+    return MessageProcessResult::Error;
+}
+
+MessageProcessResult WebView::UnownDevice(const JSONNode& request,
+        JSONNode& response, std::string& errDescription) const
+{
+    //Expected JSON:
+    // "data" : {}
+    //Expected response in case of open session:
+    // "data" : {"state" : 0 }
+    IPresenterPtr presenter = m_presenter.lock();
+
+    if (!presenter)
+    {
+        return MessageProcessResult::ErrorInternalConnectionFailed;
+    }
+
+    auto iteratorId = request.find("id");
+
+    if (iteratorId == request.end())
+    {
+        return MessageProcessResult::ErrorBadMessageFormat;
+    }
+
+    if (presenter->UnownDevice(iteratorId->as_string()) == ErrorCode::Success)
+    {
+        response.push_back(JSONNode("id", iteratorId->as_string()));
+
+        return MessageProcessResult::Success;
+    }
+
+    return MessageProcessResult::Error;
+}
 
 } //namespace iotswsec
 
index a591c4b..612690e 100644 (file)
@@ -37,6 +37,37 @@ public:
     {
         return m_sessionState ? SessionState::Open : SessionState::Closed;
     }
+
+    DeviceList GetOwnedDeviceList() override
+    {
+        //TODO: implement this function here and on model side.
+
+        DeviceList list({std::make_shared<Device>("123456789", "My TV", "smart-tv", "TV device", 0),
+                        std::make_shared<Device>("1234567890", "My Smartphone", "smartphone", "Smartphone device", 1)});
+
+        return list;
+    }
+
+    DeviceList GetUnownedDeviceList() override
+    {
+        //TODO: implement this function here and on model side.
+
+        DeviceList list({std::make_shared<Device>("123456789", "My TV", "smart-tv", "TV device", 0),
+                        std::make_shared<Device>("1234567890", "My Smartphone", "smartphone", "Smartphone device", 1)});
+
+        return list;
+    }
+
+    ErrorCode UnownDevice(const std::string& deviceId) override
+    {
+        return ErrorCode::Success;
+    }
+
+    ErrorCode OwnDevice(const std::string& deviceId) override
+    {
+        return ErrorCode::Success;
+    }
+
 private:
     bool m_sessionState;
 };
@@ -53,8 +84,8 @@ protected:
     void SetUp() override
     {
         presenterPtr = std::make_shared<iotswsec::PresenterMock>();
-        webViewPtr = std::make_shared < iotswsec::WebView
-                > (presenterPtr, WebViewCallbackStub);
+        webViewPtr = std::make_shared<iotswsec::WebView>(presenterPtr,
+                                                         WebViewCallbackStub);
     }
 
     std::shared_ptr<iotswsec::IPresenter> presenterPtr; ///< Pointer to presenter instance
@@ -143,4 +174,58 @@ TEST_F(WebViewTest, GetSessionState2)
     EXPECT_EQ(std::string("{\"state\":0}"), stateResponse.write());
 }
 
+TEST_F(WebViewTest, GetOwnedDevicesTest1)
+{
+    JSONNode ownedGetRequest;
+    JSONNode ownedGetResponse;
+    std::string errDesc;
+    MessageProcessResult result = webViewPtr->GetOwnedDevices(ownedGetRequest, ownedGetResponse, errDesc);
+
+    EXPECT_EQ(MessageProcessResult::Success, result);
+    EXPECT_EQ(std::string(R"({"devices":[{"id":"123456789","name":"My TV","type":"smart-tv","status":0,)"
+                             R"("description":"TV device"},)"
+                             R"({"id":"1234567890","name":"My Smartphone","type":"smartphone","status":1,)"
+                             R"("description":"Smartphone device"}]})"), ownedGetResponse.write());
+}
+
+TEST_F(WebViewTest, GetUnownedDevicesTest1)
+{
+    JSONNode unownedGetRequest;
+    JSONNode unownedGetResponse;
+    std::string errDesc;
+    MessageProcessResult result = webViewPtr->GetUnownedDevices(unownedGetRequest, unownedGetResponse, errDesc);
+
+    EXPECT_EQ(MessageProcessResult::Success, result);
+    EXPECT_EQ(std::string(R"({"devices":[{"id":"123456789","name":"My TV","type":"smart-tv","status":0,)"
+                             R"("description":"TV device"},)"
+                             R"({"id":"1234567890","name":"My Smartphone","type":"smartphone","status":1,)"
+                             R"("description":"Smartphone device"}]})"), unownedGetResponse.write());
+}
+
+TEST_F(WebViewTest, OwnDeviceTest1)
+{
+    JSONNode ownRequest;
+    JSONNode ownResponse;
+    std::string errDesc;
+    const std::string id("123");
+    ownRequest.push_back(JSONNode("id", id));
+    MessageProcessResult result = webViewPtr->OwnDevice(ownRequest, ownResponse, errDesc);
+
+    EXPECT_EQ(MessageProcessResult::Success, result);
+    EXPECT_EQ(std::string(R"({"id":")" + id + R"("})"), ownResponse.write());
+}
+
+TEST_F(WebViewTest, UnownDeviceTest1)
+{
+    JSONNode unownRequest;
+    JSONNode unownResponse;
+    std::string errDesc;
+    const std::string id("123");
+    unownRequest.push_back(JSONNode("id", id));
+    MessageProcessResult result = webViewPtr->UnownDevice(unownRequest, unownResponse, errDesc);
+
+    EXPECT_EQ(MessageProcessResult::Success, result);
+    EXPECT_EQ(std::string(R"({"id":")" + id + R"("})"), unownResponse.write());
+}
+
 } //namespace iotswsec