--- /dev/null
+Wonyoung Lee <wy1115.lee@samsung.com>
+Sungchan Kim <sungchan81.kim@samsung.com>
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(accounts-svc C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR "\${prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include ")
+SET(VERSION_MAJOR 0)
+SET(VERSION "${VERSION_MAJOR}.2.21")
+
+SET(SRCS
+src/account.c
+src/account-capability-parser.c
+)
+
+SET(TESTSRC
+src/account.c
+src/account-capability-parser.c
+src/utc-account.c
+)
+
+SET(XML_PARSE_TEST_SRC
+src/account.c
+src/account-capability-parser.c
+src/account-xml-verify.c
+)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED sqlite3 dlog db-util glib-2.0 capi-base-common vconf capi-appfw-application libxml-2.0)
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
+SET(CMAKE_LDFLAGS "-Wl,-zdefs")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
+ADD_DEFINITIONS("-DSLP_DEBUG")
+
+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})
+
+ADD_EXECUTABLE("account-xml-verify" ${XML_PARSE_TEST_SRC})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
+TARGET_LINK_LIBRARIES("account-xml-verify" ${pkgs_LDFLAGS})
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib/accounts-svc)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
+
+INSTALL(TARGETS account-xml-verify DESTINATION bin)
+
+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)
--- /dev/null
+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
+
--- /dev/null
+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.
+
+
+
--- /dev/null
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License, Version 2 terms and conditions.
--- /dev/null
+#!/bin/sh
+
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
--- /dev/null
+#!/bin/sh
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
--- /dev/null
+#!/bin/sh
+
+. ./_export_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -c -p ./
+tcc -b -j $JOURNAL_RESULT -p ./
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
--- /dev/null
+#!/bin/sh
+
+. ./_export_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+RESULT_DIR=results
+
+tcc -c -p ./ # executing tcc, with clean option (-c)
+rm -r $RESULT_DIR
+rm -r tet_tmp_dir
+rm testcase/tet_captured
--- /dev/null
+TET_INSTALL_HOST_PATH=/home/user/git_new/DTS/TETware
+TET_INSTALL_TARGET_PATH=/mnt/nfs/DTS/TETware
--- /dev/null
+#!/bin/sh
+
+. ./_export_target_env.sh # setting environment variables
+
+export TET_INSTALL_PATH=/mnt/nfs/TETWare
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TEST_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
--- /dev/null
+CC ?= gcc
+
+C_FILES = $(shell ls *.c)
+
+PKGS = accounts-svc dlog gthread-2.0
+
+LDFLAGS = `pkg-config --libs $(PKGS)`
+LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+
+CFLAGS = -I. `pkg-config --cflags $(PKGS)`
+CFLAGS += -I$(TET_ROOT)/inc/tet3
+CFLAGS += -Wall
+
+TCS := $(shell ls -1 *.c | cut -d. -f1)
+
+all: $(TCS)
+
+%: %.c
+ $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+ rm -f $(TCS)
--- /dev/null
+/testcase/utc_account
+
+
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 <tet_api.h>
+#include <account.h>
+#include <account-types.h>
+#include <account-error.h>
+
+#define TEST_PACKAGE_NAME "com.samsung.facebook"
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_account_connect_positive(void);
+static void utc_account_connect_negative(void);
+static void utc_account_create_positive(void);
+static void utc_account_create_negative(void);
+static void utc_account_destroy_positive(void);
+static void utc_account_destroy_negative(void);
+static void utc_account_insert_to_db_positive(void);
+static void utc_account_insert_to_db_negative(void);
+static void utc_account_delete_from_db_by_id_positive(void);
+static void utc_account_delete_from_db_by_id_negative(void);
+static void utc_account_delete_from_db_by_user_name_positive(void);
+static void utc_account_delete_from_db_by_user_name_negative(void);
+static void utc_account_delete_from_db_by_package_name_positive(void);
+static void utc_account_delete_from_db_by_package_name_negative(void);
+static void utc_account_update_to_db_by_id_positive(void);
+static void utc_account_update_to_db_by_id_negative(void);
+static void utc_account_update_to_db_by_user_name_positive(void);
+static void utc_account_update_to_db_by_user_name_negative(void);
+static void utc_account_update_sync_status_by_id_positive(void);
+static void utc_account_update_sync_status_by_id_negative(void);
+static void utc_account_get_account_id_positive(void);
+static void utc_account_get_account_id_negative(void);
+static void utc_account_get_user_name_positive(void);
+static void utc_account_get_user_name_negative(void);
+static void utc_account_set_user_name_positive(void);
+static void utc_account_set_user_name_negative(void);
+static void utc_account_get_display_name_positive(void);
+static void utc_account_get_display_name_negative(void);
+static void utc_account_set_display_name_positive(void);
+static void utc_account_set_display_name_negative(void);
+static void utc_account_get_capability_positive(void);
+static void utc_account_get_capability_negative(void);
+static void utc_account_set_capability_positive(void);
+static void utc_account_set_capability_negative(void);
+static void utc_account_get_icon_path_positive(void);
+static void utc_account_get_icon_path_negative(void);
+static void utc_account_set_icon_path_positive(void);
+static void utc_account_set_icon_path_negative(void);
+static void utc_account_get_domain_name_positive(void);
+static void utc_account_get_domain_name_negative(void);
+static void utc_account_set_domain_name_positive(void);
+static void utc_account_set_domain_name_negative(void);
+static void utc_account_get_email_address_positive(void);
+static void utc_account_get_email_address_negative(void);
+static void utc_account_set_email_address_positive(void);
+static void utc_account_set_email_address_negative(void);
+static void utc_account_get_package_name_positive(void);
+static void utc_account_get_package_name_negative(void);
+static void utc_account_set_package_name_positive(void);
+static void utc_account_set_package_name_negative(void);
+static void utc_account_get_access_token_positive(void);
+static void utc_account_get_access_token_negative(void);
+static void utc_account_set_access_token_positive(void);
+static void utc_account_set_access_token_negative(void);
+static void utc_account_get_user_text_positive(void);
+static void utc_account_get_user_text_negative(void);
+static void utc_account_set_user_text_positive(void);
+static void utc_account_set_user_text_negative(void);
+static void utc_account_get_user_int_positive(void);
+static void utc_account_get_user_int_negative(void);
+static void utc_account_set_user_int_positive(void);
+static void utc_account_set_user_int_negative(void);
+static void utc_account_get_auth_type_positive(void);
+static void utc_account_get_auth_type_negative(void);
+static void utc_account_set_auth_type_positive(void);
+static void utc_account_set_auth_type_negative(void);
+static void utc_account_get_secret_positive(void);
+static void utc_account_get_secret_negative(void);
+static void utc_account_set_secret_positive(void);
+static void utc_account_set_secret_negative(void);
+static void utc_account_get_sync_support_positive(void);
+static void utc_account_get_sync_support_negative(void);
+static void utc_account_set_sync_support_positive(void);
+static void utc_account_set_sync_support_negative(void);
+static void utc_account_get_source_positive(void);
+static void utc_account_get_source_negative(void);
+static void utc_account_set_source_positive(void);
+static void utc_account_set_source_negative(void);
+static void utc_account_foreach_account_from_db_positive(void);
+static void utc_account_foreach_account_from_db_negative(void);
+static void utc_account_query_account_by_account_id_positive(void);
+static void utc_account_query_account_by_account_id_negative(void);
+static void utc_account_query_account_by_user_name_positive(void);
+static void utc_account_query_account_by_user_name_negative(void);
+static void utc_account_query_account_by_package_name_positive(void);
+static void utc_account_query_account_by_package_name_negative(void);
+static void utc_account_query_account_by_capability_positive(void);
+static void utc_account_query_account_by_capability_negative(void);
+static void utc_account_query_capability_by_account_id_positive(void);
+static void utc_account_query_capability_by_account_id_negative(void);
+static void utc_account_get_total_count_from_db_positive(void);
+static void utc_account_get_total_count_from_db_negative(void);
+
+
+struct tet_testlist tet_testlist[] = {
+ {utc_account_connect_positive, 1},
+ //{utc_account_connect_negative, 1},
+ {utc_account_create_positive, 1},
+ {utc_account_create_negative, 1},
+ {utc_account_destroy_positive, 1},
+ //{utc_account_destroy_negative, 1},
+ {utc_account_insert_to_db_positive, 1},
+ {utc_account_insert_to_db_negative, 1},
+ {utc_account_update_to_db_by_id_positive, 1},
+ {utc_account_update_to_db_by_id_negative, 1},
+ {utc_account_update_to_db_by_user_name_positive, 1},
+ {utc_account_update_to_db_by_user_name_negative, 1},
+ {utc_account_update_sync_status_by_id_positive, 1},
+ {utc_account_update_sync_status_by_id_negative, 1},
+ {utc_account_get_account_id_positive, 1},
+ {utc_account_get_account_id_negative, 1},
+ {utc_account_get_user_name_positive, 1},
+ {utc_account_get_user_name_negative, 1},
+ {utc_account_set_user_name_positive, 1},
+ {utc_account_set_user_name_negative, 1},
+ {utc_account_get_display_name_positive, 1},
+ {utc_account_get_display_name_negative, 1},
+ {utc_account_set_display_name_positive, 1},
+ {utc_account_set_display_name_negative, 1},
+ {utc_account_get_capability_positive, 1},
+ {utc_account_get_capability_negative, 1},
+ {utc_account_set_capability_positive, 1},
+ {utc_account_set_capability_negative, 1},
+ {utc_account_get_icon_path_positive, 1},
+ {utc_account_get_icon_path_negative, 1},
+ {utc_account_set_icon_path_positive, 1},
+ {utc_account_set_icon_path_negative, 1},
+ {utc_account_get_domain_name_positive, 1},
+ {utc_account_get_domain_name_negative, 1},
+ {utc_account_set_domain_name_positive, 1},
+ {utc_account_set_domain_name_negative, 1},
+ {utc_account_get_email_address_positive, 1},
+ {utc_account_get_email_address_negative, 1},
+ {utc_account_set_email_address_positive, 1},
+ {utc_account_set_email_address_negative, 1},
+ {utc_account_get_package_name_positive, 1},
+ {utc_account_get_package_name_negative, 1},
+ {utc_account_set_package_name_positive, 1},
+ {utc_account_set_package_name_negative, 1},
+ {utc_account_get_access_token_positive, 1},
+ {utc_account_get_access_token_negative, 1},
+ {utc_account_set_access_token_positive, 1},
+ {utc_account_set_access_token_negative, 1},
+ {utc_account_get_user_text_positive, 1},
+ {utc_account_get_user_text_negative, 1},
+ {utc_account_set_user_text_positive, 1},
+ {utc_account_set_user_text_negative, 1},
+ {utc_account_get_user_int_negative, 1},
+ {utc_account_get_user_int_negative, 1},
+ {utc_account_set_user_int_negative, 1},
+ {utc_account_set_user_int_negative, 1},
+ {utc_account_get_auth_type_positive, 1},
+ {utc_account_get_auth_type_negative, 1},
+ {utc_account_set_auth_type_positive, 1},
+ {utc_account_set_auth_type_negative, 1},
+ {utc_account_get_secret_positive, 1},
+ {utc_account_get_secret_negative, 1},
+ {utc_account_set_secret_positive, 1},
+ {utc_account_set_secret_negative, 1},
+ {utc_account_get_sync_support_positive, 1},
+ {utc_account_get_sync_support_negative, 1},
+ {utc_account_set_sync_support_positive, 1},
+ {utc_account_set_sync_support_negative, 1},
+ {utc_account_get_source_positive, 1},
+ {utc_account_get_source_negative, 1},
+ {utc_account_set_source_positive, 1},
+ {utc_account_set_source_negative, 1},
+ {utc_account_foreach_account_from_db_positive, 1},
+ {utc_account_foreach_account_from_db_negative, 1},
+ {utc_account_query_account_by_account_id_positive, 1},
+ {utc_account_query_account_by_account_id_negative, 1},
+ {utc_account_query_account_by_user_name_positive, 1},
+ {utc_account_query_account_by_user_name_negative, 1},
+ {utc_account_query_account_by_package_name_positive, 1},
+ {utc_account_query_account_by_package_name_negative, 1},
+ {utc_account_query_account_by_capability_positive, 1},
+ {utc_account_query_account_by_capability_negative, 1},
+ {utc_account_query_capability_by_account_id_positive, 1},
+ {utc_account_query_capability_by_account_id_negative, 1},
+ {utc_account_get_total_count_from_db_positive, 1},
+ {utc_account_get_total_count_from_db_negative, 1},
+ {utc_account_delete_from_db_by_id_positive, 1},
+ {utc_account_delete_from_db_by_id_negative, 1},
+ {utc_account_delete_from_db_by_user_name_positive, 1},
+ {utc_account_delete_from_db_by_user_name_negative, 1},
+ {utc_account_delete_from_db_by_package_name_positive, 1},
+ {utc_account_delete_from_db_by_package_name_negative, 1},
+ /* TODO : Add more test case */
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+
+}
+
+
+static void cleanup(void)
+{
+ /* end of TC */
+}
+
+static void _account_free_text(char *text)
+{
+ if (text) {
+ free(text);
+ text = NULL;
+ }
+}
+
+// START example for libaccounts-svc API test case
+
+static void utc_account_connect_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_connect();
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+}
+
+static void utc_account_connect_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = rename("/opt/dbspace/.account.db", "/opt/dbspace/.account-tmp.db");
+
+ ret = rename("/opt/dbspace/.account.db-journal", "/opt/dbspace/.account-tmp.db-journal");
+
+ ret = account_connect();
+
+ if ( ret == ACCOUNT_ERROR_DB_NOT_OPENED ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = rename("/opt/dbspace/.account-tmp.db", "/opt/dbspace/.account.db");
+ ret = rename("/opt/dbspace/.account-tmp.db-journal", "/opt/dbspace/.account.db-journal");
+
+ ret = account_disconnect();
+ if ( ret != ACCOUNT_ERROR_NONE) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_destroy_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_connect();
+ if ( ret != ACCOUNT_ERROR_NONE) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+}
+
+static void utc_account_destroy_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = rename("/opt/dbspace/.account.db", "/opt/dbspace/.account-tmp.db");
+
+ ret = rename("/opt/dbspace/.account.db-journal", "/opt/dbspace/.account-tmp.db-journal");
+
+ ret = account_disconnect();
+
+ if ( ret == ACCOUNT_ERROR_DB_NOT_OPENED ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = rename("/opt/dbspace/.account-tmp.db", "/opt/dbspace/.account.db");
+ ret = rename("/opt/dbspace/.account-tmp.db-journal", "/opt/dbspace/.account.db-journal");
+}
+
+static void utc_account_create_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_connect();
+ if ( ret != ACCOUNT_ERROR_NONE) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+ if ( ret != ACCOUNT_ERROR_NONE) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+ if ( ret != ACCOUNT_ERROR_NONE) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_create_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ret = account_connect();
+ if ( ret != ACCOUNT_ERROR_NONE) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+ if ( ret != ACCOUNT_ERROR_NONE) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_insert_to_db_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_user_name(account, "tarun.kr");
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_package_name(account, TEST_PACKAGE_NAME);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_insert_to_db_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(NULL, &account_id);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_display_name_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_display_name(account, "tarun.kr");
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_display_name_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ ret = account_set_display_name(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_user_name_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_user_name(account, "tarun.kr");
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_user_name_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ ret = account_set_user_name(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_icon_path_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_icon_path(account, "icon-path");
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_icon_path_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ ret = account_set_icon_path(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_domain_name_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_domain_name(account, "domain-name");
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_domain_name_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ ret = account_set_domain_name(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_email_address_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_email_address(account, "email-address");
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_email_address_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ ret = account_set_email_address(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_source_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_source(account, "source");
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_source_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ ret = account_set_source(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_package_name_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_package_name(account, "package_name");
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_package_name_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ ret = account_set_package_name(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_access_token_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_access_token(account, "access_token");
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_access_token_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ ret = account_set_access_token(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_auth_type_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_auth_type(account, ACCOUNT_AUTH_TYPE_XAUTH);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_auth_type_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ ret = account_set_auth_type(account, -999);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_secret_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_secret(account, ACCOUNT_SECRECY_INVISIBLE);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_secret_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ ret = account_set_secret(account, -999);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_sync_support_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_sync_support(account, ACCOUNT_SYNC_STATUS_IDLE);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_sync_support_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ ret = account_set_sync_support(account, -999);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_user_text_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ int i;
+ for ( i = 0; i < 5; i++)
+ ret = account_set_user_text(account, i, "user-text");
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_user_text_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ int i;
+
+ for (i = 0; i < 5; i++)
+ ret = account_set_user_text(account, i, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_user_int_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ int i;
+ for (i = 0; i < 5; i++)
+ ret = account_set_user_int(account, i, 999);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_user_int_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ int i;
+ for (i = 0; i < 5; i++)
+ ret = account_set_user_int(NULL, i, 999);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_capability_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_CALENDAR, ACCOUNT_CAPABILITY_ENABLED);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_set_capability_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_capability(account, -100, -5);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_display_name_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ char * display_name;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_display_name(account, &display_name);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ _account_free_text(display_name);
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_display_name_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_display_name(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_account_id_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_account_id(account, &account_id);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_account_id_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_account_id(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_user_name_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ char *user_name;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_user_name(account, &user_name);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ _account_free_text(user_name);
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_user_name_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_user_name(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_icon_path_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ char *icon_path;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_icon_path(account, &icon_path);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ _account_free_text(icon_path);
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_icon_path_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_icon_path(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_domain_name_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ char *domain_name;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_domain_name(account, &domain_name);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ _account_free_text(domain_name);
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_domain_name_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_domain_name(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_email_address_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ char *email_address;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_email_address(account, &email_address);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ _account_free_text(email_address);
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_email_address_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_email_address(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_source_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ char *source;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_source(account, &source);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ _account_free_text(source);
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_source_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_source(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_package_name_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ char *package_name;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_package_name(account, &package_name);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ _account_free_text(package_name);
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_package_name_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_package_name(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_access_token_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ char *access_token;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_access_token(account, &access_token);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ _account_free_text(access_token);
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_access_token_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_access_token(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_auth_type_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int auth_type;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_auth_type(account, &auth_type);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_auth_type_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_auth_type(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_secret_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ account_secrecy_state_e secret;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_secret(account, &secret);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_sync_support_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ account_sync_state_e sync_support;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_sync_support(account, &sync_support);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_secret_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_secret(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_sync_support_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_sync_support(account, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_user_text_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ char *user_text;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ int i;
+ for (i = 0; i < 5; i++) {
+ ret = account_get_user_text(account, i, &user_text);
+ _account_free_text(user_text);
+ }
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_user_text_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ int i;
+ for (i = 0; i < 5; i++)
+ ret = account_get_user_text(account, i, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_user_int_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int user_int;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ int i;
+ for (i = 0; i < 5; i++)
+ ret = account_get_user_int(account, i, &user_int);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_insert_to_db(account, &account_id);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_user_int_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+ int i;
+ for (i = 0; i < 5; i++)
+ ret = account_get_user_int(NULL, i, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+bool capability_call_back(account_capability_type_e capability_type, account_capability_state_e capability_state, void *user_data)
+{
+
+}
+
+static void utc_account_get_capability_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_capability(account, capability_call_back, NULL);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_capability_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_capability(account, NULL, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+bool account_call_back(account_h account, void *user_data)
+{
+
+}
+
+static void utc_account_foreach_account_from_db_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_foreach_account_from_db(account_call_back, NULL);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_foreach_account_from_db_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_foreach_account_from_db(NULL, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_query_account_by_account_id_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(1, &account);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_query_account_by_account_id_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_account_id(-999, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_query_account_by_user_name_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_user_name(account_call_back, "tarun.kr", NULL);
+
+ if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_query_account_by_user_name_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_user_name(account_call_back, NULL, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_query_account_by_package_name_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_package_name(account_call_back, TEST_PACKAGE_NAME, NULL);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_query_account_by_package_name_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_package_name(account_call_back, NULL, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_query_account_by_capability_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_capability(account_call_back, ACCOUNT_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_ENABLED, NULL);
+
+ if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_query_account_by_capability_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_account_by_capability(account_call_back, -999, -999, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_query_capability_by_account_id_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_capability_by_account_id(capability_call_back, 1, NULL);
+
+ if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_query_capability_by_account_id_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_query_capability_by_account_id(capability_call_back, -1, NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_total_count_from_db_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int *count;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_total_count_from_db(&count);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_get_total_count_from_db_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_get_total_count_from_db(NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_update_sync_status_by_id_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_update_sync_status_by_id(1, ACCOUNT_SYNC_STATUS_IDLE);
+
+ if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_update_sync_status_by_id_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_update_sync_status_by_id(-1, ACCOUNT_SYNC_STATUS_IDLE);
+
+ if ( ret == ACCOUNT_ERROR_RECORD_NOT_FOUND || ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+}
+
+static void utc_account_delete_from_db_by_id_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_delete_from_db_by_id(1);
+
+ if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_delete_from_db_by_id_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_delete_from_db_by_id(-1);
+
+ if ( ret == ACCOUNT_ERROR_RECORD_NOT_FOUND || ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+}
+
+static void utc_account_delete_from_db_by_user_name_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_delete_from_db_by_user_name("tarun.kr", TEST_PACKAGE_NAME);
+
+ if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_delete_from_db_by_user_name_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_delete_from_db_by_user_name(NULL, TEST_PACKAGE_NAME);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_delete_from_db_by_package_name_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_delete_from_db_by_package_name(TEST_PACKAGE_NAME);
+
+ if ( ret == ACCOUNT_ERROR_NONE || ret == ACCOUNT_ERROR_RECORD_NOT_FOUND) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_delete_from_db_by_package_name_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_delete_from_db_by_package_name(NULL);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_update_to_db_by_id_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_user_name(account, "update-tarun.kr");
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_package_name(account, TEST_PACKAGE_NAME);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_update_to_db_by_id(account, 1);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_update_to_db_by_id_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_update_to_db_by_id(account, -1);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_update_to_db_by_user_name_positive(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_user_name(account, "update-tarun.kr");
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_set_package_name(account, TEST_PACKAGE_NAME);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_update_to_db_by_user_name(account, "tarun.kr", TEST_PACKAGE_NAME);
+
+ if ( ret == ACCOUNT_ERROR_NONE ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+static void utc_account_update_to_db_by_user_name_negative(void)
+{
+ const char *API_NAME = __FUNCTION__;
+ account_h account;
+ int account_id = -1;
+ int ret = ACCOUNT_ERROR_NONE;
+ ret = account_connect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_create(&account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_update_to_db_by_user_name(account, NULL, TEST_PACKAGE_NAME);
+
+ if ( ret == ACCOUNT_ERROR_INVALID_PARAMETER ) {
+ dts_pass(API_NAME, "passed");
+ } else {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_destroy(account);
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+
+ ret = account_disconnect();
+
+ if ( ret != ACCOUNT_ERROR_NONE ) {
+ dts_fail(API_NAME, "failed");
+ }
+}
+
+// END of example for libaccounts-svc API unit test
+
--- /dev/null
+all
+ ^TEST
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+ :include:/testcase/tslist
--- /dev/null
+TET_OUTPUT_CAPTURE=True # capture option for build operation checking
+TET_BUILD_TOOL=make # build with using make command
+TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build
+TET_API_COMPLIANT=True # use TET API in Test Case ?
+TET_PASS_TC_NAME=True # report passed TC name in Journal file?
--- /dev/null
+TET_OUTPUT_CAPTURE=True # capture option
+TET_CLEAN_TOOL= make clean # clean tool
+TET_CLEAN_FILE= Makefile # file for clean
+TET_API_COMPLIANT=True # TET API useage
+TET_PASS_TC_NAME=True # showing name , passed TC
--- /dev/null
+TET_OUTPUT_CAPTURE=True # capturing execution or not
+TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional
+TET_EXEC_FILE= # ex) exectool : execution file/ Optional
+TET_API_COMPLIANT=True # Test case or Tool usesTET API?
+TET_PASS_TC_NAME=True # showing Passed TC name ?
--- /dev/null
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: accounts-svc
+Description: Account DB library
+Version: @VERSION@
+Requires: sqlite3 dlog db-util glib-2.0 capi-base-common vconf capi-appfw-application libxml-2.0
+Libs: -L${libdir} -laccounts-svc
+Cflags: -I${includedir}
--- /dev/null
+/*
+ * account
+ *
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+#ifndef __ACCOUNT_ERROR_H__
+#define __ACCOUNT_ERROR_H__
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @addtogroup CAPI_ACCOUNT_MANAGER_MODULE
+ * @{
+ */
+
+/**
+ * @file account-error.h
+ * @brief ACCOUNT error definitions.
+ */
+
+//#define TIZEN_ERROR_ACCOUNT_CLASS SLP_ERROR_SOCIAL_CLASS | 0x90
+
+/**
+ * @brief Enumerations of error codes for ACOUNT APIs.
+ */
+typedef enum
+{
+
+ ACCOUNT_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ ACCOUNT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ ACCOUNT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+
+ ACCOUNT_ERROR_DUPLICATED = TIZEN_ERROR_SOCIAL_CLASS | 0x01,
+ ACCOUNT_ERROR_NO_DATA = TIZEN_ERROR_SOCIAL_CLASS | 0x02,
+
+ ACCOUNT_ERROR_RECORD_NOT_FOUND = TIZEN_ERROR_SOCIAL_CLASS | 0x03,
+ ACCOUNT_ERROR_DB_FAILED = TIZEN_ERROR_SOCIAL_CLASS | 0x04,
+ 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_XML_PARSE_FAILED = TIZEN_ERROR_SOCIAL_CLASS | 0x09,
+ ACCOUNT_ERROR_XML_FILE_NOT_FOUND = TIZEN_ERROR_SOCIAL_CLASS | 0x10,
+
+} account_error_e;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ACCOUNT_ERROR_H__*/
--- /dev/null
+/*
+ * account
+ *
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+#ifndef __ACCOUNT_PRIVATE_TYPES_H__
+#define __ACCOUNT_PRIVATE_TYPES_H__
+
+
+/*#include <glib.h>*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <glib.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "ACCOUNT"
+
+#define ACCOUNT_VERBOSE(fmt, arg...) \
+ LOGV(": " fmt "\n", ##arg);
+#define ACCOUNT_DEBUG(fmt, arg...) \
+ LOGD(": " fmt "\n", ##arg);
+#define ACCOUNT_INFO(fmt, arg...) \
+ LOGI(": " fmt "\n", ##arg);
+#define ACCOUNT_WARNING(fmt, arg...) \
+ LOGW(": " fmt "\n", ##arg);
+#define ACCOUNT_ERROR(fmt, arg...) \
+ LOGW(": " fmt "\n", ##arg);
+#define ACCOUNT_FATAL(fmt, arg...) \
+ LOGF(": " fmt "\n", ##arg);
+
+#define ACCOUNT_RETURN_VAL(eval, expr, ret_val, X)\
+ if (!(eval)) \
+{\
+ expr; \
+ if (1)\
+ {ACCOUNT_ERROR X;}\
+ return ret_val;\
+} else {;}
+
+#define ACCOUNT_SNPRINTF(dest,size,format,arg...) \
+ do { \
+ snprintf(dest,size-1,format,##arg); \
+ }while(0)
+ /* If the same pointer is passed to free twice, known as a double free. To avoid this, set pointers to
+NULL after passing them to free: free(NULL) is safe (it does nothing).
+ */
+
+#define ACCOUNT_MEMSET(dest,value,size) \
+ do { \
+ memset(dest,value,size); \
+ }while(0)
+
+#define ACCOUNT_CATCH_ERROR(eval, expr, error_val, X) \
+ if (!(eval)) \
+{\
+ expr; \
+ error_code = (error_val);\
+ if (1)\
+ {ACCOUNT_ERROR X;}\
+ goto CATCH;\
+} else {;}
+
+#define _ACCOUNT_FREE(ptr) \
+ if (ptr != NULL) { \
+ free(ptr); \
+ ptr = NULL; \
+ } \
+
+
+#define _ACCOUNT_GFREE(ptr) \
+ if (ptr != NULL) { \
+ g_free(ptr); \
+ ptr = NULL; \
+ } \
+
+#define ACCOUNT_DB_NAME "/opt/dbspace/.account.db"
+#define ACCOUNT_TABLE "account"
+#define CAPABILITY_TABLE "capability"
+#define ACCOUNT_CUSTOM_TABLE "account_custom"
+#define ACCOUNT_TYPE_TABLE "account_type"
+#define LABEL_TABLE "label"
+#define ACCOUNT_SQLITE_SEQ "sqlite_sequence"
+#define ACCOUNT_SQL_LEN_MAX 1024
+#define ACCOUNT_TABLE_TOTAL_COUNT 2
+
+#define FACEBOOK_PKG_NAME "com.samsung.facebook"
+#define EMAIL_PKG_NAME "email-setting-efl"
+#define EXCHANGE_PKG_NAME "activesync-ui"
+#define IMS_SERVICE_PKG_NAME "ims-service"
+#define SAMSUNGACCOUNT_PKG_NAME "com.samsung.samsung-account"
+#define DROPBOX_PKG_NAME "com.samsung.dropbox"
+
+typedef struct _account_s
+{
+ int id;
+ char* user_name;
+ char* email_address;
+ char* display_name;
+ char* icon_path;
+ char* source;
+ char* package_name;
+ char* access_token;
+ char* domain_name; /*< domain name [Ex: google, facebook, twitter, samsung, ...] */
+ int auth_type;
+ int secret;
+ int sync_support;
+ int user_data_int[USER_INT_CNT];
+ char* user_data_txt[USER_TXT_CNT];
+ GSList* capablity_list;
+ GList* account_list;
+ GSList* custom_list;
+}account_s;
+
+typedef struct _capability_s
+{
+ int id;
+ char* type;
+ int value;
+ char* package_name;
+ char* user_name;
+ int account_id;
+}account_capability_s;
+
+
+typedef struct _account_custom_s
+{
+ int account_id;
+ char* app_id;
+ char* key;
+ char* value;
+}account_custom_s;
+
+typedef struct _account_type_s
+{
+ int id;
+ char* app_id;
+ char* service_provider_id;
+ char* icon_path;
+ char* small_icon_path;
+ bool multiple_account_support;
+ GSList* label_list;
+ GList* account_type_list;
+}account_type_s;
+
+
+typedef struct _label_s
+{
+ char* app_id;
+ char* label;
+ char* locale;
+}label_s;
+
+
+/**
+ * @brief Enumarations for account handle fields.
+ */
+
+typedef enum {
+ ACCOUNT_FIELD_NONE = -1,
+ ACCOUNT_FIELD_ID,
+ ACCOUNT_FIELD_USER_NAME,
+ ACCOUNT_FIELD_EMAIL_ADDRESS,
+ ACCOUNT_FIELD_DISPLAY_NAME,
+ ACCOUNT_FIELD_ICON_PATH,
+ ACCOUNT_FIELD_SOURCE,
+ ACCOUNT_FIELD_PACKAGE_NAME,
+ ACCOUNT_FIELD_ACCESS_TOKEN,
+ 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,
+ ACCOUNT_FIELD_USER_TEXT_3,
+ ACCOUNT_FIELD_USER_TEXT_4,
+ ACCOUNT_FIELD_USER_INT_0,
+ ACCOUNT_FIELD_USER_INT_1,
+ ACCOUNT_FIELD_USER_INT_2,
+ ACCOUNT_FIELD_USER_INT_3,
+ ACCOUNT_FIELD_USER_INT_4,
+ ACCOUNT_DB_FIELD_END,
+} ACCOUNT_DB_IDX;
+
+/**
+ * @brief Enumarations for capability fields.
+ */
+
+typedef enum {
+ CAPABILITY_FIELD_NONE = -1,
+ CAPABILITY_FIELD_ID,
+ CAPABILITY_FIELD_KEY,
+ CAPABILITY_FIELD_VALUE,
+ CAPABILITY_FIELD_PACKAGE_NAME,
+ CAPABILITY_FIELD_USER_NAME,
+ CAPABILITY_FIELD_ACCOUNT_ID,
+ CAPABILITY_FIELD_END,
+}CAPABILITY_DB_IDX;
+
+
+typedef enum {
+ ACCOUNT_CUSTOM_FIELD_NONE = -1,
+ ACCOUNT_CUSTOM_FIELD_ACCOUNT_ID,
+ ACCOUNT_CUSTOM_FIELD_APP_ID,
+ ACCOUNT_CUSTOM_FIELD_KEY,
+ ACCOUNT_CUSTOM_FIELD_VALUE,
+ ACCOUNT_CUSTOM_FIELD_END,
+}ACCOUNT_CUSTOM_DB_IDX;
+
+typedef enum {
+ ACCOUNT_TYPE_FIELD_NONE = -1,
+ ACCOUNT_TYPE_FIELD_ID,
+ ACCOUNT_TYPE_FIELD_APP_ID,
+ ACCOUNT_TYPE_FIELD_SERVICE_PROVIDER_ID,
+ ACCOUNT_TYPE_FIELD_ICON_PATH,
+ ACCOUNT_TYPE_FIELD_SMALL_ICON_PATH,
+ ACCOUNT_TYPE_FIELD_MULTIPLE_ACCOUNT_SUPPORT,
+ ACCOUNT_TYPE_FIELD_END,
+}ACCOUNT_TYPE_DB_IDX;
+
+typedef enum {
+ LABEL_FIELD_NONE = -1,
+ LABEL_FIELD_APP_ID,
+ LABEL_FIELD_LABEL,
+ LABEL_FIELD_LOCALE,
+ LABEL_FIELD_END,
+}LABEL_DB_IDX;
+
+
+typedef sqlite3_stmt* account_stmt;
+
+#define ACCOUNT_SCHEMA "create table %s \n"\
+ "(\n"\
+"_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 "\
+");"
+
+#define CAPABILITY_SCHEMA "create table %s \n"\
+ "(\n"\
+"_id INTEGER PRIMARY KEY AUTOINCREMENT, "\
+"key TEXT, "\
+"value INTEGER, "\
+"package_name TEXT, "\
+"user_name TEXT, "\
+"account_id INTEGER "\
+");"
+
+#define ACCOUNT_CUSTOM_SCHEMA "create table %s \n"\
+ "(\n"\
+"AccountId INTEGER, "\
+"AppId TEXT, "\
+"Key TEXT, "\
+"Value TEXT "\
+");"
+
+#define ACCOUNT_TYPE_SCHEMA "create table %s \n"\
+ "(\n"\
+"_id INTEGER PRIMARY KEY AUTOINCREMENT, "\
+"AppId TEXT, "\
+"ServiceProviderId TEXT, "\
+"IconPath TEXT, "\
+"SmallIconPath TEXT, "\
+"MultipleAccountSupport INTEGER "\
+");"
+
+#define LABEL_SCHEMA "create table %s \n"\
+ "(\n"\
+"AppId TEXT PRIMARY KEY, "\
+"Label TEXT, "\
+"Locale TEXT"\
+");"
+
+
+
+typedef struct GSList account_iterator_s;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SLP_ACCOUNT_PRIVATE_TYPES_H__*/
--- /dev/null
+/*
+ * account
+ *
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+#ifndef __ACCOUNT_TYPES_H__
+#define __ACCOUNT_TYPES_H__
+
+#include <db-util.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/**
+ * @addtogroup CAPI_ACCOUNT_MANAGER_MODULE
+ * @{
+ */
+
+/**
+ * @file account-types.h
+ * @ingroup CAPI_ACCOUNT
+ * @brief This file defines common types and enums of ACCOUNT.
+ */
+
+/**
+ * @brief Enumerations for the result types of capability.
+ */
+typedef enum
+{
+ ACCOUNT_CAPABILITY_NONE = 0,
+ ACCOUNT_CAPABILITY_CONTACT,
+ ACCOUNT_CAPABILITY_CALENDAR,
+ ACCOUNT_CAPABILITY_PHOTO,
+ ACCOUNT_CAPABILITY_VIDEO,
+ ACCOUNT_CAPABILITY_EMAIL,
+ ACCOUNT_CAPABILITY_STATUS_POST,
+ ACCOUNT_CAPABILITY_VOIP,
+ ACCOUNT_CAPABILITY_SAMSUNG_APPS,
+ ACCOUNT_CAPABILITY_TASK,
+ ACCOUNT_CAPABILITY_S_NOTE,
+ ACCOUNT_CAPABILITY_GALLERY,
+ ACCOUNT_CAPABILITY_MUSIC,
+ ACCOUNT_CAPABILITY_MEMO,
+ ACCOUNT_CAPABILITY_MESSAGE,
+ ACCOUNT_CAPABILITY_CHAT,
+ ACCOUNT_CAPABILITY_BOOKMARK,
+ ACCOUNT_CAPABILITY_MOBILE_TRACKER,
+ ACCOUNT_CAPABILITY_TIZEN_EMAIL,
+ ACCOUNT_CAPABILITY_TIZEN_MAX
+} account_capability_type_e;
+
+/**
+ * @brief Enumerations for the state of capability.
+ */
+typedef enum
+{
+ ACCOUNT_CAPABILITY_STATE_INVALID = 0,
+ ACCOUNT_CAPABILITY_DISABLED,
+ ACCOUNT_CAPABILITY_ENABLED,
+ ACCOUNT_CAPABILITY_STATE_MAX
+}
+account_capability_state_e;
+
+/**
+ * @brief Enumerations for the state of account secrecy.
+ */
+typedef enum
+{
+ ACCOUNT_SECRECY_INVALID = 0,
+ ACCOUNT_SECRECY_INVISIBLE,
+ ACCOUNT_SECRECY_VISIBLE,
+ ACCOUNT_SECRECY_MAX
+}
+account_secrecy_state_e;
+
+/**
+ * @brief Enumerations for the account supported sync or not.
+ * ACCOUNT_SYNC_NOT_SUPPORT: sync not supported
+ * ACCOUNT_SYNC_STATUS_OFF: supproted sync but all synchronization functionalities are off
+ * ACCOUNT_SYNC_STATUS_IDLE: sync support and sync status is idle
+ * ACCOUNT_SYNC_STATUS_RUNNING: sync support and sync status is running
+ * ACCOUNT_SUPPORTS_SYNC: NOT USED, WILL BE REMOVED. TO PREVENT BUILD ERROR.
+ * ACCOUNT_NOT_SUPPORTS_SYNC: NOT USED, WILL BE REMOVED. TO PREVENT BUILD ERROR.
+ */
+typedef enum
+{
+ ACCOUNT_SYNC_INVALID = 0,
+ ACCOUNT_SYNC_NOT_SUPPORT,
+ ACCOUNT_SYNC_STATUS_OFF,
+ ACCOUNT_SYNC_STATUS_IDLE,
+ ACCOUNT_SYNC_STATUS_RUNNING,
+ ACCOUNT_SUPPORTS_SYNC,
+ ACCOUNT_NOT_SUPPORTS_SYNC,
+ ACCOUNT_SYNC_MAX
+}
+account_sync_state_e;
+
+typedef enum
+{
+ ACCOUNT_AUTH_TYPE_INVALID = 0,
+ ACCOUNT_AUTH_TYPE_XAUTH,
+ ACCOUNT_AUTH_TYPE_OAUTH,
+ ACCOUNT_AUTH_TYPE_CLIENT_LOGIN,
+ ACCOUNT_AUTH_TYPE_MAX
+}account_auth_type_e;
+
+/**
+ * @brief Account handle.
+ */
+typedef struct account_s* account_h;
+
+/**
+ * @brief Account capability handle.
+ */
+typedef struct account_capability_s* account_capability_h;
+
+/**
+ * @brief Account type handle.
+ */
+typedef struct account_type_s* account_type_h;
+
+/**
+ * @brief Account handle.
+ */
+typedef struct label_s* label_h;
+
+#define ACCOUNT_DATA_USERNAME "http://tizen.org/account/data/username"
+#define ACCOUNT_DATA_ID "http://tizen.org/account/data/account_id"
+#define ACCOUNT_DATA_SERVICE_PROVIDER "http://tizen.org/account/data/service_provider"
+#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_CALENDAR "http://tizen.org/account/capability/calendar"
+#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 ACCOUNT_SUPPORTS_CAPABILITY_S_NOTE "http://tizen.org/account/capability/snote"
+#define ACCOUNT_SUPPORTS_CAPABILITY_GALLERY "http://tizen.org/account/capability/gallery"
+#define ACCOUNT_SUPPORTS_CAPABILITY_MUSIC "http://tizen.org/account/capability/music"
+#define ACCOUNT_SUPPORTS_CAPABILITY_MEMO "http://tizen.org/account/capability/memo"
+#define ACCOUNT_SUPPORTS_CAPABILITY_MESSAGE "http://tizen.org/account/capability/message"
+#define ACCOUNT_SUPPORTS_CAPABILITY_CHAT "http://tizen.org/account/capability/chat"
+#define ACCOUNT_SUPPORTS_CAPABILITY_BOOKMARK "http://tizen.org/account/capability/bookmark"
+#define ACCOUNT_SUPPORTS_CAPABILITY_TIZEN_EMAIL "http://tizen.org/account/capability/tizen_email"
+
+#define USER_TXT_CNT 5
+#define USER_INT_CNT 5
+
+#define ACCOUNT_NOTI_NAME_INSERT "insert"
+#define ACCOUNT_NOTI_NAME_UPDATE "update"
+#define ACCOUNT_NOTI_NAME_DELETE "delete"
+#define ACCOUNT_NOTI_NAME_SYNC_UPDATE "sync_update"
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ACCOUNT_TYPES_H__*/
+
--- /dev/null
+/*
+ * account
+ *
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+#ifndef __ACCOUNT_H__
+#define __ACCOUNT_H__
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <glib.h>
+#include <account-types.h>
+#include <account-error.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @file account.h
+ * @brief This file contains the Account API for account management
+ */
+
+/**
+ * @addtogroup CAPI_ACCOUNT_MANAGER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Called once for each account from database
+ *
+ * @param[in] account The account handle
+ * @param[in] user_data The user data passed from the foreach function
+ *
+ * @return @c true to continue with the next iteration of the loop or @c false to break out of the loop.
+ *
+ * @pre account_foreach_account_from_db(), account_query_account_by_account_id(), account_query_account_by_user_name() or account_query_account_by_package_name() invoke this callback.
+ *
+ * @see account_foreach_account_from_db()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_package_name()
+ */
+typedef bool (*account_cb)(account_h account, void *user_data);
+
+
+/**
+ * @brief Called once for each capability of account from database
+ *
+ * @param[in] capability_type The capability type
+ * @param[in] capability_state The capability state
+ * @param[in] user_data The user data passed from the foreach function
+ *
+ * @return @c true to continue with the next iteration of the loop or @c false to break out of the loop.
+ *
+ * @pre account_query_capability_by_account_id() invokes this callback.
+ *
+ * @see account_query_capability_by_account_id()
+ */
+typedef bool (*capability_cb)(const char* capability_type, account_capability_state_e capability_state, void *user_data);
+
+/**
+ * @brief Called once for each custom data of account from database
+ *
+ * @param[in] key The user custom key
+ * @param[in] value The user custom value of the specific key
+ * @param[in] user_data The user data passed
+ *
+ * @return @c true to continue with the next iteration of the loop or @c false to break out of the loop.
+ *
+ * @see account_query_capability_by_account_id()
+ */
+typedef bool (*account_custom_cb)(char* key, char* value, void *user_data);
+
+
+typedef bool (*account_type_cb)(account_type_h account_type, void *user_data);
+typedef bool (*account_label_cb)(char* app_id, char* label, char* locale, void *user_data);
+
+
+/**
+ * @brief Connects to the account database.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_disconnect()
+ */
+int account_connect(void);
+
+
+/**
+ * @brief Disconnects from account database.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_connect()
+ */
+int account_disconnect(void);
+
+
+/**
+ * @brief Creates a handle to the account.
+ *
+ * @remarks @a account must be released with account_destroy() by you. \n
+ * The created handle is not added to the account database until account_insert_to_db() is called.
+ *
+ * @param[in] account The account handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_destroy()
+ */
+int account_create(account_h *account);
+
+
+/**
+ * @brief Destroys the account handle and releases all its resources.
+ *
+ * @param[in] account The account handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_create()
+ */
+int account_destroy(account_h account);
+
+
+/**
+ * @brief Inserts the account details to the account database.
+ *
+ * @param[in] account The account handle
+ * @param[out] account_db_id The account ID to be assigned to a account
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect().
+ *
+ * @see account_connect()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_id()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_insert_to_db(account_h account, int *account_db_id);
+
+
+/**
+ * @brief Deletes the account from the account database by accound DB ID.
+ *
+ * @param[in] account_db_id The account ID to delete
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect()
+ *
+ * @see account_connect()
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_id()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_delete_from_db_by_id(int account_db_id);
+
+
+/**
+ * @brief Deletes the account from the account database by user name.
+ *
+ * @param[in] user_name The user name of account to delete
+ * @param[in] package_name The package name of account to delete
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect()
+ *
+ * @see account_connect()
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_id()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_delete_from_db_by_user_name(char *user_name, char *package_name);
+
+
+/**
+ * @brief Deletes the account from the account database by package name.
+ *
+ * @param[in] package_name The package name of account(s) to delete
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect()
+ *
+ * @see account_connect()
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_update_to_db_by_id()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_delete_from_db_by_package_name(char *package_name);
+
+
+/**
+ * @brief Updates the account details to the account database.
+ *
+ * @param[in] account The account handle
+ * @param[in] account_id The account ID to update
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update not exist
+ *
+ * @pre This function requires an open connection to account service by account_connect()
+ *
+ * @see account_connect()
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_user_name()
+ */
+int account_update_to_db_by_id(account_h account, int account_id);
+
+
+/**
+ * @brief Updates the account details to the account database.
+ *
+ * @param[in] account The account handle
+ * @param[in] user_name The user name of account to update
+ * @param[in] package_name The package name for the user name
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update not exist
+ *
+ * @pre This function requires an open connection to account service by account_connect()
+ *
+ * @see account_connect()
+ * @see account_insert_to_db()
+ * @see account_delete_from_db_by_id()
+ * @see account_delete_from_db_by_user_name()
+ * @see account_delete_from_db_by_package_name()
+ * @see account_update_to_db_by_id()
+ *
+ */
+int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name);
+
+/**
+ * @brief Gets the account id of account.
+ *
+ *
+ * @param[in] account The account handle
+ * @param[out] account_id The account id of account
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ */
+int account_get_account_id(account_h account, int *account_id);
+
+
+/**
+ * @brief Gets the user name of account.
+ *
+ * @remarks @a user_name must be released with free() by you.
+ *
+ * @param[in] account The account handle
+ * @param[out] user_name The user name of account
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_user_name()
+ */
+int account_get_user_name(account_h account, char **user_name);
+
+
+/**
+ * @brief Sets the user name of account.
+ *
+ * @param[in] account The account handle
+ * @param[in] user_name The string to set as user name
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_user_name()
+ */
+int account_set_user_name(account_h account, const char *user_name);
+
+
+/**
+ * @brief Gets the display name of account.
+ *
+ * @remarks @a display_name must be released with free() by you.
+ *
+ * @param[in] account The account handle
+ * @param[out] display_name The display name of account
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_get_display_name()
+ */
+int account_get_display_name(account_h account, char **display_name);
+
+
+/**
+ * @brief Sets the display name of account.
+ *
+ * @param[in] account The account handle
+ * @param[in] display_name The text string to set as the display name
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_display_name()
+ */
+int account_set_display_name(account_h account, const char *display_name);
+
+/**
+ * @brief Gets the capability detail of account.
+ *
+ * @param[in] account The account handle
+ * @param[in] capability_type Capability type to get the capability value
+ * @param[out] capability_value Corresponding capability value(on/off) of the specified capability_type
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND There is no given capability_type in the account
+ *
+ * @see account_set_capability()
+ */
+int account_get_capability(account_h account, const char* capability_type, account_capability_state_e* capability_value);
+
+/**
+ * @brief Gets all the capabilities of account.
+ *
+ * @param[in] account The account handle
+ * @param[in] callback The callback function
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_capability()
+ */
+int account_get_capability_all(account_h account, capability_cb cb_func, void *user_data);
+
+/**
+ * @brief Sets the capability.
+ *
+ * @param[in] account The account handle
+ * @param[in] capability_type The capability type
+ * @param[in] capability_state The capability state
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_capability()
+ */
+int account_set_capability(account_h account, const char* capability_type, account_capability_state_e capability_state);
+
+
+/**
+ * @brief Gets the icon path.
+ *
+ * @remarks @a icon_path must be released with free() by you.
+ *
+ * @param[in] account The account handle
+ * @param[out] icon_path The icon path
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_icon_path()
+ */
+int account_get_icon_path(account_h account, char **icon_path);
+
+
+/**
+ * @brief Sets the icon path.
+ *
+ * @param[in] account The account handle
+ * @param[in] icon_path The text string to set as a icon path
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_icon_path()
+ */
+int account_set_icon_path(account_h account, const char *icon_path);
+
+
+/**
+ * @brief Gets the domain name.
+ *
+ * @remarks @a domain_name must be released with free() by you.
+ *
+ * @param[in] account The account handle
+ * @param[out] domain_name The domain name
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_domain_name()
+ */
+int account_get_domain_name(account_h account, char **domain_name);
+
+
+/**
+ * @brief Sets the domain name.
+ *
+ * @param[in] account The account handle
+ * @param[in] domain_name The text string to set as a domain name
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_domain_name()
+ */
+int account_set_domain_name(account_h account, const char *domain_name);
+
+
+/**
+ * @brief Gets the email address.
+ *
+ * @remarks @a email_address must be released with free() by you.
+ *
+ * @param[in] account The account handle
+ * @param[out] email_address The email address
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_email_address()
+ */
+int account_get_email_address(account_h account, char **email_address);
+
+
+/**
+ * @brief Sets the email address.
+ *
+ * @param[in] account The account handle
+ * @param[in] email_address The text string to set as a email address
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_email_addres()
+ */
+int account_set_email_address(account_h account, const char *email_address);
+
+
+/**
+ * @brief Gets the package name.
+ *
+ * @remarks @a package_name must be released with free() by you.
+ *
+ * @param[in] account The account handle
+ * @param[out] package_name The package name
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_package_name()
+ */
+int account_get_package_name(account_h account, char **package_name);
+
+
+/**
+ * @brief Sets the package name.
+ *
+ * @param[in] account The account handle
+ * @param[in] package_name The text string to set as a package name
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_email_addres()
+ */
+int account_set_package_name(account_h account, const char *package_name);
+
+
+/**
+ * @brief Gets the access token.
+ *
+ * @remarks @a access_token must be released with free() by you.
+ *
+ * @param[in] account The account handle
+ * @param[out] access_token The access token
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_access_token()
+ */
+int account_get_access_token(account_h account, char **access_token);
+
+
+/**
+ * @brief Set the access token.
+ *
+ * @param[in] account The account handle
+ * @param[in] access_token The text string to set as a access token
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_access_token()
+ */
+int account_set_access_token(account_h account, const char *access_token);
+
+
+/**
+ * @brief Gets the user text.
+ *
+ * @remarks @a user_text must be released with free() by you.
+ *
+ * @param[in] account The account handle
+ * @param[in] user_text_index The index of the user text (range: 0 ~ 4)
+ * @param[out] user_text The user text
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_user_text()
+ */
+int account_get_user_text(account_h account, int user_text_index, char **user_text);
+
+
+/**
+ * @brief Sets the user text.
+ *
+ * @param[in] account The account handle
+ * @param[in] user_text_index The index of the user text (must be in range from 0 to 4)
+ * @param[in] user_text The text string to set as a user txt
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_user_text()
+ */
+int account_set_user_text(account_h account, int user_text_index, const char *user_text);
+
+
+/**
+ * @brief Gets the user integer.
+ *
+ * @param[in] account The account handle
+ * @param[in] user_int_index The index of the user integer (must be in range from 0 to 4)
+ * @param[out] user_integer The user interger
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_user_int()
+ */
+int account_get_user_int(account_h account, int user_int_index, int *user_integer);
+
+
+/**
+ * @brief Set the user integer.
+ *
+ * @param[in] account The account handle
+ * @param[in] user_int_index The index of the user integer (must be in range from 0 to 4)
+ * @param[in] user_integer The integer to set as user integer
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_user_int()
+ */
+int account_set_user_int(account_h account, int user_int_index, int user_integer);
+
+
+/**
+ * @brief Gets the auth type.
+ *
+ * @param[in] account The account handle
+ * @param[out] auth_type The auth type
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_auth_type()
+ */
+int account_get_auth_type(account_h account, account_auth_type_e *auth_type);
+
+
+/**
+ * @brief Sets the auth type.
+ *
+ * @param[in] account The account handle
+ * @param[in] auth_type Integer to be set as auth type
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_auth_type()
+ */
+int account_set_auth_type(account_h account, const account_auth_type_e auth_type);
+
+
+/**
+ * @brief Gets the secret.
+ *
+ * @param[in] account The account handle
+ * @param[out] secret The secret
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_secret()
+ */
+int account_get_secret(account_h account, account_secrecy_state_e *secret);
+
+
+/**
+ * @brief Sets the secret.
+ *
+ * @param[in] account The account handle
+ * @param[in] secret Secrecy 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_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.
+ *
+ * @remarks @a user_text must be released with free() by you.
+ *
+ * @param[in] account The account handle
+ * @param[out] source The source
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_set_source()
+ */
+int account_get_source(account_h account, char **source);
+
+
+/**
+ * @brief Sets the source.
+ *
+ * @param[in] account The account handle
+ * @param[in] source The text string to set as a source
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_source()
+ */
+int account_set_source(account_h account, const char *source);
+
+/**
+ * @brief Sets the capability.
+ *
+ * @param[in] account The account handle
+ * @param[in] key The user custom key for specific value
+ * @param[in] value The user custom value about the given key
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_get_custom()
+ */
+int account_set_custom(account_h account, const char* key, const char* value);
+
+/**
+ * @brief Gets the user specific custom text of account key.
+ *
+ * @param[in] account The account handle
+ * @param[in] callback The callback function to retreive custom text. The callback function gives key and value
+ * @param[out] value text of the given key
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND There is no given capability_type in the account
+ *
+ * @see account_set_custom()
+ */
+int account_get_custom(account_h account, const char* key, char** value);
+
+
+/**
+ * @brief Gets all the user custom texts of account.
+ *
+ * @param[in] account The account handle
+ * @param[in] callback The callback function to retreive all custom text. The callback function gives key and value
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_set_custom()
+ */
+int account_get_custom_all(account_h account, account_custom_cb cb_func, void* user_data);
+
+/**
+ * @brief Retrieves all accounts details by invoking the given callback function iteratively.
+ *
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect().
+ * @post This function invokes account_cb().
+ *
+ * @see account_connect()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_package_name()
+ * @see account_query_account_by_capability()
+ */
+int account_foreach_account_from_db(account_cb callback, void *user_data);
+
+
+/**
+ * @brief Retrieves all accounts with the account database ID.
+ *
+ * @param[in] account_db_id The account database ID to search
+ * @param[out] account account handle. Must be allocated by account_create and free after using by account_destroy.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect().
+ *
+ * @see account_connect()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_package_name()
+ * @see account_query_account_by_capability()
+ */
+int account_query_account_by_account_id(int account_db_id, account_h *account);
+
+/**
+ * @brief Retrieves all accounts with the user name.
+ *
+ * @param[in] callback The callback function to invoke
+ * @param[in] user_name The user name to search
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect().
+ * @post This function invokes account_cb().
+ *
+ * @see account_connect()
+ * @see account_foreach_account_from_db()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_package_name()
+ * @see account_query_account_by_capability()
+ *
+ */
+int account_query_account_by_user_name(account_cb callback, const char* user_name, void* user_data);
+
+/**
+ * @brief Retrieves all accounts with the package name.
+ *
+ * @param[in] callback The callback function to invoke
+ * @param[in] package_name The package name to search
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect().
+ * @post This function invokes account_cb().
+ *
+ * @see account_connect()
+ * @see account_foreach_account_from_db()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_capability()
+ */
+int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data);
+
+/**
+ * @brief Retrieves all accounts with the capability.
+ *
+ * @param[in] callback The callback function to invoke
+ * @param[in] capability_type The capablity type to search
+ * @param[in] capability_value The capablity value to search
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect().
+ * @post This function invokes account_cb().
+ *
+ * @see account_connect()
+ * @see account_foreach_account_from_db()
+ * @see account_query_account_by_account_id()
+ * @see account_query_account_by_user_name()
+ * @see account_query_account_by_package_name()
+ */
+int account_query_account_by_capability(account_cb callback, const char* capability_type, account_capability_state_e capability_value, void *user_data);
+
+/**
+ * @brief Retrieves all capabilities with the account database ID.
+ *
+ * @param[in] callback The callback function to invoke
+ * @param[in] account_db_id The account database ID to search
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect().
+ * @post This function invokes capability_cb().
+ *
+ * @see account_connect()
+ * @see account_get_capability()
+ * @see account_set_capability()
+ */
+int account_query_capability_by_account_id(capability_cb callback, int account_db_id, void *user_data);
+
+
+/**
+ * @brief Retrieves number of account in the account database.
+ *
+ * @param[out] out parameter for number of all accounts
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect().
+ *
+ * @see account_connect()
+ */
+int account_get_total_count_from_db(int *count);
+
+/**
+ * @brief changes sync status of account by account id
+ *
+ * @param[in] account_db_id The account id which sync status needs to be change
+ * @param[in] sync_status New sync status
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect().
+ *
+ * @see account_connect()
+ */
+int account_update_sync_status_by_id(int account_db_id, const account_sync_state_e sync_status);
+
+/**
+ * @brief Called once for each service provider of account
+ *
+ * @param[in] package_name package name of the service
+ * @param[in] icon_path icon path of the service
+ * @param[in] multiple if true supports multiple account else only one account support
+ * @param[in] user_data The user data passed from the account_query_service_list_by_capability function
+ *
+ * @return @c true to continue with the next iteration of the loop or @c false to break out of the loop.
+ *
+ * @pre account_query_service_list_by_capability() invokes this callback.
+ *
+ * @see account_query_service_list_by_capability()
+ */
+typedef bool (*service_list_cb)(char *package_name, char *icon_path, bool multiple, void *user_data);
+
+/**
+ * @brief Retrieves all services which supports specified capability.
+ *
+ * @param[in] callback The callback function to invoke
+ * @param[in] capability_type The capablity type to search
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_XML_PARSE_FAILED XML Parsing failed
+ * @retval #ACCOUNT_ERROR_XML_FILE_NOT_FOUND XML file not found
+ *
+ * @post This function invokes service_list_cb().
+ *
+ */
+int account_query_service_list_by_capability(service_list_cb callback, const char* capability_type, void *user_data);
+
+
+/**
+ * @brief Get whether application supports desired capability or not.
+ *
+ * @param[in] package_name The application's package name
+ * @param[in] capability_filter which capability to check for
+ * @param[out] supported whether desired capability is supported, Returns true otherwise false
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_XML_PARSE_FAILED XML Parsing failed
+ * @retval #ACCOUNT_ERROR_XML_FILE_NOT_FOUND XML file not found
+ *
+ */
+int account_get_application_capability_support(char *package_name, char *capability_filter, bool *supported);
+
+
+/**
+ * @brief Get whether application supports multiple accounts or not.
+ *
+ * @param[in] package_name The application's package name
+ * @param[out] supported if multiple account is supported returns true otherwise false
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_XML_PARSE_FAILED XML Parsing failed
+ * @retval #ACCOUNT_ERROR_XML_FILE_NOT_FOUND XML file not found
+ *
+ */
+int account_get_application_multiple_account_support(char * package_name, bool * supported);
+
+/**
+ * @brief Get application's icon path.
+ *
+ * @remarks @a icon_path must be released with free() by you.
+ *
+ * @param[in] package_name The application's package name
+ * @param[out] icon_path if path is availabe it will have icon_path, otherwise NULL
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_XML_PARSE_FAILED XML Parsing failed
+ * @retval #ACCOUNT_ERROR_XML_FILE_NOT_FOUND XML file not found
+ *
+ */
+int account_get_application_icon_path(char *package_name, char **icon_path);
+
+
+/* Account type API */
+
+
+/**
+ * @brief Creates a handle to the account.
+ *
+ * @remarks @a account type handle must be released with account_type_destroy() by you. \n
+ * The created handle is not added to the account database until account_type_insert_to_db() is called.
+ *
+ * @param[in] account_type The account type handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_type_destroy()
+ */
+int account_type_create(account_type_h *account_type);
+
+/**
+ * @brief Destroys the account type handle and releases all its resources.
+ * When you get account_type_h through account_type_create, the handle should be released by account_destroy to avoid memory leak
+ *
+ * @param[in] account_type The account type handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_type_create()
+ */
+int account_type_destroy(account_type_h account_type);
+
+/**
+ * @brief Sets the app id. It should be filled with your application id. e.g) com.tizen.testapp
+ *
+ * @remarks @ app id is mandatory field and is not allowed duplicated app id in account type database
+ *
+ * @param[in] account_type The account type handle. It should be assigned by account_type_create()
+ * @param[in] app_id Application id of yours.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_get_app_id()
+ */
+int account_type_set_app_id(account_type_h account_type, const char *app_id);
+
+/**
+ * @brief Sets the service provider id. It should be filled with your service provider id.
+ *
+ * @remarks @ service provider id is mandatory field.
+ *
+ * @param[in] account_type The account type handle. It should be assigned by account_type_create()
+ * @param[in] service_provider_id Service provider id of yours.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_get_service_provider_id()
+ */
+int account_type_set_service_provider_id(account_type_h account_type, const char *service_provider_id);
+
+/**
+ * @brief Sets icon path. It represents your service provider or application.
+ *
+ * @remarks @ icon_path is not mandatory field. But when it is set, you can display this icon in add account screen.
+ *
+ * @param[in] account_type The account type handle. It should be assigned by account_type_create()
+ * @param[in] icon_path of your application.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_get_icon_path()
+ */
+int account_type_set_icon_path(account_type_h account_type, const char *icon_path);
+
+/**
+ * @brief Sets small icon path. It also represents your service provider or application.
+ *
+ * @remarks @ small icon_path is not mandatory field.
+ *
+ * @param[in] account_type The account type handle. It should be assigned by account_type_create()
+ * @param[in] small_icon_path the scaled icon of your application.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_get_small_icon_path()
+ */
+int account_type_set_small_icon_path(account_type_h account_type, const char *small_icon_path);
+
+/**
+ * @brief Sets multiple account. It represents whether your application support multiple accounts or not.
+ *
+ * @remarks @ The default value of multiple account support is FALSE.
+ *
+ * @param[in] account_type The account type handle. It should be assigned by account_type_create()
+ * @param[in] multiple_account_support TRUE means that your application can make two or more accounts. FALSE means that your application can make only one account.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_get_multiple_account_support()
+ */
+int account_type_set_multiple_account_support(account_type_h account_type, const bool multiple_account_support);
+
+/**
+ * @brief Sets label and locale. Label represents the name of account type.
+ *
+ * @param[in] account_type The account type handle. It should be assigned by account_type_create()
+ * @param[in] label The name of account depend on the specified locale
+ * @param[in] locale Locale of the corresponding label
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_get_label()
+ */
+int account_type_set_label(account_type_h account_type, const char* label, const char* locale);
+
+/**
+ * @brief Gets the application id of account type.
+ *
+ * @remarks @a app_id must be released with free() by you.
+ *
+ * @param[in] account_type The account type handle. It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db
+ * @param[out] app_id application id of account type item
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ * @see account_type_set_app_id()
+ */
+int account_type_get_app_id(account_type_h account_type, char **app_id);
+
+/**
+ * @brief Gets the service provider id of account type.
+ *
+ * @remarks @a service_provider_id must be released with free() by you.
+ *
+ * @param[in] account_type The account type handle. It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db
+ * @param[out] service_provider_id service provider text id of account type item
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ * @see account_type_set_service_provider_id()
+ */
+int account_type_get_service_provider_id(account_type_h account_type, char **service_provider_id);
+
+/**
+ * @brief Gets icon path of account type.
+ *
+ * @remarks @a icon_path must be released with free() by you.
+ *
+ * @param[in] account_type The account type handle. It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db
+ * @param[out] icon_path It represents the icon of account type item
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ * @see account_type_set_icon_path()
+ */
+int account_type_get_icon_path(account_type_h account_type, char **icon_path);
+
+/**
+ * @brief Gets small icon path of account type.
+ *
+ * @remarks @a small_icon_path must be released with free() by you.
+ *
+ * @param[in] account_type The account type handle. It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db
+ * @param[out] small_icon_path It represents the small icon of account type item
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ * @see account_type_set_small_icon_path()
+ */
+int account_type_get_small_icon_path(account_type_h account_type, char **small_icon_path);
+
+/**
+ * @brief Gets small icon path of account type.
+ *
+ * @param[in] account_type The account type handle. It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db
+ * @param[out] multiple_account_support It represents whether the retreived account type supports over two accounts or not. TRUE or FALSE
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ * @see account_type_set_small_icon_path()
+ */
+int account_type_get_multiple_account_support(account_type_h account_type, int *multiple_account_support);
+
+/**
+ * @brief Gets the label information detail of account type.
+ *
+ * @param[in] account_type The account type handle. It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db
+ * @param[in] callback The callback function carrying label information
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_type_query_by_app_id()
+ * @see account_type_set_label()
+ */
+int account_type_get_label(account_type_h account_type, account_label_cb cb_func, void *user_data);
+
+/**
+ * @brief Inserts the account type details to the database.
+ *
+ * @param[in] account_type The account handle which is created by account_type_create(). And the madatory fields must be filled with account_type_set_* functions
+ * @param[out] account_type_id The account type ID to be assigned after inserting account type handle.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect().
+ * @post account_disconnect() is recommended after insertion
+ *
+ * @see account_connect()
+ * @see account_type_set_app_id()
+ * @see account_type_set_service_provider_id()
+ * @see account_type_set_icon_path()
+ * @see account_type_set_small_icon_path()
+ * @see account_type_set_multiple_account_support()
+ * @see account_type_set_label()
+ * @see account_type_delete_by_app_id()
+ * @see account_type_update_to_db_by_app_id()
+ * @see account_disconnect()
+ */
+int account_type_insert_to_db(account_type_h account_type, int* account_type_id);
+
+/**
+ * @brief Updates the account details to the account database.
+ *
+ * @param[in] account_type The account handle which is created by account_type_create(). And the madatory fields must be filled with account_type_set_* functions
+ * @param[in] app_id Application id of account type
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect()
+ * @post account_disconnect() is recommended after update
+ *
+ * @see account_connect()
+ * @see account_type_insert_to_db()
+ * @see account_type_set_app_id()
+ * @see account_type_set_service_provider_id()
+ * @see account_type_set_icon_path()
+ * @see account_type_set_small_icon_path()
+ * @see account_type_set_multiple_account_support()
+ * @see account_type_set_label()
+ * @see account_type_delete_by_app_id()
+ * @see account_disconnect()
+ */
+int account_type_update_to_db_by_app_id(const account_type_h account_type, const char* app_id);
+
+/**
+ * @brief Deletes the account type from the account database by application id.
+ *
+ * @param[in] app_id Application id of account type to be deleted
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect()
+ *
+ * @see account_connect()
+ * @see account_type_insert_to_db()
+ * @see account_type_update_to_db_by_app_id()
+ * @see account_disconnect()
+ */
+int account_type_delete_by_app_id(const char* app_id);
+
+/**
+ * @brief Retrieves label information with your applicaiton id.
+ *
+ * @param[in] cb_func Callback function will carry label_h for label information. label_h contains label info as parameter.
+ * @param[in] app_id Your application ID to search
+ * @param[in] user_data User data if you have your private data to carry into callback function, you can use.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect().
+ *
+ * @see account_connect()
+ * @see account_type_query_by_app_id()
+ * @see account_type_foreach_account_type_from_db()
+ * @see account_disconnect()
+ */
+int account_type_query_label_by_app_id(account_label_cb cb_func, const char* app_id, void *user_data );
+
+/**
+ * @brief Retrieves account type information with your applicaiton id.
+ *
+ * @param[in] app_id Your application ID to search
+ * @param[out] account_type The account handle which is created by account_type_create().
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect().
+ *
+ * @see account_connect()
+ * @see account_type_create()
+ * @see account_type_get_app_id()
+ * @see account_type_get_service_provider_id()
+ * @see account_type_get_icon_path()
+ * @see account_type_get_small_icon_path()
+ * @see account_type_get_multiple_account_support()
+ * @see account_type_get_label()
+ * @see account_type_destroy()
+ */
+int account_type_query_by_app_id(const char* app_id, account_type_h *account_type);
+
+/**
+ * @brief Retrieves all account type information with your applicaiton id.
+ *
+ * @param[in] callback Retrieving account type information. You can get account information through account_type_get_* with the carried account_type_handle
+ * @param[in] user_data User data. It will be carried through your callback function.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect().
+ *
+ * @see account_connect()
+ * @see account_type_create()
+ * @see account_type_get_app_id()
+ * @see account_type_get_service_provider_id()
+ * @see account_type_get_icon_path()
+ * @see account_type_get_small_icon_path()
+ * @see account_type_get_multiple_account_support()
+ * @see account_type_get_label()
+ * @see account_type_destroy()
+ */
+int account_type_foreach_account_type_from_db(account_type_cb callback, void *user_data);
+
+/**
+ * @brief Retrieves all account type information with your applicaiton id.
+ *
+ * @param[in] app_id Your application id
+ * @param[in] locale Locale value to search label. e.g) en_US
+ * @param[out] label label text corresponding app_id and locale. It must be free.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ACCOUNT_ERROR_NONE Successful
+ * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
+ *
+ * @pre This function requires an open connection to account service by account_connect().
+ *
+ * @see account_connect()
+ */
+int account_type_query_label_by_locale(const char* app_id, const char* locale, char** label);
+
+/* End of account type api */
+
+/**
+* @}
+*/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ACCOUNT_H__ */
--- /dev/null
+/*
+ * Account
+ *
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
+ *
+ * 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
+
+
+<h1 class="pg">Introduction</h1>
+ <h2 class="pg">Purpose of this document</h2>
+
+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.
+
+ <h2 class="pg">Scope</h2>
+
+The scope of this document is limited to Account API usage.
+
+
+<h1 class="pg">Account Architecture</h1>
+ <h2 class="pg"> Overview</h2>
+
+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
+
+<h1 class="pg">Account Features</h1>
+ - Similar to Sqlite3
+ - Handle information of Account
+
+ <h2 class="pg">Similar to Sqlite3</h2>
+Account API is similar to Sqlite3.
+
+ <h2 class="pg">Handle information of Account</h2>
+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.
+
+<h1 class="pg">Account API Description</h1>
+
+you can refer @ref ACCOUNT_SVC
+
+<h1 class="pg">Sample Code</h1>
+
+ <h2 class="pg">Connect to Account Database</h2>
+
+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
+
+ <h2 class="pg">Insert information of account</h2>
+
+@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;i<USER_TXT_CNT;i++)
+ {
+ ret = account_set_user_text(account, i, "user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ ret = account_set_user_int(account, i, 888);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_CONTACT, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_CALENDAR, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_VIDEO, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_EMAIL, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_STATUS_POST, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_VOIP, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_SAMSUNG_APPS, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_MOBILE_TRACKER, ACCOUNT_CAPABILITY_ENABLED);
+
+ int account_id = -1;
+ ret = account_insert_to_db(account, &account_id);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ return;
+ }
+
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ return;
+}
+@endcode
+
+ <h2 class="pg">Get account by id</h2>
+
+@code
+bool _capability_get_callback(const char* capability_type, account_capability_state_e capability_value, void* user_data)
+{
+ char* test_type = capability_type;
+ int test_value = capability_value;
+
+ printf("_capability_get_callback test_type = : %s\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;i<USER_TXT_CNT;i++)
+ {
+ _account_free_text(test_text);
+
+ account_get_user_text(handle, i, &test_text);
+ printf("_account_get_callback : %s\n", test_text);
+ }
+
+ int test_int = -1;
+
+ account_auth_type_e auth_type;
+ account_get_auth_type(handle, &auth_type);
+ printf("account_get_auth_type : %d\n", auth_type);
+
+ account_secrecy_state_e secret;
+ account_get_secret(handle, &secret);
+ printf("account_get_secret : %d\n", secret);
+
+ account_sync_state_e sync_support;
+ account_get_sync_support(handle, &sync_support);
+ printf("account_get_sync_support : %d\n", sync_support);
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ test_int = -1;
+ account_get_user_int(handle, i, &test_int);
+ printf("_account_get_callback : %d\n", test_int);
+ }
+
+ account_get_capability(handle, _capability_get_callback, NULL);
+
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+}
+@endcode
+
+
+ <h2 class="pg">Get account list by user name</h2>
+
+@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;i<USER_TXT_CNT;i++)
+ {
+ _account_free_text(test_text);
+
+ account_get_user_text(handle, i, &test_text);
+ printf("_account_get_callback : %s\n", test_text);
+ }
+
+ int test_int = -1;
+
+ account_auth_type_e auth_type;
+ account_get_auth_type(handle, &auth_type);
+ printf("account_get_auth_type : %d\n", auth_type);
+
+ account_secrecy_state_e secret;
+ account_get_secret(handle, &secret);
+ printf("account_get_secret : %d\n", secret);
+
+ account_sync_state_e sync_support;
+ account_get_sync_support(handle, &sync_support);
+ printf("account_get_sync_support : %d\n", sync_support);
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ test_int = -1;
+ account_get_user_int(handle, i, &test_int);
+ printf("_account_get_callback : %d\n", test_int);
+ }
+
+ account_get_capability(handle, _capability_get_callback, NULL);
+
+ return TRUE;
+}
+
+
+void get_account_list_by_user_name(char * user_name)
+{
+ int ret = - 1;
+ account_h account;
+
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ ret = account_query_account_by_user_name(_account_get_callback, user_name, NULL);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+}
+@endcode
+
+ <h2 class="pg">Get account list by package name</h2>
+
+@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;i<USER_TXT_CNT;i++)
+ {
+ _account_free_text(test_text);
+
+ account_get_user_text(handle, i, &test_text);
+ printf("_account_get_callback : %s\n", test_text);
+ }
+
+ int test_int = -1;
+
+ account_auth_type_e auth_type;
+ account_get_auth_type(handle, &auth_type);
+ printf("account_get_auth_type : %d\n", auth_type);
+
+ account_secrecy_state_e secret;
+ account_get_secret(handle, &secret);
+ printf("account_get_secret : %d\n", secret);
+
+ account_sync_state_e sync_support;
+ account_get_sync_support(handle, &sync_support);
+ printf("account_get_sync_support : %d\n", sync_support);
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ test_int = -1;
+ account_get_user_int(handle, i, &test_int);
+ printf("_account_get_callback : %d\n", test_int);
+ }
+
+ account_get_capability(handle, _capability_get_callback, NULL);
+
+ return TRUE;
+}
+
+void get_account_list_by_package_name(char * package_name)
+{
+ int ret = - 1;
+ account_h account;
+
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ ret = account_query_account_by_package_name(_account_get_callback, package_name, NULL);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+}
+@endcode
+
+ <h2 class="pg">Get all account list</h2>
+
+@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;i<USER_TXT_CNT;i++)
+ {
+ _account_free_text(test_text);
+
+ account_get_user_text(handle, i, &test_text);
+ printf("_account_get_callback : %s\n", test_text);
+ }
+
+ int test_int = -1;
+
+ account_auth_type_e auth_type;
+ account_get_auth_type(handle, &auth_type);
+ printf("account_get_auth_type : %d\n", auth_type);
+
+ account_secrecy_state_e secret;
+ account_get_secret(handle, &secret);
+ printf("account_get_secret : %d\n", secret);
+
+ account_sync_state_e sync_support;
+ account_get_sync_support(handle, &sync_support);
+ printf("account_get_sync_support : %d\n", sync_support);
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ test_int = -1;
+ account_get_user_int(handle, i, &test_int);
+ printf("_account_get_callback : %d\n", test_int);
+ }
+
+ account_get_capability(handle, _capability_get_callback, NULL);
+
+ return TRUE;
+}
+
+void get_all_account()
+{
+ int ret = - 1;
+ account_h account;
+
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ ret = account_foreach_account_from_db(_account_get_callback, NULL);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+}
+@endcode
+
+ <h2 class="pg">Update information of account by account id</h2>
+
+@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;i<USER_TXT_CNT;i++)
+ {
+ ret = account_set_user_text(account, i, "update-user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ ret = account_set_user_int(account, i, 999);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_CONTACT, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_CALENDAR, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_VIDEO, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_EMAIL, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_STATUS_POST, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_VOIP, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_SAMSUNG_APPS, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_MOBILE_TRACKER, ACCOUNT_CAPABILITY_DISABLED);
+
+ ret = account_update_to_db_by_id(account, account_id);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ return;
+ }
+
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+}
+@endcode
+
+ <h2 class="pg">Update information of account by user name</h2>
+
+@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;i<USER_TXT_CNT;i++)
+ {
+ ret = account_set_user_text(account, i, "update-user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ ret = account_set_user_int(account, i, 999);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_CONTACT, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_CALENDAR, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_VIDEO, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_EMAIL, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_STATUS_POST, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_VOIP, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_SAMSUNG_APPS, ACCOUNT_CAPABILITY_DISABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_MOBILE_TRACKER, ACCOUNT_CAPABILITY_DISABLED);
+
+ ret = account_update_to_db_by_user_name(account, user_name, package_name);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ return;
+ }
+
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+}
+@endcode
+
+ <h2 class="pg">Delete account by id </h2>
+
+@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
+
+ <h2 class="pg">Update sync status by id </h2>
+
+@code
+void update_sync_status_by_id(int account_id, const account_sync_state_e sync_status)
+{
+ int ret = -1;
+
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ ret = account_update_sync_status_by_id(account_id, sync_status);
+ 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
+
+ <h2 class="pg">Delete account by user name </h2>
+
+@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
+
+ <h2 class="pg">Delete account by package name </h2>
+
+@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
+
+ <h2 class="pg">Get account insert dbus notification </h2>
+
+@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
+
+ <h2 class="pg">Get account update dbus notification </h2>
+
+@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
+
+ <h2 class="pg">Get account delete dbus notification </h2>
+
+@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
+
+ <h2 class="pg">Get capability by acccount id</h2>
+
+@code
+bool _capability_get_callback(const char* capability_type, account_capability_state_e capability_value, void* user_data)
+{
+ char* test_type = capability_type;
+ int test_value = capability_value;
+
+ printf("_capability_get_callback test_type = : %s\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
+ * @}
+ */
+
--- /dev/null
+<manifest>
+ <define>
+ <domain name="libaccounts-svc"/>
+ <provide>
+ <label name="libaccounts-svc::db"/>
+ </provide>
+ <request>
+ <smack request="libaccounts-svc::db" type="rw" />
+ </request>
+ </define>
+ <request>
+ <domain name="libaccounts-svc"/>
+ </request>
+ <assign>
+ <filesystem path="/usr/lib/libaccounts-svc.so" label="_" />
+ <filesystem path="/usr/lib/libaccounts-svc.so.0.2.21" label="_" />
+ </assign>
+</manifest>
--- /dev/null
+
+Name: libaccounts-svc
+Summary: Account DB library
+Version: 0.2.21
+Release: 1
+Group: TO_BE/FILLED_IN
+License: TO BE FILLED IN
+Source0: libaccounts-svc-%{version}.tar.gz
+
+BuildRequires: cmake
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(db-util)
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(libxml-2.0)
+Requires(post): /sbin/ldconfig
+Requires(post): /usr/bin/sqlite3
+Requires(postun): /sbin/ldconfig
+
+%description
+Account DB libraryXB-Public-Package: no
+
+
+%package devel
+Summary: Development files for %{name}
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+%description devel
+Development files for %{name}
+
+
+%prep
+%setup -q
+
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX=/usr
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+rm -rf %{buildroot}/usr/lib/accounts-svc
+
+
+%post
+/sbin/ldconfig
+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 label (AppId TEXT, Label TEXT, Locale TEXT);
+ CREATE TABLE if not exists account_type (_id INTEGER PRIMARY KEY AUTOINCREMENT, AppId TEXT,
+ ServiceProviderId TEXT, IconPath TEXT, SmallIconPath TEXT, MultipleAccountSupport INT);
+ CREATE TABLE if not exists account_custom (AccountId INTEGER, AppId TEXT, Key TEXT, Value TEXT);
+ 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 capability (_id INTEGER PRIMARY KEY AUTOINCREMENT, key TEXT, value INTEGER,
+ package_name TEXT, user_name TEXT, account_id INTEGER, FOREIGN KEY (account_id) REFERENCES account(_id));'
+fi
+
+mkdir -p /opt/usr/share/account
+chown 5000:5000 /opt/dbspace/.account.db
+chown 5000:5000 /opt/dbspace/.account.db-journal
+chown 5000:5000 /opt/usr/share/account
+
+chmod 660 /opt/dbspace/.account.db
+chmod 660 /opt/dbspace/.account.db-journal
+chmod 755 /opt/usr/share/account
+
+#set message key value to NULL
+vconftool set -t string db/account/msg '' -g 6514
+
+#smack labeling
+if [ -f /usr/lib/rpm-plugins/msm.so ]
+then
+ chsmack -a 'libaccounts-svc::db' /opt/dbspace/.account.db-journal
+ chsmack -a 'libaccounts-svc::db' /opt/dbspace/.account.db
+fi
+
+
+%postun -p /sbin/ldconfig
+
+
+
+%files
+%manifest libaccounts-svc.manifest
+%defattr(-,root,root,-)
+%{_libdir}/*.so.*
+%{_bindir}/account-xml-verify
+
+%files devel
+%defattr(-,root,root,-)
+%{_libdir}/*.so
+%{_libdir}/pkgconfig/accounts-svc.pc
+%{_includedir}/*.h
+%{_bindir}/account-xml-verify
--- /dev/null
+/*
+ * account
+ *
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
+ *
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <account.h>
+#include <glib.h>
+#include <account-private.h>
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+#include <app.h>
+
+#define ACCOUNT_XML_DIR "/opt/usr/share/account"
+#define BUFSIZE 1024
+
+static void _account_parse_doc(xmlDocPtr doc, xmlNodePtr cur,
+ char *capability_filter, bool *supported)
+{
+ xmlChar *key;
+ cur = cur->xmlChildrenNode;
+ while ((cur != NULL) && (*supported != true)) {
+ if ((!xmlStrcmp(cur->name, (const xmlChar *)"capability"))) {
+ key = xmlNodeGetContent(cur);
+ ACCOUNT_DEBUG("Capability String is : %s\n", key);
+ if (!strcmp(capability_filter, (char *)key)) {
+ *supported = true;
+ }
+ xmlFree(key);
+ }
+ cur = cur->next;
+ }
+ return;
+}
+
+static bool _account_check_file_exists(char *f_path)
+{
+ FILE *file;
+ if ((file = fopen(f_path, "r")) != NULL) {
+ fclose(file);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+int account_get_application_capability_support(char *package_name,
+ char *capability_filter, bool *supported)
+{
+ if (!package_name) {
+ ACCOUNT_ERROR("package_name can not be NULL \n");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ if (!capability_filter) {
+ ACCOUNT_ERROR("capability_filter can not be NULL \n");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ if (!supported) {
+ ACCOUNT_ERROR("supported pointer can not be NULL \n");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ char xml_file_path[BUFSIZE] = {0, };
+ xmlDocPtr doc = NULL;
+ xmlNodePtr cur = NULL;
+ *supported = false;
+
+ ACCOUNT_MEMSET(xml_file_path, 0, sizeof(xml_file_path));
+ ACCOUNT_SNPRINTF(xml_file_path, BUFSIZE, "%s/%s.account.xml",
+ ACCOUNT_XML_DIR, package_name);
+
+ ACCOUNT_INFO("xml_file_path = %s \n",xml_file_path);
+
+ if (!_account_check_file_exists(xml_file_path)) {
+ ACCOUNT_ERROR("XML file not found for %s \n", package_name);
+ return ACCOUNT_ERROR_XML_FILE_NOT_FOUND;
+ }
+
+ doc = xmlParseFile(xml_file_path);
+ if (doc == NULL ) {
+ ACCOUNT_ERROR("Document not parsed successfully. \n");
+ return ACCOUNT_ERROR_XML_PARSE_FAILED;
+ }
+
+ cur = xmlDocGetRootElement(doc);
+ if (cur == NULL) {
+ ACCOUNT_ERROR("empty document\n");
+ xmlFreeDoc(doc);
+ return ACCOUNT_ERROR_XML_PARSE_FAILED;
+ }
+
+ if (xmlStrcmp(cur->name, (const xmlChar *) "account")) {
+ ACCOUNT_ERROR("document of the wrong type, root node != account");
+ xmlFreeDoc(doc);
+ return ACCOUNT_ERROR_XML_PARSE_FAILED;
+ }
+ _account_parse_doc(doc, cur, capability_filter, supported);
+ xmlFreeDoc(doc);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_application_multiple_account_support(
+ char *package_name,
+ bool *supported)
+{
+ if (!package_name) {
+ ACCOUNT_ERROR("package_name can not be NULL \n");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ if (!supported) {
+ ACCOUNT_ERROR("supported pointer can not be NULL \n");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ char xml_file_path[BUFSIZE] = {0, };
+ xmlDocPtr doc = NULL;
+ xmlNodePtr cur = NULL;
+ xmlChar *attr = NULL;
+ *supported = false;
+
+ ACCOUNT_MEMSET(xml_file_path, 0, sizeof(xml_file_path));
+ ACCOUNT_SNPRINTF(xml_file_path, BUFSIZE, "%s/%s.account.xml",
+ ACCOUNT_XML_DIR, package_name);
+
+ ACCOUNT_VERBOSE("xml_file_path = %s \n",xml_file_path);
+
+ if (!_account_check_file_exists(xml_file_path)) {
+ ACCOUNT_ERROR("XML file not found for %s \n", package_name);
+ return ACCOUNT_ERROR_XML_FILE_NOT_FOUND;
+ }
+
+ doc = xmlParseFile(xml_file_path);
+ if (doc == NULL ) {
+ ACCOUNT_ERROR("Document not parsed successfully. \n");
+ return ACCOUNT_ERROR_XML_PARSE_FAILED;
+ }
+
+ cur = xmlDocGetRootElement(doc);
+ if (cur == NULL) {
+ ACCOUNT_ERROR("empty document\n");
+ xmlFreeDoc(doc);
+ return ACCOUNT_ERROR_XML_PARSE_FAILED;
+ }
+
+ if (xmlStrcmp(cur->name, (const xmlChar *) "account")) {
+ ACCOUNT_ERROR("document of the wrong type, root node != account");
+ xmlFreeDoc(doc);
+ return ACCOUNT_ERROR_XML_PARSE_FAILED;
+ }
+ attr = xmlGetProp(cur, (const xmlChar *)"multiple");
+ ACCOUNT_INFO("Multiple = %s \n",(char *)attr);
+
+ if (attr == NULL)
+ *supported = false;
+ else if (!strcmp("false", (char *)attr))
+ *supported = false;
+ else if (!strcmp("true", (char *)attr))
+ *supported = true;
+ else
+ *supported = false;
+
+ xmlFreeDoc(doc);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_application_icon_path(char *package_name,
+ char **icon_path)
+{
+ if (!package_name) {
+ ACCOUNT_ERROR("package_name can not be NULL \n");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ if (!icon_path) {
+ ACCOUNT_ERROR("icon_path pointer can not be NULL \n");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ char xml_file_path[BUFSIZE] = {0, };
+ xmlDocPtr doc = NULL;
+ xmlNodePtr cur = NULL;
+ xmlChar *attr = NULL;
+ *icon_path = NULL;
+
+ ACCOUNT_MEMSET(xml_file_path, 0, sizeof(xml_file_path));
+ ACCOUNT_SNPRINTF(xml_file_path, BUFSIZE, "%s/%s.account.xml",
+ ACCOUNT_XML_DIR, package_name);
+
+ ACCOUNT_INFO("xml_file_path = %s \n",xml_file_path);
+
+ if (!_account_check_file_exists(xml_file_path)) {
+ ACCOUNT_ERROR("XML file not found for %s \n", package_name);
+ return ACCOUNT_ERROR_XML_FILE_NOT_FOUND;
+ }
+
+ doc = xmlParseFile(xml_file_path);
+ if (doc == NULL ) {
+ ACCOUNT_ERROR("Document not parsed successfully. \n");
+ return ACCOUNT_ERROR_XML_PARSE_FAILED;
+ }
+
+ cur = xmlDocGetRootElement(doc);
+ if (cur == NULL) {
+ ACCOUNT_ERROR("empty document\n");
+ xmlFreeDoc(doc);
+ return ACCOUNT_ERROR_XML_PARSE_FAILED;
+ }
+
+ if (xmlStrcmp(cur->name, (const xmlChar *) "account")) {
+ ACCOUNT_ERROR("document of the wrong type, root node != account");
+ xmlFreeDoc(doc);
+ return ACCOUNT_ERROR_XML_PARSE_FAILED;
+ }
+ attr = xmlGetProp(cur, (const xmlChar *)"icon_path");
+ ACCOUNT_DEBUG("icon_path = %s \n",(char *)attr);
+
+ if (attr == NULL)
+ *icon_path = NULL;
+ else
+ *icon_path = strdup((char *)attr);
+
+ xmlFreeDoc(doc);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static bool __service_iter_func(service_h service, const char* pkg_name,
+ void *data)
+{
+ if (!pkg_name) {
+ ACCOUNT_ERROR("__service_iter_func: pkg name NULL \n");
+ return TRUE;
+ }
+ GList **pkg_list = (GList **)data;
+ char *pkgname = NULL;
+ pkgname = strdup(pkg_name);
+ *pkg_list = g_list_append(*pkg_list, pkgname);
+ return TRUE;
+}
+
+int account_query_service_list_by_capability(service_list_cb callback,
+ const char* capability_type,
+ void *user_data)
+{
+ int ret = SERVICE_ERROR_NONE;
+ GList *pkg_list = NULL;
+ service_h service = NULL;
+ GList *iter = NULL;
+ char *list_item = NULL;
+ char *capability_filter = NULL;
+ bool supported = false;
+ char *icon_path = NULL;
+ bool multiple = false;
+ int error_code = ACCOUNT_ERROR_NONE;
+
+ ACCOUNT_RETURN_VAL((capability_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("CAPABILITY TYPE IS NULL"));
+ ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("CALL BACK IS NULL"));
+
+ ACCOUNT_VERBOSE("account_query_service_list_by_capability START \n");
+ ret = service_create(&service);
+ if (ret != SERVICE_ERROR_NONE) {
+ ACCOUNT_ERROR("Owner Check : service_create fail ret=%d\n", ret);
+ return ret;
+ } else {
+ ACCOUNT_VERBOSE("service_list_by: service_create SUCCESS!!!!!! ret=%d\n", ret);
+ }
+ ret = service_set_operation(service, ACCOUNT_OPERATION_SIGNIN);
+ if (ret != SERVICE_ERROR_NONE) {
+ ACCOUNT_ERROR("service_list_by : service_set_operation fail ret=%d\n", ret);
+ service_destroy(service);
+ return ret;
+ } else {
+ ACCOUNT_VERBOSE("service_list_by : service_set_operation SUCCESS!!!!!! ret=%d\n",
+ ret);
+ }
+ ret = service_foreach_app_matched(service, __service_iter_func, &pkg_list);
+ if (ret != SERVICE_ERROR_NONE) {
+ ACCOUNT_ERROR("service_list_by : service_foreach_app_matched fail ret=%d\n",
+ ret);
+ service_destroy(service);
+ return ret;
+ } else {
+ ACCOUNT_VERBOSE("service_list_by : service_foreach_app_matched SUCCESS!!!!!! ret=%d\n",
+ ret);
+ }
+ pkg_list = g_list_append(pkg_list, strdup(FACEBOOK_PKG_NAME));
+ pkg_list = g_list_append(pkg_list, strdup(EMAIL_PKG_NAME));
+ pkg_list = g_list_append(pkg_list, strdup(EXCHANGE_PKG_NAME));
+ pkg_list = g_list_append(pkg_list, strdup(IMS_SERVICE_PKG_NAME));
+ pkg_list = g_list_append(pkg_list, strdup(SAMSUNGACCOUNT_PKG_NAME));
+ pkg_list = g_list_append(pkg_list, strdup(DROPBOX_PKG_NAME));
+
+ ret = service_destroy(service);
+ if (ret != SERVICE_ERROR_NONE) {
+ ACCOUNT_ERROR("service_list_by : service_destroy fail ret=%d\n", ret);
+ for (iter = pkg_list; iter != NULL; iter = g_list_next(iter)) {
+ list_item = (char *)iter->data;
+ g_free(list_item);
+ }
+ g_list_free(pkg_list);
+ return ret;
+ } else {
+ ACCOUNT_VERBOSE("service_list_by : service_destroy SUCCESS!!!!!! ret=%d\n", ret);
+ }
+
+ capability_filter = strdup(capability_type);
+
+ for (iter = pkg_list; iter != NULL; iter = g_list_next(iter)) {
+ list_item = (char *)iter->data;
+ error_code = account_get_application_capability_support(list_item,
+ capability_filter,
+ &supported);
+
+ if ((error_code != ACCOUNT_ERROR_NONE)
+ && (error_code != ACCOUNT_ERROR_XML_FILE_NOT_FOUND)) {
+ ACCOUNT_ERROR("service_list_by : account_get_application_capability_support fail error_code=%d\n", error_code);
+ for (iter = pkg_list; iter != NULL; iter = g_list_next(iter)) {
+ list_item = (char *)iter->data;
+ g_free(list_item);
+ }
+ g_list_free(pkg_list);
+ _ACCOUNT_FREE(capability_filter);
+ return error_code;
+ }
+
+ if (supported) {
+ error_code = account_get_application_icon_path(list_item, &icon_path);
+ if (error_code != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("service_list_by : account_get_application_capability_support fail error_code=%d\n", error_code);
+ for (iter = pkg_list; iter != NULL; iter = g_list_next(iter)) {
+ list_item = (char *)iter->data;
+ g_free(list_item);
+ }
+ g_list_free(pkg_list);
+ _ACCOUNT_FREE(capability_filter);
+ return error_code;
+ }
+ error_code = account_get_application_multiple_account_support(list_item, &multiple);
+ if (error_code != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("service_list_by : account_get_application_capability_support fail error_code=%d\n", error_code);
+ for (iter = pkg_list; iter != NULL; iter = g_list_next(iter)) {
+ list_item = (char *)iter->data;
+ g_free(list_item);
+ }
+ g_list_free(pkg_list);
+ _ACCOUNT_FREE(capability_filter);
+ return error_code;
+ }
+ callback(list_item, icon_path, multiple, user_data);
+ }
+ }
+ /* free list */
+ for (iter = pkg_list; iter != NULL; iter = g_list_next(iter)) {
+ list_item = (char *)iter->data;
+ g_free(list_item);
+ }
+ g_list_free(pkg_list);
+ _ACCOUNT_FREE(capability_filter);
+ return ACCOUNT_ERROR_NONE;
+}
--- /dev/null
+/*
+ * account
+ *
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
+ *
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+#include <account-types.h>
+#include <account.h>
+
+static char *_account_list_get_capablity_string_value(char *key)
+{
+ if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_CONTACT, key))
+ return "Contact";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_CALENDAR, key))
+ return "Calendar";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_PHOTO, key))
+ return "Photo";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_VIDEO, key))
+ return "Video";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_EMAIL, key))
+ return "Email";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_POST, key))
+ return "Post";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_VOIP, key))
+ return "VOIP";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_SAMSUNG_APPS, key))
+ return "Samsung Apps";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_MOBILE_TRACKER, key))
+ return "Mobile Tracker";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_TASK, key))
+ return "Task";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_S_NOTE, key))
+ return "S note";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_GALLERY, key))
+ return "Gallery";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_MUSIC, key))
+ return "Music";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_MEMO, key))
+ return "Memo";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_MESSAGE, key))
+ return "Message";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_CHAT, key))
+ return "Chat";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_BOOKMARK, key))
+ return "Bookmark";
+ else if (!strcmp(ACCOUNT_SUPPORTS_CAPABILITY_TIZEN_EMAIL, key))
+ return "Tizen Email";
+ else
+ return "::ERROR::Unkown:Recheck String !!!!";
+}
+
+void parseCap (xmlDocPtr doc, xmlNodePtr cur)
+{
+ xmlChar *key;
+ cur = cur->xmlChildrenNode;
+ printf("\n List of supported Capabilities is :\n");
+ while (cur != NULL) {
+ if ((!xmlStrcmp(cur->name, (const xmlChar *)"capability"))) {
+ key = xmlNodeGetContent(cur);
+ printf("\n :: %s :: \n", _account_list_get_capablity_string_value((char *)key));
+ xmlFree(key);
+ }
+ cur = cur->next;
+ }
+ return;
+}
+
+static void parseDoc(char *docname)
+{
+ xmlDocPtr doc = NULL;
+ xmlNodePtr cur = NULL;
+ xmlChar *attr = NULL;
+ xmlChar *icon_path = NULL;
+
+ doc = xmlParseFile(docname);
+
+ if (doc == NULL ) {
+ fprintf(stderr,"::ERROR::Document not parsed successfully. \n");
+ return;
+ }
+
+ cur = xmlDocGetRootElement(doc);
+
+ if (cur == NULL) {
+ fprintf(stderr,"::ERROR::empty document.\n");
+ xmlFreeDoc(doc);
+ return;
+ }
+
+ if (xmlStrcmp(cur->name, (const xmlChar *) "account")) {
+ fprintf(stderr,"::ERROR::document of the wrong type, root node != account.");
+ xmlFreeDoc(doc);
+ return;
+ }
+ attr = xmlGetProp(cur, (const xmlChar *)"multiple");
+
+ if (attr == NULL)
+ printf("\n multiple attribute not set, by default it will be taken as false.\n");
+ else if (!strcmp("false", (char *)attr))
+ printf("\n :: multiple = %s ::\n",attr);
+ else if (!strcmp("true", (char *)attr))
+ printf("\n :: multiple = %s :: \n",attr);
+ else
+ fprintf(stderr,"::ERROR:: Only multiple can be set as false or true. \n");
+
+ icon_path = xmlGetProp(cur, (const xmlChar *)"icon_path");
+
+ if (icon_path == NULL)
+ printf("\n icon path is NULL.\n");
+ else
+ printf("\n :: icon path = %s ::\n",icon_path);
+
+
+ parseCap(doc, cur);
+ xmlFreeDoc(doc);
+ return;
+}
+
+int main(int argc, char **argv)
+{
+ char *docname = NULL;
+
+ if (argc <= 1) {
+ printf("Usage: %s xml_file_path\n", argv[0]);
+ return(0);
+ }
+ printf("\n #############################################################################\n");
+ docname = argv[1];
+ parseDoc (docname);
+ printf("\n #############################################################################\n");
+ return (1);
+}
--- /dev/null
+/*
+ * account
+ *
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
+ *
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <account.h>
+#include <glib.h>
+#include <db-util.h>
+#include <pthread.h>
+#include <assert.h>
+#include <account-private.h>
+#include <vconf.h>
+#include <app.h>
+
+static sqlite3* g_hAccountDB = NULL;
+static int g_refCntDB = 0;
+pthread_mutex_t account_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static char *_account_get_text(const char *text_data);
+static int _account_gslist_free(GSList* list);
+static int _account_glist_free(GList* list);
+static char *_account_query_table_column_text(account_stmt pStmt, int pos);
+static int _account_insert_custom(account_s *account, int account_id);
+static int _account_update_custom(account_s *account, int account_id);
+static int _account_query_custom_by_account_id(account_custom_cb cb_func, int account_id, void *user_data );
+
+static const char *_account_db_err_msg()
+{
+ assert(NULL != g_hAccountDB);
+ return sqlite3_errmsg(g_hAccountDB);
+}
+
+static void _account_insert_delete_update_notification_send(char *noti_name)
+{
+ if (!noti_name) {
+ ACCOUNT_ERROR("Noti Name is NULL!!!!!!\n");
+ return;
+ }
+
+ ACCOUNT_DEBUG("Sending notification with value %s\n", noti_name);
+
+ if (vconf_set_str(VCONFKEY_ACCOUNT_MSG_STR, noti_name) == 0) {
+ ACCOUNT_VERBOSE("Vconf MSG Str set SUCCESS !!!!!!\n");;
+ } else {
+ ACCOUNT_ERROR("Vconf MSG Str set FAILED !!!!!!\n");;
+ }
+}
+
+static int _account_get_record_count(char* query)
+{
+ int rc = -1;
+ int ncount = 0;
+ account_stmt pStmt = NULL;
+
+ assert(NULL != query);
+ assert(NULL != g_hAccountDB);
+ rc = sqlite3_prepare_v2(g_hAccountDB, query, strlen(query), &pStmt, NULL);
+
+ rc = sqlite3_step(pStmt);
+ if (SQLITE_ROW != rc) {
+ ACCOUNT_ERROR("sqlite3_step() failed(%d, %s).", rc, _account_db_err_msg());
+ sqlite3_finalize(pStmt);
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ ncount = sqlite3_column_int(pStmt, 0);
+
+ ACCOUNT_VERBOSE("count : %d, End", ncount);
+ sqlite3_finalize(pStmt);
+
+ return ncount;
+}
+
+static int _account_execute_query(char *query)
+{
+ int rc = -1;
+ char* pszErrorMsg = NULL;
+
+ assert(NULL != query);
+ assert(NULL != g_hAccountDB);
+
+ ACCOUNT_INFO("query : %s", query);
+
+ rc = sqlite3_exec(g_hAccountDB, query, NULL, NULL, &pszErrorMsg);
+ if (SQLITE_OK != rc) {
+ ACCOUNT_FATAL("sqlite3_exec(%s) failed(%s).", query, pszErrorMsg);
+ sqlite3_free(pszErrorMsg);
+ }
+
+ return rc;
+}
+
+static int _account_begin_transaction(void)
+{
+ int ret = -1;
+
+ ret = _account_execute_query("BEGIN IMMEDIATE TRANSACTION");
+
+ if (ret != SQLITE_OK) {
+ ACCOUNT_FATAL("_account_svc_begin_transaction fail :: %d", ret);
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_end_transaction(bool is_success)
+{
+ int ret = -1;
+
+ if (is_success == true) {
+ ret = _account_execute_query("COMMIT TRANSACTION");
+ } else {
+ ret = _account_execute_query("ROLLBACK TRANSACTION");
+ }
+
+ if (ret != SQLITE_OK) {
+ ACCOUNT_FATAL("_account_svc_end_transaction fail :: %d", ret);
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_create_all_tables(void)
+{
+ int rc = -1;
+ int error_code = ACCOUNT_ERROR_NONE;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+
+
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+
+ ACCOUNT_VERBOSE("_account_create_all_tables begin");
+
+ /*Create the account table*/
+ ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from sqlite_master where name in ('%s')", ACCOUNT_TABLE);
+ rc = _account_get_record_count(query);
+ if (rc <= 0) {
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), ACCOUNT_SCHEMA, ACCOUNT_TABLE);
+ ACCOUNT_INFO("Create %s table", ACCOUNT_TABLE);
+ rc = _account_execute_query(query);
+ ACCOUNT_RETURN_VAL((SQLITE_OK == rc), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_execute_query(%s) failed(%d, %s).\n", query, rc, _account_db_err_msg()));
+ }
+
+ /*Create capability table*/
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from sqlite_master where name in ('%s')", CAPABILITY_TABLE);
+ rc = _account_get_record_count(query);
+ if (rc <= 0) {
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), CAPABILITY_SCHEMA, CAPABILITY_TABLE);
+ ACCOUNT_INFO("Create %s table", CAPABILITY_TABLE);
+ rc = _account_execute_query(query);
+ ACCOUNT_RETURN_VAL((SQLITE_OK == rc), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_execute_query(%s) failed(%d, %s).\n", query, rc, _account_db_err_msg()));
+ }
+
+ /* Create account custom table */
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from sqlite_master where name in ('%s')", ACCOUNT_CUSTOM_TABLE);
+ rc = _account_get_record_count(query);
+ if (rc <= 0) {
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), ACCOUNT_CUSTOM_SCHEMA, ACCOUNT_CUSTOM_TABLE);
+ ACCOUNT_INFO("Create %s table", ACCOUNT_CUSTOM_TABLE);
+ rc = _account_execute_query(query);
+ ACCOUNT_RETURN_VAL((SQLITE_OK == rc), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_execute_query(%s) failed(%d, %s).\n", query, rc, _account_db_err_msg()));
+ }
+
+ /* Create account type table */
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from sqlite_master where name in ('%s')", ACCOUNT_TYPE_TABLE);
+ rc = _account_get_record_count(query);
+ if (rc <= 0) {
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), ACCOUNT_TYPE_SCHEMA, ACCOUNT_TYPE_TABLE);
+ ACCOUNT_INFO("Create %s table", ACCOUNT_TYPE_TABLE);
+ rc = _account_execute_query(query);
+ ACCOUNT_RETURN_VAL((SQLITE_OK == rc), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_execute_query(%s) failed(%d, %s).\n", query, rc, _account_db_err_msg()));
+ }
+
+ /* Create label table */
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from sqlite_master where name in ('%s')", LABEL_TABLE);
+ rc = _account_get_record_count(query);
+ if (rc <= 0) {
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), LABEL_SCHEMA, LABEL_TABLE);
+ ACCOUNT_INFO("Create %s table", LABEL_TABLE);
+ rc = _account_execute_query(query);
+ ACCOUNT_RETURN_VAL((SQLITE_OK == rc), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_execute_query(%s) failed(%d, %s).\n", query, rc, _account_db_err_msg()));
+ }
+
+ return error_code;
+}
+
+static bool _account_check_is_all_table_exists()
+{
+ int rc = 0;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0,};
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+
+ ACCOUNT_VERBOSE("_account_check_is_all_table_exists");
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from sqlite_master where name in ('%s', '%s')",
+ ACCOUNT_TABLE, CAPABILITY_TABLE);
+ rc = _account_get_record_count(query);
+ if (rc != ACCOUNT_TABLE_TOTAL_COUNT) {
+ ACCOUNT_INFO("Table count is not matched rc=%d\n", rc);
+ return FALSE;
+ }
+
+ ACCOUNT_VERBOSE("END of _account_check_is_all_table_exists\n");
+
+ return TRUE;
+}
+
+static int _account_db_open(void)
+{
+ int rc = 0;
+ bool is_success = false;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+
+ if (!g_hAccountDB) {
+ rc = db_util_open(ACCOUNT_DB_NAME, &g_hAccountDB, DB_UTIL_REGISTER_HOOK_METHOD);
+ ACCOUNT_RETURN_VAL((rc == SQLITE_OK), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected. rc : %d", rc));
+
+ g_refCntDB++;
+ is_success = true;
+ ACCOUNT_INFO("_account_db_open: The database connected. refcnt=%d ", g_refCntDB);
+ } else {
+ g_refCntDB++;
+ is_success = true;
+ ACCOUNT_INFO("The database already connected. refcnt=%d ", g_refCntDB);
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_db_close(void)
+{
+ int rc = 0;
+ int ret = -1;
+
+ if (g_hAccountDB) {
+ if (g_refCntDB > 0) {
+ g_refCntDB--;
+ ACCOUNT_INFO("_account_svc_db_close: The database disconnected. refcnt=%d ", g_refCntDB);
+ }
+ if (g_refCntDB == 0) {
+ rc = db_util_close(g_hAccountDB);
+ ACCOUNT_RETURN_VAL((rc == SQLITE_OK), {}, ACCOUNT_ERROR_DB_FAILED, ("The database isn't connected. rc : %d", rc));
+ g_hAccountDB = NULL;
+ ACCOUNT_INFO( "_account_svc_db_close: The database disconnected really. ");
+ }
+ ret = ACCOUNT_ERROR_NONE;
+ } else {
+ ACCOUNT_ERROR( "_account_svc_db_close: No handle(). refcnt=%d ", g_refCntDB);
+ ret = ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ return ret;
+}
+
+static int _account_connect(void)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+
+ pthread_mutex_lock(&account_mutex);
+
+ ACCOUNT_VERBOSE("db path = %s\n", ACCOUNT_DB_NAME);
+
+ error_code = _account_db_open();
+ if (ACCOUNT_ERROR_NONE != error_code) {
+ ACCOUNT_ERROR("The database isn't connected.\n");
+ pthread_mutex_unlock(&account_mutex);
+ return ACCOUNT_ERROR_DB_NOT_OPENED;
+ }
+
+ if (FALSE == _account_check_is_all_table_exists())
+ error_code = _account_create_all_tables();
+
+ pthread_mutex_unlock(&account_mutex);
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_connect (void)
+{
+ return _account_connect();
+}
+
+static int _account_disconnect(void)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+
+ pthread_mutex_lock(&account_mutex);
+ ACCOUNT_INFO("db path = %s have been closed!!!\n", ACCOUNT_DB_NAME);
+
+ error_code = _account_db_close();
+ pthread_mutex_unlock(&account_mutex);
+
+ return error_code;
+}
+
+int account_disconnect (void)
+{
+ return _account_disconnect();
+}
+
+static int _account_free_capability_items(account_capability_s *data)
+{
+ _ACCOUNT_FREE(data->type);
+ _ACCOUNT_FREE(data->package_name);
+ _ACCOUNT_FREE(data->user_name);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_custom_item_free(account_custom_s *data)
+{
+ _ACCOUNT_FREE(data->app_id);
+ _ACCOUNT_FREE(data->key);
+ _ACCOUNT_FREE(data->value);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_custom_gslist_free(GSList* list)
+{
+ ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("GSlist is NULL"));
+
+ GSList* iter;
+
+ for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
+ account_custom_s *custom_data = (account_custom_s*)iter->data;
+ _account_custom_item_free(custom_data);
+ _ACCOUNT_FREE(custom_data);
+ }
+
+ g_slist_free(list);
+ list = NULL;
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_free_account_items(account_s *data)
+{
+ _ACCOUNT_FREE(data->user_name);
+ _ACCOUNT_FREE(data->email_address);
+ _ACCOUNT_FREE(data->display_name);
+ _ACCOUNT_FREE(data->icon_path);
+ _ACCOUNT_FREE(data->source);
+ _ACCOUNT_FREE(data->package_name);
+ _ACCOUNT_FREE(data->domain_name);
+
+ int i;
+ for(i=0;i<USER_TXT_CNT;i++)
+ _ACCOUNT_FREE(data->user_data_txt[i]);
+
+ _account_gslist_free(data->capablity_list);
+ _account_glist_free(data->account_list);
+ _account_custom_gslist_free(data->custom_list);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_gslist_free(GSList* list)
+{
+ ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("GSlist is NULL"));
+
+ GSList* iter;
+
+ for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
+ account_capability_s *cap_data = (account_capability_s*)iter->data;
+ _account_free_capability_items(cap_data);
+ _ACCOUNT_FREE(cap_data);
+ }
+
+ g_slist_free(list);
+ list = NULL;
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_glist_free(GList* list)
+{
+ ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Glist is NULL"));
+
+ GList* iter;
+
+ for (iter = list; iter != NULL; iter = g_list_next(iter)) {
+ account_s *account_record = (account_s*)iter->data;
+ _account_free_account_items(account_record);
+ _ACCOUNT_FREE(account_record);
+ }
+
+ g_list_free(list);
+ list = NULL;
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static gboolean _account_check_duplicated(account_s *data)
+{
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int count = 0;
+
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from %s where user_name='%s' and domain_name='%s'"
+ , ACCOUNT_TABLE, data->user_name, data->domain_name);
+
+ count = _account_get_record_count(query);
+ if (count > 0) {
+ ACCOUNT_INFO("_account_check_duplicated : duplicated %d account(s) exist!, user_name=%s, domain_name=%s\n",
+ count, data->user_name, data->domain_name );
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static int _account_get_next_sequence(char *pszName)
+{
+ int rc = 0;
+ account_stmt pStmt = NULL;
+ int max_seq = 0;
+ char szQuery[ACCOUNT_SQL_LEN_MAX] = {0,};
+
+ ACCOUNT_VERBOSE( "[Enter] pszName:%s\n", pszName);
+
+ ACCOUNT_MEMSET(szQuery, 0x00, sizeof(szQuery));
+ ACCOUNT_SNPRINTF(szQuery, sizeof(szQuery), "SELECT max(seq) FROM %s where name = '%s' ", ACCOUNT_SQLITE_SEQ, pszName);
+ rc = sqlite3_prepare_v2(g_hAccountDB, szQuery, strlen(szQuery), &pStmt, NULL);
+
+ rc = sqlite3_step(pStmt);
+ max_seq = sqlite3_column_int(pStmt, 0);
+ max_seq++;
+
+ ACCOUNT_VERBOSE( "sqlite3_column_int, rc=%d, max_seq=%d\n", rc, max_seq);
+
+ /*Finalize Statement*/
+ rc = sqlite3_finalize(pStmt);
+ pStmt = NULL;
+
+ return max_seq;
+}
+
+static account_stmt _account_prepare_query(char *query)
+{
+ int rc = -1;
+ account_stmt pStmt = NULL;
+
+ ACCOUNT_RETURN_VAL((query != NULL), {}, NULL, ("query is NULL"));
+
+ ACCOUNT_INFO( "prepare query : %s", query);
+
+ rc = sqlite3_prepare_v2(g_hAccountDB, query, strlen(query), &pStmt, NULL);
+ ACCOUNT_RETURN_VAL((SQLITE_OK == rc), {}, NULL, ("sqlite3_prepare_v2(%s) failed(%s).", query, _account_db_err_msg()));
+
+ return pStmt;
+}
+
+static int _account_query_bind_int(account_stmt pStmt, int pos, int num)
+{
+ assert(NULL != pStmt);
+ assert(pos > -1);
+ return sqlite3_bind_int(pStmt, pos, num);
+}
+
+static int _account_query_bind_text(account_stmt pStmt, int pos, const char *str)
+{
+ assert(NULL != pStmt);
+
+ if(str)
+ return sqlite3_bind_text(pStmt, pos, (const char*)str, strlen(str), SQLITE_STATIC);
+ else
+ return sqlite3_bind_null(pStmt, pos);
+}
+
+static int _account_convert_account_to_sql(account_s *account, account_stmt hstmt, char *sql_value)
+{
+ ACCOUNT_VERBOSE( "_account_convert_account_to_sql");
+ int count = 1;
+
+ /*Caution : Keep insert query orders.*/
+
+ /* 1. user name*/
+ _account_query_bind_text(hstmt, count++, (char*)account->user_name);
+
+ /* 2. email address*/
+ _account_query_bind_text(hstmt, count++, (char*)account->email_address);
+
+ /* 3. display name*/
+ _account_query_bind_text(hstmt, count++, (char*)account->display_name);
+
+ /* 4. icon path*/
+ _account_query_bind_text(hstmt, count++, (char*)account->icon_path);
+
+ /* 5. source*/
+ _account_query_bind_text(hstmt, count++, (char*)account->source);
+
+ /* 6. package name*/
+ _account_query_bind_text(hstmt, count++, (char*)account->package_name);
+
+ /* 7. access token*/
+ _account_query_bind_text(hstmt, count++, (char*)account->access_token);
+
+ /* 8. domain name*/
+ _account_query_bind_text(hstmt, count++, (char*)account->domain_name);
+
+ /* 9. auth type*/
+ _account_query_bind_int(hstmt, count++, account->auth_type);
+
+ /* 10. secret */
+ _account_query_bind_int(hstmt, count++, account->secret);
+
+ /* 11. sync_support */
+ _account_query_bind_int(hstmt, count++, account->sync_support);
+
+ int i;
+
+ /* 12. user text*/
+ for(i=0; i< USER_TXT_CNT; i++)
+ _account_query_bind_text(hstmt, count++, (char*)account->user_data_txt[i]);
+
+ /* 13. user integer */
+ for(i=0; i< USER_INT_CNT; i++)
+ _account_query_bind_int(hstmt, count++, account->user_data_int[i]);
+
+ return count;
+}
+
+static void _account_query_finalize(account_stmt pStmt)
+{
+ int rc = -1;
+
+ if (!pStmt) {
+ ACCOUNT_FATAL( "pStmt is NULL");
+ return;
+ }
+
+ rc = sqlite3_finalize(pStmt);
+ if (rc != SQLITE_OK) {
+ ACCOUNT_FATAL( "sqlite3_finalize fail, rc : %d, db_error : %s\n", rc, _account_db_err_msg());
+ }
+
+ ACCOUNT_VERBOSE( "sqlite3_finalize finish");
+}
+
+static int _account_query_step(account_stmt pStmt)
+{
+ assert(NULL != pStmt);
+ return sqlite3_step(pStmt);
+}
+
+
+
+static int _do_account_owner_existance_check()
+{
+ /* TODO check owner*/
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_execute_insert_query(account_s *account)
+{
+ int rc = 0;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+
+ if (!account->package_name) {
+ ACCOUNT_ERROR("Package name is mandetory field, it can not be NULL!!!!\n");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!account->user_name && !account->display_name && !account->email_address) {
+ ACCOUNT_ERROR("Mandetory fields is NULL. At least one field is required among username, display name, email address\n");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ 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 , 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);
+
+ hstmt = _account_prepare_query(query);
+ ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_prepare_query() failed(%s).\n", _account_db_err_msg()));
+
+ _account_convert_account_to_sql(account, hstmt, query);
+
+ rc = _account_query_step(hstmt);
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_FATAL( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ error_code = ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ return error_code;
+}
+
+static int _account_insert_capability(account_s *account, int account_id)
+{
+ int rc, count = 1;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ account_stmt hstmt = NULL;
+
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+
+ if (g_slist_length( account->capablity_list)==0) {
+ ACCOUNT_ERROR( "_account_insert_capability, no capability\n");
+ return ACCOUNT_ERROR_NONE;
+ }
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where _id=%d", ACCOUNT_TABLE, account_id);
+
+ rc = _account_get_record_count(query);
+
+ if (rc <= 0) {
+ ACCOUNT_WARNING( "_account_insert_capability : related account item is not existed rc=%d , %s", rc, _account_db_err_msg());
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ }
+
+ /* insert query*/
+
+ GSList *iter;
+
+ for (iter = account->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
+ int rc, ret;
+ count = 1;
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(key, value, package_name, user_name, account_id) VALUES "
+ "(?, ?, ?, ?, ?) ", CAPABILITY_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()));
+
+ account_capability_s* cap_data = NULL;
+ cap_data = (account_capability_s*)iter->data;
+ ACCOUNT_VERBOSE("cap_data->type = %d, cap_data->value = %d \n", cap_data->type, cap_data->value);
+
+ ret = _account_query_bind_text(hstmt, count++, cap_data->type);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_int(hstmt, count++, cap_data->value);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Integer binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, (char*)account->package_name);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, (char*)account->user_name);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_int(hstmt, count++, (int)account_id);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Integer binding fail"));
+
+ rc = _account_query_step(hstmt);
+
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_FATAL( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ break;
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ }
+
+ ACCOUNT_VERBOSE( "_account_insert_capability() DONE\n");
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_update_capability(account_s *account, int account_id)
+{
+ int rc, count = 1;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ account_stmt hstmt = NULL;
+
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+
+ if (g_slist_length( account->capablity_list)==0) {
+ ACCOUNT_ERROR( "_account_insert_capability, no capability\n");
+ return ACCOUNT_ERROR_NONE;
+ }
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where _id=%d", ACCOUNT_TABLE, account_id);
+
+ rc = _account_get_record_count(query);
+
+ if (rc <= 0) {
+ ACCOUNT_WARNING( "_account_insert_capability : related account item is not existed rc=%d , %s", rc, _account_db_err_msg());
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE account_id=? ", CAPABILITY_TABLE);
+ hstmt = _account_prepare_query(query);
+ count = 1;
+ _account_query_bind_int(hstmt, count++, (int)account_id);
+ rc = _account_query_step(hstmt);
+
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_FATAL( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ GSList *iter;
+
+ for (iter = account->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
+ int rc, ret;
+ count = 1;
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(key, value, package_name, user_name, account_id) VALUES "
+ "(?, ?, ?, ?, ?) ", CAPABILITY_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()));
+
+ account_capability_s* cap_data = NULL;
+ cap_data = (account_capability_s*)iter->data;
+
+ ret = _account_query_bind_text(hstmt, count++, cap_data->type);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_int(hstmt, count++, cap_data->value);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Integer binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, (char*)account->package_name);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, (char*)account->user_name);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_int(hstmt, count++, (int)account_id);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Integer binding fail"));
+
+ rc = _account_query_step(hstmt);
+
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_FATAL( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ break;
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ }
+
+ ACCOUNT_DEBUG( "_account_insert_capability() DONE\n");
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_update_capability_by_user_name(account_s *account, char *user_name, char *package_name )
+{
+ int rc, count = 1;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ account_stmt hstmt = NULL;
+
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+
+ if (g_slist_length( account->capablity_list)==0) {
+ ACCOUNT_ERROR( "_account_insert_capability, no capability\n");
+ return ACCOUNT_ERROR_NONE;
+ }
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where package_name=%s and user_name=%s", ACCOUNT_TABLE, package_name, user_name);
+
+ rc = _account_get_record_count(query);
+
+ if (rc <= 0) {
+ ACCOUNT_WARNING( "_account_insert_capability : related account item is not existed rc=%d , %s ", rc, _account_db_err_msg());
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE package_name=? and user_name=? ", CAPABILITY_TABLE);
+ hstmt = _account_prepare_query(query);
+ count = 1;
+ _account_query_bind_text(hstmt, count++, (char*)account->package_name);
+ _account_query_bind_text(hstmt, count++, (char*)account->user_name);
+ rc = _account_query_step(hstmt);
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_FATAL( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ GSList* iter;
+
+ for (iter = account->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
+ int rc, ret;
+ count = 1;
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(key, value, package_name, user_name, account_id) VALUES "
+ "(?, ?, ?, ?, ?) ", CAPABILITY_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()));
+
+ account_capability_s* cap_data = NULL;
+ cap_data = (account_capability_s*)iter->data;
+
+ ret = _account_query_bind_text(hstmt, count++, cap_data->type);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_int(hstmt, count++, cap_data->value);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Integer binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, (char*)account->package_name);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, (char*)account->user_name);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_int(hstmt, count++, (int)account->id);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Integer binding fail"));
+
+ rc = _account_query_step(hstmt);
+
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_FATAL( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ break;
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ }
+
+ ACCOUNT_VERBOSE( "_account_insert_capability() DONE\n");
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_query_table_column_int(account_stmt pStmt, int pos)
+{
+ assert(NULL != pStmt);
+ assert(pos > -1);
+ return sqlite3_column_int(pStmt, pos);
+}
+
+static char *_account_query_table_column_text(account_stmt pStmt, int pos)
+{
+ assert(NULL != pStmt);
+ assert(pos > -1);
+ return (char *)sqlite3_column_text(pStmt, pos);
+}
+
+static void _account_db_data_to_text(char *textbuf, char **output)
+{
+ if (textbuf && strlen(textbuf)>0) {
+ if (*output) {
+ free(*output);
+ *output = NULL;
+ }
+ *output = strdup(textbuf);
+ } else {
+ ACCOUNT_WARNING("_account_db_data_to_text : no text");
+ }
+}
+
+static void _account_convert_column_to_account(account_stmt hstmt, account_s *account_record)
+{
+ char *textbuf = NULL;
+
+ account_record->id = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_ID);
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_NAME);
+ _account_db_data_to_text(textbuf, &(account_record->user_name));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_EMAIL_ADDRESS);
+ _account_db_data_to_text(textbuf, &(account_record->email_address));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_DISPLAY_NAME);
+ _account_db_data_to_text(textbuf, &(account_record->display_name));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_ICON_PATH);
+ _account_db_data_to_text(textbuf, &(account_record->icon_path));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_SOURCE);
+ _account_db_data_to_text(textbuf, &(account_record->source));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_PACKAGE_NAME);
+ _account_db_data_to_text(textbuf, &(account_record->package_name));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_ACCESS_TOKEN);
+ _account_db_data_to_text(textbuf, &(account_record->access_token));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_DOMAIN_NAME);
+ _account_db_data_to_text(textbuf, &(account_record->domain_name));
+
+ account_record->auth_type = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_AUTH_TYPE);
+
+ 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]));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_TEXT_1);
+ _account_db_data_to_text(textbuf, &(account_record->user_data_txt[1]));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_TEXT_2);
+ _account_db_data_to_text(textbuf, &(account_record->user_data_txt[2]));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_TEXT_3);
+ _account_db_data_to_text(textbuf, &(account_record->user_data_txt[3]));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_FIELD_USER_TEXT_4);
+ _account_db_data_to_text(textbuf, &(account_record->user_data_txt[4]));
+
+ account_record->user_data_int[0] = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_USER_INT_0);
+ account_record->user_data_int[1] = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_USER_INT_1);
+ account_record->user_data_int[2] = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_USER_INT_2);
+ account_record->user_data_int[3] = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_USER_INT_3);
+ account_record->user_data_int[4] = _account_query_table_column_int(hstmt, ACCOUNT_FIELD_USER_INT_4);
+
+ ACCOUNT_VERBOSE("END _account_convert_column_to_account");
+}
+
+static void _account_convert_column_to_capability(account_stmt hstmt, account_capability_s *capability_record)
+{
+ char *textbuf = NULL;
+
+ capability_record->id = _account_query_table_column_int(hstmt, CAPABILITY_FIELD_ID);
+
+ textbuf = _account_query_table_column_text(hstmt, CAPABILITY_FIELD_KEY);
+ _account_db_data_to_text(textbuf, &(capability_record->type));
+
+ capability_record->value = _account_query_table_column_int(hstmt, CAPABILITY_FIELD_VALUE);
+
+ textbuf = _account_query_table_column_text(hstmt, CAPABILITY_FIELD_PACKAGE_NAME);
+ _account_db_data_to_text(textbuf, &(capability_record->package_name));
+
+ textbuf = _account_query_table_column_text(hstmt, CAPABILITY_FIELD_USER_NAME);
+ _account_db_data_to_text(textbuf, &(capability_record->user_name));
+
+ capability_record->account_id = _account_query_table_column_int(hstmt, CAPABILITY_FIELD_ACCOUNT_ID);
+
+ ACCOUNT_VERBOSE("END _account_convert_column_to_capability");
+}
+
+static void _account_convert_column_to_custom(account_stmt hstmt, account_custom_s *custom_record)
+{
+ char *textbuf = NULL;
+
+ custom_record->account_id = _account_query_table_column_int(hstmt, ACCOUNT_CUSTOM_FIELD_ACCOUNT_ID);
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_CUSTOM_FIELD_APP_ID);
+ _account_db_data_to_text(textbuf, &(custom_record->app_id));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_CUSTOM_FIELD_KEY);
+ _account_db_data_to_text(textbuf, &(custom_record->key));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_CUSTOM_FIELD_VALUE);
+ _account_db_data_to_text(textbuf, &(custom_record->value));
+
+ ACCOUNT_VERBOSE("END _account_convert_column_to_custom");
+}
+
+bool _account_get_capability_text_cb(const char* capability_type, account_capability_state_e capability_value, void *user_data)
+{
+ account_s *data = (account_s*)user_data;
+
+ account_capability_s *cap_data = (account_capability_s*)malloc(sizeof(account_capability_s));
+
+ if (cap_data == NULL)
+ return FALSE;
+ ACCOUNT_MEMSET(cap_data, 0, sizeof(account_capability_s));
+
+ cap_data->type = _account_get_text(capability_type);
+ cap_data->value = capability_value;
+
+ data->capablity_list = g_slist_append(data->capablity_list, (gpointer)cap_data);
+
+ ACCOUNT_VERBOSE("_account_get_capability_text_cb :: %d\n", capability_type);
+
+ return TRUE;
+}
+
+
+bool _account_get_custom_text_cb(char* key, char* value, void *user_data)
+{
+ account_s *data = (account_s*)user_data;
+
+ account_custom_s *custom_data = (account_custom_s*)malloc(sizeof(account_custom_s));
+
+ if (custom_data == NULL) {
+ ACCOUNT_DEBUG("_account_get_custom_text_cb :: malloc fail\n");
+ return FALSE;
+ }
+ ACCOUNT_MEMSET(custom_data, 0, sizeof(account_custom_s));
+
+ custom_data->account_id = data->id;
+ custom_data->app_id = _account_get_text(data->package_name);
+ custom_data->key = _account_get_text(key);
+ custom_data->value = _account_get_text(value);
+
+ data->custom_list = g_slist_append(data->custom_list, (gpointer)custom_data);
+
+ return TRUE;
+}
+
+
+static char *_account_get_text(const char *text_data)
+{
+ char *text_value = NULL;
+
+ if (text_data != NULL) {
+ text_value = strdup(text_data);
+ ACCOUNT_VERBOSE("text_value = %s", text_value);
+ }
+ return text_value;
+}
+
+static int _account_update_account_by_user_name(account_s *account, char *user_name, char *package_name)
+{
+ int rc = 0, binding_count = 0, count = 0;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+
+ 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_ERROR("One field should be set among user name, display name, email address\n");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE user_name='%s' and package_name='%s'"
+ , ACCOUNT_TABLE, user_name, package_name);
+
+ count = _account_get_record_count(query);
+ if (count <= 0) {
+ ACCOUNT_INFO("_account_update_account_by_user_name : The account not exist!, count = %d, user_name=%s, package_name=%s\n",
+ count, user_name, package_name);
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ }
+
+ 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 =?, 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);
+
+ hstmt = _account_prepare_query(query);
+ ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_svc_query_prepare() failed(%s).\n", _account_db_err_msg()));
+
+ binding_count = _account_convert_account_to_sql(account, hstmt, query);
+
+ _account_query_bind_text(hstmt, binding_count++, user_name);
+ _account_query_bind_text(hstmt, binding_count++, package_name);
+ rc = _account_query_step(hstmt);
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_FATAL( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ }
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ /*update capability*/
+ error_code = _account_update_capability_by_user_name(account, user_name, package_name);
+
+ return error_code;
+}
+
+int account_insert_to_db(account_h account, int *account_id)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+ 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;
+
+ pthread_mutex_lock(&account_mutex);
+
+ if (_account_check_duplicated(data)) {
+ error_code = ACCOUNT_ERROR_DUPLICATED;
+ } else {
+ *account_id = _account_get_next_sequence(ACCOUNT_TABLE);
+
+ error_code = _account_execute_insert_query(data);
+
+ if (error_code != ACCOUNT_ERROR_NONE)
+ *account_id = -1;
+ }
+
+ ACCOUNT_VERBOSE( "_account_execute_insert_query, insert error_code : %d", error_code);
+
+ _account_insert_capability(data, *account_id);
+ _account_insert_custom(data, *account_id);
+
+ pthread_mutex_unlock(&account_mutex);
+ _account_insert_delete_update_notification_send(ACCOUNT_NOTI_NAME_INSERT);
+
+ return ACCOUNT_ERROR_NONE;
+
+}
+
+int account_create(account_h *account)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)malloc(sizeof(account_s));
+
+ if (data == NULL) {
+ ACCOUNT_FATAL("Memory Allocation Failed");
+ return ACCOUNT_ERROR_OUT_OF_MEMORY;
+ }
+ ACCOUNT_MEMSET(data, 0, sizeof(account_s));
+
+ ACCOUNT_VERBOSE("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_SYNC_NOT_SUPPORT;
+
+ *account = (account_h)data;
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_set_user_name(account_h account, const char *user_name)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!user_name) {
+ ACCOUNT_ERROR("(%s)-(%d) user_name is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ _ACCOUNT_FREE(data->user_name);
+ data->user_name = _account_get_text(user_name);
+
+ ACCOUNT_VERBOSE("(%s)-(%d) %s, %s\n", __FUNCTION__, __LINE__ , data->user_name, user_name);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_set_display_name(account_h account, const char *display_name)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!display_name) {
+ ACCOUNT_ERROR("(%s)-(%d) display_name is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ _ACCOUNT_FREE(data->display_name);
+ data->display_name = _account_get_text(display_name);
+
+ ACCOUNT_VERBOSE("(%s)-(%d) %s, %s\n", __FUNCTION__, __LINE__ , data->display_name, display_name);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_set_email_address(account_h account, const char *email_address)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!email_address) {
+ ACCOUNT_ERROR("(%s)-(%d) email_address is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ _ACCOUNT_FREE(data->email_address);
+ data->email_address = _account_get_text(email_address);
+
+ ACCOUNT_VERBOSE("(%s)-(%d) %s, %s\n", __FUNCTION__, __LINE__ , data->email_address, email_address);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_set_icon_path(account_h account, const char *icon_path)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!icon_path) {
+ ACCOUNT_ERROR("(%s)-(%d) icon_path is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ _ACCOUNT_FREE(data->icon_path);
+ data->icon_path = _account_get_text(icon_path);
+
+ ACCOUNT_VERBOSE("(%s)-(%d) %s, %s\n", __FUNCTION__, __LINE__ , data->icon_path, icon_path);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_set_source(account_h account, const char *source)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!source) {
+ ACCOUNT_ERROR("(%s)-(%d) source is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ account_s *data = (account_s*)account;
+
+ _ACCOUNT_FREE(data->source);
+ data->source = _account_get_text(source);
+
+ ACCOUNT_VERBOSE("(%s)-(%d) %s, %s\n", __FUNCTION__, __LINE__ , data->source, source);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_set_package_name(account_h account, const char *package_name)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!package_name) {
+ ACCOUNT_ERROR("(%s)-(%d) package_name is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ _ACCOUNT_FREE(data->package_name);
+ data->package_name = _account_get_text(package_name);
+
+ ACCOUNT_VERBOSE("(%s)-(%d) %s, %s\n", __FUNCTION__, __LINE__ , data->package_name, package_name);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_set_domain_name(account_h account, const char *domain_name)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!domain_name) {
+ ACCOUNT_ERROR("(%s)-(%d) domain_name is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ account_s *data = (account_s*)account;
+
+ _ACCOUNT_FREE(data->domain_name);
+ data->domain_name = _account_get_text(domain_name);
+
+ ACCOUNT_VERBOSE("(%s)-(%d) %s, %s\n", __FUNCTION__, __LINE__ , data->domain_name, domain_name);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_set_access_token(account_h account, const char *access_token)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!access_token) {
+ ACCOUNT_ERROR("(%s)-(%d) access_token is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ _ACCOUNT_FREE(data->access_token);
+ data->access_token = _account_get_text(access_token);
+
+ ACCOUNT_VERBOSE("(%s)-(%d) %s, %s\n", __FUNCTION__, __LINE__ , data->access_token, access_token);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_set_user_text(account_h account, int index, const char *user_txt)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!user_txt) {
+ ACCOUNT_ERROR("(%s)-(%d) user_txt is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ if (index >= USER_TXT_CNT || index < 0) {
+ ACCOUNT_ERROR("(%s)-(%d) index rage should be between 0-4.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ _ACCOUNT_FREE(data->user_data_txt[index]);
+ data->user_data_txt[index] = _account_get_text(user_txt);
+
+ ACCOUNT_VERBOSE("(%s)-(%d) %s, %s\n", __FUNCTION__, __LINE__ , data->user_data_txt[index], user_txt);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_set_custom(account_h account, const char* key, const char* value)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!key) {
+ ACCOUNT_ERROR("(%s)-(%d) key is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!value) {
+ ACCOUNT_ERROR("(%s)-(%d) value is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ GSList *iter;
+ bool b_is_new = TRUE;
+
+ for (iter = data->custom_list; iter != NULL; iter = g_slist_next(iter)) {
+
+ account_custom_s* custom_data = NULL;
+ custom_data = (account_custom_s*)iter->data;
+ ACCOUNT_VERBOSE( "account_custom_s->key = %s, account_custom_s->value = %s \n", custom_data->key, custom_data->value);
+
+ if(!strcmp(custom_data->key, key)) {
+ _ACCOUNT_FREE(custom_data->value);
+ custom_data->value = _account_get_text(value);
+ b_is_new = FALSE;
+ }
+ }
+
+ if(b_is_new) {
+ account_custom_s* custom_data = (account_custom_s*)malloc(sizeof(account_custom_s));
+
+ if (custom_data == NULL) {
+ ACCOUNT_FATAL("(%s)-(%d) MALLOC FAIL\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_OUT_OF_MEMORY;
+ }
+ ACCOUNT_MEMSET(custom_data, 0, sizeof(account_custom_s));
+ custom_data->account_id = data->id;
+ custom_data->app_id = _account_get_text(data->package_name);
+ custom_data->key = _account_get_text(key);
+ custom_data->value = _account_get_text(value);
+ data->custom_list = g_slist_append(data->custom_list, (gpointer)custom_data);
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_set_auth_type(account_h account, const account_auth_type_e auth_type)
+{
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__));
+
+ if ( (auth_type < 0) || (auth_type > ACCOUNT_AUTH_TYPE_CLIENT_LOGIN)) {
+ ACCOUNT_ERROR("(%s)-(%d) auth_type is less than 1 or more than enum max.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ data->auth_type = (int)auth_type;
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_set_secret(account_h account, const account_secrecy_state_e secret)
+{
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__));
+
+ if ( (secret < 0) || (secret > ACCOUNT_SECRECY_VISIBLE)) {
+ ACCOUNT_ERROR("(%s)-(%d) auth_type is less than 1 or more than enum max.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ data->secret = (int)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_ERROR("(%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) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (index >= USER_INT_CNT ||index < 0) {
+ ACCOUNT_ERROR("(%s)-(%d) index rage should be between 0-4.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ data->user_data_int[index] = user_int;
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_set_capability(account_h account, const char* capability_type, account_capability_state_e capability_value)
+{
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("account handle is null"));
+ ACCOUNT_RETURN_VAL((capability_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("capability_type is null"));
+
+ if ((capability_value != ACCOUNT_CAPABILITY_DISABLED) && (capability_value != ACCOUNT_CAPABILITY_ENABLED)) {
+ ACCOUNT_ERROR("(%s)-(%d) capability_value is not equal to 0 or 1.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ GSList *iter = NULL;
+ bool b_is_new = TRUE;
+
+ for(iter = data->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
+ account_capability_s *cap_data = NULL;
+ cap_data = (account_capability_s*)iter->data;
+
+ if(!strcmp(cap_data->type, capability_type)) {
+ cap_data->value = capability_value;
+ b_is_new = FALSE;
+ break;
+ }
+ }
+
+ if(b_is_new) {
+ account_capability_s* cap_data = (account_capability_s*)malloc(sizeof(account_capability_s));
+
+ if (cap_data == NULL)
+ return ACCOUNT_ERROR_OUT_OF_MEMORY;
+ ACCOUNT_MEMSET(cap_data, 0, sizeof(account_capability_s));
+
+ cap_data->type = _account_get_text(capability_type);
+ cap_data->value = capability_value;
+ data->capablity_list = g_slist_append(data->capablity_list, (gpointer)cap_data);
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_user_name(account_h account, char **user_name)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!user_name) {
+ ACCOUNT_ERROR("(%s)-(%d) user name is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ (*user_name) = NULL;
+ *user_name = _account_get_text(data->user_name);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_display_name(account_h account, char **display_name)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!display_name) {
+ ACCOUNT_ERROR("(%s)-(%d) display name is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ (*display_name) = NULL;
+
+ *display_name = _account_get_text(data->display_name);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_email_address(account_h account,char **email_address)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!email_address) {
+ ACCOUNT_ERROR("(%s)-(%d) email address is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ (*email_address) = NULL;
+
+ *email_address = _account_get_text(data->email_address);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_icon_path(account_h account, char **icon_path)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!icon_path) {
+ ACCOUNT_ERROR("(%s)-(%d) icon path is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ (*icon_path) = NULL;
+
+ *icon_path = _account_get_text(data->icon_path);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_source(account_h account, char **source)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!source) {
+ ACCOUNT_ERROR("(%s)-(%d) source is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ (*source) = NULL;
+
+ *source = _account_get_text(data->source);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_package_name(account_h account, char **package_name)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!package_name) {
+ ACCOUNT_ERROR("(%s)-(%d) package name is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ (*package_name) = NULL;
+
+ *package_name = _account_get_text(data->package_name);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_domain_name(account_h account, char **domain_name)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!domain_name) {
+ ACCOUNT_ERROR("(%s)-(%d) domain name is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ (*domain_name) = NULL;
+
+ *domain_name = _account_get_text(data->domain_name);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_access_token(account_h account, char **access_token)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!access_token) {
+ ACCOUNT_ERROR("(%s)-(%d) access token is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ (*access_token) = NULL;
+
+ *access_token = _account_get_text(data->access_token);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_user_text(account_h account, int user_text_index, char **text)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!text) {
+ ACCOUNT_ERROR("(%s)-(%d) text is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ ACCOUNT_RETURN_VAL((user_text_index >=0 && user_text_index < USER_TXT_CNT ), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("INVALID USER TEXT INDEX"));
+
+ account_s *data = (account_s*)account;
+
+ (*text) = NULL;
+
+ *text = _account_get_text(data->user_data_txt[user_text_index]);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_auth_type(account_h account, account_auth_type_e *auth_type)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ if (!auth_type) {
+ ACCOUNT_ERROR("(%s)-(%d) auth_type is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s* data = (account_s*)account;
+
+ *auth_type = data->auth_type;
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_secret(account_h account, account_secrecy_state_e *secret)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ if (!secret) {
+ ACCOUNT_ERROR("(%s)-(%d) secret is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s* data = (account_s*)account;
+
+ *secret = data->secret;
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_sync_support(account_h account, account_sync_state_e *sync_support)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ if (!sync_support) {
+ ACCOUNT_ERROR("(%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) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ if (!account_id) {
+ ACCOUNT_ERROR("(%s)-(%d) account_id is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ *account_id = data->id;
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_user_int(account_h account, int user_int_index, int *integer)
+{
+ if (!account) {
+ ACCOUNT_ERROR("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ ACCOUNT_RETURN_VAL((user_int_index >=0 && user_int_index < USER_TXT_CNT ), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("INVALID USER TEXT INDEX"));
+
+ if (!integer) {
+ ACCOUNT_ERROR("(%s)-(%d) integer is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_s *data = (account_s*)account;
+
+ *integer = data->user_data_int[user_int_index];
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_capability(account_h account, const char* capability_type, account_capability_state_e* capability_value)
+{
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+ ACCOUNT_RETURN_VAL((capability_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("capability_type is NULL"));
+ ACCOUNT_RETURN_VAL((capability_value != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("capability_value is NULL"));
+
+ GSList *iter;
+ account_s *data = (account_s*)account;
+
+ for (iter = data->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
+ account_capability_s *cap_data = NULL;
+
+ cap_data = (account_capability_s*)iter->data;
+
+ ACCOUNT_VERBOSE("account_get_capability :: type = %d, value = %d", cap_data->type, cap_data->value);
+
+ if(!strcmp(capability_type, cap_data->type)) {
+ *capability_value = cap_data->value;
+ return ACCOUNT_ERROR_NONE;
+ }
+ }
+
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+}
+
+int account_get_capability_all(account_h account, capability_cb cb_func, void *user_data)
+{
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+ ACCOUNT_RETURN_VAL((cb_func != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
+
+ GSList *iter;
+ account_s *data = (account_s*)account;
+
+ for (iter = data->capablity_list; iter != NULL; iter = g_slist_next(iter)) {
+ account_capability_s *cap_data = NULL;
+
+ cap_data = (account_capability_s*)iter->data;
+
+ ACCOUNT_VERBOSE("account_get_capability :: type = %d, value = %d", cap_data->type, cap_data->value);
+
+ cb_func(cap_data->type, cap_data->value, user_data);
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_get_custom(account_h account, const char* key, char** value)
+{
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+ ACCOUNT_RETURN_VAL((key != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO KEY TO REQUEST"));
+ ACCOUNT_RETURN_VAL((value != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("VALUE POINTER IS NULL"));
+
+ GSList *iter;
+ account_s *data = (account_s*)account;
+
+ for (iter = data->custom_list; iter != NULL; iter = g_slist_next(iter)) {
+ account_custom_s *custom_data = NULL;
+
+ custom_data = (account_custom_s*)iter->data;
+
+ ACCOUNT_VERBOSE("account_get_custom :: key = %s, value = %s", custom_data->key, custom_data->value);
+
+ if(!strcmp(key, custom_data->key)) {
+ (*value) = NULL;
+ *value = _account_get_text(custom_data->value);
+ return ACCOUNT_ERROR_NONE;
+ }
+ }
+
+ ACCOUNT_INFO("key is not found %s", key);
+
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+}
+
+int account_get_custom_all(account_h account, account_custom_cb cb_func, void* user_data)
+{
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+ ACCOUNT_RETURN_VAL((cb_func != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
+
+ GSList *iter;
+ account_s *data = (account_s*)account;
+
+ for (iter = data->custom_list; iter != NULL; iter = g_slist_next(iter)) {
+ bool cb_ret = FALSE;
+ account_custom_s *custom_data = NULL;
+
+ custom_data = (account_custom_s*)iter->data;
+
+ ACCOUNT_VERBOSE("account_get_custom :: key = %s, value = %s", custom_data->key, custom_data->value);
+
+ cb_ret = cb_func(custom_data->key, custom_data->value, user_data);
+ if(!cb_ret) {
+ ACCOUNT_INFO("account_get_custom_all callback func ret = %d", cb_ret);
+ break;
+ }
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_query_capability_by_account_id(capability_cb cb_func, int account_id, void *user_data )
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ 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"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ ret = _do_account_owner_existance_check();
+ if (ret != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("_do_account_owner_existance_check Failed !!!\n");
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE account_id = %d", CAPABILITY_TABLE, account_id);
+ hstmt = _account_prepare_query(query);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ account_capability_s* capability_record = NULL;
+
+ while (rc == SQLITE_ROW) {
+ capability_record = (account_capability_s*) malloc(sizeof(account_capability_s));
+
+ if (capability_record == NULL) {
+ ACCOUNT_FATAL("malloc Failed");
+ break;
+ }
+
+ ACCOUNT_MEMSET(capability_record, 0x00, sizeof(account_capability_s));
+
+ _account_convert_column_to_capability(hstmt, capability_record);
+
+ cb_func(capability_record->type, capability_record->value, user_data);
+
+ _account_free_capability_items(capability_record);
+ _ACCOUNT_FREE(capability_record);
+
+ rc = _account_query_step(hstmt);
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ error_code = ACCOUNT_ERROR_NONE;
+
+CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+ return error_code;
+}
+
+#define URUSA_TEST
+
+#ifdef URUSA_TEST
+static int _account_compare_old_record(account_s *new_account, int account_id)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0;
+ account_s *old_account = NULL;
+
+ ACCOUNT_RETURN_VAL((account_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0"));
+ ACCOUNT_RETURN_VAL((new_account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT IS NULL"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ old_account = (account_s*)calloc(1, sizeof(account_s));
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id = %d", ACCOUNT_TABLE, account_id);
+ hstmt = _account_prepare_query(query);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ while (rc == SQLITE_ROW) {
+ _account_convert_column_to_account(hstmt, old_account);
+ ACCOUNT_VERBOSE("get account info by id %p\n", old_account);
+ rc = _account_query_step(hstmt);
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ // get capability
+ error_code = account_query_capability_by_account_id(_account_get_capability_text_cb, old_account->id, (void*)old_account);
+
+ // get custom text
+ error_code = _account_query_custom_by_account_id(_account_get_custom_text_cb, old_account->id, (void*)old_account);
+
+
+ // compare
+
+ //user name
+ if(!new_account->user_name) {
+ if(old_account->user_name)
+ new_account->user_name = _account_get_text(old_account->user_name);
+ }
+
+ // display name
+ if(!new_account->display_name) {
+ if(old_account->display_name)
+ new_account->display_name = _account_get_text(old_account->display_name);
+ }
+
+ // email address
+ if(!new_account->email_address) {
+ if(old_account->email_address)
+ new_account->email_address = _account_get_text(old_account->email_address);
+ }
+
+ // icon path
+ if(!new_account->icon_path) {
+ if(old_account->icon_path)
+ new_account->icon_path = _account_get_text(old_account->icon_path);
+ }
+
+ // source
+ if(!new_account->source) {
+ if(old_account->source)
+ new_account->source = _account_get_text(old_account->source);
+ }
+
+ // package name
+ if(!new_account->package_name) {
+ if(old_account->package_name)
+ new_account->package_name = _account_get_text(old_account->package_name);
+ }
+
+ // access token
+ if(!new_account->access_token) {
+ if(old_account->access_token)
+ new_account->access_token = _account_get_text(old_account->access_token);
+ }
+
+ // user text
+ int i;
+ for(i=0;i<USER_TXT_CNT;i++) {
+ if(!new_account->user_data_txt[i]) {
+ if(old_account->user_data_txt[i])
+ new_account->user_data_txt[i] = _account_get_text(old_account->user_data_txt[i]);
+ }
+ }
+
+ // auth type
+ if(new_account->auth_type == ACCOUNT_AUTH_TYPE_INVALID) {
+ new_account->auth_type = old_account->auth_type;
+ }
+
+ //secret
+ if(new_account->secret== ACCOUNT_SECRECY_INVALID) {
+ new_account->secret = old_account->secret;
+ }
+
+ // sync support
+ if(new_account->sync_support == ACCOUNT_SYNC_INVALID) {
+ new_account->sync_support = old_account->sync_support;
+ }
+
+ // user int
+ for(i=0;i<USER_INT_CNT;i++) {
+ if(new_account->user_data_int[i] == 0) {
+ new_account->user_data_int[i] = old_account->user_data_int[i];
+ }
+ }
+
+ // capability
+
+ // user custom table
+
+
+
+ CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+
+ if (old_account) {
+ _account_free_account_items(old_account);
+ _ACCOUNT_FREE(old_account);
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+#endif
+
+static int _account_update_account(account_s *account, int account_id)
+{
+ int rc = 0, binding_count =0;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int error_code = ACCOUNT_ERROR_NONE, count=0;
+ account_stmt hstmt = NULL;
+
+
+#ifdef URUSA_TEST
+ _account_compare_old_record(account, account_id);
+#endif
+
+ if (!account->package_name) {
+ ACCOUNT_ERROR("Package name is mandetory field, it can not be NULL!!!!\n");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!account->user_name && !account->display_name && !account->email_address) {
+ ACCOUNT_ERROR("One field should be set among user name, display name, email address\n");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE _id = %d ", ACCOUNT_TABLE, account_id);
+
+ count = _account_get_record_count(query);
+ if (count <= 0) {
+ ACCOUNT_WARNING(" Account record not found, count = %d\n", count);
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ }
+
+ 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 =?, 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);
+
+ hstmt = _account_prepare_query(query);
+ ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_svc_query_prepare() failed(%s).\n", _account_db_err_msg()));
+
+ binding_count = _account_convert_account_to_sql(account, hstmt, query);
+ _account_query_bind_int(hstmt, binding_count++, account_id);
+
+ rc = _account_query_step(hstmt);
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_DEBUG( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ /*update capability*/
+ error_code = _account_update_capability(account, account_id);
+
+ /* update custom */
+ error_code = _account_update_custom(account, account_id);
+
+ return error_code;
+}
+
+int account_update_to_db_by_id(const account_h account, int account_id)
+{
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("DATA IS NULL"));
+ ACCOUNT_RETURN_VAL((account_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Account id is not valid"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_s* data = (account_s*)account;
+
+ pthread_mutex_lock(&account_mutex);
+
+ error_code = _account_update_account(data, account_id);
+
+ if(error_code != ACCOUNT_ERROR_NONE) {
+ pthread_mutex_unlock(&account_mutex);
+ return error_code;
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+ _account_insert_delete_update_notification_send(ACCOUNT_NOTI_NAME_UPDATE);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name)
+{
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("DATA IS NULL"));
+ ACCOUNT_RETURN_VAL((user_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("USER NAME IS NULL"));
+ ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("PACKAGE NAME IS NULL"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_s *data = (account_s*)account;
+
+ pthread_mutex_lock(&account_mutex);
+
+ error_code = _account_update_account_by_user_name(data, (char*)user_name, (char*)package_name);
+
+ pthread_mutex_unlock(&account_mutex);
+ _account_insert_delete_update_notification_send(ACCOUNT_NOTI_NAME_UPDATE);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_foreach_account_from_db(account_cb callback, void *user_data)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0;
+ GList *account_list = NULL;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INFO IS NULL"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ ret = _do_account_owner_existance_check();
+ if (ret != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_WARNING("_do_account_owner_existance_check Failed !!!\n");
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s ", ACCOUNT_TABLE);
+ hstmt = _account_prepare_query(query);
+
+ rc = _account_query_step(hstmt);
+
+ account_s *account_record = NULL;
+
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ int k=0;
+ while(rc == SQLITE_ROW) {
+ account_record = (account_s*) malloc(sizeof(account_s));
+
+ if (account_record == NULL) {
+ ACCOUNT_FATAL("malloc Failed");
+ break;
+ }
+
+ ACCOUNT_MEMSET(account_record, 0x00, sizeof(account_s));
+ _account_convert_column_to_account(hstmt, account_record);
+ account_list = g_list_append(account_list, account_record);
+ rc = _account_query_step(hstmt);
+ k++;
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ GList* iter;
+ k = 0;
+ for (iter = account_list; iter != NULL; iter = g_list_next(iter)) {
+ account_s *account = NULL;
+ account = (account_s*)iter->data;
+ account_query_capability_by_account_id(_account_get_capability_text_cb, account->id, (void*)account);
+ _account_query_custom_by_account_id(_account_get_custom_text_cb, account->id, (void*)account);
+ callback((account_h)account, user_data);
+ k++;
+ }
+
+ error_code = ACCOUNT_ERROR_NONE;
+
+CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+ if (account_list) {
+ _account_glist_free(account_list);
+ account_list = NULL;
+ }
+
+ return error_code;
+}
+
+int account_update_sync_status_by_id(int account_db_id, const account_sync_state_e sync_status)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0;
+ int count =1;
+
+ ACCOUNT_RETURN_VAL((account_db_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INDEX IS LESS THAN 0"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+ if ( (sync_status < 0) || (sync_status > ACCOUNT_SYNC_STATUS_RUNNING)) {
+ ACCOUNT_ERROR("(%s)-(%d) sync_status is less than 0 or more than enum max.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ pthread_mutex_lock(&account_mutex);
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where _id=%d", ACCOUNT_TABLE, account_db_id);
+
+ rc = _account_get_record_count(query);
+
+ if (rc <= 0) {
+ ACCOUNT_ERROR( "account_update_sync_status_by_id : related account item is not existed rc=%d , %s", rc, _account_db_err_msg());
+ pthread_mutex_unlock(&account_mutex);
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "UPDATE %s SET sync_support=? WHERE _id = %d", ACCOUNT_TABLE, account_db_id);
+ hstmt = _account_prepare_query(query);
+
+ _account_query_bind_int(hstmt, count, (int)sync_status);
+
+ rc = _account_query_step(hstmt);
+
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg()));
+
+ _account_query_finalize(hstmt);
+
+ _account_insert_delete_update_notification_send(ACCOUNT_NOTI_NAME_SYNC_UPDATE);
+
+ hstmt = NULL;
+ error_code = ACCOUNT_ERROR_NONE;
+
+CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+ return error_code;
+}
+
+int account_query_account_by_account_id(int account_db_id, account_h *account)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ 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"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ ret = _do_account_owner_existance_check();
+ if (ret != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_WARNING("_do_account_owner_existance_check Failed !!!\n");
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id = %d", ACCOUNT_TABLE, account_db_id);
+ hstmt = _account_prepare_query(query);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ account_s *account_record = (account_s *)(*account);
+
+ while (rc == SQLITE_ROW) {
+ _account_convert_column_to_account(hstmt, account_record);
+ ACCOUNT_VERBOSE("get account info by id %p\n", account_record);
+ rc = _account_query_step(hstmt);
+ }
+
+ _account_query_finalize(hstmt);
+ account_query_capability_by_account_id(_account_get_capability_text_cb, account_record->id, (void*)account_record);
+ _account_query_custom_by_account_id(_account_get_custom_text_cb, account_record->id, (void*)account_record);
+
+ hstmt = NULL;
+ error_code = ACCOUNT_ERROR_NONE;
+
+CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+ return error_code;
+}
+
+int account_query_account_by_user_name(account_cb cb_func, const char *user_name, void *user_data)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ 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;
+
+
+ ret = _do_account_owner_existance_check();
+ if (ret != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_WARNING("_do_account_owner_existance_check Failed !!!\n");
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE user_name = ?", ACCOUNT_TABLE);
+
+ hstmt = _account_prepare_query(query);
+
+ int binding_count = 1;
+ _account_query_bind_text(hstmt, binding_count++, user_name);
+
+ rc = _account_query_step(hstmt);
+
+ account_s *account_head = NULL;
+
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ int tmp = 0;
+
+ account_head = (account_s*) malloc(sizeof(account_s));
+ if (account_head == NULL) {
+ ACCOUNT_FATAL("malloc Failed");
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+ return ACCOUNT_ERROR_OUT_OF_MEMORY;
+ }
+ ACCOUNT_MEMSET(account_head, 0x00, sizeof(account_s));
+
+ while (rc == SQLITE_ROW) {
+ account_s* account_record = NULL;
+
+ account_record = (account_s*) malloc(sizeof(account_s));
+
+ if (account_record == NULL) {
+ ACCOUNT_FATAL("malloc Failed");
+ break;
+ }
+ ACCOUNT_MEMSET(account_record, 0x00, sizeof(account_s));
+
+ _account_convert_column_to_account(hstmt, account_record);
+
+ account_head->account_list = g_list_append(account_head->account_list, account_record);
+
+ rc = _account_query_step(hstmt);
+ tmp++;
+ ACCOUNT_DEBUG("DETECTED COUNT %d\n", tmp);
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ GList *iter;
+
+
+ tmp = g_list_length(account_head->account_list);
+ ACCOUNT_VERBOSE("GLIST LEN %d\n", tmp);
+
+ for (iter = account_head->account_list; iter != NULL; iter = g_list_next(iter)) {
+ account_h account;
+ account = (account_h)iter->data;
+
+ account_s *testaccount = (account_s*)account;
+
+ ACCOUNT_VERBOSE("id = %d", testaccount->id);
+ ACCOUNT_VERBOSE("user_name = %s", testaccount->user_name);
+ ACCOUNT_VERBOSE("email_address = %s", testaccount->email_address);
+ ACCOUNT_VERBOSE("display_name = %s", testaccount->display_name);
+ ACCOUNT_VERBOSE("icon_path = %s", testaccount->icon_path);
+ ACCOUNT_VERBOSE("source = %s", testaccount->source);
+ ACCOUNT_VERBOSE("package_name = %s", testaccount->package_name);
+ ACCOUNT_VERBOSE("access_token = %s", testaccount->access_token);
+ ACCOUNT_VERBOSE("domain_name = %s", testaccount->domain_name);
+ ACCOUNT_VERBOSE("auth_type = %d", testaccount->auth_type);
+ ACCOUNT_VERBOSE("secret = %d", testaccount->secret);
+ ACCOUNT_VERBOSE("sync_support = %d", testaccount->sync_support);
+
+ account_query_capability_by_account_id(_account_get_capability_text_cb, testaccount->id, (void*)testaccount);
+ _account_query_custom_by_account_id(_account_get_custom_text_cb, testaccount->id, (void*)testaccount);
+
+ ACCOUNT_VERBOSE("capability_list address = %p", testaccount->capablity_list);
+
+ cb_func(account, user_data);
+
+ }
+
+ error_code = ACCOUNT_ERROR_NONE;
+
+CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+ if (account_head) {
+ if (account_head->account_list) {
+ _account_glist_free(account_head->account_list);
+ account_head->account_list = NULL;
+ _account_free_account_items(account_head);
+ }
+ _ACCOUNT_FREE(account_head);
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+ return error_code;
+}
+
+int account_query_account_by_capability(account_cb cb_func, const char* capability_type, account_capability_state_e capability_value, void* user_data)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ACCOUNT_RETURN_VAL((capability_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("capability_type IS NULL"));
+
+ if ((capability_value < 0) || (capability_value > ACCOUNT_CAPABILITY_ENABLED)) {
+ ACCOUNT_ERROR("(%s)-(%d) capability_value is not equal to 0 or 1.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ ACCOUNT_RETURN_VAL((cb_func != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("CALL BACK IS NULL"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ ret = _do_account_owner_existance_check();
+ if (ret != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_WARNING("_do_account_owner_existance_check Failed !!!\n");
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE _id IN (SELECT account_id from %s WHERE key=? AND value=?)", ACCOUNT_TABLE, CAPABILITY_TABLE);
+
+ hstmt = _account_prepare_query(query);
+
+ int binding_count = 1;
+ _account_query_bind_text(hstmt, binding_count++, (char*)capability_type);
+ _account_query_bind_int(hstmt, binding_count++, (int)capability_value);
+
+ rc = _account_query_step(hstmt);
+
+ account_s* account_head = NULL;
+
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ int tmp = 0;
+
+ account_head = (account_s*) malloc(sizeof(account_s));
+ if (account_head == NULL) {
+ ACCOUNT_FATAL("malloc Failed");
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+ return ACCOUNT_ERROR_OUT_OF_MEMORY;
+ }
+ ACCOUNT_MEMSET(account_head, 0x00, sizeof(account_s));
+
+ while (rc == SQLITE_ROW) {
+ account_s* account_record = NULL;
+
+ account_record = (account_s*) malloc(sizeof(account_s));
+
+ if (account_record == NULL) {
+ ACCOUNT_FATAL("malloc Failed");
+ break;
+ }
+ ACCOUNT_MEMSET(account_record, 0x00, sizeof(account_s));
+
+ _account_convert_column_to_account(hstmt, account_record);
+
+ account_head->account_list = g_list_append(account_head->account_list, account_record);
+
+ rc = _account_query_step(hstmt);
+ tmp++;
+ ACCOUNT_VERBOSE("DETECTED COUNT %d\n", tmp);
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ GList *iter;
+
+
+ tmp = g_list_length(account_head->account_list);
+ ACCOUNT_VERBOSE("GLIST LEN %d\n", tmp);
+
+ for (iter = account_head->account_list; iter != NULL; iter = g_list_next(iter)) {
+ account_h account = NULL;
+ account = (account_h)iter->data;
+
+
+ account_s* testaccount = (account_s*)account;
+
+ ACCOUNT_VERBOSE("id = %d", testaccount->id);
+ ACCOUNT_VERBOSE("user_name = %s", testaccount->user_name);
+ ACCOUNT_VERBOSE("email_address = %s", testaccount->email_address);
+ ACCOUNT_VERBOSE("display_name = %s", testaccount->display_name);
+ ACCOUNT_VERBOSE("icon_path = %s", testaccount->icon_path);
+ ACCOUNT_VERBOSE("source = %s", testaccount->source);
+ ACCOUNT_VERBOSE("package_name = %s", testaccount->package_name);
+ ACCOUNT_VERBOSE("access_token = %s", testaccount->access_token);
+ ACCOUNT_VERBOSE("domain_name = %s", testaccount->domain_name);
+ ACCOUNT_VERBOSE("auth_type = %d", testaccount->auth_type);
+ ACCOUNT_VERBOSE("secret = %d", testaccount->secret);
+ ACCOUNT_VERBOSE("sync_support = %d", testaccount->sync_support);
+
+ account_query_capability_by_account_id(_account_get_capability_text_cb, testaccount->id, (void*)testaccount);
+ _account_query_custom_by_account_id(_account_get_custom_text_cb, testaccount->id, (void*)testaccount);
+
+ ACCOUNT_VERBOSE("capability_list address = %p", testaccount->capablity_list);
+
+ cb_func(account, user_data);
+
+ }
+
+
+ error_code = ACCOUNT_ERROR_NONE;
+
+CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+ if (account_head) {
+ if (account_head->account_list) {
+ _account_glist_free(account_head->account_list);
+ account_head->account_list = NULL;
+ _account_free_account_items(account_head);
+ }
+ _ACCOUNT_FREE(account_head);
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+ return error_code;
+}
+
+int account_query_account_by_package_name(account_cb cb_func, const char* package_name, void* user_data)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0;
+ int ret = ACCOUNT_ERROR_NONE;
+
+ ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("PACKAGE NAME IS NULL"));
+ ACCOUNT_RETURN_VAL((cb_func != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("CALL BACK IS NULL"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ ret = _do_account_owner_existance_check();
+ if (ret != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("_do_account_owner_existance_check Failed !!!\n");
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE package_name=?", ACCOUNT_TABLE);
+
+ hstmt = _account_prepare_query(query);
+
+ int binding_count = 1;
+ _account_query_bind_text(hstmt, binding_count++, package_name);
+
+ rc = _account_query_step(hstmt);
+
+ account_s* account_head = NULL;
+
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ int tmp = 0;
+
+ account_head = (account_s*) malloc(sizeof(account_s));
+ if (account_head == NULL) {
+ ACCOUNT_FATAL("malloc Failed");
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+ return ACCOUNT_ERROR_OUT_OF_MEMORY;
+ }
+ ACCOUNT_MEMSET(account_head, 0x00, sizeof(account_s));
+
+ while (rc == SQLITE_ROW) {
+ account_s* account_record = NULL;
+
+ account_record = (account_s*) malloc(sizeof(account_s));
+
+ if (account_record == NULL) {
+ ACCOUNT_FATAL("malloc Failed");
+ break;
+ }
+ ACCOUNT_MEMSET(account_record, 0x00, sizeof(account_s));
+
+ _account_convert_column_to_account(hstmt, account_record);
+
+ account_head->account_list = g_list_append(account_head->account_list, account_record);
+
+ rc = _account_query_step(hstmt);
+ tmp++;
+ ACCOUNT_VERBOSE("DETECTED COUNT %d\n", tmp);
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ GList *iter;
+
+ tmp = g_list_length(account_head->account_list);
+ ACCOUNT_DEBUG("GLIST LEN %d\n", tmp);
+
+ for (iter = account_head->account_list; iter != NULL; iter = g_list_next(iter)) {
+ account_h account = NULL;
+ account = (account_h)iter->data;
+
+ account_s* testaccount = (account_s*)account;
+
+ ACCOUNT_VERBOSE("id = %d", testaccount->id);
+ ACCOUNT_VERBOSE("user_name = %s", testaccount->user_name);
+ ACCOUNT_VERBOSE("email_address = %s", testaccount->email_address);
+ ACCOUNT_VERBOSE("display_name = %s", testaccount->display_name);
+ ACCOUNT_VERBOSE("icon_path = %s", testaccount->icon_path);
+ ACCOUNT_VERBOSE("source = %s", testaccount->source);
+ ACCOUNT_VERBOSE("package_name = %s", testaccount->package_name);
+ ACCOUNT_VERBOSE("access_token = %s", testaccount->access_token);
+ ACCOUNT_VERBOSE("domain_name = %s", testaccount->domain_name);
+ ACCOUNT_VERBOSE("auth_type = %d", testaccount->auth_type);
+ ACCOUNT_VERBOSE("secret = %d", testaccount->secret);
+ ACCOUNT_VERBOSE("sync_support = %d", testaccount->sync_support);
+
+ account_query_capability_by_account_id(_account_get_capability_text_cb, testaccount->id, (void*)testaccount);
+ _account_query_custom_by_account_id(_account_get_custom_text_cb, testaccount->id, (void*)testaccount);
+
+ ACCOUNT_VERBOSE("capability_list address = %p", testaccount->capablity_list);
+
+ cb_func(account, user_data);
+
+ }
+
+ error_code = ACCOUNT_ERROR_NONE;
+
+CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+ if (account_head) {
+ if (account_head->account_list) {
+ _account_glist_free(account_head->account_list);
+ account_head->account_list = NULL;
+ _account_free_account_items(account_head);
+ }
+ _ACCOUNT_FREE(account_head);
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+ return error_code;
+}
+
+int account_delete(int account_id)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0, count = -1;
+ int ret_transaction = 0;
+ bool is_success = FALSE;
+
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ /* Check requested ID to delete */
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE _id=%d", ACCOUNT_TABLE, account_id);
+
+ count = _account_get_record_count(query);
+ if (count <= 0) {
+ ACCOUNT_ERROR("account id(%d) is not exist. count(%d)\n", account_id, count);
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ }
+
+ /* transaction control required*/
+ ret_transaction = _account_begin_transaction();
+
+ if (ret_transaction != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("account_delete:_account_begin_transaction fail %d\n", ret_transaction);
+ pthread_mutex_unlock(&account_mutex);
+ return ret_transaction;
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE account_id = %d", CAPABILITY_TABLE, account_id);
+
+ hstmt = _account_prepare_query(query);
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE _id = %d", ACCOUNT_TABLE, account_id);
+
+ hstmt = _account_prepare_query(query);
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found. id=%d, rc=%d\n", account_id, rc));
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ /* delete custom data */
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AccountId = %d", ACCOUNT_CUSTOM_TABLE, account_id);
+
+ hstmt = _account_prepare_query(query);
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found. id=%d, rc=%d\n", account_id, rc));
+
+ _account_query_finalize(hstmt);
+
+ is_success = TRUE;
+
+CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+
+ ret_transaction = _account_end_transaction(is_success);
+
+ if (ret_transaction != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("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_notification_send(ACCOUNT_NOTI_NAME_DELETE);
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+
+ return error_code;
+
+}
+
+int account_delete_from_db_by_id(int account_db_id)
+{
+ ACCOUNT_RETURN_VAL((account_db_id > 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT ID IS LESS THAN ZERO."));
+
+ return account_delete(account_db_id);
+}
+
+static int _account_query_account_by_username_and_package(const char* username, const char* package_name, account_h *account)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0;
+ int ret = ACCOUNT_ERROR_NONE;
+ int binding_count = 1;
+
+ ACCOUNT_RETURN_VAL((username != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("username IS NULL"));
+ ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name IS NULL"));
+ ACCOUNT_RETURN_VAL((*account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT IS NULL"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ ret = _do_account_owner_existance_check();
+ if (ret != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_WARNING("_do_account_owner_existance_check Failed !!!\n");
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE user_name = ? and package_name = ?", ACCOUNT_TABLE);
+ hstmt = _account_prepare_query(query);
+
+ _account_query_bind_text(hstmt, binding_count++, username);
+ _account_query_bind_text(hstmt, binding_count++, package_name);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ account_s *account_record = (account_s *)(*account);
+
+ while (rc == SQLITE_ROW) {
+ _account_convert_column_to_account(hstmt, account_record);
+ ACCOUNT_VERBOSE("get account info by id %p\n", account_record);
+ rc = _account_query_step(hstmt);
+ }
+
+ _account_query_finalize(hstmt);
+ account_query_capability_by_account_id(_account_get_capability_text_cb, account_record->id, (void*)account_record);
+ _account_query_custom_by_account_id(_account_get_custom_text_cb, account_record->id, (void*)account_record);
+
+ hstmt = NULL;
+ error_code = ACCOUNT_ERROR_NONE;
+
+CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+ return error_code;
+}
+
+int account_delete_from_db_by_user_name(char *user_name, char *package_name)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0;
+ int ret_transaction = 0;
+ bool is_success = FALSE;
+ account_h account = NULL;
+ int binding_count = 1;
+ int account_id = -1;
+
+ ACCOUNT_RETURN_VAL((user_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("user_name is null!"));
+ ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name is null!"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ rc = account_create(&account);
+ rc = _account_query_account_by_username_and_package(user_name, package_name, &account);
+
+ rc = account_get_account_id(account, &account_id);
+
+ rc = account_destroy(account);
+
+ /* transaction control required*/
+ ret_transaction = _account_begin_transaction();
+
+ if (ret_transaction != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("account_delete:_account_begin_transaction fail %d\n", ret_transaction);
+ pthread_mutex_unlock(&account_mutex);
+ return ret_transaction;
+ }
+
+ /* delete custom data */
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AccountId = ?", ACCOUNT_CUSTOM_TABLE);
+
+ hstmt = _account_prepare_query(query);
+
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ _account_query_bind_int(hstmt, binding_count++, account_id);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ /* delete capability */
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE user_name = ? and package_name = ?", CAPABILITY_TABLE);
+
+ hstmt = _account_prepare_query(query);
+
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ binding_count = 1;
+ _account_query_bind_text(hstmt, binding_count++, user_name);
+ _account_query_bind_text(hstmt, binding_count++, package_name);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE user_name = ? and package_name = ?", ACCOUNT_TABLE);
+
+ hstmt = _account_prepare_query(query);
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ binding_count = 1;
+ _account_query_bind_text(hstmt, binding_count++, user_name);
+ _account_query_bind_text(hstmt, binding_count++, package_name);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found. user_name=%s, package_name=%s, rc=%d\n", user_name, package_name, rc));
+
+ _account_query_finalize(hstmt);
+ is_success = TRUE;
+
+ hstmt = NULL;
+
+CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+
+ ret_transaction = _account_end_transaction(is_success);
+
+ if (ret_transaction != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("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_notification_send(ACCOUNT_NOTI_NAME_DELETE);
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+
+ return error_code;
+}
+
+int account_delete_from_db_by_package_name(char *package_name)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0;
+ int ret_transaction = 0;
+ bool is_success = FALSE;
+ int binding_count = 1;
+
+ ACCOUNT_RETURN_VAL((package_name != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("package_name is null!"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ /* transaction control required*/
+ ret_transaction = _account_begin_transaction();
+
+ if (ret_transaction != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("account_delete:_account_begin_transaction fail %d\n", ret_transaction);
+ pthread_mutex_unlock(&account_mutex);
+ return ret_transaction;
+ }
+
+ /* delete custom table */
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AppId = ?", ACCOUNT_CUSTOM_TABLE);
+
+ hstmt = _account_prepare_query(query);
+
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ binding_count = 1;
+ _account_query_bind_text(hstmt, binding_count++, package_name);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ /* delete capability table */
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE package_name = ?", CAPABILITY_TABLE);
+
+ hstmt = _account_prepare_query(query);
+
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ binding_count = 1;
+ _account_query_bind_text(hstmt, binding_count++, package_name);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ /* delete account table */
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE package_name = ?", ACCOUNT_TABLE);
+
+ hstmt = _account_prepare_query(query);
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ binding_count = 1;
+ _account_query_bind_text(hstmt, binding_count++, package_name);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found. package_name=%s, rc=%d\n", package_name, rc));
+
+ _account_query_finalize(hstmt);
+ is_success = TRUE;
+
+ hstmt = NULL;
+
+CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+
+ ret_transaction = _account_end_transaction(is_success);
+
+ if (ret_transaction != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_ERROR("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_notification_send(ACCOUNT_NOTI_NAME_DELETE);
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+
+ return error_code;
+}
+
+int account_get_total_count_from_db(int *count)
+{
+ if (!count) {
+ ACCOUNT_ERROR("(%s)-(%d) count is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ int ret = ACCOUNT_ERROR_NONE;
+ char query[1024] = {0, };
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "select count(*) from %s", ACCOUNT_TABLE);
+
+ ret = _do_account_owner_existance_check();
+ if (ret != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_WARNING("_do_account_owner_existance_check Failed !!!\n");
+ }
+
+ *count = _account_get_record_count(query);
+ int rc = -1;
+ int ncount = 0;
+ account_stmt pStmt = NULL;
+
+ assert(NULL != g_hAccountDB);
+ rc = sqlite3_prepare_v2(g_hAccountDB, query, strlen(query), &pStmt, NULL);
+
+ rc = sqlite3_step(pStmt);
+ if (SQLITE_ROW != rc) {
+ ACCOUNT_ERROR("[ERROR] sqlite3_step() failed\n");
+ sqlite3_finalize(pStmt);
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ ncount = sqlite3_column_int(pStmt, 0);
+
+ *count = ncount;
+
+ ACCOUNT_VERBOSE("Number of account : %d", ncount);
+ sqlite3_finalize(pStmt);
+
+ if (ncount < 0) {
+ ACCOUNT_ERROR("[ERROR] Number of account : %d, End", ncount);
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_destroy(account_h account)
+{
+ account_s *data = (account_s*)account;
+
+ ACCOUNT_RETURN_VAL((data != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Account handle is null!"));
+
+ ACCOUNT_INFO("destroy handle=%p\n", data);
+
+ _account_free_account_items(data);
+ _ACCOUNT_FREE(data);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_type_free_label_items(label_s *data)
+{
+ _ACCOUNT_FREE(data->app_id);
+ _ACCOUNT_FREE(data->label);
+ _ACCOUNT_FREE(data->locale);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_type_gslist_free(GSList* list)
+{
+ ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("GSlist is NULL"));
+
+ GSList* iter;
+
+ for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
+ label_s *label_data = (label_s*)iter->data;
+ _account_type_free_label_items(label_data);
+ _ACCOUNT_FREE(label_data);
+ }
+
+ g_slist_free(list);
+ list = NULL;
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_type_item_free(account_type_s *data)
+{
+ _ACCOUNT_FREE(data->app_id);
+ _ACCOUNT_FREE(data->service_provider_id);
+ _ACCOUNT_FREE(data->icon_path);
+ _ACCOUNT_FREE(data->small_icon_path);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_type_glist_free(GList* list)
+{
+ ACCOUNT_RETURN_VAL((list != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Glist is NULL"));
+
+ GList* iter;
+
+ for (iter = list; iter != NULL; iter = g_list_next(iter)) {
+ account_type_s *account_type_record = (account_type_s*)iter->data;
+ _account_type_item_free(account_type_record);
+ _ACCOUNT_FREE(account_type_record);
+ }
+
+ g_list_free(list);
+ list = NULL;
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_type_free_account_type_items(account_type_s *data)
+{
+ _account_type_item_free(data);
+
+ _account_type_gslist_free(data->label_list);
+ _account_type_glist_free(data->account_type_list);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_type_create(account_type_h *account_type)
+{
+ if (!account_type) {
+ ACCOUNT_ERROR("(%s)-(%d) account type handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_type_s *data = (account_type_s*)malloc(sizeof(account_type_s));
+
+ if (data == NULL) {
+ ACCOUNT_ERROR("Memory Allocation Failed");
+ return ACCOUNT_ERROR_OUT_OF_MEMORY;
+ }
+
+ ACCOUNT_MEMSET(data, 0, sizeof(account_type_s));
+
+ ACCOUNT_VERBOSE("create handle=%p\n", *account_type);
+
+ *account_type = (account_type_h)data;
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_type_destroy(account_type_h account_type)
+{
+ account_type_s *data = (account_type_s*)account_type;
+
+ ACCOUNT_RETURN_VAL((data != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Account type handle is null!"));
+
+ ACCOUNT_VERBOSE("destroy handle=%p\n", data);
+
+ _account_type_free_account_type_items(data);
+ _ACCOUNT_FREE(data);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+//app_id mandatory field
+int account_type_set_app_id(account_type_h account_type, const char *app_id)
+{
+ if (!account_type) {
+ ACCOUNT_ERROR("(%s)-(%d) account_type handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!app_id) {
+ ACCOUNT_ERROR("(%s)-(%d) app_id is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_type_s *data = (account_type_s*)account_type;
+
+ _ACCOUNT_FREE(data->app_id);
+ data->app_id = _account_get_text(app_id);
+
+ ACCOUNT_VERBOSE("(%s)-(%d) %s, %s\n", __FUNCTION__, __LINE__ , data->app_id, app_id);
+ return ACCOUNT_ERROR_NONE;
+}
+
+//service_provider_id mandatory field
+int account_type_set_service_provider_id(account_type_h account_type, const char *service_provider_id)
+{
+ if (!account_type) {
+ ACCOUNT_ERROR("(%s)-(%d) account_type handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!service_provider_id) {
+ ACCOUNT_ERROR("(%s)-(%d) service_provider_id is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_type_s *data = (account_type_s*)account_type;
+
+ _ACCOUNT_FREE(data->service_provider_id);
+ data->service_provider_id = _account_get_text(service_provider_id);
+
+ ACCOUNT_VERBOSE("(%s)-(%d) %s, %s\n", __FUNCTION__, __LINE__ , data->service_provider_id, service_provider_id);
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_type_set_icon_path(account_type_h account_type, const char *icon_path)
+{
+ if (!account_type) {
+ ACCOUNT_ERROR("(%s)-(%d) account_type handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!icon_path) {
+ ACCOUNT_ERROR("(%s)-(%d) icon_path is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_type_s *data = (account_type_s*)account_type;
+
+ _ACCOUNT_FREE(data->icon_path);
+ data->icon_path = _account_get_text(icon_path);
+
+ ACCOUNT_VERBOSE("(%s)-(%d) %s, %s\n", __FUNCTION__, __LINE__ , data->icon_path, icon_path);
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_type_set_small_icon_path(account_type_h account_type, const char *small_icon_path)
+{
+ if (!account_type) {
+ ACCOUNT_ERROR("(%s)-(%d) account_type handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!small_icon_path) {
+ ACCOUNT_ERROR("(%s)-(%d) small_icon_path is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_type_s *data = (account_type_s*)account_type;
+
+ _ACCOUNT_FREE(data->small_icon_path);
+ data->small_icon_path = _account_get_text(small_icon_path);
+
+ ACCOUNT_VERBOSE("(%s)-(%d) %s, %s\n", __FUNCTION__, __LINE__ , data->small_icon_path, small_icon_path);
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_type_set_multiple_account_support(account_type_h account_type, const bool multiple_account_support)
+{
+ ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("(%s)-(%d) account handle is NULL.\n", __FUNCTION__, __LINE__));
+
+ account_type_s *data = (account_type_s*)account_type;
+
+ data->multiple_account_support = multiple_account_support;
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+// unset?
+int account_type_set_label(account_type_h account_type, const char* label, const char* locale)
+{
+ if (!account_type) {
+ ACCOUNT_ERROR("(%s)-(%d) account_type handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if(!label || !locale) {
+ ACCOUNT_ERROR("(%s)-(%d) label(%p) or locale(%p) is NULL.\n", __FUNCTION__, __LINE__, label, locale);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_type_s *data = (account_type_s*)account_type;
+ label_s *label_data = (label_s*)malloc(sizeof(label_s));
+
+ if (label_data == NULL) {
+ ACCOUNT_FATAL("(%s)-(%d) Malloc fail. label_data is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_OUT_OF_MEMORY;
+ }
+ ACCOUNT_MEMSET(label_data, 0, sizeof(label_s));
+
+ label_data->label = _account_get_text(label);
+ label_data->locale = _account_get_text(locale);
+
+ data->label_list = g_slist_append(data->label_list, (gpointer)label_data);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+
+int account_type_get_app_id(account_type_h account_type, char **app_id)
+{
+ if (!account_type) {
+ ACCOUNT_ERROR("(%s)-(%d) account type handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!app_id) {
+ ACCOUNT_ERROR("(%s)-(%d) app id is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_type_s *data = (account_type_s*)account_type;
+
+ (*app_id) = NULL;
+ *app_id = _account_get_text(data->app_id);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_type_get_service_provider_id(account_type_h account_type, char **service_provider_id)
+{
+ if (!account_type) {
+ ACCOUNT_ERROR("(%s)-(%d) account type handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!service_provider_id) {
+ ACCOUNT_ERROR("(%s)-(%d) service provider id is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_type_s *data = (account_type_s*)account_type;
+
+ (*service_provider_id) = NULL;
+ *service_provider_id = _account_get_text(data->service_provider_id);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_type_get_icon_path(account_type_h account_type, char **icon_path)
+{
+ if (!account_type) {
+ ACCOUNT_ERROR("(%s)-(%d) account type handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!icon_path) {
+ ACCOUNT_ERROR("(%s)-(%d) icon path is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_type_s *data = (account_type_s*)account_type;
+
+ (*icon_path) = NULL;
+ *icon_path = _account_get_text(data->icon_path);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_type_get_small_icon_path(account_type_h account_type, char **small_icon_path)
+{
+ if (!account_type) {
+ ACCOUNT_ERROR("(%s)-(%d) account type handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!small_icon_path) {
+ ACCOUNT_ERROR("(%s)-(%d) icon path is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_type_s *data = (account_type_s*)account_type;
+
+ (*small_icon_path) = NULL;
+ *small_icon_path = _account_get_text(data->small_icon_path);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_type_get_multiple_account_support(account_type_h account_type, int *multiple_account_support)
+{
+ if (!account_type) {
+ ACCOUNT_ERROR("(%s)-(%d) account_type handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+ if (!multiple_account_support) {
+ ACCOUNT_ERROR("(%s)-(%d) multiple_account_support is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ account_type_s *data = (account_type_s*)account_type;
+
+ *multiple_account_support = data->multiple_account_support;
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_type_get_label(account_type_h account_type, account_label_cb cb_func, void *user_data)
+{
+ ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+ ACCOUNT_RETURN_VAL((cb_func != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
+
+ GSList *iter;
+ account_type_s *data = (account_type_s*)account_type;
+
+ for (iter = data->label_list; iter != NULL; iter = g_slist_next(iter)) {
+ label_s *label_data = NULL;
+
+ label_data = (label_s*)iter->data;
+
+ ACCOUNT_VERBOSE("account_type_get_label :: app_id=%s, label=%s, locale=%s", label_data->app_id, label_data->label, label_data->locale);
+
+ cb_func(label_data->app_id, label_data->label, label_data->locale, user_data);
+ }
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static gboolean _account_type_check_duplicated(account_type_s *data)
+{
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int count = 0;
+
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE AppId='%s'"
+ , ACCOUNT_TYPE_TABLE, data->app_id);
+
+ count = _account_get_record_count(query);
+ if (count > 0) {
+ ACCOUNT_VERBOSE("_account_check_duplicated : duplicated %d account(s) exist!, user_name=%s, domain_name=%s\n",
+ count, data->app_id, data->service_provider_id);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static int _account_type_convert_account_to_sql(account_type_s *account_type, account_stmt hstmt, char *sql_value)
+{
+ int count = 1;
+
+ /*Caution : Keep insert query orders.*/
+
+ /* 1. app id*/
+ _account_query_bind_text(hstmt, count++, (char*)account_type->app_id);
+
+ /* 2. service provider id*/
+ _account_query_bind_text(hstmt, count++, (char*)account_type->service_provider_id);
+
+ /* 3. icon path*/
+ _account_query_bind_text(hstmt, count++, (char*)account_type->icon_path);
+
+ /* 4. small icon path*/
+ _account_query_bind_text(hstmt, count++, (char*)account_type->small_icon_path);
+
+ /* 5. multiple accont support*/
+ _account_query_bind_int(hstmt, count++, account_type->multiple_account_support);
+
+ return count;
+}
+
+
+static int _account_type_execute_insert_query(account_type_s *account_type)
+{
+ int rc = 0;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+
+ /* check mandatory field */
+ // app id & service provider id
+ if (!account_type->app_id) {
+ ACCOUNT_ERROR("App name is mandetory field, it can not be NULL!!!!\n");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!account_type->service_provider_id) {
+ ACCOUNT_ERROR("service_provider_id is mandetory field, it can not be NULL!!!!\n");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s( AppId, ServiceProviderId , IconPath , SmallIconPath , MultipleAccountSupport ) values "
+ "(?, ?, ?, ?, ?)", ACCOUNT_TYPE_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()));
+
+ _account_type_convert_account_to_sql(account_type, hstmt, query);
+
+ rc = _account_query_step(hstmt);
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_FATAL( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ error_code = ACCOUNT_ERROR_DB_FAILED;
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ return error_code;
+}
+
+static int _account_type_insert_label(account_type_s *account_type)
+{
+ int rc, count = 1;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ account_stmt hstmt = NULL;
+
+ ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+
+ if (g_slist_length( account_type->label_list)==0) {
+ ACCOUNT_ERROR( "_account_type_insert_label, no label\n");
+ return ACCOUNT_ERROR_NONE;
+ }
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where AppId = '%s'", ACCOUNT_TYPE_TABLE, account_type->app_id);
+
+ rc = _account_get_record_count(query);
+
+ if (rc <= 0) {
+ ACCOUNT_ERROR( "_account_insert_label : related account item is not existed rc=%d , %s", rc, _account_db_err_msg());
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ }
+
+ /* insert query*/
+ GSList *iter;
+
+ for (iter = account_type->label_list; iter != NULL; iter = g_slist_next(iter)) {
+ int rc, ret;
+ count = 1;
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(AppId, Label, Locale) VALUES "
+ "(?, ?, ?) ", LABEL_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()));
+
+ label_s* label_data = NULL;
+ label_data = (label_s*)iter->data;
+ ACCOUNT_VERBOSE( "label_data->appid = %s, label_data->label = %s, label_data->locale \n", label_data->app_id, label_data->label, label_data->locale);
+
+ ret = _account_query_bind_text(hstmt, count++, account_type->app_id);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, label_data->label);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, (char*)label_data->locale);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+
+ rc = _account_query_step(hstmt);
+
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_FATAL( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ break;
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ }
+
+ ACCOUNT_VERBOSE( "_account_type_insert_label() DONE\n");
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_type_insert_to_db(account_type_h account_type, int* account_type_id)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+ ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT TYPE HANDLE IS NULL"));
+ ACCOUNT_RETURN_VAL((account_type_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT TYPE ID POINTER IS NULL"));
+
+ account_type_s *data = (account_type_s*)account_type;
+
+ pthread_mutex_lock(&account_mutex);
+
+ if (_account_type_check_duplicated(data)) {
+ error_code = ACCOUNT_ERROR_DUPLICATED;
+ } else {
+ *account_type_id = _account_get_next_sequence(ACCOUNT_TYPE_TABLE);
+
+ error_code = _account_type_execute_insert_query(data);
+
+ if (error_code != ACCOUNT_ERROR_NONE)
+ *account_type_id = -1;
+ }
+
+ ACCOUNT_INFO( "_account_type_execute_insert_query, insert error_code : %d", error_code);
+
+ _account_type_insert_label(data);
+
+ pthread_mutex_unlock(&account_mutex);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_type_update_label(account_type_s *account_type, const char* app_id)
+{
+ int rc, count = 1;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ account_stmt hstmt = NULL;
+
+ ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+
+ if (g_slist_length( account_type->label_list)==0) {
+ ACCOUNT_ERROR( "_account_type_update_label, no label\n");
+ return ACCOUNT_ERROR_NONE;
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AppId=? ", LABEL_TABLE);
+ hstmt = _account_prepare_query(query);
+ count = 1;
+ _account_query_bind_text(hstmt, count++, app_id);
+ rc = _account_query_step(hstmt);
+
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_FATAL( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ GSList *iter;
+
+ for (iter = account_type->label_list; iter != NULL; iter = g_slist_next(iter)) {
+ int rc, ret;
+ count = 1;
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(AppId, Label, Locale) VALUES "
+ "(?, ?, ?) ", LABEL_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()));
+
+ label_s* label_data = NULL;
+ label_data = (label_s*)iter->data;
+
+ ret = _account_query_bind_text(hstmt, count++, account_type->app_id);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, label_data->label);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, label_data->locale);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+
+ rc = _account_query_step(hstmt);
+
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_FATAL( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ break;
+ }
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+
+ ACCOUNT_VERBOSE( "_account_type_update_label() DONE\n");
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+
+static int _account_type_update_account(account_type_s *account_type, const char* app_id)
+{
+ int rc = 0, binding_count =1;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+
+ if (!account_type->app_id) {
+ ACCOUNT_ERROR("app id is mandetory field, it can not be NULL!!!!\n");
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "UPDATE %s SET AppId=?, ServiceProviderId=?, IconPath=?, "
+ "SmallIconPath=?, MultipleAccountSupport=? WHERE AppId=? ", ACCOUNT_TYPE_TABLE);
+
+ hstmt = _account_prepare_query(query);
+ ACCOUNT_RETURN_VAL((hstmt != NULL), {}, ACCOUNT_ERROR_DB_FAILED, ("_account_svc_query_prepare() failed(%s).\n", _account_db_err_msg()));
+
+ binding_count = _account_type_convert_account_to_sql(account_type, hstmt, query);
+ _account_query_bind_text(hstmt, binding_count++, app_id);
+
+ rc = _account_query_step(hstmt);
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_FATAL( "account_db_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ /*update label*/
+ error_code = _account_type_update_label(account_type, app_id);
+
+ return error_code;
+}
+
+int account_type_update_to_db_by_app_id(account_type_h account_type, const char* app_id)
+{
+ ACCOUNT_RETURN_VAL((account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("DATA IS NULL"));
+ ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_type_s* data = (account_type_s*)account_type;
+
+ pthread_mutex_lock(&account_mutex);
+
+ error_code = _account_type_update_account(data, app_id);
+
+ pthread_mutex_unlock(&account_mutex);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+int account_type_delete_by_app_id(const char* app_id)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0, count = -1;
+ int ret_transaction = 0;
+ int binding_count = 1;
+ bool is_success = FALSE;
+
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+ ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("The database isn't connected."));
+
+ /* Check requested ID to delete */
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) FROM %s WHERE AppId = '%s'", ACCOUNT_TYPE_TABLE, app_id);
+
+ count = _account_get_record_count(query);
+ if (count <= 0) {
+ ACCOUNT_ERROR("app id(%s) is not exist. count(%d)\n", app_id, count);
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ }
+
+ /* transaction control required*/
+ ret_transaction = _account_begin_transaction();
+
+ if (ret_transaction != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_FATAL("account_delete:_account_begin_transaction fail %d\n", ret_transaction);
+ pthread_mutex_unlock(&account_mutex);
+ return ret_transaction;
+ }
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AppId = ?", LABEL_TABLE);
+
+ hstmt = _account_prepare_query(query);
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ _account_query_bind_text(hstmt, binding_count++, app_id);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ binding_count = 1;
+ ACCOUNT_MEMSET(query, 0, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AppId = ? ", ACCOUNT_TYPE_TABLE);
+
+ hstmt = _account_prepare_query(query);
+ ACCOUNT_CATCH_ERROR(hstmt != NULL, {}, ACCOUNT_ERROR_DB_FAILED,
+ ("_account_svc_query_prepare(%s) failed(%s).\n", query, _account_db_err_msg()));
+
+ _account_query_bind_text(hstmt, binding_count++, app_id);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_DONE, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found. AppId=%s, rc=%d\n", app_id, rc));
+
+ _account_query_finalize(hstmt);
+ is_success = TRUE;
+
+ hstmt = NULL;
+
+ CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+
+ ret_transaction = _account_end_transaction(is_success);
+
+ if (ret_transaction != ACCOUNT_ERROR_NONE) {
+ ACCOUNT_FATAL("account_svc_delete:_account_svc_end_transaction fail %d, is_success=%d\n", ret_transaction, is_success);
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+
+ return error_code;
+}
+
+static void _account_type_convert_column_to_account_type(account_stmt hstmt, account_type_s *account_type_record)
+{
+ char *textbuf = NULL;
+
+ account_type_record->id = _account_query_table_column_int(hstmt, ACCOUNT_TYPE_FIELD_ID);
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_TYPE_FIELD_APP_ID);
+ _account_db_data_to_text(textbuf, &(account_type_record->app_id));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_TYPE_FIELD_SERVICE_PROVIDER_ID);
+ _account_db_data_to_text(textbuf, &(account_type_record->service_provider_id));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_TYPE_FIELD_ICON_PATH);
+ _account_db_data_to_text(textbuf, &(account_type_record->icon_path));
+
+ textbuf = _account_query_table_column_text(hstmt, ACCOUNT_TYPE_FIELD_SMALL_ICON_PATH);
+ _account_db_data_to_text(textbuf, &(account_type_record->small_icon_path));
+
+ account_type_record->multiple_account_support = _account_query_table_column_int(hstmt, ACCOUNT_TYPE_FIELD_MULTIPLE_ACCOUNT_SUPPORT);
+
+ ACCOUNT_VERBOSE("END _account_type_convert_column_to_account_type");
+}
+
+static void _account_type_convert_column_to_label(account_stmt hstmt, label_s *label_record)
+{
+ char *textbuf = NULL;
+
+ textbuf = _account_query_table_column_text(hstmt, LABEL_FIELD_APP_ID);
+ _account_db_data_to_text(textbuf, &(label_record->app_id));
+
+ textbuf = _account_query_table_column_text(hstmt, LABEL_FIELD_LABEL);
+ _account_db_data_to_text(textbuf, &(label_record->label));
+
+ textbuf = _account_query_table_column_text(hstmt, LABEL_FIELD_LOCALE);
+ _account_db_data_to_text(textbuf, &(label_record->locale));
+
+ ACCOUNT_VERBOSE("END _account_type_convert_column_to_label");
+}
+
+int account_type_query_label_by_app_id(account_label_cb cb_func, const char* app_id, void *user_data )
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0, binding_count = 1;
+
+ ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
+ ACCOUNT_RETURN_VAL((cb_func != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO CALLBACK FUNCTION"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE AppId = ?", LABEL_TABLE);
+ hstmt = _account_prepare_query(query);
+
+ _account_query_bind_text(hstmt, binding_count++, app_id);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ label_s* label_record = NULL;
+
+ while (rc == SQLITE_ROW) {
+ label_record = (label_s*) malloc(sizeof(label_s));
+
+ if (label_record == NULL) {
+ ACCOUNT_FATAL("malloc Failed");
+ break;
+ }
+
+ ACCOUNT_MEMSET(label_record, 0x00, sizeof(label_s));
+
+ _account_type_convert_column_to_label(hstmt, label_record);
+
+ cb_func(label_record->app_id, label_record->label , label_record->locale, user_data);
+
+ _account_type_free_label_items(label_record);
+ _ACCOUNT_FREE(label_record);
+
+ rc = _account_query_step(hstmt);
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ error_code = ACCOUNT_ERROR_NONE;
+
+CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+ return error_code;
+}
+
+int _account_type_label_get_app_id(label_h label, char **app_id)
+{
+ if (!label) {
+ ACCOUNT_ERROR("(%s)-(%d) label handle is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!app_id) {
+ ACCOUNT_ERROR("(%s)-(%d) app_id is NULL.\n", __FUNCTION__, __LINE__);
+ return ACCOUNT_ERROR_INVALID_PARAMETER;
+ }
+
+ label_s *data = (label_s*)label;
+
+ (*app_id) = NULL;
+
+ *app_id = _account_get_text(data->app_id);
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+bool _account_get_label_text_cb(char* app_id, char* label, char* locale, void *user_data)
+{
+ account_type_s *data = (account_type_s*)user_data;
+
+ label_s *label_data = (label_s*)malloc(sizeof(label_s));
+
+ if (label_data == NULL) {
+ ACCOUNT_FATAL("_account_get_label_text_cb : MALLOC FAIL\n");
+ return FALSE;
+ }
+ ACCOUNT_MEMSET(label_data, 0, sizeof(label_s));
+
+ label_data->app_id = _account_get_text(app_id);
+ label_data->label = _account_get_text(label);
+ label_data->locale = _account_get_text(locale);
+
+ data->label_list = g_slist_append(data->label_list, (gpointer)label_data);
+
+ ACCOUNT_VERBOSE("_account_get_label_text_cb :: appid=%s, label=%s\n", label_data->app_id, label_data->label);
+
+ return TRUE;
+}
+
+
+int account_type_query_by_app_id(const char* app_id, account_type_h *account_type)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0, binding_count = 1;
+
+ ACCOUNT_RETURN_VAL((app_id != 0), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("APP ID IS NULL"));
+ ACCOUNT_RETURN_VAL((*account_type != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT TYPE IS NULL"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE AppId = ?", ACCOUNT_TYPE_TABLE);
+ hstmt = _account_prepare_query(query);
+
+ _account_query_bind_text(hstmt, binding_count++, app_id);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ account_type_s *account_type_record = (account_type_s *)(*account_type);
+
+ while (rc == SQLITE_ROW) {
+ _account_type_convert_column_to_account_type(hstmt, account_type_record);
+ ACCOUNT_DEBUG("get account info by id %p\n", account_type_record);
+ rc = _account_query_step(hstmt);
+ }
+
+ _account_query_finalize(hstmt);
+ account_type_query_label_by_app_id(_account_get_label_text_cb, account_type_record->app_id, (void*)account_type_record);
+
+ hstmt = NULL;
+ error_code = ACCOUNT_ERROR_NONE;
+
+ CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+ return error_code;
+}
+
+int account_type_foreach_account_type_from_db(account_type_cb callback, void *user_data)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0;
+ GList *account_type_list = NULL;
+
+ ACCOUNT_RETURN_VAL((callback != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT INFO IS NULL"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s ", ACCOUNT_TYPE_TABLE);
+ hstmt = _account_prepare_query(query);
+
+ rc = _account_query_step(hstmt);
+
+ account_type_s *account_type_record = NULL;
+
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ int k=0;
+ while(rc == SQLITE_ROW) {
+ account_type_record = (account_type_s*) malloc(sizeof(account_type_s));
+
+ if (account_type_record == NULL) {
+ ACCOUNT_FATAL("malloc Failed");
+ break;
+ }
+
+ ACCOUNT_MEMSET(account_type_record, 0x00, sizeof(account_type_s));
+ _account_type_convert_column_to_account_type(hstmt, account_type_record);
+ account_type_list = g_list_append(account_type_list, account_type_record);
+ rc = _account_query_step(hstmt);
+ k++;
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ GList* iter;
+ k = 0;
+ for (iter = account_type_list; iter != NULL; iter = g_list_next(iter)) {
+ account_type_s *account_type = NULL;
+ account_type = (account_type_s*)iter->data;
+ account_type_query_label_by_app_id(_account_get_label_text_cb,account_type->app_id,(void*)account_type);
+ callback((account_type_h)account_type, user_data);
+ k++;
+ }
+
+ error_code = ACCOUNT_ERROR_NONE;
+
+CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+ if (account_type_list) {
+ _account_type_glist_free(account_type_list);
+ account_type_list = NULL;
+ }
+
+ return error_code;
+}
+
+// output parameter label must be free
+int account_type_query_label_by_locale(const char* app_id, const char* locale, char** label)
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ int rc = 0, binding_count = 1;
+
+ ACCOUNT_RETURN_VAL((app_id != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("NO APP ID"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+ ACCOUNT_RETURN_VAL((label != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("label char is null"));
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE AppId = ? AND Locale = '%s' ", LABEL_TABLE, locale);
+ hstmt = _account_prepare_query(query);
+
+ _account_query_bind_text(hstmt, binding_count++, app_id);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ label_s* label_record = NULL;
+
+ while (rc == SQLITE_ROW) {
+ label_record = (label_s*) malloc(sizeof(label_s));
+
+ if (label_record == NULL) {
+ ACCOUNT_FATAL("malloc Failed");
+ break;
+ }
+
+ ACCOUNT_MEMSET(label_record, 0x00, sizeof(label_s));
+
+ _account_type_convert_column_to_label(hstmt,label_record);
+
+ *label = _account_get_text(label_record->label);
+
+ _account_type_free_label_items(label_record);
+ _ACCOUNT_FREE(label_record);
+
+ rc = _account_query_step(hstmt);
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ error_code = ACCOUNT_ERROR_NONE;
+
+ CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+ return error_code;
+}
+
+static int _account_insert_custom(account_s *account, int account_id)
+{
+ int rc, count = 1;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ account_stmt hstmt = NULL;
+
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+
+ if (g_slist_length( account->custom_list)==0) {
+ ACCOUNT_ERROR( "_account_insert_custom, no custom data\n");
+ return ACCOUNT_ERROR_NONE;
+ }
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where _id=%d", ACCOUNT_TABLE, account_id);
+
+ rc = _account_get_record_count(query);
+
+ if (rc <= 0) {
+ ACCOUNT_ERROR( "_account_insert_custom : related account item is not existed rc=%d , %s", rc, _account_db_err_msg());
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ }
+
+ /* insert query*/
+
+ GSList *iter;
+
+ for (iter = account->custom_list; iter != NULL; iter = g_slist_next(iter)) {
+ int rc, ret;
+ count = 1;
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s (AccountId, AppId, Key, Value) VALUES "
+ "(?, ?, ?, ?) ", ACCOUNT_CUSTOM_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()));
+
+ account_custom_s* custom_data = NULL;
+ custom_data = (account_custom_s*)iter->data;
+ ACCOUNT_VERBOSE( "account_custom_s->key = %s, account_custom_s->value = %s \n", custom_data->key, custom_data->value);
+
+ ret = _account_query_bind_int(hstmt, count++, account_id);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Int binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, account->package_name);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, (char*)custom_data->key);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, (char*)custom_data->value);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+
+ rc = _account_query_step(hstmt);
+
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_FATAL( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ break;
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ }
+
+ ACCOUNT_VERBOSE( "_account_insert_custom() DONE\n");
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_update_custom(account_s *account, int account_id)
+{
+ int rc, count = 1;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ account_stmt hstmt = NULL;
+
+ ACCOUNT_RETURN_VAL((account != NULL), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("ACCOUNT HANDLE IS NULL"));
+
+ if (g_slist_length( account->custom_list)==0) {
+ ACCOUNT_ERROR( "_account_update_custom, no custom data\n");
+ return ACCOUNT_ERROR_NONE;
+ }
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT COUNT(*) from %s where _id=%d", ACCOUNT_TABLE, account_id);
+
+ rc = _account_get_record_count(query);
+
+ if (rc <= 0) {
+ ACCOUNT_ERROR( "_account_update_custom : related account item is not existed rc=%d , %s", rc, _account_db_err_msg());
+ return ACCOUNT_ERROR_RECORD_NOT_FOUND;
+ }
+
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "DELETE FROM %s WHERE AccountId=? ", ACCOUNT_CUSTOM_TABLE);
+ hstmt = _account_prepare_query(query);
+ count = 1;
+ _account_query_bind_int(hstmt, count++, (int)account_id);
+ rc = _account_query_step(hstmt);
+
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_FATAL( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ return ACCOUNT_ERROR_DB_FAILED;
+ }
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ GSList *iter;
+
+ for (iter = account->custom_list; iter != NULL; iter = g_slist_next(iter)) {
+ int rc, ret;
+ count = 1;
+ ACCOUNT_MEMSET(query, 0x00, sizeof(query));
+ ACCOUNT_SNPRINTF(query, sizeof(query), "INSERT INTO %s(AccountId, AppId, Key, Value) VALUES "
+ "(?, ?, ?, ?) ", ACCOUNT_CUSTOM_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()));
+
+ account_custom_s* custom_data = NULL;
+ custom_data = (account_custom_s*)iter->data;
+
+ ret = _account_query_bind_int(hstmt, count++, (int)account_id);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Int binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, (char*)account->package_name);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, (char*)custom_data->key);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+ ret = _account_query_bind_text(hstmt, count++, (char*)custom_data->value);
+ ACCOUNT_RETURN_VAL((ret == ACCOUNT_ERROR_NONE), {}, ACCOUNT_ERROR_INVALID_PARAMETER, ("Text binding fail"));
+
+ rc = _account_query_step(hstmt);
+
+ if (rc != SQLITE_DONE) {
+ ACCOUNT_FATAL( "_account_query_step() failed(%d, %s)", rc, _account_db_err_msg());
+ break;
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ }
+
+ ACCOUNT_VERBOSE( "_account_update_custom() DONE\n");
+
+ return ACCOUNT_ERROR_NONE;
+}
+
+static int _account_query_custom_by_account_id(account_custom_cb cb_func, int account_id, void *user_data )
+{
+ int error_code = ACCOUNT_ERROR_NONE;
+ account_stmt hstmt = NULL;
+ char query[ACCOUNT_SQL_LEN_MAX] = {0, };
+ 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"));
+ ACCOUNT_RETURN_VAL((g_hAccountDB != NULL), {}, ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+
+ ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
+
+ ACCOUNT_SNPRINTF(query, sizeof(query), "SELECT * FROM %s WHERE AccountId = %d", ACCOUNT_CUSTOM_TABLE, account_id);
+ hstmt = _account_prepare_query(query);
+
+ rc = _account_query_step(hstmt);
+ ACCOUNT_CATCH_ERROR(rc == SQLITE_ROW, {}, ACCOUNT_ERROR_RECORD_NOT_FOUND, ("The record isn't found.\n"));
+
+ account_custom_s* custom_record = NULL;
+
+ while (rc == SQLITE_ROW) {
+ custom_record = (account_custom_s*) malloc(sizeof(account_custom_s));
+
+ if (custom_record == NULL) {
+ ACCOUNT_FATAL("malloc Failed");
+ break;
+ }
+
+ ACCOUNT_MEMSET(custom_record, 0x00, sizeof(account_custom_s));
+
+ _account_convert_column_to_custom(hstmt, custom_record);
+
+ cb_func(custom_record->key, custom_record->value, user_data);
+
+ _account_custom_item_free(custom_record);
+ _ACCOUNT_FREE(custom_record);
+
+ rc = _account_query_step(hstmt);
+ }
+
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+
+ error_code = ACCOUNT_ERROR_NONE;
+
+CATCH:
+ if (hstmt != NULL) {
+ _account_query_finalize(hstmt);
+ hstmt = NULL;
+ }
+
+ pthread_mutex_unlock(&account_mutex);
+ return error_code;
+}
+
+
--- /dev/null
+/*
+ * utc-account
+ *
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
+ *
+ * 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 <stdio.h>
+#include "account.h"
+#include <string.h>
+//#include <dbus/dbus.h>
+
+int account_id = 0;
+
+static void _account_free_text(char *text)
+{
+ if (text) {
+ free(text);
+ text = NULL;
+ }
+}
+
+bool _capability_get_callback(const char* capability_type, account_capability_state_e capability_value, void* user_data)
+{
+ char* test_type = (char*)capability_type;
+ int test_value = capability_value;
+
+ printf("_capability_get_callback test_type = : %s\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;i<USER_TXT_CNT;i++)
+ {
+ _account_free_text(test_text);
+
+ account_get_user_text(handle, i, &test_text);
+ printf("_account_get_callback : %s\n", test_text);
+ }
+
+ int test_int = -1;
+
+ account_auth_type_e auth_type;
+ account_get_auth_type(handle, &auth_type);
+ printf("account_get_auth_type : %d\n", auth_type);
+
+ account_secrecy_state_e secret;
+ account_get_secret(handle, &secret);
+ printf("account_get_secret : %d\n", secret);
+
+ account_sync_state_e sync_support;
+ account_get_sync_support(handle, &sync_support);
+ printf("account_get_sync_support : %d\n", sync_support);
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ test_int = -1;
+ account_get_user_int(handle, i, &test_int);
+ printf("_account_get_callback : %d\n", test_int);
+ }
+
+ account_get_capability_all(handle, _capability_get_callback, NULL);
+
+ return 0;
+}
+
+
+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;i<USER_TXT_CNT;i++)
+ {
+ _account_free_text(test_text);
+
+ account_get_user_text(handle, i, &test_text);
+ printf("_account_get_callback : %s\n", test_text);
+ }
+
+ int test_int = -1;
+
+ account_auth_type_e auth_type;
+ account_get_auth_type(handle, &auth_type);
+ printf("account_get_auth_type : %d\n", auth_type);
+
+ account_secrecy_state_e secret;
+ account_get_secret(handle, &secret);
+ printf("account_get_secret : %d\n", secret);
+
+ account_sync_state_e sync_support;
+ account_get_sync_support(handle, &sync_support);
+ printf("account_get_sync_support : %d\n", sync_support);
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ test_int = -1;
+ account_get_user_int(handle, i, &test_int);
+ printf("_account_get_callback : %d\n", test_int);
+ }
+
+ account_get_capability_all(handle, _capability_get_callback, NULL);
+
+ return TRUE;
+}
+
+static int _account_insert_test_new(void)
+{
+ int ret = -1;
+
+ account_h account = NULL;
+ int temp_int = -1;
+
+ ret = account_connect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ char temp[128];
+ memset(temp, 0x00, sizeof(temp));
+
+ ret = account_create(&account);
+ printf("account_set_user_name: Enter User Name to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_user_name(account, temp);
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+ printf("account_set_display_name: Enter display Name to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_display_name(account, temp);
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+ printf("account_set_domain_name: Enter domain Name to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_domain_name(account, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ memset(temp, 0x00, sizeof(temp));
+ printf("account_set_email_address: Enter email Name to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+ ret = account_set_email_address(account, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+ printf("account_set_package_name: Enter package Name to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_package_name(account, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+ printf("account_set_icon_path: Enter icon path to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_icon_path(account, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_access_token: Enter access token to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_access_token(account, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+ printf("account_set_auth_type: Enter auth type to be set \n");
+ if (scanf("%d", &temp_int) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_auth_type( account, temp_int );
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ temp_int = -1;
+ printf("account_set_secret: Enter secret to be set \n");
+ if (scanf("%d", &temp_int) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_secret( account, temp_int );
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ temp_int = -1;
+ printf("account_set_sync_support: Enter sync support state \n");
+ if (scanf("%d", &temp_int) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_sync_support( account, temp_int );
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ memset(temp, 0x00, sizeof(temp));
+ printf("account_set_source: Enter source to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+ ret = account_set_source(account, temp);
+
+ int i;
+
+ for(i=0;i<USER_TXT_CNT;i++)
+ {
+ memset(temp, 0x00, sizeof(temp));
+ printf("account_set_user_text [%d]: Enter user text to be set \n", i);
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+ ret = account_set_user_text(account, i, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ temp_int = -1;
+ printf("account_set_user_int [%d]: Enter user int to be set \n", i);
+ if (scanf("%d", &temp_int) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+ ret = account_set_user_int(account, i, temp_int);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+
+ int cap_key = -1;
+ int cap_value = -1;
+ int want_to_enter_more_cap = 1;
+ while (want_to_enter_more_cap){
+ printf("account_set_capability: Enter capability key to set \n");
+ if (scanf("%d", &cap_key) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ printf("account_set_capability: Enter capability value to set \n");
+ if (scanf("%d", &cap_value) != 1 ) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_TIZEN_EMAIL, cap_value);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ printf("account_set_capability: Want to set more capabilitiy key value then enter 1 else 0 \n");
+ if (scanf("%d", &temp_int) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+ if (temp_int == 1)
+ want_to_enter_more_cap = 1;
+ else
+ want_to_enter_more_cap = 0;
+ }
+ int account_id = -1;
+ ret = account_insert_to_db(account, &account_id);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ 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);
+ }
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return -1;
+ }
+
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return account_id;
+}
+
+#if 0
+static int _account_insert_test(void)
+{
+ int ret = -1;
+
+ account_h account = NULL;
+
+ printf("account_connect returns %d\n", ret);
+
+ ret = account_create(&account);
+
+ printf("account = %p\n", account);
+
+ ret = account_set_user_name(account, "wy1115.lee");
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_set_display_name(account, "Wonyoung Lee");
+
+ 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, "urusa77@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.account");
+ 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;i<USER_TXT_CNT;i++)
+ {
+ ret = account_set_user_text(account, i, "user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ ret = account_set_user_int(account, i, 888);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_CONTACT, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_CALENDAR, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_VIDEO, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_EMAIL, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_STATUS_POST, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_VOIP, ACCOUNT_CAPABILITY_ENABLED);
+ //ret = account_set_capability(account, ACCOUNT_CAPABILITY_IM, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_SAMSUNG_APPS, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_MOBILE_TRACKER, ACCOUNT_CAPABILITY_ENABLED);
+
+ int account_id = -1;
+ ret = account_insert_to_db(account, &account_id);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ return -1;
+ }
+
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account=NULL;
+
+ printf("account_connect returns %d\n", ret);
+
+ ret = account_create(&account);
+
+ account_query_account_by_account_id(account_id, &account);
+ _account_get_account_info(account);
+
+ account_query_capability_by_account_id(_capability_get_callback, account_id, NULL);
+
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+
+ account=NULL;
+
+ printf("account_connect returns %d\n", ret);
+
+ ret = account_create(&account);
+
+ account_query_account_by_user_name(_account_get_callback, "usernamed-wy1115", NULL);
+
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ return account_id;
+}
+#endif
+
+static int _account_update_test_new_by_user_name(char *user_name, char *package_name)
+{
+ int ret = -1;
+
+ account_h account = NULL;
+ int temp_int = -1;
+
+ char temp[128];
+ memset(temp, 0x00, sizeof(temp));
+ ret = account_connect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_create(&account);
+ printf("account_set_user_name: Enter User Name to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_user_name(account, temp);
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_display_name: Enter display Name to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_display_name(account, temp);
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_domain_name: Enter domain Name to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_domain_name(account, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_email_address: Enter email Name to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+ ret = account_set_email_address(account, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_package_name: Enter package Name to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_package_name(account, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_icon_path: Enter icon path to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_icon_path(account, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_access_token: Enter access token to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_access_token(account, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_auth_type: Enter auth type to be set \n");
+ if (scanf("%d", &temp_int) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_auth_type( account, temp_int );
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ temp_int = -1;
+ printf("account_set_secret: Enter secret to be set \n");
+ if (scanf("%d", &temp_int) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_secret( account, temp_int );
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ temp_int = -1;
+ printf("account_set_sync_support: Enter sync support state \n");
+ if (scanf("%d", &temp_int) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_sync_support( account, temp_int );
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_source: Enter source to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+ ret = account_set_source(account, temp);
+
+ int i;
+
+ for(i=0;i<USER_TXT_CNT;i++)
+ {
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_user_text [%d]: Enter user text to be set \n", i);
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+ ret = account_set_user_text(account, i, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ temp_int = -1;
+ printf("account_set_user_int [%d]: Enter user int to be set \n", i);
+ if (scanf("%d", &temp_int) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+ ret = account_set_user_int(account, i, temp_int);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+
+ int cap_key = -1;
+ int cap_value = -1;
+ int want_to_enter_more_cap = 1;
+ while (want_to_enter_more_cap){
+ printf("account_set_capability: Enter capability key to set \n");
+ if (scanf("%d", &cap_key) != 1 ) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ printf("account_set_capability: Enter capability value to set \n");
+ if (scanf("%d", &cap_value) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_TIZEN_EMAIL, cap_value);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ printf("account_set_capability: Want to set more capabilitiy key value then enter 1 else 0 \n");
+ if (scanf("%d", &temp_int) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+ if (temp_int == 1)
+ want_to_enter_more_cap = 1;
+ else
+ want_to_enter_more_cap = 0;
+ }
+
+
+ ret = account_update_to_db_by_user_name(account, user_name, package_name);
+
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ 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);
+ }
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ return ret;
+
+}
+
+
+static int _account_update_test_new(int account_id)
+{
+
+ int ret = -1;
+
+ account_h account = NULL;
+ int temp_int = -1;
+
+ char temp[128];
+ memset(temp, 0x00, sizeof(temp));
+ ret = account_connect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+
+ ret = account_create(&account);
+ printf("account_set_user_name: Enter User Name to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_user_name(account, temp);
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_display_name: Enter display Name to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_display_name(account, temp);
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+ printf("account_set_domain_name: Enter domain Name to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_domain_name(account, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ memset(temp, 0x00, sizeof(temp));
+ printf("account_set_email_address: Enter email Name to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+ ret = account_set_email_address(account, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_package_name: Enter package Name to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_package_name(account, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_icon_path: Enter icon path to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_icon_path(account, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_access_token: Enter access token to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_access_token(account, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_auth_type: Enter auth type to be set \n");
+ if (scanf("%d", &temp_int) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_auth_type( account, temp_int );
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ temp_int = -1;
+ printf("account_set_secret: Enter secret to be set \n");
+ if (scanf("%d", &temp_int) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_secret( account, temp_int );
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ temp_int = -1;
+ printf("account_set_sync_support: Enter sync support state \n");
+ if (scanf("%d", &temp_int) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+
+ ret = account_set_sync_support( account, temp_int );
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_source: Enter source to be set \n");
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+ ret = account_set_source(account, temp);
+
+ int i;
+
+ for(i=0;i<USER_TXT_CNT;i++)
+ {
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("account_set_user_text [%d]: Enter user text to be set \n", i);
+ if (scanf("%s", temp) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+ ret = account_set_user_text(account, i, temp);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ temp_int = -1;
+ printf("account_set_user_int [%d]: Enter user int to be set \n", i);
+ if (scanf("%d", &temp_int) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+ ret = account_set_user_int(account, i, temp_int);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+
+ int cap_key = -1;
+ int cap_value = -1;
+ int want_to_enter_more_cap = 1;
+ while (want_to_enter_more_cap){
+ printf("account_set_capability: Enter capability key to set \n");
+ if (scanf("%d", &cap_key) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ printf("account_set_capability: Enter capability value to set \n");
+ if (scanf("%d", &cap_value) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_TIZEN_EMAIL, cap_value);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ printf("account_set_capability: Want to set more capabilitiy key value then enter 1 else 0 \n");
+ if (scanf("%d", &temp_int) != 1) {
+ printf("scanf Failed !!!! \n");
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ return ret;
+ }
+ if (temp_int == 1)
+ want_to_enter_more_cap = 1;
+ else
+ want_to_enter_more_cap = 0;
+ }
+
+ ret = account_update_to_db_by_id(account, account_id);
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ 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);
+ }
+
+ ret = account_disconnect();
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ return ret;
+}
+
+#if 0
+static int _account_update_test(int account_id)
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+
+ ret = account_create(&account);
+
+ ret = account_set_user_name(account, "updated-wy1115");
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_set_display_name(account, "updated-Wonyoung Lee");
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_set_domain_name(account, "updated-Samsung Facebook");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ ret = account_set_email_address(account, "updated-urusa77@gmail.com");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ ret = account_set_package_name(account, "updated-com.samsung.account");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ ret = account_set_icon_path(account, "updated-icon-path");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_set_access_token(account, "updated-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, "updated-URUSA inc.");
+
+ int i;
+
+ for(i=0;i<USER_TXT_CNT;i++)
+ {
+ ret = account_set_user_text(account, i, "updated-user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ ret = account_set_user_int(account, i, 111);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+
+
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_VIDEO, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_STATUS_POST, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_SAMSUNG_APPS, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_MOBILE_TRACKER, ACCOUNT_CAPABILITY_ENABLED);
+
+ ret = account_update_to_db_by_id(account, account_id);
+
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ 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);
+ }
+
+ return ret;
+
+}
+
+static int _account_update_test_by_username()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+
+ ret = account_create(&account);
+
+ ret = account_set_user_name(account, "usernamed-wy1115");
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_set_display_name(account, "usernamed-Wonyoung Lee");
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_set_domain_name(account, "usernamed-Samsung Facebook");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ ret = account_set_email_address(account, "usernamed-urusa77@gmail.com");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ ret = account_set_package_name(account, "usernamed-com.samsung.account");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ ret = account_set_icon_path(account, "usernamed-icon-path");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_set_access_token(account, "usernamed-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, "updated-URUSA inc.");
+
+ int i;
+
+ for(i=0;i<USER_TXT_CNT;i++)
+ {
+ ret = account_set_user_text(account, i, "usernamed-user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ ret = account_set_user_int(account, i, 111);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+
+
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_VIDEO, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_VOIP, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_SAMSUNG_APPS, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_CAPABILITY_STATUS_POST, ACCOUNT_CAPABILITY_ENABLED);
+
+ ret = account_update_to_db_by_user_name(account, "updated-wy1115", "updated-com.samsung.account");
+
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ 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);
+ }
+
+ return ret;
+
+}
+
+static int _account_test_capability()
+{
+ GSList* list = NULL;
+ GSList* iter = NULL;
+ int glist_len = 0;
+
+ list = g_slist_append(list, strdup("test 1"));
+ list = g_slist_append(list, strdup("test 2"));
+ list = g_slist_append(list, strdup("test 3"));
+ list = g_slist_append(list, strdup("test 4"));
+ list = g_slist_append(list, strdup("test 5"));
+ list = g_slist_append(list, strdup("test 6"));
+
+ glist_len = g_slist_length( list );
+
+ int capability_count = g_slist_length( list );
+
+ int binding_bufsize = 2+2*(capability_count*2)+1;
+
+ int binding_buf_index = 0;
+ char* binding_buf = (char*)malloc(sizeof(char)*binding_bufsize);
+
+ memset(binding_buf, 0, sizeof(char)*binding_bufsize);
+
+ binding_buf[binding_buf_index++]='(';
+
+ printf("(%d)Binding buf = %s\n", __LINE__,binding_buf);
+
+ int i;
+
+ for(i=0;i<capability_count;i++)
+ {
+ /*snprintf(binding_buf+binding_buf_index, strlen(binding_buf)+2, "%s?,", binding_buf);*/
+ binding_buf[binding_buf_index++]='?';
+ if(i != capability_count -1)
+ binding_buf[binding_buf_index++]=',';
+ printf("(%d)Binding buf = %s\n", __LINE__,binding_buf);
+ }
+
+ binding_buf[binding_buf_index]=')';
+
+ printf("(%d)Binding buf = %s\n", __LINE__,binding_buf);
+
+ printf("Length %d\n", glist_len);
+
+ for (iter = list; iter != NULL; iter = g_slist_next(iter))
+ {
+ char* capa;
+ capa = (char *)iter->data;
+ printf("%s\n", (char *)iter->data);
+ g_free(capa);
+ }
+
+
+ g_slist_free(list);
+ g_free(binding_buf);
+ return 0;
+}
+#endif
+
+static int utc1_account_insert()
+{
+
+ int ret = -1;
+ account_h account = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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 = NULL;
+ 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<USER_TXT_CNT; i++)
+ {
+ ret = account_set_user_text(account, i, NULL);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+ 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] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_destroy(account);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ else
+ {
+ printf("(%d)-[Account] 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 utc20_account_insert()
+{
+
+ int ret = -1;
+ account_h account = NULL;
+ 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-else loop] 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_set_display_name(account, "tarun kumar");
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ else
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_set_domain_name(account, "Samsung");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ else
+ {
+ printf("(%d)-[Account] 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-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ else
+ {
+ printf("(%d)-[Account] 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-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ else
+ {
+ printf("(%d)-[Account] 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-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ else
+ {
+ printf("(%d)-[Account] 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-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ else
+ {
+ 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-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ else
+ {
+ 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);
+ }
+ 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-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+ else
+ {
+ printf("(%d)-[Account] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ int i;
+
+ for(i=0; i<USER_TXT_CNT; i++)
+ {
+ ret = account_set_user_text(account, i, "user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+ 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 utc21_account_insert()
+{
+
+ int ret = -1;
+ account_h account = NULL;
+ 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-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-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-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ int i;
+
+ for(i=0; i<USER_TXT_CNT; i++)
+ {
+ ret = account_set_user_text(account, i, "user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ ret = account_set_user_int(account, i, 000);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+ 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 utc22_account_insert()
+{
+
+ int ret = -1;
+ account_h account = NULL;
+ 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<USER_TXT_CNT; i++)
+ {
+ ret = account_set_user_text(account, i, "user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ ret = account_set_user_int(account, i, 888);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+ 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 utc23_account_insert()
+{
+
+ int ret = -1;
+ account_h account = NULL;
+ 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<USER_TXT_CNT; i++)
+ {
+ ret = account_set_user_text(account, i, "user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ ret = account_set_user_int(account, i, 888);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+
+ ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT, ACCOUNT_CAPABILITY_ENABLED);
+ 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_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_POST, ACCOUNT_CAPABILITY_ENABLED);
+ 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 utc1_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_update_to_db_by_id(account, 0);
+
+ 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_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 1;
+}
+
+static int utc2_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_update_to_db_by_id(account, -999);
+
+ 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_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 1;
+}
+
+static int utc3_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_update_to_db_by_id(account, 555);
+
+ 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_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 1;
+}
+
+static int utc4_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc5_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc6_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc7_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc8_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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_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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+static int utc9_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc10_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc11_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc12_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc13_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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, "updated-com.samsung.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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc14_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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, "updated-com.samsung.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_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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc15_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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, "updated-com.samsung.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_set_icon_path(account, "updated-icon-path");
+ 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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc16_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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, "updated-com.samsung.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_set_icon_path(account, "updated-icon-path");
+ 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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc17_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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, "updated-com.samsung.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_set_icon_path(account, "updated-icon-path");
+ 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, "updated-ACCESSTOKEN");
+ 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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc18_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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, "updated-com.samsung.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_set_icon_path(account, "updated-icon-path");
+ 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, "updated-ACCESSTOKEN");
+ 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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc19_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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, "updated-com.samsung.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_set_icon_path(account, "updated-icon-path");
+ 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, "updated-ACCESSTOKEN");
+ 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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc20_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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, "updated-com.samsung.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_set_icon_path(account, "updated-icon-path");
+ 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, "updated-ACCESSTOKEN");
+ 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, "updated-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_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc21_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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, "updated-com.samsung.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_set_icon_path(account, "updated-icon-path");
+ 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, "updated-ACCESSTOKEN");
+ 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, "updated-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<USER_TXT_CNT;i++)
+ {
+ ret = account_set_user_text(account, i, NULL);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+
+ ret = account_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc22_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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, "updated-com.samsung.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_set_icon_path(account, "updated-icon-path");
+ 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, "updated-ACCESSTOKEN");
+ 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, "updated-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<USER_TXT_CNT;i++)
+ {
+ ret = account_set_user_text(account, i, "updated-user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+
+ ret = account_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc23_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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, "updated-com.samsung.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_set_icon_path(account, "updated-icon-path");
+ 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, "updated-ACCESSTOKEN");
+ 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, "updated-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<USER_TXT_CNT;i++)
+ {
+ ret = account_set_user_text(account, i, "updated-user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ ret = account_set_user_int(account, i, -111);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+
+ ret = account_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc24_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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, "updated-com.samsung.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_set_icon_path(account, "updated-icon-path");
+ 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, "updated-ACCESSTOKEN");
+ 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, "updated-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<USER_TXT_CNT;i++)
+ {
+ ret = account_set_user_text(account, i, "updated-user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ ret = account_set_user_int(account, i, 0);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+
+ ret = account_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc25_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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, "updated-com.samsung.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_set_icon_path(account, "updated-icon-path");
+ 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, "updated-ACCESSTOKEN");
+ 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, "updated-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<USER_TXT_CNT;i++)
+ {
+ ret = account_set_user_text(account, i, "updated-user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ ret = account_set_user_int(account, i, 111);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+
+ ret = account_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc26_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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, "updated-com.samsung.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_set_icon_path(account, "updated-icon-path");
+ 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, "updated-ACCESSTOKEN");
+ 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, "updated-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<USER_TXT_CNT;i++)
+ {
+ ret = account_set_user_text(account, i, "updated-user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ ret = account_set_user_int(account, i, 111);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+
+ ret = account_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+static int utc27_account_update()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ account_set_user_name(account, "updated-tarun.kr");
+
+ 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_display_name(account, "updated-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, "updated-Samsung Facebook");
+ 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, "updated-urusa77@gmail.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, "updated-com.samsung.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_set_icon_path(account, "updated-icon-path");
+ 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, "updated-ACCESSTOKEN");
+ 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, "updated-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<USER_TXT_CNT;i++)
+ {
+ ret = account_set_user_text(account, i, "updated-user txt");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+
+ }
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ ret = account_set_user_int(account, i, 111);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, account=%p, i=%d\n", __LINE__, ret, account, i);
+ }
+ }
+ ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_CALENDAR, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_VIDEO, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_EMAIL, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_POST, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_VOIP, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_SAMSUNG_APPS, ACCOUNT_CAPABILITY_ENABLED);
+ ret = account_set_capability(account, ACCOUNT_SUPPORTS_CAPABILITY_MOBILE_TRACKER, ACCOUNT_CAPABILITY_ENABLED);
+
+ ret = account_update_to_db_by_id(account, account_id);
+
+ 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_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 1;
+}
+
+bool _utc1_account_get_callback(account_h handle, void* user_data)
+{
+ printf("_account_get_callback handle = %s , user_data = %s \n", (char *)handle, (char *)user_data);
+
+ 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);
+ _account_free_text(test_text);
+
+ int i=0, test_int=0;
+
+ account_auth_type_e auth_type;
+ account_get_auth_type(handle, &auth_type);
+ printf("account_get_auth_type : %d\n", auth_type);
+
+ account_secrecy_state_e secret;
+ account_get_secret(handle, &secret);
+ printf("account_get_secret : %d\n", secret);
+
+ account_sync_state_e sync_support;
+ account_get_sync_support(handle, &sync_support);
+ printf("account_get_sync_support : %d\n", sync_support);
+
+ for(i=0;i<USER_INT_CNT;i++)
+ {
+ account_get_user_int(handle, i, &test_int);
+ printf("_account_get_callback : %d\n", test_int);
+ }
+
+ account_get_capability_all(handle, _capability_get_callback, NULL);
+
+ return TRUE;
+}
+
+
+static int utc1_get_account_by_id()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ _account_get_account_info(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 1;
+}
+
+static int utc2_get_account_by_id()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ 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);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, account=%p\n", __LINE__, ret, account);
+ }
+
+ ret = account_query_account_by_account_id(account_id, &account);
+
+ _account_get_account_info(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_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 1;
+}
+
+static int utc1_get_account_by_user_name()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ ret = account_query_account_by_user_name(_account_get_callback, "usernamed-wy1115", 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_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ return 1;
+}
+
+static int utc2_get_account_by_user_name()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ char *user_data = "test user_data";
+
+ ret = account_query_account_by_user_name(_account_get_callback, "usernamed-wy1115", (void *)user_data);
+
+ 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 1;
+}
+
+static int utc1_get_account_by_capability()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ ret = account_query_account_by_capability(_account_get_callback, ACCOUNT_SUPPORTS_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_ENABLED, 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_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ return 1;
+}
+
+static int utc2_get_account_by_capability()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ ret = account_query_account_by_capability(_account_get_callback, ACCOUNT_SUPPORTS_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_DISABLED, 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_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ return 1;
+}
+
+static int utc3_get_account_by_capability()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ ret = account_query_account_by_capability(_account_get_callback, ACCOUNT_SUPPORTS_CAPABILITY_PHOTO, -1, 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_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ return 1;
+}
+
+static int utc4_get_account_by_capability()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ ret = account_query_account_by_capability(_account_get_callback, ACCOUNT_SUPPORTS_CAPABILITY_PHOTO, ACCOUNT_CAPABILITY_DISABLED, 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_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ return 1;
+}
+
+static int utc5_get_account_by_capability()
+{
+ int ret = - 1;
+
+ account_h account = NULL;
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ ret = account_query_account_by_capability(_account_get_callback, ACCOUNT_SUPPORTS_CAPABILITY_PHOTO, -1, 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_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ return 1;
+}
+
+static int utc1_get_all_accounts()
+{
+ int ret = - 1;
+
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ ret = account_foreach_account_from_db(_account_get_callback, NULL);
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, \n", __LINE__, ret);
+ }
+
+ ret = account_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ return 1;
+}
+
+static int utc2_get_all_accounts()
+{
+ int ret = - 1;
+
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ char *user_data = "test user_data";
+
+ ret = account_foreach_account_from_db(_account_get_callback, (void *)user_data);
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d \n", __LINE__, ret);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d \n", __LINE__, ret);
+ }
+
+ ret = account_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ return 1;
+}
+
+bool _utc_capability_get_callback(const char* capability_type, account_capability_state_e capability_value, void* user_data)
+{
+ char* test_type = (char*)capability_type;
+ int test_value = capability_value;
+
+ printf("_capability_get_callback test_type = : %s\n", test_type);
+ printf("_capability_get_callback test_value = : %d\n", test_value);
+ return TRUE;
+
+}
+
+static int utc1_account_get_capability_by_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(_utc_capability_get_callback, account_id, NULL);
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d,\n", __LINE__, ret);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, \n", __LINE__, ret);
+ }
+ ret = account_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+ return 1;
+}
+
+static int utc2_account_get_capability_by_account_id()
+{
+ int ret = -1;
+
+ char *user_data = "test user_data";
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ ret = account_query_capability_by_account_id(_utc_capability_get_callback, account_id, (void *)user_data);
+
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, \n", __LINE__, ret);
+ }
+ ret = account_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+ return 1;
+}
+
+static int utc_account_delete_by_id()
+{
+ 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_id(account_id);
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d, \n", __LINE__, ret);
+ }
+ ret = account_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+ return 1;
+}
+
+static int utc_account_delete_by_user_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("usernamed-wy1115", "usernamed-com.samsung.account");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d \n", __LINE__, ret);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d \n", __LINE__, ret);
+ }
+ ret = account_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+ return 1;
+}
+
+static int utc_account_delete_by_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("usernamed-com.samsung.account");
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d\n", __LINE__, ret);
+ }
+ else
+ {
+ printf("(%d)-[Account-else loop] ret = %d\n", __LINE__, ret);
+ }
+ ret = account_disconnect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+ return 1;
+}
+
+static int utc_account_update_sync_status_by_id()
+{
+ int ret = -1;
+
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ ret = account_update_sync_status_by_id(account_id, ACCOUNT_SYNC_STATUS_IDLE);
+ 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 ret;
+}
+
+static int utc_account_get_application_capability_support()
+{
+ int ret = -1;
+ bool test = false;
+
+ ret = account_connect();
+ if(ret != ACCOUNT_ERROR_NONE)
+ {
+ printf("(%d)-[Account] ret = %d, \n", __LINE__, ret);
+ }
+
+ ret = account_get_application_capability_support("com.samsung.facebook", ACCOUNT_SUPPORTS_CAPABILITY_CONTACT, &test);
+ 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 ret;
+}
+
+static int utc_account_get_and_update()
+{
+ int ret = -1;
+ account_h account = NULL;
+
+ ret = account_connect();
+ printf("%s(%d) ret=%x\n", __FUNCTION__, __LINE__, ret);
+
+ ret = account_create(&account);
+ printf("%s(%d) ret=%x\n", __FUNCTION__, __LINE__, ret);
+
+ ret = account_query_account_by_account_id( 2, &account);
+ printf("%s(%d) ret=%x\n", __FUNCTION__, __LINE__, ret);
+
+ ret = account_set_access_token(account, "ACCESSSSSSSSSSSSSSSSSSSFASFASDGDSFFASDFASFDSDGAASDFASDGDFDFGAFASDFASFASDFASASGSGASDFASFSADDSGASGASGGASDFASDFASGSAASDFAAAG");
+ printf("%s(%d) ret=%x\n", __FUNCTION__, __LINE__, ret);
+
+ ret = account_update_to_db_by_id( account, 2);
+ printf("%s(%d) ret=%x\n", __FUNCTION__, __LINE__, ret);
+
+ ret = account_destroy(account);
+ printf("%s(%d) ret=%x\n", __FUNCTION__, __LINE__, ret);
+
+ ret = account_disconnect();
+ printf("%s(%d) ret=%x\n", __FUNCTION__, __LINE__, ret);
+
+ return 1;
+}
+
+#if 0
+
+static int utc_account_type_test()
+{
+ int ret;
+ account_connect();
+ ret = account_type_create(&account_type);
+ MYACCOUNT_DBUG("account_type_create %d ret = %d", __LINE__, ret);
+
+ ret = account_type_set_app_id(account_type, "com.samsung.urusa");
+ ret = account_type_set_icon_path(account_type, "urusa/iconpath");
+ ret = account_type_set_small_icon_path(account_type, "urusa/smalliconpath");
+ ret = account_type_set_service_provider_id(account_type,"http://org.tizen.urusa.com");
+ ret = account_type_set_multiple_account_support(account_type, 1);
+
+ ret = account_type_set_label(account_type, "urusa", "en_US");
+ ret = account_type_set_label(account_type, "urusa-fr_FR", "fr_FR");
+ ret = account_type_set_label(account_type, "urusa-ge_GE", "ge_GE");
+
+ ret = account_type_insert_to_db(account_type,&account_type_id);
+ MYACCOUNT_DBUG("account_type_insert_to_db ret = %d", ret);
+
+ ret = account_type_destroy(account_type);
+
+ ret = account_type_create(&account_type);
+ ret = account_type_set_app_id(account_type, "com.tizen.urusa");
+ ret = account_type_set_icon_path(account_type, "1111urusa/iconpath");
+ ret = account_type_set_small_icon_path(account_type, "1111urusa/smalliconpath");
+ ret = account_type_set_service_provider_id(account_type,"1111http://org.tizen.urusa.com");
+ ret = account_type_set_multiple_account_support(account_type, 0);
+
+ ret = account_type_set_label(account_type, "1111urusa", "en_US");
+ ret = account_type_set_label(account_type, "1111urusa-fr_FR", "fr_FR");
+ ret = account_type_set_label(account_type, "1111urusa-ge_GE", "ge_GE");
+
+ ret = account_type_update_to_db_by_app_id(account_type, "com.samsung.urusa");
+ MYACCOUNT_DBUG("account_type_update_to_db_by_app_id ret = %d", ret);
+ ret = account_type_destroy(account_type);
+
+ ret = account_type_create(&account_type);
+ ret = account_type_query_by_app_id("com.tizen.urusa", &account_type);
+ MYACCOUNT_DBUG("account_type_update_to_db_by_app_id ret = %d", ret);
+
+ char* tmptxt = NULL;
+ int tmpint = -1 ;
+ ret = account_type_get_app_id(account_type, &tmptxt);
+ MYACCOUNT_DBUG("account_type_get ret = %d, %s", ret, tmptxt);
+ free(tmptxt);
+
+ ret = account_type_get_icon_path(account_type, &tmptxt);
+ MYACCOUNT_DBUG("account_type_get ret = %d, %s", ret, tmptxt);
+ free(tmptxt);
+
+ ret = account_type_get_small_icon_path(account_type, &tmptxt);
+ MYACCOUNT_DBUG("account_type_get ret = %d, %s", ret, tmptxt);
+ free(tmptxt);
+
+ ret = account_type_get_service_provider_id(account_type, &tmptxt);
+ MYACCOUNT_DBUG("account_type_get ret = %d, %s", ret, tmptxt);
+ free(tmptxt);
+
+ ret = account_type_get_multiple_account_support(account_type, &tmpint);
+ MYACCOUNT_DBUG("account_type_get ret = %d, %d", ret, tmpint);
+
+ ret = account_type_get_label(account_type, label_cb_func, NULL);
+
+ ret = account_type_destroy(account_type);
+
+
+ ret = account_type_foreach_account_type_from_db( account_type_callback,NULL);
+
+ ret = account_type_delete_by_app_id("com.tizen.urusa");
+ MYACCOUNT_DBUG("account_type_delete_by_app_id ret = %d", ret);
+ account_disconnect();
+
+ return ret;
+}
+
+static int utc_notify_account_insert_update_delete()
+{
+ DBusMessage* msg;
+ DBusConnection* conn;
+ DBusError err;
+
+ printf("Listening for signals\n");
+
+ /*initialise the errors */
+ dbus_error_init(&err);
+
+ /* connect to the bus and check for errors*/
+ 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);
+ }
+
+ /* add a rule for which messages we want to see*/
+ dbus_bus_add_match(conn, "type='signal',interface='account.signal.Type'", &err); /* see signals from the given interface*/
+ 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");
+
+ /* loop listening for signals being emmitted*/
+ while (true) {
+
+ /* non blocking read of the next available message*/
+ dbus_connection_read_write(conn, 0);
+ msg = dbus_connection_pop_message(conn);
+
+ /* loop again if we haven't read a message*/
+ if (NULL == msg) {
+ sleep(1);
+ continue;
+ }
+
+ /* check if the message is a signal from the correct interface and with the correct name*/
+ if (dbus_message_is_signal(msg, ACCOUNT_DBUS_SIGNAL_INTERFACE, ACCOUNT_DBUS_NOTI_NAME_INSERT)) {
+ printf("Got Signal with name insert\n");
+ }
+
+ if (dbus_message_is_signal(msg, ACCOUNT_DBUS_SIGNAL_INTERFACE, ACCOUNT_DBUS_NOTI_NAME_UPDATE)) {
+ printf("Got Signal with name update\n");
+ }
+
+ if (dbus_message_is_signal(msg, ACCOUNT_DBUS_SIGNAL_INTERFACE, ACCOUNT_DBUS_NOTI_NAME_DELETE)) {
+ printf("Got Signal with name delete\n");
+ }
+ /* free the message*/
+ dbus_message_unref(msg);
+ }
+ /*close the connection*/
+ dbus_connection_close(conn);
+}
+#endif
+
+int main(int argc, char** argv)
+{
+#if 0
+ utc_notify_account_insert_update_delete();
+#else
+ int account_id = -1;
+ int cap_key = -1;
+ int cap_value = -1;
+ int user_resp = 0;
+ char temp[128];
+ memset(temp, 0x00, sizeof(temp));
+
+ printf("\n\n**************************** Account Unit Test case Execution Suite ************************************ \n\n");
+ printf("1. Press 1 for account insert test \n");
+ printf("2. Press 2 for account update test \n");
+ printf("3. Press 3 for account delete test \n");
+ printf("4. Press 4 for query account test \n");
+ if (scanf("%d", &user_resp) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+
+ if (user_resp == 1) {
+ printf("In Account Insert Test Mode \n");
+ account_id = _account_insert_test_new();
+ if(account_id > 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");
+ if (scanf("%d", &user_resp) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ if (user_resp == 1) {
+ printf("Enter Account Id to be Updated \n");
+ if (scanf("%d", &account_id) != 1){
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ 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));
+ if (scanf("%s", temp) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ char temp2[128];
+ memset(temp2, 0x00, sizeof(temp2));
+ printf("Enter Account package name to be Updated \n");
+ if (scanf("%s", temp2) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ 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");
+ if (scanf("%d", &user_resp) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ if (user_resp == 1) {
+ printf("Enter Account Id to be Deleted \n");
+ if (scanf("%d", &account_id) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ 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));
+ if (scanf("%s", temp) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ char temp2[128];
+ memset(temp2, 0x00, sizeof(temp2));
+ printf("Enter Account package name to be Deleted \n");
+ if (scanf("%s", temp2) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ 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));
+ if (scanf("%s", temp) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ 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");
+ if (scanf("%d", &user_resp) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ if (user_resp == 1) {
+ printf("Enter Account Id to be Queried \n");
+ if (scanf("%d", &account_id) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ account_h account = NULL;
+ 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");
+ if (scanf("%s", temp) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ 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");
+ if (scanf("%s", temp) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ 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");
+ if (scanf("%d", &cap_key) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ printf("Enter Account capability key's value to be Queried \n");
+ if (scanf("%d", &cap_value) != 1) {
+ printf("Scanf Failed!!!\n");
+ exit(0);
+ }
+ 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, ACCOUNT_SUPPORTS_CAPABILITY_PHOTO, 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 update sync status by id
+#if 1
+ utc_account_update_sync_status_by_id();
+#endif
+
+ //utc get application capability support
+#if 1
+ utc_account_get_application_capability_support();
+#endif
+
+#if 1
+ utc_account_delete_by_id();
+ utc_account_delete_by_user_name();
+ utc_account_delete_by_package_name();
+#endif
+
+#endif
+
+ return 0;
+}
+