|
1 // Copyright (c) 2003-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 "commands.h" |
|
17 #include <biodb.h> |
|
18 #include <bitsids.h> |
|
19 #include <biouids.h> |
|
20 #include <miutset.h> |
|
21 #include <pop3set.h> |
|
22 #include <imapset.h> |
|
23 #include <smtpset.h> |
|
24 #include <smutset.h> |
|
25 #include <mtmdef.h> |
|
26 #include <regpsdll.h> |
|
27 |
|
28 #include <cmsvattachment.h> |
|
29 #include <mmsvattachmentmanager.h> |
|
30 #include <cemailaccounts.h> |
|
31 |
|
32 #ifdef SYMBIAN_BOOKMARK_DATABASE |
|
33 #include <bookmarkdatabase.h> |
|
34 #include <bookmark.h> |
|
35 _LIT(KTxtBookmarkExtension, ".ebm"); |
|
36 #endif // SYMBIAN_BOOKMARK_DATABASE |
|
37 |
|
38 #include <commsdat.h> |
|
39 #include <utf.h> |
|
40 #include <cdblen.h> |
|
41 |
|
42 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
43 #include "tmsvbioinfo.h" |
|
44 #endif |
|
45 |
|
46 // |
|
47 // CDoCmdGeneral |
|
48 // Handles the running of the genral commands |
|
49 |
|
50 // |
|
51 // For ECmdGeneralComment |
|
52 CDoCmdGeneral* CDoCmdGeneral::NewL(CClientTestHarness& aTestHarness, const CDesCArrayFlat& aComment, TCmdGeneral aCmd) |
|
53 { |
|
54 CDoCmdGeneral* self = NULL; |
|
55 |
|
56 switch(aCmd) |
|
57 { |
|
58 case(ECmdGeneralComment): |
|
59 { |
|
60 self = new (ELeave) CDoCmdGeneral(aTestHarness, ECmdGeneralComment); |
|
61 CleanupStack::PushL(self); |
|
62 self->ConstructL(aComment); |
|
63 CleanupStack::Pop(self); |
|
64 } |
|
65 break; |
|
66 |
|
67 case(ECmdGeneralCheckUsedBif): |
|
68 { |
|
69 self = new (ELeave) CDoCmdGeneral(aTestHarness, ECmdGeneralCheckUsedBif); |
|
70 CleanupStack::PushL(self); |
|
71 self->ConstructL(aComment); |
|
72 CleanupStack::Pop(self); |
|
73 } |
|
74 break; |
|
75 |
|
76 case(ECmdGeneralCheckFileWithExtExists): |
|
77 { |
|
78 self = new (ELeave) CDoCmdGeneral(aTestHarness, ECmdGeneralCheckFileWithExtExists); |
|
79 |
|
80 } |
|
81 break; |
|
82 |
|
83 case(ECmdGeneralPrettifyLog): |
|
84 { |
|
85 self = new (ELeave) CDoCmdGeneral(aTestHarness, ECmdGeneralPrettifyLog); |
|
86 } |
|
87 break; |
|
88 |
|
89 case(ECmdGeneralDumpMsg): |
|
90 { |
|
91 self = new (ELeave) CDoCmdGeneral(aTestHarness, ECmdGeneralDumpMsg); |
|
92 } |
|
93 break; |
|
94 |
|
95 case(ECmdGeneralGenerateFromFile): |
|
96 { |
|
97 self = new (ELeave) CDoCmdGeneral(aTestHarness, ECmdGeneralGenerateFromFile); |
|
98 CleanupStack::PushL(self); |
|
99 self->ConstructL(aComment); |
|
100 CleanupStack::Pop(self); |
|
101 } |
|
102 break; |
|
103 |
|
104 default: |
|
105 User::Leave(KErrNotFound); |
|
106 } |
|
107 |
|
108 return self; |
|
109 } |
|
110 |
|
111 // |
|
112 // For ECmdGeneralComment |
|
113 void CDoCmdGeneral::ConstructL(const CDesCArrayFlat& aComment) |
|
114 { |
|
115 switch(iCmd) |
|
116 { |
|
117 case(ECmdGeneralComment): |
|
118 { |
|
119 TInt commentSize = 0; |
|
120 for(TInt i = 0; i < aComment.Count(); i++) |
|
121 commentSize += ((aComment[i]).Length() + _L(" ").Size()); |
|
122 |
|
123 iComment = HBufC::NewL(commentSize); |
|
124 TPtr commentPtr = iComment->Des(); |
|
125 |
|
126 for(TInt j = 0; j < aComment.Count(); j++) |
|
127 { |
|
128 commentPtr.Append((aComment)[j]); |
|
129 commentPtr.Append(_L(" ")); |
|
130 } |
|
131 } |
|
132 break; |
|
133 |
|
134 case(ECmdGeneralGenerateFromFile): |
|
135 case(ECmdGeneralCheckUsedBif): |
|
136 { |
|
137 TBuf<KMaxFileName> mFilename; |
|
138 mFilename = aComment[0]; |
|
139 iComment=mFilename.AllocL(); |
|
140 } |
|
141 break; |
|
142 |
|
143 default: |
|
144 break; |
|
145 } |
|
146 } |
|
147 |
|
148 // |
|
149 // For ECmdGenerateFromSection |
|
150 CDoCmdGeneral* CDoCmdGeneral::NewL(CClientTestHarness& aTestHarness, const HBufC*& aBuffer, const TBIOMessageType& aMsgType, TCmdGeneral aCmd) |
|
151 { |
|
152 CDoCmdGeneral* self = new (ELeave) CDoCmdGeneral(aTestHarness, aCmd); |
|
153 CleanupStack::PushL(self); |
|
154 self->ConstructL(aBuffer, aMsgType); |
|
155 CleanupStack::Pop(self); |
|
156 return self; |
|
157 } |
|
158 |
|
159 void CDoCmdGeneral::ConstructL(const HBufC*& aBuffer, const TBIOMessageType& aMsgType) |
|
160 { |
|
161 // |
|
162 // Must make local copy of buffer; |
|
163 iBuffer = HBufC::NewMaxL(aBuffer->Length()); |
|
164 *iBuffer = *aBuffer; |
|
165 iMsgType = aMsgType; |
|
166 } |
|
167 |
|
168 // |
|
169 // For others |
|
170 CDoCmdGeneral* CDoCmdGeneral::NewL(CClientTestHarness& aTestHarness, TCmdGeneral aCmd) |
|
171 { |
|
172 CDoCmdGeneral* self = new (ELeave) CDoCmdGeneral(aTestHarness, aCmd); |
|
173 return self; |
|
174 } |
|
175 |
|
176 void CDoCmdGeneral::StartL(TRequestStatus& aStatus) |
|
177 { |
|
178 switch(iCmd) |
|
179 { |
|
180 case ECmdGeneralPrettifyLog: |
|
181 PrettifyLogL(); |
|
182 break; |
|
183 case ECmdGeneralDumpMsg: |
|
184 DumpCurrentMessageL(); |
|
185 break; |
|
186 case ECmdGeneralClean: |
|
187 { |
|
188 iTestHarness.TestUtils().CleanMessageFolderL(); |
|
189 } |
|
190 break; |
|
191 case ECmdGeneralComment: |
|
192 { |
|
193 // |
|
194 // Now we have to add the debugging line number which we only know at run time... |
|
195 TBuf<7> commentString; |
|
196 commentString.Format(_L("[%4d] "), iDebugInfo.LineNumber()); |
|
197 |
|
198 // |
|
199 // Create a pointer to the HBufC, realloc size and then insert new data... |
|
200 iComment = iComment->ReAllocL(iComment->Size() + commentString.Size()); |
|
201 TPtr commentPtr = iComment->Des(); |
|
202 commentPtr.Insert(0, commentString); |
|
203 iTestHarness.TestUtils().WriteComment(*iComment); |
|
204 break; |
|
205 } |
|
206 case ECmdGeneralGenerateFromFile: |
|
207 { |
|
208 GenerateBIOMessageFromFileL(*iComment); |
|
209 } |
|
210 break; |
|
211 case ECmdGeneralGenerateFromSection: |
|
212 GenerateBIOMessageFromSectionL(); |
|
213 break; |
|
214 case ECmdGeneralCheckUsedBif: |
|
215 CheckBifFileUsedL(*iComment); |
|
216 break; |
|
217 case ECmdGeneralCheckFileWithExtExists: |
|
218 CheckDataFileCreatedL(); |
|
219 break; |
|
220 case ECmdGeneralCleanAllBioMsgs: |
|
221 CleanAllBioMsgsL(); |
|
222 break; |
|
223 |
|
224 default: |
|
225 User::Leave(KErrNotFound); |
|
226 } |
|
227 |
|
228 // |
|
229 // We leave on error, so always say KErrNone |
|
230 TRequestStatus* req = &aStatus; |
|
231 User::RequestComplete(req, KErrNone); |
|
232 |
|
233 } |
|
234 |
|
235 CDoCmdGeneral::~CDoCmdGeneral() |
|
236 { |
|
237 delete iBuffer; |
|
238 delete iComment; |
|
239 } |
|
240 |
|
241 |
|
242 void CDoCmdGeneral::PrettifyLogL() |
|
243 { |
|
244 TParse loglocation; |
|
245 TFileName logfile; |
|
246 User::LeaveIfError(iTestHarness.TestUtils().ResolveLogFile(KNullDesC, loglocation)); |
|
247 logfile.Copy(loglocation.FullName()); |
|
248 logfile.Delete(logfile.Length()-1,1); |
|
249 iTestHarness.TestUtils().DoAppendVariantName(logfile); |
|
250 |
|
251 RFile Lfile; |
|
252 Lfile.Open(g_rfs,logfile,EFileRead|EFileShareAny); |
|
253 |
|
254 _LIT(KHTMLExtn,".html"); |
|
255 logfile.Append(KHTMLExtn); |
|
256 RFile Hfile; |
|
257 User::LeaveIfError(Hfile.Replace(g_rfs,logfile,EFileWrite|EFileShareAny)); |
|
258 |
|
259 _LIT8(KHTMLHeader,"<HTML><HEAD><TITLE>TBIO_T Test Logfile</TITLE></HEAD><BODY><PRE>\n\r"); |
|
260 _LIT8(KHTMLFooter,"</PRE></BODY>"); |
|
261 _LIT8(KHTMLRedLineStart,"<FONT COLOR=red>"); |
|
262 _LIT8(KHTMLGreenLineStart,"<FONT COLOR=green>"); |
|
263 _LIT8(KHTMLBlackLineStart,"<FONT COLOR=c0c0c0>"); |
|
264 _LIT8(KHTMLBlueLineStart,"<FONT COLOR=blue>"); |
|
265 _LIT8(KHTMLLineEnd,"</FONT><br>"); |
|
266 |
|
267 Hfile.Write(KHTMLHeader); |
|
268 |
|
269 TBuf8<258> mReadBuf; //258 = KMaxLogLineLength + '\n\r' |
|
270 |
|
271 TInt p=0; |
|
272 Lfile.Read(mReadBuf); |
|
273 while(mReadBuf.Length()>0) |
|
274 { |
|
275 TInt eol = mReadBuf.Locate('\n'); |
|
276 p+=eol+1; //skip the \r |
|
277 Lfile.Seek(ESeekStart,p); |
|
278 if (eol>0) |
|
279 { |
|
280 mReadBuf.SetLength(eol); //skip the \n |
|
281 |
|
282 _LIT8(KDesOK,"ok"); |
|
283 _LIT8(KDesError,"error"); |
|
284 _LIT8(KDesFailed,"failed"); |
|
285 _LIT8(KDesWarning,"warning"); |
|
286 |
|
287 TBuf8<20> linestart; |
|
288 |
|
289 linestart = KHTMLBlackLineStart; |
|
290 |
|
291 if (mReadBuf.FindF(KDesOK())>0) |
|
292 { |
|
293 linestart=KHTMLGreenLineStart; |
|
294 } |
|
295 else if (mReadBuf.FindF(KDesError())>0) |
|
296 { |
|
297 linestart=KHTMLRedLineStart; |
|
298 } |
|
299 else if (mReadBuf.FindF(KDesFailed())>0) |
|
300 { |
|
301 linestart=KHTMLRedLineStart; |
|
302 } |
|
303 else if (mReadBuf.FindF(KDesWarning())>0) |
|
304 { |
|
305 linestart=KHTMLBlueLineStart; |
|
306 } |
|
307 |
|
308 Hfile.Write(linestart); |
|
309 Hfile.Write(mReadBuf); |
|
310 Hfile.Write(KHTMLLineEnd); |
|
311 } |
|
312 |
|
313 Lfile.Read(mReadBuf); |
|
314 } |
|
315 |
|
316 Hfile.Write(KHTMLFooter); |
|
317 |
|
318 Hfile.Close(); |
|
319 Lfile.Close(); |
|
320 } |
|
321 |
|
322 void CDoCmdGeneral::CheckBifFileUsedL(TDesC& aExpectedName) |
|
323 { |
|
324 // Checks that the Message Type Uid is correct |
|
325 // NB - this will change to check the BIF Name when the |
|
326 // base source code has been updated to support it. |
|
327 iTestHarness.InstantiateClientMtmL(); |
|
328 |
|
329 const TMsvId& mMsg = iTestHarness.CurrentBioMsg(); |
|
330 |
|
331 iTestHarness.TestUtils().iMsvEntry->SetEntryL(mMsg); |
|
332 |
|
333 TMsvEntry tm = iTestHarness.TestUtils().iMsvEntry->Entry(); |
|
334 TInt mBioMsgInt = tm.iBioType; |
|
335 TUid mBioMsgUID = TUid::Uid(mBioMsgInt); |
|
336 |
|
337 TBuf<32> description; |
|
338 TUid mMessageTypeUid; |
|
339 TInt index; |
|
340 |
|
341 CBIODatabase* bioDB = CBIODatabase::NewLC(g_rfs); |
|
342 bioDB->GetBioIndexWithMsgIDL(mBioMsgUID, index); |
|
343 |
|
344 description.Copy(bioDB->BifReader(index).Description()); |
|
345 mMessageTypeUid=bioDB->BifReader(index).MessageTypeUid(); |
|
346 |
|
347 CleanupStack::PopAndDestroy(); // bioDB |
|
348 |
|
349 TBuf<32> mUidHexString; |
|
350 _LIT(KHexFormatString,"%x"); |
|
351 mUidHexString.Format(KHexFormatString,mMessageTypeUid); |
|
352 |
|
353 if (mUidHexString.CompareF(aExpectedName)!=0) |
|
354 { |
|
355 _LIT(KTmp,"ERROR - checking BIF MessageTypeUID - expected \"%S\" read \"%S\""); |
|
356 HBufC* td = HBufC::NewLC(KTmp().Length()+105); |
|
357 td->Des().Format(KTmp,&aExpectedName,&mUidHexString); |
|
358 iTestHarness.TestUtils().WriteComment(*td); |
|
359 CleanupStack::PopAndDestroy(td); |
|
360 |
|
361 User::Leave(KErrGeneral); //Test framework requires us to leave if test fails |
|
362 } |
|
363 else |
|
364 { |
|
365 _LIT(KOK,"OK Checked BIF FileTypeUid - correct"); |
|
366 iTestHarness.TestUtils().WriteComment(KOK); |
|
367 } |
|
368 } |
|
369 |
|
370 #ifdef SYMBIAN_BOOKMARK_DATABASE |
|
371 void CDoCmdGeneral::CheckBookmarksDbL() const |
|
372 { |
|
373 iTestHarness.TestUtils().WriteComment(_L("-- BookmarkDb Details --")); |
|
374 RBkDatabase bookmarkDb; |
|
375 bookmarkDb.OpenL(); |
|
376 CleanupClosePushL(bookmarkDb); |
|
377 RBkFolder rootFolder = bookmarkDb.OpenRootL(); |
|
378 CleanupClosePushL(rootFolder); |
|
379 RBkNode bookmarkItem; |
|
380 TBool foundBookmark = EFalse; |
|
381 const TInt bookmarkCount = rootFolder.Count(); |
|
382 for( TInt ii=0; ii<bookmarkCount; ++ii ) |
|
383 { |
|
384 bookmarkItem = rootFolder.OpenItemL(ii); |
|
385 CleanupClosePushL(bookmarkItem); |
|
386 if( bookmarkItem.Type() == Bookmark::ETypeBookmark ) |
|
387 { |
|
388 foundBookmark = ETrue; |
|
389 Bookmark::TItemId bookmarkId = bookmarkItem.Id(); |
|
390 CleanupStack::PopAndDestroy(&bookmarkItem); |
|
391 |
|
392 // bookmark found, display bookmark infomation |
|
393 RBkBookmark bookmark = bookmarkDb.OpenBookmarkL(bookmarkId); |
|
394 CleanupClosePushL(bookmark); |
|
395 TBuf<Bookmark::KMaxUriLength> uri; |
|
396 uri.Copy(bookmark.Uri()); |
|
397 iTestHarness.TestUtils().WriteComment(bookmark.Title()); |
|
398 iTestHarness.TestUtils().WriteComment(uri); |
|
399 CleanupStack::PopAndDestroy(&bookmark); |
|
400 iTestHarness.TestUtils().WriteComment(_L("-----")); |
|
401 } |
|
402 else |
|
403 { |
|
404 CleanupStack::PopAndDestroy(&bookmarkItem); |
|
405 } |
|
406 } |
|
407 |
|
408 CleanupStack::PopAndDestroy(2, &bookmarkDb); // rootFolder, bookmarkDb |
|
409 |
|
410 if( !foundBookmark ) |
|
411 { |
|
412 _LIT(KError,"ERROR - No bookmarks found in root folder of BookmarkDb."); |
|
413 iTestHarness.TestUtils().WriteComment(KError); |
|
414 User::Leave(KErrNotFound); |
|
415 } |
|
416 } |
|
417 #endif // SYMBIAN_BOOKMARK_DATABASE |
|
418 |
|
419 void CDoCmdGeneral::CheckDataFileCreatedL() |
|
420 { |
|
421 iTestHarness.InstantiateClientMtmL(); |
|
422 |
|
423 const TMsvId& messageId = iTestHarness.CurrentBioMsg(); |
|
424 |
|
425 iTestHarness.TestUtils().iMsvEntry->SetEntryL(messageId); |
|
426 |
|
427 TInt index; |
|
428 |
|
429 TMsvEntry tm = iTestHarness.TestUtils().iMsvEntry->Entry(); |
|
430 TInt mBioMsgInt = tm.iBioType; |
|
431 TUid mBioMsgUID = TUid::Uid(mBioMsgInt); |
|
432 |
|
433 CBIODatabase* bioDB = CBIODatabase::NewLC(g_rfs); |
|
434 bioDB->GetBioIndexWithMsgIDL(mBioMsgUID, index); |
|
435 |
|
436 TBuf<KMaxFileName> mExtn = bioDB->BifReader(index).FileExtension(); |
|
437 |
|
438 // The following section is necessary as semi-supported iacp functions |
|
439 // (e.g. WWWHotlist) just create a file, but the bif file doesn't have |
|
440 // a file extension field set. DPS |
|
441 _LIT(KNullString,""); |
|
442 |
|
443 if (mExtn==KNullString) |
|
444 { |
|
445 _LIT(KNullExtensionWarning,"Warning: file extension read from BIF file is NULL!"); |
|
446 iTestHarness.TestUtils().WriteComment(KNullExtensionWarning); |
|
447 |
|
448 _LIT(KWWWHotlistExtn,".eBM"); |
|
449 |
|
450 if (bioDB->BifReader(index).MessageTypeUid().iUid==KUidBIOInternetAccessPointMsg) |
|
451 { |
|
452 mExtn = KWWWHotlistExtn; |
|
453 |
|
454 _LIT(KNullFixupWarning,"Warning: As MessageTypeUid indicates IACP msg, guessed .eBM"); |
|
455 iTestHarness.TestUtils().WriteComment(KNullFixupWarning); |
|
456 } |
|
457 |
|
458 // The same if ture for WAPP bookmarks. See comment above. |
|
459 else if (bioDB->BifReader(index).MessageTypeUid().iUid == KUidBIOWAPAccessPointMsg) |
|
460 { |
|
461 mExtn = KWWWHotlistExtn; |
|
462 |
|
463 _LIT(KNullFixupWarning,"Warning: As MessageTypeUid indicates WAPP msg, guessed .eBM"); |
|
464 iTestHarness.TestUtils().WriteComment(KNullFixupWarning); |
|
465 } |
|
466 } |
|
467 |
|
468 CleanupStack::PopAndDestroy(bioDB); |
|
469 |
|
470 // a <message id>.ebm attachment should exist |
|
471 CMsvStore* store = iTestHarness.TestUtils().iMsvEntry->ReadStoreL(); |
|
472 CleanupStack::PushL(store); |
|
473 MMsvAttachmentManager& manager = store->AttachmentManagerL(); |
|
474 TBool found = EFalse; |
|
475 TBuf<KMaxFileName> ebmFilename; |
|
476 ebmFilename.Format(_L("%x%S"), messageId,&mExtn); |
|
477 for( TInt ii=0; ii<manager.AttachmentCount(); ++ii ) |
|
478 { |
|
479 CMsvAttachment* attachment = manager.GetAttachmentInfoL(ii); |
|
480 if( attachment->AttachmentName().CompareF(ebmFilename) == 0 ) |
|
481 { |
|
482 found = ETrue; |
|
483 } |
|
484 delete attachment; |
|
485 |
|
486 if( found ) |
|
487 { |
|
488 break; |
|
489 } |
|
490 } |
|
491 CleanupStack::PopAndDestroy(store); |
|
492 |
|
493 TBuf<KMaxFileName+40> mOut; |
|
494 if( found ) |
|
495 { |
|
496 _LIT(KOK,"OK File Exists (%S)"); |
|
497 mOut.Format(KOK, &ebmFilename); |
|
498 iTestHarness.TestUtils().WriteComment(mOut); |
|
499 |
|
500 #ifdef SYMBIAN_BOOKMARK_DATABASE |
|
501 // File is found, ensure that bookmarks exists is database if it |
|
502 // is a bookmark file |
|
503 if( mExtn.CompareF(KTxtBookmarkExtension) == 0 ) |
|
504 { |
|
505 CheckBookmarksDbL(); |
|
506 } |
|
507 #endif // SYMBIAN_BOOKMARK_DATABASE |
|
508 } |
|
509 else |
|
510 { |
|
511 _LIT(KError,"ERROR: File [%S] not found!"); |
|
512 mOut.Format(KError, &ebmFilename); |
|
513 iTestHarness.TestUtils().WriteComment(mOut); |
|
514 |
|
515 User::Leave(KErrNotFound); |
|
516 } |
|
517 |
|
518 } |
|
519 |
|
520 |
|
521 void CDoCmdGeneral::DumpCurrentMessageL() |
|
522 { |
|
523 _LIT(KAboutToDump,"Dump of Parsed Fields:"); |
|
524 iTestHarness.TestUtils().WriteComment(KAboutToDump); |
|
525 |
|
526 iTestHarness.InstantiateClientMtmL(); |
|
527 |
|
528 const TMsvId& messageId = iTestHarness.CurrentBioMsg(); |
|
529 iTestHarness.TestUtils().iMsvEntry->SetEntryL(messageId); |
|
530 |
|
531 CMsvStore* mStore = iTestHarness.TestUtils().iMsvEntry->ReadStoreL(); |
|
532 CleanupStack::PushL(mStore); |
|
533 |
|
534 RMsvReadStream msgInStream; |
|
535 msgInStream.OpenLC(*mStore, KUidMsvBIODataStream); |
|
536 |
|
537 CParsedField* parsedField = new(ELeave) CParsedField(); |
|
538 CleanupStack::PushL(parsedField); |
|
539 |
|
540 TInt numOfFields = msgInStream.ReadUint8L(); |
|
541 |
|
542 for (TInt i = 0; i < numOfFields; i++) |
|
543 { |
|
544 parsedField->InternalizeL(msgInStream); |
|
545 |
|
546 TPtrC mFieldName = parsedField->FieldName(); |
|
547 TPtrC mFieldVal = parsedField->FieldValue(); |
|
548 |
|
549 HBufC* td = HBufC::NewLC(10+mFieldName.Length()+mFieldVal.Length()); |
|
550 |
|
551 _LIT(KTmp,"-- %S:\"%S\""); |
|
552 td->Des().Format(KTmp,&mFieldName,&mFieldVal); |
|
553 |
|
554 //NB this shouldn't really be needed as msgs should |
|
555 //be shorter than 160 chars, but some of the test data |
|
556 //aren't!! |
|
557 if (td->Length()>220) {td->Des().SetLength(220);} |
|
558 |
|
559 |
|
560 iTestHarness.TestUtils().WriteComment(*td); |
|
561 |
|
562 CleanupStack::PopAndDestroy(td); |
|
563 } |
|
564 |
|
565 CleanupStack::PopAndDestroy(parsedField); |
|
566 CleanupStack::PopAndDestroy(); // msgInStream.OpenLC ??? not sure what got created... |
|
567 CleanupStack::PopAndDestroy(mStore); |
|
568 } |
|
569 |
|
570 |
|
571 void CDoCmdGeneral::GenerateBIOMessageFromSectionL() |
|
572 { |
|
573 iTestHarness.InstantiateClientMtmL(); |
|
574 TMsvId newEntryId = iTestHarness.TestUtils().CreateBIOEntryL(*iBuffer, iMsgType); |
|
575 _LIT(KMessageGend,"Msg Generated from section with ID: (%d)"); |
|
576 |
|
577 TBuf<KMaxFileName*2> mComment; |
|
578 mComment.Format(KMessageGend, newEntryId); |
|
579 iTestHarness.TestUtils().WriteComment(mComment); |
|
580 |
|
581 // |
|
582 // Set the context Biomsg to the |
|
583 // entry we've just added to the |
|
584 // message store |
|
585 iTestHarness.SetCurrentBioMsg(newEntryId); |
|
586 } |
|
587 |
|
588 |
|
589 void CDoCmdGeneral::GenerateBIOMessageFromFileL(const TDesC& aFilename) |
|
590 { |
|
591 // |
|
592 // Generates the BIO message we store as a member variable from a |
|
593 // file. Initially assumes file name only given (looks in default |
|
594 // BIO msg directory). If not found tries to find file based on |
|
595 // aFilename being a fully qualified filename incl. path. |
|
596 // |
|
597 // |
|
598 TBuf<KMaxFileName> currentFile; |
|
599 TMsvId messageId; |
|
600 TBIOMessageType currentMsgType; |
|
601 |
|
602 currentFile = KBioTMsgDirectory; |
|
603 currentFile.Append(aFilename); |
|
604 |
|
605 TEntry mEntry; |
|
606 |
|
607 // |
|
608 // Check that file exists |
|
609 TInt err=g_rfs.Entry(currentFile,mEntry); |
|
610 |
|
611 // |
|
612 // If not, try the alternate path |
|
613 if(err != KErrNone) |
|
614 { |
|
615 currentFile = aFilename; |
|
616 TInt err=g_rfs.Entry(currentFile,mEntry); |
|
617 if (err!=KErrNone) User::Leave(err); //Leave (not found) |
|
618 } |
|
619 |
|
620 // |
|
621 // Set up for server side testing |
|
622 // iTestHarness.InstantiateServerMtmL(); |
|
623 iTestHarness.InstantiateClientMtmL(); |
|
624 |
|
625 // |
|
626 // Pull the file name off |
|
627 TInt nPos = currentFile.LocateReverse('\\'); |
|
628 TPtrC current(currentFile.Right(currentFile.Length() - nPos - 1)); |
|
629 |
|
630 // |
|
631 // Get utils to set type based on file name |
|
632 currentMsgType = iTestHarness.TestUtils().SetMessageType(current); |
|
633 |
|
634 if(currentMsgType!=ENoMessage) // skip dodgy filenames |
|
635 { |
|
636 messageId = iTestHarness.TestUtils().CreateBIOEntryFromFileL( currentFile,currentMsgType); |
|
637 |
|
638 _LIT(KMessageGend,"Msg Generated from [%S] with ID: (%d)"); |
|
639 |
|
640 TBuf<KMaxFileName*2> mComment; |
|
641 mComment.Format(KMessageGend,&aFilename, messageId); |
|
642 iTestHarness.TestUtils().WriteComment(mComment); |
|
643 |
|
644 // |
|
645 // Set the context Biomsg to the |
|
646 // entry we've just added to the |
|
647 // message store |
|
648 iTestHarness.SetCurrentBioMsg(messageId); |
|
649 } |
|
650 else |
|
651 { |
|
652 _LIT(KBadFileName,"Error [%S] isn't a BIO Msg Filename."); |
|
653 TBuf<KMaxFileName+40> mComment; |
|
654 mComment.Format(KBadFileName,&aFilename); |
|
655 iTestHarness.TestUtils().WriteComment(mComment); |
|
656 User::Leave(KErrNotFound); |
|
657 } |
|
658 } |
|
659 |
|
660 |
|
661 void CDoCmdGeneral::CleanAllBioMsgsL() |
|
662 { |
|
663 // Clean the BIO message entires only, marked by iMtmUid == KUidBIOMessageTypeMtm. |
|
664 |
|
665 // Go client side. |
|
666 iTestHarness.InstantiateClientMtmL(); |
|
667 |
|
668 // Access the context. |
|
669 CMsvEntry& entry = *(iTestHarness.TestUtils().iMsvEntry); |
|
670 |
|
671 // Change context to root folder. |
|
672 entry.SetEntryL(KMsvRootIndexEntryId); |
|
673 |
|
674 // Set the msg selection ordering. |
|
675 TMsvSelectionOrdering ordering; |
|
676 ordering.SetShowInvisibleEntries(ETrue); |
|
677 entry.SetSortTypeL(ordering); |
|
678 |
|
679 // Delete all email accounts from CenRep |
|
680 CEmailAccounts* accounts = CEmailAccounts::NewLC(); |
|
681 |
|
682 // delete POP accounts |
|
683 RArray<TPopAccount> popAccounts; |
|
684 CleanupClosePushL(popAccounts); |
|
685 accounts->GetPopAccountsL(popAccounts); |
|
686 TInt count = popAccounts.Count(); |
|
687 for(TInt ii=0; ii<count; ++ii) |
|
688 { |
|
689 accounts->DeletePopAccountL(popAccounts[ii]); |
|
690 } |
|
691 CleanupStack::PopAndDestroy(&popAccounts); |
|
692 |
|
693 // delete IMAP accounts |
|
694 RArray<TImapAccount> imapAccounts; |
|
695 CleanupClosePushL(imapAccounts); |
|
696 accounts->GetImapAccountsL(imapAccounts); |
|
697 count = imapAccounts.Count(); |
|
698 for(TInt ii=0; ii<count; ++ii) |
|
699 { |
|
700 accounts->DeleteImapAccountL(imapAccounts[ii]); |
|
701 } |
|
702 CleanupStack::PopAndDestroy(&imapAccounts); |
|
703 |
|
704 // delete SMTP accounts |
|
705 RArray<TSmtpAccount> smtpAccounts; |
|
706 CleanupClosePushL(smtpAccounts); |
|
707 accounts->GetSmtpAccountsL(smtpAccounts); |
|
708 count = smtpAccounts.Count(); |
|
709 for(TInt ii=0; ii<count; ++ii) |
|
710 { |
|
711 accounts->DeleteSmtpAccountL(smtpAccounts[ii]); |
|
712 } |
|
713 CleanupStack::PopAndDestroy(&smtpAccounts); |
|
714 |
|
715 CleanupStack::PopAndDestroy(accounts); |
|
716 |
|
717 entry.SetEntryL(KMsvGlobalInBoxIndexEntryId); |
|
718 entry.SetEntryL(KMsvRootIndexEntryId); |
|
719 |
|
720 // Check each service. |
|
721 CMsvEntrySelection* services = entry.ChildrenWithTypeL(KUidMsvServiceEntry); |
|
722 CleanupStack::PushL(services); |
|
723 |
|
724 TInt serviceCount = services->Count(); |
|
725 |
|
726 if(serviceCount) |
|
727 { |
|
728 for(TInt i = 0; i < serviceCount; i++) |
|
729 { |
|
730 entry.SetEntryL(services->At(i)); |
|
731 |
|
732 // BIO services do not contain folders, so can be deleted. |
|
733 if (entry.Entry().iMtm == KUidBIOMessageTypeMtm) |
|
734 { |
|
735 entry.SetEntryL(KMsvRootIndexEntryId); |
|
736 entry.DeleteL(services->At(i)); |
|
737 } |
|
738 |
|
739 // Check each folder within other services. |
|
740 else |
|
741 { |
|
742 CMsvEntrySelection* folders = entry.ChildrenWithTypeL(KUidMsvFolderEntry); |
|
743 CleanupStack::PushL(folders); |
|
744 |
|
745 TInt fldrCount = folders->Count(); |
|
746 |
|
747 if (fldrCount) |
|
748 { |
|
749 for (TInt ii = 0; ii < fldrCount; ii++) |
|
750 { |
|
751 entry.SetEntryL(folders->At(ii)); |
|
752 |
|
753 // Check each messaging in the folder. |
|
754 CMsvEntrySelection* msgs = entry.ChildrenWithTypeL(KUidMsvMessageEntry); |
|
755 CleanupStack::PushL(msgs); |
|
756 |
|
757 TInt msgCount = msgs->Count(); |
|
758 |
|
759 if(msgCount) |
|
760 { |
|
761 for(TInt iii = 0; iii < msgCount; iii++) |
|
762 { |
|
763 // Delete if BIO message. |
|
764 TMsvEntry msgEntry = entry.ChildDataL(msgs->At(iii)); |
|
765 |
|
766 if (msgEntry.iMtm == KUidBIOMessageTypeMtm) |
|
767 entry.DeleteL(msgs->At(iii)); |
|
768 } |
|
769 } |
|
770 CleanupStack::PopAndDestroy(msgs); |
|
771 } |
|
772 } |
|
773 CleanupStack::PopAndDestroy(folders); |
|
774 } |
|
775 } |
|
776 } |
|
777 CleanupStack::PopAndDestroy(services); |
|
778 |
|
779 // Reset context back to root folder. |
|
780 entry.SetEntryL(KMsvRootIndexEntryId); |
|
781 } |
|
782 |
|
783 // |
|
784 // CDoCmdBioDB |
|
785 // Handles the running of the genral commands |
|
786 |
|
787 // |
|
788 // Constants |
|
789 const TUid KUidBioMsgTypeEmailNotification = {0x10005530}; |
|
790 const TUid KUidBioMsgTypeVCal = {0x10005533}; |
|
791 |
|
792 // |
|
793 // For others |
|
794 CDoCmdBioDB* CDoCmdBioDB::NewL(CClientTestHarness& aTestHarness, TCmdBioDB aCmd) |
|
795 { |
|
796 CDoCmdBioDB* self = new (ELeave) CDoCmdBioDB(aTestHarness, aCmd); |
|
797 return self; |
|
798 } |
|
799 |
|
800 void CDoCmdBioDB::StartL(TRequestStatus& aStatus) |
|
801 { |
|
802 switch(iCmd) |
|
803 { |
|
804 case ECmdBioDBDump: |
|
805 DoBioDBDumpL(); |
|
806 break; |
|
807 |
|
808 case ECmdBioDBTestAPI: |
|
809 DoBioDBTestAPIL(); |
|
810 break; |
|
811 |
|
812 case ECmdBioDBDumpWapBif: |
|
813 DoBioDBDumpWapBifsL(); |
|
814 break; |
|
815 |
|
816 case ECmdBioDBCheckBioness: |
|
817 DoBioDBCheckBionessL(); |
|
818 break; |
|
819 |
|
820 case ECmdBioDBDefaultSendBearer: |
|
821 DoBioDBDefaultSendBearerL(); |
|
822 break; |
|
823 |
|
824 default: |
|
825 User::Leave(KErrNotFound); |
|
826 } |
|
827 |
|
828 // |
|
829 // We leave on error, so always say KErrNone |
|
830 TRequestStatus* req = &aStatus; |
|
831 User::RequestComplete(req, KErrNone); |
|
832 } |
|
833 |
|
834 void CDoCmdBioDB::DoBioDBDumpL() |
|
835 { |
|
836 _LIT(KTestStart, "Starting BIODB BIF Dump..."); |
|
837 iTestHarness.TestUtils().WriteComment(KTestStart); |
|
838 |
|
839 HBufC* commentText = HBufC::NewLC(100); |
|
840 CBIODatabase* bioDB = CBIODatabase::NewL(g_rfs); |
|
841 CleanupStack::PushL(bioDB); |
|
842 |
|
843 (commentText->Des()).Format(_L("%D Bif files read\n"), bioDB->BIOCount()); |
|
844 iTestHarness.TestUtils().WriteComment(*commentText); |
|
845 |
|
846 const CArrayFix<TBioMsgId>* ent = NULL; |
|
847 |
|
848 for (TInt i=0; i < bioDB->BIOCount(); i++) |
|
849 { |
|
850 const CBioInfoFileReader& bifReader = bioDB->BifReader(i); |
|
851 TPtrC desc; |
|
852 desc.Set(bifReader.Description()); |
|
853 (commentText->Des()).Format(_L("%D: '%S'"), i, &desc); |
|
854 iTestHarness.TestUtils().WriteComment(*commentText); |
|
855 ent = bioDB->BIOEntryLC(i); |
|
856 CleanupStack::PopAndDestroy(); //ent |
|
857 } |
|
858 |
|
859 _LIT(KLookForWap, "\r\nLooking for all Wap Ports to Watch\n"); |
|
860 iTestHarness.TestUtils().WriteComment(KLookForWap); |
|
861 TPtrC desc; |
|
862 TInt pos; |
|
863 ent = bioDB->BioEntryByTypeLC(CBIODatabase::EStart, EBioMsgIdWap, pos); |
|
864 |
|
865 while(pos < bioDB->BIOCount()) |
|
866 { |
|
867 desc.Set(bioDB->BifReader(pos).Description()); |
|
868 |
|
869 for (TInt i = 0; ent && i < ent->Count(); i++) |
|
870 { |
|
871 if ((*ent)[i].iType == EBioMsgIdWap) |
|
872 { |
|
873 (commentText->Des()).Format(_L("%D: '%S' Port#:%D"), i, &desc, (*ent)[i].iPort); |
|
874 iTestHarness.TestUtils().WriteComment(*commentText); |
|
875 } |
|
876 } |
|
877 if(ent != NULL) |
|
878 CleanupStack::PopAndDestroy(); // ent |
|
879 |
|
880 ent = bioDB->BioEntryByTypeLC(CBIODatabase::ENext, EBioMsgIdWap, pos); |
|
881 } |
|
882 if(ent != NULL) |
|
883 CleanupStack::PopAndDestroy(); // ent |
|
884 |
|
885 _LIT(KLookNBS, "\nLooking for all NBS Ports to Watch\n"); |
|
886 iTestHarness.TestUtils().WriteComment(KLookNBS); |
|
887 |
|
888 ent = bioDB->BioEntryByTypeLC(CBIODatabase::EStart, EBioMsgIdNbs, pos); |
|
889 |
|
890 while(pos < bioDB->BIOCount()) |
|
891 { |
|
892 desc.Set(bioDB->BifReader(pos).Description()); |
|
893 |
|
894 for (TInt i = 0; ent && i < ent->Count(); i++) |
|
895 { |
|
896 if ((*ent)[i].iType == EBioMsgIdNbs) |
|
897 { |
|
898 (commentText->Des()).Format(_L("%D: '%S' String:%S"), i, &desc, &((*ent)[i].iText)); |
|
899 iTestHarness.TestUtils().WriteComment(*commentText); |
|
900 } |
|
901 } |
|
902 if (ent != NULL) |
|
903 CleanupStack::PopAndDestroy(); // ent |
|
904 |
|
905 ent = bioDB->BioEntryByTypeLC(CBIODatabase::ENext, EBioMsgIdNbs, pos); |
|
906 } |
|
907 if (ent != NULL) |
|
908 CleanupStack::PopAndDestroy(); // ent |
|
909 |
|
910 CleanupStack::PopAndDestroy(bioDB); |
|
911 CleanupStack::PopAndDestroy(commentText); |
|
912 |
|
913 _LIT(KTestEnd, "Done BIODB BIF Dump"); |
|
914 iTestHarness.TestUtils().WriteComment(KTestEnd); |
|
915 } |
|
916 |
|
917 void CDoCmdBioDB::DoBioDBTestAPIL() |
|
918 { |
|
919 _LIT(KTestStart, "Starting BIODB TestAPI..."); |
|
920 iTestHarness.TestUtils().WriteComment(KTestStart); |
|
921 |
|
922 TUid msgID; |
|
923 |
|
924 CBIODatabase* bioDB = CBIODatabase::NewL(g_rfs); |
|
925 CleanupStack::PushL(bioDB); |
|
926 |
|
927 while(bioDB->BIOCount()) |
|
928 { |
|
929 bioDB->GetBioMsgID(0,msgID); |
|
930 bioDB->RemoveBifL(msgID); |
|
931 } |
|
932 |
|
933 _LIT(KTestEnd, "Done BIODB TestAPI"); |
|
934 iTestHarness.TestUtils().WriteComment(KTestEnd); |
|
935 CleanupStack::PopAndDestroy(bioDB); |
|
936 } |
|
937 |
|
938 void CDoCmdBioDB::DoBioDBDumpWapBifsL() |
|
939 { |
|
940 // |
|
941 // Gets a list of port numbers for WAP Port type |
|
942 TInt pos; |
|
943 HBufC* commentText = HBufC::NewLC(100); |
|
944 CBIODatabase* bioDB = CBIODatabase::NewL(g_rfs); |
|
945 CleanupStack::PushL( bioDB ); |
|
946 |
|
947 _LIT(KTestStart, "Starting BIODB WAP BIF Dump..."); |
|
948 iTestHarness.TestUtils().WriteComment(KTestStart); |
|
949 |
|
950 const CArrayFix<TBioMsgId>* bioMsgIDs = bioDB->BioEntryByTypeLC( |
|
951 CBIODatabase::EStart, |
|
952 EBioMsgIdWap, pos); |
|
953 while(bioMsgIDs != NULL) |
|
954 { |
|
955 TUid msgUID; |
|
956 |
|
957 bioDB->GetBioMsgID(pos, msgUID); |
|
958 |
|
959 _LIT(KMFormatString, "<%S>:\tBioUID %D\tParserName %S\tFile Extension %S"); |
|
960 |
|
961 TFileName parserName(bioDB->GetBioParserNameL(msgUID)); |
|
962 |
|
963 TPtrC ext; |
|
964 ext.Set(bioDB->GetFileExtL(msgUID)); |
|
965 |
|
966 TPtrC desc; |
|
967 desc.Set(bioDB->BifReader(pos).Description()); |
|
968 (commentText->Des()).Format(KMFormatString, &desc, msgUID, &parserName, &ext); |
|
969 iTestHarness.TestUtils().WriteComment(commentText->Des()); |
|
970 |
|
971 for (TInt i = 0; i < bioMsgIDs->Count(); i++) |
|
972 { |
|
973 TBuf<100> bearerString; |
|
974 GetBearerText(bioMsgIDs->At(i).iType, bearerString); |
|
975 (commentText->Des()).Format(_L("\t\tType:%S\tConf:%D\tIANA:%S\tPort:%D\t"), |
|
976 &bearerString, |
|
977 bioMsgIDs->At(i).iConfidence, |
|
978 &(bioMsgIDs->At(i).iText), |
|
979 bioMsgIDs->At(i).iPort); |
|
980 |
|
981 iTestHarness.TestUtils().WriteComment(commentText->Des()); |
|
982 } |
|
983 |
|
984 CleanupStack::PopAndDestroy(); // bioMsgID |
|
985 |
|
986 bioMsgIDs = bioDB->BioEntryByTypeLC( |
|
987 CBIODatabase::ENext, |
|
988 EBioMsgIdWap, pos); |
|
989 } |
|
990 |
|
991 |
|
992 TInt portNumber = 0; |
|
993 TRAP_IGNORE(bioDB->GetPortNumberL(KUidBioMsgTypeEmailNotification, EBioMsgIdWap, portNumber)); |
|
994 |
|
995 |
|
996 _LIT(KFormat, "Email Notify is Wap Port %d"); |
|
997 (commentText->Des()).Format(KFormat,portNumber); |
|
998 iTestHarness.TestUtils().WriteComment(commentText->Des()); |
|
999 |
|
1000 TBioMsgIdText ianaString; |
|
1001 TRAP_IGNORE(bioDB->GetIdentifierTextL(KUidBioMsgTypeEmailNotification, EBioMsgIdIana, ianaString)); |
|
1002 |
|
1003 _LIT(KFormat2, "Email Notify is IANA String %d"); |
|
1004 (commentText->Des()).Format(KFormat2, &ianaString); |
|
1005 iTestHarness.TestUtils().WriteComment(commentText->Des()); |
|
1006 |
|
1007 CleanupStack::PopAndDestroy(bioDB); |
|
1008 CleanupStack::PopAndDestroy(commentText); |
|
1009 |
|
1010 _LIT(KTestEnd, "Done BIODB WAP BIF Dump"); |
|
1011 iTestHarness.TestUtils().WriteComment(KTestEnd); |
|
1012 } |
|
1013 |
|
1014 void CDoCmdBioDB::DoBioDBCheckBionessL() |
|
1015 { |
|
1016 CBIODatabase* bioDB = CBIODatabase::NewL(g_rfs); |
|
1017 CleanupStack::PushL(bioDB); |
|
1018 |
|
1019 /* Not finished, and not used by parser. |
|
1020 Keeping, unsure of history, GL 29_05_03. |
|
1021 TBioMsgId bioMsg = iTestHarness.CurrentBioMsg(); |
|
1022 TUid bioMsgId; |
|
1023 |
|
1024 _LIT(KIsBio, "This IS a BIO message"); |
|
1025 _LIT(KIsntBio, "This IS NOT a BIO message"); |
|
1026 |
|
1027 if(bioDB->IsBioMessageL(bioMsg, bioMsgId) == KErrNone) |
|
1028 { |
|
1029 iTestHarness.TestUtils().WriteComment(KIsBio); |
|
1030 } |
|
1031 else |
|
1032 { |
|
1033 iTestHarness.TestUtils().WriteComment(KIsntBio); |
|
1034 } |
|
1035 */ |
|
1036 CleanupStack::PopAndDestroy(bioDB); |
|
1037 } |
|
1038 |
|
1039 void CDoCmdBioDB::DoBioDBDefaultSendBearerL() |
|
1040 { |
|
1041 HBufC* commentText = HBufC::NewLC(100); |
|
1042 TBuf<100> bearerString; |
|
1043 CBIODatabase* bioDB = CBIODatabase::NewL(g_rfs); |
|
1044 CleanupStack::PushL( bioDB ); |
|
1045 |
|
1046 _LIT(KEmailFound, "Default Send Bearer for EmailNotifciation %S (%d)\n"); |
|
1047 _LIT(KEmailNotFound, "Default Send Bearer for EmailNotifciation cannot be found\n"); |
|
1048 _LIT(KUnexpected, "Unexepect Error %d"); |
|
1049 |
|
1050 TBioMsgId aBioMsgIdentifier; |
|
1051 TRAPD(err, bioDB->GetDefaultSendBearerL(KUidBioMsgTypeEmailNotification, aBioMsgIdentifier)); |
|
1052 if (!err) |
|
1053 { |
|
1054 GetBearerText(aBioMsgIdentifier.iType, bearerString); |
|
1055 (commentText->Des()).Format(KEmailFound ,&bearerString, aBioMsgIdentifier.iType); |
|
1056 } |
|
1057 else if (err == KErrNotFound) |
|
1058 { |
|
1059 (commentText->Des()).Format(KEmailNotFound); |
|
1060 } |
|
1061 else |
|
1062 { |
|
1063 (commentText->Des()).Format(KUnexpected, err); |
|
1064 } |
|
1065 |
|
1066 iTestHarness.TestUtils().WriteComment(commentText->Des()); |
|
1067 |
|
1068 |
|
1069 _LIT(KVCalFound, "Default Send Bearer for KUidBioMsgTypeVCal %S (%d)\n"); |
|
1070 _LIT(KVCalNotFound, "Default Send Bearer for KUidBioMsgTypeVCal cannot be found\n"); |
|
1071 |
|
1072 TBioMsgIdType aPortType = EBioMsgIdWap; |
|
1073 TRAP( err, bioDB->GetDefaultSendBearerTypeL(KUidBioMsgTypeVCal, aPortType)); |
|
1074 if (!err) |
|
1075 { |
|
1076 GetBearerText(aPortType, bearerString); |
|
1077 (commentText->Des()).Format(KVCalFound ,&bearerString, aPortType);; |
|
1078 } |
|
1079 else if (err == KErrNotFound) |
|
1080 { |
|
1081 (commentText->Des()).Format(KVCalNotFound); |
|
1082 } |
|
1083 else |
|
1084 { |
|
1085 (commentText->Des()).Format(KUnexpected, err); |
|
1086 } |
|
1087 |
|
1088 iTestHarness.TestUtils().WriteComment(commentText->Des()); |
|
1089 |
|
1090 |
|
1091 _LIT(KVCardNotFound, "Default Send Bearer for KUidBioMsgTypeVCard cannot be found\n"); |
|
1092 |
|
1093 TRAP(err, bioDB->GetDefaultSendBearerByTypeL(KUidBioMsgTypeEmailNotification, EBioMsgIdWapSecure, aBioMsgIdentifier)); |
|
1094 if (!err) |
|
1095 { |
|
1096 (commentText->Des()).Format(KVCardNotFound,aBioMsgIdentifier.iPort); |
|
1097 |
|
1098 } |
|
1099 else if (err == KErrNotFound) |
|
1100 { |
|
1101 (commentText->Des()).Format(KVCardNotFound); |
|
1102 } |
|
1103 else |
|
1104 { |
|
1105 (commentText->Des()).Format(KUnexpected, err); |
|
1106 } |
|
1107 |
|
1108 iTestHarness.TestUtils().WriteComment(commentText->Des()); |
|
1109 |
|
1110 |
|
1111 CleanupStack::PopAndDestroy(); // bioDB |
|
1112 CleanupStack::PopAndDestroy(); // commentText |
|
1113 } |
|
1114 |
|
1115 CDoCmdBioDB::~CDoCmdBioDB() |
|
1116 { |
|
1117 } |
|
1118 |
|
1119 void CDoCmdBioDB::GetBearerText(TInt aBearer, TBuf<100>& rBearerString) |
|
1120 { |
|
1121 switch (aBearer) |
|
1122 { |
|
1123 case EBioMsgIdIana: |
|
1124 rBearerString.Copy(_L("Iana")); |
|
1125 break; |
|
1126 case EBioMsgIdNbs: |
|
1127 rBearerString.Copy(_L("Nbs")); |
|
1128 break; |
|
1129 case EBioMsgIdWap: |
|
1130 rBearerString.Copy(_L("Wap")); |
|
1131 break; |
|
1132 case EBioMsgIdWapSecure: |
|
1133 rBearerString.Copy(_L("WapSecure")); |
|
1134 break; |
|
1135 case EBioMsgIdUnknown: |
|
1136 default: |
|
1137 rBearerString.Copy(_L("Unknown")); |
|
1138 break; |
|
1139 } |
|
1140 } |
|
1141 |
|
1142 // |
|
1143 // CDoCmdCommDB |
|
1144 // Handles the running of the CommDb Commands |
|
1145 |
|
1146 // For 3 argument commands |
|
1147 CDoCmdCommDB* CDoCmdCommDB::NewL(const CDesCArrayFlat& aArgs,CClientTestHarness& aTestHarness, TCmdCommDB aCmd) |
|
1148 { |
|
1149 CDoCmdCommDB* self = new (ELeave) CDoCmdCommDB(aTestHarness, aCmd); |
|
1150 CleanupStack::PushL(self); |
|
1151 self->ConstructL(aArgs); |
|
1152 CleanupStack::Pop(self); |
|
1153 return self; |
|
1154 } |
|
1155 |
|
1156 void CDoCmdCommDB::ConstructL(const CDesCArrayFlat& aArgs) |
|
1157 { |
|
1158 iArgs = new(ELeave) CDesCArrayFlat(3); |
|
1159 CleanupStack::PushL(iArgs); |
|
1160 for(TInt m=0;m<aArgs.Count();m++) |
|
1161 iArgs->InsertL(m,aArgs[m]); |
|
1162 CleanupStack::Pop(iArgs); |
|
1163 iDBSession = CMDBSession::NewL(CMDBSession::LatestVersion()); |
|
1164 } |
|
1165 |
|
1166 void CDoCmdCommDB::StartL(TRequestStatus& aStatus) |
|
1167 { |
|
1168 switch(iCmd) |
|
1169 { |
|
1170 // |
|
1171 // Command takes three arguments: [Record#] [Field] [TableName] |
|
1172 // [TableName] is appended by COMMAND PARSER!!! |
|
1173 case ECmdCommDBReadText: |
|
1174 DoCmdCommDBReadTextL(); |
|
1175 break; |
|
1176 case ECmdCommDBReadLongText: |
|
1177 break; |
|
1178 case ECmdCommDBReadUint: |
|
1179 break; |
|
1180 case ECmdCommDBReadBool: |
|
1181 break; |
|
1182 |
|
1183 // |
|
1184 // Command takes four arguments: [Field] "Expected Value" [TableName] |
|
1185 // The "'s are MANDATORY. [TableName] is appended by COMMAND PARSER!!! |
|
1186 case ECmdCommDBCheck: |
|
1187 DoCmdCommDBCheckL(); |
|
1188 break; |
|
1189 } |
|
1190 |
|
1191 TRequestStatus* req = &aStatus; |
|
1192 User::RequestComplete(req, KErrNone); |
|
1193 } |
|
1194 |
|
1195 void CDoCmdCommDB::DoCmdCommDBReadTextL() |
|
1196 { |
|
1197 TPtrC mTableName = (*iArgs)[2]; |
|
1198 TPtrC mFieldName = (*iArgs)[1]; |
|
1199 // |
|
1200 // Count the records |
|
1201 TInt nNumRecords = 0; |
|
1202 |
|
1203 CMDBRecordSetBase* recordSet = NULL; |
|
1204 CMDBRecordSet<CCDDialOutISPRecord>* dialOutispRecordSet = NULL; |
|
1205 if(mTableName.CompareF(_L("dialoutisp")) == 0) |
|
1206 { |
|
1207 dialOutispRecordSet = new(ELeave) CMDBRecordSet<CCDDialOutISPRecord>(KCDTIdDialOutISPRecord); |
|
1208 recordSet = static_cast<CMDBRecordSetBase*>(dialOutispRecordSet); |
|
1209 CleanupStack::PushL(dialOutispRecordSet); |
|
1210 //cleanup |
|
1211 TRAPD(err, ((CCDDialOutISPRecord*)recordSet)->LoadL(*iDBSession)); |
|
1212 if(err != KErrNone) |
|
1213 { |
|
1214 User::Leave(err); |
|
1215 } |
|
1216 nNumRecords = recordSet->iRecords.Count(); |
|
1217 } |
|
1218 |
|
1219 // |
|
1220 // Check record number |
|
1221 TInt nRecordNum = 0;; |
|
1222 |
|
1223 _LIT(KFirst, "first"); |
|
1224 _LIT(KLast, "last"); |
|
1225 TPtrC rcNum((*iArgs)[0]); |
|
1226 if(rcNum.CompareF(KFirst) == 0) |
|
1227 { |
|
1228 nRecordNum = 0; |
|
1229 } |
|
1230 else |
|
1231 if(rcNum.CompareF(KLast) == 0) |
|
1232 { |
|
1233 nRecordNum = nNumRecords - 1; |
|
1234 } |
|
1235 else |
|
1236 { |
|
1237 TLex lex((*iArgs)[0]); |
|
1238 |
|
1239 lex.Val(nRecordNum); |
|
1240 nRecordNum = nRecordNum - 1; |
|
1241 // |
|
1242 // Numeric record number, check its within range |
|
1243 if(nRecordNum > nNumRecords - 1 || nRecordNum < 0) |
|
1244 User::Leave(KErrNotFound); |
|
1245 } |
|
1246 |
|
1247 TInt nSelectedRecord = nRecordNum; |
|
1248 if(nSelectedRecord < 0) |
|
1249 nSelectedRecord = 0; |
|
1250 |
|
1251 TBuf<KCommsDbSvrMaxFieldLength> mVal; |
|
1252 if(nRecordNum <= nNumRecords) |
|
1253 { |
|
1254 if(mFieldName.CompareF(_L("IpNameServer1")) == 0) |
|
1255 { |
|
1256 mVal = ((CCDDialOutISPRecord*)recordSet->iRecords[nRecordNum])->iIpNameServer1; |
|
1257 } |
|
1258 else if(mFieldName.CompareF(_L("IpNameServer2")) == 0) |
|
1259 { |
|
1260 mVal = ((CCDDialOutISPRecord*)recordSet->iRecords[nRecordNum])->iIpNameServer2; |
|
1261 } |
|
1262 } |
|
1263 HBufC* mOut = HBufC::NewL(mVal.Length()+mTableName.Length()+mFieldName.Length()+50); //On the CleanupStack |
|
1264 _LIT(KReadFormatString,"CommDB - Table='%S', Column='%S', Row=%d, Value='%S'"); |
|
1265 mOut->Des().Format(KReadFormatString, &mTableName, &mFieldName, nSelectedRecord, &mVal); |
|
1266 iTestHarness.TestUtils().WriteComment(*mOut); |
|
1267 delete mOut; |
|
1268 |
|
1269 if(dialOutispRecordSet) |
|
1270 { |
|
1271 CleanupStack::PopAndDestroy(dialOutispRecordSet); |
|
1272 } |
|
1273 } |
|
1274 |
|
1275 |
|
1276 |
|
1277 TBool CDoCmdCommDB::CheckBool(const TDesC& aValue) |
|
1278 { |
|
1279 TBool value= EFalse; |
|
1280 if(aValue.CompareF(_L("false")) == 0) |
|
1281 value= EFalse; |
|
1282 else |
|
1283 value= ETrue; |
|
1284 return value; |
|
1285 } |
|
1286 |
|
1287 TInt CDoCmdCommDB::GetIntValue(const TDesC& aValue) |
|
1288 { |
|
1289 TInt value = 0; |
|
1290 TLex lex(aValue); |
|
1291 lex.Val(value); |
|
1292 return value; |
|
1293 } |
|
1294 |
|
1295 TBool CDoCmdCommDB::DoFindRecordExists(const TDesC& aTableNam, const TDesC& aData) |
|
1296 { |
|
1297 TInt equalPos = 0; |
|
1298 TInt commaPos = 0; |
|
1299 TBool err = EFalse; |
|
1300 |
|
1301 TPtrC fieldData = aData; |
|
1302 const TChar equal = '='; |
|
1303 equalPos = fieldData.Locate(equal); |
|
1304 TPtrC fieldName = fieldData.Left(equalPos); |
|
1305 fieldData.Set(fieldData.Mid(equalPos+1)); |
|
1306 commaPos = fieldData.Locate(KCommaSeparator); |
|
1307 TPtrC fieldValue; |
|
1308 if(commaPos >= 0) |
|
1309 { |
|
1310 fieldValue.Set(fieldData.Left(commaPos)); |
|
1311 fieldData.Set(fieldData.Mid(commaPos+1)); |
|
1312 } |
|
1313 else |
|
1314 fieldValue.Set(fieldData); |
|
1315 |
|
1316 if(aTableNam.CompareF(_L("DialOutIsp")) == 0) |
|
1317 { |
|
1318 CCDDialOutISPRecord* dialOutispRecord = static_cast<CCDDialOutISPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdDialOutISPRecord)); |
|
1319 CleanupStack::PushL(dialOutispRecord); |
|
1320 do |
|
1321 { |
|
1322 equalPos = commaPos = 0; |
|
1323 if(fieldName.CompareF(_L("Name")) == 0) |
|
1324 { |
|
1325 dialOutispRecord->iRecordName.SetMaxLengthL(fieldValue.Length()); |
|
1326 dialOutispRecord->iRecordName = fieldValue; |
|
1327 } |
|
1328 else if(fieldName.CompareF(_L("LoginName")) == 0) |
|
1329 { |
|
1330 dialOutispRecord->iLoginName.SetMaxLengthL(fieldValue.Length()); |
|
1331 dialOutispRecord->iLoginName = fieldValue; |
|
1332 } |
|
1333 else if(fieldName.CompareF(_L("IfAuthName")) == 0) |
|
1334 { |
|
1335 dialOutispRecord->iIfAuthName.SetMaxLengthL(fieldValue.Length()); |
|
1336 dialOutispRecord->iIfAuthName = fieldValue; |
|
1337 } |
|
1338 else if(fieldName.CompareF(_L("DefaultTelNum")) == 0) |
|
1339 { |
|
1340 dialOutispRecord->iDefaultTelNum.SetMaxLengthL(fieldValue.Length()); |
|
1341 dialOutispRecord->iDefaultTelNum = fieldValue; |
|
1342 } |
|
1343 else if(fieldName.CompareF(_L("IpNameServer1")) == 0) |
|
1344 { |
|
1345 dialOutispRecord->iIpNameServer1.SetMaxLengthL(fieldValue.Length()); |
|
1346 dialOutispRecord->iIpNameServer1 = fieldValue; |
|
1347 } |
|
1348 else if(fieldName.CompareF(_L("IpNameServer2")) == 0) |
|
1349 { |
|
1350 dialOutispRecord->iIpNameServer2.SetMaxLengthL(fieldValue.Length()); |
|
1351 dialOutispRecord->iIpNameServer2 = fieldValue; |
|
1352 } |
|
1353 else if(fieldName.CompareF(_L("IpGateway")) == 0) |
|
1354 { |
|
1355 dialOutispRecord->iIpGateway.SetMaxLengthL(fieldValue.Length()); |
|
1356 dialOutispRecord->iIpGateway = fieldValue; |
|
1357 } |
|
1358 else if(fieldName.CompareF(_L("Description")) == 0) |
|
1359 { |
|
1360 dialOutispRecord->iDescription.SetMaxLengthL(fieldValue.Length()); |
|
1361 dialOutispRecord->iDescription = fieldValue; |
|
1362 } |
|
1363 else if(fieldName.CompareF(_L("UseLoginScript")) == 0) |
|
1364 { |
|
1365 dialOutispRecord->iUseLoginScript = CheckBool(fieldValue); |
|
1366 } |
|
1367 else if(fieldName.CompareF(_L("EnableSWComp")) == 0) |
|
1368 { |
|
1369 dialOutispRecord->iEnableSwComp = CheckBool(fieldValue); |
|
1370 } |
|
1371 else if(fieldName.CompareF(_L("BearerProtocol")) == 0) |
|
1372 { |
|
1373 dialOutispRecord->iBearerProtocol = (TUint32)GetIntValue(fieldValue); |
|
1374 } |
|
1375 else if(fieldName.CompareF(_L("BearerSpeed")) == 0) |
|
1376 { |
|
1377 dialOutispRecord->iBearerSpeed = GetIntValue(fieldValue); |
|
1378 } |
|
1379 else if(fieldName.CompareF(_L("InitString")) == 0) |
|
1380 { |
|
1381 TBuf8<100> tempPtr; |
|
1382 const TBuf16<100> tmpField = fieldValue; |
|
1383 TInt val = CnvUtfConverter::ConvertFromUnicodeToUtf8(tempPtr, tmpField); |
|
1384 dialOutispRecord->iInitString.SetMaxLengthL(fieldValue.Length()); |
|
1385 dialOutispRecord->iInitString = tempPtr; |
|
1386 } |
|
1387 else if(fieldName.CompareF(_L("PromptForLogin")) == 0) |
|
1388 { |
|
1389 dialOutispRecord->iPromptForLogin = CheckBool(fieldValue); |
|
1390 } |
|
1391 else if(fieldName.CompareF(_L("IpAddr")) == 0) |
|
1392 { |
|
1393 dialOutispRecord->iIpAddr.SetMaxLengthL(fieldValue.Length()); |
|
1394 dialOutispRecord->iIpAddr = fieldValue; |
|
1395 } |
|
1396 else if(fieldName.CompareF(_L("IpNetmask")) == 0) |
|
1397 { |
|
1398 dialOutispRecord->iIpNetMask.SetMaxLengthL(fieldValue.Length()); |
|
1399 dialOutispRecord->iIpNetMask = fieldValue; |
|
1400 } |
|
1401 |
|
1402 equalPos = fieldData.Locate(equal); |
|
1403 if(equalPos >=0 ) |
|
1404 { |
|
1405 fieldName.Set(fieldData.Left(equalPos)); |
|
1406 fieldData.Set(fieldData.Mid(equalPos+1)); |
|
1407 } |
|
1408 else |
|
1409 { |
|
1410 fieldName.Set(fieldData); |
|
1411 } |
|
1412 |
|
1413 commaPos = fieldData.Locate(KCommaSeparator); |
|
1414 if(commaPos >= 0 ) |
|
1415 { |
|
1416 fieldValue.Set(fieldData.Left(commaPos)); |
|
1417 fieldData.Set(fieldData.Mid(commaPos+1)); |
|
1418 } |
|
1419 else |
|
1420 { |
|
1421 fieldValue.Set(fieldData); |
|
1422 } |
|
1423 }while(equalPos > 0); |
|
1424 |
|
1425 err = dialOutispRecord->FindL(*iDBSession); |
|
1426 |
|
1427 CleanupStack::PopAndDestroy(dialOutispRecord); |
|
1428 } |
|
1429 else if(aTableNam.CompareF(_L("IAP")) == 0) |
|
1430 { |
|
1431 CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord)); |
|
1432 CleanupStack::PushL(iapRecord); |
|
1433 do |
|
1434 { |
|
1435 equalPos = commaPos = 0; |
|
1436 if(fieldName.CompareF(_L("Name")) == 0) |
|
1437 { |
|
1438 iapRecord->iRecordName.SetMaxLengthL(fieldValue.Length()); |
|
1439 iapRecord->iRecordName = fieldValue; |
|
1440 } |
|
1441 else if(fieldName.CompareF(_L("IAPServiceType")) == 0) |
|
1442 { |
|
1443 iapRecord->iServiceType.SetMaxLengthL(fieldValue.Length()); |
|
1444 iapRecord->iServiceType = fieldValue; |
|
1445 } |
|
1446 else if(fieldName.CompareF(_L("IAPBearerType")) == 0) |
|
1447 { |
|
1448 iapRecord->iBearerType.SetMaxLengthL(fieldValue.Length()); |
|
1449 iapRecord->iBearerType = fieldValue; |
|
1450 } |
|
1451 |
|
1452 equalPos = fieldData.Locate(equal); |
|
1453 if(equalPos >=0 ) |
|
1454 { |
|
1455 fieldName.Set(fieldData.Left(equalPos)); |
|
1456 fieldData.Set(fieldData.Mid(equalPos+1)); |
|
1457 } |
|
1458 else |
|
1459 { |
|
1460 fieldName.Set(fieldData); |
|
1461 } |
|
1462 |
|
1463 commaPos = fieldData.Locate(KCommaSeparator); |
|
1464 if(commaPos >=0 ) |
|
1465 { |
|
1466 fieldValue.Set(fieldData.Left(commaPos)); |
|
1467 fieldData.Set(fieldData.Mid(commaPos+1)); |
|
1468 } |
|
1469 else |
|
1470 { |
|
1471 fieldValue.Set(fieldData); |
|
1472 } |
|
1473 }while(equalPos > 0); |
|
1474 |
|
1475 err = iapRecord->FindL(*iDBSession); |
|
1476 |
|
1477 CleanupStack::PopAndDestroy(iapRecord); |
|
1478 } |
|
1479 else if(aTableNam.CompareF(_L("proxies")) == 0) |
|
1480 { |
|
1481 CCDProxiesRecord* proxiesRecord = static_cast<CCDProxiesRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord)); |
|
1482 CleanupStack::PushL(proxiesRecord); |
|
1483 do |
|
1484 { |
|
1485 equalPos = commaPos = 0; |
|
1486 if(fieldName.CompareF(_L("ProxyServerName")) == 0) |
|
1487 { |
|
1488 proxiesRecord->iServerName.SetMaxLengthL(fieldValue.Length()); |
|
1489 proxiesRecord->iServerName = fieldValue; |
|
1490 } |
|
1491 |
|
1492 else if(fieldName.CompareF(_L("PortNumber")) == 0) |
|
1493 { |
|
1494 proxiesRecord->iPortNumber.SetMaxLengthL(fieldValue.Length()); |
|
1495 proxiesRecord->iPortNumber = GetIntValue(fieldValue); |
|
1496 } |
|
1497 |
|
1498 else if(fieldName.CompareF(_L("Exceptions")) == 0) |
|
1499 { |
|
1500 TInt fieldLength = fieldValue.Length(); |
|
1501 if(fieldLength>50) |
|
1502 { |
|
1503 proxiesRecord->iExceptions.SetMaxLengthL(KCommsDbSvrMaxFieldLength); |
|
1504 } |
|
1505 else |
|
1506 { |
|
1507 proxiesRecord->iExceptions.SetMaxLengthL(fieldValue.Length()); |
|
1508 proxiesRecord->iExceptions = fieldValue; |
|
1509 } |
|
1510 } |
|
1511 else if(fieldName.CompareF(_L("ProtocolName")) == 0) |
|
1512 { |
|
1513 proxiesRecord->iProtocolName.SetMaxLengthL(fieldValue.Length()); |
|
1514 proxiesRecord->iProtocolName = fieldValue; |
|
1515 } |
|
1516 |
|
1517 equalPos = fieldData.Locate(equal); |
|
1518 if(equalPos >=0 ) |
|
1519 { |
|
1520 fieldName.Set(fieldData.Left(equalPos)); |
|
1521 fieldData.Set(fieldData.Mid(equalPos+1)); |
|
1522 } |
|
1523 else |
|
1524 { |
|
1525 fieldName.Set(fieldData); |
|
1526 } |
|
1527 |
|
1528 commaPos = fieldData.Locate(KCommaSeparator); |
|
1529 if(commaPos >= 0) |
|
1530 { |
|
1531 fieldValue.Set(fieldData.Left(commaPos)); |
|
1532 fieldData.Set(fieldData.Mid(commaPos+1)); |
|
1533 } |
|
1534 else |
|
1535 { |
|
1536 fieldValue.Set(fieldData); |
|
1537 } |
|
1538 }while(equalPos > 0); |
|
1539 |
|
1540 err = proxiesRecord->FindL(*iDBSession); |
|
1541 CleanupStack::PopAndDestroy(proxiesRecord); |
|
1542 } |
|
1543 else if(aTableNam.CompareF(_L("outgoinggprs")) == 0) |
|
1544 { |
|
1545 CCDOutgoingGprsRecord* gprsRecord = static_cast<CCDOutgoingGprsRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdOutgoingGprsRecord)); |
|
1546 CleanupStack::PushL(gprsRecord); |
|
1547 do |
|
1548 { |
|
1549 equalPos = commaPos = 0; |
|
1550 if(fieldName.CompareF(_L("Name")) == 0) |
|
1551 { |
|
1552 gprsRecord->iRecordName.SetMaxLengthL(fieldValue.Length()); |
|
1553 gprsRecord->iRecordName = fieldValue; |
|
1554 } |
|
1555 else if(fieldName.CompareF(_L("APN")) == 0) |
|
1556 { |
|
1557 gprsRecord->iGPRSAPN.SetMaxLengthL(fieldValue.Length()); |
|
1558 gprsRecord->iGPRSAPN = fieldValue; |
|
1559 } |
|
1560 else if(fieldName.CompareF(_L("PDPAddress")) == 0) |
|
1561 { |
|
1562 gprsRecord->iGPRSPDPAddress.SetMaxLengthL(fieldValue.Length()); |
|
1563 gprsRecord->iGPRSPDPAddress = fieldValue; |
|
1564 } |
|
1565 else if(fieldName.CompareF(_L("IfAuthName")) == 0) |
|
1566 { |
|
1567 gprsRecord->iGPRSIfAuthName.SetMaxLengthL(fieldValue.Length()); |
|
1568 gprsRecord->iGPRSIfAuthName = fieldValue; |
|
1569 } |
|
1570 else if(fieldName.CompareF(_L("IfAuthPass")) == 0) |
|
1571 { |
|
1572 gprsRecord->iGPRSIfAuthPass.SetMaxLengthL(fieldValue.Length()); |
|
1573 gprsRecord->iGPRSIfAuthPass = fieldValue; |
|
1574 } |
|
1575 else if(fieldName.CompareF(_L("IpNameServer1")) == 0) |
|
1576 { |
|
1577 gprsRecord->iGPRSIPNameServer1.SetMaxLengthL(fieldValue.Length()); |
|
1578 gprsRecord->iGPRSIPNameServer1 = fieldValue; |
|
1579 } |
|
1580 else if(fieldName.CompareF(_L("IpNameServer2")) == 0) |
|
1581 { |
|
1582 gprsRecord->iGPRSIPNameServer2.SetMaxLengthL(fieldValue.Length()); |
|
1583 gprsRecord->iGPRSIPNameServer2 = fieldValue; |
|
1584 } |
|
1585 |
|
1586 equalPos = fieldData.Locate(equal); |
|
1587 if(equalPos >= 0 ) |
|
1588 { |
|
1589 fieldName.Set(fieldData.Left(equalPos)); |
|
1590 fieldData.Set(fieldData.Mid(equalPos+1)); |
|
1591 } |
|
1592 else |
|
1593 { |
|
1594 fieldName.Set(fieldData); |
|
1595 } |
|
1596 commaPos = fieldData.Locate(KCommaSeparator); |
|
1597 if(commaPos >= 0) |
|
1598 { |
|
1599 fieldValue.Set(fieldData.Left(commaPos)); |
|
1600 fieldData.Set(fieldData.Mid(commaPos+1)); |
|
1601 } |
|
1602 else |
|
1603 { |
|
1604 fieldValue.Set(fieldData); |
|
1605 } |
|
1606 }while(equalPos > 0); |
|
1607 |
|
1608 err = gprsRecord->FindL(*iDBSession); |
|
1609 CleanupStack::PopAndDestroy(gprsRecord); |
|
1610 } |
|
1611 else if(aTableNam.CompareF(_L("IncomingGPRS")) == 0) |
|
1612 { |
|
1613 CCDIncomingGprsRecord* gprsRecord = static_cast<CCDIncomingGprsRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIncomingGprsRecord)); |
|
1614 CleanupStack::PushL(gprsRecord); |
|
1615 do |
|
1616 { |
|
1617 equalPos = commaPos = 0; |
|
1618 if(fieldName.CompareF(_L("Name")) == 0) |
|
1619 { |
|
1620 gprsRecord->iRecordName.SetMaxLengthL(fieldValue.Length()); |
|
1621 gprsRecord->iRecordName = fieldValue; |
|
1622 } |
|
1623 else if(fieldName.CompareF(_L("APN")) == 0) |
|
1624 { |
|
1625 gprsRecord->iGPRSAPN.SetMaxLengthL(fieldValue.Length()); |
|
1626 gprsRecord->iGPRSAPN = fieldValue; |
|
1627 } |
|
1628 else if(fieldName.CompareF(_L("PDPAddress")) == 0) |
|
1629 { |
|
1630 gprsRecord->iGPRSPDPAddress.SetMaxLengthL(fieldValue.Length()); |
|
1631 gprsRecord->iGPRSPDPAddress = fieldValue; |
|
1632 } |
|
1633 else if(fieldName.CompareF(_L("IfAuthName")) == 0) |
|
1634 { |
|
1635 gprsRecord->iGPRSIfAuthName.SetMaxLengthL(fieldValue.Length()); |
|
1636 gprsRecord->iGPRSIfAuthName = fieldValue; |
|
1637 } |
|
1638 else if(fieldName.CompareF(_L("IfAuthPass")) == 0) |
|
1639 { |
|
1640 gprsRecord->iGPRSIfAuthPass.SetMaxLengthL(fieldValue.Length()); |
|
1641 gprsRecord->iGPRSIfAuthPass = fieldValue; |
|
1642 } |
|
1643 else if(fieldName.CompareF(_L("IpNameServer1")) == 0) |
|
1644 { |
|
1645 gprsRecord->iGPRSIPNameServer1.SetMaxLengthL(fieldValue.Length()); |
|
1646 gprsRecord->iGPRSIPNameServer1 = fieldValue; |
|
1647 } |
|
1648 else if(fieldName.CompareF(_L("IpNameServer2")) == 0) |
|
1649 { |
|
1650 gprsRecord->iGPRSIPNameServer2.SetMaxLengthL(fieldValue.Length()); |
|
1651 gprsRecord->iGPRSIPNameServer2 = fieldValue; |
|
1652 } |
|
1653 equalPos = fieldData.Locate(equal); |
|
1654 if(equalPos >=0 ) |
|
1655 { |
|
1656 fieldName.Set(fieldData.Left(equalPos)); |
|
1657 fieldData.Set(fieldData.Mid(equalPos+1)); |
|
1658 } |
|
1659 else |
|
1660 { |
|
1661 fieldName.Set(fieldData); |
|
1662 } |
|
1663 commaPos = fieldData.Locate(KCommaSeparator); |
|
1664 if(commaPos >= 0) |
|
1665 { |
|
1666 fieldValue.Set(fieldData.Left(commaPos)); |
|
1667 fieldData.Set(fieldData.Mid(commaPos+1)); |
|
1668 } |
|
1669 else |
|
1670 { |
|
1671 fieldValue.Set(fieldData); |
|
1672 } |
|
1673 }while(equalPos > 0); |
|
1674 |
|
1675 err = gprsRecord->FindL(*iDBSession); |
|
1676 CleanupStack::PopAndDestroy(gprsRecord); |
|
1677 } |
|
1678 else if(aTableNam.CompareF(_L("WAPAccessPoint")) == 0) |
|
1679 { |
|
1680 CCDWAPAccessPointRecord* wapAPRecord = static_cast<CCDWAPAccessPointRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord)); |
|
1681 CleanupStack::PushL(wapAPRecord); |
|
1682 do |
|
1683 { |
|
1684 equalPos = commaPos = 0; |
|
1685 if(fieldName.CompareF(_L("Name")) == 0) |
|
1686 { |
|
1687 wapAPRecord->iRecordName.SetMaxLengthL(fieldValue.Length()); |
|
1688 wapAPRecord->iRecordName = fieldValue; |
|
1689 } |
|
1690 else if(fieldName.CompareF(_L("StartPage")) == 0) |
|
1691 { |
|
1692 wapAPRecord->iWAPStartPage.SetMaxLengthL(fieldValue.Length()); |
|
1693 wapAPRecord->iWAPStartPage = fieldValue; |
|
1694 } |
|
1695 |
|
1696 equalPos = fieldData.Locate(equal); |
|
1697 if(equalPos >= 0 ) |
|
1698 { |
|
1699 fieldName.Set(fieldData.Left(equalPos)); |
|
1700 fieldData.Set(fieldData.Mid(equalPos+1)); |
|
1701 } |
|
1702 else |
|
1703 { |
|
1704 fieldName.Set(fieldData); |
|
1705 } |
|
1706 |
|
1707 commaPos = fieldData.Locate(KCommaSeparator); |
|
1708 if(commaPos >= 0 ) |
|
1709 { |
|
1710 fieldValue.Set(fieldData.Left(commaPos)); |
|
1711 fieldData.Set(fieldData.Mid(commaPos+1)); |
|
1712 } |
|
1713 else |
|
1714 { |
|
1715 fieldValue.Set(fieldData); |
|
1716 } |
|
1717 }while(equalPos > 0); |
|
1718 |
|
1719 err = wapAPRecord->FindL(*iDBSession); |
|
1720 |
|
1721 CleanupStack::PopAndDestroy(wapAPRecord); |
|
1722 } |
|
1723 else if(aTableNam.CompareF(_L("WAPIPBearer")) == 0) |
|
1724 { |
|
1725 CCDWAPIPBearerRecord* wapIPBearerRecord = static_cast<CCDWAPIPBearerRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdWAPIPBearerRecord)); |
|
1726 CleanupStack::PushL(wapIPBearerRecord); |
|
1727 do |
|
1728 { |
|
1729 equalPos = commaPos = 0; |
|
1730 if(fieldName.CompareF(_L("GatewayAddress")) == 0) |
|
1731 { |
|
1732 wapIPBearerRecord->iWAPGatewayAddress.SetMaxLengthL(fieldValue.Length()); |
|
1733 wapIPBearerRecord->iWAPGatewayAddress = fieldValue; |
|
1734 } |
|
1735 else if(fieldName.CompareF(_L("ProxyPortNumber")) == 0) |
|
1736 { |
|
1737 wapIPBearerRecord->iWAPProxyPort = GetIntValue(fieldValue); |
|
1738 } |
|
1739 else if(fieldName.CompareF(_L("WSPOption")) == 0) |
|
1740 { |
|
1741 wapIPBearerRecord->iWAPWSPOption = GetIntValue(fieldValue); |
|
1742 } |
|
1743 else if(fieldName.CompareF(_L("Security")) == 0) |
|
1744 { |
|
1745 wapIPBearerRecord->iWAPSecurity = CheckBool(fieldValue); |
|
1746 } |
|
1747 else if(fieldName.CompareF(_L("ProxyLogin")) == 0) |
|
1748 { |
|
1749 wapIPBearerRecord->iWAPProxyLoginName.SetMaxLengthL(fieldValue.Length()); |
|
1750 wapIPBearerRecord->iWAPProxyLoginName = fieldValue; |
|
1751 } |
|
1752 else if(fieldName.CompareF(_L("ProxyPassword")) == 0) |
|
1753 { |
|
1754 wapIPBearerRecord->iWAPProxyLoginPass.SetMaxLengthL(fieldValue.Length()); |
|
1755 wapIPBearerRecord->iWAPProxyLoginPass = fieldValue; |
|
1756 } |
|
1757 |
|
1758 equalPos = fieldData.Locate(equal); |
|
1759 if(equalPos >= 0 ) |
|
1760 { |
|
1761 fieldName.Set(fieldData.Left(equalPos)); |
|
1762 fieldData.Set(fieldData.Mid(equalPos+1)); |
|
1763 } |
|
1764 else |
|
1765 { |
|
1766 fieldName.Set(fieldData); |
|
1767 } |
|
1768 |
|
1769 commaPos = fieldData.Locate(KCommaSeparator); |
|
1770 if(commaPos >= 0 ) |
|
1771 { |
|
1772 fieldValue.Set(fieldData.Left(commaPos)); |
|
1773 fieldData.Set(fieldData.Mid(commaPos+1)); |
|
1774 } |
|
1775 else |
|
1776 { |
|
1777 fieldValue.Set(fieldData); |
|
1778 } |
|
1779 }while(equalPos > 0); |
|
1780 |
|
1781 err = wapIPBearerRecord->FindL(*iDBSession); |
|
1782 CleanupStack::PopAndDestroy(wapIPBearerRecord); |
|
1783 } |
|
1784 else if(aTableNam.CompareF(_L("WAPSMSBearer")) == 0) |
|
1785 { |
|
1786 CCDWAPSMSBearerRecord* wapSmsBearerRecord = static_cast<CCDWAPSMSBearerRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdWAPSMSBearerRecord)); |
|
1787 CleanupStack::PushL(wapSmsBearerRecord); |
|
1788 do |
|
1789 { |
|
1790 equalPos = commaPos = 0; |
|
1791 if(fieldName.CompareF(_L("GatewayAddress")) == 0) |
|
1792 { |
|
1793 wapSmsBearerRecord->iWAPGatewayAddress.SetMaxLengthL(fieldValue.Length()); |
|
1794 wapSmsBearerRecord->iWAPGatewayAddress = fieldValue; |
|
1795 } |
|
1796 else if(fieldName.CompareF(_L("ServiceCentreAddress")) == 0) |
|
1797 { |
|
1798 wapSmsBearerRecord->iWAPServiceCentreAddress.SetMaxLengthL(fieldValue.Length()); |
|
1799 wapSmsBearerRecord->iWAPServiceCentreAddress = fieldValue; |
|
1800 } |
|
1801 |
|
1802 equalPos = fieldData.Locate(equal); |
|
1803 if(equalPos >= 0 ) |
|
1804 { |
|
1805 fieldName.Set(fieldData.Left(equalPos)); |
|
1806 fieldData.Set(fieldData.Mid(equalPos+1)); |
|
1807 } |
|
1808 else |
|
1809 fieldName.Set(fieldData); |
|
1810 commaPos = fieldData.Locate(KCommaSeparator); |
|
1811 if(commaPos >= 0 ) |
|
1812 { |
|
1813 fieldValue.Set(fieldData.Left(commaPos)); |
|
1814 fieldData.Set(fieldData.Mid(commaPos+1)); |
|
1815 } |
|
1816 else |
|
1817 fieldValue.Set(fieldData); |
|
1818 }while(equalPos > 0); |
|
1819 |
|
1820 err = wapSmsBearerRecord->FindL(*iDBSession); |
|
1821 |
|
1822 CleanupStack::PopAndDestroy(wapSmsBearerRecord); |
|
1823 } |
|
1824 return err; |
|
1825 } |
|
1826 |
|
1827 void CDoCmdCommDB::DoCmdCommDBCheckL() |
|
1828 { |
|
1829 // |
|
1830 // Get SQL |
|
1831 const TPtrC& mSQL = (*iArgs)[0]; |
|
1832 // |
|
1833 // Get table name |
|
1834 const TPtrC& mTableName = (*iArgs)[1]; |
|
1835 |
|
1836 |
|
1837 |
|
1838 TBool retValue = DoFindRecordExists(mTableName, mSQL); |
|
1839 |
|
1840 if(!retValue) |
|
1841 { |
|
1842 _LIT(KReadFormStr,"ERROR: \"%S\" Returned NO match from CommDat"); |
|
1843 //HBufC* mOut = HBufC::NewL(KReadFormatString1().Length() + mSQL.Length()); |
|
1844 HBufC* mOut = HBufC::NewL(250); |
|
1845 mOut->Des().Format(KReadFormStr, &mSQL); |
|
1846 delete mOut; |
|
1847 //User::Leave(retValue); |
|
1848 } |
|
1849 else |
|
1850 { |
|
1851 _LIT(KReadFormStr,"OK: record found in COMMDAT (SQL=\"%S\")"); |
|
1852 HBufC* mOut = HBufC::NewL(KReadFormStr().Length() + 5 + mSQL.Length()); |
|
1853 mOut->Des().Format(KReadFormStr, /*nRecordNum, */&mSQL); |
|
1854 iTestHarness.TestUtils().WriteComment((mOut->Left(230))); // Note we can only log upto 230 chars. |
|
1855 delete mOut; |
|
1856 } |
|
1857 } |
|
1858 |
|
1859 CDoCmdCommDB::~CDoCmdCommDB() |
|
1860 { |
|
1861 delete iArgs; |
|
1862 delete iDBSession; |
|
1863 } |
|
1864 |
|
1865 // |
|
1866 // CDoCmdClient |
|
1867 // Handles the running of the Client Commands |
|
1868 CDoCmdClient* CDoCmdClient::NewL(CDesCArrayFlat& aArgs, CClientTestHarness& aTestHarness, const TCmdClient& aCmd) |
|
1869 { |
|
1870 CDoCmdClient* self = new (ELeave) CDoCmdClient(aTestHarness, aCmd); |
|
1871 CleanupStack::PushL(self); |
|
1872 self->ConstructL(aArgs); |
|
1873 CleanupStack::Pop(self); |
|
1874 return self; |
|
1875 } |
|
1876 |
|
1877 void CDoCmdClient::ConstructL(const CDesCArrayFlat& aArgs) |
|
1878 { |
|
1879 iArgs = new(ELeave) CDesCArrayFlat(3); |
|
1880 CleanupStack::PushL(iArgs); |
|
1881 for(TInt m=0;m<aArgs.Count();m++) |
|
1882 iArgs->InsertL(m,aArgs[m]); |
|
1883 CleanupStack::Pop(iArgs); |
|
1884 } |
|
1885 |
|
1886 CDoCmdClient::~CDoCmdClient() |
|
1887 { |
|
1888 delete iArgs; |
|
1889 } |
|
1890 |
|
1891 void CDoCmdClient::StartL(TRequestStatus& aStatus) |
|
1892 { |
|
1893 iTestHarness.InstantiateClientMtmL(); |
|
1894 |
|
1895 switch(iCmd) |
|
1896 { |
|
1897 // |
|
1898 // Parse |
|
1899 case ECmdClientParse: |
|
1900 DoCmdClientParseL(); |
|
1901 break; |
|
1902 |
|
1903 // |
|
1904 // Process |
|
1905 case ECmdClientProcess: |
|
1906 DoCmdClientProcessL(); |
|
1907 break; |
|
1908 |
|
1909 // |
|
1910 // Find in subject |
|
1911 case ECmdClientFindSubject: |
|
1912 DoCmdClientFindInSubjectL(); |
|
1913 break; |
|
1914 |
|
1915 // |
|
1916 // Find in body |
|
1917 case ECmdClientFindBody: |
|
1918 DoCmdClientFindInBodyL(); |
|
1919 break; |
|
1920 |
|
1921 default: |
|
1922 User::Leave(KErrNotFound); |
|
1923 } |
|
1924 |
|
1925 // |
|
1926 // We leave on error, so always say KErrNone |
|
1927 TRequestStatus* req = &aStatus; |
|
1928 User::RequestComplete(req, KErrNone); |
|
1929 } |
|
1930 |
|
1931 void CDoCmdClient::DoCmdClientProcessL() |
|
1932 { |
|
1933 // |
|
1934 // Fail the test if we dont have a connection |
|
1935 User::LeaveIfNull(iTestHarness.TestUtils().iBioClientMtm); |
|
1936 |
|
1937 // |
|
1938 // Create a wait AO. This AO just calls CActiveScheduler::Stop in its RunL |
|
1939 CMsvOperationWait* wait = CMsvOperationWait::NewLC(); |
|
1940 wait->iStatus = KRequestPending; |
|
1941 |
|
1942 // |
|
1943 // Create a selection that contains the one BIO msg we are currently working on |
|
1944 CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; |
|
1945 CleanupStack::PushL(selection); |
|
1946 |
|
1947 const TMsvId& msgID = iTestHarness.CurrentBioMsg(); |
|
1948 selection->AppendL(msgID); |
|
1949 |
|
1950 // |
|
1951 // Start the operation running |
|
1952 TBuf8<1> parms; |
|
1953 CMsvOperation* operation = NULL; |
|
1954 operation = iTestHarness.TestUtils().iBioClientMtm->InvokeAsyncFunctionL( KBiosMtmProcess, *selection, parms, wait->iStatus); |
|
1955 |
|
1956 // |
|
1957 // Wait for it to finish |
|
1958 wait->Start(); |
|
1959 CActiveScheduler::Start(); |
|
1960 |
|
1961 // |
|
1962 // Get error |
|
1963 TInt error = operation->iStatus.Int(); |
|
1964 delete operation; |
|
1965 |
|
1966 // Access the optional parameter, if present should be a error code. |
|
1967 if (iArgs->Count() > 0) |
|
1968 { |
|
1969 TPtrC arg((*iArgs)[0]); |
|
1970 TInt expectedErr = KErrNone; |
|
1971 TLex lex; |
|
1972 HBufC* comment = HBufC::NewLC(100); |
|
1973 |
|
1974 lex.Assign(arg); |
|
1975 lex.Val(expectedErr); // this returns an err code, check |
|
1976 |
|
1977 if (error == expectedErr) |
|
1978 { |
|
1979 _LIT(KMsvExpectedErr, "Parser's ProcessL() failed correctly with error code %d"); |
|
1980 comment->Des().Format(KMsvExpectedErr, error); |
|
1981 } |
|
1982 |
|
1983 else |
|
1984 { |
|
1985 _LIT(KMsvExpectedErr, "Parser's ProcessL() failed in-correctly with error code %d, expected error code %d"); |
|
1986 comment->Des().Format(KMsvExpectedErr, error, expectedErr); |
|
1987 } |
|
1988 iTestHarness.TestUtils().WriteComment(*comment); |
|
1989 iTestHarness.SetExpectedError(expectedErr); |
|
1990 |
|
1991 CleanupStack::PopAndDestroy(comment); |
|
1992 } |
|
1993 |
|
1994 |
|
1995 |
|
1996 CleanupStack::PopAndDestroy(selection); |
|
1997 CleanupStack::PopAndDestroy(wait); |
|
1998 |
|
1999 User::LeaveIfError(error); |
|
2000 } |
|
2001 |
|
2002 void CDoCmdClient::DoCmdClientParseL() |
|
2003 { |
|
2004 // |
|
2005 // Fail the test if we dont have a connection |
|
2006 User::LeaveIfNull(iTestHarness.TestUtils().iBioClientMtm); |
|
2007 |
|
2008 // |
|
2009 // Create a wait AO. This AO just calls CActiveScheduler::Stop in its RunL |
|
2010 CMsvOperationWait* wait = CMsvOperationWait::NewLC(); |
|
2011 wait->iStatus = KRequestPending; |
|
2012 |
|
2013 // |
|
2014 // Create a selection that contains the one BIO msg we are currently working on |
|
2015 CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; |
|
2016 CleanupStack::PushL(selection); |
|
2017 |
|
2018 const TMsvId& msgID = iTestHarness.CurrentBioMsg(); |
|
2019 selection->AppendL(msgID); |
|
2020 |
|
2021 // |
|
2022 // Get the iMtmData1 and iMtmData3 members |
|
2023 iTestHarness.TestUtils().iMsvEntry->SetEntryL(msgID); |
|
2024 TMsvEntry msvEntry = iTestHarness.TestUtils().iMsvEntry->Entry(); |
|
2025 |
|
2026 _LIT(KMsvb4, "Message with ID %d BEFORE PARSE: iMtmData1=%d, iMtmData3=%d"); |
|
2027 _LIT(KMsvAfter, "Message with ID %d AFTER PARSE: iMtmData1=%d, iMtmData3=%d"); |
|
2028 |
|
2029 HBufC* comment = HBufC::NewLC(KMsvb4().Length() + 50); // 30 |
|
2030 comment->Des().Format(KMsvb4, msgID, msvEntry.MtmData1(), msvEntry.MtmData3()); |
|
2031 iTestHarness.TestUtils().WriteComment(*comment); |
|
2032 |
|
2033 // set waiter active - avoid nested active scheduler problems... |
|
2034 wait->Start(); |
|
2035 |
|
2036 // |
|
2037 // Start the operation running |
|
2038 TBuf8<1> parms; |
|
2039 CMsvOperation* operation = NULL; |
|
2040 operation = iTestHarness.TestUtils().iBioClientMtm->InvokeAsyncFunctionL( KBiosMtmParse, *selection, parms, wait->iStatus); |
|
2041 |
|
2042 // |
|
2043 // Wait for it to finish |
|
2044 CActiveScheduler::Start(); |
|
2045 |
|
2046 // |
|
2047 // Re-get the message - it should have changed |
|
2048 msvEntry = iTestHarness.TestUtils().iMsvEntry->Entry(); |
|
2049 comment->Des().Format(KMsvAfter, msgID, msvEntry.MtmData1(), msvEntry.MtmData3()); |
|
2050 iTestHarness.TestUtils().WriteComment(*comment); |
|
2051 |
|
2052 // |
|
2053 // Get error |
|
2054 TInt error = operation->iStatus.Int(); |
|
2055 delete operation; |
|
2056 |
|
2057 // Access the optional parameter, if present should be a error code. |
|
2058 if (iArgs->Count() > 0) |
|
2059 { |
|
2060 TPtrC arg((*iArgs)[0]); |
|
2061 TInt expectedErr = KErrNone; // will have to get this via iTestHarness or something similar DON'T understand comment ???? |
|
2062 TLex lex; |
|
2063 |
|
2064 lex.Assign(arg); |
|
2065 lex.Val(expectedErr); // this returns an err code, check |
|
2066 |
|
2067 if (error == expectedErr) |
|
2068 { |
|
2069 _LIT(KMsvExpectedErr, "Parser's ParseL() failed correctly with error code %d"); |
|
2070 comment->Des().Format(KMsvExpectedErr, error); |
|
2071 } |
|
2072 |
|
2073 else |
|
2074 { |
|
2075 _LIT(KMsvExpectedErr, "Parser's ParseL() failed in-correctly with error code %d, expected error code %d"); |
|
2076 comment->Des().Format(KMsvExpectedErr, error, expectedErr); |
|
2077 } |
|
2078 iTestHarness.TestUtils().WriteComment(*comment); |
|
2079 iTestHarness.SetExpectedError(expectedErr); |
|
2080 } |
|
2081 |
|
2082 // else |
|
2083 // iTestHarness.SetExpectedError(KErrNone); // do we need this..., |
|
2084 |
|
2085 |
|
2086 |
|
2087 CleanupStack::PopAndDestroy(comment); |
|
2088 CleanupStack::PopAndDestroy(selection); |
|
2089 CleanupStack::PopAndDestroy(wait); |
|
2090 |
|
2091 User::LeaveIfError(error); |
|
2092 } |
|
2093 |
|
2094 void CDoCmdClient::DoCmdClientFindInSubjectL() |
|
2095 { |
|
2096 _LIT(KMsgNotFound, "Text %S NOT found in message (Id: %d)'s subject"); |
|
2097 _LIT(KMsgFound, "Text %S found in message (Id: %d)'s subject"); |
|
2098 |
|
2099 // |
|
2100 // Fail the test if we dont have a connection |
|
2101 User::LeaveIfNull(iTestHarness.TestUtils().iBioClientMtm); |
|
2102 |
|
2103 // |
|
2104 // Swicth to the current BIO message |
|
2105 const TMsvId& msgID = iTestHarness.CurrentBioMsg(); |
|
2106 iTestHarness.TestUtils().iBioClientMtm->SwitchCurrentEntryL(msgID); |
|
2107 iTestHarness.TestUtils().iBioClientMtm->LoadMessageL(); |
|
2108 |
|
2109 // |
|
2110 // Look for the string |
|
2111 TPtrC aArg((*iArgs)[0]); |
|
2112 TMsvPartList retPart = iTestHarness.TestUtils().iBioClientMtm->Find(aArg, KMsvMessagePartDescription); |
|
2113 TBuf<200> comment; |
|
2114 if(retPart & KMsvMessagePartDescription) |
|
2115 { |
|
2116 comment.Format(KMsgFound, &aArg, msgID); |
|
2117 } |
|
2118 else |
|
2119 { |
|
2120 comment.Format(KMsgNotFound, &aArg, msgID); |
|
2121 } |
|
2122 |
|
2123 iTestHarness.TestUtils().WriteComment(comment); |
|
2124 } |
|
2125 |
|
2126 void CDoCmdClient::DoCmdClientFindInBodyL() |
|
2127 { |
|
2128 _LIT(KMsgNotFound, "Text %S NOT found in message (Id: %d)'s body"); |
|
2129 _LIT(KMsgFound, "Text %S found in message (Id: %d)'s body"); |
|
2130 |
|
2131 // |
|
2132 // Fail the test if we dont have a connection |
|
2133 User::LeaveIfNull(iTestHarness.TestUtils().iBioClientMtm); |
|
2134 |
|
2135 // Swicth to the current BIO message |
|
2136 const TMsvId& msgID = iTestHarness.CurrentBioMsg(); |
|
2137 iTestHarness.TestUtils().iBioClientMtm->SwitchCurrentEntryL(msgID); |
|
2138 iTestHarness.TestUtils().iBioClientMtm->LoadMessageL(); |
|
2139 |
|
2140 // |
|
2141 // Look for the string |
|
2142 TPtrC aArg((*iArgs)[0]); |
|
2143 TMsvPartList retPart = iTestHarness.TestUtils().iBioClientMtm->Find(aArg, KMsvMessagePartBody); |
|
2144 |
|
2145 TBuf<200> comment; |
|
2146 if(retPart & KMsvMessagePartBody) |
|
2147 { |
|
2148 comment.Format(KMsgFound, &aArg, msgID); |
|
2149 } |
|
2150 else |
|
2151 { |
|
2152 comment.Format(KMsgNotFound, &aArg, msgID); |
|
2153 } |
|
2154 |
|
2155 iTestHarness.TestUtils().WriteComment(comment); |
|
2156 } |
|
2157 |
|
2158 // |
|
2159 // CDoCmdServer |
|
2160 // Handles the running of the Server Commands |
|
2161 CDoCmdServer* CDoCmdServer::NewL(CDesCArrayFlat& aArgs, CClientTestHarness& aTestHarness, const TCmdServer& aCmd) |
|
2162 { |
|
2163 CDoCmdServer* self = new (ELeave) CDoCmdServer(aTestHarness, aCmd); |
|
2164 CleanupStack::PushL(self); |
|
2165 self->ConstructL(aArgs); |
|
2166 CleanupStack::Pop(self); |
|
2167 return self; |
|
2168 } |
|
2169 |
|
2170 void CDoCmdServer::ConstructL(const CDesCArrayFlat& aArgs) |
|
2171 { |
|
2172 iArgs = new(ELeave) CDesCArrayFlat(3); |
|
2173 CleanupStack::PushL(iArgs); |
|
2174 for(TInt m=0;m<aArgs.Count();m++) |
|
2175 iArgs->InsertL(m,aArgs[m]); |
|
2176 CleanupStack::Pop(iArgs); |
|
2177 } |
|
2178 |
|
2179 CDoCmdServer::~CDoCmdServer() |
|
2180 { |
|
2181 delete iArgs; |
|
2182 } |
|
2183 |
|
2184 void CDoCmdServer::StartL(TRequestStatus& aStatus) |
|
2185 { |
|
2186 iTestHarness.InstantiateServerMtmL(); |
|
2187 |
|
2188 switch(iCmd) |
|
2189 { |
|
2190 // |
|
2191 // Parse |
|
2192 case ECmdServerParse: |
|
2193 DoCmdServerParseL(); |
|
2194 break; |
|
2195 |
|
2196 // |
|
2197 // Process |
|
2198 case ECmdServerProcess: |
|
2199 DoCmdServerProcessL(); |
|
2200 break; |
|
2201 |
|
2202 default: |
|
2203 User::Leave(KErrNotFound); |
|
2204 } |
|
2205 |
|
2206 // |
|
2207 // We leave on error, so always say KErrNone |
|
2208 TRequestStatus* req = &aStatus; |
|
2209 User::RequestComplete(req, KErrNone); |
|
2210 } |
|
2211 |
|
2212 void CDoCmdServer::DoCmdServerProcessL() |
|
2213 { |
|
2214 // |
|
2215 // Fail the test if we dont have a connection |
|
2216 User::LeaveIfNull(iTestHarness.TestUtils().iBioServerMtm); |
|
2217 |
|
2218 // |
|
2219 // Create a wait AO. This AO just calls CActiveScheduler::Stop in its RunL |
|
2220 CMsvOperationWait* wait = CMsvOperationWait::NewLC(); |
|
2221 wait->iStatus = KRequestPending; |
|
2222 |
|
2223 // |
|
2224 // Create a selection that contains the one BIO msg we are currently working on |
|
2225 CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; |
|
2226 CleanupStack::PushL(selection); |
|
2227 |
|
2228 const TMsvId& msgID = iTestHarness.CurrentBioMsg(); |
|
2229 selection->AppendL(msgID); |
|
2230 |
|
2231 // |
|
2232 // Start the operation |
|
2233 TBuf8<1> parms; |
|
2234 iTestHarness.TestUtils().iBioServerMtm->StartCommandL(*selection, KBiosMtmProcess, parms, wait->iStatus); |
|
2235 |
|
2236 // |
|
2237 // Wait for it to finish |
|
2238 wait->Start(); |
|
2239 CActiveScheduler::Start(); |
|
2240 |
|
2241 // |
|
2242 // Get error |
|
2243 TInt error = wait->iStatus.Int(); |
|
2244 CleanupStack::PopAndDestroy(selection); |
|
2245 CleanupStack::PopAndDestroy(wait); |
|
2246 |
|
2247 User::LeaveIfError(error); |
|
2248 } |
|
2249 |
|
2250 void CDoCmdServer::DoCmdServerParseL() |
|
2251 { |
|
2252 // |
|
2253 // Fail the test if we dont have a connection |
|
2254 User::LeaveIfNull(iTestHarness.TestUtils().iBioServerMtm); |
|
2255 |
|
2256 // |
|
2257 // Create a wait AO. This AO just calls CActiveScheduler::Stop in its RunL |
|
2258 CMsvOperationWait* wait = CMsvOperationWait::NewLC(); |
|
2259 wait->iStatus = KRequestPending; |
|
2260 |
|
2261 // |
|
2262 // Create a selection that contains the one BIO msg we are currently working on |
|
2263 CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; |
|
2264 CleanupStack::PushL(selection); |
|
2265 |
|
2266 const TMsvId& msgID = iTestHarness.CurrentBioMsg(); |
|
2267 selection->AppendL(msgID); |
|
2268 |
|
2269 // |
|
2270 // Start the operation running |
|
2271 TBuf8<1> parms; |
|
2272 iTestHarness.TestUtils().iBioServerMtm->StartCommandL(*selection, KBiosMtmParse, parms, wait->iStatus); |
|
2273 |
|
2274 // |
|
2275 // Wait for it to finish |
|
2276 wait->Start(); |
|
2277 CActiveScheduler::Start(); |
|
2278 |
|
2279 // |
|
2280 // Get error |
|
2281 TInt error = wait->iStatus.Int(); |
|
2282 CleanupStack::PopAndDestroy(selection); |
|
2283 CleanupStack::PopAndDestroy(wait); |
|
2284 |
|
2285 User::LeaveIfError(error); |
|
2286 } |
|
2287 |
|
2288 |
|
2289 // |
|
2290 // CDoCmdMsv |
|
2291 // Handles the running of the Msv commands |
|
2292 |
|
2293 // For 3 argument commands |
|
2294 CDoCmdMsv* CDoCmdMsv::NewL(const CDesCArrayFlat& aArgs,CClientTestHarness& aTestHarness, TCmdMsv aCmd) |
|
2295 { |
|
2296 CDoCmdMsv* self = new (ELeave) CDoCmdMsv(aTestHarness, aCmd); |
|
2297 CleanupStack::PushL(self); |
|
2298 self->ConstructL(aArgs); |
|
2299 CleanupStack::Pop(self); |
|
2300 return self; |
|
2301 } |
|
2302 |
|
2303 CDoCmdMsv* CDoCmdMsv::NewL(const TDesC& aName,CClientTestHarness& aTestHarness, TCmdMsv aCmd) |
|
2304 { |
|
2305 CDoCmdMsv* self = new (ELeave) CDoCmdMsv(aName,aTestHarness, aCmd); |
|
2306 return self; |
|
2307 } |
|
2308 |
|
2309 void CDoCmdMsv::ConstructL(const CDesCArrayFlat& aArgs) |
|
2310 { |
|
2311 iArgs = new(ELeave) CDesCArrayFlat(3); |
|
2312 CleanupStack::PushL(iArgs); |
|
2313 for(TInt m=0;m<aArgs.Count();m++) |
|
2314 iArgs->InsertL(m,aArgs[m]); |
|
2315 CleanupStack::Pop(iArgs); |
|
2316 } |
|
2317 |
|
2318 void CDoCmdMsv::StartL(TRequestStatus& aStatus) |
|
2319 { |
|
2320 |
|
2321 |
|
2322 TPtrC mExpected; |
|
2323 if ((iCmd!=ECmdDumpSmsMsgCentres) && (iCmd!=ECmdInstantNamedPop3) && (iCmd!=ECmdInstantNamedImap) && (iCmd!=ECmdInstantNamedSmtp) |
|
2324 && (iCmd!=ECmdInstantDefaultPop3) && (iCmd!=ECmdInstantDefaultSmtp) && (iCmd!=ECmdInstantDefaultImap)) |
|
2325 mExpected.Set( (*iArgs)[0] ); |
|
2326 |
|
2327 switch(iCmd) |
|
2328 { |
|
2329 |
|
2330 /* |
|
2331 N.B. The implementation for some of the features unsupported by the |
|
2332 Symbian Spec. is present but #commented out - if these features are required |
|
2333 in future it should only be necessary to fill in the //if compare fails |
|
2334 stubs. Several commands have already been implemented which are not supported |
|
2335 by the BIO spec. |
|
2336 */ |
|
2337 |
|
2338 //The Sms Settings |
|
2339 case ECmdDumpSmsMsgCentres: |
|
2340 { |
|
2341 iTestHarness.InstantiateSmsSettingsL(); |
|
2342 |
|
2343 _LIT(KSmsMsgCentre,"SMS Message Centres present:"); |
|
2344 iTestHarness.TestUtils().WriteComment(KSmsMsgCentre); |
|
2345 |
|
2346 for (TInt j=0;j<=iTestHarness.iSmsSettings->ServiceCenterCount()-1;j++) |
|
2347 { |
|
2348 CSmsServiceCenter& mSmsN = iTestHarness.iSmsSettings->GetServiceCenter(j); |
|
2349 _LIT(KSmsMsgCentre," SMS Centre: Name \"%S\" Address \"%S\""); |
|
2350 HBufC* td = HBufC::NewLC(35+mSmsN.Name().Length()+mSmsN.Address().Length()); |
|
2351 |
|
2352 TPtrC name = mSmsN.Name(); |
|
2353 TPtrC address = mSmsN.Address(); |
|
2354 |
|
2355 td->Des().Format(KSmsMsgCentre,&name,&address); |
|
2356 iTestHarness.TestUtils().WriteComment(*td); |
|
2357 CleanupStack::PopAndDestroy(td); |
|
2358 |
|
2359 } |
|
2360 break; |
|
2361 } |
|
2362 case ECmdChkDefaultSmsMsgCentre: |
|
2363 { |
|
2364 TBuf<KCommsDbSvrMaxFieldLength> mRead; |
|
2365 CMDBSession *dbSession = CMDBSession::NewL(CMDBSession::LatestVersion()); |
|
2366 CleanupStack::PushL(dbSession); |
|
2367 CCDGlobalSettingsRecord *globalSettingsRecord = static_cast<CCDGlobalSettingsRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdGlobalSettingsRecord)); |
|
2368 CleanupStack::PushL(globalSettingsRecord); |
|
2369 |
|
2370 globalSettingsRecord->LoadL(*dbSession); |
|
2371 |
|
2372 CCDModemBearerRecord *modemRecord = static_cast<CCDModemBearerRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdModemBearerRecord)); |
|
2373 CleanupStack::PushL(modemRecord); |
|
2374 modemRecord->SetRecordId(globalSettingsRecord->iModemForPhoneServicesAndSMS); |
|
2375 modemRecord->LoadL(*dbSession); |
|
2376 mRead = modemRecord->iMessageCentreNumber; |
|
2377 |
|
2378 CleanupStack::PopAndDestroy(3); //dbSession, globalSettingsRecord , modemRecord |
|
2379 |
|
2380 if (mRead.CompareF(mExpected)!=0) |
|
2381 { |
|
2382 _LIT(KTmp,"ERROR - checking Address for DEFAULT SMS centre (from CommDB) expected \"%S\" read \"%S\""); |
|
2383 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
2384 td->Des().Format(KTmp,&mExpected,&mRead); |
|
2385 iTestHarness.TestUtils().WriteComment(*td); |
|
2386 CleanupStack::PopAndDestroy(td); |
|
2387 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2388 } |
|
2389 else |
|
2390 { |
|
2391 _LIT(KOK,"OK Default Sms Centre Address Correct"); |
|
2392 iTestHarness.TestUtils().WriteComment(KOK); |
|
2393 } |
|
2394 break; |
|
2395 } |
|
2396 case ECmdChkSmsMsgCentreNumber: |
|
2397 { |
|
2398 TPtrC mCentreName = mExpected; |
|
2399 mExpected.Set((*iArgs)[1]); |
|
2400 |
|
2401 |
|
2402 iTestHarness.InstantiateSmsSettingsL(); |
|
2403 |
|
2404 TPtrC name; |
|
2405 TPtrC mRead; |
|
2406 |
|
2407 for (TInt j=0;j<=iTestHarness.iSmsSettings->ServiceCenterCount();j++) |
|
2408 { |
|
2409 |
|
2410 if (j==iTestHarness.iSmsSettings->ServiceCenterCount()) |
|
2411 //Past the end of the array!! |
|
2412 { |
|
2413 User::Leave(KErrNotFound); |
|
2414 break; //To make the control flow obvious to the |
|
2415 //compiler |
|
2416 } |
|
2417 |
|
2418 CSmsServiceCenter& mSmsN = iTestHarness.iSmsSettings->GetServiceCenter(j); |
|
2419 |
|
2420 name.Set(mSmsN.Name()); |
|
2421 mRead.Set(mSmsN.Address()); |
|
2422 |
|
2423 if (name.CompareF(mCentreName)==0) break; //Found Centre Name |
|
2424 |
|
2425 } |
|
2426 |
|
2427 |
|
2428 |
|
2429 if (mRead.CompareF(mExpected)!=0) |
|
2430 { |
|
2431 _LIT(KTmp,"ERROR - checking Address for SMS centre (%S) expected \"%S\" read \"%S\""); |
|
2432 HBufC* td = HBufC::NewLC(KTmp().Length()+mCentreName.Length()+mExpected.Length()+mRead.Length()); |
|
2433 td->Des().Format(KTmp,&mCentreName,&mExpected,&mRead); |
|
2434 iTestHarness.TestUtils().WriteComment(*td); |
|
2435 CleanupStack::PopAndDestroy(td); |
|
2436 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2437 } |
|
2438 else |
|
2439 { |
|
2440 _LIT(KOK,"OK Sms Centre Address Correct"); |
|
2441 iTestHarness.TestUtils().WriteComment(KOK); |
|
2442 } |
|
2443 |
|
2444 |
|
2445 break; |
|
2446 } |
|
2447 |
|
2448 //The POP3 Settings |
|
2449 |
|
2450 case ECmdInstantNamedPop3: |
|
2451 { |
|
2452 iTestHarness.InstantiateNamedPop3SettingsL(iName); |
|
2453 break; |
|
2454 } |
|
2455 |
|
2456 case ECmdInstantDefaultPop3: |
|
2457 { |
|
2458 iTestHarness.UnInstantiatePop3SettingsL(); |
|
2459 iTestHarness.InstantiatePop3SettingsL(); |
|
2460 break; |
|
2461 } |
|
2462 |
|
2463 case ECmdInstantDefaultSmtp: |
|
2464 { |
|
2465 iTestHarness.UnInstantiateSmtpSettingsL(); |
|
2466 iTestHarness.InstantiateSmtpSettingsL(); |
|
2467 break; |
|
2468 } |
|
2469 |
|
2470 case ECmdInstantDefaultImap: |
|
2471 { |
|
2472 iTestHarness.UnInstantiateImapSettingsL(); |
|
2473 iTestHarness.InstantiateImapSettingsL(); |
|
2474 break; |
|
2475 } |
|
2476 |
|
2477 case ECmdInstantNamedSmtp: |
|
2478 { |
|
2479 iTestHarness.InstantiateNamedSmtpSettingsL(iName); |
|
2480 break; |
|
2481 } |
|
2482 |
|
2483 case ECmdInstantNamedImap: |
|
2484 { |
|
2485 iTestHarness.InstantiateNamedImapSettingsL(iName); |
|
2486 break; |
|
2487 } |
|
2488 |
|
2489 case ECmdChkPop3Version: //Command takes one arguments: [Version#] |
|
2490 { |
|
2491 _LIT(KOK, "OK POP3 Version deprecated - ignored"); |
|
2492 iTestHarness.TestUtils().WriteComment(KOK); |
|
2493 |
|
2494 break; |
|
2495 } |
|
2496 |
|
2497 case ECmdChkPop3UserAddress: //Command takes one arguments: [user@address] |
|
2498 { |
|
2499 _LIT(KOK, "OK POP3 User Address deprecated - ignored"); |
|
2500 iTestHarness.TestUtils().WriteComment(KOK); |
|
2501 |
|
2502 break; |
|
2503 } |
|
2504 |
|
2505 case ECmdChkPop3ServerAddress: //Command takes one arguments: [Server_address] |
|
2506 { |
|
2507 iTestHarness.InstantiatePop3SettingsL(); |
|
2508 |
|
2509 TPtrC mRead=iTestHarness.iPop3Settings->ServerAddress(); |
|
2510 |
|
2511 if (mRead.Compare(mExpected)!=0) |
|
2512 { |
|
2513 _LIT(KTmp,"ERROR - checking Pop3 Server Address expected \"%S\" read \"%S\""); |
|
2514 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
2515 td->Des().Format(KTmp,&mExpected,&mRead); |
|
2516 iTestHarness.TestUtils().WriteComment(*td); |
|
2517 CleanupStack::PopAndDestroy(td); |
|
2518 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2519 } |
|
2520 else |
|
2521 { |
|
2522 _LIT(KOK,"OK POP3 Server Address correct"); |
|
2523 iTestHarness.TestUtils().WriteComment(KOK); |
|
2524 } |
|
2525 |
|
2526 |
|
2527 break; |
|
2528 } |
|
2529 |
|
2530 case ECmdChkPop3Port: //Command takes one arguments: [Port#] |
|
2531 { |
|
2532 iTestHarness.InstantiatePop3SettingsL(); |
|
2533 |
|
2534 //Convert mExpected to a TInt |
|
2535 TLex lexer(mExpected); |
|
2536 TInt mExpectedInt; |
|
2537 User::LeaveIfError(lexer.Val(mExpectedInt)); |
|
2538 |
|
2539 |
|
2540 TInt mRead = iTestHarness.iPop3Settings->Port(); |
|
2541 |
|
2542 if (mRead!=mExpectedInt) |
|
2543 { |
|
2544 _LIT(KTmp,"ERROR - checking Pop3 Port expected \"%d\" read \"%d\""); |
|
2545 HBufC* td = HBufC::NewLC(KTmp().Length()+30); |
|
2546 td->Des().Format(KTmp,mExpectedInt,mRead); |
|
2547 iTestHarness.TestUtils().WriteComment(*td); |
|
2548 CleanupStack::PopAndDestroy(td); |
|
2549 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2550 } |
|
2551 else |
|
2552 { |
|
2553 _LIT(KOK,"OK POP3 Port correct"); |
|
2554 iTestHarness.TestUtils().WriteComment(KOK); |
|
2555 } |
|
2556 |
|
2557 break; |
|
2558 } |
|
2559 case ECmdChkPop3AutoSendOnConnect: //Command takes one arguments: [True/False] |
|
2560 { |
|
2561 |
|
2562 iTestHarness.InstantiatePop3SettingsL(); |
|
2563 //Convert mExpected to a TBool |
|
2564 TBool mExpBool=EFalse; |
|
2565 _LIT(KTrueDes,"true"); |
|
2566 _LIT(KFalseDes,"false"); |
|
2567 |
|
2568 if (mExpected.CompareF(KTrueDes)==0) |
|
2569 mExpBool = ETrue; |
|
2570 else if (mExpected.CompareF(KFalseDes)==0) |
|
2571 mExpBool = EFalse; |
|
2572 else |
|
2573 { |
|
2574 //script file syntax error |
|
2575 User::Leave(KErrNotSupported); |
|
2576 } |
|
2577 |
|
2578 |
|
2579 TBool mRead = iTestHarness.iPop3Settings->AutoSendOnConnect(); |
|
2580 |
|
2581 if (mRead!=mExpBool) |
|
2582 { |
|
2583 _LIT(KTmp,"ERROR - checking Pop3 AutoSendOnConnect expected \"%S\" read \"%S\""); |
|
2584 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+6); |
|
2585 TBuf<5> mRDes = (mRead?_L("TRUE"):_L("FALSE")); |
|
2586 td->Des().Format(KTmp,&mExpected,&mRDes); |
|
2587 iTestHarness.TestUtils().WriteComment(*td); |
|
2588 CleanupStack::PopAndDestroy(td); |
|
2589 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2590 } |
|
2591 else |
|
2592 { |
|
2593 _LIT(KOK,"OK POP3 AutoSendOnConnect correct"); |
|
2594 iTestHarness.TestUtils().WriteComment(KOK); |
|
2595 } |
|
2596 |
|
2597 break; |
|
2598 } |
|
2599 case ECmdChkPop3Apop: //Command takes one arguments: [True/False] |
|
2600 { |
|
2601 iTestHarness.InstantiatePop3SettingsL(); |
|
2602 |
|
2603 //Convert mExpected to a TBool |
|
2604 TBool mExpBool=EFalse; |
|
2605 _LIT(KTrueDes,"true"); |
|
2606 _LIT(KFalseDes,"false"); |
|
2607 |
|
2608 if (mExpected.CompareF(KTrueDes)==0) |
|
2609 mExpBool = ETrue; |
|
2610 else if (mExpected.CompareF(KFalseDes)==0) |
|
2611 mExpBool = EFalse; |
|
2612 else |
|
2613 { |
|
2614 //script file syntax error |
|
2615 User::Leave(KErrNotSupported); |
|
2616 } |
|
2617 |
|
2618 |
|
2619 TBool mRead = iTestHarness.iPop3Settings->Apop(); |
|
2620 |
|
2621 if (mRead!=mExpBool) |
|
2622 { |
|
2623 _LIT(KTmp,"ERROR - checking Pop3 APop expected \"%S\" read \"%S\""); |
|
2624 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+6); |
|
2625 TBuf<5> mRDes = (mRead?_L("TRUE"):_L("FALSE")); |
|
2626 td->Des().Format(KTmp,&mExpected,&mRDes); |
|
2627 iTestHarness.TestUtils().WriteComment(*td); |
|
2628 CleanupStack::PopAndDestroy(td); |
|
2629 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2630 } |
|
2631 else |
|
2632 { |
|
2633 _LIT(KOK,"OK POP3 APop correct"); |
|
2634 iTestHarness.TestUtils().WriteComment(KOK); |
|
2635 } |
|
2636 |
|
2637 break; |
|
2638 } |
|
2639 |
|
2640 case ECmdChkDeleteMsgsFromServer: //Command takes one arguments: [True/False] |
|
2641 { |
|
2642 iTestHarness.InstantiatePop3SettingsL(); |
|
2643 |
|
2644 //Convert mExpected to a TBool |
|
2645 TBool mExpBool=EFalse; |
|
2646 _LIT(KTrueDes,"true"); |
|
2647 _LIT(KFalseDes,"false"); |
|
2648 |
|
2649 if (mExpected.CompareF(KTrueDes)==0) |
|
2650 mExpBool = ETrue; |
|
2651 else if (mExpected.CompareF(KFalseDes)==0) |
|
2652 mExpBool = EFalse; |
|
2653 else |
|
2654 { |
|
2655 //script file syntax error |
|
2656 User::Leave(KErrNotSupported); |
|
2657 } |
|
2658 |
|
2659 |
|
2660 TBool mRead = iTestHarness.iPop3Settings->DeleteEmailsWhenDisconnecting(); |
|
2661 |
|
2662 if (mRead!=mExpBool) |
|
2663 { |
|
2664 _LIT(KTmp,"ERROR - checking Pop3 DeleteEmailsWhenDisconnecting expected \"%S\" read \"%S\""); |
|
2665 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+6); |
|
2666 TBuf<5> mRDes = (mRead?_L("TRUE"):_L("FALSE")); |
|
2667 td->Des().Format(KTmp,&mExpected,&mRDes); |
|
2668 iTestHarness.TestUtils().WriteComment(*td); |
|
2669 CleanupStack::PopAndDestroy(td); |
|
2670 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2671 } |
|
2672 else |
|
2673 { |
|
2674 _LIT(KOK,"OK POP3 DeleteEmailsWhenDisconnecting correct"); |
|
2675 iTestHarness.TestUtils().WriteComment(KOK); |
|
2676 } |
|
2677 |
|
2678 break; |
|
2679 } |
|
2680 |
|
2681 case ECmdChkPop3Password: //Command takes one arguments: [Password] |
|
2682 { |
|
2683 iTestHarness.InstantiatePop3SettingsL(); |
|
2684 |
|
2685 TPtrC8 mRead(iTestHarness.iPop3Settings->Password()); |
|
2686 HBufC* kj = HBufC::NewLC(mRead.Length()); |
|
2687 kj->Des().Copy(mRead); |
|
2688 |
|
2689 if (kj->Compare(mExpected)!=0) |
|
2690 { |
|
2691 _LIT(KTmp,"ERROR - checking Pop3 Password expected \"%S\" read \"%S\""); |
|
2692 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
2693 td->Des().Format(KTmp,&mExpected,kj); |
|
2694 iTestHarness.TestUtils().WriteComment(*td); |
|
2695 CleanupStack::PopAndDestroy(td); |
|
2696 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2697 } |
|
2698 else |
|
2699 { |
|
2700 _LIT(KOK,"OK POP3 Password correct"); |
|
2701 iTestHarness.TestUtils().WriteComment(KOK); |
|
2702 } |
|
2703 |
|
2704 CleanupStack::PopAndDestroy(kj); |
|
2705 |
|
2706 break; |
|
2707 } |
|
2708 |
|
2709 case ECmdChkPop3LoginName: //Command takes one arguments: [LoginName] |
|
2710 { |
|
2711 iTestHarness.InstantiatePop3SettingsL(); |
|
2712 |
|
2713 TPtrC8 mLogon(iTestHarness.iPop3Settings->LoginName()); |
|
2714 HBufC* kj = HBufC::NewLC(mLogon.Length()); |
|
2715 kj->Des().Copy(mLogon); |
|
2716 |
|
2717 if (kj->Compare(mExpected)!=0) |
|
2718 { |
|
2719 _LIT(KTmp,"ERROR - checking Pop3 LoginName expected \"%S\" read \"%S\""); |
|
2720 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mLogon.Length()); |
|
2721 td->Des().Format(KTmp,&mExpected,kj); |
|
2722 iTestHarness.TestUtils().WriteComment(*td); |
|
2723 CleanupStack::PopAndDestroy(td); |
|
2724 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2725 } |
|
2726 else |
|
2727 { |
|
2728 _LIT(KOK,"OK POP3 LoginName correct"); |
|
2729 iTestHarness.TestUtils().WriteComment(KOK); |
|
2730 } |
|
2731 |
|
2732 CleanupStack::PopAndDestroy(kj); |
|
2733 |
|
2734 break; |
|
2735 } |
|
2736 |
|
2737 case ECmdChkSmtpServerAddress : //Command takes one arguments: [ServerAddress] |
|
2738 { |
|
2739 iTestHarness.InstantiateSmtpSettingsL(); |
|
2740 |
|
2741 TPtrC mRead(iTestHarness.iSmtpSettings->ServerAddress()); |
|
2742 |
|
2743 if (mExpected.Compare(mRead)!=0) |
|
2744 { |
|
2745 _LIT(KTmp,"ERROR - checking SMTP ServerAddress expected \"%S\" read \"%S\""); |
|
2746 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
2747 td->Des().Format(KTmp,&mExpected,&mRead); |
|
2748 iTestHarness.TestUtils().WriteComment(*td); |
|
2749 CleanupStack::PopAndDestroy(td); |
|
2750 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2751 } |
|
2752 else |
|
2753 { |
|
2754 _LIT(KOK,"OK Smtp ServerAddress correct"); |
|
2755 iTestHarness.TestUtils().WriteComment(KOK); |
|
2756 } |
|
2757 |
|
2758 |
|
2759 |
|
2760 break; |
|
2761 } |
|
2762 case ECmdChkSmtpUserAddress: //Command takes one arguments: [EmailAlias] |
|
2763 { |
|
2764 _LIT(KOK, "OK Smtp User Address deprecated - ignored"); |
|
2765 iTestHarness.TestUtils().WriteComment(KOK); |
|
2766 |
|
2767 |
|
2768 break; |
|
2769 } |
|
2770 case ECmdChkSmtpEmailAlias: //Command takes one arguments: [EmailAlias] |
|
2771 { |
|
2772 iTestHarness.InstantiateSmtpSettingsL(); |
|
2773 |
|
2774 TPtrC mRead(iTestHarness.iSmtpSettings->EmailAlias()); |
|
2775 |
|
2776 if (mExpected.Compare(mRead)!=0) |
|
2777 { |
|
2778 _LIT(KTmp,"ERROR - checking SMTP EmailAlias expected \"%S\" read \"%S\""); |
|
2779 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
2780 td->Des().Format(KTmp,&mExpected,&mRead); |
|
2781 iTestHarness.TestUtils().WriteComment(*td); |
|
2782 CleanupStack::PopAndDestroy(td); |
|
2783 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2784 } |
|
2785 else |
|
2786 { |
|
2787 _LIT(KOK,"OK Smtp EmailAlias correct"); |
|
2788 iTestHarness.TestUtils().WriteComment(KOK); |
|
2789 } |
|
2790 |
|
2791 |
|
2792 |
|
2793 break; |
|
2794 } |
|
2795 case ECmdChkSmtpEmailAddress: //Command takes one arguments: [EmailAddress] |
|
2796 { |
|
2797 iTestHarness.InstantiateSmtpSettingsL(); |
|
2798 |
|
2799 TPtrC mRead(iTestHarness.iSmtpSettings->EmailAddress()); |
|
2800 |
|
2801 if (mExpected.Compare(mRead)!=0) |
|
2802 { |
|
2803 _LIT(KTmp,"ERROR - checking SMTP EmailAddress expected \"%S\" read \"%S\""); |
|
2804 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
2805 td->Des().Format(KTmp,&mExpected,&mRead); |
|
2806 iTestHarness.TestUtils().WriteComment(*td); |
|
2807 CleanupStack::PopAndDestroy(td); |
|
2808 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2809 } |
|
2810 else |
|
2811 { |
|
2812 _LIT(KOK,"OK Smtp EmailAddress correct"); |
|
2813 iTestHarness.TestUtils().WriteComment(KOK); |
|
2814 } |
|
2815 |
|
2816 |
|
2817 break; |
|
2818 } |
|
2819 case ECmdChkSmtpReplyToAddress: //Command takes one arguments: [ReplyToAddress] |
|
2820 { |
|
2821 iTestHarness.InstantiateSmtpSettingsL(); |
|
2822 |
|
2823 TPtrC mRead(iTestHarness.iSmtpSettings->ReplyToAddress()); |
|
2824 |
|
2825 if (mExpected.Compare(mRead)!=0) |
|
2826 { |
|
2827 _LIT(KTmp,"ERROR - checking SMTP ReplyToAddress expected \"%S\" read \"%S\""); |
|
2828 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
2829 td->Des().Format(KTmp,&mExpected,&mRead); |
|
2830 iTestHarness.TestUtils().WriteComment(*td); |
|
2831 CleanupStack::PopAndDestroy(td); |
|
2832 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2833 } |
|
2834 else |
|
2835 { |
|
2836 _LIT(KOK,"OK Smtp ReplyToAddress correct"); |
|
2837 iTestHarness.TestUtils().WriteComment(KOK); |
|
2838 } |
|
2839 |
|
2840 break; |
|
2841 } |
|
2842 case ECmdChkSmtpReceiptAddress: //Command takes one arguments: [ReceiptAddress] |
|
2843 { |
|
2844 iTestHarness.InstantiateSmtpSettingsL(); |
|
2845 |
|
2846 TPtrC mRead(iTestHarness.iSmtpSettings->ReceiptAddress()); |
|
2847 |
|
2848 if (mExpected.Compare(mRead)!=0) |
|
2849 { |
|
2850 _LIT(KTmp,"ERROR - checking SMTP ReceiptAddress expected \"%S\" read \"%S\""); |
|
2851 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
2852 td->Des().Format(KTmp,&mExpected,&mRead); |
|
2853 iTestHarness.TestUtils().WriteComment(*td); |
|
2854 CleanupStack::PopAndDestroy(td); |
|
2855 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2856 } |
|
2857 else |
|
2858 { |
|
2859 _LIT(KOK,"OK Smtp ReceiptAddress correct"); |
|
2860 iTestHarness.TestUtils().WriteComment(KOK); |
|
2861 } |
|
2862 |
|
2863 |
|
2864 break; |
|
2865 } |
|
2866 case ECmdChkSmtpBodyEncoding: //Command takes one arguments: [BodyEncoding] |
|
2867 { |
|
2868 iTestHarness.InstantiateSmtpSettingsL(); |
|
2869 |
|
2870 /*enum TMsgOutboxBodyEncoding |
|
2871 { |
|
2872 EMsgOutboxDefault, |
|
2873 EMsgOutboxNoAlgorithm, |
|
2874 EMsgOutboxMIME, |
|
2875 EMsgOutboxMHTMLAsMIME, |
|
2876 EMsgOutboxMHTMLAlternativeAsMIME |
|
2877 };*/ |
|
2878 |
|
2879 //Convert mExpected to a TMsgOutboxBodyEncoding |
|
2880 TMsgOutboxBodyEncoding mExpEnum=EMsgOutboxDefault; |
|
2881 _LIT(KDefaultDes,"default"); |
|
2882 _LIT(KNoAlgorithmDes,"noalgorithm"); |
|
2883 _LIT(KMIMEDes,"mime"); |
|
2884 _LIT(KMHTMLAsMIMEDes,"mhtmlasmime"); |
|
2885 _LIT(KMHTMLAlternativeAsMIMEDes,"mhtmlalternativeasmime"); |
|
2886 |
|
2887 if (mExpected.CompareF(KDefaultDes)==0) |
|
2888 mExpEnum = EMsgOutboxDefault; |
|
2889 else if (mExpected.CompareF(KNoAlgorithmDes)==0) |
|
2890 mExpEnum = EMsgOutboxNoAlgorithm; |
|
2891 else if (mExpected.CompareF(KMIMEDes)==0) |
|
2892 mExpEnum = EMsgOutboxMIME; |
|
2893 else if (mExpected.CompareF(KMHTMLAsMIMEDes)==0) |
|
2894 mExpEnum = EMsgOutboxMHTMLAsMIME; |
|
2895 else if (mExpected.CompareF(KMHTMLAlternativeAsMIMEDes)==0) |
|
2896 mExpEnum = EMsgOutboxMHTMLAlternativeAsMIME; |
|
2897 else |
|
2898 { |
|
2899 //script file syntax error |
|
2900 User::Leave(KErrNotSupported); |
|
2901 } |
|
2902 |
|
2903 TMsgOutboxBodyEncoding mRead=iTestHarness.iSmtpSettings->BodyEncoding(); |
|
2904 |
|
2905 if (mRead!=mExpEnum) |
|
2906 { |
|
2907 _LIT(KTmp,"ERROR - checking SMTP BodyEncoding expected \"%d\" read \"%d\""); |
|
2908 HBufC* td = HBufC::NewLC(KTmp().Length()+12); |
|
2909 td->Des().Format(KTmp,mExpEnum,mRead); |
|
2910 iTestHarness.TestUtils().WriteComment(*td); |
|
2911 CleanupStack::PopAndDestroy(td); |
|
2912 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2913 } |
|
2914 else |
|
2915 { |
|
2916 _LIT(KOK,"OK Smtp BodyEncoding correct"); |
|
2917 iTestHarness.TestUtils().WriteComment(KOK); |
|
2918 } |
|
2919 |
|
2920 break; |
|
2921 } |
|
2922 case ECmdChkSmtpDefaultMsgCharSet: //Command takes one arguments: [DefaultMsgCharSet] |
|
2923 { |
|
2924 |
|
2925 //This test would have to check equality of Uids |
|
2926 //We can't convert text from the script file to a TUid |
|
2927 //trivially so leave: |
|
2928 User::Leave(KErrNotSupported); |
|
2929 |
|
2930 break; |
|
2931 } |
|
2932 case ECmdChkSmtpAddVCardToEmail: //Command takes one arguments: [AddVCardToEmail] |
|
2933 { |
|
2934 iTestHarness.InstantiateSmtpSettingsL(); |
|
2935 |
|
2936 //Convert mExpected to a TBool |
|
2937 TBool mExpBool=EFalse; |
|
2938 _LIT(KTrueDes,"true"); |
|
2939 _LIT(KFalseDes,"false"); |
|
2940 |
|
2941 if (mExpected.CompareF(KTrueDes)==0) |
|
2942 mExpBool = ETrue; |
|
2943 else if (mExpected.CompareF(KFalseDes)==0) |
|
2944 mExpBool = EFalse; |
|
2945 else |
|
2946 { |
|
2947 //script file syntax error |
|
2948 User::Leave(KErrNotSupported); |
|
2949 } |
|
2950 |
|
2951 TBool mRead(iTestHarness.iSmtpSettings->AddVCardToEmail()); |
|
2952 |
|
2953 if (mRead!=mExpBool) |
|
2954 { |
|
2955 _LIT(KTmp,"ERROR - checking SMTP AddVCardToEmail expected \"%S\" read \"%S\""); |
|
2956 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+6); |
|
2957 TBuf<5> mRDes = (mRead?_L("TRUE"):_L("FALSE")); |
|
2958 td->Des().Format(KTmp,&mExpected,&mRDes); |
|
2959 iTestHarness.TestUtils().WriteComment(*td); |
|
2960 CleanupStack::PopAndDestroy(td); |
|
2961 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
2962 } |
|
2963 else |
|
2964 { |
|
2965 _LIT(KOK,"OK Smtp AddVCardToEmail correct"); |
|
2966 iTestHarness.TestUtils().WriteComment(KOK); |
|
2967 } |
|
2968 |
|
2969 break; |
|
2970 } |
|
2971 case ECmdChkSmtpAddSignatureToEmail: //Command takes one arguments: [AddSignatureToEmail] |
|
2972 { |
|
2973 iTestHarness.InstantiateSmtpSettingsL(); |
|
2974 |
|
2975 //Convert mExpected to a TBool |
|
2976 TBool mExpBool=EFalse; |
|
2977 _LIT(KTrueDes,"true"); |
|
2978 _LIT(KFalseDes,"false"); |
|
2979 |
|
2980 if (mExpected.CompareF(KTrueDes)==0) |
|
2981 mExpBool = ETrue; |
|
2982 else if (mExpected.CompareF(KFalseDes)==0) |
|
2983 mExpBool = EFalse; |
|
2984 else |
|
2985 { |
|
2986 //script file syntax error |
|
2987 User::Leave(KErrNotSupported); |
|
2988 } |
|
2989 |
|
2990 TBool mRead(iTestHarness.iSmtpSettings->AddSignatureToEmail()); |
|
2991 |
|
2992 if (mRead!=mExpBool) |
|
2993 { |
|
2994 _LIT(KTmp,"ERROR - checking SMTP AddSignatureToEmail expected \"%S\" read \"%S\""); |
|
2995 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+6); |
|
2996 TBuf<5> mRDes = (mRead?_L("TRUE"):_L("FALSE")); |
|
2997 td->Des().Format(KTmp,&mExpected,&mRDes); |
|
2998 iTestHarness.TestUtils().WriteComment(*td); |
|
2999 CleanupStack::PopAndDestroy(td); |
|
3000 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3001 } |
|
3002 else |
|
3003 { |
|
3004 _LIT(KOK,"OK Smtp AddSignatureToEmail correct"); |
|
3005 iTestHarness.TestUtils().WriteComment(KOK); |
|
3006 } |
|
3007 |
|
3008 break; |
|
3009 } |
|
3010 case ECmdChkSmtpRequestReceipts: //Command takes one arguments: [RequestReceipts] |
|
3011 { |
|
3012 iTestHarness.InstantiateSmtpSettingsL(); |
|
3013 |
|
3014 //Convert mExpected to a TBool |
|
3015 TBool mExpBool=EFalse; |
|
3016 _LIT(KTrueDes,"true"); |
|
3017 _LIT(KFalseDes,"false"); |
|
3018 |
|
3019 if (mExpected.CompareF(KTrueDes)==0) |
|
3020 mExpBool = ETrue; |
|
3021 else if (mExpected.CompareF(KFalseDes)==0) |
|
3022 mExpBool = EFalse; |
|
3023 else |
|
3024 { |
|
3025 //script file syntax error |
|
3026 User::Leave(KErrNotSupported); |
|
3027 } |
|
3028 |
|
3029 TBool mRead(iTestHarness.iSmtpSettings->RequestReceipts()); |
|
3030 |
|
3031 if (mRead!=mExpBool) |
|
3032 { |
|
3033 _LIT(KTmp,"ERROR - checking SMTP RequestReceipts expected \"%S\" read \"%S\""); |
|
3034 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+6); |
|
3035 TBuf<5> mRDes = (mRead?_L("TRUE"):_L("FALSE")); |
|
3036 td->Des().Format(KTmp,&mExpected,&mRDes); |
|
3037 iTestHarness.TestUtils().WriteComment(*td); |
|
3038 CleanupStack::PopAndDestroy(td); |
|
3039 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3040 } |
|
3041 else |
|
3042 { |
|
3043 _LIT(KOK,"OK Smtp RequestReceipts correct"); |
|
3044 iTestHarness.TestUtils().WriteComment(KOK); |
|
3045 } |
|
3046 |
|
3047 break; |
|
3048 } |
|
3049 case ECmdChkSmtpSendCopyToSelf: //Command takes one arguments: [SendCopyToSelf] |
|
3050 { |
|
3051 iTestHarness.InstantiateSmtpSettingsL(); |
|
3052 |
|
3053 /*enum TImSMTPSendCopyToSelf |
|
3054 { |
|
3055 ESendNoCopy, |
|
3056 ESendCopyAsToRecipient, |
|
3057 ESendCopyAsCcRecipient, |
|
3058 ESendCopyAsBccRecipient |
|
3059 };*/ |
|
3060 |
|
3061 //Convert mExpected to a TImSMTPSendCopyToSelf |
|
3062 TImSMTPSendCopyToSelf mExpEnum=ESendNoCopy; |
|
3063 _LIT(K1Des,"nocopy"); |
|
3064 _LIT(K2Des,"copyastorecipient"); |
|
3065 _LIT(K3Des,"copyasccrecipient"); |
|
3066 _LIT(K4Des,"copyasbccrecipient"); |
|
3067 |
|
3068 |
|
3069 if (mExpected.CompareF(K1Des)==0) |
|
3070 mExpEnum = ESendNoCopy; |
|
3071 else if (mExpected.CompareF(K2Des)==0) |
|
3072 mExpEnum = ESendCopyAsToRecipient; |
|
3073 else if (mExpected.CompareF(K3Des)==0) |
|
3074 mExpEnum = ESendCopyAsCcRecipient; |
|
3075 else if (mExpected.CompareF(K4Des)==0) |
|
3076 mExpEnum = ESendCopyAsBccRecipient; |
|
3077 else |
|
3078 { |
|
3079 //script file syntax error |
|
3080 User::Leave(KErrNotSupported); |
|
3081 } |
|
3082 |
|
3083 TImSMTPSendCopyToSelf mRead=iTestHarness.iSmtpSettings->SendCopyToSelf(); |
|
3084 |
|
3085 |
|
3086 if (mRead!=mExpEnum) |
|
3087 { |
|
3088 _LIT(KTmp,"ERROR - checking SMTP SendCopyToSelf expected \"%d\" read \"%d\""); |
|
3089 |
|
3090 HBufC* td = HBufC::NewLC(KTmp().Length()+12); |
|
3091 td->Des().Format(KTmp,mExpEnum,mRead); |
|
3092 iTestHarness.TestUtils().WriteComment(*td); |
|
3093 CleanupStack::PopAndDestroy(td); |
|
3094 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3095 } |
|
3096 else |
|
3097 { |
|
3098 _LIT(KOK,"OK Smtp SendCopyToSelf correct"); |
|
3099 iTestHarness.TestUtils().WriteComment(KOK); |
|
3100 } |
|
3101 |
|
3102 break; |
|
3103 }/* |
|
3104 case ECmdChkSmtpSendMessageOption: //Command takes one arguments: [SendMessageOption] |
|
3105 { |
|
3106 iTestHarness.InstantiateSmtpSettingsL(); |
|
3107 |
|
3108 TPtrC8 mRead(iTestHarness.iSmtpSettings->SendMessageOption()); |
|
3109 |
|
3110 if (//Compare fails) |
|
3111 { |
|
3112 _LIT(KTmp,"ERROR - checking SMTP SendMessageOption expected \"%S\" read \"%S\""); |
|
3113 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
3114 td->Des().Format(KTmp,&mExpected,kj); |
|
3115 iTestHarness.TestUtils().WriteComment(*td); |
|
3116 CleanupStack::PopAndDestroy(td); |
|
3117 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3118 } |
|
3119 else |
|
3120 { |
|
3121 _LIT(KOK,"OK Smtp SendMessageOption correct"); |
|
3122 iTestHarness.TestUtils().WriteComment(KOK); |
|
3123 } |
|
3124 |
|
3125 CleanupStack::PopAndDestroy(kj); |
|
3126 |
|
3127 break; |
|
3128 } |
|
3129 |
|
3130 */ |
|
3131 |
|
3132 case ECmdChkImapLoginName: //Command takes one arguments: [LoginName] |
|
3133 { |
|
3134 iTestHarness.InstantiateImapSettingsL(); |
|
3135 |
|
3136 TPtrC8 mRead(iTestHarness.iImapSettings->LoginName()); |
|
3137 HBufC* kj = HBufC::NewLC(mRead.Length()); |
|
3138 kj->Des().Copy(mRead); |
|
3139 |
|
3140 if (kj->Compare(mExpected)!=0) |
|
3141 { |
|
3142 _LIT(KTmp,"ERROR - checking IMAP LoginName expected \"%S\" read \"%S\""); |
|
3143 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
3144 td->Des().Format(KTmp,&mExpected,kj); |
|
3145 iTestHarness.TestUtils().WriteComment(*td); |
|
3146 CleanupStack::PopAndDestroy(td); |
|
3147 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3148 } |
|
3149 else |
|
3150 { |
|
3151 _LIT(KOK,"OK Imap LoginName correct"); |
|
3152 iTestHarness.TestUtils().WriteComment(KOK); |
|
3153 } |
|
3154 |
|
3155 CleanupStack::PopAndDestroy(kj); |
|
3156 |
|
3157 break; |
|
3158 } |
|
3159 case ECmdChkImapPassword: //Command takes one arguments: [Password] |
|
3160 { |
|
3161 iTestHarness.InstantiateImapSettingsL(); |
|
3162 |
|
3163 TPtrC8 mRead(iTestHarness.iImapSettings->Password()); |
|
3164 HBufC* kj = HBufC::NewLC(mRead.Length()); |
|
3165 kj->Des().Copy(mRead); |
|
3166 |
|
3167 if (kj->Compare(mExpected)!=0) |
|
3168 { |
|
3169 _LIT(KTmp,"ERROR - checking IMAP Password expected \"%S\" read \"%S\""); |
|
3170 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
3171 td->Des().Format(KTmp,&mExpected,kj); |
|
3172 iTestHarness.TestUtils().WriteComment(*td); |
|
3173 CleanupStack::PopAndDestroy(td); |
|
3174 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3175 } |
|
3176 else |
|
3177 { |
|
3178 _LIT(KOK,"OK Imap Password correct"); |
|
3179 iTestHarness.TestUtils().WriteComment(KOK); |
|
3180 } |
|
3181 |
|
3182 CleanupStack::PopAndDestroy(kj); |
|
3183 |
|
3184 break; |
|
3185 } |
|
3186 case ECmdChkImapFolderPath: //Command takes one arguments: [FolderPath] |
|
3187 { |
|
3188 iTestHarness.InstantiateImapSettingsL(); |
|
3189 |
|
3190 TPtrC8 mRead(iTestHarness.iImapSettings->FolderPath()); |
|
3191 HBufC* kj = HBufC::NewLC(mRead.Length()); |
|
3192 kj->Des().Copy(mRead); |
|
3193 |
|
3194 if (kj->Compare(mExpected)!=0) |
|
3195 { |
|
3196 _LIT(KTmp,"ERROR - checking IMAP FolderPath expected \"%S\" read \"%S\""); |
|
3197 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
3198 td->Des().Format(KTmp,&mExpected,kj); |
|
3199 iTestHarness.TestUtils().WriteComment(*td); |
|
3200 CleanupStack::PopAndDestroy(td); |
|
3201 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3202 } |
|
3203 else |
|
3204 { |
|
3205 _LIT(KOK,"OK Imap FolderPath correct"); |
|
3206 iTestHarness.TestUtils().WriteComment(KOK); |
|
3207 } |
|
3208 |
|
3209 CleanupStack::PopAndDestroy(kj); |
|
3210 |
|
3211 break; |
|
3212 } |
|
3213 case ECmdChkImapServerAddress: //Command takes one arguments: [Server_address] |
|
3214 { |
|
3215 iTestHarness.InstantiateImapSettingsL(); |
|
3216 |
|
3217 TPtrC mRead=iTestHarness.iImapSettings->ServerAddress(); |
|
3218 |
|
3219 if (mRead.Compare(mExpected)!=0) |
|
3220 { |
|
3221 _LIT(KTmp,"ERROR - checking Imap Server Address expected \"%S\" read \"%S\""); |
|
3222 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
3223 td->Des().Format(KTmp,&mExpected,&mRead); |
|
3224 iTestHarness.TestUtils().WriteComment(*td); |
|
3225 CleanupStack::PopAndDestroy(td); |
|
3226 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3227 } |
|
3228 else |
|
3229 { |
|
3230 _LIT(KOK,"OK Imap Server Address correct"); |
|
3231 iTestHarness.TestUtils().WriteComment(KOK); |
|
3232 } |
|
3233 |
|
3234 |
|
3235 break; |
|
3236 } |
|
3237 |
|
3238 case ECmdChkImapPort: //Command takes one arguments: [Port#] |
|
3239 { |
|
3240 iTestHarness.InstantiateImapSettingsL(); |
|
3241 |
|
3242 //Convert mExpected to a TInt |
|
3243 TLex lexer(mExpected); |
|
3244 TInt mExpectedInt; |
|
3245 User::LeaveIfError(lexer.Val(mExpectedInt)); |
|
3246 |
|
3247 |
|
3248 TInt mRead = iTestHarness.iImapSettings->Port(); |
|
3249 |
|
3250 if (mRead!=mExpectedInt) |
|
3251 { |
|
3252 _LIT(KTmp,"ERROR - checking Imap Port expected \"%d\" read \"%d\""); |
|
3253 HBufC* td = HBufC::NewLC(KTmp().Length()+30); |
|
3254 td->Des().Format(KTmp,mExpectedInt,mRead); |
|
3255 iTestHarness.TestUtils().WriteComment(*td); |
|
3256 CleanupStack::PopAndDestroy(td); |
|
3257 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3258 } |
|
3259 else |
|
3260 { |
|
3261 _LIT(KOK,"OK Imap Port correct"); |
|
3262 iTestHarness.TestUtils().WriteComment(KOK); |
|
3263 } |
|
3264 |
|
3265 break; |
|
3266 } |
|
3267 |
|
3268 |
|
3269 /* |
|
3270 case ECmdChkImapPathSeparator: //Command takes one arguments: [PathSeparator] |
|
3271 { |
|
3272 iTestHarness.InstantiateImapSettingsL(); |
|
3273 |
|
3274 TPtrC mRead(iTestHarness.iImapSettings->PathSeparator()); |
|
3275 |
|
3276 if (//Compare fails) |
|
3277 { |
|
3278 _LIT(KTmp,"ERROR - checking IMAP PathSeparator expected \"%S\" read \"%S\""); |
|
3279 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
3280 td->Des().Format(KTmp,&mExpected,&mRead); |
|
3281 iTestHarness.TestUtils().WriteComment(*td); |
|
3282 CleanupStack::PopAndDestroy(td); |
|
3283 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3284 } |
|
3285 else |
|
3286 { |
|
3287 _LIT(KOK,"OK Imap PathSeparator correct"); |
|
3288 iTestHarness.TestUtils().WriteComment(KOK); |
|
3289 } |
|
3290 |
|
3291 |
|
3292 |
|
3293 break; |
|
3294 } |
|
3295 case ECmdChkImapDisconnectedUserMode: //Command takes one arguments: [DisconnectedUserMode] |
|
3296 { |
|
3297 iTestHarness.InstantiateImapSettingsL(); |
|
3298 |
|
3299 TPtrC mRead(iTestHarness.iImapSettings->DisconnectedUserMode()); |
|
3300 |
|
3301 if (//Compare fails) |
|
3302 { |
|
3303 _LIT(KTmp,"ERROR - checking IMAP DisconnectedUserMode expected \"%S\" read \"%S\""); |
|
3304 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
3305 td->Des().Format(KTmp,&mExpected,&mRead); |
|
3306 iTestHarness.TestUtils().WriteComment(*td); |
|
3307 CleanupStack::PopAndDestroy(td); |
|
3308 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3309 } |
|
3310 else |
|
3311 { |
|
3312 _LIT(KOK,"OK Imap DisconnectedUserMode correct"); |
|
3313 iTestHarness.TestUtils().WriteComment(KOK); |
|
3314 } |
|
3315 |
|
3316 |
|
3317 |
|
3318 break; |
|
3319 } |
|
3320 case ECmdChkImapSynchronise: //Command takes one arguments: [Synchronise] |
|
3321 { |
|
3322 iTestHarness.InstantiateImapSettingsL(); |
|
3323 |
|
3324 TPtrC mRead(iTestHarness.iImapSettings->Synchronise()); |
|
3325 |
|
3326 if (//Compare fails) |
|
3327 { |
|
3328 _LIT(KTmp,"ERROR - checking IMAP Synchronise expected \"%S\" read \"%S\""); |
|
3329 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
3330 td->Des().Format(KTmp,&mExpected,&mRead); |
|
3331 iTestHarness.TestUtils().WriteComment(*td); |
|
3332 CleanupStack::PopAndDestroy(td); |
|
3333 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3334 } |
|
3335 else |
|
3336 { |
|
3337 _LIT(KOK,"OK Imap Synchronise correct"); |
|
3338 iTestHarness.TestUtils().WriteComment(KOK); |
|
3339 } |
|
3340 |
|
3341 |
|
3342 |
|
3343 break; |
|
3344 } |
|
3345 case ECmdChkImapSubscribe: //Command takes one arguments: [Subscribe] |
|
3346 { |
|
3347 iTestHarness.InstantiateImapSettingsL(); |
|
3348 |
|
3349 TPtrC mRead(iTestHarness.iImapSettings->Subscribe()); |
|
3350 |
|
3351 if (//Compare fails) |
|
3352 { |
|
3353 _LIT(KTmp,"ERROR - checking IMAP Subscribe expected \"%S\" read \"%S\""); |
|
3354 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
3355 td->Des().Format(KTmp,&mExpected,&mRead); |
|
3356 iTestHarness.TestUtils().WriteComment(*td); |
|
3357 CleanupStack::PopAndDestroy(td); |
|
3358 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3359 } |
|
3360 else |
|
3361 { |
|
3362 _LIT(KOK,"OK Imap Subscribe correct"); |
|
3363 iTestHarness.TestUtils().WriteComment(KOK); |
|
3364 } |
|
3365 |
|
3366 |
|
3367 |
|
3368 break; |
|
3369 } |
|
3370 case ECmdChkImapAutoSendOnConnect: //Command takes one arguments: [AutoSendOnConnect] |
|
3371 { |
|
3372 iTestHarness.InstantiateImapSettingsL(); |
|
3373 |
|
3374 TPtrC mRead(iTestHarness.iImapSettings->AutoSendOnConnect()); |
|
3375 |
|
3376 if (//Compare fails) |
|
3377 { |
|
3378 _LIT(KTmp,"ERROR - checking IMAP AutoSendOnConnect expected \"%S\" read \"%S\""); |
|
3379 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
3380 td->Des().Format(KTmp,&mExpected,&mRead); |
|
3381 iTestHarness.TestUtils().WriteComment(*td); |
|
3382 CleanupStack::PopAndDestroy(td); |
|
3383 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3384 } |
|
3385 else |
|
3386 { |
|
3387 _LIT(KOK,"OK Imap AutoSendOnConnect correct"); |
|
3388 iTestHarness.TestUtils().WriteComment(KOK); |
|
3389 } |
|
3390 |
|
3391 |
|
3392 |
|
3393 break; |
|
3394 } |
|
3395 case ECmdChkImapMaxEmailSize: //Command takes one arguments: [MaxEmailSize] |
|
3396 { |
|
3397 iTestHarness.InstantiateImapSettingsL(); |
|
3398 |
|
3399 TPtrC mRead(iTestHarness.iImapSettings->MaxEmailSize()); |
|
3400 |
|
3401 if (//Compare fails) |
|
3402 { |
|
3403 _LIT(KTmp,"ERROR - checking IMAP MaxEmailSize expected \"%S\" read \"%S\""); |
|
3404 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
3405 td->Des().Format(KTmp,&mExpected,&mRead); |
|
3406 iTestHarness.TestUtils().WriteComment(*td); |
|
3407 CleanupStack::PopAndDestroy(td); |
|
3408 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3409 } |
|
3410 else |
|
3411 { |
|
3412 _LIT(KOK,"OK Imap MaxEmailSize correct"); |
|
3413 iTestHarness.TestUtils().WriteComment(KOK); |
|
3414 } |
|
3415 |
|
3416 |
|
3417 |
|
3418 break; |
|
3419 } |
|
3420 case ECmdChkImapDeleteEmailsWhenDisconnecting: //Command takes one arguments: [DeleteEmailsWhenDisconnecting] |
|
3421 { |
|
3422 iTestHarness.InstantiateImapSettingsL(); |
|
3423 |
|
3424 TPtrC mRead(iTestHarness.iImapSettings->DeleteEmailsWhenDisconnecting()); |
|
3425 |
|
3426 if (//Compare fails) |
|
3427 { |
|
3428 _LIT(KTmp,"ERROR - checking IMAP DeleteEmailsWhenDisconnecting expected \"%S\" read \"%S\""); |
|
3429 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
3430 td->Des().Format(KTmp,&mExpected,&mRead); |
|
3431 iTestHarness.TestUtils().WriteComment(*td); |
|
3432 CleanupStack::PopAndDestroy(td); |
|
3433 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3434 } |
|
3435 else |
|
3436 { |
|
3437 _LIT(KOK,"OK Imap DeleteEmailsWhenDisconnecting correct"); |
|
3438 iTestHarness.TestUtils().WriteComment(KOK); |
|
3439 } |
|
3440 |
|
3441 |
|
3442 |
|
3443 break; |
|
3444 } |
|
3445 case ECmdChkImapAcknowledgeReceipts: //Command takes one arguments: [AcknowledgeReceipts] |
|
3446 { |
|
3447 iTestHarness.InstantiateImapSettingsL(); |
|
3448 |
|
3449 TPtrC mRead(iTestHarness.iImapSettings->AcknowledgeReceipts()); |
|
3450 |
|
3451 if (//Compare fails) |
|
3452 { |
|
3453 _LIT(KTmp,"ERROR - checking IMAP AcknowledgeReceipts expected \"%S\" read \"%S\""); |
|
3454 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
3455 td->Des().Format(KTmp,&mExpected,&mRead); |
|
3456 iTestHarness.TestUtils().WriteComment(*td); |
|
3457 CleanupStack::PopAndDestroy(td); |
|
3458 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3459 } |
|
3460 else |
|
3461 { |
|
3462 _LIT(KOK,"OK Imap AcknowledgeReceipts correct"); |
|
3463 iTestHarness.TestUtils().WriteComment(KOK); |
|
3464 } |
|
3465 |
|
3466 |
|
3467 |
|
3468 break; |
|
3469 } |
|
3470 case ECmdChkImapGetMailOptions: //Command takes one arguments: [GetMailOptions] |
|
3471 { |
|
3472 iTestHarness.InstantiateImapSettingsL(); |
|
3473 |
|
3474 TPtrC mRead(iTestHarness.iImapSettings->GetMailOptions()); |
|
3475 |
|
3476 if (//Compare fails) |
|
3477 { |
|
3478 _LIT(KTmp,"ERROR - checking IMAP GetMailOptions expected \"%S\" read \"%S\""); |
|
3479 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
3480 td->Des().Format(KTmp,&mExpected,&mRead); |
|
3481 iTestHarness.TestUtils().WriteComment(*td); |
|
3482 CleanupStack::PopAndDestroy(td); |
|
3483 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3484 } |
|
3485 else |
|
3486 { |
|
3487 _LIT(KOK,"OK Imap GetMailOptions correct"); |
|
3488 iTestHarness.TestUtils().WriteComment(KOK); |
|
3489 } |
|
3490 |
|
3491 |
|
3492 |
|
3493 break; |
|
3494 } |
|
3495 case ECmdChkImapInboxSynchronisationLimit: //Command takes one arguments: [InboxSynchronisationLimit] |
|
3496 { |
|
3497 iTestHarness.InstantiateImapSettingsL(); |
|
3498 |
|
3499 TPtrC mRead(iTestHarness.iImapSettings->InboxSynchronisationLimit()); |
|
3500 |
|
3501 if (//Compare fails) |
|
3502 { |
|
3503 _LIT(KTmp,"ERROR - checking IMAP InboxSynchronisationLimit expected \"%S\" read \"%S\""); |
|
3504 HBufC* td = HBufC::NewLC(KTmp().Length()+mExpected.Length()+mRead.Length()); |
|
3505 td->Des().Format(KTmp,&mExpected,&mRead); |
|
3506 iTestHarness.TestUtils().WriteComment(*td); |
|
3507 CleanupStack::PopAndDestroy(td); |
|
3508 User::Leave(KErrGeneral); // The test failed so the framework requires us to leave |
|
3509 } |
|
3510 else |
|
3511 { |
|
3512 _LIT(KOK,"OK Imap InboxSynchronisationLimit correct"); |
|
3513 iTestHarness.TestUtils().WriteComment(KOK); |
|
3514 } |
|
3515 |
|
3516 |
|
3517 |
|
3518 break; |
|
3519 } |
|
3520 |
|
3521 */ |
|
3522 default: |
|
3523 { |
|
3524 //DO Nothing |
|
3525 } |
|
3526 } |
|
3527 |
|
3528 // |
|
3529 // We leave on error, so always say KErrNone |
|
3530 TRequestStatus* req = &aStatus; |
|
3531 User::RequestComplete(req, KErrNone); |
|
3532 } |
|
3533 |
|
3534 CDoCmdMsv::~CDoCmdMsv() |
|
3535 { |
|
3536 delete iArgs; |
|
3537 } |