|
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 // CMtfTestActionDeleteExistingService.h |
|
15 // __ACTION_INFO_BEGIN__ |
|
16 // [Action Name] |
|
17 // DeleteExistingService |
|
18 // [Action Parameters] |
|
19 // Session <input>: Reference to session. |
|
20 // TUid <input>: MTM UID |
|
21 // [Action Description] |
|
22 // Deletes the exisitng service(s) of the speficied MTM type |
|
23 // [APIs Used] |
|
24 // none |
|
25 // __ACTION_INFO_END__ |
|
26 // |
|
27 // |
|
28 |
|
29 //System Include |
|
30 #include <msvapi.h> |
|
31 |
|
32 //User Include |
|
33 #include "CMtfTestActionDeleteExistingService.h" |
|
34 #include "CMtfTestCase.h" |
|
35 #include "CMtfTestActionParameters.h" |
|
36 |
|
37 /** |
|
38 Function : NewL |
|
39 Description : |
|
40 @internalTechnology |
|
41 @param : aTestCase :Reference to the Test case |
|
42 @param : aActionParams :Test Action parameters |
|
43 @return : CMtfTestAction* :a base class pointer to the newly created object |
|
44 @pre none |
|
45 @post none |
|
46 */ |
|
47 CMtfTestAction* CMtfTestActionDeleteExistingService::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
48 { |
|
49 CMtfTestActionDeleteExistingService* self = new (ELeave) CMtfTestActionDeleteExistingService(aTestCase); |
|
50 CleanupStack::PushL(self); |
|
51 self->ConstructL(aActionParameters); |
|
52 CleanupStack::Pop(self); |
|
53 return self; |
|
54 } |
|
55 |
|
56 |
|
57 /** |
|
58 Function : CMtfTestActionLaunchSchSendExe |
|
59 Description : Constructor |
|
60 @internalTechnology |
|
61 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
62 @pre none |
|
63 @post none |
|
64 */ |
|
65 CMtfTestActionDeleteExistingService::CMtfTestActionDeleteExistingService(CMtfTestCase& aTestCase) |
|
66 : CMtfSynchronousTestAction(aTestCase) |
|
67 { |
|
68 } |
|
69 |
|
70 |
|
71 /** |
|
72 Function : ~CMtfTestActionLaunchSchSendExe |
|
73 Description : Destructor |
|
74 @internalTechnology |
|
75 */ |
|
76 CMtfTestActionDeleteExistingService::~CMtfTestActionDeleteExistingService() |
|
77 { |
|
78 } |
|
79 |
|
80 /** |
|
81 Function : ExecuteActionL |
|
82 Description : Deletes all Existing Parent Services. |
|
83 @internalTechnology |
|
84 @param : none |
|
85 @return : void |
|
86 @pre : |
|
87 @post none |
|
88 */ |
|
89 void CMtfTestActionDeleteExistingService::ExecuteActionL() |
|
90 { |
|
91 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionDeleteExistingService); |
|
92 CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0)); |
|
93 TUid paramMtmUid = ObtainValueParameterL<TUid>(TestCase(),ActionParameters().Parameter(1)); |
|
94 |
|
95 CMsvEntry* entry1 = CMsvEntry::NewL(*paramSession,KMsvRootIndexEntryId,TMsvSelectionOrdering()); |
|
96 CleanupStack::PushL(entry1); |
|
97 CMsvEntrySelection* sel = entry1->ChildrenWithMtmL(paramMtmUid); |
|
98 CleanupStack::PushL(sel); |
|
99 |
|
100 if(TestCase().TestStepResult() == EPass) |
|
101 { |
|
102 TInt count = sel->Count(); |
|
103 |
|
104 while (count--) |
|
105 { |
|
106 TMsvId del = sel->At(count); |
|
107 |
|
108 entry1->SetEntryL(del); |
|
109 entry1->SetEntryL(entry1->Entry().Parent()); |
|
110 TInt err = KErrNone; |
|
111 if( err == KErrNone ) |
|
112 { |
|
113 TRAP(err, entry1->DeleteL(del)); |
|
114 } |
|
115 } |
|
116 } |
|
117 CleanupStack::PopAndDestroy(sel); |
|
118 CleanupStack::PopAndDestroy(entry1); |
|
119 |
|
120 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionDeleteExistingService); |
|
121 TestCase().ActionCompletedL(*this); |
|
122 } |