message service dependency removed
[platform/core/messaging/email-service.git] / test / testapp-utility.c
1 /*
2 *  email-service
3 *
4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5 *
6 * Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 */
21
22
23
24 /* common header */
25 #include <stdarg.h>
26 #include <string.h>
27
28 /* open header */
29 #include <glib.h>
30 #include <glib/gprintf.h>
31
32 /* internal header */
33 #include "testapp-utility.h"
34
35 /* internal data struct */
36
37 void testapp_print(char *fmt, ...)
38 {
39         va_list args = {0};
40         va_start(args, fmt);
41         vfprintf(stdout, fmt, args);
42         va_end(args);
43         fflush(stdout);
44 }
45
46 void testapp_show_menu(eEMAIL_MENU menu)
47 {
48         switch (menu) {
49                 case EMAIL_MAIN_MENU:
50                         testapp_print("==========================================\n");
51                         testapp_print("    Email test application \n");
52                         testapp_print("==========================================\n");
53                         testapp_print("1. Account Test\n");
54                         testapp_print("2. Mail Test\n");
55                         testapp_print("3. Mailbox Test\n");
56                         testapp_print("5. Rule Test\n");
57                         testapp_print("6. Thread Test\n");
58                         testapp_print("7. Others\n");
59                         testapp_print("8. Gmime test\n");
60                         testapp_print("0. Exit \n");
61                         testapp_print("------------------------------------------\n");
62                         break;
63
64                 case EMAIL_ACCOUNT_MENU:
65                         testapp_print("==========================================\n");
66                         testapp_print("    ACCOUNT MENU \n");
67                         testapp_print("==========================================\n");
68                         testapp_print(" 1.  Add account with validation\n");
69                         testapp_print(" 2.  Update account\n");
70                         testapp_print(" 3.  Delete account\n");
71                         testapp_print(" 4.  Get account\n");
72                         testapp_print(" 5.  Get account list\n");
73                         testapp_print(" 6.  Update check interval\n");
74                         testapp_print(" 7.  Validate account\n");
75                         testapp_print(" 8.  Cancel validate Account\n");
76                         testapp_print(" 9.  Backup All accounts\n");
77                         testapp_print(" 10. Restore accounts\n");
78                         testapp_print(" 11. Get password length of account\n");
79                         testapp_print(" 13. Update notifications\n");
80                         testapp_print(" 14. Clear notifications\n");
81                         testapp_print(" 15. Clear all notifications\n");
82                         testapp_print(" 16. Save default account ID\n");
83                         testapp_print(" 17. Load default account ID\n");
84                         testapp_print(" 18. Add certificate\n");
85                         testapp_print(" 19. Get certificate\n");
86                         testapp_print(" 20. Delete certificate\n");
87                         testapp_print(" 21. Add Account\n");
88                         testapp_print(" 22. Update peak schedule\n");
89                         testapp_print(" 0.  Go to Main Menu\n");
90                         testapp_print("------------------------------------------\n");
91                         break;
92
93                 case EMAIL_MAIL_MENU:
94                         testapp_print("==========================================\n");
95                         testapp_print("    MAIL MENU\n");
96                         testapp_print("==========================================\n");
97                         testapp_print("1.  Get mails\n");
98                         testapp_print("2.  Send a mail\n");
99                         testapp_print("3.  Get mail list ex\n");
100                         testapp_print("4.  Add Attachment\n");
101                         testapp_print("5.  Set deleted flag\n");
102                         testapp_print("6.  Expunge deleted flagged mails\n");
103                         testapp_print("7.  Send read receipt\n");
104                         testapp_print("8.  Delete attachment\n");
105                         testapp_print("9.  Mail Count \n");
106                         testapp_print("10. Move mails to another account\n");
107                         testapp_print("11. Send mail with downloading attachment of original mail\n");
108                         testapp_print("12. Get mail data\n");
109                         testapp_print("13. Schedule sending mail\n");
110                         testapp_print("14. Delete a mail \n");
111                         testapp_print("15. Update mail attribute \n");
112                         testapp_print("16. Download mail body\n");
113                         testapp_print("17. Download an attachment\n");
114                         testapp_print("18. Get attachment list\n");
115                         testapp_print("19. Get meeting request\n");
116                         testapp_print("20. Delete all mail\n");
117                         testapp_print("21. Move Mail \n");
118                         testapp_print("23. Resend Mail \n");
119                         testapp_print("24. Get attachment data \n");
120                         testapp_print("27. Move all mails to mailbox\n");
121                         testapp_print("38. Get total email disk usage \n");
122                         testapp_print("40. Verify Email Address Format\n");
123                         testapp_print("41. Get Max Mail Count\n");
124                         testapp_print("42. Storage test : (Input : to fields)\n");
125                         testapp_print("43. Send mail Cancel\n");
126                         testapp_print("44. Cancel Download Body\n");
127                         testapp_print("46. Get thread list\n");
128                         testapp_print("48. Get thread information\n");
129                         testapp_print("51. Get mail list\n");
130                         testapp_print("52. Get address info list\n");
131                         testapp_print("55. Set a field of flags\n");
132                         testapp_print("56. Add mail\n");
133                         testapp_print("57. Update mail\n");
134                         testapp_print("58. Search on server\n");
135                         testapp_print("59. Add mail to search result table\n");
136                         testapp_print("60. Parse mime file\n");
137                         testapp_print("61. Write mime file\n");
138                         testapp_print("63. Add mail with multiple recipient\n");
139                         testapp_print("64. Send mails every x minutes\n");
140                         testapp_print("0.  Go to Main Menu\n");
141                         testapp_print("------------------------------------------\n");
142                         break;
143
144                 case EMAIL_MAILBOX_MENU:
145                         testapp_print("==========================================\n");
146                         testapp_print("   MAILBOX MENU\n");
147                         testapp_print("==========================================\n");
148                         testapp_print(" 1. Add mailbox\n");
149                         testapp_print(" 2. Delete mailbox\n");
150                         testapp_print(" 3. Raname mailbox\n");
151                         testapp_print(" 4. Get IMAP mailbox List\n");
152                         testapp_print(" 5. Set local mailbox\n");
153                         testapp_print(" 6. Delete mailbox ex\n");
154                         testapp_print(" 7. Get mailbox by mailbox type\n");
155                         testapp_print(" 8. Set mailbox type\n");
156                         testapp_print(" 9. Set mail slot size\n");
157                         testapp_print("10. Get mailbox list\n");
158                         testapp_print("11. Sync mailbox\n");
159                         testapp_print("12. Stamp sync time\n");
160                         testapp_print("13. Raname mailbox ex\n");
161                         testapp_print("14. Get mailbox list by keyword\n");
162                         testapp_print("0. Go to Main Menu\n");
163                         testapp_print("------------------------------------------\n");
164                         break;
165
166                 case EMAIL_RULE_MENU:
167                         testapp_print("==========================================\n");
168                         testapp_print("   RULE MENU\n");
169                         testapp_print("==========================================\n");
170                         testapp_print("1. Add Rule\n");
171                         testapp_print("2. Delete Rule\n");
172                         testapp_print("3. Update Rule\n");
173                         testapp_print("5. Get Rule\n");
174                         testapp_print("6. Get Rule List\n");
175                         testapp_print("0. Go to Main Menu\n");
176                         testapp_print("------------------------------------------\n");
177                         break;
178
179                 case EMAIL_THREAD_MENU:
180                         testapp_print("==========================================\n");
181                         testapp_print("   TRHEAD MENU\n");
182                         testapp_print("==========================================\n");
183                         testapp_print("1. Move Thread\n");
184                         testapp_print("2. Delete Thread\n");
185                         testapp_print("3. Set Seen Flag of Thread\n");
186                         testapp_print("0. Go to Main Menu\n");
187                         testapp_print("------------------------------------------\n");
188                         break;
189
190                 case EMAIL_OTHERS_MENU:
191                         testapp_print("==========================================\n");
192                         testapp_print("   OTHERS\n");
193                         testapp_print("==========================================\n");
194                         testapp_print("1.  Ping service\n");
195                         testapp_print("2.  Init storage\n");
196                         testapp_print("3.  Cancel Job\n");
197                         testapp_print("5.  Set DNET Proper Profile Type\n");
198                         testapp_print("6.  Get DNET Proper Profile Type\n");
199                         testapp_print("7.  Get preview text\n");
200                         testapp_print("11. Get task information\n");
201                         testapp_print("12. Create DB full\n");
202                         testapp_print("13. Encoding Test\n");
203                         testapp_print("14. DTT Test\n");
204                         testapp_print("15. Show User Message\n");
205                         testapp_print("16. Get mime entity in signed file\n");
206                         testapp_print("17. Query SMTP mail size limit\n");
207                         testapp_print("18. Verify email address\n");
208                         testapp_print("0.  Go to Main Menu\n");
209                         testapp_print("------------------------------------------\n");
210                         break;
211
212                 case EMAIL_GMIME_MENU:
213                         testapp_print("==========================================\n");
214                         testapp_print("   Gmime Test\n");
215                         testapp_print("==========================================\n");
216                         testapp_print("1. Parsing eml\n");
217                         testapp_print("0.  Go to Main Menu\n");
218                         testapp_print("------------------------------------------\n");
219                         break;
220
221                 default:
222                         break;
223         }
224 }
225 void testapp_show_prompt(eEMAIL_MENU menu)
226 {
227         switch (menu) {
228                 case EMAIL_MAIN_MENU:
229                         testapp_print("[MAIN]# ");
230                         break;
231
232                 case EMAIL_ACCOUNT_MENU:
233                         testapp_print("[ACCOUNT]# ");
234                         break;
235
236                 case EMAIL_MAIL_MENU:
237                         testapp_print("[MAIL]# ");
238                         break;
239
240                 case EMAIL_MAILBOX_MENU:
241                         testapp_print("[MAILBOX]# ");
242                         break;
243
244                 case EMAIL_RULE_MENU:
245                         testapp_print("[RULE]# ");
246                         break;
247
248                 case EMAIL_THREAD_MENU:
249                         testapp_print("[THREAD]# ");
250                         break;
251
252                 case EMAIL_OTHERS_MENU:
253                         testapp_print("[OTHERS]# ");
254                         break;
255
256                 case EMAIL_GMIME_MENU:
257                         testapp_print("[Gmime Test]# ");
258                         break;
259
260                 default:
261                         break;
262         }
263 }
264
265