loggingservices/eventlogger/test/src/t_logfile.cpp
branchRCL_3
changeset 9 667e88a979d7
parent 0 08ec8eefde2f
child 23 26645d81f48d
equal deleted inserted replaced
8:fa9941cf3867 9:667e88a979d7
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
    16 #include <s32file.h>
    16 #include <s32file.h>
    17 #include "TEST.H"
    17 #include "t_logutil2.h"
    18 
    18 
    19 /*
    19 /*
    20 This test may fail occasionally, especially after changing the LogEng server code. The reported error is KErrCorrupt.
    20 This test may fail occasionally, especially after changing the LogEng server code. The reported error is KErrCorrupt.
    21 The typical scenario when the test fails is:
    21 The typical scenario when the test fails is:
    22 1) Some of the test functions calls "__FILE_FAILNEXT(failCount++)"
    22 1) Some of the test functions calls "__FILE_FAILNEXT(failCount++)"
    43 
    43 
    44 may be found. I think that it is there to prevent exactly the problem with 
    44 may be found. I think that it is there to prevent exactly the problem with 
    45 SetErrorCondition()/DBMS interaction.
    45 SetErrorCondition()/DBMS interaction.
    46 */
    46 */
    47 
    47 
    48 #undef test  //there is a "test" macro which hides "RTest test" declaration.
    48 RTest TheTest(_L("t_logfile"));
    49 
       
    50 RTest test(_L("Log Client API File Failure Test Harness"));
       
    51 
    49 
    52 const TUid KTestEventUid = {0x10005393};
    50 const TUid KTestEventUid = {0x10005393};
    53 _LIT(KTestEventDesc1, "Event Type Description");
    51 _LIT(KTestEventDesc1, "Event Type Description");
    54 _LIT(KTestEventDesc2, "Changed Event Description");
    52 _LIT(KTestEventDesc2, "Changed Event Description");
    55 _LIT(KTestRemoteParty1, "Remote Party");
    53 _LIT(KTestRemoteParty1, "Remote Party");
    84 @SYMTestExpectedResults Test must not fail
    82 @SYMTestExpectedResults Test must not fail
    85 @SYMREQ                 REQ0000
    83 @SYMREQ                 REQ0000
    86 */
    84 */
    87 LOCAL_C void TestBasicL(CLogClient& aClient)
    85 LOCAL_C void TestBasicL(CLogClient& aClient)
    88 	{
    86 	{
    89 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1334 "));
    87 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1334 "));
    90 	CTestActive* active = new(ELeave)CTestActive();
    88 	CTestActive* active = new(ELeave)CTestActive();
    91 	CleanupStack::PushL(active);
    89 	CleanupStack::PushL(active);
    92 
    90 
    93 	CLogEvent* event = CLogEvent::NewL();
    91 	CLogEvent* event = CLogEvent::NewL();
    94 	CleanupStack::PushL(event);
    92 	CleanupStack::PushL(event);
   189 @SYMTestExpectedResults Test must not fail
   187 @SYMTestExpectedResults Test must not fail
   190 @SYMREQ                 REQ0000
   188 @SYMREQ                 REQ0000
   191 */
   189 */
   192 LOCAL_C void TestConstructionL()
   190 LOCAL_C void TestConstructionL()
   193 	{
   191 	{
   194 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0911 "));
   192 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0911 "));
   195 	CLogClient* client = NULL;
   193 	CLogClient* client = NULL;
   196 
   194 
   197 	TInt failCount = 0;
   195 	TInt failCount = 0;
   198 	TBool finished = EFalse;
   196 	TBool finished = EFalse;
   199 	TInt error;
   197 	TInt error;
   226 			TestUtils::DeleteDatabaseL();
   224 			TestUtils::DeleteDatabaseL();
   227 			}
   225 			}
   228 		}
   226 		}
   229 
   227 
   230 	delete client;
   228 	delete client;
   231     RDebug::Print(_L("The test has succeeded at iteration %d\n"), failCount);
   229 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   232 	}
   230 	}
   233 
   231 
   234 /**
   232 /**
   235 @SYMTestCaseID          SYSLIB-LOGENG-CT-0912
   233 @SYMTestCaseID          SYSLIB-LOGENG-CT-0912
   236 @SYMTestCaseDesc	    Adding an event type test,
   234 @SYMTestCaseDesc	    Adding an event type test,
   240 @SYMTestExpectedResults Test must not fail
   238 @SYMTestExpectedResults Test must not fail
   241 @SYMREQ                 REQ0000
   239 @SYMREQ                 REQ0000
   242 */
   240 */
   243 LOCAL_C void TestAddEventTypeL(CLogClient& aClient)
   241 LOCAL_C void TestAddEventTypeL(CLogClient& aClient)
   244 	{
   242 	{
   245 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0912 "));
   243 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0912 "));
   246 	CLogEventType* type = CLogEventType::NewL();
   244 	CLogEventType* type = CLogEventType::NewL();
   247 	CleanupStack::PushL(type);
   245 	CleanupStack::PushL(type);
   248 
   246 
   249 	type->SetUid(KTestEventUid);
   247 	type->SetUid(KTestEventUid);
   250 	type->SetDescription(KTestEventDesc1);
   248 	type->SetDescription(KTestEventDesc1);
   301 	aClient.AddEventType(*type, active->iStatus);
   299 	aClient.AddEventType(*type, active->iStatus);
   302 	CActiveScheduler::Start();
   300 	CActiveScheduler::Start();
   303 	TEST2(active->iStatus.Int(), KErrAlreadyExists);
   301 	TEST2(active->iStatus.Int(), KErrAlreadyExists);
   304 
   302 
   305 	CleanupStack::PopAndDestroy(2); // active, type
   303 	CleanupStack::PopAndDestroy(2); // active, type
   306     RDebug::Print(_L("The test has succeeded at iteration %d\n"), failCount);
   304 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   307 	}
   305 	}
   308 
   306 
   309 /**
   307 /**
   310 @SYMTestCaseID          SYSLIB-LOGENG-CT-0913
   308 @SYMTestCaseID          SYSLIB-LOGENG-CT-0913
   311 @SYMTestCaseDesc	    Getting an event type test.
   309 @SYMTestCaseDesc	    Getting an event type test.
   315 @SYMTestExpectedResults Test must not fail
   313 @SYMTestExpectedResults Test must not fail
   316 @SYMREQ                 REQ0000
   314 @SYMREQ                 REQ0000
   317 */
   315 */
   318 LOCAL_C void TestGetEventTypeL(CLogClient& aClient)
   316 LOCAL_C void TestGetEventTypeL(CLogClient& aClient)
   319 	{
   317 	{
   320 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0913 "));
   318 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0913 "));
   321 	CLogEventType* type = CLogEventType::NewL();
   319 	CLogEventType* type = CLogEventType::NewL();
   322 	CleanupStack::PushL(type);
   320 	CleanupStack::PushL(type);
   323 
   321 
   324 	type->SetUid(KTestEventUid);
   322 	type->SetUid(KTestEventUid);
   325 
   323 
   352 	TEST(type->Uid() == KTestEventUid);
   350 	TEST(type->Uid() == KTestEventUid);
   353 	TEST(type->Description() == KTestEventDesc1);
   351 	TEST(type->Description() == KTestEventDesc1);
   354 	TEST(type->LoggingEnabled());
   352 	TEST(type->LoggingEnabled());
   355 
   353 
   356 	CleanupStack::PopAndDestroy(2); // active, type
   354 	CleanupStack::PopAndDestroy(2); // active, type
   357     RDebug::Print(_L("The test has succeeded at iteration %d\n"), failCount);
   355 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   358 	}
   356 	}
   359 
   357 
   360 /**
   358 /**
   361 @SYMTestCaseID          SYSLIB-LOGENG-CT-0914
   359 @SYMTestCaseID          SYSLIB-LOGENG-CT-0914
   362 @SYMTestCaseDesc	    Changing an event type test,
   360 @SYMTestCaseDesc	    Changing an event type test,
   366 @SYMTestExpectedResults Test must not fail
   364 @SYMTestExpectedResults Test must not fail
   367 @SYMREQ                 REQ0000
   365 @SYMREQ                 REQ0000
   368 */
   366 */
   369 LOCAL_C void TestChangeEventTypeL(CLogClient& aClient)
   367 LOCAL_C void TestChangeEventTypeL(CLogClient& aClient)
   370 	{
   368 	{
   371 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0914 "));
   369 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0914 "));
   372 	CTestActive* active = new(ELeave)CTestActive();
   370 	CTestActive* active = new(ELeave)CTestActive();
   373 	CleanupStack::PushL(active);
   371 	CleanupStack::PushL(active);
   374 
   372 
   375 	CLogEventType* type = CLogEventType::NewL();
   373 	CLogEventType* type = CLogEventType::NewL();
   376 	CleanupStack::PushL(type);
   374 	CleanupStack::PushL(type);
   436 	TEST(type->Uid() == KTestEventUid);
   434 	TEST(type->Uid() == KTestEventUid);
   437 	TEST(type->Description() == KTestEventDesc2);
   435 	TEST(type->Description() == KTestEventDesc2);
   438 	TEST(type->LoggingEnabled() == EFalse);
   436 	TEST(type->LoggingEnabled() == EFalse);
   439 
   437 
   440 	CleanupStack::PopAndDestroy(2); // type, active
   438 	CleanupStack::PopAndDestroy(2); // type, active
   441     RDebug::Print(_L("The test has succeeded at iteration %d\n"), failCount);
   439 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   442 	}
   440 	}
   443 
   441 
   444 /**
   442 /**
   445 @SYMTestCaseID          SYSLIB-LOGENG-CT-0915
   443 @SYMTestCaseID          SYSLIB-LOGENG-CT-0915
   446 @SYMTestCaseDesc	    Deleting an event type test
   444 @SYMTestCaseDesc	    Deleting an event type test
   450 @SYMTestExpectedResults Test must not fail
   448 @SYMTestExpectedResults Test must not fail
   451 @SYMREQ                 REQ0000
   449 @SYMREQ                 REQ0000
   452 */
   450 */
   453 LOCAL_C void TestDeleteEventTypeL(CLogClient& aClient)
   451 LOCAL_C void TestDeleteEventTypeL(CLogClient& aClient)
   454 	{
   452 	{
   455 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0915 "));
   453 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0915 "));
   456 	CTestActive* active = new(ELeave)CTestActive();
   454 	CTestActive* active = new(ELeave)CTestActive();
   457 	CleanupStack::PushL(active);
   455 	CleanupStack::PushL(active);
   458 
   456 
   459 	CLogEventType* type = CLogEventType::NewL();
   457 	CLogEventType* type = CLogEventType::NewL();
   460 	CleanupStack::PushL(type);
   458 	CleanupStack::PushL(type);
   508 	aClient.GetEventType(*type, active->iStatus);
   506 	aClient.GetEventType(*type, active->iStatus);
   509 	CActiveScheduler::Start();
   507 	CActiveScheduler::Start();
   510 	TEST2(active->iStatus.Int(), KErrNotFound);
   508 	TEST2(active->iStatus.Int(), KErrNotFound);
   511 
   509 
   512 	CleanupStack::PopAndDestroy(2); // type, active
   510 	CleanupStack::PopAndDestroy(2); // type, active
   513     RDebug::Print(_L("The test has succeeded at iteration %d\n"), failCount);
   511 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   514 	}
   512 	}
   515 
   513 
   516 /**
   514 /**
   517 @SYMTestCaseID          SYSLIB-LOGENG-CT-0916
   515 @SYMTestCaseID          SYSLIB-LOGENG-CT-0916
   518 @SYMTestCaseDesc	    Adding an event test,
   516 @SYMTestCaseDesc	    Adding an event test,
   523 @SYMTestExpectedResults Test must not fail
   521 @SYMTestExpectedResults Test must not fail
   524 @SYMREQ                 REQ0000
   522 @SYMREQ                 REQ0000
   525 */
   523 */
   526 LOCAL_C void TestAddEventL(CLogClient& aClient)
   524 LOCAL_C void TestAddEventL(CLogClient& aClient)
   527 	{
   525 	{
   528 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0916 "));
   526 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0916 "));
   529 	// Ensure we always start from the same state
   527 	// Ensure we always start from the same state
   530     TestUtils::DeleteDatabaseL();
   528     TestUtils::DeleteDatabaseL();
   531 
   529 
   532 	CLogEventType* type = CLogEventType::NewL();
   530 	CLogEventType* type = CLogEventType::NewL();
   533 	CleanupStack::PushL(type);
   531 	CleanupStack::PushL(type);
   617 	aClient.GetEvent(*event, active->iStatus);
   615 	aClient.GetEvent(*event, active->iStatus);
   618 	CActiveScheduler::Start();
   616 	CActiveScheduler::Start();
   619 	TEST2(active->iStatus.Int(), KErrNone);
   617 	TEST2(active->iStatus.Int(), KErrNone);
   620 
   618 
   621 	CleanupStack::PopAndDestroy(3); // event, active, type
   619 	CleanupStack::PopAndDestroy(3); // event, active, type
   622     RDebug::Print(_L("The test has succeeded at iteration %d\n"), failCount);
   620 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   623 	}
   621 	}
   624 
   622 
   625 /**
   623 /**
   626 @SYMTestCaseID          SYSLIB-LOGENG-CT-0917
   624 @SYMTestCaseID          SYSLIB-LOGENG-CT-0917
   627 @SYMTestCaseDesc	    Get an events' information test
   625 @SYMTestCaseDesc	    Get an events' information test
   632 @SYMTestExpectedResults Test must not fail
   630 @SYMTestExpectedResults Test must not fail
   633 @SYMREQ                 REQ0000
   631 @SYMREQ                 REQ0000
   634 */
   632 */
   635 LOCAL_C void TestGetEventL(CLogClient& aClient)
   633 LOCAL_C void TestGetEventL(CLogClient& aClient)
   636 	{
   634 	{
   637 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0917 "));
   635 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0917 "));
   638 	CTestActive* active = new(ELeave)CTestActive();
   636 	CTestActive* active = new(ELeave)CTestActive();
   639 	CleanupStack::PushL(active);
   637 	CleanupStack::PushL(active);
   640 
   638 
   641 	CLogEvent* event = CLogEvent::NewL();
   639 	CLogEvent* event = CLogEvent::NewL();
   642 	CleanupStack::PushL(event);
   640 	CleanupStack::PushL(event);
   676 	TEST(event->Contact() == KTestContact1);
   674 	TEST(event->Contact() == KTestContact1);
   677 	TEST(event->Link() == KTestLink1);
   675 	TEST(event->Link() == KTestLink1);
   678 	TEST(event->Data() == KTestData1);
   676 	TEST(event->Data() == KTestData1);
   679 
   677 
   680 	CleanupStack::PopAndDestroy(2); // event, active
   678 	CleanupStack::PopAndDestroy(2); // event, active
   681     RDebug::Print(_L("The test has succeeded at iteration %d\n"), failCount);
   679 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   682 	}
   680 	}
   683 
   681 
   684 /**
   682 /**
   685 @SYMTestCaseID          SYSLIB-LOGENG-CT-0918
   683 @SYMTestCaseID          SYSLIB-LOGENG-CT-0918
   686 @SYMTestCaseDesc	    Changing an event type test
   684 @SYMTestCaseDesc	    Changing an event type test
   691 @SYMTestExpectedResults Test must not fail
   689 @SYMTestExpectedResults Test must not fail
   692 @SYMREQ                 REQ0000
   690 @SYMREQ                 REQ0000
   693 */
   691 */
   694 LOCAL_C void TestChangeEventL(CLogClient& aClient)
   692 LOCAL_C void TestChangeEventL(CLogClient& aClient)
   695 	{
   693 	{
   696 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0918 "));
   694 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0918 "));
   697 	CTestActive* active = new(ELeave)CTestActive();
   695 	CTestActive* active = new(ELeave)CTestActive();
   698 	CleanupStack::PushL(active);
   696 	CleanupStack::PushL(active);
   699 
   697 
   700 	CLogEvent* event = CLogEvent::NewL();
   698 	CLogEvent* event = CLogEvent::NewL();
   701 	CleanupStack::PushL(event);
   699 	CleanupStack::PushL(event);
   751 			{
   749 			{
   752 			active->StartL();
   750 			active->StartL();
   753 			aClient.GetEvent(*event, active->iStatus);
   751 			aClient.GetEvent(*event, active->iStatus);
   754 			CActiveScheduler::Start();
   752 			CActiveScheduler::Start();
   755 			if (active->iStatus != KErrNone) 
   753 			if (active->iStatus != KErrNone) 
   756 				RDebug::Print(_L("error code:%d failcount:%d\n"),active->iStatus.Int(),failCount);
   754 			    TheTest.Printf(_L("error code:%d failcount:%d\n"),active->iStatus.Int(),failCount);
   757 			TEST2(active->iStatus.Int(), KErrNone);
   755 			TEST2(active->iStatus.Int(), KErrNone);
   758 
   756 
   759 			TEST(event->Id() == 0);
   757 			TEST(event->Id() == 0);
   760 			TEST(event->Time() > TTime(0));
   758 			TEST(event->Time() > TTime(0));
   761 			TEST(event->Description() == KTestEventDesc1);
   759 			TEST(event->Description() == KTestEventDesc1);
   794 	TEST(event->Contact() == KTestContact2);
   792 	TEST(event->Contact() == KTestContact2);
   795 	TEST(event->Link() == KTestLink2);
   793 	TEST(event->Link() == KTestLink2);
   796 	TEST(event->Data() == KTestData2);
   794 	TEST(event->Data() == KTestData2);
   797 
   795 
   798 	CleanupStack::PopAndDestroy(2); // event, active
   796 	CleanupStack::PopAndDestroy(2); // event, active
   799     RDebug::Print(_L("The test has succeeded at iteration %d\n"), failCount);
   797 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   800 	}
   798 	}
   801 
   799 
   802 /**
   800 /**
   803 @SYMTestCaseID          SYSLIB-LOGENG-CT-0919
   801 @SYMTestCaseID          SYSLIB-LOGENG-CT-0919
   804 @SYMTestCaseDesc	    Deleting an event test,
   802 @SYMTestCaseDesc	    Deleting an event test,
   809 @SYMTestExpectedResults Test must not fail
   807 @SYMTestExpectedResults Test must not fail
   810 @SYMREQ                 REQ0000
   808 @SYMREQ                 REQ0000
   811 */
   809 */
   812 LOCAL_C void TestDeleteEventL(CLogClient& aClient)
   810 LOCAL_C void TestDeleteEventL(CLogClient& aClient)
   813 	{
   811 	{
   814 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0919 "));
   812 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0919 "));
   815 	CTestActive* active = new(ELeave)CTestActive();
   813 	CTestActive* active = new(ELeave)CTestActive();
   816 	CleanupStack::PushL(active);
   814 	CleanupStack::PushL(active);
   817 
   815 
   818 	CLogEvent* event = CLogEvent::NewL();
   816 	CLogEvent* event = CLogEvent::NewL();
   819 	CleanupStack::PushL(event);
   817 	CleanupStack::PushL(event);
   867 	aClient.GetEvent(*event, active->iStatus);
   865 	aClient.GetEvent(*event, active->iStatus);
   868 	CActiveScheduler::Start();
   866 	CActiveScheduler::Start();
   869 	TEST2(active->iStatus.Int(), KErrNotFound);
   867 	TEST2(active->iStatus.Int(), KErrNotFound);
   870 
   868 
   871 	CleanupStack::PopAndDestroy(2); // event, active
   869 	CleanupStack::PopAndDestroy(2); // event, active
   872     RDebug::Print(_L("The test has succeeded at iteration %d\n"), failCount);
   870 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   873 	}
   871 	}
   874 
   872 
   875 /**
   873 /**
   876 @SYMTestCaseID          SYSLIB-LOGENG-CT-0920
   874 @SYMTestCaseID          SYSLIB-LOGENG-CT-0920
   877 @SYMTestCaseDesc	    Getting the Log Engine configuration information test
   875 @SYMTestCaseDesc	    Getting the Log Engine configuration information test
   882 @SYMTestExpectedResults Test must not fail
   880 @SYMTestExpectedResults Test must not fail
   883 @SYMREQ                 REQ0000
   881 @SYMREQ                 REQ0000
   884 */
   882 */
   885 LOCAL_C void TestGetConfigL(CLogClient& aClient)
   883 LOCAL_C void TestGetConfigL(CLogClient& aClient)
   886 	{
   884 	{
   887 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0920 "));
   885 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0920 "));
   888 	CTestActive* active = new(ELeave)CTestActive();
   886 	CTestActive* active = new(ELeave)CTestActive();
   889 	CleanupStack::PushL(active);
   887 	CleanupStack::PushL(active);
   890 
   888 
   891 	TLogConfig config;
   889 	TLogConfig config;
   892 
   890 
   916 	TEST(config.iMaxEventAge > 0);
   914 	TEST(config.iMaxEventAge > 0);
   917 	TEST(config.iMaxLogSize > 0);
   915 	TEST(config.iMaxLogSize > 0);
   918 	TEST(config.iMaxRecentLogSize > 0);
   916 	TEST(config.iMaxRecentLogSize > 0);
   919 
   917 
   920 	CleanupStack::PopAndDestroy(); // active
   918 	CleanupStack::PopAndDestroy(); // active
   921     RDebug::Print(_L("The test has succeeded at iteration %d\n"), failCount);
   919 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
   922 	}
   920 	}
   923 
   921 
   924 /**
   922 /**
   925 @SYMTestCaseID          SYSLIB-LOGENG-CT-0921
   923 @SYMTestCaseID          SYSLIB-LOGENG-CT-0921
   926 @SYMTestCaseDesc	    Changing the configuration of Log Engine test,
   924 @SYMTestCaseDesc	    Changing the configuration of Log Engine test,
   931 @SYMTestExpectedResults Test must not fail
   929 @SYMTestExpectedResults Test must not fail
   932 @SYMREQ                 REQ0000
   930 @SYMREQ                 REQ0000
   933 */
   931 */
   934 LOCAL_C void TestChangeConfigL(CLogClient& aClient)
   932 LOCAL_C void TestChangeConfigL(CLogClient& aClient)
   935 	{
   933 	{
   936 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0921 "));
   934 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0921 "));
   937 	CTestActive* active = new(ELeave)CTestActive();
   935 	CTestActive* active = new(ELeave)CTestActive();
   938 	CleanupStack::PushL(active);
   936 	CleanupStack::PushL(active);
   939 
   937 
   940 	TLogConfig configOld;
   938 	TLogConfig configOld;
   941 
   939 
  1000 	TEST(config.iMaxLogSize == KTestMaxLogSize);
   998 	TEST(config.iMaxLogSize == KTestMaxLogSize);
  1001 	TEST(config.iMaxRecentLogSize == KTestMaxRecentLogSize);
   999 	TEST(config.iMaxRecentLogSize == KTestMaxRecentLogSize);
  1002 	TEST(config.iMaxEventAge == KTestMaxEventAge);
  1000 	TEST(config.iMaxEventAge == KTestMaxEventAge);
  1003 
  1001 
  1004 	CleanupStack::PopAndDestroy(); // active
  1002 	CleanupStack::PopAndDestroy(); // active
  1005     RDebug::Print(_L("The test has succeeded at iteration %d\n"), failCount);
  1003 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
  1006 	}
  1004 	}
  1007 
  1005 
  1008 /**
  1006 /**
  1009 @SYMTestCaseID          SYSLIB-LOGENG-CT-0922
  1007 @SYMTestCaseID          SYSLIB-LOGENG-CT-0922
  1010 @SYMTestCaseDesc	    Getting a standard string from the specified resource file test
  1008 @SYMTestCaseDesc	    Getting a standard string from the specified resource file test
  1015 @SYMTestExpectedResults Test must not fail
  1013 @SYMTestExpectedResults Test must not fail
  1016 @SYMREQ                 REQ0000
  1014 @SYMREQ                 REQ0000
  1017 */
  1015 */
  1018 LOCAL_C void TestGetStringL(CLogClient& aClient)
  1016 LOCAL_C void TestGetStringL(CLogClient& aClient)
  1019 	{
  1017 	{
  1020 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0922 "));
  1018 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0922 "));
  1021 	TBuf<KLogMaxSharedStringLength> str;
  1019 	TBuf<KLogMaxSharedStringLength> str;
  1022 	
  1020 	
  1023 	TInt failCount = 0;
  1021 	TInt failCount = 0;
  1024 	TBool finished = EFalse;
  1022 	TBool finished = EFalse;
  1025 	TInt error;
  1023 	TInt error;
  1041 			{
  1039 			{
  1042 			TEST2(error, KErrGeneral);
  1040 			TEST2(error, KErrGeneral);
  1043 			TEST(str.Length() == 0);
  1041 			TEST(str.Length() == 0);
  1044 			}
  1042 			}
  1045 		}
  1043 		}
  1046     RDebug::Print(_L("The test has succeeded at iteration %d\n"), failCount);
  1044 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
  1047 	}
  1045 	}
  1048 
  1046 
  1049 /**
  1047 /**
  1050 @SYMTestCaseID          SYSLIB-LOGENG-CT-0923
  1048 @SYMTestCaseID          SYSLIB-LOGENG-CT-0923
  1051 @SYMTestCaseDesc	    Clearing the Log Event test.
  1049 @SYMTestCaseDesc	    Clearing the Log Event test.
  1061 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
  1059 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
  1062 		, TBool aUseSimId = EFalse
  1060 		, TBool aUseSimId = EFalse
  1063 #endif		
  1061 #endif		
  1064 		)
  1062 		)
  1065 	{
  1063 	{
  1066 	test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0923 "));
  1064 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0923 "));
  1067 	TTime now;
  1065 	TTime now;
  1068 	now.UniversalTime();
  1066 	now.UniversalTime();
  1069 	
  1067 	
  1070 	TDateTime dt(now.DateTime());
  1068 	TDateTime dt(now.DateTime());
  1071 	dt.SetYear(dt.Year() - 1);
  1069 	dt.SetYear(dt.Year() - 1);
  1172 
  1170 
  1173 	active->StartL();
  1171 	active->StartL();
  1174 	aClient.GetEvent(*event1, active->iStatus);
  1172 	aClient.GetEvent(*event1, active->iStatus);
  1175 	CActiveScheduler::Start();
  1173 	CActiveScheduler::Start();
  1176 	if (active->iStatus != KErrNone) 
  1174 	if (active->iStatus != KErrNone) 
  1177 		RDebug::Print(_L("error code:%d\n"),active->iStatus.Int());
  1175 	    TheTest.Printf(_L("error code:%d\n"),active->iStatus.Int());
  1178 	TEST2(active->iStatus.Int(), KErrNone);
  1176 	TEST2(active->iStatus.Int(), KErrNone);
  1179 
  1177 
  1180 	active->StartL();
  1178 	active->StartL();
  1181 	aClient.GetEvent(*event2, active->iStatus);
  1179 	aClient.GetEvent(*event2, active->iStatus);
  1182 	CActiveScheduler::Start();
  1180 	CActiveScheduler::Start();
  1206 	aClient.GetEvent(*event2, active->iStatus);
  1204 	aClient.GetEvent(*event2, active->iStatus);
  1207 	CActiveScheduler::Start();
  1205 	CActiveScheduler::Start();
  1208 	TEST2(active->iStatus.Int(), KErrNotFound);
  1206 	TEST2(active->iStatus.Int(), KErrNotFound);
  1209 
  1207 
  1210 	CleanupStack::PopAndDestroy(5); // event4, event3, event2, event1, active
  1208 	CleanupStack::PopAndDestroy(5); // event4, event3, event2, event1, active
  1211     RDebug::Print(_L("The test has succeeded at iteration %d\n"), failCount);
  1209 	TheTest.Printf(_L("The test has succeeded at iteration %d\n"), failCount);
  1212 	}
  1210 	}
  1213 
  1211 
  1214 void doTestsL()
  1212 void doTestsL()
  1215 	{
  1213 	{
  1216 	TestUtils::Initialize(_L("T_LOGFILE"));
  1214 	TestUtils::Initialize(_L("t_logfile"));
  1217 
  1215 
  1218     test.Start(_L("Construction + create db"));
  1216     TheTest.Start(_L("Construction + create db"));
  1219 	TestUtils::DeleteDatabaseL();
  1217 	TestUtils::DeleteDatabaseL();
  1220 	TestConstructionL(); // Creates database
  1218 	TestConstructionL(); // Creates database
  1221     test.Next(_L("Construction + open db"));
  1219     TheTest.Next(_L("Construction + open db"));
  1222 	TestConstructionL(); // Opens existing database
  1220 	TestConstructionL(); // Opens existing database
  1223 	TestUtils::DeleteDatabaseL();
  1221 	TestUtils::DeleteDatabaseL();
  1224 	theLog.Write(_L8("Test 1 OK\n"));
  1222 	theLog.Write(_L8("Test 1 OK\n"));
  1225 
  1223 
  1226 	CLogClient* client = CLogClient::NewL(theFs);
  1224 	CLogClient* client = CLogClient::NewL(theFs);
  1227 	CleanupStack::PushL(client);
  1225 	CleanupStack::PushL(client);
  1228 
  1226 
  1229 	test.Next(_L("Add Event Type"));
  1227 	TheTest.Next(_L("Add Event Type"));
  1230 	TestAddEventTypeL(*client);
  1228 	TestAddEventTypeL(*client);
  1231 	theLog.Write(_L8("Test 2 OK\n"));
  1229 	theLog.Write(_L8("Test 2 OK\n"));
  1232 
  1230 
  1233 	test.Next(_L("Get Event Type"));
  1231 	TheTest.Next(_L("Get Event Type"));
  1234 	TestGetEventTypeL(*client);
  1232 	TestGetEventTypeL(*client);
  1235 	theLog.Write(_L8("Test 3 OK\n"));
  1233 	theLog.Write(_L8("Test 3 OK\n"));
  1236 
  1234 
  1237 	test.Next(_L("Change Event Type"));
  1235 	TheTest.Next(_L("Change Event Type"));
  1238 	TestChangeEventTypeL(*client);
  1236 	TestChangeEventTypeL(*client);
  1239 	theLog.Write(_L8("Test 4 OK\n"));
  1237 	theLog.Write(_L8("Test 4 OK\n"));
  1240 
  1238 
  1241 	test.Next(_L("Delete Event Type"));
  1239 	TheTest.Next(_L("Delete Event Type"));
  1242 	TestDeleteEventTypeL(*client);
  1240 	TestDeleteEventTypeL(*client);
  1243 	theLog.Write(_L8("Test 5 OK\n"));
  1241 	theLog.Write(_L8("Test 5 OK\n"));
  1244 
  1242 
  1245 	TestUtils::DeleteDatabaseL();
  1243 	TestUtils::DeleteDatabaseL();
  1246 
  1244 
  1247 	test.Next(_L("Add Event"));
  1245 	TheTest.Next(_L("Add Event"));
  1248 	TestAddEventL(*client);
  1246 	TestAddEventL(*client);
  1249 	theLog.Write(_L8("Test 6 OK\n"));
  1247 	theLog.Write(_L8("Test 6 OK\n"));
  1250 
  1248 
  1251 	test.Next(_L("Get Event"));
  1249 	TheTest.Next(_L("Get Event"));
  1252 	TestGetEventL(*client);
  1250 	TestGetEventL(*client);
  1253 	theLog.Write(_L8("Test 7 OK\n"));
  1251 	theLog.Write(_L8("Test 7 OK\n"));
  1254 
  1252 
  1255 	test.Next(_L("Change Event"));
  1253 	TheTest.Next(_L("Change Event"));
  1256 	TestChangeEventL(*client);
  1254 	TestChangeEventL(*client);
  1257 	theLog.Write(_L8("Test 8 OK\n"));
  1255 	theLog.Write(_L8("Test 8 OK\n"));
  1258 
  1256 
  1259 	test.Next(_L("Delete Event"));
  1257 	TheTest.Next(_L("Delete Event"));
  1260 	TestDeleteEventL(*client);
  1258 	TestDeleteEventL(*client);
  1261 	theLog.Write(_L8("Test 9 OK\n"));
  1259 	theLog.Write(_L8("Test 9 OK\n"));
  1262 
  1260 
  1263 	test.Next(_L("Get Config"));
  1261 	TheTest.Next(_L("Get Config"));
  1264 	TestGetConfigL(*client);
  1262 	TestGetConfigL(*client);
  1265 	theLog.Write(_L8("Test 10 OK\n"));
  1263 	theLog.Write(_L8("Test 10 OK\n"));
  1266 
  1264 
  1267 	test.Next(_L("Change Config"));
  1265 	TheTest.Next(_L("Change Config"));
  1268 	TestChangeConfigL(*client);
  1266 	TestChangeConfigL(*client);
  1269 	theLog.Write(_L8("Test 11 OK\n"));
  1267 	theLog.Write(_L8("Test 11 OK\n"));
  1270 
  1268 
  1271 	test.Next(_L("Get String"));
  1269 	TheTest.Next(_L("Get String"));
  1272 	TestGetStringL(*client);
  1270 	TestGetStringL(*client);
  1273 	theLog.Write(_L8("Test 12 OK\n"));
  1271 	theLog.Write(_L8("Test 12 OK\n"));
  1274 
  1272 
  1275 	test.Next(_L("Clear Event Log"));
  1273 	TheTest.Next(_L("Clear Event Log"));
  1276 	TestClearEventLogL(*client);
  1274 	TestClearEventLogL(*client);
  1277 	theLog.Write(_L8("Test 13 OK\n"));
  1275 	theLog.Write(_L8("Test 13 OK\n"));
  1278 
  1276 
  1279 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
  1277 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
  1280 	test.Next(_L("Clear Event Log + SimId"));
  1278 	TheTest.Next(_L("Clear Event Log + SimId"));
  1281 	TestClearEventLogL(*client, ETrue);
  1279 	TestClearEventLogL(*client, ETrue);
  1282 	theLog.Write(_L8("Test 14 OK\n"));
  1280 	theLog.Write(_L8("Test 14 OK\n"));
  1283 #endif	
  1281 #endif	
  1284 
  1282 
  1285 	CleanupStack::PopAndDestroy(); // client
  1283 	CleanupStack::PopAndDestroy(); // client