return 0;
}
+//& purpose: Retrieves deleted account with the account ID.
+//& type: auto
+/**
+* @testcase ITc_account_query_deleted_account_info_by_account_id_p
+* @since_tizen 5.5
+* @author SRID(j.abhishek)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Retrieves deleted account with the account ID.
+* @scenario set user name, package name capabity and insert account to DB
+* query acc by acc ID, delete account by acc ID, retrive deleted acc by ID
+* compare all set attributes with retrived attributes.
+* @apicovered account_query_deleted_account_info_by_account_id
+* @passcase When Target API is successful and retrived value matches
+* @failcase If target API fails or any precondition and postcondition API fails
+* @precondition Creates a handle to the account
+* @postcondition Destroys the account handle and releases all its resources
+*/
+int ITc_account_query_deleted_account_info_by_account_id_p(void)
+{
+
+ START_TEST;
+
+ int nRet = ACCOUNT_ERROR_NONE;
+ int nAccId = -1;
+ account_h hRetAccount = NULL;
+ account_h hDelAccount = NULL;
+ char* pszRetUsrName = NULL;
+ char* pszDelUsrName = NULL;
+ char* pszRetPkgName = NULL;
+ char* pszDelPkgName = NULL;
+
+ account_capability_state_e eRetCapabilityType = 0;
+ account_capability_state_e eDelCapabilityType = 0;
+ char pszSetUserName[] = "TEST_TIZEN";
+
+ nRet = account_set_user_name(g_account, pszSetUserName);
+ PRINT_RESULT(ACCOUNT_ERROR_NONE, nRet, "account_set_user_name", AccManagerGetErrorMSG(nRet));
+
+ nRet = account_set_package_name(g_account, g_pstrAppId);
+ PRINT_RESULT(ACCOUNT_ERROR_NONE, nRet, "account_set_package_name", AccManagerGetErrorMSG(nRet));
+
+ nRet = account_set_capability(g_account, (char *)CALENDAR_CAPABILITY, ACCOUNT_CAPABILITY_ENABLED);
+ PRINT_RESULT(ACCOUNT_ERROR_NONE, nRet, "account_set_capability", AccManagerGetErrorMSG(nRet));
+
+ nRet = account_insert_to_db(g_account, &nAccId);
+ PRINT_RESULT(ACCOUNT_ERROR_NONE, nRet, "account_insert_to_db", AccManagerGetErrorMSG(nRet));
+ if(nAccId < 0)
+ {
+ FPRINTF("[Line : %d][%s] account_insert_to_db failed. nAccId is -1\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ nRet = account_create(&hRetAccount);
+ PRINT_RESULT_CLEANUP(ACCOUNT_ERROR_NONE, nRet, "account_create", AccManagerGetErrorMSG(nRet), account_delete_from_db_by_id(nAccId););
+ CHECK_HANDLE_CLEANUP(hRetAccount, "account_create", account_delete_from_db_by_id(nAccId));
+
+ nRet = account_query_account_by_account_id(nAccId, &hRetAccount);
+ PRINT_RESULT_CLEANUP(ACCOUNT_ERROR_NONE, nRet, "account_query_account_by_account_id", AccManagerGetErrorMSG(nRet), account_delete_from_db_by_id(nAccId); account_destroy(hRetAccount));
+ CHECK_HANDLE_CLEANUP(hRetAccount, "account_query_account_by_account_id", account_delete_from_db_by_id(nAccId); account_destroy(hRetAccount));
+
+ nRet = account_delete_from_db_by_id(nAccId);
+ PRINT_RESULT_CLEANUP(ACCOUNT_ERROR_NONE, nRet, "account_delete_from_db_by_id", AccManagerGetErrorMSG(nRet), account_destroy(hRetAccount));
+
+ nRet = account_create(&hDelAccount);
+ PRINT_RESULT_CLEANUP(ACCOUNT_ERROR_NONE, nRet, "account_create", AccManagerGetErrorMSG(nRet), account_destroy(hRetAccount));
+ CHECK_HANDLE_CLEANUP(hRetAccount, "account_create", account_destroy(hRetAccount));
+
+ //Target API
+ nRet = account_query_deleted_account_info_by_account_id(nAccId, &hDelAccount);
+ PRINT_RESULT_CLEANUP(ACCOUNT_ERROR_NONE, nRet, "account_query_deleted_account_info_by_account_id", AccManagerGetErrorMSG(nRet), account_destroy(hRetAccount); account_destroy(hDelAccount));
+
+ nRet = account_get_user_name(hRetAccount, &pszRetUsrName);
+ PRINT_RESULT_CLEANUP(ACCOUNT_ERROR_NONE, nRet, "account_get_user_name", AccManagerGetErrorMSG(nRet), account_destroy(hRetAccount); account_destroy(hDelAccount));
+
+ nRet = account_get_user_name(hDelAccount, &pszDelUsrName);
+ PRINT_RESULT_CLEANUP(ACCOUNT_ERROR_NONE, nRet, "account_get_user_name", AccManagerGetErrorMSG(nRet), account_destroy(hRetAccount); account_destroy(hDelAccount); FREE_MEMORY(pszRetUsrName));
+
+ nRet = account_get_package_name(hRetAccount, &pszRetPkgName);
+ PRINT_RESULT_CLEANUP(ACCOUNT_ERROR_NONE, nRet, "account_get_package_name", AccManagerGetErrorMSG(nRet), account_destroy(hRetAccount); account_destroy(hDelAccount); FREE_MEMORY(pszRetUsrName); FREE_MEMORY(pszDelUsrName));
+
+ nRet = account_get_package_name(hDelAccount, &pszDelPkgName);
+ PRINT_RESULT_CLEANUP(ACCOUNT_ERROR_NONE, nRet, "account_get_package_name", AccManagerGetErrorMSG(nRet), account_destroy(hRetAccount); account_destroy(hDelAccount); FREE_MEMORY(pszRetUsrName); FREE_MEMORY(pszDelUsrName); FREE_MEMORY(pszRetPkgName));
+
+ nRet = account_get_capability(hRetAccount, (char *)CALENDAR_CAPABILITY, &eRetCapabilityType);
+ PRINT_RESULT_CLEANUP(ACCOUNT_ERROR_NONE, nRet, "account_get_capability", AccManagerGetErrorMSG(nRet), account_destroy(hRetAccount); account_destroy(hDelAccount); FREE_MEMORY(pszRetUsrName); FREE_MEMORY(pszDelUsrName); FREE_MEMORY(pszRetPkgName); FREE_MEMORY(pszDelPkgName));
+ PRINT_RESULT_CLEANUP(ACCOUNT_CAPABILITY_ENABLED, eRetCapabilityType, "account_get_capability", "Set and Get values mismatch Capability State", account_destroy(hRetAccount); account_destroy(hDelAccount); FREE_MEMORY(pszRetUsrName); FREE_MEMORY(pszDelUsrName); FREE_MEMORY(pszRetPkgName); FREE_MEMORY(pszDelPkgName));
+
+ nRet = account_get_capability(hDelAccount, (char *)CALENDAR_CAPABILITY, &eDelCapabilityType);
+ PRINT_RESULT_CLEANUP(ACCOUNT_ERROR_NONE, nRet, "account_get_capability", AccManagerGetErrorMSG(nRet), account_delete_from_db_by_id(nAccId); FREE_MEMORY(pszRetUsrName); FREE_MEMORY(pszDelUsrName); FREE_MEMORY(pszRetPkgName); FREE_MEMORY(pszDelPkgName));
+ PRINT_RESULT_CLEANUP(ACCOUNT_CAPABILITY_ENABLED, eDelCapabilityType, "account_get_capability", "Set and Get values mismatch Capability State", account_destroy(hRetAccount); account_destroy(hDelAccount); FREE_MEMORY(pszRetUsrName); FREE_MEMORY(pszDelUsrName); FREE_MEMORY(pszRetPkgName); FREE_MEMORY(pszDelPkgName));
+
+ PRINT_RESULT_CLEANUP(0, strncmp(pszRetUsrName, pszSetUserName, sizeof(pszSetUserName)-1) , "account_get_user_name", "Set and Get user names are different", account_delete_from_db_by_id(nAccId); FREE_MEMORY(pszRetUsrName); FREE_MEMORY(pszDelUsrName); FREE_MEMORY(pszRetPkgName); FREE_MEMORY(pszDelPkgName));
+
+ PRINT_RESULT_CLEANUP(0, strncmp(pszDelUsrName, pszSetUserName, sizeof(pszSetUserName)-1) , "account_get_user_name", "Set and Get user names are different", account_delete_from_db_by_id(nAccId); FREE_MEMORY(pszRetUsrName); FREE_MEMORY(pszDelUsrName); FREE_MEMORY(pszRetPkgName); FREE_MEMORY(pszDelPkgName));
+
+ PRINT_RESULT_CLEANUP(0, strncmp(pszRetPkgName, g_pstrAppId, sizeof(pszSetUserName)-1) , "account_get_package_name", "Set and Get package names are different", account_delete_from_db_by_id(nAccId); FREE_MEMORY(pszRetUsrName); FREE_MEMORY(pszDelUsrName); FREE_MEMORY(pszRetPkgName); FREE_MEMORY(pszDelPkgName));
+
+ PRINT_RESULT_CLEANUP(0, strncmp(pszDelPkgName, g_pstrAppId, sizeof(pszSetUserName)-1) , "account_get_package_name", "Set and Get package names are different", account_delete_from_db_by_id(nAccId); FREE_MEMORY(pszRetUsrName); FREE_MEMORY(pszDelUsrName); FREE_MEMORY(pszRetPkgName); FREE_MEMORY(pszDelPkgName));
+
+ FREE_MEMORY(pszRetUsrName);
+ FREE_MEMORY(pszDelUsrName);
+ FREE_MEMORY(pszRetPkgName);
+ FREE_MEMORY(pszDelPkgName);
+
+ nRet = account_destroy(hRetAccount);
+ PRINT_RESULT_NORETURN(ACCOUNT_ERROR_NONE, nRet, "account_destroy", AccManagerGetErrorMSG(nRet));
+
+ nRet = account_destroy(hDelAccount);
+ PRINT_RESULT_NORETURN(ACCOUNT_ERROR_NONE, nRet, "account_destroy", AccManagerGetErrorMSG(nRet));
+
+ return 0;
+}
+
/** @} */
/** @} */