[IoT-1590] Modify attribute key name followed by OCF property naming convention.
authorjaesick.shin <jaesick.shin@samsung.com>
Wed, 23 Nov 2016 09:12:48 +0000 (18:12 +0900)
committerUze Choi <uzchoi@samsung.com>
Mon, 5 Dec 2016 05:01:45 +0000 (05:01 +0000)
All the OCF property should be written as lower case.
So, change the key name of attributes.

second patch include,
removed duplicated NS_QUERY_CONSUMERID.

Change-Id: I2fcc76fac003e805ad19edb0d7ee10c659218b5f
Signed-off-by: jaesick.shin <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14657
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
(cherry picked from commit 421ca0f436ae959caba272030df9b10d3024f788)
Reviewed-on: https://gerrit.iotivity.org/gerrit/15131
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
service/notification/cpp-wrapper/unittest/NSConsumerServiceSimulator.h
service/notification/cpp-wrapper/unittest/NSProviderServiceSimulator.h
service/notification/src/common/NSConstants.h
service/notification/src/common/NSStructs.h
service/notification/src/provider/NSProviderResource.c
service/notification/unittest/NSConsumerSimulator.h
service/notification/unittest/NSProviderSimulator.h

index 6d05f00..054f76c 100755 (executable)
@@ -67,8 +67,8 @@ class NSConsumerSimulator
             }
 
             OC::OCRepresentation rep;
-            rep.setValue("providerId", providerID);
-            rep.setValue("messageId", id);
+            rep.setValue("providerid", providerID);
+            rep.setValue("messageid", id);
             rep.setValue("state", type);
 
             m_syncResource->post(rep, OC::QueryParamsMap(), &onPost, OC::QualityOfService::LowQos);
@@ -115,7 +115,7 @@ class NSConsumerSimulator
         {
 
             OC::QueryParamsMap map;
-            map.insert(std::pair<std::string, std::string>(std::string("consumerId"),
+            map.insert(std::pair<std::string, std::string>(std::string("consumerid"),
                        std::string("123456789012345678901234567890123456")));
 
             try
@@ -160,14 +160,14 @@ class NSConsumerSimulator
                        std::shared_ptr<OC::OCResource> )
         {
 
-            if (rep.getUri() == "/notification/message" && rep.hasAttribute("messageId")
-                && rep.getValue<int>("messageId") != 1)
+            if (rep.getUri() == "/notification/message" && rep.hasAttribute("messageid")
+                && rep.getValue<int>("messageid") != 1)
             {
-                m_messageFunc(int(rep.getValue<int>("messageId")),
+                m_messageFunc(int(rep.getValue<int>("messageid")),
                               std::string(rep.getValueToString("title")),
-                              std::string(rep.getValueToString("contentText")),
+                              std::string(rep.getValueToString("contenttext")),
                               std::string(rep.getValueToString("source")));
-                if (rep.getValue<int>("messageId") == 3)
+                if (rep.getValue<int>("messageid") == 3)
                 {
                     m_topicResource->get(OC::QueryParamsMap(),
                                          std::bind(&NSConsumerSimulator::onTopicGet, this, std::placeholders::_1,
@@ -177,7 +177,7 @@ class NSConsumerSimulator
             }
             else if (rep.getUri() == "/notification/sync")
             {
-                m_syncFunc(int(rep.getValue<int>("state")), int(rep.getValue<int>("messageId")));
+                m_syncFunc(int(rep.getValue<int>("state")), int(rep.getValue<int>("messageid")));
             }
         }
         void onTopicGet(const OC::HeaderOptions &/*headerOption*/,
index f821496..4a7488c 100755 (executable)
@@ -123,11 +123,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("subcontrollability", m_accepter);
+                        rep.setValue("messageuri", msgUri);
+                        rep.setValue("syncuri", syncUri);
+                        rep.setValue("topicuri", topicUri);
+                        rep.setValue("providerid", providerId);
                     }
                     else if (type == requestType::NS_SYNC)
                     {
@@ -157,14 +157,14 @@ class NSProviderSimulator
                                        [& topicArr](const NS_TopicState & topicState)
                         {
                             OC::OCRepresentation topic;
-                            topic.setValue("topicName", topicState.first);
-                            topic.setValue("topicState", (int) topicState.second);
+                            topic.setValue("topicname", topicState.first);
+                            topic.setValue("topicstate", (int) topicState.second);
                             topicArr.push_back(topic);
                         }
                                       );
 
                         rep.setValue<std::vector<OC::OCRepresentation>>
-                                ("topicList", topicArr);
+                                ("topiclist", topicArr);
                     }
                     else
                     {
@@ -182,7 +182,7 @@ 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 << "provider Id : " << m_syncRep.getValueToString("providerid") << std::endl;
                         std::cout << "Sync State : " << m_syncRep.getValueToString("state") << std::endl;
 
                         response->setResourceRepresentation(m_syncRep);
@@ -195,15 +195,15 @@ class NSProviderSimulator
                     {
                         auto receivePayload =
                             requests->getResourceRepresentation()
-                            .getValue<std::vector<OC::OCRepresentation>>("topicList");
+                            .getValue<std::vector<OC::OCRepresentation>>("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("topicname"));
                             if (tmp != m_allowedTopicList.end())
                             {
-                                tmp->second = (TopicAllowState) rep.getValue<int>("topicState");
+                                tmp->second = (TopicAllowState) rep.getValue<int>("topicstate");
                             }
                         }
                                       );
@@ -234,8 +234,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>("messageid", (int)messageType::NS_ALLOW);
+                rep.setValue("providerid", providerId);
 
                 auto response = std::make_shared<OC::OCResourceResponse>();
                 response->setRequestHandle(requests->getRequestHandle());
@@ -306,27 +306,27 @@ class NSProviderSimulator
         void sendRead(const uint64_t &id)
         {
             std::string providerId = "123456789012345678901234567890123456";
-            m_syncRep.setValue<int>("messageId", id);
+            m_syncRep.setValue<int>("messageid", id);
             m_syncRep.setValue("state", (int)1);
-            m_syncRep.setValue("providerId", providerId);
+            m_syncRep.setValue("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<int>("messageid", id);
             m_syncRep.setValue("state", (int)2);
-            m_syncRep.setValue("providerId", providerId);
+            m_syncRep.setValue("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<int>("messageid", id);
             m_messageRep.setValue("title", title);
-            m_messageRep.setValue("contentText", content);
-            m_messageRep.setValue("providerId", providerId);
+            m_messageRep.setValue("contenttext", content);
+            m_messageRep.setValue("providerid", providerId);
         }
 
         void setTopics(const NS_TopicList &topics)
index e83ed34..d22f45c 100644 (file)
@@ -78,7 +78,7 @@
 // NOTIOBJ //
 #define NOTIOBJ_TITLE_KEY          "title"
 #define NOTIOBJ_ID_KEY             "id"
-#define NOTOOBJ_CONTENT_KEY        "contentText"
+#define NOTOOBJ_CONTENT_KEY        "contenttext"
 
 #define DISCOVERY_TAG              "NS_PROVIDER_DISCOVERY"
 #define SUBSCRIPTION_TAG           "NS_PROVIDER_SUBSCRIPTION"
 #define NS_QUERY_SEPARATOR         "&;"
 #define NS_KEY_VALUE_DELIMITER     "="
 
-#define NS_QUERY_CONSUMER_ID       "consumerId"
-#define NS_QUERY_PROVIDER_ID       "providerId"
+#define NS_QUERY_CONSUMER_ID       "consumerid"
+#define NS_QUERY_PROVIDER_ID       "providerid"
 #define NS_QUERY_INTERFACE         "if"
 
 #define NS_QUERY_ID_SIZE           10
 #define VERSION        "1.2.0"
 
 #define NS_ATTRIBUTE_VERSION "version"
-#define NS_ATTRIBUTE_POLICY "subControllability"
-#define NS_ATTRIBUTE_MESSAGE "messageUri"
-#define NS_ATTRIBUTE_SYNC "syncUri"
-#define NS_ATTRIBUTE_TOPIC "topicUri"
-#define NS_ATTRIBUTE_MESSAGE_ID "messageId"
-#define NS_ATTRIBUTE_PROVIDER_ID "providerId"
-#define NS_ATTRIBUTE_CONSUMER_ID "consumerId"
-#define NS_ATTRIBUTE_TOPIC_LIST "topicList"
-#define NS_ATTRIBUTE_TOPIC_NAME "topicName"
-#define NS_ATTRIBUTE_TOPIC_SELECTION "topicState"
+#define NS_ATTRIBUTE_POLICY "subcontrollability"
+#define NS_ATTRIBUTE_MESSAGE "messageuri"
+#define NS_ATTRIBUTE_SYNC "syncuri"
+#define NS_ATTRIBUTE_TOPIC "topicuri"
+#define NS_ATTRIBUTE_MESSAGE_ID "messageid"
+#define NS_ATTRIBUTE_PROVIDER_ID "providerid"
+#define NS_ATTRIBUTE_CONSUMER_ID "consumerid"
+#define NS_ATTRIBUTE_TOPIC_LIST "topiclist"
+#define NS_ATTRIBUTE_TOPIC_NAME "topicname"
+#define NS_ATTRIBUTE_TOPIC_SELECTION "topicstate"
 #define NS_ATTRIBUTE_TITLE "title"
-#define NS_ATTRIBUTE_TEXT "contentText"
+#define NS_ATTRIBUTE_TEXT "contenttext"
 #define NS_ATTRIBUTE_SOURCE "source"
 #define NS_ATTRIBUTE_STATE "state"
 #define NS_ATTRIBUTE_DEVICE "device"
 #define NS_ATTRIBUTE_TYPE "type"
-#define NS_ATTRIBUTE_DATETIME "dateTime"
+#define NS_ATTRIBUTE_DATETIME "datetime"
 #define NS_ATTRIBUTE_TTL "ttl"
-#define NS_ATTRIBUTE_ICON_IMAGE "iconImage"
+#define NS_ATTRIBUTE_ICON_IMAGE "iconimage"
 
 typedef enum eConnectionState
 {
index ceb84a3..4cd67b1 100644 (file)
@@ -133,7 +133,7 @@ typedef struct
 typedef struct\r
 {\r
     OCResourceHandle handle;\r
-    char * id;\r
+    uint64_t messageId;\r
     char providerId[NS_UUID_STRING_SIZE];\r
     char * state;\r
 \r
index 7d0c979..25f0bca 100644 (file)
@@ -158,7 +158,7 @@ NSResult NSCreateResource(char *uri)
     }
     else if (strcmp(uri, NS_COLLECTION_SYNC_URI) == 0)
     {
-        NotificationSyncResource.id = NULL;
+        NotificationSyncResource.messageId = 0;
         (NotificationSyncResource.providerId)[0] = '\0';
         NotificationSyncResource.state = NULL;
         NotificationSyncResource.handle = NULL;
index f3183a9..1a7a8ff 100644 (file)
@@ -67,8 +67,8 @@ public:
         }
 
         OC::OCRepresentation rep;
-        rep.setValue("providerId", providerID);
-        rep.setValue("messageId", id);
+        rep.setValue("providerid", providerID);
+        rep.setValue("messageid", id);
         rep.setValue("state", type);
 
         m_syncResource->post(rep, OC::QueryParamsMap(), &onPost, OC::QualityOfService::LowQos);
@@ -110,7 +110,7 @@ private:
             std::shared_ptr<OC::OCResource> resource)
     {
         OC::QueryParamsMap map;
-        map.insert(std::pair<std::string,std::string>(std::string("consumerId"),
+        map.insert(std::pair<std::string,std::string>(std::string("consumerid"),
                 std::string("123456789012345678901234567890123456")));
 
         try
@@ -155,15 +155,15 @@ private:
             const OC::OCRepresentation &rep , const int & /*eCode*/, const int &,
             std::shared_ptr<OC::OCResource> )
     {
-        if (rep.getUri() == "/notification/message" && rep.hasAttribute("messageId")
-                && rep.getValue<int>("messageId") != 1)
+        if (rep.getUri() == "/notification/message" && rep.hasAttribute("messageid")
+                && rep.getValue<int>("messageid") != 1)
         {
-            m_messageFunc(int(rep.getValue<int>("messageId")),
+            m_messageFunc(int(rep.getValue<int>("messageid")),
                           std::string(rep.getValueToString("title")),
-                          std::string(rep.getValueToString("contentText")),
+                          std::string(rep.getValueToString("contenttext")),
                           std::string(rep.getValueToString("source")));
 
-            if(rep.getValue<int>("messageId") == 3)
+            if(rep.getValue<int>("messageid") == 3)
             {
                 m_topicResource->get(std::string("oic.wk.notification"),
                         std::string("oic.if.baseline"), OC::QueryParamsMap(),
@@ -174,7 +174,7 @@ private:
         }
         else if (rep.getUri() == "/notification/sync")
         {
-            m_syncFunc(int(rep.getValue<int>("state")), int(rep.getValue<int>("messageId")));
+            m_syncFunc(int(rep.getValue<int>("state")), int(rep.getValue<int>("messageid")));
         }
     }
 
@@ -189,7 +189,7 @@ private:
             OC::OCRepresentation postRep;
 
             std::vector<OC::OCRepresentation> topicArr =
-                            rep.getValue<std::vector<OC::OCRepresentation>>("topicList");
+                            rep.getValue<std::vector<OC::OCRepresentation>>("topiclist");
 
             std::vector<OC::OCRepresentation> postTopicArr;
 
@@ -200,8 +200,8 @@ private:
                 OC::OCRepresentation topic = *it;
                 OC::OCRepresentation postTopic;
 
-                postTopic.setValue("topicName", topic.getValueToString("topicName"));
-                postTopic.setValue("topicState", (int) topic.getValue<int>("topicState"));
+                postTopic.setValue("topicname", topic.getValueToString("topicname"));
+                postTopic.setValue("topicstate", (int) topic.getValue<int>("topicstate"));
 
                 postTopicArr.push_back(topic);
 
@@ -210,10 +210,10 @@ private:
             }
 
             postRep.setValue<std::vector<OC::OCRepresentation>>
-                ("topicList", postTopicArr);
+                ("topiclist", postTopicArr);
 
             OC::QueryParamsMap map;
-            map.insert(std::pair<std::string,std::string>(std::string("consumerId"),
+            map.insert(std::pair<std::string,std::string>(std::string("consumerid"),
                     std::string("123456789012345678901234567890123456")));
             m_topicResource->post(postRep, map, &onPost, OC::QualityOfService::LowQos);
         }
index e864abc..8874733 100644 (file)
@@ -123,11 +123,11 @@ private:
                     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("subcontrollability", m_accepter);
+                    rep.setValue("messageuri", msgUri);
+                    rep.setValue("syncuri", syncUri);
+                    rep.setValue("topicuri", topicUri);
+                    rep.setValue("providerid", providerId);
                 }
                 else if (type == requestType::NS_SYNC)
                 {
@@ -157,14 +157,14 @@ private:
                         [& topicArr](const NS_TopicState & topicState)
                         {
                             OC::OCRepresentation topic;
-                            topic.setValue("topicName", topicState.first);
-                            topic.setValue("topicState", (int) topicState.second);
+                            topic.setValue("topicname", topicState.first);
+                            topic.setValue("topicstate", (int) topicState.second);
                             topicArr.push_back(topic);
                         }
                     );
 
                     rep.setValue<std::vector<OC::OCRepresentation>>
-                        ("topicList", topicArr);
+                        ("topiclist", topicArr);
                 }
                 else
                 {
@@ -182,7 +182,7 @@ private:
                     m_syncRep = requests->getResourceRepresentation();
 
                     std::cout << "Receive POST for Sync" << std::endl;
-                    std::cout << "provider Id : " << m_syncRep.getValueToString("providerId") << std::endl;
+                    std::cout << "provider Id : " << m_syncRep.getValueToString("providerid") << std::endl;
                     std::cout << "Sync State : " << m_syncRep.getValueToString("state") << std::endl;
 
                     response->setResourceRepresentation(m_syncRep);
@@ -195,15 +195,15 @@ private:
                 {
                     auto receivePayload =
                             requests->getResourceRepresentation()
-                            .getValue<std::vector<OC::OCRepresentation>>("topicList");
+                            .getValue<std::vector<OC::OCRepresentation>>("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("topicname"));
                               if (tmp != m_allowedTopicList.end())
                               {
-                                  tmp->second = (TopicAllowState) rep.getValue<int>("topicState");
+                                  tmp->second = (TopicAllowState) rep.getValue<int>("topicstate");
                               }
                           }
                     );
@@ -234,8 +234,8 @@ private:
         {
             OC::OCRepresentation rep;
             std::string providerId = "123456789012345678901234567890123456";
-            rep.setValue<int>("messageId", (int)messageType::NS_ALLOW);
-            rep.setValue("providerId", providerId);
+            rep.setValue<int>("messageid", (int)messageType::NS_ALLOW);
+            rep.setValue("providerid", providerId);
 
             auto response = std::make_shared<OC::OCResourceResponse>();
             response->setRequestHandle(requests->getRequestHandle());
@@ -306,27 +306,27 @@ public:
     void sendRead(const uint64_t & id)
     {
         std::string providerId = "123456789012345678901234567890123456";
-        m_syncRep.setValue<int>("messageId", id);
+        m_syncRep.setValue<int>("messageid", id);
         m_syncRep.setValue("state", (int)1);
-        m_syncRep.setValue("providerId", providerId);
+        m_syncRep.setValue("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<int>("messageid", id);
         m_syncRep.setValue("state", (int)2);
-        m_syncRep.setValue("providerId", providerId);
+        m_syncRep.setValue("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<int>("messageid", id);
         m_messageRep.setValue("title", title);
-        m_messageRep.setValue("contentText", content);
-        m_messageRep.setValue("providerId", providerId);
+        m_messageRep.setValue("contenttext", content);
+        m_messageRep.setValue("providerid", providerId);
     }
 
     void setTopics(const NS_TopicList & topics)