void CMtfTestActionCreateEntry::ExecuteActionL()
	{
	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCreateEntry);
	CActiveScheduler::Add(this);
	
	iBlank = KNullDesC().AllocL();

	CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
	TUid paramEntryTypeUid = ObtainValueParameterL<TUid>(TestCase(),ActionParameters().Parameter(1));
	TMsvId paramParentId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(2));
	TUid paramMtmUid = ObtainValueParameterL<TUid>(TestCase(),ActionParameters().Parameter(3), KUidMsvLocalServiceMtm);
	TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(4), KMsvLocalServiceIndexEntryId);
	TMsvPriority paramPriority = ObtainValueParameterL<TMsvPriority>(TestCase(),ActionParameters().Parameter(5),EMsvMediumPriority);
	TInt paramReadOnlyFlag = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(6),EFalse);
	TInt paramVisibleFlag = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(7),ETrue);
	HBufC* paramDescription = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(8),iBlank);
	HBufC* paramDetails = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(9),iBlank);

	iIndexEntry.iType = paramEntryTypeUid;
	iIndexEntry.iMtm = paramMtmUid;	
	iIndexEntry.iServiceId = paramServiceId;
	iIndexEntry.SetPriority(paramPriority);	
	iIndexEntry.SetReadOnly(paramReadOnlyFlag);	
	iIndexEntry.SetVisible(paramVisibleFlag);	
	iIndexEntry.iDescription.Set(paramDescription->Des());
	iIndexEntry.iDetails.Set(paramDetails->Des());
	iIndexEntry.iDate.HomeTime();

	CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramParentId,TMsvSelectionOrdering());
	CleanupStack::PushL(entry);
	entry->SetEntryL(paramParentId);
	if (entry->OwningService() == KMsvLocalServiceIndexEntryId)
		{
		entry->CreateL(iIndexEntry);
		CleanupStack::PopAndDestroy(entry);
		TMsvId paramEntryId;
		paramEntryId = iIndexEntry.Id();

		StoreParameterL<TMsvId>(TestCase(),paramEntryId,ActionParameters().Parameter(10));

		TestCase().ActionCompletedL(*this);
		}
	else
		{
		iOperation = entry->CreateL(iIndexEntry,iStatus);
		SetActive();
		}
	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCreateEntry);
	}
예제 #2
0
/**
Creates a New Service
If a Service Exists it doesnot create a new one

@param aSession		Current Session reference
@param aDescription	Entry Description Descriptor
@param aDetail		Entry Details Descriptor
@internalTechnology
*/
void CentralRepoUtils::CreateServiceL(CMsvSession* aSession, const TDesC& aDescription, const TDesC& aDetail)
	{
	TMsvId serviceId=0;
	TRAPD(err,TSmsUtilities::ServiceIdL(*aSession,serviceId));

		if(err == KErrNotFound) // If Service Already Exists Do not create new One
			{
			TInt priority = EMsvMediumPriority;
			TInt readOnlyFlag = EFalse;
			TInt visibleFlag = ETrue;

			TMsvEntry indexEntry;
			indexEntry.iType = KUidMsvServiceEntry;
			indexEntry.iMtm = KUidMsgTypeSMS;
			indexEntry.SetReadOnly(readOnlyFlag);
			indexEntry.SetVisible(visibleFlag);	
			indexEntry.SetPriority(TMsvPriority(priority));
			indexEntry.iDescription.Set(aDescription);
			indexEntry.iDetails.Set(aDetail);
			indexEntry.iDate.HomeTime();
			
			CMsvEntry* entry = CMsvEntry::NewL(*aSession,KMsvRootIndexEntryId,TMsvSelectionOrdering());
			CleanupStack::PushL(entry);
			entry->CreateL(indexEntry);
		    CleanupStack::PopAndDestroy(entry);
			}
	}
예제 #3
0
void CT_CMsvSession::TestIncPcSyncCountL()
	{
	TInt error = KErrGeneral;
	INFO_PRINTF1(_L("Testing: Increment PC Sync Count -- started"));
	TRAP(error, iSession = CMsvSession::OpenSyncL(*this));
	TEST(error == KErrNone);

	CMsvOperationWait* active = CMsvOperationWait::NewLC();
	
	CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering());
	CleanupStack::PushL(cEntry);
	
	CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection;
	CleanupStack::PushL(selection);

	TInt ret = iSession->InstallMtmGroup(KDataComponentFilename);
	TEST(ret==KErrNone|| ret==KErrAlreadyExists);

	cEntry->SetEntryL(KMsvRootIndexEntryId);
	TMsvEntry service;
	service.iType=KUidMsvServiceEntry;
	service.iMtm = KUidTestServerMtmType;
	cEntry->CreateL(service);

	selection->AppendL(service.Id());
	
	TBuf8<256> progress;
	TBuf8<32> param;
	TRAP(error, iSession->IncPcSyncCountL(*selection);)
예제 #4
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CSMSSender::CreateNewMessageL()
{
	Cancel();
	iMessageMade = iMessageSent = iMessageReceived = EFalse;
	
	delete iMtm;
	iMtm = NULL;

    TMsvEntry newEntry;              // This represents an entry in the Message Server index
    newEntry.iMtm = KUidMsgTypeSMS;                         // message type is SMS
	newEntry.iType = KUidMsvMessageEntry;                   // this defines the type of the entry: message 
	newEntry.iServiceId = KMsvLocalServiceIndexEntryId;     // ID of local service (containing the standard folders)
	newEntry.iDate.UniversalTime();                              // set the date of the entry to home time
	newEntry.SetInPreparation(ETrue);                       // a flag that this message is in preparation
   	newEntry.SetReadOnly(EFalse);
   	
    // - CMsvEntry accesses and acts upon a particular Message Server entry.
    // - NewL() does not create a new entry, but simply a new object to access an existing entry.
    // - It takes in as parameters the client's message server session,
    //   ID of the entry to access and initial sorting order of the children of the entry. 
    CMsvEntry* entry = CMsvEntry::NewL(*iSession, KMsvDraftEntryIdValue, TMsvSelectionOrdering());
    CleanupStack::PushL(entry);

    delete iOperation;
    iOperation = NULL;
    iOperation = entry->CreateL(newEntry, iStatus);
    CleanupStack::PopAndDestroy(entry);

    iPhase = EWaitingForCreate;
    SetActive();    
}
예제 #5
0
TMsvId CFakeSMSSender::CreateNewMessageL(TTime aMsgTime)
{
    CMsvEntry* Draftentry = CMsvEntry::NewL(*iMsvSession, KMsvDraftEntryIdValue ,TMsvSelectionOrdering());
  	CleanupStack::PushL(Draftentry);

    CMsvOperationWait* wait = CMsvOperationWait::NewLC();
    wait->Start();
    
	TMsvEntry newEntry;              // This represents an entry in the Message Server index
    newEntry.iMtm = KUidMsgTypeSMS;                         // message type is SMS
 	newEntry.iType = KUidMsvMessageEntry; //KUidMsvServiceEntry                  // this defines the type of the entry: message 
 	newEntry.iServiceId = KMsvLocalServiceIndexEntryId; //    // ID of local service (containing the standard folders)
   	newEntry.iDate = aMsgTime;                              // set the date of the entry to home time
	newEntry.SetInPreparation(ETrue);                       // a flag that this message is in preparation
	newEntry.SetReadOnly(EFalse);					
		
	CMsvOperation* oper = Draftentry->CreateL(newEntry,wait->iStatus);
    CleanupStack::PushL(oper);
    CActiveScheduler::Start();

    while( wait->iStatus.Int() == KRequestPending )
    {
        CActiveScheduler::Start();
    }

    
    // ...and keep track of the progress of the create operation.
    TMsvLocalOperationProgress progress = McliUtils::GetLocalProgressL(*oper);
    User::LeaveIfError(progress.iError);
//	Draftentry->MoveL(progress.iId,KMsvGlobalInBoxIndexEntryId);

	CleanupStack::PopAndDestroy(3);//Draftentry,wait,oper
	
    return progress.iId;
 }
예제 #6
0
CMsvOperation* CTextMtmClient::ForwardL(TMsvId aForwardEntryId, TMsvPartList aPartList, 
										TRequestStatus& aCompletionStatus)
// Create forwarded message 
// Destination folder is aForwardEntryL
//
	{
	__ASSERT_DEBUG(iMsvEntry!=NULL,gPanic(ETxtcNoCMsvEntrySet));
	__ASSERT_DEBUG(iMsvEntry->Entry().iType.iUid == KUidMsvMessageEntryValue, gPanic(ETxtcEntryTypeNotSupported));
	__ASSERT_DEBUG(iMsvEntry->Entry().iServiceId == KMsvLocalServiceIndexEntryId, gPanic(ETxtcInvalidServiceId));
	
	// Create the forwarded index entry
	TMsvEntry forwardEntry;
	forwardEntry.iMtm = KUidMsgTypeText;
	forwardEntry.iServiceId = Entry().Entry().iServiceId;
	forwardEntry.iType = KUidMsvMessageEntry;
	forwardEntry.iDetails.Set(iMsvEntry->Entry().iDetails);				
	forwardEntry.iSize = iMsvEntry->Entry().iSize;	
	if(aPartList&KMsvMessagePartDate)
		forwardEntry.iDate.HomeTime();
	if(aPartList&KMsvMessagePartDescription)
		forwardEntry.iDescription.Set(iMsvEntry->Entry().iDescription);		

	// Get CMsvEntry for destination (parent)
	CMsvEntry* cEntry = CMsvEntry::NewL(Session(), aForwardEntryId, TMsvSelectionOrdering());
	CleanupStack::PushL(cEntry);
	// Synchronously create new child
	CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC();
	CMsvOperation* opert = cEntry->CreateL(forwardEntry, wait->iStatus);
	CleanupStack::PushL(opert);
	wait->Start();
	User::LeaveIfError(opert->iStatus.Int());
	// Check result
	TPckgBuf<TMsvLocalOperationProgress> progressPack;
    progressPack.Copy(opert->ProgressL());
	TMsvLocalOperationProgress progress = progressPack();
	User::LeaveIfError(progress.iError);
	CleanupStack::PopAndDestroy(2);	// opert, wait

	// Get CMsvEntry for new entry
	TMsvId forwardId=progress.iId;
	cEntry->SetEntryL(forwardId);
	
	// Populate new forwarded message with Body text
	if(aPartList&KMsvMessagePartBody)
		{
		CMsvStore* store=cEntry->EditStoreL();
		CleanupStack::PushL(store);
		StoreBodyL(*store);				// Current context is original message
		store->CommitL();
		CleanupStack::PopAndDestroy();	// store
		}

	CleanupStack::PopAndDestroy(); // cEntry
		
	// Request was performed synchronously, so return a completed operation object
	return CMsvCompletedOperation::NewL(Session(), KUidMsgTypeText, progressPack, 
		KMsvNullIndexEntryId, aCompletionStatus);
	}
예제 #7
0
// -----------------------------------------------------------------------------
// CWPMessage::StoreMsgL
// -----------------------------------------------------------------------------
//
void CWPMessage::StoreMsgL()
    {
    FLOG( _L( "CWPMessage::StoreMsgL" ) );
    
    // create an invisible blank entry 
    TMsvEntry entry;
    PrepareEntryLC( entry ); // details on cleanup stack
    entry.iBioType = iBioUID.iUid;
    entry.iMtm = KUidBIOMessageTypeMtm;
    
    // Look up and set the description
    FLOG( _L( "CWPMessage::StoreMsgL 1" ) );
    
    TInt index;
    CBIODatabase* bioDB = CBIODatabase::NewLC( iSession->FileSession() );
    FLOG( _L( "CWPMessage::StoreMsgL 2" ) );
    TRAPD( err, bioDB->GetBioIndexWithMsgIDL( iBioUID, index ) );
    if (err ==KErrNone)
        {
        FLOG( _L( "CWPMessage::StoreMsgL 3" ) );
        HBufC* description = bioDB->BifReader(index).Description().AllocL();
        FLOG( _L( "CWPMessage::StoreMsgL 4" ) );
        entry.iDescription.Set(*description);
        FLOG( _L( "CWPMessage::StoreMsgL 5" ) );
        CleanupStack::PopAndDestroy();  // bioDB
        CleanupStack::PushL( description );
        }
    else
        {
        FTRACE(RDebug::Print(_L(" CWPMessage::StoreMsgL err (%d)"), err));
        CleanupStack::PopAndDestroy();  // bioDB
        }
        
    FLOG( _L( "CWPMessage::StoreMsgL 6" ) );
    // Store entry in inbox
    CMsvEntry* msvEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
    FLOG( _L( "CWPMessage::StoreMsgL 7" ) );
    CleanupStack::PushL(msvEntry);
    msvEntry->CreateL(entry);
    msvEntry->Session().CleanupEntryPushL(entry.Id());
    msvEntry->SetEntryL(entry.Id());
    FLOG( _L( "CWPMessage::StoreMsgL 8" ) );
    // Save the message
    CMsvStore* store = msvEntry->EditStoreL();
    CleanupStack::PushL(store);
    FLOG( _L( "CWPMessage::StoreMsgL 9" ) );
    iMessage->StoreL( *store );
    store->CommitL();
    
    // Complete processing the message
    PostprocessEntryL( *msvEntry, entry );

    CleanupStack::PopAndDestroy(); //store
    msvEntry->Session().CleanupEntryPop(); //entry
    CleanupStack::PopAndDestroy(3); //description, details, msvEntry
    FLOG( _L( "CWPMessage::StoreMsgL Done" ) );
    }
예제 #8
0
// -----------------------------------------------------------------------------
// CWPMessage::StoreMsgL
// -----------------------------------------------------------------------------
//
void CWPMessage::StoreMsgL( TInt aResource )
    {
    FLOG( _L( "CWPMessage::StoreMsgL(aResource)" ) );
    
    // create an invisible blank entry 
    TMsvEntry entry;
    PrepareEntryLC( entry ); // details on cleanup stack
    entry.iMtm = KUidMsgTypeSMS;     

    // Store entry in inbox
    CMsvEntry* msvEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
    CleanupStack::PushL(msvEntry);
    msvEntry->CreateL(entry);
    msvEntry->Session().CleanupEntryPushL(entry.Id());
    msvEntry->SetEntryL(entry.Id());

    // Save the message body
    CMsvStore* store = msvEntry->EditStoreL();
    CleanupStack::PushL(store);
    CParaFormatLayer* paraFormat = CParaFormatLayer::NewL();
    CleanupStack::PushL( paraFormat );
    CCharFormatLayer* charFormat = CCharFormatLayer::NewL();
    CleanupStack::PushL( charFormat );
    CRichText* body = CRichText::NewL( paraFormat, charFormat );
    CleanupStack::PushL( body );
    HBufC* text = LoadStringLC( aResource );
    body->InsertL( body->DocumentLength(), *text );
    store->StoreBodyTextL( *body );

    // Store the actual message for post-mortem analysis
    iMessage->StoreL( *store );

    // Save the SMS header and create a description field
    CSmsHeader* header = CSmsHeader::NewL( CSmsPDU::ESmsDeliver, *body );
    CleanupStack::PushL( header );
    TBuf<KSmsDescriptionLength> description;

    CSmsGetDetDescInterface* smsPlugin = CSmsGetDetDescInterface::NewL();
    CleanupStack::PushL( smsPlugin );
    smsPlugin->GetDescription( header->Message(), description );
    CleanupStack::PopAndDestroy( smsPlugin );

    entry.iDescription.Set( description );
    header->StoreL( *store );
    store->CommitL();
    CleanupStack::PopAndDestroy( 5 ); // header, text, body, charformat, paraFormat

    // Complete processing the message
    PostprocessEntryL( *msvEntry, entry );

    CleanupStack::PopAndDestroy(); //store
    msvEntry->Session().CleanupEntryPop(); //entry
    CleanupStack::PopAndDestroy(2); //details, msvEntry
    }
예제 #9
0
LOCAL_C void TestSetSendingStateAttributeL()
	{
	CDummyObserver* ob = new(ELeave)CDummyObserver;
	CleanupStack::PushL(ob);

	CMsvSession* session = CMsvSession::OpenSyncL(*ob);
	CleanupStack::PushL(session);

	CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvDraftEntryId, TMsvSelectionOrdering());
	CleanupStack::PushL(cEntry);

	CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection;
	CleanupStack::PushL(selection);

	TMsvEntry entry1;
	entry1.iType = KUidMsvMessageEntry;
	entry1.iMtm = KUidMsvLocalServiceMtm;
	entry1.iServiceId = KMsvLocalServiceIndexEntryId;
	entry1.SetSendingState(12);
	cEntry->CreateL(entry1);
	selection->AppendL(entry1.Id());

	TMsvEntry entry2;
	entry2.iType = KUidMsvMessageEntry;
	entry2.iMtm = KUidMsvLocalServiceMtm;
	entry2.iServiceId = KMsvLocalServiceIndexEntryId;
	entry2.SetSendingState(3);
	cEntry->CreateL(entry2);
	selection->AppendL(entry2.Id());
	
	session->ChangeAttributesL(*selection, 6<<KMsvSendingStateShift, 0);

	cEntry->SetEntryL(entry1.Id());
	test(cEntry->Entry().SendingState() == 6);

	cEntry->SetEntryL(entry2.Id());
	test(cEntry->Entry().SendingState() == 6);
	
	CleanupStack::PopAndDestroy(4); // selection, cEntry, session, ob
	}
예제 #10
0
LOCAL_C void TestReadOnlyDeletionL()
	{
	CDummyObserver* ob = new(ELeave)CDummyObserver;
	CleanupStack::PushL(ob);

	CMsvSession* session = CMsvSession::OpenSyncL(*ob);
	CleanupStack::PushL(session);

	CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvDraftEntryId, TMsvSelectionOrdering());
	CleanupStack::PushL(cEntry);

	// Create an entry
	TMsvEntry entry;
	entry.iType = KUidMsvMessageEntry;
	entry.iMtm = KUidMsvLocalServiceMtm;
	entry.iServiceId = KMsvLocalServiceIndexEntryId;
	cEntry->CreateL(entry);

	// Generate name of attachment
	cEntry->SetEntryL(entry.Id());
	TFileName fileName;

	fileName.Append(_L("Test"));
	CMsvStore* store = cEntry->EditStoreL();
	CleanupStack::PushL(store);

	CAsyncWaiter* waiter = CAsyncWaiter::NewL();
	CleanupStack::PushL(waiter);
	CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
	CleanupStack::PushL(attachment);
	fileName.Append(_L("Test"));
	attachment->SetAttachmentNameL(fileName);
	RFile file;
	store->AttachmentManagerL().CreateAttachmentL(fileName, file, attachment, waiter->iStatus);
	CleanupStack::Pop(attachment); // ownership passed
	waiter->StartAndWait();
	User::LeaveIfError(waiter->Result());
	CleanupStack::PopAndDestroy(waiter);
	
	CleanupClosePushL(file);
	User::LeaveIfError(file.Write(_L8("some text")));
	User::LeaveIfError(file.SetAtt(KEntryAttReadOnly, KEntryAttNormal));
	CleanupStack::PopAndDestroy(2, store); // file, store

	// Now try and delete the file
	cEntry->SetEntryL(entry.Parent());
	cEntry->DeleteL(entry.Id());

	CleanupStack::PopAndDestroy(3); // cEntry, session, ob
	}
// -----------------------------------------------------------------------------
// CMmsAdapterMsvApi::AddUserFolderL
// Creates new user folder
// -----------------------------------------------------------------------------        
TInt CMmsAdapterMsvApi::AddUserFolderL( TMsvId& aFolder, const TDesC& aName )
    {
    TRACE_FUNC_ENTRY;
    LOGGER_WRITE_1( "aName: %S", &aName );
        
    // Make sure that we are not going to add same folder twise
    TBool found( EFalse );
    found = FindUserFolderL( aName, aFolder );
    if ( found )
        {
        LOGGER_WRITE( "Folder already exists" );
        LOGGER_LEAVEFN( "CMmsAdapterMsvApi::AddUserFolderL" );
        return KErrNone;
        } 
        
    CMsvEntry* entry = iSession.GetEntryL(KMsvMyFoldersEntryIdValue);
    CleanupStack::PushL( entry );
    
    TTime date;
    date.UniversalTime();    
    
    TMsvEntry folderEntry;
    folderEntry.iType = KUidMsvFolderEntry;
    folderEntry.iMtm = KUidMsvLocalServiceMtm;
    folderEntry.iDetails.Set( aName );   
    folderEntry.iServiceId = KMsvLocalServiceIndexEntryIdValue;
    folderEntry.iSize = sizeof( folderEntry );
    folderEntry.iDate = date;
    folderEntry.SetStandardFolder( EFalse );
    folderEntry.SetVisible( ETrue );
    folderEntry.SetComplete( ETrue );
    folderEntry.SetInPreparation( EFalse ); 
    folderEntry.SetReadOnly( EFalse );
    
    entry->CreateL( folderEntry );
    CleanupStack::PopAndDestroy( entry );
    
    aFolder = folderEntry.Id();
    
    TRACE_FUNC_EXIT;
    return KErrNone;
    }
예제 #12
0
void CT_CMsvSession::TestTransferCommandL()
	{
	TInt error = KErrGeneral;
	INFO_PRINTF1(_L("Testing: Transfer Commands -- started"));
	TRAP(error, iSession = CMsvSession::OpenSyncL(*this));
	TEST(error == KErrNone);

	CMsvOperationWait* active = CMsvOperationWait::NewLC();
	
	CMsvEntry* cEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering());
	CleanupStack::PushL(cEntry);
	
	CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection;
	CleanupStack::PushL(selection);

	TInt ret = iSession->InstallMtmGroup(KDataComponentFilename);
	TEST(ret==KErrNone|| ret==KErrAlreadyExists);

	cEntry->SetEntryL(KMsvRootIndexEntryId);
	TMsvEntry service;
	service.iType=KUidMsvServiceEntry;
	service.iMtm = KUidTestServerMtmType;
	cEntry->CreateL(service);

	selection->AppendL(service.Id());
	
	TBuf8<256> progress;
	TBuf8<32> param;
	CMsvOperation* operation = NULL;	
	active->Start();
	operation = iSession->TransferCommandL(*selection, 1, param, active->iStatus);
	CActiveScheduler::Start();
	TEST(operation->iStatus.Int()==KErrNone);
	cEntry->DeleteL(service.Id());
	delete operation;
	CleanupStack::PopAndDestroy(selection);
	CleanupStack::PopAndDestroy(cEntry);
	CleanupStack::PopAndDestroy(active);
	delete iSession;
	INFO_PRINTF1(_L("Testing: Transfer Commands -- ended"));
	}
예제 #13
0
LOCAL_C void CreateEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry, TInt aError, CEntryObserver& aObserver)
{
    CTestActive* active = new (ELeave) CTestActive;
    CleanupStack::PushL(active);
    active->StartL();
    aObserver.Start();
    CMsvOperation*  opert = aClientEntry.CreateL(aNewEntry, active->iStatus);
    CActiveScheduler::Start(); // operation complete
    CActiveScheduler::Start(); // cEntry changed
    test(opert->iStatus.Int()==KErrNone);
    test(opert->Mtm()==KUidMsvLocalServiceMtm);
    test(opert->Service()==KMsvLocalServiceIndexEntryId);
    TMsvLocalOperationProgress details;
    TPckgC<TMsvLocalOperationProgress> package(details);
    package.Set(opert->ProgressL());
    test(package().iType==TMsvLocalOperationProgress::ELocalNew);
    test(package().iTotalNumberOfEntries==1);
    test(package().iError==aError);
    if (aError)
    {
        test(package().iNumberCompleted==0);
        test(package().iNumberFailed==1);
    }
    else
    {
        test(package().iNumberCompleted==1);
        test(package().iNumberFailed==0);
        TTestMsvEntry* ptr = (TTestMsvEntry*)&aNewEntry;
        ptr->SetId(package().iId);
        ptr->SetParent(aClientEntry.EntryId());
        if (aNewEntry.iType==KUidMsvServiceEntry)
            aNewEntry.iServiceId = aNewEntry.Id();
    }
    test(package().iNumberRemaining==0);
    delete opert;
    opert=NULL;
    CleanupStack::PopAndDestroy(); // active
}
예제 #14
0
LOCAL_C void TestCleanupStackL()
	{
	CDummyObserver* ob = new(ELeave)CDummyObserver;
	CleanupStack::PushL(ob);

	CMsvSession* session = CMsvSession::OpenSyncL(*ob);
	CleanupStack::PushL(session);

	CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvDraftEntryId, TMsvSelectionOrdering());
	CleanupStack::PushL(cEntry);

	TMsvEntry entry;
	entry.iType = KUidMsvMessageEntry;
	entry.iMtm = KUidMsvLocalServiceMtm;
	entry.iServiceId = KMsvLocalServiceIndexEntryId;

	// Create an entry
	cEntry->CreateL(entry);

	// Make sure heap failure occurs in CleanupEntryPushL
	// If a failure occurs the entry should still be on cleanup stack
	__UHEAP_FAILNEXT(0);
	TRAPD(error, session->CleanupEntryPushL(entry.Id()); session->CleanupEntryPop(); );
//---------------------------------------------------------------
// TestUniDataModelPlugin::createMMS
//---------------------------------------------------------------
void TestUniDataModelMMSPlugin::createMMS(TMsvId pId, TBool subjectField)
    {
    TMsvEntry indexEntry;
    indexEntry.iType = KUidMsvMessageEntry;
    indexEntry.iMtm = KUidMsgTypeMultimedia;
    indexEntry.iServiceId = iServiceId;
    indexEntry.iDate.HomeTime();
    
    // Convert TTime to QDateTime , this will be used for comparing the time of mesage 
    // when fetched from datamodel
    TTime unixEpoch(KUnixEpoch);
    TTimeIntervalSeconds seconds;
    TTime timeStamp = indexEntry.iDate;
    timeStamp.SecondsFrom(unixEpoch, seconds);
    retTimeStamp.setTime_t(seconds.Int());

    TMsvId parentId = pId;
    CMsvEntry* entry = CMsvEntry::NewL(*iMSession,parentId,TMsvSelectionOrdering());
    CleanupStack::PushL(entry);

    entry->SetEntryL(parentId);
    entry->CreateL(indexEntry);
    entry->SetEntryL(indexEntry.Id());
    iMmsClientMtm->SwitchCurrentEntryL(entry->EntryId());

    CMsvStore* store = iMmsClientMtm->Entry().EditStoreL();
    CleanupStack::PushL(store);
      
    //MMS Message ID Saved
    iMessageId = indexEntry.Id();
    
    //Adding Subject
    if(subjectField)
        {
        QString subject(TEST_MSG_SUBJECT);
        HBufC* subj = XQConversions::qStringToS60Desc(subject);
        iMmsClientMtm->SetSubjectL(*subj);
        }

    //Adding Sender
    QString sender(TEST_MSG_FROM1);
    HBufC* addr = XQConversions::qStringToS60Desc(sender);
    
    if (addr)
        {
        CleanupStack::PushL(addr);
        TBuf<32> name;
        name.Copy(addr->Left(32));
        indexEntry.iDetails.Set(name);
        
        iMmsClientMtm->SetSenderL(*addr);
        
        CleanupStack::PopAndDestroy(addr);
        }
    
    //Adding Recipient
    QString recipient(TEST_MSG_RECIEPIENT1);
    HBufC* addr2 = XQConversions::qStringToS60Desc(recipient);
    if (addr2)
        {
        CleanupStack::PushL(addr2);
        iMmsClientMtm->AddAddresseeL(EMsvRecipientTo,*addr2);
        CleanupStack::PopAndDestroy(addr2);
        }
    
    //Adding cCRecipient
    QString recipient2(TEST_MSG_RECIEPIENT2);
    HBufC* addr3 = XQConversions::qStringToS60Desc(recipient2);
    if (addr3)
        {
        CleanupStack::PushL(addr3);
        iMmsClientMtm->AddAddresseeL(EMsvRecipientCc,*addr3);
        CleanupStack::PopAndDestroy(addr3);
        }
      
    //Adding bCCRecipient
    QString recipient3(TEST_MSG_RECIEPIENT3);
	HBufC* addr4 = XQConversions::qStringToS60Desc(recipient3);
	if (addr4)
		{
		CleanupStack::PushL(addr4);
		iMmsClientMtm->AddAddresseeL(EMsvRecipientBcc,*addr4);
		CleanupStack::PopAndDestroy(addr4);
		}
	
    //Create Text Attachment
    TMsvAttachmentId attaId = 0;
    TFileName attachmentFile( _L("story.txt") );
    TBufC<12> story = _L( "Hello world!" );
    
    iMmsClientMtm->CreateTextAttachmentL(*store, attaId, story, attachmentFile, ETrue );
    qDebug() << "Text Attachment id" << attaId;
    
    //Image Attachment added to the message entry
    RFile attaFile;
	// Set filename of attachment
	TFileName name( KPictureFileName );
   
	CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
	CleanupStack::PushL( mimeHeaders );
   
	// Set values to mime headers
	mimeHeaders->SetContentTypeL( _L8( "image") );
	mimeHeaders->SetContentSubTypeL( _L8( "jpeg" ) );
   
	_LIT8(KMimeType, "image/jpeg");
	TBufC8<10> mimeType(KMimeType);
	// CreateAttachment2L will set the content type to attachment Info
   
	// Open the attachment file for reading
	attaFile.Open( iFs, name, EFileShareReadersOnly | EFileRead );
	CleanupClosePushL(attaFile);
   
	CMsvAttachment* attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
	// attaInfo ownerhip will be transferred to Attachment Manager.
	// It must not be pushed onto the cleanupStack before calling 
	// CreateAttachment2L.
   
	iMmsClientMtm->CreateAttachment2L(*store, attaFile,mimeType,*mimeHeaders,attaInfo,attaId);
	qDebug() << "Image Attachment id" << attaId;
	
	// Now Attachment Manager owns the attaInfo
	CleanupStack::Pop(); // attaFile.Close()
	CleanupStack::PopAndDestroy(); // mimeHeaders
        
    store->CommitL();
    
    CleanupStack::PopAndDestroy(store); // store
    
    iMmsClientMtm->SaveMessageL();
    
    //Saving the message size for future checking
    msgSize = iMmsClientMtm->MessageSize();
    
    CleanupStack::Pop(entry); // entry
    }
예제 #16
0
void CSmsFile::send_messageL(const TDesC& recipient, const TDesC& body)
{
    if (iStatus==KRequestPending) {
        User::Leave(KErrServerBusy);
    }

    state=_L("send_messageL");

    TMsvEntry newEntry;								 // This represents an entry in the Message Server index
    newEntry.iMtm = KUidMsgTypeSMS;                         // message type is CSmsFile
    newEntry.iType = KUidMsvMessageEntry;                   // this defines the type of the entry: message
    newEntry.iServiceId = KMsvLocalServiceIndexEntryId;     // ID of local service (containing the standard folders)
    newEntry.iDate.HomeTime();                              // set the date of the entry to home time

    newEntry.SetInPreparation(ETrue);                       // a flag that this message is in preparation


    // get ref to outbox
    state=_L("NewL");
    CMsvEntry *entry =CMsvEntry::NewL(*iSession, KMsvGlobalOutBoxIndexEntryId ,TMsvSelectionOrdering());
    CleanupStack::PushL(entry);

    // create message in outbox
    state=_L("CreateL");
    entry->CreateL(newEntry);

    state=_L("GetEntry");
    entry = iSession->GetEntryL(newEntry.Id());

    // SetCurrentEntryL takes ownership of the CMsvEntry
    state=_L("SetCurrentEntry");
    iMtm->SetCurrentEntryL(entry);

    CleanupStack::Pop(); // entry

    state=_L("Entry()");
    TMsvEntry msvEntry = (iMtm->Entry()).Entry();

    state=_L("Body()");
    CRichText& mtmBody = iMtm->Body();
    mtmBody.Reset();

    state=_L("set message");
    mtmBody.InsertL(0, body);   // insert our msg tag as the body text

    // set iRecipient into the Details of the entry
    msvEntry.iDetails.Set(recipient);  // set recipient info in details
    msvEntry.SetInPreparation(EFalse);         // set inPreparation to false

    msvEntry.SetSendingState(KMsvSendStateWaiting);   // set the sending state (immediately)
    msvEntry.iDate.HomeTime();                        // set time to Home Time

    // To handle the CSmsFile specifics we start using SmsMtm
    CSmsClientMtm* smsMtm = STATIC_CAST(CSmsClientMtm*, iMtm);

    state=_L("RestoreServiceAndSettingsL");
    smsMtm->RestoreServiceAndSettingsL();

    state=_L("set header");
    // CSmsHeader encapsulates data specific for CSmsFile messages,
    // like service center number and options for sending.
    CSmsHeader& header = smsMtm->SmsHeader();
    state=_L("get options");

    if (!sendOptions) {
        sendOptions = CSmsSettings::NewL();
        sendOptions->CopyL(smsMtm->ServiceSettings()); // restore existing settings
        state=_L("SetDelivery");
        sendOptions->SetDelivery(ESmsDeliveryImmediately);      // set to be delivered immediately
    }

    // set send options
    // ERROR HERE!
    state=_L("SetSmsSettingsL");
    header.SetSmsSettingsL(*sendOptions);

    state=_L("check sc");
    // let's check if there's sc address
    if (header.Message().ServiceCenterAddress().Length() == 0)
    {
        // no, there isn't. We assume there is at least one sc number set and use
        // the default SC number.
        CSmsSettings* serviceSettings = &(smsMtm->ServiceSettings());

        // if number of scaddresses in the list is null
        if (!serviceSettings->NumSCAddresses())
        {
            // FIXME: what to do?
            User::Leave(1);
        } else {
            // set sc address to default.
            CSmsNumber* sc = 0;
            sc = &(serviceSettings->SCAddress(serviceSettings->DefaultSC()));
            header.Message().SetServiceCenterAddressL(sc->Address());
        }
    }

    state=_L("add addresses");
    // Add our recipient to the list, takes in two TDesCs, first is real address and second is an alias
    // works also without the alias parameter.
    smsMtm->AddAddresseeL(recipient, msvEntry.iDetails);

    // if message is to be deleted after sending, mark with our UID
    msvEntry.iMtmData3 = KUidRippleVaultApp.iUid;

    state=_L("save");
    // save message
    iMtm->Entry().ChangeL(msvEntry);                // make sure that we are handling the right entry
    smsMtm->SaveMessageL();                 // closes the message

    state=_L("move");
    // This moves the message entry to outbox, we'll schedule it for sending after this.
    //    TMsvId movedId = MoveMessageEntryL( KMsvGlobalOutBoxIndexEntryId );  // move message to outbox
    TMsvId movedId = iMtm->Entry().Entry().Id();

    // We must create an entry selection for message copies (although now we only have one message in selection)
    CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
    CleanupStack::PushL(selection);

    selection->AppendL(movedId);            // add our message to the selection

    TBuf8<1> dummyParams;
    //    CCommandAbsorbingControl::NewLC();

    state=_L("InvokeAsyncFunctionL");
    // invoking async schedule copy command on our mtm
    op=iMtm->InvokeAsyncFunctionL(
           ESmsMtmCommandScheduleCopy,
           *selection,
           dummyParams,
           iStatus);

    CleanupStack::Pop(); // selection

#ifdef __LOGME__
    iAppUi.LogText.Copy(_L("SENT\n"));
    iAppUi.WriteLogFile(iAppUi.LogText);
#endif

    SetActive();

    //return KErrNone;
}
TVerdict CCreateSmsMessageTestStep::doTestStepL()
	{

	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
	CActiveScheduler::Install(scheduler);
	CleanupStack::PushL(scheduler);

	CSessionObserver* sessionObserver = new (ELeave) CSessionObserver;
	CleanupStack::PushL(sessionObserver);
	CMsvSession* session = CMsvSession::OpenSyncL(*sessionObserver);
	CleanupStack::PushL(session);
	
	_LIT(KFileName,"FileName");
	TPtrC tag;
	if ( !GetStringFromConfig(ConfigSection(),KFileName,tag))
		{
		ERR_PRINTF1(_L("No Input for FileName in CreateSmsMessage"));
		User::Leave(KErrNotReady);
		}
	
	HBufC* fileName = tag.AllocLC();
	

	// Create a Rich Text object
	CPlainText::TTextOrganisation ttOrg = {CPlainText::EOrganiseByLine};

	CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
	CleanupStack::PushL(paraFormatLayer);
	CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
	CleanupStack::PushL(charFormatLayer);
	CRichText* bodyRichText = CRichText::NewL(paraFormatLayer, charFormatLayer);
	CleanupStack::PushL(bodyRichText);
	
	// Store the file contents into the CRichText object
	bodyRichText->ImportTextFileL(0, fileName->Des(), ttOrg);
	
	
	// Create the SMS header object...
	CSmsHeader* header = CSmsHeader::NewL(CSmsPDU::ESmsSubmit, *bodyRichText);
	CleanupStack::PushL(header);
	
	// Set the body text...
	CSmsSettings* smsSettings = CSmsSettings::NewL();
	CleanupStack::PushL(smsSettings);

	CSmsAccount* account = CSmsAccount::NewLC();
	account->LoadSettingsL(*smsSettings);
	// Copy the message settings...
	header->SetSmsSettingsL(*smsSettings); 
	
	// Set the service centre
	TInt defaultIndex = smsSettings->DefaultServiceCenter();
	header->SetServiceCenterAddressL(smsSettings->GetServiceCenter(defaultIndex).Address());

	// Set recipient - ask derived class
	SetRecipientsL(*header);
	CArrayPtrFlat<CSmsNumber>& recipient = header->Recipients();

	INFO_PRINTF1(_L("Creating message..."));
	
	TMsvEntry entry;
	entry.SetVisible(ETrue); 
	entry.SetInPreparation(ETrue);
	TMsvId srvcId=0;
	TSmsUtilities::ServiceIdL(*session, srvcId);
	entry.iServiceId = srvcId;
	entry.iType = KUidMsvMessageEntry; 
	entry.iMtm = KUidMsgTypeSMS; 
	entry.iDate.UniversalTime();
	entry.iSize = 0; 
	entry.iDescription.Set(KNullDesC); 
	entry.iDetails.Set(KNullDesC); 
	entry.SetSendingState(KMsvSendStateWaiting);

	// Update entry description and details...
	entry.iDetails.Set(recipient[0]->Address());
	entry.iDescription.Set(recipient[0]->Address());
	entry.SetInPreparation(EFalse);

	//TPtrC tag;
	_LIT(KParent,"Parent");
	TPtrC parentTag;
	if ( !GetStringFromConfig(ConfigSection(),KParent,parentTag))
		{
		ERR_PRINTF1(_L("No Input for Outbox"));
		User::Leave(KErrNotReady);
		}
	// Create the entry - set context to the global outbox.
	TMsvId paramParentId =	MsgingUtils::GetLocalFolderId(parentTag);//KMsvGlobalOutBoxIndexEntryId;

	CMsvEntry* newEntry = CMsvEntry::NewL(*session,paramParentId,TMsvSelectionOrdering());
	CleanupStack::PushL(newEntry);
	newEntry->SetEntryL(paramParentId);
	
	newEntry->CreateL(entry);

	// Create new store and save header information
	newEntry->SetEntryL(entry.Id());
	CMsvStore* store = newEntry->EditStoreL();
	CleanupStack::PushL(store);
	header->StoreL(*store);
	store->StoreBodyTextL(*bodyRichText);
	store->CommitL();

//store,newEntry,account, smsSettings, header, bodyRichText,charFormatLayer, paraFormatLayer,fileName
	CleanupStack::PopAndDestroy(9,fileName); 
	
	CleanupStack::PopAndDestroy(3, scheduler);
	
	SetTestStepResult(EPass);
	
	return TestStepResult();
	}
void CMtfTestActionCreateMmsMessageFromSmilFile::RunL()
	{
	iFs.Close();

	CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
	TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
	TMsvId paramFolderId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(2));
	TInt paramConfigIndexSmilFile = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(3),0);
	TInt paramConfigIndexHeader = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(4),0);
		   
	TPtrC SmilFileName = TestCase().GetConfigurationFileL(CMtfConfigurationType::EMtfSmilFile,paramConfigIndexSmilFile);
	TPtrC headerFileName = TestCase().GetConfigurationFileL(CMtfConfigurationType::EMtfMmsHeader,paramConfigIndexHeader);

	iConfigParser = CMtfTestActionUtilsConfigFileParser::NewL(headerFileName);

	TMsvEntry indexEntry;
	indexEntry.iType = KUidMsvMessageEntry;
	indexEntry.iMtm = KUidMsvLocalServiceMtm;
	indexEntry.iServiceId = paramServiceId;

	CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramFolderId,TMsvSelectionOrdering());
	CleanupStack::PushL(entry);

	entry->SetEntryL(paramFolderId);
	entry->CreateL(indexEntry);


	TMsvId paramMessageId = indexEntry.Id();

    CMmsClientMessage* mmsMessage = CMmsClientMessage::NewL(*paramSession,paramMessageId);
	CleanupStack::PushL(mmsMessage);

    CMmsHeaders& headers = mmsMessage->Headers();
	TPtrC from;      
	User::LeaveIfError(iConfigParser->GetFieldAsString(KFrom,from));
    headers.SetFromL(from);
	TPtrC to;          	
	User::LeaveIfError(iConfigParser->GetFieldAsString(KTo,to));
    headers.AddRecipientL(CMmsHeaders::ETo,to);
	TPtrC subject;	
	TInt err = iConfigParser->GetFieldAsString(KSubject,subject);
	if (err != KErrNotFound)
	    headers.SetSubjectL(subject);
	TPtrC cc;          	
	err = iConfigParser->GetFieldAsString(KCc,cc);
	if (err != KErrNotFound)
		headers.AddRecipientL(CMmsHeaders::ECc,cc);
	TPtrC bcc;        	
	err = iConfigParser->GetFieldAsString(KBcc,bcc);
	if (err != KErrNotFound)
	    headers.AddRecipientL(CMmsHeaders::EBcc,bcc);

    mmsMessage->CreateMediaObjectL(ETrue,KMimeApplicationSmil,SmilFileName);
	mmsMessage->StoreL();

	CMDXMLDocument* domTree = iXmlParser->DetachXMLDoc();	
	CleanupStack::PushL(domTree);
	CMDXMLElement* rootElement = domTree->DocumentElement();
	CTraverseNode* traverseNode = new(ELeave) CTraverseNode(*rootElement,*mmsMessage);
	traverseNode->Start();
	delete traverseNode;
	CleanupStack::PopAndDestroy(domTree);

	CleanupStack::PopAndDestroy(mmsMessage);
	CleanupStack::PopAndDestroy(entry);

	StoreParameterL<TMsvId>(TestCase(),paramMessageId,ActionParameters().Parameter(5));

	TestCase().ActionCompletedL(*this);
	}
void CTestPerformanceM::TestMoveMultipleEntry()
{
    _LIT(KFunction, "TestMoveMultipleEntry");
    INFO_PRINTF1(KFunction);

    TSecureId owner = 0x999;
    TUint32 start, stop;
    TMsvEntry entry;
    CMsvEntry* parent = NULL;
    TMsvLocalOperationProgress progress = TMsvLocalOperationProgress();
    CMsvEntrySelection* entries = new(ELeave) CMsvEntrySelection;
    TReal64 diff = 0;

    iServerSide = EFalse;

    INFO_PRINTF1(_L("<b>CLIENT SIDE</b>"));
    TInt frequency;
    HAL::Get(HALData::EFastCounterFrequency, frequency);
    INFO_PRINTF2(_L("<b>FastCounter frequency: %d</b>"), frequency);

    parent = iTestUtils->iMsvSession->GetEntryL(KMsvDraftEntryId);

    //[1]. Move entries from Drafts to Outbox, and back again, and so on.
    for(TInt index = 0; index < 10; ++index)
    {
        TMsvEntry entry;
        entry.SetId((TMsvId)20000+index);
        entry.SetParent(KMsvDraftEntryId);
        entry.iType = KUidMsvMessageEntry;
        entry.iMtm = KUidMsvMessageEntry;
        entry.iServiceId = KMsvLocalServiceIndexEntryId;
        parent->CreateL(entry);
        entries->AppendL(entry.iId);
    }
    parent->SetEntryNoCheckL(KMsvDraftEntryId); //bring to cache
    start = User::FastCounter();
    parent->MoveL(*entries, KMsvGlobalOutBoxIndexEntryId, progress); //iTestActive->iStatus);
    stop = User::FastCounter();
    diff = (TReal64)(stop-start)/frequency;
    INFO_PRINTF3(_L("---Time taken to MOVE %d entries from Drafts which has 10 entries: <b>%f sec</b>"), 10, diff);
    MY_ASSERT_EQUALS(entries->Count(), 10);

    parent->SetEntryL(KMsvGlobalOutBoxIndexEntryId);
    for(TInt index = 0; index < 90; ++index)
    {
        TMsvEntry entry;
        entry.SetId((TMsvId)21000+index);
        entry.SetParent(KMsvGlobalOutBoxIndexEntryId);
        entry.iType = KUidMsvMessageEntry;
        entry.iMtm = KUidMsvMessageEntry;
        entry.iServiceId = KMsvLocalServiceIndexEntryId;
        parent->CreateL(entry);
        entries->AppendL(entry.iId);
    }
    parent->SetEntryNoCheckL(KMsvGlobalOutBoxIndexEntryId); //bring to cache
    start = User::FastCounter();
    parent->MoveL(*entries, KMsvDraftEntryId, progress);
    stop = User::FastCounter();
    diff = (TReal64)(stop-start)/frequency;
    INFO_PRINTF3(_L("---Time taken to MOVE %d entries from Outbox which has 100 entries: <b>%f sec</b>"), 100, diff);
    MY_ASSERT_EQUALS(entries->Count(), 100);

    parent->SetEntryL(KMsvDraftEntryId);
    for(TInt index = 0; index < 400; ++index)
    {
        TMsvEntry entry;
        entry.SetId((TMsvId)22000+index);
        entry.SetParent(KMsvDraftEntryId);
        entry.iType = KUidMsvMessageEntry;
        entry.iMtm = KUidMsvMessageEntry;
        entry.iServiceId = KMsvLocalServiceIndexEntryId;
        parent->CreateL(entry);
        entries->AppendL(entry.iId);
    }
    start = User::FastCounter();
    parent->MoveL(*entries, KMsvGlobalOutBoxIndexEntryId, progress);
    stop = User::FastCounter();
    diff = (TReal64)(stop-start)/frequency;
    INFO_PRINTF3(_L("---Time taken to MOVE %d entries from Drafts which has 500 entries: <b>%f sec</b>"), 500, diff);
    MY_ASSERT_EQUALS(entries->Count(), 500);

    parent->SetEntryL(KMsvGlobalOutBoxIndexEntryId);
    for(TInt index = 0; index < 500; ++index)
    {
        TMsvEntry entry;
        entry.SetId((TMsvId)22000+index);
        entry.SetParent(KMsvGlobalOutBoxIndexEntryId);
        entry.iType = KUidMsvMessageEntry;
        entry.iMtm = KUidMsvMessageEntry;
        entry.iServiceId = KMsvLocalServiceIndexEntryId;
        parent->CreateL(entry);
        entries->AppendL(entry.iId);
    }
    start = User::FastCounter();
    parent->MoveL(*entries, KMsvDraftEntryId, progress);
    stop = User::FastCounter();
    diff = (TReal64)(stop-start)/frequency;
    INFO_PRINTF3(_L("---Time taken to MOVE %d entries from Outbox which has 1000 entries: <b>%f sec</b>"), 1000, diff);
    MY_ASSERT_EQUALS(entries->Count(), 1000);

    parent->SetEntryL(KMsvDraftEntryId);
    for(TInt index = 0; index < 500; ++index)
    {
        TMsvEntry entry;
        entry.SetId((TMsvId)23000+index);
        entry.SetParent(KMsvDraftEntryId);
        entry.iType = KUidMsvMessageEntry;
        entry.iMtm = KUidMsvMessageEntry;
        entry.iServiceId = KMsvLocalServiceIndexEntryId;
        parent->CreateL(entry);
        entries->AppendL(entry.iId);
    }
    start = User::FastCounter();
    parent->MoveL(*entries, KMsvGlobalOutBoxIndexEntryId, progress);
    stop = User::FastCounter();
    diff = (TReal64)(stop-start)/frequency;
    INFO_PRINTF3(_L("---Time taken to MOVE %d entries from Drafts which has 1500 entries: <b>%f sec</b>"), 1500, diff);
    MY_ASSERT_EQUALS(entries->Count(), 1500);

    parent->SetEntryL(KMsvGlobalOutBoxIndexEntryId);
    for(TInt index = 0; index < 500; ++index)
    {
        TMsvEntry entry;
        entry.SetId((TMsvId)24000+index);
        entry.SetParent(KMsvGlobalOutBoxIndexEntryId);
        entry.iType = KUidMsvMessageEntry;
        entry.iMtm = KUidMsvMessageEntry;
        entry.iServiceId = KMsvLocalServiceIndexEntryId;
        parent->CreateL(entry);
        entries->AppendL(entry.iId);
    }
    start = User::FastCounter();
    parent->MoveL(*entries, KMsvDraftEntryId, progress);
    stop = User::FastCounter();
    diff = (TReal64)(stop-start)/frequency;
    INFO_PRINTF3(_L("---Time taken to MOVE %d entries from Outbox which has 2000 entries: <b>%f sec</b>"), 2000, diff);
    MY_ASSERT_EQUALS(entries->Count(), 2000);

    parent->SetEntryL(KMsvDraftEntryId);
    for(TInt index = 0; index < 500; ++index)
    {
        TMsvEntry entry;
        entry.SetId((TMsvId)25000+index);
        entry.SetParent(KMsvDraftEntryId);
        entry.iType = KUidMsvMessageEntry;
        entry.iMtm = KUidMsvMessageEntry;
        entry.iServiceId = KMsvLocalServiceIndexEntryId;
        parent->CreateL(entry);
        entries->AppendL(entry.iId);
    }
    start = User::FastCounter();
    parent->MoveL(*entries, KMsvGlobalOutBoxIndexEntryId, progress);
    stop = User::FastCounter();
    diff = (TReal64)(stop-start)/frequency;
    INFO_PRINTF3(_L("---Time taken to MOVE %d entries from Drafts which has 2500 entries: <b>%f sec</b>"), 2500, diff);
    MY_ASSERT_EQUALS(entries->Count(), 2500);

    parent->SetEntryL(KMsvGlobalOutBoxIndexEntryId);
    for(TInt index = 0; index < 500; ++index)
    {
        TMsvEntry entry;
        entry.SetId((TMsvId)26000+index);
        entry.SetParent(KMsvGlobalOutBoxIndexEntryId);
        entry.iType = KUidMsvMessageEntry;
        entry.iMtm = KUidMsvMessageEntry;
        entry.iServiceId = KMsvLocalServiceIndexEntryId;
        parent->CreateL(entry);
        entries->AppendL(entry.iId);
    }
    start = User::FastCounter();
    parent->MoveL(*entries, KMsvDraftEntryId, progress);
    stop = User::FastCounter();
    diff = (TReal64)(stop-start)/frequency;
    INFO_PRINTF3(_L("---Time taken to MOVE %d entries from Outbox which has 3000 entries: <b>%f sec</b>"), 3000, diff);
    MY_ASSERT_EQUALS(entries->Count(), 3000);
    delete entries;

    iServerSide = ETrue;
}