|
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 // DisconnectImap4Server |
|
17 // [Action Parameters] |
|
18 // ServiceId <input>: Value of the Imap4 service id. |
|
19 // Mtm <input>: Reference to Imap4 client MTM. |
|
20 // [Action Description] |
|
21 // Discoonnects from the Imap4 server. |
|
22 // [APIs Used] |
|
23 // CMsvEntry::SetEntryL |
|
24 // CMsvEntrySelection::AppendL |
|
25 // CImap4ClientMtm::InvokeAsyncFunctionL |
|
26 // __ACTION_INFO_END__ |
|
27 // |
|
28 // |
|
29 |
|
30 /** |
|
31 @file |
|
32 */ |
|
33 |
|
34 |
|
35 #include "CMtfTestActionDisconnectImap4Server.h" |
|
36 #include "CMtfTestCase.h" |
|
37 #include "CMtfTestActionParameters.h" |
|
38 #include "MtfTestActionUtilsUser.h" |
|
39 |
|
40 #include <impcmtm.h> |
|
41 |
|
42 |
|
43 CMtfTestAction* CMtfTestActionDisconnectImap4Server::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
44 { |
|
45 CMtfTestActionDisconnectImap4Server* self = new (ELeave) CMtfTestActionDisconnectImap4Server(aTestCase); |
|
46 CleanupStack::PushL(self); |
|
47 self->ConstructL(aActionParameters); |
|
48 CleanupStack::Pop(); |
|
49 return self; |
|
50 } |
|
51 |
|
52 |
|
53 CMtfTestActionDisconnectImap4Server::CMtfTestActionDisconnectImap4Server(CMtfTestCase& aTestCase) |
|
54 : CMtfTestAction(aTestCase) |
|
55 { |
|
56 } |
|
57 |
|
58 |
|
59 CMtfTestActionDisconnectImap4Server::~CMtfTestActionDisconnectImap4Server() |
|
60 { |
|
61 } |
|
62 |
|
63 |
|
64 void CMtfTestActionDisconnectImap4Server::ExecuteActionL() |
|
65 { |
|
66 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionDisconnectImap4Server); |
|
67 TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(0)); |
|
68 CImap4ClientMtm* paramMtm = ObtainParameterReferenceL<CImap4ClientMtm>(TestCase(),ActionParameters().Parameter(1)); |
|
69 |
|
70 CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; |
|
71 CleanupStack::PushL(selection); |
|
72 selection->AppendL(paramServiceId); |
|
73 TBuf8<1> param; |
|
74 iOperation = paramMtm->InvokeAsyncFunctionL(KIMAP4MTMDisconnect,*selection,param,iStatus); |
|
75 CleanupStack::PopAndDestroy(selection); |
|
76 CActiveScheduler::Add(this); |
|
77 SetActive(); |
|
78 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionDisconnectImap4Server); |
|
79 } |
|
80 |
|
81 |
|
82 void CMtfTestActionDisconnectImap4Server::DoCancel() |
|
83 { |
|
84 iOperation->Cancel(); |
|
85 } |
|
86 |
|
87 |
|
88 void CMtfTestActionDisconnectImap4Server::RunL() |
|
89 { |
|
90 TInt err = MtfTestActionUtilsUser::FinalProgressStatus(*iOperation,iStatus); |
|
91 |
|
92 delete iOperation; |
|
93 |
|
94 if( err != KErrNone ) |
|
95 { |
|
96 TestCase().ERR_PRINTF2(_L("CMtfTestActionDisconnectImap4Server failed with code %d"), err ); |
|
97 User::Leave(err); |
|
98 } |
|
99 |
|
100 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionDisconnectImap4Server); |
|
101 TestCase().ActionCompletedL(*this); |
|
102 } |
|
103 |