LOCAL_C void ResetSettingsL(TBool aSecureSocket) { _LIT(KSmtpServer, "smtp.demon.co.uk"); _LIT(KSmtpEmailAlias, "SMTP STARTTLS"); _LIT(KSmtpEmailAddress, "<a@b>"); // Overwrite the setings with test code one. Don't want the default settings. CImSmtpSettings* settings = new(ELeave) CImSmtpSettings(); CleanupStack::PushL(settings); CEmailAccounts* accounts = CEmailAccounts::NewLC(); TSmtpAccount smtpAccountId; accounts->GetSmtpAccountL(smtpService,smtpAccountId); accounts->LoadSmtpSettingsL(smtpAccountId, *settings); settings->SetServerAddressL(KSmtpServer); settings->SetEmailAliasL(KSmtpEmailAlias); settings->SetEmailAddressL(KSmtpEmailAddress); settings->SetReplyToAddressL(KSmtpEmailAddress); settings->SetBodyEncoding(EMsgOutboxMIME); settings->SetReceiptAddressL(KSmtpEmailAddress); settings->SetSecureSockets(aSecureSocket); settings->SetPort(25); accounts->SaveSmtpSettingsL(smtpAccountId, *settings); CleanupStack::PopAndDestroy(2, settings); //settings, store/accounts }
/** Function : ExecuteActionL Description : Entry point for the this test action in the test framework @internalTechnology @param : none @return : void @pre none @post none */ void CMtfTestActionGetPopAccountInArray::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionGetPopAccountInArray); TInt indexNumber = ObtainValueParameterL<TInt>(TestCase(), ActionParameters().Parameter(0)); CEmailAccounts* accounts = CEmailAccounts::NewLC(); RArray<TPopAccount> accountArray; CleanupClosePushL(accountArray); accounts->GetPopAccountsL(accountArray); // make sure we're not out of range if (indexNumber >= 0 && indexNumber < accountArray.Count()) { TPopAccount id = accountArray[indexNumber]; StoreParameterL<TPopAccount>( TestCase(), id, ActionParameters().Parameter(1)); } else { TestCase().ERR_PRINTF1(_L("Index is out of range!")); TestCase().SetTestStepResult(EFail); } CleanupStack::PopAndDestroy( 2, accounts ); TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionGetPopAccountInArray); TestCase().ActionCompletedL(*this); }
/** doTestStepL() Reads the POP account name from the ini file. If ALL string is mentioned in the .ini file it deletes all the IMAP accounts, Else deletes the IMAP account whose name is mentioned in the ini file @return Returns the test step result */ TVerdict CT_MsgDeletePopAccount::doTestStepL() { INFO_PRINTF1(_L("Test Step: Delete Pop Account")); TPtrC popAccountName; // Read Pop Account Name from ini file if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName)) { ERR_PRINTF1(_L("Account name not specified")); SetTestStepResult(EFail); } else { CEmailAccounts* account = CEmailAccounts::NewLC(); RArray<TPopAccount> arrayPop3Accounts; CleanupClosePushL(arrayPop3Accounts); account->GetPopAccountsL(arrayPop3Accounts); TInt count=arrayPop3Accounts.Count(); TBuf<12> temp(popAccountName); temp.UpperCase(); // Making case insensitive if(temp.CompareC(_L("ALL")) == 0) { INFO_PRINTF2(_L("Deleting all accounts. Total = %d"), count); for(TInt i=0; i<count; i++) { TPopAccount id = arrayPop3Accounts[i]; account->DeletePopAccountL(id); } } else { TBool deleteFlag = EFalse; for(TInt i = 0; i < count; i++) { if(popAccountName.CompareC(arrayPop3Accounts[i].iPopAccountName) == 0) { account->DeletePopAccountL(arrayPop3Accounts[i]); // Just ensure that if we try to delete it again we hopefuly get an error // or can see that it has been deleted. arrayPop3Accounts.Remove(i); deleteFlag = ETrue; break; } } if(deleteFlag) { INFO_PRINTF2(_L("Pop acount \" %S \" deleted"), &popAccountName); } else { ERR_PRINTF2(_L("Pop acount \" %S \" not found"), &popAccountName); SetTestStepResult(EFail); User::Leave(KErrNotFound); } } CleanupStack::PopAndDestroy(2, account); //arrayPop3Accounts,account } return TestStepResult(); }
/** doTestStepL() Reads the expected count from the ini file. Obtains the count of the POP accounts created and compares against the expected number. @return Returns the test step result. */ TVerdict CT_MsgVerifyPopAccountsCount::doTestStepL() { INFO_PRINTF1(_L("Test Step: Verify Pop Accounts Count")); TInt expectedCount = -1; if(!GetIntFromConfig(ConfigSection(), KExpectedCount, expectedCount) && expectedCount < 0) { ERR_PRINTF1(_L("ExpectedCount is not Specified or < 0")); SetTestStepResult(EFail); } else { CEmailAccounts *account = CEmailAccounts::NewLC(); RArray<TPopAccount> arrayPopAccounts; account->GetPopAccountsL(arrayPopAccounts); TInt count = arrayPopAccounts.Count(); CleanupStack::PopAndDestroy(account); arrayPopAccounts.Reset(); if (count != expectedCount) { ERR_PRINTF3(_L("Number of POP accounts do not match ! expected = %d actual = %d"), expectedCount, count); SetTestStepResult(EFail); } else { INFO_PRINTF2(_L("Number of POP accounts matched value = %d !"), expectedCount); } } return TestStepResult(); }
LOCAL_C void OverwriteSmtpSettingsL(TBool aRequestReceipt) { testUtils->iMsvEntry->SetEntryL(smtpService); //overwrite the setings with test code one. Don't want the default settings. CEmailAccounts* accounts = CEmailAccounts::NewLC(); CImSmtpSettings* settings = new(ELeave) CImSmtpSettings(); CleanupStack::PushL(settings); settings->Reset(); _LIT(KSmtpServer, "msg6"); // globel address for msg6 is fe80::2c0:4fff:fe84:61f7 // link local address fe80::1111:1111:dead:beef settings->SetServerAddressL(KSmtpServer); settings->SetEmailAliasL(_L("SMTP_IPV6 Test")); _LIT(KSmtpEmailAddress, "<kashifn@msg4>"); settings->SetEmailAddressL(KSmtpEmailAddress); settings->SetReplyToAddressL(KSmtpEmailAddress); settings->SetBodyEncoding(EMsgOutboxMIME); settings->SetReceiptAddressL(KSmtpEmailAddress); settings->SetRequestReceipts(aRequestReceipt); settings->SetPort(25); TSmtpAccount smtpAccountId; accounts->GetSmtpAccountL(smtpService, smtpAccountId); accounts->SaveSmtpSettingsL(smtpAccountId, *settings); CleanupStack::PopAndDestroy(2); //settings, store/account CTestTimer* timer = CTestTimer::NewL(); timer->After(5000000); CActiveScheduler::Start(); delete timer; }
void CTestImapSyncManager::ChangeSyncLimitL(TInt limit) { CEmailAccounts* newaccount = CEmailAccounts::NewLC(); iTestUtils->GoClientSideL(); newaccount->GetImapAccountL(iServiceId, iImapAccount); newaccount->LoadImapSettingsL(iImapAccount, *iImapSettings1); iImapSettings1->SetInboxSynchronisationLimit(limit); iImapSettings1->SetMailboxSynchronisationLimit(limit); newaccount->SaveImapSettingsL(iImapAccount, *iImapSettings1); CleanupStack::PopAndDestroy(newaccount); iTestUtils->GoServerSideL(); iTestUtils->InstantiateImapServerMtmL(); iImapServerMtm=(CImap4ServerMtm*)iTestUtils->iImapServerMtm; iEntry = iTestUtils->iServerEntry; // load the new impsettings... iImapSettings = CImapSettings::NewL(*iEntry); iImapSettings->LoadSettingsL(iServiceId); delete iSel; iSel = new (ELeave) CMsvEntrySelection; }
/** Function : doTestStepL Description : Change the IMAP4 Subscribe and Synchronise settings of a test case through the .ini file @return : TVerdict - Test step result */ TVerdict CT_MsgChangeImap4SubAndSyncSettings::doTestStepL() { INFO_PRINTF1(_L("Test Step : ChangeImap4SubAndSyncSettings")); if(ReadIni()) { CEmailAccounts* accounts = CEmailAccounts::NewL(); CleanupStack::PushL(accounts); CImImap4Settings *imapSettings = new (ELeave) CImImap4Settings; CleanupStack::PushL(imapSettings); TImapAccount imapAccountId; CT_MsgUtilsCentralRepository::GetImapAccountL((TDes&)iImapAccountName,imapAccountId); accounts->LoadImapSettingsL(imapAccountId,*imapSettings); TFolderSubscribeType setFolderSubscribeType = CT_MsgUtilsEnumConverter::ConvertDesToTFolderSubscribeType(iImapSubscribeMethod); imapSettings->SetSubscribe(setFolderSubscribeType); TFolderSyncType setFolderSyncType = CT_MsgUtilsEnumConverter::ConvertDesToTFolderSyncType(iImapSynchroniseMethod); imapSettings->SetSynchronise(setFolderSyncType); accounts->SaveImapSettingsL(imapAccountId,*imapSettings); CleanupStack::PopAndDestroy(2,accounts); // imapSettings,accounts } return TestStepResult(); }
/** Function : ExecuteActionL Description : Entry point for the this test action in the test framework @internalTechnology @param : none @return : void @pre none @post none */ void CMtfTestActionCountImapAccountsInArray::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCountImapAccountsInArray); TInt numberToMatch = ObtainValueParameterL<TInt>(TestCase(), ActionParameters().Parameter(0)); CEmailAccounts *account = CEmailAccounts::NewLC(); RArray<TImapAccount> arrayImapAccounts; account->GetImapAccountsL(arrayImapAccounts); TInt count = arrayImapAccounts.Count(); CleanupStack::PopAndDestroy(account); arrayImapAccounts.Reset(); if (count != numberToMatch) { // failed TestCase().ERR_PRINTF3(_L("Number of IMAP accounts do not match ! expected = %d actual = %d"), numberToMatch, count ); TestCase().SetTestStepResult(EFail); } TestCase().INFO_PRINTF2(_L("Number of IMAP accounts matched value = %d !"), numberToMatch ); TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCountImapAccountsInArray); TestCase().ActionCompletedL(*this); }
/** Sets the default SMTP service. @param aService The default service */ EXPORT_C void CSmtpClientMtm::ChangeDefaultServiceL(const TMsvId& aService) { CEmailAccounts* account = CEmailAccounts::NewLC(); TSmtpAccount id; account->GetSmtpAccountL(aService, id); account->SetDefaultSmtpAccountL(id); CleanupStack::PopAndDestroy(account); }
void CMtfTestActionGetPopAccountSettings::LoadSettingsL(CEmailAccounts& aAccounts, const TPopAccount& aAccount, CImPop3Settings& aPopSettings, CImIAPPreferences& aPopIapSettings, CImSmtpSettings& aSmtpSettings, CImIAPPreferences& aSmtpIapSettings) { aAccounts.LoadPopSettingsL(aAccount, aPopSettings); aAccounts.LoadPopIapSettingsL(aAccount, aPopIapSettings); TSmtpAccount smtpAccount; aAccounts.GetSmtpAccountL(aAccount.iSmtpService, smtpAccount); aAccounts.LoadSmtpSettingsL(smtpAccount, aSmtpSettings); aAccounts.LoadSmtpIapSettingsL(smtpAccount, aSmtpIapSettings); }
/** Function : MoveAsyncImap4CommandL Description : This function retrieves the download limits set @param : aCommand The Imap command to be executed. aImapServiceId The Imap service Id aMailSelection The selection object aDownloadLimits The download limts set. @return : none */ void CT_MsgImapMoveAsyncFunction::MoveAsyncImap4CommandL( TImap4Cmds aCommand, CMsvEntrySelection& aMailSelection, TMsvId aImapServiceId , TBool aDownloadLimits, TMsvId afolderId) { // Loads the Imap account settings and saves the download limits CEmailAccounts* emailAccounts = CEmailAccounts::NewLC(); CImImap4Settings* imapSettings = new(ELeave) CImImap4Settings(); CleanupStack::PushL(imapSettings); TImapAccount imapAccount; emailAccounts->GetImapAccountL(aImapServiceId, imapAccount); emailAccounts->LoadImapSettingsL(imapAccount, *imapSettings); // If full download limts are set load it onto the the account CT_MsgActive& active=Active(); if(aDownloadLimits) { TImImap4GetMailInfo imapFullinfo; imapFullinfo.iDestinationFolder = afolderId; imapFullinfo.iGetMailBodyParts = imapSettings->GetMailOptions(); imapFullinfo.iMaxEmailSize = imapSettings->MaxEmailSize(); // Package of the download limits TPckgBuf<TImImap4GetMailInfo> fullPack(imapFullinfo); iSharedDataIMAP.iMtm->SwitchCurrentEntryL(aImapServiceId); // Moves asynchronous IMAP4-specific operation iOperation = iSharedDataIMAP.iMtm->InvokeAsyncFunctionL(aCommand,aMailSelection, fullPack, active.iStatus); } // If partial download limts are set load it onto the the account else { TImImap4GetPartialMailInfo imapPartialinfo; imapPartialinfo.iAttachmentSizeLimit = imapSettings->AttachmentSizeLimit(); imapPartialinfo.iBodyTextSizeLimit = imapSettings->BodyTextSizeLimit(); imapPartialinfo.iDestinationFolder = afolderId; imapPartialinfo.iPartialMailOptions = imapSettings->PartialMailOptions(); imapPartialinfo.iTotalSizeLimit = imapSettings->MaxEmailSize(); // Package of the download limits TPckgBuf<TImImap4GetPartialMailInfo> partialPack(imapPartialinfo); // Switches the cuurent context on to the IMAP service ID iSharedDataIMAP.iMtm->SwitchCurrentEntryL(aImapServiceId); // Moves asynchronous IMAP4-specific operation iOperation = iSharedDataIMAP.iMtm->InvokeAsyncFunctionL(aCommand,aMailSelection, partialPack, active.iStatus); } active.Activate(); CActiveScheduler::Start(); User::LeaveIfError(active.Result()); CleanupStack::PopAndDestroy(2,emailAccounts); // imapSettings,emailAccounts }
void CTestImapSyncManager::SetupL() { TInt err; err=User::LoadPhysicalDevice(PDD_NAME); if (err!=KErrNone && err!=KErrAlreadyExists) User::Leave(err); err=User::LoadLogicalDevice(LDD_NAME); if (err!=KErrNone && err!=KErrAlreadyExists) User::Leave(err); iTestUtils = CEmailTestUtils::NewL(test); iTestUtils->ClearEmailAccountsL( ); iTestUtils->CreateAllTestDirectories( ); iTestUtils->FileSession( ).SetSessionPath( _L( "C:\\" ) ); iActiveWaiter = new(ELeave)CActiveWaiter(); iTestUtils->GoServerSideL(); iTestUtils->DeleteImapServiceL(); iTestUtils->GoClientSideL(); CEmailAccounts* account = CEmailAccounts::NewLC(); iImapSettings1 = new(ELeave) CImImap4Settings(); CImIAPPreferences* imapIAP = CImIAPPreferences::NewLC(); account->PopulateDefaultImapSettingsL(*iImapSettings1, *imapIAP); iImapSettings1->SetServerAddressL(KImapServer); iImapSettings1->SetLoginNameL(iTestUtils->MachineName()); iImapSettings1->SetPasswordL(iTestUtils->MachineName()); iImapSettings1->SetPort(143); iImapSettings1->SetImapIdle(ETrue); iImapSettings1->SetSubscribe(EUpdateRemote); iImapSettings1->SetSynchronise(EUseRemote); iImapSettings1->SetInboxSynchronisationLimit(KSyncLimit); iImapSettings1->SetMailboxSynchronisationLimit(KSyncLimit); _LIT(KTxtAccountName, "testAccount"); iImapAccount = account->CreateImapAccountL(KTxtAccountName, *iImapSettings1, *imapIAP, EFalse); CleanupStack::PopAndDestroy(2, account); // imapIAP, account iTestUtils->GoServerSideL(); iEntry = iTestUtils->iServerEntry; iServiceId = iImapAccount.iImapService; iTestUtils->InstantiateImapServerMtmL(); iImapServerMtm=(CImap4ServerMtm*)iTestUtils->iImapServerMtm; iEntry = iTestUtils->iServerEntry; iImapSettings = CImapSettings::NewL(*iEntry); iImapSettings->LoadSettingsL(iServiceId); iSel = new (ELeave) CMsvEntrySelection; }
/** LoadAccountSettingsL() This function loads the IMAP and SMTP settings object from the IMAP account given @param aEmailAccount An object of type CEmailAccounts @param aAccount An object of type TPopAccount @param aPopSettings An object of type CImPop3Settings @param aPopIapSettings An object of type CImIAPPreferences @param aSmtpSettings An object of type CImSmtpSettings @param aSmtpIapSettings An object of type CImIAPPreferences @return : void */ void CT_MsgComparePopSettings::LoadAccountSettingsL(CEmailAccounts& aEmailAccount, const TPopAccount& aAccount, CImPop3Settings& aPopSettings, CImIAPPreferences& aPopIapSettings,CImSmtpSettings& aSmtpSettings, CImIAPPreferences& aSmtpIapSettings) { aEmailAccount.LoadPopSettingsL(aAccount, aPopSettings); aEmailAccount.LoadPopIapSettingsL(aAccount, aPopIapSettings); TSmtpAccount smtpAccount; aEmailAccount.GetSmtpAccountL(aAccount.iSmtpService, smtpAccount); aEmailAccount.LoadSmtpSettingsL(smtpAccount, aSmtpSettings); aEmailAccount.LoadSmtpIapSettingsL(smtpAccount, aSmtpIapSettings); }
EXPORT_C void CSmtpClientMtm::RestoreSettingsL() /** Loads into the object's cache the service settings from the Central Repository for the current entry. */ { __ASSERT_DEBUG(iMsvEntry->Entry().iType.iUid==KUidMsvServiceEntryValue, gPanic(ESmtcMTMNotAServiceEntry)); CEmailAccounts* account = CEmailAccounts::NewLC(); TSmtpAccount id; account->GetSmtpAccountL(iMsvEntry->Entry().Id(), id); account->LoadSmtpSettingsL(id, *iImSmtpSettings); CleanupStack::PopAndDestroy(account); }
void CTestUTCSort::CreateServiceAndAccountL() { CEmailAccounts* accounts = CEmailAccounts::NewL(); CleanupStack::PushL(accounts); CImSmtpSettings* settings=new(ELeave) CImSmtpSettings(); CleanupStack::PushL(settings); CImIAPPreferences* smtpIAP = CImIAPPreferences::NewLC(); TSmtpAccount smtpAccountId=accounts->CreateSmtpAccountL(_L("SMTP"),*settings, *smtpIAP, EFalse); CleanupStack::PopAndDestroy(smtpIAP); CleanupStack::PopAndDestroy(settings); CleanupStack::PopAndDestroy(accounts); }
// ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- CImImap4Settings* CIpsPlgImap4ConnectOp::GetImapSettingsLC() { FUNC_LOG; CImImap4Settings* settings = new ( ELeave ) CImImap4Settings(); CleanupStack::PushL( settings ); CEmailAccounts* accounts = CEmailAccounts::NewLC(); TImapAccount imapAcc; accounts->GetImapAccountL(iService, imapAcc ); accounts->LoadImapSettingsL( imapAcc, *settings ); CleanupStack::PopAndDestroy( accounts ); return settings; }
// ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- void CIpsSosAOImapAgent::LoadSettingsL( ) { FUNC_LOG; delete iImapSettings; iImapSettings = NULL; iImapSettings = new ( ELeave ) CImImap4Settings(); CEmailAccounts* accounts = CEmailAccounts::NewLC(); TImapAccount imapAcc; accounts->GetImapAccountL(iServiceId, imapAcc ); accounts->LoadImapSettingsL( imapAcc, *iImapSettings ); CleanupStack::PopAndDestroy( accounts ); }
/** Function : doTestStepL Description : Checks the provisioned SNAP information for the POP account settings of a test case. @return : TVerdict - Test step result */ TVerdict CT_MsgCheckPopSNAPSetting::doTestStepL() { INFO_PRINTF1(_L("Test Step : CheckPopSNAPSetting")); if(ReadIni()) { CEmailAccounts* accounts = CEmailAccounts::NewL(); CleanupStack::PushL(accounts); CImIAPPreferences* popIapPrefs = CImIAPPreferences::NewLC(); TPopAccount popAccountId; CT_MsgUtilsCentralRepository::GetPopAccountL((TDes&)iPopAccountName,popAccountId); accounts->LoadPopIapSettingsL(popAccountId, *popIapPrefs); TBool actualSNAPDefintion = popIapPrefs->SNAPDefined(); if (actualSNAPDefintion == iExpectedSNAPDefinition) { if (actualSNAPDefintion) { TInt expectedSNAPPreference = 0; if(!GetIntFromConfig(ConfigSection(), KSNAPPreference, expectedSNAPPreference)) { ERR_PRINTF1(_L("An expected SNAP ID value is not specified")); SetTestStepResult(EFail); CleanupStack::PopAndDestroy(2,accounts); // popIapPrefs, accounts return TestStepResult(); } TInt actualSNAPPreference = popIapPrefs->SNAPPreference(); if (actualSNAPPreference != expectedSNAPPreference) { ERR_PRINTF3(_L("Actual SNAP ID [%d] does not equal Expected SNAP ID [%d]"),actualSNAPPreference,expectedSNAPPreference); SetTestStepResult(EFail); } else { INFO_PRINTF3(_L("Actual SNAP ID [%d] equals Expected SNAP ID [%d]"),actualSNAPPreference,expectedSNAPPreference); } } } else { ERR_PRINTF3(_L("Actual SNAP Defintion [%d] does not equal Expected SNAP Defintion [%d]"),actualSNAPDefintion,iExpectedSNAPDefinition); SetTestStepResult(EFail); } CleanupStack::PopAndDestroy(2,accounts); // popIapPrefs, accounts } return TestStepResult(); }
/** Gets the default SMTP service. @return The default service @leave KErrNotFound If default service setting does not exist. */ EXPORT_C TMsvId CSmtpClientMtm::DefaultServiceL() const { // Get default service Id from CenRep CEmailAccounts* account = CEmailAccounts::NewLC(); TSmtpAccount id; TInt error = account->DefaultSmtpAccountL(id); if (error == KErrNotFound) { User::Leave(error); } CleanupStack::PopAndDestroy(account); return id.iSmtpService; }
EXPORT_C void CSmtpClientMtm::CreateMessageL(TMsvId aServiceId) /** Creates a new message entry as a child of the current context. @param aServiceId ID of the service to own the entry. */ { // fix for DEF051564 - SMTP client MTM CreateMessageL not creating message in correct state TMsvEmailTypeList emailTypeList = KMsvEmailTypeListInvisibleMessage | KMsvEmailTypeListMessageInPreparation; CEmailAccounts* account = CEmailAccounts::NewLC(); CImSmtpSettings* smtpSettings = new (ELeave) CImSmtpSettings; CleanupStack::PushL(smtpSettings); TSmtpAccount id; account->GetSmtpAccountL(aServiceId, id); account->LoadSmtpSettingsL(id, *smtpSettings); switch (smtpSettings->BodyEncoding()) { case EMsgOutboxMHTMLAsMIME: case EMsgOutboxMHTMLAlternativeAsMIME: emailTypeList |= KMsvEmailTypeListMHTMLMessage; break; case EMsgOutboxDefault: case EMsgOutboxNoAlgorithm: case EMsgOutboxMIME: break; } CleanupStack::PopAndDestroy(2, account); // smtpSettings, account // Now invoke the create new mail operation. // Note that it is wrapped up to make the asynchronous call synchronous. CMsvOperationActiveSchedulerWait* waiter=CMsvOperationActiveSchedulerWait::NewLC(); CImEmailOperation* createNewMailOp = CImEmailOperation::CreateNewL(waiter->iStatus, iMsvEntry->Session(), iMsvEntry->Entry().Id(), aServiceId, KMsvMessagePartBody|KMsvMessagePartAttachments, emailTypeList, KUidMsgTypeSMTP); CleanupStack::PushL(createNewMailOp); waiter->Start(); // The the entry is expected to be set to the new message. TMsvId temp; TPckgC<TMsvId> paramPack(temp); const TDesC8& progBuf = createNewMailOp->ProgressL(); paramPack.Set(progBuf); TMsvId messageId = paramPack(); iMsvEntry->SetEntryL(messageId); CMsvStore* store = iMsvEntry->ReadStoreL(); CleanupStack::PushL(store); iHeader->RestoreL(*store); CleanupStack::PopAndDestroy(3, waiter); // waiter, createNewMailOp, store }
void CPerformance426Client::ConstructL() { //open the imap account that the test step has created CEmailAccounts* emailAccounts; emailAccounts = CEmailAccounts::NewLC(); RArray<TImapAccount> imapAccounts; CleanupClosePushL(imapAccounts); emailAccounts->GetImapAccountsL(imapAccounts); iImapAccount=imapAccounts[0]; //open the smtp account too RArray<TSmtpAccount> smtpAccounts; CleanupClosePushL(smtpAccounts); emailAccounts->GetSmtpAccountsL(smtpAccounts); iSmtpAccount=smtpAccounts[0]; CleanupStack::PopAndDestroy(3,emailAccounts); // Session observer. Needed to create a session iSessionObserver = new (ELeave) TDummySessionObserver; // Session. Needed to create a client registry. iSession=CMsvSession::OpenSyncL(*iSessionObserver); // Client registry. Needed to get the MTM component iClientRegistry=CClientMtmRegistry::NewL(*iSession,KMsvDefaultTimeoutMicroSeconds32); //get the client mtm iClientMtm=iClientRegistry->NewMtmL(KUidMsgTypeIMAP4); // Load the serial comms device drivers. If this is not done, // connecting via NT-RAS returns KErrNotFound (-1). TInt driverErr; driverErr=User::LoadPhysicalDevice(PDD_NAME); if (driverErr!=KErrNone && driverErr!=KErrAlreadyExists) { User::Leave(driverErr); } driverErr=User::LoadLogicalDevice(LDD_NAME); if (driverErr!=KErrNone && driverErr!=KErrAlreadyExists) { User::Leave(driverErr); } //initialise package object TImImap4GetMailInfo imap4GetMailInfo; imap4GetMailInfo.iMaxEmailSize = KMaxTInt; imap4GetMailInfo.iDestinationFolder = KMsvGlobalInBoxIndexEntryIdValue; imap4GetMailInfo.iGetMailBodyParts = EGetImap4EmailBodyTextAndAttachments; iPackage=imap4GetMailInfo; }
LOCAL_C void SetAddVCardToEmailL(TBool addVCard, TMsvId serviceId) { CImSmtpSettings* smtpSettings = new (ELeave) CImSmtpSettings; CleanupStack::PushL(smtpSettings); CEmailAccounts* accounts = CEmailAccounts::NewLC(); TSmtpAccount smtpAccount; accounts->GetSmtpAccountL(serviceId, smtpAccount); accounts->LoadSmtpSettingsL(smtpAccount, *smtpSettings); smtpSettings->SetAddVCardToEmail(addVCard); accounts->SaveSmtpSettingsL(smtpAccount, *smtpSettings); CleanupStack::PopAndDestroy(2); // smtpSettings, accounts }
LOCAL_C void SetDefaultServiceL(TMsvId smtpService) { CEmailAccounts* accounts = CEmailAccounts::NewLC(); TSmtpAccount smtpAccount; accounts->GetSmtpAccountL(smtpService, smtpAccount); accounts->SetDefaultSmtpAccountL(smtpAccount); // is default service ?? TSmtpAccount defaultAccount; accounts->DefaultSmtpAccountL(defaultAccount); if (smtpService != defaultAccount.iSmtpService) { User::Leave(KErrNotFound); } CleanupStack::PopAndDestroy(accounts); }
/** ExecuteActionL Sets the values for TImImap4GetMailInfo memeber variables and then store it as an output parameter of the Test Action. @internalTechnology @pre None @post None @leave System wide errors */ void CMtfTestActionSetImap4FullDownloadLimits::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSetImap4FullDownloadLimits); // Obtain Test Action input parameters TInt paramTotalSizeLimit = ObtainValueParameterL<TInt>(TestCase(), ActionParameters().Parameter(0),KMaxTInt); TImap4GetMailOptions paramMailOptions = ObtainValueParameterL<TImap4GetMailOptions> (TestCase(),ActionParameters().Parameter(1), EGetImap4EmailHeaders); TMsvId paramDestinationFolder = ObtainValueParameterL<TMsvId> (TestCase(),ActionParameters().Parameter(2)); TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(3)); // Store the full donwload limits values TImImap4GetMailInfo imap4GetMailInfo; imap4GetMailInfo.iMaxEmailSize = paramTotalSizeLimit; imap4GetMailInfo.iGetMailBodyParts = paramMailOptions; imap4GetMailInfo.iDestinationFolder = paramDestinationFolder; // Load the Imap account settings and save the download limits CEmailAccounts* emailAccounts = CEmailAccounts::NewLC(); CImImap4Settings* imapSettings = new(ELeave) CImImap4Settings(); CleanupStack::PushL(imapSettings); TImapAccount imapAccount; emailAccounts->GetImapAccountL(paramServiceId, imapAccount); emailAccounts->LoadImapSettingsL(imapAccount, *imapSettings); imapSettings->SetMaxEmailSize( imap4GetMailInfo.iMaxEmailSize ); imapSettings->SetGetMailOptions( imap4GetMailInfo.iGetMailBodyParts ); emailAccounts->SaveImapSettingsL(imapAccount, *imapSettings); CleanupStack::PopAndDestroy( 2, emailAccounts ); // imapSettings, emailSettings // Store the full download limits as the ouput parameter of the Test Action StoreParameterL<TImImap4GetMailInfo>(TestCase(),imap4GetMailInfo, ActionParameters().Parameter(4)); TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSetImap4FullDownloadLimits ); TestCase().ActionCompletedL(*this); }
LOCAL_C void doMainL() { InitL(); test.Printf(_L("\nPerforming Tests\n")); testUtils->iMsvEntry->SetEntryL(smtpService); CTestTimer* timer = CTestTimer::NewL(); timer->After(5000000); CActiveScheduler::Start(); delete timer; // store service as default service CEmailAccounts* accounts = CEmailAccounts::NewLC(); TSmtpAccount smtpAccountId; accounts->GetSmtpAccountL(smtpService, smtpAccountId); accounts->SetDefaultSmtpAccountL(smtpAccountId); CleanupStack::PopAndDestroy(accounts); OverwriteSmtpSettingsL(EFalse); CreateMessageL(); // Create a message that will request a receipt OverwriteSmtpSettingsL(ETrue); CreateMessageL(); testUtils->InstantiateSmtpClientMtmL(); timer = CTestTimer::NewL(); timer->After(5000000); CActiveScheduler::Start(); delete timer; testUtils->TestStart(testNo++); TestSendingMessagesL(); testUtils->TestFinish(testNo-1); testUtils->TestStart(testNo++); TestCapabilityL(); testUtils->TestFinish(testNo-1); testUtils->TestHarnessCompleted(); Closedown(); }
void CMtfTestActionDeleteImapAccounts::ExecuteActionL() { TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionDeleteImapAccounts); TInt paramDefaultIndex = ObtainValueParameterL<TInt>( TestCase(),ActionParameters().Parameter(0) ,-1 ); CEmailAccounts* account = CEmailAccounts::NewLC(); RArray<TImapAccount> arrayImap4Accounts; CleanupClosePushL(arrayImap4Accounts); account->GetImapAccountsL(arrayImap4Accounts); if ( paramDefaultIndex >= 0 ) { // Delete the specified id. account->DeleteImapAccountL(arrayImap4Accounts[paramDefaultIndex]); // Just ensure that if we try to delete it again we hopefuly get an error // or can see that it has been deleted. arrayImap4Accounts.Remove(paramDefaultIndex); } else if (paramDefaultIndex == -1 ) { // Assume delete all the indexs TInt count=arrayImap4Accounts.Count(); TestCase().INFO_PRINTF2(_L("CMtfTestActionDeletePopAccounts deleting all accounts count = %d"), count ); for(TInt i=0; i<count; i++) { TImapAccount id = arrayImap4Accounts[i]; account->DeleteImapAccountL(id); } } else { // Bad value. TestCase().ERR_PRINTF1(_L("DeleteImapAccounts : Index value must be -1 or greater than 0\n")); TestCase().SetTestStepResult(EFail); } CleanupStack::PopAndDestroy(2, account); TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionDeleteImapAccounts); TestCase().ActionCompletedL(*this); }
LOCAL_C void SetSignatureToEmailL(TBool addSignature, TMsvId serviceId) { CImSmtpSettings* smtpSettings = new (ELeave) CImSmtpSettings; CleanupStack::PushL(smtpSettings); CEmailAccounts* accounts = CEmailAccounts::NewLC(); TSmtpAccount smtpAccount; accounts->GetSmtpAccountL(serviceId, smtpAccount); accounts->LoadSmtpSettingsL(smtpAccount, *smtpSettings); smtpSettings->SetAddSignatureToEmail(addSignature); accounts->SaveSmtpSettingsL(smtpAccount, *smtpSettings); CleanupStack::PopAndDestroy(2); // smtpSettings, accounts if (addSignature) testUtils->WriteComment(_L("\tAdd VCard")); }
// ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- TInt CIpsPlgPop3ConnectOp::GetPopulateLimitFromSettingsL() { FUNC_LOG; TInt limit( KDefaultPopulateLimit ); CImPop3Settings* settings = new(ELeave) CImPop3Settings(); CleanupStack::PushL( settings ); TPopAccount popAccountId; CEmailAccounts* accounts = CEmailAccounts::NewLC(); accounts->GetPopAccountL( iService , popAccountId ); accounts->LoadPopSettingsL( popAccountId, *settings ); limit = settings->PopulationLimit(); if ( limit > 0 ) { // basically doing a _very_rough_ conversion from kilobyte value to number-of-rows limit = ( limit * KPopulateAlgorithmBytesInKilo ) / KPopulateAlgorithmRowLength; } CleanupStack::PopAndDestroy( 2, settings ); return limit; }
LOCAL_C void CreateNewSmtpSettingsL() { testUtils->iMsvEntry->SetEntryL(smtpService); TMsvId serviceId = smtpService; //overwrite the settings with test code one. Don't want the default settings. CImSmtpSettings* settings = new(ELeave) CImSmtpSettings(); CleanupStack::PushL(settings); CEmailAccounts* accounts = CEmailAccounts::NewLC(); TSmtpAccount smtpAccountId; accounts->GetSmtpAccountL( serviceId, smtpAccountId); accounts->LoadSmtpSettingsL(smtpAccountId, *settings); TInt serverLength = testUtils->MachineName().Length(); HBufC* serverad = HBufC::NewL(serverLength + 7 ); // 7 is the length of KServerAddress CleanupStack::PushL(serverad); serverad->Des().Copy(testUtils->MachineName()); serverad->Des().Append(KServer); settings->SetServerAddressL(*serverad); HBufC* emailaddress = HBufC::NewL(serverLength + 8 + serverad->Des().Length() + 1 ); CleanupStack::PushL(emailaddress); emailaddress->Des().Copy(testUtils->MachineName()); emailaddress->Des().Append(KAt); emailaddress->Des().Append(*serverad); settings->SetEmailAddressL(*emailaddress); settings->SetReplyToAddressL(*emailaddress); settings->SetReceiptAddressL(*emailaddress); settings->SetEmailAliasL(_L("Test Account")); settings->SetBodyEncoding(EMsgOutboxMIME); settings->SetRequestReceipts(EFalse); settings->SetPort(25); TSmtpAccount smtpAccount; accounts->GetSmtpAccountL(smtpService, smtpAccount); accounts->SaveSmtpSettingsL(smtpAccount, *settings); CleanupStack::PopAndDestroy(emailaddress); CleanupStack::PopAndDestroy(serverad); CleanupStack::PopAndDestroy(2,settings); testUtils->WriteComment(_L("Created New SmtpSettings ")); }
/** Function : doTestStepL Description : Removes the provisioned SNAP information from the SMTP account settings of a test case. @return : TVerdict - Test step result */ TVerdict CT_MsgRemoveSmtpSNAPSetting::doTestStepL() { INFO_PRINTF1(_L("Test Step : RemoveSmtpSNAPSetting")); if(ReadIni()) { CEmailAccounts* accounts = CEmailAccounts::NewL(); CleanupStack::PushL(accounts); CImIAPPreferences* smtpIapPrefs = CImIAPPreferences::NewLC(); TSmtpAccount smtpAccountId; CT_MsgUtilsCentralRepository::GetSmtpAccountL((TDes&)iSmtpAccountName, smtpAccountId); accounts->LoadSmtpIapSettingsL(smtpAccountId, *smtpIapPrefs); smtpIapPrefs->RemoveSNAP(); accounts->SaveSmtpIapSettingsL(smtpAccountId, *smtpIapPrefs); CleanupStack::PopAndDestroy(2,accounts); // smtpIapPrefs, accounts } return TestStepResult(); }