|
1 // Copyright (c) 2008-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 // [TestStep Name] |
|
15 // UnitTestCPop3ClientMtm |
|
16 // [Paramaters] |
|
17 // [TestStep Description] |
|
18 // Invokes the API of the class CPop3ClientMtm for improving code coverage. |
|
19 // |
|
20 // |
|
21 |
|
22 #include "t_cpop3clientmtm.h" |
|
23 |
|
24 #include <t_utilsreademailsettingsfromconfigfile.h> |
|
25 #include <t_utilscentralrepository.h> |
|
26 //#include <imapset.h> |
|
27 #include <iapprefs.h> |
|
28 #include <popcmtm.h> |
|
29 |
|
30 /* Literals Used */ |
|
31 _LIT(KAccountName,"ImapAccountName"); |
|
32 _LIT8(KConfigFileName, "ImapConfigFileName"); |
|
33 _LIT(KDataComponentFilename, "c:\\system\\mtm\\testsmtm.dat"); |
|
34 _LIT(KDummyRealAddress,"test001@msexchange01.closedtest.intra"); |
|
35 _LIT(KDummyAlliasAddress,"subbutest"); |
|
36 const TInt KTempId = 10; |
|
37 |
|
38 const TUid KUidTestServerMtmType={0x10001304}; |
|
39 /** |
|
40 Function : CT_CPop3ClientMtm |
|
41 Description : Constructor |
|
42 @param : aSharedDataIMAP Reference to CT_MsgSharedDataImap |
|
43 @return : N/A |
|
44 */ |
|
45 CT_CPop3ClientMtm::CT_CPop3ClientMtm(CT_MsgSharedDataPop& aSharedDataPOP) |
|
46 : CT_MsgSyncStepPOP(aSharedDataPOP) |
|
47 { |
|
48 SetTestStepName(KUnitTestCPop3ClientMtm); |
|
49 } |
|
50 |
|
51 /** |
|
52 Function : ~CT_CPop3ClientMtm |
|
53 Description : Destructor |
|
54 @return : N/A |
|
55 */ |
|
56 CT_CPop3ClientMtm::~CT_CPop3ClientMtm() |
|
57 { |
|
58 } |
|
59 |
|
60 void CT_CPop3ClientMtm::TestValidateMessageL() |
|
61 { |
|
62 TInt error = KErrGeneral; |
|
63 INFO_PRINTF1(_L("Testing: Validate Message -- started")); |
|
64 |
|
65 TRAP(error, iSession = CMsvSession::OpenSyncL(*this)); |
|
66 TEST(error == KErrNone); |
|
67 |
|
68 CClientMtmRegistry *theClientRegistry=CClientMtmRegistry::NewL(*iSession,KMsvDefaultTimeoutMicroSeconds32); |
|
69 TEST(theClientRegistry != NULL); |
|
70 TEST(theClientRegistry->IsPresent(KUidMsgTypePOP3)); |
|
71 CleanupStack::PushL(theClientRegistry); |
|
72 |
|
73 CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); |
|
74 CleanupStack::PushL(cEntry); |
|
75 |
|
76 CPop3ClientMtm *theClientMtm=(CPop3ClientMtm*)theClientRegistry->NewMtmL(KUidMsgTypePOP3); |
|
77 |
|
78 CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection; |
|
79 CleanupStack::PushL(selection); |
|
80 |
|
81 cEntry->SetEntryL(KMsvRootIndexEntryId); |
|
82 TMsvEntry service; |
|
83 service.iType=KUidMsvServiceEntry; |
|
84 service.iMtm = KUidTestServerMtmType; |
|
85 cEntry->CreateL(service); |
|
86 cEntry->SetEntryL(service.Id()); |
|
87 selection->AppendL(service.Id()); |
|
88 CleanupStack::PopAndDestroy(selection); |
|
89 CleanupStack::Pop(cEntry); |
|
90 |
|
91 theClientMtm->SetCurrentEntryL(cEntry); |
|
92 theClientMtm->SaveMessageL(); |
|
93 INFO_PRINTF1(_L("Testing ValidateMessage with KMsvMessagePartRecipient")); |
|
94 theClientMtm->ValidateMessage(KMsvMessagePartRecipient); |
|
95 INFO_PRINTF1(_L("Testing ValidateMessage with KMsvMessagePartOriginator")); |
|
96 theClientMtm->ValidateMessage(KMsvMessagePartOriginator); |
|
97 CleanupStack::Pop(theClientRegistry); |
|
98 delete iSession; |
|
99 INFO_PRINTF1(_L("Testing: Validate Message -- ended")); |
|
100 } |
|
101 |
|
102 void CT_CPop3ClientMtm::TestKErrNotSupportedAPI() |
|
103 { |
|
104 TInt error = KErrGeneral; |
|
105 INFO_PRINTF1(_L("Testing: Validate Message -- started")); |
|
106 |
|
107 CMsvOperationWait *active = CMsvOperationWait::NewLC(); |
|
108 TRAP(error, iSession = CMsvSession::OpenSyncL(*this)); |
|
109 TEST(error == KErrNone); |
|
110 |
|
111 CClientMtmRegistry *theClientRegistry=CClientMtmRegistry::NewL(*iSession,KMsvDefaultTimeoutMicroSeconds32); |
|
112 TEST(theClientRegistry != NULL); |
|
113 TEST(theClientRegistry->IsPresent(KUidMsgTypePOP3)); |
|
114 CleanupStack::PushL(theClientRegistry); |
|
115 |
|
116 CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); |
|
117 CleanupStack::PushL(cEntry); |
|
118 |
|
119 CPop3ClientMtm *theClientMtm=(CPop3ClientMtm*)theClientRegistry->NewMtmL(KUidMsgTypePOP3); |
|
120 |
|
121 CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection; |
|
122 CleanupStack::PushL(selection); |
|
123 |
|
124 cEntry->SetEntryL(KMsvRootIndexEntryId); |
|
125 TMsvEntry service; |
|
126 service.iType=KUidMsvServiceEntry; |
|
127 service.iMtm = KUidTestServerMtmType; |
|
128 cEntry->CreateL(service); |
|
129 cEntry->SetEntryL(service.Id()); |
|
130 selection->AppendL(service.Id()); |
|
131 CleanupStack::PopAndDestroy(selection); |
|
132 CleanupStack::Pop(cEntry); |
|
133 |
|
134 theClientMtm->SetCurrentEntryL(cEntry); |
|
135 theClientMtm->SaveMessageL(); |
|
136 INFO_PRINTF1(_L("Testing: API - AddAttachmentL : started")); |
|
137 TRAP(error, theClientMtm->AddAttachmentL(KAccountName,KConfigFileName, KTempId, active->iStatus)); |
|
138 TEST(error == KErrNotSupported); |
|
139 INFO_PRINTF1(_L("Testing: API - AddAttachmentL : ended")); |
|
140 error = KErrGeneral; |
|
141 INFO_PRINTF1(_L("Testing: API - AddAttachmentL with FileSession : started")); |
|
142 RFile *tempFile = NULL; |
|
143 TRAP(error, theClientMtm->AddAttachmentL(*tempFile,KConfigFileName, KTempId, active->iStatus)); |
|
144 TEST(error == KErrNotSupported); |
|
145 INFO_PRINTF1(_L("Testing: API - AddAttachmentL with FileSession : ended")); |
|
146 error = KErrGeneral; |
|
147 INFO_PRINTF1(_L("Testing: API - AddLinkedAttachmentL : started")); |
|
148 TRAP(error, theClientMtm->AddLinkedAttachmentL(KAccountName,KConfigFileName, KTempId, active->iStatus)); |
|
149 TEST(error == KErrNotSupported); |
|
150 INFO_PRINTF1(_L("Testing: API - AddLinkedAttachmentL : ended")); |
|
151 error = KErrGeneral; |
|
152 INFO_PRINTF1(_L("Testing: API - AddEntryAsAttachmentL : started")); |
|
153 TRAP(error, theClientMtm->AddEntryAsAttachmentL(KTempId, active->iStatus)); |
|
154 TEST(error == KErrNotSupported); |
|
155 INFO_PRINTF1(_L("Testing: API - AddEntryAsAttachmentL : ended")); |
|
156 error = KErrGeneral; |
|
157 INFO_PRINTF1(_L("Testing: API - CreateAttachmentL : started")); |
|
158 TRAP(error, theClientMtm->CreateAttachmentL(KAccountName, *tempFile, KConfigFileName, KTempId, active->iStatus)); |
|
159 TEST(error == KErrNotSupported); |
|
160 INFO_PRINTF1(_L("Testing: API - CreateAttachmentL : ended")); |
|
161 error = KErrGeneral; |
|
162 INFO_PRINTF1(_L("Testing: API - CreateMessageL : started")); |
|
163 TRAP(error, theClientMtm->CreateMessageL(KTempId)); |
|
164 TEST(error == KErrNotSupported); |
|
165 INFO_PRINTF1(_L("Testing: API - CreateMessageL : ended")); |
|
166 error = KErrGeneral; |
|
167 INFO_PRINTF1(_L("Testing: API - DefaultServiceL : started")); |
|
168 TRAP(error, theClientMtm->DefaultServiceL()); |
|
169 TEST(error == KErrNotSupported); |
|
170 INFO_PRINTF1(_L("Testing: API - DefaultServiceL : ended")); |
|
171 error = KErrGeneral; |
|
172 INFO_PRINTF1(_L("Testing: API - RemoveDefaultServiceL : started")); |
|
173 TRAP(error, theClientMtm->RemoveDefaultServiceL()); |
|
174 TEST(error == KErrNotSupported); |
|
175 INFO_PRINTF1(_L("Testing: API - RemoveDefaultServiceL : ended")); |
|
176 error = KErrGeneral; |
|
177 INFO_PRINTF1(_L("Testing: API - ChangeDefaultServiceL : started")); |
|
178 TRAP(error, theClientMtm->ChangeDefaultServiceL(KTempId)); |
|
179 TEST(error == KErrNotSupported); |
|
180 INFO_PRINTF1(_L("Testing: API - ChangeDefaultServiceL : ended")); |
|
181 |
|
182 CleanupStack::Pop(theClientRegistry); |
|
183 CleanupStack::PopAndDestroy(active); |
|
184 delete iSession; |
|
185 } |
|
186 |
|
187 void CT_CPop3ClientMtm::TestReplyL() |
|
188 { |
|
189 TInt error = KErrGeneral; |
|
190 INFO_PRINTF1(_L("Testing: ReplyL -- started")); |
|
191 |
|
192 TRAP(error, iSession = CMsvSession::OpenSyncL(*this)); |
|
193 TEST(error == KErrNone); |
|
194 |
|
195 CMsvOperationWait* active = CMsvOperationWait::NewLC(); |
|
196 |
|
197 CClientMtmRegistry *theClientRegistry=CClientMtmRegistry::NewL(*iSession,KMsvDefaultTimeoutMicroSeconds32); |
|
198 TEST(theClientRegistry != NULL); |
|
199 TEST(theClientRegistry->IsPresent(KUidMsgTypePOP3)); |
|
200 CleanupStack::PushL(theClientRegistry); |
|
201 |
|
202 CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); |
|
203 CleanupStack::PushL(cEntry); |
|
204 |
|
205 CPop3ClientMtm *theClientMtm=(CPop3ClientMtm*)theClientRegistry->NewMtmL(KUidMsgTypePOP3); |
|
206 |
|
207 CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection; |
|
208 CleanupStack::PushL(selection); |
|
209 |
|
210 cEntry->SetEntryL(KMsvRootIndexEntryId); |
|
211 TMsvEntry service; |
|
212 service.iType=KUidMsvServiceEntry; |
|
213 service.iMtm = KUidTestServerMtmType; |
|
214 cEntry->CreateL(service); |
|
215 cEntry->SetEntryL(service.Id()); |
|
216 selection->AppendL(service.Id()); |
|
217 CleanupStack::PopAndDestroy(selection); |
|
218 CleanupStack::Pop(cEntry); |
|
219 TMsvPartList partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator; |
|
220 |
|
221 theClientMtm->SetCurrentEntryL(cEntry); |
|
222 CMsvOperation* operation = NULL; |
|
223 active->Start(); |
|
224 operation = theClientMtm->ReplyL(KMsvDraftEntryId, partList, active->iStatus); |
|
225 CActiveScheduler::Start(); |
|
226 TEST(operation->iStatus.Int()==KErrNone); |
|
227 delete operation; |
|
228 CleanupStack::Pop(theClientRegistry); |
|
229 CleanupStack::Pop(active); |
|
230 delete iSession; |
|
231 INFO_PRINTF1(_L("Testing: ReplyL -- ended")); |
|
232 } |
|
233 |
|
234 void CT_CPop3ClientMtm::TestAddAddresseeL() |
|
235 { |
|
236 TInt error = KErrGeneral; |
|
237 INFO_PRINTF1(_L("Testing: TestAddAddresseeL -- started")); |
|
238 |
|
239 CMsvOperationWait *active = CMsvOperationWait::NewLC(); |
|
240 TRAP(error, iSession = CMsvSession::OpenSyncL(*this)); |
|
241 TEST(error == KErrNone); |
|
242 |
|
243 CClientMtmRegistry *theClientRegistry=CClientMtmRegistry::NewL(*iSession,KMsvDefaultTimeoutMicroSeconds32); |
|
244 TEST(theClientRegistry != NULL); |
|
245 TEST(theClientRegistry->IsPresent(KUidMsgTypePOP3)); |
|
246 CleanupStack::PushL(theClientRegistry); |
|
247 |
|
248 CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); |
|
249 CleanupStack::PushL(cEntry); |
|
250 |
|
251 CPop3ClientMtm *theClientMtm=(CPop3ClientMtm*)theClientRegistry->NewMtmL(KUidMsgTypePOP3); |
|
252 |
|
253 CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection; |
|
254 CleanupStack::PushL(selection); |
|
255 |
|
256 cEntry->SetEntryL(KMsvRootIndexEntryId); |
|
257 TMsvEntry service; |
|
258 service.iType=KUidMsvServiceEntry; |
|
259 service.iMtm = KUidTestServerMtmType; |
|
260 cEntry->CreateL(service); |
|
261 cEntry->SetEntryL(service.Id()); |
|
262 selection->AppendL(service.Id()); |
|
263 CleanupStack::PopAndDestroy(selection); |
|
264 CleanupStack::Pop(cEntry); |
|
265 |
|
266 theClientMtm->SetCurrentEntryL(cEntry); |
|
267 theClientMtm->SaveMessageL(); |
|
268 INFO_PRINTF1(_L("Testing: API - TestAddAddresseeL with realaddress")); |
|
269 theClientMtm->AddAddresseeL(KDummyRealAddress); |
|
270 INFO_PRINTF1(_L("Testing: API - TestAddAddresseeL with realaddress")); |
|
271 theClientMtm->AddAddresseeL(KDummyRealAddress, KDummyAlliasAddress); |
|
272 INFO_PRINTF1(_L("Testing: API - TestAddAddresseeL -- ended")); |
|
273 |
|
274 CleanupStack::Pop(theClientRegistry); |
|
275 CleanupStack::PopAndDestroy(active); |
|
276 delete iSession; |
|
277 } |
|
278 |
|
279 void CT_CPop3ClientMtm::TestRemoveAddresseeL() |
|
280 { |
|
281 TInt error = KErrGeneral; |
|
282 INFO_PRINTF1(_L("Testing: TestAddAddresseeL -- started")); |
|
283 |
|
284 CMsvOperationWait *active = CMsvOperationWait::NewLC(); |
|
285 TRAP(error, iSession = CMsvSession::OpenSyncL(*this)); |
|
286 TEST(error == KErrNone); |
|
287 |
|
288 CClientMtmRegistry *theClientRegistry=CClientMtmRegistry::NewL(*iSession,KMsvDefaultTimeoutMicroSeconds32); |
|
289 TEST(theClientRegistry != NULL); |
|
290 TEST(theClientRegistry->IsPresent(KUidMsgTypePOP3)); |
|
291 CleanupStack::PushL(theClientRegistry); |
|
292 |
|
293 CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering()); |
|
294 CleanupStack::PushL(cEntry); |
|
295 |
|
296 CPop3ClientMtm *theClientMtm=(CPop3ClientMtm*)theClientRegistry->NewMtmL(KUidMsgTypePOP3); |
|
297 |
|
298 CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection; |
|
299 CleanupStack::PushL(selection); |
|
300 |
|
301 cEntry->SetEntryL(KMsvRootIndexEntryId); |
|
302 TMsvEntry service; |
|
303 service.iType=KUidMsvServiceEntry; |
|
304 service.iMtm = KUidTestServerMtmType; |
|
305 cEntry->CreateL(service); |
|
306 cEntry->SetEntryL(service.Id()); |
|
307 selection->AppendL(service.Id()); |
|
308 CleanupStack::PopAndDestroy(selection); |
|
309 CleanupStack::Pop(cEntry); |
|
310 |
|
311 theClientMtm->SetCurrentEntryL(cEntry); |
|
312 theClientMtm->SaveMessageL(); |
|
313 theClientMtm->AddAddresseeL(KDummyRealAddress); |
|
314 INFO_PRINTF1(_L("Testing: API - RemoveAddressee with realaddress")); |
|
315 TInt firstAddress = 0; |
|
316 theClientMtm->RemoveAddressee(firstAddress); |
|
317 INFO_PRINTF1(_L("Testing: API - TestAddAddresseeL -- ended")); |
|
318 |
|
319 CleanupStack::Pop(theClientRegistry); |
|
320 CleanupStack::PopAndDestroy(active); |
|
321 delete iSession; |
|
322 } |
|
323 |
|
324 void CT_CPop3ClientMtm::HandleSessionEventL(TMsvSessionEvent aEvent, TAny*, TAny*, TAny*) |
|
325 { |
|
326 INFO_PRINTF1(_L("Entered Handlesession EventL")); |
|
327 switch(aEvent) |
|
328 { |
|
329 case EMsvEntriesCreated: |
|
330 INFO_PRINTF1(_L("Entries created")); |
|
331 break; |
|
332 case EMsvEntriesChanged: |
|
333 INFO_PRINTF1(_L("Entries Changed")); |
|
334 break; |
|
335 case EMsvEntriesDeleted: |
|
336 INFO_PRINTF1(_L("Entried Deleted")); |
|
337 break; |
|
338 case EMsvEntriesMoved: |
|
339 INFO_PRINTF1(_L("Entried Moved")); |
|
340 break; |
|
341 case EMsvMtmGroupInstalled: |
|
342 INFO_PRINTF1(_L("Mtm Group Installed")); |
|
343 break; |
|
344 case EMsvMtmGroupDeInstalled: |
|
345 INFO_PRINTF1(_L("Mtm Group De-installed")); |
|
346 break; |
|
347 case EMsvGeneralError: |
|
348 INFO_PRINTF1(_L("General Error occured")); |
|
349 break; |
|
350 case EMsvCloseSession: |
|
351 INFO_PRINTF1(_L("Session Closed")); |
|
352 break; |
|
353 case EMsvServerReady: |
|
354 INFO_PRINTF1(_L("Server Ready")); |
|
355 break; |
|
356 case EMsvServerFailedToStart: |
|
357 INFO_PRINTF1(_L("Failed to start")); |
|
358 break; |
|
359 case EMsvCorruptedIndexRebuilt: |
|
360 INFO_PRINTF1(_L("Corrupted Intex rebuilt")); |
|
361 break; |
|
362 case EMsvServerTerminated: |
|
363 INFO_PRINTF1(_L("Server terminated")); |
|
364 break; |
|
365 case EMsvMediaChanged: |
|
366 INFO_PRINTF1(_L("Media Changed")); |
|
367 break; |
|
368 EMsvMediaUnavailable: |
|
369 INFO_PRINTF1(_L("Media Unavailable")); |
|
370 break; |
|
371 case EMsvMediaAvailable: |
|
372 INFO_PRINTF1(_L("Media Available")); |
|
373 break; |
|
374 case EMsvMediaIncorrect: |
|
375 INFO_PRINTF1(_L("Media Incorrect")); |
|
376 break; |
|
377 case EMsvCorruptedIndexRebuilding: |
|
378 INFO_PRINTF1(_L("Corrupted Index Rebuilding")); |
|
379 break; |
|
380 } |
|
381 INFO_PRINTF1(_L("Exited Handlesession EventL")); |
|
382 } |
|
383 |
|
384 /*TMsvId CT_CPop3ClientMtm::CreateMessageL() |
|
385 { |
|
386 // Handle command line arguments |
|
387 //CCommandLineArguments* cmdLineArg=CCommandLineArguments::NewLC(); |
|
388 //TInt count = cmdLineArg->Count(); |
|
389 //TBool isCmdLine=FALSE; |
|
390 //if (count>2) // Command line arguments? |
|
391 // { |
|
392 // if ((!(cmdLineArg->Arg(EArgTestParams).Compare(KTestParams))) && count==EArgEnd) |
|
393 // isCmdLine=TRUE; |
|
394 // } |
|
395 |
|
396 // testUtils->TestStart(testNo++); |
|
397 // CTestActive* testActive = new (ELeave) CTestActive(); |
|
398 // CleanupStack::PushL(testActive); |
|
399 |
|
400 TRAP(error, iSession = CMsvSession::OpenSyncL(*this)); |
|
401 TEST(error == KErrNone); |
|
402 |
|
403 TMsvPartList partList = KMsvMessagePartBody | KMsvMessagePartAttachments | KMsvMessagePartDescription | KMsvMessagePartOriginator; |
|
404 TMsvEmailTypeList msvEmailTypeList = 0; |
|
405 |
|
406 |
|
407 CMsvOperationWait* active = CMsvOperationWait::NewLC(); |
|
408 active->Start(); |
|
409 CImEmailOperation* emailOperation = CImEmailOperation::CreateNewL(active->iStatus, *iSession, KMsvGlobalOutBoxIndexEntryId, partList, msvEmailTypeList, KUidMsgTypeSMTP); |
|
410 CleanupStack::PushL(emailOperation); |
|
411 |
|
412 // TestUiTimer* testUiTimer = TestUiTimer::NewLC(test.Console(), emailOperation); |
|
413 // testActive->StartL(); |
|
414 // testUiTimer->IssueRequest(); |
|
415 CActiveScheduler::Start(); |
|
416 |
|
417 TMsvId temp; |
|
418 TPckgC<TMsvId> paramPack(temp); |
|
419 const TDesC8& progBuf = emailOperation->ProgressL(); |
|
420 paramPack.Set(progBuf); |
|
421 TMsvId messageId=paramPack(); |
|
422 TInt error = emailOperation->iStatus.Int(); |
|
423 CleanupStack::PopAndDestroy(emailOperation); |
|
424 CleanupStack::PopAndDestroy(active); |
|
425 //CleanupStack::PopAndDestroy(3, testActive); // testActive, emailOperation, testUiTimer |
|
426 //testUtils->TestFinish(testNo-1, error); |
|
427 //log->AppendComment(_L8(" Messages created in the outbox")); |
|
428 |
|
429 // fill in details for email message |
|
430 testUtils->iMsvEntry->SetEntryL(messageId); |
|
431 CMsvStore* store = testUtils->iMsvEntry->EditStoreL(); |
|
432 CleanupStack::PushL(store); |
|
433 CImHeader* header = CImHeader::NewLC(); |
|
434 header->RestoreL(*store); |
|
435 |
|
436 if (isCmdLine) |
|
437 { |
|
438 TBuf<100> buf; |
|
439 TLex lex(cmdLineArg->Arg(EArgEmail)); |
|
440 buf=lex.NextToken(); |
|
441 header->ToRecipients().AppendL(buf); |
|
442 } |
|
443 else |
|
444 header->ToRecipients().AppendL(_L("t_smtc@lon-msgtest06.intra")); |
|
445 |
|
446 header->SetSubjectL(_L("Message from T_SMTC Typhoon!!")); |
|
447 header->StoreL(*store); |
|
448 store->CommitL(); |
|
449 CleanupStack::PopAndDestroy(3, cmdLineArg); // cmdLineArg, header, store |
|
450 |
|
451 //store some body text!! |
|
452 CParaFormatLayer* paraFormatLayer=CParaFormatLayer::NewL(); |
|
453 CleanupStack::PushL(paraFormatLayer); |
|
454 |
|
455 CCharFormatLayer* charFormatLayer=CCharFormatLayer::NewL(); |
|
456 CleanupStack::PushL(charFormatLayer); |
|
457 |
|
458 CRichText* bodyText=CRichText::NewL(paraFormatLayer, charFormatLayer, CEditableText::EFlatStorage, 256); |
|
459 CleanupStack::PushL(bodyText); |
|
460 |
|
461 TBuf<100> bodyContents = _L("Test body contents so that we can test the store body text code."); |
|
462 bodyText->InsertL(0, bodyContents); |
|
463 |
|
464 // store the body text |
|
465 testActive = new (ELeave) CTestActive(); |
|
466 CleanupStack::PushL(testActive); |
|
467 |
|
468 CImEmailMessage* imEmailMessage = CImEmailMessage::NewLC(*(testUtils->iMsvEntry)); |
|
469 imEmailMessage->StoreBodyTextL(messageId, *bodyText, testActive->iStatus); |
|
470 testActive->StartL(); |
|
471 CActiveScheduler::Start(); // wait for the asynch operation to complete |
|
472 CleanupStack::PopAndDestroy(5, paraFormatLayer); // imEmailMessage, testActive, bodyText, charFormatLayer, paraFormatLayer |
|
473 |
|
474 // Add an attachment |
|
475 testActive = new (ELeave) CTestActive(); |
|
476 CleanupStack::PushL(testActive); |
|
477 |
|
478 imEmailMessage = CImEmailMessage::NewLC(*(testUtils->iMsvEntry)); |
|
479 CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); |
|
480 CleanupStack::PushL(attachmentInfo); |
|
481 imEmailMessage->AttachmentManager().AddAttachmentL(KAttachment1,attachmentInfo,testActive->iStatus); |
|
482 CleanupStack::Pop(attachmentInfo); |
|
483 testActive->StartL(); |
|
484 CActiveScheduler::Start(); // wait for the asynch operation to complete |
|
485 CleanupStack::PopAndDestroy(2, testActive); |
|
486 |
|
487 return messageId; |
|
488 }*/ |
|
489 |
|
490 /** |
|
491 Function : doTestStepL |
|
492 Description : |
|
493 @return : TVerdict - Test step result |
|
494 @leave : KMsvNullIndexEntryId Invalid IMAP account name specified |
|
495 */ |
|
496 TVerdict CT_CPop3ClientMtm::doTestStepL() |
|
497 { |
|
498 INFO_PRINTF1(_L("Test Step : CPop3ClientMtm Started")); |
|
499 TestValidateMessageL(); |
|
500 //TestReplyL(); |
|
501 TestKErrNotSupportedAPI(); |
|
502 TestAddAddresseeL(); |
|
503 TestRemoveAddresseeL(); |
|
504 INFO_PRINTF1(_L("Test Step : CPop3ClientMtm Ended")); |
|
505 |
|
506 return TestStepResult(); |
|
507 } |