Fix broken unit-test for the Resource Builder
authorcoderhyme <jhyo.kim@samsung.com>
Tue, 14 Jul 2015 15:02:45 +0000 (00:02 +0900)
committerUze Choi <uzchoi@samsung.com>
Wed, 15 Jul 2015 03:41:55 +0000 (03:41 +0000)
It is caused by AutoNotify which is new feature of ResourceObject.

Change-Id: I20b423d9c155d9f410d809be6b91c4c945d480c7
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
Change-Id: I20b423d9c155d9f410d809be6b91c4c945d480c7
Reviewed-on: https://gerrit.iotivity.org/gerrit/1648
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/resource-manipulation/src/serverBuilder/src/RequestHandler.cpp
service/resource-manipulation/src/serverBuilder/unittests/RequestHandlerTest.cpp

index 12f8f6f..e2bc59a 100755 (executable)
@@ -59,16 +59,18 @@ namespace
         return response;
     }
 
-    AttrKeyValuePairs applyAcceptMethod(ResourceObject& resource, const ResourceAttributes& requestAttrs)
+    AttrKeyValuePairs applyAcceptMethod(ResourceObject& resource,
+            const ResourceAttributes& requestAttrs)
     {
         ResourceObject::LockGuard lock(resource, ResourceObject::AutoNotifyPolicy::NEVER);
 
         return replaceAttributes(resource.getAttributes(), requestAttrs);
     }
 
-    AttrKeyValuePairs applyDefaultMethod(ResourceObject& resource, const ResourceAttributes& requestAttrs)
+    AttrKeyValuePairs applyDefaultMethod(ResourceObject& resource,
+            const ResourceAttributes& requestAttrs)
     {
-        ResourceObject::LockGuard lock(resource,ResourceObject::AutoNotifyPolicy::NEVER);
+        ResourceObject::LockGuard lock(resource, ResourceObject::AutoNotifyPolicy::NEVER);
 
         if (resource.getSetRequestHandlerPolicy()
             != ResourceObject::SetRequestHandlerPolicy::ACCEPTANCE
@@ -85,8 +87,8 @@ namespace
         return AttrKeyValuePairs();
     }
 
-    std::function<AttrKeyValuePairs(ResourceObject&, const ResourceAttributes&)> getApplyAcceptanceFunc(
-            PrimitiveSetResponse::AcceptanceMethod method)
+    auto getApplyAcceptanceFunc(PrimitiveSetResponse::AcceptanceMethod method) ->
+            std::function<AttrKeyValuePairs(ResourceObject&, const ResourceAttributes&)>
     {
         switch (method)
         {
index 689948e..66c214e 100644 (file)
@@ -55,6 +55,7 @@ protected:
 
         server = ResourceObject::Builder("a/test", "resourceType", "").build();
 
+        server->setAutoNotifyPolicy(ResourceObject::AutoNotifyPolicy::NEVER);
         server->setAttribute(EXISTING, ORIGIN_VALUE);
     }
 };