landmarks/locationlandmarks/tsrc/LandmarkTestModule/src/FT_CPosTp130.cpp
changeset 39 3efc7a0e8755
parent 35 1a92308afc46
--- a/landmarks/locationlandmarks/tsrc/LandmarkTestModule/src/FT_CPosTp130.cpp	Fri Jul 23 19:40:48 2010 +0530
+++ b/landmarks/locationlandmarks/tsrc/LandmarkTestModule/src/FT_CPosTp130.cpp	Fri Aug 06 19:34:22 2010 +0530
@@ -75,6 +75,12 @@
     // PrepareDatabases
     const TInt KNrOfDatabases = 5;
     RemoveAllLmDatabasesL();
+    // Get the list of Dbs remaining after removing the possible ones.
+    CPosLmDatabaseManager* dbMan = CPosLmDatabaseManager::NewL();
+        CleanupStack::PushL(dbMan);
+        iDbUris = dbMan->ListDatabasesLC();
+        iInitialDbCount = iDbUris->Count();
+        CleanupStack::PopAndDestroy(iDbUris);
     CopyTestDbFileL(KDb20);
     CopyTestDbFileL(KDb40);
     CopyTestDbFileL(KDb60);
@@ -82,13 +88,29 @@
     CopyTestDbFileL(KDb105);
     
     // List databases
-    CPosLmDatabaseManager* dbMan = CPosLmDatabaseManager::NewL();
-    CleanupStack::PushL(dbMan);
+    
     iDbUris = dbMan->ListDatabasesLC();
     CleanupStack::Pop(iDbUris);
-    AssertTrueSecL(iDbUris->Count() == KNrOfDatabases, _L("Wrong number of test databases!"));
+    AssertTrueSecL(iDbUris->Count() == iInitialDbCount+KNrOfDatabases, _L("Wrong number of test databases!"));
     CleanupStack::PopAndDestroy(dbMan);
     
+    // Get only the list of dburi in which this test case operations need to be performed
+        TInt dbUriCount = iDbUris->Count();
+        
+        for ( TInt i= 0;i < dbUriCount;i++)
+            {
+        iLog->Log((*iDbUris)[i]);
+        // Action to be performed only on the newly added dbs in this test case, therefore remove any other 
+        // db apart from the ones added in this test case from the iDbUris list
+            TPtrC dbUri((*iDbUris)[i]);
+                if ( (dbUri != KDb20Uri) && (dbUri != KDb40Uri) && (dbUri != KDb60Uri) &&
+                       ( dbUri != KDb80Uri) && (dbUri != KDb105Uri) )
+                    {
+                iDbUris->Delete(i);
+                    }
+
+            }
+    
     iDbSearcher = CPosLmMultiDbSearch::NewL(*iDbUris);
     
     // Initialize expected landmark search result
@@ -229,7 +251,7 @@
     CleanupStack::PushL(TCleanupItem(ResetAndDestroy, &iterators));
     
     TInt totalNrOfMatches(0), totalNrOfExpectedMatches(0);
-    for (TInt i = 0; i < KNrOfDatabases; i++)
+    for (TInt i = 0; i < iDbUris->Count(); i++)
         {
         // 2. Ask for the iterator for each database
         iterators.AppendL(iDbSearcher->MatchIteratorL(i));
@@ -246,7 +268,7 @@
     AssertTrueSecL(totalNrOfMatches == totalNrOfExpectedMatches, _L("totalNrOfMatches != totalNrOfExpectedMatches"));
     AssertTrueSecL(totalNrOfMatches == iDbSearcher->TotalNumOfMatches(), _L("totalNrOfMatches != iDbSearcher->TotalNumOfMatches()"));
     
-    for (TInt dbIndex = 0; dbIndex < KNrOfDatabases; dbIndex++)
+    for (TInt dbIndex = 0; dbIndex < iDbUris->Count(); dbIndex++)
         {
         // 5. Ask for the first item in each iterator
         TPosLmItemId id1 = iterators[dbIndex]->NextL();