diff options
author | Ickhee Woo <ickhee.woo@samsung.com> | 2016-03-30 14:02:27 +0900 |
---|---|---|
committer | Ickhee Woo <ickhee.woo@samsung.com> | 2016-03-30 14:24:47 +0900 |
commit | 0c1893795d6f29347021e7d3889e4e88f816ebc6 (patch) | |
tree | cd26beb3774507c604362b06df32078103e70807 | |
parent | 8653b06d1787445664520d32c61468d75b4752b3 (diff) | |
download | sync-manager-0c1893795d6f29347021e7d3889e4e88f816ebc6.tar.gz sync-manager-0c1893795d6f29347021e7d3889e4e88f816ebc6.tar.bz2 sync-manager-0c1893795d6f29347021e7d3889e4e88f816ebc6.zip |
updated lcov comments for excluding code from UTC coverage
excluded code is like below:
- error and exception treatment code
- code is excuted only when sync job is operated
- code for sync-service routine
- code for returning resources when sync-service is terminated
Change-Id: Iba42b43b1cbe92e718b8b4444f8d48892a919976
30 files changed, 436 insertions, 111 deletions
diff --git a/src/sync-client/sync_adapter.c b/src/sync-client/sync_adapter.c index 33fc6bc..f3548b6 100644 --- a/src/sync-client/sync_adapter.c +++ b/src/sync-client/sync_adapter.c @@ -59,6 +59,7 @@ extern int read_proc(const char *path, char *buf, int size); extern char *proc_get_cmdline_self(); +//LCOV_EXCL_START gboolean __sync_adapter_on_start_sync(TizenSyncAdapter *pObject, gint accountId, @@ -66,7 +67,6 @@ __sync_adapter_on_start_sync(TizenSyncAdapter *pObject, gboolean is_data_sync, GVariant *pSyncJobUserData) { - //LCOV_EXCL_START SYNC_LOGE_RET_RES(pObject != NULL && pSyncJobName != NULL, true, "sync adapter object is null"); LOG_LOGD("Received start sync request in sync adapter: params account[%d] jobname [%s] Data sync [%s]", accountId, pSyncJobName, is_data_sync ? "YES" : "NO"); @@ -108,7 +108,6 @@ __sync_adapter_on_start_sync(TizenSyncAdapter *pObject, return false; return true; - //LCOV_EXCL_STOP } @@ -120,7 +119,6 @@ __sync_adapter_on_stop_sync( gboolean is_data_sync, GVariant *pSyncJobUserData) { - //LCOV_EXCL_START LOG_LOGD("handle stop in adapter"); SYNC_LOGE_RET_RES(pObject != NULL, true, "sync adapter object is null"); @@ -139,8 +137,8 @@ __sync_adapter_on_stop_sync( g_sync_adapter->cancel_sync_cb(account, pSyncJobName, NULL, sync_job_user_data); return true; - //LCOV_EXCL_STOP } +//LCOV_EXCL_STOP /* flag == true => register */ diff --git a/src/sync-client/sync_manager.c b/src/sync-client/sync_manager.c index 8c32801..7217c90 100644 --- a/src/sync-client/sync_manager.c +++ b/src/sync-client/sync_manager.c @@ -426,6 +426,7 @@ int sync_manager_foreach_sync_job(sync_manager_sync_job_cb sync_job_cb, void *us } +//LCOV_EXCL_START int _sync_manager_enable_sync() { int ret = initialize_connection(); @@ -458,3 +459,4 @@ int _sync_manager_disable_sync() return SYNC_ERROR_NONE; } +//LCOV_EXCL_STOP diff --git a/src/sync-service/SyncManager_BatteryStatusListener.cpp b/src/sync-service/SyncManager_BatteryStatusListener.cpp index f390462..3cf4567 100644 --- a/src/sync-service/SyncManager_BatteryStatusListener.cpp +++ b/src/sync-service/SyncManager_BatteryStatusListener.cpp @@ -32,6 +32,7 @@ {*/ +//LCOV_EXCL_START void OnBatteryStatusChanged(keynode_t* pKey, void* pData) { LOG_LOGD("OnBatteryStatusChanged Starts"); @@ -42,6 +43,7 @@ void OnBatteryStatusChanged(keynode_t* pKey, void* pData) LOG_LOGD("OnBatteryStatusChanged Ends"); } +//LCOV_EXCL_STOP BatteryStatusListener::BatteryStatusListener(void) @@ -49,9 +51,11 @@ BatteryStatusListener::BatteryStatusListener(void) } +//LCOV_EXCL_START BatteryStatusListener::~BatteryStatusListener(void) { } +//LCOV_EXCL_STOP int @@ -61,6 +65,7 @@ BatteryStatusListener::RegisterBatteryStatusListener(void) } +//LCOV_EXCL_START int BatteryStatusListener::DeRegisterBatteryStatusListener(void) { @@ -68,4 +73,6 @@ BatteryStatusListener::DeRegisterBatteryStatusListener(void) return(vconf_ignore_key_changed(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, OnBatteryStatusChanged)); } +//LCOV_EXCL_STOP + //}//_SyncManager diff --git a/src/sync-service/SyncManager_CapabilityInfo.cpp b/src/sync-service/SyncManager_CapabilityInfo.cpp index e867a07..7b87031 100644 --- a/src/sync-service/SyncManager_CapabilityInfo.cpp +++ b/src/sync-service/SyncManager_CapabilityInfo.cpp @@ -30,9 +30,9 @@ {*/ +//LCOV_EXCL_START CapabilityInfo::CapabilityInfo(void) { - //Empty } @@ -58,20 +58,20 @@ CapabilityInfo::AddPeriodicSyncJob(int account_id, PeriodicSyncJob* pJob) __periodicSyncList.insert(pair<int, PeriodicSyncJob*> (account_id, pJob)); } + void CapabilityInfo::RemovePeriodicSyncJob(PeriodicSyncJob* pJob) { - /* +/* int acc_id; int ret = account_get_account_id(pJob->accountHandle, &acc_id); LOG_LOGE_VOID(ret == ACCOUNT_ERROR_NONE, "app account_get_account_id failed %d", ret); __periodicSyncList.erase(__periodicSyncList.find(acc_id)); - */ +*/ } - bool CapabilityInfo::RequestAlreadyExists(int account_id, PeriodicSyncJob* pJob) { @@ -108,6 +108,7 @@ CapabilityInfo& CapabilityInfo::operator =(const CapabilityInfo& capabilityInfo) this->__capability = capabilityInfo.__capability; map<int, PeriodicSyncJob*>::const_iterator endItr = capabilityInfo.__periodicSyncList.end(); + for(map<int, PeriodicSyncJob*>::const_iterator itr = capabilityInfo.__periodicSyncList.begin(); itr != endItr; ++itr) { PeriodicSyncJob* pJob = new PeriodicSyncJob(*(itr->second)); if (pJob) { @@ -117,5 +118,6 @@ CapabilityInfo& CapabilityInfo::operator =(const CapabilityInfo& capabilityInfo) return *this; } +//LCOV_EXCL_STOP //}//_SyncManager diff --git a/src/sync-service/SyncManager_CapabilityInfo.h b/src/sync-service/SyncManager_CapabilityInfo.h index 39d0ff7..0e424a8 100644 --- a/src/sync-service/SyncManager_CapabilityInfo.h +++ b/src/sync-service/SyncManager_CapabilityInfo.h @@ -27,9 +27,11 @@ #include <account.h> #include "SyncManager_PeriodicSyncJob.h" + /*namespace _SyncManager -{ -*/ +{*/ + + using namespace std; class CapabilityInfo @@ -55,5 +57,6 @@ public: string __capability; map<int, PeriodicSyncJob*> __periodicSyncList; }; + //}//_SyncManager #endif // SYNC_SERVICE_CAPABILITY_INFO_H diff --git a/src/sync-service/SyncManager_CurrentSyncContext.cpp b/src/sync-service/SyncManager_CurrentSyncContext.cpp index 38c1a64..07f1bb8 100644 --- a/src/sync-service/SyncManager_CurrentSyncContext.cpp +++ b/src/sync-service/SyncManager_CurrentSyncContext.cpp @@ -26,9 +26,12 @@ #include "SyncManager_SyncManager.h" #include "sync-log.h" + /*namespace _SyncManager {*/ + +//LCOV_EXCL_START CurrentSyncContext::CurrentSyncContext(SyncJob* pSyncJob) { __pCurrentSyncJob = pSyncJob; @@ -57,20 +60,24 @@ CurrentSyncContext::GetSyncJob() const return __pCurrentSyncJob; } + long CurrentSyncContext::GetStartTime() const { return __startTime; } + long CurrentSyncContext::GetTimerId() const { return __timerId; } + void CurrentSyncContext::SetTimerId(long id) { __timerId = id; } +//LCOV_EXCL_STOP diff --git a/src/sync-service/SyncManager_CurrentSyncJobQueue.cpp b/src/sync-service/SyncManager_CurrentSyncJobQueue.cpp index 79673af..9545aa1 100644 --- a/src/sync-service/SyncManager_CurrentSyncJobQueue.cpp +++ b/src/sync-service/SyncManager_CurrentSyncJobQueue.cpp @@ -28,7 +28,9 @@ #include "SyncManager_SyncManager.h" #include "SyncManager_CurrentSyncJobQueue.h" + using namespace std; + /*namespace _SyncManager {*/ @@ -39,6 +41,7 @@ CurrentSyncJobQueue::CurrentSyncJobQueue(void) } +//LCOV_EXCL_START CurrentSyncJobQueue::~CurrentSyncJobQueue(void) { //Empty @@ -120,6 +123,7 @@ CurrentSyncJobQueue::GetOperations(void) CurrentSyncContext *pContext = new CurrentSyncContext(*(it->second)); opsList.push_back(pContext); } + return opsList; } @@ -220,6 +224,7 @@ CurrentSyncJobQueue::DoesAccAuthExist(account_h account, string auth) return (CurrentSyncContext*)it->second; } +//LCOV_EXCL_STOP CurrentSyncContext* @@ -231,7 +236,7 @@ CurrentSyncJobQueue::GetCurrJobfromKey(string key) return NULL; } - return (CurrentSyncContext*)it->second; + return (CurrentSyncContext*)it->second; //LCOV_EXCL_LINE } //}//_SyncManager diff --git a/src/sync-service/SyncManager_DataChangeSyncScheduler.cpp b/src/sync-service/SyncManager_DataChangeSyncScheduler.cpp index 1434b7f..442e6b4 100644 --- a/src/sync-service/SyncManager_DataChangeSyncScheduler.cpp +++ b/src/sync-service/SyncManager_DataChangeSyncScheduler.cpp @@ -32,6 +32,7 @@ #include "SyncManager_SyncManager.h" +//LCOV_EXCL_START #if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE) void OnCalendarBookChanged(const char* view_uri, void* user_data) { @@ -105,6 +106,7 @@ void OnMediaContentDataChanged(media_content_error_e error, int pid, media_conte } } } +//LCOV_EXCL_STOP DataChangeSyncScheduler::DataChangeSyncScheduler(void) @@ -115,9 +117,11 @@ DataChangeSyncScheduler::DataChangeSyncScheduler(void) } +//LCOV_EXCL_START DataChangeSyncScheduler::~DataChangeSyncScheduler(void) { } +//LCOV_EXCL_STOP #if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE) @@ -130,31 +134,36 @@ DataChangeSyncScheduler::SubscribeCalendarCallback(void) err = calendar_connect_with_flags(CALENDAR_CONNECT_FLAG_RETRY); if (err != CALENDAR_ERROR_NONE) - LOG_LOGD("Calendar connection failed : %d, %s", err, get_error_message(err)); + LOG_LOGD("Calendar connection failed : %d, %s", err, get_error_message(err)); //LCOV_EXCL_LINE SYNC_LOGE_RET_RES(err == CALENDAR_ERROR_NONE, SYNC_ERROR_INVALID_OPERATION, "Calendar Connection Failed"); err = calendar_db_add_changed_cb(_calendar_book._uri, OnCalendarBookChanged, this); if (err != CALENDAR_ERROR_NONE) { + //LCOV_EXCL_START calendar_disconnect(); LOG_LOGD("Subscribing Calendar Callback for BOOK Failed"); return SYNC_ERROR_INVALID_OPERATION; + //LCOV_EXCL_STOP } err = calendar_db_add_changed_cb(_calendar_event._uri, OnCalendarEventChanged, this); if (err != CALENDAR_ERROR_NONE) { + //LCOV_EXCL_START calendar_db_remove_changed_cb(_calendar_book._uri, OnCalendarBookChanged, NULL); calendar_disconnect(); LOG_LOGD("Subscribing Calendar Callback for EVENT Failed"); return SYNC_ERROR_INVALID_OPERATION; + //LCOV_EXCL_STOP } err = calendar_db_add_changed_cb(_calendar_todo._uri, OnCalendarTodoChanged, this); if (err != CALENDAR_ERROR_NONE) { + //LCOV_EXCL_START calendar_db_remove_changed_cb(_calendar_book._uri, OnCalendarBookChanged, NULL); calendar_db_remove_changed_cb(_calendar_event._uri, OnCalendarEventChanged, NULL); calendar_disconnect(); @@ -162,6 +171,7 @@ DataChangeSyncScheduler::SubscribeCalendarCallback(void) LOG_LOGD("Subscribing Calendar Callback for TODO Failed"); return SYNC_ERROR_INVALID_OPERATION; + //LCOV_EXCL_STOP } calendar_subscription_started = true; @@ -181,11 +191,13 @@ DataChangeSyncScheduler::SubscribeContactsCallback(void) err = contacts_db_add_changed_cb(_contacts_contact._uri, OnContactsDataChanged, this); if (err != CONTACTS_ERROR_NONE) { + //LCOV_EXCL_START contacts_disconnect(); LOG_LOGD("Subscribing Contacts Callback for DataChanged Failed"); return SYNC_ERROR_INVALID_OPERATION; + //LCOV_EXCL_STOP } contacts_subscription_started = true; @@ -203,16 +215,18 @@ DataChangeSyncScheduler::SubscribeMediaContentCallback(void) err = media_content_connect(); if (err == MEDIA_CONTENT_ERROR_DB_FAILED) - LOG_LOGD("media content connection error [%s]", get_error_message(err)); + LOG_LOGD("media content connection error [%s]", get_error_message(err)); //LCOV_EXCL_LINE SYNC_LOGE_RET_RES(err == MEDIA_CONTENT_ERROR_NONE, SYNC_ERROR_INVALID_OPERATION, "Media Content Connection Failed"); err = media_content_set_db_updated_cb(OnMediaContentDataChanged, this); if (err != MEDIA_CONTENT_ERROR_NONE) { + //LCOV_EXCL_START media_content_disconnect(); LOG_LOGD("Subscribing Media Content Callback for DataChanged Failed"); return SYNC_ERROR_INVALID_OPERATION; + //LCOV_EXCL_STOP } media_content_subscription_started = true; @@ -221,6 +235,7 @@ DataChangeSyncScheduler::SubscribeMediaContentCallback(void) } +//LCOV_EXCL_START #if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE) int DataChangeSyncScheduler::UnSubscribeCalendarCallback(void) @@ -265,6 +280,7 @@ DataChangeSyncScheduler::UnSubscribeMediaContentCallback(void) return SYNC_ERROR_NONE; } +//LCOV_EXCL_STOP int @@ -275,21 +291,27 @@ DataChangeSyncScheduler::RegisterDataChangeListeners(void) #if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE) err = SubscribeCalendarCallback(); if (err != SYNC_ERROR_NONE) { + //LCOV_EXCL_START LOG_LOGD("Registration of Calendar DataChangeListener Failed"); return SYNC_ERROR_INVALID_OPERATION; + //LCOV_EXCL_STOP } err = SubscribeContactsCallback(); if (err != SYNC_ERROR_NONE) { + //LCOV_EXCL_START LOG_LOGD("Registration of Contacts DataChangeListener Failed"); return SYNC_ERROR_INVALID_OPERATION; + //LCOV_EXCL_STOP } #endif err = SubscribeMediaContentCallback(); if (err != SYNC_ERROR_NONE) { + //LCOV_EXCL_START LOG_LOGD("Registration of Media Content DataChangeListener Failed"); return SYNC_ERROR_INVALID_OPERATION; + //LCOV_EXCL_STOP } LOG_LOGD("Registration of DataChangeListener Successfully Ends"); @@ -298,6 +320,7 @@ DataChangeSyncScheduler::RegisterDataChangeListeners(void) } +//LCOV_EXCL_START int DataChangeSyncScheduler::DeRegisterDataChangeListeners(void) { @@ -346,6 +369,7 @@ DataChangeSyncScheduler::HandleDataChangeEvent(const char* pSyncCapability) LOG_LOGD("DataChangeSyncScheduler::HandleDataChangeEvent() Ends"); } +//LCOV_EXCL_STOP /* capability can be called as syncJobName in SyncManager */ diff --git a/src/sync-service/SyncManager_DataSyncJob.cpp b/src/sync-service/SyncManager_DataSyncJob.cpp index c7287cc..f594440 100644 --- a/src/sync-service/SyncManager_DataSyncJob.cpp +++ b/src/sync-service/SyncManager_DataSyncJob.cpp @@ -38,35 +38,41 @@ DataSyncJob::DataSyncJob(const string appId, const string syncJobName, int accou } +//LCOV_EXCL_START DataSyncJob::DataSyncJob(const DataSyncJob& other) : SyncJob(other) { -/* this->__accountHandle = other.__accountHandle; +/* + this->__accountHandle = other.__accountHandle; this->__capability = other.__capability; this->__pExtras = bundle_dup(other.__pExtras); this->__period = other.__period; - this->__syncAdapter = other.__syncAdapter;*/ + this->__syncAdapter = other.__syncAdapter; +*/ } DataSyncJob& DataSyncJob::operator= (const DataSyncJob& other) { - /*this->__accountHandle = other.__accountHandle; +/* + this->__accountHandle = other.__accountHandle; this->__capability = other.__capability; this->__pExtras = bundle_dup(other.__pExtras); this->__period = other.__period; - this->__syncAdapter = other.__syncAdapter;*/ + this->__syncAdapter = other.__syncAdapter; +*/ return *this; } + void DataSyncJob::Reset(int accountId, bundle* pUserData, int syncOption, string capability) { SyncJob::Reset(accountId, pUserData, syncOption); __capability = capability; } - +//LCOV_EXCL_STOP //}//_SyncManager diff --git a/src/sync-service/SyncManager_ISyncJob.h b/src/sync-service/SyncManager_ISyncJob.h index aca78fc..15bb446 100644 --- a/src/sync-service/SyncManager_ISyncJob.h +++ b/src/sync-service/SyncManager_ISyncJob.h @@ -19,7 +19,6 @@ * @brief This is the header file for the SyncJob class. */ - #ifndef SYNC_SERVICE_ISYNC_JOB_H #define SYNC_SERVICE_ISYNC_JOB_H @@ -28,12 +27,14 @@ { */ + #ifdef __cplusplus extern "C" { #endif using namespace std; + enum SyncType { SYNC_TYPE_ON_DEMAND = 0, @@ -42,12 +43,12 @@ enum SyncType SYNC_TYPE_UNKNOWN }; + class ISyncJob { public: ISyncJob() - : __syncJobId(-1) - , __syncType(SYNC_TYPE_UNKNOWN) {} + : __syncJobId(-1), __syncType(SYNC_TYPE_UNKNOWN) {} ISyncJob(int syncJobId, SyncType type) : __syncJobId(syncJobId) @@ -66,8 +67,10 @@ protected: SyncType __syncType; }; + #ifdef __cplusplus } #endif + //}//_SyncManager #endif//SYNC_SERVICE_ISYNC_JOB_H diff --git a/src/sync-service/SyncManager_ManageIdleState.cpp b/src/sync-service/SyncManager_ManageIdleState.cpp index f947a53..0295450 100644 --- a/src/sync-service/SyncManager_ManageIdleState.cpp +++ b/src/sync-service/SyncManager_ManageIdleState.cpp @@ -38,9 +38,11 @@ ManageIdleState::ManageIdleState(void) } +//LCOV_EXCL_START ManageIdleState::~ManageIdleState(void) { } +//LCOV_EXCL_STOP void terminate_service(void); diff --git a/src/sync-service/SyncManager_NetworkChangeListener.cpp b/src/sync-service/SyncManager_NetworkChangeListener.cpp index 4f416b3..236c41a 100644 --- a/src/sync-service/SyncManager_NetworkChangeListener.cpp +++ b/src/sync-service/SyncManager_NetworkChangeListener.cpp @@ -14,13 +14,11 @@ * limitations under the License. */ - /** * @file SyncManager_NetworkChangeListener.cpp * @brief This is the implementation file for the NetworkChangeListener class. */ - #include "SyncManager_SyncManager.h" #include "SyncManager_NetworkChangeListener.h" #include "SyncManager_SyncDefines.h" @@ -30,6 +28,7 @@ {*/ +//LCOV_EXCL_START void OnConnectionChanged(connection_type_e type, void *user_data) { LOG_LOGD("Network connection changed %d", type); @@ -57,6 +56,7 @@ void OnConnectionChanged(connection_type_e type, void *user_data) break; } } +//LCOV_EXCL_STOP NetworkChangeListener::NetworkChangeListener(void) @@ -64,17 +64,19 @@ NetworkChangeListener::NetworkChangeListener(void) { int ret = connection_create(&connection); if (ret != CONNECTION_ERROR_NONE) { - LOG_LOGD("Create connection failed %d, %s", ret, get_error_message(ret)); + LOG_LOGD("Create connection failed %d, %s", ret, get_error_message(ret)); //LCOV_EXCL_LINE } } +//LCOV_EXCL_START NetworkChangeListener::~NetworkChangeListener(void) { if (connection) { connection_destroy(connection); } } +//LCOV_EXCL_STOP bool @@ -84,8 +86,9 @@ NetworkChangeListener::IsWifiConnected() connection_wifi_state_e state = CONNECTION_WIFI_STATE_DEACTIVATED; ret = connection_get_wifi_state(connection, &state); if (ret != CONNECTION_ERROR_NONE) { - LOG_LOGD("Connection wifi failure %d, %s", ret, get_error_message(ret)); + LOG_LOGD("Connection wifi failure %d, %s", ret, get_error_message(ret)); //LCOV_EXCL_LINE } + return (state == CONNECTION_WIFI_STATE_CONNECTED); } @@ -97,9 +100,9 @@ NetworkChangeListener::IsDataConnectionPresent() connection_cellular_state_e state = CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE; ret = connection_get_cellular_state(connection, &state); if (ret == CONNECTION_ERROR_NOT_SUPPORTED) { - LOG_LOGD("Telephony does not be supported on this target"); + LOG_LOGD("Telephony does not be supported on this target"); //LCOV_EXCL_LINE } else if (ret != CONNECTION_ERROR_NONE) { - LOG_LOGD("Connection cellular failure %d, %s", ret, get_error_message(ret)); + LOG_LOGD("Connection cellular failure %d, %s", ret, get_error_message(ret)); //LCOV_EXCL_LINE } return (state == CONNECTION_CELLULAR_STATE_CONNECTED); @@ -112,12 +115,14 @@ NetworkChangeListener::RegisterNetworkChangeListener(void) int ret = CONNECTION_ERROR_NONE; ret = connection_set_type_changed_cb(connection, OnConnectionChanged, NULL); if (ret != CONNECTION_ERROR_NONE) { - LOG_LOGD("Registration of network change listener failed %d, %s", ret, get_error_message(ret)); + LOG_LOGD("Registration of network change listener failed %d, %s", ret, get_error_message(ret)); //LCOV_EXCL_LINE } + return ret; } +//LCOV_EXCL_START int NetworkChangeListener::DeRegisterNetworkChangeListener(void) { @@ -131,5 +136,6 @@ NetworkChangeListener::DeRegisterNetworkChangeListener(void) return ret; } +//LCOV_EXCL_STOP //}//_SyncManager diff --git a/src/sync-service/SyncManager_PeriodicSyncJob.cpp b/src/sync-service/SyncManager_PeriodicSyncJob.cpp index 5e0d8a9..3f05f31 100644 --- a/src/sync-service/SyncManager_PeriodicSyncJob.cpp +++ b/src/sync-service/SyncManager_PeriodicSyncJob.cpp @@ -38,26 +38,30 @@ PeriodicSyncJob::PeriodicSyncJob(const string appId, const string syncJobName, i } +//LCOV_EXCL_START PeriodicSyncJob::PeriodicSyncJob(const PeriodicSyncJob& other) - : SyncJob(other) - , __period(other.__period) + : SyncJob(other), __period(other.__period) { -/* this->__accountHandle = other.__accountHandle; +/* + this->__accountHandle = other.__accountHandle; this->__capability = other.__capability; this->__pExtras = bundle_dup(other.__pExtras); this->__period = other.__period; - this->__syncAdapter = other.__syncAdapter;*/ + this->__syncAdapter = other.__syncAdapter; +*/ } PeriodicSyncJob& PeriodicSyncJob::operator = (const PeriodicSyncJob& other) { - /*this->__accountHandle = other.__accountHandle; +/* + this->__accountHandle = other.__accountHandle; this->__capability = other.__capability; this->__pExtras = bundle_dup(other.__pExtras); this->__period = other.__period; - this->__syncAdapter = other.__syncAdapter;*/ + this->__syncAdapter = other.__syncAdapter; +*/ return *this; } @@ -65,14 +69,17 @@ PeriodicSyncJob::operator = (const PeriodicSyncJob& other) bool PeriodicSyncJob::operator==(const PeriodicSyncJob& other) -{/* +{ +/* if ((SyncManager::GetInstance())->AreAccountsEqual(this->__accountHandle, other.__accountHandle) && (this->__capability).compare(other.__capability) == 0 && this->__period == other.__period && this->__syncAdapter == other.__syncAdapter && IsExtraEqual((PeriodicSyncJob*)&other)) { return true; - }*/ + } +*/ + return false; } @@ -80,7 +87,8 @@ PeriodicSyncJob::operator==(const PeriodicSyncJob& other) bool PeriodicSyncJob::IsExtraEqual(PeriodicSyncJob* pJob) { - /*bundle* pExtra1 = this->__pExtras; +/* + bundle* pExtra1 = this->__pExtras; bundle* pExtra2 = pJob->__pExtras; if (pExtra2 == NULL || pExtra1 == NULL) @@ -128,16 +136,19 @@ PeriodicSyncJob::IsExtraEqual(PeriodicSyncJob* pJob) } bundle_free_exported_argv(argc1, &argv1); - bundle_free_exported_argv(argc2, &argv2);*/ + bundle_free_exported_argv(argc2, &argv2); +*/ return true; } + void PeriodicSyncJob::Reset(int accountId, bundle* pUserData, int syncOption, long frequency) { SyncJob::Reset(accountId, pUserData, syncOption); __period = frequency; } +//LCOV_EXCL_STOP //}//_SyncManager diff --git a/src/sync-service/SyncManager_PeriodicSyncScheduler.cpp b/src/sync-service/SyncManager_PeriodicSyncScheduler.cpp index 2466f72..d42dd79 100644 --- a/src/sync-service/SyncManager_PeriodicSyncScheduler.cpp +++ b/src/sync-service/SyncManager_PeriodicSyncScheduler.cpp @@ -19,7 +19,6 @@ * @brief This is the implementation file for the PeriodicSyncScheduler class. */ - #if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE) #include <calendar.h> #include <contacts.h> @@ -32,12 +31,13 @@ #include "SyncManager_SyncManager.h" -PeriodicSyncScheduler::~PeriodicSyncScheduler(void) +PeriodicSyncScheduler::PeriodicSyncScheduler(void) { } -PeriodicSyncScheduler::PeriodicSyncScheduler(void) +//LCOV_EXCL_START +PeriodicSyncScheduler::~PeriodicSyncScheduler(void) { } @@ -56,15 +56,18 @@ PeriodicSyncScheduler::OnAlarmExpired(alarm_id_t alarm_id, void *user_param) SyncManager::GetInstance()->ScheduleSyncJob(pSyncJob, true); } - /*SyncJob* pJob = new (std::nothrow) SyncJob(pSyncJob->__appId, + /* + SyncJob* pJob = new (std::nothrow) SyncJob(pSyncJob->__appId, pSyncJob->__accountId, pSyncJob->__syncJobName, pSyncJob->__pExtras, pSyncJob->__isExpedited - );*/ + ); + */ return true; } +//LCOV_EXCL_STOP int @@ -111,7 +114,7 @@ PeriodicSyncScheduler::SchedulePeriodicSyncJob(PeriodicSyncJob* periodicSyncJob) __activeAlarmList.insert(make_pair(jobKey, alarm_id)); } else { - LOG_LOGD("Failed to add Alarm for %ld min, ret %d", periodicSyncJob->__period, ret); + LOG_LOGD("Failed to add Alarm for %ld min, ret %d", periodicSyncJob->__period, ret); //LCOV_EXCL_LINE return SYNC_ERROR_SYSTEM; } diff --git a/src/sync-service/SyncManager_RepositoryEngine.cpp b/src/sync-service/SyncManager_RepositoryEngine.cpp index c87d48f..7fa0c24 100644 --- a/src/sync-service/SyncManager_RepositoryEngine.cpp +++ b/src/sync-service/SyncManager_RepositoryEngine.cpp @@ -125,8 +125,10 @@ RepositoryEngine::GetInstance(void) if (!__pInstance) { __pInstance = new (std::nothrow) RepositoryEngine(); if (__pInstance == NULL) { + //LCOV_EXCL_START LOG_LOGD("Failed to construct RepositoryEngine"); return NULL; + //LCOV_EXCL_STOP } } @@ -134,16 +136,18 @@ RepositoryEngine::GetInstance(void) } +//LCOV_EXCL_START RepositoryEngine::~RepositoryEngine(void) { pthread_mutex_destroy(&__capabilityInfoMutex); } +//LCOV_EXCL_STOP RepositoryEngine::RepositoryEngine(void) { if (pthread_mutex_init(&__capabilityInfoMutex, NULL) != 0) { - LOG_LOGD("\n __syncJobQueueMutex init failed\n"); + LOG_LOGD("\n __syncJobQueueMutex init failed\n"); //LCOV_EXCL_LINE return; } } @@ -181,23 +185,29 @@ RepositoryEngine::ReadSyncJobsData(void) doc = xmlParseFile(pDocName); if (doc == NULL) { + //LCOV_EXCL_START LOG_LOGD("Failed to parse syncjobs.xml"); SaveCurrentSyncJob(); doc = xmlParseFile(pDocName); + //LCOV_EXCL_STOP } cur = xmlDocGetRootElement(doc); if (cur == NULL) { + //LCOV_EXCL_START LOG_LOGD("Found empty document while parsing syncjobs.xml"); xmlFreeDoc(doc); return; + //LCOV_EXCL_STOP } //Parse sync jobs if (xmlStrcmp(cur->name, XML_NODE_JOBS)) { + //LCOV_EXCL_START LOG_LOGD("Found empty document while parsing syncjobs.xml"); xmlFreeDoc(doc); return; + //LCOV_EXCL_STOP } else { xmlChar* pTotalJobsCount = xmlGetProp(cur, XML_ATTR_JOBS_COUNT); @@ -211,6 +221,7 @@ RepositoryEngine::ReadSyncJobsData(void) cur = cur->xmlChildrenNode; while (cur != NULL) { + //LCOV_EXCL_START if (!xmlStrcmp(cur->name, XML_NODE_PACKAGE)) { xmlChar* pPackageId; xmlChar* pJobsCount; @@ -229,8 +240,8 @@ RepositoryEngine::ReadSyncJobsData(void) curJob = curJob->next; } } - cur = cur->next; + //LCOV_EXCL_STOP } } @@ -275,23 +286,29 @@ RepositoryEngine::ReadSyncAdapters(void) doc = xmlParseFile(pDocName); if (doc == NULL) { + //LCOV_EXCL_START LOG_LOGD("Failed to parse syncadapters.xml"); SaveCurrentSyncAdapter(); doc = xmlParseFile(pDocName); + //LCOV_EXCL_STOP } cur = xmlDocGetRootElement(doc); if (cur == NULL) { + //LCOV_EXCL_START LOG_LOGD("Found empty document while parsing syncadapters.xml"); xmlFreeDoc(doc); return; + //LCOV_EXCL_STOP } //Parse sync jobs if (xmlStrcmp(cur->name, XML_NODE_SYNCADAPTERS)) { + //LCOV_EXCL_START LOG_LOGD("Found empty document while parsing syncadapters.xml"); xmlFreeDoc(doc); return; + //LCOV_EXCL_STOP } else { xmlChar* pSACount; @@ -322,6 +339,7 @@ RepositoryEngine::ReadSyncAdapters(void) } +//LCOV_EXCL_START static void bndl_iterator(const char* pKey, const char* pVal, void* pData) { @@ -331,6 +349,7 @@ bndl_iterator(const char* pKey, const char* pVal, void* pData) xmlNewProp(extraNode, XML_ATTR_SYNC_EXTRA_KEY, (const xmlChar*)pKey); xmlNewProp(extraNode, XML_ATTR_SYNC_EXTRA_VALUE, (const xmlChar*)pVal); } +//LCOV_EXCL_STOP void @@ -357,6 +376,7 @@ RepositoryEngine::WriteSyncJobsData(void) map<string, SyncJobsInfo*>::iterator itr = syncJobs.begin(); while (itr != syncJobs.end()) { + //LCOV_EXCL_START string package = itr->first; SyncJobsInfo* pJobsInfo = itr->second; @@ -418,13 +438,13 @@ RepositoryEngine::WriteSyncJobsData(void) ss.str(string()); } } - itr++; + //LCOV_EXCL_STOP } int ret = xmlSaveFormatFileEnc(PATH_SYNCJOBS, doc, "UTF-8" , 1); if (ret < 0) { - LOG_LOGD("Failed to write account data, error [%d], errno [%d]", ret, errno); + LOG_LOGD("Failed to write account data, error [%d], errno [%d]", ret, errno); //LCOV_EXCL_LINE } xmlFreeDoc(doc); xmlCleanupParser(); @@ -449,9 +469,11 @@ RepositoryEngine::WriteSyncAdapters(void) SyncAdapterAggregator* pAggregator = SyncManager::GetInstance()->GetSyncAdapterAggregator(); if (!pAggregator) { + //LCOV_EXCL_START LOG_LOGD("Failed to get sync adapter aggregator, skip writing to file"); xmlFreeDoc(doc); return; + //LCOV_EXCL_STOP } ss << pAggregator->__syncAdapterList.size(); @@ -469,7 +491,7 @@ RepositoryEngine::WriteSyncAdapters(void) int ret = xmlSaveFormatFileEnc(PATH_SYNCADAPTERS, doc, "UTF-8" , 1); if (ret < 0) { - LOG_LOGD("Failed to write sync adapter data, error [%d]", ret); + LOG_LOGD("Failed to write sync adapter data, error [%d]", ret); //LCOV_EXCL_LINE } xmlFreeDoc(doc); xmlCleanupParser(); @@ -478,6 +500,7 @@ RepositoryEngine::WriteSyncAdapters(void) } +//LCOV_EXCL_START void RepositoryEngine::ParseExtras(xmlNodePtr cur, bundle* pExtra) { @@ -542,6 +565,7 @@ RepositoryEngine::ParseSyncJobsN(xmlNodePtr cur, xmlChar* pPackage) } } } +//LCOV_EXCL_STOP void @@ -555,6 +579,7 @@ RepositoryEngine::SaveCurrentState(void) } +//LCOV_EXCL_START void RepositoryEngine::SaveCurrentSyncAdapter(void) { @@ -573,5 +598,6 @@ RepositoryEngine::SaveCurrentSyncJob(void) WriteSyncJobsData(); pthread_mutex_unlock(&__capabilityInfoMutex); } +//LCOV_EXCL_STOP //}//_SyncManager diff --git a/src/sync-service/SyncManager_ServiceInterface.cpp b/src/sync-service/SyncManager_ServiceInterface.cpp index 1c9b90a..615620f 100644 --- a/src/sync-service/SyncManager_ServiceInterface.cpp +++ b/src/sync-service/SyncManager_ServiceInterface.cpp @@ -42,4 +42,5 @@ API int sync_service_finalise(void) return 0; } + //}//_SyncManager diff --git a/src/sync-service/SyncManager_Singleton.h b/src/sync-service/SyncManager_Singleton.h index 2d02c9d..74c4e88 100644 --- a/src/sync-service/SyncManager_Singleton.h +++ b/src/sync-service/SyncManager_Singleton.h @@ -20,10 +20,12 @@ #include <stdlib.h> #include "sync-log.h" + /*namespace _SyncManager { */ + template<typename TYPE> class Singleton { @@ -33,7 +35,7 @@ public: LOG_LOGD("singleton creation called"); __pInstance = new (std::nothrow) TYPE; if (__pInstance == NULL) { - LOG_LOGD("heap error"); + LOG_LOGD("heap error"); //LCOV_EXCL_LINE } } return __pInstance; @@ -44,7 +46,7 @@ public: protected: Singleton(void) {} - virtual ~Singleton(void) {} + virtual ~Singleton(void) {} //LCOV_EXCL_LINE private: Singleton(const Singleton& obj); @@ -55,8 +57,10 @@ private: static TYPE* __pInstance; }; + template<typename TYPE> TYPE* Singleton<TYPE>::__pInstance = NULL; + //}//_SyncManager #endif // SYNC_SERVICE_SINGLETON_H diff --git a/src/sync-service/SyncManager_StorageChangeListener.cpp b/src/sync-service/SyncManager_StorageChangeListener.cpp index 8654294..24e3e09 100644 --- a/src/sync-service/SyncManager_StorageChangeListener.cpp +++ b/src/sync-service/SyncManager_StorageChangeListener.cpp @@ -31,6 +31,8 @@ /*namespace _SyncManager {*/ + +//LCOV_EXCL_START void OnMemoryStatusChanged(keynode_t* pKey, void* pData) { MemoryStatus value = static_cast<MemoryStatus> (vconf_keynode_get_int(pKey)); @@ -38,20 +40,26 @@ void OnMemoryStatusChanged(keynode_t* pKey, void* pData) SyncManager::GetInstance()->OnStorageStatusChanged(value); } -StorageChangeListener::StorageChangeListener(void) + +StorageChangeListener::~StorageChangeListener(void) { } +//LCOV_EXCL_STOP -StorageChangeListener::~StorageChangeListener(void) + +StorageChangeListener::StorageChangeListener(void) { } + int StorageChangeListener::RegisterStorageChangeListener(void) { return( vconf_notify_key_changed(VCONFKEY_SYSMAN_LOW_MEMORY, OnMemoryStatusChanged, NULL) ); } + +//LCOV_EXCL_START int StorageChangeListener::DeRegisterStorageChangeListener(void) { @@ -59,4 +67,6 @@ StorageChangeListener::DeRegisterStorageChangeListener(void) return(vconf_ignore_key_changed(VCONFKEY_SYSMAN_LOW_MEMORY, OnMemoryStatusChanged)); } +//LCOV_EXCL_STOP + //}//_SyncManager diff --git a/src/sync-service/SyncManager_SyncAdapterAggregator.cpp b/src/sync-service/SyncManager_SyncAdapterAggregator.cpp index b743edf..865f634 100644 --- a/src/sync-service/SyncManager_SyncAdapterAggregator.cpp +++ b/src/sync-service/SyncManager_SyncAdapterAggregator.cpp @@ -35,6 +35,7 @@ /*namespace _SyncManager {*/ + using namespace std; @@ -43,16 +44,18 @@ SyncAdapterAggregator::SyncAdapterAggregator(void) } +//LCOV_EXCL_START SyncAdapterAggregator::~SyncAdapterAggregator(void) { } +//LCOV_EXCL_STOP void SyncAdapterAggregator::AddSyncAdapter(const char* pPackageId, const char* pServiceAppId) { if (HasSyncAdapter(pPackageId)) { - LOG_LOGD("Sync adapter already registered for package [%s]", pPackageId); + LOG_LOGD("Sync adapter already registered for package [%s]", pPackageId); //LCOV_EXCL_LINE } else { LOG_LOGD("Registering sync-adapter [%s] for package [%s]", pServiceAppId, pPackageId); __syncAdapterList.insert(std::pair<string, string> (pPackageId, pServiceAppId)); @@ -63,11 +66,13 @@ SyncAdapterAggregator::AddSyncAdapter(const char* pPackageId, const char* pServi void SyncAdapterAggregator::dumpSyncAdapters() { - //for (multimap<string, SyncAdapter*>::iterator it = __syncAdapterList.begin(); it != __syncAdapterList.end(); ++it) - //{ - //SyncAdapter* pSyncAdapter = it->second; - //LOG_LOGD("account provider ID %s => service app Id %s & syncJobName %s", (*it).first.c_str(), pSyncAdapter->__pAppId, pSyncAdapter->__pCapability); - //} +/* + for (multimap<string, SyncAdapter*>::iterator it = __syncAdapterList.begin(); it != __syncAdapterList.end(); ++it) + { + SyncAdapter* pSyncAdapter = it->second; + LOG_LOGD("account provider ID %s => service app Id %s & syncJobName %s", (*it).first.c_str(), pSyncAdapter->__pAppId, pSyncAdapter->__pCapability); + } +*/ } @@ -77,7 +82,7 @@ SyncAdapterAggregator::GetSyncAdapter(const char* pAppId) string PkgId(pAppId); if (PkgId.empty()) { //PkgId = SyncManager::GetInstance()->GetPkgIdByCommandline(pAppId); - if (PkgId.empty()) + if (PkgId.empty()) //LCOV_EXCL_LINE return NULL; } @@ -92,20 +97,25 @@ SyncAdapterAggregator::GetSyncAdapter(const char* pAppId) } +//LCOV_EXCL_START bool SyncAdapterAggregator::HasServiceAppId(const char* pAccountProviderId) { bool result = false; - /*pair<multimap<string, SyncAdapter*>::iterator, multimap<string, SyncAdapter*>::iterator> ret; +/* + pair<multimap<string, SyncAdapter*>::iterator, multimap<string, SyncAdapter*>::iterator> ret; ret = __syncAdapterList.equal_range(pAccountProviderId); for(multimap<string, SyncAdapter*>::iterator it = ret.first; it != ret.second; ++it) { LOG_LOGD("Sync Adapter is found by using caller package name successfully"); result = true; - }*/ + } +*/ + return result; } +//LCOV_EXCL_STOP bool @@ -116,12 +126,14 @@ SyncAdapterAggregator::HasSyncAdapter(const char* pPackageId) } +//LCOV_EXCL_START void SyncAdapterAggregator::HandlePackageUninstalled(const char* pPackageId) { LOG_LOGD("Removing sync adapter for package [%s]", pPackageId); __syncAdapterList.erase(pPackageId); } +//LCOV_EXCL_STOP void diff --git a/src/sync-service/SyncManager_SyncJob.cpp b/src/sync-service/SyncManager_SyncJob.cpp index 7ae4795..fc66f20 100644 --- a/src/sync-service/SyncManager_SyncJob.cpp +++ b/src/sync-service/SyncManager_SyncJob.cpp @@ -46,6 +46,7 @@ SyncJob::~SyncJob(void) } +//LCOV_EXCL_START SyncJob::SyncJob(const SyncJob& job) { __appId = job.__appId; @@ -79,6 +80,7 @@ void SyncJob::CleanBundle(bundle* pData) { } +//LCOV_EXCL_STOP SyncJob::SyncJob(const string appId, const string syncJobName, int account, bundle* pExtras, int syncOption, int syncJobId, SyncType syncType) @@ -101,16 +103,17 @@ SyncJob::SyncJob(const string appId, const string syncJobName, int account, bund bool -SyncJob::IsNoRetry(void) +SyncJob::IsExpedited(void) { - return __noRetry; + return __isExpedited; } +//LCOV_EXCL_START bool -SyncJob::IsExpedited(void) +SyncJob::IsNoRetry(void) { - return __isExpedited; + return __noRetry; } @@ -119,6 +122,7 @@ SyncJob::IncrementWaitCounter() { __waitCounter++; } +//LCOV_EXCL_STOP string @@ -135,6 +139,7 @@ SyncJob::ToKey(void) } +//LCOV_EXCL_START static void bndl_iterator(const char* pKey, const char* pVal, void* pData) { @@ -147,13 +152,16 @@ string SyncJob::GetExtrasInfo(bundle* pData) { string str; + if (pData == NULL) { LOG_LOGD("Invalid Parameter"); return str; } + str.append("["); bundle_iterate(pData, bndl_iterator, &str); str.append("]"); + return str; } @@ -164,11 +172,13 @@ SyncJob::Reset(int accountId, bundle* pUserData, int syncOption) __accountId = accountId; __noRetry = syncOption & SYNC_OPTION_NO_RETRY; __isExpedited = syncOption & SYNC_OPTION_EXPEDITED; + if (__pExtras) { bundle_free(__pExtras); __pExtras = bundle_dup(pUserData); } } +//LCOV_EXCL_STOP } diff --git a/src/sync-service/SyncManager_SyncJobDispatcher.cpp b/src/sync-service/SyncManager_SyncJobDispatcher.cpp index aaf8dc8..151d8ba 100644 --- a/src/sync-service/SyncManager_SyncJobDispatcher.cpp +++ b/src/sync-service/SyncManager_SyncJobDispatcher.cpp @@ -50,14 +50,17 @@ long long scheduledTimeoutTime = -1; alarm_id_t alarm_id = 0; using namespace std; + /*namespace _SyncManager {*/ + SyncJobDispatcher::SyncJobDispatcher(void) { } +//LCOV_EXCL_START SyncJobDispatcher::~SyncJobDispatcher(void) { } @@ -115,6 +118,7 @@ SyncJobDispatcher::HandleJobCompletedOrCancelledLocked(SyncStatus res, SyncJob * break; } } +//LCOV_EXCL_STOP void @@ -123,11 +127,12 @@ SyncJobDispatcher::OnEventReceived(Message msg) LOG_LOGD("0. Sync Job dispatcher starts"); if (!SyncManager::GetInstance()->__isSyncPermitted) { - LOG_LOGD("Sync not permitted now"); + LOG_LOGD("Sync not permitted now"); //LCOV_EXCL_LINE return; } switch (msg.type) { + //LCOV_EXCL_START case SYNC_CANCEL: { LOG_LOGD("1. Handle Event : SYNC_CANCEL"); HandleJobCompletedOrCancelledLocked(SYNC_STATUS_CANCELLED, msg.pSyncJob); @@ -143,6 +148,7 @@ SyncJobDispatcher::OnEventReceived(Message msg) TryStartingNextJobLocked(); } break; + //LCOV_EXCL_STOP case SYNC_CHECK_ALARM: { LOG_LOGD("1. Handle Event : SYNC_CHECK_ALARM"); @@ -151,12 +157,15 @@ SyncJobDispatcher::OnEventReceived(Message msg) } break; + //LCOV_EXCL_START case SYNC_ALARM: { LOG_LOGD("1. Handle Event : SYNC_ALARM"); LOG_LOGD("2. Start next Sync job from main queue"); TryStartingNextJobLocked(); } break; + //LCOV_EXCL_STOP + default: break; }; @@ -165,6 +174,7 @@ SyncJobDispatcher::OnEventReceived(Message msg) } +//LCOV_EXCL_START bool sortFunc(const SyncJob* pJob1, const SyncJob* pJob2) { @@ -255,5 +265,6 @@ SyncJobDispatcher::TryStartingNextJobLocked() } } } +//LCOV_EXCL_STOP //}//_SyncManager diff --git a/src/sync-service/SyncManager_SyncJobQueue.cpp b/src/sync-service/SyncManager_SyncJobQueue.cpp index f1ae44f..67c9cab 100644 --- a/src/sync-service/SyncManager_SyncJobQueue.cpp +++ b/src/sync-service/SyncManager_SyncJobQueue.cpp @@ -38,11 +38,13 @@ #endif extern "C" { +//LCOV_EXCL_START SyncJobQueue::SyncJobQueue(void) : __pSyncRepositoryEngine(NULL) { //Empty } +//LCOV_EXCL_STOP SyncJobQueue::SyncJobQueue(RepositoryEngine* pSyncRepositoryEngine) @@ -51,6 +53,7 @@ SyncJobQueue::SyncJobQueue(RepositoryEngine* pSyncRepositoryEngine) } +//LCOV_EXCL_START SyncJobQueue::~SyncJobQueue(void) { //Empty @@ -69,6 +72,7 @@ SyncJobQueue::GetPrioritySyncJobQueue(void) { return __prioritySyncJobsQueue; } +//LCOV_EXCL_STOP int @@ -110,6 +114,7 @@ SyncJobQueue::RemoveSyncJob(SyncJob* pSyncJob) } +//LCOV_EXCL_START void SyncJobQueue::UpdateAgeCount() { @@ -118,6 +123,7 @@ SyncJobQueue::UpdateAgeCount() (*itr)->IncrementWaitCounter(); } } +//LCOV_EXCL_STOP } //}//_SyncManager diff --git a/src/sync-service/SyncManager_SyncJobsAggregator.cpp b/src/sync-service/SyncManager_SyncJobsAggregator.cpp index a4addf7..874c79c 100644 --- a/src/sync-service/SyncManager_SyncJobsAggregator.cpp +++ b/src/sync-service/SyncManager_SyncJobsAggregator.cpp @@ -41,12 +41,15 @@ SyncJobsAggregator::SyncJobsAggregator(void) { } + +//LCOV_EXCL_START SyncJobsAggregator::~SyncJobsAggregator(void) { } -/*SyncJob* +/* +SyncJob* SyncJobsAggregator::GetOrCreateSyncJob(const char* pPackageId, const char* pSyncJobName, SyncJob* pSyncJob) { map<string, SyncJobsInfo*>::iterator itr = __syncJobsContainer.find(pPackageId); @@ -55,7 +58,8 @@ SyncJobsAggregator::GetOrCreateSyncJob(const char* pPackageId, const char* pSync SyncJobsInfo* pPackageSyncJobsInfo = itr->second; pPackageSyncJobsInfo->Add(pSyncJobName, pSyncJob); } -}*/ +} +*/ bool @@ -64,6 +68,7 @@ SyncJobsAggregator::HasSyncJob(const char* pPackageId, const char* pSyncJobName) ISyncJob* pSyncJob = GetSyncJob(pPackageId, pSyncJobName); return pSyncJob != NULL; } +//LCOV_EXCL_STOP int @@ -95,10 +100,12 @@ SyncJobsAggregator::AddSyncJob(const char* pPackageId, const char* pSyncJobName, SyncJobsInfo* pPackageSyncJobsInfo = itr->second; pPackageSyncJobsInfo->AddSyncJob(pSyncJobName, pSyncJob); } else { + //LCOV_EXCL_START LOG_LOGD("Creating new Sync Jobs info handle for package %s", pPackageId); SyncJobsInfo* pPackageSyncJobsInfo = new (std::nothrow) SyncJobsInfo(pPackageId); pPackageSyncJobsInfo->AddSyncJob(pSyncJobName, pSyncJob); __syncJobsContainer.insert(make_pair(pPackageId, pPackageSyncJobsInfo)); + //LCOV_EXCL_STOP } } @@ -121,6 +128,7 @@ SyncJobsAggregator::RemoveSyncJob(const char* pPackageId, int syncJobId) } +//LCOV_EXCL_START int SyncJobsAggregator::RemoveSyncJob(const char* pPackageId, const char* pSyncJobName) { @@ -142,7 +150,6 @@ SyncJobsAggregator::RemoveSyncJob(const char* pPackageId, const char* pSyncJobNa } - int SyncJobsAggregator::GetSyncJobId(const char* pPackageId, const char* pSyncJobName) { @@ -151,6 +158,7 @@ SyncJobsAggregator::GetSyncJobId(const char* pPackageId, const char* pSyncJobNam return id; } +//LCOV_EXCL_STOP ISyncJob* @@ -167,6 +175,7 @@ SyncJobsAggregator::GetSyncJob(const char* pPackageId, const char* pSyncJobName) } +//LCOV_EXCL_START void SyncJobsAggregator::HandlePackageUninstalled(const char* pPackageId) { @@ -180,6 +189,7 @@ SyncJobsAggregator::HandlePackageUninstalled(const char* pPackageId) LOG_LOGD("Sync jobs for package %s are not found", pPackageId); } } +//LCOV_EXCL_STOP ISyncJob* @@ -192,12 +202,13 @@ SyncJobsAggregator::GetSyncJob(const char* pPackageId, int syncJobId) pSyncJob = pPackageSyncJobsInfo->GetSyncJob(syncJobId); } else { - LOG_LOGD("Sync jobs for package %s are not found", pPackageId); + LOG_LOGD("Sync jobs for package %s are not found", pPackageId); //LCOV_EXCL_LINE } return pSyncJob; } +//LCOV_EXCL_START vector< int > SyncJobsAggregator::GetSyncJobIDList(const char* pPackageId) { @@ -209,6 +220,7 @@ SyncJobsAggregator::GetSyncJobIDList(const char* pPackageId) } return list; } +//LCOV_EXCL_STOP SyncJobsInfo* diff --git a/src/sync-service/SyncManager_SyncJobsInfo.cpp b/src/sync-service/SyncManager_SyncJobsInfo.cpp index bb97e34..af676e4 100644 --- a/src/sync-service/SyncManager_SyncJobsInfo.cpp +++ b/src/sync-service/SyncManager_SyncJobsInfo.cpp @@ -110,13 +110,14 @@ SyncJobsInfo::RemoveSyncJob(string syncJobname) __syncIdList.erase(syncJobId); } else { - LOG_LOGD("Sync job name doesnt exists in package [%s] for job name [%s]", __packageId.c_str(), syncJobname.c_str()); + LOG_LOGD("Sync job name doesnt exists in package [%s] for job name [%s]", __packageId.c_str(), syncJobname.c_str()); //LCOV_EXCL_LINE } return SYNC_ERROR_NONE; } +//LCOV_EXCL_START void SyncJobsInfo::RemoveAllSyncJobs() { @@ -128,6 +129,7 @@ SyncJobsInfo::RemoveAllSyncJobs() itr++; } } +//LCOV_EXCL_STOP int @@ -151,6 +153,7 @@ SyncJobsInfo::GetNextSyncJobId() } +//LCOV_EXCL_START vector <int> SyncJobsInfo::GetSyncJobIdList() { @@ -164,6 +167,7 @@ SyncJobsInfo::GetSyncJobIdList() } return idList; } +//LCOV_EXCL_STOP map<int, ISyncJob*>& diff --git a/src/sync-service/SyncManager_SyncManager.cpp b/src/sync-service/SyncManager_SyncManager.cpp index 040a8d8..6b4dbd5 100644 --- a/src/sync-service/SyncManager_SyncManager.cpp +++ b/src/sync-service/SyncManager_SyncManager.cpp @@ -63,11 +63,13 @@ SyncManager::SetSyncSetting(bool enable) } +//LCOV_EXCL_START bool SyncManager::GetSyncSetting() { return __isSyncPermitted; } +//LCOV_EXCL_STOP int @@ -77,9 +79,10 @@ SyncManager::AddOnDemandSync(string pPackageId, const char* syncJobName, int acc SYNC_LOGE_RET_RES(pSyncAdapterApp != NULL, SYNC_ERROR_SYNC_ADAPTER_NOT_FOUND, "Sync adapter cannot be found for package %s", pPackageId.c_str()); if (accountId != -1 && !GetSyncSupport(accountId)) { + //LCOV_EXCL_START LOG_LOGD("Sync is not enabled for account ID %s", accountId); - return SYNC_ERROR_SYSTEM; + //LCOV_EXCL_STOP } SyncJob* pJob = new (std::nothrow) SyncJob(pSyncAdapterApp, syncJobName, accountId, pExtras, syncOption, syncJobId, SYNC_TYPE_ON_DEMAND); @@ -111,8 +114,10 @@ int SyncManager::AddPeriodicSyncJob(string pPackageId, const char* syncJobName, int accountId, bundle* pExtras, int syncOption, int syncJobId, long period) { if (period < 1800) { + //LCOV_EXCL_START LOG_LOGD("Requested period %d is less than minimum, rounding up to 30 mins", period); period = 1800; + //LCOV_EXCL_STOP } const char* pSyncAdapterApp = __pSyncAdapterAggregator->GetSyncAdapter(pPackageId.c_str()); @@ -120,8 +125,10 @@ SyncManager::AddPeriodicSyncJob(string pPackageId, const char* syncJobName, int LOG_LOGD("Found sync adapter [%s]", pSyncAdapterApp); if (accountId != -1 && !GetSyncSupport(accountId)) { + //LCOV_EXCL_START LOG_LOGD("Sync is not enabled for account ID %s", accountId); return SYNC_ERROR_SYSTEM; + //LCOV_EXCL_STOP } PeriodicSyncJob* pRequestedJob = new (std::nothrow) PeriodicSyncJob(pSyncAdapterApp, syncJobName, accountId, pExtras, syncOption, syncJobId, SYNC_TYPE_PERIODIC, period / 60); @@ -148,8 +155,10 @@ SyncManager::AddDataSyncJob(string pPackageId, const char* syncJobName, int acco LOG_LOGD("Found sync adapter [%s]", pSyncAdapterApp); if (accountId != -1 && !GetSyncSupport(accountId)) { + //LCOV_EXCL_START LOG_LOGD("Sync is not enabled for account ID %s", accountId); return SYNC_ERROR_SYSTEM; + //LCOV_EXCL_STOP } DataSyncJob* pRequestedJob = new (std::nothrow) DataSyncJob(pSyncAdapterApp, syncJobName, accountId, pExtras, syncOption, syncJobId, SYNC_TYPE_DATA_CHANGE, pCapability); @@ -200,6 +209,7 @@ SyncManager::RemoveSyncJob(string packageId, int syncJobId) } +//LCOV_EXCL_START SyncJobQueue* SyncManager::GetSyncJobQueue(void) const { @@ -213,6 +223,7 @@ SyncManager::AddToSyncQueue(SyncJob* pJob) //No need to add mutex here, will be called during startup only return __pSyncJobQueue->AddSyncJob(pJob); } +//LCOV_EXCL_STOP void @@ -222,6 +233,7 @@ SyncManager::AddRunningAccount(int account_id, int pid) } +//LCOV_EXCL_START int SyncManager::GetAccountPid(int account_id) { @@ -364,6 +376,7 @@ static int OnPackageUninstalled(unsigned int userId, int reqId, const char* pPkg return 0; } +//LCOV_EXCL_STOP string @@ -381,18 +394,19 @@ SyncManager::GetPkgIdByAppId(const char* pAppId) pkgId.append(pPkgId); } else { - LOG_LOGD("Failed to get Pkg ID from App Id [%s]", pAppId); + LOG_LOGD("Failed to get Pkg ID from App Id [%s]", pAppId); //LCOV_EXCL_LINE } pkgmgrinfo_appinfo_destroy_appinfo(handle); } else { - LOG_LOGD("Failed to get pkgmgr AppInfoHandle from App Id [%s]", pAppId); + LOG_LOGD("Failed to get pkgmgr AppInfoHandle from App Id [%s]", pAppId); //LCOV_EXCL_LINE } return pkgId; } +//LCOV_EXCL_START string SyncManager::GetPkgIdByCommandline(const char* pCommandLine) { @@ -421,6 +435,7 @@ SyncManager::GetPkgIdByCommandline(const char* pCommandLine) return pkgId; } +//LCOV_EXCL_STOP void @@ -431,12 +446,13 @@ SyncManager::RegisterForNetworkChange(void) LOG_LOGD("Network listener : Success"); } else { - LOG_LOGD("Network listener : Failed"); + LOG_LOGD("Network listener : Failed"); //LCOV_EXCL_LINE } } } +//LCOV_EXCL_START int SyncManager::DeRegisterForNetworkChange(void) { @@ -455,6 +471,7 @@ void OnUPSModeChangedCb(keynode_t* pKey, void* pData) SyncManager::GetInstance()->OnUPSModeChanged(enabled); } +//LCOV_EXCL_STOP void @@ -464,11 +481,12 @@ SyncManager::RegisterForUPSModeChange(void) LOG_LOGD("UPS mode listener : Success"); } else { - LOG_LOGD("UPS mode listener : Failed"); + LOG_LOGD("UPS mode listener : Failed"); //LCOV_EXCL_LINE } } +//LCOV_EXCL_START int SyncManager::DeRegisterForUPSModeChange(void) { @@ -476,6 +494,7 @@ SyncManager::DeRegisterForUPSModeChange(void) return vconf_ignore_key_changed(VCONFKEY_SETAPPL_PSMODE, OnUPSModeChangedCb); } +//LCOV_EXCL_STOP void @@ -486,12 +505,13 @@ SyncManager::RegisterForStorageChange(void) LOG_LOGD("Storage listener : Success"); } else { - LOG_LOGD("Storage listener : Failed"); + LOG_LOGD("Storage listener : Failed"); //LCOV_EXCL_LINE } } } +//LCOV_EXCL_START int SyncManager::DeRegisterForStorageChange(void) { @@ -500,6 +520,7 @@ SyncManager::DeRegisterForStorageChange(void) } return -1; } +//LCOV_EXCL_STOP void @@ -510,12 +531,13 @@ SyncManager::RegisterForBatteryStatus(void) LOG_LOGD("Battery listener : Success"); } else { - LOG_LOGD("Battery listener : Failed"); + LOG_LOGD("Battery listener : Failed"); //LCOV_EXCL_LINE } } } +//LCOV_EXCL_START int SyncManager::DeRegisterForBatteryStatus(void) { @@ -524,6 +546,7 @@ SyncManager::DeRegisterForBatteryStatus(void) } return -1; } +//LCOV_EXCL_STOP void SyncManager::RegisterForDataChange(void) @@ -533,12 +556,13 @@ void SyncManager::RegisterForDataChange(void) LOG_LOGD("Data listener : Success"); } else { - LOG_LOGD("Data listener : Failed"); + LOG_LOGD("Data listener : Failed"); //LCOV_EXCL_LINE } } } +//LCOV_EXCL_START int SyncManager::DeRegisterForDataChange(void) { if (__pDataChangeSyncScheduler) { @@ -547,6 +571,7 @@ int SyncManager::DeRegisterForDataChange(void) return -1; } +//LCOV_EXCL_STOP int @@ -555,28 +580,34 @@ SyncManager::SetPkgMgrClientStatusChangedListener(void) int eventType = PKGMGR_CLIENT_STATUS_UNINSTALL; if (pkgmgr_client_set_status_type(__pPkgmgrClient, eventType) != PKGMGR_R_OK) { + //LCOV_EXCL_START LOG_LOGD("pkgmgr_client_set_status_type failed."); pkgmgr_client_free(__pPkgmgrClient); __pPkgmgrClient = NULL; return -1; + //LCOV_EXCL_STOP } if (pkgmgr_client_listen_status(__pPkgmgrClient, OnPackageUninstalled, &__syncJobQueueMutex) < 0) { + //LCOV_EXCL_START LOG_LOGD("pkgmgr_client_listen_status failed."); pkgmgr_client_free(__pPkgmgrClient); __pPkgmgrClient = NULL; return -1; + //LCOV_EXCL_STOP } return 0; } +//LCOV_EXCL_START RepositoryEngine* SyncManager::GetSyncRepositoryEngine(void) { return __pSyncRepositoryEngine; } +//LCOV_EXCL_STOP void @@ -595,9 +626,11 @@ SyncManager::CancelActiveSyncJob(SyncJob* pSyncJob) CurrentSyncContext *pCurrSyncContext = __pCurrentSyncJobQueue->GetCurrJobfromKey(pSyncJob->__key); pthread_mutex_unlock(&__currJobQueueMutex); if (pCurrSyncContext != NULL) { + //LCOV_EXCL_START g_source_remove(pCurrSyncContext->GetTimerId()); CloseCurrentSyncContext(pCurrSyncContext); SendCancelSyncsMessage(pSyncJob); + //LCOV_EXCL_STOP } } @@ -638,7 +671,7 @@ SyncManager::Construct(void) int upsMode; if (-1 == access(SYNC_DATA_DIR, F_OK)) { - mkdir(SYNC_DATA_DIR, 755); + mkdir(SYNC_DATA_DIR, 755); //LCOV_EXCL_LINE } ret = vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &upsMode); @@ -723,6 +756,7 @@ SyncManager::Construct(void) } +//LCOV_EXCL_START SyncManager::~SyncManager(void) { LOG_LOGD("SyncManager::~SyncManager() Starts"); @@ -795,7 +829,7 @@ SyncManager::IsActiveAccount(vector<account_h> accounts, account_h account) { return true; //TODO: uncomment while implementing __running accounts logic - /* +/* for (unsigned int i = 0; i < accounts.size(); i++) { if (AreAccountsEqual(accounts[i], account)) @@ -804,8 +838,10 @@ SyncManager::IsActiveAccount(vector<account_h> accounts, account_h account) } } - return false;*/ + return false; +*/ } +//LCOV_EXCL_STOP SyncAdapterAggregator* @@ -838,6 +874,7 @@ SyncManager::HandleShutdown(void) } +//LCOV_EXCL_START void SyncManager::RecordSyncAdapter(void) { @@ -854,6 +891,7 @@ SyncManager::RecordSyncJob(void) __pSyncRepositoryEngine->SaveCurrentSyncJob(); pthread_mutex_unlock(&__syncJobQueueMutex); } +//LCOV_EXCL_STOP bool @@ -873,7 +911,7 @@ SyncManager::GetSyncSupport(int accountId) LOG_LOGE_BOOL(ret == ACCOUNT_ERROR_NONE, "account access failed [%d]", ret); if (syncSupport == ACCOUNT_SYNC_INVALID || syncSupport == ACCOUNT_SYNC_NOT_SUPPORT) { - LOG_LOGD("The account does not support sync"); + LOG_LOGD("The account does not support sync"); //LCOV_EXCL_LINE return false; } @@ -883,6 +921,7 @@ SyncManager::GetSyncSupport(int accountId) } +//LCOV_EXCL_START void SyncManager::SendCancelSyncsMessage(SyncJob* pJob) { @@ -962,6 +1001,8 @@ SyncManager::SendSyncAlarmMessage() msg.type = SYNC_ALARM; FireEvent(__pSyncJobDispatcher, msg); } +//LCOV_EXCL_STOP + void SyncManager::SendSyncCheckAlarmMessage() @@ -973,16 +1014,16 @@ SyncManager::SendSyncCheckAlarmMessage() FireEvent(__pSyncJobDispatcher, msg); } -/* - * - */ + +//LCOV_EXCL_START bool SyncManager::GetBundleVal(const char* pVal) { if (pVal == NULL) { return false; } - else return strcmp(pVal, "true")? true: false; + else + return strcmp(pVal, "true")? true: false; } @@ -993,8 +1034,10 @@ bool get_capability_all_cb(const char* capability_type, account_capability_state if (capability_state == ACCOUNT_CAPABILITY_ENABLED) { pSsncableCapabilities->insert(capability_type); } + return true; } +//LCOV_EXCL_STOP void @@ -1011,15 +1054,18 @@ SyncManager::ScheduleSyncJob(SyncJob* pJob, bool fireCheckAlarm) SendSyncCheckAlarmMessage(); } } + //LCOV_EXCL_START else if (err == SYNC_ERROR_ALREADY_IN_PROGRESS) { LOG_LOGD("Duplicate sync job [%s], No need to enqueue", pJob->__key.c_str()); } else { LOG_LOGD("Failed to add into sync job list"); } + //LCOV_EXCL_STOP } +//LCOV_EXCL_START void SyncManager::TryToRescheduleJob(SyncStatus syncResult, SyncJob* pJob) { @@ -1049,5 +1095,6 @@ SyncManager::IsJobActive(CurrentSyncContext *pCurrSync) pthread_mutex_unlock(&__currJobQueueMutex); return ret; } +//LCOV_EXCL_STOP //}//_SyncManager diff --git a/src/sync-service/SyncManager_SyncService.cpp b/src/sync-service/SyncManager_SyncService.cpp index 4a8fd8d..9f3cf0f 100644 --- a/src/sync-service/SyncManager_SyncService.cpp +++ b/src/sync-service/SyncManager_SyncService.cpp @@ -65,19 +65,20 @@ static bool check_jobs = false; #define PRIV_CONTACT_READ "http://tizen.org/privilege/contact.read" #endif - #define SYS_DBUS_INTERFACE "org.tizen.system.deviced.PowerOff" #define SYS_DBUS_MATCH_RULE "type='signal',interface='org.tizen.system.deviced.PowerOff'" #define SYS_DBUS_PATH "/Org/Tizen/System/DeviceD/PowerOff" #define POWEROFF_MSG "ChangeState" + +using namespace std; + bool ShutdownInitiated = false; static TizenSyncManager* sync_ipc_obj = NULL; GHashTable* g_hash_table = NULL; string sa_app_id; static guint signal_id = -1; -using namespace std; void convert_to_path(char app_id[]) { @@ -96,20 +97,26 @@ SyncService::StartService() { __pSyncManagerInstance = SyncManager::GetInstance(); if (__pSyncManagerInstance == NULL) { + //LCOV_EXCL_START LOG_LOGD("Failed to initialize sync manager"); return -1; + //LCOV_EXCL_STOP } bool ret = __pSyncManagerInstance->Construct(); if (!ret) { + //LCOV_EXCL_START LOG_LOGD("Sync Manager Construct failed"); return -1; + //LCOV_EXCL_STOP } int cynara_result = cynara_initialize(&pCynara, NULL); if (cynara_result != CYNARA_API_SUCCESS) { + //LCOV_EXCL_START LOG_LOGD("Cynara Initialization is failed"); return -1; + //LCOV_EXCL_STOP } return 0; @@ -156,7 +163,7 @@ get_caller_pid(GDBusMethodInvocation* pMethodInvocation) const char *name = NULL; name = g_dbus_method_invocation_get_sender(pMethodInvocation); if (name == NULL) { - LOG_LOGD("GDbus error: Failed to get sender name"); + LOG_LOGD("GDbus error: Failed to get sender name"); //LCOV_EXCL_LINE return -1; } @@ -191,26 +198,34 @@ __get_data_for_checking_privilege(GDBusMethodInvocation *invocation, char **clie gdbus_conn = g_dbus_method_invocation_get_connection(invocation); if (gdbus_conn == NULL) { + //LCOV_EXCL_START LOG_LOGD("sync service: g_dbus_method_invocation_get_connection failed"); return -1; + //LCOV_EXCL_STOP } sender = (char*) g_dbus_method_invocation_get_sender(invocation); if (sender == NULL) { + //LCOV_EXCL_START LOG_LOGD("sync service: g_dbus_method_invocation_get_sender failed"); return -1; + //LCOV_EXCL_STOP } ret = cynara_creds_gdbus_get_user(gdbus_conn, sender, USER_METHOD_DEFAULT, user); if (ret != CYNARA_API_SUCCESS) { + //LCOV_EXCL_START LOG_LOGD("sync service: cynara_creds_gdbus_get_user failed, ret = %d", ret); return -1; + //LCOV_EXCL_STOP } ret = cynara_creds_gdbus_get_client(gdbus_conn, sender, CLIENT_METHOD_DEFAULT, client); if (ret != CYNARA_API_SUCCESS) { + //LCOV_EXCL_START LOG_LOGD("sync service: cynara_creds_gdbus_get_client failed, ret = %d", ret); return -1; + //LCOV_EXCL_STOP } guint pid = get_caller_pid(invocation); @@ -218,8 +233,10 @@ __get_data_for_checking_privilege(GDBusMethodInvocation *invocation, char **clie *session = cynara_session_from_pid(pid); if (*session == NULL) { + //LCOV_EXCL_START LOG_LOGD("sync service: cynara_session_from_pid failed"); return -1; + //LCOV_EXCL_STOP } return SYNC_ERROR_NONE; @@ -238,11 +255,13 @@ __check_privilege_by_cynara(const char *client, const char *session, const char LOG_LOGD("sync service: cynara_check success, privilege [%s], result [CYNARA_API_ACCESS_ALLOWED]", privilege); return SYNC_ERROR_NONE; case CYNARA_API_ACCESS_DENIED: - LOG_LOGD("sync service: cynara_check failed, privilege [%s], result [CYNARA_API_ACCESS_DENIED]", privilege); + LOG_LOGD("sync service: cynara_check failed, privilege [%s], result [CYNARA_API_ACCESS_DENIED]", privilege); //LCOV_EXCL_LINE return SYNC_ERROR_PERMISSION_DENIED; default: + //LCOV_EXCL_START cynara_strerror(ret, err_buf, sizeof(err_buf)); LOG_LOGD("sync service: cynara_check error [%s], privilege [%s] is required", err_buf, privilege); + //LCOV_EXCL_STOP return SYNC_ERROR_PERMISSION_DENIED; } } @@ -258,21 +277,25 @@ _check_privilege(GDBusMethodInvocation *invocation, const char *privilege) ret = __get_data_for_checking_privilege(invocation, &client, &session, &user); if (ret != SYNC_ERROR_NONE) { + //LCOV_EXCL_START LOG_LOGD("sync service: __get_data_for_checking_privilege is failed, ret [%d]", ret); g_free(client); g_free(user); if (session != NULL) g_free(session); + //LCOV_EXCL_STOP return SYNC_ERROR_PERMISSION_DENIED; } ret = __check_privilege_by_cynara(client, session, user, privilege); if (ret != SYNC_ERROR_NONE) { + //LCOV_EXCL_START LOG_LOGD("sync service: __check_privilege_by_cynara is failed, ret [%d]", ret); g_free(client); g_free(user); if (session != NULL) g_free(session); + //LCOV_EXCL_STOP return SYNC_ERROR_PERMISSION_DENIED; } @@ -305,6 +328,7 @@ int _check_privilege_contact_read(GDBusMethodInvocation *invocation) #endif +//LCOV_EXCL_START int SyncService::TriggerStartSync(const char* appId, int accountId, const char* syncJobName, bool isDataSync, bundle* pExtras) { @@ -418,6 +442,7 @@ SyncService::TriggerStopSync(const char* appId, int accountId, const char* syncJ GVariant* pBundle = marshal_bundle(pExtras); tizen_sync_adapter_emit_cancel_sync(pSyncAdapter, accountId, syncJobName, isDataSync, pBundle); } +//LCOV_EXCL_STOP int @@ -544,6 +569,7 @@ SyncService::HandleShutdown(void) } +//LCOV_EXCL_START int get_service_name_by_pid(guint pid, char** pAppId) { @@ -600,6 +626,7 @@ get_service_name_by_pid(guint pid, char** pAppId) return SYNC_ERROR_NONE; } +//LCOV_EXCL_STOP int @@ -629,6 +656,7 @@ get_num_of_sync_jobs(string pkgId) /* * org.tizen.sync.adapter interface methods */ +//LCOV_EXCL_START gboolean sync_adapter_handle_send_result(TizenSyncAdapter* pObject, GDBusMethodInvocation* pInvocation, const gchar* pCommandLine, @@ -687,6 +715,7 @@ sync_adapter_handle_init_complete(TizenSyncAdapter* pObject, GDBusMethodInvocati return true; } +//LCOV_EXCL_STOP /* @@ -711,8 +740,10 @@ sync_manager_add_on_demand_job(TizenSyncManager* pObject, GDBusMethodInvocation* free(pAppId); } else { + //LCOV_EXCL_START LOG_LOGD("Request seems to be from app-id less/command line based request %s", pCommandLine); pkgIdStr = SyncManager::GetInstance()->GetPkgIdByCommandline(pCommandLine); + //LCOV_EXCL_STOP } int sync_job_id = 0; @@ -724,7 +755,7 @@ sync_manager_add_on_demand_job(TizenSyncManager* pObject, GDBusMethodInvocation* bundle_free(pBundle); } else { - LOG_LOGD("Failed to get package id"); + LOG_LOGD("Failed to get package id"); //LCOV_EXCL_LINE ret = SYNC_ERROR_SYSTEM; } @@ -763,20 +794,24 @@ sync_manager_remove_job(TizenSyncManager* pObject, GDBusMethodInvocation* pInvoc free(pAppId); } else { + //LCOV_EXCL_START LOG_LOGD("Request seems to be from app-id less/command line based request"); pkgIdStr = SyncManager::GetInstance()->GetPkgIdByCommandline(pCommandLine); + //LCOV_EXCL_STOP } if (!pkgIdStr.empty()) { LOG_LOGD("package id [%s]", pkgIdStr.c_str()); ret = SyncManager::GetInstance()->RemoveSyncJob(pkgIdStr, sync_job_id); } else - LOG_LOGD("sync service: Get package Id fail %d", ret); + LOG_LOGD("sync service: Get package Id fail %d", ret); //LCOV_EXCL_LINE if (ret != SYNC_ERROR_NONE) { + //LCOV_EXCL_START GError* error = g_error_new(_sync_error_quark(), ret, "system error"); g_dbus_method_invocation_return_gerror(pInvocation, error); g_clear_error(&error); + //LCOV_EXCL_STOP } else tizen_sync_manager_complete_remove_job(pObject, pInvocation); @@ -807,9 +842,11 @@ sync_manager_add_periodic_job(TizenSyncManager* pObject, GDBusMethodInvocation* ret = _check_privilege_alarm_set(pInvocation); if (ret != SYNC_ERROR_NONE) { + //LCOV_EXCL_START GError *error = g_error_new(_sync_error_quark(), ret, "sync service: alarm.set permission denied"); g_dbus_method_invocation_return_gerror(pInvocation, error); g_clear_error(&error); + //LCOV_EXCL_STOP return true; } @@ -824,8 +861,10 @@ sync_manager_add_periodic_job(TizenSyncManager* pObject, GDBusMethodInvocation* free(pAppId); } else { + //LCOV_EXCL_START LOG_LOGD("Request seems to be from app-id less/command line based request"); pkgIdStr = SyncManager::GetInstance()->GetPkgIdByCommandline(pCommandLine); + //LCOV_EXCL_STOP } if (!pkgIdStr.empty()) { LOG_LOGD("Params acc[%d] name[%s] option[%d] period[%d] package[%s]", accountId, pSyncJobName, sync_option, sync_interval, pkgIdStr.c_str()); @@ -835,7 +874,7 @@ sync_manager_add_periodic_job(TizenSyncManager* pObject, GDBusMethodInvocation* bundle_free(pBundle); } else - LOG_LOGD("sync service: Get package Id fail %d", ret); + LOG_LOGD("sync service: Get package Id fail %d", ret); //LCOV_EXCL_LINE if (ret != SYNC_ERROR_NONE) { GError* error = g_error_new(_sync_error_quark(), ret, "system error"); @@ -881,6 +920,7 @@ sync_manager_add_data_change_job(TizenSyncManager* pObject, GDBusMethodInvocatio ret = _check_privilege_contact_read(pInvocation); if (ret != SYNC_ERROR_NONE) { + //LCOV_EXCL_START GError* error = NULL; if (!strcmp(capability, "http://tizen.org/sync/capability/calendar")) error = g_error_new(_sync_error_quark(), ret, "sync service: calendar.read permission denied"); @@ -889,6 +929,7 @@ sync_manager_add_data_change_job(TizenSyncManager* pObject, GDBusMethodInvocatio g_dbus_method_invocation_return_gerror(pInvocation, error); g_clear_error(&error); + //LCOV_EXCL_STOP return true; } } @@ -905,8 +946,10 @@ sync_manager_add_data_change_job(TizenSyncManager* pObject, GDBusMethodInvocatio free(pAppId); } else { + //LCOV_EXCL_START LOG_LOGD("Request seems to be from app-id less/command line based request"); pkgIdStr = SyncManager::GetInstance()->GetPkgIdByCommandline(pCommandLine); + //LCOV_EXCL_STOP } if (!pkgIdStr.empty()) { LOG_LOGD("Params account [%d] job_name [%s] sync_option[%d] sync_job_id[%d] package [%s] ", accountId, pCapabilityArg, sync_option, sync_job_id, pkgIdStr.c_str()); @@ -918,7 +961,7 @@ sync_manager_add_data_change_job(TizenSyncManager* pObject, GDBusMethodInvocatio bundle_free(pBundle); } else - LOG_LOGD("sync service: Get package Id fail %d", ret); + LOG_LOGD("sync service: Get package Id fail %d", ret); //LCOV_EXCL_LINE if (ret != SYNC_ERROR_NONE) { GError* error = g_error_new(_sync_error_quark(), ret, "system error"); @@ -948,7 +991,7 @@ is_service_app(pid_t pid) char *current_app_id = NULL; int ret = app_manager_get_app_id(pid, ¤t_app_id); if (ret != APP_MANAGER_ERROR_NONE) { - LOG_LOGD("Getting current app id is failed : %d, %s", ret, get_error_message(ret)); + LOG_LOGD("Getting current app id is failed : %d, %s", ret, get_error_message(ret)); //LCOV_EXCL_LINE return false; } @@ -956,18 +999,22 @@ is_service_app(pid_t pid) ret = pkgmgrinfo_appinfo_get_appinfo(current_app_id, ¤t_app_info); if (ret != PMINFO_R_OK) { + //LCOV_EXCL_START LOG_LOGD("Current app info handle creation error : %d, %s", ret, get_error_message(ret)); free(current_app_id); return false; + //LCOV_EXCL_STOP } char *current_app_type = NULL; ret = pkgmgrinfo_appinfo_get_component_type(current_app_info, ¤t_app_type); if (ret != PMINFO_R_OK) { + //LCOV_EXCL_START LOG_LOGD("Current app info getting app type error : %d, %s", ret, get_error_message(ret)); pkgmgrinfo_appinfo_destroy_appinfo(current_app_info); free(current_app_id); return false; + //LCOV_EXCL_STOP } else { if (!strcmp(current_app_type, "svcapp")) { @@ -975,10 +1022,12 @@ is_service_app(pid_t pid) pkgmgrinfo_appinfo_destroy_appinfo(current_app_info); } else { + //LCOV_EXCL_START LOG_LOGD("Current app is not a service application : %s", current_app_type); pkgmgrinfo_appinfo_destroy_appinfo(current_app_info); free(current_app_id); return false; + //LCOV_EXCL_STOP } } @@ -1023,9 +1072,11 @@ sync_manager_add_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocation* guint pid = get_caller_pid(pInvocation); if (!is_service_app(pid)) { + //LCOV_EXCL_START GError* error = g_error_new(_sync_error_quark(), SYNC_ERROR_INVALID_OPERATION, "App not supported"); g_dbus_method_invocation_return_gerror(pInvocation, error); g_clear_error(&error); + //LCOV_EXCL_STOP return false; } @@ -1037,19 +1088,24 @@ sync_manager_add_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocation* pkgIdStr = SyncManager::GetInstance()->GetPkgIdByAppId(pAppId); } else { + //LCOV_EXCL_START ret = get_service_name_by_pid(pid, &pAppId); LOG_LOGD("Request seems to be from app-id less/command line based request"); pkgIdStr = SyncManager::GetInstance()->GetPkgIdByCommandline(pCommandLine); + //LCOV_EXCL_STOP } if (!pkgIdStr.empty()) { SyncAdapterAggregator* pAggregator = SyncManager::GetInstance()->GetSyncAdapterAggregator(); if (pAggregator == NULL) { + //LCOV_EXCL_START LOG_LOGD("sync adapter aggregator is NULL"); tizen_sync_manager_complete_add_sync_adapter(pObject, pInvocation); return true; + //LCOV_EXCL_STOP } if (pAggregator->HasSyncAdapter(pkgIdStr.c_str())) { + //LCOV_EXCL_START const char *registered_app_id = pAggregator->GetSyncAdapter(pkgIdStr.c_str()); LOG_LOGD("registered appId is [%s]", registered_app_id); LOG_LOGD("caller appId is [%s]", pAppId); @@ -1061,6 +1117,7 @@ sync_manager_add_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocation* } else { check_jobs = true; // Probably sync service may have started this service. Alert sync manager for scheduling pending jobs. + //LCOV_EXCL_STOP } } @@ -1082,27 +1139,29 @@ sync_manager_add_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocation* ret = SYNC_ERROR_NONE; } else { - LOG_LOGD("export failed %s", error->message); + LOG_LOGD("export failed %s", error->message); //LCOV_EXCL_LINE } } else { - LOG_LOGD("sync adapter object creation failed"); + LOG_LOGD("sync adapter object creation failed"); //LCOV_EXCL_LINE } } else { - LOG_LOGD("Failed to get package ID"); + LOG_LOGD("Failed to get package ID"); //LCOV_EXCL_LINE } if (ret != SYNC_ERROR_NONE) { + //LCOV_EXCL_START GError* error = g_error_new(_sync_error_quark(), ret, "system error"); g_dbus_method_invocation_return_gerror(pInvocation, error); g_clear_error(&error); + //LCOV_EXCL_STOP } else tizen_sync_manager_complete_add_sync_adapter(pObject, pInvocation); if (check_jobs) { - SyncManager::GetInstance()->AlertForChange(); + SyncManager::GetInstance()->AlertForChange(); //LCOV_EXCL_LINE } LOG_LOGD("sync service: adding sync adapter ends"); @@ -1119,9 +1178,11 @@ sync_manager_remove_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocatio guint pid = get_caller_pid(pInvocation); if (!is_service_app(pid)) { + //LCOV_EXCL_START GError* error = g_error_new(_sync_error_quark(), SYNC_ERROR_INVALID_OPERATION, "App not supported"); g_dbus_method_invocation_return_gerror(pInvocation, error); g_clear_error(&error); + //LCOV_EXCL_STOP return false; } @@ -1133,8 +1194,10 @@ sync_manager_remove_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocatio pkgIdStr = SyncManager::GetInstance()->GetPkgIdByAppId(pAppId); } else { + //LCOV_EXCL_START LOG_LOGD("Request seems to be from app-id less/command line based request"); pkgIdStr = SyncManager::GetInstance()->GetPkgIdByCommandline(pCommandLine); + //LCOV_EXCL_STOP } SyncAdapterAggregator* pAggregator = SyncManager::GetInstance()->GetSyncAdapterAggregator(); @@ -1144,10 +1207,11 @@ sync_manager_remove_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocatio LOG_LOGD("Sync adapter removed for package [%s]", pkgIdStr.c_str()); } else - LOG_LOGD("sync service: Get package Id fail %d", ret); + LOG_LOGD("sync service: Get package Id fail %d", ret); //LCOV_EXCL_LINE TizenSyncAdapter* pSyncAdapter = (TizenSyncAdapter*) g_hash_table_lookup(g_hash_table, pAppId); if (pSyncAdapter == NULL) { + //LCOV_EXCL_START LOG_LOGD("Failed to lookup syncadapter gdbus object for [%s]", pAppId); char object_path[50]; snprintf(object_path, 50, "%s%d", SYNC_ADAPTER_DBUS_PATH, pid); @@ -1166,11 +1230,12 @@ sync_manager_remove_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocatio ret = SYNC_ERROR_NONE; } else { - LOG_LOGD("export failed %s", error->message); + LOG_LOGD("export failed %s", error->message); //LCOV_EXCL_LINE } } free(pAppId); + //LCOV_EXCL_STOP } else { GDBusInterfaceSkeleton* interface = NULL; @@ -1228,8 +1293,10 @@ sync_manager_get_all_sync_jobs(TizenSyncManager* pObject, GDBusMethodInvocation* free(pAppId); } else { + //LCOV_EXCL_START LOG_LOGD("Request seems to be from app-id less/command line based request"); pkgId = SyncManager::GetInstance()->GetPkgIdByCommandline(pCommandLine); + //LCOV_EXCL_STOP } GVariant* outSyncJobList = NULL; @@ -1256,17 +1323,19 @@ sync_manager_get_all_sync_jobs(TizenSyncManager* pObject, GDBusMethodInvocation* } } else { - LOG_LOGD("sync service: registered sync jobs are not found"); + LOG_LOGD("sync service: registered sync jobs are not found"); //LCOV_EXCL_LINE } } else { - LOG_LOGD("Sync jobs information not found for package [%s], pkgId.str()"); + LOG_LOGD("Sync jobs information not found for package [%s], pkgId.str()"); //LCOV_EXCL_LINE } if (outSyncJobList == NULL) { + //LCOV_EXCL_START GError* error = g_error_new(_sync_error_quark(), ret, "system error"); g_dbus_method_invocation_return_gerror(pInvocation, error); g_clear_error(&error); + //LCOV_EXCL_STOP } else tizen_sync_manager_complete_get_all_sync_jobs(pObject, pInvocation, outSyncJobList); @@ -1274,7 +1343,7 @@ sync_manager_get_all_sync_jobs(TizenSyncManager* pObject, GDBusMethodInvocation* ManageIdleState* pManageIdleState = SyncManager::GetInstance()->GetManageIdleState(); if (pManageIdleState->GetTermTimerId() != -1) - pManageIdleState->ResetTermTimer(); + pManageIdleState->ResetTermTimer(); //LCOV_EXCL_LINE LOG_LOGD("sync service: get all sync jobs ends"); @@ -1282,6 +1351,7 @@ sync_manager_get_all_sync_jobs(TizenSyncManager* pObject, GDBusMethodInvocation* } +//LCOV_EXCL_START gboolean sync_manager_set_sync_status(TizenSyncManager* pObject, GDBusMethodInvocation* pInvocation, gboolean sync_enable) { @@ -1314,6 +1384,7 @@ DbusSignalHandler(GDBusConnection* pConnection, } } } +//LCOV_EXCL_STOP /* @@ -1325,13 +1396,17 @@ OnBusAcquired(GDBusConnection* pConnection, const gchar* pName, gpointer userDat GDBusInterfaceSkeleton* interface = NULL; sync_ipc_obj = tizen_sync_manager_skeleton_new(); if (sync_ipc_obj == NULL) { + //LCOV_EXCL_START LOG_LOGD("sync_ipc_obj NULL!!"); return; + //LCOV_EXCL_STOP } interface = G_DBUS_INTERFACE_SKELETON(sync_ipc_obj); if (!g_dbus_interface_skeleton_export(interface, pConnection, SYNC_MANAGER_DBUS_PATH, NULL)) { + //LCOV_EXCL_START LOG_LOGD("export failed!!"); return; + //LCOV_EXCL_STOP } g_signal_connect(sync_ipc_obj, "handle-add-sync-adapter", G_CALLBACK(sync_manager_add_sync_adapter), NULL); g_signal_connect(sync_ipc_obj, "handle-remove-sync-adapter", G_CALLBACK(sync_manager_remove_sync_adapter), NULL); @@ -1346,8 +1421,10 @@ OnBusAcquired(GDBusConnection* pConnection, const gchar* pName, gpointer userDat signal_id = g_dbus_connection_signal_subscribe(pConnection, NULL, SYS_DBUS_INTERFACE, POWEROFF_MSG, SYS_DBUS_PATH, NULL, G_DBUS_SIGNAL_FLAGS_NONE, DbusSignalHandler, NULL, NULL); if (signal_id == (unsigned int)-1) { + //LCOV_EXCL_START LOG_LOGD("unable to register for PowerOff Signal"); return; + //LCOV_EXCL_STOP } LOG_LOGD("Sync Service started [%s]", pName); @@ -1355,7 +1432,7 @@ OnBusAcquired(GDBusConnection* pConnection, const gchar* pName, gpointer userDat __pSyncRepositoryEngine = RepositoryEngine::GetInstance(); if (__pSyncRepositoryEngine == NULL) - LOG_LOGD("Failed to construct RepositoryEngine"); + LOG_LOGD("Failed to construct RepositoryEngine"); //LCOV_EXCL_LINE else __pSyncRepositoryEngine->OnBooting(); } @@ -1367,12 +1444,14 @@ OnNameAcquired(GDBusConnection* pConnection, const gchar* pName, gpointer userDa } +//LCOV_EXCL_START static void OnNameLost(GDBusConnection* pConnection, const gchar* pName, gpointer userData) { LOG_LOGD("OnNameLost"); //exit (1); } +//LCOV_EXCL_STOP static bool @@ -1388,8 +1467,10 @@ __initialize_dbus() NULL); if (ownerId == 0) { + //LCOV_EXCL_START LOG_LOGD("gdbus own failed!!"); return false; + //LCOV_EXCL_STOP } return true; @@ -1402,8 +1483,10 @@ SyncService::InitializeDbus(void) LOG_LOGD("Dbus initialization starts"); if (__initialize_dbus() == false) { + //LCOV_EXCL_START LOG_LOGD("__initialize_dbus failed"); exit(1); + //LCOV_EXCL_STOP } g_hash_table = g_hash_table_new(g_str_hash, g_str_equal); @@ -1422,8 +1505,10 @@ SyncService::SyncService(void) } +//LCOV_EXCL_START SyncService::~SyncService(void) { } +//LCOV_EXCL_STOP //}//_SyncManager diff --git a/src/sync-service/SyncManager_SyncStatusInfo.cpp b/src/sync-service/SyncManager_SyncStatusInfo.cpp index a218bbd..9154e0d 100644 --- a/src/sync-service/SyncManager_SyncStatusInfo.cpp +++ b/src/sync-service/SyncManager_SyncStatusInfo.cpp @@ -29,6 +29,7 @@ {*/ +//LCOV_EXCL_START SyncStatusInfo::SyncStatusInfo(int capabilityId) { this->capabilityId = capabilityId; @@ -163,4 +164,6 @@ SyncStatusInfo::GetStatusInfoString(void) return buff; } +//LCOV_EXCL_STOP + //}//_SyncManager diff --git a/src/sync-service/SyncManager_SyncWorker.cpp b/src/sync-service/SyncManager_SyncWorker.cpp index 8ca87cf..98b4f8e 100644 --- a/src/sync-service/SyncManager_SyncWorker.cpp +++ b/src/sync-service/SyncManager_SyncWorker.cpp @@ -28,15 +28,18 @@ /*namespace _SyncManager {*/ + SyncWorker::SyncWorker(void) { } +//LCOV_EXCL_START SyncWorker::~SyncWorker(void) { Finalize(); } +//LCOV_EXCL_STOP int @@ -56,8 +59,10 @@ SyncWorker::Initialize(void) ret = pthread_mutex_init(&__pendingRequestsMutex, NULL); if (ret != 0) { + //LCOV_EXCL_START LOG_ERRORD("__pendingRequestsMutex Initialise Failed %d", ret); return; + //LCOV_EXCL_STOP } else { __pContext = g_main_context_new(); @@ -87,6 +92,8 @@ SyncWorker::Initialize(void) LOG_LOGD("SyncManager::initialize() Ends"); } + +//LCOV_EXCL_START void SyncWorker::Finalize(void) { @@ -119,6 +126,7 @@ SyncWorker::Finalize(void) g_thread_exit(NULL); } } +//LCOV_EXCL_STOP int @@ -146,7 +154,7 @@ SyncWorker::AddRequestN(ISyncWorkerResultListener* pSyncWorkerResultListener, Me GError* pError = NULL; int status = g_io_channel_write_chars(__pChannel, (const gchar*) &count, sizeof(count), &writtenSize, &pError); if (status != G_IO_STATUS_NORMAL) { - LOG_LOGD("SyncWorker::Add Request Failed with IO Write Error %d %d", status, count); + LOG_LOGD("SyncWorker::Add Request Failed with IO Write Error %d %d", status, count); //LCOV_EXCL_LINE return SYNC_ERROR_SYSTEM; } g_io_channel_flush(__pChannel, &pError); @@ -175,7 +183,7 @@ SyncWorker::OnEventReceived(GIOChannel* pChannel, GIOCondition condition, gpoint status = g_io_channel_read_chars (pChannel, (gchar*)&tmp, sizeof(tmp), &readSize, &pError); if (readSize == 0 || status != G_IO_STATUS_NORMAL) { - LOG_LOGD("Failed with IO Read Error"); + LOG_LOGD("Failed with IO Read Error"); //LCOV_EXCL_LINE return TRUE; } @@ -194,15 +202,18 @@ SyncWorker::OnEventReceived(GIOChannel* pChannel, GIOCondition condition, gpoint pData = NULL; } else { - pthread_mutex_unlock(&pSyncWorker->__pendingRequestsMutex); + pthread_mutex_unlock(&pSyncWorker->__pendingRequestsMutex); //LCOV_EXCL_LINE } LOG_LOGD("Event handled successfully"); return TRUE; } + //LCOV_EXCL_START LOG_LOGD("UnSuccessfully Ends"); + return FALSE; + //LCOV_EXCL_STOP } @@ -217,8 +228,11 @@ SyncWorker::ThreadLoop(gpointer data) g_main_loop_run(pLoop); } + //LCOV_EXCL_START LOG_LOGD("Sync worker thread ends"); return NULL; + //LCOV_EXCL_STOP } + //}//_SyncManager diff --git a/src/sync-service/SyncManager_SyncWorker.h b/src/sync-service/SyncManager_SyncWorker.h index fa55556..57237a4 100644 --- a/src/sync-service/SyncManager_SyncWorker.h +++ b/src/sync-service/SyncManager_SyncWorker.h @@ -36,6 +36,7 @@ using namespace std; + class SyncWorker { public: diff --git a/src/sync-service/SyncManager_SyncWorkerResultListener.h b/src/sync-service/SyncManager_SyncWorkerResultListener.h index 84b0436..ca50ebc 100644 --- a/src/sync-service/SyncManager_SyncWorkerResultListener.h +++ b/src/sync-service/SyncManager_SyncWorkerResultListener.h @@ -26,7 +26,7 @@ class ISyncWorkerResultListener { public: - virtual ~ISyncWorkerResultListener() {}; + virtual ~ISyncWorkerResultListener() {}; //LCOV_EXCL_LINE virtual void OnEventReceived(Message msg) = 0; }; |