701 CleanupStack::PopAndDestroy(2); // event, active |
702 CleanupStack::PopAndDestroy(2); // event, active |
702 } |
703 } |
703 |
704 |
704 |
705 |
705 #ifdef SYSLIBS_TEST |
706 #ifdef SYSLIBS_TEST |
|
707 |
706 /** |
708 /** |
707 @SYMTestCaseID SYSLIB-LOGENG-UT-4015 |
709 @SYMTestCaseID SYSLIB-LOGENG-UT-4015 |
708 @SYMTestCaseDesc Test the behaviour implemented by PREQ2103 |
710 @SYMTestCaseDesc Test the behaviour implemented by PREQ2103 |
709 @SYMTestPriority Medium |
711 @SYMTestPriority Medium |
710 @SYMTestActions Get the settings from logeng repository file / resource file. |
712 @SYMTestActions Get the settings from logeng repository file / resource file. |
714 REQ11127 |
716 REQ11127 |
715 REQ11128 |
717 REQ11128 |
716 */ |
718 */ |
717 LOCAL_C void TestGetConfigSettingsFromRepositoryFileL(CLogClient& aClient) |
719 LOCAL_C void TestGetConfigSettingsFromRepositoryFileL(CLogClient& aClient) |
718 { |
720 { |
719 //Note: if this test starts failing, then go and check the CentralRepository private data cage |
|
720 //(c:\\private\\10202be9 or z:\\private\\10202be9) if 101f401d.txt file is there. |
|
721 //If it is then delete it and try the test again. |
|
722 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-UT-4015 ")); |
721 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-UT-4015 ")); |
723 //Get the contact match count and contact name format.This should be from resource file. |
722 |
724 TInt16 contactMatchCount; |
723 TInt contactMatchCount1; |
725 TInt16 contactNameFormat; |
724 TLogContactNameFormat contactNameFormat1; |
|
725 LogGetContactmatchCountAndNameFormatL(contactMatchCount1, contactNameFormat1); |
|
726 TheTest.Printf(_L("Contact match count = %d, contact name format = %d\r\n"), contactMatchCount1, (TInt)contactNameFormat1); |
|
727 //contactMatchCount1 and contactNameFormat1 are loaded directly from the repository, if exists. |
|
728 //Otherwise they are initialzied with their default values. |
|
729 //The LogEng server should load these resource values in a similar way. |
|
730 //They will be stored in contactMatchCount2 and contactNameFormat2. |
|
731 TInt16 contactMatchCount2; |
|
732 TInt16 contactNameFormat2; |
726 RFs fs; |
733 RFs fs; |
727 |
734 |
728 LEAVE_IF_ERROR(fs.Connect()); |
735 LEAVE_IF_ERROR(fs.Connect()); |
729 CleanupClosePushL(fs); |
736 CleanupClosePushL(fs); |
730 |
737 |
731 //Creating a new CLogClient Object make the server getting the contact match settings. |
738 //Creating a new CLogClient Object make the server getting the contact match settings. |
732 //As the database is deleted it get them from the resource file. |
739 //As the database is deleted it gets them from the LogEng repository. |
733 CLogClient* client2 = CLogClient::NewL(fs); |
740 CLogClient* client2 = CLogClient::NewL(fs); |
734 CleanupStack::PushL(client2); |
741 CleanupStack::PushL(client2); |
735 CleanupStack::PopAndDestroy(client2); |
742 CleanupStack::PopAndDestroy(client2); |
736 |
743 |
737 //Read these settings via "reader" object. |
744 //Read these settings via "reader" object. |
741 CleanupClosePushL(resFileFormat_reader); |
748 CleanupClosePushL(resFileFormat_reader); |
742 _LIT(KLogengTestFileNameCount, "c:\\test\\test_logengconfig_count.ini"); |
749 _LIT(KLogengTestFileNameCount, "c:\\test\\test_logengconfig_count.ini"); |
743 _LIT(KLogengTestFileNameFormat, "c:\\test\\test_logengconfig_format.ini"); |
750 _LIT(KLogengTestFileNameFormat, "c:\\test\\test_logengconfig_format.ini"); |
744 LEAVE_IF_ERROR(resFileCount_reader.Open(fs, KLogengTestFileNameCount, EFileRead)); |
751 LEAVE_IF_ERROR(resFileCount_reader.Open(fs, KLogengTestFileNameCount, EFileRead)); |
745 LEAVE_IF_ERROR(resFileFormat_reader.Open(fs, KLogengTestFileNameFormat, EFileRead)); |
752 LEAVE_IF_ERROR(resFileFormat_reader.Open(fs, KLogengTestFileNameFormat, EFileRead)); |
746 contactMatchCount = resFileCount_reader.ReadInt32L(); |
753 contactMatchCount2 = resFileCount_reader.ReadInt32L(); |
747 contactNameFormat = resFileFormat_reader.ReadInt32L(); |
754 contactNameFormat2 = resFileFormat_reader.ReadInt32L(); |
748 |
755 |
749 //The settings should match the ones from resource file. |
756 //The settings should match the ones from resource file. |
750 TEST(contactMatchCount == 8); |
757 TEST2(contactMatchCount1, contactMatchCount2); |
751 TEST(contactNameFormat == 0); |
758 TEST2(contactNameFormat1, contactNameFormat2); |
752 |
759 |
753 CleanupStack::PopAndDestroy(&resFileFormat_reader); |
760 CleanupStack::PopAndDestroy(&resFileFormat_reader); |
754 CleanupStack::PopAndDestroy(&resFileCount_reader); |
761 CleanupStack::PopAndDestroy(&resFileCount_reader); |
755 |
762 |
756 //Get the config settings (Three config settings). |
763 //Get the config settings (Three config settings). |
765 active->StartL(); |
772 active->StartL(); |
766 aClient.GetConfig(config, active->iStatus); |
773 aClient.GetConfig(config, active->iStatus); |
767 CActiveScheduler::Start(); |
774 CActiveScheduler::Start(); |
768 TEST2(active->iStatus.Int(), KErrNone); |
775 TEST2(active->iStatus.Int(), KErrNone); |
769 |
776 |
770 //The config settings should match the ones from the resource file. |
777 //The config settings should match the ones from the repository. |
771 TEST(config.iMaxEventAge == 2592000); |
778 TEST(config.iMaxEventAge == 2592000); |
772 TEST(config.iMaxLogSize == 1000); |
779 TEST(config.iMaxLogSize == 1000); |
773 TEST(config.iMaxRecentLogSize == 20); |
780 TEST(config.iMaxRecentLogSize == 20); |
774 |
781 |
775 |
782 |
822 CleanupClosePushL(repFileCount_reader); |
829 CleanupClosePushL(repFileCount_reader); |
823 RFileReadStream repFileFormat_reader; |
830 RFileReadStream repFileFormat_reader; |
824 CleanupClosePushL(repFileFormat_reader); |
831 CleanupClosePushL(repFileFormat_reader); |
825 LEAVE_IF_ERROR(repFileCount_reader.Open(fs, KLogengTestFileNameCount, EFileRead)); |
832 LEAVE_IF_ERROR(repFileCount_reader.Open(fs, KLogengTestFileNameCount, EFileRead)); |
826 LEAVE_IF_ERROR(repFileFormat_reader.Open(fs, KLogengTestFileNameFormat, EFileRead)); |
833 LEAVE_IF_ERROR(repFileFormat_reader.Open(fs, KLogengTestFileNameFormat, EFileRead)); |
827 contactMatchCount = repFileCount_reader.ReadInt32L(); |
834 contactMatchCount2 = repFileCount_reader.ReadInt32L(); |
828 contactNameFormat = repFileFormat_reader.ReadInt32L(); |
835 contactNameFormat2 = repFileFormat_reader.ReadInt32L(); |
829 CleanupStack::PopAndDestroy(&repFileFormat_reader); |
836 CleanupStack::PopAndDestroy(&repFileFormat_reader); |
830 CleanupStack::PopAndDestroy(&repFileCount_reader); |
837 CleanupStack::PopAndDestroy(&repFileCount_reader); |
831 CleanupStack::PopAndDestroy(&fs); |
838 CleanupStack::PopAndDestroy(&fs); |
832 |
839 |
833 //The values should match the ones from the repository file. |
840 //The values should match the ones from the repository file. |
834 TEST(contactMatchCount == 6); |
841 TEST(contactMatchCount2 == 6); |
835 TEST(contactNameFormat == 1); |
842 TEST(contactNameFormat2 == 1); |
836 |
843 |
837 //delete the repository file c:\\private\\10202be9\\101f401d.txt. |
844 //delete the repository file c:\\private\\10202be9\\101f401d.txt. |
838 _LIT(KCommandParameters2, "c:\\private\\10202be9\\101f401d.txt;private\\10202be9\101f401d.txt;2"); |
845 _LIT(KCommandParameters2, "c:\\private\\10202be9\\101f401d.txt;private\\10202be9\101f401d.txt;2"); |
839 r = process.Create(KExecutableFileName, KCommandParameters2); |
846 r = process.Create(KExecutableFileName, KCommandParameters2); |
840 TEST(r == KErrNone); |
847 TEST(r == KErrNone); |