void CMtfTestActionImap4Connected::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionImap4Connected); TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(0)); // First parameter is the MTM CImap4ClientMtm* pMtm = ObtainParameterReferenceL<CImap4ClientMtm>(TestCase(),ActionParameters().Parameter(1)); // Second parameter is the boolean state TBool connected = ObtainValueParameterL<TBool>(TestCase(),ActionParameters().Parameter(2)); TInt expected = KErrNone; if(connected == 0) expected = KErrDisconnected; // Get the state of the MTM CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; CleanupStack::PushL(selection); selection->AppendL(paramServiceId); TBuf8<16> param; pMtm->InvokeSyncFunctionL(KIMAP4MTMIsConnected, *selection, param); CleanupStack::PopAndDestroy(); // selection TInt err = param[0]; if((err != KErrNone && connected != 0 ) || (err == KErrNone && connected == 0 )) { TestCase().ERR_PRINTF3( _L("CMtfTestActionImap4Connected err(%d) != expected(%d)"), err, expected ); TestCase().SetTestStepResult(EFail); } TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionImap4Connected); TestCase().ActionCompletedL(*this); }
EXPORT_C void CMsvServerEntry::MoveEntryL(TMsvId aId, TMsvId aDestination, TRequestStatus& aObserverStatus) // // // /** Moves a child of the context to another entry that belongs to a different service. All descendants will be moved as well. The move is carried out asynchronously. The caller should supply in aObserverStatus the status word of an active object that it owns. The function will signal this to be completed when the move is complete. If the function leaves, no changes are made. In pre-Unicode versions an asynchronous move can be cancelled through CancelMoveEntry(); in other releases, use Cancel(). @param aId The ID of the entry to move @param aDestination The ID of new parent @param aObserverStatus The request status to be completed when the operation has finished @leave KErrArgument The destination is a child of aId @leave KErrInUse The store or a file associated with the entry is open @leave KErrNoMemory A memory allocation failed @leave KErrNotFound aId is not a child of the context @leave KErrPathNotFound The destination does not exist */ { CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection; CleanupStack::PushL(selection); selection->AppendL(aId); MoveEntriesL(*selection, aDestination, aObserverStatus); CleanupStack::PopAndDestroy(); // selection }
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);)
TBool CSmsSendRecvTest::SendNextMessageL() { iCurrentMessageNum++; const TInt count = iSelection->Count(); if (iCurrentMessageNum < count) { iSmsTest.Printf(_L("Sending message %d of %d\n"), iCurrentMessageNum + 1, count); delete iOperation; iOperation = NULL; CMsvEntrySelection* sel = new (ELeave) CMsvEntrySelection(); CleanupStack::PushL(sel); const TMsvId id = iSelection->At(iCurrentMessageNum); sel->AppendL(id); iSent += CountRecipientsL(id); iSmsTest.SetEntryL(KMsvGlobalOutBoxIndexEntryId); iOperation = MsvEntry().CopyL(*sel, iSmsTest.iSmsServiceId, iStatus); CleanupStack::PopAndDestroy(); //sel iState = EStateSending; SetActive(); CActiveScheduler::Start(); return ETrue; } return EFalse; }
EXPORT_C void CMsvServerEntry::CopyEntryL(TMsvId aId, TMsvId aDestination, TRequestStatus& aObserverStatus) // // Recursively copies a child of the context to another entry that belongs to a different service. // /** Copies a child of the context to another entry. All descendants will be copied as well. The copy is carried out asynchronously. The caller should supply in aObserverStatus the status word of an active object that it owns. The function will signal this to be completed when the copy is complete. If the function leaves, no changes are made. @param aId The ID of the entry to copy @param aDestination The ID of new parent @param aObserverStatus The request status to be completed when the operation has finished @leave KErrArgument The destination is a child of an aSelection entry @leave KErrInUse The store or a file associated with an entry is open @leave KErrNoMemory A memory allocation failed @leave KErrNotFound An aSelection entry is not a child of the context @leave KErrPathNotFound The destination does not exist */ { CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection; CleanupStack::PushL(selection); selection->AppendL(aId); iCompletedSelection = NULL; iCompletedEntryId = NULL; DoCopyEntriesL(*selection, aDestination, aObserverStatus); CleanupStack::PopAndDestroy(); // selection }
void CTestNbssMtm::DoProcessAgainL() { TBuf8<1>dummy; iState = ENbssTestProcess; // add service entry and msg entry to selection passed to MTM iSelection->Reset(); iSelection->AppendL((*iMsvSelection)[iFilesProcessed]); #if defined _HEAP_FAILURE_TEST_ TBool finished=EFalse; #ifdef _DEBUG TInt failCount=0; #endif while (!finished) { __UHEAP_FAILNEXT(failCount++); TRAPD(error,iNbssServerMtm->StartCommandL(*iSelection, KBiosMtmProcess, dummy, iStatus)); if (error==KErrNone) { finished=ETrue; __UHEAP_RESET; } else { test(error==KErrNoMemory); __UHEAP_RESET; } } #else iNbssServerMtm->StartCommandL(*iSelection, KBiosMtmProcess, dummy, iStatus); #endif iState = ENbssTestProcess; }
CMsvEntrySelection* TestUniDataModelVCalPlugin::GenerateMessagesL() { HBufC* aFileDirectory = KBIOTxtFilePath().AllocL(); TMsvId messageId; TBIOMessageType currentMsgType; CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection(); CleanupStack::PushL(selection); TInt err = iFs.GetDir(aFileDirectory->Des(), KEntryAttMatchMask, ESortByName, iDir); if (err == KErrPathNotFound) { TInt makeDirErr = iFs.MkDirAll(aFileDirectory->Des()); makeDirErr == KErrNone ? User::Leave(KErrNotFound) : User::Leave(makeDirErr); } else if (err != KErrNone) { User::Leave(err); } // Set the session path for the RFs SetSessionPath(aFileDirectory->Des()); if (iDir) { delete iDir; iDir = NULL; } User::LeaveIfError(iFs.GetDir(_L("*.txt"), KEntryAttNormal, ESortByName, iDir)); TInt count = iDir->Count(); if (count == 0) { User::Leave(KErrNotFound); // No files to process } TBuf<60> outputBuf; for (TInt loop = 0; loop < count; loop++) { TEntry as = (*iDir)[0]; currentFile = (as.iName); // Not processed all the messages - so keep the current state iFilesProcessed++; // Here because need to update the counter promptly currentMsgType = SetMessageType(currentFile); if (currentMsgType != ENoMessage) // skip any dodgy filenames { messageId = CreateBIOEntryFromFileL(currentFile, currentMsgType); selection->AppendL(messageId); TPtrC tempPtr = (currentFile.Des()); } } CleanupStack::Pop(); // selection return selection; }
// ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- void CIpsSosAOImapAgent::StartSyncL() { FUNC_LOG; if ( iOngoingOp ) { User::Leave( KErrNotReady ); } LoadSettingsL( ); if ( !IsConnected() ) { NM_COMMENT("CIpsSosAOImapAgent: starting sync"); TPckg<MMsvImapConnectionObserver*> parameter(this); // connect and synchronise starts background sync or idle CMsvEntrySelection* sel = new ( ELeave ) CMsvEntrySelection(); CleanupStack::PushL( sel ); sel->AppendL( iServiceId ); iImapClientMtm->SwitchCurrentEntryL( iServiceId ); iOngoingOp = iImapClientMtm->InvokeAsyncFunctionL( KIMAP4MTMConnectAndSyncCompleteAfterFullSync, *sel, parameter, iStatus); CleanupStack::PopAndDestroy( sel ); SetActive(); iState = EStateConnectAndSync; } else { NM_COMMENT("CIpsSosAOImapAgent: already connected do not sync"); // do not do anything if we are connected, especially do never // try to sync if sync is is already started (ex. from ips plugin) // that cause problems with imap flags etc. iError = KErrCancel; iState = EStateCompleted; SetActiveAndCompleteThis(); } }
void CMsgImOutboxSend::DisconnectUnsentMessagesL() { // Pos errors TInt err = KErrNone; // Temp entry selection... CMsvEntrySelection* unsentSelection = new (ELeave) CMsvEntrySelection(); CleanupStack::PushL(unsentSelection); // Append unsent messages into the temp array.. for(TInt i=0; i<iEntrySelection.Count(); i++) { err = iServerEntry.SetEntry((iEntrySelection)[i]); // If not found carry on along the array... if(err != KErrNone) continue; if(iServerEntry.Entry().Parent() == KMsvGlobalOutBoxIndexEntryIdValue) { unsentSelection->AppendL((iEntrySelection)[i]); } } // Reset the iConnected flag on the lot. User::LeaveIfError(iServerEntry.SetEntry(KMsvGlobalOutBoxIndexEntryIdValue)); if(unsentSelection->Count() > 0) { User::LeaveIfError(iServerEntry.ChangeAttributes(*unsentSelection, 0, KMsvConnectedAttribute)); } iServerEntry.SetEntry(KMsvNullIndexEntryId); CleanupStack::PopAndDestroy(); // unsentSelection.. }
void CMsvSendExe::RescheduleAllL(TInt aError) { SCHSENDLOG(FLog(iFileName, _L("\tRescheduleAllL [aError=%d]"), aError)); RScheduler scheduler; TSchedulerItemRef ref; ref.iHandle = KErrNotFound; TInt count = 0; TInt err = KErrNone; TTime start; start.UniversalTime(); TInt activeCount = iOperations.Count(); while (activeCount--) { CMsvSendExeActive& active = *iOperations[activeCount]; active.Cancel(); TRAP(err, DoResheduleOnErrorL(scheduler, active.Selection(), active.Package(), aError, ref, count, start)); //ignore error FailOnError(active.Selection(), aError); } activeCount = iPackages.Count(); CMsvEntrySelection* sel = new (ELeave) CMsvEntrySelection; CleanupStack::PushL(sel); while (activeCount--) { const TMsvSchedulePackage& package = iPackages[activeCount]; sel->Reset(); sel->AppendL(package.iId); TRAP(err, DoResheduleOnErrorL(scheduler, *sel, package, aError, ref, count, start)); //ignore error FailOnError(*sel, aError); } CleanupStack::PopAndDestroy(sel); CompleteReschedule(scheduler, ref, count); }
void CPopsTestHarness::CreateTestHarnessesL() { CMsvEntrySelection* serviceSelection = new (ELeave) CMsvEntrySelection; CleanupStack::PushL(serviceSelection); serviceSelection->AppendL(iPop3Service); TBuf8<128> parameter; //-------------------------------------------- // Copy To Local //-------------------------------------------- delete iConnectAndCopyAll; iConnectAndCopyAll = NULL; iConnectAndCopyAll = CMtmTestHarness::NewL(*(iTestUtils->iPopServerMtm), *iTestUtils); // Connect iConnectAndCopyAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils->iPopServerMtm), serviceSelection, KPOP3MTMConnect, parameter)); // Copy all messages under the service to the local inbox. CMtmTestCommand* copyToLocal = CMtmTestCopyToLocal::NewL(*(iTestUtils->iPopServerMtm), 0, KMsvGlobalInBoxIndexEntryId); iConnectAndCopyAll->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils->iPopServerMtm), copyToLocal, iPop3Service, *(iTestUtils->iServerEntry))); // Quit iConnectAndCopyAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils->iPopServerMtm), serviceSelection, KPOP3MTMDisconnect, parameter)); //-------------------------------------------- // Copy Within Service //-------------------------------------------- delete iConnectAndPopulateAll; iConnectAndPopulateAll = NULL; iConnectAndPopulateAll = CMtmTestHarness::NewL(*(iTestUtils->iPopServerMtm), *iTestUtils); // Connect iConnectAndPopulateAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils->iPopServerMtm), serviceSelection, KPOP3MTMConnect, parameter)); // Copy all messages under the service to the local service. copyToLocal = CMtmTestCopyWithinService::NewL(*(iTestUtils->iPopServerMtm), 0, iPop3Service); iConnectAndPopulateAll->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils->iPopServerMtm), copyToLocal, iPop3Service, *(iTestUtils->iServerEntry))); // Quit iConnectAndPopulateAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils->iPopServerMtm), serviceSelection, KPOP3MTMDisconnect, parameter)); //-------------------------------------------- // Offline Copy //-------------------------------------------- CMsvServerEntry* serverEntry = iTestUtils->iServerEntry; serverEntry->SetEntry(iPop3Service); CMsvEntrySelection* newMessageList = new (ELeave)CMsvEntrySelection(); CleanupStack::PushL(newMessageList); serverEntry->GetChildren(*newMessageList); delete iOfflineCopy; iOfflineCopy = NULL; iOfflineCopy = CMtmTestHarness::NewL(*(iTestUtils->iPopServerMtm), *iTestUtils); // Copy all messages under the service to the local inbox. copyToLocal = CMtmTestCopyToLocal::NewL(*(iTestUtils->iPopServerMtm), newMessageList, KMsvGlobalInBoxIndexEntryId); iOfflineCopy->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils->iPopServerMtm), copyToLocal, iPop3Service, *(iTestUtils->iServerEntry))); // Connect iOfflineCopy->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils->iPopServerMtm), serviceSelection, KPOP3MTMConnect, parameter)); // Quit iOfflineCopy->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils->iPopServerMtm), serviceSelection, KPOP3MTMDisconnect, parameter)); CleanupStack::PopAndDestroy(2); // newMessageList, serviceSelection }
void CTestImapSyncManager::DeleteFolderL(const TDesC& aName) { TBuf8<128> parameter; TMsvId id = FindFolderL(aName); // delete CMsvEntrySelection* msvEntrySelection = new (ELeave) CMsvEntrySelection; msvEntrySelection->AppendL(id); iImapServerMtm->DeleteAllL(*msvEntrySelection,iActiveWaiter->iStatus); iActiveWaiter->WaitActive(); delete msvEntrySelection; }
void CTestImapSyncManager::SetSubscriptionL(const TDesC& aName) { TBuf8<128> parameter; TMsvId id = FindFolderL(aName); CMsvEntrySelection* msvEntrySelection = new (ELeave) CMsvEntrySelection; msvEntrySelection->Reset(); msvEntrySelection->AppendL(id); iImapServerMtm->StartCommandL(*msvEntrySelection, KIMAP4MTMLocalSubscribe, parameter, iActiveWaiter->iStatus); iActiveWaiter->WaitActive(); TBool sub = ((TMsvEmailEntry)iEntry->Entry()).LocalSubscription(); delete msvEntrySelection; }
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 }
/** doTestStepL() It establishes connection with the Pop server using a POP account. The account is identified by the account name that is read from the INI file. @return Returns the test step result */ TVerdict CT_MsgConnectPop3Server::doTestStepL() { INFO_PRINTF1(_L(" Test Step : ConnectPop3Server")); TPtrC popAccountName; if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName)) { ERR_PRINTF1(_L("Pop Account Name is not specified")); SetTestStepResult(EFail); } else { // Retrieving the Pop service Id for the given Pop account TMsvId popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName); INFO_PRINTF2(_L("Pop service id is %d"),popServiceId); // Change the current context iSharedDataPOP.iMtm->SwitchCurrentEntryL(popServiceId); CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; CleanupStack::PushL(selection); // Appends the popServiceId onto the end of the array selection->AppendL(popServiceId); TBuf8<KMaxLenghtOfChar> param; CT_MsgActive& active=Active(); // Attempts to connect to the Pop3 Service iOperation = iSharedDataPOP.iMtm->InvokeAsyncFunctionL(KPOP3MTMConnect,*selection,param, active.iStatus); active.Activate(); CActiveScheduler::Start(); // Get the error code from TPop3Progress TPop3Progress temp; TPckgC<TPop3Progress> paramPack(temp); paramPack.Set(iOperation->ProgressL()); TPop3Progress progress=paramPack(); SetTestStepError(progress.iErrorCode); delete iOperation; iOperation=NULL; CleanupStack::PopAndDestroy(selection); //operation,selection // User::LeaveIfError(active.Result()); } return TestStepResult(); }
void CMtfTestActionDisconnectPop3Server::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionDisconnectPop3Server); TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(0)); CPop3ClientMtm* paramMtm = ObtainParameterReferenceL<CPop3ClientMtm>(TestCase(),ActionParameters().Parameter(1)); CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; CleanupStack::PushL(selection); selection->AppendL(paramServiceId); TBuf8<1> param; iOperation = paramMtm->InvokeAsyncFunctionL(KPOP3MTMDisconnect,*selection,param,iStatus); CleanupStack::PopAndDestroy(selection); CActiveScheduler::Add(this); SetActive(); TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionDisconnectPop3Server); }
void CSmsReplyToStep::SendMessageL() { INFO_PRINTF1(_L("Sending message...")); delete iOperation; iOperation = NULL; CMsvEntrySelection* sel = new (ELeave) CMsvEntrySelection(); CleanupStack::PushL(sel); sel->AppendL(iMessageId); iTestUtils->DisplayMessageL(iMessageId); iTestUtils->iMsvEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryId); iOperation = iTestUtils->iMsvEntry->CopyL(*sel, iTestUtils->iSmsServiceId,iTestActive->iStatus); iTestActive->StartL(); CActiveScheduler::Start(); CleanupStack::PopAndDestroy(sel); }
void CSessionObserver::DoHandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3) { CMsvEntrySelection* selection=NULL; iSelection.Reset(); iParameter=0; iType = aEvent; switch (iType) { case EMsvEntriesCreated: selection= (CMsvEntrySelection*)aArg1; #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) iParameter = UnmaskTMsvId(*(TMsvId*)aArg2); #else iParameter = *(TMsvId*)aArg2; #endif break; case EMsvEntriesChanged: selection= (CMsvEntrySelection*)aArg1; break; case EMsvEntriesDeleted: selection= (CMsvEntrySelection*)aArg1; #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) iParameter = UnmaskTMsvId(*(TMsvId*)aArg2); #else iParameter = *(TMsvId*)aArg2; #endif break; case EMsvEntriesMoved: selection = (CMsvEntrySelection*)aArg1; #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) iParameter = UnmaskTMsvId(*(TMsvId*)aArg2); iParameter2 = UnmaskTMsvId(*(TMsvId*)aArg3); #else iParameter = *(TMsvId*)aArg2; iParameter2 = *(TMsvId*)aArg3; #endif break; default: break; } if (selection) { for (TInt count=0; count<selection->Count(); count++) iSelection.AppendL(selection->At(count)); } }
// ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- void CIpsSosAOImapAgent::CancelAllAndDisconnectL() { FUNC_LOG; // if we are already idle state, do nothing, // completing in idle state might cause unvanted events to ui if (iState == EStateIdle) { return; } iDoNotDisconnect = EFalse; iState = EStateCompleted; iFoldersArray.Reset(); if ( IsActive() ) { Cancel(); } if ( IsConnected() ) { TBuf8<1> dummy; CMsvEntrySelection* sel = new ( ELeave ) CMsvEntrySelection(); CleanupStack::PushL( sel ); sel->AppendL( iServiceId ); iImapClientMtm->SwitchCurrentEntryL( iServiceId ); TRAPD( error, iOngoingOp = iImapClientMtm->InvokeAsyncFunctionL( KIMAP4MTMDisconnect, *sel, dummy, iStatus) ); CleanupStack::PopAndDestroy( sel ); if ( error == KErrNone ) { SetActive(); } else { iSession.StopService( iServiceId ); SetActiveAndCompleteThis(); } } else { SetActiveAndCompleteThis(); } }
// Disconnect from ImapServer LOCAL_C void DisconnectImapServerL() { test.Printf(_L("DisConnecting to IMAP server \n")); CTestActive* testActive = new (ELeave) CTestActive(); CleanupStack::PushL(testActive); CMsvEntrySelection *msvSelection = new(ELeave) CMsvEntrySelection; CleanupStack::PushL(msvSelection); msvSelection->AppendL(imap4Service); TBuf8 <1> aParameter; CMsvOperation* msvOperation = testUtils->iImapClientMtm->InvokeAsyncFunctionL(KIMAP4MTMDisconnect,*msvSelection, aParameter, testActive->iStatus); testUtils->WriteComment(_L("Dissconnect from IMAP server ")); CleanupStack::PushL(msvOperation); testActive->StartL(); CActiveScheduler::Start(); CleanupStack::PopAndDestroy(3,testActive);//msvOperation,msvSelection,children,testActive }
/** Function : ExecuteActionL Description : Entry point for the this test action in the test framework @internalTechnology @param : none @return : void @pre none @post none */ void CMtfTestActionSendEMsvStopService::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSendEMsvStopService); // for this test action we need a pending operation on the MTM // we will create a spurious imap4 disconnect operation TMsvId serviceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(0)); CImap4ClientMtm* paramMtm = ObtainParameterReferenceL<CImap4ClientMtm>(TestCase(),ActionParameters().Parameter(1)); TInt pass = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2) ); CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; CleanupStack::PushL( selection ); selection->AppendL( serviceId ); TBuf8<1> param; CMsvOperation* operation = paramMtm->InvokeAsyncFunctionL(KIMAP4MTMDisconnect,*selection,param,iStatus); CleanupStack::PushL( operation ); RProxyServerSession RPSS; TInt error = RPSS.Connect(); if (error!=KErrNone) { TestCase().ERR_PRINTF1(_L("CMtfTestActionSendEMsvStopService :: Unable to start proxy server. !")); TestCase().SetTestStepResult(EFail); } else { TInt32 serverCaps; RPSS.GetServerCapabilities(serverCaps); TestCase().INFO_PRINTF2(_L("Proxy Server has capabilities: %x"), serverCaps); error = 0; error=RPSS.SendReceive(EMsvStopService , TIpcArgs( serviceId ) ); IPCCommandReportPassOrFailForCapsPermissions( TestCase(), KMsvServerName, error , pass ); } CleanupStack::PopAndDestroy( 2, selection ); TestCase().INFO_PRINTF2(_L(" (<: Test Action %S completed :>) "), &KTestActionSendEMsvStopService ); TestCase().ActionCompletedL(*this); }
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")); }
void CMultipleSessionObserver::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3) { if (iActive) { CMsvEntrySelection* selection=NULL; iEvents++; __ASSERT_ALWAYS(iType==aEvent,User::Panic(_L("T_CLIENT"),1)); switch (iType) { case EMsvEntriesMoved: #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) __ASSERT_ALWAYS(UnmaskTMsvId(iParameter2)==UnmaskTMsvId(*(TMsvId*)aArg3), User::Panic(_L("T_CLIENT"),2)); #else __ASSERT_ALWAYS(iParameter2==*(TMsvId*)aArg3, User::Panic(_L("T_CLIENT"),2)); #endif case EMsvEntriesDeleted: case EMsvEntriesCreated: selection= (CMsvEntrySelection*)aArg1; #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) __ASSERT_ALWAYS(UnmaskTMsvId(iParameter)==UnmaskTMsvId(*(TMsvId*)aArg2), User::Panic(_L("T_CLIENT"),2)); #else __ASSERT_ALWAYS(iParameter==*(TMsvId*)aArg2, User::Panic(_L("T_CLIENT"),2)); #endif break; default: User::Panic(_L("T_CLIENT"),3); break; } if (selection) { for (TInt count=0; count<selection->Count(); count++) iSelection.AppendL(selection->At(count)); } if (iWait) { CActiveScheduler::Stop(); iWait=EFalse; } } }
LOCAL_C void ConnectAndFullSyncImapServerL() { CTestActive* testActive = new(ELeave) CTestActive(); CleanupStack::PushL(testActive); CMsvEntrySelection * msvSelection = new(ELeave) CMsvEntrySelection; CleanupStack::PushL(msvSelection); test.Printf(_L("Connecting to IMAP server \n")); msvSelection->AppendL(imap4Service); CDummyConnectionObserver *dummyObserver = new(ELeave)CDummyConnectionObserver; CleanupStack::PushL(dummyObserver); TPckg<MMsvImapConnectionObserver*> aParameter(dummyObserver); CMsvOperation* msvOperation = testUtils->iImapClientMtm->InvokeAsyncFunctionL(KIMAP4MTMConnectAndSyncCompleteAfterFullSync,*msvSelection, aParameter, testActive->iStatus); testUtils->WriteComment(_L(" Connect to Imap server and Sync the mails ")); CleanupStack::PushL(msvOperation); testActive->StartL(); CActiveScheduler::Start(); CleanupStack::PopAndDestroy(4,testActive);//msvOperation,dummyObserver,msvSelection,testActive }
/** Function : doTestStepL Description : Reads the Imap account name from the ini file. It establishes connection with the IMAP server. @return : TVerdict - Test step result */ TVerdict CT_MsgConnectImap4Server::doTestStepL() { INFO_PRINTF1(_L(" Test Step : ConnectIMAP4Server")); /* Reads the name of the account from the ini file */ TPtrC imapAccountName; if(!GetStringFromConfig( ConfigSection(), KImapAccountName, imapAccountName)) { ERR_PRINTF1(_L("Imap Account Name is not specified")); SetTestStepResult(EFail); } else { /* Retrieves the Imap service Id for the given Imap account*/ TMsvId imapServiceId = CT_MsgUtilsCentralRepository::GetImapServiceIdL((TDes&)imapAccountName); INFO_PRINTF2(_L("Imap service id is %d"),imapServiceId ); /* Changes the current context and switches to the IMAP service Id*/ iSharedDataIMAP.iMtm->SwitchCurrentEntryL(imapServiceId); /* Creates a selection object*/ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; CleanupStack::PushL(selection); /* Appends the IMAP ServiceId onto the end of the selection */ selection->AppendL(imapServiceId); // Get any expected error TInt expectedErr = 0; GetIntFromConfig(ConfigSection(), KExpectedErr, expectedErr); TBuf8<1> param; /* Attempts to connect to the IMAP server*/ CT_MsgActive& active=Active(); delete iOperation; iOperation=NULL; /* Attempts to establish connection with the IMAP server */ iOperation = iSharedDataIMAP.iMtm->InvokeAsyncFunctionL(KIMAP4MTMConnect, *selection,param, active.iStatus); active.Activate(); CActiveScheduler::Start(); if ((expectedErr != KErrNone) || (active.Result() != KErrNone)) { if(active.Result() == expectedErr) { INFO_PRINTF1(_L("Failed with Expected Error")); SetTestStepResult(EPass); } else { ERR_PRINTF2(_L("Failed with %d error"), active.Result()); SetTestStepResult(EFail); } } SetTestStepError(active.Result()); CleanupStack::PopAndDestroy(selection); /* selection */ } return TestStepResult(); }
void CPopsTestHarness::CreateTestHarnessesL() { CMsvEntrySelection* serviceSelection = new (ELeave) CMsvEntrySelection; CleanupStack::PushL(serviceSelection); serviceSelection->AppendL(iPop3Service); TBuf8<128> parameter; delete iConnectAndCopyAll; iConnectAndCopyAll = NULL; iConnectAndCopyAll = CMtmTestHarness::NewL(*(iTestUtils.iPopServerMtm), iTestUtils); // Connect iConnectAndCopyAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMConnect, parameter)); // Copy all messages under the service to the local inbox. CMtmTestCommand* copyToLocal = CMtmTestCopyToLocal::NewL(*(iTestUtils.iPopServerMtm), 0, KMsvGlobalInBoxIndexEntryId); iConnectAndCopyAll->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils.iPopServerMtm), copyToLocal, iPop3Service, *(iTestUtils.iServerEntry))); // Quit iConnectAndCopyAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMDisconnect, parameter)); delete iConnectAndPopulateAll; iConnectAndPopulateAll = NULL; iConnectAndPopulateAll = CMtmTestHarness::NewL(*(iTestUtils.iPopServerMtm), iTestUtils); // Connect iConnectAndPopulateAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMConnect, parameter)); // Copy all messages under the service to the local inbox. copyToLocal = CMtmTestCopyWithinService::NewL(*(iTestUtils.iPopServerMtm), 0, iPop3Service); iConnectAndPopulateAll->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils.iPopServerMtm), copyToLocal, iPop3Service, *(iTestUtils.iServerEntry))); // Quit iConnectAndPopulateAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMDisconnect, parameter)); delete iConnectAndMoveAll; iConnectAndMoveAll = NULL; iConnectAndMoveAll = CMtmTestHarness::NewL(*(iTestUtils.iPopServerMtm), iTestUtils); // Connect iConnectAndMoveAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMConnect, parameter)); // Move all messages under the service to the local inbox. CMtmTestCommand* moveToLocal = CMtmTestMoveToLocal::NewL(*(iTestUtils.iPopServerMtm), 0, KMsvGlobalInBoxIndexEntryId); iConnectAndMoveAll->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils.iPopServerMtm), moveToLocal, iPop3Service, *(iTestUtils.iServerEntry))); // Quit iConnectAndMoveAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMDisconnect, parameter)); delete iMoveAll; iMoveAll = NULL; iMoveAll = CMtmTestHarness::NewL(*(iTestUtils.iPopServerMtm), iTestUtils); // Move all messages under the service to the local inbox. moveToLocal = CMtmTestMoveToLocal::NewL(*(iTestUtils.iPopServerMtm), 0, KMsvGlobalInBoxIndexEntryId); iMoveAll->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils.iPopServerMtm), moveToLocal, iPop3Service, *(iTestUtils.iServerEntry))); delete iConnect; iConnect = NULL; iConnect = CMtmTestHarness::NewL(*(iTestUtils.iPopServerMtm), iTestUtils); // Connect iConnect->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMConnect, parameter)); delete iConnectAndQuit; iConnectAndQuit = NULL; iConnectAndQuit = CMtmTestHarness::NewL(*(iTestUtils.iPopServerMtm), iTestUtils); // Connect iConnectAndQuit->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMConnect, parameter)); // Quit iConnectAndQuit->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMDisconnect, parameter)); delete iCopyAllWithoutConnect; iCopyAllWithoutConnect = NULL; iCopyAllWithoutConnect = CMtmTestHarness::NewL(*(iTestUtils.iPopServerMtm), iTestUtils); // Copy all messages under the service to the local inbox. copyToLocal = CMtmTestCopyToLocal::NewL(*(iTestUtils.iPopServerMtm), 0, KMsvGlobalInBoxIndexEntryId); iCopyAllWithoutConnect->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils.iPopServerMtm), copyToLocal, iPop3Service, *(iTestUtils.iServerEntry))); // Quit iCopyAllWithoutConnect->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMDisconnect, parameter)); delete iCopyAllOffline; iCopyAllOffline = NULL; iCopyAllOffline = CMtmTestHarness::NewL(*(iTestUtils.iPopServerMtm), iTestUtils); // Copy all messages under the service to the local inbox. copyToLocal = CMtmTestCopyToLocal::NewL(*(iTestUtils.iPopServerMtm), 0, KMsvGlobalInBoxIndexEntryId); iCopyAllOffline->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils.iPopServerMtm), copyToLocal, iPop3Service, *(iTestUtils.iServerEntry))); // Connect iCopyAllOffline->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMConnect, parameter)); // Quit iCopyAllOffline->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMDisconnect, parameter)); delete iOfflineDelete; iOfflineDelete = NULL; iOfflineDelete = CMtmTestHarness::NewL(*(iTestUtils.iPopServerMtm), iTestUtils); // Connect iOfflineDelete->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMConnect, parameter)); // Quit iOfflineDelete->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMDisconnect, parameter)); // Delete all the entries CMtmTestDeleteAll* deleteAll = CMtmTestDeleteAll::NewL(*(iTestUtils.iPopServerMtm), 0); iOfflineDelete->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils.iPopServerMtm), deleteAll, iPop3Service, *(iTestUtils.iServerEntry))); delete iCancelOfflineDeleteOnline; iCancelOfflineDeleteOnline = NULL; iCancelOfflineDeleteOnline = CMtmTestHarness::NewL(*(iTestUtils.iPopServerMtm), iTestUtils); // Connect iCancelOfflineDeleteOnline->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMConnect, parameter)); // Cancel offline delete CMtmTestStartCommand* cancelAllDeletes = CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), 0, KPOP3MTMCancelOfflineOperations, parameter); iCancelOfflineDeleteOnline->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils.iPopServerMtm), cancelAllDeletes, iPop3Service, *(iTestUtils.iServerEntry))); // Quit iCancelOfflineDeleteOnline->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMDisconnect, parameter)); delete iCancelOfflineDelete; iCancelOfflineDelete = NULL; iCancelOfflineDelete = CMtmTestHarness::NewL(*(iTestUtils.iPopServerMtm), iTestUtils); // Cancel offline delete cancelAllDeletes = CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), 0, KPOP3MTMCancelOfflineOperations, parameter); iCancelOfflineDelete->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils.iPopServerMtm), cancelAllDeletes, iPop3Service, *(iTestUtils.iServerEntry))); // Top Test addition delete iConnectAndTopPopulateAll; iConnectAndTopPopulateAll = NULL; iConnectAndTopPopulateAll = CMtmTestHarness::NewL(*(iTestUtils.iPopServerMtm), iTestUtils); // Connect iConnectAndTopPopulateAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMConnect, parameter)); // Copy all messages under the service to the local inbox. copyToLocal = CMtmTestTopPopulate::NewL(*(iTestUtils.iPopServerMtm), 0, iPop3Service); iConnectAndTopPopulateAll->AddCommandL(CMtmTestCommandOnAllMessages::NewL(*(iTestUtils.iPopServerMtm), copyToLocal, iPop3Service, *(iTestUtils.iServerEntry))); // Quit iConnectAndTopPopulateAll->AddCommandL(CMtmTestStartCommand::NewL(*(iTestUtils.iPopServerMtm), serviceSelection, KPOP3MTMDisconnect, parameter)); CleanupStack::PopAndDestroy(); // serviceSelection }
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; }
void CSmsSendRecvTest::TestParseL() { const TMsvId id = iEntryObserver->LastReceived(); iSmsTest.SetEntryL(id); if (iSaveToFile) { iSmsTest.Printf(_L("Saving BIO message to file\n")); iSmsTest.SaveBodyToFileL(id); } CSmsHeader* header = iSmsTest.GetHeaderLC(id); CSmsDeliver& pdu = header->Deliver(); TBool found = EFalse; TInt destination, originator, is16Bit; destination = originator = is16Bit = 0; if (pdu.UserDataPresent()) { const CSmsUserData& userData = pdu.UserData(); TInt count = userData.NumInformationElements(); iSmsTest.Printf(_L("Pdu contains %d information elements\n"), count); while (!found && count--) { CSmsInformationElement& nextIE=userData.InformationElement(count); switch(nextIE.Identifier()) { case CSmsInformationElement::ESmsIEIApplicationPortAddressing8Bit: case CSmsInformationElement::ESmsIEIApplicationPortAddressing16Bit: { pdu.ApplicationPortAddressing(destination, originator, &is16Bit); found = ETrue; break; } default: break; } } } CleanupStack::PopAndDestroy(header); if (found) iSmsTest.Printf(_L("Application Port Addressing: Dest %d, Origin %d, is16Bit %d\n"), destination, originator, is16Bit); else iSmsTest.Printf(_L("Application Port Addressing: Not Found\n")); if (!iParse) return; if (!iSmsTest.Entry().iBioType) return; iState = EStateParsing; iSmsTest.Printf(_L("Parsing BIO message\n")); CMsvEntrySelection* sel = new (ELeave) CMsvEntrySelection(); CleanupStack::PushL(sel); sel->AppendL(id); delete iOperation; iOperation = NULL; iOperation = Session().TransferCommandL(*sel, KBiosMtmParse, KNullDesC8, iStatus); SetActive(); CleanupStack::PopAndDestroy(sel); }
void CMsvServerEntry::DoDeleteEntriesL(CMsvEntrySelection& aSelection, CMsvEntrySelection*& aDeleted, CMsvEntrySelection*& aMoved) // // // { __ASSERT_DEBUG(!aDeleted && !aMoved, PanicServer(EMsvDeleteAndMoveSelectionsNotNull)); __ASSERT_DEBUG(aSelection.Count() > 0, PanicServer(EMsvDeletingEmptySelection)); // Total entries deleted and moved aDeleted = new(ELeave)CMsvEntrySelection; aMoved = new(ELeave)CMsvEntrySelection; // Entries deleted when a single item is deleted CMsvEntrySelection* deleted = new(ELeave)CMsvEntrySelection; CleanupStack::PushL(deleted); // Entries moved when a single item is deleted CMsvEntrySelection* moved = new(ELeave)CMsvEntrySelection; CleanupStack::PushL(moved); CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection; CleanupStack::PushL(selection); CMsvDelete* del = CMsvDelete::NewL(iServer); CleanupStack::PushL(del); TInt firstError = KErrNone; TInt count = aSelection.Count(); while(count--) { TMsvId id = aSelection.At(count); TInt error = KErrNone; // Only delete children if (!IsAChild(id)) error = KErrNotFound; else { // Need to know maximum number of entries that might be deleted selection->AppendL(id); error = iServer.IndexAdapter().ExpandSelectionRecursively(*selection); if (error == KErrNone) { // Reserve space in lists aDeleted->SetReserveL(aDeleted->Count() + selection->Count()); aMoved->SetReserveL(aMoved->Count() + selection->Count()); del->StartL(id, *deleted, *moved); aSelection.Delete(count); if (deleted->Count() > 0) aDeleted->AppendL(deleted->Back(0), deleted->Count()); if (moved->Count() > 0) aMoved->AppendL(moved->Back(0), moved->Count()); } deleted->Reset(); moved->Reset(); selection->Reset(); } // Remember error if (error != KErrNone && firstError == KErrNone) firstError = error; } User::LeaveIfError(firstError); CleanupStack::PopAndDestroy(4); // del, selection, moved, deleted }
LOCAL_C void doMainL() { Init(); testUtils->FileSession().SetSessionPath(_L("c:\\")); // smtpService = testUtils->CreateSmtpServiceL(); // Create the POP3 service and set the settings for this test. pop3Service = testUtils->CreatePopServiceL(); CImPop3Settings* settings = new(ELeave) CImPop3Settings(); CleanupStack::PushL(settings); settings->Reset(); _LIT(KPopServer, "internet-test.plc.psion.com"); settings->SetServerAddressL(KPopServer); settings->SetLoginNameL(testUtils->MachineName()); settings->SetPasswordL(testUtils->MachineName()); settings->SetPort(110); // Saving POP settings CEmailAccounts* accounts = CEmailAccounts::NewLC(); TPopAccount popAccount; accounts->GetPopAccountL(pop3Service, popAccount); accounts->SavePopSettingsL(popAccount, *settings); CleanupStack::PopAndDestroy(2, settings); // accounts/store, settings // Set the IAP to Demon (even though we're not going to dial up as such.) User::LeaveIfError(testUtils->iServerEntry->SetEntry(pop3Service)); TMsvEntry entry = testUtils->iServerEntry->Entry(); entry.SetMtmData1(3); User::LeaveIfError(testUtils->iServerEntry->ChangeEntry(entry)); test.Printf(_L("\nPerforming Tests\n")); CTestActive* activeObjectTester = new (ELeave) CTestActive; CleanupStack::PushL(activeObjectTester); // Get server MTM. testUtils->InstantiatePopServerMtmL(); CBaseServerMtm* pop3ServerMtm = testUtils->iPopServerMtm; // Get the POP3 server MTM to connect. log->AppendComment(_L8("Connect to POP3 server")); CMsvEntrySelection* serviceId = new (ELeave) CMsvEntrySelection; CleanupStack::PushL(serviceId); serviceId->AppendL(pop3Service); TBuf8<1> parameters; activeObjectTester->StartL(); User::LeaveIfError(testUtils->iServerEntry->SetEntry(pop3Service)); pop3ServerMtm->StartCommandL(*serviceId, KPOP3MTMConnect, parameters, activeObjectTester->iStatus); CActiveScheduler::Start(); // Get the progress TPop3Progress prog; TPckgC<TPop3Progress> paramPack(prog); paramPack.Set(pop3ServerMtm->Progress()); TPop3Progress progress=paramPack(); // Check that the reported progress is EPopConnecting test(progress.iPop3Progress == TPop3Progress::EPopConnecting); CleanupStack::PopAndDestroy(); // serviceId // Cleanup CleanupStack::PopAndDestroy(); // activeObjectTester Closedown(); }