landmarks/locationlandmarks/tsrc/LandmarkTestModule/src/FT_CPosTp130.cpp
changeset 40 16118e24b93b
parent 33 834e27cad510
--- a/landmarks/locationlandmarks/tsrc/LandmarkTestModule/src/FT_CPosTp130.cpp	Tue Jul 06 14:44:11 2010 +0300
+++ b/landmarks/locationlandmarks/tsrc/LandmarkTestModule/src/FT_CPosTp130.cpp	Wed Aug 18 10:11:45 2010 +0300
@@ -2,9 +2,9 @@
 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
-* under the terms of the License "Symbian Foundation License v1.0"
+* under the terms of "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
-* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
@@ -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();