|
1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Test harness for WAP Access Point Settings Parser. |
|
15 // The test harness simply creates new messages from binary data files |
|
16 // and calls the WAP Access Point Settings Parser to parse them. |
|
17 // |
|
18 // |
|
19 |
|
20 #include <e32uid.h> |
|
21 #include <e32test.h> |
|
22 #include <e32cons.h> |
|
23 #include <s32file.h> |
|
24 #include <e32base.h> |
|
25 |
|
26 // Comms stuff |
|
27 #include <msvids.h> |
|
28 #include <msvuids.h> |
|
29 #include <msvruids.h> |
|
30 #include <msvstd.h> |
|
31 #include <msventry.h> |
|
32 #include <mtsr.h> |
|
33 #include <txtfmlyr.h> |
|
34 #include <txtrich.h> |
|
35 #include <imcvtext.h> |
|
36 |
|
37 // General parser stuff: |
|
38 #include <bsp.h> |
|
39 #include <regpsdll.h> // Parser registration. |
|
40 |
|
41 #include <biouids.h> // Defines for use in Bio messaging |
|
42 #include <bitsids.h> // Uids for use in Test Harnesses |
|
43 |
|
44 #include "biotestutils.h" |
|
45 #include <biodb.h> // CBIODatabase. |
|
46 #include "tmsvbioinfo.h" |
|
47 |
|
48 // WAP stuff: |
|
49 |
|
50 #include <etelpckt.h> |
|
51 #include <etelmm.h> |
|
52 #include <wapp.h> |
|
53 #include <wappdef.h> |
|
54 #include "wapperr.h" |
|
55 #include "T_Wapp.h" |
|
56 |
|
57 #include <mmsvattachmentmanager.h> |
|
58 #include <cmsvattachment.h> |
|
59 |
|
60 _LIT(KEBookmarkExtension, ".eBM"); |
|
61 _LIT(KEBookmarkItemBegin, "BEGIN:eBOOKMARK"); |
|
62 _LIT(KEBookmarkItemEnd, "END:eBOOKMARK"); |
|
63 const TInt KNumberOfBookmarkFields = 3; |
|
64 |
|
65 //#define __HEAPFAILURE__ // set the compiler flag to include test code for heap failure |
|
66 |
|
67 // |
|
68 // CExampleScheduler: Implementation // |
|
69 // |
|
70 void CTestScheduler::Error(TInt aError) const |
|
71 { |
|
72 CActiveScheduler::Stop(); |
|
73 test.Printf(_L("\nLeave signalled, reason=%d\n"),aError); |
|
74 } |
|
75 // end CExampleScheduler::Error |
|
76 |
|
77 |
|
78 // |
|
79 // CTestWapp: IMPLEMENTATION // |
|
80 // |
|
81 |
|
82 // |
|
83 // Factory methods // |
|
84 // |
|
85 CTestWapp::CTestWapp(RFs& aFs) |
|
86 :CActive(KTestWappPriority), |
|
87 iFs(aFs), |
|
88 iWAPModemID(KWappModemInitValue) // Initialise to KErrNotFound |
|
89 { |
|
90 } |
|
91 // end CTestWapp::CTestWapp |
|
92 |
|
93 |
|
94 CTestWapp::~CTestWapp() |
|
95 { |
|
96 Cancel(); |
|
97 |
|
98 delete iCurrentSettingsName; |
|
99 // delete iBioDatabase; |
|
100 delete iMessageBody; |
|
101 delete iMsvSelection; |
|
102 if (iWappParser) |
|
103 { |
|
104 delete iWappParser; |
|
105 } |
|
106 |
|
107 delete iBioTestUtils; |
|
108 } |
|
109 // end CTestWapp::~CTestWapp |
|
110 |
|
111 |
|
112 CTestWapp* CTestWapp::NewL(RFs& aFs) |
|
113 { |
|
114 CTestWapp* self = new (ELeave) CTestWapp(aFs); |
|
115 CleanupStack::PushL(self); |
|
116 self->ConstructL(); |
|
117 CleanupStack::Pop(); // self |
|
118 return self; |
|
119 } |
|
120 // end CTestWapp::NewL |
|
121 |
|
122 |
|
123 void CTestWapp::ConstructL() |
|
124 { |
|
125 iBioTestUtils = CBioTestUtils::NewL(test, ETuGoClientSide); |
|
126 |
|
127 |
|
128 //Initialise our member variables |
|
129 iParsedFieldsNum = 0; //No parsed fields so far |
|
130 iTestSuccesses=0; |
|
131 iTestFailures = 0; |
|
132 iMessagesCreated=0; |
|
133 iTestCounter = 0; // Current Test Number start at 0 |
|
134 // Chose from one of following:- |
|
135 //iTestMode = ETWappConcise; |
|
136 //iTestMode = ETWappDetailed; |
|
137 iTestMode = ETWappVerbose; |
|
138 CActiveScheduler::Add(this); |
|
139 iBioTestUtils->WriteComment(_L("Created WAPP Test Harness")); |
|
140 test.Console()->ClearScreen(); // get rid of menu |
|
141 } |
|
142 // end CTestWapp::ConstructL |
|
143 |
|
144 |
|
145 // |
|
146 // Active object stuff // |
|
147 // |
|
148 void CTestWapp::RunL() |
|
149 { |
|
150 DoRunL(); |
|
151 } |
|
152 |
|
153 TInt CTestWapp::RunError(TInt aError) |
|
154 { |
|
155 iBioTestUtils->TestHarnessFailed(aError); |
|
156 CActiveScheduler::Stop(); |
|
157 return KErrNone; |
|
158 } |
|
159 |
|
160 void CTestWapp::DoRunL() |
|
161 { |
|
162 TInt result=iStatus.Int(); |
|
163 |
|
164 |
|
165 if (result != KErrNone ) |
|
166 { |
|
167 test.Console()->ClearScreen(); |
|
168 test.Console()->SetPos(0,0); |
|
169 DisplayErrorReasonL(result); // Stops active scheduler if the error is unknown. |
|
170 iState = EWappDisplay; |
|
171 } |
|
172 |
|
173 TPtrC tempPtr; |
|
174 HBufC* tempBuffer; |
|
175 |
|
176 switch (iState) |
|
177 { |
|
178 case EWappClearCommDB: |
|
179 // Create the Comms DB |
|
180 DeleteCommDbTableL(); // Trash all the CommDb entries |
|
181 iState = EWappCreateNewMessages; |
|
182 QueueOperationAsync(KErrNone); |
|
183 break; |
|
184 case EWappCreateNewMessages: |
|
185 iState = EWappCreateParser; |
|
186 tempPtr.Set(KWappTestTxtFileDir); |
|
187 tempBuffer= tempPtr.AllocL(); |
|
188 CleanupStack::PushL(tempBuffer); |
|
189 OutputFormattedTextL(_L("Creating messages from files in directory %S"),tempBuffer); |
|
190 TRAPD(error, iMsvSelection = iBioTestUtils->GenerateMessagesL(KWappTestTxtFileDir, ETrue) ); |
|
191 if (error !=KErrNone) |
|
192 { |
|
193 OutputFormattedTextL(_L("Error %d occurred when creating messages"),error); |
|
194 User::Leave(error); |
|
195 } |
|
196 iMessagesCreated= iMsvSelection->Count(); |
|
197 if (iTestMode != ETWappConcise) |
|
198 OutputFormattedTextL(_L("Created %d WAPP messages "),iMessagesCreated ); |
|
199 if (iMessagesCreated ==0) // No WAPP messages |
|
200 User::Leave(KErrNotFound);// Ensure we don't try to parse with no messages |
|
201 QueueOperationAsync(KErrNone); |
|
202 CleanupStack::Pop(); //tempBuffer; |
|
203 delete tempBuffer; |
|
204 tempBuffer = NULL; |
|
205 break; |
|
206 case EWappCreateParser: |
|
207 // Create parser and add ourselves to Active Scheduler |
|
208 iState = EWappProcessUnparsed; |
|
209 iBioTestUtils->TestStart(iTestCounter+1); // Origin at Zero |
|
210 CreateParserL(); // Sets iEntry to new ID, & creates parser |
|
211 if (iTestMode ==ETWappVerbose) |
|
212 OutputFormattedTextL(_L("Running tests on message %d with Entry Id %d"), iTestCounter+1, iEntryId); |
|
213 QueueOperationAsync(KErrNone); |
|
214 break; |
|
215 case EWappProcessUnparsed: |
|
216 //Try processing the unparsed message - should fail - catch the error |
|
217 iState =EWappParse; |
|
218 if (iTestMode !=ETWappConcise) |
|
219 OutputFormattedTextL(_L("Process unparsed message")); |
|
220 ProcessUnparsedMessageL(); // Note that this should fail |
|
221 SetActive(); |
|
222 break; |
|
223 case EWappParse: |
|
224 //Extract the body of the unparsed message and pass it to WAPP for parsing |
|
225 iState =EWappParseAgain; |
|
226 ExtractBodyPartsL();// extracts body text from current message. |
|
227 if (iTestMode != ETWappConcise) |
|
228 OutputFormattedTextL(_L("Parse")); |
|
229 ParseMessageL(); |
|
230 SetActive(); |
|
231 break; |
|
232 case EWappParseAgain: |
|
233 // Parse the parsed message again. Shouldn't generate an error. |
|
234 // Should skip the full parsing op |
|
235 iState = EWappProcess; |
|
236 if (iTestMode != ETWappConcise) |
|
237 OutputFormattedTextL(_L("Re-parse")); |
|
238 ParseMessageL(); |
|
239 SetActive(); |
|
240 break; |
|
241 case EWappProcess: |
|
242 //Process the parsed fields in the stream store attachment to the message |
|
243 iState = EWappProcessAgain; |
|
244 if (iTestMode !=ETWappConcise) |
|
245 OutputFormattedTextL(_L("Process")); |
|
246 ProcessMessageL(); |
|
247 SetActive(); |
|
248 break; |
|
249 case EWappProcessAgain: |
|
250 //Process the parsed fields again - shouldn't create any errors |
|
251 iState = EWappDisplay; |
|
252 if (iTestMode != ETWappConcise) |
|
253 OutputFormattedTextL(_L("Re-Process")); |
|
254 ProcessMessageL(); |
|
255 SetActive(); |
|
256 break; |
|
257 case EWappDisplay: |
|
258 //Display the details of the parsed fields and CommDb as required. |
|
259 UnloadParser(); |
|
260 if (iTestMode != ETWappConcise) |
|
261 RecordEntryDataL(); |
|
262 iBioTestUtils->TestFinish(iTestCounter+1); // origin at zero. |
|
263 iTestCounter++; // NB last time here, also shifts our zero for Test Summary! |
|
264 if (iTestCounter <iMessagesCreated) // Still files to process into messages |
|
265 iState = EWappCreateParser; // so loop through the operations again. |
|
266 else |
|
267 iState = EWappComplete; |
|
268 if (result ==KErrNone) |
|
269 iTestSuccesses++; |
|
270 else |
|
271 iTestFailures++; |
|
272 RequestComplete(iStatus,KErrNone); |
|
273 SetActive(); |
|
274 break; |
|
275 case EWappComplete: |
|
276 //Complete the tests |
|
277 test.Console()->ClearScreen(); |
|
278 test.Console()->SetPos(0,0); |
|
279 //DisplayTestSummaryL(); Bit confusing at the moment |
|
280 if (result ==KErrNone) |
|
281 iBioTestUtils->TestHarnessCompleted(); |
|
282 else |
|
283 iBioTestUtils->TestHarnessFailed(result); |
|
284 if (iWappParser) |
|
285 iWappParser->Cancel(); |
|
286 CActiveScheduler::Stop(); |
|
287 break; |
|
288 default: |
|
289 break; |
|
290 } |
|
291 } |
|
292 // end CTestWapp::RunL |
|
293 |
|
294 |
|
295 void CTestWapp::DoCancel() |
|
296 { |
|
297 } |
|
298 // end CTestWapp::DoCancel |
|
299 |
|
300 |
|
301 void CTestWapp::QueueOperationAsync(TInt aErr) |
|
302 { |
|
303 // Set our status flag, prior to placing ourselves on the Active Scheduler. |
|
304 TRequestStatus* pS = &iStatus; |
|
305 iStatus = KRequestPending; |
|
306 User::RequestComplete(pS, aErr); |
|
307 SetActive(); |
|
308 } |
|
309 // End of CTestWapp::QueueOperationAsync |
|
310 |
|
311 |
|
312 void CTestWapp::RequestComplete(TRequestStatus& aStatus,TInt aCompletion) |
|
313 { |
|
314 TRequestStatus* statusPtr=&aStatus; |
|
315 User::RequestComplete(statusPtr,aCompletion); |
|
316 } |
|
317 // end CTestWapp::RequestComplete |
|
318 |
|
319 |
|
320 |
|
321 // |
|
322 // Class functions // Not a good name, but ne'er mind. |
|
323 // |
|
324 |
|
325 // |
|
326 // StartL - The function controlling state engine |
|
327 // |
|
328 void CTestWapp::StartL() |
|
329 { |
|
330 // TRAPD(err, iBioTestUtils->RunAuto() ? RunAutoTest() : ShowMenuL()); |
|
331 // if (err) |
|
332 // iBioTestUtils->TestHarnessFailed(err); |
|
333 // else |
|
334 { |
|
335 Cancel(); // Halt any AO stuff |
|
336 iState=EWappClearCommDB; // set initial state |
|
337 InitialiseTesterL(); // Initialise variables and get AO going. |
|
338 } |
|
339 } |
|
340 // end CTestWapp::StartL |
|
341 |
|
342 void CTestWapp::RunAutoTest() |
|
343 { |
|
344 test.Next(_L("CTestWapp::Start()\n")); |
|
345 iTestMode = ETWappConcise;; |
|
346 } |
|
347 |
|
348 void CTestWapp::ShowMenuL() |
|
349 { |
|
350 iBioTestUtils->ResetMenu(); |
|
351 |
|
352 iBioTestUtils->AppendToMenuL(_L("Verbose Test - Logs parsed fields and CommDb tables")); |
|
353 iBioTestUtils->AppendToMenuL(_L("Detailed Test - Logs parsed fields only")); |
|
354 iBioTestUtils->AppendToMenuL(_L("Succinct Test - Logs pass and fails")); |
|
355 |
|
356 TInt result = iBioTestUtils->DisplayMenu(_L("Schedule Sending Test")); |
|
357 |
|
358 switch (result) |
|
359 { |
|
360 case 1: |
|
361 iTestMode = ETWappVerbose; |
|
362 break; |
|
363 case 2: |
|
364 iTestMode = ETWappDetailed; |
|
365 break; |
|
366 case 3: |
|
367 default: |
|
368 iTestMode = ETWappConcise; |
|
369 break; |
|
370 } |
|
371 } |
|
372 |
|
373 |
|
374 void CTestWapp::InitialiseTesterL() |
|
375 { |
|
376 // Get the NB if we don't need this two step process, use SetSmsServiceL(). |
|
377 //iBioTestUtils->SetSmsServiceIdL(); |
|
378 TRAPD(error, iBioTestUtils->SetBIOServiceIdL()); |
|
379 if (error == KErrNotFound) |
|
380 { |
|
381 iBioTestUtils->CreateServicesL(); |
|
382 } |
|
383 else |
|
384 { |
|
385 User::LeaveIfError(error); |
|
386 } |
|
387 // Empty the Inbox |
|
388 iBioTestUtils->EmptyInboxMessagesL(); |
|
389 if (iTestMode == ETWappVerbose) |
|
390 iBioTestUtils->WriteComment(_L("Removed all messages from Global Inbox\n")); |
|
391 QueueOperationAsync(KErrNone); |
|
392 } |
|
393 |
|
394 |
|
395 void CTestWapp::DeleteCommDbTableL() |
|
396 { |
|
397 // This is a very destructive function - it nukes all the CommDB tables in which |
|
398 // WAPP makes entries. Ensures that we are starting with an empty database. |
|
399 // WAPPs ability to overwrite existing entries is tested by having files with the same NAME |
|
400 // Characteristic. |
|
401 |
|
402 TInt ret=KErrNone; |
|
403 TInt WAPEntries; |
|
404 TInt WAPIpEntries; |
|
405 TInt WAPSmsEntries; |
|
406 TInt ISPOutEntries; |
|
407 TInt IAPOutEntries; |
|
408 TInt GPRSEntries; |
|
409 |
|
410 CMDBSession* iDBSession = CMDBSession::NewL(CMDBSession::LatestVersion()); |
|
411 TInt err = 0; |
|
412 CMDBRecordSet<CCDWAPAccessPointRecord> wapRecordSet(KCDTIdWAPAccessPointRecord); //Open WAP AccessPoint table |
|
413 TRAP(err,wapRecordSet.LoadL(*iDBSession)); |
|
414 if(err == KErrNone) |
|
415 { |
|
416 WAPEntries = wapRecordSet.iRecords.Count(); |
|
417 if(WAPEntries > 0) |
|
418 { |
|
419 TRAPD(err, wapRecordSet.DeleteL(*iDBSession)); |
|
420 } |
|
421 WAPEntries = wapRecordSet.iRecords.Count(); |
|
422 } |
|
423 |
|
424 CMDBRecordSet<CCDWAPIPBearerRecord> wapIpBearerRecordSet(KCDTIdWAPIPBearerRecord); //Open WAP IP Bearer table |
|
425 TRAP(err,wapIpBearerRecordSet.LoadL(*iDBSession)); |
|
426 if(err == KErrNone) |
|
427 { |
|
428 WAPIpEntries = wapIpBearerRecordSet.iRecords.Count(); |
|
429 if(WAPIpEntries > 0) |
|
430 { |
|
431 TRAPD(err, wapIpBearerRecordSet.DeleteL(*iDBSession)); |
|
432 } |
|
433 WAPIpEntries = wapIpBearerRecordSet.iRecords.Count(); |
|
434 } |
|
435 |
|
436 CMDBRecordSet<CCDWAPSMSBearerRecord> wapSmsBearerRecordSet(KCDTIdWAPSMSBearerRecord); //Open WAP SMS Bearer table |
|
437 TRAP(err,wapSmsBearerRecordSet.LoadL(*iDBSession)); |
|
438 if(err == KErrNone) |
|
439 { |
|
440 WAPSmsEntries = wapSmsBearerRecordSet.iRecords.Count(); |
|
441 if(WAPSmsEntries > 0) |
|
442 { |
|
443 TRAPD(err, wapSmsBearerRecordSet.DeleteL(*iDBSession)); |
|
444 } |
|
445 WAPSmsEntries = wapSmsBearerRecordSet.iRecords.Count(); |
|
446 } |
|
447 |
|
448 CMDBRecordSet<CCDIAPRecord> iapRecordSet(KCDTIdIAPRecord); //Open Dial Out IAP table |
|
449 TRAP(err,iapRecordSet.LoadL(*iDBSession)); |
|
450 if(err == KErrNone) |
|
451 { |
|
452 IAPOutEntries = iapRecordSet.iRecords.Count(); |
|
453 if(IAPOutEntries > 0) |
|
454 { |
|
455 TRAPD(err, iapRecordSet.DeleteL(*iDBSession)); |
|
456 } |
|
457 IAPOutEntries = iapRecordSet.iRecords.Count(); |
|
458 } |
|
459 |
|
460 CMDBRecordSet<CCDDialOutISPRecord> dialOutIspRecordSet(KCDTIdDialOutISPRecord); //Open Dial Out ISP table |
|
461 TRAP(err,dialOutIspRecordSet.LoadL(*iDBSession)); |
|
462 if(err == KErrNone) |
|
463 { |
|
464 ISPOutEntries = dialOutIspRecordSet.iRecords.Count(); |
|
465 if(ISPOutEntries > 0) |
|
466 { |
|
467 TRAPD(err, dialOutIspRecordSet.DeleteL(*iDBSession)); |
|
468 } |
|
469 ISPOutEntries = dialOutIspRecordSet.iRecords.Count(); |
|
470 } |
|
471 |
|
472 //CMDBRecordSet<CCDWCDMAPacketServiceRecord> gprsRecordSet; //Open Gprs table |
|
473 CMDBRecordSet<CCDOutgoingGprsRecord> gprsRecordSet(KCDTIdOutgoingGprsRecord); |
|
474 TRAP(err,gprsRecordSet.LoadL(*iDBSession)); |
|
475 if(err == KErrNone) |
|
476 { |
|
477 GPRSEntries = gprsRecordSet.iRecords.Count(); |
|
478 if(GPRSEntries > 0) |
|
479 { |
|
480 TRAPD(err, gprsRecordSet.DeleteL(*iDBSession)); |
|
481 } |
|
482 GPRSEntries = gprsRecordSet.iRecords.Count(); |
|
483 } |
|
484 |
|
485 if (iTestMode == ETWappVerbose) |
|
486 { |
|
487 OutputFormattedTextL(_L("COMMDAT entries deleted:")); |
|
488 OutputTextListL(_L("WAP Table "), WAPEntries); |
|
489 OutputTextListL(_L("WAP IP Bearer"), WAPIpEntries); |
|
490 OutputTextListL(_L("WAP SMS Bearer "), WAPSmsEntries); |
|
491 OutputTextListL(_L("Dial Out IAP "), IAPOutEntries); |
|
492 OutputTextListL(_L("Dial Out ISP"), ISPOutEntries); |
|
493 OutputTextListL(_L("Outgoing GPRS"), GPRSEntries); |
|
494 } |
|
495 |
|
496 delete iDBSession; |
|
497 iDBSession = NULL; |
|
498 } |
|
499 |
|
500 |
|
501 void CTestWapp::CreateParserL() |
|
502 { |
|
503 // Point our iEntry to the relevant message entry and create the parser using this Id |
|
504 test.Printf(_L("\nCreating a WAPP parser...\n")); |
|
505 iEntryId = (*iMsvSelection)[iTestCounter]; |
|
506 if (iWappParser) |
|
507 { |
|
508 delete iWappParser; |
|
509 iWappParser = NULL; |
|
510 } |
|
511 |
|
512 #if defined (__HEAPFAILURE__) |
|
513 |
|
514 TInt error = KErrNone; |
|
515 TBool finished = EFalse; |
|
516 TInt failCount = 0; |
|
517 |
|
518 while(!finished) |
|
519 { |
|
520 __UHEAP_FAILNEXT(failCount++); |
|
521 // |
|
522 TRAP(error,iWappParser = iBioTestUtils->CreateParserL(iEntryId) ); |
|
523 if (error == KErrNone) |
|
524 { |
|
525 __UHEAP_RESET; |
|
526 finished = ETrue; |
|
527 __UHEAP_RESET; |
|
528 } |
|
529 // Handle error |
|
530 else |
|
531 { |
|
532 // Check if error is out of memory or a specific parser error |
|
533 test(error == KErrNoMemory); |
|
534 __UHEAP_RESET; |
|
535 } |
|
536 } |
|
537 #else |
|
538 iWappParser = iBioTestUtils->CreateParserL(iEntryId); |
|
539 #endif |
|
540 |
|
541 __ASSERT_ALWAYS(iWappParser!=NULL, User::Panic(_L("WAPPTSRC"), KWappNullPtr)); |
|
542 if (iWappParser) |
|
543 { |
|
544 if (iTestMode==ETWappVerbose) |
|
545 iBioTestUtils->WriteComment(_L("Created a WAP Access Point parser.")); |
|
546 } |
|
547 else |
|
548 { |
|
549 if (iTestMode==ETWappVerbose) |
|
550 iBioTestUtils->WriteComment(_L("Failed to create a WAP Access Point Parser - error.")); |
|
551 User::Leave(KWappErrNullValue); |
|
552 } |
|
553 } |
|
554 // end CTestWapp::CreateParserL() |
|
555 |
|
556 |
|
557 // |
|
558 // ExtractBodyPartsL() Create a rich text object containing the contents of the |
|
559 // store. Copies the contents of this into class member descriptor. |
|
560 // |
|
561 void CTestWapp::ExtractBodyPartsL() |
|
562 { |
|
563 if (iMessageBody) |
|
564 delete iMessageBody; |
|
565 iMessageBody = NULL; |
|
566 iMessageBody = HBufC::NewL(2048); |
|
567 |
|
568 iMessageBody->Des().Copy(iBioTestUtils->MessageBodyL( (*iMsvSelection) [iTestCounter]) ); |
|
569 } |
|
570 // End of CTestWapp::ExtractBodyPartsL |
|
571 |
|
572 |
|
573 // |
|
574 // ProcessUnparsedMessageL() - Calls ProcessL for an unparsed message - should leave |
|
575 // with error code -608 |
|
576 // |
|
577 void CTestWapp::ProcessUnparsedMessageL() |
|
578 { |
|
579 // NB Expect parser to fail with KWappErrMsgUnparsed (-609) from the |
|
580 // ProcessL call because the message is unparsed!! |
|
581 |
|
582 TInt error = KErrNone; |
|
583 |
|
584 #if defined (__HEAPFAILURE__) |
|
585 |
|
586 TBool finished = EFalse; |
|
587 TInt failCount = 0; |
|
588 |
|
589 while(!finished) |
|
590 { |
|
591 __UHEAP_FAILNEXT(failCount++); |
|
592 // |
|
593 TRAP(error,iWappParser->ProcessL(iStatus)); |
|
594 if ( error ==KErrNone || error == KWappErrMsgUnparsed) |
|
595 { |
|
596 __UHEAP_RESET; |
|
597 finished = ETrue; |
|
598 } |
|
599 // Handle error |
|
600 else |
|
601 { |
|
602 // Check if error is out of memory or a specific fax rendering error |
|
603 test(error == KErrNoMemory); |
|
604 __UHEAP_RESET; |
|
605 } |
|
606 } |
|
607 #else |
|
608 TRAP(error,iWappParser->ProcessL(iStatus)); |
|
609 #endif |
|
610 |
|
611 |
|
612 if (iTestMode ==ETWappVerbose) |
|
613 { |
|
614 if (error == KWappErrMsgUnparsed) |
|
615 OutputFormattedTextL(_L("ProcessL on unparsed message gave KWappErrMsgUnparsed (%d) - OK! "),error); |
|
616 else |
|
617 OutputFormattedTextL(_L("ProcessL call returned errror %d "),error); |
|
618 } |
|
619 if (error!=KErrNone && error != KWappErrMsgUnparsed) |
|
620 RequestComplete(iStatus,error); |
|
621 else if (error == KWappErrMsgUnparsed) |
|
622 RequestComplete(iStatus,KErrNone); |
|
623 } |
|
624 // End of CTestWapp::ProcessUnparsedMessageL |
|
625 |
|
626 // |
|
627 // ParseMessageTextL() - Calls ParseL passing contents of message to function. |
|
628 // |
|
629 void CTestWapp::ParseMessageL() |
|
630 { |
|
631 TInt error = KErrNone; |
|
632 |
|
633 #if defined (__HEAPFAILURE__) |
|
634 |
|
635 TBool finished = EFalse; |
|
636 TInt failCount = 0; |
|
637 |
|
638 while(!finished) |
|
639 { |
|
640 __UHEAP_FAILNEXT(failCount++); |
|
641 // |
|
642 TRAP(error,iWappParser->ParseL(iStatus,iMessageBody->Des())); |
|
643 if (error == KErrNone) |
|
644 { |
|
645 __UHEAP_RESET; |
|
646 finished = ETrue; |
|
647 } |
|
648 // Handle error |
|
649 else |
|
650 { |
|
651 // Check if error is out of memory or a specific fax rendering error |
|
652 test(error == KErrNoMemory); |
|
653 __UHEAP_RESET; |
|
654 } |
|
655 } |
|
656 |
|
657 #else |
|
658 TRAP(error,iWappParser->ParseL(iStatus,iMessageBody->Des())); //RunL handles error in status |
|
659 #endif |
|
660 |
|
661 if (iTestMode == ETWappDetailed || iTestMode== ETWappVerbose) |
|
662 OutputFormattedTextL(_L("ParseL returned error code %d"), error); |
|
663 if (error!=KErrNone) |
|
664 RequestComplete(iStatus,error); |
|
665 } |
|
666 // End of CTestWapp::ParseMessageTextL |
|
667 |
|
668 |
|
669 void CTestWapp::ProcessMessageL() |
|
670 { |
|
671 TInt error = KErrNone; |
|
672 |
|
673 #if defined (__HEAPFAILURE__) |
|
674 TBool finished = EFalse; |
|
675 TInt failCount = 0; |
|
676 |
|
677 |
|
678 while(!finished) |
|
679 { |
|
680 __UHEAP_FAILNEXT(failCount++); |
|
681 // |
|
682 TRAP(error,iWappParser->ProcessL(iStatus)); |
|
683 if (error == KErrNone || error == KWappErrUnexpectedValue || |
|
684 error == KWappErrUnrecognised||error == KWappErrBadMessage || |
|
685 error == KWappErrMandatoryTagMissing) |
|
686 { |
|
687 __UHEAP_RESET; |
|
688 finished = ETrue; |
|
689 } |
|
690 // Handle error |
|
691 else |
|
692 { |
|
693 // Check if error is out of memory or a specific fax rendering error |
|
694 test(error == KErrNoMemory); |
|
695 __UHEAP_RESET; |
|
696 } |
|
697 } |
|
698 #else |
|
699 TRAP(error, iWappParser->ProcessL(iStatus)); // RunL handles error later |
|
700 #endif |
|
701 |
|
702 if (iTestMode == ETWappDetailed || iTestMode== ETWappVerbose) |
|
703 OutputFormattedTextL(_L("ProcessL call returned error %d "),error); |
|
704 if (error!=KErrNone) |
|
705 RequestComplete(iStatus, error); |
|
706 } |
|
707 // End of CTestWapp::ProcessMessageL |
|
708 |
|
709 |
|
710 // |
|
711 // UnloadParser() - Unload the parser and the registered dll. |
|
712 // |
|
713 void CTestWapp::UnloadParser() |
|
714 { |
|
715 delete iWappParser; |
|
716 iWappParser = NULL; |
|
717 test.Printf(_L("Unloaded the parser.\n")); |
|
718 } |
|
719 // End of CTestWapp::UnloadParser |
|
720 |
|
721 |
|
722 void CTestWapp::RecordEntryDataL() |
|
723 { |
|
724 iBioTestUtils->LogCurrentMessageTypeL(iEntryId); |
|
725 LogParsedDataL(); // Display parsed data fields |
|
726 |
|
727 if (iTestMode == ETWappVerbose) |
|
728 { |
|
729 DisplayCommDatTablesL(); |
|
730 DisplayBookmarksL(); |
|
731 DisplayMMSURLL(); |
|
732 } |
|
733 } |
|
734 // End of CTestWapp::DisplayEntryDataL |
|
735 |
|
736 |
|
737 void CTestWapp::LogParsedDataL() |
|
738 // Restores parsed data from message store and logs it. |
|
739 { |
|
740 // Run this first to create Parsed Field array for SetEntryNameL - leaves if no stream store! |
|
741 TRAPD(error, iBioTestUtils->LogExtractedFieldsL(iEntryId)); |
|
742 |
|
743 if (error !=KErrNone) |
|
744 { |
|
745 if (error ==KErrNotFound) |
|
746 OutputFormattedTextL(_L("Entry has no Parsed Data - ParseL failed.")); |
|
747 else |
|
748 OutputFormattedTextL(_L("Error %d occurred accessing Entry StreamStore"), error); |
|
749 iParsedFieldsNum =0; // Flag that ParseL failed, so we don't try to go any further |
|
750 return; |
|
751 } |
|
752 |
|
753 SetEntryNameL(); // Find 1st Name characteristic ->Settings Name |
|
754 // NB LogExtractedFields must succeed for this to work! |
|
755 } |
|
756 // End of CTestWapp::DisplayStoreL |
|
757 |
|
758 |
|
759 |
|
760 // |
|
761 // SetEntryNameL() - Finds first name characteristic, default if not specified in |
|
762 // message. Copy the value to the settings name object |
|
763 // |
|
764 void CTestWapp::SetEntryNameL() |
|
765 { |
|
766 // Should never get here unless ParseL succeeded and there's parsed fields. |
|
767 TInt count =0; |
|
768 |
|
769 CArrayPtrSeg<CParsedField>& tempArrayHandle = iBioTestUtils->ParsedFieldArray(); |
|
770 |
|
771 iParsedFieldsNum = tempArrayHandle.Count(); |
|
772 |
|
773 if (iCurrentSettingsName != NULL) |
|
774 { |
|
775 delete iCurrentSettingsName; |
|
776 iCurrentSettingsName=NULL; |
|
777 } |
|
778 |
|
779 // Search for the first Characteristic NAME Tag |
|
780 while (count<tempArrayHandle.Count() && iCurrentSettingsName ==NULL) |
|
781 { |
|
782 if (tempArrayHandle.At(count)->FieldName().CompareF(KWappCharName)==0) |
|
783 { |
|
784 if (count +1 < tempArrayHandle.Count()) |
|
785 { |
|
786 // Next field name should also be NAME & value should be none NULL |
|
787 if ( (tempArrayHandle.At(count+1)->FieldName().CompareF(KWappName)==0) |
|
788 && (iCurrentSettingsName == NULL) |
|
789 && (count <=tempArrayHandle.Count()) ) |
|
790 { |
|
791 iCurrentSettingsName = HBufC::NewL(tempArrayHandle.At(count+1)->FieldValue().Length()); |
|
792 iCurrentSettingsName->Des().Copy(tempArrayHandle.At(count+1)->FieldValue()); |
|
793 } |
|
794 } |
|
795 } |
|
796 count++; |
|
797 } |
|
798 } |
|
799 |
|
800 void CTestWapp::DisplayCommDatTablesL() |
|
801 { |
|
802 TBuf<60> entryName; |
|
803 TInt retVal = 0; |
|
804 CMDBSession* iDBSession = CMDBSession::NewL(CMDBSession::LatestVersion()); |
|
805 |
|
806 test.Printf(_L("\n")); |
|
807 OutputFormattedTextL( _L("---------- COMM Dat Entries for Message % d ----------"), iTestCounter+1); |
|
808 |
|
809 if (!(iParsedFieldsNum >0) || iCurrentSettingsName == NULL) |
|
810 { |
|
811 test.Printf(_L("\n")); |
|
812 OutputFormattedTextL(_L("COMM DB Entries not found") ); |
|
813 test.Printf(_L("\n")); |
|
814 return; // failed to restore data - therefore failed to get Settings name |
|
815 } |
|
816 |
|
817 entryName.Copy(*iCurrentSettingsName); // Name of the current entry |
|
818 |
|
819 CMDBRecordSetBase* genericRecord = GetGenericPointerL(KCDTIdWAPAccessPointRecord); |
|
820 CleanupStack::PushL(genericRecord); |
|
821 |
|
822 CCDWAPAccessPointRecord *wapAPRecord = static_cast<CCDWAPAccessPointRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord)); |
|
823 wapAPRecord->iRecordName.SetMaxLengthL(entryName.Length()); |
|
824 wapAPRecord->iRecordName = entryName; |
|
825 genericRecord->iRecords.Append(wapAPRecord); |
|
826 |
|
827 TBool searchResult = genericRecord->FindL(*iDBSession); |
|
828 |
|
829 test.Printf(_L("\n")); |
|
830 OutputFormattedTextL(_L("********** WAP AP Table Entry **********")); |
|
831 |
|
832 if(!searchResult) |
|
833 { |
|
834 OutputFormattedTextL(_L("CommDat Table for WAP AP returned error %d "), KErrNotFound); |
|
835 return; |
|
836 } |
|
837 else |
|
838 { |
|
839 retVal = DisplayCommDatWapApTableL(*genericRecord); |
|
840 } |
|
841 |
|
842 if (retVal != KErrNone) |
|
843 { |
|
844 return; // possibly multiple WAP entries of the same name!! |
|
845 } |
|
846 CleanupStack::PopAndDestroy( genericRecord); |
|
847 |
|
848 genericRecord = GetGenericPointerL(KCDTIdWAPSMSBearerRecord); |
|
849 CleanupStack::PushL(genericRecord); |
|
850 |
|
851 CCDWAPSMSBearerRecord *smsBearerRecord = static_cast<CCDWAPSMSBearerRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdWAPSMSBearerRecord)); |
|
852 |
|
853 smsBearerRecord->iWAPAccessPointId = iWapAccessPointID; |
|
854 genericRecord->iRecords.Append(smsBearerRecord); |
|
855 searchResult = genericRecord->FindL(*iDBSession); |
|
856 |
|
857 test.Printf(_L("\n")); |
|
858 OutputFormattedTextL(_L("********** WAP Sms Table Entry **********")); |
|
859 |
|
860 if(!searchResult) |
|
861 { |
|
862 OutputFormattedTextL(_L("CommDat Table for WAP SMS Entry returned error %d "), KErrNotFound); |
|
863 //return; |
|
864 } |
|
865 else |
|
866 { |
|
867 retVal = DisplayCommDatWapSmsTableL(*genericRecord); |
|
868 } |
|
869 |
|
870 if (retVal != KErrNone) |
|
871 { |
|
872 //return; // possibly multiple entries of the same name!! |
|
873 } |
|
874 CleanupStack::PopAndDestroy(genericRecord); |
|
875 |
|
876 // Append the "GsmCsd" suffix to the Entry Name |
|
877 entryName.Append(KGsmCsdSuffix); |
|
878 |
|
879 // display the other tables, Dial Out ISP first |
|
880 genericRecord = GetGenericPointerL(KCDTIdDialOutISPRecord); |
|
881 CleanupStack::PushL(genericRecord); |
|
882 |
|
883 CCDDialOutISPRecord *dialoutISPPRecord = static_cast<CCDDialOutISPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdDialOutISPRecord)); |
|
884 dialoutISPPRecord->iRecordName.SetMaxLengthL(entryName.Length()); |
|
885 dialoutISPPRecord->iRecordName = entryName; |
|
886 genericRecord->iRecords.Append(dialoutISPPRecord); |
|
887 |
|
888 searchResult = genericRecord->FindL(*iDBSession); |
|
889 TInt pp= ((CCDDialOutISPRecord*)(genericRecord->iRecords[0]))->iRecordTag.RecordId(); |
|
890 |
|
891 test.Printf(_L("\n")); |
|
892 OutputFormattedTextL(_L("********** Dial Out ISP Entries **********")); |
|
893 |
|
894 if(!searchResult) |
|
895 { |
|
896 OutputFormattedTextL(_L("CommDat Table for DialOut ISP returned error %d "), KErrNotFound); |
|
897 return; |
|
898 } |
|
899 else |
|
900 { |
|
901 retVal = DisplayCommDatDialOutISPTableL(*genericRecord, entryName); |
|
902 } |
|
903 |
|
904 if (retVal != KErrNone) |
|
905 { |
|
906 return; // possibly multiple WAP entries of the same name!! |
|
907 } |
|
908 CleanupStack::PopAndDestroy( genericRecord); |
|
909 |
|
910 genericRecord = GetGenericPointerL(KCDTIdIAPRecord); |
|
911 CleanupStack::PushL(genericRecord); |
|
912 |
|
913 CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord)); |
|
914 iapRecord->iRecordName.SetMaxLengthL(entryName.Length()); |
|
915 iapRecord->iRecordName = entryName; |
|
916 genericRecord->iRecords.Append(iapRecord); |
|
917 |
|
918 searchResult = genericRecord->FindL(*iDBSession); |
|
919 |
|
920 test.Printf(_L("\n")); |
|
921 OutputFormattedTextL( _L("********** IAP Entries **********")); |
|
922 |
|
923 if(!searchResult) |
|
924 { |
|
925 OutputFormattedTextL(_L("CommDat Table for IAP returned error %d "), KErrNotFound); |
|
926 return; |
|
927 } |
|
928 else |
|
929 { |
|
930 retVal = DisplayCommDatIAPTableL(*genericRecord, entryName, ETestWappGsmCsdBearer); |
|
931 } |
|
932 |
|
933 if (retVal != KErrNone) |
|
934 { |
|
935 return; // possibly multiple WAP entries of the same name!! |
|
936 } |
|
937 CleanupStack::PopAndDestroy( genericRecord); |
|
938 |
|
939 genericRecord=GetGenericPointerL(KCDTIdWAPIPBearerRecord); |
|
940 CleanupStack::PushL(genericRecord); |
|
941 |
|
942 CCDWAPIPBearerRecord *ipBearerRecord = static_cast<CCDWAPIPBearerRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdWAPIPBearerRecord)); |
|
943 ipBearerRecord->iWAPAccessPointId = iWapAccessPointID; |
|
944 genericRecord->iRecords.Append(ipBearerRecord); |
|
945 |
|
946 searchResult = genericRecord->FindL(*iDBSession); |
|
947 |
|
948 test.Printf(_L("\n")); |
|
949 OutputFormattedTextL( _L("********** WAP IP Table Entry **********")); |
|
950 |
|
951 if(!searchResult) |
|
952 { |
|
953 OutputFormattedTextL(_L("CommDat Table for WAP IP returned error %d "), KErrNotFound); |
|
954 //return; |
|
955 } |
|
956 else |
|
957 { |
|
958 retVal = DisplayCommDatWapIpTableL(*genericRecord, entryName, iGsmCsdIapId); |
|
959 } |
|
960 |
|
961 if (retVal != KErrNone) |
|
962 { |
|
963 //return; // possibly multiple WAP entries of the same name!! |
|
964 } |
|
965 CleanupStack::PopAndDestroy( genericRecord); |
|
966 |
|
967 // Append the "Gprs" suffix to the Entry Name |
|
968 entryName.Copy(*iCurrentSettingsName); |
|
969 entryName.Append(KGprsSuffix); |
|
970 |
|
971 // Display Grps tables Outgoing WCDMA first, IAP, then WAP IP Bearer entry |
|
972 genericRecord = GetGenericPointerL(KCDTIdOutgoingGprsRecord); |
|
973 CleanupStack::PushL(genericRecord); |
|
974 |
|
975 CCDOutgoingGprsRecord *gprsRecord = static_cast<CCDOutgoingGprsRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdOutgoingGprsRecord)); |
|
976 gprsRecord->iRecordName.SetMaxLengthL(entryName.Length()); |
|
977 gprsRecord->iRecordName = entryName; |
|
978 |
|
979 genericRecord->iRecords.Append(gprsRecord); |
|
980 searchResult = genericRecord->FindL(*iDBSession); |
|
981 |
|
982 test.Printf(_L("\n")); |
|
983 OutputFormattedTextL( _L("********** GPRS Entry **********")); |
|
984 |
|
985 if(!searchResult) |
|
986 { |
|
987 OutputFormattedTextL(_L("CommDat Table for GPRS returned error %d "), KErrNotFound); |
|
988 //return; |
|
989 } |
|
990 else |
|
991 { |
|
992 retVal = DisplayCommDatGprsTableL(*genericRecord, entryName); |
|
993 } |
|
994 |
|
995 if (retVal != KErrNone) |
|
996 { |
|
997 //return; // possibly multiple WAP entries of the same name!! |
|
998 } |
|
999 CleanupStack::PopAndDestroy( genericRecord); |
|
1000 |
|
1001 |
|
1002 genericRecord=GetGenericPointerL(KCDTIdIAPRecord); |
|
1003 CleanupStack::PushL(genericRecord); |
|
1004 |
|
1005 iapRecord = static_cast<CCDIAPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord)); |
|
1006 iapRecord->iRecordName.SetMaxLengthL(entryName.Length()); |
|
1007 iapRecord->iRecordName = entryName; |
|
1008 genericRecord->iRecords.Append(iapRecord); |
|
1009 |
|
1010 searchResult = genericRecord->FindL(*iDBSession); |
|
1011 |
|
1012 test.Printf(_L("\n")); |
|
1013 OutputFormattedTextL( _L("********** IAP Entry **********")); |
|
1014 |
|
1015 if(!searchResult) |
|
1016 { |
|
1017 OutputFormattedTextL(_L("CommDat Table for IAP returned error %d "), KErrNotFound); |
|
1018 //return; |
|
1019 } |
|
1020 else |
|
1021 { |
|
1022 // This fn also sets iGprsIapId value - only way to determine the correct entry in WAP IP table |
|
1023 retVal = DisplayCommDatIAPTableL(*genericRecord, entryName, ETestWappGprsBearer); |
|
1024 } |
|
1025 |
|
1026 if (retVal != KErrNone) |
|
1027 { |
|
1028 //return; // possibly multiple WAP entries of the same name!! |
|
1029 } |
|
1030 CleanupStack::PopAndDestroy( genericRecord); |
|
1031 |
|
1032 genericRecord=GetGenericPointerL(KCDTIdWAPIPBearerRecord); |
|
1033 CleanupStack::PushL(genericRecord); |
|
1034 ipBearerRecord = static_cast<CCDWAPIPBearerRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdWAPIPBearerRecord)); |
|
1035 |
|
1036 ipBearerRecord->iWAPAccessPointId = iWapAccessPointID; |
|
1037 genericRecord->iRecords.Append(ipBearerRecord); |
|
1038 searchResult = genericRecord->FindL(*iDBSession); |
|
1039 |
|
1040 test.Printf(_L("\n")); |
|
1041 OutputFormattedTextL( _L("********** WAP IP Table Entry **********")); |
|
1042 |
|
1043 if(!searchResult) |
|
1044 { |
|
1045 OutputFormattedTextL(_L("CommDat Table for WAP IP returned error %d "), KErrNotFound); |
|
1046 // return; |
|
1047 } |
|
1048 else |
|
1049 { |
|
1050 retVal = DisplayCommDatWapIpTableL(*genericRecord, entryName, iGprsIapId); |
|
1051 } |
|
1052 |
|
1053 if (retVal != KErrNone) |
|
1054 { |
|
1055 // return; // possibly multiple entries of the same name!! |
|
1056 } |
|
1057 CleanupStack::PopAndDestroy( genericRecord); |
|
1058 |
|
1059 OutputFormattedTextL( _L("------------------------------------------------------------")); |
|
1060 |
|
1061 delete iDBSession; |
|
1062 iDBSession = NULL; |
|
1063 } |
|
1064 |
|
1065 TInt CTestWapp::DisplayCommDatGprsTableL(CMDBRecordSetBase& aGenericRecBase, TDesC& aEntryName) |
|
1066 { |
|
1067 TInt recCount = aGenericRecBase.iRecords.Count(); |
|
1068 |
|
1069 if ( recCount == 0 ) |
|
1070 { |
|
1071 OutputFormattedTextL(_L("Entry %S not found in IAP Table !"), &aEntryName); |
|
1072 return KErrNotFound; |
|
1073 } |
|
1074 else if (recCount > 1) |
|
1075 { |
|
1076 OutputFormattedTextL(_L("ERROR - entry %S not a unique entry in IAP table !\n"), &aEntryName); |
|
1077 return KErrNotFound; |
|
1078 } |
|
1079 // One unique Iap Table record ! Display a title then details |
|
1080 CCDOutgoingGprsRecord* record= (CCDOutgoingGprsRecord*) aGenericRecBase.iRecords[0]; |
|
1081 |
|
1082 OutputTextListL(_L("GPRS_APN"), record->iGPRSAPN); |
|
1083 |
|
1084 if(record->iGPRSPDPType == RPacketContext::EPdpTypeIPv4) |
|
1085 { |
|
1086 OutputTextListL(_L("GPRS_PDP_TYPE "), _L("EPdpTypeIPv4")); |
|
1087 } |
|
1088 else if(record->iGPRSPDPType == RPacketContext::EPdpTypeIPv6) |
|
1089 { |
|
1090 OutputTextListL(_L("GPRS_PDP_TYPE "), _L("EPdpTypeIPv6")); |
|
1091 } |
|
1092 else if(record->iGPRSPDPType == RPacketContext::EPdpTypeX25) |
|
1093 { |
|
1094 OutputTextListL(_L("GPRS_PDP_TYPE "), _L("EPdpTypeX25")); |
|
1095 } |
|
1096 |
|
1097 OutputTextListL(_L("GPRS_PDP_ADDRESS"), record->iGPRSPDPAddress); |
|
1098 |
|
1099 OutputTextListL(_L("GPRS_IF_PROMPT_FOR_AUTH"), record->iGPRSIfPromptForAuth); |
|
1100 |
|
1101 OutputTextListL(_L("GPRS_IF_AUTH_NAME"), record->iGPRSIfAuthName); |
|
1102 |
|
1103 OutputTextListL(_L("GPRS_IF_AUTH_PASS"), record->iGPRSIfAuthPass); |
|
1104 |
|
1105 OutputTextListL(_L("GPRS_IP_GATEWAY"), record->iGPRSIPGateway); |
|
1106 |
|
1107 OutputTextListL(_L("GPRS_IP_DNS_ADDR_FROM_SERVER"), record->iGPRSIPDNSAddrFromServer); |
|
1108 |
|
1109 OutputTextListL(_L("GPRS_DISABLE_PLAIN_TEXT_AUTH"), record->iGPRSDisablePlainTextAuth); |
|
1110 |
|
1111 return KErrNone; |
|
1112 } |
|
1113 TInt CTestWapp::DisplayCommDatWapIpTableL(CMDBRecordSetBase& aGenericRecBase, TDesC& aEntryName, TUint32 aIapId) |
|
1114 { |
|
1115 TInt recCount = aGenericRecBase.iRecords.Count(); |
|
1116 |
|
1117 if ( recCount == 0 ) |
|
1118 { |
|
1119 OutputFormattedTextL(_L("Entry \"%S\" not found in WAP IP Table !"),&aEntryName); |
|
1120 return KErrNotFound; |
|
1121 } |
|
1122 else if (recCount > 1) |
|
1123 { |
|
1124 OutputFormattedTextL(_L("Error - entry \"%S\" not a unique entry in WAP IP table !"), &aEntryName); |
|
1125 return KErrNotFound; |
|
1126 } |
|
1127 // One unique Wap Table record ! Record title and contents |
|
1128 CCDWAPIPBearerRecord* record= (CCDWAPIPBearerRecord*) aGenericRecBase.iRecords[0]; |
|
1129 |
|
1130 if (record->iWAPIAP != aIapId) |
|
1131 { |
|
1132 OutputFormattedTextL(_L("Entry \"%S\" not found in WAP IP Table !"),&aEntryName); |
|
1133 return KErrNotFound; |
|
1134 } |
|
1135 |
|
1136 OutputTextListL(_L("WAP IP Table ID (COMMDB_ID)"), record->iRecordTag.RecordId()); |
|
1137 |
|
1138 OutputTextListL(_L("WAP_ACCESS_POINT_ID"), record->iWAPAccessPointId); |
|
1139 |
|
1140 OutputTextListL(_L("WAP_GATEWAY_ADDRESS"), record->iWAPGatewayAddress); |
|
1141 |
|
1142 OutputTextListL(_L("WAP_IAP"), iCurrentIapID); |
|
1143 |
|
1144 // The days of this field are also numbered - will be removed from CommDb before long |
|
1145 |
|
1146 if(record->iWAPWSPOption == EWapWspOptionConnectionless) |
|
1147 { |
|
1148 OutputTextListL(_L("WAP_WSP_OPTION"), _L("Non-continuous connection type ")); |
|
1149 } |
|
1150 else if(record->iWAPWSPOption == EWapWspOptionConnectionOriented) |
|
1151 { |
|
1152 OutputTextListL(_L("WAP_WSP_OPTION"), _L("Continuous connection type ")); |
|
1153 } |
|
1154 else |
|
1155 { |
|
1156 OutputTextListL(_L("WAP_WSP_OPTION"), _L("Unknown connection type ")); |
|
1157 } |
|
1158 |
|
1159 if (record->iWAPSecurity) |
|
1160 OutputTextListL(_L("WAP_SECURITY"), _L("WSP Security enabled ")); |
|
1161 else |
|
1162 OutputTextListL(_L("WAP_SECURITY"), _L("WSP security disabled ")); |
|
1163 |
|
1164 OutputTextListL(_L("WAP_PROXY_PORT"), record->iWAPProxyPort); |
|
1165 |
|
1166 OutputTextListL(_L("WAP_PROXY_LOGIN_NAME"), record->iWAPProxyLoginName); |
|
1167 |
|
1168 OutputTextListL(_L("WAP_PROXY_LOGIN_PASS"), record->iWAPProxyLoginPass); |
|
1169 |
|
1170 User::After(1000); |
|
1171 return KErrNone; // return good status value so that calling function continues executing |
|
1172 } |
|
1173 |
|
1174 TInt CTestWapp::DisplayCommDatIAPTableL(CMDBRecordSetBase& aGenericRecBase, TDesC& aEntryName, TTestWappBearerType aBearerType) |
|
1175 { |
|
1176 TInt recCount = aGenericRecBase.iRecords.Count(); |
|
1177 |
|
1178 if ( recCount == 0 ) |
|
1179 { |
|
1180 OutputFormattedTextL(_L("Entry %S not found in IAP Table !"), &aEntryName); |
|
1181 return KErrNotFound; |
|
1182 } |
|
1183 else if (recCount > 1) |
|
1184 { |
|
1185 OutputFormattedTextL(_L("ERROR - entry %S not a unique entry in IAP table !\n"), &aEntryName); |
|
1186 return KErrNotFound; |
|
1187 } |
|
1188 // One unique Iap Table record ! Display a title then details |
|
1189 CCDIAPRecord* record= (CCDIAPRecord*) aGenericRecBase.iRecords[0]; |
|
1190 |
|
1191 OutputTextListL(_L("Dial-Out IAP name(COMMDB_NAME)"), record->iRecordName); |
|
1192 |
|
1193 OutputTextListL(_L("Dial Out IAP ID (iRecordId)"), record->iRecordTag.RecordId()); |
|
1194 |
|
1195 switch (aBearerType) |
|
1196 { |
|
1197 case ETestWappGsmCsdBearer: |
|
1198 iGsmCsdIapId = record->iRecordTag.RecordId(); |
|
1199 break; |
|
1200 case ETestWappGprsBearer: |
|
1201 iGprsIapId = record->iRecordTag.RecordId(); |
|
1202 break; |
|
1203 case ETestWappUnknownBearer: |
|
1204 case ETestWappGsmSmsBearer: |
|
1205 case ETestWappGsmUssdBearer: |
|
1206 case ETestWappIS136CsdBearer: |
|
1207 default: |
|
1208 { |
|
1209 //Do nothing |
|
1210 } |
|
1211 break; |
|
1212 } |
|
1213 |
|
1214 OutputTextListL(_L("IAP_SERVICE"), record->iService); |
|
1215 |
|
1216 // Added reading ISP_TYPE |
|
1217 OutputTextListL(_L("IAP_SERVICE_TYPE"), record->iServiceType); |
|
1218 |
|
1219 User::After(1000); |
|
1220 return KErrNone; |
|
1221 } |
|
1222 |
|
1223 TInt CTestWapp::DisplayCommDatDialOutISPTableL(CMDBRecordSetBase& aGenericRecBase, TDesC& aEntryName) |
|
1224 { |
|
1225 TInt recCount = aGenericRecBase.iRecords.Count(); |
|
1226 |
|
1227 if ( recCount == 0 ) |
|
1228 { |
|
1229 OutputFormattedTextL(_L("Entry \"%S\" not found in ISP Table !"), &aEntryName); |
|
1230 return KErrNotFound; |
|
1231 } |
|
1232 else if (recCount > 1) |
|
1233 { |
|
1234 OutputFormattedTextL(_L("Error - entry %S not a unique entry in ISP table ! "), &aEntryName); |
|
1235 return KErrNotFound; |
|
1236 } |
|
1237 CCDDialOutISPRecord* record= (CCDDialOutISPRecord*) aGenericRecBase.iRecords[0]; |
|
1238 |
|
1239 OutputTextListL(_L("WAP Table Name(COMMDB_NAME)"), record->iRecordName); |
|
1240 |
|
1241 OutputTextListL(_L("WAP Table ID (iRecordId)"), record->iRecordTag.RecordId()); |
|
1242 |
|
1243 OutputTextListL(_L("ISP_DESCRIPTION"), record->iDescription); |
|
1244 |
|
1245 if(record->iType == EIspTypeInternetOnly) |
|
1246 { |
|
1247 OutputTextListL(_L("ISP_TYPE"), _L("Internet Only ISP")); |
|
1248 } |
|
1249 else if(record->iType == EIspTypeWAPOnly) |
|
1250 { |
|
1251 OutputTextListL(_L("ISP_TYPE"), _L("WAP Only ISP")); |
|
1252 } |
|
1253 else if(record->iType == EIspTypeInternetAndWAP) |
|
1254 { |
|
1255 OutputTextListL(_L("ISP_TYPE"), _L("Internet and WAP ISP")); |
|
1256 } |
|
1257 else |
|
1258 { |
|
1259 OutputTextListL(_L("ISP_TYPE"), _L("Type of ISP unknown")); |
|
1260 } |
|
1261 |
|
1262 OutputTextListL(_L("ISP_DEFAULT_TEL_NUM"), record->iDefaultTelNum); |
|
1263 |
|
1264 if (record->iDialResolution) |
|
1265 OutputTextListL(_L("ISP_DIAL_RESOLUTION"), _L("True - use Dial Resolution")); |
|
1266 else |
|
1267 OutputTextListL(_L("ISP_DIAL_RESOLUTION"), _L("False - don't use Dial Resolution")); |
|
1268 |
|
1269 if (record->iUseLoginScript) |
|
1270 OutputTextListL(_L("ISP_USE_LOGIN_SCRIPT"), _L("True - use login script")); |
|
1271 else |
|
1272 OutputTextListL(_L("ISP_USE_LOGIN_SCRIPT"), _L("False - don't use login script")); |
|
1273 |
|
1274 if (record->iUseLoginScript) |
|
1275 { |
|
1276 OutputTextListL(_L("ISP_LOGIN_SCRIPT"), record->iLoginScript); |
|
1277 } |
|
1278 |
|
1279 if (record->iPromptForLogin) |
|
1280 OutputTextListL(_L("ISP_PROMPT_FOR_LOGIN"), _L("True - prompt for username and password")); |
|
1281 else |
|
1282 OutputTextListL(_L("ISP_PROMPT_FOR_LOGIN"), _L("False - Do not prompt for username and password")); |
|
1283 |
|
1284 OutputTextListL(_L("ISP_LOGIN_NAME"), record->iLoginName); |
|
1285 |
|
1286 OutputTextListL(_L("ISP_LOGIN_PASS"), record->iLoginPass); |
|
1287 |
|
1288 if (record->iDisplayPct) |
|
1289 OutputTextListL(_L("ISP_DISPLAY_PCT"), _L("True - display PCT")); |
|
1290 else |
|
1291 OutputTextListL(_L("ISP_DISPLAY_PCT"), _L("False - don't display PCT")); |
|
1292 |
|
1293 OutputTextListL(_L("ISP_IF_PARAMS"), record->iIfParams); |
|
1294 |
|
1295 OutputTextListL(_L("ISP_IF_NETWORKS"), record->iIfNetworks); |
|
1296 |
|
1297 if (record->iIfPromptForAuth) |
|
1298 OutputTextListL(_L("ISP_IF_PROMPT_FOR_AUTH"), _L("True - prompt for authentication")); |
|
1299 else |
|
1300 OutputTextListL(_L("ISP_IF_PROMPT_FOR_AUTH"), _L("False - don't prompt for authentication")); |
|
1301 |
|
1302 OutputTextListL(_L("ISP_IF_AUTH_NAME"), record->iIfAuthName); |
|
1303 |
|
1304 OutputTextListL(_L("ISP_IF_AUTH_PASS"), record->iIfAuthPass); |
|
1305 |
|
1306 OutputTextListL(_L("ISP_IF_AUTH_RETRIES"), record->iIfAuthRetries); |
|
1307 |
|
1308 if (record->iIfCallbackEnabled) |
|
1309 OutputTextListL(_L("ISP_IF_CALLBACK_ENABLED"), _L("True - Callback enabled")); |
|
1310 else |
|
1311 OutputTextListL(_L("ISP_IF_CALLBACK_ENABLED"), _L("False - Callback disabled")); |
|
1312 |
|
1313 if (record->iIfCallbackEnabled) |
|
1314 { |
|
1315 // Following are only NOT NULL if callback is enabled |
|
1316 OutputTextListL(_L("ISP_IF_CALLBACK_TYPE"), record->iIfCallbackType); |
|
1317 TPtr16 tempPtr(0,0); |
|
1318 tempPtr.Copy(record->iIfCallbackInfo); |
|
1319 OutputTextListL(_L("ISP_IF_CALLBACK_INFO"), tempPtr); |
|
1320 |
|
1321 OutputTextListL(_L("ISP_IF_CALLBACK_TIMEOUT"), record->iCallbackTimeout); |
|
1322 } |
|
1323 else |
|
1324 { |
|
1325 // Callback isn't enabled so don't try to read these fields as they are NULL |
|
1326 OutputTextListL(_L("ISP_IF_CALLBACK_TYPE"), _L("Not defined")); |
|
1327 OutputTextListL(_L("ISP_IF_CALLBACK_INFO"), _L("Not defined")); |
|
1328 OutputTextListL(_L("ISP_IF_CALLBACK_TIMEOUT"), _L("Not defined")); |
|
1329 } |
|
1330 |
|
1331 if (record->iIpAddrFromServer) |
|
1332 OutputTextListL(_L("ISP_IP_ADDR_FROM_SERVER"), _L("True - get IP address from the server")); |
|
1333 else |
|
1334 OutputTextListL(_L("ISP_IP_ADDR_FROM_SERVER"), _L("False - know IP address")); |
|
1335 |
|
1336 OutputTextListL(_L("ISP_IP_ADDR"), record->iIpAddr); |
|
1337 |
|
1338 OutputTextListL(_L("ISP_IP_NETMASK"), record->iIpNetMask); |
|
1339 |
|
1340 OutputTextListL(_L("ISP_IP_GATEWAY"), record->iIpGateway); |
|
1341 |
|
1342 if (record->iIpDnsAddrFromServer) |
|
1343 OutputTextListL(_L("ISP_IP_DNS_ADDR_FROM_SERVER"), _L("True - Get DNS address from server")); |
|
1344 else |
|
1345 OutputTextListL(_L("ISP_IP_DNS_ADDR_FROM_SERVER"), _L("False - Don't get DNS address from server")); |
|
1346 |
|
1347 OutputTextListL(_L("ISP_IP_NAME_SERVER1"), record->iIpNameServer1); |
|
1348 |
|
1349 OutputTextListL(_L("ISP_IP_NAME_SERVER2"), record->iIpNameServer2); |
|
1350 |
|
1351 if (record->iEnableIpHeaderComp) |
|
1352 OutputTextListL(_L("ISP_ENABLE_IP_HEADER_COMP"), _L("True - Enable compression of IP header ")); |
|
1353 else |
|
1354 OutputTextListL(_L("ISP_ENABLE_IP_HEADER_COMP"), _L("False - Disable compression of IP header")); |
|
1355 |
|
1356 if (record->iDisablePlainTextAuth) |
|
1357 OutputTextListL(_L("ISP_DISABLE_PLAIN_TEXT_AUTH"), _L("True - Disable plain text authentication")); |
|
1358 else |
|
1359 OutputTextListL(_L("ISP_DISABLE_PLAIN_TEXT_AUTH"), _L("False - Enable plain text authentication")); |
|
1360 |
|
1361 if (record->iEnableSwComp) |
|
1362 OutputTextListL(_L("ISP_ENABLE_SW_COMP"), _L("True - Enable software compression")); |
|
1363 else |
|
1364 OutputTextListL(_L("ISP_ENABLE_SW_COMP"), _L("False - Disable software compression")); |
|
1365 |
|
1366 if(record->iBearerSpeed == RMobileCall::ESpeedAutobauding) |
|
1367 { |
|
1368 OutputTextListL(_L("ISP_BEARER_SPEED"), _L("Speed - Auto")); |
|
1369 } |
|
1370 else if(record->iBearerSpeed == RMobileCall::ESpeed9600) |
|
1371 { |
|
1372 OutputTextListL(_L("ISP_BEARER_SPEED"), _L("Speed - 9600 baud")); |
|
1373 } |
|
1374 else if(record->iBearerSpeed == RMobileCall::ESpeed14400) |
|
1375 { |
|
1376 OutputTextListL(_L("ISP_BEARER_SPEED"), _L("Speed - 14400 baud")); |
|
1377 } |
|
1378 else if(record->iBearerSpeed == RMobileCall::ESpeed19200) |
|
1379 { |
|
1380 OutputTextListL(_L("ISP_BEARER_SPEED"), _L("Speed - 19200 baud")); |
|
1381 } |
|
1382 else if(record->iBearerSpeed == RMobileCall::ESpeed28800) |
|
1383 { |
|
1384 OutputTextListL(_L("ISP_BEARER_SPEED"), _L("Speed - 28800 baud")); |
|
1385 } |
|
1386 else if(record->iBearerSpeed == RMobileCall::ESpeed38400) |
|
1387 { |
|
1388 OutputTextListL(_L("ISP_BEARER_SPEED"), _L("Speed - 38400 baud")); |
|
1389 } |
|
1390 else if(record->iBearerSpeed == RMobileCall::ESpeed48000) |
|
1391 { |
|
1392 OutputTextListL(_L("ISP_BEARER_SPEED"), _L("Speed - 48000 baud")); |
|
1393 } |
|
1394 else if(record->iBearerSpeed == RMobileCall::ESpeed56000) |
|
1395 { |
|
1396 OutputTextListL(_L("ISP_BEARER_SPEED"), _L("Speed - 56000 baud")); |
|
1397 } |
|
1398 else |
|
1399 { |
|
1400 OutputTextListL(_L("ISP_BEARER_SPEED"), _L("Speed - unknown!")); |
|
1401 } |
|
1402 |
|
1403 if( record->iBearerProtocol == RMobileCall::EProtocolUnspecified) |
|
1404 { |
|
1405 OutputTextListL(_L("ISP_BEARER_PROTOCOL"), _L("Protocol - unspecified")); |
|
1406 } |
|
1407 else if(record->iBearerProtocol == RMobileCall::EProtocolV22bis) |
|
1408 { |
|
1409 OutputTextListL(_L("ISP_BEARER_PROTOCOL"), _L("Protocol - V22bis")); |
|
1410 } |
|
1411 else if(record->iBearerProtocol == RMobileCall::EProtocolV32) |
|
1412 { |
|
1413 OutputTextListL(_L("ISP_BEARER_PROTOCOL"), _L("Protocol - V32")); |
|
1414 } |
|
1415 else if(record->iBearerProtocol == RMobileCall::EProtocolV34) |
|
1416 { |
|
1417 OutputTextListL(_L("ISP_BEARER_PROTOCOL"), _L("Protocol - V34")); |
|
1418 } |
|
1419 else if(record->iBearerProtocol == RMobileCall::EProtocolV110) |
|
1420 { |
|
1421 OutputTextListL(_L("ISP_BEARER_PROTOCOL"), _L("Protocol - V110")); |
|
1422 } |
|
1423 else if(record->iBearerProtocol == RMobileCall::EProtocolV120) |
|
1424 { |
|
1425 OutputTextListL(_L("ISP_BEARER_PROTOCOL"), _L("Protocol - V120")); |
|
1426 } |
|
1427 else if(record->iBearerProtocol == RMobileCall::EProtocolX31FlagStuffing) |
|
1428 { |
|
1429 OutputTextListL(_L("ISP_BEARER_PROTOCOL"), _L("Protocol - x31 Flag Stuffing")); |
|
1430 } |
|
1431 else if(record->iBearerProtocol == RMobileCall::EProtocolPIAFS) |
|
1432 { |
|
1433 OutputTextListL(_L("ISP_BEARER_PROTOCOL"), _L("Protocol - PIAFS")); |
|
1434 } |
|
1435 else if(record->iBearerProtocol == RMobileCall::EProtocolBitTransparent) |
|
1436 { |
|
1437 OutputTextListL(_L("ISP_BEARER_PROTOCOL"), _L("Protocol - Bit Transparent")); |
|
1438 } |
|
1439 else if(record->iBearerProtocol == RMobileCall::EProtocolPstnMultimediaVoiceFallback) |
|
1440 { |
|
1441 OutputTextListL(_L("ISP_BEARER_PROTOCOL"), _L("Protocol - Pstn Multimedia Voice Fallback")); |
|
1442 } |
|
1443 else if(record->iBearerProtocol == RMobileCall::EProtocolPstnMultimedia) |
|
1444 { |
|
1445 OutputTextListL(_L("ISP_BEARER_PROTOCOL"), _L("Protocol - Pstn Multimedia")); |
|
1446 } |
|
1447 else if(record->iBearerProtocol == RMobileCall::EProtocolIsdnMultimedia) |
|
1448 { |
|
1449 OutputTextListL(_L("ISP_BEARER_PROTOCOL"), _L("Protocol - Isdn Multimedia")); |
|
1450 } |
|
1451 else |
|
1452 { |
|
1453 OutputTextListL(_L("ISP_BEARER_PROTOCOL"), _L("Protocol - unspecified")); |
|
1454 } |
|
1455 |
|
1456 User::After(1000); |
|
1457 // Finished without error - return appropriate value |
|
1458 return KErrNone; |
|
1459 } |
|
1460 TInt CTestWapp::DisplayCommDatWapSmsTableL(CMDBRecordSetBase& aGenericRecBase) |
|
1461 { |
|
1462 TInt recCount = aGenericRecBase.iRecords.Count(); |
|
1463 |
|
1464 if ( recCount == 0 ) |
|
1465 { |
|
1466 OutputFormattedTextL(_L("Entry \"%S\" not found in WAP Sms Table !"),iCurrentSettingsName); |
|
1467 return KErrNotFound; |
|
1468 } |
|
1469 else if (recCount > 1) |
|
1470 { |
|
1471 OutputFormattedTextL(_L("Error - entry \"%S\" not a unique entry in WAP Sms table !"), iCurrentSettingsName); |
|
1472 return KErrNotFound; |
|
1473 } |
|
1474 // One unique Wap Table record ! Record title and contents |
|
1475 CCDWAPSMSBearerRecord* record= (CCDWAPSMSBearerRecord*) aGenericRecBase.iRecords[0]; |
|
1476 |
|
1477 OutputTextListL(_L("WAP SMS Table ID (COMMDB_ID)"), record->iRecordTag.RecordId()); |
|
1478 |
|
1479 OutputTextListL(_L("WAP_ACCESS_POINT_ID"), record->iWAPAccessPointId); |
|
1480 |
|
1481 OutputTextListL(_L("WAP_GATEWAY_ADDRESS"), record->iWAPGatewayAddress); |
|
1482 |
|
1483 OutputTextListL(_L("WAP_SERVICE_CENTRE_ADDRESS"), record->iWAPServiceCentreAddress); |
|
1484 |
|
1485 if(record->iWAPWSPOption == EWapWspOptionConnectionless) |
|
1486 OutputTextListL(_L("WAP_WSP_OPTION"), _L("Non-continuous connection type ")); |
|
1487 else if(record->iWAPWSPOption == EWapWspOptionConnectionOriented) |
|
1488 OutputTextListL(_L("WAP_WSP_OPTION"), _L("Continuous connection type ")); |
|
1489 else |
|
1490 OutputTextListL(_L("WAP_WSP_OPTION"), _L("Unknown connection type ")); |
|
1491 |
|
1492 if (record->iWAPSecurity) |
|
1493 OutputTextListL(_L("WAP_SECURITY"), _L("WSP Security enabled ")); |
|
1494 else |
|
1495 OutputTextListL(_L("WAP_SECURITY"), _L("WSP security disabled ")); |
|
1496 |
|
1497 User::After(1000); |
|
1498 return KErrNone; // return good status value so that calling function continues executing |
|
1499 } |
|
1500 |
|
1501 TInt CTestWapp::DisplayCommDatWapApTableL(CMDBRecordSetBase& aGenericRecBase) |
|
1502 { |
|
1503 TInt recCount = aGenericRecBase.iRecords.Count(); |
|
1504 |
|
1505 if ( recCount == 0 ) |
|
1506 { |
|
1507 OutputFormattedTextL(_L("Entry \"%S\" not found in WAP AP Table !"), iCurrentSettingsName); |
|
1508 return KErrNotFound; |
|
1509 } |
|
1510 else if (recCount > 1) |
|
1511 { |
|
1512 OutputFormattedTextL(_L("Error - entry %S not a unique entry in WAP AP table !"), iCurrentSettingsName); |
|
1513 return KErrNotFound; |
|
1514 } |
|
1515 //Only one record exists, read the field values |
|
1516 CCDWAPAccessPointRecord* record= (CCDWAPAccessPointRecord*) aGenericRecBase.iRecords[0]; |
|
1517 |
|
1518 // One unique Wap Table record ! Record title and contents |
|
1519 |
|
1520 OutputTextListL(_L("WAP Table Name(COMMDB_NAME)"), record->iRecordName); |
|
1521 |
|
1522 OutputTextListL(_L("WAP Table ID (iRecordId)"), record->iRecordTag.RecordId()); |
|
1523 |
|
1524 OutputTextListL(_L("WAP_START_PAGE"), record->iWAPStartPage); |
|
1525 |
|
1526 OutputTextListL(_L("WAP_CURRENT_BEARER"), record->iWAPCurrentBearer); |
|
1527 |
|
1528 User::After(1000); |
|
1529 |
|
1530 return KErrNone; // return good status value so that calling function continues executing |
|
1531 } |
|
1532 |
|
1533 CMDBRecordSetBase* CTestWapp::GetGenericPointerL(TMDBElementId aRecordElementId) |
|
1534 { |
|
1535 CMDBRecordSetBase* tablePtr; |
|
1536 switch(aRecordElementId) |
|
1537 { |
|
1538 case KCDTIdDialOutISPRecord: |
|
1539 { |
|
1540 CMDBRecordSet<CCDDialOutISPRecord>* dialoutIsp = new(ELeave) CMDBRecordSet<CCDDialOutISPRecord>(KCDTIdDialOutISPRecord); |
|
1541 tablePtr = static_cast<CMDBRecordSetBase*>(dialoutIsp); |
|
1542 } |
|
1543 break; |
|
1544 case KCDTIdIAPRecord: |
|
1545 { |
|
1546 CMDBRecordSet<CCDIAPRecord>* iapRecord = new(ELeave) CMDBRecordSet<CCDIAPRecord>(KCDTIdIAPRecord); |
|
1547 tablePtr = static_cast<CMDBRecordSetBase*>(iapRecord); |
|
1548 } |
|
1549 break; |
|
1550 case KCDTIdOutgoingGprsRecord: |
|
1551 { |
|
1552 CMDBRecordSet<CCDWCDMAPacketServiceRecord>* wcdmaRecord = new(ELeave) CMDBRecordSet<CCDWCDMAPacketServiceRecord>(KCDTIdWCDMAPacketServiceRecord); |
|
1553 tablePtr = static_cast<CMDBRecordSetBase*>(wcdmaRecord); |
|
1554 } |
|
1555 break; |
|
1556 case KCDTIdWAPAccessPointRecord: |
|
1557 { |
|
1558 CMDBRecordSet<CCDWAPAccessPointRecord>* wapAccessPtRecord = new(ELeave) CMDBRecordSet<CCDWAPAccessPointRecord>(KCDTIdWAPAccessPointRecord); |
|
1559 tablePtr = static_cast<CMDBRecordSetBase*>(wapAccessPtRecord); |
|
1560 } |
|
1561 break; |
|
1562 case KCDTIdWAPIPBearerRecord: |
|
1563 { |
|
1564 CMDBRecordSet<CCDWAPIPBearerRecord>* wapIpRecord = new(ELeave) CMDBRecordSet<CCDWAPIPBearerRecord>(KCDTIdWAPIPBearerRecord); |
|
1565 tablePtr = static_cast<CMDBRecordSetBase*>(wapIpRecord); |
|
1566 } |
|
1567 break; |
|
1568 case KCDTIdWAPSMSBearerRecord: |
|
1569 { |
|
1570 CMDBRecordSet<CCDWAPSMSBearerRecord>* smsBearerRecord = new(ELeave) CMDBRecordSet<CCDWAPSMSBearerRecord>(KCDTIdWAPSMSBearerRecord); |
|
1571 tablePtr = static_cast<CMDBRecordSetBase*>(smsBearerRecord); |
|
1572 } |
|
1573 break; |
|
1574 } |
|
1575 return tablePtr; |
|
1576 } |
|
1577 |
|
1578 |
|
1579 void CTestWapp::DisplayBookmarksL() |
|
1580 { |
|
1581 // Print out and log the attachment file containing the WAP Bookmarks |
|
1582 |
|
1583 HBufC* attachmentBuf =NULL; |
|
1584 |
|
1585 |
|
1586 TFileName fileName; |
|
1587 |
|
1588 fileName.Num(iEntryId,EHex); |
|
1589 |
|
1590 fileName.Append(KEBookmarkExtension); |
|
1591 |
|
1592 CMsvStore* store = iBioTestUtils->iMsvEntry->EditStoreL(); |
|
1593 CleanupStack::PushL(store); |
|
1594 MMsvAttachmentManager& manager = store->AttachmentManagerL(); |
|
1595 |
|
1596 // find the attachment |
|
1597 TBool found = EFalse; |
|
1598 RFile attachmentFile; |
|
1599 for( TInt ii=0; ii<manager.AttachmentCount(); ++ii ) |
|
1600 { |
|
1601 CMsvAttachment* attachment = manager.GetAttachmentInfoL(ii); |
|
1602 if( attachment->AttachmentName().CompareF(fileName) == 0 ) |
|
1603 { |
|
1604 // found a match, open the file and load |
|
1605 delete attachment; |
|
1606 attachmentFile = manager.GetAttachmentFileL(ii); |
|
1607 found = ETrue; |
|
1608 break; |
|
1609 } |
|
1610 delete attachment; |
|
1611 } |
|
1612 CleanupStack::PopAndDestroy(store); |
|
1613 |
|
1614 if(found) |
|
1615 { |
|
1616 // read the file data into a buffer |
|
1617 CleanupClosePushL(attachmentFile); |
|
1618 TInt fileSize; |
|
1619 User::LeaveIfError(attachmentFile.Size(fileSize)); |
|
1620 |
|
1621 HBufC8* fileReadBuffer = HBufC8::NewLC(fileSize); |
|
1622 TPtr8 bufferPtr = fileReadBuffer->Des(); |
|
1623 User::LeaveIfError(attachmentFile.Read(bufferPtr)); |
|
1624 |
|
1625 // convert to unicode |
|
1626 attachmentBuf = HBufC::NewL(fileReadBuffer->Length()); |
|
1627 attachmentBuf->Des().Copy(*fileReadBuffer); |
|
1628 CleanupStack::PopAndDestroy(2, &attachmentFile); // fileReadBuffer, attachmentFile |
|
1629 CleanupStack::PushL(attachmentBuf); |
|
1630 } |
|
1631 else |
|
1632 { |
|
1633 OutputFormattedTextL(_L("********** Bookmark Attachment File **********")); |
|
1634 OutputFormattedTextL(_L(" No bookmark file found.")); |
|
1635 return; |
|
1636 } |
|
1637 |
|
1638 |
|
1639 OutputFormattedTextL(_L("********** Bookmark Attachment File **********")); |
|
1640 |
|
1641 TInt numBookmarks =1; |
|
1642 TLex bookmarkLex = attachmentBuf->Des(); |
|
1643 TPtrC bookmarkPtr; |
|
1644 |
|
1645 |
|
1646 while (!bookmarkLex.Eos()) |
|
1647 { |
|
1648 bookmarkLex.Mark(); // Mark the start of this Bookmark |
|
1649 while (!bookmarkLex.Eos() && IsLineTermination(bookmarkLex.Peek())==EFalse ) // Find the end of the Name |
|
1650 bookmarkLex.Inc(); |
|
1651 |
|
1652 bookmarkPtr.Set(bookmarkLex.MarkedToken()); |
|
1653 |
|
1654 while (!bookmarkLex.Eos() && IsLineTermination(bookmarkLex.Peek())) |
|
1655 bookmarkLex.Inc(); // Increment past the linefeed |
|
1656 |
|
1657 if (bookmarkPtr.CompareF(KEBookmarkItemBegin)!=0) // check prefix for a bookmark |
|
1658 { |
|
1659 OutputFormattedTextL(_L("Bookmark %d %S Begin Tag Missing"), numBookmarks, &bookmarkPtr); |
|
1660 break; |
|
1661 } |
|
1662 |
|
1663 for (TInt count=0; count < KNumberOfBookmarkFields; count++) |
|
1664 { |
|
1665 bookmarkLex.Mark(); |
|
1666 while (!bookmarkLex.Eos() && IsLineTermination(bookmarkLex.Peek())==EFalse ) // Find the end of the field |
|
1667 bookmarkLex.Inc(); |
|
1668 bookmarkPtr.Set(bookmarkLex.MarkedToken()); |
|
1669 |
|
1670 while (!bookmarkLex.Eos() && IsLineTermination(bookmarkLex.Peek())) |
|
1671 bookmarkLex.Inc(); // increment past the linefeed |
|
1672 |
|
1673 OutputFormattedTextL(_L("Bookmark %d %S"), numBookmarks, &bookmarkPtr); |
|
1674 } |
|
1675 |
|
1676 bookmarkLex.Mark(); // Mark the start of the end tag |
|
1677 |
|
1678 while (!bookmarkLex.Eos() && IsLineTermination(bookmarkLex.Peek())==EFalse) // Find the end of the end tag |
|
1679 bookmarkLex.Inc(); |
|
1680 |
|
1681 bookmarkPtr.Set(bookmarkLex.MarkedToken()); |
|
1682 |
|
1683 while (!bookmarkLex.Eos() && IsLineTermination(bookmarkLex.Peek())) |
|
1684 bookmarkLex.Inc(); // increment past the linefeed |
|
1685 |
|
1686 if (bookmarkPtr.CompareF(KEBookmarkItemEnd) !=0) // check end tag for a bookmark |
|
1687 { |
|
1688 OutputFormattedTextL(_L("Bookmark %d %S End Tag Missing"), numBookmarks, &bookmarkPtr); |
|
1689 break; |
|
1690 } |
|
1691 |
|
1692 numBookmarks++; |
|
1693 } |
|
1694 |
|
1695 CleanupStack::PopAndDestroy(attachmentBuf); |
|
1696 } |
|
1697 |
|
1698 |
|
1699 void CTestWapp::DisplayTestSummaryL() |
|
1700 { |
|
1701 OutputFormattedTextL(_L("---------- Test Summary ----------")); |
|
1702 OutputFormattedTextL(_L("Total number of tests = %d"), iTestCounter); |
|
1703 OutputFormattedTextL(_L("Sucessful ParseL/ProcessL Ops = %d"), iTestSuccesses); |
|
1704 OutputFormattedTextL(_L("Unsuccessful ParseL/ProcessL ops = %d"), iTestFailures); |
|
1705 } |
|
1706 |
|
1707 TBool CTestWapp::IsLineTermination(TChar aChar) |
|
1708 { |
|
1709 // Checks if the argument is a linebreak of any kind. |
|
1710 if ( ( aChar != CEditableText::EParagraphDelimiter) |
|
1711 &&( aChar != CEditableText::ELineBreak) |
|
1712 &&( aChar != CEditableText::EPageBreak) //KBioLineFeed) |
|
1713 &&( aChar != (TChar) '\n') |
|
1714 &&( aChar != (TChar) '\r')) |
|
1715 |
|
1716 return EFalse; // Character Not a line break |
|
1717 else |
|
1718 return ETrue; |
|
1719 } |
|
1720 |
|
1721 // |
|
1722 // OutputTextListL() - Appends the second descriptor to the first descriptor with a separator |
|
1723 // between them.If Tabbing is on a tab is inserted at the front of the text |
|
1724 // |
|
1725 void CTestWapp::OutputTextListL(const TDesC& aFieldName, const TDesC& aValueName) |
|
1726 { |
|
1727 HBufC* outputBuf = HBufC::NewLC(200); |
|
1728 TInt paddingFactor; |
|
1729 TInt loop; |
|
1730 _LIT(KSpace, " "); |
|
1731 _LIT(KSeparatorString, " : "); |
|
1732 |
|
1733 outputBuf->Des().Copy(aFieldName); |
|
1734 paddingFactor = 30 -outputBuf->Des().Length(); |
|
1735 for (loop =0; loop < paddingFactor; loop++) |
|
1736 { |
|
1737 outputBuf->Des().Append(KSpace); |
|
1738 } |
|
1739 outputBuf->Des().Append(KSeparatorString); |
|
1740 if ( (outputBuf->Des().Length()+aValueName.Length()) <=200) |
|
1741 outputBuf->Des().Append(aValueName); //create formatted buffer |
|
1742 else |
|
1743 { |
|
1744 for (loop =0; loop < outputBuf->Des().MaxLength()-outputBuf->Des().Length(); loop++) |
|
1745 { |
|
1746 outputBuf->Des().Append( aValueName[loop]); |
|
1747 } |
|
1748 } |
|
1749 PrintDescriptor(outputBuf->Des()); //print and log the formatted text |
|
1750 iBioTestUtils->WriteComment(outputBuf->Des()); |
|
1751 CleanupStack::PopAndDestroy(); // outputBuf |
|
1752 } |
|
1753 |
|
1754 // |
|
1755 // OutputTextListL() - Converts the int to a string and then adds it to the first descriptor |
|
1756 // with a separator between them. If Tabbing is on a tab is inserted at the front of the text |
|
1757 // |
|
1758 void CTestWapp::OutputTextListL(const TDesC& aFieldName, const TUint aValue) |
|
1759 { |
|
1760 HBufC* formatBuf = HBufC::NewLC(64); |
|
1761 HBufC* outputBuf = HBufC::NewLC(100); |
|
1762 TInt paddingFactor; |
|
1763 _LIT(KSpace, " "); |
|
1764 _LIT(KFormatString, " : %d"); |
|
1765 |
|
1766 formatBuf->Des().Copy(aFieldName); |
|
1767 paddingFactor = 30 -formatBuf->Des().Length(); |
|
1768 for (TInt i =0; i < paddingFactor; i++) |
|
1769 formatBuf->Des().Append(KSpace); |
|
1770 formatBuf->Des().Append(KFormatString); |
|
1771 outputBuf->Des().Format(formatBuf->Des(), aValue); |
|
1772 PrintDescriptor(outputBuf->Des()); |
|
1773 iBioTestUtils->WriteComment(outputBuf->Des()); |
|
1774 CleanupStack::PopAndDestroy(2);// outputBuf,formatBuf |
|
1775 } |
|
1776 |
|
1777 |
|
1778 // |
|
1779 // OutputFormattedTextL() - Creates a formatted string using the two paramenter passed in |
|
1780 // prints out to console and then to log, with a preceding tab if Tabbing is on. |
|
1781 void CTestWapp::OutputFormattedTextL(TRefByValue<const TDesC> aFmt,...) |
|
1782 //const TDesC& aFormatString, TInt aValue) |
|
1783 { |
|
1784 HBufC* tempBuffer=HBufC::NewLC(1024); // aFormatString.Length()+20); |
|
1785 |
|
1786 VA_LIST list; |
|
1787 VA_START(list,aFmt); |
|
1788 // create the formatted list |
|
1789 tempBuffer->Des().AppendFormatList(aFmt,list); |
|
1790 |
|
1791 test.Printf(tempBuffer->Des()); |
|
1792 test.Printf(_L("\n")); |
|
1793 iBioTestUtils->WriteComment(tempBuffer->Des()); |
|
1794 CleanupStack::PopAndDestroy(); // tempDes |
|
1795 } |
|
1796 |
|
1797 // DisplayLogDescriptorL() - Helper function that prints the descriptor to screen |
|
1798 // and logs it to file |
|
1799 // |
|
1800 void CTestWapp::PrintDescriptor(const TDesC& aBuffer) |
|
1801 { |
|
1802 test.Printf(aBuffer); |
|
1803 test.Printf(_L("\n")); |
|
1804 } |
|
1805 |
|
1806 |
|
1807 void CTestWapp::DisplayErrorReasonL(TInt& aReason) |
|
1808 { |
|
1809 |
|
1810 switch (aReason) |
|
1811 { |
|
1812 case KErrNone: |
|
1813 OutputFormattedTextL(_L("General Error (0) - Test sequence completed successfully.")); |
|
1814 break; |
|
1815 case KErrNotFound: |
|
1816 OutputFormattedTextL(_L("General Error (-1) - Not found.")); |
|
1817 break; |
|
1818 case KErrCancel: |
|
1819 OutputFormattedTextL(_L("General Error (-3) - Session cancelled.")); |
|
1820 break; |
|
1821 case KErrNoMemory: |
|
1822 OutputFormattedTextL(_L("General Error (-4) - No memory.")); |
|
1823 break; |
|
1824 case KErrNotSupported: |
|
1825 OutputFormattedTextL(_L("General Error (-5) - Function Not Supported")); |
|
1826 break; |
|
1827 case KErrAccessDenied: |
|
1828 OutputFormattedTextL(_L("General Error (-21) - Access Denied.")); |
|
1829 break; |
|
1830 case KErrEof: |
|
1831 OutputFormattedTextL(_L("General Error (-25) - Unexpected end of file.")); |
|
1832 break; |
|
1833 case KErrDisconnected: |
|
1834 OutputFormattedTextL(_L("General Error (-36) - Disconnected.")); |
|
1835 break; |
|
1836 |
|
1837 // General Base Class String Parser error code |
|
1838 case KBspInvalidMessage: |
|
1839 OutputFormattedTextL(_L("Base Parser Error (-500) - Invalid message")); |
|
1840 break; |
|
1841 |
|
1842 // Error codes specific to the WAPP parser |
|
1843 case KWappBaseError: |
|
1844 OutputFormattedTextL(_L("General WAP Access Point Parser Error (-600).")); |
|
1845 break; |
|
1846 case KWappErrXMLVersion: |
|
1847 OutputFormattedTextL(_L("WAPP Error (-601) - Unknown XML version.")); |
|
1848 break; |
|
1849 case KWappErrOutsideBoundaries: |
|
1850 OutputFormattedTextL(_L("WAPP Error (-602) - Index exceeds boundaries.")); |
|
1851 break; |
|
1852 case KWappErrStringTable: |
|
1853 OutputFormattedTextL(_L("WAPP Error (-603) - Bad String table reference.")); |
|
1854 break; |
|
1855 case KWappErrEOS: |
|
1856 OutputFormattedTextL(_L("WAPP Error (-604) - Unexpected end of message.")); |
|
1857 break; |
|
1858 case KWappErrUnexpectedValue: |
|
1859 OutputFormattedTextL(_L("WAPP Error (-605) - Unexpected value for current byte.")); |
|
1860 break; |
|
1861 case KWappErrNoAttributes: |
|
1862 OutputFormattedTextL(_L("WAPP Error (-606) - Not found expected attributes.")); |
|
1863 break; |
|
1864 case KWappErrMandatoryTagMissing: |
|
1865 OutputFormattedTextL(_L("WAPP Error (-607) - Mandatory token missing.")); |
|
1866 break; |
|
1867 case KWappErrStoreNotFound: |
|
1868 OutputFormattedTextL(_L("WAPP Error (-608) - No store attached to this entry.")); |
|
1869 break; |
|
1870 case KWappErrMsgUnparsed: |
|
1871 OutputFormattedTextL(_L("WAPP Error (-609) - Message not yet parsed.")); |
|
1872 break; |
|
1873 case KWappErrUnrecognised: |
|
1874 OutputFormattedTextL(_L("WAPP Error (-610) - Unrecognised value.")); |
|
1875 break; |
|
1876 case KWappErrNullValue: |
|
1877 OutputFormattedTextL(_L("WAPP Error (-611) - Unexpected Null value.")); |
|
1878 break; |
|
1879 case KWappErrContent: |
|
1880 OutputFormattedTextL(_L("WAPP Error (-612) - Message Content error occurred.")); |
|
1881 break; |
|
1882 case KWappErrNoDBRecords: |
|
1883 OutputFormattedTextL(_L("WAPP Error (-613) - No entries in the Comms DB for this message.")); |
|
1884 break; |
|
1885 case KWappErrNotSupported: |
|
1886 OutputFormattedTextL(_L("WAPP Error (-614) - Not supported by WAPP.")); |
|
1887 break; |
|
1888 case KWappErrBadMessage: |
|
1889 OutputFormattedTextL(_L("WAPP Error (-615) - Badly formed message - invalid XML document")); |
|
1890 break; |
|
1891 case KWappErrNoTermination: |
|
1892 OutputFormattedTextL(_L("WAPP Error (-616) - Invalid termination of data structure")); |
|
1893 break; |
|
1894 default: |
|
1895 OutputFormattedTextL(_L("Unknown error code = %d."), aReason); |
|
1896 CActiveScheduler::Stop(); // Return from call to CActiveScheduler::Start(). |
|
1897 break; |
|
1898 } |
|
1899 } |
|
1900 // end DisplayErrorReasonL |
|
1901 |
|
1902 // DisplayMMSURLL() - Helper function that retrieves the MMS server address |
|
1903 // URL and logs it to file. |
|
1904 // MMS is no longer supported. This function now does nothing. |
|
1905 void CTestWapp::DisplayMMSURLL() |
|
1906 { |
|
1907 OutputFormattedTextL(_L("MMS is no longer supported")); |
|
1908 } |
|
1909 |
|
1910 |
|
1911 // |
|
1912 // GLOBAL FUNCTIONS: IMPLEMENTATION // |
|
1913 // |
|
1914 |
|
1915 |
|
1916 LOCAL_C void doParserTestL(RFs& aFs) |
|
1917 { |
|
1918 // Test the parser (Adds parser test to active scheduler): |
|
1919 CTestWapp* testParser = CTestWapp::NewL(aFs); |
|
1920 CleanupStack::PushL(testParser); |
|
1921 test(testParser != NULL); |
|
1922 testParser->StartL(); // Create message as first stage of testing. |
|
1923 CActiveScheduler::Start(); // Run through parser test actions. See RunL. |
|
1924 |
|
1925 // Clean up: |
|
1926 CleanupStack::PopAndDestroy(); // testParser |
|
1927 test.Printf(_L("Cleaning up - testParser\n")); |
|
1928 } |
|
1929 |
|
1930 |
|
1931 LOCAL_C void doMainL() |
|
1932 { |
|
1933 // Create a local variable for the Active Scheduler: |
|
1934 CTestScheduler* myTestScheduler; |
|
1935 myTestScheduler = new (ELeave) CTestScheduler; |
|
1936 CleanupStack::PushL( myTestScheduler ); |
|
1937 CActiveScheduler::Install( myTestScheduler ); |
|
1938 |
|
1939 // Create a file server session: |
|
1940 RFs gFs; |
|
1941 User::LeaveIfError(gFs.Connect()); |
|
1942 gFs.SetSessionPath(_L("C:\\")); |
|
1943 |
|
1944 doParserTestL(gFs); |
|
1945 |
|
1946 CleanupStack::PopAndDestroy(); // myTestScheduler |
|
1947 gFs.Close(); |
|
1948 } |
|
1949 // end doMainL() |
|
1950 |
|
1951 |
|
1952 GLDEF_C TInt E32Main() |
|
1953 { |
|
1954 test.Title(); // RTest test(_L("WAPP Test Harness")) has been declared globally. |
|
1955 test.Start(_L("Wapp Test Harness")); |
|
1956 |
|
1957 __UHEAP_MARK; |
|
1958 CTrapCleanup* cleanup=CTrapCleanup::New(); |
|
1959 test(cleanup!=NULL); |
|
1960 TRAPD(error,doMainL()); |
|
1961 |
|
1962 // Was the test sequence successful? |
|
1963 if (error !=KErrNone) |
|
1964 test.Printf(_L("\nTest sequence failed , error code %d\n"),error); |
|
1965 else |
|
1966 test.Printf(_L("\nTests completed, error status %d\n"), error); |
|
1967 delete cleanup; |
|
1968 __UHEAP_MARKEND; |
|
1969 |
|
1970 test.End(); |
|
1971 test.Close(); |
|
1972 return KErrNone; |
|
1973 } |
|
1974 // end E32Main() |