|
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 #ifndef BIO_TEST_H_ |
|
17 #define BIO_TEST_H_ |
|
18 |
|
19 #include "msvtestutils.h" |
|
20 |
|
21 #include <biocmtm.h> |
|
22 #include "biosmtm.h" |
|
23 #include <bitsids.h> |
|
24 |
|
25 #include <bsp.h> |
|
26 |
|
27 const TUid KUidMsgTypeSmartMessage = {0x10001262}; |
|
28 _LIT(KBioServerMtmFileName, "z:\\system\\libs\\bios.dll"); |
|
29 _LIT(KBioClientMtmFileName, "z:\\system\\libs\\bioc.dll"); |
|
30 _LIT(KBioUiMtmFileName, "z:\\system\\libs\\bium.dll"); |
|
31 |
|
32 const TInt KTelephoneNumberMaxLength = 32; |
|
33 |
|
34 #define KDataComponentFileName _L("z:\\system\\mtm\\cbiomtmu.dat") |
|
35 |
|
36 |
|
37 _LIT(KBIOTxtFilePath, "C:\\test\\bio\\tbiogen\\"); |
|
38 |
|
39 // Wildcard Format for text filenames used to create messages |
|
40 _LIT(KBIOIapPrefix, "iacp*"); //IACP messages-mail&internet settings, |
|
41 //Inet scripts and additions,& ?? |
|
42 _LIT(KBIOEnpPrefix, "enp*"); // Smart Message email notification |
|
43 _LIT(KBIORingTonePrefix, "rtone*"); // ringing tones message |
|
44 _LIT(KBIOOpLogoPrefix, "oplogo*"); // operator logo message |
|
45 _LIT(KBIOcBusinessCardPrefix, "cbc*"); // compact business card |
|
46 _LIT(KBIOvCardPrefix, "vcard*"); // vCard message |
|
47 _LIT(KBIOvCalenderPrefix, "vcal*"); // vCalender |
|
48 _LIT(KBIOWappPrefix, "wapp*"); //Wapp message |
|
49 |
|
50 |
|
51 enum TBioTestUtilsPanic |
|
52 { |
|
53 KErrBIONotOnClientSide, |
|
54 KErrBIOSettingsNotConstructed |
|
55 }; |
|
56 |
|
57 class CBIODatabase; |
|
58 class CBioTestUtils : public CMsvTestUtils |
|
59 { |
|
60 public: |
|
61 IMPORT_C static CBioTestUtils* NewL(RTest& aRTest); |
|
62 IMPORT_C static CBioTestUtils* NewLC(RTest& aRTest); |
|
63 // additional overloaded constructors |
|
64 IMPORT_C static CBioTestUtils* NewL(RTest& aRTest, TInt aCreationFlags); |
|
65 IMPORT_C static CBioTestUtils* NewLC(RTest& aRTest, TInt aCreationFlags); |
|
66 IMPORT_C void CreateMessageFilesL(TMsvId aFinalServiceId, TMsvId aCreateInFolderId); |
|
67 |
|
68 IMPORT_C void Reset(); |
|
69 IMPORT_C ~CBioTestUtils(); |
|
70 |
|
71 IMPORT_C void CreateBioServerMtmRegL(); |
|
72 |
|
73 inline void SetProgressL(CMsvOperation& iOperation); |
|
74 IMPORT_C void EmptyInboxMessagesL(); |
|
75 //Set the BIO service. Creates a default service if one not available. Returns value of new entry |
|
76 IMPORT_C TMsvId SetBIOServiceIdL(); |
|
77 // Inline function which returns the id of message services |
|
78 inline TMsvId BIOServiceId(); |
|
79 // Inline function - sets Bio to value passed as a parameter |
|
80 inline void SetBIOServiceIdL(TMsvId aServiceId); |
|
81 // Set the Session path for the file session |
|
82 IMPORT_C void SetSessionPath(const TDesC& aSessionpath); |
|
83 // Creates a BIO entry of the Message Type, from the descriptor passed as a parameter |
|
84 IMPORT_C TMsvId CreateBIOEntryL(TDesC& aText, TBIOMessageType aMessageType); |
|
85 // Reads text from file, and creates a BIO message entry |
|
86 IMPORT_C TMsvId CreateBIOEntryFromFileL(const TDesC& aFilename, TBIOMessageType aMessageType); |
|
87 IMPORT_C void LogCurrentMessageTypeL(TMsvId aMsvId); |
|
88 |
|
89 IMPORT_C CMsvEntrySelection* GenerateMessagesL(); |
|
90 IMPORT_C CMsvEntrySelection* GenerateMessagesL(const TDesC& aFileDirectory, TBool aLogCreationDetails = EFalse); |
|
91 |
|
92 // create a parser |
|
93 IMPORT_C CBaseScriptParser2* CreateParserTypeL(TInt32 aBioMsgType); |
|
94 IMPORT_C CBaseScriptParser2* CreateParserL(TMsvId aBioMsgId); |
|
95 |
|
96 // return message body contents |
|
97 IMPORT_C TPtrC MessageBodyL(TMsvId aBioMsg); |
|
98 |
|
99 // log extract parsed fields |
|
100 IMPORT_C void LogExtractedFieldsL(TMsvId aMessage); |
|
101 IMPORT_C CArrayPtrSeg<CParsedField>& ParsedFieldArray(); |
|
102 |
|
103 IMPORT_C TBIOMessageType SetMessageType(const TDesC& aFileName); |
|
104 IMPORT_C static void DoAppendVariantName(TDes& aFileName); |
|
105 |
|
106 |
|
107 |
|
108 void InstantiateClientMtmsL(); |
|
109 void InstantiateServerMtmsL(); |
|
110 void DeleteServicesL(); |
|
111 void CreateServicesL(); |
|
112 void FindExistingServicesL(); |
|
113 void InstallMtmGroupsL(); |
|
114 void CreateServerMtmRegsL(); |
|
115 private: |
|
116 CBioTestUtils(RTest& aRTest); |
|
117 void DisplayLogEventData(const CLogEvent& /*aEvent*/, TBool /*aToFile*/, RFile& /*aFile*/) {}; |
|
118 void ConstructL(); |
|
119 void ConstructL(TInt aCreationFlags); |
|
120 void Panic(TInt aPanic); |
|
121 void Panic (TBioTestUtilsPanic aPanic); |
|
122 |
|
123 HBufC* ReadFromFileL(const TDesC& aFile); |
|
124 HBufC* CreateDummyPhoneNumberL(); |
|
125 |
|
126 void SetForMtmTypeL(TMsvEntry& aEntry, TBIOMessageType aType); |
|
127 |
|
128 TMsvId DefaultServiceForMTML(TUid aMtmUid, TBool aFindFirstServiceIfNoDefault); |
|
129 TMsvId DefaultServiceServerL(TUid aMtmUid, TBool aFindFirstServiceIfNoDefault); |
|
130 TMsvId DefaultServiceClientL(TUid aMtmUid, TBool aFindFirstServiceIfNoDefault); |
|
131 |
|
132 CMsvEntrySelection* GetListOfAccountsWithMTMServerL(TUid aMtmUid); |
|
133 CMsvEntrySelection* GetListOfAccountsWithMTMClientL(TUid aMtmUid); |
|
134 TMsvId CreateDefaultBIOServiceL(); |
|
135 |
|
136 void CreateBioEntryServerSideL(TMsvEntry& aEntry, CRichText& aBody); |
|
137 void CreateBioEntryClientSideL(TMsvEntry& aEntry, CRichText& aBody); |
|
138 void DeleteLocalEntrySynchronouslyL(CMsvEntry& aParentEntry, TMsvId anId); |
|
139 |
|
140 void SetBioServiceServerSideL(); |
|
141 void SetBioServiceClientSideL(); |
|
142 |
|
143 void InternalizeL(RMsvReadStream& aReadStream); |
|
144 |
|
145 public: |
|
146 CBIOClientMtm* iBioClientMtm; |
|
147 CBIOServerMtm* iBioServerMtm; |
|
148 TMsvId iBioServiceId; |
|
149 CBIODatabase* iBioDb; |
|
150 |
|
151 TInt iNumFiles; |
|
152 TInt iFilesProcessed; |
|
153 TInt iMessagesCreated; |
|
154 |
|
155 CBaseScriptParser* iParser; |
|
156 CRegisteredParserDll* iRegisteredParserDll; |
|
157 CDir* iDir; |
|
158 HBufC* iMessageBody; |
|
159 CArrayPtrSeg<CParsedField>* iTestParsedFieldArray; |
|
160 }; |
|
161 |
|
162 #define BIOTEST_PANIC _L("Bio_Test") |
|
163 |
|
164 #include <biotestutils.inl> |
|
165 |
|
166 #endif |