[ITC][iotcon][ACR-632][Added testcase for new API]
authorShilpa Jindal <shilpa.j@samsung.com>
Wed, 15 Jun 2016 07:22:31 +0000 (12:52 +0530)
committerAmritanshu Pandia <a.pandia1@samsung.com>
Tue, 21 Jun 2016 06:24:55 +0000 (23:24 -0700)
Change-Id: I9e65439c232dd6ad2aca527799df2b29845e582b
Signed-off-by: Shilpa Jindal <shilpa.j@samsung.com>
src/itc/iotcon/ITs-iotcon-remote-resource.c
src/itc/iotcon/ITs-iotcon.c
src/itc/iotcon/tct-iotcon-native_common_iot.h
src/itc/iotcon/tct-iotcon-native_mobile.h
src/itc/iotcon/tct-iotcon-native_tv.h
src/itc/iotcon/tct-iotcon-native_wearable.h

index 5a7492f..890ed23 100755 (executable)
@@ -1809,6 +1809,67 @@ int ITc_iotcon_remote_resource_set_get_time_interval_p(void)
        }
        return 0;
 }
+//& purpose: CrGets the device name.
+//& type: auto
+/**
+* @testcase                    ITc_remote_resource_get_device_name_p
+* @since_tizen                 3.0
+* @author              SRID(shilpa.j)
+* @reviewer            SRID(a.pandia1)
+* @type                                auto
+* @description                  Gets the device name API of remote resource.
+* @scenario                            call iotcon_remote_resource_get_device_name
+* @apicovered                  iotcon_remote_resource_get_device_name,iotcon_remote_resource_destroy
+* @passcase                            When iotcon_remote_resource_get_device_name is successful.
+* @failcase                            If target API or any precondition API fails.
+* @precondition                        NA
+* @postcondition               NA
+*/
+int ITc_remote_resource_get_device_name_p(void)
+{
+       
+       char *pszDeviceName =NULL;
+       int nIotconTimeoutId = 0;
+       
+       g_bCheckCb = false;
+
+    int nRet = IotconCreateLiteResource();
+    if (IOTCON_ERROR_NONE != nRet)
+       {
+               FPRINTF("[Line : %d][%s] IotconCreateLiteResource failed : %s\\n", __LINE__, API_NAMESPACE,IotConGetError(nRet));
+               return 1;
+       }
+       nRet = iotcon_find_resource(IOTCON_MULTICAST_ADDRESS, IOTCON_CONNECTIVITY_IPV4,ENCAP_LIGHT_RESOURCE_TYPE, false, IotconRemoteResourceOptionsCB, NULL);
+       PRINT_RESULT_CLEANUP(IOTCON_ERROR_NONE, nRet, "iotcon_find_resource", IotConGetError(nRet), IotconDestroyLiteResource());
+       RUN_POLLING_LOOP;
+
+       if(g_bCheckCb == false)
+       {
+               FPRINTF("[Line : %d][%s] IotconRemoteResourceOptionsCB callback not invoked: \\n", __LINE__, API_NAMESPACE );
+               IotconDestroyLiteResource();
+               return 1;
+       }
+       
+
+       nRet = iotcon_remote_resource_get_device_name(g_hResourceHandle, &pszDeviceName);
+       PRINT_RESULT_CLEANUP(IOTCON_ERROR_NONE, nRet, "iotcon_remote_resource_get_device_name", IotConGetError(nRet), IotconDestroyLiteResource();iotcon_remote_resource_destroy(g_hResourceHandle));
+       if(pszDeviceName == NULL)
+       {
+               FPRINTF("[Line : %d][%s] iotcon_remote_resource_get_device_name failed : %s\\n", __LINE__, API_NAMESPACE,IotConGetError(nRet));
+               iotcon_remote_resource_destroy(g_hResourceHandle);
+               IotconDestroyLiteResource();
+               return 1;
+               
+       }
+       iotcon_remote_resource_destroy(g_hResourceHandle);
+       IotconDestroyLiteResource();
+
+       
+       return 0;
+}
+
+
+
 
 /** @} */
 /** @} */
index 6897537..6cd1461 100755 (executable)
@@ -165,6 +165,32 @@ int ITc_iotcon_set_get_timeout_p(void)
                
        return 0;
 }
+//& type: auto
+//& purpose:  set the device name
+/**
+* @testcase                    ITc_iotcon_set_get_polling_interval_p
+* @author              SRID(shilpa.j)
+* @reviewer            SRID(a.pandia1)
+* @type                                auto
+* @since_tizen                         3.0
+* @description                 sets the device name 
+* @scenario                            sets the device name *                                          
+* @apicovered                  iotcon_set_device_name
+* @passcase                            if iotcon_set_device_name passes
+* @failcase                            if iotcon_set_device_name fails
+* @precondition                        NA
+* @postcondition               NA
+*/
+int ITc_iotcon_set_device_name_p(void) 
+{ 
+       START_TEST;
+        char*pszDeviceName = "device_name";
+       int nRet = iotcon_set_device_name(pszDeviceName); 
+       PRINT_RESULT(IOTCON_ERROR_NONE, nRet, "iotcon_set_device_name", IotConGetError(nRet));
+   
+    return 0; 
+} 
+
 
 #if 0
 //& type: auto
index 37226fa..dd957f5 100755 (executable)
@@ -172,6 +172,8 @@ extern int ITc_iotcon_attributes_foreach_p(void);
 extern int ITc_iotcon_attributes_get_keys_count_p(void);
 extern int ITc_iotcon_attributes_add_get_byte_str_p(void);
 //extern int ITc_iotcon_set_persistent_storage_p(void);
+extern int ITc_iotcon_set_device_name_p(void);
+extern int ITc_remote_resource_get_device_name_p(void);
 
 
 
@@ -296,6 +298,8 @@ testcase tc_array[] = {
     {"ITc_iotcon_attributes_foreach_p", ITc_iotcon_attributes_foreach_p, ITs_iotcon_attributes_startup, ITs_iotcon_attributes_cleanup},
     {"ITc_iotcon_attributes_get_keys_count_p", ITc_iotcon_attributes_get_keys_count_p, ITs_iotcon_attributes_startup, ITs_iotcon_attributes_cleanup},
     {"ITc_iotcon_attributes_add_get_byte_str_p", ITc_iotcon_attributes_add_get_byte_str_p, ITs_iotcon_attributes_startup, ITs_iotcon_attributes_cleanup},
+       {"ITc_iotcon_set_device_name_p", ITc_iotcon_set_device_name_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
+       {"ITc_remote_resource_get_device_name_p", ITc_remote_resource_get_device_name_p, ITs_iotcon_remote_resource_startup, ITs_iotcon_remote_resource_cleanup},       
 //    {"ITc_iotcon_set_persistent_storage_p", ITc_iotcon_set_persistent_storage_p, ITs_iotcon_security_startup, ITs_iotcon_security_cleanup},
     {NULL, NULL}
 };
index 37226fa..dd957f5 100755 (executable)
@@ -172,6 +172,8 @@ extern int ITc_iotcon_attributes_foreach_p(void);
 extern int ITc_iotcon_attributes_get_keys_count_p(void);
 extern int ITc_iotcon_attributes_add_get_byte_str_p(void);
 //extern int ITc_iotcon_set_persistent_storage_p(void);
+extern int ITc_iotcon_set_device_name_p(void);
+extern int ITc_remote_resource_get_device_name_p(void);
 
 
 
@@ -296,6 +298,8 @@ testcase tc_array[] = {
     {"ITc_iotcon_attributes_foreach_p", ITc_iotcon_attributes_foreach_p, ITs_iotcon_attributes_startup, ITs_iotcon_attributes_cleanup},
     {"ITc_iotcon_attributes_get_keys_count_p", ITc_iotcon_attributes_get_keys_count_p, ITs_iotcon_attributes_startup, ITs_iotcon_attributes_cleanup},
     {"ITc_iotcon_attributes_add_get_byte_str_p", ITc_iotcon_attributes_add_get_byte_str_p, ITs_iotcon_attributes_startup, ITs_iotcon_attributes_cleanup},
+       {"ITc_iotcon_set_device_name_p", ITc_iotcon_set_device_name_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
+       {"ITc_remote_resource_get_device_name_p", ITc_remote_resource_get_device_name_p, ITs_iotcon_remote_resource_startup, ITs_iotcon_remote_resource_cleanup},       
 //    {"ITc_iotcon_set_persistent_storage_p", ITc_iotcon_set_persistent_storage_p, ITs_iotcon_security_startup, ITs_iotcon_security_cleanup},
     {NULL, NULL}
 };
index 37226fa..dd957f5 100755 (executable)
@@ -172,6 +172,8 @@ extern int ITc_iotcon_attributes_foreach_p(void);
 extern int ITc_iotcon_attributes_get_keys_count_p(void);
 extern int ITc_iotcon_attributes_add_get_byte_str_p(void);
 //extern int ITc_iotcon_set_persistent_storage_p(void);
+extern int ITc_iotcon_set_device_name_p(void);
+extern int ITc_remote_resource_get_device_name_p(void);
 
 
 
@@ -296,6 +298,8 @@ testcase tc_array[] = {
     {"ITc_iotcon_attributes_foreach_p", ITc_iotcon_attributes_foreach_p, ITs_iotcon_attributes_startup, ITs_iotcon_attributes_cleanup},
     {"ITc_iotcon_attributes_get_keys_count_p", ITc_iotcon_attributes_get_keys_count_p, ITs_iotcon_attributes_startup, ITs_iotcon_attributes_cleanup},
     {"ITc_iotcon_attributes_add_get_byte_str_p", ITc_iotcon_attributes_add_get_byte_str_p, ITs_iotcon_attributes_startup, ITs_iotcon_attributes_cleanup},
+       {"ITc_iotcon_set_device_name_p", ITc_iotcon_set_device_name_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
+       {"ITc_remote_resource_get_device_name_p", ITc_remote_resource_get_device_name_p, ITs_iotcon_remote_resource_startup, ITs_iotcon_remote_resource_cleanup},       
 //    {"ITc_iotcon_set_persistent_storage_p", ITc_iotcon_set_persistent_storage_p, ITs_iotcon_security_startup, ITs_iotcon_security_cleanup},
     {NULL, NULL}
 };
index 37226fa..dd957f5 100755 (executable)
@@ -172,6 +172,8 @@ extern int ITc_iotcon_attributes_foreach_p(void);
 extern int ITc_iotcon_attributes_get_keys_count_p(void);
 extern int ITc_iotcon_attributes_add_get_byte_str_p(void);
 //extern int ITc_iotcon_set_persistent_storage_p(void);
+extern int ITc_iotcon_set_device_name_p(void);
+extern int ITc_remote_resource_get_device_name_p(void);
 
 
 
@@ -296,6 +298,8 @@ testcase tc_array[] = {
     {"ITc_iotcon_attributes_foreach_p", ITc_iotcon_attributes_foreach_p, ITs_iotcon_attributes_startup, ITs_iotcon_attributes_cleanup},
     {"ITc_iotcon_attributes_get_keys_count_p", ITc_iotcon_attributes_get_keys_count_p, ITs_iotcon_attributes_startup, ITs_iotcon_attributes_cleanup},
     {"ITc_iotcon_attributes_add_get_byte_str_p", ITc_iotcon_attributes_add_get_byte_str_p, ITs_iotcon_attributes_startup, ITs_iotcon_attributes_cleanup},
+       {"ITc_iotcon_set_device_name_p", ITc_iotcon_set_device_name_p, ITs_iotcon_startup, ITs_iotcon_cleanup},
+       {"ITc_remote_resource_get_device_name_p", ITc_remote_resource_get_device_name_p, ITs_iotcon_remote_resource_startup, ITs_iotcon_remote_resource_cleanup},       
 //    {"ITc_iotcon_set_persistent_storage_p", ITc_iotcon_set_persistent_storage_p, ITs_iotcon_security_startup, ITs_iotcon_security_cleanup},
     {NULL, NULL}
 };