|
1 // Copyright (c) 2003-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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 */ |
|
19 |
|
20 #include "CMtfTestCaseCreateSendReceivePop3Email.h" |
|
21 #include "CMtfTestActionParameters.h" |
|
22 |
|
23 #include "CMtfTestActionGetBaseConstants.h" |
|
24 #include "CMtfTestActionGetEntryPriorityEnums.h" |
|
25 #include "CMtfTestActionCreateSession.h" |
|
26 #include "CMtfTestActionResetMessageStore.h" |
|
27 #include "CMtfTestActionCreateRegistry.h" |
|
28 #include "CMtfTestActionCopyEntry.h" |
|
29 #include "CMtfTestActionFindEntryByName.h" |
|
30 #include "CMtfTestActionDeleteChildren.h" |
|
31 #include "CMtfTestActionCheckChildrenCount.h" |
|
32 #include "CMtfTestActionCreateChildrenSelection.h" |
|
33 #include "CMtfTestActionCopySelection.h" |
|
34 |
|
35 #include "CMtfTestActionInitNtRas.h" |
|
36 |
|
37 #include "CMtfTestActionCreatePop3Service.h" |
|
38 #include "CMtfTestActionCreatePop3Mtm.h" |
|
39 #include "CMtfTestActionSetPop3ServiceParameters.h" |
|
40 #include "CMtfTestActionConnectPop3Server.h" |
|
41 #include "CMtfTestActionDisconnectPop3Server.h" |
|
42 |
|
43 #include "CMtfTestActionCreateSmtpService.h" |
|
44 #include "CMtfTestActionCreateSmtpMtm.h" |
|
45 #include "CMtfTestActionSetSmtpServiceParameters.h" |
|
46 #include "CMtfTestActionCreateSmtpMessageFromEmailFile.h" |
|
47 |
|
48 _LIT(KSession,"session"); |
|
49 |
|
50 _LIT(KInboxFolderId, "inboxFolderId"); |
|
51 _LIT(KOutboxFolderId, "outboxFolderId"); |
|
52 _LIT(KDraftsFolderId, "draftsFolderId"); |
|
53 _LIT(KSentFolderId, "sentFolderId"); |
|
54 _LIT(KDeletedFolderId, "deletedFolderId"); |
|
55 |
|
56 _LIT(KClientMtmRegistry,"clientMtmRegistry"); |
|
57 |
|
58 _LIT(KPop3Mtm, "Pop3Mtm"); |
|
59 _LIT(KPop3ServiceId, "Pop3ServiceId"); |
|
60 _LIT(KPop3MessageId, "imap4MessageId"); |
|
61 _LIT(KPop3MessageDescription, "\"SimpleEmail\""); |
|
62 _LIT(KPop3Details, "\"Pop3Service\""); |
|
63 |
|
64 _LIT(KSmtpMtm, "smtpMtm"); |
|
65 _LIT(KSmtpServiceId, "smtpServiceId"); |
|
66 _LIT(KSmtpMessageId, "smtpMessageId"); |
|
67 _LIT(KSmtpDetails, "\"SmtpService\""); |
|
68 |
|
69 |
|
70 _LIT(KZero, "0"); |
|
71 _LIT(KOne, "1"); |
|
72 |
|
73 _LIT(KSelection,"selection"); |
|
74 |
|
75 _LIT(KInboxMessageId, "inboxMessageId"); |
|
76 _LIT(KSentMessageId, "sentMessageId"); |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 CMtfTestCase* CMtfTestCaseCreateSendReceivePop3Email::NewL(const CMtfTestServer& aTestServer) |
|
82 { |
|
83 CMtfTestCaseCreateSendReceivePop3Email* self = new (ELeave) CMtfTestCaseCreateSendReceivePop3Email(aTestServer); |
|
84 CleanupStack::PushL(self); |
|
85 self->ConstructL(); |
|
86 CleanupStack::Pop(); |
|
87 return self; |
|
88 } |
|
89 |
|
90 |
|
91 CMtfTestCaseCreateSendReceivePop3Email::CMtfTestCaseCreateSendReceivePop3Email(const CMtfTestServer& aTestServer) |
|
92 : CMtfTestCase(aTestServer,EFalse,ETrue) |
|
93 { |
|
94 } |
|
95 |
|
96 |
|
97 void CMtfTestCaseCreateSendReceivePop3Email::ConstructL() |
|
98 { |
|
99 CMtfTestCase::ConstructL(); |
|
100 } |
|
101 |
|
102 |
|
103 void CMtfTestCaseCreateSendReceivePop3Email::SetupTestCaseL() |
|
104 { |
|
105 // Get constants and enums. |
|
106 CMtfTestActionGetBaseConstants::NewL(*this,CMtfTestActionParameters::NewL(KInboxFolderId,KOutboxFolderId,KDraftsFolderId,KSentFolderId,KDeletedFolderId)); |
|
107 |
|
108 // Init NTRAS. |
|
109 CMtfTestActionInitNtRas::NewL(*this,CMtfTestActionParameters::NewL()); |
|
110 |
|
111 // Create the session and reset the message store. |
|
112 CMtfTestActionCreateSession::NewL(*this,CMtfTestActionParameters::NewL(KSession)); |
|
113 CMtfTestActionResetMessageStore::NewL(*this,CMtfTestActionParameters::NewL(KSession)); |
|
114 |
|
115 // Create the POP3 and SMTP services |
|
116 CMtfTestActionCreatePop3Service::NewL(*this,CMtfTestActionParameters::NewL(KSession,_,_,_,_,KPop3Details,KPop3ServiceId)); |
|
117 CMtfTestActionCreateSmtpService::NewL(*this,CMtfTestActionParameters::NewL(KSession,_,_,_,_,KSmtpDetails,KSmtpServiceId)); |
|
118 |
|
119 // Create POP3 and SMTP client MTMs. |
|
120 CMtfTestActionCreateRegistry::NewL(*this,CMtfTestActionParameters::NewL(KSession,KClientMtmRegistry)); |
|
121 CMtfTestActionCreatePop3Mtm::NewL(*this,CMtfTestActionParameters::NewL(KSession,KPop3ServiceId,KClientMtmRegistry,KPop3Mtm)); |
|
122 CMtfTestActionCreateSmtpMtm::NewL(*this,CMtfTestActionParameters::NewL(KSession,KSmtpServiceId,KClientMtmRegistry,KSmtpMtm)); |
|
123 |
|
124 // Set POP3 and SMTP service parameters. |
|
125 CMtfTestActionSetPop3ServiceParameters::NewL(*this,CMtfTestActionParameters::NewL(KSession,KPop3ServiceId,_)); |
|
126 CMtfTestActionSetSmtpServiceParameters::NewL(*this,CMtfTestActionParameters::NewL(KSession,KSmtpServiceId,_)); |
|
127 |
|
128 // Connect and sync with POP3 server. |
|
129 CMtfTestActionConnectPop3Server::NewL(*this,CMtfTestActionParameters::NewL(KPop3ServiceId,KPop3Mtm)); |
|
130 |
|
131 // Delete all POP3 service entries and verify that it has no entries. |
|
132 CMtfTestActionDeleteChildren::NewL(*this,CMtfTestActionParameters::NewL(KSession,KPop3ServiceId)); |
|
133 CMtfTestActionCheckChildrenCount::NewL(*this,CMtfTestActionParameters::NewL(KSession,KPop3ServiceId,KZero)); |
|
134 |
|
135 // Disconnect from POP3 server. |
|
136 CMtfTestActionDisconnectPop3Server::NewL(*this,CMtfTestActionParameters::NewL(KPop3ServiceId,KPop3Mtm)); |
|
137 } |
|
138 |
|
139 |
|
140 void CMtfTestCaseCreateSendReceivePop3Email::ExecuteTestCaseL() |
|
141 { |
|
142 // Create the email and send. |
|
143 CMtfTestActionCreateSmtpMessageFromEmailFile::NewL(*this,CMtfTestActionParameters::NewL(KSession,KSmtpServiceId,KOutboxFolderId,_,KSmtpMessageId)); |
|
144 CMtfTestActionCopyEntry::NewL(*this,CMtfTestActionParameters::NewL(KSession,KSmtpMessageId,KSmtpServiceId)); |
|
145 |
|
146 // Connect and sync with POP3 server. |
|
147 CMtfTestActionConnectPop3Server::NewL(*this,CMtfTestActionParameters::NewL(KPop3ServiceId,KPop3Mtm)); |
|
148 |
|
149 // Copy POP3 service entries to local Inbox. |
|
150 CMtfTestActionCreateChildrenSelection::NewL(*this,CMtfTestActionParameters::NewL(KSession,KPop3ServiceId,KSelection)); |
|
151 CMtfTestActionCopySelection::NewL(*this,CMtfTestActionParameters::NewL(KSession,KSelection,KInboxFolderId)); |
|
152 |
|
153 // Disconnect from POP3 server. |
|
154 CMtfTestActionDisconnectPop3Server::NewL(*this,CMtfTestActionParameters::NewL(KPop3ServiceId,KPop3Mtm)); |
|
155 } |
|
156 |
|
157 |
|
158 void CMtfTestCaseCreateSendReceivePop3Email::CheckPostConditionsL() |
|
159 { |
|
160 // Check if IPOP3 service has 1 entry. |
|
161 CMtfTestActionCheckChildrenCount::NewL(*this,CMtfTestActionParameters::NewL(KSession,KPop3ServiceId,KOne)); |
|
162 |
|
163 // Check if POP3 service entry is the one we have sent. |
|
164 CMtfTestActionFindEntryByName::NewL(*this,CMtfTestActionParameters::NewL(KSession,KPop3ServiceId,KPop3MessageDescription,KPop3MessageId)); |
|
165 // COMPARE CONTENT OF THE MESSAGE |
|
166 |
|
167 // Check if local Inbox has 1 entry. |
|
168 CMtfTestActionCheckChildrenCount::NewL(*this,CMtfTestActionParameters::NewL(KSession,KInboxFolderId,KOne)); |
|
169 |
|
170 // Check if local Inbox entry is the one we have sent. |
|
171 CMtfTestActionFindEntryByName::NewL(*this,CMtfTestActionParameters::NewL(KSession,KInboxFolderId,KPop3MessageDescription,KInboxMessageId)); |
|
172 // COMPARE CONTENT OF THE MESSAGE |
|
173 |
|
174 // Check if local Sent has 1 entry. |
|
175 CMtfTestActionCheckChildrenCount::NewL(*this,CMtfTestActionParameters::NewL(KSession,KSentFolderId,KOne)); |
|
176 |
|
177 // Check if local Sent entry is the one we have sent. |
|
178 CMtfTestActionFindEntryByName::NewL(*this,CMtfTestActionParameters::NewL(KSession,KSentFolderId,KPop3MessageDescription,KSentMessageId)); |
|
179 // COMPARE CONTENT OF THE MESSAGE |
|
180 } |
|
181 |
|
182 |