|
1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "imaptestparsers.h" |
|
17 #include "imaptests.h" |
|
18 |
|
19 _LIT(KCommandImapClientTest, "imap_client_test"); |
|
20 _LIT(KCommandImapService, "imap_service"); // 1 parameter, creates an imap service |
|
21 _LIT(KCommandImapUseService, "use_service"); // 0 parameters, uses the currently selected service |
|
22 |
|
23 // IMAP settings strings |
|
24 _LIT(KCommandImapSetServer, "set_server"); // 1 parameter, sets the IMAP server |
|
25 _LIT(KCommandImapSetUserName, "set_user"); // 1 parameter, sets the username for the IMAP service |
|
26 _LIT(KCommandImapSetPassword, "set_pass"); // 1 parameter, sets the password for the IMAP service |
|
27 _LIT(KCommandImapSetName, "set_name"); // 1 parameter, sets the name of the IMAP service |
|
28 _LIT(KCommandImapSetFolderPath, "set_folder_path"); // 1 parameter, sets the folder path of the IMAP service |
|
29 _LIT(KCommandImapSetTLS, "set_tls"); // 1 parameter, sets the secure connection for IMAP service. Value should be 0 or 1 |
|
30 _LIT(KCommandImapSetUpdatingSeenFlags, "set_updating_seen_flag"); // 1 parameter, sets the updating seen flag value to the parameter value |
|
31 _LIT(KCommandImapSetWrappedTLS, "set_wrapped_tls"); // 1 parameter, sets the secure connection for IMAP service. value should be 1 or 0 |
|
32 _LIT(KCommandImapSetPort, "set_port"); // 1 parameter, sets the port no for IMAP service. |
|
33 |
|
34 // IMAP Operations |
|
35 _LIT(KCommandImapConnect, "connect"); // 0 parameters, connects to the IMAP service |
|
36 _LIT(KCommandImapConnectAndCancel, "connect_and_cancel"); // 1 parameters, connects to the IMAP service, starts the sync process then cancels after the specified interval |
|
37 _LIT(KCommandImapConnectAndMonitor, "connect_and_monitor"); // 0 parameters, connects to the IMAP service and monitors connection |
|
38 _LIT(KCommandImapConnectMonitorAndSync, "connect_monitor_and_sync"); // 0 parameters, connects to the IMAP service and monitors connection, then syncs |
|
39 _LIT(KCommandImapConnectAndSync, "connect_and_sync"); // 0 parameters, connects to the IMAP service and automatically synchronises |
|
40 _LIT(KCommandImapConnectAndPeriodicSync, "connect_and_periodic_sync"); // 0 parameters, connects to the IMAP service and automatically synchronises |
|
41 _LIT(KCommandImapDisconnect, "disconnect"); // 0 parameters, disconnects from the IMAP service |
|
42 |
|
43 _LIT(KCommandImapSetSyncRate, "set_sync_rate"); // 1 parameters, sets the sync rate - in seconds |
|
44 _LIT(KCommandImapGetSyncRate, "get_sync_rate"); // 1 parameters, gets the sync rate and validates with given rate param |
|
45 |
|
46 _LIT(KCommandImapCheckStatus, "check_imap_error"); // 1 parameter, checks the last error code and compares it to param 1 |
|
47 // Note: must only be used to check commands that have been set using |
|
48 // CMsvClientTest::SetCurrentOperation |
|
49 |
|
50 _LIT(KCommandImapSyncTree, "sync_tree"); // 0 parameters, synchronises the local IMAP structure with the remote |
|
51 _LIT(KCommandImapCheckRemoteInbox, "check_remote_inbox"); // 0 parameters, checks the remote inbox for new mail and retrieves headers |
|
52 _LIT(KCommandImapSyncFolder, "sync_folder"); // 0 parameters, synchonises the currently selected IMAP folder with the server |
|
53 _LIT(KCommandImapSubscribeFolder, "subscribe_folder"); // 0 parameters, subscribes to the currently selected folder |
|
54 _LIT(KCommandImapUnsubscribeFolder, "unsubscribe_folder"); // 0 parameters, unsubscribes from the currently selected folder |
|
55 _LIT(KCommandImapPopulateFolder, "populate_folder"); // 0 parameters, populates the bodies of the currently selected messages |
|
56 _LIT(KCommandImapPerformFullSync, "perform_full_sync"); // 0 parameters, performs a full synchronisation with the selected remote service |
|
57 _LIT(KCommandImapSetSyncLimits, "set_sync_limits"); // 2 parameters, resets the sync limits for currently selected imap service |
|
58 |
|
59 //Commands for IMAP read status testing - defect INC016632 |
|
60 //mark_selection_unread |
|
61 //check_selection |
|
62 |
|
63 _LIT(KCommandImapMarkSelection, "mark_selection_unread"); // 1 parameter, marks all the messages in mailbox as specified in parameter |
|
64 _LIT(KCommandImapCheckSelectionUnread, "check_selection_unread"); // 1 parameter, checks the unread flag all the messages in mailbox as specified in parameter |
|
65 _LIT(KCommandImapCheckSelectionSeen, "check_selection_seen"); // 1 parameter, checks the seen flag all the messages in mailbox as specified in parameter |
|
66 _LIT(KCommandImapMarkSelectedMail, "mark_selected_mail"); // 0 parameters, marks selected messages in mailbox as read |
|
67 _LIT(KCommandImapCheckSelectedMail, "check_selected_mail"); // 0 parameters, checks selected messages in mailbox as read |
|
68 |
|
69 // |
|
70 // |
|
71 // CNewImapTestCommandParser |
|
72 // |
|
73 // A command parser |
|
74 // Parses the command which generates a new Imap test harness |
|
75 // This command would usually be found in an email test section |
|
76 |
|
77 CNewImapTestCommandParser* CNewImapTestCommandParser::NewL(CTestScript& aScript, CEmailClientTest& aEmailClientTest) |
|
78 { |
|
79 CNewImapTestCommandParser* self = new (ELeave) CNewImapTestCommandParser(aScript, aEmailClientTest); |
|
80 CleanupStack::PushL(self); |
|
81 self->ConstructL(); |
|
82 CleanupStack::Pop(self); |
|
83 return self; |
|
84 }; |
|
85 |
|
86 void CNewImapTestCommandParser::ProcessL() |
|
87 { |
|
88 // Create an smtp test, give it the test utilities |
|
89 CImapClientTest* imapTest = CImapClientTest::NewL(iEmailClientTest.EmailTestUtils(), iEmailClientTest.TestConsole()); |
|
90 CleanupStack::PushL(imapTest); |
|
91 |
|
92 // Attach the email test to the main test |
|
93 iEmailClientTest.AddStateL(imapTest, iDebugInfo); |
|
94 CleanupStack::Pop(imapTest); // emailTest is now owned by the iMainTest |
|
95 |
|
96 // Check that there is one argument, the email test section name |
|
97 CheckNumberOfArgumentsL(1); |
|
98 |
|
99 // Create an email section parser |
|
100 CImapClientSectionParser* sectionParser = CImapClientSectionParser::NewL(*imapTest, iScript, (*iArgumentList)[0]); |
|
101 CleanupStack::PushL(sectionParser); |
|
102 sectionParser->ParseL(); |
|
103 CleanupStack::PopAndDestroy(sectionParser); |
|
104 } |
|
105 |
|
106 void CNewImapTestCommandParser::ConstructL() |
|
107 { |
|
108 CBaseCommandParser::ConstructL(); |
|
109 AddCommandL(KCommandImapClientTest); |
|
110 } |
|
111 |
|
112 CNewImapTestCommandParser::CNewImapTestCommandParser(CTestScript& aScript, CEmailClientTest& aEmailClientTest) : iEmailClientTest(aEmailClientTest), iScript(aScript) |
|
113 { |
|
114 } |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 // |
|
120 // |
|
121 // CImapClientSectionParser |
|
122 // |
|
123 // A section parser |
|
124 // Parses an IMAP test section |
|
125 |
|
126 CImapClientSectionParser* CImapClientSectionParser::NewL(CImapClientTest& aImapClientTest, CTestScript& aScript, const TDesC& aNewSectionName) |
|
127 { |
|
128 CImapClientSectionParser* self = new (ELeave) CImapClientSectionParser(aImapClientTest, aScript); |
|
129 CleanupStack::PushL(self); |
|
130 self->ConstructL(aNewSectionName); |
|
131 CleanupStack::Pop(self); |
|
132 return self; |
|
133 } |
|
134 |
|
135 void CImapClientSectionParser::ConstructL(const TDesC& aNewSectionName) |
|
136 { |
|
137 CEmailClientSectionParser::ConstructL(aNewSectionName); |
|
138 AddCommandParserL(CImapServiceCommandParser::NewL(iScript, iImapTest)); |
|
139 AddCommandParserL(CImapOperationParser::NewL(iImapTest)); |
|
140 AddCommandParserL(CImapCheckStatusParser::NewL(iImapTest)); |
|
141 } |
|
142 |
|
143 CImapClientSectionParser::CImapClientSectionParser(CImapClientTest& aImapTest, CTestScript& aScript) : CEmailClientSectionParser(aImapTest, aScript), iImapTest(aImapTest) |
|
144 { |
|
145 } |
|
146 |
|
147 |
|
148 |
|
149 // |
|
150 // |
|
151 // CImapServiceCommandParser |
|
152 // |
|
153 |
|
154 void CImapServiceCommandParser::ProcessL() |
|
155 { |
|
156 CheckNumberOfArgumentsL(1); |
|
157 // Create the settings object which we will give to the settings section parser |
|
158 CImapServiceSectionParser* serviceParser = CImapServiceSectionParser::NewL(iScript, iImapClientTest, (*iArgumentList)[0]); |
|
159 CleanupStack::PushL(serviceParser); |
|
160 |
|
161 serviceParser->ParseL(); |
|
162 CleanupStack::PopAndDestroy(serviceParser); |
|
163 } |
|
164 |
|
165 CImapServiceCommandParser* CImapServiceCommandParser::NewL(CTestScript& aScript, CImapClientTest& aImapClientTest) |
|
166 { |
|
167 CImapServiceCommandParser* self = new (ELeave) CImapServiceCommandParser(aScript, aImapClientTest); |
|
168 CleanupStack::PushL(self); |
|
169 self->ConstructL(); |
|
170 CleanupStack::Pop(self); |
|
171 return self; |
|
172 } |
|
173 |
|
174 void CImapServiceCommandParser::ConstructL() |
|
175 { |
|
176 CBaseCommandParser::ConstructL(); |
|
177 AddCommandL(KCommandImapService); |
|
178 } |
|
179 |
|
180 CImapServiceCommandParser::CImapServiceCommandParser(CTestScript& aScript, CImapClientTest& aImapClientTest) : iImapClientTest(aImapClientTest), iScript(aScript) |
|
181 { |
|
182 } |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 // |
|
188 // |
|
189 // CImapServiceSectionParser |
|
190 // |
|
191 |
|
192 // A section parser |
|
193 // Parses a IMAP section to create a IMAP service |
|
194 |
|
195 CImapServiceSectionParser* CImapServiceSectionParser::NewL(CTestScript& aScript, CEmailClientTest& aTestHarness, const TDesC& aSectionName) |
|
196 { |
|
197 CImapServiceSectionParser* self = new (ELeave) CImapServiceSectionParser(aScript, aTestHarness); |
|
198 CleanupStack::PushL(self); |
|
199 self->ConstructL(aSectionName); |
|
200 CleanupStack::Pop(self); |
|
201 return self; |
|
202 } |
|
203 |
|
204 void CImapServiceSectionParser::ConstructL(const TDesC& aSectionName) |
|
205 { |
|
206 CBaseSectionParser::ConstructL(aSectionName); |
|
207 |
|
208 // Add the state to generate the imap service |
|
209 CCreateImapService* testState = CCreateImapService::NewL(iTestHarness); |
|
210 |
|
211 TTestDebugInfo debugInfo(iScript, iSection->SectionPosition(), 0); |
|
212 iTestHarness.AddStateL(testState, debugInfo); |
|
213 |
|
214 // The parsers will fill in the entry and service details before the state that creates the entry is run. |
|
215 AddCommandParserL(CImapServiceCommands::NewL(*testState)); |
|
216 |
|
217 CEmailServiceSectionParser::ConstructL(aSectionName, *testState); |
|
218 } |
|
219 |
|
220 CImapServiceSectionParser::CImapServiceSectionParser(CTestScript& aScript, CEmailClientTest& aTestHarness) : CEmailServiceSectionParser(aScript, aTestHarness) |
|
221 { |
|
222 } |
|
223 |
|
224 CImapServiceSectionParser::~CImapServiceSectionParser() |
|
225 { |
|
226 } |
|
227 |
|
228 |
|
229 |
|
230 // |
|
231 // |
|
232 // CImapServiceCommands |
|
233 // |
|
234 // A command parser |
|
235 // Parses the commands that generate the IMAP service |
|
236 |
|
237 CImapServiceCommands* CImapServiceCommands::NewL(CCreateImapService& aTestState) |
|
238 { |
|
239 CImapServiceCommands* self = new (ELeave) CImapServiceCommands(aTestState); |
|
240 CleanupStack::PushL(self); |
|
241 self->ConstructL(); |
|
242 CleanupStack::Pop(self); |
|
243 return self; |
|
244 } |
|
245 |
|
246 void CImapServiceCommands::ProcessL() |
|
247 { |
|
248 if ((*iCurrentCommand) == KCommandImapSetServer) |
|
249 { |
|
250 CheckNumberOfArgumentsL(1); |
|
251 iTestState.Settings().SetServerAddressL((*iArgumentList)[0]); |
|
252 } |
|
253 else if ((*iCurrentCommand) == KCommandImapSetUserName) |
|
254 { |
|
255 CheckNumberOfArgumentsL(1); |
|
256 TBuf8<128> loginName; |
|
257 loginName.Copy((*iArgumentList)[0]); |
|
258 iTestState.Settings().SetLoginNameL(loginName); |
|
259 } |
|
260 else if ((*iCurrentCommand) == KCommandImapSetPassword) |
|
261 { |
|
262 CheckNumberOfArgumentsL(1); |
|
263 TBuf8<128> password; |
|
264 password.Copy((*iArgumentList)[0]); |
|
265 iTestState.Settings().SetPasswordL(password); |
|
266 } |
|
267 else if ((*iCurrentCommand) == KCommandImapSetName) |
|
268 { |
|
269 iTestState.SetDetailsStringL((*iArgumentList)[0]); |
|
270 } |
|
271 else if ((*iCurrentCommand) == KCommandImapSetFolderPath) |
|
272 { |
|
273 CheckNumberOfArgumentsL(1); |
|
274 TBuf8<128> folderName; |
|
275 folderName.Copy((*iArgumentList)[0]); |
|
276 iTestState.Settings().SetFolderPathL(folderName); |
|
277 } |
|
278 else if ((*iCurrentCommand) == KCommandImapSetTLS) |
|
279 { |
|
280 CheckNumberOfArgumentsL(1); |
|
281 TLex lex((*iArgumentList)[0]); |
|
282 TInt setTls=0; |
|
283 User::LeaveIfError(lex.Val(setTls)); |
|
284 iTestState.Settings().SetSecureSockets(setTls); |
|
285 } |
|
286 else if ((*iCurrentCommand) == KCommandImapSetUpdatingSeenFlags) |
|
287 { |
|
288 |
|
289 CheckNumberOfArgumentsL(1); |
|
290 TLex lex((*iArgumentList)[0]); |
|
291 TInt updateseenflag; |
|
292 User::LeaveIfError(lex.Val(updateseenflag)); |
|
293 iTestState.Settings().SetUpdatingSeenFlags(updateseenflag); |
|
294 } |
|
295 else if ((*iCurrentCommand) == KCommandImapSetPort) |
|
296 { |
|
297 |
|
298 CheckNumberOfArgumentsL(1); |
|
299 TLex lex((*iArgumentList)[0]); |
|
300 TInt setPort=0; |
|
301 User::LeaveIfError(lex.Val(setPort)); |
|
302 iTestState.Settings().SetPort(setPort); |
|
303 } |
|
304 else if ((*iCurrentCommand) == KCommandImapSetWrappedTLS) |
|
305 { |
|
306 CheckNumberOfArgumentsL(1); |
|
307 TLex lex((*iArgumentList)[0]); |
|
308 TInt setWrappedTls=0; |
|
309 User::LeaveIfError(lex.Val(setWrappedTls)); |
|
310 iTestState.Settings().SetSSLWrapper(setWrappedTls); |
|
311 } |
|
312 } |
|
313 |
|
314 CImapServiceCommands::CImapServiceCommands(CCreateImapService& aTestState) : iTestState(aTestState) |
|
315 { |
|
316 } |
|
317 |
|
318 void CImapServiceCommands::ConstructL() |
|
319 { |
|
320 CBaseCommandParser::ConstructL(); |
|
321 AddCommandL(KCommandImapSetServer); |
|
322 AddCommandL(KCommandImapSetUserName); |
|
323 AddCommandL(KCommandImapSetPassword); |
|
324 AddCommandL(KCommandImapSetName); |
|
325 AddCommandL(KCommandImapSetFolderPath); |
|
326 AddCommandL(KCommandImapSetTLS); |
|
327 AddCommandL(KCommandImapSetUpdatingSeenFlags); |
|
328 AddCommandL(KCommandImapSetPort); |
|
329 AddCommandL(KCommandImapSetWrappedTLS); |
|
330 } |
|
331 |
|
332 |
|
333 // |
|
334 // |
|
335 // CImapOperationParser |
|
336 // |
|
337 |
|
338 CImapOperationParser* CImapOperationParser::NewL(CImapClientTest& aImapClientTest) |
|
339 { |
|
340 CImapOperationParser* self = new (ELeave) CImapOperationParser(aImapClientTest); |
|
341 CleanupStack::PushL(self); |
|
342 self->ConstructL(); |
|
343 CleanupStack::Pop(self); |
|
344 return self; |
|
345 } |
|
346 |
|
347 void CImapOperationParser::ProcessL() |
|
348 { |
|
349 |
|
350 if ((*iCurrentCommand) == KCommandImapConnect) |
|
351 { |
|
352 CheckNumberOfArgumentsL(0); |
|
353 iImapClientTest.AddStateL(new (ELeave) CCheckService(iImapClientTest), iDebugInfo); |
|
354 iImapClientTest.AddStateL(new (ELeave) CImapConnect(iImapClientTest, CImapConnect::ENoSync), iDebugInfo); |
|
355 } |
|
356 else if ((*iCurrentCommand) == KCommandImapConnectAndCancel) |
|
357 { |
|
358 CheckNumberOfArgumentsL(1); |
|
359 TUint cancelDelay; |
|
360 TLex cancelDelayLex((*iArgumentList)[0]); |
|
361 User::LeaveIfError(cancelDelayLex.Val(cancelDelay)); |
|
362 |
|
363 iImapClientTest.AddStateL(new (ELeave) CCheckService(iImapClientTest), iDebugInfo); |
|
364 iImapClientTest.AddStateL(new (ELeave) CImapConnectAndCancel(iImapClientTest, cancelDelay), iDebugInfo); |
|
365 } |
|
366 else if ((*iCurrentCommand) == KCommandImapConnectAndMonitor) |
|
367 { |
|
368 CheckNumberOfArgumentsL(0); |
|
369 iImapClientTest.AddStateL(new (ELeave) CCheckService(iImapClientTest), iDebugInfo); |
|
370 iImapClientTest.AddStateL(new (ELeave) CImapConnectAndMonitor(iImapClientTest, EFalse), iDebugInfo); |
|
371 } |
|
372 else if ((*iCurrentCommand) == KCommandImapConnectMonitorAndSync) |
|
373 { |
|
374 CheckNumberOfArgumentsL(0); |
|
375 iImapClientTest.AddStateL(new (ELeave) CCheckService(iImapClientTest), iDebugInfo); |
|
376 iImapClientTest.AddStateL(new (ELeave) CImapConnectAndMonitor(iImapClientTest, ETrue), iDebugInfo); |
|
377 } |
|
378 else if ((*iCurrentCommand) == KCommandImapConnectAndSync) |
|
379 { |
|
380 CheckNumberOfArgumentsL(0); |
|
381 iImapClientTest.AddStateL(new (ELeave) CCheckService(iImapClientTest), iDebugInfo); |
|
382 iImapClientTest.AddStateL(new (ELeave) CImapConnect(iImapClientTest, CImapConnect::EConnectAndSync), iDebugInfo); |
|
383 } |
|
384 else if ((*iCurrentCommand) == KCommandImapConnectAndPeriodicSync) |
|
385 { |
|
386 CheckNumberOfArgumentsL(0); |
|
387 iImapClientTest.AddStateL(new (ELeave) CCheckService(iImapClientTest), iDebugInfo); |
|
388 iImapClientTest.AddStateL(new (ELeave) CImapConnect(iImapClientTest, CImapConnect::EConnectAndPeriodicSync), iDebugInfo); |
|
389 } |
|
390 else if ((*iCurrentCommand) == KCommandImapDisconnect) |
|
391 { |
|
392 CheckNumberOfArgumentsL(0); |
|
393 iImapClientTest.AddStateL(new (ELeave) CImapDisconnect(iImapClientTest), iDebugInfo); |
|
394 } |
|
395 else if ((*iCurrentCommand) == KCommandImapUseService) |
|
396 { |
|
397 CheckNumberOfArgumentsL(0); |
|
398 iImapClientTest.AddStateL(new (ELeave) CImapUseService(iImapClientTest), iDebugInfo); |
|
399 } |
|
400 else if ((*iCurrentCommand) == KCommandImapCheckRemoteInbox) |
|
401 { |
|
402 CheckNumberOfArgumentsL(0); |
|
403 iImapClientTest.AddStateL(new (ELeave) CImapInboxNewSync(iImapClientTest), iDebugInfo); |
|
404 } |
|
405 else if ((*iCurrentCommand) == KCommandImapSyncTree) |
|
406 { |
|
407 CheckNumberOfArgumentsL(0); |
|
408 iImapClientTest.AddStateL(new (ELeave) CImapSyncTree(iImapClientTest), iDebugInfo); |
|
409 } |
|
410 else if ((*iCurrentCommand) == KCommandImapSyncFolder) |
|
411 { |
|
412 CheckNumberOfArgumentsL(0); |
|
413 iImapClientTest.AddStateL(new (ELeave) CImapFolderSync(iImapClientTest), iDebugInfo); |
|
414 } |
|
415 else if ((*iCurrentCommand) == KCommandImapSubscribeFolder) |
|
416 { |
|
417 CheckNumberOfArgumentsL(0); |
|
418 iImapClientTest.AddStateL(new (ELeave) CImapSubscribeFolder(ETrue,iImapClientTest), iDebugInfo); |
|
419 } |
|
420 else if ((*iCurrentCommand) == KCommandImapUnsubscribeFolder) |
|
421 { |
|
422 CheckNumberOfArgumentsL(0); |
|
423 iImapClientTest.AddStateL(new (ELeave) CImapSubscribeFolder(EFalse,iImapClientTest), iDebugInfo); |
|
424 } |
|
425 else if ((*iCurrentCommand) == KCommandImapPopulateFolder) |
|
426 { |
|
427 CheckNumberOfArgumentsL(0); |
|
428 iImapClientTest.AddStateL(new (ELeave) CImapPopulateFolder(iImapClientTest), iDebugInfo); |
|
429 } |
|
430 else if ((*iCurrentCommand) == KCommandImapPerformFullSync) |
|
431 { |
|
432 CheckNumberOfArgumentsL(0); |
|
433 iImapClientTest.AddStateL(new (ELeave) CImapPerformFullSync(iImapClientTest), iDebugInfo); |
|
434 } |
|
435 else if ((*iCurrentCommand) == KCommandImapSetSyncLimits) |
|
436 { |
|
437 CheckNumberOfArgumentsL(2); |
|
438 |
|
439 TInt inboxSyncLimit,folderSyncLimit; |
|
440 TLex inboxLex((*iArgumentList)[0]); |
|
441 TLex folderLex((*iArgumentList)[1]); |
|
442 User::LeaveIfError(inboxLex.Val(inboxSyncLimit)); |
|
443 User::LeaveIfError(folderLex.Val(folderSyncLimit)); |
|
444 |
|
445 iImapClientTest.AddStateL(new (ELeave) CImapSetSyncLimits(inboxSyncLimit,folderSyncLimit,iImapClientTest), iDebugInfo); |
|
446 } |
|
447 else if ((*iCurrentCommand) == KCommandImapMarkSelection) |
|
448 { |
|
449 |
|
450 CheckNumberOfArgumentsL(1); |
|
451 |
|
452 TBool Unreadflag; |
|
453 TLex unreadflaglex((*iArgumentList)[0]); |
|
454 User::LeaveIfError(unreadflaglex.Val(Unreadflag)); |
|
455 |
|
456 iImapClientTest.AddStateL(new (ELeave) CImapMarkSelection(Unreadflag,*(iImapClientTest.iCurrentSelection), iImapClientTest.MsvTestUtils()) |
|
457 , iDebugInfo); |
|
458 } |
|
459 else if ((*iCurrentCommand) == KCommandImapCheckSelectionUnread) |
|
460 { |
|
461 |
|
462 CheckNumberOfArgumentsL(1); |
|
463 |
|
464 TInt TestType; |
|
465 TLex TestTypelex((*iArgumentList)[0]); |
|
466 User::LeaveIfError(TestTypelex.Val(TestType)); |
|
467 iImapClientTest.AddStateL(new (ELeave) CImapCheckSelectionUnread(TestType, *(iImapClientTest.iCurrentSelection), iImapClientTest.MsvTestUtils()) |
|
468 , iDebugInfo); |
|
469 } |
|
470 else if ((*iCurrentCommand) == KCommandImapCheckSelectionSeen) |
|
471 { |
|
472 |
|
473 CheckNumberOfArgumentsL(1); |
|
474 |
|
475 TInt Seenflag; |
|
476 TLex Seenflaglex((*iArgumentList)[0]); |
|
477 User::LeaveIfError(Seenflaglex.Val(Seenflag)); |
|
478 iImapClientTest.AddStateL(new (ELeave) CImapCheckSelectionSeen(Seenflag, *(iImapClientTest.iCurrentSelection), iImapClientTest.MsvTestUtils()) |
|
479 , iDebugInfo); |
|
480 } |
|
481 else if ((*iCurrentCommand) == KCommandImapMarkSelectedMail) |
|
482 { |
|
483 CheckNumberOfArgumentsL(0); |
|
484 iImapClientTest.AddStateL(new (ELeave) CImapMarkSelectedMail(*(iImapClientTest.iCurrentSelection), iImapClientTest.MsvTestUtils()) |
|
485 , iDebugInfo); |
|
486 } |
|
487 else if ((*iCurrentCommand) == KCommandImapCheckSelectedMail) |
|
488 { |
|
489 CheckNumberOfArgumentsL(0); |
|
490 iImapClientTest.AddStateL(new (ELeave) CImapCheckSelectedMail(*(iImapClientTest.iCurrentSelection), iImapClientTest.MsvTestUtils()) |
|
491 , iDebugInfo); |
|
492 } |
|
493 else if ((*iCurrentCommand) == KCommandImapSetSyncRate) |
|
494 { |
|
495 CheckNumberOfArgumentsL(1); |
|
496 TUint syncRate; |
|
497 TLex syncRateLex((*iArgumentList)[0]); |
|
498 User::LeaveIfError(syncRateLex.Val(syncRate)); |
|
499 |
|
500 iImapClientTest.AddStateL(new (ELeave) CImapSetSyncRate(syncRate,iImapClientTest), iDebugInfo); |
|
501 } |
|
502 else if ((*iCurrentCommand) == KCommandImapGetSyncRate) |
|
503 { |
|
504 CheckNumberOfArgumentsL(1); |
|
505 TUint syncRate; |
|
506 TLex syncRateLex((*iArgumentList)[0]); |
|
507 User::LeaveIfError(syncRateLex.Val(syncRate)); |
|
508 |
|
509 iImapClientTest.AddStateL(new (ELeave) CImapGetSyncRate(syncRate,iImapClientTest), iDebugInfo); |
|
510 } |
|
511 else |
|
512 { |
|
513 User::Leave(KErrNotFound); |
|
514 } |
|
515 } |
|
516 |
|
517 void CImapOperationParser::ConstructL() |
|
518 { |
|
519 CBaseCommandParser::ConstructL(); |
|
520 AddCommandL(KCommandImapConnect); |
|
521 AddCommandL(KCommandImapConnectAndCancel); |
|
522 AddCommandL(KCommandImapConnectAndMonitor); |
|
523 AddCommandL(KCommandImapConnectMonitorAndSync); |
|
524 AddCommandL(KCommandImapConnectAndSync); |
|
525 AddCommandL(KCommandImapConnectAndPeriodicSync); |
|
526 AddCommandL(KCommandImapDisconnect); |
|
527 AddCommandL(KCommandImapUseService); |
|
528 AddCommandL(KCommandImapCheckRemoteInbox); |
|
529 AddCommandL(KCommandImapSyncTree); |
|
530 AddCommandL(KCommandImapSyncFolder); |
|
531 AddCommandL(KCommandImapSubscribeFolder); |
|
532 AddCommandL(KCommandImapUnsubscribeFolder); |
|
533 AddCommandL(KCommandImapPopulateFolder); |
|
534 AddCommandL(KCommandImapPerformFullSync); |
|
535 AddCommandL(KCommandImapSetSyncLimits); |
|
536 AddCommandL(KCommandImapMarkSelection); |
|
537 AddCommandL(KCommandImapCheckSelectionUnread); |
|
538 AddCommandL(KCommandImapCheckSelectionSeen); |
|
539 AddCommandL(KCommandImapMarkSelectedMail); |
|
540 AddCommandL(KCommandImapCheckSelectedMail); |
|
541 AddCommandL(KCommandImapSetSyncRate); |
|
542 AddCommandL(KCommandImapGetSyncRate); |
|
543 } |
|
544 |
|
545 CImapOperationParser::CImapOperationParser(CImapClientTest& aImapClientTest) : iImapClientTest(aImapClientTest) |
|
546 { |
|
547 } |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 // |
|
553 // |
|
554 // CImapCheckStatusParser |
|
555 // |
|
556 |
|
557 |
|
558 CImapCheckStatusParser* CImapCheckStatusParser::NewL(CImapClientTest& aImapTestHarness) |
|
559 { |
|
560 CImapCheckStatusParser* self = new (ELeave) CImapCheckStatusParser(aImapTestHarness); |
|
561 CleanupStack::PushL(self); |
|
562 self->ConstructL(); |
|
563 CleanupStack::Pop(self); |
|
564 return self; |
|
565 } |
|
566 |
|
567 void CImapCheckStatusParser::ProcessL() |
|
568 { |
|
569 TLex lex((*iArgumentList)[0]); |
|
570 TInt expectedStatus; |
|
571 User::LeaveIfError(lex.Val(expectedStatus)); |
|
572 iTestHarness.AddStateL(new (ELeave) CCheckImapOperation(expectedStatus, iTestHarness), iDebugInfo); |
|
573 } |
|
574 |
|
575 CImapCheckStatusParser::CImapCheckStatusParser(CImapClientTest& aImapTestHarness) : iTestHarness(aImapTestHarness) |
|
576 { |
|
577 } |
|
578 |
|
579 void CImapCheckStatusParser::ConstructL() |
|
580 { |
|
581 CBaseCommandParser::ConstructL(); |
|
582 AddCommandL(KCommandImapCheckStatus); |
|
583 } |
|
584 |