From e28e57a663dad57c107d9b7b8fe9ec4d655d5664 Mon Sep 17 00:00:00 2001 From: Shilpa Jindal Date: Wed, 15 Jun 2016 12:52:31 +0530 Subject: [PATCH] [ITC][iotcon][ACR-632][Added testcase for new API] Change-Id: I9e65439c232dd6ad2aca527799df2b29845e582b Signed-off-by: Shilpa Jindal --- src/itc/iotcon/ITs-iotcon-remote-resource.c | 61 +++++++++++++++++++++++++++ src/itc/iotcon/ITs-iotcon.c | 26 ++++++++++++ src/itc/iotcon/tct-iotcon-native_common_iot.h | 4 ++ src/itc/iotcon/tct-iotcon-native_mobile.h | 4 ++ src/itc/iotcon/tct-iotcon-native_tv.h | 4 ++ src/itc/iotcon/tct-iotcon-native_wearable.h | 4 ++ 6 files changed, 103 insertions(+) diff --git a/src/itc/iotcon/ITs-iotcon-remote-resource.c b/src/itc/iotcon/ITs-iotcon-remote-resource.c index 5a7492f..890ed23 100755 --- a/src/itc/iotcon/ITs-iotcon-remote-resource.c +++ b/src/itc/iotcon/ITs-iotcon-remote-resource.c @@ -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; +} + + + /** @} */ /** @} */ diff --git a/src/itc/iotcon/ITs-iotcon.c b/src/itc/iotcon/ITs-iotcon.c index 6897537..6cd1461 100755 --- a/src/itc/iotcon/ITs-iotcon.c +++ b/src/itc/iotcon/ITs-iotcon.c @@ -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 diff --git a/src/itc/iotcon/tct-iotcon-native_common_iot.h b/src/itc/iotcon/tct-iotcon-native_common_iot.h index 37226fa..dd957f5 100755 --- a/src/itc/iotcon/tct-iotcon-native_common_iot.h +++ b/src/itc/iotcon/tct-iotcon-native_common_iot.h @@ -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} }; diff --git a/src/itc/iotcon/tct-iotcon-native_mobile.h b/src/itc/iotcon/tct-iotcon-native_mobile.h index 37226fa..dd957f5 100755 --- a/src/itc/iotcon/tct-iotcon-native_mobile.h +++ b/src/itc/iotcon/tct-iotcon-native_mobile.h @@ -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} }; diff --git a/src/itc/iotcon/tct-iotcon-native_tv.h b/src/itc/iotcon/tct-iotcon-native_tv.h index 37226fa..dd957f5 100755 --- a/src/itc/iotcon/tct-iotcon-native_tv.h +++ b/src/itc/iotcon/tct-iotcon-native_tv.h @@ -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} }; diff --git a/src/itc/iotcon/tct-iotcon-native_wearable.h b/src/itc/iotcon/tct-iotcon-native_wearable.h index 37226fa..dd957f5 100755 --- a/src/itc/iotcon/tct-iotcon-native_wearable.h +++ b/src/itc/iotcon/tct-iotcon-native_wearable.h @@ -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} }; -- 2.7.4