[ITC][contacts-service2][ACR-627][Add/Depricate new SIM contacts APIs]
authorAmritanshu Pandia <a.pandia1@samsung.com>
Thu, 9 Jun 2016 12:11:54 +0000 (17:41 +0530)
committerShilpa Jindal <shilpa.j@samsung.com>
Fri, 10 Jun 2016 05:30:05 +0000 (22:30 -0700)
Change-Id: I339335c75facd9bb8ac970b0b0c510ced1dca5dc
Signed-off-by: Amritanshu Pandia <a.pandia1@samsung.com>
packaging/itc/native-contacts-service2-itc.spec
src/itc/contacts-service2/CMakeLists.txt
src/itc/contacts-service2/ITs-contacts-service2-common.h
src/itc/contacts-service2/ITs-contacts-service2-sim.c
src/itc/contacts-service2/tct-contacts-service2-native_mobile.h
src/itc/contacts-service2/tct-contacts-service2-native_wearable.h

index ed336c0..62ce994 100755 (executable)
@@ -16,6 +16,7 @@ BuildRequires:        cmake
 BuildRequires: pkgconfig(bundle)
 BuildRequires: pkgconfig(accounts-svc)
 BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(capi-telephony)
 
 %description
 Native API Integration TC (%{name})
index e42f3fa..23daad3 100755 (executable)
@@ -29,6 +29,7 @@ PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
        accounts-svc
        capi-system-info
        dlog elementary
+       capi-telephony
 )
 
 INCLUDE_DIRECTORIES(
index efcb404..171fb24 100755 (executable)
@@ -22,6 +22,7 @@
 #include <contacts.h>
 #include <glib.h>
 #include <app.h>
+#include <telephony.h>
 
 /** @addtogroup itc-contacts-service2
 *  @ingroup itc
index 459e130..9e36fd2 100755 (executable)
@@ -75,6 +75,8 @@ void ITs_contacts_service2_sim_cleanup(void)
 *  @ingroup    itc-contacts_service2-sim
 *  @{
 */
+
+#ifdef WEARABLE        //Starts WEARABLE
 //& purpose: Checks whether SIM initialization is completed or not.
 //& type: auto
 
@@ -153,5 +155,126 @@ int ITc_contacts_sim_import_all_contacts_p(void)
 
        return 0;
 }
+
+#endif //End WEARABLE
+
+//& purpose: Checks whether SIM of the given SIM slot number is initialized
+//& type: auto
+
+/**
+* @testcase                    ITc_contacts_sim_get_initialization_status_by_sim_slot_no_p
+* @since_tizen                 3.0
+* @author              SRID(a.pandia1)
+* @reviewer            SRID(shilpa.j)
+* @type                                auto
+* @description                 Checks whether SIM of the given SIM slot number is initialized
+* @scenario                            Telephony init\n
+*                                              Check initialization status\n
+*                                              Telephony deinit
+* @apicovered                  contacts_sim_get_initialization_status_by_sim_slot_no
+* @passcase                            When contacts_sim_get_initialization_status_by_sim_slot_no is successful.
+* @failcase                            If target API fails or any precondition API fails.
+* @precondition                        telephony_init should be called as precondition API
+* @postcondition               None
+*/
+int ITc_contacts_sim_get_initialization_status_by_sim_slot_no_p(void)
+{
+       START_TEST;
+       telephony_handle_list_s hTelList;
+       int nSimSlotNo = 0;
+       bool bInitComplete = false;
+       
+       int nRet = telephony_init(&hTelList);
+       PRINT_RESULT(TELEPHONY_ERROR_NONE, nRet, "telephony_init", "Telephony Api Failed");
+       
+       for (nSimSlotNo = 0; nSimSlotNo < hTelList.count; nSimSlotNo++) 
+       {
+               nRet = contacts_sim_get_initialization_status_by_sim_slot_no(nSimSlotNo, &bInitComplete);
+               if ( !g_bFeatureIsSupported )
+               {               
+                       telephony_deinit(&hTelList);
+                       if(nRet != TIZEN_ERROR_NOT_SUPPORTED)
+                       {
+                               FPRINTF("[Line : %d][%s] contacts_sim_get_initialization_status_by_sim_slot_no API call returned mismatch %s error for unsupported feature\\n", __LINE__, API_NAMESPACE, ContactsServiceGetError(nRet));
+                               return 1;
+                       }
+                       else
+                       {
+                               FPRINTF("[Line : %d][%s] Telephony feature is not supported, Leaving test\\n", __LINE__, API_NAMESPACE);
+                               return 0;
+                       }
+               }
+               PRINT_RESULT_CLEANUP(CONTACTS_ERROR_NONE, nRet, "contacts_sim_get_initialization_status_by_sim_slot_no", 
+                                                        ContactsServiceGetError(nRet), telephony_deinit(&hTelList));
+               if ( bInitComplete == false )
+               {
+                       FPRINTF("[Line : %d][%s] Sim not initialized for slot number = %d\\n", __LINE__ , API_NAMESPACE, nSimSlotNo);
+               }
+       }
+       telephony_deinit(&hTelList);
+       return 0;
+}
+
+//& purpose: Imports all contacts from SIM of the given SIM slot number to Contacts Database.
+//& type: auto
+
+/**
+* @testcase                    ITc_contacts_sim_import_all_contacts_by_sim_slot_no_p
+* @since_tizen                 3.0
+* @author              SRID(a.pandia1)
+* @reviewer            SRID(shilpa.j)
+* @type                                auto
+* @description                 Imports all contacts from SIM of the given SIM slot number to Contacts Database.
+* @scenario                            Telephony init\n
+*                                              Imports contacts from SIM slot number\n
+*                                              Telephony deinit
+* @apicovered                  contacts_sim_import_all_contacts_by_sim_slot_no
+* @passcase                            When contacts_sim_import_all_contacts_by_sim_slot_no is successful.
+* @failcase                            If target API fails or any precondition API fails.
+* @precondition                        telephony_init should be called as precondition API
+* @postcondition               None
+*/
+int ITc_contacts_sim_import_all_contacts_by_sim_slot_no_p(void)
+{
+       START_TEST;
+       telephony_handle_list_s hTelList;
+       int nSimSlotNo = 0;
+       
+       int nRet = telephony_init(&hTelList);
+       PRINT_RESULT(TELEPHONY_ERROR_NONE, nRet, "telephony_init", "Telephony Api Failed");
+       
+       for (nSimSlotNo = 0; nSimSlotNo < hTelList.count; nSimSlotNo++) 
+       {
+               nRet = contacts_sim_import_all_contacts_by_sim_slot_no(nSimSlotNo);
+               if ( !g_bFeatureIsSupported )
+               {               
+                       telephony_deinit(&hTelList);
+                       if(nRet != TIZEN_ERROR_NOT_SUPPORTED)
+                       {
+                               FPRINTF("[Line : %d][%s] contacts_sim_import_all_contacts_by_sim_slot_no API call returned mismatch %s error for unsupported feature\\n", __LINE__, API_NAMESPACE, ContactsServiceGetError(nRet));
+                               return 1;
+                       }
+                       else
+                       {
+                               FPRINTF("[Line : %d][%s] Telephony feature is not supported, Leaving test\\n", __LINE__, API_NAMESPACE);
+                               return 0;
+                       }
+               }
+               
+               if (CONTACTS_ERROR_NO_DATA != nRet && 0 != nSimSlotNo)
+               {
+                       if ((CONTACTS_ERROR_NONE != nRet && CONTACTS_ERROR_NO_DATA != nRet)     || (CONTACTS_ERROR_NO_DATA == nRet && 0 == nSimSlotNo))
+                       {
+                               FPRINTF("[Line : %d][%s] contacts_sim_import_all_contacts_by_sim_slot_no failed, error returned = %s [%d]\\n", __LINE__, API_NAMESPACE, ContactsServiceGetError(nRet), nRet);
+                               telephony_deinit(&hTelList);
+                               return 1;
+                       }
+               }
+       }
+       telephony_deinit(&hTelList);
+       
+       return 0;
+}
+
 /** @} */ 
 /** @} */
index a3edbfd..796d12c 100755 (executable)
@@ -117,8 +117,6 @@ extern int ITc_contacts_setting_set_get_name_display_order_p(void);
 extern int ITc_contacts_setting_set_get_name_sorting_order_p(void);
 extern int ITc_contacts_setting_add_remove_name_display_order_changed_cb_p(void);
 extern int ITc_contacts_setting_add_remove_name_sorting_order_changed_cb_p(void);
-extern int ITc_contacts_sim_get_initialization_status_p(void);
-extern int ITc_contacts_sim_import_all_contacts_p(void);
 extern int ITc_contacts_record_create_destroy_sip_p(void);
 extern int ITc_contacts_record_set_get_str_sip_p(void);
 extern int ITc_contacts_record_set_get_int_sip_p(void);
@@ -132,6 +130,8 @@ extern int ITc_contacts_vcard_set_get_limit_size_of_photo_p(void);
 extern int ITc_contacts_db_search_records_with_query_for_snippet_p(void);
 extern int ITc_contacts_db_search_records_with_range_for_snippet_p(void);
 extern int ITc_contacts_db_search_records_for_snippet_p(void);
+extern int ITc_contacts_sim_get_initialization_status_by_sim_slot_no_p(void);
+extern int ITc_contacts_sim_import_all_contacts_by_sim_slot_no_p(void);
 
 testcase tc_array[] = {
     {"ITc_contacts_activity_delete_by_account_id_p", ITc_contacts_activity_delete_by_account_id_p, ITs_contacts_service2_activity_startup, ITs_contacts_service2_activity_cleanup},
@@ -205,8 +205,6 @@ testcase tc_array[] = {
     {"ITc_contacts_setting_set_get_name_sorting_order_p", ITc_contacts_setting_set_get_name_sorting_order_p, ITs_contacts_service2_setting_startup, ITs_contacts_service2_setting_cleanup},
     {"ITc_contacts_setting_add_remove_name_display_order_changed_cb_p", ITc_contacts_setting_add_remove_name_display_order_changed_cb_p, ITs_contacts_service2_setting_startup, ITs_contacts_service2_setting_cleanup},
     {"ITc_contacts_setting_add_remove_name_sorting_order_changed_cb_p", ITc_contacts_setting_add_remove_name_sorting_order_changed_cb_p, ITs_contacts_service2_setting_startup, ITs_contacts_service2_setting_cleanup},
-    {"ITc_contacts_sim_get_initialization_status_p", ITc_contacts_sim_get_initialization_status_p, ITs_contacts_service2_sim_startup, ITs_contacts_service2_sim_cleanup},
-    {"ITc_contacts_sim_import_all_contacts_p", ITc_contacts_sim_import_all_contacts_p, ITs_contacts_service2_sim_startup, ITs_contacts_service2_sim_cleanup},
     {"ITc_contacts_record_create_destroy_sip_p", ITc_contacts_record_create_destroy_sip_p, ITs_contacts_service2_sip_startup, ITs_contacts_service2_sip_cleanup},
     {"ITc_contacts_record_set_get_str_sip_p", ITc_contacts_record_set_get_str_sip_p, ITs_contacts_service2_sip_startup, ITs_contacts_service2_sip_cleanup},
     {"ITc_contacts_record_set_get_int_sip_p", ITc_contacts_record_set_get_int_sip_p, ITs_contacts_service2_sip_startup, ITs_contacts_service2_sip_cleanup},
@@ -220,7 +218,9 @@ testcase tc_array[] = {
     {"ITc_contacts_db_search_records_with_query_for_snippet_p", ITc_contacts_db_search_records_with_query_for_snippet_p, ITs_contacts_service2_database_startup, ITs_contacts_service2_database_cleanup},                              
     {"ITc_contacts_db_search_records_with_range_for_snippet_p", ITc_contacts_db_search_records_with_range_for_snippet_p, ITs_contacts_service2_database_startup, ITs_contacts_service2_database_cleanup},
     {"ITc_contacts_db_search_records_for_snippet_p", ITc_contacts_db_search_records_for_snippet_p, ITs_contacts_service2_database_startup,ITs_contacts_service2_database_cleanup},
-    {NULL, NULL}
+       {"ITc_contacts_sim_get_initialization_status_by_sim_slot_no_p", ITc_contacts_sim_get_initialization_status_by_sim_slot_no_p, ITs_contacts_service2_sim_startup, ITs_contacts_service2_sim_cleanup},
+       {"ITc_contacts_sim_import_all_contacts_by_sim_slot_no_p", ITc_contacts_sim_import_all_contacts_by_sim_slot_no_p, ITs_contacts_service2_sim_startup, ITs_contacts_service2_sim_cleanup},
+        {NULL, NULL}
 };
 
 #endif // __TCT_CONTACTS_SERVICE2_NATIVE_H__
index a3edbfd..e169f19 100755 (executable)
@@ -119,6 +119,8 @@ extern int ITc_contacts_setting_add_remove_name_display_order_changed_cb_p(void)
 extern int ITc_contacts_setting_add_remove_name_sorting_order_changed_cb_p(void);
 extern int ITc_contacts_sim_get_initialization_status_p(void);
 extern int ITc_contacts_sim_import_all_contacts_p(void);
+extern int ITc_contacts_sim_get_initialization_status_by_sim_slot_no_p(void);
+extern int ITc_contacts_sim_import_all_contacts_by_sim_slot_no_p(void);
 extern int ITc_contacts_record_create_destroy_sip_p(void);
 extern int ITc_contacts_record_set_get_str_sip_p(void);
 extern int ITc_contacts_record_set_get_int_sip_p(void);
@@ -207,6 +209,8 @@ testcase tc_array[] = {
     {"ITc_contacts_setting_add_remove_name_sorting_order_changed_cb_p", ITc_contacts_setting_add_remove_name_sorting_order_changed_cb_p, ITs_contacts_service2_setting_startup, ITs_contacts_service2_setting_cleanup},
     {"ITc_contacts_sim_get_initialization_status_p", ITc_contacts_sim_get_initialization_status_p, ITs_contacts_service2_sim_startup, ITs_contacts_service2_sim_cleanup},
     {"ITc_contacts_sim_import_all_contacts_p", ITc_contacts_sim_import_all_contacts_p, ITs_contacts_service2_sim_startup, ITs_contacts_service2_sim_cleanup},
+    {"ITc_contacts_sim_get_initialization_status_by_sim_slot_no_p", ITc_contacts_sim_get_initialization_status_by_sim_slot_no_p, ITs_contacts_service2_sim_startup, ITs_contacts_service2_sim_cleanup},
+    {"ITc_contacts_sim_import_all_contacts_by_sim_slot_no_p", ITc_contacts_sim_import_all_contacts_by_sim_slot_no_p, ITs_contacts_service2_sim_startup, ITs_contacts_service2_sim_cleanup},
     {"ITc_contacts_record_create_destroy_sip_p", ITc_contacts_record_create_destroy_sip_p, ITs_contacts_service2_sip_startup, ITs_contacts_service2_sip_cleanup},
     {"ITc_contacts_record_set_get_str_sip_p", ITc_contacts_record_set_get_str_sip_p, ITs_contacts_service2_sip_startup, ITs_contacts_service2_sip_cleanup},
     {"ITc_contacts_record_set_get_int_sip_p", ITc_contacts_record_set_get_int_sip_p, ITs_contacts_service2_sip_startup, ITs_contacts_service2_sip_cleanup},