messagingfw/msgtestfw/TestActions/Email/Imap4/src/CMtfTestActionPopulateDefaultImapSettings.cpp
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // __ACTION_INFO_BEGIN__ 
       
    15 // [Action Name]
       
    16 // PopulatedefaultImapSettings
       
    17 // [Action Parameters]
       
    18 // accounted			input			TIMAP4Account
       
    19 // ImapSettings			output			CImImap4Settings
       
    20 // ImapIAP				output			CImIAPPreferences
       
    21 // SMTPSettings			output			CImSMTPSettings
       
    22 // SmtpIAP				output			CImIAPPreferences
       
    23 // [Action Description]
       
    24 // PopulateDefaultImapSettings Test Action is intended to fill the setting 
       
    25 // objects with default values from account 0.
       
    26 // [APIs Used]	
       
    27 // CEmailAccounts::PopulateDefaultImapSettingsL
       
    28 // __ACTION_INFO_END__
       
    29 // 
       
    30 //
       
    31 
       
    32 
       
    33 
       
    34 
       
    35 
       
    36 #include <imapset.h>
       
    37 #include <smtpset.h>
       
    38 #include <iapprefs.h>
       
    39 
       
    40 
       
    41 
       
    42 #include "CMtfTestCase.h"
       
    43 
       
    44 #include <cemailaccounts.h>
       
    45 
       
    46 #include "CMtfTestActionParameters.h"
       
    47 #include "CMtfTestActionPopulateDefaultImapSettings.h"
       
    48 #include "CMtfTestActionUtilsImapScripts.h"
       
    49 
       
    50 
       
    51 
       
    52 
       
    53 /**
       
    54   Function : NewL
       
    55   Description : 
       
    56   @internalTechnology
       
    57   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    58   @param : aActionParams - CMtfTestActionParameters 
       
    59   @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionPopulateDefaultImapSettings object
       
    60   @pre none
       
    61   @post none
       
    62 */
       
    63 CMtfTestAction* CMtfTestActionPopulateDefaultImapSettings::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    64 	{
       
    65 	CMtfTestActionPopulateDefaultImapSettings* self = new (ELeave) CMtfTestActionPopulateDefaultImapSettings(aTestCase);
       
    66 	CleanupStack::PushL(self);
       
    67 	self->ConstructL(aActionParameters);
       
    68 	CleanupStack::Pop(self);
       
    69 	return self;
       
    70 	}
       
    71 
       
    72 /**
       
    73   Function : CMtfTestActionPopulateDefaultImapSettings
       
    74   Description : Constructor
       
    75   @internalTechnology
       
    76   @param : aTestCase - CMtfTestCase for the CMtfTestAction base class
       
    77   @return : N/A
       
    78   @pre none
       
    79   @post none
       
    80 */
       
    81 CMtfTestActionPopulateDefaultImapSettings::CMtfTestActionPopulateDefaultImapSettings(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase)
       
    82 	{
       
    83 	}
       
    84 	
       
    85 /**
       
    86   Function : ~CMtfTestActionPopulateDefaultImapSettings
       
    87   Description : Destructor
       
    88   @internalTechnology
       
    89   @param :
       
    90   @return : 
       
    91   @pre 
       
    92   @post 
       
    93 */
       
    94 CMtfTestActionPopulateDefaultImapSettings::~CMtfTestActionPopulateDefaultImapSettings()
       
    95 	{
       
    96 	}
       
    97 	
       
    98 /**
       
    99   Function : ExecuteActionL
       
   100   Description : Entry point for the this test action in the test framework
       
   101   @internalTechnology
       
   102   @param : none
       
   103   @return : void
       
   104   @pre none 
       
   105   @post none
       
   106 */
       
   107 void CMtfTestActionPopulateDefaultImapSettings::ExecuteActionL()
       
   108 	{
       
   109 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionPopulateDefaultImapSettings);
       
   110 	CEmailAccounts* emailAccounts=CEmailAccounts::NewLC();
       
   111 			
       
   112 	CImImap4Settings* imapSet =  new (ELeave) CImImap4Settings;
       
   113 	CleanupStack::PushL(imapSet);
       
   114 	
       
   115 	CImIAPPreferences* imapIapPref = CImIAPPreferences::NewLC();
       
   116 	
       
   117 	CImSmtpSettings* smtpSet =  new (ELeave) CImSmtpSettings;
       
   118 	CleanupStack::PushL(smtpSet);
       
   119 
       
   120 	CImIAPPreferences* smtpIapPref	=  CImIAPPreferences::NewLC();
       
   121 	
       
   122 	emailAccounts->PopulateDefaultImapSettingsL(*imapSet, *imapIapPref);
       
   123 	emailAccounts->PopulateDefaultSmtpSettingsL(*smtpSet, *smtpIapPref);
       
   124 	
       
   125 	StoreParameterL<CImIAPPreferences>(TestCase(), *smtpIapPref , ActionParameters().Parameter(3) );
       
   126 	CleanupStack::Pop(smtpIapPref);
       
   127 	
       
   128 	StoreParameterL<CImSmtpSettings>(TestCase(), *smtpSet , ActionParameters().Parameter(2) );
       
   129 	CleanupStack::Pop(smtpSet);
       
   130 	
       
   131 	StoreParameterL<CImIAPPreferences>(TestCase(), *imapIapPref , ActionParameters().Parameter(1) );
       
   132 	CleanupStack::Pop(imapIapPref);
       
   133 	
       
   134 	StoreParameterL<CImImap4Settings>(TestCase(), *imapSet , ActionParameters().Parameter(0) );
       
   135 	CleanupStack::Pop(imapSet);	
       
   136 
       
   137 	CleanupStack::PopAndDestroy(emailAccounts);
       
   138 	
       
   139 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionPopulateDefaultImapSettings);
       
   140 	TestCase().ActionCompletedL(*this);
       
   141 	
       
   142 	}
       
   143 
       
   144