[IOT-1628] fixed TC failure in the resource discovery in the cloud RD
authoryeonghun.nam <yeonghun.nam@samsung.com>
Thu, 1 Dec 2016 09:48:21 +0000 (18:48 +0900)
committerJee Hyeok Kim <jihyeok13.kim@samsung.com>
Mon, 16 Jan 2017 07:42:50 +0000 (07:42 +0000)
- According to the latest RD implementation, the resource discovery TC is fixed where the device presence information is stored in the DB in advance

Change-Id: I85c2c848cf3b0a60fa22014faa09e00985fe6688
Signed-off-by: yeonghun.nam <yeonghun.nam@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/15015
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: jung seungho <shonest.jung@samsung.com>
Reviewed-by: hwa.chung <hwa.chung@samsung.com>
Reviewed-by: Jee Hyeok Kim <jihyeok13.kim@samsung.com>
cloud/resourcedirectory/src/test/java/org/iotivity/cloud/testrdserver/DiscoveryResourceTest.java

index 1881f90..fa3a464 100644 (file)
@@ -36,6 +36,8 @@ import org.iotivity.cloud.base.protocols.MessageBuilder;
 import org.iotivity.cloud.base.protocols.coap.CoapResponse;
 import org.iotivity.cloud.base.protocols.enums.RequestMethod;
 import org.iotivity.cloud.base.protocols.enums.ResponseStatus;
+import org.iotivity.cloud.rdserver.Constants;
+import org.iotivity.cloud.rdserver.db.DBManager;
 import org.iotivity.cloud.rdserver.resources.directory.rd.ResourceDirectoryResource;
 import org.iotivity.cloud.rdserver.resources.directory.res.DiscoveryResource;
 import org.iotivity.cloud.util.Cbor;
@@ -92,6 +94,13 @@ public class DiscoveryResourceTest {
 
     @Test
     public void testHandleGetRequest_existValue() throws Exception {
+        // add presence state on
+        HashMap<String, Object> presenceinfo = new HashMap<>();
+        presenceinfo.put(Constants.DEVICE_ID, RDServerTestUtils.DI);
+        presenceinfo.put(Constants.PRESENCE_STATE, Constants.PRESENCE_ON);
+        DBManager.getInstance().insertRecord(Constants.PRESENCE_TABLE,
+                presenceinfo);
+
         IRequest request = MessageBuilder.createRequest(RequestMethod.GET,
                 RDServerTestUtils.DISCOVERY_REQ_URI,
                 "rt=core.light;di=" + RDServerTestUtils.DI);