revice packaging test 53/127053/2
authorJeesun Kim <iamjs.kim@samsung.com>
Wed, 26 Apr 2017 04:34:17 +0000 (13:34 +0900)
committerJeesun Kim <iamjs.kim@samsung.com>
Wed, 26 Apr 2017 05:04:47 +0000 (14:04 +0900)
Signed-off-by: Jeesun Kim <iamjs.kim@samsung.com>
Change-Id: I1d8f45646364c5f2c1eb4ac50000c846bbdf64eb

38 files changed:
CMakeLists.txt
packaging/email-service.spec
test/CMakeLists.txt [new file with mode: 0644]
test/main.c [new file with mode: 0644]
test/testapp-account.c [new file with mode: 0644]
test/testapp-account.h [new file with mode: 0644]
test/testapp-gmime.c [new file with mode: 0644]
test/testapp-gmime.h [new file with mode: 0644]
test/testapp-mail.c [new file with mode: 0644]
test/testapp-mail.h [new file with mode: 0644]
test/testapp-mailbox.c [new file with mode: 0644]
test/testapp-mailbox.h [new file with mode: 0644]
test/testapp-others.c [new file with mode: 0644]
test/testapp-others.h [new file with mode: 0644]
test/testapp-rule.c [new file with mode: 0644]
test/testapp-rule.h [new file with mode: 0644]
test/testapp-thread.c [new file with mode: 0644]
test/testapp-thread.h [new file with mode: 0644]
test/testapp-utility.c [new file with mode: 0644]
test/testapp-utility.h [new file with mode: 0644]
utilities/CMakeLists.txt [deleted file]
utilities/test-application/include/testapp-account.h [deleted file]
utilities/test-application/include/testapp-gmime.h [deleted file]
utilities/test-application/include/testapp-mail.h [deleted file]
utilities/test-application/include/testapp-mailbox.h [deleted file]
utilities/test-application/include/testapp-others.h [deleted file]
utilities/test-application/include/testapp-rule.h [deleted file]
utilities/test-application/include/testapp-thread.h [deleted file]
utilities/test-application/include/testapp-utility.h [deleted file]
utilities/test-application/main.c [deleted file]
utilities/test-application/testapp-account.c [deleted file]
utilities/test-application/testapp-gmime.c [deleted file]
utilities/test-application/testapp-mail.c [deleted file]
utilities/test-application/testapp-mailbox.c [deleted file]
utilities/test-application/testapp-others.c [deleted file]
utilities/test-application/testapp-rule.c [deleted file]
utilities/test-application/testapp-thread.c [deleted file]
utilities/test-application/testapp-utility.c [deleted file]

index 1e3c579363176d09caff18f3420277493ab62e45..576dbbcd59e98f3d93dda15b405a35f55dffc052 100755 (executable)
@@ -42,9 +42,8 @@ ADD_SUBDIRECTORY(email-daemon)
 ##########################################################
 # Define Test App
 ##########################################################
-IF (TEST_APP_SUPPORT)
-       ADD_SUBDIRECTORY(utilities)
-ENDIF (TEST_APP_SUPPORT)
+ADD_SUBDIRECTORY(test)
+
 ##########################################################
 # Define Install Files
 ##########################################################
index 0451a312d86b678623d87ec102db9539dcd4b8fc..c4fe268970f6847a263eafc31c8914136e117a67 100755 (executable)
@@ -1,5 +1,3 @@
-%global test_email_app_enabled 1
-
 Name:       email-service
 Summary:    E-mail Framework Middleware package
 Version:    0.10.103
@@ -59,12 +57,9 @@ BuildRequires:  pkgconfig(icu-i18n)
 BuildRequires:  pkgconfig(storage)
 BuildRequires:  pkgconfig(capi-network-connection)
 BuildRequires:  pkgconfig(capi-system-device)
-#BuildRequires:  pkgconfig(vasum)
-BuildRequires:  pkgconfig(libtzplatform-config)
 BuildRequires:  pkgconfig(libsmack)
 BuildRequires:  pkgconfig(sqlite3)
 BuildRequires:  pkgconfig(cryptsvc)
-Requires: libtzplatform-config
 
 
 # OS upgrade
@@ -83,7 +78,6 @@ Requires:   %{name} = %{version}-%{release}
 %description devel
 E-mail Framework Middleware Development package
 
-%if %{test_email_app_enabled}
 %package test
 Summary:    E-mail Framework Middleware Test package
 Group:      Development/Messaging
@@ -91,26 +85,18 @@ Requires:   %{name} = %{version}-%{release}
 
 %description test
 E-mail Framework Middleware Test package
-%endif
 
 %prep
 %setup -q
 cp %{SOURCE2} .
-%if %{test_email_app_enabled}
-       cp %{SOURCE2} %{name}-test.manifest
-%endif
+cp %{SOURCE2} %{name}-test.manifest
 %build
 
 export CFLAGS="${CFLAGS} -fPIC -Wall -g -fvisibility=hidden -fdata-sections -ffunction-sections"
 export CXXFLAGS="${CXXFLAGS} -fPIC -Wall -g -fvisibility=hidden"
 export LDFLAGS="${LDFLAGS} -Wl,--hash-style=both -Wl,--rpath=%{_libdir} -Wl,--as-needed"
 
-%cmake .  \
--DTZ_SYS_DATA=%TZ_SYS_DATA \
--DTZ_SYS_ETC=%TZ_SYS_ETC \
-%if %{test_email_app_enabled}
-        -DTEST_APP_SUPPORT=On
-%endif
+%cmake . -DTZ_SYS_DATA=%TZ_SYS_DATA -DTZ_SYS_ETC=%TZ_SYS_ETC -DBIN_INSTALL_DIR:PATH=%{_bindir}
 
 make %{?_smp_mflags}
 
@@ -136,11 +122,9 @@ ln -s ../email-service.socket %{buildroot}%{_unitdir_user}/sockets.target.wants/
 
 install -m 0775 %{SOURCE3} %{buildroot}%{_bindir}/
 
-%post
-/sbin/ldconfig
-%if %{test_email_app_enabled}
-       chsmack -e "User" %{_bindir}/email-test-app
-%endif
+%post -p /sbin/ldconfig
+%post test
+chsmack -e "User" %{_bindir}/email-test-app
 
 #################################################################
 # Set executin script
@@ -187,8 +171,6 @@ systemctl daemon-reload
 %{_libdir}/lib*.so
 %{_libdir}/pkgconfig/*.pc
 
-%if %{test_email_app_enabled}
 %files test
 %manifest email-service-test.manifest
 %{_bindir}/email-test-app
-%endif
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..eb8325f
--- /dev/null
@@ -0,0 +1,50 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(email-service)
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+       SET(CMAKE_BUILD_TYPE "Debug")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
+MESSAGE("")
+MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
+MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
+
+SET(VISIBILITY "-DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--gc-sections -fPIE")
+
+##########################################################
+# Define Test App
+##########################################################
+
+
+FILE(GLOB TEST_APP_SRCS
+    *.c)
+
+INCLUDE_DIRECTORIES(
+       ${CMAKE_SOURCE_DIR}/test
+       ${CMAKE_SOURCE_DIR}/email-api/include
+       ${CMAKE_SOURCE_DIR}/email-common-use/include
+       ${CMAKE_SOURCE_DIR}/email-core/include
+       ${CMAKE_SOURCE_DIR}/email-core/email-storage/include
+       ${CMAKE_SOURCE_DIR}/email-ipc/include
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(test_app_pkgs REQUIRED glib-2.0 gthread-2.0 vconf uw-imap-toolkit contacts-service2 gmime-2.6)
+
+FOREACH(flag ${test_app_pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
+SET(TEST_APP "email-test-app")
+
+ADD_EXECUTABLE(${TEST_APP} ${TEST_APP_SRCS})
+TARGET_LINK_LIBRARIES(${TEST_APP} ${test_app_pkgs_LDFLAGS} email-api email-smime-api)
+
+INSTALL(TARGETS ${TEST_APP} DESTINATION ${BIN_INSTALL_DIR})
+
diff --git a/test/main.c b/test/main.c
new file mode 100644 (file)
index 0000000..e09723a
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+*  email-service
+*
+* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
+*
+*/
+
+
+
+/* common header */
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+/* open header */
+#include <glib.h>
+
+#include "email-api-init.h"
+
+/* internal header */
+#include "testapp-utility.h"
+#include "testapp-account.h"
+#include "testapp-mail.h"
+#include "testapp-mailbox.h"
+#include "testapp-rule.h"
+#include "testapp-thread.h"
+#include "testapp-others.h"
+#include "testapp-gmime.h"
+
+/* function prototype */
+static void testapp_system_signal_handler(int signal_number);
+
+
+/* implementation */
+static gboolean testapp_initialize_testing()
+{
+       struct timeval tv_1, tv_2;
+       int interval;
+       int error;
+
+       /* register signal handler */
+       if (signal(SIGINT, testapp_system_signal_handler) == SIG_ERR) {
+               testapp_print("register signal handler fail\n");
+               return FALSE;
+       }
+
+       if (signal(SIGQUIT, testapp_system_signal_handler) == SIG_ERR) {
+               testapp_print("register signal handler fail\n");
+               return FALSE;
+       }
+
+       if (signal(SIGTSTP, testapp_system_signal_handler) == SIG_ERR) {
+               testapp_print("register signal handler fail\n");
+               return FALSE;
+       }
+
+       if (signal(SIGTERM, testapp_system_signal_handler) == SIG_ERR) {
+               testapp_print("register signal handler fail\n");
+               return FALSE;
+       }
+
+
+       gettimeofday(&tv_1, NULL);
+
+       if (email_service_begin() != EMAIL_ERROR_NONE) {
+               testapp_print("unexpected error: opening email service fail\n");
+               return FALSE;
+       }
+       gettimeofday(&tv_2, NULL);
+       interval = tv_2.tv_usec - tv_1.tv_usec;
+       testapp_print("\t email_service_begin Proceed time %d us\n", interval);
+
+       gettimeofday(&tv_1, NULL);
+       if ((error = email_open_db()) != EMAIL_ERROR_NONE) {
+               testapp_print("email_open_db failed [%d]\n", error);
+       }
+       gettimeofday(&tv_2, NULL);
+       interval = tv_2.tv_usec - tv_1.tv_usec;
+       testapp_print("\t email_open_db Proceed time %d us\n", interval);
+
+       return TRUE;
+}
+
+static gboolean testapp_finalize_testing()
+{
+       int error;
+
+       if ((error = email_close_db()) != EMAIL_ERROR_NONE) {
+               testapp_print("email_close_db failed [%d]\n", error);
+       }
+
+       if (email_service_end() != EMAIL_ERROR_NONE) {
+               testapp_print("unexpected error: closing email service fail \n");
+       }
+
+       return TRUE;
+}
+
+static void testapp_system_signal_handler (int signal_number)
+{
+       testapp_print("signal:%d\n", signal_number);
+       switch (signal_number) {
+               case SIGQUIT:
+               case SIGINT:
+               case SIGTSTP:
+               case SIGTERM:
+                       testapp_finalize_testing();
+                       break;
+
+               default:
+                       testapp_print("unhandled signal:%d\n", signal_number);
+                       break;
+       }
+       exit(0);
+}
+
+
+static gboolean testapp_interpret_command(int menu_number)
+{
+       gboolean go_to_loop = TRUE;
+
+       switch (menu_number) {
+               case 1:
+                       testapp_account_main();
+                       break;
+
+               case 2:
+                       testapp_mail_main();
+                       break;
+
+               case 3:
+                       email_test_mailbox_main();
+                       break;
+
+               case 4:
+                       break;
+
+               case 5:
+                       email_test_rule_main();
+                       break;
+
+               case 6:
+                       testapp_thread_main();
+                       break;
+
+               case 7:
+                       testapp_others_main();
+                       break;
+
+               case 8:
+                       testapp_gmime_main();
+                       break;
+
+               case 0:
+                       go_to_loop = FALSE;
+                       break;
+               default:
+                       break;
+       }
+
+       return go_to_loop;
+}
+
+int main(int argc, char *argv[])
+{
+       gboolean go_to_loop = TRUE;
+       int menu_number = 0;
+
+       if (testapp_initialize_testing() == FALSE) {
+               testapp_print("email-service is not ready\n");
+               exit(0);
+       }
+
+       while (go_to_loop) {
+               testapp_show_menu(EMAIL_MAIN_MENU);
+               testapp_show_prompt(EMAIL_MAIN_MENU);
+               if (0 >= scanf("%d", &menu_number))
+                       testapp_print("Invalid input");
+               go_to_loop = testapp_interpret_command(menu_number);
+       }
+
+       testapp_finalize_testing();
+
+       exit(0);
+}
+
+
diff --git a/test/testapp-account.c b/test/testapp-account.c
new file mode 100644 (file)
index 0000000..0dc994f
--- /dev/null
@@ -0,0 +1,1087 @@
+/*
+*  email-service
+*
+* Copyright(c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
+*
+*/
+
+/* common header */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+/* open header */
+#include <glib.h>
+
+#include "email-api.h"
+#include "email-api-smime.h"
+#include "email-api-account.h"
+#include "email-api-network.h"
+#include "email-types.h"
+
+/* internal header */
+#include "testapp-utility.h"
+#include "testapp-account.h"
+#include <sys/time.h>
+#include <sys/times.h>
+#include <tzplatform_config.h>
+
+/* internal defines */
+
+#define GWB_RECV_SERVER_ADDR       "pop.gawab.com"
+#define GWB_SMTP_SERVER_ADDR       "smtp.gawab.com"
+
+#define VDF_RECV_SERVER_ADDR  "imap.email.vodafone.de"
+#define VDF_SMTP_SERVER_ADDR  "smtp.email.vodafone.de"
+
+/*  SAMSUNG 3G TEST */
+#define S3G_RECV_SERVER_ADDR               "165.213.73.235"
+#define S3G_RECV_SERVER_PORT               EMAIL_POP3_PORT
+#define S3G_RECV_USE_SECURITY              0
+#define S3G_RECV_IMAP_USE_SECURITY     1
+#define S3G_SMTP_SERVER_ADDR               "165.213.73.235"
+#define S3G_SMTP_SERVER_PORT               465
+#define S3G_SMTP_AUTH                                  1
+#define S3G_SMTP_USE_SECURITY        1
+#define S3G_KEEP_ON_SERVER                   1
+
+gboolean  testapp_create_account_object(email_account_t **result_account)
+{
+       email_account_t *account = NULL;
+       char id_string[100] = { 0, }, password_string[1000] = { 0, }, address_string[100]  = { 0, };
+       char accesss_token[1000] = { 0, }, refresh_token[1000] = { 0, };
+       int samsung3g_account_index;
+       int account_type;
+
+       testapp_print("1. Gawab\n");
+       testapp_print("2. Vodafone\n");
+       testapp_print("4. SAMSUNG 3G TEST(POP)\n");
+       testapp_print("5. SAMSUNG 3G TEST(IMAP)\n");
+       testapp_print("6. Gmail(POP3)\n");
+       testapp_print("7. Gmail(IMAP4)\n");
+       testapp_print("8. Active Sync(dummy)\n");
+       testapp_print("9. AOL\n");
+       testapp_print("10. Hotmail\n");
+       testapp_print("11. Daum(IMAP4)\n");
+       testapp_print("12. Daum(POP3)\n");
+       testapp_print("13. Yahoo(IMAP ID)\n");
+       testapp_print("14. Gmail IMAP with XOAUTH\n");
+       testapp_print("15. Yandex\n");
+       testapp_print("16. mopera\n");
+       testapp_print("Choose server type: ");
+
+
+       if (0 >= scanf("%d", &account_type))
+               testapp_print("Invalid input. ");
+
+       switch (account_type) {
+               case 4:
+               case 5:
+                       do {
+                               testapp_print("Enter your account index [1~10] : ");
+                               if (0 >= scanf("%d", &samsung3g_account_index))
+                                       testapp_print("Invalid input. ");
+                       } while (samsung3g_account_index > 10 || samsung3g_account_index < 1);
+                       sprintf(id_string, "test%02d", samsung3g_account_index);
+                       sprintf(address_string, "test%02d@streaming.s3glab.net", samsung3g_account_index);
+                       sprintf(password_string, "test%02d", samsung3g_account_index);
+                       break;
+               case 14:
+                       testapp_print("Enter email address : ");
+                       if (0 >= scanf("%s", address_string))
+                               testapp_print("Invalid input. ");
+                       strcpy(id_string, address_string);
+
+                       testapp_print("Enter access token : ");
+                       if (0 >= scanf("%s", accesss_token))
+                               testapp_print("Invalid input. ");
+
+                       testapp_print("Enter refresh token : ");
+                       if (0 >= scanf("%s", refresh_token))
+                               testapp_print("Invalid input. ");
+
+                       snprintf(password_string, 100, "%s\001%s\001", accesss_token, refresh_token);
+                       break;
+               default:
+                       testapp_print("Enter email address : ");
+                       if (0 >= scanf("%s", address_string))
+                               testapp_print("Invalid input. ");
+
+                       testapp_print("Enter id : ");
+                       if (0 >= scanf("%s", id_string))
+                               testapp_print("Invalid input. ");
+
+                       testapp_print("Enter password_string : ");
+                       if (0 >= scanf("%s", password_string))
+                               testapp_print("Invalid input. ");
+                       break;
+       }
+
+       account = malloc(sizeof(email_account_t));
+       memset(account, 0x00, sizeof(email_account_t));
+
+       typedef struct {
+               int is_preset_account;
+               int index_color;
+       } user_data_t;
+       user_data_t data = (user_data_t) {1, 0};
+       /* if user_data_t has any pointer member, please don't use sizeof(). */
+       /* You need to serialize user_data to buffer and then take its length */
+       int data_length = sizeof(data);
+
+       /* Common Options */
+       account->retrieval_mode                          = EMAIL_IMAP4_RETRIEVAL_MODE_ALL;
+       account->incoming_server_secure_connection           = 1;
+       account->outgoing_server_type                    = EMAIL_SERVER_TYPE_SMTP;
+       account->auto_download_size                                  = 2;
+       account->outgoing_server_use_same_authenticator  = 1;
+       account->auto_resend_times                       = 3;
+       account->pop_before_smtp                         = 0;
+       account->incoming_server_requires_apop           = 0;
+       account->incoming_server_authentication_method   = 0;
+       account->logo_icon_path                          = NULL;
+       account->color_label                             = (128 << 16) | (128 << 8) | (128);
+       account->user_data                               = malloc(data_length);
+       memcpy(account->user_data, (void *)&data, data_length);
+       account->user_data_length                        = data_length;
+       account->options.priority                        = EMAIL_MAIL_PRIORITY_NORMAL;
+       account->options.keep_local_copy                 = 1;
+       account->options.req_delivery_receipt            = 0;
+       account->options.req_read_receipt                = 0;
+       account->options.download_limit                  = 0;
+       account->options.block_address                   = 0;
+       account->options.block_subject                   = 0;
+       account->options.display_name_from               = strdup("test");
+       account->options.reply_with_body                 = 0;
+       account->options.forward_with_files              = 0;
+       account->options.add_myname_card                 = 0;
+       account->options.add_signature                   = 1;
+       account->options.signature                       = strdup("abcdef");
+       account->options.add_my_address_to_bcc           = 0;
+       account->check_interval                          = 0;
+       account->keep_mails_on_pop_server_after_download = 1;
+       account->default_mail_slot_size                  = 20;
+       account->roaming_option                          = EMAIL_ROAMING_OPTION_RESTRICTED_BACKGROUND_TASK;
+       account->peak_interval                           = 30;
+       account->peak_days                               = EMAIL_PEAK_DAYS_MONDAY | EMAIL_PEAK_DAYS_TUEDAY | EMAIL_PEAK_DAYS_THUDAY | EMAIL_PEAK_DAYS_FRIDAY;
+       account->peak_start_time                         = 830;
+       account->peak_end_time                           = 1920;
+
+       account->account_name                            = strdup(address_string);
+       account->user_display_name                       = strdup(id_string);
+       account->user_email_address                      = strdup(address_string);
+       account->reply_to_address                        = strdup(address_string);
+       account->return_address                          = strdup(address_string);
+
+       account->incoming_server_user_name               = strdup(id_string);
+       account->incoming_server_password                = strdup(password_string);
+       account->outgoing_server_user_name               = strdup(id_string);
+       account->outgoing_server_password                    = strdup(password_string);
+
+       switch (account_type) {
+               case 1:/*  gawab */
+                       account->incoming_server_type                    = EMAIL_SERVER_TYPE_POP3 ;
+                       account->incoming_server_address                 = strdup(GWB_RECV_SERVER_ADDR);
+                       account->incoming_server_port_number         = EMAIL_POP3S_PORT;
+                       account->outgoing_server_address             = strdup(GWB_SMTP_SERVER_ADDR);
+                       account->incoming_server_secure_connection       = 1;
+                       account->outgoing_server_need_authentication = 1;
+                       account->outgoing_server_port_number         = EMAIL_SMTPS_PORT;
+                       account->outgoing_server_secure_connection   = 1;
+
+                       break;
+
+               case 2:/*  vadofone */
+                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
+                       account->incoming_server_address = strdup(VDF_RECV_SERVER_ADDR);
+                       account->incoming_server_port_number = EMAIL_IMAP_PORT;
+                       account->outgoing_server_address     = strdup(VDF_SMTP_SERVER_ADDR);
+                       account->incoming_server_secure_connection      = 0;
+                       account->outgoing_server_need_authentication = 0;
+                       break;
+
+               case 4:/*  SAMSUNG 3G TEST */
+                       account->incoming_server_type            = EMAIL_SERVER_TYPE_POP3;
+                       account->incoming_server_address         = strdup(S3G_RECV_SERVER_ADDR);
+                       account->incoming_server_port_number = S3G_RECV_SERVER_PORT;
+                       account->outgoing_server_address     = strdup(S3G_SMTP_SERVER_ADDR);
+                       account->outgoing_server_port_number = S3G_SMTP_SERVER_PORT;
+                       account->incoming_server_secure_connection      = S3G_RECV_USE_SECURITY;
+                       account->outgoing_server_secure_connection  = S3G_SMTP_USE_SECURITY;
+                       account->outgoing_server_need_authentication = S3G_SMTP_AUTH;
+                       break;
+
+               case 5:/*  SAMSUNG 3G TEST */
+                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
+                       account->incoming_server_address = strdup(S3G_RECV_SERVER_ADDR);
+                       account->incoming_server_port_number = EMAIL_IMAPS_PORT;
+                       account->outgoing_server_address     = strdup(S3G_SMTP_SERVER_ADDR);
+                       account->outgoing_server_port_number = S3G_SMTP_SERVER_PORT;
+                       account->incoming_server_secure_connection      = 1;
+                       account->outgoing_server_secure_connection  = S3G_SMTP_USE_SECURITY;
+                       account->outgoing_server_need_authentication = S3G_SMTP_AUTH;
+                       break;
+
+               case 6:/*  Gmail POP3 */
+                       account->incoming_server_type  = EMAIL_SERVER_TYPE_POP3;
+                       account->incoming_server_address = strdup("pop.gmail.com");
+                       account->incoming_server_port_number = 995;
+                       account->incoming_server_secure_connection      = 1;
+                       account->outgoing_server_address    = strdup("smtp.gmail.com");
+                       account->outgoing_server_port_number = 465;
+                       account->outgoing_server_secure_connection = 1;
+                       account->outgoing_server_need_authentication = 1;
+                       break;
+
+               case 7: /*  Gmail IMAP4 */
+                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
+                       account->incoming_server_address = strdup("imap.gmail.com");
+                       account->incoming_server_port_number = 993;
+                       account->incoming_server_secure_connection      = 1;
+                       account->outgoing_server_address = strdup("smtp.gmail.com");
+                       account->outgoing_server_port_number = 465;
+                       account->outgoing_server_secure_connection = 1;
+                       account->outgoing_server_need_authentication   = EMAIL_AUTHENTICATION_METHOD_DEFAULT;
+                       account->incoming_server_authentication_method = EMAIL_AUTHENTICATION_METHOD_NO_AUTH;
+                       break;
+
+               case 8: /*  Active Sync */
+                       account->incoming_server_type  = EMAIL_SERVER_TYPE_ACTIVE_SYNC;
+                       account->incoming_server_address = strdup("");
+                       account->incoming_server_port_number = 0;
+                       account->incoming_server_secure_connection      = 1;
+                       account->outgoing_server_address    = strdup("");
+                       account->outgoing_server_port_number = 0;
+                       account->outgoing_server_secure_connection = 1;
+                       account->outgoing_server_need_authentication = 1;
+                       break;
+
+               case 9: /*  AOL */
+                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
+                       account->incoming_server_address = strdup("imap.aol.com");
+                       account->incoming_server_port_number = 143;
+                       account->incoming_server_secure_connection      = 0;
+                       account->outgoing_server_address    = strdup("smtp.aol.com");
+                       account->outgoing_server_port_number = 587;
+                       account->outgoing_server_secure_connection = 0;
+                       account->outgoing_server_need_authentication = 1;
+                       break;
+
+               case 10: /*  Hotmail */
+                       account->incoming_server_type  = EMAIL_SERVER_TYPE_POP3;
+                       account->incoming_server_address = strdup("pop3.live.com");
+                       account->incoming_server_port_number = 995;
+                       account->incoming_server_secure_connection      = 1;
+                       account->outgoing_server_address    = strdup("smtp.live.com");
+                       account->outgoing_server_port_number = 587;
+                       account->outgoing_server_secure_connection  = 0x02;
+                       account->outgoing_server_need_authentication = 1;
+                       break;
+
+               case 11:/*  Daum IMAP4*/
+                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
+                       account->incoming_server_address = strdup("imap.daum.net");
+                       account->incoming_server_port_number = 993;
+                       account->incoming_server_secure_connection      = 1;
+                       account->outgoing_server_address    = strdup("smtp.daum.net");
+                       account->outgoing_server_port_number = 465;
+                       account->outgoing_server_secure_connection = 1;
+                       account->outgoing_server_need_authentication = 1;
+                       break;
+
+               case 12:/*  Daum POP3*/
+                       account->incoming_server_type  = EMAIL_SERVER_TYPE_POP3;
+                       account->incoming_server_address = strdup("pop.daum.net");
+                       account->incoming_server_port_number = 995;
+                       account->incoming_server_secure_connection      = 1;
+                       account->outgoing_server_address    = strdup("smtp.daum.net");
+                       account->outgoing_server_port_number = 465;
+                       account->outgoing_server_secure_connection = 1;
+                       account->outgoing_server_need_authentication = 1;
+                       break;
+
+               case 13: /* Yahoo IMAP ID */
+                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
+                       account->incoming_server_address = strdup("samsung.imap.mail.yahoo.com");
+                       account->incoming_server_port_number = 993;
+                       account->incoming_server_secure_connection      = 1;
+                       account->outgoing_server_address    = strdup("samsung.smtp.mail.yahoo.com");
+                       account->outgoing_server_port_number = 465;
+                       account->outgoing_server_secure_connection = 1;
+                       account->outgoing_server_need_authentication = 1;
+                       break;
+
+               case 14: /*  XOAUTH */
+                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
+                       account->incoming_server_address = strdup("imap.gmail.com");
+                       account->incoming_server_port_number = 993;
+                       account->incoming_server_secure_connection      = 1;
+                       account->outgoing_server_address = strdup("smtp.gmail.com");
+                       account->outgoing_server_port_number = 465;
+                       account->outgoing_server_secure_connection = 1;
+                       account->outgoing_server_need_authentication   = EMAIL_AUTHENTICATION_METHOD_XOAUTH2;
+                       account->incoming_server_authentication_method = EMAIL_AUTHENTICATION_METHOD_XOAUTH2;
+                       break;
+
+               case 15: /*  yandex */
+                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
+                       account->incoming_server_address = strdup("imap.yandex.ru");
+                       account->incoming_server_port_number = 993;
+                       account->incoming_server_secure_connection      = 1;
+                       account->outgoing_server_address = strdup("smtp.yandex.ru");
+                       account->outgoing_server_port_number = 465;
+                       account->outgoing_server_secure_connection = 1;
+                       account->outgoing_server_need_authentication   = EMAIL_AUTHENTICATION_METHOD_DEFAULT;
+                       account->incoming_server_authentication_method = EMAIL_AUTHENTICATION_METHOD_DEFAULT;
+                       break;
+
+               case 16: /*  mopera */
+                       account->incoming_server_type                  = EMAIL_SERVER_TYPE_POP3;
+                       account->incoming_server_address               = strdup("mail.mopera.net");
+                       account->incoming_server_port_number           = 110;
+                       account->incoming_server_secure_connection         = 0;
+                       account->incoming_server_authentication_method = EMAIL_AUTHENTICATION_METHOD_NO_AUTH;
+                       account->outgoing_server_address               = strdup("mail.mopera.net");
+                       account->outgoing_server_port_number           = 465;
+                       account->outgoing_server_secure_connection     = 0;
+                       account->outgoing_server_need_authentication   = EMAIL_AUTHENTICATION_METHOD_DEFAULT;
+                       break;
+
+               default:
+                       testapp_print("Invalid Account Number\n");
+                       return FALSE;
+                       break;
+       }
+       account->account_svc_id = 77;
+
+       if (result_account)
+               *result_account = account;
+
+       return TRUE;
+}
+
+static gboolean testapp_test_add_account_with_validation()
+{
+       int err = EMAIL_ERROR_NONE;
+       email_account_t *account = NULL;
+       int handle;
+       int flag = false;
+       int pre_count = 0;
+       int count = 0;
+       email_account_t *account_list = NULL;
+       int loop_count = 0;
+       if (!testapp_create_account_object(&account)) {
+               testapp_print("testapp_test_create_account_by_account_type error\n");
+               return FALSE;
+       }
+
+       email_get_account_list (&account_list, &pre_count);
+
+       err = email_add_account_with_validation(account, &handle);
+       if (err < 0) {
+               testapp_print("email_add_account_with_validation error : %d\n", err);
+               err = email_free_account(&account, 1);
+               return FALSE;
+       }
+
+       err = email_free_account(&account, 1);
+
+       do {
+               email_get_account_list (&account_list, &count);
+
+               if (count >  pre_count) {
+                       flag = true;
+                       testapp_print("email_add_account succeed.\n");
+               } else {
+                       testapp_print("account setting...\n");
+               }
+
+               sleep(3);
+               if (loop_count == 20) {
+                       testapp_print("email_add_account timeout.\n");
+                       break;
+               }
+               loop_count++;
+
+       } while (flag == false);
+
+
+       return TRUE;
+}
+
+static gboolean testapp_test_update_account()
+{
+       int account_id;
+       email_account_t *account = NULL;
+       //char account_name[256];
+       int err = EMAIL_ERROR_NONE;
+       //char signature[100] = {0};
+       //char user_email_address[256] = {0,};
+       //int add_my_address_to_bcc = 0;
+       int with_validation = 0; //account_svc_id = 0,
+
+       testapp_print("\n>> Enter Account ID: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       if ((err = email_get_account(account_id, GET_FULL_DATA, &account)) != EMAIL_ERROR_NONE) {
+               testapp_print("email_get_account failed - %d\n", err);
+               return false;
+       }
+
+       testapp_print("email_get_account result account_name - %s \n", account->account_name);
+       testapp_print("email_get_account result address - %s \n", account->user_email_address);
+       testapp_print("email_get_account result signature - %s \n", account->options.signature);
+       testapp_print("email_get_account result check_interval - %d \n", account->check_interval);
+
+       testapp_print("\n Enter new check interval(in mins):");
+       if (0 >= scanf("%d", &(account->check_interval)))
+               testapp_print("Invalid input. ");
+/*
+       testapp_print("\n Enter new peak interval(in mins):");
+       if (0 >= scanf("%d", &(account->peak_interval));
+
+       testapp_print("\n Enter new peak days:");
+       if (0 >= scanf("%d", &(account->peak_days));
+
+       testapp_print("\n Enter new peak start time:");
+       if (0 >= scanf("%d", &(account->peak_start_time));
+
+       testapp_print("\n Enter new peak end time:");
+       if (0 >= scanf("%d", &(account->peak_end_time));
+*/
+
+/*
+       testapp_print("\n Enter new Account name:");
+       if (0 >= scanf("%s",account_name);
+
+       testapp_print("\n Enter new email addr:");
+       if (0 >= scanf("%s",user_email_address);
+
+       testapp_print("\n Enter new signature:");
+       if (0 >= scanf("%s",signature);
+
+       testapp_print("\n>> Enter add_my_address_to_bcc:(0:off, 1:on) ");
+       if (0 >= scanf("%d", &add_my_address_to_bcc);
+
+       testapp_print("\n>> Enter account_svc_id: ");
+       if (0 >= scanf("%d", &account_svc_id);
+
+       testapp_print("\n>> With validation ?(0: No, 1:Yes) ");
+       if (0 >= scanf("%d", &with_validation);
+*/
+    if (account)  {
+               testapp_print("\n Assigning New Account name:(%s)", account->account_name);
+               testapp_print("\n Assigning New Signature:(%s)\n", account->options.signature);
+               /*
+               account->account_name = strdup(account_name);
+               account->user_email_address = strdup(user_email_address);
+               account->options.signature = strdup(signature);
+               account->options.add_my_address_to_bcc = add_my_address_to_bcc;
+               account->account_svc_id = account_svc_id;
+               */
+
+               if (with_validation) {
+                       if ((err = email_update_account_with_validation(account_id, account)) != EMAIL_ERROR_NONE) {
+                               testapp_print("email_update_account_with_validation failed - %d\n", err);
+                               return false;
+                       }
+                               testapp_print("email_update_account_with_validation successful \n");
+               } else {
+                       if ((err = email_update_account(account_id, account)) != EMAIL_ERROR_NONE) {
+                               testapp_print("email_update_account failed - %d\n", err);
+                               return false;
+                       }
+                       testapp_print("email_update_account successful \n");
+               }
+    }
+       return true;
+}
+
+static gboolean testapp_test_delete_account()
+{
+       int account_id;
+       email_account_t *account = NULL;
+       int err = EMAIL_ERROR_NONE;
+
+       testapp_print("\n>> Enter Account No: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+/* sowmya.kr, 281209 Adding signature to options in email_account_t changes */
+       if ((err = email_get_account(account_id, WITHOUT_OPTION, &account)) < 0) {
+               testapp_print("email_get_account failed \n");
+               testapp_print("testapp_test_delete_account failed\n");
+       } else {
+               testapp_print("email_get_account result account_name - %s \n", account->account_name);
+               if ((err = email_delete_account(account_id)) < 0)
+                       testapp_print("email_delete_account failed[%d]\n", err);
+               else
+                       testapp_print("email_delete_account successful \n");
+       }
+       return FALSE;
+
+}
+
+
+static gboolean testapp_test_validate_account()
+{
+       email_account_t *account = NULL;
+       int err_code = EMAIL_ERROR_NONE;
+       int handle = 0;
+
+       if (!testapp_create_account_object(&account)) {
+               testapp_print("testapp_create_account_object error\n");
+               return FALSE;
+       }
+
+       if ((err_code = email_validate_account_ex(account, &handle)) == EMAIL_ERROR_NONE)
+               testapp_print("email_validate_account_ex successful handle : %u\n", handle);
+       else
+               testapp_print("email_validate_account_ex failed err_code : %d \n", err_code);
+
+       if (account)
+               email_free_account(&account, 1);
+
+       return FALSE;
+
+}
+
+
+static gboolean testapp_test_cancel_validate_account()
+{
+       int account_id = 0;
+       int err_code = EMAIL_ERROR_NONE;
+       unsigned account_handle = 0;
+
+       testapp_print("\n > Enter account_id: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter handle: ");
+       if (0 >= scanf("%d", &account_handle))
+               testapp_print("Invalid input. ");
+
+       err_code = email_cancel_job(account_id, account_handle, EMAIL_CANCELED_BY_USER);
+       if (err_code == 0)
+               testapp_print("email_cancel_job Success..!handle:[%d]", account_handle);
+       else
+               testapp_print("email_cancel_job failed err_code: %d \n", err_code);
+
+       return FALSE;
+}
+
+static gboolean testapp_test_get_account()
+{
+       int account_id;
+       email_account_t *account = NULL;
+       int err_code = EMAIL_ERROR_NONE;
+       testapp_print("\n>> Enter Account No: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       typedef struct {
+               int is_preset_account;
+               int index_color;
+       } user_data_t;
+
+       testapp_print("\n----------------------------------------------------------\n");
+       testapp_print("email_get_account GET_FULL_DATA \n");
+       if ((err_code = email_get_account(account_id, GET_FULL_DATA, &account)) < 0) {
+               testapp_print("email_get_account failed - %d\n", err_code);
+               return FALSE;
+       }
+
+       user_data_t *val = (user_data_t *)account->user_data;
+       int is_preset_account =  val ? val->is_preset_account : 0;
+       int index_color = val ? val->index_color : 0;
+
+       testapp_print("email_get_account result\n"
+                       "account_name - %s \n"
+                       "user_email_address - %s \n"
+                       "incoming_server_secure_connection %d \n"
+                       "add_sig : %d \n"
+                       "signature %s \n"
+                       "add_my_address_to_bcc %d \n"
+                       "account_svc_id %d\n"
+                       "incoming_server_address %s\n"
+                       "outgoing_server_address %s\n"
+                       "default_mail_slot_size %d\n"
+                       "sync_status %d\n"
+                       "sync_disabled %d\n"
+                       "is_preset %d\n"
+                       "index_color %d\n"
+                       "certificate_path %s\n"
+                       "digest_type %d\n"
+                       "auto_resend_times %d\n"
+                       "roaming_option %d\n"
+                       "peak_interval %d\n"
+                       "peak_days %d\n"
+                       "peak_start_time %d\n"
+                       "peak_end_time %d\n"
+                       "color_label %d\n"
+                       "notification_status %d\n"
+                       "vibrate_status %d\n"
+                       "display_content_status %d\n"
+                       "default_ringtone_status %d\n"
+                       "alert_ringtone_path %s\n"
+               ,
+               account->account_name,
+               account->user_email_address,
+               account->incoming_server_secure_connection,
+               account->options.add_signature,
+               account->options.signature,
+               account->options.add_my_address_to_bcc,
+               account->account_svc_id,
+               account->incoming_server_address,
+               account->outgoing_server_address,
+               account->default_mail_slot_size,
+               account->sync_status,
+               account->sync_disabled,
+               is_preset_account,
+               index_color,
+               account->certificate_path,
+               account->digest_type,
+               account->auto_resend_times,
+               account->roaming_option,
+               account->peak_interval,
+               account->peak_days,
+               account->peak_start_time,
+               account->peak_end_time,
+               account->color_label,
+               account->options.notification_status,
+               account->options.vibrate_status,
+               account->options.display_content_status,
+               account->options.default_ringtone_status,
+               account->options.alert_ringtone_path
+               );
+
+       err_code = email_free_account(&account, 1);
+
+       testapp_print("\n----------------------------------------------------------\n");
+       testapp_print("email_get_account WITHOUT_OPTION \n");
+
+       if ((err_code = email_get_account(account_id, WITHOUT_OPTION, &account)) < 0) {
+               testapp_print("email_get_account failed \n");
+               return FALSE;
+       }
+
+       testapp_print("email_get_account result\n"
+                       "account_name - %s \n"
+                       "user_email_address - %s \n"
+                       "incoming_server_secure_connection %d \n"
+                       "add_signature : %d \n",
+               account->account_name,
+               account->user_email_address,
+               account->incoming_server_secure_connection,
+               account->options.add_signature
+       );
+
+       if (account->options.signature)
+               testapp_print("signature : %s\n", account->options.signature);
+       else
+               testapp_print("signature not retrieved \n");
+
+       err_code = email_free_account(&account, 1);
+
+       testapp_print("\n----------------------------------------------------------\n");
+       testapp_print("email_get_account ONLY_OPTION \n");
+
+       if ((err_code = email_get_account(account_id, ONLY_OPTION, &account)) < 0) {
+               testapp_print("email_get_account failed \n");
+               return FALSE;
+       }
+
+       testapp_print("email_get_account result\n"
+                       "add_sig : %d \n"
+                       "signature %s \n"
+                       "add_my_address_to_bcc %d\n"
+                       "account_svc_id %d\n",
+               account->options.add_signature,
+               account->options.signature,
+               account->options.add_my_address_to_bcc,
+               account->account_svc_id
+               );
+
+       if (account->account_name)
+               testapp_print("account_name : %s \n", account->account_name);
+       else
+               testapp_print("account_name not retrieved \n");
+
+       if (account->user_email_address)
+               testapp_print("user_email_address : %s \n", account->user_email_address);
+       else
+               testapp_print("user_email_address not retrieved \n");
+       err_code = email_free_account(&account, 1);
+
+       return FALSE;
+}
+
+static gboolean testapp_test_get_account_list()
+{
+
+       int count, i;
+       email_account_t *account_list = NULL;
+       struct timeval tv_1, tv_2;
+       int interval;
+       int err_code = EMAIL_ERROR_NONE;
+
+       gettimeofday(&tv_1, NULL);
+
+       if ((err_code = email_get_account_list(&account_list, &count)) < 0) {
+               testapp_print("   email_get_account_list error\n");
+               return false ;
+       }
+
+       gettimeofday(&tv_2, NULL);
+       interval = tv_2.tv_usec - tv_1.tv_usec;
+       testapp_print("\t testapp_test_get_account_list Proceed time %d us\n", interval);
+
+       for (i = 0; i < count; i++) {
+               testapp_print("   %2d) %-15s %-30s\n", account_list[i].account_id,
+                       account_list[i].account_name,
+                       account_list[i].user_email_address);
+       }
+
+       err_code = email_free_account(&account_list, count);
+       return FALSE;
+}
+
+static gboolean testapp_test_update_check_interval()
+{
+       int account_id = 0;
+       int err_code = EMAIL_ERROR_NONE;
+       email_account_t *account = NULL;
+
+       testapp_print("\n Enter account id :");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       if ((err_code = email_get_account(account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account)) != EMAIL_ERROR_NONE) {
+               testapp_print("email_get_account failed [%d]\n", err_code);
+               goto FINISH_OFF;
+       }
+
+       testapp_print("\n Enter new check interval(in mins):");
+       if (0 >= scanf("%d", &(account->check_interval)))
+               testapp_print("Invalid input. ");
+
+       if ((err_code = email_update_account(account_id, account)) != EMAIL_ERROR_NONE) {
+               testapp_print("email_update_account failed [%d]\n", err_code);
+               goto FINISH_OFF;
+       }
+
+       testapp_print("email_update_account successful \n");
+
+FINISH_OFF:
+       if (account)
+               email_free_account(&account, 1);
+
+       return err_code;
+}
+
+static gboolean testapp_test_backup_account()
+{
+       const char *file_name = tzplatform_mkpath(TZ_USER_DATA, "email/accounts_file");
+       int error_code;
+       error_code = email_backup_accounts_into_secure_storage(file_name);
+       testapp_print("\n email_backup_accounts_into_secure_storage returned [%d]\n", error_code);
+       return FALSE;
+}
+static gboolean testapp_test_restore_account()
+{
+       const char *file_name = tzplatform_mkpath(TZ_USER_DATA,"email/accounts_file");
+       int error_code;
+       error_code = email_restore_accounts_from_secure_storage(file_name);
+       testapp_print("\n email_restore_accounts_from_secure_storage returned [%d]\n", error_code);
+       return FALSE;
+}
+
+static gboolean testapp_test_get_password_length_of_account()
+{
+       int password_length, account_id;
+
+       testapp_print("\n input account id\n");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+       email_get_password_length_of_account(account_id, EMAIL_GET_INCOMING_PASSWORD_LENGTH, &password_length);
+       testapp_print("testapp_test_get_password_length_of_account returned [%d]\n", password_length);
+       return FALSE;
+}
+
+static gboolean testapp_test_update_notification()
+{
+       int error_code;
+       int account_id = 0;
+       int t_mail_count = 0;
+       int input_from_eas = 0;
+       int unread_mail_count = 0;
+
+       testapp_print("\n Input account ID:\n");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n Input mail count:\n");
+       if (0 >= scanf("%d", &t_mail_count))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n Input unread mail count:\n");
+       if (0 >= scanf("%d", &unread_mail_count))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n Input From eas:\n");
+       if (0 >= scanf("%d", &input_from_eas))
+               testapp_print("Invalid input. ");
+
+       error_code = email_update_notification_bar(account_id, t_mail_count, unread_mail_count, input_from_eas);
+       testapp_print("email_update_notification_bar returned [%d]\n", error_code);
+       return FALSE;
+}
+
+static gboolean testapp_test_clear_notification()
+{
+       int account_id = 0;
+       int error_code;
+
+       testapp_print("\n Input account ID:\n");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       error_code = email_clear_notification_bar(account_id);
+       testapp_print("email_clear_notification_bar returned [%d]\n", error_code);
+       return FALSE;
+}
+
+static gboolean testapp_test_clear_all_notification()
+{
+       int error_code;
+
+       error_code = email_clear_notification_bar(ALL_ACCOUNT);
+       testapp_print("email_clear_notification_bar returned [%d]\n", error_code);
+       return FALSE;
+}
+
+static gboolean testapp_test_save_default_account_id()
+{
+       int error_code;
+       int account_id = 0;
+
+       testapp_print("\nInput default account id : ");
+
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       error_code = email_save_default_account_id(account_id);
+
+       testapp_print("email_save_default_account_id returned [%d]\n", error_code);
+       return FALSE;
+}
+
+static gboolean testapp_test_load_default_account_id()
+{
+       int error_code;
+       int account_id = 0;
+
+       error_code = email_load_default_account_id(&account_id);
+
+       testapp_print("\ndefault account id : %d\n", account_id);
+       testapp_print("email_load_default_account_id returned [%d]\n", error_code);
+       return FALSE;
+}
+
+static gboolean testapp_test_add_account()
+{
+       int err = EMAIL_ERROR_NONE;
+       email_account_t *account = NULL;
+
+       if (!testapp_create_account_object(&account)) {
+               testapp_print("testapp_test_create_account_by_account_type error\n");
+               return FALSE;
+       }
+
+       err = email_add_account(account);
+       if (err < 0) {
+               testapp_print("email_add_account error : %d\n", err);
+               err = email_free_account(&account, 1);
+               return FALSE;
+       }
+
+       testapp_print("email_add_account succeed. account_id\n", account->account_id);
+
+       err = email_free_account(&account, 1);
+
+       return true;
+}
+
+static gboolean testapp_test_update_peak_schedule()
+{
+       int account_id;
+       email_account_t *account = NULL;
+       int err = EMAIL_ERROR_NONE;
+
+       testapp_print("\n>> Enter Account No: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       if ((err = email_get_account(account_id, GET_FULL_DATA, &account)) != EMAIL_ERROR_NONE) {
+               testapp_print("email_get_account failed [%d]\n", err);
+               return false;
+       }
+
+       testapp_print("old check_interval - %d \n", account->check_interval);
+       testapp_print("\n Enter new check interval(in mins):");
+       if (0 >= scanf("%d", &(account->check_interval)))
+               testapp_print("Invalid input. ");
+
+       testapp_print("old peak_interval - %d \n", account->peak_interval);
+
+       testapp_print("\n Enter new peak interval(in mins):");
+       if (0 >= scanf("%d", &(account->peak_interval)))
+               testapp_print("Invalid input. ");
+
+       testapp_print("old peak_days - %d \n", account->peak_days);
+
+       testapp_print("\n Enter new peak days:");
+       if (0 >= scanf("%d", &(account->peak_days)))
+               testapp_print("Invalid input. ");
+
+       testapp_print("old peak_start_time - %d \n", account->peak_start_time);
+
+       testapp_print("\n Enter new peak start time:");
+       if (0 >= scanf("%d", &(account->peak_start_time)))
+               testapp_print("Invalid input. ");
+
+       testapp_print("old peak_end_time - %d \n", account->peak_start_time);
+
+       testapp_print("\n Enter new peak end time:");
+       if (0 >= scanf("%d", &(account->peak_end_time)))
+               testapp_print("Invalid input. ");
+
+       if (account)  {
+               if ((err = email_update_account(account_id, account)) != EMAIL_ERROR_NONE) {
+                       testapp_print("email_update_account failed [%d]\n", err);
+                       return false;
+               }
+               testapp_print("email_update_account successful \n");
+       }
+       return true;
+}
+
+static gboolean testapp_test_interpret_command(int selected_number)
+{
+       gboolean go_to_loop = TRUE;
+
+       switch (selected_number) {
+               case 1:
+                       testapp_test_add_account_with_validation();
+                       break;
+
+               case 2:
+                       testapp_test_update_account();
+                       break;
+
+               case 3:
+                       testapp_test_delete_account();
+                       break;
+
+               case 4:
+                       testapp_test_get_account();
+                       break;
+
+               case 5:
+                       testapp_test_get_account_list();
+                       break;
+
+               case 6:
+                       testapp_test_update_check_interval();
+                       break;
+
+               case 7:
+                       testapp_test_validate_account();
+                       break;
+
+               case 8:
+                       testapp_test_cancel_validate_account();
+                       break;
+
+               case 9:
+                       testapp_test_backup_account();
+                       break;
+
+               case 10:
+                       testapp_test_restore_account();
+                       break;
+
+               case 11:
+                       testapp_test_get_password_length_of_account();
+                       break;
+
+               case 13:
+                       testapp_test_update_notification();
+                       break;
+
+               case 14:
+                       testapp_test_clear_notification();
+                       break;
+
+               case 15:
+                       testapp_test_clear_all_notification();
+                       break;
+
+               case 16:
+                       testapp_test_save_default_account_id();
+                       break;
+
+               case 17:
+                       testapp_test_load_default_account_id();
+                       break;
+
+               case 18:
+                       testapp_test_add_account();
+                       break;
+
+               case 19:
+                       testapp_test_update_peak_schedule();
+                       break;
+
+               case 0:
+                       go_to_loop = FALSE;
+                       break;
+
+               default:
+                       break;
+       }
+
+       return go_to_loop;
+}
+
+void testapp_account_main()
+{
+       gboolean go_to_loop = TRUE;
+       int menu_number = 0;
+
+       while (go_to_loop) {
+               testapp_show_menu(EMAIL_ACCOUNT_MENU);
+               testapp_show_prompt(EMAIL_ACCOUNT_MENU);
+
+               if (0 >= scanf("%d", &menu_number))
+                       testapp_print("Invalid input");
+
+               go_to_loop = testapp_test_interpret_command(menu_number);
+       }
+}
+
diff --git a/test/testapp-account.h b/test/testapp-account.h
new file mode 100644 (file)
index 0000000..1c19e78
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+*  email-service
+*
+* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_ACCOUNT_H
+#define EMAIL_TEST_ACCOUNT_H
+
+/* export API */
+void testapp_account_main();
+
+#endif
diff --git a/test/testapp-gmime.c b/test/testapp-gmime.c
new file mode 100644 (file)
index 0000000..ae68938
--- /dev/null
@@ -0,0 +1,192 @@
+#include <glib.h>
+#include <gmime/gmime.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include "testapp-utility.h"
+#include "testapp-gmime.h"
+
+
+#define TEST_EML_PATH "/tmp/test.eml"
+/*
+static void print_depth(int depth)
+{
+       int i;
+       for (i = 0; i < depth; i++)
+               testapp_print("    \n");
+}
+*/
+/*
+static void print_mime_struct(GMimeObject *part, int depth)
+{
+       const GMimeContentType *type;
+       GMimeMultipart *multipart;
+       GMimeObject *subpart;
+       int i, n;
+
+       print_depth(depth);
+       type = g_mime_object_get_content_type(part);
+       testapp_print("Content-Type: %s/%s\n", type->type, type->subtype);
+
+       if (GMIME_IS_MULTIPART(part)) {
+               multipart = (GMimeMultipart *)part;
+
+               n = g_mime_multipart_get_count(multipart);
+               for (i = 0; i < n; i++) {
+                       subpart = g_mime_multipart_get_part(multipart, i);
+                       print_mime_struct(subpart, depth + 1);
+                       g_object_unref(subpart);
+               }
+       }
+}
+*/
+static void
+test_eml_parsing_foreach_callback(GMimeObject *parent, GMimeObject *part, gpointer user_data)
+{
+       int *cnt = user_data;
+
+       (*cnt)++;
+
+       if (GMIME_IS_PART(part)) {
+               testapp_print ("Part\n");
+               GMimePart *leaf_part = NULL;
+               leaf_part = (GMimePart *)part;
+
+               testapp_print("Content ID:%s\n", g_mime_part_get_content_id(leaf_part));
+               testapp_print("Description:%s\n", g_mime_part_get_content_description(leaf_part));
+               testapp_print("MD5:%s\n", g_mime_part_get_content_md5(leaf_part));
+               testapp_print("Location:%s\n", g_mime_part_get_content_location(leaf_part));
+
+               GMimeContentEncoding enc = g_mime_part_get_content_encoding(leaf_part);
+               switch (enc) {
+               case GMIME_CONTENT_ENCODING_DEFAULT:
+                       testapp_print("Encoding:ENCODING_DEFAULT\n");
+                       break;
+               case GMIME_CONTENT_ENCODING_7BIT:
+                       testapp_print("Encoding:ENCODING_7BIT\n");
+                       break;
+               case GMIME_CONTENT_ENCODING_8BIT:
+                       testapp_print("Encoding:ENCODING_8BIT\n");
+                       break;
+               case GMIME_CONTENT_ENCODING_BINARY:
+                       testapp_print("Encoding:ENCODING_BINARY\n");
+                       break;
+               case GMIME_CONTENT_ENCODING_BASE64:
+                       testapp_print("Encoding:ENCODING_BASE64\n");
+                       break;
+               case GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE:
+                       testapp_print("Encoding:ENCODING_QUOTEDPRINTABLE\n");
+                       break;
+               case GMIME_CONTENT_ENCODING_UUENCODE:
+                       testapp_print("Encoding:ENCODING_UUENCODE\n");
+                       break;
+
+               default:
+                       break;
+               }
+
+               testapp_print("File name:%s\n\n\n", g_mime_part_get_filename(leaf_part));
+               GMimeDataWrapper *data = g_mime_part_get_content_object(leaf_part);
+
+               if (data) {
+                       char tmp_path[50] = {0,};
+                       snprintf(tmp_path, sizeof(tmp_path), "/tmp/gmime_content%d", *cnt);
+
+                       int fd;
+                       if ((fd = open(tmp_path, O_RDWR|O_CREAT, 0)) == -1) {
+                               testapp_print ("open fail\n");
+                       }
+                       GMimeStream *out_stream;
+                       out_stream = g_mime_stream_fs_new(fd);
+                       g_mime_data_wrapper_write_to_stream(data, out_stream);
+                       g_object_unref(out_stream);
+               }
+       }
+}
+
+static gboolean testapp_test_gmime_eml_parsing(void)
+{
+       GMimeMessage *message;
+       GMimeParser *parser;
+       GMimeStream *stream;
+       int fd;
+       int count = 0;
+
+       if ((fd = open(TEST_EML_PATH, O_RDONLY, 0)) == -1) {
+               testapp_print ("open fail\n");
+               return FALSE;
+       }
+
+       /* init the gmime library */
+       g_mime_init(0);
+
+       /* create a stream to read from the file descriptor */
+       stream = g_mime_stream_fs_new(fd);
+
+       /* create a new parser object to parse the stream */
+       parser = g_mime_parser_new_with_stream(stream);
+
+       /* unref the stream (parser owns a ref, so this object does not actually get free'd until we destroy the parser) */
+       g_object_unref(stream);
+
+       /* parse the message from the stream */
+       message = g_mime_parser_construct_message(parser);
+
+       /* free the parser (and the stream) */
+       g_object_unref(parser);
+
+       testapp_print("Sender:%s\n", g_mime_message_get_sender(message));
+       testapp_print("Reply To:%s\n", g_mime_message_get_reply_to(message));
+       testapp_print("Subject:%s\n", g_mime_message_get_subject(message));
+       testapp_print("Date:%s\n", g_mime_message_get_date_as_string(message));
+       testapp_print("Message ID:%s\n", g_mime_message_get_message_id(message));
+
+       GMimeObject *po = (GMimeObject *)message;
+       testapp_print("Header String:%s\n\n\n\n", g_mime_header_list_to_string(po->headers));
+
+       g_mime_message_foreach(message, test_eml_parsing_foreach_callback, &count);
+       return TRUE;
+}
+
+static gboolean testapp_test_interpret_command(int menu_number)
+{
+       gboolean go_to_loop = TRUE;
+
+       switch (menu_number) {
+               case 1:
+                       testapp_test_gmime_eml_parsing();
+                       break;
+
+               case 0:
+                       go_to_loop = FALSE;
+                       break;
+               default:
+                       break;
+       }
+
+       return go_to_loop;
+}
+
+void testapp_gmime_main()
+{
+       gboolean go_to_loop = TRUE;
+       int menu_number = 0;
+       while (go_to_loop) {
+               testapp_show_menu(EMAIL_GMIME_MENU);
+               testapp_show_prompt(EMAIL_GMIME_MENU);
+
+               if(0 >= scanf("%d", &menu_number)){
+                       testapp_print ("input fail\n");
+                       continue;
+               }
+
+               go_to_loop = testapp_test_interpret_command(menu_number);
+       }
+}
diff --git a/test/testapp-gmime.h b/test/testapp-gmime.h
new file mode 100644 (file)
index 0000000..0aeafee
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+*  email-service
+*
+* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_GMIME_H
+#define EMAIL_TEST_GMIME_H
+
+/* export API */
+void testapp_gmime_main(void);
+
+#endif
+
diff --git a/test/testapp-mail.c b/test/testapp-mail.c
new file mode 100644 (file)
index 0000000..1bef6c7
--- /dev/null
@@ -0,0 +1,2796 @@
+/*
+*  email-service
+*
+* Copyright(c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
+*
+*/
+
+
+
+/* common header */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <wait.h>
+
+/* open header */
+#include <glib.h>
+#include <time.h>
+
+#include "email-api-account.h"
+#include "email-api-network.h"
+#include "email-api-mail.h"
+#include "email-api-mailbox.h"
+#include "email-api-etc.h"
+#include "email-api-smime.h"
+
+/* internal header */
+#include "testapp-utility.h"
+#include "testapp-mail.h"
+#include "email-core-utils.h"
+#include "email-core-mime.h"
+
+#define MAIL_TEMP_BODY "/tmp/utf8"
+#define HTML_TEMP_BODY "/tmp/utf8.htm"
+
+/*
+static void testapp_test_print_sorting_menu()
+{
+       testapp_print("   EMAIL_SORT_DATETIME_HIGH = 0\n");
+       testapp_print("   EMAIL_SORT_DATETIME_LOW = 1\n");
+       testapp_print("   EMAIL_SORT_SENDER_HIGH = 2\n");
+       testapp_print("   EMAIL_SORT_SENDER_LOW = 3\n");
+       testapp_print("   EMAIL_SORT_RCPT_HIGH = 4\n");
+       testapp_print("   EMAIL_SORT_RCPT_LOW = 5\n");
+       testapp_print("   EMAIL_SORT_SUBJECT_HIGH = 6\n");
+       testapp_print("   EMAIL_SORT_SUBJECT_LOW = 7\n");
+       testapp_print("   EMAIL_SORT_PRIORITY_HIGH = 8\n");
+       testapp_print("   EMAIL_SORT_PRIORITY_LOW = 9\n");
+       testapp_print("   EMAIL_SORT_ATTACHMENT_HIGH = 10\n");
+       testapp_print("   EMAIL_SORT_ATTACHMENT_LOW = 11\n");
+       testapp_print("   EMAIL_SORT_FAVORITE_HIGH = 12\n");
+       testapp_print("   EMAIL_SORT_FAVORITE_LOW = 13\n");
+}
+
+static void testapp_test_print_mail_list_item(email_mail_list_item_t *mail_list_item, int count)
+{
+       int i;
+
+       testapp_print("\n>>>>> Print mail list items: count[%d]\n", count);
+       for (i=0; i< count; i++) {
+               testapp_print("\n[%d]\n", i);
+               testapp_print(" >>> Mailbox Name [ %s ] \n", mail_list_item[i].mailbox_name);
+               testapp_print(" >>> Mail ID [ %d ] \n", mail_list_item[i].mail_id);
+               testapp_print(" >>> Account ID [ %d ] \n", mail_list_item[i].account_id);
+               if (mail_list_item[i].from!= NULL) {
+                       testapp_print(" >>> From [ %s ] \n", mail_list_item[i].from);
+               }
+               if (mail_list_item[i].from_email_address != NULL) {
+                       testapp_print(" >>> from_email_address [ %s ] \n", mail_list_item[i].from_email_address);
+               }
+               if (mail_list_item[i].recipients!= NULL) {
+                       testapp_print(" >>> recipients [ %s ] \n", mail_list_item[i].recipients);
+               }
+               if (mail_list_item[i].subject != NULL) {
+                       testapp_print(" >>> subject [ %s ] \n", mail_list_item[i].subject);
+               }
+               testapp_print(" >>> text_download_yn [ %d ] \n", mail_list_item[i].body_download_status);
+               testapp_print(" >>> date_time [ %d ] \n", mail_list_item[i].date_time);
+               testapp_print(" >>> flags_seen_field [ %d ] \n", mail_list_item[i].flags_seen_field);
+               testapp_print(" >>> priority [ %d ] \n", mail_list_item[i].priority);
+               testapp_print(" >>> save_status [ %d ] \n", mail_list_item[i].save_status);
+               testapp_print(" >>> lock [ %d ] \n", mail_list_item[i].lock_status);
+               testapp_print(" >>> report_status [ %d ] \n", mail_list_item[i].report_status);
+               testapp_print(" >>> recipients_count [ %d ] \n", mail_list_item[i].recipients_count);
+               testapp_print(" >>> attachment_count [ %d ] \n", mail_list_item[i].attachment_count);
+               testapp_print(" >>> DRM_status [ %d ] \n", mail_list_item[i].DRM_status);
+
+               if (mail_list_item[i].preview_text != NULL) {
+                       testapp_print(" >>> preview_text [ %s ] \n", mail_list_item[i].preview_text);
+               }
+
+               testapp_print(" >>> thread_id [ %d ] \n", mail_list_item[i].thread_id);
+               testapp_print(" >>> thread_item_count [ %d ] \n", mail_list_item[i].thread_item_count);
+       }
+}
+*/
+
+static gboolean testapp_add_mail_for_sending(int *result_mail_id)
+{
+       int                    i = 0;
+       int                    account_id = 0;
+       int                    err = EMAIL_ERROR_NONE;
+       int                    smime_type = 0;
+       char                   recipient_address[300] = { 0 , };
+       char                   from_address[300] = { 0 , };
+       char                   passpharse[300] = {0, };
+       const char            *body_file_path = MAIL_TEMP_BODY;
+
+       email_account_t       *account_data = NULL;
+       email_mailbox_t       *mailbox_data = NULL;
+       email_mail_data_t     *test_mail_data = NULL;
+       FILE                  *body_file;
+
+       testapp_print("\n > Enter account id : ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter recipient address : ");
+       if (0 >= scanf("%s", recipient_address))
+               testapp_print("Invalid input. ");
+
+       email_get_account(account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account_data);
+
+       email_get_mailbox_by_mailbox_type(account_id, EMAIL_MAILBOX_TYPE_OUTBOX, &mailbox_data);
+
+       test_mail_data = malloc(sizeof(email_mail_data_t));
+       memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
+
+       SNPRINTF(from_address, 300, "<%s>", account_data->user_email_address);
+
+       test_mail_data->account_id             = account_id;
+       test_mail_data->save_status            = EMAIL_MAIL_STATUS_SEND_DELAYED;
+       test_mail_data->body_download_status   = 1;
+       test_mail_data->flags_seen_field       = 1;
+       test_mail_data->file_path_plain        = strdup(body_file_path);
+       test_mail_data->mailbox_id             = mailbox_data->mailbox_id;
+       test_mail_data->mailbox_type           = mailbox_data->mailbox_type;
+       test_mail_data->full_address_from      = strdup(from_address);
+       test_mail_data->full_address_to        = strdup(recipient_address);
+       test_mail_data->subject                = strdup("Read receipt request from TIZEN");
+       test_mail_data->remaining_resend_times = 3;
+       test_mail_data->report_status          = EMAIL_MAIL_REQUEST_DSN | EMAIL_MAIL_REQUEST_MDN;
+
+       body_file = fopen(body_file_path, "w");
+
+       testapp_print("\n body_file [%p]\n", body_file);
+
+       if (body_file == NULL) {
+               testapp_print("\n fopen [%s]failed\n", body_file_path);
+               return FALSE;
+       }
+
+       for (i = 0; i < 100; i++)
+               fprintf(body_file, "Mail sending Test. [%d]\n", i);
+
+       fflush(body_file);
+       fclose(body_file);
+
+       testapp_print(" > Select smime? [0: Normal, 1: sign, 2: Encrpyt, 3: sing + encrypt, 4: pgp sign, 5: pgp encrypted, 6: pgp sign + encrypt] : ");
+       if (0 >= scanf("%d", &smime_type))
+               testapp_print("Invalid input. ");
+       test_mail_data->smime_type = smime_type;
+
+       if (smime_type >= EMAIL_PGP_SIGNED) {
+               testapp_print(" > passpharse : ");
+               if (0 >= scanf("%s", passpharse))
+                       testapp_print("Invalid input. ");
+               test_mail_data->pgp_password = strdup(passpharse);
+       }
+
+       if ((err = email_add_mail(test_mail_data, NULL, 0, NULL, 0)) != EMAIL_ERROR_NONE)
+               testapp_print("email_add_mail failed. [%d]\n", err);
+       else
+               testapp_print("email_add_mail success.\n");
+
+       testapp_print("saved mail id = [%d]\n", test_mail_data->mail_id);
+
+       if (result_mail_id)
+               *result_mail_id = test_mail_data->mail_id;
+
+       email_free_mail_data(&test_mail_data, 1);
+       email_free_mailbox(&mailbox_data, 1);
+       email_free_account(&account_data, 1);
+
+       return FALSE;
+}
+
+static gboolean testapp_test_add_mail(int *result_mail_id)
+{
+       int                    i = 0;
+       int                    account_id = 0;
+       int                    mailbox_id = 0;
+       int                    from_eas = 0;
+       int                    attachment_count = 0;
+       int                    err = EMAIL_ERROR_NONE;
+       int                    smime_type = 0;
+       char                   arg[50] = { 0 , };
+       const char            *body_file_path = MAIL_TEMP_BODY;
+       email_mailbox_t         *mailbox_data = NULL;
+       email_mail_data_t       *test_mail_data = NULL;
+       email_attachment_data_t *attachment_data = NULL;
+       email_meeting_request_t *meeting_req = NULL;
+       FILE                  *body_file;
+
+       testapp_print("\n > Enter account id : ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       memset(arg, 0x00, 50);
+       testapp_print("\n > Enter mailbox id : ");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input. ");
+
+       email_get_mailbox_by_mailbox_id(mailbox_id, &mailbox_data);
+
+       test_mail_data = malloc(sizeof(email_mail_data_t));
+       memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
+
+       testapp_print("\n From EAS? [0/1]> ");
+       if (0 >= scanf("%d", &from_eas))
+               testapp_print("Invalid input. ");
+
+       test_mail_data->account_id             = account_id;
+       test_mail_data->save_status            = 1;
+       test_mail_data->body_download_status   = 1;
+       test_mail_data->flags_seen_field       = 1;
+       test_mail_data->file_path_plain        = strdup(body_file_path);
+       test_mail_data->mailbox_id             = mailbox_id;
+       test_mail_data->mailbox_type           = mailbox_data->mailbox_type;
+       test_mail_data->full_address_from      = strdup("<test1@test.com>");
+       test_mail_data->full_address_to        = strdup("<test2@test.com>");
+       test_mail_data->full_address_cc        = strdup("<test3@test.com>");
+       test_mail_data->full_address_bcc       = strdup("<test4@test.com>");
+       test_mail_data->subject                = strdup("Meeting request mail");
+       test_mail_data->remaining_resend_times = 3;
+       test_mail_data->eas_data               = strdup("EAS DATA TEST");
+       test_mail_data->eas_data_length        = strlen(test_mail_data->eas_data) + 1;
+
+       body_file = fopen(body_file_path, "w");
+
+       testapp_print("\n body_file [%p]\n", body_file);
+
+       if (body_file == NULL) {
+               testapp_print("\n fopen [%s]failed\n", body_file_path);
+               return FALSE;
+       }
+/*
+       for (i = 0; i < 500; i++)
+               fprintf(body_file, "X2 X2 X2 X2 X2 X2 X2");
+*/
+       fprintf(body_file, "Hello world");
+       fflush(body_file);
+       fclose(body_file);
+
+       testapp_print(" > Select smime? [0: Normal, 1: sign, 2: Encrypt, 3: sing + encrypt] : ");
+       if (0 >= scanf("%d", &smime_type))
+               testapp_print("Invalid input. ");
+       test_mail_data->smime_type = smime_type;
+
+       testapp_print(" > How many file attachment? [>=0] : ");
+       if (0 >= scanf("%d", &attachment_count))
+               testapp_print("Invalid input. ");
+
+       test_mail_data->attachment_count  = attachment_count;
+       if (attachment_count > 0)
+               attachment_data = calloc(attachment_count, sizeof(email_attachment_data_t));
+
+
+       for (i = 0; i < attachment_count ; i++) {
+               memset(arg, 0x00, 50);
+               testapp_print("\n > Enter attachment name : ");
+               if (0 >= scanf("%s", arg))
+                       testapp_print("Invalid input. ");
+
+               attachment_data[i].attachment_name  = strdup(arg);
+
+               memset(arg, 0x00, 50);
+               testapp_print("\n > Enter attachment absolute path : ");
+               if (0 >= scanf("%s", arg))
+                       testapp_print("Invalid input. ");
+
+               attachment_data[i].attachment_path  = strdup(arg);
+               attachment_data[i].save_status      = 1;
+               attachment_data[i].mailbox_id       = test_mail_data->mailbox_id;
+       }
+
+       testapp_print("\n > Meeting Request? [0: no, 1: yes(request from server), 2: yes(response from local)]");
+       if (0 >= scanf("%d", (int *)&(test_mail_data->meeting_request_status)))
+               testapp_print("Invalid input. ");
+
+       if (test_mail_data->meeting_request_status == 1
+               || test_mail_data->meeting_request_status == 2) {
+               time_t current_time;
+               /*  dummy data for meeting request */
+               meeting_req = malloc(sizeof(email_meeting_request_t));
+               memset(meeting_req, 0x00, sizeof(email_meeting_request_t));
+
+               meeting_req->meeting_response     = 1;
+               current_time = time(NULL);
+               gmtime_r(&current_time, &(meeting_req->start_time));
+               gmtime_r(&current_time, &(meeting_req->end_time));
+               meeting_req->location = strdup("Seoul");
+               meeting_req->global_object_id = strdup("abcdef12345");
+
+               meeting_req->time_zone.offset_from_GMT = 9;
+               strcpy(meeting_req->time_zone.standard_name, "STANDARD_NAME");
+               gmtime_r(&current_time, &(meeting_req->time_zone.standard_time_start_date));
+               meeting_req->time_zone.standard_bias = 3;
+
+               strcpy(meeting_req->time_zone.daylight_name, "DAYLIGHT_NAME");
+               gmtime_r(&current_time, &(meeting_req->time_zone.daylight_time_start_date));
+               meeting_req->time_zone.daylight_bias = 7;
+
+       }
+
+       if ((err = email_add_mail(test_mail_data, attachment_data, attachment_count, meeting_req, from_eas)) != EMAIL_ERROR_NONE)
+               testapp_print("email_add_mail failed. [%d]\n", err);
+       else
+               testapp_print("email_add_mail success.\n");
+
+       testapp_print("saved mail id = [%d]\n", test_mail_data->mail_id);
+       testapp_print("saved mailbox id = [%d]\n", test_mail_data->mailbox_id);
+
+       if (result_mail_id)
+               *result_mail_id = test_mail_data->mail_id;
+
+       if (attachment_data)
+               email_free_attachment_data(&attachment_data, attachment_count);
+
+       if (meeting_req)
+               email_free_meeting_request(&meeting_req, 1);
+
+       email_free_mail_data(&test_mail_data, 1);
+       email_free_mailbox(&mailbox_data, 1);
+
+       return FALSE;
+}
+
+static gboolean testapp_test_update_mail()
+{
+       int                    mail_id = 0;
+       int                    err = EMAIL_ERROR_NONE;
+       int                    test_attachment_data_count = 0;
+       int                    ret = 0;
+       char                   arg[50];
+       email_mail_data_t       *test_mail_data = NULL;
+       email_attachment_data_t *test_attachment_data_list = NULL;
+       email_meeting_request_t *meeting_req = NULL;
+
+       testapp_print("\n > Enter mail id : ");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+
+       email_get_mail_data(mail_id, &test_mail_data);
+
+       if (!test_mail_data) {
+               testapp_print("email_get_mail_data() failed\n");
+               return FALSE;
+       }
+
+       testapp_print("\n > Enter Subject: ");
+       if (0 >= scanf("%s", arg))
+               testapp_print("Invalid input. ");
+
+       test_mail_data->subject = strdup(arg);
+
+       if (test_mail_data->attachment_count > 0) {
+               if ((err = email_get_attachment_data_list(mail_id, &test_attachment_data_list, &test_attachment_data_count)) != EMAIL_ERROR_NONE) {
+                       testapp_print("email_get_attachment_data_list() failed [%d]\n", err);
+                       goto FINISH_OFF;
+               }
+       }
+
+       if (test_mail_data->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_REQUEST
+               || test_mail_data->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_RESPONSE
+               || test_mail_data->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
+
+               if ((err = email_get_meeting_request(mail_id, &meeting_req)) != EMAIL_ERROR_NONE) {
+                       testapp_print("email_get_meeting_request() failed [%d]\n", err);
+                       goto FINISH_OFF;
+               }
+
+               testapp_print("\n > Enter meeting response: ");
+               if (0 >= scanf("%d", (int *)&(meeting_req->meeting_response)))
+                       testapp_print("Invalid input. ");
+       }
+
+       if ((err = email_update_mail(test_mail_data, test_attachment_data_list, test_attachment_data_count, meeting_req, 0)) != EMAIL_ERROR_NONE)
+                       testapp_print("email_update_mail failed.[%d]\n", err);
+               else
+                       testapp_print("email_update_mail success\n");
+
+       ret = 1;
+
+FINISH_OFF:
+
+       if (test_mail_data)
+               email_free_mail_data(&test_mail_data, 1);
+
+       if (test_attachment_data_list)
+               email_free_attachment_data(&test_attachment_data_list, test_attachment_data_count);
+
+       if (meeting_req)
+               email_free_meeting_request(&meeting_req, 1);
+
+       if (!ret)
+               return FALSE;
+
+       return TRUE;
+}
+
+static gboolean testapp_test_get_mails()
+{
+       testapp_print("\n >>> testapp_test_get_mails : Entered \n");
+       email_mail_data_t *mails = NULL, **mails_pointer = NULL;
+       int mailbox_id = 0;
+       int count = 0, i = 0;
+       int account_id = 0;
+       int start_index = 0;
+       int limit_count = 0;
+       int sorting = 0;
+       int err_code = EMAIL_ERROR_NONE;
+       int to_get_count = 0;
+       int is_for_thread_view = 0;
+       int list_type;
+       struct tm *temp_time_info;
+
+       testapp_print("\n > Enter Account_id(0 = all accounts) : ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+       testapp_print("\n > Enter Mailbox id(0 = all mailboxes) :");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter Sorting : ");
+       if (0 >= scanf("%d", &sorting))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter Start index(starting at 0): ");
+       if (0 >= scanf("%d", &start_index))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter max_count : ");
+       if (0 >= scanf("%d", &limit_count))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > For thread view : ");
+       if (0 >= scanf("%d", &is_for_thread_view))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Mail count only(0:list 1:count): ");
+       if (0 >= scanf("%d", &to_get_count))
+               testapp_print("Invalid input. ");
+
+       if (to_get_count)
+               mails_pointer = NULL;
+       else
+               mails_pointer = &mails;
+
+       if (is_for_thread_view == -2)
+               list_type = EMAIL_LIST_TYPE_LOCAL;
+       else if (is_for_thread_view == -1)
+               list_type = EMAIL_LIST_TYPE_THREAD;
+       else
+               list_type = EMAIL_LIST_TYPE_NORMAL;
+
+       /* Get mail list */
+       if (mailbox_id == 0) {
+               testapp_print("Calling email_get_mails for all mailbox.\n");
+               err_code = email_get_mails(account_id, 0, list_type, start_index, limit_count, sorting, mails_pointer, &count);
+               if (err_code < 0)
+                       testapp_print("email_get_mails failed - err[%d]\n", err_code);
+       } else {
+               testapp_print("Calling email_get_mails for %d mailbox_id.\n", mailbox_id);
+               err_code = email_get_mails(account_id, mailbox_id, list_type, start_index, limit_count, sorting,  mails_pointer, &count);
+               if (err_code < 0)
+                       testapp_print("email_get_mails failed - err[%d]\n", err_code);
+       }
+       testapp_print("email_get_mails >>>>>>count - %d\n", count);
+
+       if (mails) {
+               for (i = 0; i < count; i++) {
+                       testapp_print("\n[%d]\n", i);
+                       testapp_print(" >>> mailbox_id [ %d ] \n", mails[i].mailbox_id);
+                       testapp_print(" >>> mail_id [ %d ] \n", mails[i].mail_id);
+                       testapp_print(" >>> account_id [ %d ] \n", mails[i].account_id);
+                       if (mails[i].full_address_from != NULL)
+                               testapp_print(" >>> full_address_from [ %s ] \n", mails[i].full_address_from);
+                       if (mails[i].full_address_to != NULL)
+                               testapp_print(" >>> recipients [ %s ] \n", mails[i].full_address_to);
+                       if (mails[i].subject != NULL)
+                               testapp_print(" >>> subject [ %s ] \n", mails[i].subject);
+                       testapp_print(" >>> body_download_status [ %d ] \n", mails[i].body_download_status);
+                       temp_time_info = localtime(&mails[i].date_time);
+                       testapp_print(" >>> date_time [ %d/%d/%d %d:%d:%d] \n",
+                                                                       temp_time_info->tm_year + 1900,
+                                                                       temp_time_info->tm_mon+1,
+                                                                       temp_time_info->tm_mday,
+                                                                       temp_time_info->tm_hour,
+                                                                       temp_time_info->tm_min,
+                                                                       temp_time_info->tm_sec);
+                       testapp_print(" >>> flags_seen_field [ %d ] \n", mails[i].flags_seen_field);
+                       testapp_print(" >>> priority [ %d ] \n", mails[i].priority);
+                       testapp_print(" >>> save_status [ %d ] \n", mails[i].save_status);
+                       testapp_print(" >>> lock_status [ %d ] \n", mails[i].lock_status);
+                       testapp_print(" >>> attachment_count [ %d ] \n", mails[i].attachment_count);
+                       if (mails[i].preview_text != NULL)
+                               testapp_print(" >>> preview_text [ %s ] \n", mails[i].preview_text);
+               }
+               free(mails);
+       }
+
+       testapp_print(" >>> testapp_test_get_mails : End \n");
+       return 0;
+}
+
+#define TEMP_ARGUMENT_SIZE 4096
+
+static gboolean testapp_test_mail_send(int *result_mail_id)
+{
+       int                    added_mail_id = 0;
+       int                    err = EMAIL_ERROR_NONE;
+       int                    handle = 0;
+       email_mail_data_t     *result_mail_data = NULL;
+
+       testapp_add_mail_for_sending(&added_mail_id);
+
+       if (added_mail_id) {
+               email_get_mail_data(added_mail_id, &result_mail_data);
+
+               testapp_print("Calling email_send_mail...\n");
+
+               if (email_send_mail(added_mail_id, &handle) < 0) {
+                       testapp_print("Sending failed[%d]\n", err);
+               } else {
+                       testapp_print("Start sending. handle[%d]\n", handle);
+               }
+
+               email_free_mail_data(&result_mail_data, 1);
+       }
+
+       if (result_mail_id)
+               *result_mail_id = added_mail_id;
+
+       return FALSE;
+}
+
+static gboolean testapp_test_get_mail_list_ex()
+{
+       email_list_filter_t *filter_list = NULL;
+       email_list_sorting_rule_t sorting_rule_list[2];
+       email_mail_list_item_t *result_mail_list = NULL;
+       int filter_rule_count = 0;
+       int sorting_rule_count = 2;
+       int result_mail_count = 0;
+       int err = EMAIL_ERROR_NONE;
+       int i = 0;
+       int sort_order = 0;
+
+       filter_rule_count = 3;
+
+       filter_list = malloc(sizeof(email_list_filter_t) * filter_rule_count);
+       memset(filter_list, 0 , sizeof(email_list_filter_t) * filter_rule_count);
+
+       filter_list[0].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
+       filter_list[0].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_ACCOUNT_ID;
+       filter_list[0].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_EQUAL;
+       filter_list[0].list_filter_item.rule.key_value.integer_type_value  = 1;
+       filter_list[0].list_filter_item.rule.case_sensitivity              = false;
+
+       filter_list[1].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
+       filter_list[1].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_AND;
+
+       filter_list[2].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
+       filter_list[2].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_MAILBOX_TYPE;
+       filter_list[2].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_EQUAL;
+       filter_list[2].list_filter_item.rule.key_value.integer_type_value  = EMAIL_MAILBOX_TYPE_INBOX;
+       filter_list[2].list_filter_item.rule.case_sensitivity              = false;
+
+       /*filter_list[0].list_filter_item_type                                     = EMAIL_LIST_FILTER_ITEM_RULE_ATTACH;
+       filter_list[0].list_filter_item.rule_attach.target_attribute             = EMAIL_MAIL_ATTACH_ATTRIBUTE_ATTACHMENT_NAME;
+       filter_list[0].list_filter_item.rule_attach.rule_type                    = EMAIL_LIST_FILTER_RULE_INCLUDE;
+       filter_list[0].list_filter_item.rule_attach.key_value.string_type_value  = strdup("test");
+       filter_list[0].list_filter_item.rule_attach.case_sensitivity             = false;*/
+
+       /*
+       filter_list[0].list_filter_item_type                                  = EMAIL_LIST_FILTER_ITEM_RULE;
+       filter_list[0].list_filter_item.rule_fts.target_attribute             = EMAIL_MAIL_ATTRIBUTE_ACCOUNT_ID;
+       filter_list[0].list_filter_item.rule_fts.rule_type                    = EMAIL_LIST_FILTER_RULE_EQUAL;
+       filter_list[0].list_filter_item.rule_fts.key_value.integer_type_value = 1;
+
+       filter_list[1].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
+       filter_list[1].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_OR;
+
+
+       filter_list[2].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
+       filter_list[2].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_SUBJECT;
+       filter_list[2].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_INCLUDE;
+       filter_list[2].list_filter_item.rule.key_value.string_type_value   = strdup("2013");
+       filter_list[2].list_filter_item.rule.case_sensitivity              = false;
+
+
+       filter_list[1].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
+       filter_list[1].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_OR;
+
+       filter_list[2].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
+       filter_list[2].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_TO;
+       filter_list[2].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_INCLUDE;
+       filter_list[2].list_filter_item.rule.key_value.string_type_value   = strdup("RE");
+       filter_list[2].list_filter_item.rule.case_sensitivity              = false;
+
+       filter_list[3].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
+       filter_list[3].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_OR;
+
+       filter_list[4].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
+       filter_list[4].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_CC;
+       filter_list[4].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_INCLUDE;
+       filter_list[4].list_filter_item.rule.key_value.string_type_value   = strdup("RE");
+       filter_list[4].list_filter_item.rule.case_sensitivity              = false;
+
+       filter_list[5].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
+       filter_list[5].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_OR;
+
+       filter_list[6].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
+       filter_list[6].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_BCC;
+       filter_list[6].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_INCLUDE;
+       filter_list[6].list_filter_item.rule.key_value.string_type_value   = strdup("RE");
+       filter_list[6].list_filter_item.rule.case_sensitivity              = false;
+
+       filter_list[7].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
+       filter_list[7].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_OR;
+
+       filter_list[8].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
+       filter_list[8].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_FROM;
+       filter_list[8].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_INCLUDE;
+       filter_list[8].list_filter_item.rule.key_value.string_type_value   = strdup("RE");
+       filter_list[8].list_filter_item.rule.case_sensitivity              = false;
+       */
+
+       /*
+       filter_list[0].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
+       filter_list[0].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_ACCOUNT_ID;
+       filter_list[0].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_EQUAL;
+       filter_list[0].list_filter_item.rule.key_value.integer_type_value  = 1;
+
+       filter_list[1].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
+       filter_list[1].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_AND;
+
+       filter_list[2].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
+       filter_list[2].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_MAILBOX_NAME;
+       filter_list[2].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_EQUAL;
+       filter_list[2].list_filter_item.rule.key_value.string_type_value   = strdup("INBOX");
+       filter_list[2].list_filter_item.rule.case_sensitivity              = true;
+       */
+
+       memset(sorting_rule_list, 0 , sizeof(email_list_sorting_rule_t) * sorting_rule_count);
+/*
+       sorting_rule_list[0].target_attribute                              = EMAIL_MAIL_ATTRIBUTE_RECIPIENT_ADDRESS;
+       sorting_rule_list[0].key_value.string_type_value                   = strdup("minsoo.kimn@gmail.com");
+       sorting_rule_list[0].sort_order                                    = EMAIL_SORT_ORDER_TO_CCBCC;
+*/
+       testapp_print("\n Enter the sort_order :");
+       if (0 >= scanf("%d", &sort_order))
+               testapp_print("Invalid input.");
+
+       sorting_rule_list[0].target_attribute                              = EMAIL_MAIL_ATTRIBUTE_SUBJECT;
+       sorting_rule_list[0].sort_order                                    = sort_order;
+
+       sorting_rule_list[1].target_attribute                              = EMAIL_MAIL_ATTRIBUTE_DATE_TIME;
+       sorting_rule_list[1].sort_order                                    = EMAIL_SORT_ORDER_DESCEND;
+
+       err = email_get_mail_list_ex(filter_list, filter_rule_count, sorting_rule_list, sorting_rule_count, -1, -1, &result_mail_list, &result_mail_count);
+
+       if (err == EMAIL_ERROR_NONE) {
+               testapp_print("email_get_mail_list_ex succeed.\n");
+
+               for (i = 0; i < result_mail_count; i++) {
+                       testapp_print("mail_id [%d], subject [%s], mailbox_type [%d] full_address_from [%s]\n", result_mail_list[i].mail_id, result_mail_list[i].subject, result_mail_list[i].mailbox_type, result_mail_list[i].full_address_from);
+               }
+       } else {
+               testapp_print("email_get_mail_list_ex failed.\n");
+       }
+
+       email_free_list_filter(&filter_list, 3);
+
+       return FALSE;
+}
+
+static gboolean testapp_test_send_cancel()
+{
+       int num = 0;
+       int Y = 0;
+       int i = 0;
+       int j = 0;
+       int *mailIdList = NULL;
+       int mail_id = 0;
+
+       testapp_print("\n > Enter total Number of mail  want to send: ");
+       if (0 >= scanf("%d", &num))
+               testapp_print("Invalid input. ");
+       mailIdList = (int *)malloc(sizeof(int)*num);
+       if (!mailIdList)
+               return false ;
+
+       for (i = 1; i <= num; i++) {
+               testapp_test_mail_send(&mail_id);
+
+               testapp_print("mail_id[%d]", mail_id);
+
+               mailIdList[i] = mail_id;
+               testapp_print("mailIdList[%d][%d]", i, mailIdList[i]);
+
+               mail_id = 0;
+               testapp_print("\n > Do you want to cancel the send mail job '1' or '0': ");
+               if (0 >= scanf("%d", &Y))
+                       testapp_print("Invalid input. ");
+               if (Y == 1) {
+                       testapp_print("\n >Enter mail-id[1-%d] ", i);
+                       if (0 >= scanf("%d", &j))
+                               testapp_print("Invalid input. ");
+                       testapp_print("\n mailIdList[%d] ", mailIdList[j]);
+                       if (email_cancel_sending_mail(mailIdList[j]) < 0)
+                               testapp_print("email_cancel_sending_mail failed..!");
+                       else
+                               testapp_print("email_cancel_sending_mail success..!");
+               }
+       }
+       return FALSE;
+}
+
+static gboolean testapp_test_delete()
+{
+       int mail_id = 0, account_id = 0;
+       int mailbox_id = 0;
+       int err = EMAIL_ERROR_NONE;
+       int from_server = 0;
+
+       testapp_print("\n > Enter Account_id: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter Mail_id: ");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter Mailbox id: ");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter from_server: ");
+       if (0 >= scanf("%d", &from_server))
+               testapp_print("Invalid input. ");
+
+       /* delete message */
+       if ((err = email_delete_mail(mailbox_id, &mail_id, 1, from_server)) < 0)
+               testapp_print("\n email_delete_mail failed[%d]\n", err);
+       else
+               testapp_print("\n email_delete_mail success\n");
+
+       return FALSE;
+}
+
+static gboolean testapp_test_update_mail_attribute()
+{
+       int  err = EMAIL_ERROR_NONE;
+       int  i = 0;
+       int  account_id = 0;
+       int *mail_id_array = NULL;
+       int  mail_id_count = 0;
+       email_mail_attribute_type attribute_type;
+       email_mail_attribute_value_t attribute_value;
+
+       testapp_print("\n > Enter account_id: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter attribute_type: ");
+       if (0 >= scanf("%d", (int*)&attribute_type))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter integer type value: ");
+       if (0 >= scanf("%d", (int*)&(attribute_value.integer_type_value)))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter mail_id_count: ");
+       if (0 >= scanf("%d", &mail_id_count))
+               testapp_print("Invalid input. ");
+
+       mail_id_count = (mail_id_count < 5000) ? mail_id_count : 5000;
+
+       if (mail_id_count > 0) {
+               mail_id_array = malloc(sizeof(int) * mail_id_count);
+       }
+
+       for (i = 0; i < mail_id_count; i++) {
+               testapp_print("\n > Enter mail id: ");
+               if (0 >= scanf("%d", (mail_id_array + i)))
+                       testapp_print("Invalid input. ");
+       }
+
+       /* delete message */
+       if ((err = email_update_mail_attribute(account_id, mail_id_array, mail_id_count, attribute_type, attribute_value)) < EMAIL_ERROR_NONE)
+               testapp_print("\n email_update_mail_attribute failed[%d]\n", err);
+       else
+               testapp_print("\n email_update_mail_attribute success\n");
+
+       if (mail_id_array)
+               free(mail_id_array);
+
+       return FALSE;
+}
+
+static gboolean testapp_test_move()
+{
+       int mail_id[3];
+       int i = 0;
+       int mailbox_id = 0;
+
+       for (i = 0; i < 3; i++) {
+               testapp_print("\n > Enter mail_id: ");
+               if (0 >= scanf("%d", &mail_id[i]))
+                       testapp_print("Invalid input. ");
+       }
+
+       testapp_print("\n > Enter mailbox_id: ");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input. ");
+
+       /* move mail */
+       email_move_mail_to_mailbox(mail_id, 3, mailbox_id);
+       return FALSE;
+}
+
+static gboolean testapp_test_delete_all()
+{
+       int mailbox_id = 0;
+       int err = EMAIL_ERROR_NONE;
+
+       testapp_print("\n > Enter mailbox_id: ");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input. ");
+
+       /* delete all message */
+       if ((err = email_delete_all_mails_in_mailbox(mailbox_id, 0)) < 0)
+               testapp_print("email_delete_all_mails_in_mailbox failed [%d]\n", err);
+       else
+               testapp_print("email_delete_all_mails_in_mailbox Success\n");
+
+       return FALSE;
+}
+
+
+static gboolean testapp_test_add_attachment()
+{
+       int mail_id = 0;
+       char arg[100];
+       email_attachment_data_t attachment;
+
+       testapp_print("\n > Enter Mail Id: ");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+
+       memset(&attachment, 0x00, sizeof(email_attachment_data_t));
+       memset(arg, 0x00, 100);
+       testapp_print("\n > Enter attachment name: ");
+       if (0 >= scanf("%s", arg))
+               testapp_print("Invalid input. ");
+
+       attachment.attachment_name = strdup(arg);
+
+       memset(arg, 0x00, 100);
+       testapp_print("\n > Enter attachment absolute path: ");
+       if (0 >= scanf("%s", arg))
+               testapp_print("Invalid input. ");
+
+       attachment.save_status = true;
+       attachment.attachment_path = strdup(arg);
+       if (email_add_attachment(mail_id, &attachment) < 0)
+               testapp_print("email_add_attachment failed\n");
+       else
+               testapp_print("email_add_attachment success\n");
+
+
+       return FALSE;
+
+}
+
+static gboolean testapp_test_set_deleted_flag()
+{
+       int index = 0;
+       int account_id = 0;
+       int mail_ids[100] = { 0, };
+       int temp_mail_id = 0;
+       int err_code = EMAIL_ERROR_NONE;
+
+       testapp_print("\n >>> Input target account id: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       do {
+               testapp_print("\n >>> Input target mail id( Input 0 to terminate ) [MAX = 100]: ");
+               if (0 >= scanf("%d", &temp_mail_id))
+                       testapp_print("Invalid input. ");
+               mail_ids[index++] = temp_mail_id;
+       } while (temp_mail_id != 0);
+
+       err_code = email_set_flags_field(account_id, mail_ids, index, EMAIL_FLAGS_DELETED_FIELD, 1, true);
+       testapp_print("email_set_flags_field returns - err[%d]\n", err_code);
+
+       return 0;
+}
+
+static gboolean testapp_test_expunge_mails_deleted_flagged()
+{
+       int mailbox_id = 0;
+       int on_server = 0;
+       int err_code = EMAIL_ERROR_NONE;
+       int handle = 0;
+
+       testapp_print("\n >>> Input target mailbox id: ");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n >>> Expunge on server?: ");
+       if (0 >= scanf("%d", &on_server))
+               testapp_print("Invalid input. ");
+
+       err_code = email_expunge_mails_deleted_flagged(mailbox_id, on_server, &handle);
+
+       testapp_print("email_expunge_mails_deleted_flagged returns - err[%d]\n", err_code);
+
+       return 0;
+}
+
+static gboolean testapp_test_send_read_receipt()
+{
+       int read_mail_id = 0;
+       int receipt_mail_id = 0;
+       int err_code = EMAIL_ERROR_NONE;
+       int handle = 0;
+
+       testapp_print("\n >>> Input read mail id: ");
+       if (0 >= scanf("%d", &read_mail_id))
+               testapp_print("Invalid input. ");
+
+       err_code = email_add_read_receipt(read_mail_id, &receipt_mail_id);
+
+       testapp_print("eamil_add_read_receipt returns receipt_mail_id [%d] - err[%d]\n", receipt_mail_id, err_code);
+       testapp_print("Calling email_send_mail...\n");
+
+       if ((err_code = email_send_mail(receipt_mail_id, &handle)) != EMAIL_ERROR_NONE) {
+               testapp_print("Sending failed[%d]\n", err_code);
+       } else {
+               testapp_print("Start sending. handle[%d]\n", handle);
+       }
+
+       return 0;
+}
+
+static gboolean testapp_test_delete_attachment()
+{
+       int attachment_id = 0;
+       int err_code = EMAIL_ERROR_NONE;
+
+       testapp_print("\n >>> Input attachment id: ");
+       if (0 >= scanf("%d", &attachment_id))
+               testapp_print("Invalid input. ");
+
+       if ((err_code = email_delete_attachment(attachment_id)) != EMAIL_ERROR_NONE) {
+               testapp_print("email_delete_attachment failed[%d]\n", err_code);
+       }
+
+       return 0;
+}
+
+static gboolean testapp_test_get_mail_list()
+{
+       testapp_print("\n >>> testapp_test_get_mail_list : Entered \n");
+       email_mail_list_item_t *mail_list = NULL, **mail_list_pointer = NULL;
+       int mailbox_id = 0;
+       int count = 0, i = 0;
+       int account_id = 0;
+       int start_index = 0;
+       int limit_count = 0;
+       int sorting = 0;
+       int err_code = EMAIL_ERROR_NONE;
+       int to_get_count = 0;
+       int is_for_thread_view = 0;
+       int list_type;
+       struct tm *temp_time_info;
+
+       testapp_print("\n > Enter Account_id(0 = all accounts) : ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter Mailbox id(0 = all mailboxes) :");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter Sorting : ");
+       if (0 >= scanf("%d", &sorting))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter Start index(starting at 0): ");
+       if (0 >= scanf("%d", &start_index))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter max_count : ");
+       if (0 >= scanf("%d", &limit_count))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > For thread view : ");
+       if (0 >= scanf("%d", &is_for_thread_view))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Count mails?(1: YES):");
+       if (0 >= scanf("%d", &to_get_count))
+               testapp_print("Invalid input. ");
+
+       if (to_get_count)
+               mail_list_pointer = NULL;
+       else
+               mail_list_pointer = &mail_list;
+
+       if (is_for_thread_view == -2) {
+               list_type = EMAIL_LIST_TYPE_LOCAL;
+       } else if (is_for_thread_view == -1)
+               list_type = EMAIL_LIST_TYPE_THREAD;
+       else
+               list_type = EMAIL_LIST_TYPE_NORMAL;
+
+       /* Get mail list */
+       if (mailbox_id == 0) {
+               testapp_print("Calling email_get_mail_list for all mailbox.\n");
+               err_code = email_get_mail_list(account_id, 0, list_type, start_index, limit_count, sorting,  mail_list_pointer, &count);
+               if (err_code < 0)
+                       testapp_print("email_get_mail_list failed - err[%d]\n", err_code);
+       } else {
+               testapp_print("Calling email_get_mail_list for %d mailbox_id.\n", mailbox_id);
+               err_code = email_get_mail_list(account_id, mailbox_id, list_type, start_index, limit_count, sorting,  mail_list_pointer, &count);
+               if (err_code < 0)
+                       testapp_print("email_get_mail_list failed - err[%d]\n", err_code);
+       }
+       testapp_print("email_get_mail_list >>>>>>count - %d\n", count);
+
+       if (mail_list) {
+               for (i = 0; i < count; i++) {
+                       testapp_print("\n[%d]\n", i);
+                       testapp_print(" >>> mailbox_id [ %d ] \n", mail_list[i].mailbox_id);
+                       testapp_print(" >>> mailbox_type [ %d ] \n", mail_list[i].mailbox_type);
+                       testapp_print(" >>> mail_id [ %d ] \n", mail_list[i].mail_id);
+                       testapp_print(" >>> account_id [ %d ] \n", mail_list[i].account_id);
+                       if (mail_list[i].full_address_from != NULL)
+                               testapp_print(" >>> full_address_from [ %s ] \n", mail_list[i].full_address_from);
+                       if (mail_list[i].email_address_recipient != NULL)
+                               testapp_print(" >>> email_address_recipient [ %s ] \n", mail_list[i].email_address_recipient);
+                       if (mail_list[i].subject != NULL)
+                               testapp_print(" >>> subject [ %s ] \n", mail_list[i].subject);
+                       testapp_print(" >>> body_download_status [ %d ] \n", mail_list[i].body_download_status);
+                       temp_time_info = localtime(&mail_list[i].date_time);
+                       testapp_print(" >>> date_time [ %d/%d/%d %d:%d:%d] \n",
+                                                               temp_time_info->tm_year + 1900,
+                                                               temp_time_info->tm_mon+1,
+                                                               temp_time_info->tm_mday,
+                                                               temp_time_info->tm_hour,
+                                                               temp_time_info->tm_min,
+                                                               temp_time_info->tm_sec);
+                       testapp_print(" >>> flags_seen_field [ %d ] \n", mail_list[i].flags_seen_field);
+                       testapp_print(" >>> priority [ %d ] \n", mail_list[i].priority);
+                       testapp_print(" >>> save_status [ %d ] \n", mail_list[i].save_status);
+                       testapp_print(" >>> lock_status [ %d ] \n", mail_list[i].lock_status);
+                       testapp_print(" >>> attachment_count [ %d ] \n", mail_list[i].attachment_count);
+                       if (mail_list[i].preview_text != NULL)
+                               testapp_print(" >>> preview_text [ %s ] \n", mail_list[i].preview_text);
+               }
+               free(mail_list);
+       }
+
+       testapp_print("\n >>> email_get_mail_list : End \n");
+       return 0;
+}
+
+
+static gboolean testapp_test_get_mail_list_for_thread_view()
+{
+       testapp_print(" >>> testapp_test_get_mail_list_for_thread_view : Entered \n");
+       email_mail_list_item_t *mail_list = NULL;
+       int count = 0, i = 0;
+       int account_id = 0;
+       int mailbox_id = 0;
+       int err_code = EMAIL_ERROR_NONE;
+       struct tm *time_info;
+       char buf[26] = {0};
+
+       testapp_print("\nEnter account id\n");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\nEnter mailbox id\n");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input. ");
+
+       /* Get mail list */
+       if (email_get_mail_list(account_id, mailbox_id , EMAIL_LIST_TYPE_THREAD, 0, 500, EMAIL_SORT_DATETIME_HIGH, &mail_list, &count) < 0)  {
+               testapp_print("email_get_mail_list failed : %d\n", err_code);
+               return FALSE;
+       }
+       testapp_print("email_get_mail_list >>>>>>count - %d\n", count);
+       if (mail_list) {
+               for (i = 0; i < count; i++) {
+                       testapp_print(" i [%d]\n", i);
+                       testapp_print(" >>> mail_id [ %d ] \n", mail_list[i].mail_id);
+                       testapp_print(" >>> account_id [ %d ] \n", mail_list[i].account_id);
+                       testapp_print(" >>> mailbox_id [ %d ] \n", mail_list[i].mailbox_id);
+                       testapp_print(" >>> full_address_from [ %s ] \n", mail_list[i].full_address_from);
+                       testapp_print(" >>> email_address_recipient [ %s ] \n", mail_list[i].email_address_recipient);
+                       testapp_print(" >>> subject [ %s ] \n", mail_list[i].subject);
+                       testapp_print(" >>> body_download_status [ %d ] \n", mail_list[i].body_download_status);
+                       time_info = localtime(&mail_list[i].date_time);
+                       testapp_print(" >>> date_time [ %s ] \n", asctime_r(time_info, buf));
+                       testapp_print(" >>> flags_seen_field [ %d ] \n", mail_list[i].flags_seen_field);
+                       testapp_print(" >>> priority [ %d ] \n", mail_list[i].priority);
+                       testapp_print(" >>> save_status [ %d ] \n", mail_list[i].save_status);
+                       testapp_print(" >>> lock [ %d ] \n", mail_list[i].lock_status);
+                       testapp_print(" >>> attachment_count [ %d ] \n", mail_list[i].attachment_count);
+                       testapp_print(" >>> preview_text [ %s ] \n", mail_list[i].preview_text);
+                       testapp_print(" >>> thread_id [ %d ] \n", mail_list[i].thread_id);
+                       testapp_print(" >>> thread__item_count [ %d ] \n", mail_list[i].thread_item_count);
+               }
+               free(mail_list);
+       }
+       testapp_print(" >>> testapp_test_get_mail_list_for_thread_view : End \n");
+       return 0;
+}
+
+static gboolean testapp_test_count()
+{
+       int total = 0;
+       int unseen = 0;
+       email_list_filter_t *filter_list = NULL;
+
+       filter_list = malloc(sizeof(email_list_filter_t) * 3);
+       memset(filter_list, 0 , sizeof(email_list_filter_t) * 3);
+
+       filter_list[0].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
+       filter_list[0].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_SUBJECT;
+       filter_list[0].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_INCLUDE;
+       filter_list[0].list_filter_item.rule.key_value.string_type_value   = strdup("RE");
+       filter_list[0].list_filter_item.rule.case_sensitivity              = false;
+
+       filter_list[1].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
+       filter_list[1].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_OR;
+
+       filter_list[2].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
+       filter_list[2].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_TO;
+       filter_list[2].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_INCLUDE;
+       filter_list[2].list_filter_item.rule.key_value.string_type_value   = strdup("RE");
+       filter_list[2].list_filter_item.rule.case_sensitivity              = false;
+
+       if (EMAIL_ERROR_NONE == email_count_mail(filter_list, 3, &total, &unseen))
+               printf("\n Total: %d, Unseen: %d \n", total, unseen);
+       return 0;
+}
+
+static gboolean testapp_test_move_mails_to_mailbox_of_another_account()
+{
+       int  err = EMAIL_ERROR_NONE;
+       int  mail_id_count = 0 ;
+       int *mail_id_array = NULL;
+       int  source_mailbox_id = 0;
+       int  target_mailbox_id = 0;
+       int  task_id = 0;
+       int  i = 0;
+
+       testapp_print("\n > Enter source mailbox id: ");
+       if (0 >= scanf("%d", &source_mailbox_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter target mailbox id: ");
+       if (0 >= scanf("%d", &target_mailbox_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter mail count: ");
+       if (0 >= scanf("%d", &mail_id_count))
+               testapp_print("Invalid input. ");
+
+       mail_id_count = (mail_id_count < 5000) ? mail_id_count : 5000;
+
+       if (mail_id_count > 0) {
+               mail_id_array = malloc(sizeof(int) * mail_id_count);
+       }
+
+       for (i = 0; i < mail_id_count; i++) {
+               testapp_print("\n > Enter mail id: ");
+               if (0 >= scanf("%d", (mail_id_array + i)))
+                       testapp_print("Invalid input. ");
+       }
+
+       err = email_move_mails_to_mailbox_of_another_account(source_mailbox_id, mail_id_array, mail_id_count, target_mailbox_id, &task_id);
+
+       testapp_print("\nemail_move_mails_to_mailbox_of_another_account returns [%d], tast_id [%d] \n", err, task_id);
+       return 0;
+}
+
+static gboolean        copy_file(char *input_source_path, char *input_dest_path)
+{
+    int childExitStatus;
+    pid_t pid;
+    if (!input_source_path || !input_dest_path) {
+        return FALSE;
+    }
+    testapp_print("copy_file started\n");
+
+    pid = fork();
+
+    if (pid == 0) {
+       testapp_print("Copying file [%s] [%s]\n", input_source_path, input_dest_path);
+        execl("/bin/cp", "/bin/cp", input_source_path, input_dest_path, (char *)0);
+    } else {
+       testapp_print("Wating child process\n");
+        pid_t ws = waitpid(pid, &childExitStatus, WNOHANG);
+        if (ws == -1) { /* error - handle as you wish */
+               testapp_print("waitpid returns error\n");
+        }
+
+        if (WIFEXITED(childExitStatus)) {
+                       /* exit code in childExitStatus */
+            WEXITSTATUS(childExitStatus); /* zero is normal exit */
+            testapp_print("WEXITSTATUS\n");
+            /* handle non-zero as you wish */
+        } else if (WIFSIGNALED(childExitStatus)) { /* killed */
+               testapp_print("WIFSIGNALED\n");
+        } else if (WIFSTOPPED(childExitStatus)) { /* stopped */
+               testapp_print("WIFSTOPPED\n");
+        }
+    }
+    testapp_print("copy_file finished\n");
+    return TRUE;
+}
+
+
+static gboolean        testapp_test_send_mail_with_downloading_attachment_of_original_mail()
+{
+       int err = EMAIL_ERROR_NONE;
+       int original_mail_id = 0;
+       int original_attachment_count = 0;
+       int i = 0;
+       int handle = 0;
+       char *plain_text_path = MAIL_TEMP_BODY;
+       char *html_file_path = HTML_TEMP_BODY;
+       char new_subject[4086] = { 0, };
+/*     FILE *body_file; */
+       email_mail_data_t *original_mail_data = NULL;
+       email_mailbox_t *outbox = NULL;
+       email_attachment_data_t *original_attachment_array = NULL;
+
+       testapp_print("\n > Enter original mail id: ");
+       if (0 >= scanf("%d", &original_mail_id))
+               testapp_print("Invalid input. ");
+
+       /* Get original mail */
+       if ((err = email_get_mail_data(original_mail_id, &original_mail_data)) != EMAIL_ERROR_NONE || !original_mail_data) {
+               testapp_print("email_get_mail_data failed [%d]\n", err);
+               return FALSE;
+       }
+
+       /* Get attachment of original mail */
+       if ((err = email_get_attachment_data_list(original_mail_id, &original_attachment_array, &original_attachment_count)) != EMAIL_ERROR_NONE || !original_attachment_array) {
+               testapp_print("email_get_attachment_data_list failed [%d]\n", err);
+               return FALSE;
+       }
+
+       /* Remove attachment file path */
+       for (i = 0; i < original_attachment_count; i++) {
+               original_attachment_array[i].save_status = 0;
+               if (original_attachment_array[i].attachment_path)
+                       free(original_attachment_array[i].attachment_path);
+               original_attachment_array[i].attachment_path = NULL;
+       }
+
+       /* Set reference mail id */
+       original_mail_data->reference_mail_id = original_mail_data->mail_id;
+       original_mail_data->body_download_status = 1;
+
+       /* Set from address */
+       if (!original_mail_data->full_address_from) {
+               original_mail_data->full_address_from = strdup("<abc@abc.com>");
+       }
+
+       /* Rewrite subject */
+       if (original_mail_data->subject) {
+               snprintf(new_subject, 4086, "Fw:%s", original_mail_data->subject);
+               free(original_mail_data->subject);
+               original_mail_data->subject = NULL;
+       } else {
+               snprintf(new_subject, 4086, "Forward test");
+       }
+
+       original_mail_data->subject = strdup(new_subject);
+
+       /* Set mailbox information */
+       if ((err = email_get_mailbox_by_mailbox_type(original_mail_data->account_id, EMAIL_MAILBOX_TYPE_OUTBOX, &outbox)) != EMAIL_ERROR_NONE || !outbox) {
+               testapp_print("email_get_mailbox_by_mailbox_type failed [%d]\n", err);
+               return FALSE;
+       }
+       original_mail_data->mailbox_id = outbox->mailbox_id;
+       original_mail_data->mailbox_type = outbox->mailbox_type;
+
+       /* Copy body text */
+       if (original_mail_data->file_path_html) {
+               copy_file(original_mail_data->file_path_html, html_file_path);
+               /*execl("/bin/cp", "/bin/cp", original_mail_data->file_path_html, html_file_path,(char *)0); */
+               free(original_mail_data->file_path_html);
+               original_mail_data->file_path_html = strdup(html_file_path);
+       }
+
+       if (original_mail_data->file_path_plain) {
+               copy_file(original_mail_data->file_path_plain, plain_text_path);
+               /*execl("/bin/cp", "/bin/cp", original_mail_data->file_path_plain, plain_text_path,(char *)0);*/
+               free(original_mail_data->file_path_plain);
+               original_mail_data->file_path_plain = strdup(plain_text_path);
+       }
+
+
+       /*
+       body_file = fopen(body_file_path, "w");
+
+       testapp_print("\n body_file [%p]\n", body_file);
+
+       if (body_file == NULL) {
+               testapp_print("\n fopen [%s]failed\n", body_file_path);
+               return FALSE;
+       }
+
+       for (i = 0; i < 100; i++)
+               fprintf(body_file, "Mail sending Test. [%d]\n", i);
+
+       fflush(body_file);
+       fclose(body_file);
+       */
+
+       /* Add mail */
+       if ((err = email_add_mail(original_mail_data, original_attachment_array, original_attachment_count, NULL, false)) != EMAIL_ERROR_NONE) {
+               testapp_print("email_get_attachment_data_list failed [%d]\n", err);
+               return FALSE;
+       }
+
+       /* Send mail */
+       if ((err = email_send_mail_with_downloading_attachment_of_original_mail(original_mail_data->mail_id, &handle)) != EMAIL_ERROR_NONE) {
+               testapp_print("email_send_mail_with_downloading_attachment_of_original_mail failed [%d]\n", err);
+               return FALSE;
+       }
+
+       if (original_mail_data)
+               email_free_mail_data(&original_mail_data, 1);
+
+       if (outbox)
+               email_free_mailbox(&outbox, 1);
+
+       if (original_attachment_array)
+               email_free_attachment_data(&original_attachment_array, original_attachment_count);
+
+       return TRUE;
+}
+
+static gboolean        testapp_test_get_mail_data()
+{
+       int err = EMAIL_ERROR_NONE;
+       int mail_id = 0;
+       email_mail_data_t *mail_data = NULL;
+
+       testapp_print("\n > Enter mail id: ");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+
+       /* Get original mail */
+       if ((err = email_get_mail_data(mail_id, &mail_data)) != EMAIL_ERROR_NONE || !mail_data) {
+               testapp_print("email_get_mail_data failed [%d]\n", err);
+               return FALSE;
+       }
+
+       testapp_print("mail_id [%d]\n", mail_data->mail_id);
+       testapp_print("account_id [%d]\n", mail_data->account_id);
+       testapp_print("mailbox_id [%d]\n", mail_data->mailbox_id);
+       testapp_print("mailbox_type [%d]\n", mail_data->mailbox_type);
+       if (mail_data->subject)
+               testapp_print("subject [%s]\n", mail_data->subject);
+       testapp_print("date_time [%d]\n", mail_data->date_time);
+       testapp_print("server_mail_status [%d]\n", mail_data->server_mail_status);
+
+       if (mail_data->server_mailbox_name)
+               testapp_print("server_mailbox_name [%s]\n", mail_data->server_mailbox_name);
+
+       if (mail_data->server_mail_id)
+               testapp_print("server_mail_id [%s]\n", mail_data->server_mail_id);
+
+       if (mail_data->message_id)
+               testapp_print("message_id [%s]\n", mail_data->message_id);
+
+       testapp_print("reference_mail_id [%d]\n", mail_data->reference_mail_id);
+
+       if (mail_data->full_address_from)
+               testapp_print("full_address_from [%s]\n", mail_data->full_address_from);
+
+       if (mail_data->full_address_reply)
+               testapp_print("full_address_reply [%s]\n", mail_data->full_address_reply);
+
+       if (mail_data->full_address_to)
+               testapp_print("full_address_to [%s]\n", mail_data->full_address_to);
+
+       if (mail_data->full_address_cc)
+               testapp_print("full_address_cc [%s]\n", mail_data->full_address_cc);
+
+       if (mail_data->full_address_bcc)
+               testapp_print("full_address_bcc [%s]\n", mail_data->full_address_bcc);
+
+       if (mail_data->full_address_return)
+               testapp_print("full_address_return [%s]\n", mail_data->full_address_return);
+
+       if (mail_data->email_address_sender)
+               testapp_print("email_address_sender [%s]\n", mail_data->email_address_sender);
+
+       if (mail_data->email_address_recipient)
+               testapp_print("email_address_recipient [%s]\n", mail_data->email_address_recipient);
+
+       if (mail_data->alias_sender)
+               testapp_print("alias_sender [%s]\n", mail_data->alias_sender);
+
+       if (mail_data->alias_recipient)
+               testapp_print("alias_recipient [%s]\n", mail_data->alias_recipient);
+
+       testapp_print("body_download_status [%d]\n", mail_data->body_download_status);
+
+       if (mail_data->file_path_plain)
+               testapp_print("file_path_plain [%s]\n", mail_data->file_path_plain);
+
+       if (mail_data->file_path_html)
+               testapp_print("file_path_html [%s]\n", mail_data->file_path_html);
+
+       testapp_print("file_path_mime_entity [%s]\n", mail_data->file_path_mime_entity);
+       testapp_print("mail_size [%d]\n", mail_data->mail_size);
+       testapp_print("flags_seen_field [%d]\n", mail_data->flags_seen_field);
+       testapp_print("flags_deleted_field [%d]\n", mail_data->flags_deleted_field);
+       testapp_print("flags_flagged_field [%d]\n", mail_data->flags_flagged_field);
+       testapp_print("flags_answered_field [%d]\n", mail_data->flags_answered_field);
+       testapp_print("flags_recent_field [%d]\n", mail_data->flags_recent_field);
+       testapp_print("flags_draft_field [%d]\n", mail_data->flags_draft_field);
+       testapp_print("flags_forwarded_field [%d]\n", mail_data->flags_forwarded_field);
+       testapp_print("DRM_status [%d]\n", mail_data->DRM_status);
+       testapp_print("priority [%d]\n", mail_data->priority);
+       testapp_print("save_status [%d]\n", mail_data->save_status);
+       testapp_print("lock_status [%d]\n", mail_data->lock_status);
+       testapp_print("report_status [%d]\n", mail_data->report_status);
+       testapp_print("attachment_count [%d]\n", mail_data->attachment_count);
+       testapp_print("inline_content_count [%d]\n", mail_data->inline_content_count);
+       testapp_print("thread_id [%d]\n", mail_data->thread_id);
+       testapp_print("thread_item_count [%d]\n", mail_data->thread_item_count);
+
+       if (mail_data->preview_text)
+               testapp_print("preview_text [%s]\n", mail_data->preview_text);
+
+       testapp_print("meeting_request_status [%d]\n", mail_data->meeting_request_status);
+       testapp_print("message_class [%d]\n", mail_data->message_class);
+       testapp_print("digest_type [%d]\n", mail_data->digest_type);
+       testapp_print("smime_type [%d]\n", mail_data->smime_type);
+       testapp_print("scheduled_sending_time [%d]\n", mail_data->scheduled_sending_time);
+       testapp_print("remaining_resend_times [%d]\n", mail_data->remaining_resend_times);
+       testapp_print("eas_data_length [%d]\n", mail_data->eas_data_length);
+
+       return TRUE;
+}
+
+static gboolean        testapp_test_schedule_sending_mail()
+{
+       int                    added_mail_id = 0;
+       int                    err = EMAIL_ERROR_NONE;
+       int                    handle = 0;
+       time_t                 time_to_send;
+
+       testapp_add_mail_for_sending(&added_mail_id);
+
+       if (added_mail_id) {
+               time(&time_to_send);
+               time_to_send += 60;
+
+               testapp_print("Calling email_schedule_sending_mail...\n");
+
+               if (email_schedule_sending_mail(added_mail_id, time_to_send) < 0) {
+                       testapp_print("email_schedule_sending_mail failed[%d]\n", err);
+               } else {
+                       testapp_print("Start sending. handle[%d]\n", handle);
+               }
+       }
+
+       return TRUE;
+}
+
+static gboolean        testapp_test_set_flags_field()
+{
+       int account_id = 0;
+       int mail_id = 0;
+
+       testapp_print("\n > Enter Account ID: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter Mail ID: ");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+
+       if (email_set_flags_field(account_id, &mail_id, 1, EMAIL_FLAGS_FLAGGED_FIELD, 1, 1) < 0)
+               testapp_print("email_set_flags_field failed");
+       else
+               testapp_print("email_set_flags_field success");
+
+       return TRUE;
+}
+
+static gboolean testapp_test_download_body()
+{
+       int mail_id = 0;
+       int handle = 0, err;
+
+       testapp_print("\n > Enter Mail Id: ");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+       err = email_download_body(mail_id, 0, &handle);
+       if (err  < 0)
+               testapp_print("email_download_body failed");
+       else {
+               testapp_print("email_download_body success");
+               testapp_print("handle[%d]\n", handle);
+       }
+       return TRUE;
+}
+
+
+static gboolean testapp_test_cancel_download_body()
+{
+       int mail_id = 0;
+       int account_id = 0;
+       int yes = 0;
+       int handle = 0;
+
+       email_mailbox_t mailbox;
+       memset(&mailbox, 0x00, sizeof(email_mailbox_t));
+
+       testapp_print("\n > Enter account_id: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter mail id: ");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+
+       if (email_download_body(mail_id, 0, &handle) < 0)
+               testapp_print("email_download_body failed");
+       else {
+               testapp_print("email_download_body success\n");
+               testapp_print("Do u want to cancel download job>>>>>1/0\n");
+               if (0 >= scanf("%d", &yes))
+                       testapp_print("Invalid input. ");
+               if (1 == yes) {
+                       if (email_cancel_job(account_id, handle , EMAIL_CANCELED_BY_USER) < 0)
+                               testapp_print("email_cancel_job failed..!");
+                       else {
+                               testapp_print("email_cancel_job success..!");
+                               testapp_print("handle[%d]\n", handle);
+                       }
+               }
+
+       }
+       return TRUE;
+}
+static gboolean testapp_test_download_attachment()
+{
+       int mail_id = 0;
+       int attachment_no = 0;
+       int handle = 0;
+
+       testapp_print("\n > Enter Mail Id: ");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter attachment number: ");
+       if (0 >= scanf("%d", &attachment_no))
+               testapp_print("Invalid input. ");
+
+       if (email_download_attachment(mail_id, attachment_no, &handle) < 0)
+               testapp_print("email_download_attachment failed");
+       else {
+               testapp_print("email_download_attachment success");
+               testapp_print("handle[%d]\n", handle);
+       }
+       return TRUE;
+
+}
+
+static gboolean testapp_test_get_attachment_data_list()
+{
+       int err = EMAIL_ERROR_NONE;
+       int i = 0;
+       int mail_id = 0;
+       int test_attachment_data_count;
+       email_attachment_data_t *test_attachment_data_list = NULL;
+
+       testapp_print("\n > Enter Mail id: ");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+
+       if ((err = email_get_attachment_data_list(mail_id, &test_attachment_data_list, &test_attachment_data_count)) != EMAIL_ERROR_NONE) {
+               testapp_print("email_get_attachment_data_list() failed [%d]\n", err);
+               goto FINISH_OFF;
+       }
+       if (test_attachment_data_list) {
+               for (i = 0; i < test_attachment_data_count; i++) {
+                       testapp_print("index [%d]\n", i);
+                       testapp_print("attachment_name [%s]\n", test_attachment_data_list[i].attachment_name);
+                       testapp_print("attachment_path [%s]\n", test_attachment_data_list[i].attachment_path);
+                       testapp_print("attachment_size [%d]\n", test_attachment_data_list[i].attachment_size);
+                       testapp_print("mail_id [%d]\n", test_attachment_data_list[i].mail_id);
+                       testapp_print("attachment_mime_type [%s]\n", test_attachment_data_list[i].attachment_mime_type);
+               }
+               email_free_attachment_data(&test_attachment_data_list, test_attachment_data_count);
+       }
+
+FINISH_OFF:
+
+       return TRUE;
+}
+
+static gboolean testapp_test_get_meeting_request()
+{
+       int mail_id = 0;
+       int err = EMAIL_ERROR_NONE;
+       email_meeting_request_t *meeting_request;
+
+       testapp_print("\n > Enter Mail Id: ");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+
+       err = email_get_meeting_request(mail_id, &meeting_request);
+
+       testapp_print("err[%d]\n", err);
+
+       if (err == EMAIL_ERROR_NONE && meeting_request) {
+               testapp_print("mail_id [%d]\n", meeting_request->mail_id);
+               testapp_print("global_object_id [%s]\n", meeting_request->global_object_id);
+               testapp_print("meeting_response [%d]\n", meeting_request->meeting_response);
+       }
+
+       email_free_meeting_request(&meeting_request, 1);
+       return TRUE;
+}
+
+static gboolean testapp_test_retry_send()
+{
+       int mail_id = 0;
+       int timeout = 0;
+
+       email_mailbox_t mailbox;
+       memset(&mailbox, 0x00, sizeof(email_mailbox_t));
+
+       testapp_print("\n > Enter Mail Id: ");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter timeout in seconds: ");
+       if (0 >= scanf("%d", &timeout))
+               testapp_print("Invalid input. ");
+
+       if (email_retry_sending_mail(mail_id, timeout) < 0)
+               testapp_print("email_retry_sending_mail failed");
+       return TRUE;
+}
+
+static gboolean testapp_test_get_attachment_data()
+{
+       int attachment_id = 0;
+       email_attachment_data_t *attachment = NULL;
+
+       testapp_print("\n > Enter attachment id: ");
+       if (0 >= scanf("%d", &attachment_id))
+               testapp_print("Invalid input. ");
+
+       email_get_attachment_data(attachment_id, &attachment);
+
+       if (attachment) {
+               testapp_print("attachment_name [%s]\n", attachment->attachment_name);
+               testapp_print("attachment_path [%s]\n", attachment->attachment_path);
+               testapp_print("attachment_size [%d]\n", attachment->attachment_size);
+               testapp_print("mail_id [%d]\n", attachment->mail_id);
+               testapp_print("attachment_mime_type [%s]\n", attachment->attachment_mime_type);
+       }
+
+       return TRUE;
+}
+
+static gboolean testapp_test_move_all_mails_to_mailbox()
+{
+       int err = EMAIL_ERROR_NONE;
+       int src_mailbox_id;
+       int dest_mailbox_id;
+
+       testapp_print("src mailbox id> ");
+       if (0 >= scanf("%d", &src_mailbox_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("dest mailbox id> ");
+       if (0 >= scanf("%d", &dest_mailbox_id))
+               testapp_print("Invalid input. ");
+
+       err = email_move_all_mails_to_mailbox(src_mailbox_id, dest_mailbox_id);
+       if (err < 0) {
+               testapp_print("email_move_all_mails_to_mailbox failed: err[%d]\n", err);
+       } else {
+               testapp_print("email_move_all_mails_to_mailbox suceeded\n");
+       }
+
+       return false;
+}
+
+static gboolean testapp_test_get_totaldiskusage()
+{
+       unsigned long total_size = 0;
+       int err_code = EMAIL_ERROR_NONE ;
+
+       err_code = email_get_disk_space_usage(&total_size);
+       if (err_code < 0)
+               testapp_print("email_get_disk_space_usage failed err : %d\n", err_code);
+       else
+               testapp_print("email_get_disk_space_usage SUCCESS, total disk usage in KB : %ld \n", total_size);
+
+       return FALSE;
+}
+
+
+
+static gboolean testapp_test_db_test()
+{
+       int err = EMAIL_ERROR_NONE;
+       int mail_id;
+       int account_id;
+       char *to = NULL;
+       char *cc = NULL;
+       char *bcc = NULL;
+
+       to = (char *)malloc(500000);
+       cc = (char *)malloc(500000);
+       bcc = (char *)malloc(500000);
+
+       memset(to, 0x00, sizeof(500000));
+       memset(cc, 0x00, sizeof(500000));
+       memset(bcc, 0x00, sizeof(500000));
+
+       testapp_print("Input Mail id:\n");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+       testapp_print("Input Account id:\n");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+       testapp_print("Input TO field:\n");
+       if (0 >= scanf("%s", to))
+               testapp_print("Invalid input. ");
+       testapp_print("Input CC field:\n");
+       if (0 >= scanf("%s", cc))
+               testapp_print("Invalid input. ");
+       testapp_print("Input BCC field:\n");
+       if (0 >= scanf("%s", bcc))
+               testapp_print("Invalid input. ");
+
+       if (emstorage_test(NULL, mail_id, account_id, to, cc, bcc, &err) == true) {
+               testapp_print(">> Saving Succeeded\n");
+       } else {
+               testapp_print(">> Saving Failed[%d]\n", err);
+       }
+
+       free(to);
+       free(cc);
+       free(bcc);
+
+       return false;
+}
+
+static gboolean testapp_test_address_format_check_test()
+{
+       /*
+       int i;
+       int type;
+       int index;
+       int check_yn;
+       int err = EMAIL_ERROR_NONE;
+       char *pAddress = NULL;
+       char input_address[8096];
+       char *address_list[] = {
+               "tom@gmail.com",
+               "tom@gmail,com",
+               "tom@gmail.com@gmail.com",
+               "[tom@gmail.com]",
+               "\"Tom\"<tom@gmail.com>",
+               "\"Tom\"[tom@gmail.com]",
+               "\"Tom\"<tom,@gmail.com>",
+               "<tom@gmail.com>",
+               "<tom@gmail,com>",
+               "<tom@gmail.>",
+               "<tom@gmail.com>,tom@gmail.com",
+               "<tom@gmail.com>;tom@gmail.com",
+               "tom @gmail.com",
+               "tom@ gmail.com",
+               "tom@gmail..com",
+               "tom@",
+               "tom@gmail",
+               "tom@gmail.",
+               "tom@gmail.c",
+               "tom@.",
+               "\"\"Tom\"<tom,@gmail.com>",
+               "tom@gmail.com,tom@gmail.com",
+               "tom@gmail.com.",
+               "<tom@gmail.com>,tom@.gmail.com",
+               "&& tom@live.com ----",
+               "madhu <tom@gmail.com>",
+               "tom@gmail.com, && tom@live.com",
+               "tom@gmail.com , && tom@live.com",
+               "< tom@gmail.com    > , <           tom@.gmail.com     >",
+               "tom@gmail.com ,           tom@gmail.com",
+               "<tom@gmail.com          >",
+               "<to     m@gmail.com          >",
+               "<tom@gmail.com>;tom@gmail.com",
+              "Tom< tom@gmail.com > ,       Tom <tom@gmail.com>",
+               " \"Tom\"  < tom@gmail.com>  ,  \"Tom\"   < tom@gmail.com> ,  Tom  < tom@gmail.com> ; Tom  < tom@gmail.com>,\"tomtom\" <   tom@aol.com>,\"tomtom\" <   tom@aol.com>    ,\"tomtom\" <tom@aol.com>;<tom@live.com>,  <tom@live.com>; \"tomtomtomtom\" <tom@live.com>  ; \"tomtomtomtom\" <tom@live.com>,\"Tom\"  < tom@gmail.com>",
+               "<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>",
+               "             tom@gmail.com         ;   <  tom@gmail.com   > ",
+               "\"Tom\" <        tom@gmail.com >  ;  mama <  tom@gmail.com    >  ,   abcd@gmail.com     ,   abc@gmail.com ,\"tomtom\" <tom@aol.com>,\"tomtom\"  < tom@aol.com> ;\"tomtom\" <   tom@aol.com   >    ,\"tomtom\" <tom@aol.com> , \"tomtomtomtom\" <tom@live.com>  ",
+               "             \"tomtom\" <tom@aol.com>    ;\"tomtom\" <tom@aol.com> ;          ",
+               "  tom@gmail.com  ,   tom@gmail.com ,   tom@gmail.com; Tom  < tom@gmail.com   >  ,<   tom@aol.com>, <tom@aol.com>    ,<tom@aol.com>;<tom@live.com>,  tom@live.com;tom@live.com; \"tomtomtomtom\" <tom@live.com>,\"Tom\"  < tom@gmail.com> ;    ",
+               "<tom@aol.com>    , \"tomtomtomtom\" <tom@live.com>,\"Tom\"  < tom@gmail.com> ;    ",
+               " Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <   tom@gmail.com>  ,<tom@gmail.com>,Tom <tom@gmail.com       >,Tom< tom@gmail.com > ,       Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>",
+               NULL
+       };
+       int address_count = 0;
+
+       testapp_print("Select input method:\n");
+       testapp_print("1. Test data\n");
+       testapp_print("2. Keyboard\n");
+       if (0 >= scanf("%d", &type);
+
+       switch (type) {
+               case 1:
+                       do  {
+                               for (i = 0; address_list[i] != NULL; i++) {
+                                       testapp_print("[%d] addr[%s]\n", i, address_list[i]);
+                                       address_count++;
+                               }
+                               testapp_print("Choose address to be tested:[99:quit]\n");
+                               if (0 >= scanf("%d", &index);
+                               if (index == 99 )
+                                       break;
+
+                               testapp_print(">> [%d] Checking?(1:Yes, Other:No) [%s]\n", index, address_list[index]);
+                               if (0 >= scanf("%d", &check_yn);
+                               if (check_yn == 1) {
+                                       pAddress = strdup(address_list[index]);
+                                       if (em_verify_email_address(pAddress, false, &err ) == true) {
+                                               testapp_print("<< [%d] Checking Succeeded : addr[%s]\n", index, address_list[index]);
+                                       }
+                                       else {
+                                               testapp_print("<< [%d] Checking Failed    : addr[%s], err[%d]\n", index, address_list[index], err);
+                                       }
+                                       if (pAddress) {
+                                               free(pAddress);
+                                               pAddress = NULL;
+                                       }
+                               }
+                               else {
+                                       testapp_print("<< [%d]  Skipped            : addr[%s]\n", index, address_list[index]);
+                               }
+                       }
+                       while (1);
+                       break;
+               case 2:
+                       testapp_print("Input address: \n");
+                       if (0 >= scanf("%s", input_address);
+                       if (em_verify_email_address(input_address, false, &err ) == true) {
+                               testapp_print(">> Saving Succeeded : addr[%s]\n", input_address);
+                       }
+                       else {
+                               testapp_print(">> Saving Failed : addr[%s], err[%d]\n", input_address, err);
+                       }
+                       break;
+               default:
+                       testapp_print("wrong nuber... [%d]\n", type);
+                       break;
+       }
+       */
+       return FALSE;
+}
+
+static gboolean testapp_test_get_max_mail_count()
+{
+       int max_count = -1;
+       int err = EMAIL_ERROR_NONE;
+
+       err = email_get_max_mail_count(&max_count);
+       testapp_print("\n\t>>>>> email_get_max_mail_count() return [%d][%d]\n\n", max_count, err);
+
+       return TRUE;
+}
+
+#include "email-storage.h"
+static gboolean testapp_test_test_get_thread_information()
+{
+       int error_code, thread_id = 38;
+       email_mail_list_item_t *result_mail;
+
+       if ((error_code = email_get_thread_information_ex(thread_id, &result_mail)) == EMAIL_ERROR_NONE) {
+               testapp_print("email_get_thread_information returns = %d\n", error_code);
+               testapp_print("subject = %s\n", result_mail->subject);
+               testapp_print("mail_id = %d\n", result_mail->mail_id);
+               testapp_print("full_address_from = %s\n", result_mail->full_address_from);
+               testapp_print("thrad_id = %d\n", result_mail->thread_id);
+               testapp_print("count = %d\n", result_mail->thread_item_count);
+       }
+
+       return TRUE;
+}
+
+static gboolean testapp_test_get_address_info_list()
+{
+       testapp_print(" >>> testapp_test_get_address_info_list : Entered \n");
+
+       char buf[1024];
+       int i = 0;
+       int mail_id = 0;
+       email_address_info_list_t *address_info_list = NULL;
+       email_address_info_t *p_address_info = NULL;
+       GList *list = NULL;
+       GList *node = NULL;
+
+       memset(buf, 0x00, sizeof(buf));
+       testapp_print("\n > Enter mail_id: ");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+
+       email_get_address_info_list(mail_id, &address_info_list);
+
+       testapp_print("===================================================\n");
+       testapp_print("\t\t\t address info list\n");
+       testapp_print("===================================================\n");
+       testapp_print("address_type\t address \t\tdisplay_name\t contact id\n");
+       testapp_print("===================================================\n");
+
+       for (i = EMAIL_ADDRESS_TYPE_FROM; i <= EMAIL_ADDRESS_TYPE_BCC; i++) {
+               switch (i) {
+                       case EMAIL_ADDRESS_TYPE_FROM:
+                               list = address_info_list->from;
+                               break;
+                       case EMAIL_ADDRESS_TYPE_TO:
+                               list = address_info_list->to;
+                               break;
+                       case EMAIL_ADDRESS_TYPE_CC:
+                               list = address_info_list->cc;
+                               break;
+                       case EMAIL_ADDRESS_TYPE_BCC:
+                               list = address_info_list->bcc;
+                               break;
+               }
+
+               /*  delete dynamic-allocated memory for each item */
+               node = g_list_first(list);
+               while (node != NULL) {
+                       p_address_info = (email_address_info_t *)node->data;
+                       testapp_print("%d\t\t%s\t%s\t%d\n", p_address_info->address_type, p_address_info->address, p_address_info->display_name, p_address_info->contact_id);
+
+                       node = g_list_next(node);
+               }
+               testapp_print("\n");
+       }
+       testapp_print("===================================================\n");
+
+       if (address_info_list)
+               email_free_address_info_list(&address_info_list);
+
+       testapp_print(" >>> testapp_test_get_address_info_list : END \n");
+       return TRUE;
+}
+
+static gboolean testapp_test_search_mail_on_server()
+{
+       testapp_print(" >>> testapp_test_search_mail_on_server : Entered \n");
+
+       int err_code = EMAIL_ERROR_NONE;
+       int account_id = 0;
+       int mailbox_id = 0;
+       int search_key_value_integer = 0;
+       int search_filter_count = 0;
+       email_search_filter_type search_filter_type = 0;
+       email_search_filter_t search_filter[10];
+       int handle = 0;
+       time_t current_time = 0;
+       char search_key_value_string[256];
+
+       testapp_print("input account id : ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("input mailbox id : ");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input. ");
+
+       memset(&search_filter, 0x00, sizeof(email_search_filter_t) * 10);
+
+       while (1) {
+               testapp_print(
+                       "       EMAIL_SEARCH_FILTER_TYPE_MESSAGE_NO       =  1, (integer type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_UID              =  2, (integer type ) \n"
+                       "   EMAIL_SEARCH_FILTER_TYPE_ALL              =  3, (integer type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_BCC              =  7, (string type ) \n"
+                       "   EMAIL_SEARCH_FILTER_TYPE_BODY             =  8, (string type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_CC               =  9, (string type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_FROM             = 10, (string type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_KEYWORD          = 11, (string type ) \n"
+                       "   EMAIL_SEARCH_FILTER_TYPE_TEXT             = 12, (string type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_SUBJECT          = 13, (string type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_TO               = 15, (string type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_SIZE_LARSER      = 16, (integet type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_SIZE_SMALLER     = 17, (integet type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_BEFORE = 20, (time type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_ON     = 21, (time type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_SINCE  = 22, (time type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_ANSWERED   = 26, (integer type ) \n"
+                       "   EMAIL_SEARCH_FILTER_TYPE_FLAGS_NEW        = 27, (integer type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_DELETED    = 28, (integer type ) \n"
+                       "   EMAIL_SEARCH_FILTER_TYPE_FLAGS_OLD        = 29, (integer type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_DRAFT      = 30, (integer type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_FLAGED     = 32, (integer type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_RECENT     = 34, (integer type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_SEEN       = 36, (integer type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID       = 43, (string type ) \n"
+                       "   EMAIL_SEARCH_FILTER_TYPE_HEADER_PRIORITY  = 50, (integer type ) \n"
+                       "       EMAIL_SEARCH_FILTER_TYPE_ATTACHMENT_NAME  = 60, (string type ) \n"
+                       "   EMAIL_SEARCH_FILTER_TYPE_CHARSET          = 61, (string type ) \n"
+                       "   EMAIL_SEARCH_FILTER_TYPE_USER_DEFINED     = 62, (string type ) \n"
+                       "       END                                       = 0 \n");
+
+               testapp_print("input search filter type : ");
+               if (0 >= scanf("%d", (int *)&search_filter_type))
+                       testapp_print("Invalid input. ");
+
+               search_filter[search_filter_count].search_filter_type = search_filter_type;
+
+               switch (search_filter_type) {
+                       case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_NO:
+                       case EMAIL_SEARCH_FILTER_TYPE_UID:
+                       case EMAIL_SEARCH_FILTER_TYPE_ALL:
+                       case EMAIL_SEARCH_FILTER_TYPE_SIZE_LARSER:
+                       case EMAIL_SEARCH_FILTER_TYPE_SIZE_SMALLER:
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_ANSWERED:
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_NEW:
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DELETED:
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_OLD:
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DRAFT:
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_FLAGED:
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_RECENT:
+                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_SEEN:
+                       case EMAIL_SEARCH_FILTER_TYPE_HEADER_PRIORITY:
+                               testapp_print("input search filter key value : ");
+                               if (0 >= scanf("%d", &search_key_value_integer))
+                                       testapp_print("Invalid input. ");
+                               search_filter[search_filter_count].search_filter_key_value.integer_type_key_value = search_key_value_integer;
+                               break;
+
+                       case EMAIL_SEARCH_FILTER_TYPE_BCC:
+                       case EMAIL_SEARCH_FILTER_TYPE_BODY:
+                       case EMAIL_SEARCH_FILTER_TYPE_CC:
+                       case EMAIL_SEARCH_FILTER_TYPE_FROM:
+                       case EMAIL_SEARCH_FILTER_TYPE_KEYWORD:
+                       case EMAIL_SEARCH_FILTER_TYPE_TEXT:
+                       case EMAIL_SEARCH_FILTER_TYPE_SUBJECT:
+                       case EMAIL_SEARCH_FILTER_TYPE_TO:
+                       case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID:
+                       case EMAIL_SEARCH_FILTER_TYPE_ATTACHMENT_NAME:
+                       case EMAIL_SEARCH_FILTER_TYPE_CHARSET:
+                       case EMAIL_SEARCH_FILTER_TYPE_USER_DEFINED:
+                               testapp_print("input search filter key value : ");
+                               int readn = read(0, search_key_value_string, 256);
+                               if (readn < 0)
+                                       testapp_print("Invalid input. ");
+
+                               search_filter[search_filter_count].search_filter_key_value.string_type_key_value = strndup(search_key_value_string, readn - 1);
+                               break;
+
+                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_BEFORE:
+                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_ON:
+                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_SINCE:
+                               time(&current_time);
+                               /* TODO : write codes for converting string to time */
+                               /* search_filter.search_filter_key_value.time_type_key_value = search_key_value_string; */
+                               search_filter[search_filter_count].search_filter_key_value.time_type_key_value = current_time;
+                               break;
+                       default:
+                               testapp_print("END filter type [%d]", search_filter_type);
+                               break;
+               }
+
+               if (!search_filter_type)
+                       break;
+
+               search_filter_count++;
+       }
+
+       if ((err_code = email_search_mail_on_server(account_id, mailbox_id, search_filter, search_filter_count, &handle)) != EMAIL_ERROR_NONE) {
+               testapp_print("email_search_mail_on_server failed [%d]", err_code);
+       }
+
+       testapp_print(" >>> testapp_test_search_mail_on_server : END \n");
+       return TRUE;
+}
+
+static gboolean testapp_test_add_mail_to_search_result_box()
+{
+       int                    i = 0;
+       int                    account_id = 0;
+       int                    from_eas = 0;
+       int                    attachment_count = 0;
+       int                    err = EMAIL_ERROR_NONE;
+       char                   arg[50] = { 0 , };
+       char                  *body_file_path = MAIL_TEMP_BODY;
+       email_mailbox_t         *mailbox_data = NULL;
+       email_mail_data_t       *test_mail_data = NULL;
+       email_attachment_data_t *attachment_data = NULL;
+       email_meeting_request_t *meeting_req = NULL;
+       FILE                  *body_file = NULL;
+
+       testapp_print("\n > Enter account id : ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       email_get_mailbox_by_mailbox_type(account_id, EMAIL_MAILBOX_TYPE_SEARCH_RESULT, &mailbox_data);
+
+       test_mail_data = malloc(sizeof(email_mail_data_t));
+       memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
+
+       testapp_print("\n From EAS? [0/1]> ");
+       if (0 >= scanf("%d", &from_eas))
+               testapp_print("Invalid input. ");
+
+       test_mail_data->account_id             = account_id;
+       test_mail_data->save_status            = 1;
+       test_mail_data->body_download_status   = 1;
+       test_mail_data->flags_seen_field       = 1;
+       test_mail_data->file_path_plain        = strdup(body_file_path);
+       test_mail_data->mailbox_id             = mailbox_data->mailbox_id;
+       test_mail_data->mailbox_type           = mailbox_data->mailbox_type;
+       test_mail_data->full_address_from      = strdup("<test1@test.com>");
+       test_mail_data->full_address_to        = strdup("<test2@test.com>");
+       test_mail_data->full_address_cc        = strdup("<test3@test.com>");
+       test_mail_data->full_address_bcc       = strdup("<test4@test.com>");
+       test_mail_data->subject                = strdup("Into search result mailbox");
+       test_mail_data->remaining_resend_times = 3;
+
+       body_file = fopen(body_file_path, "w");
+
+       for (i = 0; i < 500; i++)
+               fprintf(body_file, "X2 X2 X2 X2 X2 X2 X2");
+       fflush(body_file);
+       fclose(body_file);
+
+       testapp_print(" > Attach file? [0/1] : ");
+       if (0 >= scanf("%d", &attachment_count))
+               testapp_print("Invalid input. ");
+
+       if (attachment_count) {
+               memset(arg, 0x00, 50);
+               testapp_print("\n > Enter attachment name : ");
+               if (0 >= scanf("%s", arg))
+                       testapp_print("Invalid input. ");
+
+               attachment_data = malloc(sizeof(email_attachment_data_t));
+
+               attachment_data->attachment_name  = strdup(arg);
+
+               memset(arg, 0x00, 50);
+               testapp_print("\n > Enter attachment absolute path : ");
+               if (0 >= scanf("%s", arg))
+                       testapp_print("Invalid input. ");
+
+               attachment_data->attachment_path  = strdup(arg);
+               attachment_data->save_status      = 1;
+               test_mail_data->attachment_count  = attachment_count;
+       }
+
+       testapp_print("\n > Meeting Request? [0: no, 1: yes(request from server), 2: yes(response from local)]");
+       if (0 >= scanf("%d", (int *)&(test_mail_data->meeting_request_status)))
+               testapp_print("Invalid input. ");
+
+       if (test_mail_data->meeting_request_status == 1
+               || test_mail_data->meeting_request_status == 2) {
+               time_t current_time;
+               /*  dummy data for meeting request */
+               meeting_req = malloc(sizeof(email_meeting_request_t));
+               memset(meeting_req, 0x00, sizeof(email_meeting_request_t));
+
+               meeting_req->meeting_response     = 1;
+               current_time = time(NULL);
+               gmtime_r(&current_time, &(meeting_req->start_time));
+               gmtime_r(&current_time, &(meeting_req->end_time));
+               meeting_req->location = malloc(strlen("Seoul") + 1);
+               memset(meeting_req->location, 0x00, strlen("Seoul") + 1);
+               strcpy(meeting_req->location, "Seoul");
+               strcpy(meeting_req->global_object_id, "abcdef12345");
+
+               meeting_req->time_zone.offset_from_GMT = 9;
+               strcpy(meeting_req->time_zone.standard_name, "STANDARD_NAME");
+               gmtime_r(&current_time, &(meeting_req->time_zone.standard_time_start_date));
+               meeting_req->time_zone.standard_bias = 3;
+
+               strcpy(meeting_req->time_zone.daylight_name, "DAYLIGHT_NAME");
+               gmtime_r(&current_time, &(meeting_req->time_zone.daylight_time_start_date));
+               meeting_req->time_zone.daylight_bias = 7;
+
+       }
+
+       if ((err = email_add_mail(test_mail_data, attachment_data, attachment_count, meeting_req, from_eas)) != EMAIL_ERROR_NONE)
+               testapp_print("email_add_mail failed. [%d]\n", err);
+       else
+               testapp_print("email_add_mail success.\n");
+
+       testapp_print("saved mail id = [%d]\n", test_mail_data->mail_id);
+
+       if (attachment_data)
+               email_free_attachment_data(&attachment_data, attachment_count);
+
+       if (meeting_req)
+               email_free_meeting_request(&meeting_req, 1);
+
+       email_free_mail_data(&test_mail_data, 1);
+       email_free_mailbox(&mailbox_data, 1);
+
+       return FALSE;
+}
+
+static gboolean testapp_test_email_parse_mime_file()
+{
+       int i = 0;
+       int attachment_count = 0;
+       int output_attachment_count = 0;
+       int verify = 0;
+       int err = EMAIL_ERROR_NONE;
+       char eml_file_path[255] = {0, };
+        struct tm *struct_time;
+
+       email_mail_data_t *mail_data = NULL;
+       email_attachment_data_t *mail_attachment_data = NULL;
+       email_mail_data_t *output_mail_data = NULL;
+       email_attachment_data_t *output_mail_attachment_data = NULL;
+
+       testapp_print("Input eml file path : ");
+       if (0 >= scanf("%s", eml_file_path))
+               testapp_print("Invalid input. ");
+
+       if ((err = email_parse_mime_file(eml_file_path, &mail_data, &mail_attachment_data, &attachment_count)) != EMAIL_ERROR_NONE) {
+               testapp_print("email_parse_mime_file failed : [%d]\n", err);
+               return false;
+       }
+
+        testapp_print("load success\n");
+
+        struct_time = localtime(&(mail_data->date_time));
+
+        testapp_print("%4d year", struct_time->tm_year +1900);
+        testapp_print("%2d month(0-11)\n", struct_time->tm_mon + 1);
+        testapp_print("%2d day(1-31)\n", struct_time->tm_mday);
+        testapp_print("%2d wday\n", struct_time->tm_wday);
+        testapp_print("%2d hour(0-23)\n", struct_time->tm_hour);
+        testapp_print("%2d minutes(0-59)\n", struct_time->tm_min);
+        testapp_print("%2d second(0-59)\n", struct_time->tm_sec);
+        testapp_print("year day %3d\n", struct_time->tm_yday);
+
+       testapp_print("Return-Path: %s\n", mail_data->full_address_return);
+       testapp_print("To: %s\n", mail_data->full_address_to);
+       testapp_print("Subject: %s\n", mail_data->subject);
+       testapp_print("Priority: %d\n", mail_data->priority);
+       testapp_print("From: %s\n", mail_data->full_address_from);
+       testapp_print("Reply-To: %s\n", mail_data->full_address_reply);
+       testapp_print("Sender: %s\n", mail_data->email_address_sender);
+       testapp_print("Message-ID: %s\n", mail_data->message_id);
+       testapp_print("attachment_count: %d\n", mail_data->attachment_count);
+       testapp_print("SMIME type : %d\n", mail_data->smime_type);
+       testapp_print("inline content count : %d\n", mail_data->inline_content_count);
+       testapp_print("mail_size : %d\n", mail_data->mail_size);
+       testapp_print("download_body_status : %d\n", mail_data->body_download_status);
+
+
+       for (i = 0; i < attachment_count ; i++) {
+               testapp_print("%d attachment\n", i);
+               testapp_print("attachment_id: %d\n", mail_attachment_data[i].attachment_id);
+               testapp_print("attachment_size: %d\n", mail_attachment_data[i].attachment_size);
+               testapp_print("inline_attachment_status: %d\n", mail_attachment_data[i].inline_content_status);
+               testapp_print("attachment_name: %s\n", mail_attachment_data[i].attachment_name);
+               testapp_print("attachment_path: %s\n", mail_attachment_data[i].attachment_path);
+               testapp_print("attachment_save_status: %d\n", mail_attachment_data[i].save_status);
+               testapp_print("content_id: %s\n", mail_attachment_data[i].content_id);
+               testapp_print("mailbox_id: %d\n", mail_attachment_data[i].mailbox_id);
+       }
+
+       testapp_print("Success : Open eml file\n");
+
+       if (mail_data->smime_type != EMAIL_SMIME_NONE) {
+               if (mail_data->smime_type == EMAIL_SMIME_SIGNED || mail_data->smime_type == EMAIL_PGP_SIGNED) {
+                       if (!email_verify_signature_ex(mail_data, mail_attachment_data, attachment_count, &verify))
+                               testapp_print("email_verify_signature_ex failed\n");
+               } else {
+                       if ((err = email_get_decrypt_message_ex(mail_data,
+                                                                                                       mail_attachment_data,
+                                                                                                       attachment_count,
+                                                                                                       &output_mail_data,
+                                                                                                       &output_mail_attachment_data,
+                                                                                                       &output_attachment_count,
+                                                                                                       &verify)) != EMAIL_ERROR_NONE)
+                               testapp_print("email_get_decrypt_message_ex failed\n");
+               }
+
+               testapp_print("verify : [%d]\n", verify);
+       }
+
+       if ((err = email_delete_parsed_data(mail_data)) != EMAIL_ERROR_NONE) {
+               testapp_print("email_delete_eml_data failed : [%d]\n", err);
+               return false;
+       }
+
+       testapp_print("Success : email_delete_eml_data\n");
+
+       if (mail_data)
+               email_free_mail_data(&mail_data, 1);
+
+       testapp_print("Success : email_free_mail_data\n");
+
+       if (mail_attachment_data)
+               email_free_attachment_data(&mail_attachment_data, attachment_count);
+
+       testapp_print("Success : email_free_attachment_data\n");
+
+       return true;
+
+}
+
+static gboolean testapp_test_email_write_mime_file()
+{
+       int err = EMAIL_ERROR_NONE;
+       int mail_id = 0;
+       int attachment_count = 0;
+       char *file_path = NULL;
+       email_mail_data_t *mail_data = NULL;
+       email_attachment_data_t *mail_attachment_data = NULL;
+
+
+       file_path = malloc(512);
+       memset(file_path, 0x00, 512);
+
+       testapp_print("Input mail id : ");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+
+       err = email_get_mail_data(mail_id, &mail_data);
+       if (err != EMAIL_ERROR_NONE || mail_data == NULL) {
+               testapp_print("email_get_mail_data failed : [%d]\n", err);
+               return false;
+       }
+
+       err = email_get_attachment_data_list(mail_id, &mail_attachment_data, &attachment_count);
+       if (err != EMAIL_ERROR_NONE) {
+               testapp_print("email_get_attachment_data_list failed : [%d]\n", err);
+               return false;
+       }
+
+       snprintf(file_path, 512, tzplatform_mkpath(TZ_SYS_DATA,"email/.email_data/tmp/%d_%8d.eml"), mail_id, (int)time(NULL));
+
+       err = email_write_mime_file(mail_data, mail_attachment_data, attachment_count, &file_path);
+       if (err != EMAIL_ERROR_NONE) {
+               testapp_print("email_write_mime_file failed : [%d]\n", err);
+               return false;
+       }
+
+       testapp_print("file path : [%s]\n", file_path);
+
+       if (mail_data)
+               email_free_mail_data(&mail_data, 1);
+
+       if (mail_attachment_data)
+               email_free_attachment_data(&mail_attachment_data, attachment_count);
+
+       if (file_path)
+               free(file_path);
+
+       return true;
+}
+
+static gboolean testapp_test_smime_verify_signature()
+{
+       int mail_id = 0;
+       int verify = 0;
+       int err = EMAIL_ERROR_NONE;
+
+       testapp_print("input mail_id :");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+
+       err = email_verify_signature(mail_id, &verify);
+       if (err != EMAIL_ERROR_NONE) {
+               testapp_print("Failed Verify\n");
+               return false;
+       }
+
+       testapp_print("verify value : [%d]\n", verify);
+       return true;
+}
+
+static gboolean testapp_test_email_add_mail_with_multiple_recipient()
+{
+       int                    i = 0;
+       int                    account_id = 0;
+       int                    err = EMAIL_ERROR_NONE;
+//     int                    smime_type = 0;
+       int                    recipient_addresses_count = 0;
+       char                  *recipient_addresses = NULL;
+       char                   recipient_address[234] = { 0, };
+       char                   from_address[300] = { 0 , };
+       const char            *body_file_path = MAIL_TEMP_BODY;
+       email_account_t       *account_data = NULL;
+       email_mailbox_t       *mailbox_data = NULL;
+       email_mail_data_t     *test_mail_data = NULL;
+       FILE                  *body_file;
+
+       testapp_print("\n > Enter account id : ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter recipient address count : ");
+       if (0 >= scanf("%d", &recipient_addresses_count))
+               testapp_print("Invalid input. ");
+
+       if (recipient_addresses_count < 1)
+               return TRUE;
+
+       recipient_addresses = malloc(sizeof(char) * 234 * recipient_addresses_count);
+
+       for (i = 0; i < recipient_addresses_count; i++) {
+               snprintf(recipient_address, 234, "\"mailtest%05d\" <mailtest%05d@a1234567890b1234567890.com>; ", i, i);
+               strcat(recipient_addresses, recipient_address);
+       }
+
+       email_get_account(account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account_data);
+
+       email_get_mailbox_by_mailbox_type(account_id, EMAIL_MAILBOX_TYPE_OUTBOX, &mailbox_data);
+
+       test_mail_data = malloc(sizeof(email_mail_data_t));
+       memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
+
+       SNPRINTF(from_address, 300, "<%s>", account_data->user_email_address);
+
+       test_mail_data->account_id             = account_id;
+       test_mail_data->save_status            = EMAIL_MAIL_STATUS_SEND_DELAYED;
+       test_mail_data->body_download_status   = 1;
+       test_mail_data->flags_seen_field       = 1;
+       test_mail_data->file_path_plain        = strdup(body_file_path);
+       test_mail_data->mailbox_id             = mailbox_data->mailbox_id;
+       test_mail_data->mailbox_type           = mailbox_data->mailbox_type;
+       test_mail_data->full_address_from      = strdup(from_address);
+       test_mail_data->full_address_to        = recipient_addresses;
+       test_mail_data->subject                = strdup("Read receipt request from TIZEN");
+       test_mail_data->remaining_resend_times = 3;
+       test_mail_data->report_status          = EMAIL_MAIL_REQUEST_DSN | EMAIL_MAIL_REQUEST_MDN;
+       test_mail_data->smime_type             = 0;
+
+       body_file = fopen(body_file_path, "w");
+
+       testapp_print("\n body_file [%p]\n", body_file);
+
+       if (body_file == NULL) {
+               testapp_print("\n fopen [%s]failed\n", body_file_path);
+               return FALSE;
+       }
+
+       for (i = 0; i < 100; i++)
+               fprintf(body_file, "Mail sending Test. [%d]\n", i);
+
+       fflush(body_file);
+       fclose(body_file);
+
+
+       if ((err = email_add_mail(test_mail_data, NULL, 0, NULL, 0)) != EMAIL_ERROR_NONE)
+               testapp_print("email_add_mail failed. [%d]\n", err);
+       else
+               testapp_print("email_add_mail success.\n");
+
+       testapp_print("saved mail id = [%d]\n", test_mail_data->mail_id);
+
+       email_free_mail_data(&test_mail_data, 1);
+       email_free_mailbox(&mailbox_data, 1);
+       email_free_account(&account_data, 1);
+
+       return FALSE;
+}
+
+static gboolean testapp_test_send_mails_every_x_minutes()
+{
+       int                    added_mail_id = 0;
+       int                    err = EMAIL_ERROR_NONE;
+       int                    handle = 0;
+       time_t                 time_to_send;
+       int                    i = 0;
+       int                    j = 0;
+       int                    account_id = 0;
+       int                    send_interval_in_minutes = 0;
+       int                    number_of_mails = 0;
+       char                   recipient_address[300] = { 0 , };
+       char                   from_address[300] = { 0 , };
+       char                   subject_form[1024] = { 0 , };
+       const char            *body_file_path = MAIL_TEMP_BODY;
+       struct tm             *time_to_send_tm;
+       email_account_t       *account_data = NULL;
+       email_mailbox_t       *mailbox_data = NULL;
+       email_mail_data_t     *test_mail_data = NULL;
+       FILE                  *body_file;
+
+       testapp_print("\n > Enter account id : ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter recipient address : ");
+       if (0 >= scanf("%s", recipient_address))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter number of mails: ");
+       if (0 >= scanf("%d", &number_of_mails))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter send interval in minutes: ");
+       if (0 >= scanf("%d", &send_interval_in_minutes))
+               testapp_print("Invalid input. ");
+
+       email_get_account(account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account_data);
+
+       email_get_mailbox_by_mailbox_type(account_id, EMAIL_MAILBOX_TYPE_OUTBOX, &mailbox_data);
+
+       test_mail_data = malloc(sizeof(email_mail_data_t));
+       memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
+
+       SNPRINTF(from_address, 300, "<%s>", account_data->user_email_address);
+
+       test_mail_data->account_id             = account_id;
+       test_mail_data->save_status            = EMAIL_MAIL_STATUS_SEND_DELAYED;
+       test_mail_data->body_download_status   = 1;
+       test_mail_data->flags_seen_field       = 1;
+       test_mail_data->file_path_plain        = strdup(body_file_path);
+       test_mail_data->mailbox_id             = mailbox_data->mailbox_id;
+       test_mail_data->mailbox_type           = mailbox_data->mailbox_type;
+       test_mail_data->full_address_from      = strdup(from_address);
+       test_mail_data->full_address_to        = strdup(recipient_address);
+       test_mail_data->remaining_resend_times = 3;
+       test_mail_data->report_status          = EMAIL_MAIL_REPORT_NONE;
+
+
+       for (i = 0; i < number_of_mails; i++) {
+               if (test_mail_data->subject)
+                       free(test_mail_data->subject);
+
+               time(&time_to_send);
+               time_to_send += (60 * send_interval_in_minutes) * (i + 1);
+               time_to_send_tm = localtime(&time_to_send);
+
+               strftime(subject_form, 1024, "[%H:%M] TEST.", time_to_send_tm);
+               test_mail_data->subject = strdup(subject_form);
+
+               body_file = fopen(body_file_path, "w");
+
+               testapp_print("\n body_file [%p]\n", body_file);
+
+               if (body_file == NULL) {
+                       testapp_print("\n fopen [%s]failed\n", body_file_path);
+                       return FALSE;
+               }
+
+               for (j = 0; j < 100; j++)
+                       fprintf(body_file, "Mail sending Test. [%d]\n", j);
+
+               fflush(body_file);
+               fclose(body_file);
+
+               if ((err = email_add_mail(test_mail_data, NULL, 0, NULL, 0)) != EMAIL_ERROR_NONE) {
+                       testapp_print("email_add_mail failed. [%d]\n", err);
+                       added_mail_id = 0;
+               } else {
+                       testapp_print("email_add_mail success.\n");
+                       added_mail_id = test_mail_data->mail_id;
+               }
+
+               testapp_print("saved mail id = [%d]\n", added_mail_id);
+
+               if (added_mail_id) {
+                       testapp_print("Calling email_schedule_sending_mail...\n");
+
+                       if (email_schedule_sending_mail(added_mail_id, time_to_send) < 0) {
+                               testapp_print("email_schedule_sending_mail failed[%d]\n", err);
+                       } else  {
+                               testapp_print("Start sending. handle[%d]\n", handle);
+                       }
+               }
+       }
+
+       email_free_mail_data(&test_mail_data, 1);
+       email_free_mailbox(&mailbox_data, 1);
+       email_free_account(&account_data, 1);
+
+       return TRUE;
+}
+
+/* internal functions */
+static gboolean testapp_test_interpret_command(int menu_number)
+{
+       gboolean go_to_loop = TRUE;
+
+       switch (menu_number) {
+               case 1:
+                       testapp_test_get_mails();
+                       break;
+               case 2:
+                       testapp_test_mail_send(NULL);
+                       break;
+               case 3:
+                       testapp_test_get_mail_list_ex();
+                       break;
+               case 4:
+                       testapp_test_add_attachment();
+                       break;
+               case 5:
+                       testapp_test_set_deleted_flag();
+                       break;
+               case 6:
+                       testapp_test_expunge_mails_deleted_flagged();
+                       break;
+               case 7:
+                       testapp_test_send_read_receipt();
+                       break;
+               case 8:
+                       testapp_test_delete_attachment();
+                       break;
+               case 9:
+                       testapp_test_count();
+                       break;
+               case 10:
+                       testapp_test_move_mails_to_mailbox_of_another_account();
+                       break;
+               case 11:
+                       testapp_test_send_mail_with_downloading_attachment_of_original_mail();
+                       break;
+               case 12:
+                       testapp_test_get_mail_data();
+                       break;
+               case 13:
+                       testapp_test_schedule_sending_mail();
+                       break;
+               case 14:
+                       testapp_test_delete();
+                       break;
+               case 15:
+                       testapp_test_update_mail_attribute();
+                       break;
+               case 16:
+                       testapp_test_download_body();
+                       break;
+               case 17:
+                       testapp_test_download_attachment();
+                       break;
+               case 18:
+                       testapp_test_get_attachment_data_list();
+                       break;
+               case 19:
+                       testapp_test_get_meeting_request();
+                       break;
+               case 20:
+                       testapp_test_delete_all();
+                       break;
+               case 21:
+                       testapp_test_move();
+                       break;
+               case 23:
+                       testapp_test_retry_send();
+                       break;
+               case 24:
+                       testapp_test_get_attachment_data();
+                       break;
+               case 27:
+                       testapp_test_move_all_mails_to_mailbox();
+                       break;
+               case 38:
+                       testapp_test_get_totaldiskusage();
+                       break;
+               case 40:
+                       testapp_test_address_format_check_test();
+                       break;
+               case 41:
+                       testapp_test_get_max_mail_count();
+                       break;
+               case 42:
+                       testapp_test_db_test();
+                       break;
+               case 43:
+                       testapp_test_send_cancel();
+                       break;
+               case 44:
+                       testapp_test_cancel_download_body();
+                       break;
+               case 46:
+                        testapp_test_get_mail_list_for_thread_view();
+                       break;
+               case 48:
+                       testapp_test_test_get_thread_information();
+                       break;
+               case 51:
+                       testapp_test_get_mail_list();
+                       break;
+               case 52:
+                       testapp_test_get_address_info_list();
+                       break;
+               case 55:
+                       testapp_test_set_flags_field();
+                       break;
+               case 56:
+                       testapp_test_add_mail(NULL);
+                       break;
+               case 57:
+                       testapp_test_update_mail();
+                       break;
+               case 58:
+                       testapp_test_search_mail_on_server();
+                       break;
+               case 59:
+                       testapp_test_add_mail_to_search_result_box();
+                       break;
+               case 60:
+                       testapp_test_email_parse_mime_file();
+                       break;
+               case 61:
+                       testapp_test_email_write_mime_file();
+                       break;
+               case 62:
+                       testapp_test_smime_verify_signature();
+                       break;
+               case 63:
+                       testapp_test_email_add_mail_with_multiple_recipient();
+                       break;
+               case 64:
+                       testapp_test_send_mails_every_x_minutes();
+                       break;
+               case 0:
+                       go_to_loop = FALSE;
+                       break;
+               default:
+                       break;
+       }
+
+       return go_to_loop;
+}
+
+void testapp_mail_main()
+{
+       gboolean go_to_loop = TRUE;
+       int menu_number = 0;
+
+       while (go_to_loop) {
+               testapp_show_menu(EMAIL_MAIL_MENU);
+               testapp_show_prompt(EMAIL_MAIL_MENU);
+
+               if (0 >= scanf("%d", &menu_number))
+                       testapp_print("Invalid input");
+
+               go_to_loop = testapp_test_interpret_command(menu_number);
+       }
+}
+
diff --git a/test/testapp-mail.h b/test/testapp-mail.h
new file mode 100644 (file)
index 0000000..3bd21fd
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+*  email-service
+*
+* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_MESSAGE_H
+#define EMAIL_TEST_MESSAGE_H
+
+#include <glib.h>
+
+
+/* export API */
+void           testapp_mail_main               (void);
+
+#endif /* EMAIL_TEST_MESSAGE_H */
+
diff --git a/test/testapp-mailbox.c b/test/testapp-mailbox.c
new file mode 100644 (file)
index 0000000..7f3f3bb
--- /dev/null
@@ -0,0 +1,555 @@
+/*
+*  email-service
+*
+* Copyright(c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
+*
+*/
+
+
+
+/* common header */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+/* open header */
+#include <glib.h>
+
+#include "email-api-account.h"
+#include "email-api-network.h"
+#include "email-api-mailbox.h"
+
+/* internal header */
+#include "testapp-utility.h"
+#include "testapp-mailbox.h"
+
+static gboolean testapp_print_mailbox_list(email_mailbox_t *input_mailbox_list, int input_count)
+{
+       int i;
+       char time_string[40] = { 0, };
+
+       testapp_print("There are %d mailboxes\n", input_count);
+       testapp_print("============================================================================\n");
+       testapp_print("id\ta_id\talias\tunread\t total\t total_on_ server\tmailbox_type\tlast_sync_time\n");
+       testapp_print("============================================================================\n");
+       if (input_count == 0) {
+               testapp_print("No mailbox is matched\n");
+       } else {
+               for (i = 0; i < input_count; i++) {
+                       strftime(time_string, 40, "%Y-%m-%d %H:%M:%S", localtime(&(input_mailbox_list[i].last_sync_time)));
+                       testapp_print("%2d\t", input_mailbox_list[i].mailbox_id);
+                       testapp_print("%2d\t%-12s\t", input_mailbox_list[i].account_id, input_mailbox_list[i].alias);
+                       testapp_print("%3d\t%3d\t%3d\t%3d\t%s\n"
+                                       , input_mailbox_list[i].unread_count
+                                       , input_mailbox_list[i].total_mail_count_on_local
+                                       , input_mailbox_list[i].total_mail_count_on_server
+                                       , input_mailbox_list[i].mailbox_type
+                                       , time_string);
+               }
+       }
+       testapp_print("============================================================================\n");
+
+       return FALSE;
+}
+
+static gboolean testapp_test_add_mailbox()
+{
+       email_mailbox_t  mailbox;
+       int account_id, mailbox_type = 0;
+       int local_yn = 0;
+       char arg[500];
+       int ret;
+    int handle;
+
+    memset(&mailbox, 0, sizeof(email_mailbox_t));
+
+       memset(arg, 0x00, 500);
+       testapp_print("\n> Enter mailbox name: ");
+       if (0 >= scanf("%s", arg))
+               testapp_print("Invalid input. ");
+       mailbox.mailbox_name = strdup(arg);
+
+       memset(arg, 0x00, 500);
+       testapp_print("> Enter mailbox alias name: ");
+       if (0 >= scanf("%s", arg))
+               testapp_print("Invalid input. ");
+       mailbox.alias = strdup(arg);
+
+       testapp_print("> Enter account id: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+       mailbox.account_id = account_id;
+
+       testapp_print("> Enter local_yn(1/0): ");
+       if (0 >= scanf("%d", &local_yn))
+               testapp_print("Invalid input. ");
+       mailbox.local = local_yn;
+
+       testapp_print("> Enter mailbox type: ");
+       if (0 >= scanf("%d", &mailbox_type))
+               testapp_print("Invalid input. ");
+
+       mailbox.mailbox_type = mailbox_type;
+       mailbox.eas_data = strdup("EAS DATA TEST");
+       mailbox.eas_data_length = strlen(mailbox.eas_data) + 1;
+
+
+       ret = email_add_mailbox(&mailbox, local_yn ? 0 : 1, &handle);
+
+       if (ret < 0) {
+               testapp_print("\n email_add_mailbox failed");
+       } else {
+               testapp_print("\n email_add_mailbox succeed : handle[%d], mailbox_id [%d]\n", handle, mailbox.mailbox_id);
+       }
+
+       if (mailbox.eas_data)
+               free(mailbox.eas_data);
+
+       return FALSE;
+}
+
+static gboolean testapp_test_delete_mailbox()
+{
+       int mailbox_id = 0;
+       int on_server = 0;
+       int ret;
+       int handle;
+
+       testapp_print("\n> Enter mailbox id:");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input");
+
+       testapp_print("> Enter on_server(1/0): ");
+       if (0 >= scanf("%d", &on_server))
+               testapp_print("Invalid input");
+
+       ret = email_delete_mailbox(mailbox_id, on_server, &handle);
+
+       if (ret < 0) {
+               testapp_print("\n email_delete_mailbox failed");
+       } else {
+               testapp_print("\n email_delete_mailbox succeed : handle[%d]\n", handle);
+       }
+
+       return FALSE;
+
+}
+
+static gboolean testapp_test_rename_mailbox()
+{
+       testapp_print("testapp_test_rename_mailbox\n");
+       int mailbox_id;
+       char mailbox_name[500] = { 0, };
+       char mailbox_alias[500] = { 0, };
+       int err;
+       int handle = 0;
+
+       testapp_print("> Enter mailbox id: ");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input");
+
+       testapp_print("> Enter new mailbox name: ");
+       if (0 >= scanf("%s", mailbox_name))
+               testapp_print("Invalid input");
+
+       testapp_print("> Enter new mailbox name: ");
+       if (0 >= scanf("%s", mailbox_alias))
+               testapp_print("Invalid input");
+
+       if ((err = email_rename_mailbox(mailbox_id, mailbox_name, mailbox_alias, true, &handle)) < 0) {
+               testapp_print("\n email_rename_mailbox failed[%d]\n", err);
+       } else {
+               testapp_print("\n email_rename_mailbox succeed. handle [%d]\n", handle);
+       }
+
+       return FALSE;
+}
+
+static gboolean testapp_test_get_imap_mailbox_list()
+{
+       int account_id = 0;
+       int handle = 0;
+
+       testapp_print("> Enter account id: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input");
+
+       if (email_sync_imap_mailbox_list(account_id, &handle) < 0)
+               testapp_print("email_sync_imap_mailbox_list failed");
+
+       return FALSE;
+
+}
+
+static gboolean testapp_test_set_local_mailbox()
+{
+       int mailbox_id = 0;
+       int is_local_mailbox = 0;
+
+       testapp_print("> Enter mailbox id: ");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input");
+
+       testapp_print("> Enter local: ");
+       if (0 >= scanf("%d", &is_local_mailbox))
+               testapp_print("Invalid input");
+
+       if (email_set_local_mailbox(mailbox_id, is_local_mailbox) < 0)
+               testapp_print("email_set_local_mailbox failed");
+
+       return FALSE;
+}
+
+static gboolean testapp_test_delete_mailbox_ex()
+{
+       int  err = EMAIL_ERROR_NONE;
+       int  mailbox_id_count = 0 ;
+       int *mailbox_id_array = NULL;
+       int  account_id = 0;
+       int  on_server = 0;
+       int  handle = 0;
+       int  i = 0;
+
+       testapp_print("\n > Enter account_id: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input");
+
+       testapp_print("\n > Enter mailbox_id_count: ");
+       if (0 >= scanf("%d", &mailbox_id_count))
+               testapp_print("Invalid input");
+
+       testapp_print("\n > Enter on_server: ");
+       if (0 >= scanf("%d", &on_server))
+               testapp_print("Invalid input");
+
+       mailbox_id_count = (mailbox_id_count < 5000) ? mailbox_id_count : 5000;
+
+       if (mailbox_id_count > 0) {
+               mailbox_id_array = malloc(sizeof(int) * mailbox_id_count);
+       }
+
+       for (i = 0; i < mailbox_id_count; i++) {
+               testapp_print("\n > Enter mailbox id: ");
+               if (0 >= scanf("%d", (mailbox_id_array + i)))
+                       testapp_print("Invalid input");
+       }
+
+       err = email_delete_mailbox_ex(account_id, mailbox_id_array, mailbox_id_count, on_server, &handle);
+
+       testapp_print("\nemail_delete_mailbox_ex returns [%d], handle [%d] \n", err, handle);
+
+       if (mailbox_id_array)
+               free(mailbox_id_array);
+       return 0;
+}
+
+static gboolean testapp_test_get_mailbox_by_type()
+{
+       int account_id = 0;
+       int err_code = EMAIL_ERROR_NONE;
+       email_mailbox_t *mailbox = NULL;
+       email_mailbox_type_e mailbox_type = 0;
+
+       testapp_print("\n > Enter account id: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input");
+
+       testapp_print("\n > Enter mailbox_type: ");
+       if (0 >= scanf("%d", (int*)&mailbox_type))
+               testapp_print("Invalid input");
+
+       if ((err_code = email_get_mailbox_by_mailbox_type(account_id, mailbox_type, &mailbox)) < 0) {
+               testapp_print("email_get_mailbox_by_mailbox_type error : %d\n", err_code);
+               return false ;
+       }
+
+       testapp_print_mailbox_list(mailbox, 1);
+
+       email_free_mailbox(&mailbox, 1);
+       return FALSE;
+}
+
+static gboolean testapp_test_set_mailbox_type()
+{
+       int  mailbox_id = 0;
+       int  mailbox_type = 0;
+       int  err_code = EMAIL_ERROR_NONE;
+
+       testapp_print("\n > Enter mailbox id : ");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input");
+
+       testapp_print("\n > Enter mailbox type : ");
+       if (0 >= scanf("%d", &mailbox_type))
+               testapp_print("Invalid input");
+
+       if ((err_code = email_set_mailbox_type(mailbox_id, mailbox_type)) != EMAIL_ERROR_NONE) {
+               testapp_print("\nemail_set_mailbox_type error : %d\n", err_code);
+       }
+
+       return FALSE;
+}
+
+static gboolean testapp_test_set_mail_slot_size()
+{
+       int account_id = 0;
+       int mailbox_id = 0;
+       int mail_slot_size = 0;
+       int err_code = EMAIL_ERROR_NONE;
+
+       testapp_print("\n > Enter account id(0: All account): ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input");
+
+       testapp_print("\n> Enter mailbox id(0 : All mailboxes):");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input");
+
+       testapp_print("\n > Enter mailbox slot size: ");
+       if (0 >= scanf("%d", &mail_slot_size))
+               testapp_print("Invalid input");
+
+       if ((err_code = email_set_mail_slot_size(account_id, mailbox_id, mail_slot_size)) < 0) {
+               testapp_print("   testapp_test_set_mail_slot_size error : %d\n", err_code);
+               return false ;
+       }
+
+       return FALSE;
+}
+
+static gboolean testapp_test_get_mailbox_list()
+{
+       int account_id = 0;
+       int mailbox_sync_type;
+       int count = 0;
+       int error_code = EMAIL_ERROR_NONE;
+       email_mailbox_t *mailbox_list = NULL;
+       testapp_print("\n > Enter account id: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input");
+       testapp_print("\n > Enter mailbox_sync_type\n[-1 :for all mailboxes, 0 : for mailboxes from server, 1 : local mailboxes\n : ");
+       if (0 >= scanf("%d", &mailbox_sync_type))
+               testapp_print("Invalid input");
+
+       if ((error_code = email_get_mailbox_list(account_id, mailbox_sync_type, &mailbox_list, &count)) < 0) {
+               testapp_print("   email_get_mailbox_list error %d\n", error_code);
+               return false ;
+       }
+
+       testapp_print_mailbox_list(mailbox_list, count);
+
+       email_free_mailbox(&mailbox_list, count);
+
+       if ((error_code = email_get_mailbox_list_ex(account_id, mailbox_sync_type, 1, &mailbox_list, &count)) < 0) {
+               testapp_print("   email_get_mailbox_list_ex error %d\n", error_code);
+               return false ;
+       }
+
+       testapp_print_mailbox_list(mailbox_list, count);
+
+       email_free_mailbox(&mailbox_list, count);
+       return FALSE;
+}
+
+static gboolean testapp_test_get_mailbox_list_by_keyword()
+{
+       int account_id = 0;
+       int count = 0;
+       char keyword[500] = { 0, };
+       int error_code = EMAIL_ERROR_NONE;
+       email_mailbox_t *mailbox_list = NULL;
+       testapp_print("\n > Enter account id: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input");
+
+       testapp_print("> Enter keyword: ");
+       if (0 >= scanf("%s", keyword))
+               testapp_print("Invalid input");
+
+       if ((error_code = email_get_mailbox_list_by_keyword(account_id, keyword, &mailbox_list, &count)) < 0) {
+               testapp_print("   email_get_mailbox_list_by_keyword error %d\n", error_code);
+               return false ;
+       }
+
+       testapp_print_mailbox_list(mailbox_list, count);
+
+       email_free_mailbox(&mailbox_list, count);
+
+       return FALSE;
+}
+
+
+static gboolean testapp_test_sync_mailbox()
+{
+       int account_id = 0;
+       int handle = 0;
+       int mailbox_id = 0;
+
+       testapp_print("\n > Enter Account id(0: for all account) : ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input");
+
+       testapp_print("\n > Enter Mailbox id(0: for all mailboxes) : ");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input");
+
+       if (account_id == ALL_ACCOUNT) {
+               if (email_sync_header_for_all_account(&handle) < 0)
+                       testapp_print("\n email_sync_header_for_all_account failed\n");
+               else
+                       testapp_print("\n email_sync_header_for_all_account success. Handle[%d]\n", handle);
+       } else {
+               if (email_sync_header(account_id, mailbox_id, &handle) < 0)
+                       testapp_print("\n email_sync_header failed\n");
+               else
+                       testapp_print("\n email_sync_header success. Handle[%d]\n", handle);
+       }
+
+       return FALSE;
+}
+
+static gboolean testapp_test_stamp_sync_time()
+{
+       int input_mailbox_id = 0;
+
+       testapp_print("\n > Enter Mailbox id : ");
+       if (0 >= scanf("%d", &input_mailbox_id))
+               testapp_print("Invalid input");
+
+       email_stamp_sync_time_of_mailbox(input_mailbox_id);
+
+       return FALSE;
+}
+
+static gboolean testapp_test_rename_mailbox_ex()
+{
+       testapp_print("testapp_test_rename_mailbox_ex\n");
+       int mailbox_id;
+       char mailbox_name[500] = { 0, };
+       char mailbox_alias[500] = { 0, };
+       char eas_data[500] = "OK. Done";
+       int err;
+       int handle = 0;
+
+       testapp_print("> Enter mailbox id: ");
+       if (0 >= scanf("%d", &mailbox_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("> Enter new mailbox name: ");
+       if (0 >= scanf("%s", mailbox_name))
+               testapp_print("Invalid input. ");
+
+       testapp_print("> Enter new mailbox alias: ");
+       if (0 >= scanf("%s", mailbox_alias))
+               testapp_print("Invalid input. ");
+
+       if ((err = email_rename_mailbox_ex(mailbox_id, mailbox_name, mailbox_alias, eas_data, strlen(eas_data), false, &handle)) < 0) {
+               testapp_print("\n email_rename_mailbox failed[%d]\n", err);
+       } else {
+               testapp_print("\n email_rename_mailbox succeed\n");
+       }
+       return FALSE;
+}
+
+static gboolean testapp_test_interpret_command(int menu_number)
+{
+       gboolean go_to_loop = TRUE;
+
+       switch (menu_number) {
+               case 1:
+                       testapp_test_add_mailbox();
+                       break;
+
+               case 2:
+                       testapp_test_delete_mailbox();
+                       break;
+
+               case 3:
+                       testapp_test_rename_mailbox();
+                       break;
+
+               case 4:
+                       testapp_test_get_imap_mailbox_list();
+                       break;
+
+               case 5:
+                       testapp_test_set_local_mailbox();
+                       break;
+
+               case 6:
+                       testapp_test_delete_mailbox_ex();
+                       break;
+
+               case 7:
+                       testapp_test_get_mailbox_by_type();
+                       break;
+
+               case 8:
+                       testapp_test_set_mailbox_type();
+                       break;
+
+               case 9:
+                       testapp_test_set_mail_slot_size();
+                       break;
+
+               case 10:
+                       testapp_test_get_mailbox_list();
+                       break;
+
+               case 11:
+                       testapp_test_sync_mailbox();
+                       break;
+
+               case 12:
+                       testapp_test_stamp_sync_time();
+                       break;
+
+               case 13:
+                       testapp_test_rename_mailbox_ex();
+                       break;
+
+               case 14:
+                       testapp_test_get_mailbox_list_by_keyword();
+                       break;
+
+               case 0:
+                       go_to_loop = FALSE;
+                       break;
+               default:
+                       break;
+       }
+
+       return go_to_loop;
+}
+
+void email_test_mailbox_main()
+{
+       gboolean go_to_loop = TRUE;
+       int menu_number = 0;
+
+       while (go_to_loop) {
+               testapp_show_menu(EMAIL_MAILBOX_MENU);
+               testapp_show_prompt(EMAIL_MAILBOX_MENU);
+
+               if (0 >= scanf("%d", &menu_number))
+                       testapp_print("Invalid input. ");
+
+               go_to_loop = testapp_test_interpret_command(menu_number);
+       }
+}
+
diff --git a/test/testapp-mailbox.h b/test/testapp-mailbox.h
new file mode 100644 (file)
index 0000000..e3aae25
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+*  email-service
+*
+* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_MAILBOX_H
+#define EMAIL_TEST_MAILBOX_H
+
+/* export API */
+void email_test_mailbox_main   (void);
+#endif
diff --git a/test/testapp-others.c b/test/testapp-others.c
new file mode 100644 (file)
index 0000000..2db9c83
--- /dev/null
@@ -0,0 +1,498 @@
+/*
+*  email-service
+*
+* Copyright(c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
+*
+*/
+
+
+/* common header */
+#include <stdio.h>
+#include <string.h>
+
+/* open header */
+#include <glib.h>
+#include <dlfcn.h>
+#include <vconf.h>
+#include "c-client.h"
+
+
+#include "email-api.h"
+#include "email-api-account.h"
+#include "email-api-network.h"
+
+
+/* internal header */
+#include "testapp-utility.h"
+#include "testapp-others.h"
+#include "email-ipc.h"
+#include "email-core-utils.h"
+
+static gboolean testapp_test_ping_service()
+{
+       if (email_ping_service() < 0)
+               testapp_print("email_ping_service failed..!");
+
+       return FALSE;
+}
+
+static gboolean testapp_test_cancel_job()
+{
+       int account_id = 0;
+       int handle = 0;
+
+       testapp_print("\n > Enter account_id(0: all account): ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter handle: ");
+       if (0 >= scanf("%d", &handle))
+               testapp_print("Invalid input. ");
+
+       if (email_cancel_job(account_id, handle, EMAIL_CANCELED_BY_USER) < 0)
+               testapp_print("email_cancel_job failed..!");
+       return FALSE;
+}
+
+static gboolean testapp_test_init_storage()
+{
+       if (email_init_storage() < 0)
+               testapp_print("email_init_storaege failed..!");
+
+       return FALSE;
+}
+
+static gboolean testapp_test_set_dnet_proper_profile_type()
+{
+       testapp_print("NOT Support\n");
+
+       return TRUE;
+}
+
+static gboolean testapp_test_get_dnet_proper_profile_type()
+{
+       testapp_print("NOT Support\n");
+
+       return TRUE;
+}
+
+static gboolean testapp_test_get_preview_text_from_file()
+{
+       char *preview_buffer = NULL;
+       char  html_file_path[1024] = { 0, };
+
+       testapp_print("\n > Enter file path : ");
+       if (0 >= scanf("%s", html_file_path))
+               testapp_print("Invalid input. ");
+
+       emcore_get_preview_text_from_file(NULL, NULL, html_file_path, 1024, &preview_buffer);
+
+       testapp_print("\n result :\n %s ", preview_buffer);
+
+       return TRUE;
+}
+
+static gboolean testapp_test_get_task_information()
+{
+       int i = 0;
+       int err = EMAIL_ERROR_NONE;
+       int task_information_count = 0;
+       email_task_information_t *task_information_array = NULL;
+
+
+       err = email_get_task_information(&task_information_array, &task_information_count);
+
+       testapp_print("\n======================================================================\n");
+       for (i = 0; i < task_information_count; i++)
+               testapp_print("type[%d], account_id[%d], handle[%d], status[%d] nth[%d] progress[%d] mail_id[%d]", task_information_array[i].type, task_information_array[i].account_id, task_information_array[i].handle, task_information_array[i].status,(int)task_information_array[i].task_data2, (int)task_information_array[i].task_data3, task_information_array[i].task_data1 );
+       testapp_print("\n======================================================================\n");
+
+       testapp_print("testapp_test_get_task_information  ..........End\n");
+
+       return err;
+}
+
+static gboolean testapp_test_create_db_full()
+{
+       int err;
+
+       err = email_create_db_full();
+
+       testapp_print("testapp_test_create_db_full returns [%d]", err);
+
+       return err;
+}
+
+static int encode_base64(char *src, unsigned long src_len, char **enc, unsigned long* enc_len, int *err_code)
+{
+       unsigned char *content = NULL;
+       int ret = true;
+       int err = EMAIL_ERROR_NONE;
+
+       if (err_code != NULL) {
+               *err_code = EMAIL_ERROR_NONE;
+       }
+
+       content = rfc822_binary(src, src_len, enc_len);
+
+       if (content)
+               *enc = (char *)content;
+       else {
+               err = EMAIL_ERROR_UNKNOWN;
+               ret = false;
+       }
+
+       if (err_code)
+           *err_code = err;
+
+       return ret;
+}
+
+
+static gboolean testapp_test_encoding_test()
+{
+       int error = EMAIL_ERROR_NONE;
+       int has_special_character = 0, base64_file_name_length = 0, i;
+       gsize bytes_read, bytes_written;
+       char *encoded_file_name = NULL, *base64_file_name = NULL;
+       SIZEDTEXT source_text;
+       GError *glib_error = NULL;
+       CHARSET *result_charset = NULL;
+       char filename[] = {0xEB, 0xB0, 0x94, 0xED, 0x83, 0x95, 0x32, 0x2E, 0x70, 0x6E, 0x67, 0x00}; /* UTF-8 */
+
+       source_text.data = (unsigned char*)filename;
+       source_text.size = strlen(filename);
+
+       result_charset = (CHARSET*)utf8_infercharset(&source_text);
+
+       if (result_charset) {
+               testapp_print("return_charset->name [%s]", result_charset->name);
+               encoded_file_name = (char*)g_convert(filename, -1, "UTF-8", result_charset->name, &bytes_read, &bytes_written, &glib_error);
+       } else {
+               i = 0;
+               while (filename[i++] & 0x80)
+                       has_special_character = 1;
+               testapp_print("has_special_character [%d]", has_special_character);
+               if (has_special_character)
+                       encoded_file_name = (char*)g_convert(filename, -1, "UTF-8", "EUC-KR", &bytes_read, &bytes_written, &glib_error);
+       }
+
+       if (encoded_file_name == NULL)
+               encoded_file_name = strdup(filename);
+
+       testapp_print("encoded_file_name [%s]", encoded_file_name);
+
+       if (!encode_base64(encoded_file_name, strlen(encoded_file_name), &base64_file_name, (unsigned long*)&base64_file_name_length, &error)) {
+               testapp_print("encode_base64 failed. error [%d]", error);
+               goto FINISH_OFF;
+       }
+
+       testapp_print("base64_file_name [%s]", base64_file_name);
+
+       if (base64_file_name) {
+               free(encoded_file_name);
+               encoded_file_name = malloc(strlen(base64_file_name) + 15);
+               if (!encoded_file_name) {
+                       testapp_print("em_malloc failed.");
+                       goto FINISH_OFF;
+               }
+               snprintf(encoded_file_name, strlen(base64_file_name) + 15, "=?UTF-8?B?%s?=", base64_file_name);
+               testapp_print("encoded_file_name [%s]", encoded_file_name);
+       }
+FINISH_OFF:
+
+       if (encoded_file_name)
+               free(encoded_file_name);
+
+       if (base64_file_name)
+               free(base64_file_name);
+
+       return error;
+}
+
+#define LIB_EMAIL_SERVICE_PATH "/usr/lib/libemail-api.so"
+
+int(*Datastore_FI_EMTB)(char **);
+int(*Datastore_FI_EMSB)(char **);
+int(*Datastore_FI_EMOB)(char **);
+int(*Datastore_FI_EMDR)(char **);
+int(*Datastore_FI_EMMF)(char **);
+int(*Datastore_FI_EMTR)(char **);
+int(*Datastore_FI_EMSP)(char **);
+
+static gboolean email_test_dtt_Datastore_FI()
+{
+       void *handle = NULL;
+       char *dl_error = NULL, *output_str = NULL;
+
+       handle = dlopen(LIB_EMAIL_SERVICE_PATH, RTLD_LAZY | RTLD_GLOBAL);
+       if (!handle) {
+               dl_error = dlerror();
+               if (dl_error)
+                       testapp_print("\t dlopen error : Open Library with absolute path return  :  %s\n", dl_error);
+               return false;
+       }
+
+       Datastore_FI_EMTB = dlsym(handle, "Datastore_FI_EMTB");
+       Datastore_FI_EMSB = dlsym(handle, "Datastore_FI_EMSB");
+       Datastore_FI_EMOB = dlsym(handle, "Datastore_FI_EMOB");
+       Datastore_FI_EMDR = dlsym(handle, "Datastore_FI_EMDR");
+       Datastore_FI_EMMF = dlsym(handle, "Datastore_FI_EMMF");
+       Datastore_FI_EMTR = dlsym(handle, "Datastore_FI_EMTR");
+       Datastore_FI_EMSP = dlsym(handle, "Datastore_FI_EMSP");
+
+       Datastore_FI_EMTB(&output_str);
+
+       testapp_print("\nemail_test_dtt_Datastore_FI\n%s\n", output_str);
+
+       if (output_str)
+               free(output_str);
+
+       if (handle) {
+               dlclose(handle);
+               dl_error = dlerror();
+               if (dl_error)
+                       testapp_print("\t Close handle return  :  %s\n", dl_error);
+       }
+
+       return true;
+}
+
+int(*Datastore_R_EMTB)(char **);
+int(*Datastore_R_EMSB)(char **);
+int(*Datastore_R_EMOB)(char **);
+int(*Datastore_R_EMDR)(char **);
+int(*Datastore_R_EMMF)(char **);
+int(*Datastore_R_EMTR)(char **);
+int(*Datastore_R_EMSP)(char **);
+
+
+static gboolean email_test_dtt_Datastore_R()
+{
+       void *handle = NULL;
+       char *dl_error = NULL, *output_str = NULL;
+
+       handle = dlopen(LIB_EMAIL_SERVICE_PATH, RTLD_LAZY | RTLD_GLOBAL);
+       if (!handle) {
+               dl_error = dlerror();
+               if (dl_error)
+                       testapp_print("\t dlopen error : Open Library with absolute path return  :  %s\n", dl_error);
+               return false;
+       }
+
+       Datastore_R_EMTB = dlsym(handle, "Datastore_R_EMTB");
+       Datastore_R_EMSB = dlsym(handle, "Datastore_R_EMSB");
+       Datastore_R_EMOB = dlsym(handle, "Datastore_R_EMOB");
+       Datastore_R_EMDR = dlsym(handle, "Datastore_R_EMDR");
+       Datastore_R_EMMF = dlsym(handle, "Datastore_R_EMMF");
+       Datastore_R_EMTR = dlsym(handle, "Datastore_R_EMTR");
+       Datastore_R_EMSP = dlsym(handle, "Datastore_R_EMSP");
+
+       Datastore_R_EMTB(&output_str);
+
+       testapp_print("\nemail_test_dtt_Datastore_R\n%s\n", output_str);
+
+       if (output_str)
+               free(output_str);
+
+       if (handle) {
+               dlclose(handle);
+               dl_error = dlerror();
+               if (dl_error)
+                       testapp_print("\t Close handle return  :  %s\n", dl_error);
+       }
+
+       return true;
+}
+
+int(*Datastore_C_EMTB)(char **);
+int(*Datastore_C_EMSB)(char **);
+int(*Datastore_C_EMOB)(char **);
+int(*Datastore_C_EMDR)(char **);
+int(*Datastore_C_EMMF)(char **);
+int(*Datastore_C_EMTR)(char **);
+int(*Datastore_C_EMSP)(char **);
+
+static gboolean email_test_dtt_Datastore_C()
+{
+       void *handle = NULL;
+       char *dl_error = NULL, *output_str = NULL;
+
+       handle = dlopen(LIB_EMAIL_SERVICE_PATH, RTLD_LAZY | RTLD_GLOBAL);
+       if (!handle) {
+               dl_error = dlerror();
+               if (dl_error)
+                       testapp_print("\t dlopen error : Open Library with absolute path return  :  %s\n", dl_error);
+               return false;
+       }
+
+       Datastore_C_EMTB = dlsym(handle, "Datastore_C_EMTB");
+       Datastore_C_EMSB = dlsym(handle, "Datastore_C_EMSB");
+       Datastore_C_EMOB = dlsym(handle, "Datastore_C_EMOB");
+       Datastore_C_EMDR = dlsym(handle, "Datastore_C_EMDR");
+       Datastore_C_EMMF = dlsym(handle, "Datastore_C_EMMF");
+       Datastore_C_EMTR = dlsym(handle, "Datastore_C_EMTR");
+       Datastore_C_EMSP = dlsym(handle, "Datastore_C_EMSP");
+
+       Datastore_C_EMTB(&output_str);
+
+
+       testapp_print("\nemail_test_dtt_Datastore_C\n%s\n", output_str);
+
+       if (output_str)
+               free(output_str);
+
+       if (handle) {
+               dlclose(handle);
+               dl_error = dlerror();
+               if (dl_error)
+                       testapp_print("\t Close handle return  :  %s\n", dl_error);
+       }
+
+       return true;
+}
+
+static gboolean testapp_test_show_user_message()
+{
+       int mail_id;
+
+       testapp_print("\n > Enter mail id : ");
+       if (0 >= scanf("%d", &mail_id))
+               testapp_print("Invalid input. ");
+
+       email_show_user_message(mail_id, EMAIL_ACTION_SEND_MAIL, EMAIL_ERROR_NETWORK_NOT_AVAILABLE);
+       return FALSE;
+}
+
+static gboolean testapp_test_get_mime_entity()
+{
+       char mime_path[512] = {0, };
+       char *mime_entity = NULL;
+
+       testapp_print("\n > Enter mime path for parsing : ");
+       if (0 >= scanf("%s", mime_path))
+               testapp_print("Invalid input. ");
+
+       email_get_mime_entity(mime_path, &mime_entity);
+
+       testapp_print("\nmime_entity = %s\n", mime_entity);
+       return true;
+}
+
+static gboolean testapp_test_query_smtp_mail_size_limit()
+{
+       int account_id = 0;
+       testapp_print("\n > Enter account id : ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+
+       email_query_smtp_mail_size_limit(account_id, NULL);
+       return true;
+}
+
+static gboolean testapp_test_verify_email_address()
+{
+       int err = EMAIL_ERROR_NONE;
+       char email_address[512] = {0, };
+
+       testapp_print("\n > Enter mime path for parsing : ");
+       if (0 >= scanf("%s", email_address))
+               testapp_print("Invalid input. ");
+
+       err = email_verify_email_address(email_address);
+
+       testapp_print("\nemail_verify_email_address returns [%d]\n", err);
+       return true;
+}
+
+
+
+static gboolean testapp_test_interpret_command(int menu_number)
+{
+       gboolean go_to_loop = TRUE;
+
+       switch (menu_number) {
+               case 1:
+                       testapp_test_ping_service();
+                       break;
+               case 2:
+                       testapp_test_init_storage();
+                       break;
+               case 3:
+                       testapp_test_cancel_job();
+                       break;
+               case 5:
+                       testapp_test_set_dnet_proper_profile_type();
+                       break;
+               case 6:
+                       testapp_test_get_dnet_proper_profile_type();
+                       break;
+               case 7:
+                       testapp_test_get_preview_text_from_file();
+                       break;
+               case 11:
+                       testapp_test_get_task_information();
+                       break;
+               case 12:
+                       testapp_test_create_db_full();
+                       break;
+               case 13:
+                       testapp_test_encoding_test();
+                       break;
+               case 14:
+                       email_test_dtt_Datastore_FI();
+                       email_test_dtt_Datastore_C();
+                       email_test_dtt_Datastore_R();
+                       break;
+               case 15:
+                       testapp_test_show_user_message();
+                       break;
+               case 16:
+                       testapp_test_get_mime_entity();
+                       break;
+               case 17:
+                       testapp_test_query_smtp_mail_size_limit();
+                       break;
+               case 18:
+                       testapp_test_verify_email_address();
+                       break;
+               case 0:
+                       go_to_loop = FALSE;
+                       break;
+               default:
+                       break;
+       }
+
+       return go_to_loop;
+}
+
+void testapp_others_main()
+{
+       gboolean go_to_loop = TRUE;
+       int menu_number = 0;
+
+       while (go_to_loop) {
+               testapp_show_menu(EMAIL_OTHERS_MENU);
+               testapp_show_prompt(EMAIL_OTHERS_MENU);
+
+               if (0 >= scanf("%d", &menu_number))
+                       testapp_print("Invalid input. ");
+
+               go_to_loop = testapp_test_interpret_command(menu_number);
+       }
+}
+
diff --git a/test/testapp-others.h b/test/testapp-others.h
new file mode 100644 (file)
index 0000000..9e4ce9e
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+*  email-service
+*
+* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_OTHERS_H
+#define EMAIL_TEST_OTHERS_H
+
+/* export API */
+void testapp_others_main(void);
+
+#endif
+
diff --git a/test/testapp-rule.c b/test/testapp-rule.c
new file mode 100644 (file)
index 0000000..54bcc37
--- /dev/null
@@ -0,0 +1,269 @@
+/*
+*  email-service
+*
+* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
+*
+*/
+
+
+
+/* common header */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+
+/* open header */
+#include <glib.h>
+
+#include "email-api-rule.h"
+
+/* internal header */
+#include "testapp-utility.h"
+#include "testapp-mailbox.h"
+
+static gboolean testapp_test_add_rule()
+{
+       email_rule_t*  rule = NULL;
+       int account_id = 0;
+       int target_mailbox_id = 0;
+       int action = 0;
+       int type = 0;
+       int flag = 0;
+       char arg[500];
+
+       rule = malloc(sizeof(email_rule_t));
+       testapp_print("> Enter account id: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+       rule->account_id = account_id;
+
+       testapp_print("> Enter Type(FROM - 1 / SUBJECT - 2): ");
+       if (0 >= scanf("%d", &type))
+               testapp_print("Invalid input. ");
+       rule->type = type;
+
+       memset(arg, 0x00, 500);
+       testapp_print("\n> Enter Filtering Value:");
+       if (0 >= scanf("%s", arg))
+               testapp_print("Invalid input. ");
+       rule->value = strdup(arg);
+
+       testapp_print("> Enter Action(MOVE - 1, BLOCK - 2, DELETE - 3): ");
+       if (0 >= scanf("%d", &action))
+               testapp_print("Invalid input. ");
+       rule->faction = action;
+
+       if (action == 1) {
+               testapp_print("\n> Enter target mailbox id:");
+               if (0 >= scanf("%d", &target_mailbox_id))
+                       testapp_print("Invalid input. ");
+               rule->target_mailbox_id = target_mailbox_id;
+       }
+
+       testapp_print("> Enter Flag1 value [On/Off]: ");
+       if (0 >= scanf("%d", &flag))
+               testapp_print("Invalid input. ");
+       rule->flag1 = flag;
+
+       testapp_print("> Enter Flag2 value [0:Exactly same as, 1:Include, 2:Compare Domain] : ");
+       if (0 >= scanf("%d", &flag))
+               testapp_print("Invalid input. ");
+       rule->flag2 = flag;
+
+       if (email_add_rule(rule) < 0)
+               testapp_print("\n email_add_rule failed");
+
+       testapp_print("ID of rule : [%d]\n", rule->filter_id);
+
+       if (email_apply_rule(rule->filter_id) != EMAIL_ERROR_NONE)
+               testapp_print("email_apply_rule failed\n");
+
+       email_free_rule(&rule, 1);
+
+       return FALSE;
+}
+
+static gboolean testapp_test_delete_rule()
+{
+       int filter_id = 0;
+
+       testapp_print("> Enter filter id: ");
+       if (0 >= scanf("%d", &filter_id))
+               testapp_print("Invalid input. ");
+
+       if (email_delete_rule(filter_id) < 0)
+               testapp_print("email_delete_rule failed..! ");
+
+       return FALSE;
+}
+
+
+static gboolean testapp_test_update_rule()
+{
+       email_rule_t*  rule = NULL;
+       int account_id = 0;
+       int target_mailbox_id = 0;
+       int action = 0;
+       int type = 0;
+       int flag = 0;
+       char arg[500];
+       int filter_id = 0;
+
+       rule = malloc(sizeof(email_rule_t));
+       memset(rule, 0X00, sizeof(email_rule_t));
+       testapp_print("> Enter filter id: ");
+       if (0 >= scanf("%d", &filter_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("> Enter account id: ");
+       if (0 >= scanf("%d", &account_id))
+               testapp_print("Invalid input. ");
+       rule->account_id = account_id;
+
+       testapp_print("> Enter Type(FROM - 1 / SUBJECT - 2): ");
+       if (0 >= scanf("%d", &type))
+               testapp_print("Invalid input. ");
+       rule->type = type;
+
+       memset(arg, 0x00, 500);
+       testapp_print("\n> Enter Filtering Value:");
+       if (0 >= scanf("%s", arg))
+               testapp_print("Invalid input. ");
+       rule->value = strdup(arg);
+
+       testapp_print("> Enter Action(MOVE - 1, BLOCK - 2, DELETE - 3): ");
+       if (0 >= scanf("%d", &action))
+               testapp_print("Invalid input. ");
+       rule->faction = action;
+
+       if (action == 1) {
+               testapp_print("\n> Enter target mailbox id:");
+               if (0 >= scanf("%d", &target_mailbox_id))
+                       testapp_print("Invalid input. ");
+               rule->target_mailbox_id = target_mailbox_id;
+       }
+
+       testapp_print("> Enter Flag1 value: ");
+       if (0 >= scanf("%d", &flag))
+               testapp_print("Invalid input. ");
+       rule->flag1 = flag;
+
+       testapp_print("> Enter Flag2 value: ");
+       if (0 >= scanf("%d", &flag))
+               testapp_print("Invalid input. ");
+       rule->flag2 = flag;
+
+       if (!email_update_rule(filter_id, rule) < 0)
+               testapp_print("email_update_rule failed..! ");
+
+       email_free_rule(&rule, 1);
+
+       return FALSE;
+}
+
+
+static gboolean testapp_test_get_rule(void)
+{
+       email_rule_t*  rule = NULL;
+       int filter_id = 0;
+
+       testapp_print("> Enter filter id: ");
+       if (0 >= scanf("%d", &filter_id))
+               testapp_print("Invalid input. ");
+
+       if (email_get_rule(filter_id, &rule) >= 0)
+               testapp_print("\n Got rule of account_id = %d and type = %d\n", rule->account_id, rule->type);
+
+       email_free_rule(&rule, 1);
+
+       return FALSE;
+
+}
+
+static gboolean testapp_test_get_rule_list(void)
+{
+       int count, i;
+       email_rule_t* rule_list = NULL;
+
+       if (email_get_rule_list(&rule_list, &count) < 0) {
+               testapp_print("   email_get_rule_list error\n");
+               return false ;
+       }
+
+       for (i = 0; i < count; i++) {
+               testapp_print("   %2d) Fileter_Id: %d | Account_id: %d  | Type: %d | Value %s \n", i + 1,
+                       rule_list[i].filter_id,
+                       rule_list[i].account_id,
+                       rule_list[i].type,
+                       rule_list[i].value);
+       }
+
+       email_free_rule(&rule_list, count);
+       return FALSE;
+
+}
+
+
+
+static gboolean testapp_test_interpret_command(int menu_number)
+{
+       gboolean go_to_loop = TRUE;
+
+       switch (menu_number) {
+               case 1:
+                       testapp_test_add_rule();
+                       break;
+               case 2:
+                       testapp_test_delete_rule();
+                       break;
+               case 3:
+                       testapp_test_update_rule();
+                       break;
+               case 5:
+                       testapp_test_get_rule();
+                       break;
+               case 6:
+                       testapp_test_get_rule_list();
+                       break;
+
+               case 0:
+                       go_to_loop = FALSE;
+                       break;
+               default:
+                       break;
+       }
+
+       return go_to_loop;
+}
+
+void email_test_rule_main()
+{
+       gboolean go_to_loop = TRUE;
+       int menu_number = 0;
+
+       while (go_to_loop) {
+               testapp_show_menu(EMAIL_RULE_MENU);
+               testapp_show_prompt(EMAIL_RULE_MENU);
+
+               if (0 >= scanf("%d", &menu_number))
+                       testapp_print("Invalid input. ");
+
+               go_to_loop = testapp_test_interpret_command(menu_number);
+       }
+}
+
diff --git a/test/testapp-rule.h b/test/testapp-rule.h
new file mode 100644 (file)
index 0000000..9fb79b7
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+*  email-service
+*
+* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_RULE_H
+#define EMAIL_TEST_RULE_H
+
+/* export API */
+void           email_test_rule_main                                    (void);
+
+#endif
+
diff --git a/test/testapp-thread.c b/test/testapp-thread.c
new file mode 100644 (file)
index 0000000..f41b0e3
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+*  email-service
+*
+* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
+*
+*/
+
+
+
+/* common header */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+
+/* open header */
+#include <glib.h>
+
+#include "email-api-account.h"
+#include "email-api-mail.h"
+
+/* internal header */
+#include "testapp-utility.h"
+#include "testapp-thread.h"
+
+static gboolean testapp_test_move_thread()
+{
+       int thread_id, move_always_flag;
+       int target_mailbox_id;
+
+       testapp_print("\n > Enter thread_id: ");
+       if (0 >= scanf("%d", &thread_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter target_mailbox_id: ");
+       if (0 >= scanf("%d", &target_mailbox_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter move_always_flag: ");
+       if (0 >= scanf("%d", &move_always_flag))
+               testapp_print("Invalid input. ");
+
+       email_move_thread_to_mailbox(thread_id, target_mailbox_id, move_always_flag);
+
+       return FALSE;
+}
+
+static gboolean testapp_test_delete_thread()
+{
+       int thread_id, delete_always_flag;
+
+       testapp_print("\n > Enter thread_id: ");
+       if (0 >= scanf("%d", &thread_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter delete_always_flag: ");
+       if (0 >= scanf("%d", &delete_always_flag))
+               testapp_print("Invalid input. ");
+
+       email_delete_thread(thread_id, delete_always_flag);
+
+       return FALSE;
+}
+
+static gboolean testapp_test_set_seen_flag_of_thread()
+{
+       int thread_id, seen_flag, on_server;
+
+       testapp_print("\n > Enter thread_id: ");
+       if (0 >= scanf("%d", &thread_id))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter seen_flag: ");
+       if (0 >= scanf("%d", &seen_flag))
+               testapp_print("Invalid input. ");
+
+       testapp_print("\n > Enter on_server: ");
+       if (0 >= scanf("%d", &on_server))
+               testapp_print("Invalid input. ");
+
+       email_modify_seen_flag_of_thread(thread_id, seen_flag, on_server);
+
+       return FALSE;
+}
+
+static gboolean testapp_test_interpret_command(int menu_number)
+{
+       gboolean go_to_loop = TRUE;
+
+       switch (menu_number) {
+               case 1:
+                       testapp_test_move_thread();
+                       break;
+
+               case 2:
+                       testapp_test_delete_thread();
+                       break;
+
+               case 3:
+                       testapp_test_set_seen_flag_of_thread();
+                       break;
+
+               case 0:
+                       go_to_loop = FALSE;
+                       break;
+               default:
+                       break;
+       }
+
+       return go_to_loop;
+}
+
+void testapp_thread_main()
+{
+       gboolean go_to_loop = TRUE;
+       int menu_number = 0;
+
+       while (go_to_loop) {
+               testapp_show_menu(EMAIL_THREAD_MENU);
+               testapp_show_prompt(EMAIL_THREAD_MENU);
+
+               if (0 >= scanf("%d", &menu_number))
+                       testapp_print("Invalid input. ");
+
+               go_to_loop = testapp_test_interpret_command(menu_number);
+       }
+}
diff --git a/test/testapp-thread.h b/test/testapp-thread.h
new file mode 100644 (file)
index 0000000..4e8a8ec
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+*  email-service
+*
+* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_THREAD_H
+#define EMAIL_TEST_THREAD_H
+
+#include <glib.h>
+
+
+/* export API */
+void testapp_thread_main();
+
+#endif /* EMAIL_TEST_THREAD_H */
\ No newline at end of file
diff --git a/test/testapp-utility.c b/test/testapp-utility.c
new file mode 100644 (file)
index 0000000..985bc29
--- /dev/null
@@ -0,0 +1,265 @@
+/*
+*  email-service
+*
+* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
+*
+*/
+
+
+
+/* common header */
+#include <stdarg.h>
+#include <string.h>
+
+/* open header */
+#include <glib.h>
+#include <glib/gprintf.h>
+
+/* internal header */
+#include "testapp-utility.h"
+
+/* internal data struct */
+
+void testapp_print(char *fmt, ...)
+{
+       va_list args = {0};
+       va_start(args, fmt);
+       vfprintf(stdout, fmt, args);
+       va_end(args);
+       fflush(stdout);
+}
+
+void testapp_show_menu(eEMAIL_MENU menu)
+{
+       switch (menu) {
+               case EMAIL_MAIN_MENU:
+                       testapp_print("==========================================\n");
+                       testapp_print("    Email test application \n");
+                       testapp_print("==========================================\n");
+                       testapp_print("1. Account Test\n");
+                       testapp_print("2. Mail Test\n");
+                       testapp_print("3. Mailbox Test\n");
+                       testapp_print("5. Rule Test\n");
+                       testapp_print("6. Thread Test\n");
+                       testapp_print("7. Others\n");
+                       testapp_print("8. Gmime test\n");
+                       testapp_print("0. Exit \n");
+                       testapp_print("------------------------------------------\n");
+                       break;
+
+               case EMAIL_ACCOUNT_MENU:
+                       testapp_print("==========================================\n");
+                       testapp_print("    ACCOUNT MENU \n");
+                       testapp_print("==========================================\n");
+                       testapp_print(" 1.  Add account with validation\n");
+                       testapp_print(" 2.  Update account\n");
+                       testapp_print(" 3.  Delete account\n");
+                       testapp_print(" 4.  Get account\n");
+                       testapp_print(" 5.  Get account list\n");
+                       testapp_print(" 6.  Update check interval\n");
+                       testapp_print(" 7.  Validate account\n");
+                       testapp_print(" 8.  Cancel validate Account\n");
+                       testapp_print(" 9.  Backup All accounts\n");
+                       testapp_print(" 10. Restore accounts\n");
+                       testapp_print(" 11. Get password length of account\n");
+                       testapp_print(" 13. Update notifications\n");
+                       testapp_print(" 14. Clear notifications\n");
+                       testapp_print(" 15. Clear all notifications\n");
+                       testapp_print(" 16. Save default account ID\n");
+                       testapp_print(" 17. Load default account ID\n");
+                       testapp_print(" 18. Add certificate\n");
+                       testapp_print(" 19. Get certificate\n");
+                       testapp_print(" 20. Delete certificate\n");
+                       testapp_print(" 21. Add Account\n");
+                       testapp_print(" 22. Update peak schedule\n");
+                       testapp_print(" 0.  Go to Main Menu\n");
+                       testapp_print("------------------------------------------\n");
+                       break;
+
+               case EMAIL_MAIL_MENU:
+                       testapp_print("==========================================\n");
+                       testapp_print("    MAIL MENU\n");
+                       testapp_print("==========================================\n");
+                       testapp_print("1.  Get mails\n");
+                       testapp_print("2.  Send a mail\n");
+                       testapp_print("3.  Get mail list ex\n");
+                       testapp_print("4.  Add Attachment\n");
+                       testapp_print("5.  Set deleted flag\n");
+                       testapp_print("6.  Expunge deleted flagged mails\n");
+                       testapp_print("7.  Send read receipt\n");
+                       testapp_print("8.  Delete attachment\n");
+                       testapp_print("9.  Mail Count \n");
+                       testapp_print("10. Move mails to another account\n");
+                       testapp_print("11. Send mail with downloading attachment of original mail\n");
+                       testapp_print("12. Get mail data\n");
+                       testapp_print("13. Schedule sending mail\n");
+                       testapp_print("14. Delete a mail \n");
+                       testapp_print("15. Update mail attribute \n");
+                       testapp_print("16. Download mail body\n");
+                       testapp_print("17. Download an attachment\n");
+                       testapp_print("18. Get attachment list\n");
+                       testapp_print("19. Get meeting request\n");
+                       testapp_print("20. Delete all mail\n");
+                       testapp_print("21. Move Mail \n");
+                       testapp_print("23. Resend Mail \n");
+                       testapp_print("24. Get attachment data \n");
+                       testapp_print("27. Move all mails to mailbox\n");
+                       testapp_print("38. Get total email disk usage \n");
+                       testapp_print("40. Verify Email Address Format\n");
+                       testapp_print("41. Get Max Mail Count\n");
+                       testapp_print("42. Storage test : (Input : to fields)\n");
+                       testapp_print("43. Send mail Cancel\n");
+                       testapp_print("44. Cancel Download Body\n");
+                       testapp_print("46. Get thread list\n");
+                       testapp_print("48. Get thread information\n");
+                       testapp_print("51. Get mail list\n");
+                       testapp_print("52. Get address info list\n");
+                       testapp_print("55. Set a field of flags\n");
+                       testapp_print("56. Add mail\n");
+                       testapp_print("57. Update mail\n");
+                       testapp_print("58. Search on server\n");
+                       testapp_print("59. Add mail to search result table\n");
+                       testapp_print("60. Parse mime file\n");
+                       testapp_print("61. Write mime file\n");
+                       testapp_print("63. Add mail with multiple recipient\n");
+                       testapp_print("64. Send mails every x minutes\n");
+                       testapp_print("0.  Go to Main Menu\n");
+                       testapp_print("------------------------------------------\n");
+                       break;
+
+               case EMAIL_MAILBOX_MENU:
+                       testapp_print("==========================================\n");
+                       testapp_print("   MAILBOX MENU\n");
+                       testapp_print("==========================================\n");
+                       testapp_print(" 1. Add mailbox\n");
+                       testapp_print(" 2. Delete mailbox\n");
+                       testapp_print(" 3. Raname mailbox\n");
+                       testapp_print(" 4. Get IMAP mailbox List\n");
+                       testapp_print(" 5. Set local mailbox\n");
+                       testapp_print(" 6. Delete mailbox ex\n");
+                       testapp_print(" 7. Get mailbox by mailbox type\n");
+                       testapp_print(" 8. Set mailbox type\n");
+                       testapp_print(" 9. Set mail slot size\n");
+                       testapp_print("10. Get mailbox list\n");
+                       testapp_print("11. Sync mailbox\n");
+                       testapp_print("12. Stamp sync time\n");
+                       testapp_print("13. Raname mailbox ex\n");
+                       testapp_print("14. Get mailbox list by keyword\n");
+                       testapp_print("0. Go to Main Menu\n");
+                       testapp_print("------------------------------------------\n");
+                       break;
+
+               case EMAIL_RULE_MENU:
+                       testapp_print("==========================================\n");
+                       testapp_print("   RULE MENU\n");
+                       testapp_print("==========================================\n");
+                       testapp_print("1. Add Rule\n");
+                       testapp_print("2. Delete Rule\n");
+                       testapp_print("3. Update Rule\n");
+                       testapp_print("5. Get Rule\n");
+                       testapp_print("6. Get Rule List\n");
+                       testapp_print("0. Go to Main Menu\n");
+                       testapp_print("------------------------------------------\n");
+                       break;
+
+               case EMAIL_THREAD_MENU:
+                       testapp_print("==========================================\n");
+                       testapp_print("   TRHEAD MENU\n");
+                       testapp_print("==========================================\n");
+                       testapp_print("1. Move Thread\n");
+                       testapp_print("2. Delete Thread\n");
+                       testapp_print("3. Set Seen Flag of Thread\n");
+                       testapp_print("0. Go to Main Menu\n");
+                       testapp_print("------------------------------------------\n");
+                       break;
+
+               case EMAIL_OTHERS_MENU:
+                       testapp_print("==========================================\n");
+                       testapp_print("   OTHERS\n");
+                       testapp_print("==========================================\n");
+                       testapp_print("1.  Ping service\n");
+                       testapp_print("2.  Init storage\n");
+                       testapp_print("3.  Cancel Job\n");
+                       testapp_print("5.  Set DNET Proper Profile Type\n");
+                       testapp_print("6.  Get DNET Proper Profile Type\n");
+                       testapp_print("7.  Get preview text\n");
+                       testapp_print("11. Get task information\n");
+                       testapp_print("12. Create DB full\n");
+                       testapp_print("13. Encoding Test\n");
+                       testapp_print("14. DTT Test\n");
+                       testapp_print("15. Show User Message\n");
+                       testapp_print("16. Get mime entity in signed file\n");
+                       testapp_print("17. Query SMTP mail size limit\n");
+                       testapp_print("18. Verify email address\n");
+                       testapp_print("0.  Go to Main Menu\n");
+                       testapp_print("------------------------------------------\n");
+                       break;
+
+               case EMAIL_GMIME_MENU:
+                       testapp_print("==========================================\n");
+                       testapp_print("   Gmime Test\n");
+                       testapp_print("==========================================\n");
+                       testapp_print("1. Parsing eml\n");
+                       testapp_print("0.  Go to Main Menu\n");
+                       testapp_print("------------------------------------------\n");
+                       break;
+
+               default:
+                       break;
+       }
+}
+void testapp_show_prompt(eEMAIL_MENU menu)
+{
+       switch (menu) {
+               case EMAIL_MAIN_MENU:
+                       testapp_print("[MAIN]# ");
+                       break;
+
+               case EMAIL_ACCOUNT_MENU:
+                       testapp_print("[ACCOUNT]# ");
+                       break;
+
+               case EMAIL_MAIL_MENU:
+                       testapp_print("[MAIL]# ");
+                       break;
+
+               case EMAIL_MAILBOX_MENU:
+                       testapp_print("[MAILBOX]# ");
+                       break;
+
+               case EMAIL_RULE_MENU:
+                       testapp_print("[RULE]# ");
+                       break;
+
+               case EMAIL_THREAD_MENU:
+                       testapp_print("[THREAD]# ");
+                       break;
+
+               case EMAIL_OTHERS_MENU:
+                       testapp_print("[OTHERS]# ");
+                       break;
+
+               case EMAIL_GMIME_MENU:
+                       testapp_print("[Gmime Test]# ");
+                       break;
+
+               default:
+                       break;
+       }
+}
+
+
diff --git a/test/testapp-utility.h b/test/testapp-utility.h
new file mode 100644 (file)
index 0000000..3b5a6a2
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+*  email-service
+*
+* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_UTILITY_H
+#define EMAIL_TEST_UTILITY_H
+
+#include <glib.h>
+
+typedef enum
+{
+       EMAIL_MAIN_MENU = 0x0,
+       EMAIL_ACCOUNT_MENU,
+       EMAIL_MAIL_MENU,
+       EMAIL_MAILBOX_MENU,
+       EMAIL_RULE_MENU,
+       EMAIL_THREAD_MENU,
+       EMAIL_OTHERS_MENU,
+       EMAIL_GMIME_MENU
+} eEMAIL_MENU;
+
+
+void testapp_print(char *fmt, ...);
+void testapp_show_menu(eEMAIL_MENU menu);
+void testapp_show_prompt(eEMAIL_MENU menu);
+
+#endif
+
diff --git a/utilities/CMakeLists.txt b/utilities/CMakeLists.txt
deleted file mode 100755 (executable)
index 8559a67..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(email-service)
-
-SET(CMAKE_SKIP_BUILD_RPATH TRUE)
-
-IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
-       SET(CMAKE_BUILD_TYPE "Debug")
-ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
-
-MESSAGE("")
-MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
-MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
-
-SET(VISIBILITY "-DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--gc-sections -fPIE")
-
-##########################################################
-# Define Test App
-##########################################################
-
-
-SET(TEST-APP-SRCS
-       ${CMAKE_SOURCE_DIR}/utilities/test-application/main.c
-       ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-utility.c
-       ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-mail.c
-       ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-mailbox.c
-       ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-account.c
-       ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-rule.c
-       ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-thread.c
-       ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-others.c
-       ${CMAKE_SOURCE_DIR}/utilities/test-application/testapp-gmime.c
-)
-
-INCLUDE_DIRECTORIES(
-       ${CMAKE_SOURCE_DIR}/utilities/test-application/include
-       ${CMAKE_SOURCE_DIR}/email-api/include
-       ${CMAKE_SOURCE_DIR}/email-common-use/include
-       ${CMAKE_SOURCE_DIR}/email-core/include
-       ${CMAKE_SOURCE_DIR}/email-core/email-storage/include
-       ${CMAKE_SOURCE_DIR}/email-ipc/include
-)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(test_app_pkgs REQUIRED glib-2.0 gthread-2.0 vconf uw-imap-toolkit contacts-service2 gmime-2.6)
-
-FOREACH(flag ${test_app_pkgs_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
-
-ADD_EXECUTABLE(email-test-app ${TEST-APP-SRCS})
-TARGET_LINK_LIBRARIES(email-test-app ${test_app_pkgs_LDFLAGS} email-api email-smime-api)
-
-INSTALL(TARGETS email-test-app DESTINATION bin)
-
diff --git a/utilities/test-application/include/testapp-account.h b/utilities/test-application/include/testapp-account.h
deleted file mode 100755 (executable)
index 1c19e78..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_ACCOUNT_H
-#define EMAIL_TEST_ACCOUNT_H
-
-/* export API */
-void testapp_account_main();
-
-#endif
diff --git a/utilities/test-application/include/testapp-gmime.h b/utilities/test-application/include/testapp-gmime.h
deleted file mode 100755 (executable)
index 0aeafee..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_GMIME_H
-#define EMAIL_TEST_GMIME_H
-
-/* export API */
-void testapp_gmime_main(void);
-
-#endif
-
diff --git a/utilities/test-application/include/testapp-mail.h b/utilities/test-application/include/testapp-mail.h
deleted file mode 100755 (executable)
index 3bd21fd..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_MESSAGE_H
-#define EMAIL_TEST_MESSAGE_H
-
-#include <glib.h>
-
-
-/* export API */
-void           testapp_mail_main               (void);
-
-#endif /* EMAIL_TEST_MESSAGE_H */
-
diff --git a/utilities/test-application/include/testapp-mailbox.h b/utilities/test-application/include/testapp-mailbox.h
deleted file mode 100755 (executable)
index e3aae25..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_MAILBOX_H
-#define EMAIL_TEST_MAILBOX_H
-
-/* export API */
-void email_test_mailbox_main   (void);
-#endif
diff --git a/utilities/test-application/include/testapp-others.h b/utilities/test-application/include/testapp-others.h
deleted file mode 100755 (executable)
index 9e4ce9e..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_OTHERS_H
-#define EMAIL_TEST_OTHERS_H
-
-/* export API */
-void testapp_others_main(void);
-
-#endif
-
diff --git a/utilities/test-application/include/testapp-rule.h b/utilities/test-application/include/testapp-rule.h
deleted file mode 100755 (executable)
index 9fb79b7..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_RULE_H
-#define EMAIL_TEST_RULE_H
-
-/* export API */
-void           email_test_rule_main                                    (void);
-
-#endif
-
diff --git a/utilities/test-application/include/testapp-thread.h b/utilities/test-application/include/testapp-thread.h
deleted file mode 100755 (executable)
index 4e8a8ec..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_THREAD_H
-#define EMAIL_TEST_THREAD_H
-
-#include <glib.h>
-
-
-/* export API */
-void testapp_thread_main();
-
-#endif /* EMAIL_TEST_THREAD_H */
\ No newline at end of file
diff --git a/utilities/test-application/include/testapp-utility.h b/utilities/test-application/include/testapp-utility.h
deleted file mode 100755 (executable)
index 3b5a6a2..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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 EMAIL_TEST_UTILITY_H
-#define EMAIL_TEST_UTILITY_H
-
-#include <glib.h>
-
-typedef enum
-{
-       EMAIL_MAIN_MENU = 0x0,
-       EMAIL_ACCOUNT_MENU,
-       EMAIL_MAIL_MENU,
-       EMAIL_MAILBOX_MENU,
-       EMAIL_RULE_MENU,
-       EMAIL_THREAD_MENU,
-       EMAIL_OTHERS_MENU,
-       EMAIL_GMIME_MENU
-} eEMAIL_MENU;
-
-
-void testapp_print(char *fmt, ...);
-void testapp_show_menu(eEMAIL_MENU menu);
-void testapp_show_prompt(eEMAIL_MENU menu);
-
-#endif
-
diff --git a/utilities/test-application/main.c b/utilities/test-application/main.c
deleted file mode 100755 (executable)
index e09723a..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
-*
-*/
-
-
-
-/* common header */
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-/* open header */
-#include <glib.h>
-
-#include "email-api-init.h"
-
-/* internal header */
-#include "testapp-utility.h"
-#include "testapp-account.h"
-#include "testapp-mail.h"
-#include "testapp-mailbox.h"
-#include "testapp-rule.h"
-#include "testapp-thread.h"
-#include "testapp-others.h"
-#include "testapp-gmime.h"
-
-/* function prototype */
-static void testapp_system_signal_handler(int signal_number);
-
-
-/* implementation */
-static gboolean testapp_initialize_testing()
-{
-       struct timeval tv_1, tv_2;
-       int interval;
-       int error;
-
-       /* register signal handler */
-       if (signal(SIGINT, testapp_system_signal_handler) == SIG_ERR) {
-               testapp_print("register signal handler fail\n");
-               return FALSE;
-       }
-
-       if (signal(SIGQUIT, testapp_system_signal_handler) == SIG_ERR) {
-               testapp_print("register signal handler fail\n");
-               return FALSE;
-       }
-
-       if (signal(SIGTSTP, testapp_system_signal_handler) == SIG_ERR) {
-               testapp_print("register signal handler fail\n");
-               return FALSE;
-       }
-
-       if (signal(SIGTERM, testapp_system_signal_handler) == SIG_ERR) {
-               testapp_print("register signal handler fail\n");
-               return FALSE;
-       }
-
-
-       gettimeofday(&tv_1, NULL);
-
-       if (email_service_begin() != EMAIL_ERROR_NONE) {
-               testapp_print("unexpected error: opening email service fail\n");
-               return FALSE;
-       }
-       gettimeofday(&tv_2, NULL);
-       interval = tv_2.tv_usec - tv_1.tv_usec;
-       testapp_print("\t email_service_begin Proceed time %d us\n", interval);
-
-       gettimeofday(&tv_1, NULL);
-       if ((error = email_open_db()) != EMAIL_ERROR_NONE) {
-               testapp_print("email_open_db failed [%d]\n", error);
-       }
-       gettimeofday(&tv_2, NULL);
-       interval = tv_2.tv_usec - tv_1.tv_usec;
-       testapp_print("\t email_open_db Proceed time %d us\n", interval);
-
-       return TRUE;
-}
-
-static gboolean testapp_finalize_testing()
-{
-       int error;
-
-       if ((error = email_close_db()) != EMAIL_ERROR_NONE) {
-               testapp_print("email_close_db failed [%d]\n", error);
-       }
-
-       if (email_service_end() != EMAIL_ERROR_NONE) {
-               testapp_print("unexpected error: closing email service fail \n");
-       }
-
-       return TRUE;
-}
-
-static void testapp_system_signal_handler (int signal_number)
-{
-       testapp_print("signal:%d\n", signal_number);
-       switch (signal_number) {
-               case SIGQUIT:
-               case SIGINT:
-               case SIGTSTP:
-               case SIGTERM:
-                       testapp_finalize_testing();
-                       break;
-
-               default:
-                       testapp_print("unhandled signal:%d\n", signal_number);
-                       break;
-       }
-       exit(0);
-}
-
-
-static gboolean testapp_interpret_command(int menu_number)
-{
-       gboolean go_to_loop = TRUE;
-
-       switch (menu_number) {
-               case 1:
-                       testapp_account_main();
-                       break;
-
-               case 2:
-                       testapp_mail_main();
-                       break;
-
-               case 3:
-                       email_test_mailbox_main();
-                       break;
-
-               case 4:
-                       break;
-
-               case 5:
-                       email_test_rule_main();
-                       break;
-
-               case 6:
-                       testapp_thread_main();
-                       break;
-
-               case 7:
-                       testapp_others_main();
-                       break;
-
-               case 8:
-                       testapp_gmime_main();
-                       break;
-
-               case 0:
-                       go_to_loop = FALSE;
-                       break;
-               default:
-                       break;
-       }
-
-       return go_to_loop;
-}
-
-int main(int argc, char *argv[])
-{
-       gboolean go_to_loop = TRUE;
-       int menu_number = 0;
-
-       if (testapp_initialize_testing() == FALSE) {
-               testapp_print("email-service is not ready\n");
-               exit(0);
-       }
-
-       while (go_to_loop) {
-               testapp_show_menu(EMAIL_MAIN_MENU);
-               testapp_show_prompt(EMAIL_MAIN_MENU);
-               if (0 >= scanf("%d", &menu_number))
-                       testapp_print("Invalid input");
-               go_to_loop = testapp_interpret_command(menu_number);
-       }
-
-       testapp_finalize_testing();
-
-       exit(0);
-}
-
-
diff --git a/utilities/test-application/testapp-account.c b/utilities/test-application/testapp-account.c
deleted file mode 100755 (executable)
index 0dc994f..0000000
+++ /dev/null
@@ -1,1087 +0,0 @@
-/*
-*  email-service
-*
-* Copyright(c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
-*
-*/
-
-/* common header */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-/* open header */
-#include <glib.h>
-
-#include "email-api.h"
-#include "email-api-smime.h"
-#include "email-api-account.h"
-#include "email-api-network.h"
-#include "email-types.h"
-
-/* internal header */
-#include "testapp-utility.h"
-#include "testapp-account.h"
-#include <sys/time.h>
-#include <sys/times.h>
-#include <tzplatform_config.h>
-
-/* internal defines */
-
-#define GWB_RECV_SERVER_ADDR       "pop.gawab.com"
-#define GWB_SMTP_SERVER_ADDR       "smtp.gawab.com"
-
-#define VDF_RECV_SERVER_ADDR  "imap.email.vodafone.de"
-#define VDF_SMTP_SERVER_ADDR  "smtp.email.vodafone.de"
-
-/*  SAMSUNG 3G TEST */
-#define S3G_RECV_SERVER_ADDR               "165.213.73.235"
-#define S3G_RECV_SERVER_PORT               EMAIL_POP3_PORT
-#define S3G_RECV_USE_SECURITY              0
-#define S3G_RECV_IMAP_USE_SECURITY     1
-#define S3G_SMTP_SERVER_ADDR               "165.213.73.235"
-#define S3G_SMTP_SERVER_PORT               465
-#define S3G_SMTP_AUTH                                  1
-#define S3G_SMTP_USE_SECURITY        1
-#define S3G_KEEP_ON_SERVER                   1
-
-gboolean  testapp_create_account_object(email_account_t **result_account)
-{
-       email_account_t *account = NULL;
-       char id_string[100] = { 0, }, password_string[1000] = { 0, }, address_string[100]  = { 0, };
-       char accesss_token[1000] = { 0, }, refresh_token[1000] = { 0, };
-       int samsung3g_account_index;
-       int account_type;
-
-       testapp_print("1. Gawab\n");
-       testapp_print("2. Vodafone\n");
-       testapp_print("4. SAMSUNG 3G TEST(POP)\n");
-       testapp_print("5. SAMSUNG 3G TEST(IMAP)\n");
-       testapp_print("6. Gmail(POP3)\n");
-       testapp_print("7. Gmail(IMAP4)\n");
-       testapp_print("8. Active Sync(dummy)\n");
-       testapp_print("9. AOL\n");
-       testapp_print("10. Hotmail\n");
-       testapp_print("11. Daum(IMAP4)\n");
-       testapp_print("12. Daum(POP3)\n");
-       testapp_print("13. Yahoo(IMAP ID)\n");
-       testapp_print("14. Gmail IMAP with XOAUTH\n");
-       testapp_print("15. Yandex\n");
-       testapp_print("16. mopera\n");
-       testapp_print("Choose server type: ");
-
-
-       if (0 >= scanf("%d", &account_type))
-               testapp_print("Invalid input. ");
-
-       switch (account_type) {
-               case 4:
-               case 5:
-                       do {
-                               testapp_print("Enter your account index [1~10] : ");
-                               if (0 >= scanf("%d", &samsung3g_account_index))
-                                       testapp_print("Invalid input. ");
-                       } while (samsung3g_account_index > 10 || samsung3g_account_index < 1);
-                       sprintf(id_string, "test%02d", samsung3g_account_index);
-                       sprintf(address_string, "test%02d@streaming.s3glab.net", samsung3g_account_index);
-                       sprintf(password_string, "test%02d", samsung3g_account_index);
-                       break;
-               case 14:
-                       testapp_print("Enter email address : ");
-                       if (0 >= scanf("%s", address_string))
-                               testapp_print("Invalid input. ");
-                       strcpy(id_string, address_string);
-
-                       testapp_print("Enter access token : ");
-                       if (0 >= scanf("%s", accesss_token))
-                               testapp_print("Invalid input. ");
-
-                       testapp_print("Enter refresh token : ");
-                       if (0 >= scanf("%s", refresh_token))
-                               testapp_print("Invalid input. ");
-
-                       snprintf(password_string, 100, "%s\001%s\001", accesss_token, refresh_token);
-                       break;
-               default:
-                       testapp_print("Enter email address : ");
-                       if (0 >= scanf("%s", address_string))
-                               testapp_print("Invalid input. ");
-
-                       testapp_print("Enter id : ");
-                       if (0 >= scanf("%s", id_string))
-                               testapp_print("Invalid input. ");
-
-                       testapp_print("Enter password_string : ");
-                       if (0 >= scanf("%s", password_string))
-                               testapp_print("Invalid input. ");
-                       break;
-       }
-
-       account = malloc(sizeof(email_account_t));
-       memset(account, 0x00, sizeof(email_account_t));
-
-       typedef struct {
-               int is_preset_account;
-               int index_color;
-       } user_data_t;
-       user_data_t data = (user_data_t) {1, 0};
-       /* if user_data_t has any pointer member, please don't use sizeof(). */
-       /* You need to serialize user_data to buffer and then take its length */
-       int data_length = sizeof(data);
-
-       /* Common Options */
-       account->retrieval_mode                          = EMAIL_IMAP4_RETRIEVAL_MODE_ALL;
-       account->incoming_server_secure_connection           = 1;
-       account->outgoing_server_type                    = EMAIL_SERVER_TYPE_SMTP;
-       account->auto_download_size                                  = 2;
-       account->outgoing_server_use_same_authenticator  = 1;
-       account->auto_resend_times                       = 3;
-       account->pop_before_smtp                         = 0;
-       account->incoming_server_requires_apop           = 0;
-       account->incoming_server_authentication_method   = 0;
-       account->logo_icon_path                          = NULL;
-       account->color_label                             = (128 << 16) | (128 << 8) | (128);
-       account->user_data                               = malloc(data_length);
-       memcpy(account->user_data, (void *)&data, data_length);
-       account->user_data_length                        = data_length;
-       account->options.priority                        = EMAIL_MAIL_PRIORITY_NORMAL;
-       account->options.keep_local_copy                 = 1;
-       account->options.req_delivery_receipt            = 0;
-       account->options.req_read_receipt                = 0;
-       account->options.download_limit                  = 0;
-       account->options.block_address                   = 0;
-       account->options.block_subject                   = 0;
-       account->options.display_name_from               = strdup("test");
-       account->options.reply_with_body                 = 0;
-       account->options.forward_with_files              = 0;
-       account->options.add_myname_card                 = 0;
-       account->options.add_signature                   = 1;
-       account->options.signature                       = strdup("abcdef");
-       account->options.add_my_address_to_bcc           = 0;
-       account->check_interval                          = 0;
-       account->keep_mails_on_pop_server_after_download = 1;
-       account->default_mail_slot_size                  = 20;
-       account->roaming_option                          = EMAIL_ROAMING_OPTION_RESTRICTED_BACKGROUND_TASK;
-       account->peak_interval                           = 30;
-       account->peak_days                               = EMAIL_PEAK_DAYS_MONDAY | EMAIL_PEAK_DAYS_TUEDAY | EMAIL_PEAK_DAYS_THUDAY | EMAIL_PEAK_DAYS_FRIDAY;
-       account->peak_start_time                         = 830;
-       account->peak_end_time                           = 1920;
-
-       account->account_name                            = strdup(address_string);
-       account->user_display_name                       = strdup(id_string);
-       account->user_email_address                      = strdup(address_string);
-       account->reply_to_address                        = strdup(address_string);
-       account->return_address                          = strdup(address_string);
-
-       account->incoming_server_user_name               = strdup(id_string);
-       account->incoming_server_password                = strdup(password_string);
-       account->outgoing_server_user_name               = strdup(id_string);
-       account->outgoing_server_password                    = strdup(password_string);
-
-       switch (account_type) {
-               case 1:/*  gawab */
-                       account->incoming_server_type                    = EMAIL_SERVER_TYPE_POP3 ;
-                       account->incoming_server_address                 = strdup(GWB_RECV_SERVER_ADDR);
-                       account->incoming_server_port_number         = EMAIL_POP3S_PORT;
-                       account->outgoing_server_address             = strdup(GWB_SMTP_SERVER_ADDR);
-                       account->incoming_server_secure_connection       = 1;
-                       account->outgoing_server_need_authentication = 1;
-                       account->outgoing_server_port_number         = EMAIL_SMTPS_PORT;
-                       account->outgoing_server_secure_connection   = 1;
-
-                       break;
-
-               case 2:/*  vadofone */
-                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
-                       account->incoming_server_address = strdup(VDF_RECV_SERVER_ADDR);
-                       account->incoming_server_port_number = EMAIL_IMAP_PORT;
-                       account->outgoing_server_address     = strdup(VDF_SMTP_SERVER_ADDR);
-                       account->incoming_server_secure_connection      = 0;
-                       account->outgoing_server_need_authentication = 0;
-                       break;
-
-               case 4:/*  SAMSUNG 3G TEST */
-                       account->incoming_server_type            = EMAIL_SERVER_TYPE_POP3;
-                       account->incoming_server_address         = strdup(S3G_RECV_SERVER_ADDR);
-                       account->incoming_server_port_number = S3G_RECV_SERVER_PORT;
-                       account->outgoing_server_address     = strdup(S3G_SMTP_SERVER_ADDR);
-                       account->outgoing_server_port_number = S3G_SMTP_SERVER_PORT;
-                       account->incoming_server_secure_connection      = S3G_RECV_USE_SECURITY;
-                       account->outgoing_server_secure_connection  = S3G_SMTP_USE_SECURITY;
-                       account->outgoing_server_need_authentication = S3G_SMTP_AUTH;
-                       break;
-
-               case 5:/*  SAMSUNG 3G TEST */
-                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
-                       account->incoming_server_address = strdup(S3G_RECV_SERVER_ADDR);
-                       account->incoming_server_port_number = EMAIL_IMAPS_PORT;
-                       account->outgoing_server_address     = strdup(S3G_SMTP_SERVER_ADDR);
-                       account->outgoing_server_port_number = S3G_SMTP_SERVER_PORT;
-                       account->incoming_server_secure_connection      = 1;
-                       account->outgoing_server_secure_connection  = S3G_SMTP_USE_SECURITY;
-                       account->outgoing_server_need_authentication = S3G_SMTP_AUTH;
-                       break;
-
-               case 6:/*  Gmail POP3 */
-                       account->incoming_server_type  = EMAIL_SERVER_TYPE_POP3;
-                       account->incoming_server_address = strdup("pop.gmail.com");
-                       account->incoming_server_port_number = 995;
-                       account->incoming_server_secure_connection      = 1;
-                       account->outgoing_server_address    = strdup("smtp.gmail.com");
-                       account->outgoing_server_port_number = 465;
-                       account->outgoing_server_secure_connection = 1;
-                       account->outgoing_server_need_authentication = 1;
-                       break;
-
-               case 7: /*  Gmail IMAP4 */
-                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
-                       account->incoming_server_address = strdup("imap.gmail.com");
-                       account->incoming_server_port_number = 993;
-                       account->incoming_server_secure_connection      = 1;
-                       account->outgoing_server_address = strdup("smtp.gmail.com");
-                       account->outgoing_server_port_number = 465;
-                       account->outgoing_server_secure_connection = 1;
-                       account->outgoing_server_need_authentication   = EMAIL_AUTHENTICATION_METHOD_DEFAULT;
-                       account->incoming_server_authentication_method = EMAIL_AUTHENTICATION_METHOD_NO_AUTH;
-                       break;
-
-               case 8: /*  Active Sync */
-                       account->incoming_server_type  = EMAIL_SERVER_TYPE_ACTIVE_SYNC;
-                       account->incoming_server_address = strdup("");
-                       account->incoming_server_port_number = 0;
-                       account->incoming_server_secure_connection      = 1;
-                       account->outgoing_server_address    = strdup("");
-                       account->outgoing_server_port_number = 0;
-                       account->outgoing_server_secure_connection = 1;
-                       account->outgoing_server_need_authentication = 1;
-                       break;
-
-               case 9: /*  AOL */
-                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
-                       account->incoming_server_address = strdup("imap.aol.com");
-                       account->incoming_server_port_number = 143;
-                       account->incoming_server_secure_connection      = 0;
-                       account->outgoing_server_address    = strdup("smtp.aol.com");
-                       account->outgoing_server_port_number = 587;
-                       account->outgoing_server_secure_connection = 0;
-                       account->outgoing_server_need_authentication = 1;
-                       break;
-
-               case 10: /*  Hotmail */
-                       account->incoming_server_type  = EMAIL_SERVER_TYPE_POP3;
-                       account->incoming_server_address = strdup("pop3.live.com");
-                       account->incoming_server_port_number = 995;
-                       account->incoming_server_secure_connection      = 1;
-                       account->outgoing_server_address    = strdup("smtp.live.com");
-                       account->outgoing_server_port_number = 587;
-                       account->outgoing_server_secure_connection  = 0x02;
-                       account->outgoing_server_need_authentication = 1;
-                       break;
-
-               case 11:/*  Daum IMAP4*/
-                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
-                       account->incoming_server_address = strdup("imap.daum.net");
-                       account->incoming_server_port_number = 993;
-                       account->incoming_server_secure_connection      = 1;
-                       account->outgoing_server_address    = strdup("smtp.daum.net");
-                       account->outgoing_server_port_number = 465;
-                       account->outgoing_server_secure_connection = 1;
-                       account->outgoing_server_need_authentication = 1;
-                       break;
-
-               case 12:/*  Daum POP3*/
-                       account->incoming_server_type  = EMAIL_SERVER_TYPE_POP3;
-                       account->incoming_server_address = strdup("pop.daum.net");
-                       account->incoming_server_port_number = 995;
-                       account->incoming_server_secure_connection      = 1;
-                       account->outgoing_server_address    = strdup("smtp.daum.net");
-                       account->outgoing_server_port_number = 465;
-                       account->outgoing_server_secure_connection = 1;
-                       account->outgoing_server_need_authentication = 1;
-                       break;
-
-               case 13: /* Yahoo IMAP ID */
-                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
-                       account->incoming_server_address = strdup("samsung.imap.mail.yahoo.com");
-                       account->incoming_server_port_number = 993;
-                       account->incoming_server_secure_connection      = 1;
-                       account->outgoing_server_address    = strdup("samsung.smtp.mail.yahoo.com");
-                       account->outgoing_server_port_number = 465;
-                       account->outgoing_server_secure_connection = 1;
-                       account->outgoing_server_need_authentication = 1;
-                       break;
-
-               case 14: /*  XOAUTH */
-                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
-                       account->incoming_server_address = strdup("imap.gmail.com");
-                       account->incoming_server_port_number = 993;
-                       account->incoming_server_secure_connection      = 1;
-                       account->outgoing_server_address = strdup("smtp.gmail.com");
-                       account->outgoing_server_port_number = 465;
-                       account->outgoing_server_secure_connection = 1;
-                       account->outgoing_server_need_authentication   = EMAIL_AUTHENTICATION_METHOD_XOAUTH2;
-                       account->incoming_server_authentication_method = EMAIL_AUTHENTICATION_METHOD_XOAUTH2;
-                       break;
-
-               case 15: /*  yandex */
-                       account->incoming_server_type  = EMAIL_SERVER_TYPE_IMAP4;
-                       account->incoming_server_address = strdup("imap.yandex.ru");
-                       account->incoming_server_port_number = 993;
-                       account->incoming_server_secure_connection      = 1;
-                       account->outgoing_server_address = strdup("smtp.yandex.ru");
-                       account->outgoing_server_port_number = 465;
-                       account->outgoing_server_secure_connection = 1;
-                       account->outgoing_server_need_authentication   = EMAIL_AUTHENTICATION_METHOD_DEFAULT;
-                       account->incoming_server_authentication_method = EMAIL_AUTHENTICATION_METHOD_DEFAULT;
-                       break;
-
-               case 16: /*  mopera */
-                       account->incoming_server_type                  = EMAIL_SERVER_TYPE_POP3;
-                       account->incoming_server_address               = strdup("mail.mopera.net");
-                       account->incoming_server_port_number           = 110;
-                       account->incoming_server_secure_connection         = 0;
-                       account->incoming_server_authentication_method = EMAIL_AUTHENTICATION_METHOD_NO_AUTH;
-                       account->outgoing_server_address               = strdup("mail.mopera.net");
-                       account->outgoing_server_port_number           = 465;
-                       account->outgoing_server_secure_connection     = 0;
-                       account->outgoing_server_need_authentication   = EMAIL_AUTHENTICATION_METHOD_DEFAULT;
-                       break;
-
-               default:
-                       testapp_print("Invalid Account Number\n");
-                       return FALSE;
-                       break;
-       }
-       account->account_svc_id = 77;
-
-       if (result_account)
-               *result_account = account;
-
-       return TRUE;
-}
-
-static gboolean testapp_test_add_account_with_validation()
-{
-       int err = EMAIL_ERROR_NONE;
-       email_account_t *account = NULL;
-       int handle;
-       int flag = false;
-       int pre_count = 0;
-       int count = 0;
-       email_account_t *account_list = NULL;
-       int loop_count = 0;
-       if (!testapp_create_account_object(&account)) {
-               testapp_print("testapp_test_create_account_by_account_type error\n");
-               return FALSE;
-       }
-
-       email_get_account_list (&account_list, &pre_count);
-
-       err = email_add_account_with_validation(account, &handle);
-       if (err < 0) {
-               testapp_print("email_add_account_with_validation error : %d\n", err);
-               err = email_free_account(&account, 1);
-               return FALSE;
-       }
-
-       err = email_free_account(&account, 1);
-
-       do {
-               email_get_account_list (&account_list, &count);
-
-               if (count >  pre_count) {
-                       flag = true;
-                       testapp_print("email_add_account succeed.\n");
-               } else {
-                       testapp_print("account setting...\n");
-               }
-
-               sleep(3);
-               if (loop_count == 20) {
-                       testapp_print("email_add_account timeout.\n");
-                       break;
-               }
-               loop_count++;
-
-       } while (flag == false);
-
-
-       return TRUE;
-}
-
-static gboolean testapp_test_update_account()
-{
-       int account_id;
-       email_account_t *account = NULL;
-       //char account_name[256];
-       int err = EMAIL_ERROR_NONE;
-       //char signature[100] = {0};
-       //char user_email_address[256] = {0,};
-       //int add_my_address_to_bcc = 0;
-       int with_validation = 0; //account_svc_id = 0,
-
-       testapp_print("\n>> Enter Account ID: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       if ((err = email_get_account(account_id, GET_FULL_DATA, &account)) != EMAIL_ERROR_NONE) {
-               testapp_print("email_get_account failed - %d\n", err);
-               return false;
-       }
-
-       testapp_print("email_get_account result account_name - %s \n", account->account_name);
-       testapp_print("email_get_account result address - %s \n", account->user_email_address);
-       testapp_print("email_get_account result signature - %s \n", account->options.signature);
-       testapp_print("email_get_account result check_interval - %d \n", account->check_interval);
-
-       testapp_print("\n Enter new check interval(in mins):");
-       if (0 >= scanf("%d", &(account->check_interval)))
-               testapp_print("Invalid input. ");
-/*
-       testapp_print("\n Enter new peak interval(in mins):");
-       if (0 >= scanf("%d", &(account->peak_interval));
-
-       testapp_print("\n Enter new peak days:");
-       if (0 >= scanf("%d", &(account->peak_days));
-
-       testapp_print("\n Enter new peak start time:");
-       if (0 >= scanf("%d", &(account->peak_start_time));
-
-       testapp_print("\n Enter new peak end time:");
-       if (0 >= scanf("%d", &(account->peak_end_time));
-*/
-
-/*
-       testapp_print("\n Enter new Account name:");
-       if (0 >= scanf("%s",account_name);
-
-       testapp_print("\n Enter new email addr:");
-       if (0 >= scanf("%s",user_email_address);
-
-       testapp_print("\n Enter new signature:");
-       if (0 >= scanf("%s",signature);
-
-       testapp_print("\n>> Enter add_my_address_to_bcc:(0:off, 1:on) ");
-       if (0 >= scanf("%d", &add_my_address_to_bcc);
-
-       testapp_print("\n>> Enter account_svc_id: ");
-       if (0 >= scanf("%d", &account_svc_id);
-
-       testapp_print("\n>> With validation ?(0: No, 1:Yes) ");
-       if (0 >= scanf("%d", &with_validation);
-*/
-    if (account)  {
-               testapp_print("\n Assigning New Account name:(%s)", account->account_name);
-               testapp_print("\n Assigning New Signature:(%s)\n", account->options.signature);
-               /*
-               account->account_name = strdup(account_name);
-               account->user_email_address = strdup(user_email_address);
-               account->options.signature = strdup(signature);
-               account->options.add_my_address_to_bcc = add_my_address_to_bcc;
-               account->account_svc_id = account_svc_id;
-               */
-
-               if (with_validation) {
-                       if ((err = email_update_account_with_validation(account_id, account)) != EMAIL_ERROR_NONE) {
-                               testapp_print("email_update_account_with_validation failed - %d\n", err);
-                               return false;
-                       }
-                               testapp_print("email_update_account_with_validation successful \n");
-               } else {
-                       if ((err = email_update_account(account_id, account)) != EMAIL_ERROR_NONE) {
-                               testapp_print("email_update_account failed - %d\n", err);
-                               return false;
-                       }
-                       testapp_print("email_update_account successful \n");
-               }
-    }
-       return true;
-}
-
-static gboolean testapp_test_delete_account()
-{
-       int account_id;
-       email_account_t *account = NULL;
-       int err = EMAIL_ERROR_NONE;
-
-       testapp_print("\n>> Enter Account No: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-/* sowmya.kr, 281209 Adding signature to options in email_account_t changes */
-       if ((err = email_get_account(account_id, WITHOUT_OPTION, &account)) < 0) {
-               testapp_print("email_get_account failed \n");
-               testapp_print("testapp_test_delete_account failed\n");
-       } else {
-               testapp_print("email_get_account result account_name - %s \n", account->account_name);
-               if ((err = email_delete_account(account_id)) < 0)
-                       testapp_print("email_delete_account failed[%d]\n", err);
-               else
-                       testapp_print("email_delete_account successful \n");
-       }
-       return FALSE;
-
-}
-
-
-static gboolean testapp_test_validate_account()
-{
-       email_account_t *account = NULL;
-       int err_code = EMAIL_ERROR_NONE;
-       int handle = 0;
-
-       if (!testapp_create_account_object(&account)) {
-               testapp_print("testapp_create_account_object error\n");
-               return FALSE;
-       }
-
-       if ((err_code = email_validate_account_ex(account, &handle)) == EMAIL_ERROR_NONE)
-               testapp_print("email_validate_account_ex successful handle : %u\n", handle);
-       else
-               testapp_print("email_validate_account_ex failed err_code : %d \n", err_code);
-
-       if (account)
-               email_free_account(&account, 1);
-
-       return FALSE;
-
-}
-
-
-static gboolean testapp_test_cancel_validate_account()
-{
-       int account_id = 0;
-       int err_code = EMAIL_ERROR_NONE;
-       unsigned account_handle = 0;
-
-       testapp_print("\n > Enter account_id: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter handle: ");
-       if (0 >= scanf("%d", &account_handle))
-               testapp_print("Invalid input. ");
-
-       err_code = email_cancel_job(account_id, account_handle, EMAIL_CANCELED_BY_USER);
-       if (err_code == 0)
-               testapp_print("email_cancel_job Success..!handle:[%d]", account_handle);
-       else
-               testapp_print("email_cancel_job failed err_code: %d \n", err_code);
-
-       return FALSE;
-}
-
-static gboolean testapp_test_get_account()
-{
-       int account_id;
-       email_account_t *account = NULL;
-       int err_code = EMAIL_ERROR_NONE;
-       testapp_print("\n>> Enter Account No: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       typedef struct {
-               int is_preset_account;
-               int index_color;
-       } user_data_t;
-
-       testapp_print("\n----------------------------------------------------------\n");
-       testapp_print("email_get_account GET_FULL_DATA \n");
-       if ((err_code = email_get_account(account_id, GET_FULL_DATA, &account)) < 0) {
-               testapp_print("email_get_account failed - %d\n", err_code);
-               return FALSE;
-       }
-
-       user_data_t *val = (user_data_t *)account->user_data;
-       int is_preset_account =  val ? val->is_preset_account : 0;
-       int index_color = val ? val->index_color : 0;
-
-       testapp_print("email_get_account result\n"
-                       "account_name - %s \n"
-                       "user_email_address - %s \n"
-                       "incoming_server_secure_connection %d \n"
-                       "add_sig : %d \n"
-                       "signature %s \n"
-                       "add_my_address_to_bcc %d \n"
-                       "account_svc_id %d\n"
-                       "incoming_server_address %s\n"
-                       "outgoing_server_address %s\n"
-                       "default_mail_slot_size %d\n"
-                       "sync_status %d\n"
-                       "sync_disabled %d\n"
-                       "is_preset %d\n"
-                       "index_color %d\n"
-                       "certificate_path %s\n"
-                       "digest_type %d\n"
-                       "auto_resend_times %d\n"
-                       "roaming_option %d\n"
-                       "peak_interval %d\n"
-                       "peak_days %d\n"
-                       "peak_start_time %d\n"
-                       "peak_end_time %d\n"
-                       "color_label %d\n"
-                       "notification_status %d\n"
-                       "vibrate_status %d\n"
-                       "display_content_status %d\n"
-                       "default_ringtone_status %d\n"
-                       "alert_ringtone_path %s\n"
-               ,
-               account->account_name,
-               account->user_email_address,
-               account->incoming_server_secure_connection,
-               account->options.add_signature,
-               account->options.signature,
-               account->options.add_my_address_to_bcc,
-               account->account_svc_id,
-               account->incoming_server_address,
-               account->outgoing_server_address,
-               account->default_mail_slot_size,
-               account->sync_status,
-               account->sync_disabled,
-               is_preset_account,
-               index_color,
-               account->certificate_path,
-               account->digest_type,
-               account->auto_resend_times,
-               account->roaming_option,
-               account->peak_interval,
-               account->peak_days,
-               account->peak_start_time,
-               account->peak_end_time,
-               account->color_label,
-               account->options.notification_status,
-               account->options.vibrate_status,
-               account->options.display_content_status,
-               account->options.default_ringtone_status,
-               account->options.alert_ringtone_path
-               );
-
-       err_code = email_free_account(&account, 1);
-
-       testapp_print("\n----------------------------------------------------------\n");
-       testapp_print("email_get_account WITHOUT_OPTION \n");
-
-       if ((err_code = email_get_account(account_id, WITHOUT_OPTION, &account)) < 0) {
-               testapp_print("email_get_account failed \n");
-               return FALSE;
-       }
-
-       testapp_print("email_get_account result\n"
-                       "account_name - %s \n"
-                       "user_email_address - %s \n"
-                       "incoming_server_secure_connection %d \n"
-                       "add_signature : %d \n",
-               account->account_name,
-               account->user_email_address,
-               account->incoming_server_secure_connection,
-               account->options.add_signature
-       );
-
-       if (account->options.signature)
-               testapp_print("signature : %s\n", account->options.signature);
-       else
-               testapp_print("signature not retrieved \n");
-
-       err_code = email_free_account(&account, 1);
-
-       testapp_print("\n----------------------------------------------------------\n");
-       testapp_print("email_get_account ONLY_OPTION \n");
-
-       if ((err_code = email_get_account(account_id, ONLY_OPTION, &account)) < 0) {
-               testapp_print("email_get_account failed \n");
-               return FALSE;
-       }
-
-       testapp_print("email_get_account result\n"
-                       "add_sig : %d \n"
-                       "signature %s \n"
-                       "add_my_address_to_bcc %d\n"
-                       "account_svc_id %d\n",
-               account->options.add_signature,
-               account->options.signature,
-               account->options.add_my_address_to_bcc,
-               account->account_svc_id
-               );
-
-       if (account->account_name)
-               testapp_print("account_name : %s \n", account->account_name);
-       else
-               testapp_print("account_name not retrieved \n");
-
-       if (account->user_email_address)
-               testapp_print("user_email_address : %s \n", account->user_email_address);
-       else
-               testapp_print("user_email_address not retrieved \n");
-       err_code = email_free_account(&account, 1);
-
-       return FALSE;
-}
-
-static gboolean testapp_test_get_account_list()
-{
-
-       int count, i;
-       email_account_t *account_list = NULL;
-       struct timeval tv_1, tv_2;
-       int interval;
-       int err_code = EMAIL_ERROR_NONE;
-
-       gettimeofday(&tv_1, NULL);
-
-       if ((err_code = email_get_account_list(&account_list, &count)) < 0) {
-               testapp_print("   email_get_account_list error\n");
-               return false ;
-       }
-
-       gettimeofday(&tv_2, NULL);
-       interval = tv_2.tv_usec - tv_1.tv_usec;
-       testapp_print("\t testapp_test_get_account_list Proceed time %d us\n", interval);
-
-       for (i = 0; i < count; i++) {
-               testapp_print("   %2d) %-15s %-30s\n", account_list[i].account_id,
-                       account_list[i].account_name,
-                       account_list[i].user_email_address);
-       }
-
-       err_code = email_free_account(&account_list, count);
-       return FALSE;
-}
-
-static gboolean testapp_test_update_check_interval()
-{
-       int account_id = 0;
-       int err_code = EMAIL_ERROR_NONE;
-       email_account_t *account = NULL;
-
-       testapp_print("\n Enter account id :");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       if ((err_code = email_get_account(account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account)) != EMAIL_ERROR_NONE) {
-               testapp_print("email_get_account failed [%d]\n", err_code);
-               goto FINISH_OFF;
-       }
-
-       testapp_print("\n Enter new check interval(in mins):");
-       if (0 >= scanf("%d", &(account->check_interval)))
-               testapp_print("Invalid input. ");
-
-       if ((err_code = email_update_account(account_id, account)) != EMAIL_ERROR_NONE) {
-               testapp_print("email_update_account failed [%d]\n", err_code);
-               goto FINISH_OFF;
-       }
-
-       testapp_print("email_update_account successful \n");
-
-FINISH_OFF:
-       if (account)
-               email_free_account(&account, 1);
-
-       return err_code;
-}
-
-static gboolean testapp_test_backup_account()
-{
-       const char *file_name = tzplatform_mkpath(TZ_USER_DATA, "email/accounts_file");
-       int error_code;
-       error_code = email_backup_accounts_into_secure_storage(file_name);
-       testapp_print("\n email_backup_accounts_into_secure_storage returned [%d]\n", error_code);
-       return FALSE;
-}
-static gboolean testapp_test_restore_account()
-{
-       const char *file_name = tzplatform_mkpath(TZ_USER_DATA,"email/accounts_file");
-       int error_code;
-       error_code = email_restore_accounts_from_secure_storage(file_name);
-       testapp_print("\n email_restore_accounts_from_secure_storage returned [%d]\n", error_code);
-       return FALSE;
-}
-
-static gboolean testapp_test_get_password_length_of_account()
-{
-       int password_length, account_id;
-
-       testapp_print("\n input account id\n");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-       email_get_password_length_of_account(account_id, EMAIL_GET_INCOMING_PASSWORD_LENGTH, &password_length);
-       testapp_print("testapp_test_get_password_length_of_account returned [%d]\n", password_length);
-       return FALSE;
-}
-
-static gboolean testapp_test_update_notification()
-{
-       int error_code;
-       int account_id = 0;
-       int t_mail_count = 0;
-       int input_from_eas = 0;
-       int unread_mail_count = 0;
-
-       testapp_print("\n Input account ID:\n");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n Input mail count:\n");
-       if (0 >= scanf("%d", &t_mail_count))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n Input unread mail count:\n");
-       if (0 >= scanf("%d", &unread_mail_count))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n Input From eas:\n");
-       if (0 >= scanf("%d", &input_from_eas))
-               testapp_print("Invalid input. ");
-
-       error_code = email_update_notification_bar(account_id, t_mail_count, unread_mail_count, input_from_eas);
-       testapp_print("email_update_notification_bar returned [%d]\n", error_code);
-       return FALSE;
-}
-
-static gboolean testapp_test_clear_notification()
-{
-       int account_id = 0;
-       int error_code;
-
-       testapp_print("\n Input account ID:\n");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       error_code = email_clear_notification_bar(account_id);
-       testapp_print("email_clear_notification_bar returned [%d]\n", error_code);
-       return FALSE;
-}
-
-static gboolean testapp_test_clear_all_notification()
-{
-       int error_code;
-
-       error_code = email_clear_notification_bar(ALL_ACCOUNT);
-       testapp_print("email_clear_notification_bar returned [%d]\n", error_code);
-       return FALSE;
-}
-
-static gboolean testapp_test_save_default_account_id()
-{
-       int error_code;
-       int account_id = 0;
-
-       testapp_print("\nInput default account id : ");
-
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       error_code = email_save_default_account_id(account_id);
-
-       testapp_print("email_save_default_account_id returned [%d]\n", error_code);
-       return FALSE;
-}
-
-static gboolean testapp_test_load_default_account_id()
-{
-       int error_code;
-       int account_id = 0;
-
-       error_code = email_load_default_account_id(&account_id);
-
-       testapp_print("\ndefault account id : %d\n", account_id);
-       testapp_print("email_load_default_account_id returned [%d]\n", error_code);
-       return FALSE;
-}
-
-static gboolean testapp_test_add_account()
-{
-       int err = EMAIL_ERROR_NONE;
-       email_account_t *account = NULL;
-
-       if (!testapp_create_account_object(&account)) {
-               testapp_print("testapp_test_create_account_by_account_type error\n");
-               return FALSE;
-       }
-
-       err = email_add_account(account);
-       if (err < 0) {
-               testapp_print("email_add_account error : %d\n", err);
-               err = email_free_account(&account, 1);
-               return FALSE;
-       }
-
-       testapp_print("email_add_account succeed. account_id\n", account->account_id);
-
-       err = email_free_account(&account, 1);
-
-       return true;
-}
-
-static gboolean testapp_test_update_peak_schedule()
-{
-       int account_id;
-       email_account_t *account = NULL;
-       int err = EMAIL_ERROR_NONE;
-
-       testapp_print("\n>> Enter Account No: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       if ((err = email_get_account(account_id, GET_FULL_DATA, &account)) != EMAIL_ERROR_NONE) {
-               testapp_print("email_get_account failed [%d]\n", err);
-               return false;
-       }
-
-       testapp_print("old check_interval - %d \n", account->check_interval);
-       testapp_print("\n Enter new check interval(in mins):");
-       if (0 >= scanf("%d", &(account->check_interval)))
-               testapp_print("Invalid input. ");
-
-       testapp_print("old peak_interval - %d \n", account->peak_interval);
-
-       testapp_print("\n Enter new peak interval(in mins):");
-       if (0 >= scanf("%d", &(account->peak_interval)))
-               testapp_print("Invalid input. ");
-
-       testapp_print("old peak_days - %d \n", account->peak_days);
-
-       testapp_print("\n Enter new peak days:");
-       if (0 >= scanf("%d", &(account->peak_days)))
-               testapp_print("Invalid input. ");
-
-       testapp_print("old peak_start_time - %d \n", account->peak_start_time);
-
-       testapp_print("\n Enter new peak start time:");
-       if (0 >= scanf("%d", &(account->peak_start_time)))
-               testapp_print("Invalid input. ");
-
-       testapp_print("old peak_end_time - %d \n", account->peak_start_time);
-
-       testapp_print("\n Enter new peak end time:");
-       if (0 >= scanf("%d", &(account->peak_end_time)))
-               testapp_print("Invalid input. ");
-
-       if (account)  {
-               if ((err = email_update_account(account_id, account)) != EMAIL_ERROR_NONE) {
-                       testapp_print("email_update_account failed [%d]\n", err);
-                       return false;
-               }
-               testapp_print("email_update_account successful \n");
-       }
-       return true;
-}
-
-static gboolean testapp_test_interpret_command(int selected_number)
-{
-       gboolean go_to_loop = TRUE;
-
-       switch (selected_number) {
-               case 1:
-                       testapp_test_add_account_with_validation();
-                       break;
-
-               case 2:
-                       testapp_test_update_account();
-                       break;
-
-               case 3:
-                       testapp_test_delete_account();
-                       break;
-
-               case 4:
-                       testapp_test_get_account();
-                       break;
-
-               case 5:
-                       testapp_test_get_account_list();
-                       break;
-
-               case 6:
-                       testapp_test_update_check_interval();
-                       break;
-
-               case 7:
-                       testapp_test_validate_account();
-                       break;
-
-               case 8:
-                       testapp_test_cancel_validate_account();
-                       break;
-
-               case 9:
-                       testapp_test_backup_account();
-                       break;
-
-               case 10:
-                       testapp_test_restore_account();
-                       break;
-
-               case 11:
-                       testapp_test_get_password_length_of_account();
-                       break;
-
-               case 13:
-                       testapp_test_update_notification();
-                       break;
-
-               case 14:
-                       testapp_test_clear_notification();
-                       break;
-
-               case 15:
-                       testapp_test_clear_all_notification();
-                       break;
-
-               case 16:
-                       testapp_test_save_default_account_id();
-                       break;
-
-               case 17:
-                       testapp_test_load_default_account_id();
-                       break;
-
-               case 18:
-                       testapp_test_add_account();
-                       break;
-
-               case 19:
-                       testapp_test_update_peak_schedule();
-                       break;
-
-               case 0:
-                       go_to_loop = FALSE;
-                       break;
-
-               default:
-                       break;
-       }
-
-       return go_to_loop;
-}
-
-void testapp_account_main()
-{
-       gboolean go_to_loop = TRUE;
-       int menu_number = 0;
-
-       while (go_to_loop) {
-               testapp_show_menu(EMAIL_ACCOUNT_MENU);
-               testapp_show_prompt(EMAIL_ACCOUNT_MENU);
-
-               if (0 >= scanf("%d", &menu_number))
-                       testapp_print("Invalid input");
-
-               go_to_loop = testapp_test_interpret_command(menu_number);
-       }
-}
-
diff --git a/utilities/test-application/testapp-gmime.c b/utilities/test-application/testapp-gmime.c
deleted file mode 100644 (file)
index ae68938..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-#include <glib.h>
-#include <gmime/gmime.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include "testapp-utility.h"
-#include "testapp-gmime.h"
-
-
-#define TEST_EML_PATH "/tmp/test.eml"
-/*
-static void print_depth(int depth)
-{
-       int i;
-       for (i = 0; i < depth; i++)
-               testapp_print("    \n");
-}
-*/
-/*
-static void print_mime_struct(GMimeObject *part, int depth)
-{
-       const GMimeContentType *type;
-       GMimeMultipart *multipart;
-       GMimeObject *subpart;
-       int i, n;
-
-       print_depth(depth);
-       type = g_mime_object_get_content_type(part);
-       testapp_print("Content-Type: %s/%s\n", type->type, type->subtype);
-
-       if (GMIME_IS_MULTIPART(part)) {
-               multipart = (GMimeMultipart *)part;
-
-               n = g_mime_multipart_get_count(multipart);
-               for (i = 0; i < n; i++) {
-                       subpart = g_mime_multipart_get_part(multipart, i);
-                       print_mime_struct(subpart, depth + 1);
-                       g_object_unref(subpart);
-               }
-       }
-}
-*/
-static void
-test_eml_parsing_foreach_callback(GMimeObject *parent, GMimeObject *part, gpointer user_data)
-{
-       int *cnt = user_data;
-
-       (*cnt)++;
-
-       if (GMIME_IS_PART(part)) {
-               testapp_print ("Part\n");
-               GMimePart *leaf_part = NULL;
-               leaf_part = (GMimePart *)part;
-
-               testapp_print("Content ID:%s\n", g_mime_part_get_content_id(leaf_part));
-               testapp_print("Description:%s\n", g_mime_part_get_content_description(leaf_part));
-               testapp_print("MD5:%s\n", g_mime_part_get_content_md5(leaf_part));
-               testapp_print("Location:%s\n", g_mime_part_get_content_location(leaf_part));
-
-               GMimeContentEncoding enc = g_mime_part_get_content_encoding(leaf_part);
-               switch (enc) {
-               case GMIME_CONTENT_ENCODING_DEFAULT:
-                       testapp_print("Encoding:ENCODING_DEFAULT\n");
-                       break;
-               case GMIME_CONTENT_ENCODING_7BIT:
-                       testapp_print("Encoding:ENCODING_7BIT\n");
-                       break;
-               case GMIME_CONTENT_ENCODING_8BIT:
-                       testapp_print("Encoding:ENCODING_8BIT\n");
-                       break;
-               case GMIME_CONTENT_ENCODING_BINARY:
-                       testapp_print("Encoding:ENCODING_BINARY\n");
-                       break;
-               case GMIME_CONTENT_ENCODING_BASE64:
-                       testapp_print("Encoding:ENCODING_BASE64\n");
-                       break;
-               case GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE:
-                       testapp_print("Encoding:ENCODING_QUOTEDPRINTABLE\n");
-                       break;
-               case GMIME_CONTENT_ENCODING_UUENCODE:
-                       testapp_print("Encoding:ENCODING_UUENCODE\n");
-                       break;
-
-               default:
-                       break;
-               }
-
-               testapp_print("File name:%s\n\n\n", g_mime_part_get_filename(leaf_part));
-               GMimeDataWrapper *data = g_mime_part_get_content_object(leaf_part);
-
-               if (data) {
-                       char tmp_path[50] = {0,};
-                       snprintf(tmp_path, sizeof(tmp_path), "/tmp/gmime_content%d", *cnt);
-
-                       int fd;
-                       if ((fd = open(tmp_path, O_RDWR|O_CREAT, 0)) == -1) {
-                               testapp_print ("open fail\n");
-                       }
-                       GMimeStream *out_stream;
-                       out_stream = g_mime_stream_fs_new(fd);
-                       g_mime_data_wrapper_write_to_stream(data, out_stream);
-                       g_object_unref(out_stream);
-               }
-       }
-}
-
-static gboolean testapp_test_gmime_eml_parsing(void)
-{
-       GMimeMessage *message;
-       GMimeParser *parser;
-       GMimeStream *stream;
-       int fd;
-       int count = 0;
-
-       if ((fd = open(TEST_EML_PATH, O_RDONLY, 0)) == -1) {
-               testapp_print ("open fail\n");
-               return FALSE;
-       }
-
-       /* init the gmime library */
-       g_mime_init(0);
-
-       /* create a stream to read from the file descriptor */
-       stream = g_mime_stream_fs_new(fd);
-
-       /* create a new parser object to parse the stream */
-       parser = g_mime_parser_new_with_stream(stream);
-
-       /* unref the stream (parser owns a ref, so this object does not actually get free'd until we destroy the parser) */
-       g_object_unref(stream);
-
-       /* parse the message from the stream */
-       message = g_mime_parser_construct_message(parser);
-
-       /* free the parser (and the stream) */
-       g_object_unref(parser);
-
-       testapp_print("Sender:%s\n", g_mime_message_get_sender(message));
-       testapp_print("Reply To:%s\n", g_mime_message_get_reply_to(message));
-       testapp_print("Subject:%s\n", g_mime_message_get_subject(message));
-       testapp_print("Date:%s\n", g_mime_message_get_date_as_string(message));
-       testapp_print("Message ID:%s\n", g_mime_message_get_message_id(message));
-
-       GMimeObject *po = (GMimeObject *)message;
-       testapp_print("Header String:%s\n\n\n\n", g_mime_header_list_to_string(po->headers));
-
-       g_mime_message_foreach(message, test_eml_parsing_foreach_callback, &count);
-       return TRUE;
-}
-
-static gboolean testapp_test_interpret_command(int menu_number)
-{
-       gboolean go_to_loop = TRUE;
-
-       switch (menu_number) {
-               case 1:
-                       testapp_test_gmime_eml_parsing();
-                       break;
-
-               case 0:
-                       go_to_loop = FALSE;
-                       break;
-               default:
-                       break;
-       }
-
-       return go_to_loop;
-}
-
-void testapp_gmime_main()
-{
-       gboolean go_to_loop = TRUE;
-       int menu_number = 0;
-       while (go_to_loop) {
-               testapp_show_menu(EMAIL_GMIME_MENU);
-               testapp_show_prompt(EMAIL_GMIME_MENU);
-
-               if(0 >= scanf("%d", &menu_number)){
-                       testapp_print ("input fail\n");
-                       continue;
-               }
-
-               go_to_loop = testapp_test_interpret_command(menu_number);
-       }
-}
diff --git a/utilities/test-application/testapp-mail.c b/utilities/test-application/testapp-mail.c
deleted file mode 100755 (executable)
index 1bef6c7..0000000
+++ /dev/null
@@ -1,2796 +0,0 @@
-/*
-*  email-service
-*
-* Copyright(c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
-*
-*/
-
-
-
-/* common header */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <wait.h>
-
-/* open header */
-#include <glib.h>
-#include <time.h>
-
-#include "email-api-account.h"
-#include "email-api-network.h"
-#include "email-api-mail.h"
-#include "email-api-mailbox.h"
-#include "email-api-etc.h"
-#include "email-api-smime.h"
-
-/* internal header */
-#include "testapp-utility.h"
-#include "testapp-mail.h"
-#include "email-core-utils.h"
-#include "email-core-mime.h"
-
-#define MAIL_TEMP_BODY "/tmp/utf8"
-#define HTML_TEMP_BODY "/tmp/utf8.htm"
-
-/*
-static void testapp_test_print_sorting_menu()
-{
-       testapp_print("   EMAIL_SORT_DATETIME_HIGH = 0\n");
-       testapp_print("   EMAIL_SORT_DATETIME_LOW = 1\n");
-       testapp_print("   EMAIL_SORT_SENDER_HIGH = 2\n");
-       testapp_print("   EMAIL_SORT_SENDER_LOW = 3\n");
-       testapp_print("   EMAIL_SORT_RCPT_HIGH = 4\n");
-       testapp_print("   EMAIL_SORT_RCPT_LOW = 5\n");
-       testapp_print("   EMAIL_SORT_SUBJECT_HIGH = 6\n");
-       testapp_print("   EMAIL_SORT_SUBJECT_LOW = 7\n");
-       testapp_print("   EMAIL_SORT_PRIORITY_HIGH = 8\n");
-       testapp_print("   EMAIL_SORT_PRIORITY_LOW = 9\n");
-       testapp_print("   EMAIL_SORT_ATTACHMENT_HIGH = 10\n");
-       testapp_print("   EMAIL_SORT_ATTACHMENT_LOW = 11\n");
-       testapp_print("   EMAIL_SORT_FAVORITE_HIGH = 12\n");
-       testapp_print("   EMAIL_SORT_FAVORITE_LOW = 13\n");
-}
-
-static void testapp_test_print_mail_list_item(email_mail_list_item_t *mail_list_item, int count)
-{
-       int i;
-
-       testapp_print("\n>>>>> Print mail list items: count[%d]\n", count);
-       for (i=0; i< count; i++) {
-               testapp_print("\n[%d]\n", i);
-               testapp_print(" >>> Mailbox Name [ %s ] \n", mail_list_item[i].mailbox_name);
-               testapp_print(" >>> Mail ID [ %d ] \n", mail_list_item[i].mail_id);
-               testapp_print(" >>> Account ID [ %d ] \n", mail_list_item[i].account_id);
-               if (mail_list_item[i].from!= NULL) {
-                       testapp_print(" >>> From [ %s ] \n", mail_list_item[i].from);
-               }
-               if (mail_list_item[i].from_email_address != NULL) {
-                       testapp_print(" >>> from_email_address [ %s ] \n", mail_list_item[i].from_email_address);
-               }
-               if (mail_list_item[i].recipients!= NULL) {
-                       testapp_print(" >>> recipients [ %s ] \n", mail_list_item[i].recipients);
-               }
-               if (mail_list_item[i].subject != NULL) {
-                       testapp_print(" >>> subject [ %s ] \n", mail_list_item[i].subject);
-               }
-               testapp_print(" >>> text_download_yn [ %d ] \n", mail_list_item[i].body_download_status);
-               testapp_print(" >>> date_time [ %d ] \n", mail_list_item[i].date_time);
-               testapp_print(" >>> flags_seen_field [ %d ] \n", mail_list_item[i].flags_seen_field);
-               testapp_print(" >>> priority [ %d ] \n", mail_list_item[i].priority);
-               testapp_print(" >>> save_status [ %d ] \n", mail_list_item[i].save_status);
-               testapp_print(" >>> lock [ %d ] \n", mail_list_item[i].lock_status);
-               testapp_print(" >>> report_status [ %d ] \n", mail_list_item[i].report_status);
-               testapp_print(" >>> recipients_count [ %d ] \n", mail_list_item[i].recipients_count);
-               testapp_print(" >>> attachment_count [ %d ] \n", mail_list_item[i].attachment_count);
-               testapp_print(" >>> DRM_status [ %d ] \n", mail_list_item[i].DRM_status);
-
-               if (mail_list_item[i].preview_text != NULL) {
-                       testapp_print(" >>> preview_text [ %s ] \n", mail_list_item[i].preview_text);
-               }
-
-               testapp_print(" >>> thread_id [ %d ] \n", mail_list_item[i].thread_id);
-               testapp_print(" >>> thread_item_count [ %d ] \n", mail_list_item[i].thread_item_count);
-       }
-}
-*/
-
-static gboolean testapp_add_mail_for_sending(int *result_mail_id)
-{
-       int                    i = 0;
-       int                    account_id = 0;
-       int                    err = EMAIL_ERROR_NONE;
-       int                    smime_type = 0;
-       char                   recipient_address[300] = { 0 , };
-       char                   from_address[300] = { 0 , };
-       char                   passpharse[300] = {0, };
-       const char            *body_file_path = MAIL_TEMP_BODY;
-
-       email_account_t       *account_data = NULL;
-       email_mailbox_t       *mailbox_data = NULL;
-       email_mail_data_t     *test_mail_data = NULL;
-       FILE                  *body_file;
-
-       testapp_print("\n > Enter account id : ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter recipient address : ");
-       if (0 >= scanf("%s", recipient_address))
-               testapp_print("Invalid input. ");
-
-       email_get_account(account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account_data);
-
-       email_get_mailbox_by_mailbox_type(account_id, EMAIL_MAILBOX_TYPE_OUTBOX, &mailbox_data);
-
-       test_mail_data = malloc(sizeof(email_mail_data_t));
-       memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
-
-       SNPRINTF(from_address, 300, "<%s>", account_data->user_email_address);
-
-       test_mail_data->account_id             = account_id;
-       test_mail_data->save_status            = EMAIL_MAIL_STATUS_SEND_DELAYED;
-       test_mail_data->body_download_status   = 1;
-       test_mail_data->flags_seen_field       = 1;
-       test_mail_data->file_path_plain        = strdup(body_file_path);
-       test_mail_data->mailbox_id             = mailbox_data->mailbox_id;
-       test_mail_data->mailbox_type           = mailbox_data->mailbox_type;
-       test_mail_data->full_address_from      = strdup(from_address);
-       test_mail_data->full_address_to        = strdup(recipient_address);
-       test_mail_data->subject                = strdup("Read receipt request from TIZEN");
-       test_mail_data->remaining_resend_times = 3;
-       test_mail_data->report_status          = EMAIL_MAIL_REQUEST_DSN | EMAIL_MAIL_REQUEST_MDN;
-
-       body_file = fopen(body_file_path, "w");
-
-       testapp_print("\n body_file [%p]\n", body_file);
-
-       if (body_file == NULL) {
-               testapp_print("\n fopen [%s]failed\n", body_file_path);
-               return FALSE;
-       }
-
-       for (i = 0; i < 100; i++)
-               fprintf(body_file, "Mail sending Test. [%d]\n", i);
-
-       fflush(body_file);
-       fclose(body_file);
-
-       testapp_print(" > Select smime? [0: Normal, 1: sign, 2: Encrpyt, 3: sing + encrypt, 4: pgp sign, 5: pgp encrypted, 6: pgp sign + encrypt] : ");
-       if (0 >= scanf("%d", &smime_type))
-               testapp_print("Invalid input. ");
-       test_mail_data->smime_type = smime_type;
-
-       if (smime_type >= EMAIL_PGP_SIGNED) {
-               testapp_print(" > passpharse : ");
-               if (0 >= scanf("%s", passpharse))
-                       testapp_print("Invalid input. ");
-               test_mail_data->pgp_password = strdup(passpharse);
-       }
-
-       if ((err = email_add_mail(test_mail_data, NULL, 0, NULL, 0)) != EMAIL_ERROR_NONE)
-               testapp_print("email_add_mail failed. [%d]\n", err);
-       else
-               testapp_print("email_add_mail success.\n");
-
-       testapp_print("saved mail id = [%d]\n", test_mail_data->mail_id);
-
-       if (result_mail_id)
-               *result_mail_id = test_mail_data->mail_id;
-
-       email_free_mail_data(&test_mail_data, 1);
-       email_free_mailbox(&mailbox_data, 1);
-       email_free_account(&account_data, 1);
-
-       return FALSE;
-}
-
-static gboolean testapp_test_add_mail(int *result_mail_id)
-{
-       int                    i = 0;
-       int                    account_id = 0;
-       int                    mailbox_id = 0;
-       int                    from_eas = 0;
-       int                    attachment_count = 0;
-       int                    err = EMAIL_ERROR_NONE;
-       int                    smime_type = 0;
-       char                   arg[50] = { 0 , };
-       const char            *body_file_path = MAIL_TEMP_BODY;
-       email_mailbox_t         *mailbox_data = NULL;
-       email_mail_data_t       *test_mail_data = NULL;
-       email_attachment_data_t *attachment_data = NULL;
-       email_meeting_request_t *meeting_req = NULL;
-       FILE                  *body_file;
-
-       testapp_print("\n > Enter account id : ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       memset(arg, 0x00, 50);
-       testapp_print("\n > Enter mailbox id : ");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input. ");
-
-       email_get_mailbox_by_mailbox_id(mailbox_id, &mailbox_data);
-
-       test_mail_data = malloc(sizeof(email_mail_data_t));
-       memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
-
-       testapp_print("\n From EAS? [0/1]> ");
-       if (0 >= scanf("%d", &from_eas))
-               testapp_print("Invalid input. ");
-
-       test_mail_data->account_id             = account_id;
-       test_mail_data->save_status            = 1;
-       test_mail_data->body_download_status   = 1;
-       test_mail_data->flags_seen_field       = 1;
-       test_mail_data->file_path_plain        = strdup(body_file_path);
-       test_mail_data->mailbox_id             = mailbox_id;
-       test_mail_data->mailbox_type           = mailbox_data->mailbox_type;
-       test_mail_data->full_address_from      = strdup("<test1@test.com>");
-       test_mail_data->full_address_to        = strdup("<test2@test.com>");
-       test_mail_data->full_address_cc        = strdup("<test3@test.com>");
-       test_mail_data->full_address_bcc       = strdup("<test4@test.com>");
-       test_mail_data->subject                = strdup("Meeting request mail");
-       test_mail_data->remaining_resend_times = 3;
-       test_mail_data->eas_data               = strdup("EAS DATA TEST");
-       test_mail_data->eas_data_length        = strlen(test_mail_data->eas_data) + 1;
-
-       body_file = fopen(body_file_path, "w");
-
-       testapp_print("\n body_file [%p]\n", body_file);
-
-       if (body_file == NULL) {
-               testapp_print("\n fopen [%s]failed\n", body_file_path);
-               return FALSE;
-       }
-/*
-       for (i = 0; i < 500; i++)
-               fprintf(body_file, "X2 X2 X2 X2 X2 X2 X2");
-*/
-       fprintf(body_file, "Hello world");
-       fflush(body_file);
-       fclose(body_file);
-
-       testapp_print(" > Select smime? [0: Normal, 1: sign, 2: Encrypt, 3: sing + encrypt] : ");
-       if (0 >= scanf("%d", &smime_type))
-               testapp_print("Invalid input. ");
-       test_mail_data->smime_type = smime_type;
-
-       testapp_print(" > How many file attachment? [>=0] : ");
-       if (0 >= scanf("%d", &attachment_count))
-               testapp_print("Invalid input. ");
-
-       test_mail_data->attachment_count  = attachment_count;
-       if (attachment_count > 0)
-               attachment_data = calloc(attachment_count, sizeof(email_attachment_data_t));
-
-
-       for (i = 0; i < attachment_count ; i++) {
-               memset(arg, 0x00, 50);
-               testapp_print("\n > Enter attachment name : ");
-               if (0 >= scanf("%s", arg))
-                       testapp_print("Invalid input. ");
-
-               attachment_data[i].attachment_name  = strdup(arg);
-
-               memset(arg, 0x00, 50);
-               testapp_print("\n > Enter attachment absolute path : ");
-               if (0 >= scanf("%s", arg))
-                       testapp_print("Invalid input. ");
-
-               attachment_data[i].attachment_path  = strdup(arg);
-               attachment_data[i].save_status      = 1;
-               attachment_data[i].mailbox_id       = test_mail_data->mailbox_id;
-       }
-
-       testapp_print("\n > Meeting Request? [0: no, 1: yes(request from server), 2: yes(response from local)]");
-       if (0 >= scanf("%d", (int *)&(test_mail_data->meeting_request_status)))
-               testapp_print("Invalid input. ");
-
-       if (test_mail_data->meeting_request_status == 1
-               || test_mail_data->meeting_request_status == 2) {
-               time_t current_time;
-               /*  dummy data for meeting request */
-               meeting_req = malloc(sizeof(email_meeting_request_t));
-               memset(meeting_req, 0x00, sizeof(email_meeting_request_t));
-
-               meeting_req->meeting_response     = 1;
-               current_time = time(NULL);
-               gmtime_r(&current_time, &(meeting_req->start_time));
-               gmtime_r(&current_time, &(meeting_req->end_time));
-               meeting_req->location = strdup("Seoul");
-               meeting_req->global_object_id = strdup("abcdef12345");
-
-               meeting_req->time_zone.offset_from_GMT = 9;
-               strcpy(meeting_req->time_zone.standard_name, "STANDARD_NAME");
-               gmtime_r(&current_time, &(meeting_req->time_zone.standard_time_start_date));
-               meeting_req->time_zone.standard_bias = 3;
-
-               strcpy(meeting_req->time_zone.daylight_name, "DAYLIGHT_NAME");
-               gmtime_r(&current_time, &(meeting_req->time_zone.daylight_time_start_date));
-               meeting_req->time_zone.daylight_bias = 7;
-
-       }
-
-       if ((err = email_add_mail(test_mail_data, attachment_data, attachment_count, meeting_req, from_eas)) != EMAIL_ERROR_NONE)
-               testapp_print("email_add_mail failed. [%d]\n", err);
-       else
-               testapp_print("email_add_mail success.\n");
-
-       testapp_print("saved mail id = [%d]\n", test_mail_data->mail_id);
-       testapp_print("saved mailbox id = [%d]\n", test_mail_data->mailbox_id);
-
-       if (result_mail_id)
-               *result_mail_id = test_mail_data->mail_id;
-
-       if (attachment_data)
-               email_free_attachment_data(&attachment_data, attachment_count);
-
-       if (meeting_req)
-               email_free_meeting_request(&meeting_req, 1);
-
-       email_free_mail_data(&test_mail_data, 1);
-       email_free_mailbox(&mailbox_data, 1);
-
-       return FALSE;
-}
-
-static gboolean testapp_test_update_mail()
-{
-       int                    mail_id = 0;
-       int                    err = EMAIL_ERROR_NONE;
-       int                    test_attachment_data_count = 0;
-       int                    ret = 0;
-       char                   arg[50];
-       email_mail_data_t       *test_mail_data = NULL;
-       email_attachment_data_t *test_attachment_data_list = NULL;
-       email_meeting_request_t *meeting_req = NULL;
-
-       testapp_print("\n > Enter mail id : ");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-
-       email_get_mail_data(mail_id, &test_mail_data);
-
-       if (!test_mail_data) {
-               testapp_print("email_get_mail_data() failed\n");
-               return FALSE;
-       }
-
-       testapp_print("\n > Enter Subject: ");
-       if (0 >= scanf("%s", arg))
-               testapp_print("Invalid input. ");
-
-       test_mail_data->subject = strdup(arg);
-
-       if (test_mail_data->attachment_count > 0) {
-               if ((err = email_get_attachment_data_list(mail_id, &test_attachment_data_list, &test_attachment_data_count)) != EMAIL_ERROR_NONE) {
-                       testapp_print("email_get_attachment_data_list() failed [%d]\n", err);
-                       goto FINISH_OFF;
-               }
-       }
-
-       if (test_mail_data->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_REQUEST
-               || test_mail_data->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_RESPONSE
-               || test_mail_data->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
-
-               if ((err = email_get_meeting_request(mail_id, &meeting_req)) != EMAIL_ERROR_NONE) {
-                       testapp_print("email_get_meeting_request() failed [%d]\n", err);
-                       goto FINISH_OFF;
-               }
-
-               testapp_print("\n > Enter meeting response: ");
-               if (0 >= scanf("%d", (int *)&(meeting_req->meeting_response)))
-                       testapp_print("Invalid input. ");
-       }
-
-       if ((err = email_update_mail(test_mail_data, test_attachment_data_list, test_attachment_data_count, meeting_req, 0)) != EMAIL_ERROR_NONE)
-                       testapp_print("email_update_mail failed.[%d]\n", err);
-               else
-                       testapp_print("email_update_mail success\n");
-
-       ret = 1;
-
-FINISH_OFF:
-
-       if (test_mail_data)
-               email_free_mail_data(&test_mail_data, 1);
-
-       if (test_attachment_data_list)
-               email_free_attachment_data(&test_attachment_data_list, test_attachment_data_count);
-
-       if (meeting_req)
-               email_free_meeting_request(&meeting_req, 1);
-
-       if (!ret)
-               return FALSE;
-
-       return TRUE;
-}
-
-static gboolean testapp_test_get_mails()
-{
-       testapp_print("\n >>> testapp_test_get_mails : Entered \n");
-       email_mail_data_t *mails = NULL, **mails_pointer = NULL;
-       int mailbox_id = 0;
-       int count = 0, i = 0;
-       int account_id = 0;
-       int start_index = 0;
-       int limit_count = 0;
-       int sorting = 0;
-       int err_code = EMAIL_ERROR_NONE;
-       int to_get_count = 0;
-       int is_for_thread_view = 0;
-       int list_type;
-       struct tm *temp_time_info;
-
-       testapp_print("\n > Enter Account_id(0 = all accounts) : ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-       testapp_print("\n > Enter Mailbox id(0 = all mailboxes) :");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter Sorting : ");
-       if (0 >= scanf("%d", &sorting))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter Start index(starting at 0): ");
-       if (0 >= scanf("%d", &start_index))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter max_count : ");
-       if (0 >= scanf("%d", &limit_count))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > For thread view : ");
-       if (0 >= scanf("%d", &is_for_thread_view))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Mail count only(0:list 1:count): ");
-       if (0 >= scanf("%d", &to_get_count))
-               testapp_print("Invalid input. ");
-
-       if (to_get_count)
-               mails_pointer = NULL;
-       else
-               mails_pointer = &mails;
-
-       if (is_for_thread_view == -2)
-               list_type = EMAIL_LIST_TYPE_LOCAL;
-       else if (is_for_thread_view == -1)
-               list_type = EMAIL_LIST_TYPE_THREAD;
-       else
-               list_type = EMAIL_LIST_TYPE_NORMAL;
-
-       /* Get mail list */
-       if (mailbox_id == 0) {
-               testapp_print("Calling email_get_mails for all mailbox.\n");
-               err_code = email_get_mails(account_id, 0, list_type, start_index, limit_count, sorting, mails_pointer, &count);
-               if (err_code < 0)
-                       testapp_print("email_get_mails failed - err[%d]\n", err_code);
-       } else {
-               testapp_print("Calling email_get_mails for %d mailbox_id.\n", mailbox_id);
-               err_code = email_get_mails(account_id, mailbox_id, list_type, start_index, limit_count, sorting,  mails_pointer, &count);
-               if (err_code < 0)
-                       testapp_print("email_get_mails failed - err[%d]\n", err_code);
-       }
-       testapp_print("email_get_mails >>>>>>count - %d\n", count);
-
-       if (mails) {
-               for (i = 0; i < count; i++) {
-                       testapp_print("\n[%d]\n", i);
-                       testapp_print(" >>> mailbox_id [ %d ] \n", mails[i].mailbox_id);
-                       testapp_print(" >>> mail_id [ %d ] \n", mails[i].mail_id);
-                       testapp_print(" >>> account_id [ %d ] \n", mails[i].account_id);
-                       if (mails[i].full_address_from != NULL)
-                               testapp_print(" >>> full_address_from [ %s ] \n", mails[i].full_address_from);
-                       if (mails[i].full_address_to != NULL)
-                               testapp_print(" >>> recipients [ %s ] \n", mails[i].full_address_to);
-                       if (mails[i].subject != NULL)
-                               testapp_print(" >>> subject [ %s ] \n", mails[i].subject);
-                       testapp_print(" >>> body_download_status [ %d ] \n", mails[i].body_download_status);
-                       temp_time_info = localtime(&mails[i].date_time);
-                       testapp_print(" >>> date_time [ %d/%d/%d %d:%d:%d] \n",
-                                                                       temp_time_info->tm_year + 1900,
-                                                                       temp_time_info->tm_mon+1,
-                                                                       temp_time_info->tm_mday,
-                                                                       temp_time_info->tm_hour,
-                                                                       temp_time_info->tm_min,
-                                                                       temp_time_info->tm_sec);
-                       testapp_print(" >>> flags_seen_field [ %d ] \n", mails[i].flags_seen_field);
-                       testapp_print(" >>> priority [ %d ] \n", mails[i].priority);
-                       testapp_print(" >>> save_status [ %d ] \n", mails[i].save_status);
-                       testapp_print(" >>> lock_status [ %d ] \n", mails[i].lock_status);
-                       testapp_print(" >>> attachment_count [ %d ] \n", mails[i].attachment_count);
-                       if (mails[i].preview_text != NULL)
-                               testapp_print(" >>> preview_text [ %s ] \n", mails[i].preview_text);
-               }
-               free(mails);
-       }
-
-       testapp_print(" >>> testapp_test_get_mails : End \n");
-       return 0;
-}
-
-#define TEMP_ARGUMENT_SIZE 4096
-
-static gboolean testapp_test_mail_send(int *result_mail_id)
-{
-       int                    added_mail_id = 0;
-       int                    err = EMAIL_ERROR_NONE;
-       int                    handle = 0;
-       email_mail_data_t     *result_mail_data = NULL;
-
-       testapp_add_mail_for_sending(&added_mail_id);
-
-       if (added_mail_id) {
-               email_get_mail_data(added_mail_id, &result_mail_data);
-
-               testapp_print("Calling email_send_mail...\n");
-
-               if (email_send_mail(added_mail_id, &handle) < 0) {
-                       testapp_print("Sending failed[%d]\n", err);
-               } else {
-                       testapp_print("Start sending. handle[%d]\n", handle);
-               }
-
-               email_free_mail_data(&result_mail_data, 1);
-       }
-
-       if (result_mail_id)
-               *result_mail_id = added_mail_id;
-
-       return FALSE;
-}
-
-static gboolean testapp_test_get_mail_list_ex()
-{
-       email_list_filter_t *filter_list = NULL;
-       email_list_sorting_rule_t sorting_rule_list[2];
-       email_mail_list_item_t *result_mail_list = NULL;
-       int filter_rule_count = 0;
-       int sorting_rule_count = 2;
-       int result_mail_count = 0;
-       int err = EMAIL_ERROR_NONE;
-       int i = 0;
-       int sort_order = 0;
-
-       filter_rule_count = 3;
-
-       filter_list = malloc(sizeof(email_list_filter_t) * filter_rule_count);
-       memset(filter_list, 0 , sizeof(email_list_filter_t) * filter_rule_count);
-
-       filter_list[0].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
-       filter_list[0].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_ACCOUNT_ID;
-       filter_list[0].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_EQUAL;
-       filter_list[0].list_filter_item.rule.key_value.integer_type_value  = 1;
-       filter_list[0].list_filter_item.rule.case_sensitivity              = false;
-
-       filter_list[1].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
-       filter_list[1].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_AND;
-
-       filter_list[2].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
-       filter_list[2].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_MAILBOX_TYPE;
-       filter_list[2].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_EQUAL;
-       filter_list[2].list_filter_item.rule.key_value.integer_type_value  = EMAIL_MAILBOX_TYPE_INBOX;
-       filter_list[2].list_filter_item.rule.case_sensitivity              = false;
-
-       /*filter_list[0].list_filter_item_type                                     = EMAIL_LIST_FILTER_ITEM_RULE_ATTACH;
-       filter_list[0].list_filter_item.rule_attach.target_attribute             = EMAIL_MAIL_ATTACH_ATTRIBUTE_ATTACHMENT_NAME;
-       filter_list[0].list_filter_item.rule_attach.rule_type                    = EMAIL_LIST_FILTER_RULE_INCLUDE;
-       filter_list[0].list_filter_item.rule_attach.key_value.string_type_value  = strdup("test");
-       filter_list[0].list_filter_item.rule_attach.case_sensitivity             = false;*/
-
-       /*
-       filter_list[0].list_filter_item_type                                  = EMAIL_LIST_FILTER_ITEM_RULE;
-       filter_list[0].list_filter_item.rule_fts.target_attribute             = EMAIL_MAIL_ATTRIBUTE_ACCOUNT_ID;
-       filter_list[0].list_filter_item.rule_fts.rule_type                    = EMAIL_LIST_FILTER_RULE_EQUAL;
-       filter_list[0].list_filter_item.rule_fts.key_value.integer_type_value = 1;
-
-       filter_list[1].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
-       filter_list[1].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_OR;
-
-
-       filter_list[2].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
-       filter_list[2].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_SUBJECT;
-       filter_list[2].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_INCLUDE;
-       filter_list[2].list_filter_item.rule.key_value.string_type_value   = strdup("2013");
-       filter_list[2].list_filter_item.rule.case_sensitivity              = false;
-
-
-       filter_list[1].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
-       filter_list[1].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_OR;
-
-       filter_list[2].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
-       filter_list[2].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_TO;
-       filter_list[2].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_INCLUDE;
-       filter_list[2].list_filter_item.rule.key_value.string_type_value   = strdup("RE");
-       filter_list[2].list_filter_item.rule.case_sensitivity              = false;
-
-       filter_list[3].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
-       filter_list[3].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_OR;
-
-       filter_list[4].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
-       filter_list[4].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_CC;
-       filter_list[4].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_INCLUDE;
-       filter_list[4].list_filter_item.rule.key_value.string_type_value   = strdup("RE");
-       filter_list[4].list_filter_item.rule.case_sensitivity              = false;
-
-       filter_list[5].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
-       filter_list[5].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_OR;
-
-       filter_list[6].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
-       filter_list[6].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_BCC;
-       filter_list[6].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_INCLUDE;
-       filter_list[6].list_filter_item.rule.key_value.string_type_value   = strdup("RE");
-       filter_list[6].list_filter_item.rule.case_sensitivity              = false;
-
-       filter_list[7].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
-       filter_list[7].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_OR;
-
-       filter_list[8].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
-       filter_list[8].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_FROM;
-       filter_list[8].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_INCLUDE;
-       filter_list[8].list_filter_item.rule.key_value.string_type_value   = strdup("RE");
-       filter_list[8].list_filter_item.rule.case_sensitivity              = false;
-       */
-
-       /*
-       filter_list[0].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
-       filter_list[0].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_ACCOUNT_ID;
-       filter_list[0].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_EQUAL;
-       filter_list[0].list_filter_item.rule.key_value.integer_type_value  = 1;
-
-       filter_list[1].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
-       filter_list[1].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_AND;
-
-       filter_list[2].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
-       filter_list[2].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_MAILBOX_NAME;
-       filter_list[2].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_EQUAL;
-       filter_list[2].list_filter_item.rule.key_value.string_type_value   = strdup("INBOX");
-       filter_list[2].list_filter_item.rule.case_sensitivity              = true;
-       */
-
-       memset(sorting_rule_list, 0 , sizeof(email_list_sorting_rule_t) * sorting_rule_count);
-/*
-       sorting_rule_list[0].target_attribute                              = EMAIL_MAIL_ATTRIBUTE_RECIPIENT_ADDRESS;
-       sorting_rule_list[0].key_value.string_type_value                   = strdup("minsoo.kimn@gmail.com");
-       sorting_rule_list[0].sort_order                                    = EMAIL_SORT_ORDER_TO_CCBCC;
-*/
-       testapp_print("\n Enter the sort_order :");
-       if (0 >= scanf("%d", &sort_order))
-               testapp_print("Invalid input.");
-
-       sorting_rule_list[0].target_attribute                              = EMAIL_MAIL_ATTRIBUTE_SUBJECT;
-       sorting_rule_list[0].sort_order                                    = sort_order;
-
-       sorting_rule_list[1].target_attribute                              = EMAIL_MAIL_ATTRIBUTE_DATE_TIME;
-       sorting_rule_list[1].sort_order                                    = EMAIL_SORT_ORDER_DESCEND;
-
-       err = email_get_mail_list_ex(filter_list, filter_rule_count, sorting_rule_list, sorting_rule_count, -1, -1, &result_mail_list, &result_mail_count);
-
-       if (err == EMAIL_ERROR_NONE) {
-               testapp_print("email_get_mail_list_ex succeed.\n");
-
-               for (i = 0; i < result_mail_count; i++) {
-                       testapp_print("mail_id [%d], subject [%s], mailbox_type [%d] full_address_from [%s]\n", result_mail_list[i].mail_id, result_mail_list[i].subject, result_mail_list[i].mailbox_type, result_mail_list[i].full_address_from);
-               }
-       } else {
-               testapp_print("email_get_mail_list_ex failed.\n");
-       }
-
-       email_free_list_filter(&filter_list, 3);
-
-       return FALSE;
-}
-
-static gboolean testapp_test_send_cancel()
-{
-       int num = 0;
-       int Y = 0;
-       int i = 0;
-       int j = 0;
-       int *mailIdList = NULL;
-       int mail_id = 0;
-
-       testapp_print("\n > Enter total Number of mail  want to send: ");
-       if (0 >= scanf("%d", &num))
-               testapp_print("Invalid input. ");
-       mailIdList = (int *)malloc(sizeof(int)*num);
-       if (!mailIdList)
-               return false ;
-
-       for (i = 1; i <= num; i++) {
-               testapp_test_mail_send(&mail_id);
-
-               testapp_print("mail_id[%d]", mail_id);
-
-               mailIdList[i] = mail_id;
-               testapp_print("mailIdList[%d][%d]", i, mailIdList[i]);
-
-               mail_id = 0;
-               testapp_print("\n > Do you want to cancel the send mail job '1' or '0': ");
-               if (0 >= scanf("%d", &Y))
-                       testapp_print("Invalid input. ");
-               if (Y == 1) {
-                       testapp_print("\n >Enter mail-id[1-%d] ", i);
-                       if (0 >= scanf("%d", &j))
-                               testapp_print("Invalid input. ");
-                       testapp_print("\n mailIdList[%d] ", mailIdList[j]);
-                       if (email_cancel_sending_mail(mailIdList[j]) < 0)
-                               testapp_print("email_cancel_sending_mail failed..!");
-                       else
-                               testapp_print("email_cancel_sending_mail success..!");
-               }
-       }
-       return FALSE;
-}
-
-static gboolean testapp_test_delete()
-{
-       int mail_id = 0, account_id = 0;
-       int mailbox_id = 0;
-       int err = EMAIL_ERROR_NONE;
-       int from_server = 0;
-
-       testapp_print("\n > Enter Account_id: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter Mail_id: ");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter Mailbox id: ");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter from_server: ");
-       if (0 >= scanf("%d", &from_server))
-               testapp_print("Invalid input. ");
-
-       /* delete message */
-       if ((err = email_delete_mail(mailbox_id, &mail_id, 1, from_server)) < 0)
-               testapp_print("\n email_delete_mail failed[%d]\n", err);
-       else
-               testapp_print("\n email_delete_mail success\n");
-
-       return FALSE;
-}
-
-static gboolean testapp_test_update_mail_attribute()
-{
-       int  err = EMAIL_ERROR_NONE;
-       int  i = 0;
-       int  account_id = 0;
-       int *mail_id_array = NULL;
-       int  mail_id_count = 0;
-       email_mail_attribute_type attribute_type;
-       email_mail_attribute_value_t attribute_value;
-
-       testapp_print("\n > Enter account_id: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter attribute_type: ");
-       if (0 >= scanf("%d", (int*)&attribute_type))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter integer type value: ");
-       if (0 >= scanf("%d", (int*)&(attribute_value.integer_type_value)))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter mail_id_count: ");
-       if (0 >= scanf("%d", &mail_id_count))
-               testapp_print("Invalid input. ");
-
-       mail_id_count = (mail_id_count < 5000) ? mail_id_count : 5000;
-
-       if (mail_id_count > 0) {
-               mail_id_array = malloc(sizeof(int) * mail_id_count);
-       }
-
-       for (i = 0; i < mail_id_count; i++) {
-               testapp_print("\n > Enter mail id: ");
-               if (0 >= scanf("%d", (mail_id_array + i)))
-                       testapp_print("Invalid input. ");
-       }
-
-       /* delete message */
-       if ((err = email_update_mail_attribute(account_id, mail_id_array, mail_id_count, attribute_type, attribute_value)) < EMAIL_ERROR_NONE)
-               testapp_print("\n email_update_mail_attribute failed[%d]\n", err);
-       else
-               testapp_print("\n email_update_mail_attribute success\n");
-
-       if (mail_id_array)
-               free(mail_id_array);
-
-       return FALSE;
-}
-
-static gboolean testapp_test_move()
-{
-       int mail_id[3];
-       int i = 0;
-       int mailbox_id = 0;
-
-       for (i = 0; i < 3; i++) {
-               testapp_print("\n > Enter mail_id: ");
-               if (0 >= scanf("%d", &mail_id[i]))
-                       testapp_print("Invalid input. ");
-       }
-
-       testapp_print("\n > Enter mailbox_id: ");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input. ");
-
-       /* move mail */
-       email_move_mail_to_mailbox(mail_id, 3, mailbox_id);
-       return FALSE;
-}
-
-static gboolean testapp_test_delete_all()
-{
-       int mailbox_id = 0;
-       int err = EMAIL_ERROR_NONE;
-
-       testapp_print("\n > Enter mailbox_id: ");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input. ");
-
-       /* delete all message */
-       if ((err = email_delete_all_mails_in_mailbox(mailbox_id, 0)) < 0)
-               testapp_print("email_delete_all_mails_in_mailbox failed [%d]\n", err);
-       else
-               testapp_print("email_delete_all_mails_in_mailbox Success\n");
-
-       return FALSE;
-}
-
-
-static gboolean testapp_test_add_attachment()
-{
-       int mail_id = 0;
-       char arg[100];
-       email_attachment_data_t attachment;
-
-       testapp_print("\n > Enter Mail Id: ");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-
-       memset(&attachment, 0x00, sizeof(email_attachment_data_t));
-       memset(arg, 0x00, 100);
-       testapp_print("\n > Enter attachment name: ");
-       if (0 >= scanf("%s", arg))
-               testapp_print("Invalid input. ");
-
-       attachment.attachment_name = strdup(arg);
-
-       memset(arg, 0x00, 100);
-       testapp_print("\n > Enter attachment absolute path: ");
-       if (0 >= scanf("%s", arg))
-               testapp_print("Invalid input. ");
-
-       attachment.save_status = true;
-       attachment.attachment_path = strdup(arg);
-       if (email_add_attachment(mail_id, &attachment) < 0)
-               testapp_print("email_add_attachment failed\n");
-       else
-               testapp_print("email_add_attachment success\n");
-
-
-       return FALSE;
-
-}
-
-static gboolean testapp_test_set_deleted_flag()
-{
-       int index = 0;
-       int account_id = 0;
-       int mail_ids[100] = { 0, };
-       int temp_mail_id = 0;
-       int err_code = EMAIL_ERROR_NONE;
-
-       testapp_print("\n >>> Input target account id: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       do {
-               testapp_print("\n >>> Input target mail id( Input 0 to terminate ) [MAX = 100]: ");
-               if (0 >= scanf("%d", &temp_mail_id))
-                       testapp_print("Invalid input. ");
-               mail_ids[index++] = temp_mail_id;
-       } while (temp_mail_id != 0);
-
-       err_code = email_set_flags_field(account_id, mail_ids, index, EMAIL_FLAGS_DELETED_FIELD, 1, true);
-       testapp_print("email_set_flags_field returns - err[%d]\n", err_code);
-
-       return 0;
-}
-
-static gboolean testapp_test_expunge_mails_deleted_flagged()
-{
-       int mailbox_id = 0;
-       int on_server = 0;
-       int err_code = EMAIL_ERROR_NONE;
-       int handle = 0;
-
-       testapp_print("\n >>> Input target mailbox id: ");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n >>> Expunge on server?: ");
-       if (0 >= scanf("%d", &on_server))
-               testapp_print("Invalid input. ");
-
-       err_code = email_expunge_mails_deleted_flagged(mailbox_id, on_server, &handle);
-
-       testapp_print("email_expunge_mails_deleted_flagged returns - err[%d]\n", err_code);
-
-       return 0;
-}
-
-static gboolean testapp_test_send_read_receipt()
-{
-       int read_mail_id = 0;
-       int receipt_mail_id = 0;
-       int err_code = EMAIL_ERROR_NONE;
-       int handle = 0;
-
-       testapp_print("\n >>> Input read mail id: ");
-       if (0 >= scanf("%d", &read_mail_id))
-               testapp_print("Invalid input. ");
-
-       err_code = email_add_read_receipt(read_mail_id, &receipt_mail_id);
-
-       testapp_print("eamil_add_read_receipt returns receipt_mail_id [%d] - err[%d]\n", receipt_mail_id, err_code);
-       testapp_print("Calling email_send_mail...\n");
-
-       if ((err_code = email_send_mail(receipt_mail_id, &handle)) != EMAIL_ERROR_NONE) {
-               testapp_print("Sending failed[%d]\n", err_code);
-       } else {
-               testapp_print("Start sending. handle[%d]\n", handle);
-       }
-
-       return 0;
-}
-
-static gboolean testapp_test_delete_attachment()
-{
-       int attachment_id = 0;
-       int err_code = EMAIL_ERROR_NONE;
-
-       testapp_print("\n >>> Input attachment id: ");
-       if (0 >= scanf("%d", &attachment_id))
-               testapp_print("Invalid input. ");
-
-       if ((err_code = email_delete_attachment(attachment_id)) != EMAIL_ERROR_NONE) {
-               testapp_print("email_delete_attachment failed[%d]\n", err_code);
-       }
-
-       return 0;
-}
-
-static gboolean testapp_test_get_mail_list()
-{
-       testapp_print("\n >>> testapp_test_get_mail_list : Entered \n");
-       email_mail_list_item_t *mail_list = NULL, **mail_list_pointer = NULL;
-       int mailbox_id = 0;
-       int count = 0, i = 0;
-       int account_id = 0;
-       int start_index = 0;
-       int limit_count = 0;
-       int sorting = 0;
-       int err_code = EMAIL_ERROR_NONE;
-       int to_get_count = 0;
-       int is_for_thread_view = 0;
-       int list_type;
-       struct tm *temp_time_info;
-
-       testapp_print("\n > Enter Account_id(0 = all accounts) : ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter Mailbox id(0 = all mailboxes) :");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter Sorting : ");
-       if (0 >= scanf("%d", &sorting))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter Start index(starting at 0): ");
-       if (0 >= scanf("%d", &start_index))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter max_count : ");
-       if (0 >= scanf("%d", &limit_count))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > For thread view : ");
-       if (0 >= scanf("%d", &is_for_thread_view))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Count mails?(1: YES):");
-       if (0 >= scanf("%d", &to_get_count))
-               testapp_print("Invalid input. ");
-
-       if (to_get_count)
-               mail_list_pointer = NULL;
-       else
-               mail_list_pointer = &mail_list;
-
-       if (is_for_thread_view == -2) {
-               list_type = EMAIL_LIST_TYPE_LOCAL;
-       } else if (is_for_thread_view == -1)
-               list_type = EMAIL_LIST_TYPE_THREAD;
-       else
-               list_type = EMAIL_LIST_TYPE_NORMAL;
-
-       /* Get mail list */
-       if (mailbox_id == 0) {
-               testapp_print("Calling email_get_mail_list for all mailbox.\n");
-               err_code = email_get_mail_list(account_id, 0, list_type, start_index, limit_count, sorting,  mail_list_pointer, &count);
-               if (err_code < 0)
-                       testapp_print("email_get_mail_list failed - err[%d]\n", err_code);
-       } else {
-               testapp_print("Calling email_get_mail_list for %d mailbox_id.\n", mailbox_id);
-               err_code = email_get_mail_list(account_id, mailbox_id, list_type, start_index, limit_count, sorting,  mail_list_pointer, &count);
-               if (err_code < 0)
-                       testapp_print("email_get_mail_list failed - err[%d]\n", err_code);
-       }
-       testapp_print("email_get_mail_list >>>>>>count - %d\n", count);
-
-       if (mail_list) {
-               for (i = 0; i < count; i++) {
-                       testapp_print("\n[%d]\n", i);
-                       testapp_print(" >>> mailbox_id [ %d ] \n", mail_list[i].mailbox_id);
-                       testapp_print(" >>> mailbox_type [ %d ] \n", mail_list[i].mailbox_type);
-                       testapp_print(" >>> mail_id [ %d ] \n", mail_list[i].mail_id);
-                       testapp_print(" >>> account_id [ %d ] \n", mail_list[i].account_id);
-                       if (mail_list[i].full_address_from != NULL)
-                               testapp_print(" >>> full_address_from [ %s ] \n", mail_list[i].full_address_from);
-                       if (mail_list[i].email_address_recipient != NULL)
-                               testapp_print(" >>> email_address_recipient [ %s ] \n", mail_list[i].email_address_recipient);
-                       if (mail_list[i].subject != NULL)
-                               testapp_print(" >>> subject [ %s ] \n", mail_list[i].subject);
-                       testapp_print(" >>> body_download_status [ %d ] \n", mail_list[i].body_download_status);
-                       temp_time_info = localtime(&mail_list[i].date_time);
-                       testapp_print(" >>> date_time [ %d/%d/%d %d:%d:%d] \n",
-                                                               temp_time_info->tm_year + 1900,
-                                                               temp_time_info->tm_mon+1,
-                                                               temp_time_info->tm_mday,
-                                                               temp_time_info->tm_hour,
-                                                               temp_time_info->tm_min,
-                                                               temp_time_info->tm_sec);
-                       testapp_print(" >>> flags_seen_field [ %d ] \n", mail_list[i].flags_seen_field);
-                       testapp_print(" >>> priority [ %d ] \n", mail_list[i].priority);
-                       testapp_print(" >>> save_status [ %d ] \n", mail_list[i].save_status);
-                       testapp_print(" >>> lock_status [ %d ] \n", mail_list[i].lock_status);
-                       testapp_print(" >>> attachment_count [ %d ] \n", mail_list[i].attachment_count);
-                       if (mail_list[i].preview_text != NULL)
-                               testapp_print(" >>> preview_text [ %s ] \n", mail_list[i].preview_text);
-               }
-               free(mail_list);
-       }
-
-       testapp_print("\n >>> email_get_mail_list : End \n");
-       return 0;
-}
-
-
-static gboolean testapp_test_get_mail_list_for_thread_view()
-{
-       testapp_print(" >>> testapp_test_get_mail_list_for_thread_view : Entered \n");
-       email_mail_list_item_t *mail_list = NULL;
-       int count = 0, i = 0;
-       int account_id = 0;
-       int mailbox_id = 0;
-       int err_code = EMAIL_ERROR_NONE;
-       struct tm *time_info;
-       char buf[26] = {0};
-
-       testapp_print("\nEnter account id\n");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\nEnter mailbox id\n");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input. ");
-
-       /* Get mail list */
-       if (email_get_mail_list(account_id, mailbox_id , EMAIL_LIST_TYPE_THREAD, 0, 500, EMAIL_SORT_DATETIME_HIGH, &mail_list, &count) < 0)  {
-               testapp_print("email_get_mail_list failed : %d\n", err_code);
-               return FALSE;
-       }
-       testapp_print("email_get_mail_list >>>>>>count - %d\n", count);
-       if (mail_list) {
-               for (i = 0; i < count; i++) {
-                       testapp_print(" i [%d]\n", i);
-                       testapp_print(" >>> mail_id [ %d ] \n", mail_list[i].mail_id);
-                       testapp_print(" >>> account_id [ %d ] \n", mail_list[i].account_id);
-                       testapp_print(" >>> mailbox_id [ %d ] \n", mail_list[i].mailbox_id);
-                       testapp_print(" >>> full_address_from [ %s ] \n", mail_list[i].full_address_from);
-                       testapp_print(" >>> email_address_recipient [ %s ] \n", mail_list[i].email_address_recipient);
-                       testapp_print(" >>> subject [ %s ] \n", mail_list[i].subject);
-                       testapp_print(" >>> body_download_status [ %d ] \n", mail_list[i].body_download_status);
-                       time_info = localtime(&mail_list[i].date_time);
-                       testapp_print(" >>> date_time [ %s ] \n", asctime_r(time_info, buf));
-                       testapp_print(" >>> flags_seen_field [ %d ] \n", mail_list[i].flags_seen_field);
-                       testapp_print(" >>> priority [ %d ] \n", mail_list[i].priority);
-                       testapp_print(" >>> save_status [ %d ] \n", mail_list[i].save_status);
-                       testapp_print(" >>> lock [ %d ] \n", mail_list[i].lock_status);
-                       testapp_print(" >>> attachment_count [ %d ] \n", mail_list[i].attachment_count);
-                       testapp_print(" >>> preview_text [ %s ] \n", mail_list[i].preview_text);
-                       testapp_print(" >>> thread_id [ %d ] \n", mail_list[i].thread_id);
-                       testapp_print(" >>> thread__item_count [ %d ] \n", mail_list[i].thread_item_count);
-               }
-               free(mail_list);
-       }
-       testapp_print(" >>> testapp_test_get_mail_list_for_thread_view : End \n");
-       return 0;
-}
-
-static gboolean testapp_test_count()
-{
-       int total = 0;
-       int unseen = 0;
-       email_list_filter_t *filter_list = NULL;
-
-       filter_list = malloc(sizeof(email_list_filter_t) * 3);
-       memset(filter_list, 0 , sizeof(email_list_filter_t) * 3);
-
-       filter_list[0].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
-       filter_list[0].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_SUBJECT;
-       filter_list[0].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_INCLUDE;
-       filter_list[0].list_filter_item.rule.key_value.string_type_value   = strdup("RE");
-       filter_list[0].list_filter_item.rule.case_sensitivity              = false;
-
-       filter_list[1].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_OPERATOR;
-       filter_list[1].list_filter_item.operator_type                      = EMAIL_LIST_FILTER_OPERATOR_OR;
-
-       filter_list[2].list_filter_item_type                               = EMAIL_LIST_FILTER_ITEM_RULE;
-       filter_list[2].list_filter_item.rule.target_attribute              = EMAIL_MAIL_ATTRIBUTE_TO;
-       filter_list[2].list_filter_item.rule.rule_type                     = EMAIL_LIST_FILTER_RULE_INCLUDE;
-       filter_list[2].list_filter_item.rule.key_value.string_type_value   = strdup("RE");
-       filter_list[2].list_filter_item.rule.case_sensitivity              = false;
-
-       if (EMAIL_ERROR_NONE == email_count_mail(filter_list, 3, &total, &unseen))
-               printf("\n Total: %d, Unseen: %d \n", total, unseen);
-       return 0;
-}
-
-static gboolean testapp_test_move_mails_to_mailbox_of_another_account()
-{
-       int  err = EMAIL_ERROR_NONE;
-       int  mail_id_count = 0 ;
-       int *mail_id_array = NULL;
-       int  source_mailbox_id = 0;
-       int  target_mailbox_id = 0;
-       int  task_id = 0;
-       int  i = 0;
-
-       testapp_print("\n > Enter source mailbox id: ");
-       if (0 >= scanf("%d", &source_mailbox_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter target mailbox id: ");
-       if (0 >= scanf("%d", &target_mailbox_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter mail count: ");
-       if (0 >= scanf("%d", &mail_id_count))
-               testapp_print("Invalid input. ");
-
-       mail_id_count = (mail_id_count < 5000) ? mail_id_count : 5000;
-
-       if (mail_id_count > 0) {
-               mail_id_array = malloc(sizeof(int) * mail_id_count);
-       }
-
-       for (i = 0; i < mail_id_count; i++) {
-               testapp_print("\n > Enter mail id: ");
-               if (0 >= scanf("%d", (mail_id_array + i)))
-                       testapp_print("Invalid input. ");
-       }
-
-       err = email_move_mails_to_mailbox_of_another_account(source_mailbox_id, mail_id_array, mail_id_count, target_mailbox_id, &task_id);
-
-       testapp_print("\nemail_move_mails_to_mailbox_of_another_account returns [%d], tast_id [%d] \n", err, task_id);
-       return 0;
-}
-
-static gboolean        copy_file(char *input_source_path, char *input_dest_path)
-{
-    int childExitStatus;
-    pid_t pid;
-    if (!input_source_path || !input_dest_path) {
-        return FALSE;
-    }
-    testapp_print("copy_file started\n");
-
-    pid = fork();
-
-    if (pid == 0) {
-       testapp_print("Copying file [%s] [%s]\n", input_source_path, input_dest_path);
-        execl("/bin/cp", "/bin/cp", input_source_path, input_dest_path, (char *)0);
-    } else {
-       testapp_print("Wating child process\n");
-        pid_t ws = waitpid(pid, &childExitStatus, WNOHANG);
-        if (ws == -1) { /* error - handle as you wish */
-               testapp_print("waitpid returns error\n");
-        }
-
-        if (WIFEXITED(childExitStatus)) {
-                       /* exit code in childExitStatus */
-            WEXITSTATUS(childExitStatus); /* zero is normal exit */
-            testapp_print("WEXITSTATUS\n");
-            /* handle non-zero as you wish */
-        } else if (WIFSIGNALED(childExitStatus)) { /* killed */
-               testapp_print("WIFSIGNALED\n");
-        } else if (WIFSTOPPED(childExitStatus)) { /* stopped */
-               testapp_print("WIFSTOPPED\n");
-        }
-    }
-    testapp_print("copy_file finished\n");
-    return TRUE;
-}
-
-
-static gboolean        testapp_test_send_mail_with_downloading_attachment_of_original_mail()
-{
-       int err = EMAIL_ERROR_NONE;
-       int original_mail_id = 0;
-       int original_attachment_count = 0;
-       int i = 0;
-       int handle = 0;
-       char *plain_text_path = MAIL_TEMP_BODY;
-       char *html_file_path = HTML_TEMP_BODY;
-       char new_subject[4086] = { 0, };
-/*     FILE *body_file; */
-       email_mail_data_t *original_mail_data = NULL;
-       email_mailbox_t *outbox = NULL;
-       email_attachment_data_t *original_attachment_array = NULL;
-
-       testapp_print("\n > Enter original mail id: ");
-       if (0 >= scanf("%d", &original_mail_id))
-               testapp_print("Invalid input. ");
-
-       /* Get original mail */
-       if ((err = email_get_mail_data(original_mail_id, &original_mail_data)) != EMAIL_ERROR_NONE || !original_mail_data) {
-               testapp_print("email_get_mail_data failed [%d]\n", err);
-               return FALSE;
-       }
-
-       /* Get attachment of original mail */
-       if ((err = email_get_attachment_data_list(original_mail_id, &original_attachment_array, &original_attachment_count)) != EMAIL_ERROR_NONE || !original_attachment_array) {
-               testapp_print("email_get_attachment_data_list failed [%d]\n", err);
-               return FALSE;
-       }
-
-       /* Remove attachment file path */
-       for (i = 0; i < original_attachment_count; i++) {
-               original_attachment_array[i].save_status = 0;
-               if (original_attachment_array[i].attachment_path)
-                       free(original_attachment_array[i].attachment_path);
-               original_attachment_array[i].attachment_path = NULL;
-       }
-
-       /* Set reference mail id */
-       original_mail_data->reference_mail_id = original_mail_data->mail_id;
-       original_mail_data->body_download_status = 1;
-
-       /* Set from address */
-       if (!original_mail_data->full_address_from) {
-               original_mail_data->full_address_from = strdup("<abc@abc.com>");
-       }
-
-       /* Rewrite subject */
-       if (original_mail_data->subject) {
-               snprintf(new_subject, 4086, "Fw:%s", original_mail_data->subject);
-               free(original_mail_data->subject);
-               original_mail_data->subject = NULL;
-       } else {
-               snprintf(new_subject, 4086, "Forward test");
-       }
-
-       original_mail_data->subject = strdup(new_subject);
-
-       /* Set mailbox information */
-       if ((err = email_get_mailbox_by_mailbox_type(original_mail_data->account_id, EMAIL_MAILBOX_TYPE_OUTBOX, &outbox)) != EMAIL_ERROR_NONE || !outbox) {
-               testapp_print("email_get_mailbox_by_mailbox_type failed [%d]\n", err);
-               return FALSE;
-       }
-       original_mail_data->mailbox_id = outbox->mailbox_id;
-       original_mail_data->mailbox_type = outbox->mailbox_type;
-
-       /* Copy body text */
-       if (original_mail_data->file_path_html) {
-               copy_file(original_mail_data->file_path_html, html_file_path);
-               /*execl("/bin/cp", "/bin/cp", original_mail_data->file_path_html, html_file_path,(char *)0); */
-               free(original_mail_data->file_path_html);
-               original_mail_data->file_path_html = strdup(html_file_path);
-       }
-
-       if (original_mail_data->file_path_plain) {
-               copy_file(original_mail_data->file_path_plain, plain_text_path);
-               /*execl("/bin/cp", "/bin/cp", original_mail_data->file_path_plain, plain_text_path,(char *)0);*/
-               free(original_mail_data->file_path_plain);
-               original_mail_data->file_path_plain = strdup(plain_text_path);
-       }
-
-
-       /*
-       body_file = fopen(body_file_path, "w");
-
-       testapp_print("\n body_file [%p]\n", body_file);
-
-       if (body_file == NULL) {
-               testapp_print("\n fopen [%s]failed\n", body_file_path);
-               return FALSE;
-       }
-
-       for (i = 0; i < 100; i++)
-               fprintf(body_file, "Mail sending Test. [%d]\n", i);
-
-       fflush(body_file);
-       fclose(body_file);
-       */
-
-       /* Add mail */
-       if ((err = email_add_mail(original_mail_data, original_attachment_array, original_attachment_count, NULL, false)) != EMAIL_ERROR_NONE) {
-               testapp_print("email_get_attachment_data_list failed [%d]\n", err);
-               return FALSE;
-       }
-
-       /* Send mail */
-       if ((err = email_send_mail_with_downloading_attachment_of_original_mail(original_mail_data->mail_id, &handle)) != EMAIL_ERROR_NONE) {
-               testapp_print("email_send_mail_with_downloading_attachment_of_original_mail failed [%d]\n", err);
-               return FALSE;
-       }
-
-       if (original_mail_data)
-               email_free_mail_data(&original_mail_data, 1);
-
-       if (outbox)
-               email_free_mailbox(&outbox, 1);
-
-       if (original_attachment_array)
-               email_free_attachment_data(&original_attachment_array, original_attachment_count);
-
-       return TRUE;
-}
-
-static gboolean        testapp_test_get_mail_data()
-{
-       int err = EMAIL_ERROR_NONE;
-       int mail_id = 0;
-       email_mail_data_t *mail_data = NULL;
-
-       testapp_print("\n > Enter mail id: ");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-
-       /* Get original mail */
-       if ((err = email_get_mail_data(mail_id, &mail_data)) != EMAIL_ERROR_NONE || !mail_data) {
-               testapp_print("email_get_mail_data failed [%d]\n", err);
-               return FALSE;
-       }
-
-       testapp_print("mail_id [%d]\n", mail_data->mail_id);
-       testapp_print("account_id [%d]\n", mail_data->account_id);
-       testapp_print("mailbox_id [%d]\n", mail_data->mailbox_id);
-       testapp_print("mailbox_type [%d]\n", mail_data->mailbox_type);
-       if (mail_data->subject)
-               testapp_print("subject [%s]\n", mail_data->subject);
-       testapp_print("date_time [%d]\n", mail_data->date_time);
-       testapp_print("server_mail_status [%d]\n", mail_data->server_mail_status);
-
-       if (mail_data->server_mailbox_name)
-               testapp_print("server_mailbox_name [%s]\n", mail_data->server_mailbox_name);
-
-       if (mail_data->server_mail_id)
-               testapp_print("server_mail_id [%s]\n", mail_data->server_mail_id);
-
-       if (mail_data->message_id)
-               testapp_print("message_id [%s]\n", mail_data->message_id);
-
-       testapp_print("reference_mail_id [%d]\n", mail_data->reference_mail_id);
-
-       if (mail_data->full_address_from)
-               testapp_print("full_address_from [%s]\n", mail_data->full_address_from);
-
-       if (mail_data->full_address_reply)
-               testapp_print("full_address_reply [%s]\n", mail_data->full_address_reply);
-
-       if (mail_data->full_address_to)
-               testapp_print("full_address_to [%s]\n", mail_data->full_address_to);
-
-       if (mail_data->full_address_cc)
-               testapp_print("full_address_cc [%s]\n", mail_data->full_address_cc);
-
-       if (mail_data->full_address_bcc)
-               testapp_print("full_address_bcc [%s]\n", mail_data->full_address_bcc);
-
-       if (mail_data->full_address_return)
-               testapp_print("full_address_return [%s]\n", mail_data->full_address_return);
-
-       if (mail_data->email_address_sender)
-               testapp_print("email_address_sender [%s]\n", mail_data->email_address_sender);
-
-       if (mail_data->email_address_recipient)
-               testapp_print("email_address_recipient [%s]\n", mail_data->email_address_recipient);
-
-       if (mail_data->alias_sender)
-               testapp_print("alias_sender [%s]\n", mail_data->alias_sender);
-
-       if (mail_data->alias_recipient)
-               testapp_print("alias_recipient [%s]\n", mail_data->alias_recipient);
-
-       testapp_print("body_download_status [%d]\n", mail_data->body_download_status);
-
-       if (mail_data->file_path_plain)
-               testapp_print("file_path_plain [%s]\n", mail_data->file_path_plain);
-
-       if (mail_data->file_path_html)
-               testapp_print("file_path_html [%s]\n", mail_data->file_path_html);
-
-       testapp_print("file_path_mime_entity [%s]\n", mail_data->file_path_mime_entity);
-       testapp_print("mail_size [%d]\n", mail_data->mail_size);
-       testapp_print("flags_seen_field [%d]\n", mail_data->flags_seen_field);
-       testapp_print("flags_deleted_field [%d]\n", mail_data->flags_deleted_field);
-       testapp_print("flags_flagged_field [%d]\n", mail_data->flags_flagged_field);
-       testapp_print("flags_answered_field [%d]\n", mail_data->flags_answered_field);
-       testapp_print("flags_recent_field [%d]\n", mail_data->flags_recent_field);
-       testapp_print("flags_draft_field [%d]\n", mail_data->flags_draft_field);
-       testapp_print("flags_forwarded_field [%d]\n", mail_data->flags_forwarded_field);
-       testapp_print("DRM_status [%d]\n", mail_data->DRM_status);
-       testapp_print("priority [%d]\n", mail_data->priority);
-       testapp_print("save_status [%d]\n", mail_data->save_status);
-       testapp_print("lock_status [%d]\n", mail_data->lock_status);
-       testapp_print("report_status [%d]\n", mail_data->report_status);
-       testapp_print("attachment_count [%d]\n", mail_data->attachment_count);
-       testapp_print("inline_content_count [%d]\n", mail_data->inline_content_count);
-       testapp_print("thread_id [%d]\n", mail_data->thread_id);
-       testapp_print("thread_item_count [%d]\n", mail_data->thread_item_count);
-
-       if (mail_data->preview_text)
-               testapp_print("preview_text [%s]\n", mail_data->preview_text);
-
-       testapp_print("meeting_request_status [%d]\n", mail_data->meeting_request_status);
-       testapp_print("message_class [%d]\n", mail_data->message_class);
-       testapp_print("digest_type [%d]\n", mail_data->digest_type);
-       testapp_print("smime_type [%d]\n", mail_data->smime_type);
-       testapp_print("scheduled_sending_time [%d]\n", mail_data->scheduled_sending_time);
-       testapp_print("remaining_resend_times [%d]\n", mail_data->remaining_resend_times);
-       testapp_print("eas_data_length [%d]\n", mail_data->eas_data_length);
-
-       return TRUE;
-}
-
-static gboolean        testapp_test_schedule_sending_mail()
-{
-       int                    added_mail_id = 0;
-       int                    err = EMAIL_ERROR_NONE;
-       int                    handle = 0;
-       time_t                 time_to_send;
-
-       testapp_add_mail_for_sending(&added_mail_id);
-
-       if (added_mail_id) {
-               time(&time_to_send);
-               time_to_send += 60;
-
-               testapp_print("Calling email_schedule_sending_mail...\n");
-
-               if (email_schedule_sending_mail(added_mail_id, time_to_send) < 0) {
-                       testapp_print("email_schedule_sending_mail failed[%d]\n", err);
-               } else {
-                       testapp_print("Start sending. handle[%d]\n", handle);
-               }
-       }
-
-       return TRUE;
-}
-
-static gboolean        testapp_test_set_flags_field()
-{
-       int account_id = 0;
-       int mail_id = 0;
-
-       testapp_print("\n > Enter Account ID: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter Mail ID: ");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-
-       if (email_set_flags_field(account_id, &mail_id, 1, EMAIL_FLAGS_FLAGGED_FIELD, 1, 1) < 0)
-               testapp_print("email_set_flags_field failed");
-       else
-               testapp_print("email_set_flags_field success");
-
-       return TRUE;
-}
-
-static gboolean testapp_test_download_body()
-{
-       int mail_id = 0;
-       int handle = 0, err;
-
-       testapp_print("\n > Enter Mail Id: ");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-       err = email_download_body(mail_id, 0, &handle);
-       if (err  < 0)
-               testapp_print("email_download_body failed");
-       else {
-               testapp_print("email_download_body success");
-               testapp_print("handle[%d]\n", handle);
-       }
-       return TRUE;
-}
-
-
-static gboolean testapp_test_cancel_download_body()
-{
-       int mail_id = 0;
-       int account_id = 0;
-       int yes = 0;
-       int handle = 0;
-
-       email_mailbox_t mailbox;
-       memset(&mailbox, 0x00, sizeof(email_mailbox_t));
-
-       testapp_print("\n > Enter account_id: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter mail id: ");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-
-       if (email_download_body(mail_id, 0, &handle) < 0)
-               testapp_print("email_download_body failed");
-       else {
-               testapp_print("email_download_body success\n");
-               testapp_print("Do u want to cancel download job>>>>>1/0\n");
-               if (0 >= scanf("%d", &yes))
-                       testapp_print("Invalid input. ");
-               if (1 == yes) {
-                       if (email_cancel_job(account_id, handle , EMAIL_CANCELED_BY_USER) < 0)
-                               testapp_print("email_cancel_job failed..!");
-                       else {
-                               testapp_print("email_cancel_job success..!");
-                               testapp_print("handle[%d]\n", handle);
-                       }
-               }
-
-       }
-       return TRUE;
-}
-static gboolean testapp_test_download_attachment()
-{
-       int mail_id = 0;
-       int attachment_no = 0;
-       int handle = 0;
-
-       testapp_print("\n > Enter Mail Id: ");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter attachment number: ");
-       if (0 >= scanf("%d", &attachment_no))
-               testapp_print("Invalid input. ");
-
-       if (email_download_attachment(mail_id, attachment_no, &handle) < 0)
-               testapp_print("email_download_attachment failed");
-       else {
-               testapp_print("email_download_attachment success");
-               testapp_print("handle[%d]\n", handle);
-       }
-       return TRUE;
-
-}
-
-static gboolean testapp_test_get_attachment_data_list()
-{
-       int err = EMAIL_ERROR_NONE;
-       int i = 0;
-       int mail_id = 0;
-       int test_attachment_data_count;
-       email_attachment_data_t *test_attachment_data_list = NULL;
-
-       testapp_print("\n > Enter Mail id: ");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-
-       if ((err = email_get_attachment_data_list(mail_id, &test_attachment_data_list, &test_attachment_data_count)) != EMAIL_ERROR_NONE) {
-               testapp_print("email_get_attachment_data_list() failed [%d]\n", err);
-               goto FINISH_OFF;
-       }
-       if (test_attachment_data_list) {
-               for (i = 0; i < test_attachment_data_count; i++) {
-                       testapp_print("index [%d]\n", i);
-                       testapp_print("attachment_name [%s]\n", test_attachment_data_list[i].attachment_name);
-                       testapp_print("attachment_path [%s]\n", test_attachment_data_list[i].attachment_path);
-                       testapp_print("attachment_size [%d]\n", test_attachment_data_list[i].attachment_size);
-                       testapp_print("mail_id [%d]\n", test_attachment_data_list[i].mail_id);
-                       testapp_print("attachment_mime_type [%s]\n", test_attachment_data_list[i].attachment_mime_type);
-               }
-               email_free_attachment_data(&test_attachment_data_list, test_attachment_data_count);
-       }
-
-FINISH_OFF:
-
-       return TRUE;
-}
-
-static gboolean testapp_test_get_meeting_request()
-{
-       int mail_id = 0;
-       int err = EMAIL_ERROR_NONE;
-       email_meeting_request_t *meeting_request;
-
-       testapp_print("\n > Enter Mail Id: ");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-
-       err = email_get_meeting_request(mail_id, &meeting_request);
-
-       testapp_print("err[%d]\n", err);
-
-       if (err == EMAIL_ERROR_NONE && meeting_request) {
-               testapp_print("mail_id [%d]\n", meeting_request->mail_id);
-               testapp_print("global_object_id [%s]\n", meeting_request->global_object_id);
-               testapp_print("meeting_response [%d]\n", meeting_request->meeting_response);
-       }
-
-       email_free_meeting_request(&meeting_request, 1);
-       return TRUE;
-}
-
-static gboolean testapp_test_retry_send()
-{
-       int mail_id = 0;
-       int timeout = 0;
-
-       email_mailbox_t mailbox;
-       memset(&mailbox, 0x00, sizeof(email_mailbox_t));
-
-       testapp_print("\n > Enter Mail Id: ");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter timeout in seconds: ");
-       if (0 >= scanf("%d", &timeout))
-               testapp_print("Invalid input. ");
-
-       if (email_retry_sending_mail(mail_id, timeout) < 0)
-               testapp_print("email_retry_sending_mail failed");
-       return TRUE;
-}
-
-static gboolean testapp_test_get_attachment_data()
-{
-       int attachment_id = 0;
-       email_attachment_data_t *attachment = NULL;
-
-       testapp_print("\n > Enter attachment id: ");
-       if (0 >= scanf("%d", &attachment_id))
-               testapp_print("Invalid input. ");
-
-       email_get_attachment_data(attachment_id, &attachment);
-
-       if (attachment) {
-               testapp_print("attachment_name [%s]\n", attachment->attachment_name);
-               testapp_print("attachment_path [%s]\n", attachment->attachment_path);
-               testapp_print("attachment_size [%d]\n", attachment->attachment_size);
-               testapp_print("mail_id [%d]\n", attachment->mail_id);
-               testapp_print("attachment_mime_type [%s]\n", attachment->attachment_mime_type);
-       }
-
-       return TRUE;
-}
-
-static gboolean testapp_test_move_all_mails_to_mailbox()
-{
-       int err = EMAIL_ERROR_NONE;
-       int src_mailbox_id;
-       int dest_mailbox_id;
-
-       testapp_print("src mailbox id> ");
-       if (0 >= scanf("%d", &src_mailbox_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("dest mailbox id> ");
-       if (0 >= scanf("%d", &dest_mailbox_id))
-               testapp_print("Invalid input. ");
-
-       err = email_move_all_mails_to_mailbox(src_mailbox_id, dest_mailbox_id);
-       if (err < 0) {
-               testapp_print("email_move_all_mails_to_mailbox failed: err[%d]\n", err);
-       } else {
-               testapp_print("email_move_all_mails_to_mailbox suceeded\n");
-       }
-
-       return false;
-}
-
-static gboolean testapp_test_get_totaldiskusage()
-{
-       unsigned long total_size = 0;
-       int err_code = EMAIL_ERROR_NONE ;
-
-       err_code = email_get_disk_space_usage(&total_size);
-       if (err_code < 0)
-               testapp_print("email_get_disk_space_usage failed err : %d\n", err_code);
-       else
-               testapp_print("email_get_disk_space_usage SUCCESS, total disk usage in KB : %ld \n", total_size);
-
-       return FALSE;
-}
-
-
-
-static gboolean testapp_test_db_test()
-{
-       int err = EMAIL_ERROR_NONE;
-       int mail_id;
-       int account_id;
-       char *to = NULL;
-       char *cc = NULL;
-       char *bcc = NULL;
-
-       to = (char *)malloc(500000);
-       cc = (char *)malloc(500000);
-       bcc = (char *)malloc(500000);
-
-       memset(to, 0x00, sizeof(500000));
-       memset(cc, 0x00, sizeof(500000));
-       memset(bcc, 0x00, sizeof(500000));
-
-       testapp_print("Input Mail id:\n");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-       testapp_print("Input Account id:\n");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-       testapp_print("Input TO field:\n");
-       if (0 >= scanf("%s", to))
-               testapp_print("Invalid input. ");
-       testapp_print("Input CC field:\n");
-       if (0 >= scanf("%s", cc))
-               testapp_print("Invalid input. ");
-       testapp_print("Input BCC field:\n");
-       if (0 >= scanf("%s", bcc))
-               testapp_print("Invalid input. ");
-
-       if (emstorage_test(NULL, mail_id, account_id, to, cc, bcc, &err) == true) {
-               testapp_print(">> Saving Succeeded\n");
-       } else {
-               testapp_print(">> Saving Failed[%d]\n", err);
-       }
-
-       free(to);
-       free(cc);
-       free(bcc);
-
-       return false;
-}
-
-static gboolean testapp_test_address_format_check_test()
-{
-       /*
-       int i;
-       int type;
-       int index;
-       int check_yn;
-       int err = EMAIL_ERROR_NONE;
-       char *pAddress = NULL;
-       char input_address[8096];
-       char *address_list[] = {
-               "tom@gmail.com",
-               "tom@gmail,com",
-               "tom@gmail.com@gmail.com",
-               "[tom@gmail.com]",
-               "\"Tom\"<tom@gmail.com>",
-               "\"Tom\"[tom@gmail.com]",
-               "\"Tom\"<tom,@gmail.com>",
-               "<tom@gmail.com>",
-               "<tom@gmail,com>",
-               "<tom@gmail.>",
-               "<tom@gmail.com>,tom@gmail.com",
-               "<tom@gmail.com>;tom@gmail.com",
-               "tom @gmail.com",
-               "tom@ gmail.com",
-               "tom@gmail..com",
-               "tom@",
-               "tom@gmail",
-               "tom@gmail.",
-               "tom@gmail.c",
-               "tom@.",
-               "\"\"Tom\"<tom,@gmail.com>",
-               "tom@gmail.com,tom@gmail.com",
-               "tom@gmail.com.",
-               "<tom@gmail.com>,tom@.gmail.com",
-               "&& tom@live.com ----",
-               "madhu <tom@gmail.com>",
-               "tom@gmail.com, && tom@live.com",
-               "tom@gmail.com , && tom@live.com",
-               "< tom@gmail.com    > , <           tom@.gmail.com     >",
-               "tom@gmail.com ,           tom@gmail.com",
-               "<tom@gmail.com          >",
-               "<to     m@gmail.com          >",
-               "<tom@gmail.com>;tom@gmail.com",
-              "Tom< tom@gmail.com > ,       Tom <tom@gmail.com>",
-               " \"Tom\"  < tom@gmail.com>  ,  \"Tom\"   < tom@gmail.com> ,  Tom  < tom@gmail.com> ; Tom  < tom@gmail.com>,\"tomtom\" <   tom@aol.com>,\"tomtom\" <   tom@aol.com>    ,\"tomtom\" <tom@aol.com>;<tom@live.com>,  <tom@live.com>; \"tomtomtomtom\" <tom@live.com>  ; \"tomtomtomtom\" <tom@live.com>,\"Tom\"  < tom@gmail.com>",
-               "<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>,<tom@gmail.com>",
-               "             tom@gmail.com         ;   <  tom@gmail.com   > ",
-               "\"Tom\" <        tom@gmail.com >  ;  mama <  tom@gmail.com    >  ,   abcd@gmail.com     ,   abc@gmail.com ,\"tomtom\" <tom@aol.com>,\"tomtom\"  < tom@aol.com> ;\"tomtom\" <   tom@aol.com   >    ,\"tomtom\" <tom@aol.com> , \"tomtomtomtom\" <tom@live.com>  ",
-               "             \"tomtom\" <tom@aol.com>    ;\"tomtom\" <tom@aol.com> ;          ",
-               "  tom@gmail.com  ,   tom@gmail.com ,   tom@gmail.com; Tom  < tom@gmail.com   >  ,<   tom@aol.com>, <tom@aol.com>    ,<tom@aol.com>;<tom@live.com>,  tom@live.com;tom@live.com; \"tomtomtomtom\" <tom@live.com>,\"Tom\"  < tom@gmail.com> ;    ",
-               "<tom@aol.com>    , \"tomtomtomtom\" <tom@live.com>,\"Tom\"  < tom@gmail.com> ;    ",
-               " Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <   tom@gmail.com>  ,<tom@gmail.com>,Tom <tom@gmail.com       >,Tom< tom@gmail.com > ,       Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>,Tom <tom@gmail.com>",
-               NULL
-       };
-       int address_count = 0;
-
-       testapp_print("Select input method:\n");
-       testapp_print("1. Test data\n");
-       testapp_print("2. Keyboard\n");
-       if (0 >= scanf("%d", &type);
-
-       switch (type) {
-               case 1:
-                       do  {
-                               for (i = 0; address_list[i] != NULL; i++) {
-                                       testapp_print("[%d] addr[%s]\n", i, address_list[i]);
-                                       address_count++;
-                               }
-                               testapp_print("Choose address to be tested:[99:quit]\n");
-                               if (0 >= scanf("%d", &index);
-                               if (index == 99 )
-                                       break;
-
-                               testapp_print(">> [%d] Checking?(1:Yes, Other:No) [%s]\n", index, address_list[index]);
-                               if (0 >= scanf("%d", &check_yn);
-                               if (check_yn == 1) {
-                                       pAddress = strdup(address_list[index]);
-                                       if (em_verify_email_address(pAddress, false, &err ) == true) {
-                                               testapp_print("<< [%d] Checking Succeeded : addr[%s]\n", index, address_list[index]);
-                                       }
-                                       else {
-                                               testapp_print("<< [%d] Checking Failed    : addr[%s], err[%d]\n", index, address_list[index], err);
-                                       }
-                                       if (pAddress) {
-                                               free(pAddress);
-                                               pAddress = NULL;
-                                       }
-                               }
-                               else {
-                                       testapp_print("<< [%d]  Skipped            : addr[%s]\n", index, address_list[index]);
-                               }
-                       }
-                       while (1);
-                       break;
-               case 2:
-                       testapp_print("Input address: \n");
-                       if (0 >= scanf("%s", input_address);
-                       if (em_verify_email_address(input_address, false, &err ) == true) {
-                               testapp_print(">> Saving Succeeded : addr[%s]\n", input_address);
-                       }
-                       else {
-                               testapp_print(">> Saving Failed : addr[%s], err[%d]\n", input_address, err);
-                       }
-                       break;
-               default:
-                       testapp_print("wrong nuber... [%d]\n", type);
-                       break;
-       }
-       */
-       return FALSE;
-}
-
-static gboolean testapp_test_get_max_mail_count()
-{
-       int max_count = -1;
-       int err = EMAIL_ERROR_NONE;
-
-       err = email_get_max_mail_count(&max_count);
-       testapp_print("\n\t>>>>> email_get_max_mail_count() return [%d][%d]\n\n", max_count, err);
-
-       return TRUE;
-}
-
-#include "email-storage.h"
-static gboolean testapp_test_test_get_thread_information()
-{
-       int error_code, thread_id = 38;
-       email_mail_list_item_t *result_mail;
-
-       if ((error_code = email_get_thread_information_ex(thread_id, &result_mail)) == EMAIL_ERROR_NONE) {
-               testapp_print("email_get_thread_information returns = %d\n", error_code);
-               testapp_print("subject = %s\n", result_mail->subject);
-               testapp_print("mail_id = %d\n", result_mail->mail_id);
-               testapp_print("full_address_from = %s\n", result_mail->full_address_from);
-               testapp_print("thrad_id = %d\n", result_mail->thread_id);
-               testapp_print("count = %d\n", result_mail->thread_item_count);
-       }
-
-       return TRUE;
-}
-
-static gboolean testapp_test_get_address_info_list()
-{
-       testapp_print(" >>> testapp_test_get_address_info_list : Entered \n");
-
-       char buf[1024];
-       int i = 0;
-       int mail_id = 0;
-       email_address_info_list_t *address_info_list = NULL;
-       email_address_info_t *p_address_info = NULL;
-       GList *list = NULL;
-       GList *node = NULL;
-
-       memset(buf, 0x00, sizeof(buf));
-       testapp_print("\n > Enter mail_id: ");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-
-       email_get_address_info_list(mail_id, &address_info_list);
-
-       testapp_print("===================================================\n");
-       testapp_print("\t\t\t address info list\n");
-       testapp_print("===================================================\n");
-       testapp_print("address_type\t address \t\tdisplay_name\t contact id\n");
-       testapp_print("===================================================\n");
-
-       for (i = EMAIL_ADDRESS_TYPE_FROM; i <= EMAIL_ADDRESS_TYPE_BCC; i++) {
-               switch (i) {
-                       case EMAIL_ADDRESS_TYPE_FROM:
-                               list = address_info_list->from;
-                               break;
-                       case EMAIL_ADDRESS_TYPE_TO:
-                               list = address_info_list->to;
-                               break;
-                       case EMAIL_ADDRESS_TYPE_CC:
-                               list = address_info_list->cc;
-                               break;
-                       case EMAIL_ADDRESS_TYPE_BCC:
-                               list = address_info_list->bcc;
-                               break;
-               }
-
-               /*  delete dynamic-allocated memory for each item */
-               node = g_list_first(list);
-               while (node != NULL) {
-                       p_address_info = (email_address_info_t *)node->data;
-                       testapp_print("%d\t\t%s\t%s\t%d\n", p_address_info->address_type, p_address_info->address, p_address_info->display_name, p_address_info->contact_id);
-
-                       node = g_list_next(node);
-               }
-               testapp_print("\n");
-       }
-       testapp_print("===================================================\n");
-
-       if (address_info_list)
-               email_free_address_info_list(&address_info_list);
-
-       testapp_print(" >>> testapp_test_get_address_info_list : END \n");
-       return TRUE;
-}
-
-static gboolean testapp_test_search_mail_on_server()
-{
-       testapp_print(" >>> testapp_test_search_mail_on_server : Entered \n");
-
-       int err_code = EMAIL_ERROR_NONE;
-       int account_id = 0;
-       int mailbox_id = 0;
-       int search_key_value_integer = 0;
-       int search_filter_count = 0;
-       email_search_filter_type search_filter_type = 0;
-       email_search_filter_t search_filter[10];
-       int handle = 0;
-       time_t current_time = 0;
-       char search_key_value_string[256];
-
-       testapp_print("input account id : ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("input mailbox id : ");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input. ");
-
-       memset(&search_filter, 0x00, sizeof(email_search_filter_t) * 10);
-
-       while (1) {
-               testapp_print(
-                       "       EMAIL_SEARCH_FILTER_TYPE_MESSAGE_NO       =  1, (integer type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_UID              =  2, (integer type ) \n"
-                       "   EMAIL_SEARCH_FILTER_TYPE_ALL              =  3, (integer type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_BCC              =  7, (string type ) \n"
-                       "   EMAIL_SEARCH_FILTER_TYPE_BODY             =  8, (string type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_CC               =  9, (string type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_FROM             = 10, (string type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_KEYWORD          = 11, (string type ) \n"
-                       "   EMAIL_SEARCH_FILTER_TYPE_TEXT             = 12, (string type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_SUBJECT          = 13, (string type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_TO               = 15, (string type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_SIZE_LARSER      = 16, (integet type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_SIZE_SMALLER     = 17, (integet type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_BEFORE = 20, (time type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_ON     = 21, (time type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_SINCE  = 22, (time type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_ANSWERED   = 26, (integer type ) \n"
-                       "   EMAIL_SEARCH_FILTER_TYPE_FLAGS_NEW        = 27, (integer type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_DELETED    = 28, (integer type ) \n"
-                       "   EMAIL_SEARCH_FILTER_TYPE_FLAGS_OLD        = 29, (integer type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_DRAFT      = 30, (integer type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_FLAGED     = 32, (integer type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_RECENT     = 34, (integer type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_FLAGS_SEEN       = 36, (integer type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID       = 43, (string type ) \n"
-                       "   EMAIL_SEARCH_FILTER_TYPE_HEADER_PRIORITY  = 50, (integer type ) \n"
-                       "       EMAIL_SEARCH_FILTER_TYPE_ATTACHMENT_NAME  = 60, (string type ) \n"
-                       "   EMAIL_SEARCH_FILTER_TYPE_CHARSET          = 61, (string type ) \n"
-                       "   EMAIL_SEARCH_FILTER_TYPE_USER_DEFINED     = 62, (string type ) \n"
-                       "       END                                       = 0 \n");
-
-               testapp_print("input search filter type : ");
-               if (0 >= scanf("%d", (int *)&search_filter_type))
-                       testapp_print("Invalid input. ");
-
-               search_filter[search_filter_count].search_filter_type = search_filter_type;
-
-               switch (search_filter_type) {
-                       case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_NO:
-                       case EMAIL_SEARCH_FILTER_TYPE_UID:
-                       case EMAIL_SEARCH_FILTER_TYPE_ALL:
-                       case EMAIL_SEARCH_FILTER_TYPE_SIZE_LARSER:
-                       case EMAIL_SEARCH_FILTER_TYPE_SIZE_SMALLER:
-                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_ANSWERED:
-                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_NEW:
-                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DELETED:
-                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_OLD:
-                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_DRAFT:
-                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_FLAGED:
-                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_RECENT:
-                       case EMAIL_SEARCH_FILTER_TYPE_FLAGS_SEEN:
-                       case EMAIL_SEARCH_FILTER_TYPE_HEADER_PRIORITY:
-                               testapp_print("input search filter key value : ");
-                               if (0 >= scanf("%d", &search_key_value_integer))
-                                       testapp_print("Invalid input. ");
-                               search_filter[search_filter_count].search_filter_key_value.integer_type_key_value = search_key_value_integer;
-                               break;
-
-                       case EMAIL_SEARCH_FILTER_TYPE_BCC:
-                       case EMAIL_SEARCH_FILTER_TYPE_BODY:
-                       case EMAIL_SEARCH_FILTER_TYPE_CC:
-                       case EMAIL_SEARCH_FILTER_TYPE_FROM:
-                       case EMAIL_SEARCH_FILTER_TYPE_KEYWORD:
-                       case EMAIL_SEARCH_FILTER_TYPE_TEXT:
-                       case EMAIL_SEARCH_FILTER_TYPE_SUBJECT:
-                       case EMAIL_SEARCH_FILTER_TYPE_TO:
-                       case EMAIL_SEARCH_FILTER_TYPE_MESSAGE_ID:
-                       case EMAIL_SEARCH_FILTER_TYPE_ATTACHMENT_NAME:
-                       case EMAIL_SEARCH_FILTER_TYPE_CHARSET:
-                       case EMAIL_SEARCH_FILTER_TYPE_USER_DEFINED:
-                               testapp_print("input search filter key value : ");
-                               int readn = read(0, search_key_value_string, 256);
-                               if (readn < 0)
-                                       testapp_print("Invalid input. ");
-
-                               search_filter[search_filter_count].search_filter_key_value.string_type_key_value = strndup(search_key_value_string, readn - 1);
-                               break;
-
-                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_BEFORE:
-                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_ON:
-                       case EMAIL_SEARCH_FILTER_TYPE_SENT_DATE_SINCE:
-                               time(&current_time);
-                               /* TODO : write codes for converting string to time */
-                               /* search_filter.search_filter_key_value.time_type_key_value = search_key_value_string; */
-                               search_filter[search_filter_count].search_filter_key_value.time_type_key_value = current_time;
-                               break;
-                       default:
-                               testapp_print("END filter type [%d]", search_filter_type);
-                               break;
-               }
-
-               if (!search_filter_type)
-                       break;
-
-               search_filter_count++;
-       }
-
-       if ((err_code = email_search_mail_on_server(account_id, mailbox_id, search_filter, search_filter_count, &handle)) != EMAIL_ERROR_NONE) {
-               testapp_print("email_search_mail_on_server failed [%d]", err_code);
-       }
-
-       testapp_print(" >>> testapp_test_search_mail_on_server : END \n");
-       return TRUE;
-}
-
-static gboolean testapp_test_add_mail_to_search_result_box()
-{
-       int                    i = 0;
-       int                    account_id = 0;
-       int                    from_eas = 0;
-       int                    attachment_count = 0;
-       int                    err = EMAIL_ERROR_NONE;
-       char                   arg[50] = { 0 , };
-       char                  *body_file_path = MAIL_TEMP_BODY;
-       email_mailbox_t         *mailbox_data = NULL;
-       email_mail_data_t       *test_mail_data = NULL;
-       email_attachment_data_t *attachment_data = NULL;
-       email_meeting_request_t *meeting_req = NULL;
-       FILE                  *body_file = NULL;
-
-       testapp_print("\n > Enter account id : ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       email_get_mailbox_by_mailbox_type(account_id, EMAIL_MAILBOX_TYPE_SEARCH_RESULT, &mailbox_data);
-
-       test_mail_data = malloc(sizeof(email_mail_data_t));
-       memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
-
-       testapp_print("\n From EAS? [0/1]> ");
-       if (0 >= scanf("%d", &from_eas))
-               testapp_print("Invalid input. ");
-
-       test_mail_data->account_id             = account_id;
-       test_mail_data->save_status            = 1;
-       test_mail_data->body_download_status   = 1;
-       test_mail_data->flags_seen_field       = 1;
-       test_mail_data->file_path_plain        = strdup(body_file_path);
-       test_mail_data->mailbox_id             = mailbox_data->mailbox_id;
-       test_mail_data->mailbox_type           = mailbox_data->mailbox_type;
-       test_mail_data->full_address_from      = strdup("<test1@test.com>");
-       test_mail_data->full_address_to        = strdup("<test2@test.com>");
-       test_mail_data->full_address_cc        = strdup("<test3@test.com>");
-       test_mail_data->full_address_bcc       = strdup("<test4@test.com>");
-       test_mail_data->subject                = strdup("Into search result mailbox");
-       test_mail_data->remaining_resend_times = 3;
-
-       body_file = fopen(body_file_path, "w");
-
-       for (i = 0; i < 500; i++)
-               fprintf(body_file, "X2 X2 X2 X2 X2 X2 X2");
-       fflush(body_file);
-       fclose(body_file);
-
-       testapp_print(" > Attach file? [0/1] : ");
-       if (0 >= scanf("%d", &attachment_count))
-               testapp_print("Invalid input. ");
-
-       if (attachment_count) {
-               memset(arg, 0x00, 50);
-               testapp_print("\n > Enter attachment name : ");
-               if (0 >= scanf("%s", arg))
-                       testapp_print("Invalid input. ");
-
-               attachment_data = malloc(sizeof(email_attachment_data_t));
-
-               attachment_data->attachment_name  = strdup(arg);
-
-               memset(arg, 0x00, 50);
-               testapp_print("\n > Enter attachment absolute path : ");
-               if (0 >= scanf("%s", arg))
-                       testapp_print("Invalid input. ");
-
-               attachment_data->attachment_path  = strdup(arg);
-               attachment_data->save_status      = 1;
-               test_mail_data->attachment_count  = attachment_count;
-       }
-
-       testapp_print("\n > Meeting Request? [0: no, 1: yes(request from server), 2: yes(response from local)]");
-       if (0 >= scanf("%d", (int *)&(test_mail_data->meeting_request_status)))
-               testapp_print("Invalid input. ");
-
-       if (test_mail_data->meeting_request_status == 1
-               || test_mail_data->meeting_request_status == 2) {
-               time_t current_time;
-               /*  dummy data for meeting request */
-               meeting_req = malloc(sizeof(email_meeting_request_t));
-               memset(meeting_req, 0x00, sizeof(email_meeting_request_t));
-
-               meeting_req->meeting_response     = 1;
-               current_time = time(NULL);
-               gmtime_r(&current_time, &(meeting_req->start_time));
-               gmtime_r(&current_time, &(meeting_req->end_time));
-               meeting_req->location = malloc(strlen("Seoul") + 1);
-               memset(meeting_req->location, 0x00, strlen("Seoul") + 1);
-               strcpy(meeting_req->location, "Seoul");
-               strcpy(meeting_req->global_object_id, "abcdef12345");
-
-               meeting_req->time_zone.offset_from_GMT = 9;
-               strcpy(meeting_req->time_zone.standard_name, "STANDARD_NAME");
-               gmtime_r(&current_time, &(meeting_req->time_zone.standard_time_start_date));
-               meeting_req->time_zone.standard_bias = 3;
-
-               strcpy(meeting_req->time_zone.daylight_name, "DAYLIGHT_NAME");
-               gmtime_r(&current_time, &(meeting_req->time_zone.daylight_time_start_date));
-               meeting_req->time_zone.daylight_bias = 7;
-
-       }
-
-       if ((err = email_add_mail(test_mail_data, attachment_data, attachment_count, meeting_req, from_eas)) != EMAIL_ERROR_NONE)
-               testapp_print("email_add_mail failed. [%d]\n", err);
-       else
-               testapp_print("email_add_mail success.\n");
-
-       testapp_print("saved mail id = [%d]\n", test_mail_data->mail_id);
-
-       if (attachment_data)
-               email_free_attachment_data(&attachment_data, attachment_count);
-
-       if (meeting_req)
-               email_free_meeting_request(&meeting_req, 1);
-
-       email_free_mail_data(&test_mail_data, 1);
-       email_free_mailbox(&mailbox_data, 1);
-
-       return FALSE;
-}
-
-static gboolean testapp_test_email_parse_mime_file()
-{
-       int i = 0;
-       int attachment_count = 0;
-       int output_attachment_count = 0;
-       int verify = 0;
-       int err = EMAIL_ERROR_NONE;
-       char eml_file_path[255] = {0, };
-        struct tm *struct_time;
-
-       email_mail_data_t *mail_data = NULL;
-       email_attachment_data_t *mail_attachment_data = NULL;
-       email_mail_data_t *output_mail_data = NULL;
-       email_attachment_data_t *output_mail_attachment_data = NULL;
-
-       testapp_print("Input eml file path : ");
-       if (0 >= scanf("%s", eml_file_path))
-               testapp_print("Invalid input. ");
-
-       if ((err = email_parse_mime_file(eml_file_path, &mail_data, &mail_attachment_data, &attachment_count)) != EMAIL_ERROR_NONE) {
-               testapp_print("email_parse_mime_file failed : [%d]\n", err);
-               return false;
-       }
-
-        testapp_print("load success\n");
-
-        struct_time = localtime(&(mail_data->date_time));
-
-        testapp_print("%4d year", struct_time->tm_year +1900);
-        testapp_print("%2d month(0-11)\n", struct_time->tm_mon + 1);
-        testapp_print("%2d day(1-31)\n", struct_time->tm_mday);
-        testapp_print("%2d wday\n", struct_time->tm_wday);
-        testapp_print("%2d hour(0-23)\n", struct_time->tm_hour);
-        testapp_print("%2d minutes(0-59)\n", struct_time->tm_min);
-        testapp_print("%2d second(0-59)\n", struct_time->tm_sec);
-        testapp_print("year day %3d\n", struct_time->tm_yday);
-
-       testapp_print("Return-Path: %s\n", mail_data->full_address_return);
-       testapp_print("To: %s\n", mail_data->full_address_to);
-       testapp_print("Subject: %s\n", mail_data->subject);
-       testapp_print("Priority: %d\n", mail_data->priority);
-       testapp_print("From: %s\n", mail_data->full_address_from);
-       testapp_print("Reply-To: %s\n", mail_data->full_address_reply);
-       testapp_print("Sender: %s\n", mail_data->email_address_sender);
-       testapp_print("Message-ID: %s\n", mail_data->message_id);
-       testapp_print("attachment_count: %d\n", mail_data->attachment_count);
-       testapp_print("SMIME type : %d\n", mail_data->smime_type);
-       testapp_print("inline content count : %d\n", mail_data->inline_content_count);
-       testapp_print("mail_size : %d\n", mail_data->mail_size);
-       testapp_print("download_body_status : %d\n", mail_data->body_download_status);
-
-
-       for (i = 0; i < attachment_count ; i++) {
-               testapp_print("%d attachment\n", i);
-               testapp_print("attachment_id: %d\n", mail_attachment_data[i].attachment_id);
-               testapp_print("attachment_size: %d\n", mail_attachment_data[i].attachment_size);
-               testapp_print("inline_attachment_status: %d\n", mail_attachment_data[i].inline_content_status);
-               testapp_print("attachment_name: %s\n", mail_attachment_data[i].attachment_name);
-               testapp_print("attachment_path: %s\n", mail_attachment_data[i].attachment_path);
-               testapp_print("attachment_save_status: %d\n", mail_attachment_data[i].save_status);
-               testapp_print("content_id: %s\n", mail_attachment_data[i].content_id);
-               testapp_print("mailbox_id: %d\n", mail_attachment_data[i].mailbox_id);
-       }
-
-       testapp_print("Success : Open eml file\n");
-
-       if (mail_data->smime_type != EMAIL_SMIME_NONE) {
-               if (mail_data->smime_type == EMAIL_SMIME_SIGNED || mail_data->smime_type == EMAIL_PGP_SIGNED) {
-                       if (!email_verify_signature_ex(mail_data, mail_attachment_data, attachment_count, &verify))
-                               testapp_print("email_verify_signature_ex failed\n");
-               } else {
-                       if ((err = email_get_decrypt_message_ex(mail_data,
-                                                                                                       mail_attachment_data,
-                                                                                                       attachment_count,
-                                                                                                       &output_mail_data,
-                                                                                                       &output_mail_attachment_data,
-                                                                                                       &output_attachment_count,
-                                                                                                       &verify)) != EMAIL_ERROR_NONE)
-                               testapp_print("email_get_decrypt_message_ex failed\n");
-               }
-
-               testapp_print("verify : [%d]\n", verify);
-       }
-
-       if ((err = email_delete_parsed_data(mail_data)) != EMAIL_ERROR_NONE) {
-               testapp_print("email_delete_eml_data failed : [%d]\n", err);
-               return false;
-       }
-
-       testapp_print("Success : email_delete_eml_data\n");
-
-       if (mail_data)
-               email_free_mail_data(&mail_data, 1);
-
-       testapp_print("Success : email_free_mail_data\n");
-
-       if (mail_attachment_data)
-               email_free_attachment_data(&mail_attachment_data, attachment_count);
-
-       testapp_print("Success : email_free_attachment_data\n");
-
-       return true;
-
-}
-
-static gboolean testapp_test_email_write_mime_file()
-{
-       int err = EMAIL_ERROR_NONE;
-       int mail_id = 0;
-       int attachment_count = 0;
-       char *file_path = NULL;
-       email_mail_data_t *mail_data = NULL;
-       email_attachment_data_t *mail_attachment_data = NULL;
-
-
-       file_path = malloc(512);
-       memset(file_path, 0x00, 512);
-
-       testapp_print("Input mail id : ");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-
-       err = email_get_mail_data(mail_id, &mail_data);
-       if (err != EMAIL_ERROR_NONE || mail_data == NULL) {
-               testapp_print("email_get_mail_data failed : [%d]\n", err);
-               return false;
-       }
-
-       err = email_get_attachment_data_list(mail_id, &mail_attachment_data, &attachment_count);
-       if (err != EMAIL_ERROR_NONE) {
-               testapp_print("email_get_attachment_data_list failed : [%d]\n", err);
-               return false;
-       }
-
-       snprintf(file_path, 512, tzplatform_mkpath(TZ_SYS_DATA,"email/.email_data/tmp/%d_%8d.eml"), mail_id, (int)time(NULL));
-
-       err = email_write_mime_file(mail_data, mail_attachment_data, attachment_count, &file_path);
-       if (err != EMAIL_ERROR_NONE) {
-               testapp_print("email_write_mime_file failed : [%d]\n", err);
-               return false;
-       }
-
-       testapp_print("file path : [%s]\n", file_path);
-
-       if (mail_data)
-               email_free_mail_data(&mail_data, 1);
-
-       if (mail_attachment_data)
-               email_free_attachment_data(&mail_attachment_data, attachment_count);
-
-       if (file_path)
-               free(file_path);
-
-       return true;
-}
-
-static gboolean testapp_test_smime_verify_signature()
-{
-       int mail_id = 0;
-       int verify = 0;
-       int err = EMAIL_ERROR_NONE;
-
-       testapp_print("input mail_id :");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-
-       err = email_verify_signature(mail_id, &verify);
-       if (err != EMAIL_ERROR_NONE) {
-               testapp_print("Failed Verify\n");
-               return false;
-       }
-
-       testapp_print("verify value : [%d]\n", verify);
-       return true;
-}
-
-static gboolean testapp_test_email_add_mail_with_multiple_recipient()
-{
-       int                    i = 0;
-       int                    account_id = 0;
-       int                    err = EMAIL_ERROR_NONE;
-//     int                    smime_type = 0;
-       int                    recipient_addresses_count = 0;
-       char                  *recipient_addresses = NULL;
-       char                   recipient_address[234] = { 0, };
-       char                   from_address[300] = { 0 , };
-       const char            *body_file_path = MAIL_TEMP_BODY;
-       email_account_t       *account_data = NULL;
-       email_mailbox_t       *mailbox_data = NULL;
-       email_mail_data_t     *test_mail_data = NULL;
-       FILE                  *body_file;
-
-       testapp_print("\n > Enter account id : ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter recipient address count : ");
-       if (0 >= scanf("%d", &recipient_addresses_count))
-               testapp_print("Invalid input. ");
-
-       if (recipient_addresses_count < 1)
-               return TRUE;
-
-       recipient_addresses = malloc(sizeof(char) * 234 * recipient_addresses_count);
-
-       for (i = 0; i < recipient_addresses_count; i++) {
-               snprintf(recipient_address, 234, "\"mailtest%05d\" <mailtest%05d@a1234567890b1234567890.com>; ", i, i);
-               strcat(recipient_addresses, recipient_address);
-       }
-
-       email_get_account(account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account_data);
-
-       email_get_mailbox_by_mailbox_type(account_id, EMAIL_MAILBOX_TYPE_OUTBOX, &mailbox_data);
-
-       test_mail_data = malloc(sizeof(email_mail_data_t));
-       memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
-
-       SNPRINTF(from_address, 300, "<%s>", account_data->user_email_address);
-
-       test_mail_data->account_id             = account_id;
-       test_mail_data->save_status            = EMAIL_MAIL_STATUS_SEND_DELAYED;
-       test_mail_data->body_download_status   = 1;
-       test_mail_data->flags_seen_field       = 1;
-       test_mail_data->file_path_plain        = strdup(body_file_path);
-       test_mail_data->mailbox_id             = mailbox_data->mailbox_id;
-       test_mail_data->mailbox_type           = mailbox_data->mailbox_type;
-       test_mail_data->full_address_from      = strdup(from_address);
-       test_mail_data->full_address_to        = recipient_addresses;
-       test_mail_data->subject                = strdup("Read receipt request from TIZEN");
-       test_mail_data->remaining_resend_times = 3;
-       test_mail_data->report_status          = EMAIL_MAIL_REQUEST_DSN | EMAIL_MAIL_REQUEST_MDN;
-       test_mail_data->smime_type             = 0;
-
-       body_file = fopen(body_file_path, "w");
-
-       testapp_print("\n body_file [%p]\n", body_file);
-
-       if (body_file == NULL) {
-               testapp_print("\n fopen [%s]failed\n", body_file_path);
-               return FALSE;
-       }
-
-       for (i = 0; i < 100; i++)
-               fprintf(body_file, "Mail sending Test. [%d]\n", i);
-
-       fflush(body_file);
-       fclose(body_file);
-
-
-       if ((err = email_add_mail(test_mail_data, NULL, 0, NULL, 0)) != EMAIL_ERROR_NONE)
-               testapp_print("email_add_mail failed. [%d]\n", err);
-       else
-               testapp_print("email_add_mail success.\n");
-
-       testapp_print("saved mail id = [%d]\n", test_mail_data->mail_id);
-
-       email_free_mail_data(&test_mail_data, 1);
-       email_free_mailbox(&mailbox_data, 1);
-       email_free_account(&account_data, 1);
-
-       return FALSE;
-}
-
-static gboolean testapp_test_send_mails_every_x_minutes()
-{
-       int                    added_mail_id = 0;
-       int                    err = EMAIL_ERROR_NONE;
-       int                    handle = 0;
-       time_t                 time_to_send;
-       int                    i = 0;
-       int                    j = 0;
-       int                    account_id = 0;
-       int                    send_interval_in_minutes = 0;
-       int                    number_of_mails = 0;
-       char                   recipient_address[300] = { 0 , };
-       char                   from_address[300] = { 0 , };
-       char                   subject_form[1024] = { 0 , };
-       const char            *body_file_path = MAIL_TEMP_BODY;
-       struct tm             *time_to_send_tm;
-       email_account_t       *account_data = NULL;
-       email_mailbox_t       *mailbox_data = NULL;
-       email_mail_data_t     *test_mail_data = NULL;
-       FILE                  *body_file;
-
-       testapp_print("\n > Enter account id : ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter recipient address : ");
-       if (0 >= scanf("%s", recipient_address))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter number of mails: ");
-       if (0 >= scanf("%d", &number_of_mails))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter send interval in minutes: ");
-       if (0 >= scanf("%d", &send_interval_in_minutes))
-               testapp_print("Invalid input. ");
-
-       email_get_account(account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account_data);
-
-       email_get_mailbox_by_mailbox_type(account_id, EMAIL_MAILBOX_TYPE_OUTBOX, &mailbox_data);
-
-       test_mail_data = malloc(sizeof(email_mail_data_t));
-       memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
-
-       SNPRINTF(from_address, 300, "<%s>", account_data->user_email_address);
-
-       test_mail_data->account_id             = account_id;
-       test_mail_data->save_status            = EMAIL_MAIL_STATUS_SEND_DELAYED;
-       test_mail_data->body_download_status   = 1;
-       test_mail_data->flags_seen_field       = 1;
-       test_mail_data->file_path_plain        = strdup(body_file_path);
-       test_mail_data->mailbox_id             = mailbox_data->mailbox_id;
-       test_mail_data->mailbox_type           = mailbox_data->mailbox_type;
-       test_mail_data->full_address_from      = strdup(from_address);
-       test_mail_data->full_address_to        = strdup(recipient_address);
-       test_mail_data->remaining_resend_times = 3;
-       test_mail_data->report_status          = EMAIL_MAIL_REPORT_NONE;
-
-
-       for (i = 0; i < number_of_mails; i++) {
-               if (test_mail_data->subject)
-                       free(test_mail_data->subject);
-
-               time(&time_to_send);
-               time_to_send += (60 * send_interval_in_minutes) * (i + 1);
-               time_to_send_tm = localtime(&time_to_send);
-
-               strftime(subject_form, 1024, "[%H:%M] TEST.", time_to_send_tm);
-               test_mail_data->subject = strdup(subject_form);
-
-               body_file = fopen(body_file_path, "w");
-
-               testapp_print("\n body_file [%p]\n", body_file);
-
-               if (body_file == NULL) {
-                       testapp_print("\n fopen [%s]failed\n", body_file_path);
-                       return FALSE;
-               }
-
-               for (j = 0; j < 100; j++)
-                       fprintf(body_file, "Mail sending Test. [%d]\n", j);
-
-               fflush(body_file);
-               fclose(body_file);
-
-               if ((err = email_add_mail(test_mail_data, NULL, 0, NULL, 0)) != EMAIL_ERROR_NONE) {
-                       testapp_print("email_add_mail failed. [%d]\n", err);
-                       added_mail_id = 0;
-               } else {
-                       testapp_print("email_add_mail success.\n");
-                       added_mail_id = test_mail_data->mail_id;
-               }
-
-               testapp_print("saved mail id = [%d]\n", added_mail_id);
-
-               if (added_mail_id) {
-                       testapp_print("Calling email_schedule_sending_mail...\n");
-
-                       if (email_schedule_sending_mail(added_mail_id, time_to_send) < 0) {
-                               testapp_print("email_schedule_sending_mail failed[%d]\n", err);
-                       } else  {
-                               testapp_print("Start sending. handle[%d]\n", handle);
-                       }
-               }
-       }
-
-       email_free_mail_data(&test_mail_data, 1);
-       email_free_mailbox(&mailbox_data, 1);
-       email_free_account(&account_data, 1);
-
-       return TRUE;
-}
-
-/* internal functions */
-static gboolean testapp_test_interpret_command(int menu_number)
-{
-       gboolean go_to_loop = TRUE;
-
-       switch (menu_number) {
-               case 1:
-                       testapp_test_get_mails();
-                       break;
-               case 2:
-                       testapp_test_mail_send(NULL);
-                       break;
-               case 3:
-                       testapp_test_get_mail_list_ex();
-                       break;
-               case 4:
-                       testapp_test_add_attachment();
-                       break;
-               case 5:
-                       testapp_test_set_deleted_flag();
-                       break;
-               case 6:
-                       testapp_test_expunge_mails_deleted_flagged();
-                       break;
-               case 7:
-                       testapp_test_send_read_receipt();
-                       break;
-               case 8:
-                       testapp_test_delete_attachment();
-                       break;
-               case 9:
-                       testapp_test_count();
-                       break;
-               case 10:
-                       testapp_test_move_mails_to_mailbox_of_another_account();
-                       break;
-               case 11:
-                       testapp_test_send_mail_with_downloading_attachment_of_original_mail();
-                       break;
-               case 12:
-                       testapp_test_get_mail_data();
-                       break;
-               case 13:
-                       testapp_test_schedule_sending_mail();
-                       break;
-               case 14:
-                       testapp_test_delete();
-                       break;
-               case 15:
-                       testapp_test_update_mail_attribute();
-                       break;
-               case 16:
-                       testapp_test_download_body();
-                       break;
-               case 17:
-                       testapp_test_download_attachment();
-                       break;
-               case 18:
-                       testapp_test_get_attachment_data_list();
-                       break;
-               case 19:
-                       testapp_test_get_meeting_request();
-                       break;
-               case 20:
-                       testapp_test_delete_all();
-                       break;
-               case 21:
-                       testapp_test_move();
-                       break;
-               case 23:
-                       testapp_test_retry_send();
-                       break;
-               case 24:
-                       testapp_test_get_attachment_data();
-                       break;
-               case 27:
-                       testapp_test_move_all_mails_to_mailbox();
-                       break;
-               case 38:
-                       testapp_test_get_totaldiskusage();
-                       break;
-               case 40:
-                       testapp_test_address_format_check_test();
-                       break;
-               case 41:
-                       testapp_test_get_max_mail_count();
-                       break;
-               case 42:
-                       testapp_test_db_test();
-                       break;
-               case 43:
-                       testapp_test_send_cancel();
-                       break;
-               case 44:
-                       testapp_test_cancel_download_body();
-                       break;
-               case 46:
-                        testapp_test_get_mail_list_for_thread_view();
-                       break;
-               case 48:
-                       testapp_test_test_get_thread_information();
-                       break;
-               case 51:
-                       testapp_test_get_mail_list();
-                       break;
-               case 52:
-                       testapp_test_get_address_info_list();
-                       break;
-               case 55:
-                       testapp_test_set_flags_field();
-                       break;
-               case 56:
-                       testapp_test_add_mail(NULL);
-                       break;
-               case 57:
-                       testapp_test_update_mail();
-                       break;
-               case 58:
-                       testapp_test_search_mail_on_server();
-                       break;
-               case 59:
-                       testapp_test_add_mail_to_search_result_box();
-                       break;
-               case 60:
-                       testapp_test_email_parse_mime_file();
-                       break;
-               case 61:
-                       testapp_test_email_write_mime_file();
-                       break;
-               case 62:
-                       testapp_test_smime_verify_signature();
-                       break;
-               case 63:
-                       testapp_test_email_add_mail_with_multiple_recipient();
-                       break;
-               case 64:
-                       testapp_test_send_mails_every_x_minutes();
-                       break;
-               case 0:
-                       go_to_loop = FALSE;
-                       break;
-               default:
-                       break;
-       }
-
-       return go_to_loop;
-}
-
-void testapp_mail_main()
-{
-       gboolean go_to_loop = TRUE;
-       int menu_number = 0;
-
-       while (go_to_loop) {
-               testapp_show_menu(EMAIL_MAIL_MENU);
-               testapp_show_prompt(EMAIL_MAIL_MENU);
-
-               if (0 >= scanf("%d", &menu_number))
-                       testapp_print("Invalid input");
-
-               go_to_loop = testapp_test_interpret_command(menu_number);
-       }
-}
-
diff --git a/utilities/test-application/testapp-mailbox.c b/utilities/test-application/testapp-mailbox.c
deleted file mode 100755 (executable)
index 7f3f3bb..0000000
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
-*  email-service
-*
-* Copyright(c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
-*
-*/
-
-
-
-/* common header */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-/* open header */
-#include <glib.h>
-
-#include "email-api-account.h"
-#include "email-api-network.h"
-#include "email-api-mailbox.h"
-
-/* internal header */
-#include "testapp-utility.h"
-#include "testapp-mailbox.h"
-
-static gboolean testapp_print_mailbox_list(email_mailbox_t *input_mailbox_list, int input_count)
-{
-       int i;
-       char time_string[40] = { 0, };
-
-       testapp_print("There are %d mailboxes\n", input_count);
-       testapp_print("============================================================================\n");
-       testapp_print("id\ta_id\talias\tunread\t total\t total_on_ server\tmailbox_type\tlast_sync_time\n");
-       testapp_print("============================================================================\n");
-       if (input_count == 0) {
-               testapp_print("No mailbox is matched\n");
-       } else {
-               for (i = 0; i < input_count; i++) {
-                       strftime(time_string, 40, "%Y-%m-%d %H:%M:%S", localtime(&(input_mailbox_list[i].last_sync_time)));
-                       testapp_print("%2d\t", input_mailbox_list[i].mailbox_id);
-                       testapp_print("%2d\t%-12s\t", input_mailbox_list[i].account_id, input_mailbox_list[i].alias);
-                       testapp_print("%3d\t%3d\t%3d\t%3d\t%s\n"
-                                       , input_mailbox_list[i].unread_count
-                                       , input_mailbox_list[i].total_mail_count_on_local
-                                       , input_mailbox_list[i].total_mail_count_on_server
-                                       , input_mailbox_list[i].mailbox_type
-                                       , time_string);
-               }
-       }
-       testapp_print("============================================================================\n");
-
-       return FALSE;
-}
-
-static gboolean testapp_test_add_mailbox()
-{
-       email_mailbox_t  mailbox;
-       int account_id, mailbox_type = 0;
-       int local_yn = 0;
-       char arg[500];
-       int ret;
-    int handle;
-
-    memset(&mailbox, 0, sizeof(email_mailbox_t));
-
-       memset(arg, 0x00, 500);
-       testapp_print("\n> Enter mailbox name: ");
-       if (0 >= scanf("%s", arg))
-               testapp_print("Invalid input. ");
-       mailbox.mailbox_name = strdup(arg);
-
-       memset(arg, 0x00, 500);
-       testapp_print("> Enter mailbox alias name: ");
-       if (0 >= scanf("%s", arg))
-               testapp_print("Invalid input. ");
-       mailbox.alias = strdup(arg);
-
-       testapp_print("> Enter account id: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-       mailbox.account_id = account_id;
-
-       testapp_print("> Enter local_yn(1/0): ");
-       if (0 >= scanf("%d", &local_yn))
-               testapp_print("Invalid input. ");
-       mailbox.local = local_yn;
-
-       testapp_print("> Enter mailbox type: ");
-       if (0 >= scanf("%d", &mailbox_type))
-               testapp_print("Invalid input. ");
-
-       mailbox.mailbox_type = mailbox_type;
-       mailbox.eas_data = strdup("EAS DATA TEST");
-       mailbox.eas_data_length = strlen(mailbox.eas_data) + 1;
-
-
-       ret = email_add_mailbox(&mailbox, local_yn ? 0 : 1, &handle);
-
-       if (ret < 0) {
-               testapp_print("\n email_add_mailbox failed");
-       } else {
-               testapp_print("\n email_add_mailbox succeed : handle[%d], mailbox_id [%d]\n", handle, mailbox.mailbox_id);
-       }
-
-       if (mailbox.eas_data)
-               free(mailbox.eas_data);
-
-       return FALSE;
-}
-
-static gboolean testapp_test_delete_mailbox()
-{
-       int mailbox_id = 0;
-       int on_server = 0;
-       int ret;
-       int handle;
-
-       testapp_print("\n> Enter mailbox id:");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input");
-
-       testapp_print("> Enter on_server(1/0): ");
-       if (0 >= scanf("%d", &on_server))
-               testapp_print("Invalid input");
-
-       ret = email_delete_mailbox(mailbox_id, on_server, &handle);
-
-       if (ret < 0) {
-               testapp_print("\n email_delete_mailbox failed");
-       } else {
-               testapp_print("\n email_delete_mailbox succeed : handle[%d]\n", handle);
-       }
-
-       return FALSE;
-
-}
-
-static gboolean testapp_test_rename_mailbox()
-{
-       testapp_print("testapp_test_rename_mailbox\n");
-       int mailbox_id;
-       char mailbox_name[500] = { 0, };
-       char mailbox_alias[500] = { 0, };
-       int err;
-       int handle = 0;
-
-       testapp_print("> Enter mailbox id: ");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input");
-
-       testapp_print("> Enter new mailbox name: ");
-       if (0 >= scanf("%s", mailbox_name))
-               testapp_print("Invalid input");
-
-       testapp_print("> Enter new mailbox name: ");
-       if (0 >= scanf("%s", mailbox_alias))
-               testapp_print("Invalid input");
-
-       if ((err = email_rename_mailbox(mailbox_id, mailbox_name, mailbox_alias, true, &handle)) < 0) {
-               testapp_print("\n email_rename_mailbox failed[%d]\n", err);
-       } else {
-               testapp_print("\n email_rename_mailbox succeed. handle [%d]\n", handle);
-       }
-
-       return FALSE;
-}
-
-static gboolean testapp_test_get_imap_mailbox_list()
-{
-       int account_id = 0;
-       int handle = 0;
-
-       testapp_print("> Enter account id: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input");
-
-       if (email_sync_imap_mailbox_list(account_id, &handle) < 0)
-               testapp_print("email_sync_imap_mailbox_list failed");
-
-       return FALSE;
-
-}
-
-static gboolean testapp_test_set_local_mailbox()
-{
-       int mailbox_id = 0;
-       int is_local_mailbox = 0;
-
-       testapp_print("> Enter mailbox id: ");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input");
-
-       testapp_print("> Enter local: ");
-       if (0 >= scanf("%d", &is_local_mailbox))
-               testapp_print("Invalid input");
-
-       if (email_set_local_mailbox(mailbox_id, is_local_mailbox) < 0)
-               testapp_print("email_set_local_mailbox failed");
-
-       return FALSE;
-}
-
-static gboolean testapp_test_delete_mailbox_ex()
-{
-       int  err = EMAIL_ERROR_NONE;
-       int  mailbox_id_count = 0 ;
-       int *mailbox_id_array = NULL;
-       int  account_id = 0;
-       int  on_server = 0;
-       int  handle = 0;
-       int  i = 0;
-
-       testapp_print("\n > Enter account_id: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input");
-
-       testapp_print("\n > Enter mailbox_id_count: ");
-       if (0 >= scanf("%d", &mailbox_id_count))
-               testapp_print("Invalid input");
-
-       testapp_print("\n > Enter on_server: ");
-       if (0 >= scanf("%d", &on_server))
-               testapp_print("Invalid input");
-
-       mailbox_id_count = (mailbox_id_count < 5000) ? mailbox_id_count : 5000;
-
-       if (mailbox_id_count > 0) {
-               mailbox_id_array = malloc(sizeof(int) * mailbox_id_count);
-       }
-
-       for (i = 0; i < mailbox_id_count; i++) {
-               testapp_print("\n > Enter mailbox id: ");
-               if (0 >= scanf("%d", (mailbox_id_array + i)))
-                       testapp_print("Invalid input");
-       }
-
-       err = email_delete_mailbox_ex(account_id, mailbox_id_array, mailbox_id_count, on_server, &handle);
-
-       testapp_print("\nemail_delete_mailbox_ex returns [%d], handle [%d] \n", err, handle);
-
-       if (mailbox_id_array)
-               free(mailbox_id_array);
-       return 0;
-}
-
-static gboolean testapp_test_get_mailbox_by_type()
-{
-       int account_id = 0;
-       int err_code = EMAIL_ERROR_NONE;
-       email_mailbox_t *mailbox = NULL;
-       email_mailbox_type_e mailbox_type = 0;
-
-       testapp_print("\n > Enter account id: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input");
-
-       testapp_print("\n > Enter mailbox_type: ");
-       if (0 >= scanf("%d", (int*)&mailbox_type))
-               testapp_print("Invalid input");
-
-       if ((err_code = email_get_mailbox_by_mailbox_type(account_id, mailbox_type, &mailbox)) < 0) {
-               testapp_print("email_get_mailbox_by_mailbox_type error : %d\n", err_code);
-               return false ;
-       }
-
-       testapp_print_mailbox_list(mailbox, 1);
-
-       email_free_mailbox(&mailbox, 1);
-       return FALSE;
-}
-
-static gboolean testapp_test_set_mailbox_type()
-{
-       int  mailbox_id = 0;
-       int  mailbox_type = 0;
-       int  err_code = EMAIL_ERROR_NONE;
-
-       testapp_print("\n > Enter mailbox id : ");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input");
-
-       testapp_print("\n > Enter mailbox type : ");
-       if (0 >= scanf("%d", &mailbox_type))
-               testapp_print("Invalid input");
-
-       if ((err_code = email_set_mailbox_type(mailbox_id, mailbox_type)) != EMAIL_ERROR_NONE) {
-               testapp_print("\nemail_set_mailbox_type error : %d\n", err_code);
-       }
-
-       return FALSE;
-}
-
-static gboolean testapp_test_set_mail_slot_size()
-{
-       int account_id = 0;
-       int mailbox_id = 0;
-       int mail_slot_size = 0;
-       int err_code = EMAIL_ERROR_NONE;
-
-       testapp_print("\n > Enter account id(0: All account): ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input");
-
-       testapp_print("\n> Enter mailbox id(0 : All mailboxes):");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input");
-
-       testapp_print("\n > Enter mailbox slot size: ");
-       if (0 >= scanf("%d", &mail_slot_size))
-               testapp_print("Invalid input");
-
-       if ((err_code = email_set_mail_slot_size(account_id, mailbox_id, mail_slot_size)) < 0) {
-               testapp_print("   testapp_test_set_mail_slot_size error : %d\n", err_code);
-               return false ;
-       }
-
-       return FALSE;
-}
-
-static gboolean testapp_test_get_mailbox_list()
-{
-       int account_id = 0;
-       int mailbox_sync_type;
-       int count = 0;
-       int error_code = EMAIL_ERROR_NONE;
-       email_mailbox_t *mailbox_list = NULL;
-       testapp_print("\n > Enter account id: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input");
-       testapp_print("\n > Enter mailbox_sync_type\n[-1 :for all mailboxes, 0 : for mailboxes from server, 1 : local mailboxes\n : ");
-       if (0 >= scanf("%d", &mailbox_sync_type))
-               testapp_print("Invalid input");
-
-       if ((error_code = email_get_mailbox_list(account_id, mailbox_sync_type, &mailbox_list, &count)) < 0) {
-               testapp_print("   email_get_mailbox_list error %d\n", error_code);
-               return false ;
-       }
-
-       testapp_print_mailbox_list(mailbox_list, count);
-
-       email_free_mailbox(&mailbox_list, count);
-
-       if ((error_code = email_get_mailbox_list_ex(account_id, mailbox_sync_type, 1, &mailbox_list, &count)) < 0) {
-               testapp_print("   email_get_mailbox_list_ex error %d\n", error_code);
-               return false ;
-       }
-
-       testapp_print_mailbox_list(mailbox_list, count);
-
-       email_free_mailbox(&mailbox_list, count);
-       return FALSE;
-}
-
-static gboolean testapp_test_get_mailbox_list_by_keyword()
-{
-       int account_id = 0;
-       int count = 0;
-       char keyword[500] = { 0, };
-       int error_code = EMAIL_ERROR_NONE;
-       email_mailbox_t *mailbox_list = NULL;
-       testapp_print("\n > Enter account id: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input");
-
-       testapp_print("> Enter keyword: ");
-       if (0 >= scanf("%s", keyword))
-               testapp_print("Invalid input");
-
-       if ((error_code = email_get_mailbox_list_by_keyword(account_id, keyword, &mailbox_list, &count)) < 0) {
-               testapp_print("   email_get_mailbox_list_by_keyword error %d\n", error_code);
-               return false ;
-       }
-
-       testapp_print_mailbox_list(mailbox_list, count);
-
-       email_free_mailbox(&mailbox_list, count);
-
-       return FALSE;
-}
-
-
-static gboolean testapp_test_sync_mailbox()
-{
-       int account_id = 0;
-       int handle = 0;
-       int mailbox_id = 0;
-
-       testapp_print("\n > Enter Account id(0: for all account) : ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input");
-
-       testapp_print("\n > Enter Mailbox id(0: for all mailboxes) : ");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input");
-
-       if (account_id == ALL_ACCOUNT) {
-               if (email_sync_header_for_all_account(&handle) < 0)
-                       testapp_print("\n email_sync_header_for_all_account failed\n");
-               else
-                       testapp_print("\n email_sync_header_for_all_account success. Handle[%d]\n", handle);
-       } else {
-               if (email_sync_header(account_id, mailbox_id, &handle) < 0)
-                       testapp_print("\n email_sync_header failed\n");
-               else
-                       testapp_print("\n email_sync_header success. Handle[%d]\n", handle);
-       }
-
-       return FALSE;
-}
-
-static gboolean testapp_test_stamp_sync_time()
-{
-       int input_mailbox_id = 0;
-
-       testapp_print("\n > Enter Mailbox id : ");
-       if (0 >= scanf("%d", &input_mailbox_id))
-               testapp_print("Invalid input");
-
-       email_stamp_sync_time_of_mailbox(input_mailbox_id);
-
-       return FALSE;
-}
-
-static gboolean testapp_test_rename_mailbox_ex()
-{
-       testapp_print("testapp_test_rename_mailbox_ex\n");
-       int mailbox_id;
-       char mailbox_name[500] = { 0, };
-       char mailbox_alias[500] = { 0, };
-       char eas_data[500] = "OK. Done";
-       int err;
-       int handle = 0;
-
-       testapp_print("> Enter mailbox id: ");
-       if (0 >= scanf("%d", &mailbox_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("> Enter new mailbox name: ");
-       if (0 >= scanf("%s", mailbox_name))
-               testapp_print("Invalid input. ");
-
-       testapp_print("> Enter new mailbox alias: ");
-       if (0 >= scanf("%s", mailbox_alias))
-               testapp_print("Invalid input. ");
-
-       if ((err = email_rename_mailbox_ex(mailbox_id, mailbox_name, mailbox_alias, eas_data, strlen(eas_data), false, &handle)) < 0) {
-               testapp_print("\n email_rename_mailbox failed[%d]\n", err);
-       } else {
-               testapp_print("\n email_rename_mailbox succeed\n");
-       }
-       return FALSE;
-}
-
-static gboolean testapp_test_interpret_command(int menu_number)
-{
-       gboolean go_to_loop = TRUE;
-
-       switch (menu_number) {
-               case 1:
-                       testapp_test_add_mailbox();
-                       break;
-
-               case 2:
-                       testapp_test_delete_mailbox();
-                       break;
-
-               case 3:
-                       testapp_test_rename_mailbox();
-                       break;
-
-               case 4:
-                       testapp_test_get_imap_mailbox_list();
-                       break;
-
-               case 5:
-                       testapp_test_set_local_mailbox();
-                       break;
-
-               case 6:
-                       testapp_test_delete_mailbox_ex();
-                       break;
-
-               case 7:
-                       testapp_test_get_mailbox_by_type();
-                       break;
-
-               case 8:
-                       testapp_test_set_mailbox_type();
-                       break;
-
-               case 9:
-                       testapp_test_set_mail_slot_size();
-                       break;
-
-               case 10:
-                       testapp_test_get_mailbox_list();
-                       break;
-
-               case 11:
-                       testapp_test_sync_mailbox();
-                       break;
-
-               case 12:
-                       testapp_test_stamp_sync_time();
-                       break;
-
-               case 13:
-                       testapp_test_rename_mailbox_ex();
-                       break;
-
-               case 14:
-                       testapp_test_get_mailbox_list_by_keyword();
-                       break;
-
-               case 0:
-                       go_to_loop = FALSE;
-                       break;
-               default:
-                       break;
-       }
-
-       return go_to_loop;
-}
-
-void email_test_mailbox_main()
-{
-       gboolean go_to_loop = TRUE;
-       int menu_number = 0;
-
-       while (go_to_loop) {
-               testapp_show_menu(EMAIL_MAILBOX_MENU);
-               testapp_show_prompt(EMAIL_MAILBOX_MENU);
-
-               if (0 >= scanf("%d", &menu_number))
-                       testapp_print("Invalid input. ");
-
-               go_to_loop = testapp_test_interpret_command(menu_number);
-       }
-}
-
diff --git a/utilities/test-application/testapp-others.c b/utilities/test-application/testapp-others.c
deleted file mode 100755 (executable)
index 2db9c83..0000000
+++ /dev/null
@@ -1,498 +0,0 @@
-/*
-*  email-service
-*
-* Copyright(c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
-*
-*/
-
-
-/* common header */
-#include <stdio.h>
-#include <string.h>
-
-/* open header */
-#include <glib.h>
-#include <dlfcn.h>
-#include <vconf.h>
-#include "c-client.h"
-
-
-#include "email-api.h"
-#include "email-api-account.h"
-#include "email-api-network.h"
-
-
-/* internal header */
-#include "testapp-utility.h"
-#include "testapp-others.h"
-#include "email-ipc.h"
-#include "email-core-utils.h"
-
-static gboolean testapp_test_ping_service()
-{
-       if (email_ping_service() < 0)
-               testapp_print("email_ping_service failed..!");
-
-       return FALSE;
-}
-
-static gboolean testapp_test_cancel_job()
-{
-       int account_id = 0;
-       int handle = 0;
-
-       testapp_print("\n > Enter account_id(0: all account): ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter handle: ");
-       if (0 >= scanf("%d", &handle))
-               testapp_print("Invalid input. ");
-
-       if (email_cancel_job(account_id, handle, EMAIL_CANCELED_BY_USER) < 0)
-               testapp_print("email_cancel_job failed..!");
-       return FALSE;
-}
-
-static gboolean testapp_test_init_storage()
-{
-       if (email_init_storage() < 0)
-               testapp_print("email_init_storaege failed..!");
-
-       return FALSE;
-}
-
-static gboolean testapp_test_set_dnet_proper_profile_type()
-{
-       testapp_print("NOT Support\n");
-
-       return TRUE;
-}
-
-static gboolean testapp_test_get_dnet_proper_profile_type()
-{
-       testapp_print("NOT Support\n");
-
-       return TRUE;
-}
-
-static gboolean testapp_test_get_preview_text_from_file()
-{
-       char *preview_buffer = NULL;
-       char  html_file_path[1024] = { 0, };
-
-       testapp_print("\n > Enter file path : ");
-       if (0 >= scanf("%s", html_file_path))
-               testapp_print("Invalid input. ");
-
-       emcore_get_preview_text_from_file(NULL, NULL, html_file_path, 1024, &preview_buffer);
-
-       testapp_print("\n result :\n %s ", preview_buffer);
-
-       return TRUE;
-}
-
-static gboolean testapp_test_get_task_information()
-{
-       int i = 0;
-       int err = EMAIL_ERROR_NONE;
-       int task_information_count = 0;
-       email_task_information_t *task_information_array = NULL;
-
-
-       err = email_get_task_information(&task_information_array, &task_information_count);
-
-       testapp_print("\n======================================================================\n");
-       for (i = 0; i < task_information_count; i++)
-               testapp_print("type[%d], account_id[%d], handle[%d], status[%d] nth[%d] progress[%d] mail_id[%d]", task_information_array[i].type, task_information_array[i].account_id, task_information_array[i].handle, task_information_array[i].status,(int)task_information_array[i].task_data2, (int)task_information_array[i].task_data3, task_information_array[i].task_data1 );
-       testapp_print("\n======================================================================\n");
-
-       testapp_print("testapp_test_get_task_information  ..........End\n");
-
-       return err;
-}
-
-static gboolean testapp_test_create_db_full()
-{
-       int err;
-
-       err = email_create_db_full();
-
-       testapp_print("testapp_test_create_db_full returns [%d]", err);
-
-       return err;
-}
-
-static int encode_base64(char *src, unsigned long src_len, char **enc, unsigned long* enc_len, int *err_code)
-{
-       unsigned char *content = NULL;
-       int ret = true;
-       int err = EMAIL_ERROR_NONE;
-
-       if (err_code != NULL) {
-               *err_code = EMAIL_ERROR_NONE;
-       }
-
-       content = rfc822_binary(src, src_len, enc_len);
-
-       if (content)
-               *enc = (char *)content;
-       else {
-               err = EMAIL_ERROR_UNKNOWN;
-               ret = false;
-       }
-
-       if (err_code)
-           *err_code = err;
-
-       return ret;
-}
-
-
-static gboolean testapp_test_encoding_test()
-{
-       int error = EMAIL_ERROR_NONE;
-       int has_special_character = 0, base64_file_name_length = 0, i;
-       gsize bytes_read, bytes_written;
-       char *encoded_file_name = NULL, *base64_file_name = NULL;
-       SIZEDTEXT source_text;
-       GError *glib_error = NULL;
-       CHARSET *result_charset = NULL;
-       char filename[] = {0xEB, 0xB0, 0x94, 0xED, 0x83, 0x95, 0x32, 0x2E, 0x70, 0x6E, 0x67, 0x00}; /* UTF-8 */
-
-       source_text.data = (unsigned char*)filename;
-       source_text.size = strlen(filename);
-
-       result_charset = (CHARSET*)utf8_infercharset(&source_text);
-
-       if (result_charset) {
-               testapp_print("return_charset->name [%s]", result_charset->name);
-               encoded_file_name = (char*)g_convert(filename, -1, "UTF-8", result_charset->name, &bytes_read, &bytes_written, &glib_error);
-       } else {
-               i = 0;
-               while (filename[i++] & 0x80)
-                       has_special_character = 1;
-               testapp_print("has_special_character [%d]", has_special_character);
-               if (has_special_character)
-                       encoded_file_name = (char*)g_convert(filename, -1, "UTF-8", "EUC-KR", &bytes_read, &bytes_written, &glib_error);
-       }
-
-       if (encoded_file_name == NULL)
-               encoded_file_name = strdup(filename);
-
-       testapp_print("encoded_file_name [%s]", encoded_file_name);
-
-       if (!encode_base64(encoded_file_name, strlen(encoded_file_name), &base64_file_name, (unsigned long*)&base64_file_name_length, &error)) {
-               testapp_print("encode_base64 failed. error [%d]", error);
-               goto FINISH_OFF;
-       }
-
-       testapp_print("base64_file_name [%s]", base64_file_name);
-
-       if (base64_file_name) {
-               free(encoded_file_name);
-               encoded_file_name = malloc(strlen(base64_file_name) + 15);
-               if (!encoded_file_name) {
-                       testapp_print("em_malloc failed.");
-                       goto FINISH_OFF;
-               }
-               snprintf(encoded_file_name, strlen(base64_file_name) + 15, "=?UTF-8?B?%s?=", base64_file_name);
-               testapp_print("encoded_file_name [%s]", encoded_file_name);
-       }
-FINISH_OFF:
-
-       if (encoded_file_name)
-               free(encoded_file_name);
-
-       if (base64_file_name)
-               free(base64_file_name);
-
-       return error;
-}
-
-#define LIB_EMAIL_SERVICE_PATH "/usr/lib/libemail-api.so"
-
-int(*Datastore_FI_EMTB)(char **);
-int(*Datastore_FI_EMSB)(char **);
-int(*Datastore_FI_EMOB)(char **);
-int(*Datastore_FI_EMDR)(char **);
-int(*Datastore_FI_EMMF)(char **);
-int(*Datastore_FI_EMTR)(char **);
-int(*Datastore_FI_EMSP)(char **);
-
-static gboolean email_test_dtt_Datastore_FI()
-{
-       void *handle = NULL;
-       char *dl_error = NULL, *output_str = NULL;
-
-       handle = dlopen(LIB_EMAIL_SERVICE_PATH, RTLD_LAZY | RTLD_GLOBAL);
-       if (!handle) {
-               dl_error = dlerror();
-               if (dl_error)
-                       testapp_print("\t dlopen error : Open Library with absolute path return  :  %s\n", dl_error);
-               return false;
-       }
-
-       Datastore_FI_EMTB = dlsym(handle, "Datastore_FI_EMTB");
-       Datastore_FI_EMSB = dlsym(handle, "Datastore_FI_EMSB");
-       Datastore_FI_EMOB = dlsym(handle, "Datastore_FI_EMOB");
-       Datastore_FI_EMDR = dlsym(handle, "Datastore_FI_EMDR");
-       Datastore_FI_EMMF = dlsym(handle, "Datastore_FI_EMMF");
-       Datastore_FI_EMTR = dlsym(handle, "Datastore_FI_EMTR");
-       Datastore_FI_EMSP = dlsym(handle, "Datastore_FI_EMSP");
-
-       Datastore_FI_EMTB(&output_str);
-
-       testapp_print("\nemail_test_dtt_Datastore_FI\n%s\n", output_str);
-
-       if (output_str)
-               free(output_str);
-
-       if (handle) {
-               dlclose(handle);
-               dl_error = dlerror();
-               if (dl_error)
-                       testapp_print("\t Close handle return  :  %s\n", dl_error);
-       }
-
-       return true;
-}
-
-int(*Datastore_R_EMTB)(char **);
-int(*Datastore_R_EMSB)(char **);
-int(*Datastore_R_EMOB)(char **);
-int(*Datastore_R_EMDR)(char **);
-int(*Datastore_R_EMMF)(char **);
-int(*Datastore_R_EMTR)(char **);
-int(*Datastore_R_EMSP)(char **);
-
-
-static gboolean email_test_dtt_Datastore_R()
-{
-       void *handle = NULL;
-       char *dl_error = NULL, *output_str = NULL;
-
-       handle = dlopen(LIB_EMAIL_SERVICE_PATH, RTLD_LAZY | RTLD_GLOBAL);
-       if (!handle) {
-               dl_error = dlerror();
-               if (dl_error)
-                       testapp_print("\t dlopen error : Open Library with absolute path return  :  %s\n", dl_error);
-               return false;
-       }
-
-       Datastore_R_EMTB = dlsym(handle, "Datastore_R_EMTB");
-       Datastore_R_EMSB = dlsym(handle, "Datastore_R_EMSB");
-       Datastore_R_EMOB = dlsym(handle, "Datastore_R_EMOB");
-       Datastore_R_EMDR = dlsym(handle, "Datastore_R_EMDR");
-       Datastore_R_EMMF = dlsym(handle, "Datastore_R_EMMF");
-       Datastore_R_EMTR = dlsym(handle, "Datastore_R_EMTR");
-       Datastore_R_EMSP = dlsym(handle, "Datastore_R_EMSP");
-
-       Datastore_R_EMTB(&output_str);
-
-       testapp_print("\nemail_test_dtt_Datastore_R\n%s\n", output_str);
-
-       if (output_str)
-               free(output_str);
-
-       if (handle) {
-               dlclose(handle);
-               dl_error = dlerror();
-               if (dl_error)
-                       testapp_print("\t Close handle return  :  %s\n", dl_error);
-       }
-
-       return true;
-}
-
-int(*Datastore_C_EMTB)(char **);
-int(*Datastore_C_EMSB)(char **);
-int(*Datastore_C_EMOB)(char **);
-int(*Datastore_C_EMDR)(char **);
-int(*Datastore_C_EMMF)(char **);
-int(*Datastore_C_EMTR)(char **);
-int(*Datastore_C_EMSP)(char **);
-
-static gboolean email_test_dtt_Datastore_C()
-{
-       void *handle = NULL;
-       char *dl_error = NULL, *output_str = NULL;
-
-       handle = dlopen(LIB_EMAIL_SERVICE_PATH, RTLD_LAZY | RTLD_GLOBAL);
-       if (!handle) {
-               dl_error = dlerror();
-               if (dl_error)
-                       testapp_print("\t dlopen error : Open Library with absolute path return  :  %s\n", dl_error);
-               return false;
-       }
-
-       Datastore_C_EMTB = dlsym(handle, "Datastore_C_EMTB");
-       Datastore_C_EMSB = dlsym(handle, "Datastore_C_EMSB");
-       Datastore_C_EMOB = dlsym(handle, "Datastore_C_EMOB");
-       Datastore_C_EMDR = dlsym(handle, "Datastore_C_EMDR");
-       Datastore_C_EMMF = dlsym(handle, "Datastore_C_EMMF");
-       Datastore_C_EMTR = dlsym(handle, "Datastore_C_EMTR");
-       Datastore_C_EMSP = dlsym(handle, "Datastore_C_EMSP");
-
-       Datastore_C_EMTB(&output_str);
-
-
-       testapp_print("\nemail_test_dtt_Datastore_C\n%s\n", output_str);
-
-       if (output_str)
-               free(output_str);
-
-       if (handle) {
-               dlclose(handle);
-               dl_error = dlerror();
-               if (dl_error)
-                       testapp_print("\t Close handle return  :  %s\n", dl_error);
-       }
-
-       return true;
-}
-
-static gboolean testapp_test_show_user_message()
-{
-       int mail_id;
-
-       testapp_print("\n > Enter mail id : ");
-       if (0 >= scanf("%d", &mail_id))
-               testapp_print("Invalid input. ");
-
-       email_show_user_message(mail_id, EMAIL_ACTION_SEND_MAIL, EMAIL_ERROR_NETWORK_NOT_AVAILABLE);
-       return FALSE;
-}
-
-static gboolean testapp_test_get_mime_entity()
-{
-       char mime_path[512] = {0, };
-       char *mime_entity = NULL;
-
-       testapp_print("\n > Enter mime path for parsing : ");
-       if (0 >= scanf("%s", mime_path))
-               testapp_print("Invalid input. ");
-
-       email_get_mime_entity(mime_path, &mime_entity);
-
-       testapp_print("\nmime_entity = %s\n", mime_entity);
-       return true;
-}
-
-static gboolean testapp_test_query_smtp_mail_size_limit()
-{
-       int account_id = 0;
-       testapp_print("\n > Enter account id : ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-
-       email_query_smtp_mail_size_limit(account_id, NULL);
-       return true;
-}
-
-static gboolean testapp_test_verify_email_address()
-{
-       int err = EMAIL_ERROR_NONE;
-       char email_address[512] = {0, };
-
-       testapp_print("\n > Enter mime path for parsing : ");
-       if (0 >= scanf("%s", email_address))
-               testapp_print("Invalid input. ");
-
-       err = email_verify_email_address(email_address);
-
-       testapp_print("\nemail_verify_email_address returns [%d]\n", err);
-       return true;
-}
-
-
-
-static gboolean testapp_test_interpret_command(int menu_number)
-{
-       gboolean go_to_loop = TRUE;
-
-       switch (menu_number) {
-               case 1:
-                       testapp_test_ping_service();
-                       break;
-               case 2:
-                       testapp_test_init_storage();
-                       break;
-               case 3:
-                       testapp_test_cancel_job();
-                       break;
-               case 5:
-                       testapp_test_set_dnet_proper_profile_type();
-                       break;
-               case 6:
-                       testapp_test_get_dnet_proper_profile_type();
-                       break;
-               case 7:
-                       testapp_test_get_preview_text_from_file();
-                       break;
-               case 11:
-                       testapp_test_get_task_information();
-                       break;
-               case 12:
-                       testapp_test_create_db_full();
-                       break;
-               case 13:
-                       testapp_test_encoding_test();
-                       break;
-               case 14:
-                       email_test_dtt_Datastore_FI();
-                       email_test_dtt_Datastore_C();
-                       email_test_dtt_Datastore_R();
-                       break;
-               case 15:
-                       testapp_test_show_user_message();
-                       break;
-               case 16:
-                       testapp_test_get_mime_entity();
-                       break;
-               case 17:
-                       testapp_test_query_smtp_mail_size_limit();
-                       break;
-               case 18:
-                       testapp_test_verify_email_address();
-                       break;
-               case 0:
-                       go_to_loop = FALSE;
-                       break;
-               default:
-                       break;
-       }
-
-       return go_to_loop;
-}
-
-void testapp_others_main()
-{
-       gboolean go_to_loop = TRUE;
-       int menu_number = 0;
-
-       while (go_to_loop) {
-               testapp_show_menu(EMAIL_OTHERS_MENU);
-               testapp_show_prompt(EMAIL_OTHERS_MENU);
-
-               if (0 >= scanf("%d", &menu_number))
-                       testapp_print("Invalid input. ");
-
-               go_to_loop = testapp_test_interpret_command(menu_number);
-       }
-}
-
diff --git a/utilities/test-application/testapp-rule.c b/utilities/test-application/testapp-rule.c
deleted file mode 100755 (executable)
index 54bcc37..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
-*
-*/
-
-
-
-/* common header */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-
-/* open header */
-#include <glib.h>
-
-#include "email-api-rule.h"
-
-/* internal header */
-#include "testapp-utility.h"
-#include "testapp-mailbox.h"
-
-static gboolean testapp_test_add_rule()
-{
-       email_rule_t*  rule = NULL;
-       int account_id = 0;
-       int target_mailbox_id = 0;
-       int action = 0;
-       int type = 0;
-       int flag = 0;
-       char arg[500];
-
-       rule = malloc(sizeof(email_rule_t));
-       testapp_print("> Enter account id: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-       rule->account_id = account_id;
-
-       testapp_print("> Enter Type(FROM - 1 / SUBJECT - 2): ");
-       if (0 >= scanf("%d", &type))
-               testapp_print("Invalid input. ");
-       rule->type = type;
-
-       memset(arg, 0x00, 500);
-       testapp_print("\n> Enter Filtering Value:");
-       if (0 >= scanf("%s", arg))
-               testapp_print("Invalid input. ");
-       rule->value = strdup(arg);
-
-       testapp_print("> Enter Action(MOVE - 1, BLOCK - 2, DELETE - 3): ");
-       if (0 >= scanf("%d", &action))
-               testapp_print("Invalid input. ");
-       rule->faction = action;
-
-       if (action == 1) {
-               testapp_print("\n> Enter target mailbox id:");
-               if (0 >= scanf("%d", &target_mailbox_id))
-                       testapp_print("Invalid input. ");
-               rule->target_mailbox_id = target_mailbox_id;
-       }
-
-       testapp_print("> Enter Flag1 value [On/Off]: ");
-       if (0 >= scanf("%d", &flag))
-               testapp_print("Invalid input. ");
-       rule->flag1 = flag;
-
-       testapp_print("> Enter Flag2 value [0:Exactly same as, 1:Include, 2:Compare Domain] : ");
-       if (0 >= scanf("%d", &flag))
-               testapp_print("Invalid input. ");
-       rule->flag2 = flag;
-
-       if (email_add_rule(rule) < 0)
-               testapp_print("\n email_add_rule failed");
-
-       testapp_print("ID of rule : [%d]\n", rule->filter_id);
-
-       if (email_apply_rule(rule->filter_id) != EMAIL_ERROR_NONE)
-               testapp_print("email_apply_rule failed\n");
-
-       email_free_rule(&rule, 1);
-
-       return FALSE;
-}
-
-static gboolean testapp_test_delete_rule()
-{
-       int filter_id = 0;
-
-       testapp_print("> Enter filter id: ");
-       if (0 >= scanf("%d", &filter_id))
-               testapp_print("Invalid input. ");
-
-       if (email_delete_rule(filter_id) < 0)
-               testapp_print("email_delete_rule failed..! ");
-
-       return FALSE;
-}
-
-
-static gboolean testapp_test_update_rule()
-{
-       email_rule_t*  rule = NULL;
-       int account_id = 0;
-       int target_mailbox_id = 0;
-       int action = 0;
-       int type = 0;
-       int flag = 0;
-       char arg[500];
-       int filter_id = 0;
-
-       rule = malloc(sizeof(email_rule_t));
-       memset(rule, 0X00, sizeof(email_rule_t));
-       testapp_print("> Enter filter id: ");
-       if (0 >= scanf("%d", &filter_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("> Enter account id: ");
-       if (0 >= scanf("%d", &account_id))
-               testapp_print("Invalid input. ");
-       rule->account_id = account_id;
-
-       testapp_print("> Enter Type(FROM - 1 / SUBJECT - 2): ");
-       if (0 >= scanf("%d", &type))
-               testapp_print("Invalid input. ");
-       rule->type = type;
-
-       memset(arg, 0x00, 500);
-       testapp_print("\n> Enter Filtering Value:");
-       if (0 >= scanf("%s", arg))
-               testapp_print("Invalid input. ");
-       rule->value = strdup(arg);
-
-       testapp_print("> Enter Action(MOVE - 1, BLOCK - 2, DELETE - 3): ");
-       if (0 >= scanf("%d", &action))
-               testapp_print("Invalid input. ");
-       rule->faction = action;
-
-       if (action == 1) {
-               testapp_print("\n> Enter target mailbox id:");
-               if (0 >= scanf("%d", &target_mailbox_id))
-                       testapp_print("Invalid input. ");
-               rule->target_mailbox_id = target_mailbox_id;
-       }
-
-       testapp_print("> Enter Flag1 value: ");
-       if (0 >= scanf("%d", &flag))
-               testapp_print("Invalid input. ");
-       rule->flag1 = flag;
-
-       testapp_print("> Enter Flag2 value: ");
-       if (0 >= scanf("%d", &flag))
-               testapp_print("Invalid input. ");
-       rule->flag2 = flag;
-
-       if (!email_update_rule(filter_id, rule) < 0)
-               testapp_print("email_update_rule failed..! ");
-
-       email_free_rule(&rule, 1);
-
-       return FALSE;
-}
-
-
-static gboolean testapp_test_get_rule(void)
-{
-       email_rule_t*  rule = NULL;
-       int filter_id = 0;
-
-       testapp_print("> Enter filter id: ");
-       if (0 >= scanf("%d", &filter_id))
-               testapp_print("Invalid input. ");
-
-       if (email_get_rule(filter_id, &rule) >= 0)
-               testapp_print("\n Got rule of account_id = %d and type = %d\n", rule->account_id, rule->type);
-
-       email_free_rule(&rule, 1);
-
-       return FALSE;
-
-}
-
-static gboolean testapp_test_get_rule_list(void)
-{
-       int count, i;
-       email_rule_t* rule_list = NULL;
-
-       if (email_get_rule_list(&rule_list, &count) < 0) {
-               testapp_print("   email_get_rule_list error\n");
-               return false ;
-       }
-
-       for (i = 0; i < count; i++) {
-               testapp_print("   %2d) Fileter_Id: %d | Account_id: %d  | Type: %d | Value %s \n", i + 1,
-                       rule_list[i].filter_id,
-                       rule_list[i].account_id,
-                       rule_list[i].type,
-                       rule_list[i].value);
-       }
-
-       email_free_rule(&rule_list, count);
-       return FALSE;
-
-}
-
-
-
-static gboolean testapp_test_interpret_command(int menu_number)
-{
-       gboolean go_to_loop = TRUE;
-
-       switch (menu_number) {
-               case 1:
-                       testapp_test_add_rule();
-                       break;
-               case 2:
-                       testapp_test_delete_rule();
-                       break;
-               case 3:
-                       testapp_test_update_rule();
-                       break;
-               case 5:
-                       testapp_test_get_rule();
-                       break;
-               case 6:
-                       testapp_test_get_rule_list();
-                       break;
-
-               case 0:
-                       go_to_loop = FALSE;
-                       break;
-               default:
-                       break;
-       }
-
-       return go_to_loop;
-}
-
-void email_test_rule_main()
-{
-       gboolean go_to_loop = TRUE;
-       int menu_number = 0;
-
-       while (go_to_loop) {
-               testapp_show_menu(EMAIL_RULE_MENU);
-               testapp_show_prompt(EMAIL_RULE_MENU);
-
-               if (0 >= scanf("%d", &menu_number))
-                       testapp_print("Invalid input. ");
-
-               go_to_loop = testapp_test_interpret_command(menu_number);
-       }
-}
-
diff --git a/utilities/test-application/testapp-thread.c b/utilities/test-application/testapp-thread.c
deleted file mode 100755 (executable)
index f41b0e3..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
-*
-*/
-
-
-
-/* common header */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-
-/* open header */
-#include <glib.h>
-
-#include "email-api-account.h"
-#include "email-api-mail.h"
-
-/* internal header */
-#include "testapp-utility.h"
-#include "testapp-thread.h"
-
-static gboolean testapp_test_move_thread()
-{
-       int thread_id, move_always_flag;
-       int target_mailbox_id;
-
-       testapp_print("\n > Enter thread_id: ");
-       if (0 >= scanf("%d", &thread_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter target_mailbox_id: ");
-       if (0 >= scanf("%d", &target_mailbox_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter move_always_flag: ");
-       if (0 >= scanf("%d", &move_always_flag))
-               testapp_print("Invalid input. ");
-
-       email_move_thread_to_mailbox(thread_id, target_mailbox_id, move_always_flag);
-
-       return FALSE;
-}
-
-static gboolean testapp_test_delete_thread()
-{
-       int thread_id, delete_always_flag;
-
-       testapp_print("\n > Enter thread_id: ");
-       if (0 >= scanf("%d", &thread_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter delete_always_flag: ");
-       if (0 >= scanf("%d", &delete_always_flag))
-               testapp_print("Invalid input. ");
-
-       email_delete_thread(thread_id, delete_always_flag);
-
-       return FALSE;
-}
-
-static gboolean testapp_test_set_seen_flag_of_thread()
-{
-       int thread_id, seen_flag, on_server;
-
-       testapp_print("\n > Enter thread_id: ");
-       if (0 >= scanf("%d", &thread_id))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter seen_flag: ");
-       if (0 >= scanf("%d", &seen_flag))
-               testapp_print("Invalid input. ");
-
-       testapp_print("\n > Enter on_server: ");
-       if (0 >= scanf("%d", &on_server))
-               testapp_print("Invalid input. ");
-
-       email_modify_seen_flag_of_thread(thread_id, seen_flag, on_server);
-
-       return FALSE;
-}
-
-static gboolean testapp_test_interpret_command(int menu_number)
-{
-       gboolean go_to_loop = TRUE;
-
-       switch (menu_number) {
-               case 1:
-                       testapp_test_move_thread();
-                       break;
-
-               case 2:
-                       testapp_test_delete_thread();
-                       break;
-
-               case 3:
-                       testapp_test_set_seen_flag_of_thread();
-                       break;
-
-               case 0:
-                       go_to_loop = FALSE;
-                       break;
-               default:
-                       break;
-       }
-
-       return go_to_loop;
-}
-
-void testapp_thread_main()
-{
-       gboolean go_to_loop = TRUE;
-       int menu_number = 0;
-
-       while (go_to_loop) {
-               testapp_show_menu(EMAIL_THREAD_MENU);
-               testapp_show_prompt(EMAIL_THREAD_MENU);
-
-               if (0 >= scanf("%d", &menu_number))
-                       testapp_print("Invalid input. ");
-
-               go_to_loop = testapp_test_interpret_command(menu_number);
-       }
-}
diff --git a/utilities/test-application/testapp-utility.c b/utilities/test-application/testapp-utility.c
deleted file mode 100755 (executable)
index 985bc29..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
-*  email-service
-*
-* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@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.
-*
-*/
-
-
-
-/* common header */
-#include <stdarg.h>
-#include <string.h>
-
-/* open header */
-#include <glib.h>
-#include <glib/gprintf.h>
-
-/* internal header */
-#include "testapp-utility.h"
-
-/* internal data struct */
-
-void testapp_print(char *fmt, ...)
-{
-       va_list args = {0};
-       va_start(args, fmt);
-       vfprintf(stdout, fmt, args);
-       va_end(args);
-       fflush(stdout);
-}
-
-void testapp_show_menu(eEMAIL_MENU menu)
-{
-       switch (menu) {
-               case EMAIL_MAIN_MENU:
-                       testapp_print("==========================================\n");
-                       testapp_print("    Email test application \n");
-                       testapp_print("==========================================\n");
-                       testapp_print("1. Account Test\n");
-                       testapp_print("2. Mail Test\n");
-                       testapp_print("3. Mailbox Test\n");
-                       testapp_print("5. Rule Test\n");
-                       testapp_print("6. Thread Test\n");
-                       testapp_print("7. Others\n");
-                       testapp_print("8. Gmime test\n");
-                       testapp_print("0. Exit \n");
-                       testapp_print("------------------------------------------\n");
-                       break;
-
-               case EMAIL_ACCOUNT_MENU:
-                       testapp_print("==========================================\n");
-                       testapp_print("    ACCOUNT MENU \n");
-                       testapp_print("==========================================\n");
-                       testapp_print(" 1.  Add account with validation\n");
-                       testapp_print(" 2.  Update account\n");
-                       testapp_print(" 3.  Delete account\n");
-                       testapp_print(" 4.  Get account\n");
-                       testapp_print(" 5.  Get account list\n");
-                       testapp_print(" 6.  Update check interval\n");
-                       testapp_print(" 7.  Validate account\n");
-                       testapp_print(" 8.  Cancel validate Account\n");
-                       testapp_print(" 9.  Backup All accounts\n");
-                       testapp_print(" 10. Restore accounts\n");
-                       testapp_print(" 11. Get password length of account\n");
-                       testapp_print(" 13. Update notifications\n");
-                       testapp_print(" 14. Clear notifications\n");
-                       testapp_print(" 15. Clear all notifications\n");
-                       testapp_print(" 16. Save default account ID\n");
-                       testapp_print(" 17. Load default account ID\n");
-                       testapp_print(" 18. Add certificate\n");
-                       testapp_print(" 19. Get certificate\n");
-                       testapp_print(" 20. Delete certificate\n");
-                       testapp_print(" 21. Add Account\n");
-                       testapp_print(" 22. Update peak schedule\n");
-                       testapp_print(" 0.  Go to Main Menu\n");
-                       testapp_print("------------------------------------------\n");
-                       break;
-
-               case EMAIL_MAIL_MENU:
-                       testapp_print("==========================================\n");
-                       testapp_print("    MAIL MENU\n");
-                       testapp_print("==========================================\n");
-                       testapp_print("1.  Get mails\n");
-                       testapp_print("2.  Send a mail\n");
-                       testapp_print("3.  Get mail list ex\n");
-                       testapp_print("4.  Add Attachment\n");
-                       testapp_print("5.  Set deleted flag\n");
-                       testapp_print("6.  Expunge deleted flagged mails\n");
-                       testapp_print("7.  Send read receipt\n");
-                       testapp_print("8.  Delete attachment\n");
-                       testapp_print("9.  Mail Count \n");
-                       testapp_print("10. Move mails to another account\n");
-                       testapp_print("11. Send mail with downloading attachment of original mail\n");
-                       testapp_print("12. Get mail data\n");
-                       testapp_print("13. Schedule sending mail\n");
-                       testapp_print("14. Delete a mail \n");
-                       testapp_print("15. Update mail attribute \n");
-                       testapp_print("16. Download mail body\n");
-                       testapp_print("17. Download an attachment\n");
-                       testapp_print("18. Get attachment list\n");
-                       testapp_print("19. Get meeting request\n");
-                       testapp_print("20. Delete all mail\n");
-                       testapp_print("21. Move Mail \n");
-                       testapp_print("23. Resend Mail \n");
-                       testapp_print("24. Get attachment data \n");
-                       testapp_print("27. Move all mails to mailbox\n");
-                       testapp_print("38. Get total email disk usage \n");
-                       testapp_print("40. Verify Email Address Format\n");
-                       testapp_print("41. Get Max Mail Count\n");
-                       testapp_print("42. Storage test : (Input : to fields)\n");
-                       testapp_print("43. Send mail Cancel\n");
-                       testapp_print("44. Cancel Download Body\n");
-                       testapp_print("46. Get thread list\n");
-                       testapp_print("48. Get thread information\n");
-                       testapp_print("51. Get mail list\n");
-                       testapp_print("52. Get address info list\n");
-                       testapp_print("55. Set a field of flags\n");
-                       testapp_print("56. Add mail\n");
-                       testapp_print("57. Update mail\n");
-                       testapp_print("58. Search on server\n");
-                       testapp_print("59. Add mail to search result table\n");
-                       testapp_print("60. Parse mime file\n");
-                       testapp_print("61. Write mime file\n");
-                       testapp_print("63. Add mail with multiple recipient\n");
-                       testapp_print("64. Send mails every x minutes\n");
-                       testapp_print("0.  Go to Main Menu\n");
-                       testapp_print("------------------------------------------\n");
-                       break;
-
-               case EMAIL_MAILBOX_MENU:
-                       testapp_print("==========================================\n");
-                       testapp_print("   MAILBOX MENU\n");
-                       testapp_print("==========================================\n");
-                       testapp_print(" 1. Add mailbox\n");
-                       testapp_print(" 2. Delete mailbox\n");
-                       testapp_print(" 3. Raname mailbox\n");
-                       testapp_print(" 4. Get IMAP mailbox List\n");
-                       testapp_print(" 5. Set local mailbox\n");
-                       testapp_print(" 6. Delete mailbox ex\n");
-                       testapp_print(" 7. Get mailbox by mailbox type\n");
-                       testapp_print(" 8. Set mailbox type\n");
-                       testapp_print(" 9. Set mail slot size\n");
-                       testapp_print("10. Get mailbox list\n");
-                       testapp_print("11. Sync mailbox\n");
-                       testapp_print("12. Stamp sync time\n");
-                       testapp_print("13. Raname mailbox ex\n");
-                       testapp_print("14. Get mailbox list by keyword\n");
-                       testapp_print("0. Go to Main Menu\n");
-                       testapp_print("------------------------------------------\n");
-                       break;
-
-               case EMAIL_RULE_MENU:
-                       testapp_print("==========================================\n");
-                       testapp_print("   RULE MENU\n");
-                       testapp_print("==========================================\n");
-                       testapp_print("1. Add Rule\n");
-                       testapp_print("2. Delete Rule\n");
-                       testapp_print("3. Update Rule\n");
-                       testapp_print("5. Get Rule\n");
-                       testapp_print("6. Get Rule List\n");
-                       testapp_print("0. Go to Main Menu\n");
-                       testapp_print("------------------------------------------\n");
-                       break;
-
-               case EMAIL_THREAD_MENU:
-                       testapp_print("==========================================\n");
-                       testapp_print("   TRHEAD MENU\n");
-                       testapp_print("==========================================\n");
-                       testapp_print("1. Move Thread\n");
-                       testapp_print("2. Delete Thread\n");
-                       testapp_print("3. Set Seen Flag of Thread\n");
-                       testapp_print("0. Go to Main Menu\n");
-                       testapp_print("------------------------------------------\n");
-                       break;
-
-               case EMAIL_OTHERS_MENU:
-                       testapp_print("==========================================\n");
-                       testapp_print("   OTHERS\n");
-                       testapp_print("==========================================\n");
-                       testapp_print("1.  Ping service\n");
-                       testapp_print("2.  Init storage\n");
-                       testapp_print("3.  Cancel Job\n");
-                       testapp_print("5.  Set DNET Proper Profile Type\n");
-                       testapp_print("6.  Get DNET Proper Profile Type\n");
-                       testapp_print("7.  Get preview text\n");
-                       testapp_print("11. Get task information\n");
-                       testapp_print("12. Create DB full\n");
-                       testapp_print("13. Encoding Test\n");
-                       testapp_print("14. DTT Test\n");
-                       testapp_print("15. Show User Message\n");
-                       testapp_print("16. Get mime entity in signed file\n");
-                       testapp_print("17. Query SMTP mail size limit\n");
-                       testapp_print("18. Verify email address\n");
-                       testapp_print("0.  Go to Main Menu\n");
-                       testapp_print("------------------------------------------\n");
-                       break;
-
-               case EMAIL_GMIME_MENU:
-                       testapp_print("==========================================\n");
-                       testapp_print("   Gmime Test\n");
-                       testapp_print("==========================================\n");
-                       testapp_print("1. Parsing eml\n");
-                       testapp_print("0.  Go to Main Menu\n");
-                       testapp_print("------------------------------------------\n");
-                       break;
-
-               default:
-                       break;
-       }
-}
-void testapp_show_prompt(eEMAIL_MENU menu)
-{
-       switch (menu) {
-               case EMAIL_MAIN_MENU:
-                       testapp_print("[MAIN]# ");
-                       break;
-
-               case EMAIL_ACCOUNT_MENU:
-                       testapp_print("[ACCOUNT]# ");
-                       break;
-
-               case EMAIL_MAIL_MENU:
-                       testapp_print("[MAIL]# ");
-                       break;
-
-               case EMAIL_MAILBOX_MENU:
-                       testapp_print("[MAILBOX]# ");
-                       break;
-
-               case EMAIL_RULE_MENU:
-                       testapp_print("[RULE]# ");
-                       break;
-
-               case EMAIL_THREAD_MENU:
-                       testapp_print("[THREAD]# ");
-                       break;
-
-               case EMAIL_OTHERS_MENU:
-                       testapp_print("[OTHERS]# ");
-                       break;
-
-               case EMAIL_GMIME_MENU:
-                       testapp_print("[Gmime Test]# ");
-                       break;
-
-               default:
-                       break;
-       }
-}
-
-