From f84112db9d4f8613313d6d514df650e07c12cf5f Mon Sep 17 00:00:00 2001 From: sckim Date: Tue, 21 Aug 2012 19:03:20 +0900 Subject: [PATCH] RSA initial upload from private git Change-Id: I2b6ed13f609db4881d92db33b4087499cb1d5289 --- AUTHORS | 3 + CMakeLists.txt | 13 +- INSTALL | 33 + LICENSE | 410 +- NOTICE | 1 - accounts-svc.pc.in | 2 +- debian/changelog | 8 - debian/compat | 1 - debian/control | 26 - debian/copyright | 7 - debian/dirs | 2 - debian/docs | 1 - debian/libaccounts-svc-0.install.in | 1 - debian/libaccounts-svc-0.postinst | 41 - debian/libaccounts-svc-dev.install.in | 2 - debian/rules | 135 - include/account-error.h | 7 +- include/account-private.h | 12 +- include/account-types.h | 37 +- include/account.h | 35 +- include/account_PG.h | 1214 ++++++ libaccounts-svc.manifest | 14 + packaging/libaccounts-svc.spec | 39 +- src/account.c | 151 +- src/utc-account.c | 7753 +++++++++++++++++++++++++++++++++ 25 files changed, 9463 insertions(+), 485 deletions(-) create mode 100755 AUTHORS create mode 100755 INSTALL mode change 100755 => 100644 LICENSE delete mode 100755 NOTICE delete mode 100644 debian/changelog delete mode 100755 debian/compat delete mode 100755 debian/control delete mode 100755 debian/copyright delete mode 100755 debian/dirs delete mode 100755 debian/docs delete mode 100755 debian/libaccounts-svc-0.install.in delete mode 100755 debian/libaccounts-svc-0.postinst delete mode 100755 debian/libaccounts-svc-dev.install.in delete mode 100755 debian/rules create mode 100755 include/account_PG.h create mode 100644 libaccounts-svc.manifest create mode 100755 src/utc-account.c diff --git a/AUTHORS b/AUTHORS new file mode 100755 index 0000000..8150926 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,3 @@ +Woojay Jeon +Wonyoung Lee +Tarun kumar diff --git a/CMakeLists.txt b/CMakeLists.txt index 291cc67..f93cf44 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,16 +6,21 @@ SET(EXEC_PREFIX "\${prefix}") SET(LIBDIR "\${prefix}/lib") SET(INCLUDEDIR "\${prefix}/include ") SET(VERSION_MAJOR 0) -SET(VERSION "${VERSION_MAJOR}.0.73") +SET(VERSION "${VERSION_MAJOR}.0.87") SET(SRCS src/account.c ) +SET(TESTSRC +src/account.c +src/utc-account.c +) + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED sqlite3 dlog db-util glib-2.0 capi-base-common) +pkg_check_modules(pkgs REQUIRED sqlite3 dlog db-util glib-2.0 capi-base-common dbus-1) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") @@ -32,7 +37,10 @@ ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) +ADD_EXECUTABLE("acctest" ${TESTSRC}) + TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS}) +TARGET_LINK_LIBRARIES("acctest" ${pkgs_LDFLAGS}) CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) @@ -44,3 +52,4 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/account.h DESTINATION include) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/account-error.h DESTINATION include) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/account-types.h DESTINATION include) +#ADD_SUBDIRECTORY(test) diff --git a/INSTALL b/INSTALL new file mode 100755 index 0000000..ddf4e78 --- /dev/null +++ b/INSTALL @@ -0,0 +1,33 @@ +1. make the build directory + + ex) + + $ mkdir build + + +2. change the working directory to the build directory + + ex) + + $ cd build + + +3. run 'cmake' + + $ cmake ${SOURCE_DIR} -DCMAKE_INSTALL_PREFIX=/usr + + ex) + + $ cmake .. -DCMAKE_INSTALL_PREFIX=/usr + + or + + $ cmake .. + + +4. make & make install + + ex) + + $ make -j 2 && make install + diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 index bae7f54..f94008a --- a/LICENSE +++ b/LICENSE @@ -1,204 +1,206 @@ -Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + diff --git a/NOTICE b/NOTICE deleted file mode 100755 index 4c49449..0000000 --- a/NOTICE +++ /dev/null @@ -1 +0,0 @@ -Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. diff --git a/accounts-svc.pc.in b/accounts-svc.pc.in index fdc61f8..968ec23 100755 --- a/accounts-svc.pc.in +++ b/accounts-svc.pc.in @@ -8,6 +8,6 @@ includedir=@INCLUDEDIR@ Name: accounts-svc Description: Account DB library Version: @VERSION@ -Requires: sqlite3 dlog db-util glib-2.0 capi-base-common +Requires: sqlite3 dlog db-util glib-2.0 capi-base-common dbus-1 Libs: -L${libdir} -laccounts-svc Cflags: -I${includedir} diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index ebb53b4..0000000 --- a/debian/changelog +++ /dev/null @@ -1,8 +0,0 @@ -libaccounts-svc (0.0.73) unstable; urgency=low - - * Release - * Git: pkgs/l/libaccounts-svc - * Tag: libaccounts-svc_0.0.73 - - -- Wonyoung Lee Fri, 27 Apr 2012 08:52:17 +0900 - diff --git a/debian/compat b/debian/compat deleted file mode 100755 index 7ed6ff8..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/debian/control b/debian/control deleted file mode 100755 index c1ca48b..0000000 --- a/debian/control +++ /dev/null @@ -1,26 +0,0 @@ -Source: libaccounts-svc -Section: devel -Priority: extra -Maintainer: Wonyoung Lee -Uploaders: Wonyoung Lee -Build-Depends: debhelper (>= 5), dlog-dev, libslp-db-util-dev, libglib2.0-dev, capi-base-common-dev -Standards-Version: 0.1.0 - -Package: libaccounts-svc-dev -Section: libs -Architecture: any -Depends: libaccounts-svc-0 (= ${Source-Version}), dlog-dev, libglib2.0-dev, libslp-db-util-dev, capi-base-common-dev -Description: Account DB library -XB-Public-Package: no - -Package: libaccounts-svc-0 -Section: libs -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Account DB library - -Package: libaccounts-svc-dbg -Section: debug -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libaccounts-svc-0 (= ${Source-Version}) -Description: Account DB library (unstripped) diff --git a/debian/copyright b/debian/copyright deleted file mode 100755 index 4f93c69..0000000 --- a/debian/copyright +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the Apache License version 2.0. - -The full text of the Apache 2.0 can be found in -/usr/share/common-licenses. diff --git a/debian/dirs b/debian/dirs deleted file mode 100755 index ca882bb..0000000 --- a/debian/dirs +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin -usr/sbin diff --git a/debian/docs b/debian/docs deleted file mode 100755 index a0f0008..0000000 --- a/debian/docs +++ /dev/null @@ -1 +0,0 @@ -CMakeLists.txt diff --git a/debian/libaccounts-svc-0.install.in b/debian/libaccounts-svc-0.install.in deleted file mode 100755 index bf766f0..0000000 --- a/debian/libaccounts-svc-0.install.in +++ /dev/null @@ -1 +0,0 @@ -@PREFIX@/lib/*.so* diff --git a/debian/libaccounts-svc-0.postinst b/debian/libaccounts-svc-0.postinst deleted file mode 100755 index b901b53..0000000 --- a/debian/libaccounts-svc-0.postinst +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -if [ ! -d /opt/dbspace ] -then - mkdir -p /opt/dbspace -fi - -if [ ! -f /opt/dbspace/.account.db ] - rm -rf /opt/dbspace/.account.db* -then - sqlite3 /opt/dbspace/.account.db 'PRAGMA journal_mode = PERSIST; - CREATE TABLE if not exists account (_id INTEGER PRIMARY KEY AUTOINCREMENT, user_name TEXT, email_address TEXT, - display_name TEXT, icon_path TEXT, source TEXT, package_name TEXT, access_token TEXT, domain_name TEXT, - auth_type INTEGER, secret INTEGER, txt_custom0 TEXT, txt_custom1 TEXT, txt_custom2 TEXT, txt_custom3 TEXT, txt_custom4 TEXT, - int_custom0 INTEGER, int_custom1 INTEGER, int_custom2 INTEGER, int_custom3 INTEGER, int_custom4 INTEGER); - - CREATE TABLE if not exists capability (_id INTEGER PRIMARY KEY AUTOINCREMENT, key INTEGER, value INTEGER, package_name TEXT, user_name TEXT, account_id INTEGER);' -fi - - -if [ ${USER} == "root" ] -then - if [ -f /opt/dbspace/.account.db ] - then - chown 5000:5000 /opt/dbspace/.account.db - fi - - if [ -f /opt/dbspace/.account.db-journal ] - then - chown 5000:5000 /opt/dbspace/.account.db-journal - fi -fi - -if [ -f /opt/dbspace/.account.db ] -then - chmod 660 /opt/dbspace/.account.db -fi - -if [ -f /opt/dbspace/.account.db-journal ] -then - chmod 660 /opt/dbspace/.account.db-journal -fi diff --git a/debian/libaccounts-svc-dev.install.in b/debian/libaccounts-svc-dev.install.in deleted file mode 100755 index 0f2a4da..0000000 --- a/debian/libaccounts-svc-dev.install.in +++ /dev/null @@ -1,2 +0,0 @@ -@PREFIX@/include/* -@PREFIX@/lib/pkgconfig/*.pc diff --git a/debian/rules b/debian/rules deleted file mode 100755 index 30c5355..0000000 --- a/debian/rules +++ /dev/null @@ -1,135 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -CFLAGS ?= -Wall -g -CXXFLAGS ?= -Wall -g -LDFLAGS ?= -PREFIX ?= /usr -DATADIR ?= /opt - -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O0 - CXXFLAGS += -O0 -else - CFLAGS += -O2 - CXXFLAGS += -O2 -endif - -LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed - -#CMAKE_TMP_DIR = $(CURDIR)/cmake_tmp - - -configure: configure-stamp -configure-stamp: - dh_testdir - # Add here commands to configure the package. -# mkdir -p $(CMAKE_TMP_DIR); - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake . -DCMAKE_INSTALL_PREFIX=$(PREFIX) - - touch configure-stamp - -build: build-stamp - -build-stamp: configure-stamp - dh_testdir - - # Add here commands to compile the package. - $(MAKE) - #docbook-to-man debian/wavplayer.sgml > wavplayer.1 - - for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ - cat $$f > $${f%.in}; \ - sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ - sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \ - done - - - touch $@ - -clean: - dh_testdir - dh_testroot - rm -f build-stamp configure-stamp - - # Add here commands to clean up after the build process. - -$(MAKE) clean - #rm -rf $(CMAKE_TMP_DIR) - - rm -rf CMakeCache.txt - #rm -rf test/CMakeCache.txt - rm -rf CMakeFiles - #rm -rf test/CMakeFiles - rm -rf cmake_install.cmake - #rm -rf test/cmake_install.cmake - rm -rf Makefile - #rm -rf test/Makefile - rm -rf install_manifest.txt - rm -rf *.so - rm -rf *.edj - #rm -rf test/*.edj - #rm -rf test/testlibqp - rm -rf *.desktop - rm -rf *.pc - for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ - rm -f $${f%.in}; \ - done - - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - # Add here commands to install the package into debian/wavplayer. - $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install - - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_installchangelogs - dh_installdocs - dh_installexamples - dh_install --sourcedir=debian/tmp -# dh_installmenu -# dh_installdebconf -# dh_installlogrotate -# dh_installemacsen -# dh_installpam -# dh_installmime -# dh_python -# dh_installinit -# dh_installcron -# dh_installinfo - dh_installman - dh_link -# dh_strip - dh_strip --dbg-package=libaccounts-svc-dbg - dh_compress - dh_fixperms -# dh_perl - dh_makeshlibs - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/include/account-error.h b/include/account-error.h index 4a0c529..72e1599 100755 --- a/include/account-error.h +++ b/include/account-error.h @@ -1,9 +1,9 @@ /* - * libaccounts-svc + * account * - * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * - * Contact: Tarun Kumar , Sukumar Moharana , Wonyoung Lee + * Contact: Wonyoung Lee , Tarun Kumar * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,6 +59,7 @@ typedef enum ACCOUNT_ERROR_DB_NOT_OPENED = TIZEN_ERROR_SOCIAL_CLASS | 0x05, ACCOUNT_ERROR_QUERY_SYNTAX_ERROR = TIZEN_ERROR_SOCIAL_CLASS | 0x06, ACCOUNT_ERROR_ITERATOR_END = TIZEN_ERROR_SOCIAL_CLASS | 0x07, + ACCOUNT_ERROR_NOTI_FAILED = TIZEN_ERROR_SOCIAL_CLASS | 0x08, } account_error_e; diff --git a/include/account-private.h b/include/account-private.h index 39c4825..1aa46de 100755 --- a/include/account-private.h +++ b/include/account-private.h @@ -1,9 +1,9 @@ /* - * libaccounts-svc + * account * - * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * - * Contact: Tarun Kumar , Sukumar Moharana , Wonyoung Lee + * Contact: Wonyoung Lee , Tarun Kumar * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,7 +64,8 @@ typedef struct _account_s char* domain_name; /*< domain name [Ex: google, facebook, twitter, samsung, ...] */ /*int service_type;*/ /* ACCOUNT_CATEGORY*/ int auth_type; - int secret; + int secret; + int sync_support; int user_data_int[USER_INT_CNT]; char* user_data_txt[USER_TXT_CNT]; GSList* capablity_list; @@ -98,6 +99,7 @@ typedef enum { ACCOUNT_FIELD_DOMAIN_NAME, ACCOUNT_FIELD_AUTH_TYPE, ACCOUNT_FIELD_SECRET, + ACCOUNT_FIELD_SYNC_SUPPORT, ACCOUNT_FIELD_USER_TEXT_0, ACCOUNT_FIELD_USER_TEXT_1, ACCOUNT_FIELD_USER_TEXT_2, @@ -126,7 +128,6 @@ typedef enum { CAPABILITY_FIELD_END, }CAPABILITY_DB_IDX; - typedef sqlite3_stmt* account_stmt; #define ACCOUNT_SCHEMA "create table %s \n"\ @@ -142,6 +143,7 @@ typedef sqlite3_stmt* account_stmt; "domain_name TEXT, "\ "auth_type INTEGER, "\ "secret INTEGER, "\ +"sync_support INTEGER, "\ "txt_custom0 TEXT, "\ "txt_custom1 TEXT, "\ "txt_custom2 TEXT, "\ diff --git a/include/account-types.h b/include/account-types.h index d353c3c..8754004 100755 --- a/include/account-types.h +++ b/include/account-types.h @@ -1,9 +1,9 @@ /* - * libaccounts-svc + * account * - * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * - * Contact: Tarun Kumar , Sukumar Moharana , Wonyoung Lee + * Contact: Wonyoung Lee , Tarun Kumar * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,6 +55,7 @@ typedef enum ACCOUNT_CAPABILITY_STATUS_POST, ACCOUNT_CAPABILITY_VOIP, ACCOUNT_CAPABILITY_SAMSUNG_APPS, + ACCOUNT_CAPABILITY_TASK, ACCOUNT_CAPABILITY_MOBILE_TRACKER } account_capability_type_e; @@ -78,6 +79,22 @@ typedef enum } account_secrecy_state_e; +/** + * @brief Enumerations for the account supported sync or not. + * ACCOUNT_NOT_SUPPORTS_SYNC: sync not support + * ACCOUNT_SUPPORTS_SYNC_IDLE: sync support and sync status is idle + * ACCOUNT_SUPPORTS_SYNC_ACTIVE: sync support and sync status id active + * ACCOUNT_SUPPORTS_SYNC: NOT USED, WILL BE REMOVED. TO PREVENT BUILD ERROR. + */ +typedef enum +{ + ACCOUNT_NOT_SUPPORTS_SYNC = 0x00, + ACCOUNT_SUPPORTS_SYNC_IDLE, + ACCOUNT_SUPPORTS_SYNC_ACTIVE, + ACCOUNT_SUPPORTS_SYNC +} +account_sync_state_e; + typedef enum { ACCOUNT_AUTH_TYPE_XAUTH, @@ -98,10 +115,24 @@ typedef struct account_capability_s* account_capability_h; #define ACCOUNT_DATA_USERNAME "http://tizen.org/account/data/username" #define ACCOUNT_OPERATION_SIGNIN "http://tizen.org/account/operation/signin" #define ACCOUNT_OPERATION_VIEW "http://tizen.org/account/operation/view" +#define ACCOUNT_SUPPORTS_CAPABILITY_CONTACT "http://tizen.org/account/capability/contact" +#define ACCOUNT_SUPPORTS_CAPABILITY_CALENDER "http://tizen.org/account/capability/calender" +#define ACCOUNT_SUPPORTS_CAPABILITY_PHOTO "http://tizen.org/account/capability/photo" +#define ACCOUNT_SUPPORTS_CAPABILITY_VIDEO "http://tizen.org/account/capability/video" +#define ACCOUNT_SUPPORTS_CAPABILITY_EMAIL "http://tizen.org/account/capability/email" +#define ACCOUNT_SUPPORTS_CAPABILITY_POST "http://tizen.org/account/capability/post" +#define ACCOUNT_SUPPORTS_CAPABILITY_VOIP "http://tizen.org/account/capability/voip" +#define ACCOUNT_SUPPORTS_CAPABILITY_SAMSUNG_APPS "http://tizen.org/account/capability/samsungapps" +#define ACCOUNT_SUPPORTS_CAPABILITY_TASK "http://tizen.org/account/capability/task" +#define ACCOUNT_SUPPORTS_CAPABILITY_MOBILE_TRACKER "http://tizen.org/account/capability/mobiletracker" #define USER_TXT_CNT 5 #define USER_INT_CNT 5 +#define ACCOUNT_DBUS_SIGNAL_INTERFACE "account.signal.Type" +#define ACCOUNT_DBUS_NOTI_NAME_INSERT "insert" +#define ACCOUNT_DBUS_NOTI_NAME_UPDATE "update" +#define ACCOUNT_DBUS_NOTI_NAME_DELETE "delete" /** * @} */ diff --git a/include/account.h b/include/account.h index e5d2888..a98c694 100755 --- a/include/account.h +++ b/include/account.h @@ -1,9 +1,9 @@ /* - * libaccounts-svc + * account * - * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * - * Contact: Tarun Kumar , Sukumar Moharana , Wonyoung Lee + * Contact: Wonyoung Lee , Tarun Kumar * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -674,6 +674,35 @@ int account_get_secret(account_h account, account_secrecy_state_e *secret); */ int account_set_secret(account_h account, const account_secrecy_state_e secret); +/** + * @brief Gets the sync support. + * + * @param[in] account The account handle + * @param[out] sync_support The sync support + * + * @return 0 on success, otherwise a negative error value. + * @retval #ACCOUNT_ERROR_NONE Successful + * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see account_set_sync_support() + */ +int account_get_sync_support(account_h account, account_sync_state_e *sync_support); + + +/** + * @brief Sets the sync support. + * + * @param[in] account The account handle + * @param[in] sync_support sync state to be set + * + * @return 0 on success, otherwise a negative error value. + * @retval #ACCOUNT_ERROR_NONE Successful + * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see account_get_sync_support() + */ +int account_set_sync_support(account_h account, const account_sync_state_e sync_support); + /** * @brief Gets the source. diff --git a/include/account_PG.h b/include/account_PG.h new file mode 100755 index 0000000..6c63277 --- /dev/null +++ b/include/account_PG.h @@ -0,0 +1,1214 @@ +/* + * Account + * + * Copyright (c) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Wonyoung Lee , Tarun Kumar + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/** + * + * @ingroup SLP_PG + * @defgroup Account_PG Account + + +

Introduction

+

Purpose of this document

+ +The purpose of this document is to describe how applications can use account APIs for handling Account's information. This document gives programming guidelines to application engineers and examples of using Account data. + +

Scope

+ +The scope of this document is limited to Account API usage. + + +

Account Architecture

+

Overview

+ +Account is responsible for inserting, deleting, and updating Account data in order to accommodate the needs for application's Account data. +Users can access Account data without knowing DB schema, SQLite, relations of data + +

Account Features

+ - Similar to Sqlite3 + - Handle information of Account + +

Similar to Sqlite3

+Account API is similar to Sqlite3. + +

Handle information of Account

+Account supports to insert/update/delete/get/set/query information of Account. +The Information of Account includes user name, package name, email, access token, icon path, source, display name, capability informatio etc. + +

Account API Description

+ +you can refer @ref ACCOUNT_SVC + +

Sample Code

+ +

Connect to Account Database

+ +Before using Account information from Account API, caller module should connect to the Account database, and after finishing with the account information, should disconnect from the Account database + +@code +int account_connect(void); + +int account_disconnect(void); +@endcode + +

Insert information of account

+ +@code +void insert_test(void) +{ + int ret = -1; + account_h account; + + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_create(&account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_user_name(account, "tarun.kr"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "Tarun Kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "Samsung electronics"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, "tarun@gmail.com"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_package_name(account, "com.samsung.twiter"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_icon_path(account, "icon-path"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_access_token(account, "ACCESSTOKEN"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH ); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE ); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_set_source(account, "URUSA inc."); + + int i; + + for(i=0;iGet account by id + +@code +bool _capability_get_callback(account_capability_type_e capability_type, account_capability_state_e capability_value, void* user_data) +{ + int test_type = capability_type; + int test_value = capability_value; + + printf("_capability_get_callback test_type = : %d\n", test_type); + printf("_capability_get_callback test_value = : %d\n", test_value); + return TRUE; +} + +static void _account_free_text(char *text) +{ + if (text) { + free(text); + text = NULL; + } +} + +void get_account_by_id(int account_id) +{ + int ret = - 1; + account_h account; + + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_query_account_by_account_id(account_id, &account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + char *test_text = NULL; + + account_get_user_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_display_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_email_address(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_icon_path(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_source(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_package_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_domain_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_access_token(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + int i; + + for(i=0;iGet account list by user name + +@code +static void _account_free_text(char *text) +{ + if (text) { + free(text); + text = NULL; + } +} + +bool _account_get_callback(account_h handle, void* user_data) +{ + printf("_account_get_callback\n"); + + char *test_text = NULL; + + account_get_user_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_display_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_email_address(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_icon_path(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_source(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_package_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_domain_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_access_token(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + int i; + + for(i=0;iGet account list by package name + +@code +static void _account_free_text(char *text) +{ + if (text) { + free(text); + text = NULL; + } +} + +bool _account_get_callback(account_h handle, void* user_data) +{ + printf("_account_get_callback\n"); + + char *test_text = NULL; + + account_get_user_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_display_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_email_address(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_icon_path(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_source(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_package_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_domain_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_access_token(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + int i; + + for(i=0;iGet all account list + +@code +static void _account_free_text(char *text) +{ + if (text) { + free(text); + text = NULL; + } +} + +bool _account_get_callback(account_h handle, void* user_data) +{ + printf("_account_get_callback\n"); + + char *test_text = NULL; + + account_get_user_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_display_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_email_address(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_icon_path(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_source(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_package_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_domain_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_access_token(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + int i; + + for(i=0;iUpdate information of account by account id + +@code +void update_accont_by_id(int account_id) +{ + int ret = -1; + account_h account; + + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_create(&account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_user_name(account, "update-tarun.kr"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "update-Tarun Kumar"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "update-Samsung electronics"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, "update-tarun@gmail.com"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_package_name(account, "update-com.samsung.twiter"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_icon_path(account, "update-icon-path"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_access_token(account, "update-ACCESSTOKEN"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH ); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE ); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_set_source(account, "update-URUSA inc."); + + int i; + + for(i=0;iUpdate information of account by user name + +@code +void update_accont_by_user_name(char *user_name, char *package_name) +{ + int ret = -1; + account_h account; + + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_create(&account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_user_name(account, "update-tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "update-Tarun Kumar"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "update-Samsung electronics"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, "update-tarun@gmail.com"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_package_name(account, "update-com.samsung.twiter"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_icon_path(account, "update-icon-path"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_access_token(account, "update-ACCESSTOKEN"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH ); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE ); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_source(account, "update-URUSA inc."); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + int i; + + for(i=0;iDelete account by id + +@code +void delete_account_by_id(int account_id) +{ + int ret = -1; + + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_delete(account_id); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return; +} +@endcode + +

Delete account by user name

+ +@code +void delete_account_by_user_name(char *user_name, char *package_name) +{ + int ret = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_delete_from_db_by_user_name(user_name, package_name); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d \n", __LINE__, ret); + } + + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return; +} +@endcode + +

Delete account by package name

+ +@code +void delete_account_by_package_name(char *package_name) +{ + int ret = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_delete_from_db_by_package_name(package_name); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d \n", __LINE__, ret); + } + + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return; +} +@endcode + +

Get account insert dbus notification

+ +@code +void notify_account_insert() +{ + DBusMessage* msg; + DBusConnection* conn; + DBusError err; + + printf("Listening for signals\n"); + + dbus_error_init(&err); + + conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); + if (dbus_error_is_set(&err)) { + fprintf(stderr, "Connection Error (%s)\n", err.message); + dbus_error_free(&err); + } + if (NULL == conn) { + exit(1); + } + + dbus_bus_add_match(conn, "type='signal',interface='account.signal.Type'", &err); + dbus_connection_flush(conn); + if (dbus_error_is_set(&err)) { + fprintf(stderr, "Match Error (%s)\n", err.message); + exit(1); + } + printf("Match rule sent\n"); + + while (true) { + + dbus_connection_read_write(conn, 0); + msg = dbus_connection_pop_message(conn); + + if (NULL == msg) { + sleep(1); + continue; + } + + if (dbus_message_is_signal(msg, ACCOUNT_DBUS_SIGNAL_INTERFACE, ACCOUNT_DBUS_NOTI_NAME_INSERT)) { + printf("Got Signal with name insert\n"); + } + + dbus_message_unref(msg); + } + dbus_connection_close(conn); +} +@endcode + +

Get account update dbus notification

+ +@code +void notify_account_update() +{ + DBusMessage* msg; + DBusConnection* conn; + DBusError err; + + printf("Listening for signals\n"); + + + dbus_error_init(&err); + + conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); + if (dbus_error_is_set(&err)) { + fprintf(stderr, "Connection Error (%s)\n", err.message); + dbus_error_free(&err); + } + if (NULL == conn) { + exit(1); + } + + dbus_bus_add_match(conn, "type='signal',interface='account.signal.Type'", &err); + dbus_connection_flush(conn); + if (dbus_error_is_set(&err)) { + fprintf(stderr, "Match Error (%s)\n", err.message); + exit(1); + } + printf("Match rule sent\n"); + + while (true) { + + dbus_connection_read_write(conn, 0); + msg = dbus_connection_pop_message(conn); + + if (NULL == msg) { + sleep(1); + continue; + } + + if (dbus_message_is_signal(msg, ACCOUNT_DBUS_SIGNAL_INTERFACE, ACCOUNT_DBUS_NOTI_NAME_UPDATE)) { + printf("Got Signal with name update\n"); + } + + dbus_message_unref(msg); + } + dbus_connection_close(conn); +} +@endcode + +

Get account delete dbus notification

+ +@code +void notify_account_delete() +{ + DBusMessage* msg; + DBusConnection* conn; + DBusError err; + + printf("Listening for signals\n"); + + + dbus_error_init(&err); + + conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); + if (dbus_error_is_set(&err)) { + fprintf(stderr, "Connection Error (%s)\n", err.message); + dbus_error_free(&err); + } + if (NULL == conn) { + exit(1); + } + + dbus_bus_add_match(conn, "type='signal',interface='account.signal.Type'", &err); + dbus_connection_flush(conn); + if (dbus_error_is_set(&err)) { + fprintf(stderr, "Match Error (%s)\n", err.message); + exit(1); + } + printf("Match rule sent\n"); + + while (true) { + + dbus_connection_read_write(conn, 0); + msg = dbus_connection_pop_message(conn); + + if (NULL == msg) { + sleep(1); + continue; + } + + if (dbus_message_is_signal(msg, ACCOUNT_DBUS_SIGNAL_INTERFACE, ACCOUNT_DBUS_NOTI_NAME_DELETE)) { + printf("Got Signal with name delete\n"); + } + + dbus_message_unref(msg); + } + dbus_connection_close(conn); +} +@endcode + +

Get capability by acccount id

+ +@code +bool _capability_get_callback(account_capability_type_e capability_type, account_capability_state_e capability_value, void* user_data) +{ + int test_type = capability_type; + int test_value = capability_value; + + printf("_capability_get_callback test_type = : %d\n", test_type); + printf("_capability_get_callback test_value = : %d\n", test_value); + return TRUE; +} + +void capability_by_account_id(int account_id) +{ + int ret = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_query_capability_by_account_id(_capability_get_callback, account_id, NULL); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d \n", __LINE__, ret); + } + + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return; +} +@endcode + * @} + */ + diff --git a/libaccounts-svc.manifest b/libaccounts-svc.manifest new file mode 100644 index 0000000..806f08e --- /dev/null +++ b/libaccounts-svc.manifest @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/packaging/libaccounts-svc.spec b/packaging/libaccounts-svc.spec index 895cf12..a9a2269 100755 --- a/packaging/libaccounts-svc.spec +++ b/packaging/libaccounts-svc.spec @@ -1,7 +1,7 @@ Name: libaccounts-svc Summary: Account DB library -Version: 0.0.73 +Version: 0.0.87 Release: 1 Group: TO_BE/FILLED_IN License: TO BE FILLED IN @@ -12,6 +12,7 @@ BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(db-util) BuildRequires: pkgconfig(capi-base-common) +BuildRequires: pkgconfig(dbus-1) Requires(post): /sbin/ldconfig Requires(post): /usr/bin/sqlite3 Requires(postun): /sbin/ldconfig @@ -50,29 +51,26 @@ if [ ! -d /opt/dbspace ] then mkdir -p /opt/dbspace fi -if [ ! -f /opt/dbspace/.account-svc.db ] -rm -rf /opt/dbspace/.account-svc.db* +if [ ! -f /opt/dbspace/.account.db ] +rm -rf /opt/dbspace/.account.db* then - sqlite3 /opt/dbspace/.account-svc.db 'PRAGMA journal_mode = PERSIST; - CREATE TABLE if not exists accounts (_id INTEGER PRIMARY KEY AUTOINCREMENT, email_address TEXT, user_name TEXT, display_name TEXT, icon_path TEXT, - service_type INTEGER, source TEXT, library_name TEXT, is_default INTEGER, domain_name TEXT, - key TEXT, secret TEXT, save_screen_name INTEGER, save_token INTEGER, save_user_name INTEGER, - save_password INTEGER, key_values TEXT, capability TEXT, - int_custom0 INTEGER, int_custom1 INTEGER, int_custom2 INTEGER, int_custom3 INTEGER, int_custom4 INTEGER, - txt_custom0 TEXT, txt_custom1 TEXT, txt_custom2 TEXT, txt_custom3 TEXT, txt_custom4 TEXT); - CREATE TABLE if not exists capabilities (_id INTEGER PRIMARY KEY AUTOINCREMENT, key TEXT, value TEXT, app_id INTEGER, account_id INTEGER, FOREIGN KEY (account_id) REFERENCES accounts(_id)); - CREATE TABLE if not exists service (_service_id INTEGER PRIMARY KEY AUTOINCREMENT, service_name TEXT, library_name TEXT, version TEXT, type TEXT, icon_path TEXT, auth_type TEXT); - INSERT INTO service ( _service_id, service_name, library_name, version, type) values (1, "Samsung", "samsung-sso-efl", "0.0.1", "ui-gadget"); - INSERT INTO service ( _service_id, service_name, library_name, version, type) values (3, "Google", "email-setting-efl", "0.0.1", "ui-gadget"); - INSERT INTO service ( _service_id, service_name, library_name, version, type) values (4, "MSN", "email-setting-efl", "0.0.1", "ui-gadget"); - CREATE TABLE if not exists feature (_feature_id INTEGER PRIMARY KEY AUTOINCREMENT, feature_name TEXT, description TEXT, service_id INTEGER, FOREIGN KEY (service_id) REFERENCES service(_service_id));' + sqlite3 /opt/dbspace/.account.db 'PRAGMA journal_mode = PERSIST; + CREATE TABLE if not exists account (_id INTEGER PRIMARY KEY AUTOINCREMENT, user_name TEXT, email_address TEXT, display_name TEXT, icon_path TEXT, + source TEXT, package_name TEXT, access_token TEXT, domain_name TEXT, auth_type INTEGER, secret INTEGER, sync_support INTEGER, + txt_custom0 TEXT, txt_custom1 TEXT, txt_custom2 TEXT, txt_custom3 TEXT, txt_custom4 TEXT, + int_custom0 INTEGER, int_custom1 INTEGER, int_custom2 INTEGER, int_custom3 INTEGER, int_custom4 INTEGER); + CREATE TABLE if not exists capabilitiy (_id INTEGER PRIMARY KEY AUTOINCREMENT, key INTEGER, value INTEGER, + package_name TEXT, user_name TEXT, account_id INTEGER, FOREIGN KEY (account_id) REFERENCES account(_id));' fi -chown 5000:5000 /opt/dbspace/.account-svc.db -chown 5000:5000 /opt/dbspace/.account-svc.db-journal +chown 5000:5000 /opt/dbspace/.account.db +chown 5000:5000 /opt/dbspace/.account.db-journal -chmod 660 /opt/dbspace/.account-svc.db -chmod 660 /opt/dbspace/.account-svc.db-journal +chmod 660 /opt/dbspace/.account.db +chmod 660 /opt/dbspace/.account.db-journal + +#chsmack -a 'libaccounts-svc' /opt/dbspace/.account.db +#chsmack -a 'libaccounts-svc' /opt/dbspace/.account.db-journal %postun -p /sbin/ldconfig @@ -80,6 +78,7 @@ chmod 660 /opt/dbspace/.account-svc.db-journal %files +%manifest libaccounts-svc.manifest %defattr(-,root,root,-) %{_libdir}/*.so.* diff --git a/src/account.c b/src/account.c index 0c3592f..5384a21 100755 --- a/src/account.c +++ b/src/account.c @@ -1,9 +1,9 @@ /* - * libaccounts-svc + * account * - * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * - * Contact: Tarun Kumar , Sukumar Moharana , Wonyoung Lee + * Contact: Wonyoung Lee , Tarun Kumar * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef LOG_TAG #undef LOG_TAG @@ -91,6 +92,55 @@ static const char *_account_db_err_msg() return sqlite3_errmsg(g_hAccountDB); } +static void _account_insert_delete_update_dbus_notification_send(char *noti_name) +{ + DBusMessage* msg; + DBusConnection* conn; + DBusError err; + dbus_uint32_t serial = 0; + + if (!noti_name) { + ACCOUNT_DEBUG("Noti Name is NULL!!!!!!\n"); + return; + } + + ACCOUNT_DEBUG("Sending signal with value %s\n", noti_name); + + /* initialise the error value*/ + dbus_error_init(&err); + + /* connect to the DBUS system bus, and check for errors*/ + conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); + if (dbus_error_is_set(&err)) { + ACCOUNT_DEBUG("Connection Error (%s)\n", err.message); + dbus_error_free(&err); + } + if (NULL == conn) { + ACCOUNT_DEBUG("Dbus connection is NULL \n"); + return; + } + /* create a signal & check for errors */ + msg = dbus_message_new_signal("/account/signal/Object", /*object name of the signal*/ + ACCOUNT_DBUS_SIGNAL_INTERFACE, /*interface name of the signal*/ + noti_name); /* name of the signal*/ + if (NULL == msg) { + ACCOUNT_DEBUG("Message Null\n"); + return; + } + + /* send the message and flush the connection*/ + if (!dbus_connection_send(conn, msg, &serial)) { + ACCOUNT_DEBUG("Out Of Memory!\n"); + return; + } + dbus_connection_flush(conn); + ACCOUNT_DEBUG("Signal Sent\n"); + + /* free the message*/ + if (msg) + dbus_message_unref(msg); +} + static int _account_get_record_count(char* query) { int rc = -1; @@ -501,13 +551,16 @@ static int _account_convert_account_to_sql(account_s *account, account_stmt hstm /* 10. secret */ _account_query_bind_int(hstmt, count++, account->secret); + /* 11. sync_support */ + _account_query_bind_int(hstmt, count++, account->sync_support); + int i; - /* 11. user text*/ + /* 12. user text*/ for(i=0; i< USER_TXT_CNT; i++) _account_query_bind_text(hstmt, count++, (char*)account->user_data_txt[i]); - /* 12. user integer */ + /* 13. user integer */ for(i=0; i< USER_INT_CNT; i++) _account_query_bind_int(hstmt, count++, account->user_data_int[i]); @@ -554,9 +607,9 @@ static int _account_execute_insert_query(account_s *account) ACCOUNT_MEMSET(query, 0x00, sizeof(query)); ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s( user_name, email_address , display_name , icon_path , source , package_name , " - "access_token , domain_name , auth_type , secret , txt_custom0, txt_custom1, txt_custom2, txt_custom3, txt_custom4, " + "access_token , domain_name , auth_type , secret , sync_support , txt_custom0, txt_custom1, txt_custom2, txt_custom3, txt_custom4, " "int_custom0, int_custom1, int_custom2, int_custom3, int_custom4, txt_custom0 ) values " - "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? , ?)", ACCOUNT_TABLE); + "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? , ?, ?)", ACCOUNT_TABLE); hstmt = _account_prepare_query(query); ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg())); @@ -859,6 +912,8 @@ static void _account_convert_column_to_account(account_stmt hstmt, account_s *ac account_record->secret = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_SECRET); + account_record->sync_support = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_SYNC_SUPPORT); + textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_TEXT_0); _account_db_data_to_text(textbuf, &(account_record->user_data_txt[0])); @@ -943,8 +998,8 @@ static int _account_update_account_by_user_name(account_s *account, char *user_n int error_code = ACCOUNT_ERROR_NONE; account_stmt hstmt = NULL; - ACCOUNT_RETURN_VAL((account->user_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("user_name is NULL.\n")); - ACCOUNT_RETURN_VAL((account->email_address != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("email_address is NULL.\n")); + ACCOUNT_RETURN_VAL((user_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("user_name is NULL.\n")); + ACCOUNT_RETURN_VAL((package_name!= NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name is NULL.\n")); if (!account->user_name && !account->display_name && !account->email_address) { ACCOUNT_DEBUG("One field should be set among user name, display name, email address\n"); @@ -953,7 +1008,7 @@ static int _account_update_account_by_user_name(account_s *account, char *user_n ACCOUNT_MEMSET(query, 0x00, sizeof(query)); ACCOUNT_SNPRINTF(query, sizeof(query), "UPDATE %s SET user_name=?, email_address =?, display_name =?, " - "icon_path =?, source =?, package_name =? , access_token =?, domain_name =?, auth_type =?, secret =?," + "icon_path =?, source =?, package_name =? , access_token =?, domain_name =?, auth_type =?, secret =?, sync_support =?," "txt_custom0=?, txt_custom1=?, txt_custom2=?, txt_custom3=?, txt_custom4=?, " "int_custom0=?, int_custom1=?, int_custom2=?, int_custom3=?, int_custom4=? WHERE user_name=? and package_name=? ", ACCOUNT_TABLE); @@ -975,7 +1030,7 @@ static int _account_update_account_by_user_name(account_s *account, char *user_n hstmt = NULL; /*update capability*/ - _account_update_capability_by_user_name(account, user_name, package_name); + error_code = _account_update_capability_by_user_name(account, user_name, package_name); return error_code; } @@ -990,6 +1045,7 @@ int account_insert_to_db(account_h account, int *account_id) } ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL")); + ACCOUNT_RETURN_VAL((account_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT ID POINTER IS NULL")); account_s *data = (account_s*)account; @@ -1011,6 +1067,7 @@ int account_insert_to_db(account_h account, int *account_id) _account_insert_capability(data, *account_id); pthread_mutex_unlock(&account_mutex); + _account_insert_delete_update_dbus_notification_send(ACCOUNT_DBUS_NOTI_NAME_INSERT); return ACCOUNT_ERROR_NONE; @@ -1025,12 +1082,20 @@ int account_create(account_h *account) account_s *data = (account_s*)malloc(sizeof(account_s)); - if (data == NULL) + if (data == NULL) { + ACCOUNT_DEBUG("Memory Allocation Failed"); return ACCOUNT_ERROR_OUT_OF_MEMORY; + } ACCOUNT_MEMSET(data, 0, sizeof(account_s)); ACCOUNT_DEBUG("create handle=%p\n", *account); + /*Setting account as visible by default*/ + data->secret = ACCOUNT_SECRECY_VISIBLE; + + /*Setting account as not supporting sync by default*/ + data->sync_support = ACCOUNT_NOT_SUPPORTS_SYNC; + *account = (account_h)data; return ACCOUNT_ERROR_NONE; @@ -1227,7 +1292,7 @@ int account_set_user_text(account_h account, int index, const char *user_txt) ACCOUNT_DEBUG("(%s)-(%d) user_txt is NULL.\n", __FUNCTION__, __LINE__); return ACCOUNT_ERROR_INVALID_PARAMETER; } - if (index >= USER_TXT_CNT) { + if (index >= USER_TXT_CNT || index < 0) { ACCOUNT_DEBUG("(%s)-(%d) index rage should be between 0-4.\n", __FUNCTION__, __LINE__); return ACCOUNT_ERROR_INVALID_PARAMETER; } @@ -1274,6 +1339,22 @@ int account_set_secret(account_h account, const account_secrecy_state_e secret) return ACCOUNT_ERROR_NONE; } +int account_set_sync_support(account_h account, const account_sync_state_e sync_support) +{ + ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__)); + + if ( (sync_support < 0) || (sync_support > ACCOUNT_SUPPORTS_SYNC)) { + ACCOUNT_DEBUG("(%s)-(%d) sync_support is less than 1 or more than enum max.\n", __FUNCTION__, __LINE__); + return ACCOUNT_ERROR_INVALID_PARAMETER; + } + + account_s *data = (account_s*)account; + + data->sync_support= (int)sync_support; + + return ACCOUNT_ERROR_NONE; +} + int account_set_user_int(account_h account, int index, const int user_int) { if (!account) { @@ -1281,7 +1362,7 @@ int account_set_user_int(account_h account, int index, const int user_int) return ACCOUNT_ERROR_INVALID_PARAMETER; } - if (index >= USER_INT_CNT) { + if (index >= USER_INT_CNT ||index < 0) { ACCOUNT_DEBUG("(%s)-(%d) index rage should be between 0-4.\n", __FUNCTION__, __LINE__); return ACCOUNT_ERROR_INVALID_PARAMETER; } @@ -1551,6 +1632,24 @@ int account_get_secret(account_h account, account_secrecy_state_e *secret) return ACCOUNT_ERROR_NONE; } +int account_get_sync_support(account_h account, account_sync_state_e *sync_support) +{ + if (!account) { + ACCOUNT_DEBUG("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__); + return ACCOUNT_ERROR_INVALID_PARAMETER; + } + if (!sync_support) { + ACCOUNT_DEBUG("(%s)-(%d) sync_support is NULL.\n", __FUNCTION__, __LINE__); + return ACCOUNT_ERROR_INVALID_PARAMETER; + } + + account_s* data = (account_s*)account; + + *sync_support = data->sync_support; + + return ACCOUNT_ERROR_NONE; +} + int account_get_account_id(account_h account, int *account_id) { if (!account) { @@ -1619,6 +1718,7 @@ int account_query_capability_by_account_id(capability_cb cb_func, int account_id int rc = 0; ACCOUNT_RETURN_VAL((account_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0")); + ACCOUNT_RETURN_VAL((cb_func != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION")); int ret = ACCOUNT_ERROR_NONE; @@ -1678,9 +1778,6 @@ static int _account_update_account(account_s *account, int account_id) int error_code = ACCOUNT_ERROR_NONE; account_stmt hstmt = NULL; - ACCOUNT_RETURN_VAL((account->user_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("user_name is NULL.\n")); - ACCOUNT_RETURN_VAL((account->email_address != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("email_address is NULL.\n")); - if (!account->user_name && !account->display_name && !account->email_address) { ACCOUNT_DEBUG("One field should be set among user name, display name, email address\n"); return ACCOUNT_ERROR_INVALID_PARAMETER; @@ -1688,7 +1785,7 @@ static int _account_update_account(account_s *account, int account_id) ACCOUNT_MEMSET(query, 0x00, sizeof(query)); ACCOUNT_SNPRINTF(query, sizeof(query), "UPDATE %s SET user_name=?, email_address =?, display_name =?, " - "icon_path =?, source =?, package_name =? , access_token =?, domain_name =?, auth_type =?, secret =?," + "icon_path =?, source =?, package_name =? , access_token =?, domain_name =?, auth_type =?, secret =?, sync_support =?," "txt_custom0=?, txt_custom1=?, txt_custom2=?, txt_custom3=?, txt_custom4=?, " "int_custom0=?, int_custom1=?, int_custom2=?, int_custom3=?, int_custom4=? WHERE _id=? ", ACCOUNT_TABLE); @@ -1708,7 +1805,7 @@ static int _account_update_account(account_s *account, int account_id) hstmt = NULL; /*update capability*/ - _account_update_capability(account, account_id); + error_code = _account_update_capability(account, account_id); return error_code; } @@ -1731,6 +1828,7 @@ int account_update_to_db_by_id(const account_h account, int account_id) error_code = _account_update_account(data, account_id); pthread_mutex_unlock(&account_mutex); + _account_insert_delete_update_dbus_notification_send(ACCOUNT_DBUS_NOTI_NAME_UPDATE); return ACCOUNT_ERROR_NONE; } @@ -1754,6 +1852,7 @@ int account_update_to_db_by_user_name(account_h account, const char *user_name, error_code = _account_update_account_by_user_name(data, (char*)user_name, (char*)package_name); pthread_mutex_unlock(&account_mutex); + _account_insert_delete_update_dbus_notification_send(ACCOUNT_DBUS_NOTI_NAME_UPDATE); return ACCOUNT_ERROR_NONE; } @@ -1842,6 +1941,7 @@ int account_query_account_by_account_id(int account_db_id, account_h *account) int rc = 0; ACCOUNT_RETURN_VAL((account_db_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0")); + ACCOUNT_RETURN_VAL((*account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT IS NULL")); int ret = ACCOUNT_ERROR_NONE; @@ -1889,6 +1989,7 @@ int account_query_account_by_user_name(account_cb cb_func, const char *user_name int rc = 0; ACCOUNT_RETURN_VAL((user_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("USER NAME IS NULL")); + ACCOUNT_RETURN_VAL((cb_func != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("CALL BACK IS NULL")); int ret = ACCOUNT_ERROR_NONE; @@ -1971,6 +2072,7 @@ int account_query_account_by_user_name(account_cb cb_func, const char *user_name ACCOUNT_DEBUG("domain_name = %s", testaccount->domain_name); ACCOUNT_DEBUG("auth_type = %d", testaccount->auth_type); ACCOUNT_DEBUG("secret = %d", testaccount->secret); + ACCOUNT_DEBUG("sync_support = %d", testaccount->sync_support); ACCOUNT_DEBUG("user text = %s", testaccount->user_data_txt[0]); ACCOUNT_DEBUG("user text = %s", testaccount->user_data_txt[1]); ACCOUNT_DEBUG("user text = %s", testaccount->user_data_txt[2]); @@ -2111,6 +2213,7 @@ int account_query_account_by_capability(account_cb cb_func, account_capability_t ACCOUNT_DEBUG("domain_name = %s", testaccount->domain_name); ACCOUNT_DEBUG("auth_type = %d", testaccount->auth_type); ACCOUNT_DEBUG("secret = %d", testaccount->secret); + ACCOUNT_DEBUG("sync_support = %d", testaccount->sync_support); ACCOUNT_DEBUG("user text = %s", testaccount->user_data_txt[0]); ACCOUNT_DEBUG("user text = %s", testaccount->user_data_txt[1]); ACCOUNT_DEBUG("user text = %s", testaccount->user_data_txt[2]); @@ -2243,6 +2346,7 @@ int account_query_account_by_package_name(account_cb cb_func, const char* packag ACCOUNT_DEBUG("domain_name = %s", testaccount->domain_name); ACCOUNT_DEBUG("auth_type = %d", testaccount->auth_type); ACCOUNT_DEBUG("secret = %d", testaccount->secret); + ACCOUNT_DEBUG("sync_support = %d", testaccount->sync_support); ACCOUNT_DEBUG("user text = %s", testaccount->user_data_txt[0]); ACCOUNT_DEBUG("user text = %s", testaccount->user_data_txt[1]); ACCOUNT_DEBUG("user text = %s", testaccount->user_data_txt[2]); @@ -2342,6 +2446,9 @@ CATCH: if (ret_transaction != ACCOUNT_ERROR_NONE) { ACCOUNT_DEBUG("account_svc_delete:_account_svc_end_transaction fail %d, is_success=%d\n", ret_transaction, is_success); + } else { + if (is_success == true) + _account_insert_delete_update_dbus_notification_send(ACCOUNT_DBUS_NOTI_NAME_DELETE); } pthread_mutex_unlock(&account_mutex); @@ -2429,6 +2536,9 @@ CATCH: if (ret_transaction != ACCOUNT_ERROR_NONE) { ACCOUNT_DEBUG("account_svc_delete:_account_svc_end_transaction fail %d, is_success=%d\n", ret_transaction, is_success); + } else { + if (is_success == true) + _account_insert_delete_update_dbus_notification_send(ACCOUNT_DBUS_NOTI_NAME_DELETE); } pthread_mutex_unlock(&account_mutex); @@ -2505,6 +2615,9 @@ CATCH: if (ret_transaction != ACCOUNT_ERROR_NONE) { ACCOUNT_DEBUG("account_svc_delete:_account_svc_end_transaction fail %d, is_success=%d\n", ret_transaction, is_success); + } else { + if (is_success == true) + _account_insert_delete_update_dbus_notification_send(ACCOUNT_DBUS_NOTI_NAME_DELETE); } pthread_mutex_unlock(&account_mutex); diff --git a/src/utc-account.c b/src/utc-account.c new file mode 100755 index 0000000..5ab0349 --- /dev/null +++ b/src/utc-account.c @@ -0,0 +1,7753 @@ +/* + * utc-account + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Wonyoung Lee , Tarun Kumar + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include "account.h" +#include +#include + +int account_id = 0; + +static void _account_free_text(char *text) +{ + if (text) { + free(text); + text = NULL; + } +} + +bool _capability_get_callback(account_capability_type_e capability_type, account_capability_state_e capability_value, void* user_data) +{ + int test_type = capability_type; + int test_value = capability_value; + + printf("_capability_get_callback test_type = : %d\n", test_type); + printf("_capability_get_callback test_value = : %d\n", test_value); + return TRUE; +} + +int _account_get_account_info(account_h handle) +{ + printf("_account_get_callback\n"); + + char *test_text = NULL; + + account_get_user_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_display_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_email_address(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_icon_path(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_source(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_package_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_domain_name(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + _account_free_text(test_text); + + account_get_access_token(handle, &test_text); + printf("_account_get_callback : %s\n", test_text); + + + int i; + + for(i=0;idata; + printf("%s\n", (char *)iter->data); + g_free(capa); + } + + + g_slist_free(list); + return 0; +} + + +static int utc1_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc2_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, NULL); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + + + + +static int utc3_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "11111111111111111111111111111111111 \ + 2222222222222222222222222222222222222222222222222 \ + 3333333333333333333333333333333333333333333333333\ + 4444444444444444444444444444444444444444444444444\ + 5555555555555555555555555555555555555555555555555\ + 666666666666666666666666666666666666666666666666\ + 777777777777777777777777777777777777777777777777\ + 888888888888888888888888888888888888888888888888\ + 99999999999999999999999999999999999999999999999\ + 111111111111111111111111111111111111111111111111\ + 22222222222222222222222222222222222222222222222\ + 333333333333333333333333333333333333333333333\ + 444444444444444444444444444444444444444444\ + 444444444444444444444444444444444444444444444444\ + 555555555555555555555555555555555555555555555555 \ + 66666666666666666666666666666666666666666666666666\ + 777777777777777777777777777777777777777777777777779999999999999999999999999999999999999999\ + 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\ + 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc4_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, NULL); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc5_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "tarun kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, NULL); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc6_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "tarun kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "Samsung"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc7_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "tarun kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "Samsung"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, NULL); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc8_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "tarun kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "Samsung"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, "tarun.kr@samsung.com"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account-else loop] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc9_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "tarun kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "Samsung"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, "tarun.kr@samsung.com"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_package_name(account, NULL); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc10_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "tarun kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "Samsung"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, "tarun.kr@samsung.com"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_package_name(account, "com.samsung.accounts"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc11_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "tarun kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "Samsung"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, "tarun.kr@samsung.com"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_package_name(account, "com.samsung.accounts"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_icon_path(account, NULL); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc12_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "tarun kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "Samsung"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, "tarun.kr@samsung.com"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_package_name(account, "com.samsung.accounts"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_icon_path(account, "/test/test.jpg"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc13_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "tarun kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "Samsung"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, "tarun.kr@samsung.com"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_package_name(account, "com.samsung.accounts"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_icon_path(account, "/test/test.jpg"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_access_token(account, NULL); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc14_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "tarun kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "Samsung"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, "tarun.kr@samsung.com"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_package_name(account, "com.samsung.accounts"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_icon_path(account, "/test/test.jpg"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc15_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "tarun kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "Samsung"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, "tarun.kr@samsung.com"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_package_name(account, "com.samsung.accounts"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_icon_path(account, "/test/test.jpg"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH ); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc16_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "tarun kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "Samsung"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, "tarun.kr@samsung.com"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_package_name(account, "com.samsung.accounts"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_icon_path(account, "/test/test.jpg"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH ); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc17_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "tarun kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "Samsung"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, "tarun.kr@samsung.com"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_package_name(account, "com.samsung.accounts"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_icon_path(account, "/test/test.jpg"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH ); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_source(account, NULL); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc18_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "tarun kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "Samsung"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, "tarun.kr@samsung.com"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_package_name(account, "com.samsung.accounts"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_icon_path(account, "/test/test.jpg"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH ); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_source(account, "URUSA inc."); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_insert_to_db(account, &account_id); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_destroy(account); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + return account_id; +} + +static int utc19_account_insert() +{ + + int ret = -1; + account_h account; + int account_id = -1; + ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + ret = account_create(&account); + + printf("account = %p, ret = %d \n", account, ret); + + ret = account_set_user_name(account, "tarun.kr"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p , account_id = %d\n", __LINE__, ret, account, account_id); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_display_name(account, "tarun kumar"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_domain_name(account, "Samsung"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_email_address(account, "tarun.kr@samsung.com"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_package_name(account, "com.samsung.accounts"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_icon_path(account, "/test/test.jpg"); + + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_access_token(account, "xxxx/yyyy/zzzz/-&abc"); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_auth_type( account, ACCOUNT_AUTH_TYPE_OAUTH ); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + ret = account_set_secret( account, ACCOUNT_SECRECY_INVISIBLE); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + ret = account_set_source(account, "URUSA inc."); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account); + } + else + { + printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account); + } + + int i; + + for(i=0; i 0) + { + printf("(%d)-[Account] account insert test Success!! account id = %d\n", __LINE__, account_id); + } + utc_account_get_and_update(); + } else if (user_resp == 2) { + printf("In Account Update Test Mode \n"); + printf("1. Press 1 to upadte account by id test \n"); + printf("2. Press 2 for update account by user name test \n"); + scanf("%d", &user_resp); + if (user_resp == 1) { + printf("Enter Account Id to be Updated \n"); + scanf("%d", &account_id); + if (_account_update_test_new(account_id) == ACCOUNT_ERROR_NONE) + printf("Account update Success \n"); + else + printf("Account update Failed \n"); + } else if (user_resp == 2) { + printf("Enter Account user name to be Updated \n"); + memset(temp, 0x00, sizeof(temp)); + scanf("%s", temp); + char temp2[128]; + memset(temp2, 0x00, sizeof(temp2)); + printf("Enter Account package name to be Updated \n"); + scanf("%s", temp2); + if (_account_update_test_new_by_user_name(temp, temp2) == ACCOUNT_ERROR_NONE) + printf("Account update Success \n"); + else + printf("Account update Failed \n"); + } else { + printf("Wrong info entered \n"); + exit(0); + } + } else if (user_resp == 3) { + printf("In Account Delete Test Mode \n"); + printf("1. Press 1 to delete account by id test \n"); + printf("2. Press 2 to delete account by user name test \n"); + printf("3. Press 3 to delete account by package name test \n"); + scanf("%d", &user_resp); + if (user_resp == 1) { + printf("Enter Account Id to be Deleted \n"); + scanf("%d", &account_id); + int ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + if (account_delete_from_db_by_id(account_id) == ACCOUNT_ERROR_NONE) + printf("Account delete Success \n"); + else + printf("Account delete Failed \n"); + + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + } else if (user_resp == 2) { + printf("Enter Account user name to be Deleted \n"); + memset(temp, 0x00, sizeof(temp)); + scanf("%s", temp); + char temp2[128]; + memset(temp2, 0x00, sizeof(temp2)); + printf("Enter Account package name to be Deleted \n"); + scanf("%s", temp2); + int ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + if (account_delete_from_db_by_user_name(temp, temp2) == ACCOUNT_ERROR_NONE) + printf("Account delete Success \n"); + else + printf("Account delete Failed \n"); + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + } else if (user_resp == 3) { + printf("Enter Account package name to be Deleted \n"); + memset(temp, 0x00, sizeof(temp)); + scanf("%s", temp); + int ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + if (account_delete_from_db_by_package_name(temp) == ACCOUNT_ERROR_NONE ) + printf("Account delete Success \n"); + else + printf("Account delete Failed \n"); + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + + } else { + printf("Wrong info entered \n"); + exit(0); + } + + } else if (user_resp == 4) { + printf("In Account Query Test Mode \n"); + printf("1. Press 1 to Query account by id test \n"); + printf("2. Press 2 to Query account by user name test \n"); + printf("3. Press 3 to Query account by package name test \n"); + printf("4. Press 4 to Query account by capability test \n"); + scanf("%d", &user_resp); + if (user_resp == 1) { + printf("Enter Account Id to be Queried \n"); + scanf("%d", &account_id); + account_h account; + account_connect(); + account_create(&account); + if (account_query_account_by_account_id(account_id, &account) == ACCOUNT_ERROR_NONE) + printf("Account Queried Successfully \n"); + else + printf("Account Queried failed \n"); + account_destroy(account); + account_disconnect(); + } else if (user_resp == 2) { + printf("Enter Account user name to be Queried \n"); + scanf("%s", temp); + int ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + if (account_query_account_by_user_name(_account_get_callback, temp, NULL) == ACCOUNT_ERROR_NONE) + printf("Account Queried Successfully \n"); + else + printf("Account Queried failed \n"); + + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + } else if (user_resp == 3) { + printf("Enter Account package name to be Queried \n"); + scanf("%s", temp); + int ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d\n", __LINE__, ret); + } + if (account_query_account_by_package_name(_account_get_callback, temp, NULL) == ACCOUNT_ERROR_NONE) + printf("Account Queried Successfully \n"); + else + printf("Account Queried failed \n"); + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + } else if (user_resp == 4) { + printf("Enter Account capability key to be Queried \n"); + scanf("%d", &cap_key); + printf("Enter Account capability key's value to be Queried \n"); + scanf("%d", &cap_value); + int ret = account_connect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d\n", __LINE__, ret); + } + if (account_query_account_by_capability(_account_get_callback, cap_key, cap_value, NULL) == ACCOUNT_ERROR_NONE) + printf("Account Queried Successfully \n"); + else + printf("Account Queried failed \n"); + ret = account_disconnect(); + if(ret != ACCOUNT_ERROR_NONE) + { + printf("(%d)-[Account] ret = %d, \n", __LINE__, ret); + } + } else { + printf("Wrong info entered \n"); + exit(0); + } + + } else { + printf("Wrong info entered \n"); + exit(0); + } + + //utc calls +#if 1 + //utc insert + utc1_account_insert(); + utc2_account_insert(); + utc3_account_insert(); + utc4_account_insert(); + utc5_account_insert(); + utc6_account_insert(); + utc7_account_insert(); + utc8_account_insert(); + utc9_account_insert(); + utc10_account_insert(); + utc11_account_insert(); + utc12_account_insert(); + utc13_account_insert(); + utc14_account_insert(); + utc15_account_insert(); + utc16_account_insert(); + utc17_account_insert(); + utc18_account_insert(); + utc19_account_insert(); + utc20_account_insert(); + utc21_account_insert(); + utc22_account_insert(); + utc23_account_insert(); +#endif + + //utc update +#if 1 + utc1_account_update(); + utc2_account_update(); + utc3_account_update(); + utc4_account_update(); + utc5_account_update(); + utc6_account_update(); + utc7_account_update(); + utc8_account_update(); + utc9_account_update(); + utc10_account_update(); + utc11_account_update(); + utc12_account_update(); + utc13_account_update(); + utc14_account_update(); + utc15_account_update(); + utc16_account_update(); + utc17_account_update(); + utc18_account_update(); + utc19_account_update(); + utc20_account_update(); + utc21_account_update(); + utc22_account_update(); + utc23_account_update(); + utc24_account_update(); + utc25_account_update(); + utc26_account_update(); + utc27_account_update(); +#endif + + //utc get account by id +#if 1 + utc1_get_account_by_id(); + utc2_get_account_by_id(); +#endif + + //utc get account by user name +#if 1 + utc1_get_account_by_user_name(); + utc2_get_account_by_user_name(); +#endif + + //utc get account by capability +#if 1 + utc1_get_account_by_capability(); + utc2_get_account_by_capability(); + utc3_get_account_by_capability(); + utc4_get_account_by_capability(); + utc5_get_account_by_capability(); +#endif + + //utc get all accounts +#if 1 + utc1_get_all_accounts(); + utc2_get_all_accounts(); +#endif + + //utc get capability by account id +#if 1 + utc1_account_get_capability_by_account_id(); + utc2_account_get_capability_by_account_id(); +#endif + + //utc_account_delete_by_id(); +#if 1 + utc_account_delete_by_user_name(); + utc_account_delete_by_package_name(); +#endif + +#endif + + return 0; +} + -- 2.7.4