os/persistentdata/loggingservices/eventlogger/test/src/t_logapi2.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/loggingservices/eventlogger/test/src/t_logapi2.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,1058 @@
     1.4 +// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// t_logapi2.cpp - LogEng API tests 
    1.18 +// 
    1.19 +//
    1.20 +#include <s32file.h>
    1.21 +#include <s32mem.h>
    1.22 +#include <e32math.h>
    1.23 +#include <bautils.h>
    1.24 +#include <logview.h>
    1.25 +#include "t_logutil2.h"
    1.26 +#include "LogServSqlStrings.h"
    1.27 +
    1.28 +RTest TheTest(_L("t_logapi2"));
    1.29 +
    1.30 +_LIT(KTestRemoteParty1, "Remote Party");
    1.31 +_LIT(KTestDirection1, "Direction");
    1.32 +_LIT(KTestStatus1, "Status");
    1.33 +_LIT(KTestSubject1, "Subject");
    1.34 +const TUid KTestEventUid = {0x10005393};
    1.35 +const TLogDurationType KTestDurationType1 = 1;
    1.36 +const TLogDuration KTestDuration1 = 0x1234;
    1.37 +const TLogContactItemId KTestContact1 = 0x1234;
    1.38 +const TLogLink KTestLink1 = 0x1234;
    1.39 +_LIT8(KTestData1, "ABCDEFGH");
    1.40 +const TLogFlags KTestFlags1 = 0x5;
    1.41 +_LIT(KEvNumber1, "11119999");
    1.42 +_LIT(KEvNumber2, "22226666");
    1.43 +const TLogDurationType KEvDurationType1 = 1;
    1.44 +const TLogDurationType KEvDurationType2 = 2;
    1.45 +const TLogContactItemId KEvContact1 = 1010;
    1.46 +const TLogLink KEvLink1 = 2000;
    1.47 +_LIT(KEvDesc1, "Event Type Description 1");
    1.48 +
    1.49 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
    1.50 +const TSimId KEvSimId1 = 3000000910U;//Bigger than KMaxTInt, to check that SQL statement formatting works as expected
    1.51 +const TSimId KEvSimId2 = 2911;
    1.52 +#endif
    1.53 +
    1.54 +const TInt KDiffEvCount = 10;
    1.55 +
    1.56 +//KEvDirection2 used together with KEvTypeUid guarantees that the properties of the event being changed
    1.57 +//match the conditions of one the LogEng server recent lists and thus the "recent list" related functionality 
    1.58 +//on the server side will be used.
    1.59 +_LIT(KEvDirection2, "Incoming");
    1.60 +
    1.61 +const TUid KEvTypeUid = {KLogCallEventType};
    1.62 +const TUid KEvTypeUidLoggingDisabled = {0x447422};
    1.63 +
    1.64 +enum TLogAddEventOps {ELogOpAddEvent, ELogOpAddEventInvalidType, ELogOpAddEventLoggingDisabled};
    1.65 +enum TLogGetEventOps {ELogOpGetEvent, ELogOpGetEventZeroId, ELogOpGetEventNotExists};
    1.66 +
    1.67 +TLogId TheEvId = -1;
    1.68 +TInt TheAddedEventCount = -1;
    1.69 +TInt TheMaxLogSize = -1;
    1.70 +
    1.71 +//The default max log size is 1000. But the test timeouts on hardware with max log size of 1000.
    1.72 +const TInt KMaxLogSize = 200;
    1.73 +const TInt KMaxRecentLogSize = 10; // Default recent log size is 20
    1.74 +const TInt KMaxPlusEvCount = 100; //Added events count on top of the max log size
    1.75 +
    1.76 +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1.77 +
    1.78 +//Add a new event type with "logging disabled"
    1.79 +void DoAddEventTypeL(CLogClient& aClient, CTestActive& aActive)
    1.80 +	{
    1.81 +	CLogEventType* type = CLogEventType::NewL();
    1.82 +	CleanupStack::PushL(type);
    1.83 +
    1.84 +	type->SetUid(KEvTypeUidLoggingDisabled);
    1.85 +	type->SetDescription(_L("110111011011"));
    1.86 +	type->SetLoggingEnabled(EFalse);
    1.87 +
    1.88 +	aClient.AddEventType(*type, aActive.iStatus);
    1.89 +	aActive.StartL();
    1.90 +	CActiveScheduler::Start();
    1.91 +	TEST2(aActive.iStatus.Int(), KErrNone);
    1.92 +
    1.93 +	CleanupStack::PopAndDestroy(type);
    1.94 +	}
    1.95 +
    1.96 +void DoSetNewMaxLogSizeL(CLogClient& aClient, CTestActive& aActive)
    1.97 +	{
    1.98 +	//Check what is the max log size.
    1.99 +	TLogConfig config;
   1.100 +	aActive.StartL();
   1.101 +	aClient.GetConfig(config, aActive.iStatus);
   1.102 +	CActiveScheduler::Start();
   1.103 +	TEST2(aActive.iStatus.Int(), KErrNone);
   1.104 +	//Set new max log size
   1.105 +	config.iMaxLogSize = KMaxLogSize;
   1.106 +	aActive.StartL();
   1.107 +	aClient.ChangeConfig(config, aActive.iStatus);
   1.108 +	CActiveScheduler::Start();
   1.109 +	TEST2(aActive.iStatus.Int(), KErrNone);
   1.110 +	//Test the new max log size
   1.111 +	aActive.StartL();
   1.112 +	aClient.GetConfig(config, aActive.iStatus);
   1.113 +	CActiveScheduler::Start();
   1.114 +	TEST2(aActive.iStatus.Int(), KErrNone);
   1.115 +	TEST2(config.iMaxLogSize, KMaxLogSize);
   1.116 +	//
   1.117 +	TheMaxLogSize = config.iMaxLogSize;
   1.118 +	TheAddedEventCount = config.iMaxLogSize + KMaxPlusEvCount;
   1.119 +	}
   1.120 +
   1.121 +void DoAddEventsL()
   1.122 +	{
   1.123 +	CLogClient* client = CLogClient::NewL(theFs);
   1.124 +	CleanupStack::PushL(client);
   1.125 +	CTestActive* active = new(ELeave)CTestActive();
   1.126 +	CleanupStack::PushL(active);
   1.127 +	
   1.128 +	//Set new max log size
   1.129 +	DoSetNewMaxLogSizeL(*client, *active);
   1.130 +
   1.131 +	//Add TheAddedEventCount events. Some of them with SimId, some - not.
   1.132 +	//This certainly will involve some log purging operations when the log size reaches the max.
   1.133 +	CLogEvent* event = CLogEvent::NewL();
   1.134 +	CleanupStack::PushL(event);
   1.135 +	event->SetEventType(KLogCallEventTypeUid);
   1.136 +	event->SetRemoteParty(KTestRemoteParty1);
   1.137 +	event->SetDirection(KTestDirection1);
   1.138 +	event->SetDurationType(KEvDurationType1);
   1.139 +	event->SetDuration(KTestDuration1);
   1.140 +	event->SetStatus(KTestStatus1);
   1.141 +	event->SetSubject(KTestSubject1);
   1.142 +	event->SetNumber(KEvNumber1);
   1.143 +	event->SetContact(KEvContact1);
   1.144 +	event->SetLink(KEvLink1);
   1.145 +	event->SetDescription(KEvDesc1);
   1.146 +	event->SetFlags(KTestFlags1);
   1.147 +	event->SetDataL(KTestData1);
   1.148 +	
   1.149 +	TTime st_time;
   1.150 +	st_time.UniversalTime();
   1.151 +	
   1.152 +	TheTest.Printf(_L("Added events:\n"));
   1.153 +	TInt diffEvCount = KDiffEvCount;
   1.154 +	for(TInt i=0;i<TheAddedEventCount;++i)
   1.155 +		{
   1.156 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
   1.157 +		event->SetSimId(KLogNullSimId);
   1.158 +#endif		
   1.159 +		event->SetDurationType(KEvDurationType1);
   1.160 +		event->SetNumber(KEvNumber1);
   1.161 +		if((i %2) == 0)
   1.162 +			{
   1.163 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
   1.164 +			event->SetSimId(KEvSimId1);
   1.165 +#endif			
   1.166 +			if((i > TheMaxLogSize / 2 + 1) && (i % 10) == 0 && --diffEvCount >= 0)
   1.167 +				{//Add after the second half because when the log grows above the max log size, the first events will be deleted
   1.168 +				event->SetDurationType(KEvDurationType2);
   1.169 +				event->SetNumber(KEvNumber2);
   1.170 +				}
   1.171 +			}
   1.172 +		active->StartL();
   1.173 +		client->AddEvent(*event, active->iStatus);
   1.174 +		CActiveScheduler::Start();
   1.175 +		TEST(!active->IsActive());
   1.176 +		TEST2(active->iStatus.Int(), KErrNone);
   1.177 +		if((i % 50) == 0 && i > 0)
   1.178 +			{
   1.179 +			TheTest.Printf(_L("%d\r"), i);
   1.180 +			}
   1.181 +		}
   1.182 +	TheTest.Printf(_L("%d\n"), TheAddedEventCount);
   1.183 +	
   1.184 +	TTime end_time;
   1.185 +	end_time.UniversalTime();
   1.186 +	
   1.187 +	CleanupStack::PopAndDestroy(event);
   1.188 +	
   1.189 +	CleanupStack::PopAndDestroy(active);
   1.190 +	CleanupStack::PopAndDestroy(client);
   1.191 +	
   1.192 +	TTimeIntervalMicroSeconds us = end_time.MicroSecondsFrom(st_time);
   1.193 +	TheTest.Printf(_L("%d events added. Time: %ld milliseconds\n"), TheAddedEventCount, us.Int64() / 1000);
   1.194 +	}
   1.195 +
   1.196 +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   1.197 +
   1.198 +/**
   1.199 +@SYMTestCaseID			PDS-LOGENG-UT-4042
   1.200 +@SYMTestCaseDesc		"Cancel operation" test.
   1.201 +						The test uses RLogTestSession to establish a connection with the EventViewer server.
   1.202 +						The the test initializes an "Add Event" opertaion.
   1.203 +						But instead of completing the operation the test cancels it. 
   1.204 +@SYMTestActions			"Cancel operation" test.
   1.205 +@SYMTestExpectedResults Test must not fail
   1.206 +@SYMTestPriority		Medium
   1.207 +@SYMREQ					REQ12747
   1.208 +*/
   1.209 +void CancelOperationTest()
   1.210 +	{
   1.211 +	RLogTestSession sess;
   1.212 +	TInt err = sess.Connect();
   1.213 +	TEST2(err, KErrNone);
   1.214 +	
   1.215 +	CLogEvent* event = NULL;
   1.216 +	TRAP(err, event = CLogEvent::NewL());
   1.217 +	TEST2(err, KErrNone);
   1.218 +	event->SetEventType(KTestEventUid);
   1.219 +	event->SetRemoteParty(KTestRemoteParty1);
   1.220 +	event->SetDirection(KTestDirection1);
   1.221 +	event->SetDurationType(KTestDurationType1);
   1.222 +	event->SetDuration(KTestDuration1);
   1.223 +	event->SetStatus(KTestStatus1);
   1.224 +	event->SetSubject(KTestSubject1);
   1.225 +	event->SetContact(KTestContact1);
   1.226 +	event->SetLink(KTestLink1);
   1.227 +	TRAP(err, event->SetDataL(KTestData1));
   1.228 +	TEST2(err, KErrNone);
   1.229 +	event->SetFlags(KTestFlags1);
   1.230 +	
   1.231 +	TBuf8<1024> buf;
   1.232 +	RDesWriteStream strm(buf);
   1.233 +	TRAP(err, event->ExternalizeL(strm));
   1.234 +	TEST2(err, KErrNone);
   1.235 +	TRAP(err, strm.CommitL());
   1.236 +	TEST2(err, KErrNone);
   1.237 +	
   1.238 +	TPckgBuf<TLogClientServerData> data;
   1.239 +	data().iOperationType = ELogOperationEventAdd;
   1.240 +	data().iOperationId = KLogNullOperationId;
   1.241 +	
   1.242 +	TRequestStatus stat;
   1.243 +	TIpcArgs args1(&data, &buf);
   1.244 +	sess.Send(ELogOperationInitiate, args1, stat);
   1.245 +	TEST2(stat.Int(), KRequestPending);
   1.246 +	TIpcArgs args2(&data);
   1.247 +	err = sess.Send(ELogOperationCancel, args2);
   1.248 +	TEST2(err, KErrCancel);
   1.249 +	User::WaitForRequest(stat);
   1.250 +	err = stat.Int();
   1.251 +	TEST2(err, KErrCancel);
   1.252 +	
   1.253 +	strm.Close();
   1.254 +	delete event;
   1.255 +	sess.Close();
   1.256 +	}
   1.257 +
   1.258 +/**
   1.259 +@SYMTestCaseID			PDS-LOGENG-UT-4029
   1.260 +@SYMTestCaseDesc		AddEvent() server side OOM test.
   1.261 +						This test uses the results from the previous test cases that
   1.262 +						the LogEng database contains TheMaxLogSize events.
   1.263 +						This ensures that the "purge main" functionality on the server side 
   1.264 +						will be used.
   1.265 +						The properties of the event being added are such (KEvDirection1 and KEvTypeUid) that 
   1.266 +						one of the LogServ recent lists will be used. This ensures that the "purge recent"
   1.267 +						LogEng server functionality will be used.
   1.268 +						The test, as any other of the LogEng server OOM tests, does not fully cover the used on the
   1.269 +						server side functions, because:
   1.270 +						1) CLogAddEvent will set the iEventAdded flag right after adding the event to the database.
   1.271 +						   After that, any OOM failure that occurs for example in "purge recent" related calls, will be
   1.272 +						   ignored.
   1.273 +						2) CLogEvent will use the CLogDuplicate active object for the "purge recent" action.
   1.274 +						   When CLogDuplicate fails with KErrNoMemory in DoRunL(), the error is ignored and not reported
   1.275 +						   back.
   1.276 +@SYMTestActions			AddEvent() server side OOM test.
   1.277 +@SYMTestExpectedResults Test must not fail
   1.278 +@SYMTestPriority		Medium
   1.279 +@SYMREQ					REQ12746
   1.280 +*/
   1.281 +void AddEventOomTestL(TLogAddEventOps aLogAddEventOp, TInt aExpectedError)
   1.282 +	{
   1.283 +	CLogClient* client = CLogClient::NewL(theFs);
   1.284 +	CleanupStack::PushL(client);
   1.285 +	CTestActive* active = new(ELeave)CTestActive();
   1.286 +	CleanupStack::PushL(active);
   1.287 +	CLogEvent* event = CLogEvent::NewL();
   1.288 +	CleanupStack::PushL(event);
   1.289 +
   1.290 +	if(aLogAddEventOp == ELogOpAddEventLoggingDisabled)
   1.291 +		{
   1.292 +		DoAddEventTypeL(*client, *active);
   1.293 +		}
   1.294 +	
   1.295 +	TTime now;
   1.296 +	now.UniversalTime();
   1.297 +
   1.298 +	TUid eventType = KEvTypeUid;
   1.299 +	if(aLogAddEventOp == ELogOpAddEventInvalidType)
   1.300 +		{
   1.301 +		eventType = TUid::Uid(0x445972);
   1.302 +		}
   1.303 +	else if(aLogAddEventOp == ELogOpAddEventLoggingDisabled)
   1.304 +		{
   1.305 +		eventType = KEvTypeUidLoggingDisabled;
   1.306 +		}
   1.307 +
   1.308 +	event->SetEventType(eventType);
   1.309 +	event->SetRemoteParty(KTestRemoteParty1);
   1.310 +	event->SetDirection(KTestDirection1);
   1.311 +	event->SetDurationType(KEvDurationType1);
   1.312 +	event->SetDuration(KTestDuration1);
   1.313 +	event->SetStatus(KTestStatus1);
   1.314 +	event->SetSubject(KTestSubject1);
   1.315 +	event->SetNumber(KEvNumber1);
   1.316 +	event->SetContact(KEvContact1);
   1.317 +	event->SetLink(KEvLink1);
   1.318 +	event->SetDescription(KEvDesc1);
   1.319 +	event->SetFlags(KTestFlags1);
   1.320 +	event->SetDataL(KTestData1);
   1.321 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
   1.322 +	event->SetSimId(KEvSimId1);
   1.323 +#endif	
   1.324 +	
   1.325 +	TInt failCount = 0;
   1.326 +	TBool finished = EFalse;
   1.327 +
   1.328 +	while(!finished)
   1.329 +		{
   1.330 +		__LOGSERV_UHEAP_FAILNEXT(++failCount);
   1.331 +		client->AddEvent(*event, active->iStatus);
   1.332 +		active->StartL();
   1.333 +		CActiveScheduler::Start();
   1.334 +
   1.335 +		if(active->iStatus.Int() == aExpectedError)
   1.336 +			{
   1.337 +			finished = ETrue;
   1.338 +			}
   1.339 +		
   1.340 +		__LOGSERV_UHEAP_RESET;
   1.341 +
   1.342 +		if(active->iStatus.Int() != aExpectedError)
   1.343 +			{
   1.344 +			TEST2(active->iStatus.Int(), KErrNoMemory);
   1.345 +			}
   1.346 +		}
   1.347 +
   1.348 +	TEST2(active->iStatus.Int(), aExpectedError);
   1.349 +	if(aLogAddEventOp == ELogOpAddEvent)
   1.350 +		{
   1.351 +		TEST(event->Time() >= now);
   1.352 +		active->StartL();
   1.353 +		client->GetEvent(*event, active->iStatus);
   1.354 +		CActiveScheduler::Start();
   1.355 +		TEST2(active->iStatus.Int(), KErrNone);
   1.356 +		TheEvId = event->Id();
   1.357 +		TEST(TheEvId > 0);
   1.358 +		}
   1.359 +
   1.360 +	CleanupStack::PopAndDestroy(event);
   1.361 +	CleanupStack::PopAndDestroy(active);
   1.362 +	CleanupStack::PopAndDestroy(client);
   1.363 +	
   1.364 +	TheTest.Printf(_L("===CLogClient::AddEvent() server side OOM test succeeded at iteration %d\n"), failCount);
   1.365 +	}
   1.366 +
   1.367 +/**
   1.368 +@SYMTestCaseID			PDS-LOGENG-UT-4030
   1.369 +@SYMTestCaseDesc		ChangeEvent() server side OOM test.
   1.370 +						This test uses the results from the previous test cases that
   1.371 +						the LogEng database contains TheMaxLogSize events.
   1.372 +						This ensures that the "purge main" functionality on the server side 
   1.373 +						will be used.
   1.374 +						The properties of the event being changed are such (KEvDirection2 and KEvTypeUid) that 
   1.375 +						one of the LogServ recent lists will be used. This ensures that the "purge recent"
   1.376 +						LogEng server functionality will be used.
   1.377 +@SYMTestActions			ChangeEvent() server side OOM test.
   1.378 +@SYMTestExpectedResults Test must not fail
   1.379 +@SYMTestPriority		Medium
   1.380 +@SYMREQ					REQ12746
   1.381 +*/
   1.382 +void ChangeEventOomTestL(TBool aEventExists)
   1.383 +	{
   1.384 +	CLogClient* client = CLogClient::NewL(theFs);
   1.385 +	CleanupStack::PushL(client);
   1.386 +	CTestActive* active = new(ELeave)CTestActive();
   1.387 +	CleanupStack::PushL(active);
   1.388 +	CLogEvent* event = CLogEvent::NewL();
   1.389 +	CleanupStack::PushL(event);
   1.390 +	
   1.391 +	event->SetId(TheEvId);
   1.392 +	active->StartL();
   1.393 +	client->GetEvent(*event, active->iStatus);
   1.394 +	CActiveScheduler::Start();
   1.395 +	TEST2(active->iStatus.Int(), KErrNone);
   1.396 +	TEST2(TheEvId, event->Id());
   1.397 +	event->SetDirection(KEvDirection2);
   1.398 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
   1.399 +	event->SetSimId(KEvSimId2);
   1.400 +#endif	
   1.401 +	
   1.402 +	TInt failCount = 0;
   1.403 +	TBool finished = EFalse;
   1.404 +
   1.405 +	if(!aEventExists)
   1.406 +		{//Search for a non-existing event in the OOM loop
   1.407 +		event->SetId(TheEvId + 5678);
   1.408 +		}
   1.409 +	
   1.410 +	while(!finished)
   1.411 +		{
   1.412 +		__LOGSERV_UHEAP_FAILNEXT(++failCount);
   1.413 +		client->ChangeEvent(*event, active->iStatus);
   1.414 +		active->StartL();
   1.415 +		CActiveScheduler::Start();
   1.416 +
   1.417 +		TInt err = active->iStatus.Int();
   1.418 +		if(err == (aEventExists ? KErrNone : KErrNotFound))
   1.419 +			{
   1.420 +			finished = ETrue;
   1.421 +			}
   1.422 +		
   1.423 +		__LOGSERV_UHEAP_RESET;
   1.424 +
   1.425 +		if(err != (aEventExists ? KErrNone : KErrNotFound))
   1.426 +			{
   1.427 +			TEST2(err, KErrNoMemory);
   1.428 +			}
   1.429 +		}
   1.430 +
   1.431 +	active->StartL();
   1.432 +	client->GetEvent(*event, active->iStatus);
   1.433 +	CActiveScheduler::Start();
   1.434 +	if(aEventExists)
   1.435 +		{
   1.436 +		TEST2(active->iStatus.Int(), KErrNone);
   1.437 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
   1.438 +		TEST2(event->SimId(), KEvSimId2);
   1.439 +#endif		
   1.440 +		}
   1.441 +	else
   1.442 +		{
   1.443 +		TEST2(active->iStatus.Int(), KErrNotFound);
   1.444 +		}
   1.445 +
   1.446 +	CleanupStack::PopAndDestroy(event);
   1.447 +	CleanupStack::PopAndDestroy(active);
   1.448 +	CleanupStack::PopAndDestroy(client);
   1.449 +	
   1.450 +	TheTest.Printf(_L("===CLogClient::ChangeEvent() server side OOM test succeeded at iteration %d\n"), failCount);
   1.451 +	}
   1.452 +
   1.453 +/**
   1.454 +@SYMTestCaseID			PDS-LOGENG-UT-4031
   1.455 +@SYMTestCaseDesc		DeleteEvent() server side OOM test.
   1.456 +						This test uses the results from the previous test cases that
   1.457 +						the LogEng database contains TheMaxLogSize events.
   1.458 +						This ensures that the "purge main" functionality on the server side 
   1.459 +						will be used.
   1.460 +@SYMTestActions			DeleteEvent() server side OOM test.
   1.461 +@SYMTestExpectedResults Test must not fail
   1.462 +@SYMTestPriority		Medium
   1.463 +@SYMREQ					REQ12746
   1.464 +*/
   1.465 +void DeleteEventOomTestL(TBool aEventExists)
   1.466 +	{
   1.467 +	CLogClient* client = CLogClient::NewL(theFs);
   1.468 +	CleanupStack::PushL(client);
   1.469 +	CTestActive* active = new(ELeave)CTestActive();
   1.470 +	CleanupStack::PushL(active);
   1.471 +	
   1.472 +	TInt failCount = 0;
   1.473 +	TBool finished = EFalse;
   1.474 +
   1.475 +	while(!finished)
   1.476 +		{
   1.477 +		__LOGSERV_UHEAP_FAILNEXT(++failCount);
   1.478 +		client->DeleteEvent(TheEvId, active->iStatus);
   1.479 +		active->StartL();
   1.480 +		CActiveScheduler::Start();
   1.481 +
   1.482 +		TInt err = active->iStatus.Int();
   1.483 +		if(err == (aEventExists ? KErrNone : KErrNotFound))
   1.484 +			{
   1.485 +			finished = ETrue;
   1.486 +			}
   1.487 +		
   1.488 +		__LOGSERV_UHEAP_RESET;
   1.489 +
   1.490 +		if(err != (aEventExists ? KErrNone : KErrNotFound))
   1.491 +			{
   1.492 +			TEST2(err, KErrNoMemory);
   1.493 +			}
   1.494 +		}
   1.495 +
   1.496 +	CLogEvent* event = CLogEvent::NewL();
   1.497 +	CleanupStack::PushL(event);
   1.498 +	event->SetId(TheEvId);
   1.499 +	active->StartL();
   1.500 +	client->GetEvent(*event, active->iStatus);
   1.501 +	CActiveScheduler::Start();
   1.502 +	TEST2(active->iStatus.Int(), KErrNotFound);
   1.503 +	CleanupStack::PopAndDestroy(event);
   1.504 +	
   1.505 +	CleanupStack::PopAndDestroy(active);
   1.506 +	CleanupStack::PopAndDestroy(client);
   1.507 +	
   1.508 +	TheTest.Printf(_L("===CLogClient::DeleteEvent() server side OOM test succeeded at iteration %d\n"), failCount);
   1.509 +	}
   1.510 +
   1.511 +/**
   1.512 +@SYMTestCaseID			PDS-LOGENG-UT-4032
   1.513 +@SYMTestCaseDesc		GetEvent() server side OOM test.
   1.514 +						This test uses the results from the previous test cases that
   1.515 +						the LogEng database contains TheMaxLogSize events.
   1.516 +						GetEvent() is executed in OOM loop.
   1.517 +@SYMTestActions			GetEvent() server side OOM test.
   1.518 +@SYMTestExpectedResults Test must not fail
   1.519 +@SYMTestPriority		Medium
   1.520 +@SYMREQ					REQ12746
   1.521 +*/
   1.522 +void GetEventOomTestL(TLogGetEventOps aGetEventOp, TInt aExpectedError)
   1.523 +	{
   1.524 +	CLogClient* client = CLogClient::NewL(theFs);
   1.525 +	CleanupStack::PushL(client);
   1.526 +	CTestActive* active = new(ELeave)CTestActive();
   1.527 +	CleanupStack::PushL(active);
   1.528 +	CLogEvent* event = CLogEvent::NewL();
   1.529 +	CleanupStack::PushL(event);
   1.530 +	
   1.531 +	event->SetId(aGetEventOp == ELogOpGetEvent ? TheEvId : (aGetEventOp == ELogOpGetEventNotExists ? 0x932271F : 0x0));
   1.532 +	
   1.533 +	TInt failCount = 0;
   1.534 +	TBool finished = EFalse;
   1.535 +
   1.536 +	while(!finished)
   1.537 +		{
   1.538 +		__LOGSERV_UHEAP_FAILNEXT(++failCount);
   1.539 +		client->GetEvent(*event, active->iStatus);
   1.540 +		active->StartL();
   1.541 +		CActiveScheduler::Start();
   1.542 +
   1.543 +		if(active->iStatus.Int() == aExpectedError)
   1.544 +			{
   1.545 +			finished = ETrue;
   1.546 +			}
   1.547 +		
   1.548 +		__LOGSERV_UHEAP_RESET;
   1.549 +
   1.550 +		if(active->iStatus.Int() != aExpectedError)
   1.551 +			{
   1.552 +			TEST2(active->iStatus.Int(), KErrNoMemory);
   1.553 +			}
   1.554 +		}
   1.555 +	
   1.556 +	TEST2(active->iStatus.Int(), aExpectedError);
   1.557 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
   1.558 +	if(aGetEventOp == ELogOpGetEvent)
   1.559 +		{
   1.560 +		TEST2(event->SimId(), KEvSimId2);
   1.561 +		}
   1.562 +#endif
   1.563 +	
   1.564 +	CleanupStack::PopAndDestroy(event);
   1.565 +	CleanupStack::PopAndDestroy(active);
   1.566 +	CleanupStack::PopAndDestroy(client);
   1.567 +	
   1.568 +	TheTest.Printf(_L("===CLogClient::GetEvent() server side OOM test succeeded at iteration %d\n"), failCount);
   1.569 +	}
   1.570 +
   1.571 +/**
   1.572 +@SYMTestCaseID			PDS-LOGENG-UT-4033
   1.573 +@SYMTestCaseDesc		Change Event Type test.
   1.574 +						The test attempts to change the type of an existing event.
   1.575 +						The attempt must fails with KErrPermissionDenied error. 
   1.576 +@SYMTestActions			Change Event Type test.
   1.577 +@SYMTestExpectedResults Test must not fail
   1.578 +@SYMTestPriority		Medium
   1.579 +@SYMREQ					REQ12746
   1.580 +*/
   1.581 +void ChangeStandardEventTypeTestL()
   1.582 +	{
   1.583 +	CLogClient* client = CLogClient::NewL(theFs);
   1.584 +	CleanupStack::PushL(client);
   1.585 +	CTestActive* active = new(ELeave)CTestActive();
   1.586 +	CleanupStack::PushL(active);
   1.587 +	
   1.588 +	CLogEventType* evType = CLogEventType::NewL(); 
   1.589 +	CleanupStack::PushL(evType);
   1.590 +	TUid uid = {KLogCallEventType};
   1.591 +	evType->SetUid(uid);
   1.592 +	evType->SetDescription(_L("aaaaaaaa"));
   1.593 +
   1.594 +	active->StartL();
   1.595 +	client->ChangeEventType(*evType, active->iStatus);
   1.596 +	CActiveScheduler::Start();
   1.597 +	TEST2(active->iStatus.Int(), KErrPermissionDenied);
   1.598 +	
   1.599 +	CleanupStack::PopAndDestroy(evType);
   1.600 +	
   1.601 +	CleanupStack::PopAndDestroy(active);
   1.602 +	CleanupStack::PopAndDestroy(client);
   1.603 +	}
   1.604 +
   1.605 +CLogFilter* DoCreateFilter1LC()
   1.606 +	{
   1.607 +	CLogFilter* filter = CLogFilter::NewL();
   1.608 +	CleanupStack::PushL(filter);
   1.609 +	
   1.610 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
   1.611 +	filter->SetSimId(KEvSimId2);
   1.612 +#endif	
   1.613 +	filter->SetDurationType(KEvDurationType2);
   1.614 +	filter->SetNumber(KEvNumber2);
   1.615 +	filter->SetStatus(KTestStatus1);
   1.616 +	filter->SetDirection(KTestDirection1);
   1.617 +	
   1.618 +	return filter;
   1.619 +	}
   1.620 +
   1.621 +CLogFilter* DoCreateFilter2LC()
   1.622 +	{
   1.623 +	CLogFilter* filter = CLogFilter::NewL();
   1.624 +	CleanupStack::PushL(filter);
   1.625 +
   1.626 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
   1.627 +	filter->SetSimId(KEvSimId1);
   1.628 +#endif	
   1.629 +	filter->SetDurationType(KEvDurationType1);
   1.630 +	filter->SetNumber(KEvNumber1);
   1.631 +	filter->SetStatus(KTestStatus1);
   1.632 +	filter->SetDirection(KTestDirection1);
   1.633 +	filter->SetEventType(KEvTypeUid);
   1.634 +	filter->SetRemoteParty(KTestRemoteParty1);
   1.635 +	filter->SetNullFields(ELogFlagsField);
   1.636 +
   1.637 +	return filter;
   1.638 +	}
   1.639 +
   1.640 +CLogFilter* DoCreateFilter3LC()
   1.641 +	{
   1.642 +	CLogFilter* filter = CLogFilter::NewL();
   1.643 +	CleanupStack::PushL(filter);
   1.644 +
   1.645 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
   1.646 +	filter->SetSimId(KEvSimId1);
   1.647 +#endif	
   1.648 +	filter->SetDurationType(KEvDurationType1);
   1.649 +	filter->SetNumber(KEvNumber1);
   1.650 +	filter->SetStatus(KTestStatus1);
   1.651 +	filter->SetDirection(KTestDirection1);
   1.652 +	filter->SetEventType(KEvTypeUid);
   1.653 +	filter->SetRemoteParty(KTestRemoteParty1);
   1.654 +	filter->SetContact(KEvContact1);
   1.655 +	filter->SetNullFields(ELogFlagsField);
   1.656 +
   1.657 +	return filter;
   1.658 +	}
   1.659 +
   1.660 +/**
   1.661 +@SYMTestCaseID			PDS-LOGENG-UT-4034
   1.662 +@SYMTestCaseDesc		Complex view filter set test.
   1.663 +						The test creates a set of filters using all event properties and duplicating some of them
   1.664 +						in the filters. Then sets the set of filters to a view and iterates over the view's events.
   1.665 +						The idea is to test as much as possible the server side filter processing in TLogFilterExprBuilder
   1.666 +						class implementation.
   1.667 +@SYMTestActions			Complex view filter set test.
   1.668 +@SYMTestExpectedResults Test must not fail
   1.669 +@SYMTestPriority		Medium
   1.670 +@SYMREQ					REQ12746
   1.671 +*/
   1.672 +void ComplexFilterSetTestL()
   1.673 +	{
   1.674 +	CLogClient* client = CLogClient::NewL(theFs);
   1.675 +	CleanupStack::PushL(client);
   1.676 +	CTestActive* active = new(ELeave)CTestActive();
   1.677 +	CleanupStack::PushL(active);
   1.678 +	CLogViewEvent* view = CLogViewEvent::NewL(*client);
   1.679 +	CleanupStack::PushL(view);
   1.680 +	CLogFilter* filter1 = DoCreateFilter1LC();
   1.681 +	CLogFilter* filter2 = DoCreateFilter2LC();
   1.682 +	CLogFilter* filter3 = DoCreateFilter3LC();
   1.683 +	CLogFilterList* filterList = new(ELeave)CLogFilterList;
   1.684 +	CleanupStack::PushL(filterList);
   1.685 +	filterList->AppendL(filter1);
   1.686 +	filterList->AppendL(filter2);
   1.687 +	filterList->AppendL(filter3);
   1.688 +	
   1.689 +	//Check the "copy filter list" operations
   1.690 +	CLogFilterList* filterList2 = filterList->CopyL();
   1.691 +	TEST2(filterList2->Count(), filterList->Count());
   1.692 +	delete filterList2;
   1.693 +	CLogFilterList* filterList3 = filterList->CopyLC();
   1.694 +	TEST2(filterList3->Count(), filterList->Count());
   1.695 +	CleanupStack::PopAndDestroy(filterList3);
   1.696 +	
   1.697 +	TTime st_time;
   1.698 +	st_time.UniversalTime();
   1.699 +	TBool res = view->SetFilterL(*filterList, active->iStatus);
   1.700 +	TEST(res);
   1.701 +	active->StartL();
   1.702 +	CActiveScheduler::Start();
   1.703 +	TEST2(active->iStatus.Int(), KErrNone);
   1.704 +	TInt count = view->CountL();
   1.705 +	TheTest.Printf(_L("===Events count: %d\n"), count);
   1.706 +	TTime end_time;
   1.707 +	end_time.UniversalTime();
   1.708 +	TTimeIntervalMicroSeconds us = end_time.MicroSecondsFrom(st_time);
   1.709 +	TheTest.Printf(_L("SetFilter(). Time: %ld milliseconds\n"), us.Int64() / 1000);
   1.710 +
   1.711 +	st_time.UniversalTime();
   1.712 +	if(view->FirstL(active->iStatus))
   1.713 +		{
   1.714 +		count = 0; 
   1.715 +		do
   1.716 +			{
   1.717 +			active->StartL();
   1.718 +			CActiveScheduler::Start();
   1.719 +			TEST2(active->iStatus.Int(), KErrNone);
   1.720 +			++count;
   1.721 +			}
   1.722 +		while(view->NextL(active->iStatus));
   1.723 +		}
   1.724 +	end_time.UniversalTime();
   1.725 +	us = end_time.MicroSecondsFrom(st_time);
   1.726 +	TheTest.Printf(_L("Event view walk completed. Events count: %d. Time: %ld milliseconds\n"), count, us.Int64() / 1000);
   1.727 +		
   1.728 +	CleanupStack::PopAndDestroy(filterList);
   1.729 +	CleanupStack::PopAndDestroy(filter3);
   1.730 +	CleanupStack::PopAndDestroy(filter2);
   1.731 +	CleanupStack::PopAndDestroy(filter1);
   1.732 +	CleanupStack::PopAndDestroy(view);
   1.733 +	CleanupStack::PopAndDestroy(active);
   1.734 +	CleanupStack::PopAndDestroy(client);
   1.735 +	}
   1.736 +
   1.737 +#ifdef _DEBUG
   1.738 +static void StopLogServerL()
   1.739 +    {
   1.740 +    static RLogTestSession logServSession;
   1.741 +    //this function doesn't have any effect on UREL builds as LogEng server doesn't 
   1.742 +    //support the transient mode in UREL builds 
   1.743 +    //Used for LogEng server side heap failure testing.
   1.744 +    TInt error = KErrNone;
   1.745 +      
   1.746 +    if(!logServSession.Handle())
   1.747 +        {
   1.748 +        error = logServSession.Connect();
   1.749 +        }
   1.750 +      
   1.751 +    // Is the server running?
   1.752 +    if(error == KErrNotFound)
   1.753 +        {
   1.754 +        return;
   1.755 +        }
   1.756 +    LEAVE_IF_ERROR(error);
   1.757 +      
   1.758 +    // Make the server transient
   1.759 +    TInt p0 = 1;
   1.760 +    TIpcArgs  ipcArgs(p0);
   1.761 +    LEAVE_IF_ERROR(logServSession.Send(ELogMakeTransient, ipcArgs));
   1.762 +      
   1.763 +    logServSession.Close();
   1.764 +      
   1.765 +    User::After(6 * 1000000); // Enough time for the server to exit
   1.766 +    }
   1.767 +#else//_DEBUG
   1.768 +static void StopLogServerL()
   1.769 +    {
   1.770 +    TheTest.Printf(_L("StopLogServerL(): the LogEng server cannot be stopped in release mode. ELogMakeTransient is a debug message.\n"));
   1.771 +    }
   1.772 +#endif//_DEBUG
   1.773 +
   1.774 +/**
   1.775 +@SYMTestCaseID          PDS-LOGENG-UT-4047
   1.776 +@SYMTestCaseDesc        Configuration value update test.
   1.777 +                        The test changes the configuration values & thne stops the log server. Start the 
   1.778 +                        server again & check if the configuration values are updated. 
   1.779 +                        Again restores the original value back. 
   1.780 +@SYMTestActions         Configuration value update test.
   1.781 +@SYMTestExpectedResults Test must not fail
   1.782 +@SYMTestPriority        Medium
   1.783 +@SYMREQ                 DEF142142
   1.784 +*/
   1.785 +void DoCheckUpdateConfigL()
   1.786 +    {
   1.787 + 
   1.788 +    CLogClient* client = CLogClient::NewL(theFs);
   1.789 +    CleanupStack::PushL(client);
   1.790 +    CTestActive* active = new(ELeave)CTestActive();
   1.791 +    CleanupStack::PushL(active);
   1.792 +
   1.793 +    //Check for updated configurations.
   1.794 +    TLogConfig config;
   1.795 +    active->StartL();
   1.796 +    client->GetConfig(config, active->iStatus);
   1.797 +    CActiveScheduler::Start();
   1.798 +    TEST2(active->iStatus.Int(), KErrNone);
   1.799 +    
   1.800 +    //Set new max log size
   1.801 +    TLogSize tmpMaxLogSize = config.iMaxLogSize;
   1.802 +    config.iMaxLogSize = KMaxLogSize;
   1.803 +    config.iMaxRecentLogSize = KMaxRecentLogSize;
   1.804 +    active->StartL();
   1.805 +    client->ChangeConfig(config, active->iStatus);
   1.806 +    CActiveScheduler::Start();
   1.807 +    TEST2(active->iStatus.Int(), KErrNone);
   1.808 +    
   1.809 +    //Stop the Server
   1.810 +    StopLogServerL();
   1.811 +    
   1.812 +    //Test the new max log size
   1.813 +    active->StartL();
   1.814 +    client->GetConfig(config, active->iStatus);
   1.815 +    CActiveScheduler::Start();
   1.816 +    TEST2(active->iStatus.Int(), KErrNone);
   1.817 +    TEST2(config.iMaxLogSize, KMaxLogSize);
   1.818 +    
   1.819 +    //Set original max log size
   1.820 +    config.iMaxLogSize = tmpMaxLogSize;
   1.821 +    active->StartL();
   1.822 +    client->ChangeConfig(config, active->iStatus);
   1.823 +    CActiveScheduler::Start();
   1.824 +    TEST2(active->iStatus.Int(), KErrNone);
   1.825 +    
   1.826 +    CleanupStack::PopAndDestroy(active);
   1.827 +    CleanupStack::PopAndDestroy(client);
   1.828 +    }
   1.829 +
   1.830 +//////////////////////////////////////////////////////////////////////////////////////////////////////
   1.831 +#ifdef SYSLIBS_TEST
   1.832 +
   1.833 +TLogId DoAddEvent2TestRecentListL(CLogClient& aClient, CTestActive& aActive)
   1.834 +	{
   1.835 +	CLogEvent* event = CLogEvent::NewL();
   1.836 +	CleanupStack::PushL(event);
   1.837 +	
   1.838 +	event->SetEventType(KLogCallEventTypeUid);
   1.839 +	event->SetRemoteParty(KLogRctTListRemoteParty);
   1.840 +	event->SetDirection(KLogRctTListDirection);
   1.841 +	event->SetDurationType(KLogRctTListDurationType);
   1.842 +	event->SetDuration(KTestDuration1);
   1.843 +	event->SetStatus(KLogRctTListStatus);
   1.844 +	event->SetSubject(KTestSubject1);
   1.845 +	event->SetNumber(KLogRctTListNumber);
   1.846 +	event->SetContact(KEvContact1);
   1.847 +	event->SetLink(KEvLink1);
   1.848 +	event->SetDescription(KEvDesc1);
   1.849 +	event->SetFlags(KLogRctTListFlags);
   1.850 +	event->SetDataL(KTestData1);
   1.851 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
   1.852 +	event->SetSimId(KLogRctTListSimId);
   1.853 +#endif	
   1.854 +	
   1.855 +	aActive.StartL();
   1.856 +	aClient.AddEvent(*event, aActive.iStatus);
   1.857 +	CActiveScheduler::Start();
   1.858 +	TEST(!aActive.IsActive());
   1.859 +	TEST2(aActive.iStatus.Int(), KErrNone);
   1.860 +	TLogId logId = event->Id();
   1.861 +	
   1.862 +	//Get the just added event
   1.863 +	aActive.StartL();
   1.864 +	aClient.GetEvent(*event, aActive.iStatus);
   1.865 +	CActiveScheduler::Start();
   1.866 +	TEST2(aActive.iStatus.Int(), KErrNone);
   1.867 +	
   1.868 +	CleanupStack::PopAndDestroy(event);
   1.869 +	
   1.870 +	return logId;
   1.871 +	}
   1.872 +
   1.873 +TLogId DoAddEvent2TestRecentListL()
   1.874 +	{
   1.875 +	CLogClient* client = CLogClient::NewL(theFs);
   1.876 +	CleanupStack::PushL(client);
   1.877 +	CTestActive* active = new(ELeave)CTestActive();
   1.878 +	CleanupStack::PushL(active);
   1.879 +
   1.880 +	TLogId logId = DoAddEvent2TestRecentListL(*client, *active);
   1.881 +
   1.882 +	CleanupStack::PopAndDestroy(active);
   1.883 +	CleanupStack::PopAndDestroy(client);
   1.884 +	
   1.885 +	return logId;
   1.886 +	}
   1.887 +
   1.888 +struct TLogViewTestObserver : public MLogViewChangeObserver
   1.889 +	{
   1.890 +	TLogViewTestObserver() : 
   1.891 +		iIdAdded(-1),
   1.892 +		iIdChanged(-1),
   1.893 +		iIdDeleted(-1)
   1.894 +		{
   1.895 +		}
   1.896 +	virtual void HandleLogViewChangeEventAddedL(TLogId aId, TInt, TInt, TInt)
   1.897 +		{
   1.898 +		iIdAdded = aId;
   1.899 +		}
   1.900 +	virtual void HandleLogViewChangeEventChangedL(TLogId aId, TInt, TInt, TInt)
   1.901 +		{
   1.902 +		iIdChanged = aId;
   1.903 +		}
   1.904 +	virtual void HandleLogViewChangeEventDeletedL(TLogId aId, TInt, TInt, TInt)
   1.905 +		{
   1.906 +		iIdDeleted = aId;
   1.907 +		}
   1.908 +	TLogId iIdAdded;
   1.909 +	TLogId iIdChanged;
   1.910 +	TLogId iIdDeleted;
   1.911 +	};
   1.912 +	
   1.913 +void DoViewEventFromTestRecentListL(TLogId aId1, TLogId aId2)
   1.914 +	{
   1.915 +	CLogClient* client = CLogClient::NewL(theFs);
   1.916 +	CleanupStack::PushL(client);
   1.917 +	CTestActive* active = new(ELeave)CTestActive();
   1.918 +	CleanupStack::PushL(active);
   1.919 +	CLogViewRecent* view = CLogViewRecent::NewL(*client);
   1.920 +	CleanupStack::PushL(view);
   1.921 +	TLogViewTestObserver observer;
   1.922 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(*client, observer);
   1.923 +	CleanupStack::PushL(duplicate);
   1.924 +	
   1.925 +	TBool rc = view->SetRecentListL(KLogRctTListId, active->iStatus);
   1.926 +	active->StartL();
   1.927 +	CActiveScheduler::Start();
   1.928 +	TEST2(active->iStatus.Int(), KErrNone);
   1.929 +	
   1.930 +	TInt count = 0; 
   1.931 +	if(view->FirstL(active->iStatus))
   1.932 +		{
   1.933 +		do
   1.934 +			{
   1.935 +			active->StartL();
   1.936 +			CActiveScheduler::Start();
   1.937 +			TEST2(active->iStatus.Int(), KErrNone);
   1.938 +			const CLogEvent& e = view->Event();
   1.939 +			TEST2(aId2, e.Id());
   1.940 +			++count;
   1.941 +			}
   1.942 +		while(view->NextL(active->iStatus));
   1.943 +		}
   1.944 +	TEST2(count, 1);//The second event is a duplicate => not in the list
   1.945 +		
   1.946 +	//Check duplicates 
   1.947 +	active->StartL();
   1.948 +	rc = view->DuplicatesL(*duplicate, active->iStatus);
   1.949 +	TEST(rc);
   1.950 +	CActiveScheduler::Start();
   1.951 +	TEST2(active->iStatus.Int(), KErrNone);
   1.952 +	TEST2(duplicate->CountL(), 1);
   1.953 +	
   1.954 +	//Test the duplicated event
   1.955 +	rc = duplicate->FirstL(active->iStatus);
   1.956 +	TEST(rc);
   1.957 +	active->StartL();
   1.958 +	CActiveScheduler::Start();
   1.959 +	TEST2(active->iStatus.Int(), KErrNone);
   1.960 +	const CLogEvent& e2 = duplicate->Event();
   1.961 +	TEST2(aId1, e2.Id());
   1.962 +
   1.963 +	//Get the event
   1.964 +	CLogEvent* event = CLogEvent::NewL();
   1.965 +	CleanupStack::PushL(event);
   1.966 +	event->SetId(aId1);
   1.967 +	active->StartL();
   1.968 +	client->GetEvent(*event, active->iStatus);
   1.969 +	CActiveScheduler::Start();
   1.970 +	TEST2(active->iStatus.Int(), KErrNone);
   1.971 +	
   1.972 +	//Change the event. The observer should register the change. 
   1.973 +	event->SetDataL(_L8("123444555"));
   1.974 +	client->ChangeEvent(*event, active->iStatus);
   1.975 +	active->StartL();
   1.976 +	CActiveScheduler::Start();
   1.977 +	TEST2(active->iStatus.Int(), KErrNone);
   1.978 +	TEST2(observer.iIdChanged, event->Id());
   1.979 +
   1.980 +	//Add  a new event to the recent list. This operation should be detected as a "delete" one by the observer 
   1.981 +	//and the existing event should be cleared from the recent list.
   1.982 +	TLogId logId = DoAddEvent2TestRecentListL(*client, *active);
   1.983 +	TEST2(observer.iIdDeleted, aId1);
   1.984 +	TEST(logId != observer.iIdDeleted);
   1.985 +	//No added events detected by the observer
   1.986 +	TEST2(observer.iIdAdded, -1);
   1.987 +	
   1.988 +	//Cleanup
   1.989 +	CleanupStack::PopAndDestroy(event);
   1.990 +	CleanupStack::PopAndDestroy(duplicate);
   1.991 +	CleanupStack::PopAndDestroy(view);
   1.992 +	CleanupStack::PopAndDestroy(active);
   1.993 +	CleanupStack::PopAndDestroy(client);
   1.994 +	}
   1.995 +
   1.996 +/**
   1.997 +@SYMTestCaseID			PDS-LOGENG-UT-4035
   1.998 +@SYMTestCaseDesc		Complex recent list test.
   1.999 +						The test works only if SYSLIBS_TEST macro is defined, in which case the server side will
  1.1000 +						create a recent list with a lot of fields.
  1.1001 +						The test case will add 2 events with the same properties, such that both will be added
  1.1002 +						to that test recent list. Because the second event is a match of the first one and matches 
  1.1003 +						the recent list "duplicates" mask, the second event will be marked as a duplicate of the
  1.1004 +						first one. After adding the events a view is used to check for their presence.
  1.1005 +@SYMTestActions			Complex recent list test.
  1.1006 +@SYMTestExpectedResults Test must not fail
  1.1007 +@SYMTestPriority		Medium
  1.1008 +@SYMREQ					REQ12747
  1.1009 +*/
  1.1010 +void ComplexRecentListTestL()
  1.1011 +	{
  1.1012 +	TLogId logId1 = DoAddEvent2TestRecentListL();
  1.1013 +	TLogId logId2 = DoAddEvent2TestRecentListL();
  1.1014 +	DoViewEventFromTestRecentListL(logId1, logId2);
  1.1015 +	}
  1.1016 +
  1.1017 +#endif//SYSLIBS_TEST
  1.1018 +//////////////////////////////////////////////////////////////////////////////////////////////////////
  1.1019 +
  1.1020 +void doTestsL()
  1.1021 +	{
  1.1022 +    TestUtils::Initialize(_L("t_logapi2"));
  1.1023 +	TestUtils::DeleteDatabaseL();
  1.1024 +	//
  1.1025 +	TheTest.Start(_L("Preparation. Adding 200 events..."));
  1.1026 +	DoAddEventsL();
  1.1027 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4029: AddEvent() server side OOM test when logged events count is max (200)"));
  1.1028 +	AddEventOomTestL(ELogOpAddEvent, KErrNone);
  1.1029 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4029: AddEvent() server side OOM test when logged events count is max (200). Invalid event type."));
  1.1030 +	AddEventOomTestL(ELogOpAddEventInvalidType, KErrNotFound);
  1.1031 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4030: AddEvent() server side OOM test when logged events count is max (200). Logging disabled."));
  1.1032 +	AddEventOomTestL(ELogOpAddEventLoggingDisabled, KErrNotSupported);
  1.1033 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4030: ChangeEvent() server side OOM test when logged events count is max (200). The event does exist."));
  1.1034 +	ChangeEventOomTestL(ETrue);
  1.1035 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4030: ChangeEvent() server side OOM test when logged events count is max (200). The event does not exist."));
  1.1036 +	ChangeEventOomTestL(EFalse);
  1.1037 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4032: GetEvent() server side OOM test when logged events count is max (200)."));
  1.1038 +	GetEventOomTestL(ELogOpGetEvent, KErrNone);
  1.1039 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4032: GetEvent() server side OOM test when logged events count is max (200). The event does not exist."));
  1.1040 +	GetEventOomTestL(ELogOpGetEventNotExists, KErrNotFound);
  1.1041 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4032: GetEvent() server side OOM test when logged events count is max (200). The event id is 0."));
  1.1042 +	GetEventOomTestL(ELogOpGetEventZeroId, KErrNotFound);
  1.1043 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4031: DeleteEvent() server side OOM test when logged events count is max (200). The event does exist."));
  1.1044 +	DeleteEventOomTestL(ETrue);
  1.1045 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4031: DeleteEvent() server side OOM test when logged events count is max (200). The event does not exist."));
  1.1046 +	DeleteEventOomTestL(EFalse);
  1.1047 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4033: Attempt to change one of the standard event types."));
  1.1048 +	ChangeStandardEventTypeTestL();
  1.1049 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4042: \"Cancel Operation\" test"));
  1.1050 +	CancelOperationTest();
  1.1051 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4034: Complex filter set test."));
  1.1052 +	ComplexFilterSetTestL();
  1.1053 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4047: Check for updated configuration values"));
  1.1054 +	DoCheckUpdateConfigL();
  1.1055 +#ifdef SYSLIBS_TEST
  1.1056 +	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4035: Complex recent list test."));
  1.1057 +	ComplexRecentListTestL();
  1.1058 +#endif
  1.1059 +	//
  1.1060 +	TestUtils::DeleteDatabaseL();
  1.1061 +	}