|
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 // CompareSmsSettings |
|
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, if not specified 0 is assumed |
|
21 // [Action Description] |
|
22 // Compares the settings of the specified SMS service to those stored on a file. The Messaging Test |
|
23 // server will decide on what file to be used to read the settings from. |
|
24 // [APIs Used] |
|
25 // CSmsSettings:: |
|
26 // CSmsSettings::CanConcatenate() |
|
27 // CSmsSettings::CharacterSet() |
|
28 // CSmsSettings::CommDbAction() |
|
29 // CSmsSettings::Delivery() |
|
30 // CSmsSettings::DeliveryReport( |
|
31 // CSmsSettings::MessageConversion() |
|
32 // CSmsSettings::NumSCAddresses() |
|
33 // CSmsSettings::RejectDuplicate() |
|
34 // CSmsSettings::ReplyPath() |
|
35 // CSmsSettings::ReplyQuoted() |
|
36 // CSmsSettings::SmsBearer() |
|
37 // CSmsSettings::SmsBearerAction() |
|
38 // CSmsSettings::SpecialMessageHandling() |
|
39 // CSmsSettings::StatusReportHandling() |
|
40 // CSmsSettings::ValidityPeriod() |
|
41 // CSmsSettings::ValidityPeriodFormat() |
|
42 // CSmsSettings::SCAddress() |
|
43 // __ACTION_INFO_END__ |
|
44 // |
|
45 // |
|
46 |
|
47 /** |
|
48 @file |
|
49 */ |
|
50 |
|
51 |
|
52 #include "CMtfTestActionCompareSmsSettings.h" |
|
53 #include "CMtfTestCase.h" |
|
54 #include "CMtfTestActionParameters.h" |
|
55 |
|
56 #include "CMtfTestActionUtilsSmsScripts.h" |
|
57 |
|
58 #include "MSVAPI.H" |
|
59 |
|
60 |
|
61 #include <csmsaccount.h> |
|
62 |
|
63 |
|
64 CMtfTestAction* CMtfTestActionCompareSmsSettings::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
65 { |
|
66 CMtfTestActionCompareSmsSettings* self = new (ELeave) CMtfTestActionCompareSmsSettings(aTestCase); |
|
67 CleanupStack::PushL(self); |
|
68 self->ConstructL(aActionParameters); |
|
69 CleanupStack::Pop(); |
|
70 return self; |
|
71 } |
|
72 |
|
73 |
|
74 CMtfTestActionCompareSmsSettings::CMtfTestActionCompareSmsSettings(CMtfTestCase& aTestCase) |
|
75 : CMtfSynchronousTestAction(aTestCase) |
|
76 { |
|
77 } |
|
78 |
|
79 |
|
80 CMtfTestActionCompareSmsSettings::~CMtfTestActionCompareSmsSettings() |
|
81 { |
|
82 } |
|
83 |
|
84 void CMtfTestActionCompareSmsSettings::ExecuteActionL() |
|
85 { |
|
86 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCompareSmsSettings); |
|
87 CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0)); |
|
88 TMsvId paramSmsServiceId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1)); |
|
89 |
|
90 |
|
91 TInt paramDefaultIndex = 0; |
|
92 if(ActionParameters().Count() == 3) |
|
93 { |
|
94 paramDefaultIndex = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2)); |
|
95 } |
|
96 |
|
97 // Get the settings file name from the test case |
|
98 const TPtrC settingsFile = TestCase().GetConfigurationFileL(CMtfConfigurationType::EMtfSmsSettings, paramDefaultIndex); |
|
99 |
|
100 // Create reference SMS settings from the file |
|
101 CSmsSettings* smsSettingsReference = CSmsSettings::NewL(); |
|
102 CleanupStack::PushL(smsSettingsReference); |
|
103 CMtfTestActionUtilsSmsScripts::ReadSmsSettingsFromConfigurationFileL(TestCase(), settingsFile, *smsSettingsReference); |
|
104 |
|
105 CSmsSettings* smsSettings = CSmsSettings::NewL(); |
|
106 CleanupStack::PushL(smsSettings); |
|
107 |
|
108 // Restore the settings from the specified service into second CSmsSettings object |
|
109 |
|
110 CSmsAccount* smsAccount = CSmsAccount::NewLC(); |
|
111 smsAccount->LoadSettingsL(*smsSettings); |
|
112 |
|
113 |
|
114 // Compare them, might want to split "if" below for ease of debugging.. |
|
115 |
|
116 if( smsSettings->CanConcatenate() != smsSettingsReference->CanConcatenate() || |
|
117 smsSettings->Class2Folder() != smsSettingsReference->Class2Folder() || |
|
118 smsSettings->CharacterSet() != smsSettingsReference->CharacterSet() || |
|
119 smsSettings->CommDbAction() != smsSettingsReference->CommDbAction() || |
|
120 |
|
121 smsSettings->DefaultServiceCenter() != smsSettingsReference->DefaultServiceCenter() || |
|
122 |
|
123 smsSettings->Delivery() != smsSettingsReference->Delivery() || |
|
124 smsSettings->DeliveryReport() != smsSettingsReference->DeliveryReport() || |
|
125 smsSettings->DescriptionLength() != smsSettingsReference->DescriptionLength() || |
|
126 smsSettings->MessageConversion() != smsSettingsReference->MessageConversion() || |
|
127 |
|
128 smsSettings->ServiceCenterCount() != smsSettingsReference->ServiceCenterCount() || |
|
129 |
|
130 smsSettings->RejectDuplicate() != smsSettingsReference->RejectDuplicate() || |
|
131 smsSettings->ReplyPath() != smsSettingsReference->ReplyPath() || |
|
132 smsSettings->ReplyQuoted() != smsSettingsReference->ReplyQuoted() || |
|
133 smsSettings->SmsBearer() != smsSettingsReference->SmsBearer() || |
|
134 smsSettings->SmsBearerAction() != smsSettingsReference->SmsBearerAction() || |
|
135 smsSettings->SpecialMessageHandling() != smsSettingsReference->SpecialMessageHandling() || |
|
136 smsSettings->StatusReportHandling() != smsSettingsReference->StatusReportHandling() || |
|
137 smsSettings->ValidityPeriod() != smsSettingsReference->ValidityPeriod() || |
|
138 smsSettings->ValidityPeriodFormat() != smsSettingsReference->ValidityPeriodFormat() |
|
139 ) |
|
140 { |
|
141 // settings differ |
|
142 User::Leave(KErrGeneral); |
|
143 } |
|
144 |
|
145 // compare service centre addresses |
|
146 |
|
147 |
|
148 for (TInt i = 0; i<smsSettings->ServiceCenterCount(); i++) |
|
149 { |
|
150 if(smsSettings->GetServiceCenter(i).Name() != smsSettingsReference->GetServiceCenter(i).Name() || |
|
151 smsSettings->GetServiceCenter(i).Address() != smsSettingsReference->GetServiceCenter(i).Address() ) |
|
152 { |
|
153 // settings differ |
|
154 User::Leave(KErrGeneral); |
|
155 } |
|
156 } |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 CleanupStack::PopAndDestroy(3,smsSettingsReference); // smsSettings, smsAccount |
|
162 |
|
163 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCompareSmsSettings); |
|
164 TestCase().ActionCompletedL(*this); |
|
165 } |
|
166 |
|
167 |