62 |
65 |
63 void doLog( CStifLogger* logger, TInt error, const TDesC& errorString ) |
66 void doLog( CStifLogger* logger, TInt error, const TDesC& errorString ) |
64 { |
67 { |
65 if( KErrNone == error ) logger->Log( KNoErrorString ); |
68 if( KErrNone == error ) logger->Log( KNoErrorString ); |
66 else logger->Log( errorString ); |
69 else logger->Log( errorString ); |
|
70 } |
|
71 |
|
72 void getcontentstatus ( TPtrC aContent , TInt& aBLstatus ,TInt& aINstatus) |
|
73 { |
|
74 RSqlDatabase sqlDB; |
|
75 RFs fssession; |
|
76 User::LeaveIfError( fssession.Connect() ); |
|
77 TFileName privatePath; |
|
78 TFileName datafile; |
|
79 fssession.CreatePrivatePath(EDriveC); |
|
80 fssession.PrivatePath(privatePath);//data caged path of loading process |
|
81 fssession.Close(); |
|
82 datafile.Copy(KDriveC); |
|
83 datafile.Append(privatePath); |
|
84 datafile.Append( KContentInfoFileName ); |
|
85 TInt err = sqlDB.Open( datafile ); |
|
86 |
|
87 if ( err ==KErrNone ) |
|
88 { |
|
89 TSqlScalarFullSelectQuery fullSelectQuery(sqlDB); |
|
90 |
|
91 TBuf<100> sql; |
|
92 // Query with INS column |
|
93 _LIT(KgetINstatusSqlFormat, "SELECT INS FROM table1 WHERE NAME = '"); |
|
94 _LIT(Kendtag, "'"); |
|
95 sql.Copy( KgetINstatusSqlFormat); |
|
96 sql.Append( aContent); |
|
97 sql.Append( Kendtag ); |
|
98 //sql.Format( KgetINstatusSqlFormat , aContent ); |
|
99 // Read INS as integer. |
|
100 aINstatus = fullSelectQuery.SelectIntL(sql); |
|
101 |
|
102 _LIT(KgetBLstatusSqlFormat, "SELECT BLS FROM table1 WHERE NAME = '"); |
|
103 sql.FillZ(); |
|
104 sql.Copy( KgetBLstatusSqlFormat); |
|
105 sql.Append( aContent); |
|
106 sql.Append( Kendtag ); |
|
107 //sql.Format( KgetBLstatusSqlFormat , aContent ); |
|
108 // Read BLS as integer. |
|
109 aBLstatus = fullSelectQuery.SelectIntL(sql); |
|
110 } |
|
111 sqlDB.Close(); |
67 } |
112 } |
68 // ----------------------------------------------------------------------------- |
113 // ----------------------------------------------------------------------------- |
69 // ?function_name ?description. |
114 // ?function_name ?description. |
70 // ?description |
115 // ?description |
71 // Returns: ?value_1: ?description |
116 // Returns: ?value_1: ?description |
113 // Copy this line for every implemented function. |
158 // Copy this line for every implemented function. |
114 // First string is the function name used in TestScripter script file. |
159 // First string is the function name used in TestScripter script file. |
115 // Second is the actual implementation member function. |
160 // Second is the actual implementation member function. |
116 ENTRY( "TestBlacklistPlugin", CCPixMWTester::TestBlacklistPluginL ), |
161 ENTRY( "TestBlacklistPlugin", CCPixMWTester::TestBlacklistPluginL ), |
117 ENTRY( "TestBlacklistPluginVersion", CCPixMWTester::TestBlacklistPluginVersionL ), |
162 ENTRY( "TestBlacklistPluginVersion", CCPixMWTester::TestBlacklistPluginVersionL ), |
118 ENTRY( "TestWatchdog",CCPixMWTester::TestWatchdogL ), |
163 ENTRY( "TestWatchdog",CCPixMWTester::TestWatchdogL ), |
|
164 ENTRY( "TestDeleteContentInfoDB",CCPixMWTester::TestDeleteContentInfoDBL ), |
|
165 ENTRY( "TestAddContent",CCPixMWTester::TestAddContentL ), |
|
166 ENTRY( "TestRemoveContent",CCPixMWTester::TestRemoveContentL ), |
|
167 ENTRY( "TestResetContent",CCPixMWTester::TestResetContentL ), |
|
168 ENTRY( "TestUpdateBLStatus",CCPixMWTester::TestUpdateBLStatusL ), |
|
169 ENTRY( "TestUpdateINStatus",CCPixMWTester::TestUpdateINStatusL ), |
119 //ADD NEW ENTRY HERE |
170 //ADD NEW ENTRY HERE |
120 // [test cases entries] - Do not remove |
171 // [test cases entries] - Do not remove |
121 |
172 |
122 }; |
173 }; |
123 |
174 |
213 p.Close(); |
264 p.Close(); |
214 doLog( iLog, err, KNoErrorString ); |
265 doLog( iLog, err, KNoErrorString ); |
215 return err; |
266 return err; |
216 } |
267 } |
217 // ----------------------------------------------------------------------------- |
268 // ----------------------------------------------------------------------------- |
|
269 // CCPixMWTester::TestDeleteContentInfoDBL |
|
270 // ----------------------------------------------------------------------------- |
|
271 // |
|
272 TInt CCPixMWTester::TestDeleteContentInfoDBL( CStifItemParser& /*aItem*/) |
|
273 { |
|
274 RFs fssession; |
|
275 CContentInfoMgr* contentInfoMgr = NULL; |
|
276 User::LeaveIfError( fssession.Connect() ); |
|
277 TFileName privatePath; |
|
278 TFileName datafile; |
|
279 fssession.CreatePrivatePath(EDriveC); |
|
280 fssession.PrivatePath(privatePath);//data caged path of loading process |
|
281 datafile.Copy(KDriveC); |
|
282 datafile.Append(privatePath); |
|
283 datafile.Append( KContentInfoFileName ); |
|
284 //delete the database file |
|
285 fssession.Delete( datafile ); |
|
286 TRAPD ( err , contentInfoMgr = CContentInfoMgr::NewL() ); |
|
287 delete contentInfoMgr; |
|
288 doLog( iLog, err, KNoErrorString ); |
|
289 return err; |
|
290 } |
|
291 // ----------------------------------------------------------------------------- |
|
292 // CCPixMWTester::TestAddContentL |
|
293 // ----------------------------------------------------------------------------- |
|
294 // |
|
295 TInt CCPixMWTester::TestAddContentL( CStifItemParser& aItem) |
|
296 { |
|
297 RFs fssession; |
|
298 TPtrC content; |
|
299 TInt err = KErrNone; |
|
300 aItem.GetNextString( content ); |
|
301 CContentInfoMgr* contentInfoMgr = CContentInfoMgr::NewL(); |
|
302 CContentInfo* contentinfo = CContentInfo::NewL(); |
|
303 //Add the content with given content name and 0 as BL status and 1 as IN status |
|
304 contentinfo->SetNameL( content ); |
|
305 contentinfo->SetBlacklistStatus( 0 ); |
|
306 contentinfo->SetIndexStatus( 1 ); |
|
307 contentInfoMgr->AddL( contentinfo ); |
|
308 delete contentinfo; |
|
309 //TBuf<50> name; |
|
310 //name.Copy( content.Ptr() ); |
|
311 //Find if the content exists |
|
312 TBool found = contentInfoMgr->FindL( content ); |
|
313 delete contentInfoMgr; |
|
314 if ( !found ) err = KErrNotFound; |
|
315 doLog( iLog, err, KNoErrorString ); |
|
316 return err; |
|
317 } |
|
318 // ----------------------------------------------------------------------------- |
|
319 // CCPixMWTester::TestRemoveContentL |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 TInt CCPixMWTester::TestRemoveContentL( CStifItemParser& aItem) |
|
323 { |
|
324 RFs fssession; |
|
325 TPtrC content; |
|
326 TInt err = KErrNotFound; |
|
327 aItem.GetNextString( content ); |
|
328 CContentInfoMgr* contentInfoMgr = CContentInfoMgr::NewL(); |
|
329 contentInfoMgr->ResetL(); |
|
330 CContentInfo* contentinfo = CContentInfo::NewL(); |
|
331 //Add the content with given content name and 0 as BL status and 1 as IN status |
|
332 contentinfo->SetNameL( content ); |
|
333 contentinfo->SetBlacklistStatus( 0 ); |
|
334 contentinfo->SetIndexStatus( 1 ); |
|
335 contentInfoMgr->AddL( contentinfo ); |
|
336 delete contentinfo; |
|
337 //check if the added content exists |
|
338 TBool found = contentInfoMgr->FindL( content ); |
|
339 if ( found ) |
|
340 { |
|
341 //remove the content from DB and find it |
|
342 contentInfoMgr->RemoveL( content ); |
|
343 found = contentInfoMgr->FindL( content ); |
|
344 if ( !found ) err = KErrNone; |
|
345 } |
|
346 delete contentInfoMgr; |
|
347 doLog( iLog, err, KNoErrorString ); |
|
348 return err; |
|
349 } |
|
350 // ----------------------------------------------------------------------------- |
|
351 // CCPixMWTester::TestResetContentL |
|
352 // ----------------------------------------------------------------------------- |
|
353 // |
|
354 TInt CCPixMWTester::TestResetContentL( CStifItemParser& aItem) |
|
355 { |
|
356 RFs fssession; |
|
357 TPtrC content; |
|
358 TInt err = KErrNotFound; |
|
359 aItem.GetNextString( content ); |
|
360 CContentInfoMgr* contentInfoMgr = CContentInfoMgr::NewL(); |
|
361 CContentInfo* contentinfo = CContentInfo::NewL(); |
|
362 //Add the content with given content name and 0 as BL status and 1 as IN status |
|
363 contentinfo->SetNameL( content ); |
|
364 contentinfo->SetBlacklistStatus( 0 ); |
|
365 contentinfo->SetIndexStatus( 1 ); |
|
366 contentInfoMgr->AddL( contentinfo ); |
|
367 delete contentinfo; |
|
368 //make sure there is some content exists in the database |
|
369 TInt count = contentInfoMgr->GetContentCountL(); |
|
370 if ( count ) |
|
371 { |
|
372 //reset the DB and get the count . the count should be 0 |
|
373 contentInfoMgr->ResetL(); |
|
374 count = contentInfoMgr->GetContentCountL( ); |
|
375 if ( !count ) err = KErrNone; |
|
376 } |
|
377 delete contentInfoMgr; |
|
378 doLog( iLog, err, KNoErrorString ); |
|
379 return err; |
|
380 } |
|
381 // ----------------------------------------------------------------------------- |
|
382 // CCPixMWTester::TestUpdateBLStatusL |
|
383 // ----------------------------------------------------------------------------- |
|
384 // |
|
385 TInt CCPixMWTester::TestUpdateBLStatusL( CStifItemParser& aItem) |
|
386 { |
|
387 RFs fssession; |
|
388 TPtrC content; |
|
389 TInt err = KErrNotFound; |
|
390 aItem.GetNextString( content ); |
|
391 CContentInfoMgr* contentInfoMgr = CContentInfoMgr::NewL(); |
|
392 contentInfoMgr->ResetL(); |
|
393 CContentInfo* contentinfo = CContentInfo::NewL(); |
|
394 //Add the content with given content name and 0 as BL status and 1 as IN status |
|
395 contentinfo->SetNameL( content ); |
|
396 contentinfo->SetBlacklistStatus( 0 ); |
|
397 contentinfo->SetIndexStatus( 1 ); |
|
398 contentInfoMgr->AddL( contentinfo ); |
|
399 delete contentinfo; |
|
400 //Update the blacklist status to 1 |
|
401 contentInfoMgr->UpdateBlacklistStatusL( content , 1); |
|
402 TInt blstatus =0,instatus = 0; |
|
403 getcontentstatus ( content , blstatus , instatus); |
|
404 if ( blstatus ) err = KErrNone; |
|
405 delete contentInfoMgr; |
|
406 doLog( iLog, err, KNoErrorString ); |
|
407 return err; |
|
408 } |
|
409 |
|
410 // ----------------------------------------------------------------------------- |
|
411 // CCPixMWTester::TestUpdateINStatusL |
|
412 // ----------------------------------------------------------------------------- |
|
413 // |
|
414 TInt CCPixMWTester::TestUpdateINStatusL( CStifItemParser& aItem) |
|
415 { |
|
416 RFs fssession; |
|
417 TPtrC content; |
|
418 TInt err = KErrNotFound; |
|
419 aItem.GetNextString( content ); |
|
420 CContentInfoMgr* contentInfoMgr = CContentInfoMgr::NewL(); |
|
421 contentInfoMgr->ResetL(); |
|
422 CContentInfo* contentinfo = CContentInfo::NewL(); |
|
423 //Add the content with given content name and 0 as BL status and 1 as IN status |
|
424 contentinfo->SetNameL( content ); |
|
425 contentinfo->SetBlacklistStatus( 0 ); |
|
426 contentinfo->SetIndexStatus( 1 ); |
|
427 contentInfoMgr->AddL( contentinfo ); |
|
428 delete contentinfo; |
|
429 //Update the Indexing status to 0 |
|
430 contentInfoMgr->UpdatePluginIndexStatusL( content , 0); |
|
431 TInt blstatus = 0,instatus = 1; |
|
432 getcontentstatus ( content , blstatus , instatus); |
|
433 if ( !blstatus ) err = KErrNone; |
|
434 delete contentInfoMgr; |
|
435 doLog( iLog, err, KNoErrorString ); |
|
436 return err; |
|
437 } |
|
438 // ----------------------------------------------------------------------------- |
218 // CCPixMWTester::?member_function |
439 // CCPixMWTester::?member_function |
219 // ?implementation_description |
440 // ?implementation_description |
220 // (other items were commented in a header). |
441 // (other items were commented in a header). |
221 // ----------------------------------------------------------------------------- |
442 // ----------------------------------------------------------------------------- |
222 // |
443 // |