|
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 // LoadPopSettings |
|
17 // [Action Parameters] |
|
18 // accountId input TPOP3Account |
|
19 // configFileIndex input Index of config file |
|
20 // PopSettings output CImPop3Settings |
|
21 // PopIAP output CImIAPPreferences |
|
22 // SMTPSettings output CImSMTPSettings |
|
23 // SmtpIAP output CImIAPPreferences |
|
24 // [Action Description] |
|
25 // LoadPopSettings Test Action is intended to retrieve POP settings from |
|
26 // the central repository for the specified account Id. |
|
27 // [APIs Used] |
|
28 // CEmailAccounts::LoadPopSettingsL |
|
29 // __ACTION_INFO_END__ |
|
30 // |
|
31 // |
|
32 |
|
33 #include <pop3set.h> |
|
34 #include <smtpset.h> |
|
35 |
|
36 #include <cemailaccounts.h> |
|
37 #include <iapprefs.h> |
|
38 |
|
39 |
|
40 #include "CMtfTestActionGetPopAccountSettings.h" |
|
41 #include "CMtfTestCase.h" |
|
42 #include "CMtfTestActionParameters.h" |
|
43 |
|
44 |
|
45 /** |
|
46 Function : NewL |
|
47 Description : |
|
48 @internalTechnology |
|
49 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
50 @param : aActionParams - CMtfTestActionParameters |
|
51 @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionGetPopAccountSettings object |
|
52 @pre none |
|
53 @post none |
|
54 */ |
|
55 CMtfTestAction* CMtfTestActionGetPopAccountSettings::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
56 { |
|
57 CMtfTestActionGetPopAccountSettings* self = new (ELeave) CMtfTestActionGetPopAccountSettings(aTestCase); |
|
58 CleanupStack::PushL(self); |
|
59 self->ConstructL(aActionParameters); |
|
60 CleanupStack::Pop(self); |
|
61 return self; |
|
62 } |
|
63 |
|
64 /** |
|
65 Function : CMtfTestActionGetPopAccountSettings |
|
66 Description : Constructor |
|
67 @internalTechnology |
|
68 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
69 @return : N/A |
|
70 @pre none |
|
71 @post none |
|
72 */ |
|
73 CMtfTestActionGetPopAccountSettings::CMtfTestActionGetPopAccountSettings(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase) |
|
74 { |
|
75 } |
|
76 |
|
77 /** |
|
78 Function : ~CMtfTestActionGetPopAccountSettings |
|
79 Description : Destructor |
|
80 @internalTechnology |
|
81 @param : |
|
82 @return : |
|
83 @pre |
|
84 @post |
|
85 */ |
|
86 CMtfTestActionGetPopAccountSettings::~CMtfTestActionGetPopAccountSettings() |
|
87 { |
|
88 } |
|
89 |
|
90 void CMtfTestActionGetPopAccountSettings::LoadSettingsL(CEmailAccounts& aAccounts, const TPopAccount& aAccount, CImPop3Settings& aPopSettings, CImIAPPreferences& aPopIapSettings, CImSmtpSettings& aSmtpSettings, CImIAPPreferences& aSmtpIapSettings) |
|
91 { |
|
92 aAccounts.LoadPopSettingsL(aAccount, aPopSettings); |
|
93 aAccounts.LoadPopIapSettingsL(aAccount, aPopIapSettings); |
|
94 TSmtpAccount smtpAccount; |
|
95 aAccounts.GetSmtpAccountL(aAccount.iSmtpService, smtpAccount); |
|
96 aAccounts.LoadSmtpSettingsL(smtpAccount, aSmtpSettings); |
|
97 aAccounts.LoadSmtpIapSettingsL(smtpAccount, aSmtpIapSettings); |
|
98 } |
|
99 |
|
100 /** |
|
101 Function : ExecuteActionL |
|
102 Description : Entry point for the this test action in the test framework |
|
103 @internalTechnology |
|
104 @param : none |
|
105 @return : void |
|
106 @pre none |
|
107 @post none |
|
108 */ |
|
109 void CMtfTestActionGetPopAccountSettings::ExecuteActionL() |
|
110 { |
|
111 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionGetPopAccountSettings); |
|
112 TPopAccount accountId = ObtainValueParameterL<TPopAccount>( TestCase(),ActionParameters().Parameter(0) ); |
|
113 CEmailAccounts* accounts = CEmailAccounts::NewLC(); |
|
114 CImIAPPreferences* smtpIapPref =CImIAPPreferences::NewLC(); |
|
115 CImSmtpSettings* smtpSet = new (ELeave) CImSmtpSettings; |
|
116 CleanupStack::PushL(smtpSet); |
|
117 CImIAPPreferences* popIapPref = CImIAPPreferences::NewLC(); |
|
118 CImPop3Settings* popSet = new (ELeave) CImPop3Settings; |
|
119 CleanupStack::PushL(popSet); |
|
120 |
|
121 TRAPD( error, LoadSettingsL(*accounts, accountId, *popSet, *popIapPref, *smtpSet, *smtpIapPref) ); |
|
122 |
|
123 if( error != KErrNone ) |
|
124 { |
|
125 TestCase().INFO_PRINTF2(_L("CMtfTestActionGetPopAccountSettings LoadPOPSettingsL Failed leave with code %d"), error ); |
|
126 TestCase().SetTestStepResult(EFail); |
|
127 } |
|
128 StoreParameterL<CImPop3Settings>(TestCase(), *popSet , ActionParameters().Parameter(1) ); |
|
129 CleanupStack::Pop(popSet); |
|
130 StoreParameterL<CImIAPPreferences>(TestCase(), *popIapPref , ActionParameters().Parameter(2) ); |
|
131 CleanupStack::Pop(popIapPref); |
|
132 StoreParameterL<CImSmtpSettings>(TestCase(), *smtpSet , ActionParameters().Parameter(3) ); |
|
133 CleanupStack::Pop(smtpSet); |
|
134 StoreParameterL<CImIAPPreferences>(TestCase(), *smtpIapPref , ActionParameters().Parameter(4) ); |
|
135 CleanupStack::Pop(smtpIapPref); |
|
136 CleanupStack::PopAndDestroy(accounts); |
|
137 |
|
138 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionGetPopAccountSettings); |
|
139 |
|
140 TestCase().ActionCompletedL(*this); |
|
141 } |
|
142 |
|
143 |