|
1 /* |
|
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 // INCLUDE FILES |
|
29 #include <StifTestModule.h> |
|
30 #include <e32math.h> |
|
31 #include <libc/assert.h> |
|
32 #include <e32panic.h> |
|
33 #include "senutilsbctest.h" |
|
34 |
|
35 // ============================ MEMBER FUNCTIONS =============================== |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // CSenUtilsBCTest::Case |
|
39 // Returns a test case by number. |
|
40 // |
|
41 // This function contains an array of all available test cases |
|
42 // i.e pair of case name and test function. If case specified by parameter |
|
43 // aCaseNumber is found from array, then that item is returned. |
|
44 // |
|
45 // The reason for this rather complicated function is to specify all the |
|
46 // test cases only in one place. It is not necessary to understand how |
|
47 // function pointers to class member functions works when adding new test |
|
48 // cases. See function body for instructions how to add new test case. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 const TCaseInfo CSenUtilsBCTest::Case ( |
|
52 const TInt aCaseNumber ) const |
|
53 { |
|
54 |
|
55 /** |
|
56 * To add new test cases, implement new test case function and add new |
|
57 * line to KCases array specify the name of the case and the function |
|
58 * doing the test case |
|
59 * In practice, do following |
|
60 * 1) Make copy of existing test case function and change its name |
|
61 * and functionality. Note that the function must be added to |
|
62 * SenUtils.cpp file and to SenUtils.h |
|
63 * header file. |
|
64 * |
|
65 * 2) Add entry to following KCases array either by using: |
|
66 * |
|
67 * 2.1: FUNCENTRY or ENTRY macro |
|
68 * ENTRY macro takes two parameters: test case name and test case |
|
69 * function name. |
|
70 * |
|
71 * FUNCENTRY macro takes only test case function name as a parameter and |
|
72 * uses that as a test case name and test case function name. |
|
73 * |
|
74 * Or |
|
75 * |
|
76 * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used |
|
77 * only with OOM (Out-Of-Memory) testing! |
|
78 * |
|
79 * OOM_ENTRY macro takes five parameters: test case name, test case |
|
80 * function name, TBool which specifies is method supposed to be run using |
|
81 * OOM conditions, TInt value for first heap memory allocation failure and |
|
82 * TInt value for last heap memory allocation failure. |
|
83 * |
|
84 * OOM_FUNCENTRY macro takes test case function name as a parameter and uses |
|
85 * that as a test case name, TBool which specifies is method supposed to be |
|
86 * run using OOM conditions, TInt value for first heap memory allocation |
|
87 * failure and TInt value for last heap memory allocation failure. |
|
88 */ |
|
89 |
|
90 static TCaseInfoInternal const KCases[] = |
|
91 { |
|
92 |
|
93 ENTRY( "NewL - CSenSoapEnvelope", CSenUtilsBCTest::CSenSoapEnvelope_NewLL ), |
|
94 ENTRY( "SetBodyL - CSenSoapEnvelope ", CSenUtilsBCTest::CSenSoapEnvelope_SetBodyLL ), |
|
95 ENTRY( "BodyL - CSenSoapEnvelope ", CSenUtilsBCTest::CSenSoapEnvelope_BodyLL ), |
|
96 ENTRY( "HeaderL - CSenSoapEnvelope ", CSenUtilsBCTest::CSenSoapEnvelope_HeaderLL ), |
|
97 ENTRY( "AddHeaderL - CSenSoapEnvelope", CSenUtilsBCTest::CSenSoapEnvelope_AddHeaderLL ), |
|
98 ENTRY( "BodyAsStringL - CSenSoapEnvelope ", CSenUtilsBCTest::CSenSoapEnvelope_BodyAsStringLL ), |
|
99 ENTRY( "DetachFaultL - CSenSoapEnvelope ", CSenUtilsBCTest::CSenSoapEnvelope_DetachFaultLL ), |
|
100 ENTRY( "FaultL - CSenSoapEnvelope ", CSenUtilsBCTest::CSenSoapEnvelope_FaultLL ), |
|
101 ENTRY( "SoapAction - CSenSoapEnvelope ", CSenUtilsBCTest::CSenSoapEnvelope_SoapActionL ), |
|
102 // ENTRY( "SoapAction2 - CSenSoapEnvelope ", CSenUtilsBCTest::CSenSoapEnvelope_SoapAction2L ), |
|
103 ENTRY( "HasHeader - CSenSoapEnvelope ", CSenUtilsBCTest::CSenSoapEnvelope_HasHeaderL ), |
|
104 ENTRY( "SoapVersion - CSenSoapEnvelope ", CSenUtilsBCTest::CSenSoapEnvelope_SoapVersionL ), |
|
105 ENTRY( "HasBody - CSenSoapEnvelope ", CSenUtilsBCTest::CSenSoapEnvelope_HasBodyL ), |
|
106 ENTRY( "IsFault - CSenSoapEnvelope ", CSenUtilsBCTest::CSenSoapEnvelope_IsFaultL ), |
|
107 ENTRY( "ParseL - CSenSoapEnvelope ", CSenUtilsBCTest::CSenSoapEnvelope_ParseLL ), |
|
108 |
|
109 ENTRY( "NewL - CSenSoapFault ", CSenUtilsBCTest::CSenSoapFault_NewLL ), |
|
110 ENTRY( "NewL - CSenSoapFault ", CSenUtilsBCTest::CSenSoapFault_NewL_1L ), |
|
111 ENTRY( "FaultCode - CSenSoapFault ", CSenUtilsBCTest::CSenSoapFault_FaultCodeL ), |
|
112 ENTRY( "FaultSubcode - CSenSoapFault ", CSenUtilsBCTest::CSenSoapFault_FaultSubcodeL ), |
|
113 |
|
114 ENTRY( "FaultString - CSenSoapFault ", CSenUtilsBCTest::CSenSoapFault_FaultStringL ), |
|
115 ENTRY( "FaultActor - CSenSoapFault ", CSenUtilsBCTest::CSenSoapFault_FaultActorL ), |
|
116 ENTRY( "Detail - CSenSoapFault ", CSenUtilsBCTest::CSenSoapFault_DetailL ), |
|
117 ENTRY( "NewL - CSenSoapMessage ", CSenUtilsBCTest::CSenSoapMessage_NewLL ), |
|
118 ENTRY( "SetSecurityHeaderL - CSenSoapMessage ", CSenUtilsBCTest::CSenSoapMessage_SetSecurityHeaderLL ), |
|
119 ENTRY( "AddSecurityTokenL - CSenSoapMessage ", CSenUtilsBCTest::CSenSoapMessage_AddSecurityTokenLL ), |
|
120 ENTRY( "NewL - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_NewLL ), |
|
121 ENTRY( "ParseL - CSenSoapMessage ", CSenUtilsBCTest::CSenSoapMessage_ParseLL ), |
|
122 |
|
123 ENTRY( "NewLC - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_NewLCL ), |
|
124 ENTRY( "NewL - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_NewL_1L ), |
|
125 ENTRY( "NewLC - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_NewLC_1L ), |
|
126 ENTRY( "NewL - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_NewL_2L ), |
|
127 ENTRY( "NewLC - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_NewLC_2L ), |
|
128 ENTRY( "BinarySecurityToken - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_BinarySecurityTokenL_L ), |
|
129 ENTRY( "BinarySecurityToken1 - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_BinarySecurityTokenL_1L ), |
|
130 // ENTRY( "UsernameTokenL - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_UsernameTokenLL ), |
|
131 ENTRY( "TimestampL - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_TimestampL_L ), |
|
132 ENTRY( "TimestampL - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_TimestampL_1L ), |
|
133 // ENTRY( "UsernameTokenL - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_UsernameTokenL_1L ), |
|
134 // ENTRY( "UsernameTokenL - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_UsernameTokenL_2L ), |
|
135 // ENTRY( "UsernameTokenL - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_UsernameTokenL_3L ), |
|
136 // ENTRY( "UsernameTokenL - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_UsernameTokenL_4L ), |
|
137 ENTRY( "XmlNs - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_XmlNsL ), |
|
138 ENTRY( "XmlNsPrefix - CSenWsSecurityHeader ", CSenUtilsBCTest::CSenWsSecurityHeader_XmlNsPrefixL ), |
|
139 ENTRY( "FromXmlDateTimeL - SenDateUtils ", CSenUtilsBCTest::SenDateUtils_FromXmlDateTimeLL ), |
|
140 ENTRY( "ToXmlDateTimeUtf8L - SenDateUtils ", CSenUtilsBCTest::SenDateUtils_ToXmlDateTimeUtf8LL ), |
|
141 ENTRY( "ToXmlDateTimeUtf82L - SenDateUtils ", CSenUtilsBCTest::SenDateUtils_ToXmlDateTimeUtf82LL ), |
|
142 |
|
143 ENTRY( "FileAttachmentL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_FileAttachmentLL ), |
|
144 ENTRY( "NewL - CSenXmlProperties", CSenUtilsBCTest::SenXmlProperties_NewLL ), |
|
145 ENTRY( "NewLC - CSenXmlProperties", CSenUtilsBCTest::SenXmlProperties_NewLCL ), |
|
146 ENTRY( "NewL - CSenXmlProperties", CSenUtilsBCTest::SenXmlProperties_NewL_1L ), |
|
147 ENTRY( "NewLC - CSenXmlProperties", CSenUtilsBCTest::SenXmlProperties_NewLC_1L ), |
|
148 ENTRY( "NewL - CSenXmlProperties", CSenUtilsBCTest::SenXmlProperties_NewL_2L ), |
|
149 ENTRY( "NewLC - CSenXmlProperties", CSenUtilsBCTest::SenXmlProperties_NewLC_2L ), |
|
150 ENTRY( "NewL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_NewLL ), |
|
151 ENTRY( "NewLC - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_NewLCL ), |
|
152 ENTRY( "NewL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_NewL_1L ), |
|
153 ENTRY( "NewLC - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_NewLC_1L ), |
|
154 ENTRY( "NewL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_NewL_2L ), |
|
155 ENTRY( "NewLC - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_NewLC_2L ), |
|
156 ENTRY( "AsUtf8L - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_AsUtf8LL ), |
|
157 ENTRY( "SetPropertyL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetPropertyLL ), |
|
158 ENTRY( "PropertyL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_PropertyLL ), |
|
159 ENTRY( "SetIntPropertyL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetIntPropertyLL ), |
|
160 ENTRY( "IntPropertyL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_IntPropertyLL ), |
|
161 ENTRY( "SetBoolPropertyL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetBoolPropertyLL ), |
|
162 ENTRY( "BoolPropertyL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_BoolPropertyLL ), |
|
163 ENTRY( "SetOmittedL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetOmittedLL ), |
|
164 ENTRY( "RemovePropertyL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_RemovePropertyLL ), |
|
165 ENTRY( "HeartbeatL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_HeartbeatLL ), |
|
166 ENTRY( "SetHeartbeatL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetHeartbeatLL ), |
|
167 ENTRY( "IapIdL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_IapIdLL ), |
|
168 ENTRY( "SetIapIdL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetIapIdLL ), |
|
169 ENTRY( "ProxyPortL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_ProxyPortLL ), |
|
170 ENTRY( "SetProxyPortL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetProxyPortLL ), |
|
171 ENTRY( "ProxyHostL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_ProxyHostLL ), |
|
172 ENTRY( "SetProxyHostL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetProxyHostLL ), |
|
173 ENTRY( "ProxyUsageL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_ProxyUsageLL ), |
|
174 ENTRY( "SetProxyUsageL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetProxyUsageLL ), |
|
175 ENTRY( "SecureDialogL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SecureDialogLL ), |
|
176 ENTRY( "SetSecureDialogL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetSecureDialogLL ), |
|
177 ENTRY( "UserAgentL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_UserAgentLL ), |
|
178 ENTRY( "SetUserAgentL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetUserAgentLL ), |
|
179 ENTRY( "DeviceIDL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_DeviceIDLL ), |
|
180 ENTRY( "SetDeviceIDL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetDeviceIDLL ), |
|
181 ENTRY( "SoapActionL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SoapActionLL ), |
|
182 ENTRY( "SetSoapActionL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetSoapActionLL ), |
|
183 ENTRY( "DownloadFolderL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_DownloadFolderLL ), |
|
184 ENTRY( "SetDownloadFolderL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetDownloadFolderLL ), |
|
185 ENTRY( "SetFileAttachmentL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetFileAttachmentLL ), |
|
186 ENTRY( "MwsNamespaceL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_MwsNamespaceLL ), |
|
187 ENTRY( "SetMwsNamespaceL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetMwsNamespaceLL ), |
|
188 ENTRY( "MessageIdL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_MessageIdLL ), |
|
189 ENTRY( "SetMessageIdL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetMessageIdLL ), |
|
190 ENTRY( "OnewayMessageOnOffL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_OnewayMessageOnOffLL ), |
|
191 ENTRY( "SetOnewayMessageOnOffL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetOnewayMessageOnOffLL ), |
|
192 ENTRY( "SetMaxTimeToLiveL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetMaxTimeToLiveLL ), |
|
193 ENTRY( "MaxTimeToLiveL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_MaxTimeToLiveLL ), |
|
194 ENTRY( "SetMaxTimeToLiveL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetMaxTimeToLiveLL), |
|
195 ENTRY( "MinTimeToLiveL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_MinTimeToLiveLL ), |
|
196 ENTRY( "SetMinTimeToLiveL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetMinTimeToLiveLL ), |
|
197 ENTRY( "SetReaderL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_SetReaderL ), |
|
198 ENTRY( "PropertiesClassTypeL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_PropertiesClassTypeL ), |
|
199 ENTRY( "WriteToLL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_WriteToLL ), |
|
200 ENTRY( "ReadFromLL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_ReadFromLL ), |
|
201 ENTRY( "CloneL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_CloneL ), |
|
202 ENTRY( "IsSafeToCastL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_IsSafeToCastL ), |
|
203 ENTRY( "CloneLL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_CloneLL ), |
|
204 ENTRY( "ApplyBindingLL - CSenTransportProperties", CSenUtilsBCTest::SenTransportProperties_ApplyBindingLL ), |
|
205 |
|
206 ENTRY( "NewL - CSenHttpTransportProperties", CSenUtilsBCTest::SenHttpTransportProperties_NewLL ), |
|
207 ENTRY( "NewLC - CSenHttpTransportProperties", CSenUtilsBCTest::SenHttpTransportProperties_NewLCL ), |
|
208 ENTRY( "NewL - CSenHttpTransportProperties", CSenUtilsBCTest::SenHttpTransportProperties_NewL_1L ), |
|
209 ENTRY( "NewLC - CSenHttpTransportProperties", CSenUtilsBCTest::SenHttpTransportProperties_NewLC_1L ), |
|
210 ENTRY( "NewL - CSenHttpTransportProperties", CSenUtilsBCTest::SenHttpTransportProperties_NewL_2L ), |
|
211 ENTRY( "NewLC - CSenHttpTransportProperties", CSenUtilsBCTest::SenHttpTransportProperties_NewLC_2L), |
|
212 //ENTRY( "NewL - CSenVtcpTransportProperties", CSenUtilsBCTest::SenVtcpTransportProperties_NewLL ), |
|
213 //ENTRY( "NewLC - CSenVtcpTransportProperties", CSenUtilsBCTest::SenVtcpTransportProperties_NewLCL ), |
|
214 //ENTRY( "NewL - CSenVtcpTransportProperties", CSenUtilsBCTest::SenVtcpTransportProperties_NewL_1L ), |
|
215 //ENTRY( "NewLC - CSenVtcpTransportProperties", CSenUtilsBCTest::SenVtcpTransportProperties_NewLC_1L ), |
|
216 //ENTRY( "NewL - CSenVtcpTransportProperties", CSenUtilsBCTest::SenVtcpTransportProperties_NewL_2L ), |
|
217 //ENTRY( "NewLC - CSenVtcpTransportProperties", CSenUtilsBCTest::SenVtcpTransportProperties_NewLC_2L ), |
|
218 //ENTRY( "OnewayMessageOnOffL - CSenVtcpTransportProperties", CSenUtilsBCTest::SenVtcpTransportProperties_OnewayMessageOnOffLL ), |
|
219 //ENTRY( "SetOnewayMessageOnOffL - CSenVtcpTransportProperties", CSenUtilsBCTest::SenVtcpTransportProperties_SetOnewayMessageOnOffLL ), |
|
220 //ENTRY( "SetMaxTimeToLiveL - CSenVtcpTransportProperties", CSenUtilsBCTest::SenVtcpTransportProperties_SetMaxTimeToLiveLL ), |
|
221 //ENTRY( "MaxTimeToLiveL - CSenVtcpTransportProperties", CSenUtilsBCTest::SenVtcpTransportProperties_MaxTimeToLiveLL ), |
|
222 //ENTRY( "MinTimeToLiveL - CSenVtcpTransportProperties", CSenUtilsBCTest::SenVtcpTransportProperties_MinTimeToLiveLL ), |
|
223 //ENTRY( "SetMinTimeToLiveL - CSenVtcpTransportProperties", CSenUtilsBCTest::SenVtcpTransportProperties_SetMinTimeToLiveLL ),*/ |
|
224 |
|
225 |
|
226 // Example how to use OOM functionality |
|
227 //OOM_ENTRY( "Loop test with OOM", CSenUtilsBCTest::LoopTest, ETrue, 2, 3), |
|
228 //OOM_FUNCENTRY( CSenUtilsBCTest::PrintTest, ETrue, 1, 3 ), |
|
229 }; |
|
230 |
|
231 // Verify that case number is valid |
|
232 if( (TUint) aCaseNumber >= sizeof( KCases ) / |
|
233 sizeof( TCaseInfoInternal ) ) |
|
234 { |
|
235 // Invalid case, construct empty object |
|
236 TCaseInfo null( (const TText*) L"" ); |
|
237 null.iMethod = NULL; |
|
238 null.iIsOOMTest = EFalse; |
|
239 null.iFirstMemoryAllocation = 0; |
|
240 null.iLastMemoryAllocation = 0; |
|
241 return null; |
|
242 } |
|
243 |
|
244 // Construct TCaseInfo object and return it |
|
245 TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName ); |
|
246 tmp.iMethod = KCases[ aCaseNumber ].iMethod; |
|
247 tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest; |
|
248 tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation; |
|
249 tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation; |
|
250 return tmp; |
|
251 |
|
252 } |
|
253 |
|
254 void CSenUtilsBCTest::SetupL( ){ |
|
255 if ( iXmlReader ){ |
|
256 delete iXmlReader; |
|
257 iXmlReader = NULL; |
|
258 } |
|
259 iXmlReader = CSenXmlReader::NewL(); |
|
260 } |
|
261 |
|
262 void CSenUtilsBCTest::Teardown( ){ |
|
263 if ( iXmlReader){ |
|
264 delete iXmlReader; |
|
265 iXmlReader = NULL; |
|
266 } |
|
267 } |
|
268 |
|
269 |
|
270 TPtr16 CSenUtilsBCTest::ConvertToPtr16LC(CSenBaseFragment &fragment){ |
|
271 HBufC16* xmlBuffer = fragment.AsElement().AsXmlUnicodeL();//Parent()-> |
|
272 CleanupStack::PushL( xmlBuffer ); |
|
273 TPtr16 ptr = xmlBuffer->Des(); |
|
274 if (ptr.Length()){ |
|
275 RDebug::Print( _L( "WSModTester: xmlBuffer length [%d]"),ptr.Length()); |
|
276 if (ptr.Length()<=254){//below string must be =< max byte value |
|
277 RDebug::Print( _L( "WSModTester: xmlBuffer #START#")); |
|
278 RDebug::Print( _L( "[%S]"),&ptr); |
|
279 RDebug::Print( _L( "WSModTester: xmlBuffer #END#")); |
|
280 } |
|
281 else |
|
282 RDebug::Print( _L( "WSModTester: xmlBuffer too long to display, must be <=256- 2//[]")); |
|
283 } |
|
284 else |
|
285 RDebug::Print( _L( "WSModTester: xmlBuffer empty")); |
|
286 return ptr; |
|
287 } |
|
288 |
|
289 TPtr16 CSenUtilsBCTest::ConvertToPtr16LC(MSenElement &element){ |
|
290 HBufC16* xmlBuffer = element.AsXmlUnicodeL();//Parent()-> |
|
291 CleanupStack::PushL( xmlBuffer ); |
|
292 TPtr16 ptr = xmlBuffer->Des(); |
|
293 if (ptr.Length() > 0){ |
|
294 RDebug::Print( _L( "WSModTester: xmlBuffer length [%d]"),ptr.Length()); |
|
295 if (ptr.Length()<=254){//below string must be =< max byte value |
|
296 RDebug::Print( _L( "WSModTester: xmlBuffer #START#")); |
|
297 RDebug::Print( _L( "[%S]"),&ptr); |
|
298 RDebug::Print( _L( "WSModTester: xmlBuffer #END#")); |
|
299 } |
|
300 else |
|
301 RDebug::Print( _L( "WSModTester: xmlBuffer too long to display, must be <=256- 2//[]")); |
|
302 } |
|
303 else |
|
304 RDebug::Print( _L( "WSModTester: xmlBuffer empty")); |
|
305 return ptr; |
|
306 } |
|
307 |
|
308 TInt CSenUtilsBCTest::CSenSoapEnvelope_NewLL( TTestResult& aResult ) |
|
309 { |
|
310 SetupL(); |
|
311 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
312 CleanupStack::PushL(env); |
|
313 /*EUNIT_ASSERT_NOT_EQUALS(env, (CSenSoapEnvelope*)NULL);*/ |
|
314 TL(env != (CSenSoapEnvelope*)NULL); |
|
315 //checking xml |
|
316 _LIT16(KRef, "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"/>"); |
|
317 TPtrC16 ptrRef = KRef(); |
|
318 /*EUNIT_ASSERT_EQUALS(ConvertToPtr16LC(*env), ptrRef);*/ |
|
319 TL(ConvertToPtr16LC(*env) == ptrRef); |
|
320 CleanupStack::PopAndDestroy();//Ptr |
|
321 CleanupStack::Pop(env); |
|
322 /*EUNIT_ASSERT_NO_LEAVE(delete env);*/ |
|
323 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
324 env = NULL; |
|
325 Teardown(); |
|
326 return KErrNone; |
|
327 } |
|
328 |
|
329 TInt CSenUtilsBCTest::CSenSoapEnvelope_SetBodyLL( TTestResult& aResult ) |
|
330 { |
|
331 SetupL(); |
|
332 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
333 /*EUNIT_ASSERT_NOT_EQUALS(env, (CSenSoapEnvelope*)NULL); */ |
|
334 TL(env != (CSenSoapEnvelope*)NULL); |
|
335 _LIT8(KBody,"ComarchBody"); |
|
336 TPtrC8 result = env->SetBodyL(KBody); |
|
337 |
|
338 _LIT16(KRef2, "ComarchBody"); |
|
339 TPtrC16 result16(reinterpret_cast<const TUint16*>(result.Ptr()),(result.Size()/2)); |
|
340 RDebug::Print( _L( "WSModTester: body [%S]"),&result16); |
|
341 /*EUNIT_ASSERT_EQUALS(result, KBody);*/ |
|
342 TL(result == KBody); |
|
343 _LIT16(KRef, "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Body>ComarchBody</S:Body></S:Envelope>"); |
|
344 /*EUNIT_ASSERT_EQUALS(ConvertToPtr16LC(*env), KRef);*/ |
|
345 TL(ConvertToPtr16LC(*env) == KRef); |
|
346 CleanupStack::PopAndDestroy();//Ptr |
|
347 |
|
348 /*EUNIT_ASSERT_NO_LEAVE(delete env);*/ |
|
349 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
350 env = NULL; |
|
351 Teardown(); |
|
352 return KErrNone; |
|
353 } |
|
354 |
|
355 TInt CSenUtilsBCTest::CSenSoapEnvelope_BodyLL( TTestResult& aResult ) |
|
356 { |
|
357 SetupL(); |
|
358 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
359 /*EUNIT_ASSERT_NOT_EQUALS(env, (CSenSoapEnvelope*)NULL); */ |
|
360 TL(env != (CSenSoapEnvelope*)NULL); |
|
361 _LIT8(KBody,"ComarchBody"); |
|
362 env->SetBodyL(KBody); |
|
363 |
|
364 CSenElement& element = env->BodyL(); |
|
365 |
|
366 _LIT16(KRef, "<S:Body>ComarchBody</S:Body>"); |
|
367 /*EUNIT_ASSERT_EQUALS(ConvertToPtr16LC(element), KRef);*/ |
|
368 TL(ConvertToPtr16LC(element) == KRef); |
|
369 CleanupStack::PopAndDestroy();//Ptr |
|
370 |
|
371 /*EUNIT_ASSERT_NO_LEAVE(delete env);*/ |
|
372 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
373 env = NULL; |
|
374 |
|
375 Teardown(); |
|
376 return KErrNone; |
|
377 } |
|
378 |
|
379 TInt CSenUtilsBCTest::CSenSoapEnvelope_HeaderLL( TTestResult& aResult ) |
|
380 { |
|
381 SetupL(); |
|
382 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
383 /*EUNIT_ASSERT_NOT_EQUALS(env, (CSenSoapEnvelope*)NULL); */ |
|
384 TL(env != (CSenSoapEnvelope*)NULL); |
|
385 CSenBaseElement* el = CSenBaseElement::NewL(KText); |
|
386 env->AddHeaderL(*el); |
|
387 el = &(CSenBaseElement&)env->HeaderL(); |
|
388 |
|
389 _LIT16(KRef, "<S:Header><text/></S:Header>"); |
|
390 /*EUNIT_ASSERT_EQUALS(ConvertToPtr16LC(*el), KRef);*/ |
|
391 TL(ConvertToPtr16LC(*el)== KRef); |
|
392 CleanupStack::PopAndDestroy();//Ptr |
|
393 |
|
394 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
395 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
396 env = NULL; |
|
397 Teardown(); |
|
398 return KErrNone; |
|
399 } |
|
400 |
|
401 TInt CSenUtilsBCTest::CSenSoapEnvelope_AddHeaderLL( TTestResult& aResult ) |
|
402 { |
|
403 SetupL(); |
|
404 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
405 /*EUNIT_ASSERT_NOT_EQUALS*/TL(env != (CSenSoapEnvelope*)NULL); |
|
406 |
|
407 CSenBaseElement* el = CSenBaseElement::NewL(KText); |
|
408 //el = &(CSenBaseElement&) env->AddHeaderL(*el);//ok |
|
409 el = &(CSenBaseElement&) env->AddHeaderL(*el);//ok |
|
410 //checking xml |
|
411 _LIT16(KRef, "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Header><text/></S:Header><S:Body/></S:Envelope>"); |
|
412 TL(ConvertToPtr16LC(*env) == KRef); |
|
413 CleanupStack::PopAndDestroy();//Ptr |
|
414 |
|
415 _LIT16(KRef2, "<text/>"); |
|
416 TL(ConvertToPtr16LC(*el)== KRef2); |
|
417 CleanupStack::PopAndDestroy();//Ptr |
|
418 |
|
419 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
420 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
421 env = NULL; |
|
422 Teardown(); |
|
423 return KErrNone; |
|
424 } |
|
425 |
|
426 TInt CSenUtilsBCTest::CSenSoapEnvelope_BodyAsStringLL( TTestResult& aResult ) |
|
427 { |
|
428 SetupL(); |
|
429 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
430 /*EUNIT_ASSERT_NOT_EQUALS*/TL(env != (CSenSoapEnvelope*)NULL); |
|
431 |
|
432 _LIT8(KBody,"ComarchBody"); |
|
433 env->SetBodyL(KBody); |
|
434 HBufC8* str = env->BodyAsStringL(); |
|
435 |
|
436 _LIT8(KRef, "<S:Body xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">ComarchBody</S:Body>"); |
|
437 TPtrC8 ptrRef = KRef(); |
|
438 TPtr8 ptr = str->Des(); |
|
439 TL(ptr == ptrRef); |
|
440 |
|
441 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
442 __ASSERT_ALWAYS_NO_LEAVE(delete str); |
|
443 str = NULL; |
|
444 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
445 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
446 env = NULL; |
|
447 Teardown(); |
|
448 return KErrNone; |
|
449 } |
|
450 |
|
451 TInt CSenUtilsBCTest::CSenSoapEnvelope_DetachFaultLL( TTestResult& aResult ) |
|
452 { |
|
453 SetupL(); |
|
454 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
455 env->SetReader( *iXmlReader ); |
|
456 iXmlReader->SetContentHandler(*env); |
|
457 env->ParseL(KFaultMessage); |
|
458 CSenSoapFault* fault = env->DetachFaultL(); |
|
459 |
|
460 //checking Envelope without Fault |
|
461 _LIT16(KRefEnvFault, "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Body/></S:Envelope>"); |
|
462 TPtrC16 ptrRefEnvFault = KRefEnvFault(); |
|
463 TL(ConvertToPtr16LC(*env) == ptrRefEnvFault); |
|
464 CleanupStack::PopAndDestroy();//Ptr |
|
465 |
|
466 //checking Fault |
|
467 _LIT16(KRefFault, "<S:Fault xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><faultcode>VersionMismatch</faultcode><faultstring>some string</faultstring><faultactor>some actor</faultactor><detail>bla bla</detail></S:Fault>"); |
|
468 TPtrC16 ptrRefFault = KRefFault(); |
|
469 TL(ConvertToPtr16LC(*fault) == ptrRefFault); |
|
470 CleanupStack::PopAndDestroy();//Ptr |
|
471 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
472 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
473 env = NULL; |
|
474 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
475 __ASSERT_ALWAYS_NO_LEAVE(delete fault); |
|
476 fault = NULL; |
|
477 |
|
478 |
|
479 env = CSenSoapEnvelope::NewL(); |
|
480 env->SetReader( *iXmlReader ); |
|
481 iXmlReader->SetContentHandler(*env); |
|
482 env->ParseL(KSOAPMessage); |
|
483 TL(env->DetachFaultL() == (CSenSoapFault* )NULL); |
|
484 //checking Envelope not touched should be |
|
485 _LIT16(KRefEnv, "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Header/><S:Body><QueryResponse><Data>Hard Coded response, alway the same</Data></QueryResponse></S:Body></S:Envelope>"); |
|
486 TPtrC16 ptrRefEnv = KRefEnv(); |
|
487 TL(ConvertToPtr16LC(*env) == ptrRefEnv); |
|
488 CleanupStack::PopAndDestroy();//Ptr |
|
489 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
490 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
491 env = NULL; |
|
492 Teardown(); |
|
493 return KErrNone; |
|
494 } |
|
495 |
|
496 TInt CSenUtilsBCTest::CSenSoapEnvelope_FaultLL( TTestResult& aResult ) |
|
497 { |
|
498 SetupL(); |
|
499 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
500 env->SetReader( *iXmlReader ); |
|
501 iXmlReader->SetContentHandler(*env); |
|
502 |
|
503 |
|
504 env->ParseL(KFaultMessage); |
|
505 CSenSoapFault* fault = env->FaultL(); |
|
506 |
|
507 //checking Envelope, still Fault exist |
|
508 _LIT16(KRefEnvFault, "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Body><S:Fault><faultcode>VersionMismatch</faultcode><faultstring>some string</faultstring><faultactor>some actor</faultactor><detail>bla bla</detail></S:Fault></S:Body></S:Envelope>"); |
|
509 TL(ConvertToPtr16LC(*env)== KRefEnvFault); |
|
510 CleanupStack::PopAndDestroy();//Ptr |
|
511 //checking Fault |
|
512 _LIT16(KRefFault, "<S:Fault><faultcode>VersionMismatch</faultcode><faultstring>some string</faultstring><faultactor>some actor</faultactor><detail>bla bla</detail></S:Fault>"); |
|
513 TL(ConvertToPtr16LC(*fault) == KRefFault); |
|
514 CleanupStack::PopAndDestroy();//Ptr |
|
515 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
516 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
517 env = NULL; |
|
518 |
|
519 |
|
520 env = CSenSoapEnvelope::NewL(); |
|
521 env->SetReader( *iXmlReader ); |
|
522 iXmlReader->SetContentHandler(*env); |
|
523 env->ParseL(KSOAPMessage); |
|
524 TL(env->FaultL() == (CSenSoapFault* )NULL); |
|
525 //checking Envelope not touched should be |
|
526 _LIT16(KRefEnv, "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Header/><S:Body><QueryResponse><Data>Hard Coded response, alway the same</Data></QueryResponse></S:Body></S:Envelope>"); |
|
527 TL(ConvertToPtr16LC(*env) == KRefEnv); |
|
528 CleanupStack::PopAndDestroy();//Ptr |
|
529 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
530 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
531 env = NULL; |
|
532 Teardown(); |
|
533 return KErrNone; |
|
534 } |
|
535 |
|
536 TInt CSenUtilsBCTest::CSenSoapEnvelope_SoapActionL( TTestResult& aResult ) |
|
537 { |
|
538 SetupL(); |
|
539 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
540 /*EUNIT_ASSERT_NOT_EQUALS*/TL(env != (CSenSoapEnvelope*)NULL); |
|
541 |
|
542 _LIT8(KRef, "\"\""); |
|
543 _LIT8(KRef2, "\"URI-referenceRFC2396\""); |
|
544 _LIT8(KRef3, ""); |
|
545 TL(env->SoapAction() == KRef); |
|
546 env->SetSoapActionL(_L8("URI-referenceRFC2396")); |
|
547 TL(env->SoapAction() == KRef2); |
|
548 env->SetSoapActionL(KRef2); |
|
549 TL(env->SoapAction() == KRef2); |
|
550 |
|
551 env->SetSoapActionL(KRef3); |
|
552 TL(env->SoapAction() == KRef3); |
|
553 |
|
554 |
|
555 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
556 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
557 env = NULL; |
|
558 Teardown(); |
|
559 return KErrNone; |
|
560 } |
|
561 |
|
562 TInt CSenUtilsBCTest::CSenSoapEnvelope_SoapAction2L( TTestResult& aResult ) |
|
563 { |
|
564 SetupL(); |
|
565 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
566 /*EUNIT_ASSERT_NOT_EQUALS*/TL(env != (CSenSoapEnvelope*)NULL); |
|
567 |
|
568 _LIT8(KRef, ""); |
|
569 _LIT8(KRef2, "\"URI-referenceRFC2396\""); |
|
570 |
|
571 TL(env->SoapAction2() == KRef); |
|
572 env->SetSoapActionL(_L8("URI-referenceRFC2396")); |
|
573 TL(env->SoapAction2() == KRef2); |
|
574 env->SetSoapActionL(KRef2); |
|
575 TL(env->SoapAction2() == KRef2); |
|
576 |
|
577 |
|
578 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
579 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
580 env = NULL; |
|
581 Teardown(); |
|
582 return KErrNone; |
|
583 } |
|
584 |
|
585 TInt CSenUtilsBCTest::CSenSoapEnvelope_HasHeaderL( TTestResult& aResult ) |
|
586 { |
|
587 SetupL(); |
|
588 |
|
589 _LIT8(KHeaderElementName, "HeaderElement"); |
|
590 _LIT8(KHeaderContent, "HeaderContent"); |
|
591 |
|
592 CSenSoapEnvelope* pEnvelope = CSenSoapEnvelope::NewL(); |
|
593 |
|
594 if(!( pEnvelope->HasHeader() == EFalse )) return KErrArgument; |
|
595 CSenBaseElement* el = CSenBaseElement::NewL(KText); |
|
596 pEnvelope->AddHeaderL(*el); |
|
597 if(( pEnvelope->HasHeader() == EFalse )) return KErrArgument; |
|
598 |
|
599 |
|
600 __ASSERT_ALWAYS_NO_LEAVE(delete pEnvelope); |
|
601 pEnvelope = NULL; |
|
602 Teardown(); |
|
603 return KErrNone; |
|
604 |
|
605 //EUNIT_ASSERT_NO_LEAVE(delete el); |
|
606 //el = NULL; |
|
607 } |
|
608 |
|
609 TInt CSenUtilsBCTest::CSenSoapEnvelope_SoapVersionL( TTestResult& aResult ) |
|
610 { |
|
611 SetupL(); |
|
612 |
|
613 TSOAPVersion var = ESOAP11; |
|
614 CSenSoapEnvelope* pEnvelope = CSenSoapEnvelope::NewL(); |
|
615 CleanupStack::PushL(pEnvelope); |
|
616 |
|
617 TL(var == pEnvelope->SoapVersion()); |
|
618 CleanupStack::PopAndDestroy(pEnvelope); |
|
619 Teardown(); |
|
620 return KErrNone; |
|
621 |
|
622 } |
|
623 |
|
624 TInt CSenUtilsBCTest::CSenSoapEnvelope_HasBodyL( TTestResult& aResult ) |
|
625 { |
|
626 SetupL(); |
|
627 |
|
628 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
629 TL(env != (CSenSoapEnvelope*)NULL); |
|
630 |
|
631 _LIT8(KBody,"ComarchBody"); |
|
632 TPtrC8 result = env->SetBodyL(KBody); |
|
633 if(( env->HasBody() == EFalse )) return KErrArgument; |
|
634 |
|
635 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
636 env = NULL; |
|
637 |
|
638 CSenSoapEnvelope* env1 = CSenSoapEnvelope::NewL(); |
|
639 TL(env1 != (CSenSoapEnvelope*)NULL); |
|
640 |
|
641 if(!( env1->HasBody() == EFalse )) return KErrArgument; |
|
642 |
|
643 __ASSERT_ALWAYS_NO_LEAVE(delete env1); |
|
644 env1 = NULL; |
|
645 Teardown(); |
|
646 return KErrNone; |
|
647 |
|
648 } |
|
649 |
|
650 TInt CSenUtilsBCTest::CSenSoapEnvelope_IsFaultL( TTestResult& aResult ) |
|
651 { |
|
652 SetupL(); |
|
653 |
|
654 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
655 TL(env!= (CSenSoapEnvelope*)NULL); |
|
656 if(!( env->IsFault() == EFalse )) return KErrArgument; |
|
657 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
658 env = NULL; |
|
659 Teardown(); |
|
660 return KErrNone; |
|
661 |
|
662 } |
|
663 |
|
664 TInt CSenUtilsBCTest::CSenSoapEnvelope_ParseLL( TTestResult& aResult ) |
|
665 { |
|
666 SetupL(); |
|
667 _LIT8(KInputString, "<S:Envelope \ |
|
668 xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">\ |
|
669 <S:Header>\ |
|
670 <sb:Correlation xmlns:sb=\"urn:liberty:sb:2003-08\" \ |
|
671 messageID=\"URN:UUID:860949DC-134D-A989-E328-2FD7F20E31CE\" timestamp=\"2006-06-01T14:53:19Z\"/>\ |
|
672 <wsse:Security xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2003/06/secext\"/>\ |
|
673 </S:Header>\ |
|
674 <S:Body>\ |
|
675 <sa:SASLRequest xmlns:sa=\"urn:liberty:sa:2004-04\" mechanism=\"ANONYMOUS PLAIN CRAM-MD5\" authzID=\"testuser1\"/>\ |
|
676 </S:Body>\ |
|
677 </S:Envelope>"); |
|
678 _LIT8(KBodyAsString, "\ |
|
679 <S:Body xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:sa=\"urn:liberty:sa:2004-04\">\ |
|
680 <sa:SASLRequest xmlns:sa=\"urn:liberty:sa:2004-04\" mechanism=\"ANONYMOUS PLAIN CRAM-MD5\" authzID=\"testuser1\"/>\ |
|
681 </S:Body>"); |
|
682 |
|
683 _LIT8(KEmptyBodyAsString, "<S:Body/>"); |
|
684 |
|
685 _LIT8(KEmptyBodyWithNsAsString, "<S:Body xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"/>"); |
|
686 CSenParser* pParser = CSenParser::NewLC(); |
|
687 CSenSoapEnvelope* pEnvelope = CSenSoapEnvelope::NewL(); |
|
688 pEnvelope->SetReader( *iXmlReader ); |
|
689 iXmlReader->SetContentHandler(*pEnvelope); |
|
690 |
|
691 CleanupStack::PushL(pEnvelope); |
|
692 |
|
693 |
|
694 pEnvelope->ParseL(KInputString); |
|
695 |
|
696 CleanupStack::PopAndDestroy(pEnvelope); |
|
697 CleanupStack::PopAndDestroy(pParser); |
|
698 Teardown(); |
|
699 return KErrNone; |
|
700 } |
|
701 |
|
702 |
|
703 |
|
704 TInt CSenUtilsBCTest::CSenSoapFault_NewLL( TTestResult& aResult ) |
|
705 { |
|
706 SetupL(); |
|
707 RAttributeArray attributeArray; |
|
708 _LIT8(KFault, "Fault"); |
|
709 CSenSoapFault* soapFault = CSenSoapFault::NewL(KFault, KFault, KFault, attributeArray); |
|
710 CleanupStack::PushL(soapFault); |
|
711 /*EUNIT_ASSERT_NOT_EQUALS*/TL(soapFault != (CSenSoapFault*)NULL); |
|
712 |
|
713 //checking xml |
|
714 _LIT16(KRef, "<Fault xmlns=\"Fault\"/>"); |
|
715 TPtrC16 ptrRef = KRef(); |
|
716 TL(ConvertToPtr16LC(*soapFault) == ptrRef); |
|
717 CleanupStack::PopAndDestroy();//Ptr |
|
718 CleanupStack::Pop(soapFault); |
|
719 attributeArray.Close(); |
|
720 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
721 __ASSERT_ALWAYS_NO_LEAVE(delete soapFault); |
|
722 soapFault = NULL; |
|
723 Teardown(); |
|
724 return KErrNone; |
|
725 } |
|
726 |
|
727 TInt CSenUtilsBCTest::CSenSoapFault_NewL_1L( TTestResult& aResult ) |
|
728 { |
|
729 SetupL(); |
|
730 RAttributeArray attributeArray; |
|
731 _LIT8(KFault, "Fault"); |
|
732 CSenSoapFault* orgSoapFault = CSenSoapFault::NewL(KFault, KFault, KFault, attributeArray); |
|
733 CSenSoapFault* soapFault = CSenSoapFault::NewL(*orgSoapFault); |
|
734 /*EUNIT_ASSERT_NOT_EQUALS*/TL(soapFault != (CSenSoapFault*)NULL); |
|
735 |
|
736 //checking xml |
|
737 _LIT16(KRef, "<Fault xmlns=\"Fault\"/>"); |
|
738 TL(ConvertToPtr16LC(*soapFault) == KRef); |
|
739 CleanupStack::PopAndDestroy();//Ptr |
|
740 |
|
741 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
742 __ASSERT_ALWAYS_NO_LEAVE(delete orgSoapFault); |
|
743 orgSoapFault = NULL; |
|
744 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
745 __ASSERT_ALWAYS_NO_LEAVE(delete soapFault); |
|
746 soapFault = NULL; |
|
747 Teardown(); |
|
748 return KErrNone; |
|
749 } |
|
750 |
|
751 TInt CSenUtilsBCTest::CSenSoapFault_FaultCodeL( TTestResult& aResult ) |
|
752 { |
|
753 SetupL(); |
|
754 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
755 env->SetReader( *iXmlReader ); |
|
756 iXmlReader->SetContentHandler(*env); |
|
757 env->ParseL(KFaultMessage); |
|
758 CSenSoapFault* fault = env->DetachFaultL(); |
|
759 //not empty |
|
760 _LIT8(KCode, "VersionMismatch"); |
|
761 |
|
762 __ASSERT_ALWAYS_NO_LEAVE(fault->FaultCode()); |
|
763 TL(fault->FaultCode()== KCode); |
|
764 //TPtrC16 result16(reinterpret_cast<const TUint16*>(fault->FaultCode().Ptr()),(fault->FaultCode().Size()/2)); |
|
765 //RDebug::Print( _L( "WSModTester: faultCode [%S]"),&result16); |
|
766 |
|
767 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
768 __ASSERT_ALWAYS_NO_LEAVE(delete fault); |
|
769 fault = NULL; |
|
770 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
771 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
772 env = NULL; |
|
773 |
|
774 //empty |
|
775 RAttributeArray attributeArray; |
|
776 fault = CSenSoapFault::NewL(KText, KText, KText, attributeArray); |
|
777 __ASSERT_ALWAYS_NO_LEAVE(fault->FaultCode()); |
|
778 TL(fault->FaultCode() == KNullDesC8); |
|
779 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
780 __ASSERT_ALWAYS_NO_LEAVE(delete fault); |
|
781 fault = NULL; |
|
782 Teardown(); |
|
783 return KErrNone; |
|
784 } |
|
785 |
|
786 TInt CSenUtilsBCTest::CSenSoapFault_FaultSubcodeL( TTestResult& aResult ) |
|
787 { |
|
788 SetupL(); |
|
789 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
790 env->SetReader( *iXmlReader ); |
|
791 iXmlReader->SetContentHandler(*env); |
|
792 env->ParseL(KFaultMessage); |
|
793 CSenSoapFault* fault = env->DetachFaultL(); |
|
794 |
|
795 |
|
796 //empty |
|
797 RAttributeArray attributeArray; |
|
798 fault = CSenSoapFault::NewL(KText, KText, KText, attributeArray); |
|
799 __ASSERT_ALWAYS_NO_LEAVE(fault->FaultSubcode()); |
|
800 TL(fault->FaultSubcode() == KNullDesC8); |
|
801 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
802 __ASSERT_ALWAYS_NO_LEAVE(delete fault); |
|
803 fault = NULL; |
|
804 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
805 env = NULL; |
|
806 |
|
807 Teardown(); |
|
808 return KErrNone; |
|
809 } |
|
810 |
|
811 TInt CSenUtilsBCTest::CSenSoapFault_FaultStringL( TTestResult& aResult ) |
|
812 { |
|
813 SetupL(); |
|
814 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
815 env->SetReader( *iXmlReader ); |
|
816 iXmlReader->SetContentHandler(*env); |
|
817 env->ParseL(KFaultMessage); |
|
818 CSenSoapFault* fault = env->DetachFaultL(); |
|
819 //not empty |
|
820 _LIT8(KString, "some string"); |
|
821 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
822 __ASSERT_ALWAYS_NO_LEAVE(fault->FaultString()); |
|
823 TL(fault->FaultString() == KString); |
|
824 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
825 __ASSERT_ALWAYS_NO_LEAVE(delete fault); |
|
826 fault = NULL; |
|
827 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
828 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
829 env = NULL; |
|
830 |
|
831 //empty |
|
832 RAttributeArray attributeArray; |
|
833 fault = CSenSoapFault::NewL(KText, KText, KText, attributeArray); |
|
834 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
835 __ASSERT_ALWAYS_NO_LEAVE(fault->FaultString()); |
|
836 TL(fault->FaultString() == KNullDesC8); |
|
837 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
838 __ASSERT_ALWAYS_NO_LEAVE(delete fault); |
|
839 fault = NULL; |
|
840 Teardown(); |
|
841 return KErrNone; |
|
842 } |
|
843 |
|
844 TInt CSenUtilsBCTest::CSenSoapFault_FaultActorL( TTestResult& aResult ) |
|
845 { |
|
846 SetupL(); |
|
847 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
848 env->SetReader( *iXmlReader ); |
|
849 iXmlReader->SetContentHandler(*env); |
|
850 env->ParseL(KFaultMessage); |
|
851 CSenSoapFault* fault = env->DetachFaultL(); |
|
852 //not empty |
|
853 _LIT8(KActor, "some actor"); |
|
854 /*EUNIT_ASSERT_NO_LEAVEP*/ |
|
855 __ASSERT_ALWAYS_NO_LEAVE(fault->FaultActor()); |
|
856 TL(fault->FaultActor() == KActor); |
|
857 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
858 __ASSERT_ALWAYS_NO_LEAVE(delete fault); |
|
859 fault = NULL; |
|
860 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
861 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
862 env = NULL; |
|
863 |
|
864 //empty |
|
865 RAttributeArray attributeArray; |
|
866 fault = CSenSoapFault::NewL(KText, KText, KText, attributeArray); |
|
867 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
868 __ASSERT_ALWAYS_NO_LEAVE(fault->FaultActor()); |
|
869 TL(fault->FaultActor() == KNullDesC8); |
|
870 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
871 __ASSERT_ALWAYS_NO_LEAVE(delete fault); |
|
872 fault = NULL; |
|
873 Teardown(); |
|
874 return KErrNone; |
|
875 } |
|
876 |
|
877 TInt CSenUtilsBCTest::CSenSoapFault_DetailL( TTestResult& aResult ) |
|
878 { |
|
879 SetupL(); |
|
880 CSenSoapEnvelope* env = CSenSoapEnvelope::NewL(); |
|
881 env->SetReader( *iXmlReader ); |
|
882 iXmlReader->SetContentHandler(*env); |
|
883 env->ParseL(KFaultMessage); |
|
884 CSenSoapFault* fault = env->DetachFaultL(); |
|
885 //not empty |
|
886 _LIT8(KDetail, "bla bla"); |
|
887 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
888 __ASSERT_ALWAYS_NO_LEAVE(fault->Detail()); |
|
889 TL(fault->Detail() == KDetail); |
|
890 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
891 __ASSERT_ALWAYS_NO_LEAVE(delete fault); |
|
892 fault = NULL; |
|
893 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
894 __ASSERT_ALWAYS_NO_LEAVE(delete env); |
|
895 env = NULL; |
|
896 |
|
897 //empty |
|
898 RAttributeArray attributeArray; |
|
899 fault = CSenSoapFault::NewL(KText, KText, KText, attributeArray); |
|
900 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
901 __ASSERT_ALWAYS_NO_LEAVE(fault->Detail()); |
|
902 TL(fault->Detail() == KNullDesC8); |
|
903 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
904 __ASSERT_ALWAYS_NO_LEAVE(delete fault); |
|
905 fault = NULL; |
|
906 Teardown(); |
|
907 return KErrNone; |
|
908 } |
|
909 |
|
910 TInt CSenUtilsBCTest::CSenSoapMessage_NewLL( TTestResult& aResult ) |
|
911 { |
|
912 SetupL(); |
|
913 CSenSoapMessage* msg = CSenSoapMessage::NewL(); |
|
914 /*EUNIT_ASSERT_NOT_EQUALS*/TL(msg != (CSenSoapMessage*)NULL); |
|
915 |
|
916 //checking xml |
|
917 _LIT16(KRef, "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"/>"); |
|
918 TL(ConvertToPtr16LC(*msg) == KRef); |
|
919 CleanupStack::PopAndDestroy();//Ptr |
|
920 |
|
921 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
922 __ASSERT_ALWAYS_NO_LEAVE(delete msg); |
|
923 msg = NULL; |
|
924 Teardown(); |
|
925 return KErrNone; |
|
926 } |
|
927 |
|
928 TInt CSenUtilsBCTest::CSenSoapMessage_SetSecurityHeaderLL( TTestResult& aResult ) |
|
929 { |
|
930 SetupL(); |
|
931 CSenSoapMessage* msg = CSenSoapMessage::NewL(); |
|
932 /*EUNIT_ASSERT_NOT_EQUALS*/TL(msg != (CSenSoapMessage*)NULL); |
|
933 |
|
934 |
|
935 msg->SetSecurityHeaderL(KText); |
|
936 //checking xml |
|
937 _LIT16(KRef, "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Header><wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">text</wsse:Security></S:Header><S:Body/></S:Envelope>"); |
|
938 TPtrC16 ptrRef = KRef(); |
|
939 TL(ConvertToPtr16LC(*msg) == ptrRef); |
|
940 CleanupStack::PopAndDestroy();//Ptr |
|
941 |
|
942 msg->SetSecurityHeaderL(KText2); |
|
943 //checking xml |
|
944 _LIT16(KRef2, "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Header><wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">text2</wsse:Security></S:Header><S:Body/></S:Envelope>"); |
|
945 TPtrC16 ptrRef2 = KRef2(); |
|
946 TL(ConvertToPtr16LC(*msg) == ptrRef2); |
|
947 CleanupStack::PopAndDestroy();//Ptr |
|
948 |
|
949 |
|
950 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
951 __ASSERT_ALWAYS_NO_LEAVE(delete msg); |
|
952 msg = NULL; |
|
953 Teardown(); |
|
954 return KErrNone; |
|
955 } |
|
956 |
|
957 TInt CSenUtilsBCTest::CSenSoapMessage_AddSecurityTokenLL( TTestResult& aResult ) |
|
958 { |
|
959 SetupL(); |
|
960 CSenSoapMessage* msg = CSenSoapMessage::NewL(); |
|
961 /*EUNIT_ASSERT_NOT_EQUALS*/TL(msg != (CSenSoapMessage*)NULL); |
|
962 |
|
963 |
|
964 /*EUNIT_ASSERT*/TL(msg->AddSecurityTokenL(KText)==KErrNone); |
|
965 //checking xml |
|
966 _LIT16(KRef, "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Header><wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">text</wsse:Security></S:Header><S:Body/></S:Envelope>"); |
|
967 TPtrC16 ptrRef = KRef(); |
|
968 TL(ConvertToPtr16LC(*msg) == ptrRef); |
|
969 CleanupStack::PopAndDestroy();//Ptr |
|
970 |
|
971 /*EUNIT_ASSERT*/TL(msg->AddSecurityTokenL(KText2)==KErrNone); |
|
972 //checking xml |
|
973 _LIT16(KRef2, "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Header><wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">texttext2</wsse:Security></S:Header><S:Body/></S:Envelope>"); |
|
974 TPtrC16 ptrRef2 = KRef2(); |
|
975 TL(ConvertToPtr16LC(*msg) == ptrRef2); |
|
976 CleanupStack::PopAndDestroy();//Ptr |
|
977 |
|
978 |
|
979 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
980 __ASSERT_ALWAYS_NO_LEAVE(delete msg); |
|
981 msg = NULL; |
|
982 Teardown(); |
|
983 return KErrNone; |
|
984 } |
|
985 |
|
986 TInt CSenUtilsBCTest::CSenSoapMessage_ParseLL( TTestResult& aResult ) |
|
987 { |
|
988 SetupL(); |
|
989 _LIT8(KInputString, "<S:Envelope \ |
|
990 xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">\ |
|
991 <S:Header>\ |
|
992 <sb:Correlation xmlns:sb=\"urn:liberty:sb:2003-08\" \ |
|
993 messageID=\"URN:UUID:860949DC-134D-A989-E328-2FD7F20E31CE\" timestamp=\"2006-06-01T14:53:19Z\"/>\ |
|
994 <wsse:Security xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2003/06/secext\"/>\ |
|
995 </S:Header>\ |
|
996 <S:Body>\ |
|
997 <sa:SASLRequest xmlns:sa=\"urn:liberty:sa:2004-04\" mechanism=\"ANONYMOUS PLAIN CRAM-MD5\" authzID=\"testuser1\"/>\ |
|
998 </S:Body>\ |
|
999 </S:Envelope>"); |
|
1000 _LIT8(KBodyAsString, "\ |
|
1001 <S:Body xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:sa=\"urn:liberty:sa:2004-04\">\ |
|
1002 <sa:SASLRequest xmlns:sa=\"urn:liberty:sa:2004-04\" mechanism=\"ANONYMOUS PLAIN CRAM-MD5\" authzID=\"testuser1\"/>\ |
|
1003 </S:Body>"); |
|
1004 |
|
1005 _LIT8(KEmptyBodyAsString, "<S:Body/>"); |
|
1006 |
|
1007 _LIT8(KEmptyBodyWithNsAsString, "<S:Body xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"/>"); |
|
1008 CSenParser* pParser = CSenParser::NewLC(); |
|
1009 CSenSoapMessage* pMessage = CSenSoapMessage::NewL(); |
|
1010 pMessage->SetReader( *iXmlReader ); |
|
1011 iXmlReader->SetContentHandler(*pMessage); |
|
1012 |
|
1013 CleanupStack::PushL(pMessage); |
|
1014 |
|
1015 |
|
1016 pMessage->ParseL(KInputString); |
|
1017 |
|
1018 CleanupStack::PopAndDestroy(pMessage); |
|
1019 CleanupStack::PopAndDestroy(pParser); |
|
1020 Teardown(); |
|
1021 return KErrNone; |
|
1022 } |
|
1023 |
|
1024 |
|
1025 TInt CSenUtilsBCTest::CSenWsSecurityHeader_NewLL( TTestResult& aResult ) |
|
1026 { |
|
1027 SetupL(); |
|
1028 CSenWsSecurityHeader* hdr = CSenWsSecurityHeader::NewL(); |
|
1029 /*EUNIT_ASSERT_NOT_EQUALS*/TL(hdr != (CSenWsSecurityHeader*)NULL); |
|
1030 CleanupStack::PushL(hdr); |
|
1031 //checking xml |
|
1032 _LIT16(KRef, "<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"/>"); |
|
1033 TPtrC16 ptrRef = KRef(); |
|
1034 TL(ConvertToPtr16LC(*hdr) == ptrRef); |
|
1035 CleanupStack::PopAndDestroy();//Ptr |
|
1036 CleanupStack::Pop(hdr); |
|
1037 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
1038 __ASSERT_ALWAYS_NO_LEAVE(delete hdr); |
|
1039 hdr = NULL; |
|
1040 Teardown(); |
|
1041 return KErrNone; |
|
1042 } |
|
1043 |
|
1044 TInt CSenUtilsBCTest::CSenWsSecurityHeader_NewLCL( TTestResult& aResult ) |
|
1045 { |
|
1046 SetupL(); |
|
1047 CSenWsSecurityHeader* hdr = CSenWsSecurityHeader::NewLC(); |
|
1048 TL(hdr!= (CSenWsSecurityHeader*)NULL); |
|
1049 |
|
1050 //checking xml |
|
1051 _LIT16(KRef, "<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"/>"); |
|
1052 TPtrC16 ptrRef(KRef); |
|
1053 TL(ConvertToPtr16LC(*hdr)== ptrRef); |
|
1054 CleanupStack::PopAndDestroy(2);//Ptr |
|
1055 Teardown(); |
|
1056 return KErrNone; |
|
1057 } |
|
1058 |
|
1059 |
|
1060 TInt CSenUtilsBCTest::CSenWsSecurityHeader_NewLC_1L( TTestResult& aResult ) |
|
1061 { |
|
1062 SetupL(); |
|
1063 CSenWsSecurityHeader* hdr = CSenWsSecurityHeader::NewLC(KText); |
|
1064 TL(hdr!= (CSenWsSecurityHeader*)NULL); |
|
1065 |
|
1066 //checking xml |
|
1067 _LIT16(KRef, "<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">text</wsse:Security>"); |
|
1068 TPtrC16 ptrRef(KRef); |
|
1069 TL(ConvertToPtr16LC(*hdr)== ptrRef); |
|
1070 CleanupStack::PopAndDestroy(2); |
|
1071 |
|
1072 //EUNIT_ASSERT_NO_LEAVE(delete hdr); |
|
1073 hdr = NULL; |
|
1074 Teardown(); |
|
1075 return KErrNone; |
|
1076 } |
|
1077 |
|
1078 TInt CSenUtilsBCTest::CSenWsSecurityHeader_NewL_2L( TTestResult& aResult ) |
|
1079 { |
|
1080 SetupL(); |
|
1081 CSenWsSecurityHeader* hdr = CSenWsSecurityHeader::NewL(KText, KText); |
|
1082 TL(hdr!= (CSenWsSecurityHeader*)NULL); |
|
1083 CleanupStack::PushL(hdr); |
|
1084 //checking xml |
|
1085 _LIT16(KRef, "<wsse:Security xmlns:wsse=\"text\">text</wsse:Security>"); |
|
1086 TPtrC16 ptrRef(KRef); |
|
1087 TL(ConvertToPtr16LC(*hdr)== ptrRef); |
|
1088 CleanupStack::PopAndDestroy(2); |
|
1089 Teardown(); |
|
1090 return KErrNone; |
|
1091 } |
|
1092 |
|
1093 TInt CSenUtilsBCTest::CSenWsSecurityHeader_NewLC_2L( TTestResult& aResult ) |
|
1094 { |
|
1095 CSenWsSecurityHeader* hdr = CSenWsSecurityHeader::NewLC(KText, KText); |
|
1096 TL(hdr != (CSenWsSecurityHeader*)NULL); |
|
1097 |
|
1098 //checking xml |
|
1099 _LIT16(KRef, "<wsse:Security xmlns:wsse=\"text\">text</wsse:Security>"); |
|
1100 TPtrC16 ptrRef(KRef); |
|
1101 TL(ConvertToPtr16LC(*hdr)== ptrRef); |
|
1102 CleanupStack::PopAndDestroy(2); |
|
1103 Teardown(); |
|
1104 return KErrNone; |
|
1105 } |
|
1106 |
|
1107 |
|
1108 TInt CSenUtilsBCTest::CSenWsSecurityHeader_BinarySecurityTokenL_L( TTestResult& aResult ) |
|
1109 { |
|
1110 SetupL(); |
|
1111 //testing NULL |
|
1112 HBufC8* token=NULL; |
|
1113 TL(CSenWsSecurityHeader::BinarySecurityTokenL(KNullDesC8, token)==KErrNone); |
|
1114 TL(token != (HBufC8*)NULL); |
|
1115 //-----checking xml |
|
1116 _LIT8(KRef, "<wsse:BinarySecurityToken wsu:Id=\"token\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"></wsse:BinarySecurityToken>"); |
|
1117 TPtrC8 ptrRef(KRef); |
|
1118 TPtr8 ptrToken = token->Des(); |
|
1119 TL(ptrToken == ptrRef); |
|
1120 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1121 token = NULL; |
|
1122 |
|
1123 |
|
1124 //testing normal |
|
1125 TL(CSenWsSecurityHeader::BinarySecurityTokenL(KText, token)==KErrNone); |
|
1126 TL(token != (HBufC8*)NULL); |
|
1127 //-----checking xml |
|
1128 _LIT8(KRef2, "<wsse:BinarySecurityToken wsu:Id=\"token\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">text</wsse:BinarySecurityToken>"); |
|
1129 TPtrC8 ptrRef2(KRef2); |
|
1130 ptrToken = token->Des(); |
|
1131 TL(ptrToken == ptrRef2); |
|
1132 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1133 token = NULL; |
|
1134 Teardown(); |
|
1135 return KErrNone; |
|
1136 } |
|
1137 |
|
1138 TInt CSenUtilsBCTest::CSenWsSecurityHeader_BinarySecurityTokenL_1L( TTestResult& aResult ) |
|
1139 { |
|
1140 SetupL(); |
|
1141 //testing NULL |
|
1142 HBufC8* token=NULL; |
|
1143 TL(CSenWsSecurityHeader::BinarySecurityTokenL(KNullDesC8, KNullDesC8, token)==KErrNone); |
|
1144 TL(token != (HBufC8*)NULL); |
|
1145 //-----checking xml |
|
1146 _LIT8(KRef, "<wsse:BinarySecurityToken wsu:Id=\"token\" ValueType=\"\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"></wsse:BinarySecurityToken>"); |
|
1147 TPtrC8 ptrRef(KRef); |
|
1148 TPtr8 ptrToken = token->Des(); |
|
1149 TL(ptrToken == ptrRef); |
|
1150 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1151 token = NULL; |
|
1152 |
|
1153 |
|
1154 //testing normal |
|
1155 TL(CSenWsSecurityHeader::BinarySecurityTokenL(KText, KText, token)==KErrNone); |
|
1156 TL(token != (HBufC8*)NULL); |
|
1157 //-----checking xml |
|
1158 _LIT8(KRef2, "<wsse:BinarySecurityToken wsu:Id=\"token\" ValueType=\"text\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">text</wsse:BinarySecurityToken>"); |
|
1159 TPtrC8 ptrRef2(KRef2); |
|
1160 ptrToken = token->Des(); |
|
1161 TL(ptrToken == ptrRef2); |
|
1162 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1163 token = NULL; |
|
1164 Teardown(); |
|
1165 return KErrNone; |
|
1166 } |
|
1167 |
|
1168 TInt CSenUtilsBCTest::CSenWsSecurityHeader_TimestampL_L( TTestResult& aResult ) |
|
1169 { |
|
1170 SetupL(); |
|
1171 //testing NULL |
|
1172 HBufC8* timestamp=NULL; |
|
1173 TL(CSenWsSecurityHeader::TimestampL(KNullDesC8, timestamp)==KErrNone); |
|
1174 TL(timestamp != (HBufC8*)NULL); |
|
1175 //-----checking xml |
|
1176 _LIT8(KRef, "<wsu:Timestamp xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsu:Created></wsu:Created></wsu:Timestamp>"); |
|
1177 TPtrC8 ptrRef(KRef); |
|
1178 TPtr8 ptrToken = timestamp->Des(); |
|
1179 TL(ptrToken == ptrRef); |
|
1180 __ASSERT_ALWAYS_NO_LEAVE(delete timestamp); |
|
1181 timestamp = NULL; |
|
1182 |
|
1183 |
|
1184 //testing normal |
|
1185 TL(CSenWsSecurityHeader::TimestampL(KText, timestamp)==KErrNone); |
|
1186 TL(timestamp != (HBufC8*)NULL); |
|
1187 //-----checking xml |
|
1188 _LIT8(KRef2, "<wsu:Timestamp xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsu:Created>text</wsu:Created></wsu:Timestamp>"); |
|
1189 TPtrC8 ptrRef2(KRef2); |
|
1190 ptrToken = timestamp->Des(); |
|
1191 TL(ptrToken == ptrRef2); |
|
1192 __ASSERT_ALWAYS_NO_LEAVE(delete timestamp); |
|
1193 timestamp = NULL; |
|
1194 Teardown(); |
|
1195 return KErrNone; |
|
1196 } |
|
1197 |
|
1198 TInt CSenUtilsBCTest::CSenWsSecurityHeader_TimestampL_1L( TTestResult& aResult ) |
|
1199 { |
|
1200 SetupL(); |
|
1201 //testing NULL |
|
1202 HBufC8* timestamp=NULL; |
|
1203 TL(CSenWsSecurityHeader::TimestampL(KNullDesC8, KNullDesC8, timestamp)==KErrNone); |
|
1204 TL(timestamp != (HBufC8*)NULL); |
|
1205 //-----checking xml |
|
1206 _LIT8(KRef, "<wsu:Timestamp xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsu:Created></wsu:Created><wsu:Expires></wsu:Expires></wsu:Timestamp>"); |
|
1207 TPtrC8 ptrRef(KRef); |
|
1208 TPtr8 ptrToken = timestamp->Des(); |
|
1209 TL(ptrToken == ptrRef); |
|
1210 __ASSERT_ALWAYS_NO_LEAVE(delete timestamp); |
|
1211 timestamp = NULL; |
|
1212 |
|
1213 |
|
1214 TL(CSenWsSecurityHeader::TimestampL(KNullDesC8, KText, timestamp)==KErrNone); |
|
1215 TL(timestamp != (HBufC8*)NULL); |
|
1216 //-----checking xml |
|
1217 _LIT8(KRef2, "<wsu:Timestamp xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsu:Created></wsu:Created><wsu:Expires>text</wsu:Expires></wsu:Timestamp>"); |
|
1218 TPtrC8 ptrRef2(KRef2); |
|
1219 ptrToken = timestamp->Des(); |
|
1220 TL(ptrToken == ptrRef2); |
|
1221 __ASSERT_ALWAYS_NO_LEAVE(delete timestamp); |
|
1222 timestamp = NULL; |
|
1223 |
|
1224 TL(CSenWsSecurityHeader::TimestampL(KText, KNullDesC8, timestamp)==KErrNone); |
|
1225 TL(timestamp != (HBufC8*)NULL); |
|
1226 //-----checking xml |
|
1227 _LIT8(KRef3, "<wsu:Timestamp xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsu:Created>text</wsu:Created><wsu:Expires></wsu:Expires></wsu:Timestamp>"); |
|
1228 TPtrC8 ptrRef3(KRef3); |
|
1229 ptrToken = timestamp->Des(); |
|
1230 TL(ptrToken == ptrRef3); |
|
1231 __ASSERT_ALWAYS_NO_LEAVE(delete timestamp); |
|
1232 timestamp = NULL; |
|
1233 |
|
1234 //testing normal |
|
1235 TL(CSenWsSecurityHeader::TimestampL(KText, KText, timestamp)==KErrNone); |
|
1236 TL(timestamp != (HBufC8*)NULL); |
|
1237 //-----checking xml |
|
1238 _LIT8(KRef4, "<wsu:Timestamp xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsu:Created>text</wsu:Created><wsu:Expires>text</wsu:Expires></wsu:Timestamp>"); |
|
1239 TPtrC8 ptrRef4(KRef4); |
|
1240 ptrToken = timestamp->Des(); |
|
1241 TL(ptrToken == ptrRef4); |
|
1242 __ASSERT_ALWAYS_NO_LEAVE(delete timestamp); |
|
1243 timestamp = NULL; |
|
1244 Teardown(); |
|
1245 return KErrNone; |
|
1246 } |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 TInt CSenUtilsBCTest::CSenWsSecurityHeader_UsernameTokenL_2L( TTestResult& aResult ) |
|
1253 { |
|
1254 SetupL(); |
|
1255 //testing NULL |
|
1256 HBufC8* token=NULL; |
|
1257 TL(CSenWsSecurityHeader::UsernameTokenL(KNullDesC8, KNullDesC8, token)==KErrNone); |
|
1258 TL(token != (HBufC8*)NULL); |
|
1259 //-----checking xml |
|
1260 _LIT8(KRef, "<wsse:UsernameToken><wsse:Username></wsse:Username><wsse:Password></wsse:Password></wsse:UsernameToken>"); |
|
1261 TPtrC8 ptrRef(KRef); |
|
1262 TPtr8 ptrToken = token->Des(); |
|
1263 TL(ptrToken == ptrRef); |
|
1264 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1265 token = NULL; |
|
1266 |
|
1267 |
|
1268 TL(CSenWsSecurityHeader::UsernameTokenL(KNullDesC8, KText, token)==KErrNone); |
|
1269 TL(token != (HBufC8*)NULL); |
|
1270 //-----checking xml |
|
1271 _LIT8(KRef2, "<wsse:UsernameToken><wsse:Username></wsse:Username><wsse:Password>text</wsse:Password></wsse:UsernameToken>"); |
|
1272 TPtrC8 ptrRef2(KRef2); |
|
1273 ptrToken = token->Des(); |
|
1274 TL(ptrToken == ptrRef2); |
|
1275 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1276 token = NULL; |
|
1277 |
|
1278 TL(CSenWsSecurityHeader::UsernameTokenL(KText, KNullDesC8, token)==KErrNone); |
|
1279 TL(token != (HBufC8*)NULL); |
|
1280 //-----checking xml |
|
1281 _LIT8(KRef3, "<wsse:UsernameToken><wsse:Username>text</wsse:Username><wsse:Password></wsse:Password></wsse:UsernameToken>"); |
|
1282 TPtrC8 ptrRef3(KRef3); |
|
1283 ptrToken = token->Des(); |
|
1284 TL(ptrToken == ptrRef3); |
|
1285 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1286 token = NULL; |
|
1287 |
|
1288 //testing normal |
|
1289 TL(CSenWsSecurityHeader::UsernameTokenL(KText, KText, token)==KErrNone); |
|
1290 TL(token != (HBufC8*)NULL); |
|
1291 //-----checking xml |
|
1292 _LIT8(KRef4, "<wsse:UsernameToken><wsse:Username>text</wsse:Username><wsse:Password>text</wsse:Password></wsse:UsernameToken>"); |
|
1293 TPtrC8 ptrRef4(KRef4); |
|
1294 ptrToken = token->Des(); |
|
1295 TL(ptrToken == ptrRef4); |
|
1296 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1297 token = NULL; |
|
1298 Teardown(); |
|
1299 return KErrNone; |
|
1300 } |
|
1301 |
|
1302 TInt CSenUtilsBCTest::CSenWsSecurityHeader_UsernameTokenL_3L( TTestResult& aResult ) |
|
1303 { |
|
1304 SetupL(); |
|
1305 CSenWsSecurityHeader::TPasswordType aType = CSenWsSecurityHeader::EText; |
|
1306 |
|
1307 //testing NULL |
|
1308 HBufC8* token=NULL; |
|
1309 TL(CSenWsSecurityHeader::UsernameTokenL(KNullDesC8, KNullDesC8, aType, token)==KErrNone); |
|
1310 TL(token != (HBufC8*)NULL); |
|
1311 //-----checking xml |
|
1312 _LIT8(KRef, "<wsse:UsernameToken><wsse:Username></wsse:Username><wsse:Password></wsse:Password></wsse:UsernameToken>"); |
|
1313 TPtrC8 ptrRef(KRef); |
|
1314 TPtr8 ptrToken = token->Des(); |
|
1315 TL(ptrToken == ptrRef); |
|
1316 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1317 token = NULL; |
|
1318 |
|
1319 |
|
1320 TL(CSenWsSecurityHeader::UsernameTokenL(KNullDesC8, KText, aType, token)==KErrNone); |
|
1321 TL(token != (HBufC8*)NULL); |
|
1322 //-----checking xml |
|
1323 _LIT8(KRef2, "<wsse:UsernameToken><wsse:Username></wsse:Username><wsse:Password>text</wsse:Password></wsse:UsernameToken>"); |
|
1324 TPtrC8 ptrRef2(KRef2); |
|
1325 ptrToken = token->Des(); |
|
1326 TL(ptrToken == ptrRef2); |
|
1327 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1328 token = NULL; |
|
1329 |
|
1330 |
|
1331 TL(CSenWsSecurityHeader::UsernameTokenL(KText, KNullDesC8, aType, token)==KErrNone); |
|
1332 TL(token != (HBufC8*)NULL); |
|
1333 //-----checking xml |
|
1334 _LIT8(KRef3, "<wsse:UsernameToken><wsse:Username>text</wsse:Username><wsse:Password></wsse:Password></wsse:UsernameToken>"); |
|
1335 TPtrC8 ptrRef3(KRef3); |
|
1336 ptrToken = token->Des(); |
|
1337 TL(ptrToken == ptrRef3); |
|
1338 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1339 token = NULL; |
|
1340 |
|
1341 //testing normal |
|
1342 TL(CSenWsSecurityHeader::UsernameTokenL(KText, KText, aType, token)==KErrNone); |
|
1343 TL(token != (HBufC8*)NULL); |
|
1344 //-----checking xml |
|
1345 _LIT8(KRef4, "<wsse:UsernameToken><wsse:Username>text</wsse:Username><wsse:Password>text</wsse:Password></wsse:UsernameToken>"); |
|
1346 TPtrC8 ptrRef4(KRef4); |
|
1347 ptrToken = token->Des(); |
|
1348 TL(ptrToken == ptrRef4); |
|
1349 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1350 token = NULL; |
|
1351 Teardown(); |
|
1352 return KErrNone; |
|
1353 } |
|
1354 |
|
1355 TInt CSenUtilsBCTest::CSenWsSecurityHeader_UsernameTokenL_4L( TTestResult& aResult ) |
|
1356 { |
|
1357 SetupL(); |
|
1358 |
|
1359 CSenWsSecurityHeader* hdr = CSenWsSecurityHeader::NewL(KText); |
|
1360 TL(hdr!= (CSenWsSecurityHeader*)NULL); |
|
1361 |
|
1362 CSenWsSecurityHeader::TPasswordType aType = CSenWsSecurityHeader::EText; |
|
1363 |
|
1364 //testing NULL |
|
1365 CSenIdentityProvider* provider = CSenIdentityProvider::NewL(KText, KText); |
|
1366 HBufC8* token=NULL; |
|
1367 token = hdr->UsernameTokenL(*provider, aType); |
|
1368 TL(token != (HBufC8*)NULL); |
|
1369 //-----checking xml |
|
1370 _LIT8(KRef, "<wsse:UsernameToken><wsse:Username></wsse:Username><wsse:Password></wsse:Password></wsse:UsernameToken>"); |
|
1371 TPtrC8 ptrRef(KRef); |
|
1372 TPtr8 ptrToken = token->Des(); |
|
1373 TL(ptrToken == ptrRef); |
|
1374 __ASSERT_ALWAYS_NO_LEAVE(delete provider); |
|
1375 provider = NULL; |
|
1376 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1377 token = NULL; |
|
1378 |
|
1379 |
|
1380 //testing normal |
|
1381 provider = CSenIdentityProvider::NewL(KText, KText); |
|
1382 provider->SetUserInfoL(KText, KText2, KText); |
|
1383 token = hdr->UsernameTokenL(*provider, aType); |
|
1384 TL(token != (HBufC8*)NULL); |
|
1385 //checking xml |
|
1386 _LIT8(KRef2, "<wsse:UsernameToken><wsse:Username>text</wsse:Username><wsse:Password>text</wsse:Password></wsse:UsernameToken>"); |
|
1387 TPtrC8 ptrRef2(KRef2); |
|
1388 TPtr8 ptrToken2 = token->Des(); |
|
1389 TL(ptrToken2 == ptrRef2); |
|
1390 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1391 token = NULL; |
|
1392 __ASSERT_ALWAYS_NO_LEAVE(delete provider); |
|
1393 provider = NULL; |
|
1394 __ASSERT_ALWAYS_NO_LEAVE(delete hdr); |
|
1395 hdr = NULL; |
|
1396 Teardown(); |
|
1397 return KErrNone; |
|
1398 |
|
1399 } |
|
1400 |
|
1401 |
|
1402 TInt CSenUtilsBCTest::CSenWsSecurityHeader_NewL_1L( TTestResult& aResult ) |
|
1403 { |
|
1404 SetupL(); |
|
1405 CSenWsSecurityHeader* hdr = CSenWsSecurityHeader::NewL(KText); |
|
1406 /*EUNIT_ASSERT_NOT_EQUALS*/TL(hdr != (CSenWsSecurityHeader*)NULL); |
|
1407 |
|
1408 //checking xml |
|
1409 _LIT16(KRef, "<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">text</wsse:Security>"); |
|
1410 TPtrC16 ptrRef = KRef(); |
|
1411 TL(ConvertToPtr16LC(*hdr) == ptrRef); |
|
1412 CleanupStack::PopAndDestroy();//Ptr |
|
1413 |
|
1414 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
1415 __ASSERT_ALWAYS_NO_LEAVE(delete hdr); |
|
1416 hdr = NULL; |
|
1417 Teardown(); |
|
1418 return KErrNone; |
|
1419 } |
|
1420 |
|
1421 TInt CSenUtilsBCTest::CSenWsSecurityHeader_UsernameTokenLL( TTestResult& aResult ) |
|
1422 { |
|
1423 SetupL(); |
|
1424 CSenWsSecurityHeader* hdr = CSenWsSecurityHeader::NewL(KText); |
|
1425 /*EUNIT_ASSERT_NOT_EQUALS*/TL(hdr != (CSenWsSecurityHeader*)NULL); |
|
1426 |
|
1427 //testing NULL |
|
1428 CSenIdentityProvider* provider = CSenIdentityProvider::NewL(KText, KText); |
|
1429 HBufC8* token=NULL; |
|
1430 token = hdr->UsernameTokenL(*provider); |
|
1431 /*EUNIT_ASSERT_NOT_EQUALS*/TL(token != (HBufC8*)NULL); |
|
1432 //-----checking xml |
|
1433 _LIT8(KRef, "<wsse:UsernameToken><wsse:Username></wsse:Username></wsse:UsernameToken>"); |
|
1434 TPtrC8 ptrRef = KRef(); |
|
1435 TPtr8 ptrToken = token->Des(); |
|
1436 TL(ptrToken == ptrRef); |
|
1437 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
1438 __ASSERT_ALWAYS_NO_LEAVE(delete provider); |
|
1439 provider = NULL; |
|
1440 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
1441 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1442 token = NULL; |
|
1443 |
|
1444 |
|
1445 //testing normal |
|
1446 provider = CSenIdentityProvider::NewL(KText, KText); |
|
1447 provider->SetUserInfoL(KText, KText2, KText); |
|
1448 token = hdr->UsernameTokenL(*provider); |
|
1449 /*EUNIT_ASSERT_NOT_EQUALS*/TL(token != (HBufC8*)NULL); |
|
1450 //checking xml |
|
1451 _LIT8(KRef2, "<wsse:UsernameToken><wsse:Username>text</wsse:Username></wsse:UsernameToken>"); |
|
1452 TPtrC8 ptrRef2 = KRef2(); |
|
1453 TPtr8 ptrToken2 = token->Des(); |
|
1454 TL(ptrToken2 == ptrRef2); |
|
1455 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
1456 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1457 token = NULL; |
|
1458 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
1459 __ASSERT_ALWAYS_NO_LEAVE(delete provider); |
|
1460 provider = NULL; |
|
1461 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
1462 __ASSERT_ALWAYS_NO_LEAVE(delete hdr); |
|
1463 hdr = NULL; |
|
1464 Teardown(); |
|
1465 return KErrNone; |
|
1466 } |
|
1467 |
|
1468 TInt CSenUtilsBCTest::CSenWsSecurityHeader_UsernameTokenL_1L( TTestResult& aResult ) |
|
1469 { |
|
1470 SetupL(); |
|
1471 //testing NULL |
|
1472 HBufC8* token=NULL; |
|
1473 /*EUNIT_ASSERT*/TL(CSenWsSecurityHeader::UsernameTokenL(KNullDesC8, token)==KErrNone); |
|
1474 /*EUNIT_ASSERT_NOT_EQUALS*/TL(token != (HBufC8*)NULL); |
|
1475 //-----checking xml |
|
1476 _LIT8(KRef, "<wsse:UsernameToken><wsse:Username></wsse:Username></wsse:UsernameToken>"); |
|
1477 TPtrC8 ptrRef = KRef(); |
|
1478 TPtr8 ptrToken = token->Des(); |
|
1479 TL(ptrToken == ptrRef); |
|
1480 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
1481 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1482 token = NULL; |
|
1483 |
|
1484 |
|
1485 //testing normal |
|
1486 /*EUNIT_ASSERT*/TL(CSenWsSecurityHeader::UsernameTokenL(KText, token)==KErrNone); |
|
1487 /*EUNIT_ASSERT_NOT_EQUALS*/TL(token != (HBufC8*)NULL); |
|
1488 //-----checking xml |
|
1489 _LIT8(KRef2, "<wsse:UsernameToken><wsse:Username>text</wsse:Username></wsse:UsernameToken>"); |
|
1490 TPtrC8 ptrRef2 = KRef2(); |
|
1491 ptrToken = token->Des(); |
|
1492 TL(ptrToken == ptrRef2); |
|
1493 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
1494 __ASSERT_ALWAYS_NO_LEAVE(delete token); |
|
1495 token = NULL; |
|
1496 Teardown(); |
|
1497 return KErrNone; |
|
1498 } |
|
1499 |
|
1500 TInt CSenUtilsBCTest::CSenWsSecurityHeader_XmlNsL( TTestResult& aResult ) |
|
1501 { |
|
1502 SetupL(); |
|
1503 CSenWsSecurityHeader* hdr = CSenWsSecurityHeader::NewL(); |
|
1504 /*EUNIT_ASSERT_NOT_EQUALS*/TL(hdr != (CSenWsSecurityHeader*)NULL); |
|
1505 _LIT8(KSecurityXmlNsRef, "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); |
|
1506 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
1507 __ASSERT_ALWAYS_NO_LEAVE(hdr->XmlNs()); |
|
1508 TL(hdr->XmlNs() == KSecurityXmlNsRef); |
|
1509 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
1510 __ASSERT_ALWAYS_NO_LEAVE(delete hdr); |
|
1511 hdr = NULL; |
|
1512 Teardown(); |
|
1513 return KErrNone; |
|
1514 } |
|
1515 |
|
1516 TInt CSenUtilsBCTest::CSenWsSecurityHeader_XmlNsPrefixL( TTestResult& aResult ) |
|
1517 { |
|
1518 SetupL(); |
|
1519 CSenWsSecurityHeader* hdr = CSenWsSecurityHeader::NewL(); |
|
1520 /*EUNIT_ASSERT_NOT_EQUALS*/TL(hdr != (CSenWsSecurityHeader*)NULL); |
|
1521 _LIT8(KSecurityXmlNsPrefixRef, "wsse"); |
|
1522 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
1523 __ASSERT_ALWAYS_NO_LEAVE(hdr->XmlNsPrefix()); |
|
1524 TL(hdr->XmlNsPrefix() == KSecurityXmlNsPrefixRef); |
|
1525 /*EUNIT_ASSERT_NO_LEAVE*/ |
|
1526 __ASSERT_ALWAYS_NO_LEAVE(delete hdr); |
|
1527 hdr = NULL; |
|
1528 Teardown(); |
|
1529 return KErrNone; |
|
1530 } |
|
1531 |
|
1532 |
|
1533 TInt CSenUtilsBCTest::SenDateUtils_FromXmlDateTimeLL( TTestResult& aResult ) |
|
1534 { |
|
1535 SetupL(); |
|
1536 //normal |
|
1537 TTime ttime, ttime2; |
|
1538 _LIT8(KIn1, "2005-02-28T13:20:05Z"); |
|
1539 _LIT(KDateTimeString1, "28-feb/05 01:20.05pm"); |
|
1540 ttime = SenDateUtils::FromXmlDateTimeL(KIn1); |
|
1541 ttime2.Parse(KDateTimeString1); |
|
1542 TL(ttime == ttime2); |
|
1543 |
|
1544 //-5 |
|
1545 _LIT8(KIn2, "2005-02-28T13:20:05-05:00"); |
|
1546 _LIT(KDateTimeString2, "28-feb/05 08:20.05am"); |
|
1547 ttime = SenDateUtils::FromXmlDateTimeL(KIn2); |
|
1548 ttime2.Parse(KDateTimeString2); |
|
1549 TL(ttime == ttime2); |
|
1550 |
|
1551 //+5 |
|
1552 _LIT8(KIn3, "2005-02-28T13:20:05+05:00"); |
|
1553 _LIT(KDateTimeString3, "28-feb/05 06:20.05pm"); |
|
1554 ttime = SenDateUtils::FromXmlDateTimeL(KIn3); |
|
1555 ttime2.Parse(KDateTimeString3); |
|
1556 TL(ttime == ttime2); |
|
1557 |
|
1558 //1 increase precision |
|
1559 _LIT8(KIn4, "2005-02-28T13:20:05.5Z"); |
|
1560 _LIT(KDateTimeString4, "20050127:132005.500000");//The month and day values are offset from zero. |
|
1561 ttime = SenDateUtils::FromXmlDateTimeL(KIn4); |
|
1562 ttime2 = TTime(KDateTimeString4); |
|
1563 TL(ttime == ttime2); |
|
1564 |
|
1565 |
|
1566 //3 increase precision |
|
1567 _LIT8(KIn5, "2005-02-28T13:20:05.231Z"); |
|
1568 _LIT(KDateTimeString5, "20050127:132005.231000");//The month and day values are offset from zero. |
|
1569 ttime = SenDateUtils::FromXmlDateTimeL(KIn5); |
|
1570 ttime2 = TTime(KDateTimeString5); |
|
1571 TL(ttime == ttime2); |
|
1572 |
|
1573 //-----------wrong |
|
1574 |
|
1575 //month |
|
1576 _LIT8(KIn6, "2005-55-28T13:20:05Z"); |
|
1577 TRAPD( err, SenDateUtils::FromXmlDateTimeL(KIn6)); |
|
1578 if(err != KErrOverflow) return err; |
|
1579 |
|
1580 //day |
|
1581 _LIT8(KIn7, "2005-02-58T13:20:05Z"); |
|
1582 TRAP(err, SenDateUtils::FromXmlDateTimeL(KIn7)); |
|
1583 if(err != KErrOverflow) return err; |
|
1584 |
|
1585 |
|
1586 //hour |
|
1587 _LIT8(KIn9, "2005-02-28T33:20:05Z"); |
|
1588 TRAP(err, SenDateUtils::FromXmlDateTimeL(KIn9)); |
|
1589 if(err != KErrOverflow) return err; |
|
1590 |
|
1591 //minute |
|
1592 _LIT8(KIn10, "2005-02-28T13:70:05Z"); |
|
1593 TRAP(err, SenDateUtils::FromXmlDateTimeL(KIn10)); |
|
1594 if(err != KErrOverflow) return err; |
|
1595 |
|
1596 //second |
|
1597 _LIT8(KIn11, "2005-02-28T13:20:65Z"); |
|
1598 TRAP(err, SenDateUtils::FromXmlDateTimeL(KIn11)); |
|
1599 if(err != KErrOverflow) return err; |
|
1600 |
|
1601 //+hour |
|
1602 _LIT8(KIn12, "2005-02-28T13:20:05+88:00"); |
|
1603 TRAP(err, SenDateUtils::FromXmlDateTimeL(KIn12)); |
|
1604 if(err != KErrOverflow) return err; |
|
1605 |
|
1606 //UTC wrong designator |
|
1607 _LIT8(KIn13, "2005-02-28T13:20:65Z05:00"); |
|
1608 TRAP(err, SenDateUtils::FromXmlDateTimeL(KIn13)); |
|
1609 if(err != KErrOverflow) return err; |
|
1610 |
|
1611 |
|
1612 //short garbage |
|
1613 _LIT8(KIn14, "xx"); |
|
1614 TRAP(err, SenDateUtils::FromXmlDateTimeL(KIn14)); |
|
1615 if(err != KErrUnderflow) return err; |
|
1616 |
|
1617 //garbage year |
|
1618 _LIT8(KIn15, "xxxx-02-28T13:20:65Z"); |
|
1619 //EUNIT_ASSERT_LEAVE |
|
1620 //ASSERT(SenDateUtils::FromXmlDateTimeL(KIn15)); |
|
1621 |
|
1622 //"-" |
|
1623 _LIT8(KIn16, "2005x02-28T13:20:65Z"); |
|
1624 TRAP(err, SenDateUtils::FromXmlDateTimeL(KIn16)); |
|
1625 if(err != KErrGeneral) return err; |
|
1626 |
|
1627 _LIT8(KIn17, "2005-02x28T13:20:65Z"); |
|
1628 TRAP(err, SenDateUtils::FromXmlDateTimeL(KIn17)); |
|
1629 if(err != KErrGeneral) return err; |
|
1630 |
|
1631 _LIT8(KIn18, "2005-02-28X13:20:65Z"); |
|
1632 TRAP(err, SenDateUtils::FromXmlDateTimeL(KIn18)); |
|
1633 if(err != KErrGeneral) return err; |
|
1634 |
|
1635 _LIT8(KIn19, "2005-02-28X13:20:65Z"); |
|
1636 TRAP(err, SenDateUtils::FromXmlDateTimeL(KIn19)); |
|
1637 if(err != KErrGeneral) return err; |
|
1638 |
|
1639 _LIT8(KIn20, "2005-02-28T13-20:65Z"); |
|
1640 TRAP(err, SenDateUtils::FromXmlDateTimeL(KIn20)); |
|
1641 if(err != KErrGeneral) return err; |
|
1642 |
|
1643 _LIT8(KIn21, "2005-02-28T13:20-65Z"); |
|
1644 TRAP(err, SenDateUtils::FromXmlDateTimeL(KIn21)); |
|
1645 if(err != KErrGeneral) return err; |
|
1646 |
|
1647 //31 II |
|
1648 _LIT8(KIn8, "2005-02-31T13:20:05Z"); |
|
1649 // EUNIT_ASSERT_PANIC(SenDateUtils::FromXmlDateTimeL(KIn8),"USER", 3 ); |
|
1650 TestModuleIf().SetExitReason (TestModuleIf(). EPanic, ETDateTimeBadDateTime); |
|
1651 SenDateUtils::FromXmlDateTimeL(KIn8); |
|
1652 |
|
1653 Teardown(); |
|
1654 return KErrNone; |
|
1655 } |
|
1656 |
|
1657 TInt CSenUtilsBCTest::SenDateUtils_ToXmlDateTimeUtf8LL( TTestResult& aResult ) |
|
1658 { |
|
1659 SetupL(); |
|
1660 //KXmlDateTimeMaxLength = 25 |
|
1661 _LIT(KDate, "23:34.56"); |
|
1662 _LIT8(KRef, "0000-01-01T23:34:56Z"); |
|
1663 TTime ttime; |
|
1664 TInt res(0); |
|
1665 HBufC8* writeBuf; |
|
1666 TInt error = ttime.Parse(KDate); |
|
1667 |
|
1668 //OK, more |
|
1669 writeBuf=HBufC8::New(SenDateUtils::KXmlDateTimeMaxLength+10); |
|
1670 //ptrResult = writeBuf->Des(); it wrong, becouse = operator will only copy, creation has been done in previous case |
|
1671 TPtr8 ptrResult2 = writeBuf->Des(); |
|
1672 // EUNIT_ASSERT_NO_LEAVE |
|
1673 __ASSERT_ALWAYS_NO_LEAVE(SenDateUtils::ToXmlDateTimeUtf8L(ptrResult2, ttime)); |
|
1674 TL(ptrResult2 == KRef); |
|
1675 delete writeBuf; |
|
1676 writeBuf = NULL; |
|
1677 |
|
1678 //OK,equal |
|
1679 writeBuf=HBufC8::New(SenDateUtils::KXmlDateTimeMaxLength); |
|
1680 //ptrResult = writeBuf->Des(); it wrong, becouse = operator will only copy, creation has been done in previous case |
|
1681 TPtr8 ptrResult3 = writeBuf->Des(); |
|
1682 //EUNIT_ASSERT_NO_LEAVE |
|
1683 __ASSERT_ALWAYS_NO_LEAVE(SenDateUtils::ToXmlDateTimeUtf8L(ptrResult3, ttime)); |
|
1684 TL(ptrResult3 == KRef); |
|
1685 delete writeBuf; |
|
1686 writeBuf = NULL; |
|
1687 Teardown(); |
|
1688 |
|
1689 TRAP(res, |
|
1690 //SetupL(); |
|
1691 //CleanupStack::PushL(iXmlReader); |
|
1692 //KErrOverflow |
|
1693 writeBuf=HBufC8::NewLC(SenDateUtils::KXmlDateTimeMaxLength - 20); |
|
1694 TPtr8 ptrResult = writeBuf->Des(); |
|
1695 SenDateUtils::ToXmlDateTimeUtf8L(ptrResult, ttime); |
|
1696 CleanupStack::PopAndDestroy();//writeBuf |
|
1697 //CleanupStack::Pop();//iXmlReader |
|
1698 //Teardown(); |
|
1699 ); |
|
1700 if(res != KErrOverflow) |
|
1701 return res; |
|
1702 |
|
1703 return KErrNone; |
|
1704 } |
|
1705 |
|
1706 TInt CSenUtilsBCTest::SenDateUtils_ToXmlDateTimeUtf82LL( TTestResult& aResult ) |
|
1707 { |
|
1708 SetupL(); |
|
1709 |
|
1710 //KXmlDateTimeMaxLength = 25 |
|
1711 _LIT(KDate, "23:34.56"); |
|
1712 _LIT8(KRef, "0000-01-01T23:34:56.000000Z"); |
|
1713 TTime ttime; |
|
1714 TInt res(0); |
|
1715 HBufC8* writeBuf; |
|
1716 TInt error = ttime.Parse(KDate); |
|
1717 |
|
1718 //OK, more |
|
1719 writeBuf=HBufC8::New(SenDateUtils::KXmlDateTimeMaxLength+10); |
|
1720 //ptrResult = writeBuf->Des(); it wrong, becouse = operator will only copy, creation has been done in previous case |
|
1721 TPtr8 ptrResult2 = writeBuf->Des(); |
|
1722 // EUNIT_ASSERT_NO_LEAVE |
|
1723 __ASSERT_ALWAYS_NO_LEAVE(SenDateUtils::ToXmlDateTimeUtf82L(ptrResult2, ttime)); |
|
1724 TL(ptrResult2 == KRef); |
|
1725 delete writeBuf; |
|
1726 writeBuf = NULL; |
|
1727 |
|
1728 //OK,equal |
|
1729 writeBuf=HBufC8::New(SenDateUtils::KXmlDateTimeMaxLength); |
|
1730 //ptrResult = writeBuf->Des(); it wrong, becouse = operator will only copy, creation has been done in previous case |
|
1731 TPtr8 ptrResult3 = writeBuf->Des(); |
|
1732 //EUNIT_ASSERT_NO_LEAVE |
|
1733 __ASSERT_ALWAYS_NO_LEAVE(SenDateUtils::ToXmlDateTimeUtf82L(ptrResult3, ttime)); |
|
1734 TL(ptrResult3 == KRef); |
|
1735 delete writeBuf; |
|
1736 writeBuf = NULL; |
|
1737 Teardown(); |
|
1738 |
|
1739 TRAP(res, |
|
1740 //KErrOverflow |
|
1741 writeBuf=HBufC8::NewLC(SenDateUtils::KXmlDateTimeMaxLength - 20); |
|
1742 TPtr8 ptrResult = writeBuf->Des(); |
|
1743 SenDateUtils::ToXmlDateTimeUtf82L(ptrResult, ttime); |
|
1744 CleanupStack::PopAndDestroy();//writeBuf |
|
1745 ); |
|
1746 if(res != KErrOverflow) |
|
1747 return res; |
|
1748 |
|
1749 |
|
1750 |
|
1751 return KErrNone; |
|
1752 } |
|
1753 |
|
1754 TInt CSenUtilsBCTest::SenTransportProperties_FileAttachmentLL(TTestResult& aResult ) |
|
1755 { |
|
1756 SetupL(); |
|
1757 |
|
1758 CSenTransportProperties* transProp = CSenTransportProperties::NewLC(); |
|
1759 HBufC8* value = NULL; |
|
1760 TL(transProp->FileAttachmentL(_L8("1"),value) == KErrNotFound); |
|
1761 TL(value == (HBufC8*)NULL); |
|
1762 |
|
1763 transProp->SetFileAttachmentL(_L8("1"),_L8("abcd")); |
|
1764 TL(transProp->FileAttachmentL(_L8("1"),value) == KErrNone); |
|
1765 TL(*value == _L8("abcd")); |
|
1766 |
|
1767 delete value; |
|
1768 CleanupStack::PopAndDestroy(transProp); |
|
1769 Teardown(); |
|
1770 return KErrNone; |
|
1771 |
|
1772 } |
|
1773 |
|
1774 TInt CSenUtilsBCTest::SenXmlProperties_NewLL(TTestResult& aResult ) |
|
1775 { |
|
1776 SetupL(); |
|
1777 TBool Flag; |
|
1778 CSenXmlProperties *pXmlElement=CSenXmlProperties::NewL(); |
|
1779 CleanupStack::PushL(pXmlElement); |
|
1780 if(pXmlElement) |
|
1781 Flag=1; |
|
1782 else |
|
1783 Flag=0; |
|
1784 if(!( Flag )) return KErrArgument; |
|
1785 CleanupStack::PopAndDestroy(pXmlElement); |
|
1786 Teardown(); |
|
1787 return KErrNone; |
|
1788 } |
|
1789 |
|
1790 TInt CSenUtilsBCTest::SenXmlProperties_NewLCL(TTestResult& aResult ) |
|
1791 { |
|
1792 SetupL(); |
|
1793 TBool Flag; |
|
1794 CSenXmlProperties *pXmlElement=CSenXmlProperties::NewLC(); |
|
1795 |
|
1796 if(pXmlElement) |
|
1797 Flag=1; |
|
1798 else |
|
1799 Flag=0; |
|
1800 if(!( Flag )) return KErrArgument; |
|
1801 CleanupStack::PopAndDestroy(pXmlElement); |
|
1802 Teardown(); |
|
1803 return KErrNone; |
|
1804 } |
|
1805 |
|
1806 TInt CSenUtilsBCTest::SenXmlProperties_NewL_1L(TTestResult& aResult ) |
|
1807 { |
|
1808 SetupL(); |
|
1809 TBool Flag; |
|
1810 _LIT8(KString,"<parent><element1/><element2/><element3/>parent content</parent>"); |
|
1811 CSenXmlReader* pParser = CSenXmlReader::NewL(); |
|
1812 CleanupStack::PushL(pParser); |
|
1813 CSenXmlProperties *pXmlElement=CSenXmlProperties::NewL(KString,*pParser); |
|
1814 CleanupStack::PushL(pXmlElement); |
|
1815 if(pXmlElement) |
|
1816 Flag=1; |
|
1817 else |
|
1818 Flag=0; |
|
1819 if(!( Flag )) return KErrArgument; |
|
1820 CleanupStack::PopAndDestroy(pXmlElement); |
|
1821 CleanupStack::PopAndDestroy(pParser); |
|
1822 Teardown(); |
|
1823 return KErrNone; |
|
1824 } |
|
1825 |
|
1826 TInt CSenUtilsBCTest::SenXmlProperties_NewLC_1L(TTestResult& aResult ) |
|
1827 { |
|
1828 SetupL(); |
|
1829 TBool Flag; |
|
1830 _LIT8(KString,"<parent><element1/><element2/><element3/>parent content</parent>"); |
|
1831 CSenXmlReader* pParser = CSenXmlReader::NewL(); |
|
1832 CleanupStack::PushL(pParser); |
|
1833 CSenXmlProperties *pXmlElement=CSenXmlProperties::NewLC(KString,*pParser); |
|
1834 if(pXmlElement) |
|
1835 Flag=1; |
|
1836 else |
|
1837 Flag=0; |
|
1838 if(!( Flag )) return KErrArgument; |
|
1839 CleanupStack::PopAndDestroy(pXmlElement); |
|
1840 CleanupStack::PopAndDestroy(pParser); |
|
1841 Teardown(); |
|
1842 return KErrNone; |
|
1843 } |
|
1844 |
|
1845 TInt CSenUtilsBCTest::SenXmlProperties_NewL_2L(TTestResult& aResult ) |
|
1846 { |
|
1847 SetupL(); |
|
1848 TBool Flag; |
|
1849 CSenBaseElement* pElement= CSenBaseElement::NewL(_L8("Nokia")); |
|
1850 CleanupStack::PushL(pElement); |
|
1851 CSenXmlProperties *pXmlElement=CSenXmlProperties::NewL(*pElement); |
|
1852 CleanupStack::PushL(pXmlElement); |
|
1853 if(pXmlElement) |
|
1854 Flag=1; |
|
1855 else |
|
1856 Flag=0; |
|
1857 if(!( Flag )) return KErrArgument; |
|
1858 CleanupStack::PopAndDestroy(pXmlElement); |
|
1859 CleanupStack::PopAndDestroy(pElement); |
|
1860 Teardown(); |
|
1861 return KErrNone; |
|
1862 } |
|
1863 |
|
1864 TInt CSenUtilsBCTest::SenXmlProperties_NewLC_2L(TTestResult& aResult ) |
|
1865 { |
|
1866 SetupL(); |
|
1867 TBool Flag; |
|
1868 CSenBaseElement* pElement= CSenBaseElement::NewL(_L8("Nokia")); |
|
1869 CleanupStack::PushL(pElement); |
|
1870 CSenXmlProperties *pXmlElement=CSenXmlProperties::NewLC(*pElement); |
|
1871 if(pXmlElement) |
|
1872 Flag=1; |
|
1873 else |
|
1874 Flag=0; |
|
1875 if(!( Flag )) return KErrArgument; |
|
1876 CleanupStack::PopAndDestroy(pXmlElement); |
|
1877 CleanupStack::PopAndDestroy(pElement); |
|
1878 Teardown(); |
|
1879 return KErrNone; |
|
1880 } |
|
1881 |
|
1882 TInt CSenUtilsBCTest::SenTransportProperties_NewLL(TTestResult& aResult ) |
|
1883 { |
|
1884 SetupL(); |
|
1885 TBool Flag; |
|
1886 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
1887 CleanupStack::PushL(pElement); |
|
1888 if(pElement) |
|
1889 Flag=1; |
|
1890 else |
|
1891 Flag=0; |
|
1892 if(!( Flag )) return KErrArgument; |
|
1893 CleanupStack::PopAndDestroy(pElement); |
|
1894 Teardown(); |
|
1895 return KErrNone; |
|
1896 } |
|
1897 |
|
1898 TInt CSenUtilsBCTest::SenTransportProperties_NewLCL(TTestResult& aResult ) |
|
1899 { |
|
1900 SetupL(); |
|
1901 TBool Flag; |
|
1902 CSenTransportProperties* pElement= CSenTransportProperties::NewLC(); |
|
1903 if(pElement) |
|
1904 Flag=1; |
|
1905 else |
|
1906 Flag=0; |
|
1907 if(!( Flag )) return KErrArgument; |
|
1908 CleanupStack::PopAndDestroy(pElement); |
|
1909 Teardown(); |
|
1910 return KErrNone; |
|
1911 } |
|
1912 |
|
1913 TInt CSenUtilsBCTest::SenTransportProperties_NewL_1L(TTestResult& aResult ) |
|
1914 { |
|
1915 SetupL(); |
|
1916 TBool Flag; |
|
1917 _LIT8(KString,"<parent><element1/><element2/><element3/>parent content</parent>"); |
|
1918 CSenXmlReader* pParser = CSenXmlReader::NewL(); |
|
1919 CleanupStack::PushL(pParser); |
|
1920 CSenTransportProperties *pXmlElement=CSenTransportProperties::NewL(KString,*pParser); |
|
1921 CleanupStack::PushL(pXmlElement); |
|
1922 if(pXmlElement) |
|
1923 Flag=1; |
|
1924 else |
|
1925 Flag=0; |
|
1926 if(!( Flag )) return KErrArgument; |
|
1927 CleanupStack::PopAndDestroy(pXmlElement); |
|
1928 CleanupStack::PopAndDestroy(pParser); |
|
1929 Teardown(); |
|
1930 return KErrNone; |
|
1931 } |
|
1932 |
|
1933 TInt CSenUtilsBCTest::SenTransportProperties_NewLC_1L(TTestResult& aResult ) |
|
1934 { |
|
1935 SetupL(); |
|
1936 TBool Flag; |
|
1937 _LIT8(KString,"<parent><element1/><element2/><element3/>parent content</parent>"); |
|
1938 CSenXmlReader* pParser = CSenXmlReader::NewL(); |
|
1939 CleanupStack::PushL(pParser); |
|
1940 CSenTransportProperties *pXmlElement=CSenTransportProperties::NewLC(KString,*pParser); |
|
1941 |
|
1942 if(pXmlElement) |
|
1943 Flag=1; |
|
1944 else |
|
1945 Flag=0; |
|
1946 if(!( Flag )) return KErrArgument; |
|
1947 CleanupStack::PopAndDestroy(pXmlElement); |
|
1948 CleanupStack::PopAndDestroy(pParser); |
|
1949 Teardown(); |
|
1950 return KErrNone; |
|
1951 } |
|
1952 |
|
1953 TInt CSenUtilsBCTest::SenTransportProperties_NewL_2L(TTestResult& aResult ) |
|
1954 { |
|
1955 SetupL(); |
|
1956 TBool Flag; |
|
1957 CSenBaseElement* pElement= CSenBaseElement::NewL(_L8("Nokia")); |
|
1958 CleanupStack::PushL(pElement); |
|
1959 CSenTransportProperties *pXmlElement=CSenTransportProperties::NewL(*pElement); |
|
1960 CleanupStack::PushL(pXmlElement); |
|
1961 if(pXmlElement) |
|
1962 Flag=1; |
|
1963 else |
|
1964 Flag=0; |
|
1965 if(!( Flag )) return KErrArgument; |
|
1966 CleanupStack::PopAndDestroy(pXmlElement); |
|
1967 CleanupStack::PopAndDestroy(pElement); |
|
1968 Teardown(); |
|
1969 return KErrNone; |
|
1970 } |
|
1971 |
|
1972 TInt CSenUtilsBCTest::SenTransportProperties_NewLC_2L(TTestResult& aResult ) |
|
1973 { |
|
1974 SetupL(); |
|
1975 TBool Flag; |
|
1976 CSenBaseElement* pElement= CSenBaseElement::NewL(_L8("Nokia")); |
|
1977 CleanupStack::PushL(pElement); |
|
1978 CSenTransportProperties *pXmlElement=CSenTransportProperties::NewLC(*pElement); |
|
1979 if(pXmlElement) |
|
1980 Flag=1; |
|
1981 else |
|
1982 Flag=0; |
|
1983 if(!( Flag )) KErrArgument; |
|
1984 CleanupStack::PopAndDestroy(pXmlElement); |
|
1985 CleanupStack::PopAndDestroy(pElement); |
|
1986 Teardown(); |
|
1987 return KErrNone; |
|
1988 } |
|
1989 |
|
1990 |
|
1991 TInt CSenUtilsBCTest::SenTransportProperties_AsUtf8LL(TTestResult& aResult ) |
|
1992 { |
|
1993 SetupL(); |
|
1994 _LIT8(KElementText,"<Properties><Property>value</Property></Properties>"); |
|
1995 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
1996 CleanupStack::PushL(pElement); |
|
1997 pElement->SetPropertyL(_L8("Property"),_L8("value")); |
|
1998 HBufC8* Utf8Buf=pElement->AsUtf8L(); |
|
1999 TL(*Utf8Buf == KElementText); |
|
2000 CleanupStack::PopAndDestroy(pElement); |
|
2001 delete Utf8Buf; |
|
2002 Teardown(); |
|
2003 return KErrNone; |
|
2004 } |
|
2005 |
|
2006 TInt CSenUtilsBCTest::SenTransportProperties_SetPropertyLL(TTestResult& aResult ) |
|
2007 { |
|
2008 SetupL(); |
|
2009 _LIT8(KElementText,"<Properties><Property>value</Property></Properties>"); |
|
2010 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2011 CleanupStack::PushL(pElement); |
|
2012 TInt retval=pElement->SetPropertyL(_L8("Property"),_L8("value")); |
|
2013 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2014 TL(retval == KErrNone); |
|
2015 TL(*ElementBuf == KElementText); |
|
2016 CleanupStack::PopAndDestroy(pElement); |
|
2017 delete ElementBuf; |
|
2018 Teardown(); |
|
2019 return KErrNone; |
|
2020 } |
|
2021 TInt CSenUtilsBCTest::SenTransportProperties_PropertyLL(TTestResult& aResult ) |
|
2022 { |
|
2023 SetupL(); |
|
2024 _LIT8(KValue,"Value"); |
|
2025 TPtrC8 ValuePtr; |
|
2026 TPtrC8 ValuePtr1; |
|
2027 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2028 CleanupStack::PushL(pElement); |
|
2029 pElement->SetPropertyL(_L8("Property"),_L8("value")); |
|
2030 |
|
2031 //true case |
|
2032 TInt retval=pElement->PropertyL(_L8("Property"),ValuePtr); |
|
2033 TL(retval == KErrNone); |
|
2034 |
|
2035 //false case |
|
2036 retval=pElement->PropertyL(_L8("NoProperty"),ValuePtr1); |
|
2037 TL(retval == KErrNotFound); |
|
2038 |
|
2039 CleanupStack::PopAndDestroy(pElement); |
|
2040 Teardown(); |
|
2041 return KErrNone; |
|
2042 } |
|
2043 TInt CSenUtilsBCTest::SenTransportProperties_SetIntPropertyLL(TTestResult& aResult ) |
|
2044 { |
|
2045 SetupL(); |
|
2046 _LIT8(KElementText,"<Properties><Property>10</Property></Properties>"); |
|
2047 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2048 CleanupStack::PushL(pElement); |
|
2049 TInt retval=pElement->SetIntPropertyL(_L8("Property"),10); |
|
2050 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2051 TL(retval==KErrNone); |
|
2052 TL(*ElementBuf == KElementText); |
|
2053 CleanupStack::PopAndDestroy(pElement); |
|
2054 delete ElementBuf; |
|
2055 Teardown(); |
|
2056 return KErrNone; |
|
2057 } |
|
2058 TInt CSenUtilsBCTest::SenTransportProperties_IntPropertyLL(TTestResult& aResult ) |
|
2059 { |
|
2060 SetupL(); |
|
2061 TInt PropValue; |
|
2062 TInt PropValue1; |
|
2063 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2064 CleanupStack::PushL(pElement); |
|
2065 pElement->SetIntPropertyL(_L8("Property"),10); |
|
2066 //true case |
|
2067 TInt retval=pElement->IntPropertyL(_L8("Property"),PropValue); |
|
2068 TL(retval == KErrNone); |
|
2069 TL(PropValue == 10); |
|
2070 //false case |
|
2071 retval=pElement->IntPropertyL(_L8("NoProperty"),PropValue1); |
|
2072 TL(retval == KErrNotFound); |
|
2073 |
|
2074 CleanupStack::PopAndDestroy(pElement); |
|
2075 Teardown(); |
|
2076 return KErrNone; |
|
2077 } |
|
2078 TInt CSenUtilsBCTest::SenTransportProperties_SetBoolPropertyLL(TTestResult& aResult ) |
|
2079 { |
|
2080 SetupL(); |
|
2081 _LIT8(KElementText,"<Properties><Property>true</Property></Properties>"); |
|
2082 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2083 CleanupStack::PushL(pElement); |
|
2084 TInt retval=pElement->SetBoolPropertyL(_L8("Property"),1); |
|
2085 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2086 TL(retval == KErrNone); |
|
2087 TL(*ElementBuf == KElementText); |
|
2088 CleanupStack::PopAndDestroy(pElement); |
|
2089 delete ElementBuf; |
|
2090 Teardown(); |
|
2091 return KErrNone; |
|
2092 } |
|
2093 TInt CSenUtilsBCTest::SenTransportProperties_BoolPropertyLL(TTestResult& aResult ) |
|
2094 { |
|
2095 SetupL(); |
|
2096 TBool BoolValue=1; |
|
2097 TBool BoolValue1; |
|
2098 TBool BoolValue2; |
|
2099 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2100 CleanupStack::PushL(pElement); |
|
2101 pElement->SetBoolPropertyL(_L8("Property"),BoolValue); |
|
2102 //true case |
|
2103 TInt retval=pElement->BoolPropertyL(_L8("Property"),BoolValue1); |
|
2104 TL(retval == KErrNone); |
|
2105 TL(BoolValue == BoolValue1); |
|
2106 //false case |
|
2107 retval=pElement->BoolPropertyL(_L8("NoProperty"),BoolValue2); |
|
2108 TL(retval == KErrNotFound); |
|
2109 CleanupStack::PopAndDestroy(pElement); |
|
2110 Teardown(); |
|
2111 return KErrNone; |
|
2112 } |
|
2113 TInt CSenUtilsBCTest::SenTransportProperties_SetOmittedLL(TTestResult& aResult ) |
|
2114 { |
|
2115 SetupL(); |
|
2116 _LIT8(KText,"<Properties><Property Omitted=\"true\">value</Property></Properties>"); |
|
2117 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2118 CleanupStack::PushL(pElement); |
|
2119 pElement->SetPropertyL(_L8("Property"),_L8("value")); |
|
2120 TInt retval=pElement->SetOmittedL(_L8("Property"),1); |
|
2121 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2122 TL(retval == KErrNone); |
|
2123 TL(*ElementBuf == KText); |
|
2124 CleanupStack::PopAndDestroy(pElement); |
|
2125 delete ElementBuf; |
|
2126 Teardown(); |
|
2127 return KErrNone; |
|
2128 } |
|
2129 TInt CSenUtilsBCTest::SenTransportProperties_RemovePropertyLL(TTestResult& aResult ) |
|
2130 { |
|
2131 SetupL(); |
|
2132 _LIT8(KText,"<Properties><Property1>value</Property1><Property2>value</Property2></Properties>"); |
|
2133 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2134 CleanupStack::PushL(pElement); |
|
2135 pElement->SetPropertyL(_L8("Property"),_L8("value")); |
|
2136 pElement->SetPropertyL(_L8("Property1"),_L8("value")); |
|
2137 pElement->SetPropertyL(_L8("Property2"),_L8("value")); |
|
2138 //True |
|
2139 TInt retval=pElement->RemovePropertyL(_L8("Property")); |
|
2140 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2141 TL(retval == KErrNone); |
|
2142 //False |
|
2143 retval=pElement->RemovePropertyL(_L8("NoProperty")); |
|
2144 TL(retval == KErrNotFound); |
|
2145 TL(*ElementBuf == KText); |
|
2146 CleanupStack::PopAndDestroy(pElement); |
|
2147 delete ElementBuf; |
|
2148 ElementBuf=NULL; |
|
2149 Teardown(); |
|
2150 return KErrNone; |
|
2151 } |
|
2152 /* |
|
2153 TInt CSenUtilsBCTest::SenTransportProperties_CloneLL() |
|
2154 { |
|
2155 _LIT8(KCloneText,"<Properties><Property>value</Property><Property1>value</Property1></Properties>"); |
|
2156 TInt okRnotok; |
|
2157 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2158 CleanupStack::PushL(pElement); |
|
2159 pElement->SetPropertyL(_L8("Property"),_L8("value")); |
|
2160 pElement->SetPropertyL(_L8("Property1"),_L8("value")); |
|
2161 MSenProperties* pCloneElement=pElement->Clone(okRnotok); |
|
2162 CleanupStack::PushL(pCloneElement); |
|
2163 HBufC8* CloneElementBuf=pCloneElement->AsUtf8L(); |
|
2164 EUNIT_ASSERT_EQUALS(*CloneElementBuf,KCloneText); |
|
2165 EUNIT_ASSERT_EQUALS(okRnotok,KErrNone); |
|
2166 delete CloneElementBuf; |
|
2167 CleanupStack::PopAndDestroy(pCloneElement); |
|
2168 CleanupStack::PopAndDestroy(pElement); |
|
2169 } |
|
2170 */ |
|
2171 TInt CSenUtilsBCTest::SenTransportProperties_HeartbeatLL(TTestResult& aResult ) |
|
2172 { |
|
2173 SetupL(); |
|
2174 TInt Delta=10; |
|
2175 TInt Delta1; |
|
2176 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2177 CleanupStack::PushL(pElement); |
|
2178 pElement->SetHeartbeatL(Delta); |
|
2179 TInt retval=pElement->HeartbeatL(Delta1); |
|
2180 TL(retval == KErrNone); |
|
2181 TL(Delta1 == Delta); |
|
2182 CleanupStack::PopAndDestroy(pElement); |
|
2183 Teardown(); |
|
2184 return KErrNone; |
|
2185 } |
|
2186 |
|
2187 TInt CSenUtilsBCTest::SenTransportProperties_SetHeartbeatLL(TTestResult& aResult ) |
|
2188 { |
|
2189 SetupL(); |
|
2190 _LIT8(KElementText,"<Properties><Heartbeat>10</Heartbeat></Properties>"); |
|
2191 TInt Delta=10; |
|
2192 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2193 CleanupStack::PushL(pElement); |
|
2194 TInt retval=pElement->SetHeartbeatL(Delta); |
|
2195 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2196 TL(retval == KErrNone); |
|
2197 TL(*ElementBuf == KElementText); |
|
2198 CleanupStack::PopAndDestroy(pElement); |
|
2199 delete ElementBuf; |
|
2200 Teardown(); |
|
2201 return KErrNone; |
|
2202 } |
|
2203 |
|
2204 TInt CSenUtilsBCTest::SenTransportProperties_IapIdLL(TTestResult& aResult ) |
|
2205 { |
|
2206 SetupL(); |
|
2207 TUint32 Delta; |
|
2208 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2209 CleanupStack::PushL(pElement); |
|
2210 pElement->SetIapIdL(101); |
|
2211 TInt retval=pElement->IapIdL(Delta); |
|
2212 TL(retval == KErrNone); |
|
2213 TL(Delta == 101); |
|
2214 CleanupStack::PopAndDestroy(pElement); |
|
2215 Teardown(); |
|
2216 return KErrNone; |
|
2217 } |
|
2218 |
|
2219 TInt CSenUtilsBCTest::SenTransportProperties_SetIapIdLL(TTestResult& aResult ) |
|
2220 { |
|
2221 SetupL(); |
|
2222 _LIT8(KElementText,"<Properties><IapId>101</IapId></Properties>"); |
|
2223 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2224 CleanupStack::PushL(pElement); |
|
2225 pElement->SetIapIdL(101); |
|
2226 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2227 TL(*ElementBuf == KElementText); |
|
2228 CleanupStack::PopAndDestroy(pElement); |
|
2229 delete ElementBuf; |
|
2230 Teardown(); |
|
2231 return KErrNone; |
|
2232 } |
|
2233 |
|
2234 TInt CSenUtilsBCTest::SenTransportProperties_ProxyPortLL(TTestResult& aResult ) |
|
2235 { |
|
2236 SetupL(); |
|
2237 TInt PortNum; |
|
2238 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2239 CleanupStack::PushL(pElement); |
|
2240 pElement->SetProxyPortL(8080); |
|
2241 TInt retval=pElement->ProxyPortL(PortNum); |
|
2242 TL(retval == KErrNone); |
|
2243 TL(PortNum == 8080); |
|
2244 CleanupStack::PopAndDestroy(pElement); |
|
2245 Teardown(); |
|
2246 return KErrNone; |
|
2247 } |
|
2248 |
|
2249 TInt CSenUtilsBCTest::SenTransportProperties_SetProxyPortLL(TTestResult& aResult ) |
|
2250 { |
|
2251 SetupL(); |
|
2252 _LIT8(KElementText,"<Properties><ProxyPort>8080</ProxyPort></Properties>"); |
|
2253 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2254 CleanupStack::PushL(pElement); |
|
2255 pElement->SetProxyPortL(8080); |
|
2256 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2257 TL(*ElementBuf == KElementText); |
|
2258 CleanupStack::PopAndDestroy(pElement); |
|
2259 delete ElementBuf; |
|
2260 Teardown(); |
|
2261 return KErrNone; |
|
2262 } |
|
2263 |
|
2264 TInt CSenUtilsBCTest::SenTransportProperties_ProxyHostLL(TTestResult& aResult ) |
|
2265 { |
|
2266 SetupL(); |
|
2267 TPtrC8 host; |
|
2268 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2269 CleanupStack::PushL(pElement); |
|
2270 pElement->SetProxyHostL(_L8("tcp.mws.mobile.msn-ppe.com")); |
|
2271 TInt retval=pElement->ProxyHostL(host); |
|
2272 TL(retval == KErrNone); |
|
2273 TL(host == _L8("tcp.mws.mobile.msn-ppe.com")); |
|
2274 CleanupStack::PopAndDestroy(pElement); |
|
2275 Teardown(); |
|
2276 return KErrNone; |
|
2277 } |
|
2278 |
|
2279 TInt CSenUtilsBCTest::SenTransportProperties_SetProxyHostLL(TTestResult& aResult ) |
|
2280 { |
|
2281 SetupL(); |
|
2282 _LIT8(KElementText,"<Properties><ProxyHost>tcp.mws.mobile.msn-ppe.com</ProxyHost></Properties>"); |
|
2283 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2284 CleanupStack::PushL(pElement); |
|
2285 pElement->SetProxyHostL(_L8("tcp.mws.mobile.msn-ppe.com")); |
|
2286 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2287 TL(*ElementBuf == KElementText); |
|
2288 CleanupStack::PopAndDestroy(pElement); |
|
2289 delete ElementBuf; |
|
2290 Teardown(); |
|
2291 return KErrNone; |
|
2292 } |
|
2293 |
|
2294 TInt CSenUtilsBCTest::SenTransportProperties_ProxyUsageLL(TTestResult& aResult ) |
|
2295 { |
|
2296 SetupL(); |
|
2297 TBool Usage; |
|
2298 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2299 CleanupStack::PushL(pElement); |
|
2300 pElement->SetProxyUsageL(TRUE); |
|
2301 TInt retval=pElement->ProxyUsageL(Usage); |
|
2302 TL(retval == KErrNone); |
|
2303 TL(Usage == TRUE); |
|
2304 CleanupStack::PopAndDestroy(pElement); |
|
2305 Teardown(); |
|
2306 return KErrNone; |
|
2307 } |
|
2308 |
|
2309 TInt CSenUtilsBCTest::SenTransportProperties_SetProxyUsageLL(TTestResult& aResult ) |
|
2310 { |
|
2311 SetupL(); |
|
2312 _LIT8(KElementText,"<Properties><ProxyUsage>true</ProxyUsage></Properties>"); |
|
2313 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2314 CleanupStack::PushL(pElement); |
|
2315 pElement->SetProxyUsageL(TRUE); |
|
2316 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2317 TL(*ElementBuf == KElementText); |
|
2318 CleanupStack::PopAndDestroy(pElement); |
|
2319 delete ElementBuf; |
|
2320 Teardown(); |
|
2321 return KErrNone; |
|
2322 } |
|
2323 |
|
2324 TInt CSenUtilsBCTest::SenTransportProperties_SecureDialogLL(TTestResult& aResult ) |
|
2325 { |
|
2326 SetupL(); |
|
2327 TBool Security; |
|
2328 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2329 CleanupStack::PushL(pElement); |
|
2330 pElement->SetSecureDialogL(TRUE); |
|
2331 TInt retval=pElement->SecureDialogL(Security); |
|
2332 TL(retval == KErrNone); |
|
2333 TL(Security == TRUE); |
|
2334 CleanupStack::PopAndDestroy(pElement); |
|
2335 Teardown(); |
|
2336 return KErrNone; |
|
2337 } |
|
2338 |
|
2339 TInt CSenUtilsBCTest::SenTransportProperties_SetSecureDialogLL(TTestResult& aResult ) |
|
2340 { |
|
2341 SetupL(); |
|
2342 _LIT8(KElementText,"<Properties><SecureDialog>true</SecureDialog></Properties>"); |
|
2343 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2344 CleanupStack::PushL(pElement); |
|
2345 pElement->SetSecureDialogL(TRUE); |
|
2346 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2347 TL(*ElementBuf == KElementText); |
|
2348 CleanupStack::PopAndDestroy(pElement); |
|
2349 delete ElementBuf; |
|
2350 Teardown(); |
|
2351 return KErrNone; |
|
2352 } |
|
2353 |
|
2354 TInt CSenUtilsBCTest::SenTransportProperties_UserAgentLL(TTestResult& aResult ) |
|
2355 { |
|
2356 SetupL(); |
|
2357 TPtrC8 UserAgent; |
|
2358 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2359 CleanupStack::PushL(pElement); |
|
2360 pElement->SetUserAgentL(_L8("TestAgent")); |
|
2361 TInt retval=pElement->UserAgentL(UserAgent); |
|
2362 TL(retval == KErrNone); |
|
2363 TL(UserAgent ==_L8("TestAgent")); |
|
2364 CleanupStack::PopAndDestroy(pElement); |
|
2365 Teardown(); |
|
2366 return KErrNone; |
|
2367 } |
|
2368 |
|
2369 TInt CSenUtilsBCTest::SenTransportProperties_SetUserAgentLL(TTestResult& aResult ) |
|
2370 { |
|
2371 SetupL(); |
|
2372 _LIT8(KElementText,"<Properties><User-Agent>TestAgent</User-Agent></Properties>"); |
|
2373 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2374 CleanupStack::PushL(pElement); |
|
2375 pElement->SetUserAgentL(_L8("TestAgent")); |
|
2376 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2377 TL(*ElementBuf == KElementText); |
|
2378 CleanupStack::PopAndDestroy(pElement); |
|
2379 delete ElementBuf; |
|
2380 Teardown(); |
|
2381 return KErrNone; |
|
2382 } |
|
2383 |
|
2384 TInt CSenUtilsBCTest::SenTransportProperties_DeviceIDLL(TTestResult& aResult ) |
|
2385 { |
|
2386 SetupL(); |
|
2387 TPtrC8 DeviceID; |
|
2388 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2389 CleanupStack::PushL(pElement); |
|
2390 pElement->SetDeviceIDL(_L8("TestDevice")); |
|
2391 TInt retval=pElement->DeviceIDL(DeviceID); |
|
2392 TL(retval == KErrNone); |
|
2393 TL(DeviceID == _L8("TestDevice")); |
|
2394 CleanupStack::PopAndDestroy(pElement); |
|
2395 Teardown(); |
|
2396 return KErrNone; |
|
2397 } |
|
2398 |
|
2399 TInt CSenUtilsBCTest::SenTransportProperties_SetDeviceIDLL(TTestResult& aResult ) |
|
2400 { |
|
2401 SetupL(); |
|
2402 _LIT8(KElementText,"<Properties><DeviceID>TestDevice</DeviceID></Properties>"); |
|
2403 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2404 CleanupStack::PushL(pElement); |
|
2405 pElement->SetDeviceIDL(_L8("TestDevice")); |
|
2406 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2407 TL(*ElementBuf == KElementText); |
|
2408 CleanupStack::PopAndDestroy(pElement); |
|
2409 delete ElementBuf; |
|
2410 Teardown(); |
|
2411 return KErrNone; |
|
2412 } |
|
2413 |
|
2414 TInt CSenUtilsBCTest::SenTransportProperties_SoapActionLL(TTestResult& aResult ) |
|
2415 { |
|
2416 SetupL(); |
|
2417 TPtrC8 SoapURI; |
|
2418 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2419 CleanupStack::PushL(pElement); |
|
2420 pElement->SetSoapActionL(_L8("URI-referenceRFC2396")); |
|
2421 TInt retval=pElement->SoapActionL(SoapURI); |
|
2422 TL(retval == KErrNone); |
|
2423 TL(SoapURI == _L8("URI-referenceRFC2396")); |
|
2424 CleanupStack::PopAndDestroy(pElement); |
|
2425 Teardown(); |
|
2426 return KErrNone; |
|
2427 } |
|
2428 |
|
2429 TInt CSenUtilsBCTest::SenTransportProperties_SetSoapActionLL(TTestResult& aResult ) |
|
2430 { |
|
2431 SetupL(); |
|
2432 _LIT8(KElementText,"<Properties><SOAPAction>URI-referenceRFC2396</SOAPAction></Properties>"); |
|
2433 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2434 CleanupStack::PushL(pElement); |
|
2435 pElement->SetSoapActionL(_L8("URI-referenceRFC2396")); |
|
2436 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2437 TL(*ElementBuf == KElementText); |
|
2438 CleanupStack::PopAndDestroy(pElement); |
|
2439 delete ElementBuf; |
|
2440 Teardown(); |
|
2441 return KErrNone; |
|
2442 } |
|
2443 |
|
2444 TInt CSenUtilsBCTest::SenTransportProperties_DownloadFolderLL(TTestResult& aResult ) |
|
2445 { |
|
2446 SetupL(); |
|
2447 TPtrC8 Download; |
|
2448 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2449 CleanupStack::PushL(pElement); |
|
2450 pElement->SetDownloadFolderL(_L8("Download")); |
|
2451 TInt retval=pElement->DownloadFolderL(Download); |
|
2452 TL(retval == KErrNone); |
|
2453 TL(Download ==_L8("Download")); |
|
2454 CleanupStack::PopAndDestroy(pElement); |
|
2455 Teardown(); |
|
2456 return KErrNone; |
|
2457 } |
|
2458 |
|
2459 TInt CSenUtilsBCTest::SenTransportProperties_SetDownloadFolderLL(TTestResult& aResult ) |
|
2460 { |
|
2461 SetupL(); |
|
2462 _LIT8(KElementText,"<Properties><DownloadFolder>Download</DownloadFolder></Properties>"); |
|
2463 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2464 CleanupStack::PushL(pElement); |
|
2465 pElement->SetDownloadFolderL(_L8("Download")); |
|
2466 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2467 TL(*ElementBuf==KElementText); |
|
2468 CleanupStack::PopAndDestroy(pElement); |
|
2469 delete ElementBuf; |
|
2470 Teardown(); |
|
2471 return KErrNone; |
|
2472 } |
|
2473 |
|
2474 |
|
2475 TInt CSenUtilsBCTest::SenTransportProperties_SetFileAttachmentLL(TTestResult& aResult ) |
|
2476 { |
|
2477 SetupL(); |
|
2478 _LIT8(KElementText,"<Properties><FileAttachments><Attachments><Attachment0 cid="test:cid">c:\\test.file.txt</Attachment0></Attachments></FileAttachments></Properties>"); |
|
2479 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2480 CleanupStack::PushL(pElement); |
|
2481 pElement->SetFileAttachmentL(_L8("test:cid"),_L8("c:\\test.file.txt")); |
|
2482 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2483 TL(*ElementBuf==KElementText); |
|
2484 CleanupStack::PopAndDestroy(pElement); |
|
2485 delete ElementBuf; |
|
2486 Teardown(); |
|
2487 return KErrNone; |
|
2488 } |
|
2489 |
|
2490 |
|
2491 |
|
2492 TInt CSenUtilsBCTest::SenTransportProperties_MwsNamespaceLL(TTestResult& aResult ) |
|
2493 { |
|
2494 SetupL(); |
|
2495 |
|
2496 TPtrC8 NameSpace; |
|
2497 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2498 CleanupStack::PushL(pElement); |
|
2499 pElement->SetMwsNamespaceL(_L8("Mwsnsuri")); |
|
2500 TInt retval=pElement->MwsNamespaceL(NameSpace); |
|
2501 TL(retval == KErrNone); |
|
2502 TL(NameSpace == _L8("Mwsnsuri")); |
|
2503 CleanupStack::PopAndDestroy(pElement); |
|
2504 Teardown(); |
|
2505 return KErrNone; |
|
2506 |
|
2507 } |
|
2508 |
|
2509 TInt CSenUtilsBCTest::SenTransportProperties_SetMwsNamespaceLL(TTestResult& aResult ) |
|
2510 { |
|
2511 SetupL(); |
|
2512 |
|
2513 |
|
2514 _LIT8(KElementText,"<Properties><MwsNamespace>Mwsnsuri</MwsNamespace></Properties>"); |
|
2515 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2516 CleanupStack::PushL(pElement); |
|
2517 pElement->SetMwsNamespaceL(_L8("Mwsnsuri")); |
|
2518 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2519 TL(*ElementBuf == KElementText); |
|
2520 CleanupStack::PopAndDestroy(pElement); |
|
2521 delete ElementBuf; |
|
2522 Teardown(); |
|
2523 return KErrNone; |
|
2524 |
|
2525 |
|
2526 } |
|
2527 |
|
2528 |
|
2529 TInt CSenUtilsBCTest::SenTransportProperties_MessageIdLL(TTestResult& aResult ) |
|
2530 { |
|
2531 SetupL(); |
|
2532 |
|
2533 TPtrC8 MsgId; |
|
2534 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2535 CleanupStack::PushL(pElement); |
|
2536 pElement->SetMessageIdL(_L8("test-message")); |
|
2537 TInt retval=pElement->MessageIdL(MsgId); |
|
2538 TL(retval == KErrNone); |
|
2539 TL(MsgId == _L8("test-message")); |
|
2540 CleanupStack::PopAndDestroy(pElement); |
|
2541 Teardown(); |
|
2542 return KErrNone; |
|
2543 |
|
2544 } |
|
2545 |
|
2546 TInt CSenUtilsBCTest::SenTransportProperties_SetMessageIdLL(TTestResult& aResult ) |
|
2547 { |
|
2548 SetupL(); |
|
2549 |
|
2550 _LIT8(KElementText,"<Properties><MessageID>test-message</MessageID></Properties>"); |
|
2551 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2552 CleanupStack::PushL(pElement); |
|
2553 pElement->SetMessageIdL(_L8("test-message")); |
|
2554 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2555 TL(*ElementBuf == KElementText); |
|
2556 CleanupStack::PopAndDestroy(pElement); |
|
2557 delete ElementBuf; |
|
2558 Teardown(); |
|
2559 return KErrNone; |
|
2560 |
|
2561 } |
|
2562 |
|
2563 TInt CSenUtilsBCTest::SenTransportProperties_OnewayMessageOnOffLL(TTestResult& aResult ) |
|
2564 { |
|
2565 SetupL(); |
|
2566 |
|
2567 TBool OnRoff; |
|
2568 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2569 CleanupStack::PushL(pElement); |
|
2570 pElement->SetOnewayMessageOnOffL(TRUE); |
|
2571 TInt retval=pElement->OnewayMessageOnOffL(OnRoff); |
|
2572 TL(retval == KErrNone); |
|
2573 TL(OnRoff == TRUE); |
|
2574 CleanupStack::PopAndDestroy(pElement); |
|
2575 Teardown(); |
|
2576 return KErrNone; |
|
2577 |
|
2578 } |
|
2579 |
|
2580 TInt CSenUtilsBCTest::SenTransportProperties_SetOnewayMessageOnOffLL( TTestResult& aResult) |
|
2581 { |
|
2582 |
|
2583 SetupL(); |
|
2584 |
|
2585 _LIT8(KElementText,"<Properties><OneWayMessage>true</OneWayMessage></Properties>"); |
|
2586 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2587 CleanupStack::PushL(pElement); |
|
2588 pElement->SetOnewayMessageOnOffL(TRUE); |
|
2589 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
2590 TL(*ElementBuf == KElementText); |
|
2591 CleanupStack::PopAndDestroy(pElement); |
|
2592 delete ElementBuf; |
|
2593 Teardown(); |
|
2594 return KErrNone; |
|
2595 |
|
2596 } |
|
2597 |
|
2598 TInt CSenUtilsBCTest::SenTransportProperties_SetMaxTimeToLiveLL(TTestResult& aResult ) |
|
2599 { |
|
2600 SetupL(); |
|
2601 |
|
2602 TInt PropValue; |
|
2603 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2604 CleanupStack::PushL(pElement); |
|
2605 pElement->SetMaxTimeToLiveL(10); |
|
2606 //true case |
|
2607 TInt retval=pElement->MaxTimeToLiveL(PropValue); |
|
2608 TL(retval == KErrNone); |
|
2609 TL(PropValue == 10); |
|
2610 |
|
2611 CleanupStack::PopAndDestroy(pElement); |
|
2612 Teardown(); |
|
2613 return KErrNone; |
|
2614 |
|
2615 } |
|
2616 |
|
2617 TInt CSenUtilsBCTest::SenTransportProperties_MaxTimeToLiveLL(TTestResult& aResult ) |
|
2618 { |
|
2619 TTestResult Result; |
|
2620 SenTransportProperties_SetMaxTimeToLiveLL( Result); |
|
2621 } |
|
2622 |
|
2623 TInt CSenUtilsBCTest::SenTransportProperties_SetMinTimeToLiveLL(TTestResult& aResult ) |
|
2624 { |
|
2625 SetupL(); |
|
2626 |
|
2627 TInt PropValue; |
|
2628 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2629 CleanupStack::PushL(pElement); |
|
2630 pElement->SetMinTimeToLiveL(10); |
|
2631 //true case |
|
2632 TInt retval=pElement->MinTimeToLiveL(PropValue); |
|
2633 TL(retval == KErrNone); |
|
2634 TL(PropValue == 10); |
|
2635 |
|
2636 CleanupStack::PopAndDestroy(pElement); |
|
2637 Teardown(); |
|
2638 return KErrNone; |
|
2639 |
|
2640 } |
|
2641 |
|
2642 TInt CSenUtilsBCTest::SenTransportProperties_SetReaderL(TTestResult& aResult ) |
|
2643 { |
|
2644 SetupL(); |
|
2645 |
|
2646 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2647 CleanupStack::PushL(pElement); |
|
2648 pElement->SetReader(*iXmlReader); |
|
2649 |
|
2650 CleanupStack::PopAndDestroy(pElement); |
|
2651 Teardown(); |
|
2652 return KErrNone; |
|
2653 |
|
2654 } |
|
2655 |
|
2656 |
|
2657 TInt CSenUtilsBCTest::SenTransportProperties_PropertiesClassTypeL(TTestResult& aResult ) |
|
2658 { |
|
2659 SetupL(); |
|
2660 MSenProperties::TSenPropertiesClassType var = MSenProperties::ESenTransportProperties; |
|
2661 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2662 CleanupStack::PushL(pElement); |
|
2663 TL(var == pElement->PropertiesClassType()); |
|
2664 |
|
2665 CleanupStack::PopAndDestroy(pElement); |
|
2666 Teardown(); |
|
2667 return KErrNone; |
|
2668 |
|
2669 } |
|
2670 |
|
2671 TInt CSenUtilsBCTest::SenTransportProperties_WriteToLL(TTestResult& aResult ) |
|
2672 { |
|
2673 SetupL(); |
|
2674 |
|
2675 TBuf8<50> StreamBuf; |
|
2676 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")); |
|
2677 CleanupStack::PushL(pElement); |
|
2678 pElement->AddElementL(_L8("webservices")); |
|
2679 RWriteStream& ElemntStream=pElement->ContentWriteStreamL(); |
|
2680 |
|
2681 CSenTransportProperties* pElement1= CSenTransportProperties::NewL(); |
|
2682 CleanupStack::PushL(pElement1); |
|
2683 pElement1->WriteToL(ElemntStream); |
|
2684 |
|
2685 CleanupStack::PopAndDestroy(pElement1); |
|
2686 CleanupStack::PopAndDestroy(pElement); |
|
2687 |
|
2688 Teardown(); |
|
2689 return KErrNone; |
|
2690 |
|
2691 } |
|
2692 |
|
2693 TInt CSenUtilsBCTest::SenTransportProperties_ReadFromLL(TTestResult& aResult ) |
|
2694 { |
|
2695 SetupL(); |
|
2696 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2697 CleanupStack::PushL(pElement); |
|
2698 pElement->ReadFromL(_L8("")); |
|
2699 |
|
2700 CleanupStack::PopAndDestroy(pElement); |
|
2701 Teardown(); |
|
2702 return KErrNone; |
|
2703 |
|
2704 } |
|
2705 |
|
2706 TInt CSenUtilsBCTest::SenTransportProperties_CloneL(TTestResult& aResult ) |
|
2707 { |
|
2708 SetupL(); |
|
2709 TBool Flag; |
|
2710 TInt var; |
|
2711 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2712 CleanupStack::PushL(pElement); |
|
2713 CSenTransportProperties* pClone = NULL; |
|
2714 pClone = (CSenTransportProperties*)pElement->Clone(var); |
|
2715 if(pClone != NULL) |
|
2716 Flag = 1; |
|
2717 if(!(Flag)) return KErrArgument; |
|
2718 |
|
2719 delete pClone; |
|
2720 CleanupStack::PopAndDestroy(pElement); |
|
2721 |
|
2722 Teardown(); |
|
2723 return KErrNone; |
|
2724 |
|
2725 } |
|
2726 |
|
2727 TInt CSenUtilsBCTest::SenTransportProperties_IsSafeToCastL(TTestResult& aResult ) |
|
2728 { |
|
2729 SetupL(); |
|
2730 TBool Flag, retVal; |
|
2731 MSenProperties::TSenPropertiesClassType pVar = MSenProperties::ESenTransportProperties; |
|
2732 |
|
2733 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2734 CleanupStack::PushL(pElement); |
|
2735 |
|
2736 retVal = pElement->IsSafeToCast(pVar); |
|
2737 if(retVal != EFalse) |
|
2738 Flag = 1; |
|
2739 else |
|
2740 Flag = 0; |
|
2741 |
|
2742 MSenProperties::TSenPropertiesClassType xVar = MSenProperties::ESenXmlProperties; |
|
2743 retVal = pElement->IsSafeToCast(xVar); |
|
2744 if(retVal != EFalse) |
|
2745 Flag = 1; |
|
2746 else |
|
2747 return KErrArgument; |
|
2748 |
|
2749 CleanupStack::PopAndDestroy(pElement); |
|
2750 |
|
2751 Teardown(); |
|
2752 return KErrNone; |
|
2753 |
|
2754 } |
|
2755 |
|
2756 |
|
2757 TInt CSenUtilsBCTest::SenTransportProperties_CloneLL(TTestResult& aResult ) |
|
2758 { |
|
2759 SetupL(); |
|
2760 TBool Flag; |
|
2761 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2762 CleanupStack::PushL(pElement); |
|
2763 CSenTransportProperties* pClone = NULL; |
|
2764 pClone = (CSenTransportProperties*)pElement->CloneL(); |
|
2765 if(pClone != NULL) |
|
2766 Flag = 1; |
|
2767 if(!(Flag)) return KErrArgument; |
|
2768 |
|
2769 delete pClone; |
|
2770 CleanupStack::PopAndDestroy(pElement); |
|
2771 |
|
2772 Teardown(); |
|
2773 return KErrNone; |
|
2774 |
|
2775 } |
|
2776 |
|
2777 TInt CSenUtilsBCTest::SenTransportProperties_ApplyBindingLL(TTestResult& aResult ) |
|
2778 { |
|
2779 SetupL(); |
|
2780 TSOAPVersion var = ESOAP11; |
|
2781 CSenTransportProperties* pElement= CSenTransportProperties::NewL(); |
|
2782 CleanupStack::PushL(pElement); |
|
2783 pElement->ApplyBindingL(var); |
|
2784 CleanupStack::PopAndDestroy(pElement); |
|
2785 |
|
2786 Teardown(); |
|
2787 return KErrNone; |
|
2788 |
|
2789 } |
|
2790 |
|
2791 |
|
2792 TInt CSenUtilsBCTest::SenTransportProperties_MinTimeToLiveLL(TTestResult& aResult ) |
|
2793 { |
|
2794 TTestResult Result; |
|
2795 SenTransportProperties_SetMinTimeToLiveLL(Result); |
|
2796 } |
|
2797 |
|
2798 TInt CSenUtilsBCTest::SenHttpTransportProperties_NewLL(TTestResult& aResult) |
|
2799 { |
|
2800 SetupL(); |
|
2801 |
|
2802 TBool Flag; |
|
2803 CSenHttpTransportProperties *pProperties = CSenHttpTransportProperties::NewL(); |
|
2804 CleanupStack::PushL(pProperties ); |
|
2805 if(pProperties) |
|
2806 Flag=1; |
|
2807 else |
|
2808 Flag=0; |
|
2809 if(! Flag) return KErrArgument; |
|
2810 CleanupStack::PopAndDestroy(pProperties ); |
|
2811 Teardown(); |
|
2812 return KErrNone; |
|
2813 |
|
2814 } |
|
2815 |
|
2816 TInt CSenUtilsBCTest::SenHttpTransportProperties_NewLCL(TTestResult& aResult) |
|
2817 { |
|
2818 SetupL(); |
|
2819 |
|
2820 TBool Flag; |
|
2821 CSenHttpTransportProperties *pProperties = CSenHttpTransportProperties::NewLC(); |
|
2822 if(pProperties) |
|
2823 Flag=1; |
|
2824 else |
|
2825 Flag=0; |
|
2826 if(! Flag) return KErrArgument; |
|
2827 CleanupStack::PopAndDestroy(pProperties ); |
|
2828 Teardown(); |
|
2829 return KErrNone; |
|
2830 |
|
2831 } |
|
2832 |
|
2833 TInt CSenUtilsBCTest::SenHttpTransportProperties_NewL_1L(TTestResult& aResult) |
|
2834 { |
|
2835 SetupL(); |
|
2836 |
|
2837 TBool Flag; |
|
2838 _LIT8(KString,"<parent><element1/><element2/><element3/>parent content</parent>"); |
|
2839 CSenXmlReader* pParser = CSenXmlReader::NewL(); |
|
2840 CleanupStack::PushL(pParser); |
|
2841 CSenHttpTransportProperties *pProperties=CSenHttpTransportProperties::NewL(KString,*pParser); |
|
2842 CleanupStack::PushL(pProperties); |
|
2843 if(pProperties) |
|
2844 Flag=1; |
|
2845 else |
|
2846 Flag=0; |
|
2847 if(!( Flag )) return KErrArgument; |
|
2848 CleanupStack::PopAndDestroy(pProperties); |
|
2849 CleanupStack::PopAndDestroy(pParser); |
|
2850 Teardown(); |
|
2851 return KErrNone; |
|
2852 |
|
2853 } |
|
2854 |
|
2855 TInt CSenUtilsBCTest::SenHttpTransportProperties_NewLC_1L(TTestResult& aResult) |
|
2856 { |
|
2857 SetupL(); |
|
2858 |
|
2859 TBool Flag; |
|
2860 _LIT8(KString,"<parent><element1/><element2/><element3/>parent content</parent>"); |
|
2861 CSenXmlReader* pParser = CSenXmlReader::NewL(); |
|
2862 CleanupStack::PushL(pParser); |
|
2863 CSenHttpTransportProperties *pProperties=CSenHttpTransportProperties::NewLC(KString,*pParser); |
|
2864 if(pProperties) |
|
2865 Flag=1; |
|
2866 else |
|
2867 Flag=0; |
|
2868 if(!( Flag )) return KErrArgument; |
|
2869 CleanupStack::PopAndDestroy(pProperties); |
|
2870 CleanupStack::PopAndDestroy(pParser); |
|
2871 Teardown(); |
|
2872 return KErrNone; |
|
2873 |
|
2874 } |
|
2875 |
|
2876 TInt CSenUtilsBCTest::SenHttpTransportProperties_NewL_2L(TTestResult& aResult) |
|
2877 { |
|
2878 SetupL(); |
|
2879 |
|
2880 |
|
2881 TBool Flag; |
|
2882 CSenBaseElement* pElement= CSenBaseElement::NewL(_L8("Nokia")); |
|
2883 CleanupStack::PushL(pElement); |
|
2884 CSenHttpTransportProperties *pProperties=CSenHttpTransportProperties::NewL(*pElement); |
|
2885 CleanupStack::PushL(pProperties); |
|
2886 if(pProperties) |
|
2887 Flag=1; |
|
2888 else |
|
2889 Flag=0; |
|
2890 if(!( Flag )) return KErrArgument; |
|
2891 CleanupStack::PopAndDestroy(pProperties); |
|
2892 CleanupStack::PopAndDestroy(pElement); |
|
2893 Teardown(); |
|
2894 return KErrNone; |
|
2895 |
|
2896 } |
|
2897 |
|
2898 TInt CSenUtilsBCTest::SenHttpTransportProperties_NewLC_2L(TTestResult& aResult) |
|
2899 { |
|
2900 SetupL(); |
|
2901 |
|
2902 |
|
2903 TBool Flag; |
|
2904 CSenBaseElement* pElement= CSenBaseElement::NewL(_L8("Nokia")); |
|
2905 CleanupStack::PushL(pElement); |
|
2906 CSenHttpTransportProperties *pProperties=CSenHttpTransportProperties::NewLC(*pElement); |
|
2907 if(pProperties) |
|
2908 Flag=1; |
|
2909 else |
|
2910 Flag=0; |
|
2911 if(!( Flag )) return KErrArgument; |
|
2912 CleanupStack::PopAndDestroy(pProperties); |
|
2913 CleanupStack::PopAndDestroy(pElement); |
|
2914 Teardown(); |
|
2915 return KErrNone; |
|
2916 |
|
2917 } |
|
2918 /* |
|
2919 TInt CSenUtilsBCTest::SenVtcpTransportProperties_NewLL(TTestResult& aResult) |
|
2920 { |
|
2921 SetupL(); |
|
2922 |
|
2923 TBool Flag; |
|
2924 CSenVtcpTransportProperties *pProperties = CSenVtcpTransportProperties::NewL(); |
|
2925 CleanupStack::PushL(pProperties ); |
|
2926 if(pProperties) |
|
2927 Flag=1; |
|
2928 else |
|
2929 Flag=0; |
|
2930 if(! Flag) return KErrArgument; |
|
2931 CleanupStack::PopAndDestroy(pProperties ); |
|
2932 Teardown(); |
|
2933 return KErrNone; |
|
2934 |
|
2935 } |
|
2936 |
|
2937 TInt CSenUtilsBCTest::SenVtcpTransportProperties_NewLCL(TTestResult& aResult) |
|
2938 { |
|
2939 SetupL(); |
|
2940 |
|
2941 TBool Flag; |
|
2942 CSenVtcpTransportProperties *pProperties = CSenVtcpTransportProperties::NewLC(); |
|
2943 if(pProperties) |
|
2944 Flag=1; |
|
2945 else |
|
2946 Flag=0; |
|
2947 if(! Flag) return KErrArgument; |
|
2948 CleanupStack::PopAndDestroy(pProperties ); |
|
2949 Teardown(); |
|
2950 return KErrNone; |
|
2951 |
|
2952 } |
|
2953 |
|
2954 |
|
2955 TInt CSenUtilsBCTest::SenVtcpTransportProperties_NewL_1L(TTestResult& aResult) |
|
2956 { |
|
2957 SetupL(); |
|
2958 |
|
2959 TBool Flag; |
|
2960 _LIT8(KString,"<parent><element1/><element2/><element3/>parent content plus some other content</parent>"); |
|
2961 CSenXmlReader* pParser = CSenXmlReader::NewL(); |
|
2962 CleanupStack::PushL(pParser); |
|
2963 CSenVtcpTransportProperties *pProperties=CSenVtcpTransportProperties::NewL(KString,*pParser); |
|
2964 CleanupStack::PushL(pProperties); |
|
2965 if(pProperties) |
|
2966 Flag=1; |
|
2967 else |
|
2968 Flag=0; |
|
2969 if(!( Flag )) return KErrArgument; |
|
2970 CleanupStack::PopAndDestroy(pProperties); |
|
2971 CleanupStack::PopAndDestroy(pParser); |
|
2972 Teardown(); |
|
2973 return KErrNone; |
|
2974 |
|
2975 } |
|
2976 |
|
2977 TInt CSenUtilsBCTest::SenVtcpTransportProperties_NewLC_1L(TTestResult& aResult) |
|
2978 { |
|
2979 SetupL(); |
|
2980 |
|
2981 TBool Flag; |
|
2982 _LIT8(KString,"<parent><element1/><element2/><element3/>parent content plus some other content</parent>"); |
|
2983 CSenXmlReader* pParser = CSenXmlReader::NewL(); |
|
2984 CleanupStack::PushL(pParser); |
|
2985 CSenVtcpTransportProperties *pProperties=CSenVtcpTransportProperties::NewLC(KString,*pParser); |
|
2986 if(pProperties) |
|
2987 Flag=1; |
|
2988 else |
|
2989 Flag=0; |
|
2990 if(!( Flag )) return KErrArgument; |
|
2991 CleanupStack::PopAndDestroy(pProperties); |
|
2992 CleanupStack::PopAndDestroy(pParser); |
|
2993 Teardown(); |
|
2994 return KErrNone; |
|
2995 |
|
2996 } |
|
2997 |
|
2998 TInt CSenUtilsBCTest::SenVtcpTransportProperties_NewL_2L(TTestResult& aResult) |
|
2999 { |
|
3000 SetupL(); |
|
3001 |
|
3002 TBool Flag; |
|
3003 CSenBaseElement* pElement= CSenBaseElement::NewL(_L8("Nokia")); |
|
3004 CleanupStack::PushL(pElement); |
|
3005 CSenVtcpTransportProperties *pProperties=CSenVtcpTransportProperties::NewL(*pElement); |
|
3006 CleanupStack::PushL(pProperties); |
|
3007 if(pProperties) |
|
3008 Flag=1; |
|
3009 else |
|
3010 Flag=0; |
|
3011 if(!( Flag )) return KErrArgument; |
|
3012 CleanupStack::PopAndDestroy(pProperties); |
|
3013 CleanupStack::PopAndDestroy(pElement); |
|
3014 Teardown(); |
|
3015 return KErrNone; |
|
3016 |
|
3017 } |
|
3018 |
|
3019 TInt CSenUtilsBCTest::SenVtcpTransportProperties_NewLC_2L(TTestResult& aResult) |
|
3020 { |
|
3021 SetupL(); |
|
3022 |
|
3023 TBool Flag; |
|
3024 CSenBaseElement* pElement= CSenBaseElement::NewL(_L8("Nokia")); |
|
3025 CleanupStack::PushL(pElement); |
|
3026 CSenVtcpTransportProperties *pProperties=CSenVtcpTransportProperties::NewLC(*pElement); |
|
3027 if(pProperties) |
|
3028 Flag=1; |
|
3029 else |
|
3030 Flag=0; |
|
3031 if(!( Flag )) return KErrArgument; |
|
3032 CleanupStack::PopAndDestroy(pProperties); |
|
3033 CleanupStack::PopAndDestroy(pElement); |
|
3034 Teardown(); |
|
3035 return KErrNone; |
|
3036 |
|
3037 } |
|
3038 |
|
3039 TInt CSenUtilsBCTest::SenVtcpTransportProperties_OnewayMessageOnOffLL(TTestResult& aResult ) |
|
3040 { |
|
3041 SetupL(); |
|
3042 |
|
3043 TBool OnRoff; |
|
3044 CSenVtcpTransportProperties* pElement= CSenVtcpTransportProperties::NewL(); |
|
3045 CleanupStack::PushL(pElement); |
|
3046 pElement->SetOnewayMessageOnOffL(TRUE); |
|
3047 TInt retval=pElement->OnewayMessageOnOffL(OnRoff); |
|
3048 TL(retval == KErrNone); |
|
3049 TL(OnRoff == TRUE); |
|
3050 CleanupStack::PopAndDestroy(pElement); |
|
3051 Teardown(); |
|
3052 return KErrNone; |
|
3053 |
|
3054 } |
|
3055 |
|
3056 TInt CSenUtilsBCTest::SenVtcpTransportProperties_SetOnewayMessageOnOffLL( TTestResult& aResult) |
|
3057 { |
|
3058 |
|
3059 SetupL(); |
|
3060 |
|
3061 _LIT8(KElementText,"<Properties><OneWayMessage>true</OneWayMessage></Properties>"); |
|
3062 CSenVtcpTransportProperties* pElement= CSenVtcpTransportProperties::NewL(); |
|
3063 CleanupStack::PushL(pElement); |
|
3064 pElement->SetOnewayMessageOnOffL(TRUE); |
|
3065 HBufC8* ElementBuf=pElement->AsUtf8L(); |
|
3066 TL(*ElementBuf == KElementText); |
|
3067 CleanupStack::PopAndDestroy(pElement); |
|
3068 delete ElementBuf; |
|
3069 Teardown(); |
|
3070 return KErrNone; |
|
3071 |
|
3072 } |
|
3073 |
|
3074 TInt CSenUtilsBCTest::SenVtcpTransportProperties_SetMaxTimeToLiveLL(TTestResult& aResult ) |
|
3075 { |
|
3076 SetupL(); |
|
3077 |
|
3078 TInt PropValue; |
|
3079 CSenVtcpTransportProperties* pElement= CSenVtcpTransportProperties::NewL(); |
|
3080 CleanupStack::PushL(pElement); |
|
3081 pElement->SetMaxTimeToLiveL(10); |
|
3082 //true case |
|
3083 TInt retval=pElement->MaxTimeToLiveL(PropValue); |
|
3084 TL(retval == KErrNone); |
|
3085 TL(PropValue == 10); |
|
3086 |
|
3087 CleanupStack::PopAndDestroy(pElement); |
|
3088 Teardown(); |
|
3089 return KErrNone; |
|
3090 |
|
3091 } |
|
3092 |
|
3093 TInt CSenUtilsBCTest::SenVtcpTransportProperties_MaxTimeToLiveLL(TTestResult& aResult ) |
|
3094 { |
|
3095 TTestResult Result; |
|
3096 SenVtcpTransportProperties_SetMaxTimeToLiveLL( Result); |
|
3097 } |
|
3098 |
|
3099 TInt CSenUtilsBCTest::SenVtcpTransportProperties_SetMinTimeToLiveLL(TTestResult& aResult ) |
|
3100 { |
|
3101 SetupL(); |
|
3102 |
|
3103 TInt PropValue; |
|
3104 CSenVtcpTransportProperties* pElement= CSenVtcpTransportProperties::NewL(); |
|
3105 CleanupStack::PushL(pElement); |
|
3106 pElement->SetMinTimeToLiveL(10); |
|
3107 //true case |
|
3108 TInt retval=pElement->MinTimeToLiveL(PropValue); |
|
3109 TL(retval == KErrNone); |
|
3110 TL(PropValue == 10); |
|
3111 |
|
3112 CleanupStack::PopAndDestroy(pElement); |
|
3113 Teardown(); |
|
3114 return KErrNone; |
|
3115 |
|
3116 } |
|
3117 |
|
3118 TInt CSenUtilsBCTest::SenVtcpTransportProperties_MinTimeToLiveLL(TTestResult& aResult ) |
|
3119 { |
|
3120 TTestResult Result; |
|
3121 SenVtcpTransportProperties_SetMinTimeToLiveLL(Result); |
|
3122 } |
|
3123 */ |
|
3124 // End of File |