Added one more unit test for OCCreateResource
authorRavi Nanjundappa <nravi.n@samsung.com>
Mon, 29 Jun 2015 05:38:27 +0000 (11:08 +0530)
committerErich Keane <erich.keane@intel.com>
Mon, 29 Jun 2015 20:06:27 +0000 (20:06 +0000)
* Unit test to exercise code path to check OCCreateResource() when the
  resource policy is non-discoverable & non-observable.

Change-Id: Ifd95cd6f48a498fbc81c5c62fd7c8df91855f40b
Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1438
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/csdk/stack/test/stacktests.cpp

index 8ec27f4..dff43c6 100644 (file)
@@ -423,6 +423,28 @@ TEST(StackResource, CreateResourceSuccess)
     EXPECT_EQ(OC_STACK_OK, OCStop());
 }
 
+TEST(StackResource, CreateResourceSuccessWithResourcePolicyPropNone)
+{
+    itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);
+    OC_LOG(INFO, TAG, "Starting CreateResourceSuccessWithResourcePolicyPropNone test");
+    InitStack(OC_SERVER);
+
+    OCResourceHandle handle;
+    // the resource is non-discoverable & non-observable by the client.
+    EXPECT_EQ(OC_STACK_OK, OCCreateResource(&handle,
+                                            "core.led",
+                                            "core.rw",
+                                            "/a/led",
+                                            0,   
+                                            NULL,   
+                                            OC_RES_PROP_NONE));// the resource is non-discoverable &
+                                                // non-observable by the client.
+    const char* url = OCGetResourceUri(handle);
+    EXPECT_STREQ("/a/led", url);
+
+    EXPECT_EQ(OC_STACK_OK, OCStop());
+}
+
 TEST(StackResource, CreateResourceWithClientStackMode)
 {
     itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);