loggingservices/eventlogger/test/src/t_logapi.cpp
changeset 51 7d4490026038
parent 31 ba1c4f4a893f
--- a/loggingservices/eventlogger/test/src/t_logapi.cpp	Thu Aug 12 11:53:23 2010 +0100
+++ b/loggingservices/eventlogger/test/src/t_logapi.cpp	Mon Sep 27 11:59:56 2010 +0100
@@ -18,6 +18,7 @@
 #include <logview.h>
 #include <s32mem.h> 
 #include "t_logutil2.h"
+#include "t_logutil3.h"
 
 #define UNUSED_VAR(a) a = a
 
@@ -703,6 +704,7 @@
 
 
 #ifdef SYSLIBS_TEST
+
 /**
 @SYMTestCaseID          SYSLIB-LOGENG-UT-4015
 @SYMTestCaseDesc	    Test the behaviour implemented by PREQ2103
@@ -716,20 +718,25 @@
 */
 LOCAL_C void TestGetConfigSettingsFromRepositoryFileL(CLogClient& aClient)
 	{
-	//Note: if this test starts failing, then go and check the CentralRepository private data cage 
-	//(c:\\private\\10202be9 or z:\\private\\10202be9) if 101f401d.txt file is there.
-	//If it is then delete it and try the test again.
 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-UT-4015 "));
-	//Get the contact match count and contact name format.This should be from resource file.
-	TInt16 contactMatchCount;
-	TInt16 contactNameFormat;
+
+	TInt contactMatchCount1;
+	TLogContactNameFormat contactNameFormat1;
+	LogGetContactmatchCountAndNameFormatL(contactMatchCount1, contactNameFormat1);
+	TheTest.Printf(_L("Contact match count = %d, contact name format = %d\r\n"), contactMatchCount1, (TInt)contactNameFormat1);
+	//contactMatchCount1 and contactNameFormat1 are loaded directly from the repository, if exists.
+	//Otherwise they are initialzied with their default values.
+	//The LogEng server should load these resource values in a similar way.
+	//They will be stored in contactMatchCount2 and contactNameFormat2.  
+	TInt16 contactMatchCount2;
+	TInt16 contactNameFormat2;
 	RFs fs;
 	
 	LEAVE_IF_ERROR(fs.Connect());
 	CleanupClosePushL(fs);
 	
 	//Creating a new CLogClient Object make the server getting the contact match settings. 
-	//As the database is deleted it get them from the resource file.
+	//As the database is deleted it gets them from the LogEng repository.
 	CLogClient* client2 = CLogClient::NewL(fs);
 	CleanupStack::PushL(client2);
 	CleanupStack::PopAndDestroy(client2);
@@ -743,12 +750,12 @@
 	_LIT(KLogengTestFileNameFormat, "c:\\test\\test_logengconfig_format.ini");
 	LEAVE_IF_ERROR(resFileCount_reader.Open(fs, KLogengTestFileNameCount, EFileRead));
 	LEAVE_IF_ERROR(resFileFormat_reader.Open(fs, KLogengTestFileNameFormat, EFileRead));		
-	contactMatchCount = resFileCount_reader.ReadInt32L();
-	contactNameFormat = resFileFormat_reader.ReadInt32L();
+	contactMatchCount2 = resFileCount_reader.ReadInt32L();
+	contactNameFormat2 = resFileFormat_reader.ReadInt32L();
 		
 	//The settings should match the ones from resource file.
-	TEST(contactMatchCount == 8);
-	TEST(contactNameFormat == 0);
+	TEST2(contactMatchCount1, contactMatchCount2);
+	TEST2(contactNameFormat1, contactNameFormat2);
 		
 	CleanupStack::PopAndDestroy(&resFileFormat_reader);
 	CleanupStack::PopAndDestroy(&resFileCount_reader);
@@ -767,7 +774,7 @@
 	CActiveScheduler::Start();
 	TEST2(active->iStatus.Int(), KErrNone);
 	
-	//The config settings should match the ones from the resource file.
+	//The config settings should match the ones from the repository.
 	TEST(config.iMaxEventAge == 2592000);
 	TEST(config.iMaxLogSize == 1000);
 	TEST(config.iMaxRecentLogSize == 20);
@@ -824,15 +831,15 @@
 	CleanupClosePushL(repFileFormat_reader);
 	LEAVE_IF_ERROR(repFileCount_reader.Open(fs, KLogengTestFileNameCount, EFileRead));
 	LEAVE_IF_ERROR(repFileFormat_reader.Open(fs, KLogengTestFileNameFormat, EFileRead));		
-	contactMatchCount = repFileCount_reader.ReadInt32L();
-	contactNameFormat = repFileFormat_reader.ReadInt32L();
+	contactMatchCount2 = repFileCount_reader.ReadInt32L();
+	contactNameFormat2 = repFileFormat_reader.ReadInt32L();
 	CleanupStack::PopAndDestroy(&repFileFormat_reader);
 	CleanupStack::PopAndDestroy(&repFileCount_reader);
 	CleanupStack::PopAndDestroy(&fs);
 	
 	//The values should match the ones from the repository file.
-	TEST(contactMatchCount == 6);
-	TEST(contactNameFormat == 1);
+	TEST(contactMatchCount2 == 6);
+	TEST(contactNameFormat2 == 1);
 	
 	//delete the repository file c:\\private\\10202be9\\101f401d.txt.
 	_LIT(KCommandParameters2,		"c:\\private\\10202be9\\101f401d.txt;private\\10202be9\101f401d.txt;2");