1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /* |
|
20 |
|
21 Testmodule needs two new blocks: |
|
22 EnableVerifying |
|
23 - Parameters: verify ID, appendmode: 0 = if verify file exists it will be |
|
24 overwritten, 1 data is written to end of file |
|
25 - Verify ID can be the Case ID |
|
26 - Calls IptvTestUtility::CreateVerifyData |
|
27 - The case can call EnableVerifying block of multiple modules. Verify ID should be same in each call, |
|
28 just use append mode in other calls but the first. |
|
29 - If this has not been called then IptvTestUtility::VerifyData and |
|
30 IptvTestUtility::WriteVerifyData do nothing |
|
31 |
|
32 Verify |
|
33 - Parameters: The verify ID used in the case |
|
34 - Calls IptvTestUtility::VerifyData(CaseId) for the ID |
|
35 - Case should call Verify block only once, even EnableVerifying is called for multiple test modules |
|
36 |
|
37 After call to EnableVerifying the test module can write data with two different |
|
38 IptvTestUtility::WriteVerifyData methods. |
|
39 |
|
40 VerifyData will fail at the first time it's called. This is because it can't |
|
41 find already verified file to compare with the one generated during the case run. |
|
42 The unverified file can be found from E (or C if MMC is not installed) drive |
|
43 in the folder: \iptvtest\verify\<VerifyID>.txt. This file must be verified by |
|
44 hand and copied to IPTV_engine\internal\data\verify. |
|
45 |
|
46 Note: Only logs from HW test runs should be accepted. Emulator and HW might give |
|
47 different results. |
|
48 |
|
49 IPTV_engine\internal\sis\generateverifylist.pl script generates |
|
50 internal\data\verifyExports.inf file which exports the verified files to |
|
51 correct locations. internal\sis\pkgExports.txt is also created and the |
|
52 lines inside must be copied to STIF_IPTV_Engine.pkg. The verified files will |
|
53 be installed in c:\Testframework\Iptvtest\verify folder on the terminal. |
|
54 |
|
55 File & directory summary. |
|
56 1. (E/C):\iptvtest\verify\<VerifyID>.txt (on hardware) |
|
57 - Generated during the case run |
|
58 2. internal\data\verify |
|
59 - #1 should be copied here after it has been verified manually for first time. |
|
60 3. c:\Testframework\Iptvtest\verify (on hardware) |
|
61 - Verified files are installed here. Compared to #1 |
|
62 4. internal\sis\generateverifylist.pl |
|
63 - Creates files #5 & #6 |
|
64 5. internal\data\verifyExports.inf |
|
65 - Exports the files in folders: epoc32\winscw\c\testframework\iptvtest\verify |
|
66 epoc32\data\Z\System\Data\Iptvtest\Verify |
|
67 6. \internal\sis\pkgExports.txt |
|
68 - Pkg lines for the files, copy to STIF_IPTV_Engine.pkg |
|
69 |
|
70 Example case: |
|
71 |
|
72 [Test] |
|
73 title ET39000 Data verifying example |
|
74 create IptvProvisioningTest ProvTest |
|
75 create IptvServiceManagementApiTest SMTest |
|
76 SMTest DeleteServicesDb |
|
77 ProvTest Create |
|
78 ProvTest EnableVerifying ET39000 // first module and first call will create new data file |
|
79 ProvTest LocalProvision "c:\TestFramework\testvod_services.xml" |
|
80 create IptvVodContentApiTest VCTest |
|
81 VCTest Create SERV_1 |
|
82 VCTest EnableVerifying ET39000 APPEND // second module will append to the same file |
|
83 VCTest SelectIap 3G_AP |
|
84 VCTest UpdateEcg |
|
85 waittestclass VCTest |
|
86 VCTest VerifyAllCategoryContent KIptvVodContentCategoryRootId |
|
87 ProvTest Verify ET39000 // only one module will do the verifying |
|
88 VCTest Destroy |
|
89 delete VCTest |
|
90 ProvTest Destroy |
|
91 delete ProvTest |
|
92 SMTest Destroy |
|
93 delete SMTest |
|
94 [Endtest] |
|
95 |
|
96 */ |
|
97 |
|
98 |
|
99 #ifndef CIPTVTESTVERIFYDATA_H |
|
100 #define CIPTVTESTVERIFYDATA_H |
|
101 |
|
102 // INCLUDES |
|
103 #include <e32base.h> |
|
104 #include <e32cmn.h> // RArray |
|
105 #include <f32file.h> // RFs |
|
106 #include <BAUTILS.H> |
|
107 #include <S32FILE.H> |
|
108 |
|
109 // CONSTANTS |
|
110 const TInt KIptvTestErrVerifyFailed = -1112; |
|
111 _LIT(KIptvVerifyZipFile, "c:\\testing\\data\\verifyzip\\verify.zip" ); |
|
112 |
|
113 // MACROS |
|
114 |
|
115 // DATA TYPES |
|
116 |
|
117 // FUNCTION PROTOTYPES |
|
118 |
|
119 // FORWARD DECLARATIONS |
|
120 class CZipFile; |
|
121 |
|
122 // CLASS DECLARATION |
|
123 |
|
124 class CVerifyFile : public CBase |
|
125 { |
|
126 public: |
|
127 static CVerifyFile* CVerifyFile::NewL(); |
|
128 |
|
129 virtual ~CVerifyFile(); |
|
130 |
|
131 // data |
|
132 |
|
133 TBuf<64> iId; |
|
134 |
|
135 /** |
|
136 * Returns the file name and path where case data is written to be verified |
|
137 * @since |
|
138 * @param aFileName pointer to descriptor where file name is written |
|
139 * @return Error code, KErrNone if no errors, |
|
140 */ |
|
141 void GetFileToWrite(TDes& aFileName); |
|
142 |
|
143 void CreateNewFile(); |
|
144 |
|
145 void WriteData(TDesC& aData); |
|
146 |
|
147 void CloseFileHandles(); |
|
148 |
|
149 protected: |
|
150 CVerifyFile(); |
|
151 void ConstructL(); |
|
152 |
|
153 private: |
|
154 RFs iFs; |
|
155 HBufC* iFileName; |
|
156 TBool iFileOpen; |
|
157 RFileWriteStream iFileStream; |
|
158 RFile iFile; |
|
159 |
|
160 void OpenStream(); |
|
161 void ResolveFileName(); |
|
162 }; |
|
163 |
|
164 |
|
165 /** |
|
166 * |
|
167 * @since |
|
168 */ |
|
169 class CIptvTestVerifyData : public CBase |
|
170 { |
|
171 public: // Constructors and destructor |
|
172 |
|
173 enum TVerifyResult |
|
174 { |
|
175 EVerifyOk = 0, |
|
176 EVerifyFailed = -1112, |
|
177 EVerifiedFileNotFound = -1111, |
|
178 EFileToVerifyNotFound = -1110, |
|
179 ESystemError = -1109 |
|
180 }; |
|
181 |
|
182 /** |
|
183 * Two-phased constructor. |
|
184 */ |
|
185 IMPORT_C static CIptvTestVerifyData* NewL(); |
|
186 |
|
187 |
|
188 /** |
|
189 * Destructor. |
|
190 */ |
|
191 IMPORT_C virtual ~CIptvTestVerifyData(); |
|
192 |
|
193 |
|
194 public: // New functions |
|
195 |
|
196 /** |
|
197 * Initializes the verify file, deletes if the file exists |
|
198 * @since |
|
199 * @param aVerifyId An id to identify the file where verify data is written |
|
200 * @return Error code, KErrNone if no errors, |
|
201 */ |
|
202 IMPORT_C TInt CreateVerifyDataL(TDesC& aVerifyId, TBool aAppend); |
|
203 |
|
204 /** |
|
205 * Writes verify data to a file |
|
206 * @since |
|
207 * @param aVerifyId An id to identify the file where verify data is written |
|
208 * @param aVerifyData Data to write into the file |
|
209 * @return Error code, KErrNone if no errors, |
|
210 */ |
|
211 IMPORT_C TInt WriteVerifyDataL(TDesC& aVerifyId, TDesC& aVerifyData); |
|
212 |
|
213 /** |
|
214 * Verifies the results, result is written to aVerifyResult |
|
215 * @since |
|
216 * @param aVerifyId An id to identify the files which are compared |
|
217 * @return Error code, KErrNone if no errors, |
|
218 */ |
|
219 IMPORT_C TInt VerifyDataL(TDesC& aVerifyId, TVerifyResult& aVerifyResult); |
|
220 |
|
221 /** |
|
222 * Enables timestamp writing to the file. |
|
223 * @since |
|
224 * @param aUseTimestamps |
|
225 * @return Error code, KErrNone if no errors, |
|
226 */ |
|
227 IMPORT_C void EnableTimestamps( TBool aUseTimestamps ); |
|
228 |
|
229 protected: //from base classes |
|
230 |
|
231 private: |
|
232 |
|
233 /** |
|
234 * C++ default constructor. |
|
235 */ |
|
236 CIptvTestVerifyData(); |
|
237 |
|
238 /** |
|
239 * By default Symbian 2nd phase constructor is private. |
|
240 */ |
|
241 void ConstructL(); |
|
242 |
|
243 TInt GetVerifyFileIndex(TInt& aIndex, TDesC& aVerifyId); |
|
244 |
|
245 /* |
|
246 * Reads a file into the buffer. |
|
247 */ |
|
248 TInt ReadFileL(RFs& aFs, TDes& aFileName, HBufC8** aBuff, TVerifyResult& aVerifyResult); |
|
249 |
|
250 /* |
|
251 * Extracts a file from zip file. |
|
252 */ |
|
253 void ExtractVerifyFileL( TDesC& aVerifyId, const TDesC& aDestFile ); |
|
254 |
|
255 /* |
|
256 * Checks if file exists in zip file. |
|
257 */ |
|
258 TBool FileExistsInZip( CZipFile* aZipFile, const TDesC& aFileName ); |
|
259 |
|
260 private: // Data |
|
261 RFs iFs; |
|
262 |
|
263 RPointerArray<CVerifyFile> iVerifyFiles; |
|
264 |
|
265 CZipFile* iZipFile; |
|
266 |
|
267 TBool iUseTimestamps; |
|
268 |
|
269 HBufC* iBuffer; |
|
270 }; |
|
271 |
|
272 #endif // CIPTVTESTVERIFYDATA_H |
|
273 |
|
274 // End of File |
|