1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/loggingservices/eventlogger/test/src/t_logheap.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,2558 @@
1.4 +// Copyright (c) 2002-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 +//
1.18 +
1.19 +#include <s32file.h>
1.20 +#include <logview.h>
1.21 +#include "t_logutil2.h"
1.22 +
1.23 +RTest TheTest(_L("t_logheap"));
1.24 +
1.25 +const TUid KTestEventUid = {0x10005393};
1.26 +_LIT(KTestEventDesc1, "Event Type Description");
1.27 +_LIT(KTestEventDesc2, "Changed Event Description");
1.28 +_LIT(KTestRemoteParty1, "Remote Party");
1.29 +_LIT(KTestRemoteParty2, "Changed Remote Party");
1.30 +_LIT(KTestDirection1, "Direction");
1.31 +_LIT(KTestDirection2, "Changed Direction");
1.32 +const TLogDurationType KTestDurationType1 = 1;
1.33 +const TLogDurationType KTestDurationType2 = 2;
1.34 +const TLogDuration KTestDuration1 = 0x1234;
1.35 +const TLogDuration KTestDuration2 = 0x1234567;
1.36 +_LIT(KTestStatus1, "Status");
1.37 +_LIT(KTestStatus2, "Changed Status");
1.38 +_LIT(KTestSubject1, "Subject");
1.39 +_LIT(KTestSubject2, "Changed Subject");
1.40 +_LIT(KTestNumber1, "Number");
1.41 +_LIT(KTestNumber2, "Changed Number");
1.42 +const TLogContactItemId KTestContact1 = 0x1234;
1.43 +const TLogContactItemId KTestContact2 = 0x1234567;
1.44 +const TLogLink KTestLink1 = 0x1234;
1.45 +const TLogLink KTestLink2 = 0x1234567;
1.46 +_LIT8(KTestData1, "ABCDEFGH");
1.47 +_LIT8(KTestData2, "IJKLMNOPQRSTUVWXYZ");
1.48 +const TLogSize KTestMaxLogSize = 0xFFF;
1.49 +const TLogRecentSize KTestMaxRecentLogSize = 0xF;
1.50 +const TLogAge KTestMaxEventAge = 0xFFFFFFF;
1.51 +
1.52 +_LIT(KCreateDb, "Create Db");
1.53 +_LIT(KOpenDb, "Open Db");
1.54 +
1.55 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
1.56 +_LIT(KServerSide, "server side");
1.57 +_LIT(KClientSide, "client side");
1.58 +#endif
1.59 +
1.60 +/**
1.61 +@SYMTestCaseID SYSLIB-LOGENG-CT-0884
1.62 +@SYMTestCaseDesc Tests for functionality of CLogEvent,CTestActive classes
1.63 +@SYMTestPriority High
1.64 +@SYMTestActions Tests for no memory errors.
1.65 +@SYMTestExpectedResults Test must not fail
1.66 +@SYMREQ REQ0000
1.67 +*/
1.68 +LOCAL_C void TestStartup1L()
1.69 + {
1.70 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0884 "));
1.71 + CLogClient* client = CLogClient::NewL(theFs);
1.72 + CleanupStack::PushL(client);
1.73 +
1.74 + CTestActive* active = new(ELeave)CTestActive();
1.75 + CleanupStack::PushL(active);
1.76 +
1.77 + CLogEvent* event = CLogEvent::NewL();
1.78 + CleanupStack::PushL(event);
1.79 +
1.80 + TTime now;
1.81 + now.UniversalTime();
1.82 +
1.83 + event->SetEventType(KLogCallEventTypeUid);
1.84 +
1.85 + active->StartL();
1.86 + client->AddEvent(*event, active->iStatus);
1.87 + CActiveScheduler::Start();
1.88 + TEST2(active->iStatus.Int(), KErrNone);
1.89 +
1.90 + TBool finished = EFalse;
1.91 + TInt failCount = 0;
1.92 +
1.93 + while(!finished)
1.94 + {
1.95 + __UHEAP_FAILNEXT(++failCount);
1.96 + client->ChangeEvent(*event, active->iStatus);
1.97 + __UHEAP_RESET;
1.98 + active->StartL();
1.99 + CActiveScheduler::Start();
1.100 +
1.101 + if (active->iStatus == KErrNone)
1.102 + {
1.103 + finished = ETrue;
1.104 + }
1.105 + else
1.106 + {
1.107 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.108 + }
1.109 + }
1.110 +
1.111 + CleanupStack::PopAndDestroy(3); // client, active, event
1.112 + TheTest.Printf(_L("===CLogClient::ChangeEvent() client side OOM test succeeded at iteration %d\n"), failCount);
1.113 + }
1.114 +
1.115 +/**
1.116 +@SYMTestCaseID SYSLIB-LOGENG-CT-0885
1.117 +@SYMTestCaseDesc Tests for CLogEvent,CTestActive classes
1.118 +@SYMTestPriority High
1.119 +@SYMTestActions Tests for all basic functions of CLogEvent,CTestActive classes.Check for ErrNone flag.
1.120 +@SYMTestExpectedResults Test must not fail
1.121 +@SYMREQ REQ0000
1.122 +*/
1.123 +LOCAL_C void TestBasicL(CLogClient& aClient)
1.124 + {
1.125 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0885 "));
1.126 +
1.127 + CTestActive* active = new(ELeave)CTestActive();
1.128 + CleanupStack::PushL(active);
1.129 +
1.130 + CLogEvent* event = CLogEvent::NewL();
1.131 + CleanupStack::PushL(event);
1.132 +
1.133 + TTime now;
1.134 + now.UniversalTime();
1.135 +
1.136 + event->SetEventType(KLogCallEventTypeUid);
1.137 +
1.138 + active->StartL();
1.139 + aClient.AddEvent(*event, active->iStatus);
1.140 + CActiveScheduler::Start();
1.141 + TEST2(active->iStatus.Int(), KErrNone);
1.142 +
1.143 + TEST(event->EventType() == KLogCallEventTypeUid);
1.144 + TEST(event->Description().Length() > 0);
1.145 + TEST(event->Time() >= now);
1.146 + now = event->Time();
1.147 +
1.148 + TLogId id = event->Id();
1.149 +
1.150 + event->SetRemoteParty(KTestRemoteParty1);
1.151 + event->SetDirection(KTestDirection1);
1.152 + event->SetDurationType(KTestDurationType1);
1.153 + event->SetDuration(KTestDuration1);
1.154 + event->SetStatus(KTestStatus1);
1.155 + event->SetSubject(KTestSubject1);
1.156 + event->SetNumber(KTestNumber1);
1.157 + event->SetContact(KTestContact1);
1.158 + event->SetLink(KTestLink1);
1.159 + event->SetDataL(KTestData1);
1.160 +
1.161 + active->StartL();
1.162 + aClient.ChangeEvent(*event, active->iStatus);
1.163 + CActiveScheduler::Start();
1.164 + TEST2(active->iStatus.Int(), KErrNone);
1.165 +
1.166 + TEST(event->Id() == id);
1.167 + TEST(event->EventType() == KLogCallEventTypeUid);
1.168 + TEST(event->Description().Length() > 0);
1.169 + TEST(event->Time() == now);
1.170 + TEST(event->RemoteParty() == KTestRemoteParty1);
1.171 + TEST(event->Direction() == KTestDirection1);
1.172 + TEST(event->DurationType() == KTestDurationType1);
1.173 + TEST(event->Duration() == KTestDuration1);
1.174 + TEST(event->Status() == KTestStatus1);
1.175 + TEST(event->Subject() == KTestSubject1);
1.176 + TEST(event->Number() == KTestNumber1);
1.177 + TEST(event->Contact() == KTestContact1);
1.178 + TEST(event->Link() == KTestLink1);
1.179 + TEST(event->Data() == KTestData1);
1.180 +
1.181 + CleanupStack::PopAndDestroy(); // event;
1.182 +
1.183 + event = CLogEvent::NewL();
1.184 + CleanupStack::PushL(event);
1.185 +
1.186 + event->SetId(id);
1.187 +
1.188 + active->StartL();
1.189 + aClient.GetEvent(*event, active->iStatus);
1.190 + CActiveScheduler::Start();
1.191 + TEST2(active->iStatus.Int(), KErrNone);
1.192 +
1.193 + TEST(event->Id() == id);
1.194 + TEST(event->EventType() == KLogCallEventTypeUid);
1.195 + TEST(event->Description().Length() > 0);
1.196 + TEST(event->Time() == now);
1.197 + TEST(event->RemoteParty() == KTestRemoteParty1);
1.198 + TEST(event->Direction() == KTestDirection1);
1.199 + TEST(event->DurationType() == KTestDurationType1);
1.200 + TEST(event->Duration() == KTestDuration1);
1.201 + TEST(event->Status() == KTestStatus1);
1.202 + TEST(event->Subject() == KTestSubject1);
1.203 + TEST(event->Number() == KTestNumber1);
1.204 + TEST(event->Contact() == KTestContact1);
1.205 + TEST(event->Link() == KTestLink1);
1.206 + TEST(event->Data() == KTestData1);
1.207 +
1.208 + active->StartL();
1.209 + aClient.DeleteEvent(id, active->iStatus);
1.210 + CActiveScheduler::Start();
1.211 + TEST2(active->iStatus.Int(), KErrNone);
1.212 +
1.213 + active->StartL();
1.214 + aClient.GetEvent(*event, active->iStatus);
1.215 + CActiveScheduler::Start();
1.216 + TEST2(active->iStatus.Int(), KErrNotFound);
1.217 +
1.218 + CleanupStack::PopAndDestroy(2, active); // event, active
1.219 + }
1.220 +
1.221 +/**
1.222 +@SYMTestCaseID SYSLIB-LOGENG-CT-0886
1.223 +@SYMTestCaseDesc Tests for new CLogClient object creation
1.224 +@SYMTestPriority High
1.225 +@SYMTestActions Create a CLogClient object on heap.Check for memory errors
1.226 +@SYMTestExpectedResults Test must not fail
1.227 +@SYMREQ REQ0000
1.228 +*/
1.229 +LOCAL_C void TestConstruction1L(TBool aCreateDb)
1.230 + {
1.231 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0886 "));
1.232 +
1.233 + if(aCreateDb)
1.234 + {
1.235 + TestUtils::DeleteDatabaseL();
1.236 + }
1.237 +
1.238 + CLogClient* client = NULL;
1.239 + TInt failCount = 0;
1.240 +
1.241 + TBool finished = EFalse;
1.242 + TInt error;
1.243 +
1.244 + while(!finished)
1.245 + {
1.246 + __UHEAP_FAILNEXT(++failCount);
1.247 +
1.248 + TRAP(error, client = CLogClient::NewL(theFs));
1.249 +
1.250 + __UHEAP_RESET;
1.251 +
1.252 + if (error == KErrNone)
1.253 + {
1.254 + finished = ETrue;
1.255 + TestBasicL(*client);
1.256 + }
1.257 + else
1.258 + TEST2(error, KErrNoMemory);
1.259 + }
1.260 +
1.261 + delete client;
1.262 + TheTest.Printf(_L("==CLogClient::NewL()+\"%S\" client side OOM test succeeded at iteration %d\n"), aCreateDb ? &KCreateDb : &KOpenDb, failCount);
1.263 + }
1.264 +
1.265 +/**s
1.266 +@SYMTestCaseID SYSLIB-LOGENG-CT-0887
1.267 +@SYMTestCaseDesc Tests for creation of new CLogClient object
1.268 +@SYMTestPriority High
1.269 +@SYMTestActions Check for memory errors and error in the environment
1.270 +@SYMTestExpectedResults Test must not fail
1.271 +@SYMREQ REQ0000
1.272 +*/
1.273 +LOCAL_C void TestConstruction3L(TBool aCreateDb)
1.274 + {
1.275 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0887 "));
1.276 +
1.277 + if(aCreateDb)
1.278 + {
1.279 + TestUtils::DeleteDatabaseL();
1.280 + }
1.281 +
1.282 + CLogClient* client = NULL;
1.283 +
1.284 + TInt failCount = 0;
1.285 +
1.286 + TBool finished = EFalse;
1.287 + TInt error;
1.288 +
1.289 + while(!finished)
1.290 + {
1.291 + __LOGSERV_UHEAP_FAILNEXT(++failCount);
1.292 +
1.293 + TRAP(error, client = CLogClient::NewL(theFs));
1.294 +
1.295 + __LOGSERV_UHEAP_RESET;
1.296 +
1.297 + if (error == KErrNone)
1.298 + {
1.299 + finished = ETrue;
1.300 + TestBasicL(*client);
1.301 + }
1.302 + else
1.303 + TEST2(error, KErrNoMemory);
1.304 + }
1.305 +
1.306 + delete client;
1.307 + TheTest.Printf(_L("==CLogClient::NewL()+\"%S\" server side OOM test succeeded at iteration %d\n"), aCreateDb ? &KCreateDb : &KOpenDb, failCount);
1.308 + }
1.309 +
1.310 +/**
1.311 +@SYMTestCaseID SYSLIB-LOGENG-CT-0888
1.312 +@SYMTestCaseDesc Tests for CLogClient::AddEventType() function
1.313 +@SYMTestPriority High
1.314 +@SYMTestActions Tests for adding events to the log
1.315 + Check for memory errors and error in the environment
1.316 +@SYMTestExpectedResults Test must not fail
1.317 +@SYMREQ REQ0000
1.318 +*/
1.319 +LOCAL_C void TestAddEventType1L()
1.320 + {
1.321 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0888 "));
1.322 +
1.323 + CLogClient* client = CLogClient::NewL(theFs);
1.324 + CleanupStack::PushL(client);
1.325 +
1.326 + CLogEventType* type = CLogEventType::NewL();
1.327 + CleanupStack::PushL(type);
1.328 +
1.329 + type->SetUid(KTestEventUid);
1.330 + type->SetDescription(KTestEventDesc1);
1.331 + type->SetLoggingEnabled(ETrue);
1.332 +
1.333 + CTestActive* active = new(ELeave)CTestActive();
1.334 + CleanupStack::PushL(active);
1.335 +
1.336 + TInt failCount = 0;
1.337 + TBool finished = EFalse;
1.338 + TInt error;
1.339 +
1.340 + while(!finished)
1.341 + {
1.342 + error = KErrNone;
1.343 +
1.344 + __UHEAP_FAILNEXT(++failCount);
1.345 + client->AddEventType(*type, active->iStatus);
1.346 +
1.347 + active->StartL();
1.348 + CActiveScheduler::Start();
1.349 +
1.350 + if (active->iStatus == KErrNone)
1.351 + finished = ETrue;
1.352 + else
1.353 + error = active->iStatus.Int();
1.354 +
1.355 + __UHEAP_RESET;
1.356 +
1.357 + if (error == KErrNoMemory)
1.358 + {
1.359 + active->StartL();
1.360 + client->GetEventType(*type, active->iStatus);
1.361 + CActiveScheduler::Start();
1.362 + TEST2(active->iStatus.Int(), KErrNotFound);
1.363 + }
1.364 + else
1.365 + TEST2(error, KErrNone);
1.366 +
1.367 + }
1.368 +
1.369 + active->StartL();
1.370 + client->AddEventType(*type, active->iStatus);
1.371 + CActiveScheduler::Start();
1.372 + TEST2(active->iStatus.Int(), KErrAlreadyExists);
1.373 +
1.374 + CleanupStack::PopAndDestroy(3, client); // active, type, client
1.375 + TheTest.Printf(_L("===CLogClient::AddEventType() client side OOM test succeeded at iteration %d\n"), failCount);
1.376 + }
1.377 +
1.378 +/**
1.379 +@SYMTestCaseID SYSLIB-LOGENG-CT-0889
1.380 +@SYMTestCaseDesc Tests for CLogClient::AddEventType() function
1.381 +@SYMTestPriority High
1.382 +@SYMTestActions Tests for adding events to the log
1.383 + Check for memory errors and error in the environment
1.384 + Test for adding the same event and check for already exits error.
1.385 +@SYMTestExpectedResults Test must not fail
1.386 +@SYMREQ REQ0000
1.387 +*/
1.388 +LOCAL_C void TestAddEventType3L()
1.389 + {
1.390 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0889 "));
1.391 +
1.392 + CLogClient* client = CLogClient::NewL(theFs);
1.393 + CleanupStack::PushL(client);
1.394 +
1.395 + CLogEventType* type = CLogEventType::NewL();
1.396 + CleanupStack::PushL(type);
1.397 +
1.398 + type->SetUid(KTestEventUid);
1.399 + type->SetDescription(KTestEventDesc1);
1.400 + type->SetLoggingEnabled(ETrue);
1.401 +
1.402 + CTestActive* active = new(ELeave)CTestActive();
1.403 + CleanupStack::PushL(active);
1.404 +
1.405 + TInt failCount = 0;
1.406 +
1.407 + TBool finished = EFalse;
1.408 + TInt error;
1.409 +
1.410 + while(!finished)
1.411 + {
1.412 + error = KErrNone;
1.413 +
1.414 + __LOGSERV_UHEAP_FAILNEXT(++failCount);
1.415 + client->AddEventType(*type, active->iStatus);
1.416 +
1.417 + active->StartL();
1.418 + CActiveScheduler::Start();
1.419 +
1.420 + if (active->iStatus == KErrNone)
1.421 + finished = ETrue;
1.422 + else
1.423 + error = active->iStatus.Int();
1.424 +
1.425 + __LOGSERV_UHEAP_RESET;
1.426 +
1.427 + if (error == KErrNoMemory)
1.428 + {
1.429 + active->StartL();
1.430 + client->GetEventType(*type, active->iStatus);
1.431 + CActiveScheduler::Start();
1.432 + TEST2(active->iStatus.Int(), KErrNotFound);
1.433 + }
1.434 + else
1.435 + TEST2(error, KErrNone);
1.436 +
1.437 + }
1.438 +
1.439 + active->StartL();
1.440 + client->AddEventType(*type, active->iStatus);
1.441 + CActiveScheduler::Start();
1.442 + TEST2(active->iStatus.Int(), KErrAlreadyExists);
1.443 +
1.444 + CleanupStack::PopAndDestroy(3, client); // active, type, client
1.445 + TheTest.Printf(_L("===CLogClient::AddEventType() server side OOM test succeeded at iteration %d\n"), failCount);
1.446 + }
1.447 +
1.448 +/**
1.449 +@SYMTestCaseID SYSLIB-LOGENG-CT-0890
1.450 +@SYMTestCaseDesc Tests for CLogClient::GetEventType() function
1.451 +@SYMTestPriority High
1.452 +@SYMTestActions Tests for getting event type for the specific UID from the log
1.453 + Check for memory errors and error in the environment
1.454 +@SYMTestExpectedResults Test must not fail
1.455 +@SYMREQ REQ0000
1.456 +*/
1.457 +LOCAL_C void TestGetEventType1L()
1.458 + {
1.459 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0890 "));
1.460 +
1.461 + CLogClient* client = CLogClient::NewL(theFs);
1.462 + CleanupStack::PushL(client);
1.463 +
1.464 + CLogEventType* type = CLogEventType::NewL();
1.465 + CleanupStack::PushL(type);
1.466 +
1.467 + type->SetUid(KTestEventUid);
1.468 +
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 + __UHEAP_FAILNEXT(++failCount);
1.478 +
1.479 + client->GetEventType(*type, active->iStatus);
1.480 +
1.481 + active->StartL();
1.482 + CActiveScheduler::Start();
1.483 +
1.484 + if (active->iStatus == KErrNone)
1.485 + finished = ETrue;
1.486 + else
1.487 + {
1.488 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.489 + TEST(type->Description() == KNullDesC);
1.490 + }
1.491 +
1.492 + __UHEAP_RESET;
1.493 + }
1.494 +
1.495 + TEST(type->Uid() == KTestEventUid);
1.496 + TEST(type->Description() == KTestEventDesc1);
1.497 + TEST(type->LoggingEnabled());
1.498 +
1.499 + CleanupStack::PopAndDestroy(3, client); // active, type, client
1.500 + TheTest.Printf(_L("===CLogClient::GetEventType() client side OOM test succeeded at iteration %d\n"), failCount);
1.501 + }
1.502 +
1.503 +/**
1.504 +@SYMTestCaseID SYSLIB-LOGENG-CT-0891
1.505 +@SYMTestCaseDesc Tests for CLogClient::GetEventType() function
1.506 +@SYMTestPriority High
1.507 +@SYMTestActions Tests for getting event type for the specific UID from the log
1.508 + Check for memory errors and error in the environment
1.509 +@SYMTestExpectedResults Test must not fail
1.510 +@SYMREQ REQ0000
1.511 +*/
1.512 +LOCAL_C void TestGetEventType3L()
1.513 + {
1.514 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0891 "));
1.515 +
1.516 + CLogClient* client = CLogClient::NewL(theFs);
1.517 + CleanupStack::PushL(client);
1.518 +
1.519 + CLogEventType* type = CLogEventType::NewL();
1.520 + CleanupStack::PushL(type);
1.521 +
1.522 + type->SetUid(KTestEventUid);
1.523 +
1.524 + CTestActive* active = new(ELeave)CTestActive();
1.525 + CleanupStack::PushL(active);
1.526 +
1.527 + TInt failCount = 0;
1.528 + TBool finished = EFalse;
1.529 +
1.530 + while(!finished)
1.531 + {
1.532 + __LOGSERV_UHEAP_FAILNEXT(++failCount);
1.533 +
1.534 + client->GetEventType(*type, active->iStatus);
1.535 +
1.536 + active->StartL();
1.537 + CActiveScheduler::Start();
1.538 +
1.539 + if (active->iStatus == KErrNone)
1.540 + finished = ETrue;
1.541 + else
1.542 + {
1.543 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.544 + TEST(type->Description() == KNullDesC);
1.545 + }
1.546 +
1.547 + __LOGSERV_UHEAP_RESET;
1.548 + }
1.549 +
1.550 + TEST(type->Uid() == KTestEventUid);
1.551 + TEST(type->Description() == KTestEventDesc1);
1.552 + TEST(type->LoggingEnabled());
1.553 +
1.554 + CleanupStack::PopAndDestroy(3, client); // active, type, client
1.555 + TheTest.Printf(_L("===CLogClient::GetEventType() server side OOM test succeeded at iteration %d\n"), failCount);
1.556 + }
1.557 +
1.558 +/**
1.559 +@SYMTestCaseID SYSLIB-LOGENG-CT-0892
1.560 +@SYMTestCaseDesc Tests for CLogClient::ChangeEventType() function
1.561 +@SYMTestPriority High
1.562 +@SYMTestActions Tests for changing the event type
1.563 + Check for memory errors and error in the environment
1.564 +@SYMTestExpectedResults Test must not fail
1.565 +@SYMREQ REQ0000
1.566 +*/
1.567 +LOCAL_C void TestChangeEventType1L()
1.568 + {
1.569 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0892 "));
1.570 +
1.571 + CLogClient* client = CLogClient::NewL(theFs);
1.572 + CleanupStack::PushL(client);
1.573 +
1.574 + CTestActive* active = new(ELeave)CTestActive();
1.575 + CleanupStack::PushL(active);
1.576 +
1.577 + CLogEventType* type = CLogEventType::NewL();
1.578 + CleanupStack::PushL(type);
1.579 +
1.580 + type->SetUid(KTestEventUid);
1.581 +
1.582 + type->SetDescription(KTestEventDesc1);
1.583 + type->SetDescription(KTestEventDesc2);
1.584 +
1.585 + TInt failCount = 0;
1.586 + TBool finished = EFalse;
1.587 + TInt error;
1.588 +
1.589 + while(!finished)
1.590 + {
1.591 + error = KErrNone;
1.592 +
1.593 + type->SetDescription(KTestEventDesc2);
1.594 + type->SetLoggingEnabled(EFalse);
1.595 +
1.596 + __UHEAP_FAILNEXT(++failCount);
1.597 +
1.598 + client->ChangeEventType(*type, active->iStatus);
1.599 +
1.600 + active->StartL();
1.601 + CActiveScheduler::Start();
1.602 +
1.603 + if (active->iStatus == KErrNone)
1.604 + finished = ETrue;
1.605 + else
1.606 + error = active->iStatus.Int();
1.607 +
1.608 + __UHEAP_RESET;
1.609 +
1.610 + if (error == KErrNoMemory)
1.611 + {
1.612 + active->StartL();
1.613 + client->GetEventType(*type, active->iStatus);
1.614 + CActiveScheduler::Start();
1.615 + TEST2(active->iStatus.Int(), KErrNone);
1.616 +
1.617 + TEST(type->Description() == KTestEventDesc1);
1.618 + TEST(type->LoggingEnabled());
1.619 + }
1.620 + else
1.621 + TEST2(error, KErrNone);
1.622 + }
1.623 +
1.624 + type->SetUid(KTestEventUid);
1.625 +
1.626 + active->StartL();
1.627 + client->GetEventType(*type, active->iStatus);
1.628 + CActiveScheduler::Start();
1.629 + TEST2(active->iStatus.Int(), KErrNone);
1.630 +
1.631 + TEST(type->Uid() == KTestEventUid);
1.632 + TEST(type->Description() == KTestEventDesc2);
1.633 + TEST(type->LoggingEnabled() == EFalse);
1.634 +
1.635 + CleanupStack::PopAndDestroy(3, client); // type, active, client
1.636 + TheTest.Printf(_L("===CLogClient::ChangeEventType() client side OOM test succeeded at iteration %d\n"), failCount);
1.637 + }
1.638 +
1.639 +/**
1.640 +@SYMTestCaseID SYSLIB-LOGENG-CT-0893
1.641 +@SYMTestCaseDesc Tests for CLogClient::ChangeEventType() function
1.642 +@SYMTestPriority High
1.643 +@SYMTestActions Tests for changing the event type.
1.644 + Check for memory errors and error in the environment
1.645 +@SYMTestExpectedResults Test must not fail
1.646 +@SYMREQ REQ0000
1.647 +*/
1.648 +LOCAL_C void TestChangeEventType3L()
1.649 + {
1.650 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0893 "));
1.651 +
1.652 + CLogClient* client = CLogClient::NewL(theFs);
1.653 + CleanupStack::PushL(client);
1.654 +
1.655 + CTestActive* active = new(ELeave)CTestActive();
1.656 + CleanupStack::PushL(active);
1.657 +
1.658 + CLogEventType* type = CLogEventType::NewL();
1.659 + CleanupStack::PushL(type);
1.660 +
1.661 + type->SetUid(KTestEventUid);
1.662 +
1.663 + type->SetDescription(KTestEventDesc1);
1.664 + type->SetDescription(KTestEventDesc2);
1.665 +
1.666 + TInt failCount = 0;
1.667 + TBool finished = EFalse;
1.668 + TInt error;
1.669 +
1.670 + while(!finished)
1.671 + {
1.672 + error = KErrNone;
1.673 +
1.674 + type->SetDescription(KTestEventDesc2);
1.675 + type->SetLoggingEnabled(EFalse);
1.676 +
1.677 + __LOGSERV_UHEAP_FAILNEXT(++failCount);
1.678 +
1.679 + client->ChangeEventType(*type, active->iStatus);
1.680 +
1.681 + active->StartL();
1.682 + CActiveScheduler::Start();
1.683 +
1.684 + if (active->iStatus == KErrNone)
1.685 + finished = ETrue;
1.686 + else
1.687 + error = active->iStatus.Int();
1.688 +
1.689 + __LOGSERV_UHEAP_RESET;
1.690 +
1.691 + if (error == KErrNoMemory)
1.692 + {
1.693 + active->StartL();
1.694 + client->GetEventType(*type, active->iStatus);
1.695 + CActiveScheduler::Start();
1.696 + TEST2(active->iStatus.Int(), KErrNone);
1.697 +
1.698 + TEST(type->Description() == KTestEventDesc1);
1.699 + TEST(type->LoggingEnabled());
1.700 + }
1.701 + else
1.702 + TEST2(error, KErrNone);
1.703 + }
1.704 +
1.705 + type->SetUid(KTestEventUid);
1.706 +
1.707 + active->StartL();
1.708 + client->GetEventType(*type, active->iStatus);
1.709 + CActiveScheduler::Start();
1.710 + TEST2(active->iStatus.Int(), KErrNone);
1.711 +
1.712 + TEST(type->Uid() == KTestEventUid);
1.713 + TEST(type->Description() == KTestEventDesc2);
1.714 + TEST(type->LoggingEnabled() == EFalse);
1.715 +
1.716 + CleanupStack::PopAndDestroy(3, client); // type, active, client
1.717 + TheTest.Printf(_L("===CLogClient::ChangeEventType() server side OOM test succeeded at iteration %d\n"), failCount);
1.718 + }
1.719 +
1.720 +/**
1.721 +@SYMTestCaseID SYSLIB-LOGENG-CT-0894
1.722 +@SYMTestCaseDesc Tests for CLogClient::DeleteEventType() function
1.723 +@SYMTestPriority High
1.724 +@SYMTestActions Tests for deleting of event type.
1.725 + After deletion check by trying to retrieve the event.
1.726 + Check for ErrNotFound,error flag
1.727 +@SYMTestExpectedResults Test must not fail
1.728 +@SYMREQ REQ0000
1.729 +*/
1.730 +LOCAL_C void TestDeleteEventType1L()
1.731 + {
1.732 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0894 "));
1.733 +
1.734 + CLogClient* client = CLogClient::NewL(theFs);
1.735 + CleanupStack::PushL(client);
1.736 +
1.737 + CTestActive* active = new(ELeave)CTestActive();
1.738 + CleanupStack::PushL(active);
1.739 +
1.740 + CLogEventType* type = CLogEventType::NewL();
1.741 + CleanupStack::PushL(type);
1.742 +
1.743 + type->SetUid(KTestEventUid);
1.744 +
1.745 + TInt failCount = 0;
1.746 + TBool finished = EFalse;
1.747 + TInt error;
1.748 +
1.749 + while(!finished)
1.750 + {
1.751 + error = KErrNone;
1.752 +
1.753 + __UHEAP_FAILNEXT(++failCount);
1.754 + client->DeleteEventType(KTestEventUid, active->iStatus);
1.755 +
1.756 + active->StartL();
1.757 + CActiveScheduler::Start();
1.758 +
1.759 + if (active->iStatus == KErrNone)
1.760 + finished = ETrue;
1.761 + else
1.762 + error = active->iStatus.Int();
1.763 +
1.764 + __UHEAP_RESET;
1.765 +
1.766 + if (error == KErrNoMemory)
1.767 + {
1.768 + active->StartL();
1.769 + client->GetEventType(*type, active->iStatus);
1.770 + CActiveScheduler::Start();
1.771 + TEST2(active->iStatus.Int(), KErrNone);
1.772 + }
1.773 + else
1.774 + TEST2(error, KErrNone);
1.775 + }
1.776 +
1.777 + active->StartL();
1.778 + client->GetEventType(*type, active->iStatus);
1.779 + CActiveScheduler::Start();
1.780 + TEST2(active->iStatus.Int(), KErrNotFound);
1.781 +
1.782 + CleanupStack::PopAndDestroy(3, client); // type, active, client
1.783 + TheTest.Printf(_L("===CLogClient::DeleteEventType() client side OOM test succeeded at iteration %d\n"), failCount);
1.784 + }
1.785 +
1.786 +/**
1.787 +@SYMTestCaseID SYSLIB-LOGENG-CT-0895
1.788 +@SYMTestCaseDesc Tests for CLogClient::DeleteEventType() function
1.789 +@SYMTestPriority High
1.790 +@SYMTestActions Tests for deleting of event type.
1.791 + After deletion check by trying to retrieve the event.
1.792 + Check for ErrNotFound,error flag.
1.793 +@SYMTestExpectedResults Test must not fail
1.794 +@SYMREQ REQ0000
1.795 +*/
1.796 +LOCAL_C void TestDeleteEventType3L()
1.797 + {
1.798 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0895 "));
1.799 +
1.800 + CLogClient* client = CLogClient::NewL(theFs);
1.801 + CleanupStack::PushL(client);
1.802 +
1.803 + CTestActive* active = new(ELeave)CTestActive();
1.804 + CleanupStack::PushL(active);
1.805 +
1.806 + CLogEventType* type = CLogEventType::NewL();
1.807 + CleanupStack::PushL(type);
1.808 +
1.809 + type->SetUid(KTestEventUid);
1.810 +
1.811 + TInt failCount = 0;
1.812 +
1.813 + TBool finished = EFalse;
1.814 + TInt error;
1.815 +
1.816 + while(!finished)
1.817 + {
1.818 + error = KErrNone;
1.819 +
1.820 + __LOGSERV_UHEAP_FAILNEXT(++failCount);
1.821 + client->DeleteEventType(KTestEventUid, active->iStatus);
1.822 +
1.823 + active->StartL();
1.824 + CActiveScheduler::Start();
1.825 +
1.826 + if (active->iStatus == KErrNone)
1.827 + finished = ETrue;
1.828 + else
1.829 + error = active->iStatus.Int();
1.830 +
1.831 + __LOGSERV_UHEAP_RESET;
1.832 +
1.833 + if (error == KErrNoMemory)
1.834 + {
1.835 + active->StartL();
1.836 + client->GetEventType(*type, active->iStatus);
1.837 + CActiveScheduler::Start();
1.838 + TEST2(active->iStatus.Int(), KErrNone);
1.839 + }
1.840 + else
1.841 + TEST2(error, KErrNone);
1.842 + }
1.843 +
1.844 + active->StartL();
1.845 + client->GetEventType(*type, active->iStatus);
1.846 + CActiveScheduler::Start();
1.847 + TEST2(active->iStatus.Int(), KErrNotFound);
1.848 +
1.849 + CleanupStack::PopAndDestroy(3, client); // type, active, client
1.850 + TheTest.Printf(_L("===CLogClient::DeleteEventType() server side OOM test succeeded at iteration %d\n"), failCount);
1.851 + }
1.852 +
1.853 +/**
1.854 +@SYMTestCaseID SYSLIB-LOGENG-CT-0896
1.855 +@SYMTestCaseDesc Tests for adding event CLogClient::AddEvent() function
1.856 +@SYMTestPriority High
1.857 +@SYMTestActions Add logeventtype and logevent to the log
1.858 + Tests for memory errors and environment errors.
1.859 +@SYMTestExpectedResults Test must not fail
1.860 +@SYMREQ REQ0000
1.861 +*/
1.862 +LOCAL_C void TestAddEvent1L()
1.863 + {
1.864 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0896 "));
1.865 +
1.866 + CLogClient* client = CLogClient::NewL(theFs);
1.867 + CleanupStack::PushL(client);
1.868 +
1.869 + CLogEventType* type = CLogEventType::NewL();
1.870 + CleanupStack::PushL(type);
1.871 +
1.872 + type->SetUid(KTestEventUid);
1.873 + type->SetDescription(KTestEventDesc1);
1.874 + type->SetLoggingEnabled(ETrue);
1.875 +
1.876 + CTestActive* active = new(ELeave)CTestActive();
1.877 + CleanupStack::PushL(active);
1.878 +
1.879 + active->StartL();
1.880 + client->AddEventType(*type, active->iStatus);
1.881 + CActiveScheduler::Start();
1.882 + TEST2(active->iStatus.Int(), KErrNone);
1.883 +
1.884 + CLogEvent* event = CLogEvent::NewL();
1.885 + CleanupStack::PushL(event);
1.886 +
1.887 + TTime now;
1.888 + now.UniversalTime();
1.889 +
1.890 + event->SetEventType(KTestEventUid);
1.891 + event->SetRemoteParty(KTestRemoteParty1);
1.892 + event->SetDirection(KTestDirection1);
1.893 + event->SetDurationType(KTestDurationType1);
1.894 + event->SetDuration(KTestDuration1);
1.895 + event->SetStatus(KTestStatus1);
1.896 + event->SetSubject(KTestSubject1);
1.897 + event->SetNumber(KTestNumber1);
1.898 + event->SetContact(KTestContact1);
1.899 + event->SetLink(KTestLink1);
1.900 + event->SetDataL(KTestData1);
1.901 +
1.902 + TInt failCount = 0;
1.903 + TBool finished = EFalse;
1.904 + TInt error;
1.905 +
1.906 + while(!finished)
1.907 + {
1.908 + error = KErrNone;
1.909 +
1.910 + __UHEAP_FAILNEXT(++failCount);
1.911 + client->AddEvent(*event, active->iStatus);
1.912 + active->StartL();
1.913 + CActiveScheduler::Start();
1.914 +
1.915 + if (active->iStatus == KErrNone)
1.916 + finished = ETrue;
1.917 + else
1.918 + error = active->iStatus.Int();
1.919 +
1.920 + __UHEAP_RESET;
1.921 +
1.922 + if(error != KErrNoMemory)
1.923 + {
1.924 + TEST2(error, KErrNone);
1.925 + }
1.926 + }
1.927 +
1.928 + TEST(event->Time() >= now);
1.929 + TEST(event->Description() == KTestEventDesc1);
1.930 +
1.931 + active->StartL();
1.932 + client->GetEvent(*event, active->iStatus);
1.933 + CActiveScheduler::Start();
1.934 + TEST2(active->iStatus.Int(), KErrNone);
1.935 +
1.936 + CleanupStack::PopAndDestroy(4, client); // event, active, type, client
1.937 + TheTest.Printf(_L("===CLogClient::AddEvent() client side OOM test succeeded at iteration %d\n"), failCount);
1.938 + }
1.939 +
1.940 +/**
1.941 +@SYMTestCaseID SYSLIB-LOGENG-CT-0897
1.942 +@SYMTestCaseDesc Tests for adding event CLogClient::AddEvent() function
1.943 +@SYMTestPriority High
1.944 +@SYMTestActions Add logeventtype and logevent to the log
1.945 + Tests for memory errors and environment errors.
1.946 +@SYMTestExpectedResults Test must not fail
1.947 +@SYMREQ REQ0000
1.948 +*/
1.949 +LOCAL_C void TestAddEvent3L()
1.950 + {
1.951 +
1.952 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0897 "));
1.953 +
1.954 + CLogClient* client = CLogClient::NewL(theFs);
1.955 + CleanupStack::PushL(client);
1.956 +
1.957 + CLogEventType* type = CLogEventType::NewL();
1.958 + CleanupStack::PushL(type);
1.959 +
1.960 + type->SetUid(KTestEventUid);
1.961 + type->SetDescription(KTestEventDesc1);
1.962 + type->SetLoggingEnabled(ETrue);
1.963 +
1.964 + CTestActive* active = new(ELeave)CTestActive();
1.965 + CleanupStack::PushL(active);
1.966 +
1.967 + active->StartL();
1.968 + client->AddEventType(*type, active->iStatus);
1.969 + CActiveScheduler::Start();
1.970 + TEST2(active->iStatus.Int(), KErrNone);
1.971 +
1.972 + CLogEvent* event = CLogEvent::NewL();
1.973 + CleanupStack::PushL(event);
1.974 +
1.975 + TTime now;
1.976 + now.UniversalTime();
1.977 +
1.978 + event->SetEventType(KTestEventUid);
1.979 + event->SetRemoteParty(KTestRemoteParty1);
1.980 + event->SetDirection(KTestDirection1);
1.981 + event->SetDurationType(KTestDurationType1);
1.982 + event->SetDuration(KTestDuration1);
1.983 + event->SetStatus(KTestStatus1);
1.984 + event->SetSubject(KTestSubject1);
1.985 + event->SetNumber(KTestNumber1);
1.986 + event->SetContact(KTestContact1);
1.987 + event->SetLink(KTestLink1);
1.988 + event->SetDataL(KTestData1);
1.989 +
1.990 + TInt failCount = 0;
1.991 + TBool finished = EFalse;
1.992 + TInt error;
1.993 +
1.994 + while(!finished)
1.995 + {
1.996 + error = KErrNone;
1.997 +
1.998 + __LOGSERV_UHEAP_FAILNEXT(++failCount);
1.999 + client->AddEvent(*event, active->iStatus);
1.1000 + active->StartL();
1.1001 + CActiveScheduler::Start();
1.1002 +
1.1003 + if (active->iStatus == KErrNone)
1.1004 + finished = ETrue;
1.1005 + else
1.1006 + error = active->iStatus.Int();
1.1007 +
1.1008 + __LOGSERV_UHEAP_RESET;
1.1009 +
1.1010 + if(error != KErrNoMemory)
1.1011 + {
1.1012 + TEST2(error, KErrNone);
1.1013 + }
1.1014 + }
1.1015 +
1.1016 + TEST(event->Time() >= now);
1.1017 + TEST(event->Description() == KTestEventDesc1);
1.1018 +
1.1019 + active->StartL();
1.1020 + client->GetEvent(*event, active->iStatus);
1.1021 + CActiveScheduler::Start();
1.1022 + TEST2(active->iStatus.Int(), KErrNone);
1.1023 +
1.1024 + CleanupStack::PopAndDestroy(4, client); // event, active, type, client
1.1025 + TheTest.Printf(_L("===CLogClient::AddEvent() server side OOM test succeeded at iteration %d\n"), failCount);
1.1026 + }
1.1027 +
1.1028 +/**
1.1029 +@SYMTestCaseID SYSLIB-LOGENG-CT-0898
1.1030 +@SYMTestCaseDesc Tests for retrieving details of an event
1.1031 + Tests for CLogClient::GetEvent() function.
1.1032 +@SYMTestPriority High
1.1033 +@SYMTestActions Tests for getting event details.Check for memory errors and error in the environment
1.1034 + Tests for the integrity of the information
1.1035 +@SYMTestExpectedResults Test must not fail
1.1036 +@SYMREQ REQ0000
1.1037 +*/
1.1038 +LOCAL_C void TestGetEvent1L()
1.1039 + {
1.1040 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0898 "));
1.1041 +
1.1042 + CLogClient* client = CLogClient::NewL(theFs);
1.1043 + CleanupStack::PushL(client);
1.1044 +
1.1045 + CTestActive* active = new(ELeave)CTestActive();
1.1046 + CleanupStack::PushL(active);
1.1047 +
1.1048 + CLogEvent* event = CLogEvent::NewL();
1.1049 + CleanupStack::PushL(event);
1.1050 +
1.1051 + event->SetId(0);
1.1052 +
1.1053 + TInt failCount = 0;
1.1054 + TBool finished = EFalse;
1.1055 +
1.1056 + while(!finished)
1.1057 + {
1.1058 + __UHEAP_FAILNEXT(++failCount);
1.1059 + client->GetEvent(*event, active->iStatus);
1.1060 +
1.1061 + active->StartL();
1.1062 + CActiveScheduler::Start();
1.1063 +
1.1064 + if (active->iStatus == KErrNone)
1.1065 + finished = ETrue;
1.1066 + else
1.1067 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.1068 +
1.1069 + __UHEAP_RESET;
1.1070 + }
1.1071 +
1.1072 + TEST(event->Id() == 0);
1.1073 + TEST(event->Time() > TTime(0));
1.1074 + TEST(event->Description() == KTestEventDesc1);
1.1075 + TEST(event->EventType() == KTestEventUid);
1.1076 + TEST(event->RemoteParty() == KTestRemoteParty1);
1.1077 + TEST(event->Direction() == KTestDirection1);
1.1078 + TEST(event->DurationType() == KTestDurationType1);
1.1079 + TEST(event->Duration() == KTestDuration1);
1.1080 + TEST(event->Status() == KTestStatus1);
1.1081 + TEST(event->Subject() == KTestSubject1);
1.1082 + TEST(event->Number() == KTestNumber1);
1.1083 + TEST(event->Contact() == KTestContact1);
1.1084 + TEST(event->Link() == KTestLink1);
1.1085 + TEST(event->Data() == KTestData1);
1.1086 +
1.1087 + CleanupStack::PopAndDestroy(3, client); // event, active, client
1.1088 + TheTest.Printf(_L("===CLogClient::AddEvent() client side OOM test succeeded at iteration %d\n"), failCount);
1.1089 + }
1.1090 +
1.1091 +/**
1.1092 +@SYMTestCaseID SYSLIB-LOGENG-CT-0899
1.1093 +@SYMTestCaseDesc Tests for retrieving details of an event.Tests for CLogClient::GetEventL() function
1.1094 +@SYMTestPriority High
1.1095 +@SYMTestActions Tests for getting event details of UID 0.Check for memory errors and error in the environment
1.1096 + Tests for the integrity of the information
1.1097 +@SYMTestExpectedResults Test must not fail
1.1098 +@SYMREQ REQ0000
1.1099 +*/
1.1100 +LOCAL_C void TestGetEvent3L()
1.1101 + {
1.1102 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0899 "));
1.1103 +
1.1104 + CLogClient* client = CLogClient::NewL(theFs);
1.1105 + CleanupStack::PushL(client);
1.1106 +
1.1107 + CTestActive* active = new(ELeave)CTestActive();
1.1108 + CleanupStack::PushL(active);
1.1109 +
1.1110 + CLogEvent* event = CLogEvent::NewL();
1.1111 + CleanupStack::PushL(event);
1.1112 +
1.1113 + event->SetId(0);
1.1114 +
1.1115 + TInt failCount = 0;
1.1116 + TBool finished = EFalse;
1.1117 +
1.1118 + while(!finished)
1.1119 + {
1.1120 + __LOGSERV_UHEAP_FAILNEXT(++failCount);
1.1121 + client->GetEvent(*event, active->iStatus);
1.1122 +
1.1123 + active->StartL();
1.1124 + CActiveScheduler::Start();
1.1125 +
1.1126 + if (active->iStatus == KErrNone)
1.1127 + finished = ETrue;
1.1128 + else
1.1129 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.1130 +
1.1131 + __LOGSERV_UHEAP_RESET;
1.1132 + }
1.1133 +
1.1134 + TEST(event->Id() == 0);
1.1135 + TEST(event->Time() > TTime(0));
1.1136 + TEST(event->Description() == KTestEventDesc1);
1.1137 + TEST(event->EventType() == KTestEventUid);
1.1138 + TEST(event->RemoteParty() == KTestRemoteParty1);
1.1139 + TEST(event->Direction() == KTestDirection1);
1.1140 + TEST(event->DurationType() == KTestDurationType1);
1.1141 + TEST(event->Duration() == KTestDuration1);
1.1142 + TEST(event->Status() == KTestStatus1);
1.1143 + TEST(event->Subject() == KTestSubject1);
1.1144 + TEST(event->Number() == KTestNumber1);
1.1145 + TEST(event->Contact() == KTestContact1);
1.1146 + TEST(event->Link() == KTestLink1);
1.1147 + TEST(event->Data() == KTestData1);
1.1148 +
1.1149 + CleanupStack::PopAndDestroy(3, client); // event, active, client
1.1150 + TheTest.Printf(_L("===CLogClient::GetEvent() server side OOM test succeeded at iteration %d\n"), failCount);
1.1151 + }
1.1152 +
1.1153 +/**
1.1154 +@SYMTestCaseID SYSLIB-LOGENG-CT-0900
1.1155 +@SYMTestCaseDesc Tests for changing the log event details.
1.1156 + Tests for CLogClient::ChangeEvent() function
1.1157 +@SYMTestPriority High
1.1158 +@SYMTestActions Tests for changing the event details.Check for memory errors and error in the environment
1.1159 + If no memory error,get the event details and check for the integrity.
1.1160 +@SYMTestExpectedResults Test must not fail
1.1161 +@SYMREQ REQ0000
1.1162 +*/
1.1163 +LOCAL_C void TestChangeEvent3L()
1.1164 + {
1.1165 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0900 "));
1.1166 +
1.1167 + CLogClient* client = CLogClient::NewL(theFs);
1.1168 + CleanupStack::PushL(client);
1.1169 +
1.1170 + CTestActive* active = new(ELeave)CTestActive();
1.1171 + CleanupStack::PushL(active);
1.1172 +
1.1173 + CLogEvent* event = CLogEvent::NewL();
1.1174 + CleanupStack::PushL(event);
1.1175 +
1.1176 + TTime now;
1.1177 + now.UniversalTime();
1.1178 +
1.1179 + TInt failCount = 0;
1.1180 + TBool finished = EFalse;
1.1181 + TInt error;
1.1182 +
1.1183 + while(!finished)
1.1184 + {
1.1185 + error = KErrNone;
1.1186 +
1.1187 + event->SetId(0);
1.1188 + event->SetTime(now);
1.1189 + event->SetRemoteParty(KTestRemoteParty2);
1.1190 + event->SetDirection(KTestDirection2);
1.1191 + event->SetDurationType(KTestDurationType2);
1.1192 + event->SetDuration(KTestDuration2);
1.1193 + event->SetStatus(KTestStatus2);
1.1194 + event->SetSubject(KTestSubject2);
1.1195 + event->SetNumber(KTestNumber2);
1.1196 + event->SetContact(KTestContact2);
1.1197 + event->SetLink(KTestLink2);
1.1198 + event->SetDataL(KTestData2);
1.1199 +
1.1200 + __LOGSERV_UHEAP_FAILNEXT(++failCount);
1.1201 + client->ChangeEvent(*event, active->iStatus);
1.1202 +
1.1203 + active->StartL();
1.1204 + CActiveScheduler::Start();
1.1205 + if (active->iStatus == KErrNone)
1.1206 + finished = ETrue;
1.1207 + else
1.1208 + error = active->iStatus.Int();
1.1209 +
1.1210 + __LOGSERV_UHEAP_RESET;
1.1211 +
1.1212 + if (error == KErrNoMemory)
1.1213 + {
1.1214 + active->StartL();
1.1215 + client->GetEvent(*event, active->iStatus);
1.1216 + CActiveScheduler::Start();
1.1217 + TEST2(active->iStatus.Int(), KErrNone);
1.1218 +
1.1219 + TEST(event->Id() == 0);
1.1220 + TEST(event->Time() > TTime(0));
1.1221 + TEST(event->Description() == KTestEventDesc1);
1.1222 + TEST(event->EventType() == KTestEventUid);
1.1223 + TEST(event->RemoteParty() == KTestRemoteParty1);
1.1224 + TEST(event->Direction() == KTestDirection1);
1.1225 + TEST(event->DurationType() == KTestDurationType1);
1.1226 + TEST(event->Duration() == KTestDuration1);
1.1227 + TEST(event->Status() == KTestStatus1);
1.1228 + TEST(event->Subject() == KTestSubject1);
1.1229 + TEST(event->Number() == KTestNumber1);
1.1230 + TEST(event->Contact() == KTestContact1);
1.1231 + TEST(event->Link() == KTestLink1);
1.1232 + TEST(event->Data() == KTestData1);
1.1233 + }
1.1234 + else
1.1235 + TEST2(error, KErrNone);
1.1236 + }
1.1237 +
1.1238 + active->StartL();
1.1239 + client->GetEvent(*event, active->iStatus);
1.1240 + CActiveScheduler::Start();
1.1241 + TEST2(active->iStatus.Int(), KErrNone);
1.1242 +
1.1243 + TEST(event->Id() == 0);
1.1244 + TEST(event->Time() == now);
1.1245 + TEST(event->Description() == KTestEventDesc1);
1.1246 + TEST(event->EventType() == KTestEventUid);
1.1247 + TEST(event->RemoteParty() == KTestRemoteParty2);
1.1248 + TEST(event->Direction() == KTestDirection2);
1.1249 + TEST(event->DurationType() == KTestDurationType2);
1.1250 + TEST(event->Duration() == KTestDuration2);
1.1251 + TEST(event->Status() == KTestStatus2);
1.1252 + TEST(event->Subject() == KTestSubject2);
1.1253 + TEST(event->Number() == KTestNumber2);
1.1254 + TEST(event->Contact() == KTestContact2);
1.1255 + TEST(event->Link() == KTestLink2);
1.1256 + TEST(event->Data() == KTestData2);
1.1257 +
1.1258 + CleanupStack::PopAndDestroy(3, client); // event, active, client
1.1259 + TheTest.Printf(_L("===CLogClient::ChangeEvent() server side OOM test succeeded at iteration %d\n"), failCount);
1.1260 + }
1.1261 +
1.1262 +/**
1.1263 +@SYMTestCaseID SYSLIB-LOGENG-CT-0901
1.1264 +@SYMTestCaseDesc Tests for changing the log event details.Tests for CLogClient::ChangeEvent() function
1.1265 +@SYMTestPriority High
1.1266 +@SYMTestActions Tests for changing the event details.Check for memory errors and error in the environment
1.1267 + If no memory error,get the event details and check for the integrity.
1.1268 +@SYMTestExpectedResults Test must not fail
1.1269 +@SYMREQ REQ0000
1.1270 +*/
1.1271 +LOCAL_C void TestChangeEvent1L()
1.1272 + {
1.1273 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0901 "));
1.1274 +
1.1275 + CLogClient* client = CLogClient::NewL(theFs);
1.1276 + CleanupStack::PushL(client);
1.1277 +
1.1278 + CTestActive* active = new(ELeave)CTestActive();
1.1279 + CleanupStack::PushL(active);
1.1280 +
1.1281 + CLogEvent* event = CLogEvent::NewL();
1.1282 + CleanupStack::PushL(event);
1.1283 +
1.1284 + TTime now;
1.1285 + now.UniversalTime();
1.1286 +
1.1287 + TInt failCount = 0;
1.1288 + TBool finished = EFalse;
1.1289 + TInt error;
1.1290 +
1.1291 + while(!finished)
1.1292 + {
1.1293 + error = KErrNone;
1.1294 +
1.1295 + event->SetId(0);
1.1296 + event->SetTime(now);
1.1297 + event->SetRemoteParty(KTestRemoteParty2);
1.1298 + event->SetDirection(KTestDirection2);
1.1299 + event->SetDurationType(KTestDurationType2);
1.1300 + event->SetDuration(KTestDuration2);
1.1301 + event->SetStatus(KTestStatus2);
1.1302 + event->SetSubject(KTestSubject2);
1.1303 + event->SetNumber(KTestNumber2);
1.1304 + event->SetContact(KTestContact2);
1.1305 + event->SetLink(KTestLink2);
1.1306 + event->SetDataL(KTestData2);
1.1307 +
1.1308 + __UHEAP_FAILNEXT(++failCount);
1.1309 + client->ChangeEvent(*event, active->iStatus);
1.1310 +
1.1311 + active->StartL();
1.1312 + CActiveScheduler::Start();
1.1313 + if (active->iStatus == KErrNone)
1.1314 + finished = ETrue;
1.1315 + else
1.1316 + error = active->iStatus.Int();
1.1317 +
1.1318 + __UHEAP_RESET;
1.1319 +
1.1320 + if (error == KErrNoMemory)
1.1321 + {
1.1322 + active->StartL();
1.1323 + client->GetEvent(*event, active->iStatus);
1.1324 + CActiveScheduler::Start();
1.1325 + TEST2(active->iStatus.Int(), KErrNone);
1.1326 +
1.1327 + TEST(event->Id() == 0);
1.1328 + TEST(event->Time() > TTime(0));
1.1329 + TEST(event->Description() == KTestEventDesc1);
1.1330 + TEST(event->EventType() == KTestEventUid);
1.1331 + TEST(event->RemoteParty() == KTestRemoteParty1);
1.1332 + TEST(event->Direction() == KTestDirection1);
1.1333 + TEST(event->DurationType() == KTestDurationType1);
1.1334 + TEST(event->Duration() == KTestDuration1);
1.1335 + TEST(event->Status() == KTestStatus1);
1.1336 + TEST(event->Subject() == KTestSubject1);
1.1337 + TEST(event->Number() == KTestNumber1);
1.1338 + TEST(event->Contact() == KTestContact1);
1.1339 + TEST(event->Link() == KTestLink1);
1.1340 + TEST(event->Data() == KTestData1);
1.1341 + }
1.1342 + else
1.1343 + TEST2(error, KErrNone);
1.1344 + }
1.1345 +
1.1346 + active->StartL();
1.1347 + client->GetEvent(*event, active->iStatus);
1.1348 + CActiveScheduler::Start();
1.1349 + TEST2(active->iStatus.Int(), KErrNone);
1.1350 +
1.1351 + TEST(event->Id() == 0);
1.1352 + TEST(event->Time() == now);
1.1353 + TEST(event->Description() == KTestEventDesc1);
1.1354 + TEST(event->EventType() == KTestEventUid);
1.1355 + TEST(event->RemoteParty() == KTestRemoteParty2);
1.1356 + TEST(event->Direction() == KTestDirection2);
1.1357 + TEST(event->DurationType() == KTestDurationType2);
1.1358 + TEST(event->Duration() == KTestDuration2);
1.1359 + TEST(event->Status() == KTestStatus2);
1.1360 + TEST(event->Subject() == KTestSubject2);
1.1361 + TEST(event->Number() == KTestNumber2);
1.1362 + TEST(event->Contact() == KTestContact2);
1.1363 + TEST(event->Link() == KTestLink2);
1.1364 + TEST(event->Data() == KTestData2);
1.1365 +
1.1366 + CleanupStack::PopAndDestroy(3, client); // event, active, client
1.1367 + TheTest.Printf(_L("===CLogClient::ChangeEvent() client side OOM test succeeded at iteration %d\n"), failCount);
1.1368 + }
1.1369 +
1.1370 +/**
1.1371 +@SYMTestCaseID SYSLIB-LOGENG-CT-0902
1.1372 +@SYMTestCaseDesc Tests for deleting an event from the main event log.Tests for CLogClient::DeleteEvent() function
1.1373 +@SYMTestPriority High
1.1374 +@SYMTestActions Tests for deleting an event with unique ID of 0,check for any memory errors
1.1375 + Try to get the deleted event and test for not found error.
1.1376 +@SYMTestExpectedResults Test must not fail
1.1377 +@SYMREQ REQ0000
1.1378 +*/
1.1379 +LOCAL_C void TestDeleteEvent1L()
1.1380 + {
1.1381 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0902 "));
1.1382 +
1.1383 + CLogClient* client = CLogClient::NewL(theFs);
1.1384 + CleanupStack::PushL(client);
1.1385 +
1.1386 + CTestActive* active = new(ELeave)CTestActive();
1.1387 + CleanupStack::PushL(active);
1.1388 +
1.1389 + CLogEvent* event = CLogEvent::NewL();
1.1390 + CleanupStack::PushL(event);
1.1391 +
1.1392 + event->SetId(0);
1.1393 +
1.1394 + TInt failCount = 0;
1.1395 + TBool finished = EFalse;
1.1396 + TInt error;
1.1397 +
1.1398 + while(!finished)
1.1399 + {
1.1400 + error = KErrNone;
1.1401 +
1.1402 + __UHEAP_FAILNEXT(++failCount);
1.1403 + client->DeleteEvent(0, active->iStatus);
1.1404 +
1.1405 + if (error == KErrNone)
1.1406 + {
1.1407 + active->StartL();
1.1408 + CActiveScheduler::Start();
1.1409 +
1.1410 + if (active->iStatus == KErrNone)
1.1411 + finished = ETrue;
1.1412 + else
1.1413 + error = active->iStatus.Int();
1.1414 + }
1.1415 +
1.1416 + __UHEAP_RESET;
1.1417 +
1.1418 + if (error == KErrNoMemory)
1.1419 + {
1.1420 + active->StartL();
1.1421 + client->GetEvent(*event, active->iStatus);
1.1422 + CActiveScheduler::Start();
1.1423 + TEST2(active->iStatus.Int(), KErrNone);
1.1424 + }
1.1425 + else
1.1426 + TEST2(error, KErrNone);
1.1427 + }
1.1428 +
1.1429 + active->StartL();
1.1430 + client->GetEvent(*event, active->iStatus);
1.1431 + CActiveScheduler::Start();
1.1432 + TEST2(active->iStatus.Int(), KErrNotFound);
1.1433 +
1.1434 + CleanupStack::PopAndDestroy(3); // event, active, client
1.1435 + TheTest.Printf(_L("===CLogClient::DeleteEvent() client side OOM test succeeded at iteration %d\n"), failCount);
1.1436 + }
1.1437 +
1.1438 +/**
1.1439 +@SYMTestCaseID SYSLIB-LOGENG-CT-0903
1.1440 +@SYMTestCaseDesc Tests for deleting an event from the main event log
1.1441 +@SYMTestPriority High
1.1442 +@SYMTestActions Tests for deleting an event with unique ID of 0,check for any memory errors
1.1443 + Try to get the deleted event and test for not found error.
1.1444 +@SYMTestExpectedResults Test must not fail
1.1445 +@SYMREQ REQ0000
1.1446 +*/
1.1447 +LOCAL_C void TestDeleteEvent3L()
1.1448 + {
1.1449 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0903 "));
1.1450 +
1.1451 + CLogClient* client = CLogClient::NewL(theFs);
1.1452 + CleanupStack::PushL(client);
1.1453 +
1.1454 + CTestActive* active = new(ELeave)CTestActive();
1.1455 + CleanupStack::PushL(active);
1.1456 +
1.1457 + CLogEvent* event = CLogEvent::NewL();
1.1458 + CleanupStack::PushL(event);
1.1459 +
1.1460 + event->SetId(0);
1.1461 +
1.1462 + TInt failCount = 0;
1.1463 + TBool finished = EFalse;
1.1464 + TInt error;
1.1465 +
1.1466 + while(!finished)
1.1467 + {
1.1468 + error = KErrNone;
1.1469 +
1.1470 + __LOGSERV_UHEAP_FAILNEXT(++failCount);
1.1471 + client->DeleteEvent(0, active->iStatus);
1.1472 +
1.1473 + if (error == KErrNone)
1.1474 + {
1.1475 + active->StartL();
1.1476 + CActiveScheduler::Start();
1.1477 +
1.1478 + if (active->iStatus == KErrNone)
1.1479 + finished = ETrue;
1.1480 + else
1.1481 + error = active->iStatus.Int();
1.1482 + }
1.1483 +
1.1484 + __LOGSERV_UHEAP_RESET;
1.1485 +
1.1486 + if (error == KErrNoMemory)
1.1487 + {
1.1488 + active->StartL();
1.1489 + client->GetEvent(*event, active->iStatus);
1.1490 + CActiveScheduler::Start();
1.1491 + TEST2(active->iStatus.Int(), KErrNone);
1.1492 + }
1.1493 + else
1.1494 + TEST2(error, KErrNone);
1.1495 + }
1.1496 +
1.1497 + active->StartL();
1.1498 + client->GetEvent(*event, active->iStatus);
1.1499 + CActiveScheduler::Start();
1.1500 + TEST2(active->iStatus.Int(), KErrNotFound);
1.1501 +
1.1502 + CleanupStack::PopAndDestroy(3, client); // event, active, client
1.1503 + TheTest.Printf(_L("===CLogClient::DeleteEvent() server side OOM test succeeded at iteration %d\n"), failCount);
1.1504 + }
1.1505 +
1.1506 +/**
1.1507 +@SYMTestCaseID SYSLIB-LOGENG-CT-0904
1.1508 +@SYMTestCaseDesc Tests for CLogClient::GetConfig() function
1.1509 +@SYMTestPriority High
1.1510 +@SYMTestActions Set the configuration data with zero values.
1.1511 + Get the log engine configuration data,check for any memory errors.
1.1512 + Tests for the integrity of the data
1.1513 +@SYMTestExpectedResults Test must not fail
1.1514 +@SYMREQ REQ0000
1.1515 +*/
1.1516 +LOCAL_C void TestGetConfig1L()
1.1517 + {
1.1518 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0904 "));
1.1519 +
1.1520 + CLogClient* client = CLogClient::NewL(theFs);
1.1521 + CleanupStack::PushL(client);
1.1522 +
1.1523 + CTestActive* active = new(ELeave)CTestActive();
1.1524 + CleanupStack::PushL(active);
1.1525 +
1.1526 + TLogConfig config;
1.1527 +
1.1528 + TEST(config.iMaxEventAge == 0);
1.1529 + TEST(config.iMaxLogSize == 0);
1.1530 + TEST(config.iMaxRecentLogSize == 0);
1.1531 +
1.1532 + TInt failCount = 0;
1.1533 + TBool finished = EFalse;
1.1534 +
1.1535 + while(!finished)
1.1536 + {
1.1537 + __UHEAP_FAILNEXT(++failCount);
1.1538 + client->GetConfig(config, active->iStatus);
1.1539 +
1.1540 + active->StartL();
1.1541 + CActiveScheduler::Start();
1.1542 +
1.1543 + if (active->iStatus == KErrNone)
1.1544 + finished = ETrue;
1.1545 + else
1.1546 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.1547 +
1.1548 + __UHEAP_RESET;
1.1549 + }
1.1550 +
1.1551 + TEST(config.iMaxEventAge > 0);
1.1552 + TEST(config.iMaxLogSize > 0);
1.1553 + TEST(config.iMaxRecentLogSize > 0);
1.1554 +
1.1555 + CleanupStack::PopAndDestroy(2, client); // active, client
1.1556 + TheTest.Printf(_L("===CLogClient::GetConfig() client side OOM test succeeded at iteration %d\n"), failCount);
1.1557 + }
1.1558 +
1.1559 +/**
1.1560 +@SYMTestCaseID SYSLIB-LOGENG-CT-0905
1.1561 +@SYMTestCaseDesc Tests for CLogClient::GetConfig() function
1.1562 +@SYMTestPriority High
1.1563 +@SYMTestActions Set the configuration data with zero values.
1.1564 + Get the log engine configuration data,check for any memory errors.
1.1565 + Tests for the integrity of the data
1.1566 +@SYMTestExpectedResults Test must not fail
1.1567 +@SYMREQ REQ0000
1.1568 +*/
1.1569 +LOCAL_C void TestGetConfig3L()
1.1570 + {
1.1571 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0905 "));
1.1572 +
1.1573 + CLogClient* client = CLogClient::NewL(theFs);
1.1574 + CleanupStack::PushL(client);
1.1575 +
1.1576 + CTestActive* active = new(ELeave)CTestActive();
1.1577 + CleanupStack::PushL(active);
1.1578 +
1.1579 + TLogConfig config;
1.1580 +
1.1581 + TEST(config.iMaxEventAge == 0);
1.1582 + TEST(config.iMaxLogSize == 0);
1.1583 + TEST(config.iMaxRecentLogSize == 0);
1.1584 +
1.1585 + TInt failCount = 0;
1.1586 + TBool finished = EFalse;
1.1587 +
1.1588 + while(!finished)
1.1589 + {
1.1590 + __LOGSERV_UHEAP_FAILNEXT(++failCount);
1.1591 + client->GetConfig(config, active->iStatus);
1.1592 +
1.1593 + active->StartL();
1.1594 + CActiveScheduler::Start();
1.1595 +
1.1596 + if (active->iStatus == KErrNone)
1.1597 + finished = ETrue;
1.1598 + else
1.1599 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.1600 +
1.1601 + __LOGSERV_UHEAP_RESET;
1.1602 + }
1.1603 +
1.1604 + TEST(config.iMaxEventAge > 0);
1.1605 + TEST(config.iMaxLogSize > 0);
1.1606 + TEST(config.iMaxRecentLogSize > 0);
1.1607 +
1.1608 + CleanupStack::PopAndDestroy(2, client); // active, client
1.1609 + TheTest.Printf(_L("===CLogClient::GetConfig() server side OOM test succeeded at iteration %d\n"), failCount);
1.1610 + }
1.1611 +
1.1612 +/**
1.1613 +@SYMTestCaseID SYSLIB-LOGENG-CT-0906
1.1614 +@SYMTestCaseDesc Tests for CLogClient::ChangeConfig() function
1.1615 +@SYMTestPriority High
1.1616 +@SYMTestActions Get the configuration data and store in temporary object.
1.1617 + Set the new configuration data and change the log engine configuration,check for no memory error
1.1618 + If no memory error,get the configuration data and test for the new changes of the data with the old data.
1.1619 +@SYMTestExpectedResults Test must not fail
1.1620 +@SYMREQ REQ0000
1.1621 +*/
1.1622 +LOCAL_C void TestChangeConfig1L()
1.1623 + {
1.1624 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0906 "));
1.1625 +
1.1626 + CLogClient* client = CLogClient::NewL(theFs);
1.1627 + CleanupStack::PushL(client);
1.1628 +
1.1629 + CTestActive* active = new(ELeave)CTestActive();
1.1630 + CleanupStack::PushL(active);
1.1631 +
1.1632 + TLogConfig configOld;
1.1633 +
1.1634 + active->StartL();
1.1635 + client->GetConfig(configOld, active->iStatus);
1.1636 + CActiveScheduler::Start();
1.1637 + TEST2(active->iStatus.Int(), KErrNone);
1.1638 +
1.1639 + TLogConfig config;
1.1640 +
1.1641 + TInt failCount = 0;
1.1642 + TBool finished = EFalse;
1.1643 + TInt error;
1.1644 +
1.1645 + while(!finished)
1.1646 + {
1.1647 + error = KErrNone;
1.1648 +
1.1649 + config.iMaxLogSize = KTestMaxLogSize;
1.1650 + config.iMaxRecentLogSize = KTestMaxRecentLogSize;
1.1651 + config.iMaxEventAge = KTestMaxEventAge;
1.1652 +
1.1653 + __UHEAP_FAILNEXT(++failCount);
1.1654 + client->ChangeConfig(config, active->iStatus);
1.1655 +
1.1656 + active->StartL();
1.1657 + CActiveScheduler::Start();
1.1658 +
1.1659 + if (active->iStatus == KErrNone)
1.1660 + finished = ETrue;
1.1661 + else
1.1662 + error = active->iStatus.Int();
1.1663 +
1.1664 + __UHEAP_RESET;
1.1665 +
1.1666 + if (error == KErrNoMemory)
1.1667 + {
1.1668 + active->StartL();
1.1669 + client->GetConfig(config, active->iStatus);
1.1670 + CActiveScheduler::Start();
1.1671 + TEST2(active->iStatus.Int(), KErrNone);
1.1672 +
1.1673 + TEST(config.iMaxLogSize == configOld.iMaxLogSize);
1.1674 + TEST(config.iMaxRecentLogSize == configOld.iMaxRecentLogSize);
1.1675 + TEST(config.iMaxEventAge == configOld.iMaxEventAge);
1.1676 + }
1.1677 + else
1.1678 + TEST2(error, KErrNone);
1.1679 + }
1.1680 +
1.1681 + TEST(config.iMaxLogSize == KTestMaxLogSize);
1.1682 + TEST(config.iMaxRecentLogSize == KTestMaxRecentLogSize);
1.1683 + TEST(config.iMaxEventAge == KTestMaxEventAge);
1.1684 +
1.1685 + CleanupStack::PopAndDestroy(2, client); // active, client
1.1686 + TheTest.Printf(_L("===CLogClient::ChangeConfig() client side OOM test succeeded at iteration %d\n"), failCount);
1.1687 + }
1.1688 +
1.1689 +/**
1.1690 +@SYMTestCaseID SYSLIB-LOGENG-CT-0907
1.1691 +@SYMTestCaseDesc Tests for CLogClient::ChangeConfig() function
1.1692 +@SYMTestPriority High
1.1693 +@SYMTestActions Get the configuration data and store in temporary object.
1.1694 + Set the new configuration data and change the log engine configuration,check for no memory error
1.1695 + If no memory error,get the configuration data and test for the new changes of the data with the old data.
1.1696 +@SYMTestExpectedResults Test must not fail
1.1697 +@SYMREQ REQ0000
1.1698 +*/
1.1699 +LOCAL_C void TestChangeConfig3L()
1.1700 + {
1.1701 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0907 "));
1.1702 +
1.1703 + CLogClient* client = CLogClient::NewL(theFs);
1.1704 + CleanupStack::PushL(client);
1.1705 +
1.1706 + CTestActive* active = new(ELeave)CTestActive();
1.1707 + CleanupStack::PushL(active);
1.1708 +
1.1709 + TLogConfig configOld;
1.1710 +
1.1711 + active->StartL();
1.1712 + client->GetConfig(configOld, active->iStatus);
1.1713 + CActiveScheduler::Start();
1.1714 + TEST2(active->iStatus.Int(), KErrNone);
1.1715 +
1.1716 + TLogConfig config;
1.1717 +
1.1718 + TInt failCount = 0;
1.1719 + TBool finished = EFalse;
1.1720 + TInt error;
1.1721 +
1.1722 + while(!finished)
1.1723 + {
1.1724 + error = KErrNone;
1.1725 +
1.1726 + config.iMaxLogSize = KTestMaxLogSize;
1.1727 + config.iMaxRecentLogSize = KTestMaxRecentLogSize;
1.1728 + config.iMaxEventAge = KTestMaxEventAge;
1.1729 +
1.1730 + __LOGSERV_UHEAP_FAILNEXT(++failCount);
1.1731 + client->ChangeConfig(config, active->iStatus);
1.1732 +
1.1733 + active->StartL();
1.1734 + CActiveScheduler::Start();
1.1735 +
1.1736 + if (active->iStatus == KErrNone)
1.1737 + finished = ETrue;
1.1738 + else
1.1739 + error = active->iStatus.Int();
1.1740 +
1.1741 + __LOGSERV_UHEAP_RESET;
1.1742 +
1.1743 + if (error == KErrNoMemory)
1.1744 + {
1.1745 + active->StartL();
1.1746 + client->GetConfig(config, active->iStatus);
1.1747 + CActiveScheduler::Start();
1.1748 + TEST2(active->iStatus.Int(), KErrNone);
1.1749 +
1.1750 + TEST(config.iMaxLogSize == configOld.iMaxLogSize);
1.1751 + TEST(config.iMaxRecentLogSize == configOld.iMaxRecentLogSize);
1.1752 + TEST(config.iMaxEventAge == configOld.iMaxEventAge);
1.1753 + }
1.1754 + else
1.1755 + TEST2(error, KErrNone);
1.1756 + }
1.1757 +
1.1758 + TEST(config.iMaxLogSize == KTestMaxLogSize);
1.1759 + TEST(config.iMaxRecentLogSize == KTestMaxRecentLogSize);
1.1760 + TEST(config.iMaxEventAge == KTestMaxEventAge);
1.1761 +
1.1762 + CleanupStack::PopAndDestroy(2, client); // active, client
1.1763 + TheTest.Printf(_L("===CLogClient::ChangeConfig() server side OOM test succeeded at iteration %d\n"), failCount);
1.1764 + }
1.1765 +
1.1766 +/**
1.1767 +@SYMTestCaseID SYSLIB-LOGENG-CT-0908
1.1768 +@SYMTestCaseDesc Tests for CLogClient::GetString() function
1.1769 +@SYMTestPriority High
1.1770 +@SYMTestActions Get the standard string name from the resource.
1.1771 + Tests for no memory error and null string.
1.1772 +@SYMTestExpectedResults Test must not fail
1.1773 +@SYMREQ REQ0000
1.1774 +*/
1.1775 +LOCAL_C void TestGetString1L()
1.1776 + {
1.1777 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0908 "));
1.1778 +
1.1779 + CLogClient* client = CLogClient::NewL(theFs);
1.1780 + CleanupStack::PushL(client);
1.1781 +
1.1782 + TBuf<KLogMaxSharedStringLength> str;
1.1783 +
1.1784 + TInt failCount = 0;
1.1785 + TBool finished = EFalse;
1.1786 + TInt error;
1.1787 +
1.1788 + while(!finished)
1.1789 + {
1.1790 + __UHEAP_FAILNEXT(++failCount);
1.1791 +
1.1792 + error = client->GetString(str, R_LOG_DIR_IN);
1.1793 +
1.1794 + __UHEAP_RESET;
1.1795 +
1.1796 + if (error == KErrNone)
1.1797 + {
1.1798 + finished = ETrue;
1.1799 + TEST(str.Length() > 0);
1.1800 + }
1.1801 + else
1.1802 + {
1.1803 + TEST2(error, KErrNoMemory);
1.1804 + TEST(str.Length() == 0);
1.1805 + }
1.1806 + }
1.1807 + CleanupStack::PopAndDestroy(client);
1.1808 + TheTest.Printf(_L("===CLogClient::GetString() client side OOM test succeeded at iteration %d\n"), failCount);
1.1809 + }
1.1810 +
1.1811 +/**
1.1812 +@SYMTestCaseID SYSLIB-LOGENG-CT-0909
1.1813 +@SYMTestCaseDesc Tests for CLogClient::ClearLog() function
1.1814 +@SYMTestPriority High
1.1815 +@SYMTestActions Add 4 events to the event log,check for no errors
1.1816 + Clear the log by calling ClearLog function.
1.1817 + Try for getting the before added 4 events and check for not found error.
1.1818 +@SYMTestExpectedResults Test must not fail
1.1819 +@SYMREQ REQ0000
1.1820 +*/
1.1821 +LOCAL_C void TestClearEventLog1L(TBool aMicroSeconds)
1.1822 + {
1.1823 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0909 "));
1.1824 +
1.1825 + CLogClient* client = CLogClient::NewL(theFs);
1.1826 + CleanupStack::PushL(client);
1.1827 +
1.1828 + TTime now;
1.1829 + now.UniversalTime();
1.1830 +
1.1831 + TDateTime dt(now.DateTime());
1.1832 + if(!aMicroSeconds)
1.1833 + dt.SetMicroSecond(0);
1.1834 + dt.SetYear(dt.Year() - 1);
1.1835 + TTime date1(dt);
1.1836 +
1.1837 + dt.SetYear(dt.Year() - 1);
1.1838 + TTime date2(dt);
1.1839 +
1.1840 + TTime ClearThreshold(date1);
1.1841 + ClearThreshold -= TTimeIntervalSeconds(1);
1.1842 + /*need to use set the clear threshold (at least 1 sec) before the date of event 1,2.
1.1843 + Otherwise the test will fail if now happens to occur at 0 microseconds (e.g the
1.1844 + last 6 digit of now is 0) */
1.1845 +
1.1846 + CTestActive* active = new(ELeave)CTestActive();
1.1847 + CleanupStack::PushL(active);
1.1848 +
1.1849 + CLogEvent* event1 = CLogEvent::NewL();
1.1850 + CleanupStack::PushL(event1);
1.1851 + event1->SetEventType(KTestEventUid);
1.1852 +
1.1853 + active->StartL();
1.1854 + client->AddEvent(*event1, active->iStatus);
1.1855 + CActiveScheduler::Start();
1.1856 + TEST2(active->iStatus.Int(), KErrNone);
1.1857 +
1.1858 + event1->SetTime(date1);
1.1859 +
1.1860 + active->StartL();
1.1861 + client->ChangeEvent(*event1, active->iStatus);
1.1862 + CActiveScheduler::Start();
1.1863 + TEST2(active->iStatus.Int(), KErrNone);
1.1864 +
1.1865 + CLogEvent* event2 = CLogEvent::NewL();
1.1866 + CleanupStack::PushL(event2);
1.1867 + event2->SetEventType(KTestEventUid);
1.1868 +
1.1869 + active->StartL();
1.1870 + client->AddEvent(*event2, active->iStatus);
1.1871 + CActiveScheduler::Start();
1.1872 + TEST2(active->iStatus.Int(), KErrNone);
1.1873 +
1.1874 + event2->SetTime(date1);
1.1875 +
1.1876 + active->StartL();
1.1877 + client->ChangeEvent(*event2, active->iStatus);
1.1878 + CActiveScheduler::Start();
1.1879 + TEST2(active->iStatus.Int(), KErrNone);
1.1880 +
1.1881 + CLogEvent* event3 = CLogEvent::NewL();
1.1882 + CleanupStack::PushL(event3);
1.1883 + event3->SetEventType(KTestEventUid);
1.1884 +
1.1885 + active->StartL();
1.1886 + client->AddEvent(*event3, active->iStatus);
1.1887 + CActiveScheduler::Start();
1.1888 + TEST2(active->iStatus.Int(), KErrNone);
1.1889 +
1.1890 + event3->SetTime(date2);
1.1891 +
1.1892 + active->StartL();
1.1893 + client->ChangeEvent(*event3, active->iStatus);
1.1894 + CActiveScheduler::Start();
1.1895 + TEST2(active->iStatus.Int(), KErrNone);
1.1896 +
1.1897 + CLogEvent* event4 = CLogEvent::NewL();
1.1898 + CleanupStack::PushL(event4);
1.1899 + event4->SetEventType(KTestEventUid);
1.1900 +
1.1901 + active->StartL();
1.1902 + client->AddEvent(*event4, active->iStatus);
1.1903 + CActiveScheduler::Start();
1.1904 + TEST2(active->iStatus.Int(), KErrNone);
1.1905 +
1.1906 + event4->SetTime(date2);
1.1907 +
1.1908 + active->StartL();
1.1909 + client->ChangeEvent(*event4, active->iStatus);
1.1910 + CActiveScheduler::Start();
1.1911 + TEST2(active->iStatus.Int(), KErrNone);
1.1912 +
1.1913 + TInt failCount = 0;
1.1914 + TBool finished = EFalse;
1.1915 +
1.1916 + while(!finished)
1.1917 + {
1.1918 + __UHEAP_FAILNEXT(++failCount);
1.1919 +
1.1920 + client->ClearLog(ClearThreshold, active->iStatus);
1.1921 +
1.1922 + __UHEAP_RESET;
1.1923 +
1.1924 + active->StartL();
1.1925 + CActiveScheduler::Start();
1.1926 +
1.1927 + if (active->iStatus == KErrNone)
1.1928 + finished = ETrue;
1.1929 + else
1.1930 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.1931 + }
1.1932 +
1.1933 + active->StartL();
1.1934 + client->GetEvent(*event1, active->iStatus);
1.1935 + CActiveScheduler::Start();
1.1936 + if (active->iStatus != KErrNone)
1.1937 + TheTest.Printf(_L("error code:%d failcoount:%d\n"),active->iStatus.Int(),failCount);
1.1938 + TEST2(active->iStatus.Int(), KErrNone);
1.1939 +
1.1940 + active->StartL();
1.1941 + client->GetEvent(*event2, active->iStatus);
1.1942 + CActiveScheduler::Start();
1.1943 + TEST2(active->iStatus.Int(), KErrNone);
1.1944 +
1.1945 + active->StartL();
1.1946 + client->GetEvent(*event3, active->iStatus);
1.1947 + CActiveScheduler::Start();
1.1948 + TEST2(active->iStatus.Int(), KErrNotFound);
1.1949 +
1.1950 + active->StartL();
1.1951 + client->GetEvent(*event4, active->iStatus);
1.1952 + CActiveScheduler::Start();
1.1953 + TEST2(active->iStatus.Int(), KErrNotFound);
1.1954 +
1.1955 + active->StartL();
1.1956 + client->ClearLog(now, active->iStatus);
1.1957 + CActiveScheduler::Start();
1.1958 + TEST2(active->iStatus.Int(), KErrNone);
1.1959 +
1.1960 + active->StartL();
1.1961 + client->GetEvent(*event1, active->iStatus);
1.1962 + CActiveScheduler::Start();
1.1963 + TEST2(active->iStatus.Int(), KErrNotFound);
1.1964 +
1.1965 + active->StartL();
1.1966 + client->GetEvent(*event2, active->iStatus);
1.1967 + CActiveScheduler::Start();
1.1968 + TEST2(active->iStatus.Int(), KErrNotFound);
1.1969 +
1.1970 + CleanupStack::PopAndDestroy(6, client); // event4, event3, event2, event1, active, client
1.1971 + TheTest.Printf(_L("===CLogClient::ClearLog() client side OOM test succeeded at iteration %d\n"), failCount);
1.1972 + }
1.1973 +
1.1974 +/**
1.1975 +@SYMTestCaseID SYSLIB-LOGENG-CT-0910
1.1976 +@SYMTestCaseDesc Tests for CLogClient::ClearLog() function
1.1977 +@SYMTestPriority High
1.1978 +@SYMTestActions Add 4 events to the event log,check for no errors
1.1979 + Clear the log by calling ClearLog function.
1.1980 + Try for getting the before added 4 events and check for not found error.
1.1981 +@SYMTestExpectedResults Test must not fail
1.1982 +@SYMREQ REQ0000
1.1983 +*/
1.1984 +LOCAL_C void TestClearEventLog3L(TBool aMicroSeconds)
1.1985 + {
1.1986 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0910 "));
1.1987 +
1.1988 + CLogClient* client = CLogClient::NewL(theFs);
1.1989 + CleanupStack::PushL(client);
1.1990 +
1.1991 + TTime now;
1.1992 + now.UniversalTime();
1.1993 +
1.1994 + TDateTime dt(now.DateTime());
1.1995 + if(!aMicroSeconds)
1.1996 + dt.SetMicroSecond(0);
1.1997 + dt.SetYear(dt.Year() - 1);
1.1998 + TTime date1(dt);
1.1999 +
1.2000 + dt.SetYear(dt.Year() - 1);
1.2001 + TTime date2(dt);
1.2002 +
1.2003 + TTime ClearThreshold(date1);
1.2004 + ClearThreshold -= TTimeIntervalSeconds(1);
1.2005 + /*need to use set the clear threshold (at least 1 sec) before the date of event 1,2.
1.2006 + Otherwise the test will fail if now happens to occur at 0 microseconds (e.g the
1.2007 + last 6 digit of now is 0) */
1.2008 +
1.2009 +
1.2010 + CTestActive* active = new(ELeave)CTestActive();
1.2011 + CleanupStack::PushL(active);
1.2012 +
1.2013 + CLogEvent* event1 = CLogEvent::NewL();
1.2014 + CleanupStack::PushL(event1);
1.2015 + event1->SetEventType(KTestEventUid);
1.2016 +
1.2017 + active->StartL();
1.2018 + client->AddEvent(*event1, active->iStatus);
1.2019 + CActiveScheduler::Start();
1.2020 + TEST2(active->iStatus.Int(), KErrNone);
1.2021 +
1.2022 + event1->SetTime(date1);
1.2023 +
1.2024 + active->StartL();
1.2025 + client->ChangeEvent(*event1, active->iStatus);
1.2026 + CActiveScheduler::Start();
1.2027 + TEST2(active->iStatus.Int(), KErrNone);
1.2028 +
1.2029 + CLogEvent* event2 = CLogEvent::NewL();
1.2030 + CleanupStack::PushL(event2);
1.2031 + event2->SetEventType(KTestEventUid);
1.2032 +
1.2033 + active->StartL();
1.2034 + client->AddEvent(*event2, active->iStatus);
1.2035 + CActiveScheduler::Start();
1.2036 + TEST2(active->iStatus.Int(), KErrNone);
1.2037 +
1.2038 + event2->SetTime(date1);
1.2039 +
1.2040 + active->StartL();
1.2041 + client->ChangeEvent(*event2, active->iStatus);
1.2042 + CActiveScheduler::Start();
1.2043 + TEST2(active->iStatus.Int(), KErrNone);
1.2044 +
1.2045 + CLogEvent* event3 = CLogEvent::NewL();
1.2046 + CleanupStack::PushL(event3);
1.2047 + event3->SetEventType(KTestEventUid);
1.2048 +
1.2049 + active->StartL();
1.2050 + client->AddEvent(*event3, active->iStatus);
1.2051 + CActiveScheduler::Start();
1.2052 + TEST2(active->iStatus.Int(), KErrNone);
1.2053 +
1.2054 + event3->SetTime(date2);
1.2055 +
1.2056 + active->StartL();
1.2057 + client->ChangeEvent(*event3, active->iStatus);
1.2058 + CActiveScheduler::Start();
1.2059 + TEST2(active->iStatus.Int(), KErrNone);
1.2060 +
1.2061 + CLogEvent* event4 = CLogEvent::NewL();
1.2062 + CleanupStack::PushL(event4);
1.2063 + event4->SetEventType(KTestEventUid);
1.2064 +
1.2065 + active->StartL();
1.2066 + client->AddEvent(*event4, active->iStatus);
1.2067 + CActiveScheduler::Start();
1.2068 + TEST2(active->iStatus.Int(), KErrNone);
1.2069 +
1.2070 + event4->SetTime(date2);
1.2071 +
1.2072 + active->StartL();
1.2073 + client->ChangeEvent(*event4, active->iStatus);
1.2074 + CActiveScheduler::Start();
1.2075 + TEST2(active->iStatus.Int(), KErrNone);
1.2076 +
1.2077 + TInt failCount = 0;
1.2078 + TBool finished = EFalse;
1.2079 +
1.2080 + while(!finished)
1.2081 + {
1.2082 + __LOGSERV_UHEAP_FAILNEXT(++failCount);
1.2083 +
1.2084 + client->ClearLog(ClearThreshold, active->iStatus);
1.2085 +
1.2086 + __LOGSERV_UHEAP_RESET;
1.2087 +
1.2088 + active->StartL();
1.2089 + CActiveScheduler::Start();
1.2090 +
1.2091 + if (active->iStatus == KErrNone)
1.2092 + finished = ETrue;
1.2093 + else
1.2094 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.2095 + }
1.2096 +
1.2097 + active->StartL();
1.2098 + client->GetEvent(*event1, active->iStatus);
1.2099 + CActiveScheduler::Start();
1.2100 + TEST2(active->iStatus.Int(), KErrNone);
1.2101 +
1.2102 + active->StartL();
1.2103 + client->GetEvent(*event2, active->iStatus);
1.2104 + CActiveScheduler::Start();
1.2105 + TEST2(active->iStatus.Int(), KErrNone);
1.2106 +
1.2107 + active->StartL();
1.2108 + client->GetEvent(*event3, active->iStatus);
1.2109 + CActiveScheduler::Start();
1.2110 + TEST2(active->iStatus.Int(), KErrNotFound);
1.2111 +
1.2112 + active->StartL();
1.2113 + client->GetEvent(*event4, active->iStatus);
1.2114 + CActiveScheduler::Start();
1.2115 + TEST2(active->iStatus.Int(), KErrNotFound);
1.2116 +
1.2117 + active->StartL();
1.2118 + client->ClearLog(now, active->iStatus);
1.2119 + CActiveScheduler::Start();
1.2120 + TEST2(active->iStatus.Int(), KErrNone);
1.2121 +
1.2122 + active->StartL();
1.2123 + client->GetEvent(*event1, active->iStatus);
1.2124 + CActiveScheduler::Start();
1.2125 + TEST2(active->iStatus.Int(), KErrNotFound);
1.2126 +
1.2127 + active->StartL();
1.2128 + client->GetEvent(*event2, active->iStatus);
1.2129 + CActiveScheduler::Start();
1.2130 + TEST2(active->iStatus.Int(), KErrNotFound);
1.2131 +
1.2132 + CleanupStack::PopAndDestroy(6, client); // event4, event3, event2, event1, active, client
1.2133 + TheTest.Printf(_L("===CLogClient::ClearLog() server side OOM test succeeded at iteration %d\n"), failCount);
1.2134 + }
1.2135 +
1.2136 + /**
1.2137 +@SYMTestCaseID SYSLIB-LOGENG-CT-1910
1.2138 +@SYMTestCaseDesc Tests for CLogClient::ClearLog() under boundary conditions
1.2139 +@SYMTestPriority High
1.2140 +@SYMTestActions Add 4 events to the event log,check for no errors
1.2141 + Clear the log by calling ClearLog function.
1.2142 + However using the date for 2 events the same as the clear date threshold.
1.2143 + Try for getting the before added 4 events and check for not found error.
1.2144 +@SYMTestExpectedResults Test must not fail
1.2145 +@SYMDEF DEF093601
1.2146 +*/
1.2147 +LOCAL_C void TestDEF093601L(TBool aClientTest)
1.2148 + {
1.2149 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1910 "));
1.2150 + if(aClientTest)
1.2151 + TestClearEventLog3L(EFalse);
1.2152 + else
1.2153 + TestClearEventLog1L(EFalse);
1.2154 + }
1.2155 +
1.2156 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
1.2157 +
1.2158 +/**
1.2159 +@SYMTestCaseID PDS-LOGENG-UT-4038
1.2160 +@SYMTestCaseDesc Clear log events with specific SimId - client/server side OOM test.
1.2161 + The test adds 2 events, one of them with a SimId. Then the test
1.2162 + executes CLogClient::ClearLog() in an OOM loop.
1.2163 +@SYMTestActions Clear log events with specific SimId - client/server side OOM test.
1.2164 +@SYMTestExpectedResults Test must not fail
1.2165 +@SYMTestPriority Medium
1.2166 +@SYMREQ REQ12748
1.2167 +*/
1.2168 +void ClearLogSimIdOomTestL(TBool aServerSideOomTest)
1.2169 + {//This test case is compiled only when SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM macro is defined
1.2170 + CLogClient* client = CLogClient::NewL(theFs);
1.2171 + CleanupStack::PushL(client);
1.2172 +
1.2173 + const TSimId KSimId = 4100000000U;
1.2174 + TTime now;
1.2175 + now.UniversalTime();
1.2176 +
1.2177 + TDateTime dt(now.DateTime());
1.2178 + dt.SetYear(dt.Year() - 1);
1.2179 + TTime date(dt);
1.2180 +
1.2181 + TTime threshold(date);
1.2182 + threshold += TTimeIntervalSeconds(10);
1.2183 +
1.2184 + CTestActive* active = new(ELeave)CTestActive();
1.2185 + CleanupStack::PushL(active);
1.2186 +
1.2187 + //////// Event1 ///////////////////////////
1.2188 + CLogEvent* event1 = CLogEvent::NewL();
1.2189 + CleanupStack::PushL(event1);
1.2190 + event1->SetEventType(KTestEventUid);
1.2191 +
1.2192 + active->StartL();
1.2193 + client->AddEvent(*event1, active->iStatus);
1.2194 + CActiveScheduler::Start();
1.2195 + TEST2(active->iStatus.Int(), KErrNone);
1.2196 +
1.2197 + event1->SetTime(date);
1.2198 +
1.2199 + active->StartL();
1.2200 + client->ChangeEvent(*event1, active->iStatus);
1.2201 + CActiveScheduler::Start();
1.2202 + TEST2(active->iStatus.Int(), KErrNone);
1.2203 +
1.2204 + //////// Event2 ///////////////////////////
1.2205 + CLogEvent* event2 = CLogEvent::NewL();
1.2206 + CleanupStack::PushL(event2);
1.2207 + event2->SetEventType(KTestEventUid);
1.2208 +
1.2209 + active->StartL();
1.2210 + client->AddEvent(*event2, active->iStatus);
1.2211 + CActiveScheduler::Start();
1.2212 + TEST2(active->iStatus.Int(), KErrNone);
1.2213 +
1.2214 + event2->SetTime(date);
1.2215 + event2->SetSimId(KSimId);
1.2216 +
1.2217 + active->StartL();
1.2218 + client->ChangeEvent(*event2, active->iStatus);
1.2219 + CActiveScheduler::Start();
1.2220 + TEST2(active->iStatus.Int(), KErrNone);
1.2221 + ////////////////////////////////////////////
1.2222 +
1.2223 + TInt failCount = 0;
1.2224 + TBool finished = EFalse;
1.2225 +
1.2226 + while(!finished)
1.2227 + {
1.2228 + if(aServerSideOomTest)
1.2229 + {
1.2230 + __LOGSERV_UHEAP_FAILNEXT(++failCount);
1.2231 + }
1.2232 + else
1.2233 + {
1.2234 + __UHEAP_FAILNEXT(++failCount);
1.2235 + }
1.2236 +
1.2237 + client->ClearLog(threshold, KSimId, active->iStatus);
1.2238 +
1.2239 + if(aServerSideOomTest)
1.2240 + {
1.2241 + __LOGSERV_UHEAP_RESET;
1.2242 + }
1.2243 + else
1.2244 + {
1.2245 + __UHEAP_RESET;
1.2246 + }
1.2247 +
1.2248 + active->StartL();
1.2249 + CActiveScheduler::Start();
1.2250 +
1.2251 + if (active->iStatus == KErrNone)
1.2252 + finished = ETrue;
1.2253 + else
1.2254 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.2255 + }
1.2256 +
1.2257 + //Check: event1 is without SimId and must not be deleted. event2 is with SimId and should be deleted.
1.2258 + active->StartL();
1.2259 + client->GetEvent(*event1, active->iStatus);
1.2260 + CActiveScheduler::Start();
1.2261 + TEST2(active->iStatus.Int(), KErrNone);
1.2262 +
1.2263 + active->StartL();
1.2264 + client->GetEvent(*event2, active->iStatus);
1.2265 + CActiveScheduler::Start();
1.2266 + TEST2(active->iStatus.Int(), KErrNotFound);
1.2267 +
1.2268 + //Delete all events
1.2269 + active->StartL();
1.2270 + client->ClearLog(now, active->iStatus);
1.2271 + CActiveScheduler::Start();
1.2272 + TEST2(active->iStatus.Int(), KErrNone);
1.2273 +
1.2274 + active->StartL();
1.2275 + client->GetEvent(*event1, active->iStatus);
1.2276 + CActiveScheduler::Start();
1.2277 + TEST2(active->iStatus.Int(), KErrNotFound);
1.2278 +
1.2279 + active->StartL();
1.2280 + client->GetEvent(*event2, active->iStatus);
1.2281 + CActiveScheduler::Start();
1.2282 + TEST2(active->iStatus.Int(), KErrNotFound);
1.2283 +
1.2284 + CleanupStack::PopAndDestroy(4, client); //event2, event1, active, client
1.2285 + TheTest.Printf(_L("===CLogClient::ClearLog() + SimId %S OOM test succeeded at iteration %d\n"), aServerSideOomTest ? &KServerSide : &KClientSide, failCount);
1.2286 + }
1.2287 +
1.2288 +/**
1.2289 +@SYMTestCaseID PDS-LOGENG-UT-4039
1.2290 +@SYMTestCaseDesc Clear log events with specific SimId and recent list- client/server side OOM test.
1.2291 + The test adds 2 events to a recent list, one of them with a SimId. Then the test
1.2292 + executes CLogClient::ClearLog() in an OOM loop.
1.2293 +@SYMTestActions Clear log events with specific SimId and recent list- client/server side OOM test.
1.2294 +@SYMTestExpectedResults Test must not fail
1.2295 +@SYMTestPriority Medium
1.2296 +@SYMREQ REQ12748
1.2297 +*/
1.2298 +void ClearLogRecentSimIdOomTestL(TBool aServerSideOomTest)
1.2299 + {//This test case is compiled only when SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM macro is defined
1.2300 + CLogClient* client = CLogClient::NewL(theFs);
1.2301 + CleanupStack::PushL(client);
1.2302 +
1.2303 + const TSimId KSimId = 4200000000U;
1.2304 + const TUid KEvTypeUid = {KLogCallEventType};
1.2305 + _LIT(KEvDirection, "Missed call");
1.2306 +
1.2307 + CTestActive* active = new(ELeave)CTestActive();
1.2308 + CleanupStack::PushL(active);
1.2309 +
1.2310 + //////// Event1 ///////////////////////////
1.2311 + CLogEvent* event1 = CLogEvent::NewL();
1.2312 + CleanupStack::PushL(event1);
1.2313 + event1->SetEventType(KEvTypeUid);
1.2314 + event1->SetDirection(KEvDirection);
1.2315 + event1->SetNumber(_L("12345678"));
1.2316 +
1.2317 + active->StartL();
1.2318 + client->AddEvent(*event1, active->iStatus);
1.2319 + CActiveScheduler::Start();
1.2320 + TEST2(active->iStatus.Int(), KErrNone);
1.2321 + //////// Event2 ///////////////////////////
1.2322 + CLogEvent* event2 = CLogEvent::NewL();
1.2323 + CleanupStack::PushL(event2);
1.2324 + event2->SetEventType(KEvTypeUid);
1.2325 + event2->SetDirection(KEvDirection);
1.2326 + event2->SetNumber(_L("87654321"));
1.2327 + event2->SetSimId(KSimId);
1.2328 +
1.2329 + active->StartL();
1.2330 + client->AddEvent(*event2, active->iStatus);
1.2331 + CActiveScheduler::Start();
1.2332 + TEST2(active->iStatus.Int(), KErrNone);
1.2333 + ////////////////////////////////////////////
1.2334 +
1.2335 + TInt failCount = 0;
1.2336 + TBool finished = EFalse;
1.2337 +
1.2338 + while(!finished)
1.2339 + {
1.2340 + if(aServerSideOomTest)
1.2341 + {
1.2342 + __LOGSERV_UHEAP_FAILNEXT(++failCount);
1.2343 + }
1.2344 + else
1.2345 + {
1.2346 + __UHEAP_FAILNEXT(++failCount);
1.2347 + }
1.2348 +
1.2349 + client->ClearLog(KLogRecentMissedCalls, KSimId, active->iStatus);
1.2350 +
1.2351 + if(aServerSideOomTest)
1.2352 + {
1.2353 + __LOGSERV_UHEAP_RESET;
1.2354 + }
1.2355 + else
1.2356 + {
1.2357 + __UHEAP_RESET;
1.2358 + }
1.2359 +
1.2360 + active->StartL();
1.2361 + CActiveScheduler::Start();
1.2362 +
1.2363 + if (active->iStatus == KErrNone)
1.2364 + finished = ETrue;
1.2365 + else
1.2366 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.2367 + }
1.2368 +
1.2369 + //Check: event1 is without SimId and must be presented in the view. Event2 is with SimId and should not be in the view.
1.2370 + CLogViewRecent* view = CLogViewRecent::NewL(*client);
1.2371 + CleanupStack::PushL(view);
1.2372 + TBool rc = view->SetRecentListL(KLogRecentMissedCalls, active->iStatus);
1.2373 + TEST(rc);
1.2374 + active->StartL();
1.2375 + CActiveScheduler::Start();
1.2376 + TEST2(active->iStatus.Int(), KErrNone);
1.2377 +
1.2378 + TInt count = view->CountL();
1.2379 + TEST2(count, 1);
1.2380 + rc = view->FirstL(active->iStatus);
1.2381 + TEST(rc);
1.2382 + active->StartL();
1.2383 + CActiveScheduler::Start();
1.2384 + TEST2(active->iStatus.Int(), KErrNone);
1.2385 + const CLogEvent& e = view->Event();
1.2386 + TEST2(e.SimId(), KLogNullSimId);
1.2387 +
1.2388 + CleanupStack::PopAndDestroy(view);
1.2389 +
1.2390 + //Delete all events
1.2391 + active->StartL();
1.2392 + client->ClearLog(KLogRecentMissedCalls, active->iStatus);
1.2393 + CActiveScheduler::Start();
1.2394 + TEST2(active->iStatus.Int(), KErrNone);
1.2395 +
1.2396 + //Check: no events in the recent view list
1.2397 + view = CLogViewRecent::NewL(*client);
1.2398 + CleanupStack::PushL(view);
1.2399 + rc = view->SetRecentListL(KLogRecentMissedCalls, active->iStatus);
1.2400 + TEST(!rc);
1.2401 +
1.2402 + CleanupStack::PopAndDestroy(5, client); //view, event2, event1, active, client
1.2403 + TheTest.Printf(_L("===CLogClient::ClearLog()/Recent + SimId %S OOM test succeeded at iteration %d\n"), aServerSideOomTest ? &KServerSide : &KClientSide, failCount);
1.2404 + }
1.2405 +
1.2406 +#endif//SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
1.2407 +
1.2408 +LOCAL_C void doClientFailureL()
1.2409 + {
1.2410 + TheTest.Next(_L("Server startup"));
1.2411 + TestStartup1L();
1.2412 + User::After(100000);
1.2413 +
1.2414 + TheTest.Next(_L("Construction + create logeng database"));
1.2415 + TestConstruction1L(ETrue); // Creates database
1.2416 + TheTest.Next(_L("Construction + open logeng database"));
1.2417 + TestConstruction1L(EFalse); // Opens existing database
1.2418 + TestUtils::DeleteDatabaseL();
1.2419 + theLog.Write(_L8("Test 1.1 OK\n"));
1.2420 +
1.2421 + TheTest.Next(_L("Add Event Type"));
1.2422 + TestAddEventType1L();
1.2423 + theLog.Write(_L8("Test 1.2 OK\n"));
1.2424 +
1.2425 + TheTest.Next(_L("Get Event Type"));
1.2426 + TestGetEventType1L();
1.2427 + theLog.Write(_L8("Test 1.3 OK\n"));
1.2428 +
1.2429 + TheTest.Next(_L("Change Event Type"));
1.2430 + TestChangeEventType1L();
1.2431 + theLog.Write(_L8("Test 1.4 OK\n"));
1.2432 +
1.2433 + TheTest.Next(_L("Delete Event Type"));
1.2434 + TestDeleteEventType1L();
1.2435 + theLog.Write(_L8("Test 1.5 OK\n"));
1.2436 +
1.2437 + TheTest.Next(_L("Add Event"));
1.2438 + TestAddEvent1L();
1.2439 + theLog.Write(_L8("Test 1.6 OK\n"));
1.2440 +
1.2441 + TheTest.Next(_L("Get Event"));
1.2442 + TestGetEvent1L();
1.2443 + theLog.Write(_L8("Test 1.7 OK\n"));
1.2444 +
1.2445 + TheTest.Next(_L("Change Event"));
1.2446 + TestChangeEvent1L();
1.2447 + theLog.Write(_L8("Test 1.8 OK\n"));
1.2448 +
1.2449 + TheTest.Next(_L("Delete Event"));
1.2450 + TestDeleteEvent1L();
1.2451 + theLog.Write(_L8("Test 1.9 OK\n"));
1.2452 +
1.2453 + TheTest.Next(_L("Get Config"));
1.2454 + TestGetConfig1L();
1.2455 + theLog.Write(_L8("Test 1.10 OK\n"));
1.2456 +
1.2457 + TheTest.Next(_L("Change Config"));
1.2458 + TestChangeConfig1L();
1.2459 + theLog.Write(_L8("Test 1.11 OK\n"));
1.2460 +
1.2461 + TheTest.Next(_L("Get String"));
1.2462 + TestGetString1L();
1.2463 + theLog.Write(_L8("Test 1.12 OK\n"));
1.2464 +
1.2465 + TheTest.Next(_L("Clear Event Log"));
1.2466 + TestClearEventLog1L(ETrue);
1.2467 + theLog.Write(_L8("Test 1.13 OK\n"));
1.2468 +
1.2469 + TheTest.Next(_L("DEF093601"));
1.2470 + TestDEF093601L(EFalse);
1.2471 + theLog.Write(_L8("Test 1.14 OK\n"));
1.2472 +
1.2473 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
1.2474 + TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4038 Clear Event Log + SimId"));
1.2475 + ClearLogSimIdOomTestL(EFalse);
1.2476 + theLog.Write(_L8("Test 1.15 OK\n"));
1.2477 +
1.2478 + TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4039 Clear Event Log/Recent + SimId"));
1.2479 + ClearLogRecentSimIdOomTestL(EFalse);
1.2480 + theLog.Write(_L8("Test 1.16 OK\n"));
1.2481 +#endif
1.2482 + }
1.2483 +
1.2484 +LOCAL_C void doLogServFailureL()
1.2485 + {
1.2486 + TheTest.Next(_L("Construction + create logeng database"));
1.2487 + TestConstruction3L(ETrue); // Creates database
1.2488 + TheTest.Next(_L("Construction + open logeng database"));
1.2489 + TestConstruction3L(EFalse); // Opens existing database
1.2490 + TestUtils::DeleteDatabaseL();
1.2491 + theLog.Write(_L8("Test 2.1 OK\n"));
1.2492 +
1.2493 + TheTest.Next(_L("Add Event Type"));
1.2494 + TestAddEventType3L();
1.2495 + theLog.Write(_L8("Test 2.2 OK\n"));
1.2496 +
1.2497 + TheTest.Next(_L("Get Event Type"));
1.2498 + TestGetEventType3L();
1.2499 + theLog.Write(_L8("Test 2.3 OK\n"));
1.2500 +
1.2501 + TheTest.Next(_L("Change Event Type"));
1.2502 + TestChangeEventType3L();
1.2503 + theLog.Write(_L8("Test 2.4 OK\n"));
1.2504 +
1.2505 + TheTest.Next(_L("Delete Event Type"));
1.2506 + TestDeleteEventType3L();
1.2507 + theLog.Write(_L8("Test 2.5 OK\n"));
1.2508 +
1.2509 + TheTest.Next(_L("Add Event"));
1.2510 + TestAddEvent3L();
1.2511 + theLog.Write(_L8("Test 2.6 OK\n"));
1.2512 +
1.2513 + TheTest.Next(_L("Get Event"));
1.2514 + TestGetEvent3L();
1.2515 + theLog.Write(_L8("Test 2.7 OK\n"));
1.2516 +
1.2517 + TheTest.Next(_L("Change Event"));
1.2518 + TestChangeEvent3L();
1.2519 + theLog.Write(_L8("Test 2.8 OK\n"));
1.2520 +
1.2521 + TheTest.Next(_L("Delete Event"));
1.2522 + TestDeleteEvent3L();
1.2523 + theLog.Write(_L8("Test 2.9 OK\n"));
1.2524 +
1.2525 + TheTest.Next(_L("Get Config"));
1.2526 + TestGetConfig3L();
1.2527 + theLog.Write(_L8("Test 2.10 OK\n"));
1.2528 +
1.2529 + TheTest.Next(_L("Change Config"));
1.2530 + TestChangeConfig3L();
1.2531 + theLog.Write(_L8("Test 2.11 OK\n"));
1.2532 +
1.2533 + TheTest.Next(_L("Clear Event Log"));
1.2534 + TestClearEventLog3L(ETrue);
1.2535 + theLog.Write(_L8("Test 2.12 OK\n"));
1.2536 +
1.2537 + TheTest.Next(_L("DEF093601"));
1.2538 + TestDEF093601L(ETrue);
1.2539 + theLog.Write(_L8("Test 2.13 OK\n"));
1.2540 +
1.2541 +#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
1.2542 + TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4038 Clear Event Log + SimId"));
1.2543 + ClearLogSimIdOomTestL(ETrue);
1.2544 + theLog.Write(_L8("Test 2.14 OK\n"));
1.2545 +
1.2546 + TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4039 Clear Event Log/Recent + SimId"));
1.2547 + ClearLogRecentSimIdOomTestL(ETrue);
1.2548 + theLog.Write(_L8("Test 2.15 OK\n"));
1.2549 +#endif
1.2550 + }
1.2551 +
1.2552 +void doTestsL()
1.2553 + {
1.2554 + TestUtils::Initialize(_L("t_logheap"));
1.2555 +
1.2556 + TheTest.Start(_L("Log Client"));
1.2557 + doClientFailureL();
1.2558 +
1.2559 + TheTest.Next(_L("Log Server"));
1.2560 + doLogServFailureL();
1.2561 + }