|
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 // SetSmsServiceSettings |
|
17 // [Action Parameters] |
|
18 // CMsvSession& Session <input>: Reference to the session. |
|
19 // TMsvId ServiceId <input>: Value of the SMS service id. |
|
20 // TInt Index <input>: (optional) Selects what defaults file to use |
|
21 // [Action Description] |
|
22 // Modifies the settings of the specified SMS service to match the ones specified on a file. |
|
23 // The Messaging Test server will decide on what file to be used to read the settings from. |
|
24 // New settings are created if the SMS service doesn't have any settings saved. |
|
25 // [APIs Used] |
|
26 // CMsvEntry::EditStoreL |
|
27 // CSmsSettings::StoreL |
|
28 // CMsvStore::CommitL |
|
29 // __ACTION_INFO_END__ |
|
30 // |
|
31 // |
|
32 |
|
33 /** |
|
34 @file |
|
35 */ |
|
36 |
|
37 |
|
38 #include <msvapi.h> |
|
39 #include <smutset.h> |
|
40 #include <csmsaccount.h> |
|
41 |
|
42 |
|
43 #include "CMtfTestActionSetSmsServiceSettings.h" |
|
44 #include "CMtfTestCase.h" |
|
45 #include "CMtfTestActionParameters.h" |
|
46 |
|
47 #include "CMtfTestActionUtilsSmsScripts.h" |
|
48 |
|
49 CMtfTestAction* CMtfTestActionSetSmsServiceSettings::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
50 { |
|
51 CMtfTestActionSetSmsServiceSettings* self = new (ELeave) CMtfTestActionSetSmsServiceSettings(aTestCase); |
|
52 CleanupStack::PushL(self); |
|
53 self->ConstructL(aActionParameters); |
|
54 CleanupStack::Pop(); |
|
55 return self; |
|
56 } |
|
57 |
|
58 |
|
59 CMtfTestActionSetSmsServiceSettings::CMtfTestActionSetSmsServiceSettings(CMtfTestCase& aTestCase) |
|
60 : CMtfSynchronousTestAction(aTestCase) |
|
61 { |
|
62 } |
|
63 |
|
64 |
|
65 CMtfTestActionSetSmsServiceSettings::~CMtfTestActionSetSmsServiceSettings() |
|
66 { |
|
67 } |
|
68 |
|
69 void CMtfTestActionSetSmsServiceSettings::ExecuteActionL() |
|
70 { |
|
71 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSetSmsServiceSettings); |
|
72 CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0)); |
|
73 TMsvId paramSmsServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1)); |
|
74 |
|
75 |
|
76 TInt paramDefaultIndex = 0; |
|
77 if(ActionParameters().Count() == 3) |
|
78 { |
|
79 paramDefaultIndex = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2)); |
|
80 } |
|
81 |
|
82 // Get the settings file name from the test case |
|
83 const TPtrC settingsFile = TestCase().GetConfigurationFileL(CMtfConfigurationType::EMtfSmsSettings, paramDefaultIndex); |
|
84 |
|
85 // Create SMS settings from the file |
|
86 CSmsSettings* smsSettings = CSmsSettings::NewL(); |
|
87 CleanupStack::PushL(smsSettings); |
|
88 |
|
89 CSmsAccount* account = CSmsAccount::NewLC(); |
|
90 account->InitialiseDefaultSettingsL(*smsSettings); |
|
91 |
|
92 // now override the settings with the config file contents |
|
93 CMtfTestActionUtilsSmsScripts::ReadSmsSettingsFromConfigurationFileL(TestCase(), settingsFile, *smsSettings); |
|
94 |
|
95 account->SaveSettingsL(*smsSettings); |
|
96 CleanupStack::PopAndDestroy(2, smsSettings); // account smsSettings |
|
97 |
|
98 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSetSmsServiceSettings); |
|
99 TestCase().ActionCompletedL(*this); |
|
100 } |
|
101 |
|
102 |
|
103 |