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);
	}
/**
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);
	}
/**
  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();
	}
Пример #4
0
/**
  Function : doTestStepL
  Description : Reads the Pop account name and config file name from the .ini file
				 and it then modifies the account with the settings read from the config file.
  @return : TVerdict - Test step result
  @leave  : KMsvNullIndexEntryId	Invalid POP account name specified	
*/
TVerdict CT_MsgModifyPopSettings2::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Step: ModifyPopSettings2"));
	// Read the POP account name from the ini file
	TPtrC popAccountName;
	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
		{
		ERR_PRINTF1(_L("POP account name is not specified"));
		SetTestStepResult(EFail);
		}
	else
		{
		// Read the POP Config file name from the ini file
		TPtrC configFileName;
		if(!GetStringFromConfig(ConfigSection(), KPopConfigFileName, configFileName))
			{
			ERR_PRINTF1(_L("Configuration file path 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);
			
			if(popServiceId == KMsvNullIndexEntryId)
				{
				ERR_PRINTF1(_L("Invalid POP account name specified"));
				SetTestStepResult(EFail);
				}
			// Creates the settings object
			else
				{
				CEmailAccounts* emailAccounts = CEmailAccounts::NewLC();

				CImPop3Settings* popSettings = new(ELeave) CImPop3Settings();
				CleanupStack::PushL(popSettings);
				
				CImIAPPreferences* popIapPrefs = CImIAPPreferences::NewLC();

				// Loads the settings for the account with the current settings
				TPopAccount popAccount;
				emailAccounts->GetPopAccountL(popServiceId, popAccount);
				emailAccounts->LoadPopSettingsL(popAccount, *popSettings);
				emailAccounts->LoadPopIapSettingsL(popAccount, *popIapPrefs);

				// Reads the settings from the config file
				TRAPD(err, CT_MsgUtilsReadEmailSettingsFromConfigFile::ReadPopSettingsFromConfigurationFileL(configFileName, *popSettings, *popIapPrefs));
				if(err)
					{	
					ERR_PRINTF2(_L("Failure while setting the POP setting parameters, failed with error %d"), err);
					SetTestStepError(err);															  
					}
				else
					{
					// Saves the new settings
					emailAccounts->SavePopSettingsL(popAccount, *popSettings);
					emailAccounts->SavePopIapSettingsL(popAccount, *popIapPrefs);
					}
				CleanupStack::PopAndDestroy(3, emailAccounts);// popIapPrefs,popSettings,emailAccounts
				}
			}
		}
	return TestStepResult();
	}
Пример #5
0
/**
doTestStepL()
Populate the default POP and SMTP settings, Load the settings of the account 
created with the default settings, and compares the settings objects.
The test passes if all the settings objects match else it fails.

@return
Returns the test step result
*/
TVerdict CT_MsgVerifyPopSettings::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Step: VerifyPopSettings"));
	// Read the Pop account name from the ini file
	TPtrC popAccountName;
	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
		{
		ERR_PRINTF1(_L("PopAccount 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);
		
		if(popServiceId == KMsvNullIndexEntryId)
			{
			ERR_PRINTF1(_L("Invalid POP account name specified"));
			SetTestStepResult(EFail);
			}
		else
			{
			CEmailAccounts* emailAccounts = CEmailAccounts::NewLC();
	
			CImPop3Settings* popSettings1 = new(ELeave) CImPop3Settings();
			CleanupStack::PushL(popSettings1);
			
			CImIAPPreferences* popIapPrefs1 = CImIAPPreferences::NewLC();
			
			CImSmtpSettings* smtpSettings1 = new(ELeave) CImSmtpSettings();
			CleanupStack::PushL(smtpSettings1);

			CImIAPPreferences* smtpIapPrefs1 = CImIAPPreferences::NewLC();

			emailAccounts->PopulateDefaultPopSettingsL(*popSettings1, *popIapPrefs1);
			emailAccounts->PopulateDefaultSmtpSettingsL(*smtpSettings1, *smtpIapPrefs1);

			
	
			CImPop3Settings* popSettings2 = new(ELeave) CImPop3Settings();
			CleanupStack::PushL(popSettings2);
			
			CImIAPPreferences* popIapPrefs2 = CImIAPPreferences::NewLC();
			
			CImSmtpSettings* smtpSettings2 = new(ELeave) CImSmtpSettings();
			CleanupStack::PushL(smtpSettings2);

			CImIAPPreferences* smtpIapPrefs2 = CImIAPPreferences::NewLC();

			TPopAccount popAccount;
			emailAccounts->GetPopAccountL(popServiceId, popAccount);
			emailAccounts->LoadPopSettingsL(popAccount, *popSettings2);
			emailAccounts->LoadPopIapSettingsL(popAccount, *popIapPrefs2);
			
			TSmtpAccount smtpAccount;
			emailAccounts->GetSmtpAccountL(popAccount.iSmtpService, smtpAccount);
			emailAccounts->LoadSmtpSettingsL(smtpAccount, *smtpSettings2);
			emailAccounts->LoadSmtpIapSettingsL(smtpAccount, *smtpIapPrefs2);

			TVerdict result = EPass;
			if (!(*popSettings1 == *popSettings2))   
				{
				// failed
				ERR_PRINTF1(_L("Pop3 Settings objects do not match !"));
				result = EFail;
				}
			else if (!(*smtpSettings1 == *smtpSettings2))
				{
				// failed
				ERR_PRINTF1(_L("SMTP Settings objects do not match !"));
				result = EFail;
				}
			else if (!CT_MsgUtilsReadEmailSettingsFromConfigFile::CompareIapPrefs(*popIapPrefs1, *popIapPrefs2))
				{
				// failed
				ERR_PRINTF1(_L("Pop3 IAP Preference objects do not match !"));
				result = EFail;
				}
			else if (!CT_MsgUtilsReadEmailSettingsFromConfigFile::CompareIapPrefs(*smtpIapPrefs1, *smtpIapPrefs2))
				{
				// failed
				ERR_PRINTF1(_L("SMTP IAP Preference objects do not match !"));
				result = EFail;
				}
			SetTestStepResult(result);
			CleanupStack::PopAndDestroy(9,emailAccounts);
			}
		}
	return TestStepResult();
	}