|
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 // CompareImapSettings |
|
17 // [Action Parameters] |
|
18 // Input Input Type |
|
19 // ImapSettings1 input CImImap4Settings |
|
20 // ImapIAP1 input CImIAPPreferences |
|
21 // SMTPSettings1 input CImSMTPSettings |
|
22 // SmtpIAP1 input CImIAPPreferences |
|
23 // ImapSettings2 input CImImap4Settings |
|
24 // ImapIAP2 input CImIAPPreferences |
|
25 // SMTPSettings2 input CImSMTPSettings |
|
26 // SmtpIAP2 input CImIAPPreferences |
|
27 // [Action Description] |
|
28 // CompareImapSettings Test Action is intended to compare the IMAP account settings. |
|
29 // [APIs Used] |
|
30 // CImImap4Settings::ServerAddress |
|
31 // CImImap4Settings::UserAddress |
|
32 // CImImap4Settings::LoginName |
|
33 // CImImap4Settings::Password |
|
34 // CImImap4Settings::Port |
|
35 // CImImap4Settings::SecureSockets |
|
36 // CImImap4Settings::Version |
|
37 // CImImap4Settings::FolderPath |
|
38 // CImImap4Settings::PathSeparator |
|
39 // CImImap4Settings::MaxEmailSize |
|
40 // CImImap4Settings::GetMailOptions |
|
41 // CImImap4Settings::InboxSynchronisationLimit |
|
42 // CImImap4Settings::MailboxSynchronisationLimit |
|
43 // CImSmtpSettings::ServerAddress |
|
44 // CImSmtpSettings::EmailAddress |
|
45 // CImSmtpSettings::Version |
|
46 // CImSmtpSettings::UserAddress |
|
47 // CImSmtpSettings::Port |
|
48 // CImSmtpSettings::BodyEncoding |
|
49 // CImSmtpSettings::DefaultMsgCharSet |
|
50 // CImSmtpSettings::ReceiptAddress |
|
51 // CImIAPPreferences::Version |
|
52 // __ACTION_INFO_END__ |
|
53 // |
|
54 // |
|
55 |
|
56 |
|
57 #include "CMtfTestActionCompareImapSettings.h" |
|
58 |
|
59 |
|
60 #include <imapset.h> |
|
61 #include <smtpset.h> |
|
62 #include <iapprefs.h> |
|
63 |
|
64 #include "CMtfTestCase.h" |
|
65 #include "CMtfTestActionParameters.h" |
|
66 |
|
67 #include "CMtfTestActionUtilsImapScripts.h" |
|
68 |
|
69 |
|
70 /** |
|
71 Function : NewL |
|
72 Description : |
|
73 @internalTechnology |
|
74 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
75 @param : aActionParams - CMtfTestActionParameters |
|
76 @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestAction<> object |
|
77 @pre none |
|
78 @post none |
|
79 */ |
|
80 CMtfTestAction* CMtfTestActionCompareImapSettings::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
81 { |
|
82 CMtfTestActionCompareImapSettings* self = new (ELeave) CMtfTestActionCompareImapSettings(aTestCase); |
|
83 CleanupStack::PushL(self); |
|
84 self->ConstructL(aActionParameters); |
|
85 CleanupStack::Pop(self); |
|
86 return self; |
|
87 } |
|
88 |
|
89 /** |
|
90 Function : CMtfTestAction<> |
|
91 Description : Constructor |
|
92 @internalTechnology |
|
93 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
94 @return : N/A |
|
95 @pre none |
|
96 @post none |
|
97 */ |
|
98 CMtfTestActionCompareImapSettings::CMtfTestActionCompareImapSettings(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase) |
|
99 { |
|
100 } |
|
101 |
|
102 /** |
|
103 Function : ~CMtfTestAction<> |
|
104 Description : Destructor |
|
105 @internalTechnology |
|
106 @param : |
|
107 @return : |
|
108 @pre |
|
109 @post |
|
110 */ |
|
111 CMtfTestActionCompareImapSettings::~CMtfTestActionCompareImapSettings() |
|
112 { |
|
113 } |
|
114 |
|
115 /** |
|
116 Function : ExecuteActionL |
|
117 Description : Entry point for the this test action in the test framework |
|
118 @internalTechnology |
|
119 @param : none |
|
120 @return : void |
|
121 @pre none |
|
122 @post none |
|
123 */ |
|
124 void CMtfTestActionCompareImapSettings::ExecuteActionL() |
|
125 { |
|
126 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCompareImapSettings); |
|
127 CImImap4Settings* imap4Settings1 = ObtainParameterReferenceL<CImImap4Settings>(TestCase(), ActionParameters().Parameter(0)); |
|
128 CImImap4Settings* imap4Settings2 = ObtainParameterReferenceL<CImImap4Settings>(TestCase(), ActionParameters().Parameter(1)); |
|
129 CImIAPPreferences* imap4Prefs1 = ObtainParameterReferenceL<CImIAPPreferences>(TestCase(), ActionParameters().Parameter(2)); |
|
130 CImIAPPreferences* imap4Prefs2 = ObtainParameterReferenceL<CImIAPPreferences>(TestCase(), ActionParameters().Parameter(3)); |
|
131 CImSmtpSettings* smtpSettings1 = ObtainParameterReferenceL<CImSmtpSettings>(TestCase(), ActionParameters().Parameter(4)); |
|
132 CImSmtpSettings* smtpSettings2 = ObtainParameterReferenceL<CImSmtpSettings>(TestCase(), ActionParameters().Parameter(5)); |
|
133 CImIAPPreferences* smtpPrefs1 = ObtainParameterReferenceL<CImIAPPreferences>(TestCase(), ActionParameters().Parameter(6)); |
|
134 CImIAPPreferences* smtpPrefs2 = ObtainParameterReferenceL<CImIAPPreferences>(TestCase(), ActionParameters().Parameter(7)); |
|
135 |
|
136 // final param indicates whether we expect the input params to match |
|
137 // a non-zero value indicates we expect a match |
|
138 TInt matchExpected = ObtainValueParameterL<TInt>(TestCase(), ActionParameters().Parameter(8)); |
|
139 |
|
140 TVerdict result = EPass; |
|
141 |
|
142 if (!(*imap4Settings1 == *imap4Settings2)) |
|
143 { |
|
144 // failed |
|
145 TestCase().ERR_PRINTF1(_L("IMAP4 Settings objects do not match !")); |
|
146 result = EFail; |
|
147 } |
|
148 else if (!(*smtpSettings1 == *smtpSettings2)) |
|
149 { |
|
150 // failed |
|
151 TestCase().ERR_PRINTF1(_L("SMTP Settings objects do not match !")); |
|
152 result = EFail; |
|
153 } |
|
154 else if (!CMtfTestActionUtilsImapScripts::CompareIapPrefs(*imap4Prefs1, *imap4Prefs2)) |
|
155 { |
|
156 // failed |
|
157 TestCase().ERR_PRINTF1(_L("IMAP4 IAP Preference objects do not match !")); |
|
158 result = EFail; |
|
159 } |
|
160 else if (!CMtfTestActionUtilsImapScripts::CompareIapPrefs(*smtpPrefs1, *smtpPrefs2)) |
|
161 { |
|
162 // failed |
|
163 TestCase().ERR_PRINTF1(_L("SMTP IAP Preference objects do not match !")); |
|
164 result = EFail; |
|
165 } |
|
166 |
|
167 // if the parameters did not match and we expected them to then fail the test |
|
168 if( result == EFail && matchExpected != 0 ) |
|
169 { |
|
170 TestCase().ERR_PRINTF1(_L("Expected to match but failed comparison")); |
|
171 TestCase().SetTestStepResult(EFail); |
|
172 } |
|
173 |
|
174 // if the parameters matched and we didn't expected them to then fail the test |
|
175 if( result == EPass && matchExpected == 0) |
|
176 { |
|
177 TestCase().ERR_PRINTF1(_L("Expected to fail comparison but matched")); |
|
178 TestCase().SetTestStepResult(EFail); |
|
179 } |
|
180 |
|
181 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCompareImapSettings); |
|
182 TestCase().ActionCompletedL(*this); |
|
183 } |
|
184 |
|
185 |
|
186 |