|
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 // SaveScheduleSendSettings |
|
17 // [Action Parameters] |
|
18 // configFileIndex <input>: Configuration file index |
|
19 // ScheduleSettings <output>: CMsvScheduleSettings |
|
20 // OffPeakTimes <output>: CMsvOffPeakTimes |
|
21 // ErrorActions <output>: CMsvSendErrorActions |
|
22 // SysAgentActions <output>: CMsvSysAgentActions |
|
23 // [Action Description] |
|
24 // SaveScheduleSendSettings Test Action is intended to modify and save existing Schedule Send settings |
|
25 // to CenRep using configuration settings file. The Test Action creates the CMsvScheduleSettings, |
|
26 // CMsvOffPeakTimes, CMsvSendErrorActions and CMsvSysAgentActions object, parses the settings file and |
|
27 // then sets the member variables of the objects to the corresponding value stored in the settings file. |
|
28 // These objects are then used to save the settings into the Central Repository. It is assumed that the |
|
29 // settings for Schedule send settings Off Peak Times, Send Error Actions and Agent Actions will be |
|
30 // present in the same ini file. |
|
31 // [APIs Used] |
|
32 // CSMSAccount::SaveSettingsL |
|
33 // CMsvScheduleSettings::SetPriority |
|
34 // CMsvScheduleSettings::SetValidityPeriod |
|
35 // CMsvScheduleSettings::SetIntervalType |
|
36 // CMsvScheduleSettings::SetLatency |
|
37 // CMsvScheduleSettings::SetLongInterval |
|
38 // CMsvScheduleSettings::SetShortInterval |
|
39 // __ACTION_INFO_END__ |
|
40 // |
|
41 // |
|
42 |
|
43 |
|
44 |
|
45 #include <msvsenderroraction.h> |
|
46 #include <msvsysagentaction.h> |
|
47 #include <msvoffpeaktime.h> |
|
48 #include <msvschedulesettings.h> |
|
49 #include <csmsaccount.h> |
|
50 |
|
51 #include "CMtfTestCase.h" |
|
52 #include "CMtfTestActionSaveScheduleSendSettings.h" |
|
53 #include "TMtfTestActionUtilsSchSendScripts.h" |
|
54 #include "CMtfTestActionParameters.h" |
|
55 |
|
56 |
|
57 |
|
58 /** |
|
59 Function : NewL |
|
60 Description : |
|
61 @internalTechnology |
|
62 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
63 @param : aActionParams - CMtfTestActionParameters |
|
64 @return : CMtfTestAction* - a base class pointer to the newly created CMtfTestActionSaveScheduleSendSettings object |
|
65 @pre none |
|
66 @post none |
|
67 */ |
|
68 CMtfTestAction* CMtfTestActionSaveScheduleSendSettings::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
69 { |
|
70 CMtfTestActionSaveScheduleSendSettings* self = new (ELeave) CMtfTestActionSaveScheduleSendSettings(aTestCase); |
|
71 CleanupStack::PushL(self); |
|
72 self->ConstructL(aActionParameters); |
|
73 CleanupStack::Pop(self); |
|
74 return self; |
|
75 } |
|
76 |
|
77 /** |
|
78 Function : CMtfTestActionSaveScheduleSendSettings |
|
79 Description : Constructor |
|
80 @internalTechnology |
|
81 @param : aTestCase - CMtfTestCase for the CMtfTestAction base class |
|
82 @return : N/A |
|
83 @pre none |
|
84 @post none |
|
85 */ |
|
86 CMtfTestActionSaveScheduleSendSettings::~CMtfTestActionSaveScheduleSendSettings() |
|
87 { |
|
88 } |
|
89 |
|
90 /** |
|
91 Function : ~CMtfTestActionSaveScheduleSendSettings |
|
92 Description : Destructor |
|
93 @internalTechnology |
|
94 @param : |
|
95 @return : |
|
96 @pre |
|
97 @post |
|
98 */ |
|
99 CMtfTestActionSaveScheduleSendSettings::CMtfTestActionSaveScheduleSendSettings(CMtfTestCase& aTestCase) : CMtfSynchronousTestAction(aTestCase) |
|
100 { |
|
101 } |
|
102 |
|
103 /** |
|
104 Function : ExecuteActionL |
|
105 Description : Entry point for the this test action in the test framework |
|
106 @internalTechnology |
|
107 @param : none |
|
108 @return : void |
|
109 @pre none |
|
110 @post none |
|
111 */ |
|
112 void CMtfTestActionSaveScheduleSendSettings::ExecuteActionL() |
|
113 { |
|
114 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSaveScheduleSendSettings); |
|
115 CSmsAccount* smsAccount = CSmsAccount::NewL(); |
|
116 CleanupStack::PushL(smsAccount); |
|
117 |
|
118 CMsvSysAgentActions* sysAgentActions = new (ELeave) CMsvSysAgentActions; |
|
119 CleanupStack::PushL(sysAgentActions); |
|
120 |
|
121 CMsvSendErrorActions* errorActions = CMsvSendErrorActions::NewL(); |
|
122 CleanupStack::PushL(errorActions); |
|
123 |
|
124 CMsvOffPeakTimes* offPeakTimes = new (ELeave) CMsvOffPeakTimes; |
|
125 CleanupStack::PushL(offPeakTimes); |
|
126 |
|
127 CMsvScheduleSettings* scheduleSettings = CMsvScheduleSettings::NewL(); |
|
128 CleanupStack::PushL(scheduleSettings); |
|
129 |
|
130 // Get index for schedule settings config file, see CMtfTestServer.cpp |
|
131 TInt configFileIndex = ObtainValueParameterL<TInt>(TestCase(), ActionParameters().Parameter(0)); |
|
132 |
|
133 // Get the settings file name from the test case |
|
134 const TPtrC settingsFile = TestCase().GetConfigurationFileL(CMtfConfigurationType::EMtfSmsSettings, configFileIndex); |
|
135 |
|
136 // Read SMS settings from config file |
|
137 TMtfTestActionUtilsSchSendScripts::ReadScheduleSettingsFromConfigurationFileL(TestCase(), settingsFile, *scheduleSettings); |
|
138 |
|
139 // Save settings to central repository |
|
140 smsAccount->SaveSettingsL(*scheduleSettings, *offPeakTimes, *errorActions, *sysAgentActions); |
|
141 |
|
142 // Set output parameters |
|
143 StoreParameterL<CMsvScheduleSettings>(TestCase(), *scheduleSettings, ActionParameters().Parameter(1)); |
|
144 CleanupStack::Pop(scheduleSettings); |
|
145 |
|
146 StoreParameterL<CMsvOffPeakTimes>(TestCase(), *offPeakTimes, ActionParameters().Parameter(2)); |
|
147 CleanupStack::Pop(offPeakTimes); |
|
148 |
|
149 StoreParameterL<CMsvSendErrorActions>(TestCase(), *errorActions, ActionParameters().Parameter(3)); |
|
150 CleanupStack::Pop(errorActions); |
|
151 |
|
152 StoreParameterL<CMsvSysAgentActions>(TestCase(), *sysAgentActions, ActionParameters().Parameter(4)); |
|
153 CleanupStack::Pop(sysAgentActions); |
|
154 |
|
155 CleanupStack::PopAndDestroy(smsAccount); |
|
156 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSaveScheduleSendSettings); |
|
157 TestCase().ActionCompletedL(*this); |
|
158 } |
|
159 |
|
160 |