Ejemplo n.º 1
0
void CEventLogger::RunL()
{
    // request has completed
    // delete completed event and check if there is a next event pending
    // If LogEng is not supported, a dummy logeng just returns error straight on.
    // but we carry on doing all the requests
    if (iLogEventQueue->Count() >0)
    {
        CLogEvent* nextEventPtr = iLogEventQueue->At(0);
        __ASSERT_DEBUG((nextEventPtr != NULL), AgentPanic(Agent::ENullCLogEventPointerPresentInLogEventQueue));
        if (nextEventPtr->Id() == KGenconnLogWaitingForLogId)
        {
            //Id was not available when the update has been entered because addEvent did not return at that time
            nextEventPtr->SetId(iCurrentLogEvent->Id());
        }
        iCurrentLogEvent->CopyL(*nextEventPtr);
        iLogWrap->Log().ChangeEvent(*iCurrentLogEvent, iStatus);
        SetActive();
        // delete the ongoing CLogEvent we just copied to currentLogEvent
        delete nextEventPtr;
        //remove the pointer from the queue
        iLogEventQueue->Delete(0);
    }
    else if (iNotificationRequestStatus!=NULL)
    {
        // We have finished processing all the log event updates in the queue
        User::RequestComplete(iNotificationRequestStatus, KErrNone);
        iNotificationRequestStatus = NULL;	// did the job, so do need the pointer anymore.
    }
}
Ejemplo n.º 2
0
//See TestUtils::AddEventL(). Adds an event to the LogEng database.
//The event type is set to be: KLogCallEventTypeUid.
//Return: the Id of the added event
static TInt AddEventL()
	{
	TheTestScheduler = new (ELeave) CActiveScheduler;
	CleanupStack::PushL(TheTestScheduler);
	CActiveScheduler::Install(TheTestScheduler);

	CLogClient* client = CLogClient::NewL(theFs);
	CleanupStack::PushL(client);

	CTestActive* active = new(ELeave)CTestActive();
	CleanupStack::PushL(active);

	CLogEvent* event = CLogEvent::NewL();
	CleanupStack::PushL(event);
	
	event->SetEventType(KLogCallEventTypeUid);

	active->StartL();
	client->AddEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	LEAVE_IF_ERROR(active->iStatus.Int());
    TLogId eventId = event->Id();
	
	CleanupStack::PopAndDestroy(4); // scheduler, client, active, event
	TheTestScheduler = NULL;
	return eventId;
	}
Ejemplo n.º 3
0
void NotifyProvider::LogEventL(const CLogEvent &event)
{
    // store new call
    QString number=QString::fromRawData(reinterpret_cast<const QChar*>(event.Number().Ptr()),event.Number().Length());
    QString direction=QString::fromRawData(reinterpret_cast<const QChar*>(event.Direction().Ptr()),event.Direction().Length());
    QString description=QString::fromRawData(reinterpret_cast<const QChar*>(event.Description().Ptr()),event.Description().Length());
    if (description.contains("Voice call")&&direction.contains("Missed call"))
    {
        TTime times=event.Time();
        RTz tzsession;
        tzsession.Connect();
        tzsession.ConvertToLocalTime(times);
        tzsession.Close();
        TDateTime dts=times.DateTime();
        QDate d; QTime t;
        d.setYMD(dts.Year(),dts.Month()+1,dts.Day()+1);
        t.setHMS(dts.Hour(),dts.Minute(),dts.Second());
        QDateTime dt; dt.setDate(d); dt.setTime(t);
        dt=dt.toLocalTime();
        QString time=dt.toString("d.M.yy hh:mm");

        TNotifyInfo info;
        info.time=time;
        info.timeStamp=dt;
        info.sender=number;
        info.text=findContact(number);
        info.id=-1;
        info.type=EMissedCall;
        iNotifiers.insert(0,info);
        qDebug()<<"store call from"<<info.sender;
        prepareNotifier(EMissedCall);
    }
}
Ejemplo n.º 4
0
TInt CEventLogger::UpdateLogEventParam(CLogEvent& aLogEvent, TInt aRConnectionStatusId, const TUid& aDataEventType, const TInt64& aBytesSent, const TInt64& aBytesReceived)
{

    TTime time;
    TInt ret =KErrNone;
    time.UniversalTime();
    TTimeIntervalSeconds interval(0);
    if (time.SecondsFrom(iCurrentLogEvent->Time(),interval) != KErrNone)
    {
        interval = 0;	// no duration available ->error
    }
    if (KConnectionStatusIdNotAvailable != aRConnectionStatusId)
    {
        //status needs to be updated
        TBuf<KLogMaxStatusLength > logStatusBuf;
        iLogWrap->Log().GetString(logStatusBuf, aRConnectionStatusId); // Ignore error - string blank on error which is ok
        aLogEvent.SetStatus(logStatusBuf);
    }
    if ( aDataEventType != TUid::Null())
    {
        aLogEvent.SetEventType(aDataEventType);
    }
    aLogEvent.SetDuration(interval.Int());		//0 or not
    //check if data metrics need to be updated
    TInt64 byteInfoNotAvailable(KBytesInfoNotAvailable);
    if ((aBytesReceived != byteInfoNotAvailable) && (aBytesSent != byteInfoNotAvailable))
    {
        TBuf8<KDatabufferSize> dataBuffer;
        dataBuffer.Num(aBytesSent);
        dataBuffer.Append(TChar(','));
        dataBuffer.AppendNum(aBytesReceived);
        TRAP(ret, aLogEvent.SetDataL(dataBuffer));
    }
    return ret;
}
Ejemplo n.º 5
0
EXPORT_C CLogEvent* CLogEvent::NewL()
/** Creates a new log event detail object.

@return Pointer to the new log event detail object. */
	{
	CLogEvent* self = new(ELeave)CLogEvent;
	CleanupStack::PushL(self);
	self->ConstructL();
	CleanupStack::Pop(); // self
	return self;
	}
Ejemplo n.º 6
0
EXPORT_C TInt CEventLogger::LogDataUpdateEvent(TInt aRConnectionStatusId, const TUid& aDataEventType, const TInt64& aBytesSent, const TInt64& aBytesReceived)
{
    LOGSTRING("GenConn:\tCEventLogger LogDataUpdateEvent");
    TInt ret = KErrNone;
    // check if there is a request ongoing on the current event
    // check if no request pending then start it otherwise wait until the previous request is finished and keep going on.
    //PROBLEM HERE:
    // if LogDataAddEvent has not been called then iCurrentLogEvent->Id() == KLogNullId we do nothing, we should assert
    // if id is not ready yet, iCurrentLogEvent->Id() is equal to KGenconnLogWaitingForLogId and the active object is active.
    // So it is put as a request and it will be updated when the event is ready to be processed otherwise if we don't log at all, we should do nothing.
    if (iCurrentLogEvent->Id() != KLogNullId)
    {
        if (!IsActive() && (iLogEventQueue->Count() ==0))
        {
            // request update straight on
            UpdateLogEventParam(*iCurrentLogEvent, aRConnectionStatusId, aDataEventType, aBytesSent, aBytesReceived);
            iLogWrap->Log().ChangeEvent(*iCurrentLogEvent, iStatus);
            SetActive();
        }
        else
        {
            // add the request to the queue, it will be processed asap
            CLogEvent* eventUpdate = 0;
            TRAP(ret, eventUpdate = CLogEvent::NewL());
            if(KErrNone != ret)
            {
                return ret;
            }
            TRAP(ret, eventUpdate->CopyL(*iCurrentLogEvent));
            if(KErrNone != ret)
            {
                delete eventUpdate;
                return ret;
            }

            ret = UpdateLogEventParam(*eventUpdate, aRConnectionStatusId, aDataEventType, aBytesSent, aBytesReceived);
            if(KErrNone != ret)
            {
                delete eventUpdate;
                return ret;
            }

            // add to the queue
            TRAP(ret, iLogEventQueue->AppendL(eventUpdate));
            if(KErrNone != ret)
            {
                delete eventUpdate;
                return ret;
            }
        }
    }
    return ret;
}
Ejemplo n.º 7
0
/**
@SYMTestCaseID          SYSLIB-LOGENG-CT-0875
@SYMTestCaseDesc	    Tests for maximum logging of configuration data 
@SYMTestPriority 	    High
@SYMTestActions  	    Get the event type configuration data.Set the log size to maximum.
                        Change the log engine configuration data with the new one.Add events to the log
                        Set the filter on the view and check for KErrNone flag.
						Add a new event and disable logging by setting the maximum logging size to zero
						Clear all the events and test for KErrNone and the total count of events.
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void TestMaxLogSizeL(CLogClient& aClient)
	{
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0875 "));
	CLogEvent* event = CLogEvent::NewL();
	CleanupStack::PushL(event);
	event->SetEventType(KLogCallEventTypeUid);

	CTestActive* active = new(ELeave)CTestActive();
	CleanupStack::PushL(active);

	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
	CleanupStack::PushL(view);

	CLogFilter* filter = CLogFilter::NewL();
	CleanupStack::PushL(filter);

	TLogConfig config;

	// Get log configuration
	active->StartL();
	aClient.GetConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Set the maximum log size
	config.iMaxLogSize = KTestEventNum;

	// Change the log engine config
	active->StartL();
	aClient.ChangeConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Initialise the view - There should be no events
	TEST(!view->SetFilterL(*filter, active->iStatus));

	// Add the number of allowed events
	TInt count;
	for(count = 0; count < KTestEventNum; count++)
		{
		active->StartL();
		aClient.AddEvent(*event, active->iStatus);
		CActiveScheduler::Start();
		TEST2(active->iStatus.Int(), KErrNone);
		}

	TEST(view->SetFilterL(*filter, active->iStatus));
	active->StartL();
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// The view should now have the correct number of events
	TEST(view->CountL() == KTestEventNum);

	// Add the same number of events again - the old ones should be deleted
	for(count = 0; count < KTestEventNum; count++)
		{
		TEST(view->SetFilterL(*filter, active->iStatus));
		active->StartL();
		CActiveScheduler::Start();
		TEST2(active->iStatus.Int(), KErrNone);

		// Get the last (oldest) event
		active->StartL();
		view->LastL(active->iStatus);
		CActiveScheduler::Start();
		TEST2(active->iStatus.Int(), KErrNone);

		// Remember the Id
		TLogId id = view->Event().Id();

		// Add another event - the oldest should be removed
		active->StartL();
		aClient.AddEvent(*event, active->iStatus);
		CActiveScheduler::Start();
		TEST2(active->iStatus.Int(), KErrNone);

		// There should be the same number of events in view
		TEST(view->CountL() == KTestEventNum);
		
		event->SetId(id);

		// Try and get the old event
		active->StartL();
		aClient.GetEvent(*event, active->iStatus);
		CActiveScheduler::Start();
		TEST2(active->iStatus.Int(), KErrNotFound);
		}

	// Add an event
	active->StartL();
	aClient.AddEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Check it's there
	active->StartL();
	aClient.GetEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Set the maximum log size to zero, i.e. disable logging
	config.iMaxLogSize = 0;

	// Change the log engine config
	active->StartL();
	aClient.ChangeConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Check the event has gone
	active->StartL();
	aClient.GetEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNotFound);;

	// Add an event
	active->StartL();
	aClient.AddEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNotSupported);

	// Check that event doesn't exist
	active->StartL();
	aClient.GetEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNotFound);;

	User::After(1000000);

	TTime now;
	now.UniversalTime();
	now+=(TTimeIntervalDays) 1;
	// Clear all the events
	active->StartL();
	aClient.ClearLog(now, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	TEST(!view->SetFilterL(*filter, active->iStatus));
	TEST(view->CountL() == 0);

	CleanupStack::PopAndDestroy(4); // filter, view, active, event
	}
Ejemplo n.º 8
0
/**
@SYMTestCaseID          SYSLIB-LOGENG-CT-0877
@SYMTestCaseDesc	    Tests for maximum time for which events can be retained in the log
@SYMTestPriority 	    High
@SYMTestActions  	    Get the event type configuration data.Set maximum log age.
                        Change the log engine configuration data with the new one.Add events to the log
                        Set the date and time of events clear the log and check for errors
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void TestMaxLogAgeL(CLogClient& aClient, TLogAge aMaxLogAge)
	{
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0877 "));
	CLogEvent* event = CLogEvent::NewL();
	CleanupStack::PushL(event);
	event->SetEventType(KLogCallEventTypeUid);

	CTestActive* active = new(ELeave)CTestActive();
	CleanupStack::PushL(active);

	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
	CleanupStack::PushL(view);

	CLogFilter* filter = CLogFilter::NewL();
	CleanupStack::PushL(filter);

	TLogConfig config;

	// Get log configuration
	active->StartL();
	aClient.GetConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Set the maximum log age
	config.iMaxLogSize = KTestEventAge * 2;
	config.iMaxEventAge = aMaxLogAge;

	// Change the log engine config
	active->StartL();
	aClient.ChangeConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Initialise the view - There should be no events
	TEST(!view->SetFilterL(*filter, active->iStatus));

	TTime date;
	date.UniversalTime();

	// Wait a second
	User::After(0x1000000);

	// Add events
	TInt count;
	for(count = 0; count < KTestEventAge * 2; count++)
		{
		active->StartL();
		aClient.AddEvent(*event, active->iStatus);
		CActiveScheduler::Start();
		TEST2(active->iStatus.Int(), KErrNone);

		// Set the time and date of the event
		event->SetTime(date);
		date -= TTimeIntervalDays(1);

		active->StartL();
		aClient.ChangeEvent(*event, active->iStatus);
		CActiveScheduler::Start();
		TEST2(active->iStatus.Int(), KErrNone);
		User::After(1000000);

		TEST(view->SetFilterL(*filter, active->iStatus));
		active->StartL();
		CActiveScheduler::Start();
		TEST2(active->iStatus.Int(), KErrNone);

		// Check the old events have been removed
		if ((count < KTestEventAge) || !aMaxLogAge)
			TEST(view->CountL() == count + 1);
		else
			TEST(view->CountL() == KTestEventAge);
		}

	User::After(0x1000000);
	date.UniversalTime();

	date+=(TTimeIntervalYears )1;

	// Clear all the events
	active->StartL();
	aClient.ClearLog(date, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	TEST(!view->SetFilterL(*filter, active->iStatus));
	TEST(view->CountL() == 0);

	CleanupStack::PopAndDestroy(4); // filter, view, active, event
	}
Ejemplo n.º 9
0
/**
@SYMTestCaseID          SYSLIB-LOGENG-CT-0876
@SYMTestCaseDesc	    Tests for maximum logging of configuration data 
@SYMTestPriority 	    High
@SYMTestActions  	    Get the event type configuration data.Set the log size to maximum.
                        Change the log engine configuration data and add the number of allowed events
                        Reduce the number of allowed events.The old ones should be purged
						Change the log engine config and check for the event count.
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void TestMaxLogSizeConfigL(CLogClient& aClient)
	{
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0876 "));
	CLogEvent* event = CLogEvent::NewL();
	CleanupStack::PushL(event);
	event->SetEventType(KLogCallEventTypeUid);

	CTestActive* active = new(ELeave)CTestActive();
	CleanupStack::PushL(active);

	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
	CleanupStack::PushL(view);

	CLogFilter* filter = CLogFilter::NewL();
	CleanupStack::PushL(filter);

	TLogConfig config;

	// Get log configuration
	active->StartL();
	aClient.GetConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Set the maximum log size
	config.iMaxLogSize = KTestEventNum;

	// Change the log engine config
	active->StartL();
	aClient.ChangeConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Initialise the view - There should be no events
	TEST(!view->SetFilterL(*filter, active->iStatus));

	// Add the number of allowed events
	TInt count;
	for(count = 0; count < KTestEventNum; count++)
		{
		active->StartL();
		aClient.AddEvent(*event, active->iStatus);
		CActiveScheduler::Start();
		TEST2(active->iStatus.Int(), KErrNone);
		}

	TEST(view->SetFilterL(*filter, active->iStatus));
	active->StartL();
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// The view should now have the correct number of events
	TEST(view->CountL() == KTestEventNum);

	// Reduce the number of allowed events
	// The old ones should be purged
	config.iMaxLogSize = KTestEventNum / 2;

	// Change the log engine config
	active->StartL();
	aClient.ChangeConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Check the event count
	TEST(view->SetFilterL(*filter, active->iStatus));
	active->StartL();
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);
	TEST(view->CountL() == KTestEventNum / 2);
		
	User::After(0x1000000);

	TTime now;
	now.UniversalTime();
	now+=(TTimeIntervalDays )1;
	// Clear all the events
	active->StartL();
	aClient.ClearLog(now, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	TEST(!view->SetFilterL(*filter, active->iStatus));
	TEST(view->CountL() == 0);

	CleanupStack::PopAndDestroy(4); // filter, view, active, event
	}
Ejemplo n.º 10
0
EXPORT_C void CLogEvent::CopyL(const CLogEvent& aEvent)
/** Makes a copy of the specified log event.

@param aEvent The log event to be copied. */
	{
	// Set data first as this is the only function that can leave
	// If this function fails nothing will be changed
	SetDataL(aEvent.Data());

	SetId(aEvent.Id());
	SetEventType(aEvent.EventType());
	SetTime(aEvent.Time());
	SetDurationType(aEvent.DurationType());
	SetDuration(aEvent.Duration());
	SetContact(aEvent.Contact());
	SetLink(aEvent.Link());
	SetDescription(aEvent.Description());
	SetRemoteParty(aEvent.RemoteParty());
	SetDirection(aEvent.Direction());
	SetStatus(aEvent.Status());
	SetSubject(aEvent.Subject());
	SetNumber(aEvent.Number());

	ClearFlags(KLogFlagsMask);
	SetFlags(aEvent.Flags());
#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
	SetSimId(aEvent.SimId());
#endif
	}
/**
@SYMTestCaseID SYSLIB-LOGENG-CT-0119
@SYMTestCaseDesc Tests AddEvent, GetEvent, ChangeEvent and DeleteEvent.
@SYMTestPriority High
@SYMTestActions See the description and expected results.
@SYMTestExpectedResults 

1. a client with sufficient capability succeed in all cases would expect the following...
AddEvent - KErrNone
GetEvent - KErrNone
ChangeEvent - KErrNone
DeleteEvent - KErrNone

2. a client with insufficient capability would expect the following results...
AddEvent - KErrPermissionDenied
GetEvent - KErrNone
ChangeEvent - KErrPermissionDenied
DeleteEvent - KErrPermissionDenied

@SYMREQ REQ3431
*/
LOCAL_C void TestBasicL(CLogClient& aClient)
	{
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0119 "));
	CTestActive* active = new(ELeave)CTestActive();
	CleanupStack::PushL(active);

	CLogEvent* event = CLogEvent::NewL();
	CleanupStack::PushL(event);
	
	TTime now;
	now.UniversalTime();

	event->SetEventType(KLogCallEventTypeUid);

	active->StartL();
	aClient.AddEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied);

	if(!TheHiCapability)
		{
		TInt eventId = TestUtils::AddEventL();
		TEST(eventId >= 0);
		event->SetId(eventId);
		}


	TEST(event->EventType() == KLogCallEventTypeUid);

	now = event->Time();

	TLogId id = event->Id();

	event->SetRemoteParty(KTestRemoteParty1);
	event->SetDirection(KTestDirection1);
	event->SetDurationType(KTestDurationType1);
	event->SetDuration(KTestDuration1);
	event->SetStatus(KTestStatus1);
	event->SetSubject(KTestSubject1);
	event->SetNumber(KTestNumber1);
	event->SetContact(KTestContact1);
	event->SetLink(KTestLink1);
	event->SetDataL(KTestData1);

	active->StartL();
	aClient.ChangeEvent(*event, active->iStatus);
	CActiveScheduler::Start();
    TheTest.Printf(_L("TestBasicL(), TheHiCapability=%d, event id=%d\r\n"), TheHiCapability, id);
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied);

	TEST(event->Id() == id );
	TEST(event->EventType() == KLogCallEventTypeUid);

	if(TheHiCapability)
		{
		TEST(event->Description().Length() > 0);
		TEST(event->Time() == now);
		TEST(event->RemoteParty() == KTestRemoteParty1);
		TEST(event->Direction() == KTestDirection1);
		TEST(event->DurationType() == KTestDurationType1);
		TEST(event->Duration() == KTestDuration1);
		TEST(event->Status() == KTestStatus1);
		TEST(event->Subject() == KTestSubject1);
		TEST(event->Number() == KTestNumber1);
		TEST(event->Contact() == KTestContact1);
		TEST(event->Link() == KTestLink1);
		TEST(event->Data() == KTestData1);
		}
		
	CleanupStack::PopAndDestroy(); // event;

	event = CLogEvent::NewL();
	CleanupStack::PushL(event);

	event->SetId(id);

	active->StartL();
	aClient.GetEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied);

	if(TheHiCapability)
		{
		TEST(event->Id() == id);
		TEST(event->EventType() == KLogCallEventTypeUid);
		TEST(event->Description().Length() > 0);
		TEST(event->Time() == now);
		TEST(event->RemoteParty() == KTestRemoteParty1);
		TEST(event->Direction() == KTestDirection1);
		TEST(event->DurationType() == KTestDurationType1);
		TEST(event->Duration() == KTestDuration1);
		TEST(event->Status() == KTestStatus1);
		TEST(event->Subject() == KTestSubject1);
		TEST(event->Number() == KTestNumber1);
		TEST(event->Contact() == KTestContact1);
		TEST(event->Link() == KTestLink1);
		TEST(event->Data() == KTestData1);
		}
			
	active->StartL();
	aClient.DeleteEvent(id, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied);

	active->StartL();
	aClient.GetEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNotFound : KErrPermissionDenied);
	
	// try to delete a non-existent event...
	active->StartL();
	aClient.DeleteEvent(123, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNotFound);

	CleanupStack::PopAndDestroy(2); // event, active
	}
Ejemplo n.º 12
0
/**
@SYMTestCaseID          SYSLIB-LOGENG-CT-0881
@SYMTestCaseDesc	    Tests for purge
@SYMTestPriority 	    High
@SYMTestActions  	    Get the event type data 
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void TestNoPurgeWithGetL(CLogClient& aClient)
	{
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0881 "));
	CLogEvent* event = CLogEvent::NewL();
	CleanupStack::PushL(event);
	event->SetEventType(KLogCallEventTypeUid);

	CTestActive* active = new(ELeave)CTestActive();
	CleanupStack::PushL(active);

	TLogConfig config;

	// Get log configuration
	active->StartL();
	aClient.GetConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Set the maximum log age
	TInt oldAge = config.iMaxEventAge;
	config.iMaxEventAge = 24 * 60 * 60;

	// Change the log engine config
	active->StartL();
	aClient.ChangeConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	active->StartL();
	aClient.AddEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Check that the event can be retrieved
	active->StartL();
	aClient.GetEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Wait for 15 seconds (just to be safe)
	User::After(15000000);

	// Check that the event can still be retrieved
	active->StartL();
	aClient.GetEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Perform a dummy change
	event->SetTime(event->Time() - TTimeIntervalDays(2));
	active->StartL();
	aClient.ChangeEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Check the event has been removed
	active->StartL();
	aClient.GetEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNotFound);;

	// Reset the config
	config.iMaxEventAge = oldAge;

	// Change the log engine config
	active->StartL();
	aClient.ChangeConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	CleanupStack::PopAndDestroy(2); // active, event	
	}
Ejemplo n.º 13
0
/**
@SYMTestCaseID          SYSLIB-LOGENG-CT-0879
@SYMTestCaseDesc	    Tests for maximum number of events that a recent event list holds
@SYMTestPriority 	    High
@SYMTestActions  	    Set the event configuration data of recent log size(10) to maximum and 
						Add events to the log.Set the filter on the view and check for NO error.
	                    Reduce the recent log size(5)  and set the new configuration.
						Clear all the events and test for no errors and the total count of events and the logviewrecent should be zero.
						Tests for CLogViewRecent::SetRecentListL
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void TestMaxRecentSizeConfigL(CLogClient& aClient)
	{
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0879 "));
	CLogEvent* event = CLogEvent::NewL();
	CleanupStack::PushL(event);

	// Incoming
	TBuf<KLogMaxDirectionLength> buf;
	aClient.GetString(buf, R_LOG_DIR_IN);

	event->SetEventType(KLogCallEventTypeUid);
	event->SetDirection(buf);

	CTestActive* active = new(ELeave)CTestActive();
	CleanupStack::PushL(active);

	CLogViewRecent* recent = CLogViewRecent::NewL(aClient);
	CleanupStack::PushL(recent);

	TLogConfig config;

	// Get log configuration
	active->StartL();
	aClient.GetConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Set the maximum log size
	config.iMaxLogSize = KTestRecentNum * 2;
	config.iMaxRecentLogSize = KTestRecentNum;

	// Change the log engine config
	active->StartL();
	aClient.ChangeConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Initialise the views - There should be no events
	TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));

	// Add a number of events
	TInt count;
	for(count = 0; count < KTestRecentNum; count++)
		{
		event->SetContact(count);

		active->StartL();
		aClient.AddEvent(*event, active->iStatus);
		CActiveScheduler::Start();
		TEST2(active->iStatus.Int(), KErrNone);
		}

	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
	active->StartL();
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	TEST(recent->CountL() == KTestRecentNum);

	// Reduce the maximum allowed recent list size
	// The oldest ones should be removed
	config.iMaxRecentLogSize = KTestRecentNum / 2;

	active->StartL();
	aClient.ChangeConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
	active->StartL();
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	TEST(recent->CountL() == KTestRecentNum / 2);
	User::After(0x1000000);

	TTime now;
	now.UniversalTime();
	now+=(TTimeIntervalDays )1;

	// Clear all the events
	active->StartL();
	aClient.ClearLog(now, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
	TEST(recent->CountL() == 0);

	CleanupStack::PopAndDestroy(3); // recent, active, event
	}
Ejemplo n.º 14
0
EXPORT_C void CEventLogger::LogDataAddEvent(TInt aRConnectionStatusId, const TDesC& aRemote, TInt aLogDir, const TDesC& aTelNum, TUid aDataEventType)
{
    LOGSTRING2("GenConn:\tCEventLogger LogDataAddEvent aRConnectionStatusId:%d", aRConnectionStatusId);
    //It is possible to add a new logevent with a new log id for the same connection (reconnect case)
    // assuming that all the next updates will be for the new event and not the old one.

    // [NeilMa 140403]: This method cannot leave and has no return value, but
    // performs memory allocations if the event cannot be logged immediately.
    // Therefore, if the memory alloc fails for any reason, the event is
    // currently discarded with no record. This method should be replaced by
    // one which can Leave or returns an error code. See Typhoon DEF022946.
    TTime time;
    time.UniversalTime();

    if (!IsActive() && (iLogEventQueue->Count() ==0))
    {
        iCurrentLogEvent->SetId(KGenconnLogWaitingForLogId);
        iCurrentLogEvent->SetTime(time);
        TBuf<KLogMaxStatusLength > logStatusBuf;
        iLogWrap->Log().GetString(logStatusBuf, aRConnectionStatusId); // Ignore error - string blank on error which is ok
        iCurrentLogEvent->SetStatus(logStatusBuf);
        iCurrentLogEvent->SetRemoteParty(aRemote);
        TBuf<KLogMaxDirectionLength> logDirBuf;
        iLogWrap->Log().GetString(logDirBuf, aLogDir); // Ignore error - string blank on error which is ok
        iCurrentLogEvent->SetDirection(logDirBuf);
        iCurrentLogEvent->SetNumber(aTelNum);
        iCurrentLogEvent->SetEventType(aDataEventType);
        iCurrentLogEvent->SetDurationType(KLogDurationValid);
        iStatus=KRequestPending;
        iLogWrap->Log().AddEvent(*iCurrentLogEvent, iStatus);
        SetActive();
    }
    else
    {
        // add the request to the queue, it will be processed asap
        CLogEvent* eventUpdate = 0;
        TRAPD(error, eventUpdate = CLogEvent::NewL());
        if (KErrNone != error)
        {
            return; // event is discarded!
        }
        eventUpdate->SetId(KGenconnLogWaitingForLogId);
        eventUpdate->SetTime(time);
        TBuf<KLogMaxStatusLength > logStatusBuf;
        iLogWrap->Log().GetString(logStatusBuf, aRConnectionStatusId); // Ignore error - string blank on error which is ok
        eventUpdate->SetStatus(logStatusBuf);
        eventUpdate->SetRemoteParty(aRemote);
        TBuf<KLogMaxDirectionLength> logDirBuf;
        iLogWrap->Log().GetString(logDirBuf, aLogDir); // Ignore error - string blank on error which is ok
        eventUpdate->SetDirection(logDirBuf);
        eventUpdate->SetNumber(aTelNum);
        eventUpdate->SetEventType(aDataEventType);
        eventUpdate->SetDurationType(KLogDurationValid);
        // add to the queue
        TRAP(error, iLogEventQueue->AppendL(eventUpdate));
        if (KErrNone != error)
        {
            delete eventUpdate; // event is discarded!
            return;
        }
    }
}
Ejemplo n.º 15
0
/**
@SYMTestCaseID          SYSLIB-LOGENG-CT-1010
@SYMTestCaseDesc	    Tests for CLogEvent::NewL(),CLogEvent::SetDataL() functions
@SYMTestPriority 	    High
@SYMTestActions  	    Tests for setting event specific data read from the file and try to read the data back from the event.
                        Check for memory errors
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void TestEventWithFileFailL()
	{
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1010 "));
	CLogEvent* event = CLogEvent::NewL();
	CleanupStack::PushL(event);

	// streaming
	TFileName storename = _L("c:\\T_BASIC_DATA");
	TUid uid={0x12345678};

	// create a store
	theFs.Delete(storename);
	CDictionaryFileStore* store = CDictionaryFileStore::OpenLC(theFs, storename, uid);
	
	RDictionaryWriteStream write;
	RDictionaryReadStream read;

	uid.iUid++;
	write.AssignL(*store, uid);
	write << KNullDesC8;
	write.CommitL();
	write.Close();

	read.OpenL(*store, uid);

	TInt failCount = 0;
	TBool finished = EFalse;
	TInt error;

	theFs.SetErrorCondition(KErrGeneral, 0);
	event->SetDataL(read, 0);
	theFs.SetErrorCondition(KErrNone, 10000);

	read.Close();
	TEST(event->Data() == KNullDesC8);

	HBufC8* buf8 = TestUtils::CreateBuf8LC(100);

	uid.iUid++;
	write.AssignL(*store, uid);
	write.WriteL(buf8->Des());
	write.CommitL();
	write.Close();

	while(!finished)
		{
		read.OpenL(*store, uid);
		theFs.SetErrorCondition(KErrGeneral, failCount++);

		TRAP(error, event->SetDataL(read, 100));

		theFs.SetErrorCondition(KErrGeneral, 10000);

		read.Close();

		if (error == KErrNone)
			{
			TEST(event->Data() == buf8->Des());
			finished = ETrue;
			}
		else
			{
			TEST2(error, KErrGeneral);
			TEST(event->Data() == KNullDesC8);
			}
		}

	CleanupStack::PopAndDestroy(3); // buf8, store, event
	::DeleteDataFile(storename);
	}
Ejemplo n.º 16
0
/**
@SYMTestCaseID          SYSLIB-LOGENG-CT-1009
@SYMTestCaseDesc	    Tests for CLogEvent::NewL(),SetDataL() functions
@SYMTestPriority 	    High
@SYMTestActions  	    Tests for creation of log event on heap and 
                        test for setting  event specific data from the specified stream and try to read the data back.
                        Check for memory errors
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void TestEventWithHeapFailL()
	{
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1009 "));
#ifdef _DEBUG
	TInt failCount = 0;
#endif
	TInt error;
	TBool finished = EFalse;

	CLogEvent* event = NULL;

	while(!finished)
		{
		__UHEAP_FAILNEXT(failCount++);

		TRAP(error, event = CLogEvent::NewL());
		
		__UHEAP_RESET;

		if (error == KErrNone)
			{
			finished = ETrue;
			CleanupStack::PushL(event);
			}
		else
			TEST2(error, KErrNoMemory);
		}

	_LIT8(KDataTest1, "01234567890123456789");
	_LIT8(KDataTest2, "012345678901234567890123456789");

	finished = EFalse;
#ifdef _DEBUG
	failCount = 0;
#endif
	event->SetDataL(KNullDesC8);

	while(!finished)
		{
		__UHEAP_FAILNEXT(failCount++);

		TRAP(error, event->SetDataL(KDataTest1));

		__UHEAP_RESET;

		if (error == KErrNone)
			{
			finished = ETrue;
			TEST(event->Data() == KDataTest1);
			}
		else
			{
			TEST2(error, KErrNoMemory);
			TEST(event->Data() == KNullDesC8);
			}
		}

	finished = EFalse;
#ifdef _DEBUG
	failCount = 0;
#endif
	event->SetDataL(KNullDesC8);

	while(!finished)
		{
		__UHEAP_FAILNEXT(failCount++);

		TRAP(error, event->SetDataL(KDataTest2));

		__UHEAP_RESET;

		if (error == KErrNone)
			{
			finished = ETrue;
			TEST(event->Data() == KDataTest2);
			}
		else
			{
			TEST2(error, KErrNoMemory);
			TEST(event->Data() == KNullDesC8);
			}
		}

	finished = EFalse;
#ifdef _DEBUG
	failCount = 0;
#endif
	event->SetDataL(KNullDesC8);

	// Check we don't get any more failures
	__UHEAP_FAILNEXT(0);
	event->SetDataL(KDataTest2);
	TEST(event->Data() == KDataTest2);
	event->SetDataL(KDataTest1);
	TEST(event->Data() == KDataTest1);
	event->SetDataL(KNullDesC8);
	TEST(event->Data() == KNullDesC8);
	__UHEAP_RESET;

	// streaming
	TFileName storename = _L("c:\\T_BASIC_DATA");
	TUid uid={0x12345678};

	// create a store
	theFs.Delete(storename);
	CDictionaryFileStore* store = CDictionaryFileStore::OpenLC(theFs, storename, uid);
	
	RDictionaryWriteStream write;
	RDictionaryReadStream read;

	uid.iUid++;
	write.AssignL(*store, uid);
	write << KNullDesC8;
	write.CommitL();
	write.Close();

	read.OpenL(*store, uid);

#ifdef _DEBUG
	failCount = 0;
#endif
	finished = EFalse;

	__UHEAP_FAILNEXT(0);
	event->SetDataL(read, 0);
	__UHEAP_RESET;

	read.Close();	
	TEST(event->Data() == KNullDesC8);

	HBufC8* buf8 = TestUtils::CreateBuf8LC(100);

	uid.iUid++;
	write.AssignL(*store, uid);
	write.WriteL(buf8->Des());
	write.CommitL();
	write.Close();

	read.OpenL(*store, uid);

	while(!finished)
		{
		__UHEAP_FAILNEXT(failCount++);

		TRAP(error, event->SetDataL(read, 100));

		__UHEAP_RESET;

		if (error == KErrNone)
			{
			TEST(event->Data() == buf8->Des());
			read.Close();
			finished = ETrue;
			}
		else
			{
			TEST2(error, KErrNoMemory);
			TEST(event->Data() == KNullDesC8);
			}
		}

	event->SetId(0x12345678);
	event->SetEventType(TUid::Uid(0x12345678));

	HBufC* buf = TestUtils::CreateBufLC(KLogMaxRemotePartyLength / 2);
	event->SetRemoteParty(buf->Des());
	CleanupStack::PopAndDestroy(); // buf

	buf = TestUtils::CreateBufLC(KLogMaxDirectionLength / 2);
	event->SetDirection(buf->Des());
	CleanupStack::PopAndDestroy(); // buf

	TTime time;

	time.UniversalTime();
	event->SetTime(time);
	TEST(event->Time() == time);

	event->SetDurationType(0xf);
	event->SetDuration(0x12345678);

	buf = TestUtils::CreateBufLC(KLogMaxStatusLength / 2);
	event->SetStatus(buf->Des());
	CleanupStack::PopAndDestroy(); // buf

	buf = TestUtils::CreateBufLC(KLogMaxSubjectLength / 2);
	event->SetSubject(buf->Des());
	CleanupStack::PopAndDestroy(); // buf

	buf = TestUtils::CreateBufLC(KLogMaxNumberLength / 2);
	event->SetNumber(buf->Des());
	CleanupStack::PopAndDestroy(); // buf

	event->SetContact(0x12345678);
	event->SetLink(0x12345678);

	buf = TestUtils::CreateBufLC(KLogMaxDescriptionLength / 2);
	event->SetDescription(buf->Des());
	CleanupStack::PopAndDestroy(); // buf

	event->SetFlags(0xA);

	buf8 = TestUtils::CreateBuf8LC(100);
	event->SetDataL(buf8->Des());
	TEST(event->Data() == buf8->Des());
	CleanupStack::PopAndDestroy(); // buf8

	CLogEvent* event1 = CLogEvent::NewL();
	CleanupStack::PushL(event1);

	CLogEvent* event2 = CLogEvent::NewL();
	CleanupStack::PushL(event2);

	TEST(TestUtils::EventsEqual(*event1, *event2));

	finished = EFalse;
#ifdef _DEBUG
	failCount = 0;
#endif

	while(!finished)
		{
		__UHEAP_FAILNEXT(failCount++);

		TRAP(error, event1->CopyL(*event));

		__UHEAP_RESET;

		if (error == KErrNone)
			{
			TEST(!TestUtils::EventsEqual(*event1, *event2));
			TEST(TestUtils::EventsEqual(*event1, *event));
			finished = ETrue;
			}
		else
			{
			TEST2(error, KErrNoMemory);
			TEST(TestUtils::EventsEqual(*event1, *event2));
			TEST(!TestUtils::EventsEqual(*event1, *event));
			}
		}

	CleanupStack::PopAndDestroy(5); // buf8, store, event, event1, event2
	::DeleteDataFile(storename);
	}
Ejemplo n.º 17
0
TBool CompareEvents(const CLogEvent& aLeft, const CLogEvent& aRight)
	{
	TBool ret = aLeft.Data() == aRight.Data();
	ret = ret && aLeft.Description() == aRight.Description();
	ret = ret && aLeft.Direction() == aRight.Direction();
	ret = ret && aLeft.Duration() == aRight.Duration();
	ret = ret && aLeft.DurationType() == aRight.DurationType();
	ret = ret && aLeft.EventType() == aRight.EventType();
	ret = ret && aLeft.Flags() == aRight.Flags();
	ret = ret && aLeft.Id() == aRight.Id();
	ret = ret && aLeft.Link() == aRight.Link();
	ret = ret && aLeft.Number() == aRight.Number();
	ret = ret && aLeft.RemoteParty() == aRight.RemoteParty();
	ret = ret && aLeft.Status() == aRight.Status();
	ret = ret && aLeft.Subject() == aRight.Subject();
	ret = ret && aLeft.Time() == aRight.Time();
	return ret;
	}
Ejemplo n.º 18
0
/**
@SYMTestCaseID          SYSLIB-LOGENG-CT-0880
@SYMTestCaseDesc	    Tests for CLogViewRecent::SetRecentListL(),CLogViewRecent::DuplicatesL() functions
@SYMTestPriority 	    High
@SYMTestActions  	    Set the event configuration data of recent log size(10) to maximum and 
						Add events to the log.Set the filter on the view and check for NO error.
	                    Reduce the recent log size(5)  and set the new configuration.
						Clear all the events and test for no errors and the total count of events and the logviewrecent should be zero.
						Tests for CLogViewRecent::SetRecentListL()
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void TestMaxRecentSize2L(CLogClient& aClient)
	{
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0880 "));
	CLogEvent* event = CLogEvent::NewL();
	CleanupStack::PushL(event);

	// Incoming
	TBuf<KLogMaxDirectionLength> buf;
	aClient.GetString(buf, R_LOG_DIR_IN);

	event->SetEventType(KLogCallEventTypeUid);
	event->SetDirection(buf);

	CTestActive* active = new(ELeave)CTestActive();
	CleanupStack::PushL(active);

	CLogViewRecent* recent = CLogViewRecent::NewL(aClient);
	CleanupStack::PushL(recent);

	CLogViewDuplicate* dup = CLogViewDuplicate::NewL(aClient);
	CleanupStack::PushL(dup);

	CLogFilter* filter = CLogFilter::NewL();
	CleanupStack::PushL(filter);

	TLogConfig config;

	// Get log configuration
	active->StartL();
	aClient.GetConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Set the maximum log size
	config.iMaxLogSize = (KTestRecentNum * KTestDuplicateNum) * 2;
	config.iMaxRecentLogSize = KTestRecentNum;

	// Change the log engine config
	active->StartL();
	aClient.ChangeConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// Initialise the view - There should be no events
	TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));

	// Add a number of events
	TInt count;
	for(count = 0; count < KTestRecentNum; count++)
		{
		TBuf<KLogMaxRemotePartyLength> buf;
		buf.Format(KTestRemoteParty, count);
		event->SetRemoteParty(buf);

		active->StartL();
		aClient.AddEvent(*event, active->iStatus);
		CActiveScheduler::Start();
		TEST2(active->iStatus.Int(), KErrNone);

		// Add some duplicates
		TInt duplicate;
		for(duplicate = 0; duplicate < KTestDuplicateNum; duplicate++)
			{
			active->StartL();
			aClient.AddEvent(*event, active->iStatus);
			CActiveScheduler::Start();
			TEST2(active->iStatus.Int(), KErrNone);
			}

		// The views should now have the correct number of events
		TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
		active->StartL();
		CActiveScheduler::Start();
		TEST2(active->iStatus.Int(), KErrNone);

		TEST(recent->CountL() == count + 1);

		TEST(recent->DuplicatesL(*dup, active->iStatus));
		active->StartL();
		CActiveScheduler::Start();
		TEST2(active->iStatus.Int(), KErrNone);

		TEST(dup->CountL() == KTestDuplicateNum);
		}

	event->SetRemoteParty(KNullDesC);

	// Add the more events - the old ones should be removed
	for(count = 0; count < KTestRecentNum; count++)
		{
		// Add another event - the oldest should be removed from recent list
		active->StartL();
		aClient.AddEvent(*event, active->iStatus);
		CActiveScheduler::Start();
		TEST2(active->iStatus.Int(), KErrNone);

		TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
		active->StartL();
		CActiveScheduler::Start();
		TEST2(active->iStatus.Int(), KErrNone);

		// Check an event has been removed from recent view
		TEST(recent->CountL() == KTestRecentNum);
		}

	User::After(0x1000000);

	TTime now;
	now.UniversalTime();
	now+=(TTimeIntervalDays )1;

	// Clear all the events
	active->StartL();
	aClient.ClearLog(now, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	TEST(!recent->DuplicatesL(*dup, active->iStatus));

	CleanupStack::PopAndDestroy(5); // filter, dup, recent, active, event
	}
Ejemplo n.º 19
0
//See TestUtils::AddViewTestEventsL(). Adds events to the LogEng database.
static void AddTestEventsL()
	{
	TheTestScheduler = new (ELeave) CActiveScheduler;
	CleanupStack::PushL(TheTestScheduler);
	CActiveScheduler::Install(TheTestScheduler);
	
	CTestActive* active = new(ELeave)CTestActive;
	CleanupStack::PushL(active);

 	CLogClient* client = CLogClient::NewL(theFs);
	CleanupStack::PushL(client);
	
	TLogString direction;
	client->GetString(direction, R_LOG_DIR_IN);

	// Create a test event type
	CLogEventType* type = CLogEventType::NewL();
	CleanupStack::PushL(type);
	type->SetUid(KTestEventUid);
	type->SetDescription(KTestEventDesc);
	type->SetLoggingEnabled(ETrue);

	// Register the event type
	active->StartL();
	client->AddEventType(*type, active->iStatus);
	CActiveScheduler::Start();
	LEAVE_IF_ERROR(active->iStatus.Int());
	
	// Now add some events...
	//
	CLogEvent* event = CLogEvent::NewL();
	CleanupStack::PushL(event);
	//
	event->SetEventType(KLogCallEventTypeUid);
	event->SetContact(KTestContact1);
	event->SetDirection(direction);
	event->SetDurationType(KLogDurationValid);
	event->SetNumber(KTestNumber1);
	event->SetRemoteParty(KTestRemote1);
	event->SetStatus(KTestStatus1);

	// Add event
	active->StartL();
	client->AddEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	LEAVE_IF_ERROR(active->iStatus.Int());
	//
	
	event->SetEventType(KTestEventUid);	// low cap visible
	event->SetContact(KTestContact1);
	event->SetDirection(direction);
	event->SetDurationType(KLogDurationNone);
	event->SetNumber(KTestNumber1);
	event->SetRemoteParty(KTestRemote1);
	event->SetStatus(KTestStatus1);

	// Add event
	active->StartL();
	client->AddEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	LEAVE_IF_ERROR(active->iStatus.Int());
	//
		
	event->SetEventType(KLogCallEventTypeUid);
	event->SetContact(KTestContact2);
	event->SetDirection(direction);
	event->SetDurationType(KLogDurationValid);
	event->SetNumber(KTestNumber1);
	event->SetRemoteParty(KTestRemote2);
	event->SetStatus(KTestStatus2);

	// Add event and 4 duplicates
	for(TInt i=0; i<5; i++)
		{
		active->StartL();
		client->AddEvent(*event, active->iStatus);
		CActiveScheduler::Start();
		LEAVE_IF_ERROR(active->iStatus.Int());
		}
	
	event->SetEventType(KTestEventUid);	// low cap visible
	event->SetContact(KTestContact2);
	event->SetDirection(KTestDirection1);
	event->SetDurationType(KLogDurationData);
	event->SetNumber(KTestNumber1);
	event->SetRemoteParty(KTestRemote3);
	event->SetStatus(KTestStatusT3);

	// Add event
	active->StartL();
	client->AddEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	LEAVE_IF_ERROR(active->iStatus.Int());
	
	CleanupStack::PopAndDestroy(5);	// event, client, type, active, scheduler
	TheTestScheduler = NULL;
	}
Ejemplo n.º 20
0
/**
@SYMTestCaseID          SYSLIB-LOGENG-CT-0883
@SYMTestCaseDesc	    Tests for CLogClient::ClearLog() function
@SYMTestPriority 	    High
@SYMTestActions  	    Change locale settings,call up ClearLog and try to retrieve event,test for count of number of events in the view.
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void TestClearLog2L(CLogClient& aClient)
	{
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0883 "));
	CLogEvent* event = CLogEvent::NewL();
	CleanupStack::PushL(event);
	event->SetEventType(KLogCallEventTypeUid);

	CTestActive* active = new(ELeave)CTestActive();
	CleanupStack::PushL(active);

	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
	CleanupStack::PushL(view);

	// change Locale
	TLocale locale;
	locale.SetCountryCode(47);//Norway
	locale.SetDateFormat(EDateEuropean);
	locale.SetTimeFormat(ETime12);
	for (int i=0; i<4; i++)
         {
         locale.SetTimeSeparator(TChar('.'),i);
         locale.SetDateSeparator(TChar(':'),i);
         }
	locale.Set();

	// change the log duration settings to 1 day  
	TLogConfig config;
	active->StartL();
	aClient.GetConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	config.iMaxLogSize = KTestEventAge * 2;
	config.iMaxEventAge = 86400;
	active->StartL();
	aClient.ChangeConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// add a call event
	active->StartL();
	aClient.AddEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);
	User::After(1000000);
	TTime now;
	now.HomeTime();	
	event->SetTime(now);
	active->StartL();
	aClient.ChangeEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// forward two days
	now+=(TTimeIntervalDays )2;
	User::SetHomeTime(now);
		
	active->StartL();
	aClient.ClearLog(now, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// try to retrieve event
	active->StartL();
	aClient.GetEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNotFound);;

	TEST(view->CountL() == 0);

	CleanupStack::PopAndDestroy(3); // view, active, event
	}
Ejemplo n.º 21
0
/**
@SYMTestCaseID          SYSLIB-LOGENG-CT-1022
@SYMTestCaseDesc	    Tests for operations on log database
@SYMTestPriority 	    High
@SYMTestActions  	    Check by add new event,change the event,and get event and check for integrity of data 
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/	
LOCAL_C void TestEventViewL(CLogClient& aClient)
	{
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1022 "));
	CTestActive* active = new(ELeave)CTestActive();
	CleanupStack::PushL(active);

	CLogViewChangeObserver* changeObs = CLogViewChangeObserver::NewLC();
	changeObs->SetActive();

  	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs);
	CleanupStack::PushL(view);

	CLogEvent* event;
	TLogId id;
	TTime now;
	now.UniversalTime();
	TInt count;

	for(count = 0; count < KTestEventNum; count++)
		{
		event = CLogEvent::NewL();
		CleanupStack::PushL(event);
		event->SetEventType(KLogCallEventTypeUid);

		//User::After(Math::Random() % 100000);
		User::After(1000000);
		active->StartL();
		aClient.AddEvent(*event, active->iStatus);
		CActiveScheduler::Start();

		TEST2(active->iStatus.Int(), KErrNone);
		TEST(event->EventType() == KLogCallEventTypeUid);
		TEST(event->Description().Length() > 0);
		TEST(event->Time() >= now);

		now = event->Time();
		id = event->Id();
		
		event->SetRemoteParty(KTestRemoteParty1);
		event->SetDirection(KTestDirection1);
		event->SetDurationType(KTestDurationType1);
		event->SetDuration(KTestDuration1);
		event->SetStatus(KTestStatus1);
		event->SetSubject(KTestSubject1);
		event->SetNumber(KTestNumber1);
		event->SetLink(KTestLink1);
		event->SetDataL(KTestData1);
		event->SetFlags(KTestFlags1);
		event->SetContact((TLogContactItemId) count+1);

		User::After(Math::Random() % 100000);
		active->StartL();
		aClient.ChangeEvent(*event, active->iStatus);
		CActiveScheduler::Start();

		//If the test fails on the next line with -1 or -12 error, it is possible that the contacts database is missing:
		//c:\private\10003a73\SQLite__Contacts.cdb. Copy it to the specified location and rerun the test.
		TEST2(active->iStatus.Int(), KErrNone);
		TEST(event->EventType() == KLogCallEventTypeUid);
		TEST(event->RemoteParty() == KTestRemoteParty1);
		TEST(event->Direction() == KTestDirection1);
		TEST(event->DurationType() == KTestDurationType1);
		TEST(event->Duration() == KTestDuration1);
		TEST(event->Status() == KTestStatus1);
		TEST(event->Subject() == KTestSubject1);
		TEST(event->Number() == KTestNumber1);
		TEST(event->Link() == KTestLink1);
		TEST(event->Data() == KTestData1);
		TLogFlags eventFlags;
		if(TheMatchingIsEnabled)
			{
			eventFlags=KTestFlags1|KLogEventContactSearched;
			}
		else
			{
			eventFlags=KTestFlags1;
			}
		//If the test fails on the next line, it is quite possible that there is a
		//z:\private\10202be9a\101f401d.txt file that sets the contacts match count to 0.
		//Delete the file and run the test again.
		TEST(event->Flags() == eventFlags);
		TEST(event->Contact()==(TLogContactItemId) count+1);

		CleanupStack::PopAndDestroy(); // event;

		event = CLogEvent::NewL();
		CleanupStack::PushL(event);

		event->SetId(id);
		active->StartL();
		aClient.GetEvent(*event, active->iStatus);
		CActiveScheduler::Start();

		TEST2(active->iStatus.Int(), KErrNone);
		TEST(event->EventType() == KLogCallEventTypeUid);
		TEST(event->RemoteParty() == KTestRemoteParty1);
		TEST(event->Direction() == KTestDirection1);
		TEST(event->DurationType() == KTestDurationType1);
		TEST(event->Duration() == KTestDuration1);
		TEST(event->Status() == KTestStatus1);
		TEST(event->Subject() == KTestSubject1);
		TEST(event->Number() == KTestNumber1);
		TEST(event->Link() == KTestLink1);
		TEST(event->Data() == KTestData1);
		TEST(event->Flags() == eventFlags);
		TEST(event->Contact()==(TLogContactItemId) count+1);
		CleanupStack::PopAndDestroy(); // event;
		}

	CleanupStack::PopAndDestroy(3, active); // Delete view, changeObs, active
	}