author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 19 | 989d2f495d90 |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2002 - 2007 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: ?Description |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
#include <e32svr.h> |
|
23 |
#include <StifParser.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
24 |
#include <StifTestInterface.h> |
19 | 25 |
#include "tcal_import.h" |
26 |
#include "calendarheader.h" |
|
27 |
#include "calendarservice.h" |
|
28 |
#include "importestcases.h" |
|
29 |
||
30 |
||
31 |
// EXTERNAL DATA STRUCTURES |
|
32 |
//extern ?external_data; |
|
33 |
||
34 |
// EXTERNAL FUNCTION PROTOTYPES |
|
35 |
//extern ?external_function( ?arg_type,?arg_type ); |
|
36 |
||
37 |
// CONSTANTS |
|
38 |
//const ?type ?constant_var = ?constant; |
|
39 |
||
40 |
// MACROS |
|
41 |
//#define ?macro ?macro_def |
|
42 |
||
43 |
// LOCAL CONSTANTS AND MACROS |
|
44 |
//const ?type ?constant_var = ?constant; |
|
45 |
//#define ?macro_name ?macro_def |
|
46 |
||
47 |
// MODULE DATA STRUCTURES |
|
48 |
//enum ?declaration |
|
49 |
//typedef ?declaration |
|
50 |
||
51 |
// LOCAL FUNCTION PROTOTYPES |
|
52 |
//?type ?function_name( ?arg_type, ?arg_type ); |
|
53 |
||
54 |
// FORWARD DECLARATIONS |
|
55 |
//class ?FORWARD_CLASSNAME; |
|
56 |
||
57 |
// ============================= LOCAL FUNCTIONS =============================== |
|
58 |
||
59 |
// ----------------------------------------------------------------------------- |
|
60 |
// ?function_name ?description. |
|
61 |
// ?description |
|
62 |
// Returns: ?value_1: ?description |
|
63 |
// ?value_n: ?description_line1 |
|
64 |
// ?description_line2 |
|
65 |
// ----------------------------------------------------------------------------- |
|
66 |
// |
|
67 |
/* |
|
68 |
?type ?function_name( |
|
69 |
?arg_type arg, // ?description |
|
70 |
?arg_type arg) // ?description |
|
71 |
{ |
|
72 |
||
73 |
?code // ?comment |
|
74 |
||
75 |
// ?comment |
|
76 |
?code |
|
77 |
} |
|
78 |
*/ |
|
79 |
||
80 |
// ============================ MEMBER FUNCTIONS =============================== |
|
81 |
||
82 |
// ----------------------------------------------------------------------------- |
|
83 |
// Ctcal_import::Delete |
|
84 |
// Delete here all resources allocated and opened from test methods. |
|
85 |
// Called from destructor. |
|
86 |
// ----------------------------------------------------------------------------- |
|
87 |
// |
|
88 |
void Ctcal_import::Delete() |
|
89 |
{ |
|
90 |
||
91 |
} |
|
92 |
||
93 |
// ----------------------------------------------------------------------------- |
|
94 |
// Ctcal_import::RunMethodL |
|
95 |
// Run specified method. Contains also table of test mothods and their names. |
|
96 |
// ----------------------------------------------------------------------------- |
|
97 |
// |
|
98 |
TInt Ctcal_import::RunMethodL( |
|
99 |
CStifItemParser& aItem ) |
|
100 |
{ |
|
101 |
||
102 |
static TStifFunctionInfo const KFunctions[] = |
|
103 |
{ |
|
104 |
// Copy this line for every implemented function. |
|
105 |
// First string is the function name used in TestScripter script file. |
|
106 |
// Second is the actual implementation member function. |
|
107 |
ENTRY( "ImportByGuid", Ctcal_import::ImportByGuid ), |
|
108 |
ENTRY( "ImportUsingGUidAsync", Ctcal_import::ImportUsingGUidAsync), |
|
109 |
ENTRY( "ImportByLuid", Ctcal_import::ImportByLuid), |
|
110 |
ENTRY( "ImportUsingLUidAsync", Ctcal_import::ImportUsingLUidAsync), |
|
111 |
ENTRY( "ImportCases_one", Ctcal_import::ImportCases_one), |
|
112 |
ENTRY( "ImportCases_two", Ctcal_import::ImportCases_two), |
|
113 |
ENTRY( "ImportFromFile", Ctcal_import::ImportFromFile), |
|
114 |
ENTRY( "ImportUsingFileAsync", Ctcal_import::ImportUsingFileAsync), |
|
115 |
ENTRY( "ImportCases_three", Ctcal_import::ImportCases_three), |
|
116 |
ENTRY( "ImportMultipleEntry", Ctcal_import::ImportMultipleEntry), |
|
117 |
ENTRY( "ImportMultipleEntryAsync", Ctcal_import::ImportMultipleEntryAsync), |
|
118 |
ENTRY( "ImportCaseAsync", Ctcal_import::ImportCaseAsync), |
|
119 |
ENTRY( "RemoveFile", Ctcal_import::RemoveFile ), |
|
120 |
//ADD NEW ENTRY HERE |
|
121 |
||
122 |
}; |
|
123 |
||
124 |
const TInt count = sizeof( KFunctions ) / |
|
125 |
sizeof( TStifFunctionInfo ); |
|
126 |
||
127 |
return RunInternalL( KFunctions, count, aItem ); |
|
128 |
||
129 |
} |
|
130 |
||
131 |
// Function to remove a file |
|
132 |
TInt Ctcal_import::RemoveFile( CStifItemParser& aItem ) |
|
133 |
{ |
|
134 |
TPtrC16 file; |
|
135 |
aItem.GetNextString(file); |
|
136 |
RFile LogResult; |
|
137 |
RFs LogResultSession; |
|
138 |
User::LeaveIfError(LogResultSession.Connect()); |
|
139 |
if(LogResult.Open(LogResultSession ,file , EFileWrite | EFileShareAny ) != KErrNotFound) |
|
140 |
{ |
|
141 |
LogResult.Close(); |
|
142 |
||
143 |
LogResultSession.Delete(file); |
|
144 |
||
145 |
LogResultSession.Close(); |
|
146 |
} |
|
147 |
||
148 |
LogResult.Close(); |
|
149 |
LogResultSession.Close(); |
|
150 |
return KErrNone; |
|
151 |
||
152 |
} |
|
153 |
||
154 |
||
155 |
// ----------------------------------------------------------------------------- |
|
156 |
// Ctcal_import::ImportByGuid |
|
157 |
// Example test method function to import entries based on Guid. |
|
158 |
// (other items were commented in a header). |
|
159 |
// ----------------------------------------------------------------------------- |
|
160 |
// |
|
161 |
TInt Ctcal_import::ImportByGuid( CStifItemParser& /*aItem*/ ) |
|
162 |
{ |
|
163 |
||
164 |
__UHEAP_MARK; |
|
165 |
||
166 |
TInt result=KErrNone; |
|
167 |
||
168 |
CCalImpTestCases *calImpTest = CCalImpTestCases::NewL(result); |
|
169 |
||
170 |
result = calImpTest->TestImportGuidL(); |
|
171 |
||
172 |
delete calImpTest; |
|
173 |
||
174 |
__UHEAP_MARKEND; |
|
175 |
||
176 |
return result; |
|
177 |
||
178 |
} |
|
179 |
||
180 |
// ----------------------------------------------------------------------------- |
|
181 |
// Ctcal_import::ImportUsingGUidAsync |
|
182 |
// Example test method function to import entries based on Guid - Async. |
|
183 |
// (other items were commented in a header). |
|
184 |
// ----------------------------------------------------------------------------- |
|
185 |
// |
|
186 |
TInt Ctcal_import::ImportUsingGUidAsync( CStifItemParser& /*aItem*/ ) |
|
187 |
{ |
|
188 |
||
189 |
TInt result=KErrNone; |
|
190 |
||
191 |
CCalImpTestCases *calImpTest = CCalImpTestCases::NewL(result); |
|
192 |
||
193 |
calImpTest->TestImportUsingGuidAsyncL(); |
|
194 |
||
195 |
delete calImpTest; |
|
196 |
||
197 |
return result; |
|
198 |
||
199 |
} |
|
200 |
||
201 |
// ----------------------------------------------------------------------------- |
|
202 |
// Ctcal_import::ImportByLuid |
|
203 |
// Example test method function to import entries based on Luid. |
|
204 |
// (other items were commented in a header). |
|
205 |
// ----------------------------------------------------------------------------- |
|
206 |
// |
|
207 |
TInt Ctcal_import::ImportByLuid( CStifItemParser& /*aItem*/ ) |
|
208 |
{ |
|
209 |
||
210 |
__UHEAP_MARK; |
|
211 |
||
212 |
TInt result=KErrNone; |
|
213 |
||
214 |
CCalImpTestCases *calImpTest = CCalImpTestCases::NewL(result); |
|
215 |
||
216 |
result = calImpTest->TestImportLuidL(); |
|
217 |
||
218 |
delete calImpTest; |
|
219 |
||
220 |
__UHEAP_MARKEND; |
|
221 |
||
222 |
return result; |
|
223 |
||
224 |
} |
|
225 |
||
226 |
// ----------------------------------------------------------------------------- |
|
227 |
// Ctcal_import::ImportUsingLUidAsync |
|
228 |
// Example test method function to import entries based on Luid - Async. |
|
229 |
// (other items were commented in a header). |
|
230 |
// ----------------------------------------------------------------------------- |
|
231 |
// |
|
232 |
TInt Ctcal_import::ImportUsingLUidAsync( CStifItemParser& /*aItem*/ ) |
|
233 |
{ |
|
234 |
||
235 |
TInt result=KErrNone; |
|
236 |
||
237 |
CCalImpTestCases *calImpTest = CCalImpTestCases::NewL(result); |
|
238 |
||
239 |
calImpTest->TestImportUsingLuidAsyncL(); |
|
240 |
||
241 |
delete calImpTest; |
|
242 |
||
243 |
return result; |
|
244 |
||
245 |
} |
|
246 |
||
247 |
// ----------------------------------------------------------------------------- |
|
248 |
// Ctcal_import::ImportCases_one |
|
249 |
// Example test method function to test few cases with Import. |
|
250 |
// (other items were commented in a header). |
|
251 |
// ----------------------------------------------------------------------------- |
|
252 |
// |
|
253 |
TInt Ctcal_import::ImportCases_one( CStifItemParser& /*aItem*/ ) |
|
254 |
{ |
|
255 |
||
256 |
__UHEAP_MARK; |
|
257 |
||
258 |
TInt result=KErrNone; |
|
259 |
||
260 |
CCalImpTestCases *calImpTest = CCalImpTestCases::NewL(result); |
|
261 |
||
262 |
result = calImpTest->TestImportCases1(); |
|
263 |
||
264 |
delete calImpTest; |
|
265 |
||
266 |
__UHEAP_MARKEND; |
|
267 |
||
268 |
return result; |
|
269 |
||
270 |
} |
|
271 |
||
272 |
// ----------------------------------------------------------------------------- |
|
273 |
// Ctcal_import::ImportCases_two |
|
274 |
// Example test method function to test few cases with Import. |
|
275 |
// (other items were commented in a header). |
|
276 |
// ----------------------------------------------------------------------------- |
|
277 |
// |
|
278 |
TInt Ctcal_import::ImportCases_two( CStifItemParser& /*aItem*/ ) |
|
279 |
{ |
|
280 |
||
281 |
__UHEAP_MARK; |
|
282 |
||
283 |
TInt result=KErrNone; |
|
284 |
||
285 |
CCalImpTestCases *calImpTest = CCalImpTestCases::NewL(result); |
|
286 |
||
287 |
result = calImpTest->TestImportCases2(); |
|
288 |
||
289 |
delete calImpTest; |
|
290 |
||
291 |
__UHEAP_MARKEND; |
|
292 |
||
293 |
return result; |
|
294 |
||
295 |
} |
|
296 |
||
297 |
// ----------------------------------------------------------------------------- |
|
298 |
// Ctcal_import::ImportFromFile |
|
299 |
// Example test method function to import from file. |
|
300 |
// (other items were commented in a header). |
|
301 |
// ----------------------------------------------------------------------------- |
|
302 |
// |
|
303 |
TInt Ctcal_import::ImportFromFile( CStifItemParser& /*aItem*/ ) |
|
304 |
{ |
|
305 |
||
306 |
__UHEAP_MARK; |
|
307 |
||
308 |
TInt result=KErrNone; |
|
309 |
||
310 |
CCalImpTestCases *calImpTest = CCalImpTestCases::NewL(result); |
|
311 |
||
312 |
result = calImpTest->TestImportFromFileL(); |
|
313 |
||
314 |
delete calImpTest; |
|
315 |
||
316 |
__UHEAP_MARKEND; |
|
317 |
||
318 |
return result; |
|
319 |
||
320 |
} |
|
321 |
||
322 |
// ----------------------------------------------------------------------------- |
|
323 |
// Ctcal_import::ImportUsingFileAsync |
|
324 |
// Example test method function to import from file - async |
|
325 |
// (other items were commented in a header). |
|
326 |
// ----------------------------------------------------------------------------- |
|
327 |
// |
|
328 |
TInt Ctcal_import::ImportUsingFileAsync( CStifItemParser& /*aItem*/ ) |
|
329 |
{ |
|
330 |
||
331 |
||
332 |
TInt result=KErrNone; |
|
333 |
||
334 |
CCalImpTestCases *calImpTest = CCalImpTestCases::NewL(result); |
|
335 |
||
336 |
calImpTest->TestImportUsingFileAsyncL(); |
|
337 |
||
338 |
delete calImpTest; |
|
339 |
||
340 |
return result; |
|
341 |
||
342 |
} |
|
343 |
||
344 |
// ----------------------------------------------------------------------------- |
|
345 |
// Ctcal_import::ImportCases_three |
|
346 |
// Example test method function to test few cases with Import. |
|
347 |
// (other items were commented in a header). |
|
348 |
// ----------------------------------------------------------------------------- |
|
349 |
// |
|
350 |
TInt Ctcal_import::ImportCases_three( CStifItemParser& /*aItem*/ ) |
|
351 |
{ |
|
352 |
||
353 |
__UHEAP_MARK; |
|
354 |
||
355 |
TInt result=KErrNone; |
|
356 |
||
357 |
CCalImpTestCases *calImpTest = CCalImpTestCases::NewL(result); |
|
358 |
||
359 |
result = calImpTest->TestImportCases3(); |
|
360 |
||
361 |
delete calImpTest; |
|
362 |
||
363 |
__UHEAP_MARKEND; |
|
364 |
||
365 |
return result; |
|
366 |
||
367 |
} |
|
368 |
||
369 |
// ----------------------------------------------------------------------------- |
|
370 |
// Ctcal_import::ImportMultipleEntry |
|
371 |
// Example test method function to import entries from multiple files. |
|
372 |
// (other items were commented in a header). |
|
373 |
// ----------------------------------------------------------------------------- |
|
374 |
// |
|
375 |
TInt Ctcal_import::ImportMultipleEntry( CStifItemParser& /*aItem*/ ) |
|
376 |
{ |
|
377 |
||
378 |
__UHEAP_MARK; |
|
379 |
||
380 |
TInt result=KErrNone; |
|
381 |
||
382 |
CCalImpTestCases *calImpTest = CCalImpTestCases::NewL(result); |
|
383 |
||
384 |
result = calImpTest->TestImportMultipleEntry(); |
|
385 |
||
386 |
delete calImpTest; |
|
387 |
||
388 |
__UHEAP_MARKEND; |
|
389 |
||
390 |
return result; |
|
391 |
||
392 |
} |
|
393 |
||
394 |
// ----------------------------------------------------------------------------- |
|
395 |
// Ctcal_import::ImportMultipleEntryAsync |
|
396 |
// Example test method function to import entries from multiple files - Async. |
|
397 |
// (other items were commented in a header). |
|
398 |
// ----------------------------------------------------------------------------- |
|
399 |
// |
|
400 |
TInt Ctcal_import::ImportMultipleEntryAsync( CStifItemParser& /*aItem*/ ) |
|
401 |
{ |
|
402 |
||
403 |
||
404 |
TInt result=KErrNone; |
|
405 |
||
406 |
CCalImpTestCases *calImpTest = CCalImpTestCases::NewL(result); |
|
407 |
||
408 |
calImpTest->TestImportMultipleEntryAsyncL(); |
|
409 |
||
410 |
delete calImpTest; |
|
411 |
||
412 |
return result; |
|
413 |
||
414 |
} |
|
415 |
||
416 |
// ----------------------------------------------------------------------------- |
|
417 |
// Ctcal_import::ImportCaseAsync |
|
418 |
// Example test method function to test import case - Async. |
|
419 |
// (other items were commented in a header). |
|
420 |
// ----------------------------------------------------------------------------- |
|
421 |
// |
|
422 |
TInt Ctcal_import::ImportCaseAsync( CStifItemParser& /*aItem*/ ) |
|
423 |
{ |
|
424 |
||
425 |
||
426 |
TInt result=KErrNone; |
|
427 |
||
428 |
CCalImpTestCases *calImpTest = CCalImpTestCases::NewL(result); |
|
429 |
||
430 |
calImpTest->TestImportCaseAsyncL(); |
|
431 |
||
432 |
delete calImpTest; |
|
433 |
||
434 |
return result; |
|
435 |
||
436 |
} |
|
437 |
||
438 |
||
439 |
// ----------------------------------------------------------------------------- |
|
440 |
// Ctcal_import::?member_function |
|
441 |
// ?implementation_description |
|
442 |
// (other items were commented in a header). |
|
443 |
// ----------------------------------------------------------------------------- |
|
444 |
// |
|
445 |
/* |
|
446 |
TInt Ctcal_import::?member_function( |
|
447 |
CItemParser& aItem ) |
|
448 |
{ |
|
449 |
||
450 |
?code |
|
451 |
||
452 |
} |
|
453 |
*/ |
|
454 |
||
455 |
// ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
456 |
// None |
|
457 |
||
458 |
// End of File |