replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / notification / cpp-wrapper / unittest / NSProviderServiceSimulator.h
index 5d515a3..d7dbee4 100755 (executable)
@@ -124,11 +124,11 @@ class NSProviderSimulator
                         std::string syncUri = m_notificationUri + m_syncUri;
                         std::string topicUri = m_notificationUri + m_topicUri;
                         std::string providerId = "123456789012345678901234567890123456";
-                        rep.setValue("subcontrollability", m_accepter);
-                        rep.setValue("messageuri", msgUri);
-                        rep.setValue("syncuri", syncUri);
-                        rep.setValue("topicuri", topicUri);
-                        rep.setValue("providerid", providerId);
+                        rep.setValue("x.org.iotivity.ns.subcontrollability", m_accepter);
+                        rep.setValue("x.org.iotivity.ns.messageuri", msgUri);
+                        rep.setValue("x.org.iotivity.ns.syncuri", syncUri);
+                        rep.setValue("x.org.iotivity.ns.topicuri", topicUri);
+                        rep.setValue("x.org.iotivity.ns.providerid", providerId);
                     }
                     else if (type == requestType::NS_SYNC)
                     {
@@ -158,14 +158,14 @@ class NSProviderSimulator
                                        [& topicArr](const NS_TopicState & topicState)
                         {
                             OC::OCRepresentation topic;
-                            topic.setValue("topicname", topicState.first);
-                            topic.setValue("topicstate", (int) topicState.second);
+                            topic.setValue("x.org.iotivity.ns.topicname", topicState.first);
+                            topic.setValue("x.org.iotivity.ns.topicstate", (int) topicState.second);
                             topicArr.push_back(topic);
                         }
                                       );
 
                         rep.setValue<std::vector<OC::OCRepresentation>>
-                                ("topiclist", topicArr);
+                                ("x.org.iotivity.ns.topiclist", topicArr);
                     }
                     else
                     {
@@ -183,8 +183,8 @@ class NSProviderSimulator
                         m_syncRep = requests->getResourceRepresentation();
 
                         std::cout << "Receive POST for Sync" << std::endl;
-                        std::cout << "provider Id : " << m_syncRep.getValueToString("providerid") << std::endl;
-                        std::cout << "Sync State : " << m_syncRep.getValueToString("state") << std::endl;
+                        std::cout << "provider Id : " << m_syncRep.getValueToString("x.org.iotivity.ns.providerid") << std::endl;
+                        std::cout << "Sync State : " << m_syncRep.getValueToString("x.org.iotivity.ns.state") << std::endl;
 
                         response->setResourceRepresentation(m_syncRep);
 
@@ -196,15 +196,15 @@ class NSProviderSimulator
                     {
                         auto receivePayload =
                             requests->getResourceRepresentation()
-                            .getValue<std::vector<OC::OCRepresentation>>("topiclist");
+                            .getValue<std::vector<OC::OCRepresentation>>("x.org.iotivity.ns.topiclist");
 
                         std::for_each (receivePayload.begin(), receivePayload.end(),
                                        [this](const OC::OCRepresentation & rep)
                         {
-                            auto tmp = m_allowedTopicList.find(rep.getValueToString("topicname"));
+                            auto tmp = m_allowedTopicList.find(rep.getValueToString("x.org.iotivity.ns.topicname"));
                             if (tmp != m_allowedTopicList.end())
                             {
-                                tmp->second = (TopicAllowState) rep.getValue<int>("topicstate");
+                                tmp->second = (TopicAllowState) rep.getValue<int>("x.org.iotivity.ns.topicstate");
                             }
                         }
                                       );
@@ -235,8 +235,8 @@ class NSProviderSimulator
             {
                 OC::OCRepresentation rep;
                 std::string providerId = "123456789012345678901234567890123456";
-                rep.setValue<int>("messageid", (int)messageType::NS_ALLOW);
-                rep.setValue("providerid", providerId);
+                rep.setValue<int>("x.org.iotivity.ns.messageid", (int)messageType::NS_ALLOW);
+                rep.setValue("x.org.iotivity.ns.providerid", providerId);
 
                 auto response = std::make_shared<OC::OCResourceResponse>();
                 response->setRequestHandle(requests->getRequestHandle());
@@ -308,27 +308,27 @@ class NSProviderSimulator
         void sendRead(const uint64_t &id)
         {
             std::string providerId = "123456789012345678901234567890123456";
-            m_syncRep.setValue<int>("messageid", id);
-            m_syncRep.setValue("state", (int)1);
-            m_syncRep.setValue("providerid", providerId);
+            m_syncRep.setValue<int>("x.org.iotivity.ns.messageid", id);
+            m_syncRep.setValue("x.org.iotivity.ns.state", (int)1);
+            m_syncRep.setValue("x.org.iotivity.ns.providerid", providerId);
             OC::OCPlatform::notifyAllObservers(m_syncHandle);
         }
         void sendDismiss(const uint64_t &id)
         {
             std::string providerId = "123456789012345678901234567890123456";
-            m_syncRep.setValue<int>("messageid", id);
-            m_syncRep.setValue("state", (int)2);
-            m_syncRep.setValue("providerid", providerId);
+            m_syncRep.setValue<int>("x.org.iotivity.ns.messageid", id);
+            m_syncRep.setValue("x.org.iotivity.ns.state", (int)2);
+            m_syncRep.setValue("x.org.iotivity.ns.providerid", providerId);
             OC::OCPlatform::notifyAllObservers(m_syncHandle);
         }
 
         void setMessage(const uint64_t &id, const std::string &title, const std::string &content)
         {
             std::string providerId = "123456789012345678901234567890123456";
-            m_messageRep.setValue<int>("messageid", id);
-            m_messageRep.setValue("title", title);
-            m_messageRep.setValue("contenttext", content);
-            m_messageRep.setValue("providerid", providerId);
+            m_messageRep.setValue<int>("x.org.iotivity.ns.messageid", id);
+            m_messageRep.setValue("x.org.iotivity.ns.title", title);
+            m_messageRep.setValue("x.org.iotivity.ns.contenttext", content);
+            m_messageRep.setValue("x.org.iotivity.ns.providerid", providerId);
         }
 
         void setTopics(const NS_TopicList &topics)
@@ -400,7 +400,7 @@ class NSProviderSimulator
             OC::OCPlatform::startPresence(30);
 
             std::string notificationUri = m_notificationUri;
-            std::string resourceTypeName = "oic.wk.notification.topic";
+            std::string resourceTypeName = "x.org.iotivity.notification.topic";
             std::string resourceInterface = OC::DEFAULT_INTERFACE;
 
             uint8_t resourceProperty = OC_OBSERVABLE;
@@ -420,7 +420,7 @@ class NSProviderSimulator
             }
 
             //resourceProperty |= OC_OBSERVABLE;
-            resourceTypeName = "oic.wk.notification.message";
+            resourceTypeName = "x.org.iotivity.notification.message";
             childUri = uri + m_messageUri;
             try
             {
@@ -436,7 +436,7 @@ class NSProviderSimulator
                 std::cout << e.what() << std::endl;
             }
 
-            resourceTypeName = "oic.wk.notification.sync";
+            resourceTypeName = "x.org.iotivity.notification.sync";
             childUri = uri + m_syncUri;
             try
             {
@@ -453,7 +453,7 @@ class NSProviderSimulator
             }
 
             resourceProperty |= OC_DISCOVERABLE;
-            resourceTypeName = "oic.wk.notification";
+            resourceTypeName = "x.org.iotivity.notification";
             try
             {
                 OC::OCPlatform::registerResource(