|
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 // __ACTION_INFO_BEGIN__ |
|
15 // [Action Name] |
|
16 // CreateSmtpMtm |
|
17 // [Action Parameters] |
|
18 // Session <input>: Reference to the session. |
|
19 // ServiceId <input>: Value of the the service id. |
|
20 // MtmRegistry <input>: Reference to the client MTM registry. |
|
21 // Mtm <output>: Reference to the created Smtp client MTM. |
|
22 // [Action Description] |
|
23 // Creates Smtp client MTM. |
|
24 // [APIs Used] |
|
25 // CClientMtmRegistry::NewMtmL |
|
26 // CMsvSession::GetEntryL |
|
27 // CBaseMtm::SetCurrentEntryL |
|
28 // __ACTION_INFO_END__ |
|
29 // |
|
30 // |
|
31 |
|
32 /** |
|
33 @file |
|
34 */ |
|
35 |
|
36 #include <msvapi.h> |
|
37 #include <smtcmtm.h> |
|
38 #include <mtclreg.h> |
|
39 |
|
40 #include <cemailaccounts.h> |
|
41 |
|
42 #include "CMtfTestActionCreateSmtpMtm.h" |
|
43 #include "CMtfTestCase.h" |
|
44 #include "CMtfTestActionParameters.h" |
|
45 |
|
46 CMtfTestAction* CMtfTestActionCreateSmtpMtm::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
47 { |
|
48 CMtfTestActionCreateSmtpMtm* self = new (ELeave) CMtfTestActionCreateSmtpMtm(aTestCase); |
|
49 CleanupStack::PushL(self); |
|
50 self->ConstructL(aActionParameters); |
|
51 CleanupStack::Pop(); |
|
52 return self; |
|
53 } |
|
54 |
|
55 |
|
56 CMtfTestActionCreateSmtpMtm::CMtfTestActionCreateSmtpMtm(CMtfTestCase& aTestCase) |
|
57 : CMtfSynchronousTestAction(aTestCase) |
|
58 { |
|
59 } |
|
60 |
|
61 |
|
62 CMtfTestActionCreateSmtpMtm::~CMtfTestActionCreateSmtpMtm() |
|
63 { |
|
64 } |
|
65 |
|
66 |
|
67 void CMtfTestActionCreateSmtpMtm::ExecuteActionL() |
|
68 { |
|
69 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCreateSmtpMtm); |
|
70 CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0)); |
|
71 |
|
72 CEmailAccounts* accounts = CEmailAccounts::NewLC(); |
|
73 TSmtpAccount smtpAccount; |
|
74 User::LeaveIfError(accounts->DefaultSmtpAccountL(smtpAccount)); |
|
75 TMsvId paramServiceId = smtpAccount.iSmtpService; |
|
76 CleanupStack::PopAndDestroy( accounts ); |
|
77 |
|
78 CClientMtmRegistry* paramMtmRegistry = ObtainParameterReferenceL<CClientMtmRegistry>(TestCase(),ActionParameters().Parameter(2));; |
|
79 |
|
80 CBaseMtm* paramMtm = paramMtmRegistry->NewMtmL(KUidMsgTypeSMTP); |
|
81 CleanupStack::PushL(paramMtm); |
|
82 CMsvEntry* entry = paramSession->GetEntryL(paramServiceId); |
|
83 CleanupStack::PushL(entry); |
|
84 paramMtm->SetCurrentEntryL(entry); |
|
85 |
|
86 StoreParameterL<CBaseMtm>(TestCase(),*(reinterpret_cast<CBaseMtm*>(paramMtm)),ActionParameters().Parameter(3)); |
|
87 CleanupStack::Pop(entry); |
|
88 CleanupStack::Pop(paramMtm); |
|
89 |
|
90 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCreateSmtpMtm); |
|
91 TestCase().ActionCompletedL(*this); |
|
92 } |
|
93 |