|
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 // INCLUDE FILES |
|
20 #include "SenServiceConnectionBCTest.h" |
|
21 #include <StifTestModule.h> |
|
22 #include <e32math.h> |
|
23 #include <libc/assert.h> |
|
24 |
|
25 // EXTERNAL INCLUDES |
|
26 #include <http.h> |
|
27 #include <httperr.h> |
|
28 |
|
29 #include <SenBaseFragment.h> |
|
30 #include <SenBaseElement.h> |
|
31 #include <SenDomFragment.h> |
|
32 #include <SenServiceConnection.h> |
|
33 #include <SenServicePattern.h> |
|
34 #include <SenSoapEnvelope.h> |
|
35 #include <SenSoapEnvelope2.h> |
|
36 #include <SenXmlReader.h> |
|
37 #include <SenXmlServiceDescription.h> |
|
38 #include <SenXmlUtils.h> |
|
39 #include <SenServiceManager.h> |
|
40 #include <SenIdentityProvider.h> |
|
41 #include <SenHttpTransportProperties.h> |
|
42 #include <SenSoapMessage.h> |
|
43 #include <SenSoapMessage2.h> |
|
44 #include <SenDateUtils.h> |
|
45 #include <SenTransportProperties.h> |
|
46 |
|
47 //#include <SenVtcpTransportProperties.h> |
|
48 #include "testproperty.h" |
|
49 #include <xmlengchunkcontainer.h> |
|
50 #include <xmlengfilecontainer.h> |
|
51 //#include <XmlEngSerializer.h> |
|
52 |
|
53 #include <e32base.h> // for CActive |
|
54 #include <aknnotewrappers.h> |
|
55 |
|
56 #include <commdb.h> |
|
57 |
|
58 #include <s32file.h> // filestream |
|
59 #include <e32svr.h> // fileman |
|
60 #include "TestConnection.h" |
|
61 #include "testprovider.h" |
|
62 #include "testfileobserver.h" |
|
63 #include "testconsumer.h" |
|
64 // INTERNAL INCLUDES |
|
65 |
|
66 //Macro for Porting to STIF |
|
67 #define LOCAL_ASSERT(expression) {if(!(expression)){return KErrArgument;}} |
|
68 #define STIFF_ASSERT_DESC(expression, desc) {if(!(expression)){RDebug::Print(_L(desc)) ;return KErrArgument;}} |
|
69 #define STIFF_ASSERT_NOT_EQUALS_DESC(expression1, expression2, desc) \ |
|
70 {TL((expression1) != (expression2)){RDebug::Print(_L(desc)) ;}} |
|
71 |
|
72 |
|
73 // CONSTANTS |
|
74 namespace |
|
75 { |
|
76 |
|
77 #ifdef AOL_RADIO_SERVICE |
|
78 // AOL redio.etenee.net:9080 |
|
79 _LIT8(KWSPContract, "urn:aol-com:services:radio"); |
|
80 _LIT8(KAuthServEndpoint, "http://radio.etenee.net:9080/tfs/IDPSSO_IDWSF"); |
|
81 _LIT8(KASProviderID, "http://radio.etenee.net:9080/tfs/"); |
|
82 _LIT8(KTestAuthzID, "012345678901234"); |
|
83 _LIT8(KTestPassword, "012345678901234"); |
|
84 #elif VALIMO_ADDRESSBOOK_SERVICE |
|
85 // Addressbook service hosted inside Nokia intra by ASP / testing team |
|
86 _LIT8(KWSPContract, "urn:nokia:test:addrbook:2004-09"); |
|
87 _LIT8(KAuthServEndpoint, "http://10.21.32.110/tfs/IDPSSO_IDWSF10"); |
|
88 _LIT8(KASProviderID, "provider01"); |
|
89 _LIT8(KTestAuthzID, "john"); |
|
90 _LIT8(KTestPassword, "password"); |
|
91 #elif SYSOPENDIGIA_ADDRESSBOOK_SERVICE |
|
92 _LIT8(KWSPContract, "urn:nokia:test:addrbook:2004-09"); |
|
93 _LIT8(KAuthServEndpoint, "http://ys01liw022.partner.yomi.com:9080/tfs/IDPSSO_IDWSF"); |
|
94 _LIT8(KASProviderID, "http://ys01liw022.partner.yomi.com:9080/tfs/"); |
|
95 _LIT8(KTestAuthzID, "012345678901234"); |
|
96 _LIT8(KTestPassword, "012345678901234"); |
|
97 #else // == default (no MACROs defined in .mmp) |
|
98 // Addressbook service hosted by Forum Nokia (accessible from external network) |
|
99 _LIT8(KWSPContract, "urn:nokia:test:addrbook:2004-09"); |
|
100 _LIT8(KAuthServEndpoint, "http://selma.ndhub.net:9080/tfs/IDPSSO_IDWSF"); |
|
101 _LIT8(KASProviderID, "http://selma.ndhub.net:9080/tfs/"); |
|
102 _LIT8(KTestAuthzID, "testuser1"); |
|
103 _LIT8(KTestPassword, "testuser1"); |
|
104 #endif // FN_ADDRESSBOOK_SERVICE |
|
105 |
|
106 |
|
107 _LIT8(KASContract, "urn:liberty:as:2004-04"); |
|
108 _LIT8(KHttpsEndPoint, "https://10.21.32.110/sereneHardCoded/WS_WSI_R9980_001" ); |
|
109 |
|
110 _LIT8(KWSIFrameworkID, "WS-I"); |
|
111 _LIT8(KIDWSFFrameworkID, "ID-WSF"); |
|
112 _LIT8(KRESTFrameworkID, "REST"); |
|
113 // _LIT8(KWsStarFrameworkID, "WS-STAR"); |
|
114 #ifdef SYSOPENDIGIA_ADDRESSBOOK_SERVICE |
|
115 _LIT8(KAddressBookServiceId, "http://radio.aol.com/xsd/2.0/ns/"); |
|
116 _LIT8(KAddressBookContract, "http://radio.aol.com/xsd/2.0/ns/"); |
|
117 #else |
|
118 _LIT8(KAddressBookServiceId, "urn:nokia:test:addrbook:2004-09"); |
|
119 _LIT8(KIPCServiceEndPoint, "http://125.16.213.244//sereneHardCoded//WS_IPCImpr_001"); |
|
120 _LIT8(KMtomEndPoint, "http://10.21.32.20:8080//mtom//servlet//MtomRequest"); |
|
121 |
|
122 _LIT8(KAddressBookContract, "urn:nokia:test:addrbook:2004-09"); |
|
123 #endif |
|
124 |
|
125 #ifdef __WINS__ |
|
126 #ifdef SYSOPENDIGIA_ADDRESSBOOK_SERVICE |
|
127 _LIT(KIAPName, "Ethernet No Daemon Static IP"); |
|
128 #else |
|
129 //_LIT(KIAPName, "Ethernet No Daemon Static IP"); |
|
130 _LIT(KIAPName, "Ethernet with Daemon Dynamic IP"); |
|
131 #endif |
|
132 #else |
|
133 // ARMv5 |
|
134 _LIT(KIAPName, "Internet"); |
|
135 #endif |
|
136 _LIT8(KLoggerFileNameProperty, "HttpLoggerFileName"); |
|
137 |
|
138 _LIT(KFileToRead, "c:\\Logs\\LoggingHttpFilter\\httptrace.xml"); |
|
139 _LIT8(KFileName, "httptrace.xml"); |
|
140 |
|
141 _LIT8(KHTTPMethodGet, "GET"); |
|
142 _LIT8(KHTTPMethodPost, "POST"); |
|
143 |
|
144 // const TBool MultipleSimultanousRHttpSessionsSupported = EFalse; |
|
145 // If IAP changes all previously sent messages will be canceled. |
|
146 |
|
147 |
|
148 //_LIT8(KProxyHost, "esprx00.nokia.com"); |
|
149 _LIT8(KProxyHost, "172.19.160.50"); // IP address to: bsprx01.americas.nokia.com |
|
150 const TInt KProxyPort = 8080; |
|
151 |
|
152 //MSN Constants : |
|
153 //--------------- |
|
154 _LIT8(KPassportUser, "m_minkkis@hotmail.com"); |
|
155 _LIT8(KPassportPass, "M1nkk1s"); |
|
156 |
|
157 _LIT8(KStsEndpoint, "https://login.live.com/rst2.srf"); |
|
158 _LIT8(KMSNProxy, "tcp.mws.mobile.live.com"); |
|
159 //_LIT8(KMetadataEndpoint, "http://10.132.11.31/WSStar/secpolicy/secpol.xml"); |
|
160 _LIT8(KMetadataEndpoint, "https://http.mws.mobile.live.com/2006/10/MWP2007_02/SecurityPolicy/Default.aspx"); |
|
161 |
|
162 _LIT8(KPolicyAdr, "Addressing"); |
|
163 _LIT8(KPolicyMT, "MetadataEndpoint"); |
|
164 _LIT8(KPolicyTLS, "UsernameTokenOverTLS"); |
|
165 _LIT8(KPolicySOAP12, "SOAP12"); |
|
166 _LIT8(KPolicyPassExt, "PassportExtensions"); |
|
167 _LIT8(KProviderId, "provider01"); |
|
168 |
|
169 #ifdef OLD_MSN_NAMESPACE_2005_08 |
|
170 _LIT8(KMessagingEndpoint, "tcp://schemas.live.com/mws/2005/08/messaging"); |
|
171 _LIT8(KMessagingContract, "http://schemas.live.com/mws/2005/08/messaging"); |
|
172 _LIT8(KMessagingNameSpace, "http://schemas.live.com/mws/2005/08/core"); |
|
173 #else |
|
174 _LIT8(KMessagingEndpoint, "tcp://schemas.live.com/mws/2006/10/messaging"); |
|
175 _LIT8(KMessagingContract, "http://schemas.live.com/mws/2006/10/messaging"); |
|
176 _LIT8(KMessagingNameSpace, "http://schemas.live.com/mws/2006/10/core"); |
|
177 #endif |
|
178 } |
|
179 |
|
180 // CONSTRUCTION |
|
181 // ============================ MEMBER FUNCTIONS =============================== |
|
182 |
|
183 // ----------------------------------------------------------------------------- |
|
184 // CSenServiceConnectionBCTest::Case |
|
185 // Returns a test case by number. |
|
186 // |
|
187 // This function contains an array of all available test cases |
|
188 // i.e pair of case name and test function. If case specified by parameter |
|
189 // aCaseNumber is found from array, then that item is returned. |
|
190 // |
|
191 // The reason for this rather complicated function is to specify all the |
|
192 // test cases only in one place. It is not necessary to understand how |
|
193 // function pointers to class member functions works when adding new test |
|
194 // cases. See function body for instructions how to add new test case. |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 const TCaseInfo CSenServiceConnectionBCTest::Case ( |
|
198 const TInt aCaseNumber ) const |
|
199 { |
|
200 |
|
201 /** |
|
202 * To add new test cases, implement new test case function and add new |
|
203 * line to KCases array specify the name of the case and the function |
|
204 * doing the test case |
|
205 * In practice, do following |
|
206 * 1) Make copy of existing test case function and change its name |
|
207 * and functionality. Note that the function must be added to |
|
208 * SenServiceManager_stif.cpp file and to SenServiceManager_stif.h |
|
209 * header file. |
|
210 * |
|
211 * 2) Add entry to following KCases array either by using: |
|
212 * |
|
213 * 2.1: FUNCENTRY or ENTRY macro |
|
214 * ENTRY macro takes two parameters: test case name and test case |
|
215 * function name. |
|
216 * |
|
217 * FUNCENTRY macro takes only test case function name as a parameter and |
|
218 * uses that as a test case name and test case function name. |
|
219 * |
|
220 * Or |
|
221 * |
|
222 * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used |
|
223 * only with OOM (Out-Of-Memory) testing! |
|
224 * |
|
225 * OOM_ENTRY macro takes five parameters: test case name, test case |
|
226 * function name, TBool which specifies is method supposed to be run using |
|
227 * OOM conditions, TInt value for first heap memory allocation failure and |
|
228 * TInt value for last heap memory allocation failure. |
|
229 * |
|
230 * OOM_FUNCENTRY macro takes test case function name as a parameter and uses |
|
231 * that as a test case name, TBool which specifies is method supposed to be |
|
232 * run using OOM conditions, TInt value for first heap memory allocation |
|
233 * failure and TInt value for last heap memory allocation failure. |
|
234 */ |
|
235 |
|
236 static TCaseInfoInternal const KCases[] = |
|
237 { |
|
238 // To add new test cases, add new items to this array |
|
239 |
|
240 // NOTE: When compiled to GCCE, there must be Classname:: |
|
241 // declaration in front of the method name, e.g. |
|
242 // CSenServiceManagerBCTest::PrintTest. Otherwise the compiler |
|
243 // gives errors. |
|
244 // TEST TABLE |
|
245 |
|
246 //ENTRY("RegisterIdentityProviderL CSenServiceConnection RegisterIdentityProviderL", CSenServiceConnectionBCTest::UT_CSenServiceConnection_RegisterIdentityProviderLL), |
|
247 |
|
248 |
|
249 //ENTRY("SendL, Pattern, IAP1 Test CSenServiceConnection SendL, Pattern, IAP1 Test",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_Pattern_IAP1L), |
|
250 |
|
251 //ENTRY("SendL, Pattern, IAP2 Test CSenServiceConnection SendL, Pattern, IAP2 Test",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_Pattern_IAP2L), |
|
252 |
|
253 //ENTRY("SendL, Pattern, IAP3 Test CSenServiceConnection SendL, Pattern, IAP3 Test",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_Pattern_IAP3L), |
|
254 |
|
255 ENTRY( "NewL - contract test CSenServiceConnection NewL contract",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_ContractL), |
|
256 ENTRY("NewLC - contract test CSenServiceConnection NewLC contract",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_ContractL), |
|
257 |
|
258 ENTRY("NewL - description test for WS-I CSenServiceConnection NewL description for WS-I",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_WS_I_DescriptionL), |
|
259 |
|
260 ENTRY("NewLC - description test for WS-I CSenServiceConnection NewLC description for WS-I",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_WS_I_DescriptionL), |
|
261 |
|
262 ENTRY("NewL - description test for ID-WSF CSenServiceConnection NewL description for ID-WSF",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_ID_WSF_DescriptionL), |
|
263 |
|
264 ENTRY("NewLC - description test for ID-WSF CSenServiceConnection NewLC description for ID-WSF",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_ID_WSF_DescriptionL), |
|
265 |
|
266 ENTRY("NewL - pattern test for WS-I CSenServiceConnection NewL pattern for WS-I",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_WS_I_PatternL), |
|
267 |
|
268 ENTRY("NewLC - pattern test for WS-I CSenServiceConnection NewLC pattern for WS-I",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_WS_I_PatternL), |
|
269 |
|
270 ENTRY("NewL - pattern test for ID-WSF CSenServiceConnection NewL pattern for ID-WSF",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_ID_WSF_PatternL), |
|
271 |
|
272 ENTRY("NewLC - pattern test for ID-WSF CSenServiceConnection NewLC pattern for ID-WSF",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_ID_WSF_PatternL), |
|
273 |
|
274 ENTRY( "NewL1 - contract test CSenServiceConnection NewL contract",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_ContractL1), |
|
275 |
|
276 ENTRY("NewLC1 - contract test CSenServiceConnection NewLC contract",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_ContractL1), |
|
277 |
|
278 ENTRY("NewL1 - description test for WS-I CSenServiceConnection NewL description for WS-I",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_WS_I_DescriptionL1), |
|
279 |
|
280 ENTRY("NewLC1 - description test for WS-I CSenServiceConnection NewLC description for WS-I",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_WS_I_DescriptionL1), |
|
281 |
|
282 |
|
283 ENTRY("NewL1 - pattern test for WS-I CSenServiceConnection NewL pattern for WS-I",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_WS_I_PatternL1), |
|
284 |
|
285 ENTRY("NewLC1 - pattern test for WS-I CSenServiceConnection NewLC pattern for WS-I",CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_WS_I_PatternL1), |
|
286 |
|
287 /* |
|
288 ENTRY("SendL - no error test CSenServiceConnection SendL no error",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_NoErrorL), |
|
289 ENTRY("SendL - cancel test CSenServiceConnection SendL no error",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_CancelL), |
|
290 |
|
291 ENTRY("SendL - connection is not initialized test CSenServiceConnection SendL connection is not initialized",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_ConNotInitialL), |
|
292 |
|
293 ENTRY("SendL - Multiple Messages CSenServiceConnection SendL Multiple Messages",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendMultipleMessagesL), |
|
294 ENTRY("SendL, Get,Post 1 Test CSenServiceConnection SendL, Get,Post 1 Test",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_Get_Post1L), |
|
295 |
|
296 ENTRY("SendL, Get,Post 2 Test CSenServiceConnection SendL, Get,Post 2 Test",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_Get_Post2L), |
|
297 |
|
298 ENTRY("SendL, Post, Proxy 1 Test CSenServiceConnection SendL, Post, Proxy 1 Test",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_Proxy1L), |
|
299 |
|
300 ENTRY("SendL, Post, Proxy 2 Test CSenServiceConnection SendL connection is not initialized",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_Proxy2L), |
|
301 |
|
302 ENTRY("SendL, ContentType1 Test CSenServiceConnection SendL, ContentType1 Test",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_ContentType1L), |
|
303 |
|
304 ENTRY("SendL, ContentType2 Test CSenServiceConnection SendL, ContentType2 Test",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_ContentType2L), |
|
305 ENTRY("SendL, UserAgent1 Test CSenServiceConnection SendL, UserAgent1 Test",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_UserAgent1L), |
|
306 |
|
307 ENTRY("SendL, UserAgent2 Test CSenServiceConnection SendL, UserAgent2 Test",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_UserAgent2L), |
|
308 ENTRY("SendL, Message SoapAction Test CSenServiceConnection SendL, Message SoapAction Test",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_MessageSoapActionL), |
|
309 ENTRY("SendL, SoapAction1 Test CSenServiceConnection SendL, SoapAction1 Test",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_SoapAction1L), |
|
310 |
|
311 ENTRY("SendL, SoapAction2 Test CSenServiceConnection SendL, SoapAction2 Test",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_SoapAction2L), |
|
312 ENTRY("SendL, CustomHttpHeader Test CSenServiceConnection SendL, CustomHttpHeader Test",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_CustomHttpHeaderL), |
|
313 ENTRY("SendL, TP boundaries Test CSenServiceConnection SendL, TP boundaries Test", CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries1), |
|
314 |
|
315 ENTRY("SendL, TP boundaries Test CSenServiceConnection", CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries2), |
|
316 ENTRY("SendL, TP boundaries Test CSenServiceConnection", CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries3), |
|
317 ENTRY("SendL, TP boundaries Test CSenServiceConnection", CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries4), |
|
318 ENTRY("SendL, TP boundaries Test CSenServiceConnection", CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries5), |
|
319 ENTRY("SendL, TP boundaries Test CSenServiceConnection", CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries6), |
|
320 ENTRY("SendL, TP boundaries Test CSenServiceConnection", CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries7), |
|
321 ENTRY("SendL, TP boundaries Test CSenServiceConnection", CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries8), |
|
322 ENTRY("SendL, TP boundaries Test CSenServiceConnection", CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries9), |
|
323 ENTRY("SendL, TP SecDialog Test CSenServiceConnection SendL connection is not initialized",CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_SecDialog), |
|
324 ENTRY("SendL, TP Omitted True Test CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Omitted_True), |
|
325 ENTRY("SendL, TP Omitted False Test CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Omitted_False), |
|
326 ENTRY("SendL, TP Removed Test CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Removed), |
|
327 ENTRY("SendL, TP Omit/Rem Test CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Omit_Rem), |
|
328 ENTRY("SubmitL, LibXml2 CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_LibXml2_L), |
|
329 ENTRY("SubmitL, LibXml2 + props CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_LibXml2_with_Properties_L), |
|
330 ENTRY("SubmitL, BLOB 20KB CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_LibXml2_MTOM_20KBL), |
|
331 ENTRY("SubmitL, BLOB 200KB CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_LibXml2_MTOM_200KBL), |
|
332 ENTRY("SubmitL, BLOB less1MB CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_LibXml2_MTOM_Less1MBL), |
|
333 ENTRY("SubmitL, BLOB more1MB CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_LibXml2_MTOM_More1MBL), |
|
334 ENTRY("MSN - Basic case CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_TestMessengerL), |
|
335 ENTRY("MSN - ReUse Credential CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_TestMessenger2L), |
|
336 ENTRY("MSN - AuthCallback success CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_TestMessenger3L), |
|
337 ENTRY("MSN - AuthCallback fail CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_TestMessenger4L), |
|
338 ENTRY("MSN - UserInfoPrompt CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_TestMessenger5L), |
|
339 ENTRY("MSN - show prompt CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_TestMessenger6L), |
|
340 ENTRY("MSN - Invalid password CSenServiceConnection",CSenServiceConnectionBCTest::UT_CSenServiceConnection_TestMessenger7L), |
|
341 */ |
|
342 ENTRY("SendL- CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::SendL), |
|
343 ENTRY("Send2L- CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::Send2L), |
|
344 ENTRY("Send3L- CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::Send3L), |
|
345 ENTRY("Send4L- CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::Send4L), |
|
346 ENTRY("Send5L- CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::Send5L), |
|
347 ENTRY("SubmitL- CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::SubmitL), |
|
348 ENTRY("Submit2L- CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::Submit2L), |
|
349 ENTRY("Submit3L- CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::Submit3L), |
|
350 ENTRY("Submit4L- CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::Submit4L), |
|
351 ENTRY("Submit5L- CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::Submit5L), |
|
352 ENTRY("IsReady- CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::IsReady), |
|
353 ENTRY("HasFacetL-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::HasFacetL), |
|
354 ENTRY("CompleteServerMessagesOnOff-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::CompleteServerMessagesOnOff), |
|
355 ENTRY("ServiceDescriptionL-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::ServiceDescriptionL), |
|
356 ENTRY("StartTransaction-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::StartTransaction), |
|
357 ENTRY("TransactionCompleted-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::TransactionCompleted), |
|
358 ENTRY("TxnId-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::TxnId), |
|
359 ENTRY("SetTransportPropertiesL-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::SetTransportPropertiesL), |
|
360 ENTRY("TransportPropertiesL-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::TransportPropertiesL), |
|
361 ENTRY("Response-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::Response), |
|
362 ENTRY("CancelTransaction-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::CancelTransaction), |
|
363 ENTRY("IdentityProviderL-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::IdentityProvider1L), |
|
364 ENTRY("Identifier-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::Identifier), |
|
365 ENTRY("Name-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::Name), |
|
366 ENTRY("Type-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::Type), |
|
367 ENTRY("Value-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::Value), |
|
368 ENTRY("IntValue-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::IntValue), |
|
369 ENTRY("BoolValue-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::BoolValue), |
|
370 ENTRY("ValueTokensL-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::ValueTokensL), |
|
371 ENTRY("IdentityProviderL-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::IdentityProvider2L), |
|
372 ENTRY("UsernameL-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::Username1L), |
|
373 ENTRY("PasswordL-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::Password1L), |
|
374 ENTRY("ExtendedInterface-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::ExtendedInterface1L), |
|
375 ENTRY("TransferProgress-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::TransferProgress), |
|
376 ENTRY("HandleMeassage-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::HandleMeassage), |
|
377 ENTRY("HandleErrorL-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::HandleErrorL), |
|
378 ENTRY("SetStatus-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::SetStatus), |
|
379 // ENTRY("SendL - RfileHandle - Test for sending 4.4M jpg file to the server ",CSenServiceConnectionBCTest::UT_CSenServiceConnectionSnapIdL), |
|
380 ENTRY("SendL - RfileHandle - IPCImpBigRequest ",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_RFileL_IPCBigrequest), |
|
381 ENTRY("SendL - RfileHandle - Simple Request ",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_RFileL), |
|
382 ENTRY("SubmitL - RfileHandle - Simple Request ",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_RFileL), |
|
383 //ENTRY("SubmitL - RfileHandle -IPCImpBigRequest ",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_RFileL_IPCBigrequest), |
|
384 // ENTRY("SubmitL - RfileHandle -MTOM ",CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_RFileL_MTOM), |
|
385 #ifdef __ENABLE_ALR__ |
|
386 ENTRY("ALR-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::ALRL), |
|
387 #endif //__ENABLE_ALR__ |
|
388 ENTRY("CoBrand-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::CoBrandL), |
|
389 ENTRY("HostletConsumer-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::HostletConsumerL), |
|
390 ENTRY("DataTrafficDetails-CSenServiceConnectionBCTest",CSenServiceConnectionBCTest::DataTrafficDetailsL), |
|
391 }; |
|
392 |
|
393 // Verify that case number is valid |
|
394 if( (TUint) aCaseNumber >= sizeof( KCases ) / |
|
395 sizeof( TCaseInfoInternal ) ) |
|
396 { |
|
397 // Invalid case, construct empty object |
|
398 TCaseInfo null( (const TText*) L"" ); |
|
399 null.iMethod = NULL; |
|
400 null.iIsOOMTest = EFalse; |
|
401 null.iFirstMemoryAllocation = 0; |
|
402 null.iLastMemoryAllocation = 0; |
|
403 return null; |
|
404 } |
|
405 |
|
406 // Construct TCaseInfo object and return it |
|
407 TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName ); |
|
408 tmp.iMethod = KCases[ aCaseNumber ].iMethod; |
|
409 tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest; |
|
410 tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation; |
|
411 tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation; |
|
412 return tmp; |
|
413 |
|
414 } |
|
415 |
|
416 // METHODS |
|
417 /* |
|
418 CSenVtcpTransportProperties* CSenServiceConnectionBCTest::CreateMSTransportPropertiesL(TMSCommands aCommand) |
|
419 { |
|
420 #ifdef OLD_MSN_NAMESPACE_2005_08 |
|
421 _LIT8(KRegisterAct, "http://schemas.live.com/mws/2005/08/messaging/Register"); |
|
422 _LIT8(KInviteReqAct,"http://schemas.live.com/mws/2005/08/messaging/Invite"); |
|
423 _LIT8(KSendReqAct,"http://schemas.live.com/mws/2005/08/messaging/Message"); |
|
424 #else |
|
425 _LIT8(KRegisterAct, "http://schemas.live.com/mws/2006/10/messaging/Register"); |
|
426 _LIT8(KInviteReqAct,"http://schemas.live.com/mws/2006/10/messaging/Invite"); |
|
427 _LIT8(KSendReqAct,"http://schemas.live.com/mws/2006/10/messaging/Message"); |
|
428 |
|
429 #endif |
|
430 |
|
431 CSenVtcpTransportProperties* pVtcpProperties = CSenVtcpTransportProperties::NewLC(); |
|
432 pVtcpProperties->SetProxyHostL(KMSNProxy); |
|
433 //pVtcpProperties->SetOnewayMessageOnOffL(TRUE); |
|
434 |
|
435 pVtcpProperties->SetMwsNamespaceL(KMessagingNameSpace); |
|
436 |
|
437 switch (aCommand) |
|
438 { |
|
439 case EMSNMessengerRegister: |
|
440 { |
|
441 pVtcpProperties->SetSoapActionL(KRegisterAct); |
|
442 break; |
|
443 } |
|
444 case EMSNMessengerUnRegister: |
|
445 { |
|
446 pVtcpProperties->SetSoapActionL(KRegisterAct); |
|
447 break; |
|
448 } |
|
449 case EMSNMessengerInvite: |
|
450 { |
|
451 pVtcpProperties->SetSoapActionL(KInviteReqAct); |
|
452 break; |
|
453 } |
|
454 case EMSNMessengerSend: |
|
455 { |
|
456 pVtcpProperties->SetSoapActionL(KSendReqAct); |
|
457 break; |
|
458 } |
|
459 default: |
|
460 break; |
|
461 } |
|
462 |
|
463 CleanupStack::Pop(pVtcpProperties); |
|
464 |
|
465 return pVtcpProperties; |
|
466 } |
|
467 */ |
|
468 CSenSoapMessage2* CSenServiceConnectionBCTest::CreateMSSoapMessage(TMSCommands aCommand) |
|
469 { |
|
470 #ifdef OLD_MSN_NAMESPACE_2005_08 |
|
471 _LIT8(KReristerReq, "<sip:RegisterRequest xmlns:sip=\"http://schemas.live.com/mws/2005/08/messaging\">\ |
|
472 <sip:Expires>240</sip:Expires>\ |
|
473 <sip:AutoOffline>0</sip:AutoOffline>\ |
|
474 <sip:Capabilities>1074003969</sip:Capabilities>\ |
|
475 <sip:SubscribedNotifications>31</sip:SubscribedNotifications>\ |
|
476 <sip:MessengerArgot sip:Status=\"Online\" sip:PresenceUpdates=\"All\"/>\ |
|
477 </sip:RegisterRequest>"); |
|
478 |
|
479 _LIT8(KUnReristerReq, "<sip:RegisterRequest xmlns:sip=\"http://schemas.live.com/mws/2005/08/messaging\">\ |
|
480 <sip:Expires>0</sip:Expires>\ |
|
481 <sip:MessengerArgot sip:Status=\"Online\" sip:PresenceUpdates=\"All\"/>\ |
|
482 </sip:RegisterRequest>"); |
|
483 |
|
484 _LIT8(KInviteReq, |
|
485 "<sip:InviteRequest xmlns:sip=\"http://schemas.live.com/mws/2005/08/messaging\">\ |
|
486 <sip:Call>\ |
|
487 <mc:To xmlns:mc=\"http://schemas.live.com/mws/2005/08/contacts\">7553</mc:To>\ |
|
488 </sip:Call>\ |
|
489 </sip:InviteRequest>"); |
|
490 |
|
491 _LIT8(KSendReq, |
|
492 "<sip:MessageRequest xmlns:sip=\"http://schemas.live.com/mws/2005/08/messaging\">\ |
|
493 <sip:Call>\ |
|
494 <sip:CallID>1</sip:CallID>\ |
|
495 </sip:Call>\ |
|
496 <sip:MessageObject sip:ContentType=\"text/plain\">\ |
|
497 <sip:MessageBody>lalamido</sip:MessageBody>\ |
|
498 </sip:MessageObject>\ |
|
499 </sip:MessageRequest>"); |
|
500 #else |
|
501 _LIT8(KReristerReq, "<sip:RegisterRequest xmlns:sip=\"http://schemas.live.com/mws/2006/10/messaging\">\ |
|
502 <sip:Expires>240</sip:Expires>\ |
|
503 <sip:AutoOffline>0</sip:AutoOffline>\ |
|
504 <sip:Capabilities>1074003969</sip:Capabilities>\ |
|
505 <sip:SubscribedNotifications>31</sip:SubscribedNotifications>\ |
|
506 <sip:MessengerArgot sip:Status=\"Online\" sip:PresenceUpdates=\"All\"/>\ |
|
507 </sip:RegisterRequest>"); |
|
508 |
|
509 _LIT8(KUnReristerReq, "<sip:RegisterRequest xmlns:sip=\"http://schemas.live.com/mws/2006/10/messaging\">\ |
|
510 <sip:Expires>0</sip:Expires>\ |
|
511 <sip:MessengerArgot sip:Status=\"Online\" sip:PresenceUpdates=\"All\"/>\ |
|
512 </sip:RegisterRequest>"); |
|
513 |
|
514 _LIT8(KInviteReq, |
|
515 "<sip:InviteRequest xmlns:sip=\"http://schemas.live.com/mws/2006/10/messaging\">\ |
|
516 <sip:Call>\ |
|
517 <mc:To xmlns:mc=\"http://schemas.live.com/mws/2006/10/contacts\">4878</mc:To>\ |
|
518 </sip:Call>\ |
|
519 </sip:InviteRequest>"); |
|
520 |
|
521 _LIT8(KSendReq, |
|
522 "<sip:MessageRequest xmlns:sip=\"http://schemas.live.com/mws/2006/10/messaging\">\ |
|
523 <sip:Call>\ |
|
524 <sip:CallID>1</sip:CallID>\ |
|
525 </sip:Call>\ |
|
526 <sip:MessageObject sip:ContentType=\"text/plain\">\ |
|
527 <sip:MessageBody>lalamido</sip:MessageBody>\ |
|
528 </sip:MessageObject>\ |
|
529 </sip:MessageRequest>"); |
|
530 #endif |
|
531 |
|
532 CSenSoapMessage2* pMessage = CSenSoapMessage2::NewLC(ESOAP12); |
|
533 |
|
534 AddDeviceOptionsHeader2L(*pMessage); |
|
535 |
|
536 AddApplicationHeader2L(*pMessage); |
|
537 |
|
538 switch (aCommand) |
|
539 { |
|
540 case EMSNMessengerRegister: |
|
541 { |
|
542 pMessage->SetBodyL(KReristerReq); |
|
543 break; |
|
544 } |
|
545 case EMSNMessengerUnRegister: |
|
546 { |
|
547 pMessage->SetBodyL(KUnReristerReq); |
|
548 break; |
|
549 } |
|
550 case EMSNMessengerInvite: |
|
551 { |
|
552 pMessage->SetBodyL(KInviteReq); |
|
553 break; |
|
554 } |
|
555 case EMSNMessengerSend: |
|
556 { |
|
557 pMessage->SetBodyL(KSendReq); |
|
558 break; |
|
559 } |
|
560 default: |
|
561 break; |
|
562 } |
|
563 |
|
564 CleanupStack::Pop(pMessage); |
|
565 |
|
566 return pMessage; |
|
567 } |
|
568 |
|
569 TInt CSenServiceConnectionBCTest::RegisterSTSL() |
|
570 { |
|
571 CSenServiceManager* manager = CSenServiceManager::NewLC(); |
|
572 _LIT8(KWsStarContract, "urn:wstar:sts"); |
|
573 _LIT8(KAddressing, "http://schemas.xmlsoap.org/ws/2006/10/addressing"); |
|
574 |
|
575 //register Identity provider for STS |
|
576 CSenIdentityProvider* stsProvider = CSenIdentityProvider::NewLC(KStsEndpoint); |
|
577 stsProvider->SetContractL(KWsStarContract);//(TDesC8) |
|
578 stsProvider->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
579 stsProvider->SetProviderID(KProviderId); |
|
580 stsProvider->SetUserInfoL( KPassportUser, KPassportUser, KPassportPass); |
|
581 manager->RegisterIdentityProviderL( *stsProvider); |
|
582 CleanupStack::PopAndDestroy(stsProvider); |
|
583 |
|
584 //register SD for STS |
|
585 CSenXmlServiceDescription* pattern = CSenXmlServiceDescription::NewLC();//KNullDesC8(), KWsStarContract); |
|
586 pattern->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
587 pattern->SetContractL(KWsStarContract); |
|
588 pattern->SetEndPointL(KStsEndpoint); |
|
589 pattern->AsElement().AddElementL(_L8("ProviderID")).SetContentL(KProviderId); |
|
590 SetPolicyL(pattern, KPolicyAdr, KAddressing); //this RST2 |
|
591 SetPolicyL(pattern, KPolicySOAP12, KNullDesC8); //this RST2 |
|
592 |
|
593 SetPolicyL(pattern, KPolicyMT, KMetadataEndpoint); |
|
594 SetPolicyL(pattern, KPolicyPassExt, KNullDesC8); |
|
595 SetPolicyL(pattern, KPolicyTLS, KNullDesC8); |
|
596 TInt error = manager->RegisterServiceDescriptionL( *pattern); |
|
597 |
|
598 CleanupStack::PopAndDestroy(pattern); |
|
599 CleanupStack::PopAndDestroy(manager); |
|
600 } |
|
601 |
|
602 TInt CSenServiceConnectionBCTest::RegisterSTSInvalidPasswordL() |
|
603 { |
|
604 CSenServiceManager* manager = CSenServiceManager::NewLC(); |
|
605 _LIT8(KWsStarContract, "urn:wstar:sts"); |
|
606 _LIT8(KAddressing, "http://schemas.xmlsoap.org/ws/2006/10/addressing"); |
|
607 |
|
608 //register Identity provider for STS |
|
609 CSenIdentityProvider* stsProvider = CSenIdentityProvider::NewLC(KStsEndpoint); |
|
610 stsProvider->SetContractL(KWsStarContract);//(TDesC8) |
|
611 stsProvider->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
612 stsProvider->SetProviderID(KProviderId); |
|
613 stsProvider->SetUserInfoL( KPassportUser, KPassportUser, _L8("Invalid")); |
|
614 manager->RegisterIdentityProviderL( *stsProvider); |
|
615 CleanupStack::PopAndDestroy(stsProvider); |
|
616 |
|
617 //register SD for STS |
|
618 CSenXmlServiceDescription* pattern = CSenXmlServiceDescription::NewLC();//KNullDesC8(), KWsStarContract); |
|
619 pattern->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
620 pattern->SetContractL(KWsStarContract); |
|
621 pattern->SetEndPointL(KStsEndpoint); |
|
622 pattern->AsElement().AddElementL(_L8("ProviderID")).SetContentL(KProviderId); |
|
623 SetPolicyL(pattern, KPolicyAdr, KAddressing); //this RST2 |
|
624 SetPolicyL(pattern, KPolicySOAP12, KNullDesC8); //this RST2 |
|
625 |
|
626 SetPolicyL(pattern, KPolicyMT, KMetadataEndpoint); |
|
627 SetPolicyL(pattern, KPolicyPassExt, KNullDesC8); |
|
628 SetPolicyL(pattern, KPolicyTLS, KNullDesC8); |
|
629 TInt error = manager->RegisterServiceDescriptionL( *pattern); |
|
630 |
|
631 CleanupStack::PopAndDestroy(pattern); |
|
632 CleanupStack::PopAndDestroy(manager); |
|
633 } |
|
634 |
|
635 TInt CSenServiceConnectionBCTest::UnregisterSTSL() |
|
636 { |
|
637 CSenServiceManager* manager = CSenServiceManager::NewLC(); |
|
638 _LIT8(KWsStarContract, "urn:wstar:sts"); |
|
639 _LIT8(KAddressing, "http://schemas.xmlsoap.org/ws/2006/10/addressing"); |
|
640 |
|
641 //Unregister Identity provider for STS |
|
642 CSenIdentityProvider* stsProvider = CSenIdentityProvider::NewLC(KStsEndpoint); |
|
643 stsProvider->SetContractL(KWsStarContract);//(TDesC8) |
|
644 stsProvider->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
645 stsProvider->SetProviderID(KProviderId); |
|
646 stsProvider->SetUserInfoL( KPassportUser, KPassportUser, KPassportPass); |
|
647 manager->UnregisterIdentityProviderL( *stsProvider); |
|
648 CleanupStack::PopAndDestroy(stsProvider); |
|
649 |
|
650 //Unregister SD for STS |
|
651 CSenXmlServiceDescription* pattern = CSenXmlServiceDescription::NewLC();//KNullDesC8(), KWsStarContract); |
|
652 pattern->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
653 pattern->SetContractL(KWsStarContract); |
|
654 pattern->SetEndPointL(KStsEndpoint); |
|
655 pattern->AsElement().AddElementL(_L8("ProviderID")).SetContentL(KProviderId); |
|
656 SetPolicyL(pattern, KPolicyAdr, KAddressing); //this RST2 |
|
657 SetPolicyL(pattern, KPolicySOAP12, KNullDesC8); //this RST2 |
|
658 |
|
659 SetPolicyL(pattern, KPolicyMT, KMetadataEndpoint); |
|
660 SetPolicyL(pattern, KPolicyPassExt, KNullDesC8); |
|
661 SetPolicyL(pattern, KPolicyTLS, KNullDesC8); |
|
662 TInt error = manager->UnregisterServiceDescriptionL( *pattern); |
|
663 |
|
664 CleanupStack::PopAndDestroy(pattern); |
|
665 CleanupStack::PopAndDestroy(manager); |
|
666 } |
|
667 |
|
668 TInt CSenServiceConnectionBCTest::SetPolicyL( CSenXmlServiceDescription* pServDesc, |
|
669 const TDesC8& pName, |
|
670 const TDesC8& pValue) |
|
671 { |
|
672 CSenElement* servicePolicy = pServDesc->AsElement().Element(_L8("ServicePolicy")); |
|
673 CSenElement* clientPolicy = servicePolicy->Element(_L8("ClientPolicy")); |
|
674 if(!clientPolicy) |
|
675 servicePolicy->AddElementL(_L8("ClientPolicy")); |
|
676 clientPolicy = servicePolicy->Element(_L8("ClientPolicy")); |
|
677 |
|
678 if(pValue==KNullDesC8()) |
|
679 { |
|
680 clientPolicy->AddElementL(pName); |
|
681 } |
|
682 else |
|
683 { |
|
684 clientPolicy->AddElementL(pName).SetContentL(pValue); |
|
685 } |
|
686 } |
|
687 |
|
688 TInt CSenServiceConnectionBCTest::CreateConnectionToMessengerServiceL() |
|
689 { |
|
690 _LIT8(KAddressing, "http://schemas.xmlsoap.org/ws/2004/08/addressing"); |
|
691 CSenXmlServiceDescription* pServiceDesc = CSenXmlServiceDescription::NewLC(KMessagingEndpoint, KMessagingContract); |
|
692 |
|
693 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
694 pServiceDesc->SetIapIdL(iapId); |
|
695 |
|
696 pServiceDesc->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
697 pServiceDesc->AsElement().AddElementL(_L8("ProviderID")).SetContentL(KProviderId); |
|
698 SetPolicyL(pServiceDesc, KPolicySOAP12, KNullDesC8); |
|
699 SetPolicyL(pServiceDesc, KPolicyAdr, KAddressing); |
|
700 |
|
701 // create connection |
|
702 iServiceConnection = CSenServiceConnection::NewL(*this, *pServiceDesc, *this); |
|
703 CleanupStack::PopAndDestroy(pServiceDesc); |
|
704 } |
|
705 |
|
706 TInt CSenServiceConnectionBCTest::CreateConnectionToMessengerServiceWithoutCallbackL() |
|
707 { |
|
708 _LIT8(KAddressing, "http://schemas.xmlsoap.org/ws/2004/08/addressing"); |
|
709 CSenXmlServiceDescription* pServiceDesc = CSenXmlServiceDescription::NewLC(KMessagingEndpoint, KMessagingContract); |
|
710 |
|
711 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
712 pServiceDesc->SetIapIdL(iapId); |
|
713 |
|
714 |
|
715 pServiceDesc->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
716 pServiceDesc->AsElement().AddElementL(_L8("ProviderID")).SetContentL(KProviderId); |
|
717 SetPolicyL(pServiceDesc, KPolicySOAP12, KNullDesC8); |
|
718 SetPolicyL(pServiceDesc, KPolicyAdr, KAddressing); |
|
719 |
|
720 // create connection |
|
721 iServiceConnection = CSenServiceConnection::NewL(*this, *pServiceDesc); |
|
722 CleanupStack::PopAndDestroy(pServiceDesc); |
|
723 } |
|
724 |
|
725 TInt CSenServiceConnectionBCTest::AddDeviceOptionsHeader2L(CSenSoapMessage2& aMessage) |
|
726 { |
|
727 TXmlEngElement header = aMessage.HeaderL(); |
|
728 |
|
729 TXmlEngElement deviceOp = header.AddNewElementL(_L8("DeviceOptions"), |
|
730 KMessagingNameSpace, |
|
731 _L8("mws")); |
|
732 |
|
733 TXmlEngElement child = deviceOp.AddNewElementSameNsL(_L8("Locale")); |
|
734 child.AddTextL(_L8("1033")); |
|
735 |
|
736 TXmlEngElement child1 = deviceOp.AddNewElementSameNsL(_L8("UserAgent")); |
|
737 |
|
738 TXmlEngElement child1_1 = child1.AddNewElementSameNsL(_L8("Manufacturer")); |
|
739 child1_1.AddTextL(_L8("NO_UserAgent")); |
|
740 |
|
741 TXmlEngElement child1_2 = child1.AddNewElementSameNsL(_L8("Model")); |
|
742 child1_2.AddTextL(_L8("NO_Model")); |
|
743 |
|
744 TXmlEngElement child1_3 = child1.AddNewElementSameNsL(_L8("OS")); |
|
745 |
|
746 TXmlEngElement child1_3_1 = child1_3.AddNewElementSameNsL(_L8("Name")); |
|
747 child1_3_1.AddTextL(_L8("NO_OS")); |
|
748 |
|
749 TXmlEngElement child1_3_2 = child1_3.AddNewElementSameNsL(_L8("Version")); |
|
750 child1_3_2.AddTextL(_L8("NO_Version")); |
|
751 } |
|
752 |
|
753 TInt CSenServiceConnectionBCTest::AddApplicationHeader2L(CSenSoapMessage2& aMessage) |
|
754 { |
|
755 TXmlEngElement header = aMessage.HeaderL(); |
|
756 |
|
757 TXmlEngElement application = header.AddNewElementL(_L8("Application"),KMessagingNameSpace,_L8("mws")); |
|
758 |
|
759 TXmlEngElement child = application.AddNewElementSameNsL(_L8("Name")); |
|
760 child.AddTextL(_L8("NO_CLIENT")); |
|
761 |
|
762 TXmlEngElement child1 = application.AddNewElementSameNsL(_L8("Vendor")); |
|
763 child1.AddTextL(_L8("NO_VENDOR")); |
|
764 |
|
765 TXmlEngElement child2 = application.AddNewElementSameNsL(_L8("Version")); |
|
766 child2.AddTextL(_L8("NO_VERSION")); |
|
767 } |
|
768 |
|
769 TInt CSenServiceConnectionBCTest::StartActiveScheduler(TInt aNumberOfPendingOps) |
|
770 { |
|
771 iNumberOfPendingOps = aNumberOfPendingOps; |
|
772 CActiveScheduler::Start(); |
|
773 } |
|
774 |
|
775 TInt CSenServiceConnectionBCTest::StopActiveScheduler() |
|
776 { |
|
777 iNumberOfPendingOps--; |
|
778 if ( iNumberOfPendingOps == 0 ) |
|
779 { |
|
780 CActiveScheduler::Stop(); |
|
781 } |
|
782 } |
|
783 |
|
784 const CSenIdentityProvider* CSenServiceConnectionBCTest::IdentityProviderL() const |
|
785 { |
|
786 ((CSenServiceConnectionBCTest*)this)->iAuthInfoAskCounter++; |
|
787 return ipProviderForAuthProvider; |
|
788 } |
|
789 |
|
790 void CSenServiceConnectionBCTest::HandleMessageL(const TDesC8& aMessage) |
|
791 { |
|
792 iLog->Log(_L("BCTest::HandleMessageL->> start")); |
|
793 iCallback = ECallbackHandleMessage; |
|
794 |
|
795 if ( ipMessage ) |
|
796 { |
|
797 delete ipMessage; |
|
798 ipMessage = NULL; |
|
799 } |
|
800 ipMessage = aMessage.AllocL(); |
|
801 iTransactionId = iServiceConnection->TxnId(); |
|
802 //Alr retry logic |
|
803 if( iUseALR && (!isNewCarrierAccepted || !isMigratedToPrefferedCarrier) && iAlrCallBackRetryCount < 5 ) |
|
804 { |
|
805 TInt ret = iServiceConnection->SendL(*iSOAPMessage); |
|
806 iAlrCallBackRetryCount++; |
|
807 iLog->Log(_L("BCTest::HandleMessageL->>Alr Retry SendL is called")); |
|
808 return; |
|
809 } |
|
810 else if( (iUseALR && isNewCarrierAccepted && isMigratedToPrefferedCarrier) || iAlrCallBackRetryCount >= 5 ) |
|
811 { |
|
812 iAlrCallBackRetryCount = 0; |
|
813 iUseALR = EFalse; |
|
814 iLog->Log(_L("BCTest::HandleMessageL->>Alr retry Done ")); |
|
815 } |
|
816 // Cobranding callback |
|
817 if (iCoBrandingCallbackOption) |
|
818 { |
|
819 iCoBrandingCallbackOption=EFalse; |
|
820 iLog->Log(_L("BCTest::HandleMessageL->>CoBrandingCallbackOption ")); |
|
821 } |
|
822 if(iGetDataTrafficDetails) |
|
823 { |
|
824 TSenDataTrafficDetails details; |
|
825 TSenDataTrafficOperations operations; |
|
826 iServiceConnection->DataTrafficDetails(details,operations); |
|
827 TInt BytesSent = details.iTotalBytesSent; |
|
828 TInt BytesRecieved = details.iTotalBytesRecieved; |
|
829 } |
|
830 |
|
831 StopActiveScheduler(); |
|
832 iLog->Log(_L("BCTest::HandleMessageL->>End")); |
|
833 } |
|
834 |
|
835 void CSenServiceConnectionBCTest::HandleErrorL(const int aErrorCode, const TDesC8& aError) |
|
836 { |
|
837 iLog->Log(_L("BCTest::HandleErrorL->> start")); |
|
838 iCallback = ECallbackHandleError; |
|
839 iErrorCode = aErrorCode; |
|
840 |
|
841 // debugging only - START |
|
842 if( HTTPStatus::IsInformational( this->iErrorCode ) ) |
|
843 { |
|
844 // if((aStatus >= HTTPStatus::EContinue) && (aStatus < HTTPStatus::EOk)) |
|
845 RDebug::Print(_L("- HTTP error code: IS INFORMATION.")); |
|
846 } |
|
847 if( HTTPStatus::IsSuccessful( this->iErrorCode ) ) |
|
848 { |
|
849 // if((aStatus >= HTTPStatus::EOk) && (aStatus < HTTPStatus::EMultipleChoices)) |
|
850 RDebug::Print(_L("- HTTP error code: IS SUCCESSFUL.")); |
|
851 } |
|
852 if( HTTPStatus::IsRedirection( this->iErrorCode ) ) |
|
853 { |
|
854 // if((aStatus >= HTTPStatus::EMultipleChoices) && (aStatus < HTTPStatus::EBadRequest)) |
|
855 RDebug::Print(_L("- HTTP error code: IS REDIRECTION.")); |
|
856 } |
|
857 if( HTTPStatus::IsClientError( this->iErrorCode ) ) |
|
858 { |
|
859 // if((aStatus >= HTTPStatus::EBadRequest) && (aStatus < HTTPStatus::EInternalServerError)) |
|
860 RDebug::Print(_L("- HTTP error code: IS CLIENT ERROR.")); |
|
861 } |
|
862 if( HTTPStatus::IsServerError( this->iErrorCode ) ) |
|
863 { |
|
864 // if(aStatus >= HTTPStatus::EInternalServerError) |
|
865 RDebug::Print(_L("- HTTP error code: IS CLIENT ERROR.")); |
|
866 } |
|
867 // debuggin only - END |
|
868 |
|
869 if ( ipMessage ) |
|
870 { |
|
871 delete ipMessage; |
|
872 ipMessage = NULL; |
|
873 } |
|
874 ipMessage = aError.AllocL(); |
|
875 iTransactionId = iServiceConnection->TxnId(); |
|
876 |
|
877 TBuf<70> errorMessage; |
|
878 _LIT(KErrNotInitialized, "Connection isn't initialized."); |
|
879 |
|
880 switch(aErrorCode) |
|
881 { |
|
882 case KErrSubmitting: |
|
883 errorMessage = KErrNotInitialized; |
|
884 break; |
|
885 default: |
|
886 break; |
|
887 } |
|
888 iUseALR = EFalse; |
|
889 StopActiveScheduler(); |
|
890 |
|
891 iLog->Log(_L("BCTest::HandleErrorL->>End")); |
|
892 } |
|
893 |
|
894 void CSenServiceConnectionBCTest::ErrorL(TInt aCode) |
|
895 { |
|
896 _LIT(KNotReady, "Connection is not ready."); |
|
897 |
|
898 TBuf<70> errorMessage; |
|
899 switch(aCode) |
|
900 { |
|
901 case EConnectionNotReady: |
|
902 errorMessage = KNotReady; |
|
903 break; |
|
904 default: |
|
905 break; |
|
906 } |
|
907 } |
|
908 |
|
909 void CSenServiceConnectionBCTest::SetStatus(const TInt aStatus) |
|
910 { |
|
911 iLog->Log(_L("BCTest::SetStatus-->start")); |
|
912 switch(aStatus) |
|
913 { |
|
914 case KSenConnectionStatusNew: |
|
915 break; |
|
916 case KSenConnectionStatusReady: |
|
917 iInitialized = ETrue; |
|
918 iLog->Log(_L("BCTest::SetStatus-->SenConnectionStatusReady")); |
|
919 break; |
|
920 case KSenConnectionStatusExpired: |
|
921 break; |
|
922 default: |
|
923 TBuf<32> num; |
|
924 num.AppendNum(aStatus); |
|
925 break; |
|
926 } |
|
927 if ( aStatus >= KSenConnectionStatusCreateFailed && aStatus <= KSenConnectionStatusMetadataExchange ) |
|
928 { |
|
929 iConnectionState = aStatus; |
|
930 if(!iInitialized) |
|
931 { |
|
932 TInt leaveCode(KErrNone); |
|
933 TRAP(leaveCode, ErrorL(EConnectionNotReady)); |
|
934 leaveCode = 0; // not used |
|
935 } |
|
936 StopActiveScheduler(); |
|
937 iLog->Log(_L("BCTest::SetStatus-->StopActiveScheduler()")); |
|
938 } |
|
939 iLog->Log(_L("BCTest::SetStatus-->End")); |
|
940 } |
|
941 |
|
942 TInt CSenServiceConnectionBCTest::Find(const TDesC8& aDestination, |
|
943 const TDesC8& aDescToFind, |
|
944 TInt aStartingPos ) |
|
945 { |
|
946 TInt descLength = aDescToFind.Length(); |
|
947 TInt length = aDestination.Length() - descLength + 1; |
|
948 for (TInt i = aStartingPos; i < length ; i++) |
|
949 { |
|
950 if ( aDestination.Mid(i,descLength) == aDescToFind ) |
|
951 { |
|
952 return i; |
|
953 } |
|
954 } |
|
955 |
|
956 return KErrNotFound; |
|
957 } |
|
958 |
|
959 |
|
960 TBool CSenServiceConnectionBCTest::ReplaceAll(TPtr8 aDestination, |
|
961 const TDesC8& aFrom, |
|
962 const TDesC8& aTo) |
|
963 { |
|
964 TInt retVal(EFalse); |
|
965 |
|
966 TInt pos = Find(aDestination, aFrom, 0); |
|
967 if (pos != KErrNotFound) retVal = ETrue; |
|
968 |
|
969 while (pos != KErrNotFound) |
|
970 { |
|
971 aDestination.Replace(pos,aFrom.Length(),aTo); |
|
972 pos = Find(aDestination, aFrom, pos+1); |
|
973 } |
|
974 |
|
975 return retVal; |
|
976 } |
|
977 |
|
978 |
|
979 TBool CSenServiceConnectionBCTest::DecodeHttpCharactersL(const TDesC8& aOriginal, |
|
980 HBufC8*& aDecoded) |
|
981 { |
|
982 // Five basic entities as descriptors |
|
983 _LIT8(KEscapedApos, "'"); |
|
984 _LIT8(KEscapedDblQuot, """); |
|
985 _LIT8(KEscapedGt, ">"); |
|
986 _LIT8(KEscapedLt, "<"); |
|
987 _LIT8(KEscapedAmp, "&"); |
|
988 |
|
989 // XML-escaping chars as descriptors |
|
990 _LIT8(KAmpersandDesC8, "&"); |
|
991 _LIT8(KAposDesC8, "\'"); |
|
992 _LIT8(KDblQuotDesC8, "\""); |
|
993 _LIT8(KGtDesC8, ">"); |
|
994 _LIT8(KLtDesC8, "<"); |
|
995 |
|
996 delete aDecoded; |
|
997 aDecoded = NULL; |
|
998 |
|
999 // make a copy of the original |
|
1000 aDecoded = aOriginal.AllocL(); |
|
1001 |
|
1002 TBool retVal(EFalse); |
|
1003 |
|
1004 // replace all five basic entities with XML escaping counterpart, |
|
1005 // if found. |
|
1006 if (ReplaceAll(aDecoded->Des(), KEscapedApos(), KAposDesC8())) |
|
1007 { |
|
1008 retVal = ETrue; |
|
1009 } |
|
1010 if (ReplaceAll(aDecoded->Des(), KEscapedDblQuot(), KDblQuotDesC8())) |
|
1011 { |
|
1012 retVal = ETrue; |
|
1013 } |
|
1014 if (ReplaceAll(aDecoded->Des(), KEscapedGt(), KGtDesC8())) |
|
1015 { |
|
1016 retVal = ETrue; |
|
1017 } |
|
1018 if (ReplaceAll(aDecoded->Des(), KEscapedLt(), KLtDesC8())) |
|
1019 { |
|
1020 retVal = ETrue; |
|
1021 } |
|
1022 if (ReplaceAll(aDecoded->Des(), KEscapedAmp(), KAmpersandDesC8())) |
|
1023 { |
|
1024 retVal = ETrue; |
|
1025 } |
|
1026 |
|
1027 return retVal; |
|
1028 } |
|
1029 |
|
1030 HBufC8* CSenServiceConnectionBCTest::HttpPropertyValueFromXmlLC(const TDesC8& aXml, |
|
1031 const TDesC8& aPropertyName) |
|
1032 { |
|
1033 CSenXmlReader* pReader = CSenXmlReader::NewL(); |
|
1034 CleanupStack::PushL(pReader); |
|
1035 CSenDomFragment* pDom = CSenDomFragment::NewL(); |
|
1036 CleanupStack::PushL(pDom); |
|
1037 pReader->SetContentHandler(*pDom); |
|
1038 pDom->SetReader(*pReader); |
|
1039 pReader->ParseL(aXml); |
|
1040 |
|
1041 HBufC8* pRetBuf = NULL; |
|
1042 |
|
1043 CSenElement& element = pDom->AsElement(); |
|
1044 CSenElement* pRequestElement = element.Element(_L8("Request")); |
|
1045 if ( pRequestElement ) |
|
1046 { |
|
1047 CSenElement* pTPElement = pRequestElement->Element(_L8("TranportProperties")); |
|
1048 if ( pTPElement ) |
|
1049 { |
|
1050 CSenElement* pElement = pTPElement->Element(aPropertyName); |
|
1051 if ( pElement ) |
|
1052 { |
|
1053 pRetBuf = pElement->Content().AllocL(); |
|
1054 CleanupStack::PushL(pRetBuf); |
|
1055 HBufC8* pNew = NULL; |
|
1056 DecodeHttpCharactersL(*pRetBuf, pNew); |
|
1057 CleanupStack::PopAndDestroy(pRetBuf); |
|
1058 pRetBuf = pNew; |
|
1059 } |
|
1060 } |
|
1061 } |
|
1062 |
|
1063 CleanupStack::PopAndDestroy(pDom); |
|
1064 CleanupStack::PopAndDestroy(pReader); |
|
1065 CleanupStack::PushL(pRetBuf); |
|
1066 return pRetBuf; |
|
1067 } |
|
1068 |
|
1069 HBufC8* CSenServiceConnectionBCTest::ReadFileL(const TDesC& aFilename) |
|
1070 { |
|
1071 RFs fsSession; |
|
1072 CleanupClosePushL(fsSession); |
|
1073 User::LeaveIfError(fsSession.Connect() == NULL); |
|
1074 TEntry entry; |
|
1075 User::LeaveIfError(fsSession.Entry(aFilename,entry)); |
|
1076 HBufC8* pFileContent = NULL; |
|
1077 RFileReadStream fileInStream; |
|
1078 CleanupClosePushL(fileInStream); |
|
1079 if (fileInStream.Open(fsSession,aFilename,EFileRead) == KErrNone) |
|
1080 { |
|
1081 HBufC8* pTempFileContent = HBufC8::NewLC(entry.iSize+10); |
|
1082 TRAPD(error, |
|
1083 fileInStream.ReadL((TUint8*)pTempFileContent->Ptr(),entry.iSize); |
|
1084 ); |
|
1085 |
|
1086 if (!error) |
|
1087 { |
|
1088 TPtrC8 fileContent((TUint8*)pTempFileContent->Ptr(),entry.iSize); |
|
1089 pFileContent = fileContent.AllocL(); |
|
1090 } |
|
1091 CleanupStack::PopAndDestroy(pTempFileContent); |
|
1092 } |
|
1093 CleanupStack::PopAndDestroy(&fileInStream); |
|
1094 CleanupStack::PopAndDestroy(&fsSession); |
|
1095 return pFileContent; |
|
1096 } |
|
1097 |
|
1098 TUint32 CSenServiceConnectionBCTest::SearchIAPIdByNameL( const TDesC& aIAPName ) |
|
1099 { |
|
1100 TBool found = EFalse; |
|
1101 CCommsDatabase* pDB = CCommsDatabase::NewL(EDatabaseTypeIAP); |
|
1102 CleanupStack::PushL(pDB); |
|
1103 |
|
1104 //open internet accesspoint table |
|
1105 CCommsDbTableView* pDbTView = pDB->OpenTableLC(TPtrC(IAP)); |
|
1106 TInt retVal = pDbTView->GotoFirstRecord(); |
|
1107 TBuf<128> name; |
|
1108 TUint32 id = 0; |
|
1109 //Find the correct record |
|
1110 while ( retVal == KErrNone && found == EFalse ) |
|
1111 { |
|
1112 pDbTView->ReadTextL(TPtrC(COMMDB_NAME), name); |
|
1113 pDbTView->ReadUintL(TPtrC(COMMDB_ID), id); |
|
1114 found = ( name == aIAPName ); |
|
1115 if ( !found ) |
|
1116 { |
|
1117 retVal = pDbTView->GotoNextRecord(); |
|
1118 } |
|
1119 } |
|
1120 CleanupStack::PopAndDestroy(pDbTView); |
|
1121 CleanupStack::PopAndDestroy(pDB); |
|
1122 return id; |
|
1123 } |
|
1124 |
|
1125 CSenSoapMessage* CSenServiceConnectionBCTest::CreateAuthRequestLC() |
|
1126 { |
|
1127 _LIT8(KRequest, "<sa:SASLRequest xmlns:sa=\"urn:liberty:sa:2004-04\" mechanism=\"PLAIN ANONYMOUS\" advisoryAuthnID=\"012345678901234\"/>"); |
|
1128 CSenSoapMessage* pSOAPMessage = CSenSoapMessage::NewL(); |
|
1129 CleanupStack::PushL(pSOAPMessage); |
|
1130 |
|
1131 //xxxxxxxx*************** CorrelationHeader starts *************************** |
|
1132 CSenBaseElement* pElement = CSenBaseElement::NewL(_L8("urn:liberty:sb:2003-08"), _L8("Correlation"), _L8("sb:Correlation")); |
|
1133 CleanupStack::PushL(pElement); |
|
1134 |
|
1135 pElement->AddAttrL(_L8("messageID"),_L8("")); |
|
1136 pElement->AddAttrL(_L8("refToMessageID"),_L8("")); |
|
1137 |
|
1138 TTime t; |
|
1139 t.HomeTime(); |
|
1140 TBuf8<SenDateUtils::KXmlDateTimeMaxLength> ts; |
|
1141 SenDateUtils::ToXmlDateTimeUtf8L(ts, t); |
|
1142 pElement->AddAttrL(_L8("timestamp"), ts); |
|
1143 |
|
1144 pSOAPMessage->AddHeaderL(*pElement); // pElement will be owned by pSOAPMessage |
|
1145 CleanupStack::Pop(pElement); |
|
1146 //************************ CorrelationHeader ends **************************** |
|
1147 |
|
1148 pSOAPMessage->SetBodyL(KRequest); |
|
1149 return pSOAPMessage; |
|
1150 } |
|
1151 |
|
1152 CSenSoapMessage2* CSenServiceConnectionBCTest::CreateNewAuthRequestLC() |
|
1153 { |
|
1154 _LIT8(KRequest, "<sa:SASLRequest xmlns:sa=\"urn:liberty:sa:2004-04\" mechanism=\"PLAIN ANONYMOUS\" advisoryAuthnID=\"012345678901234\"/>"); |
|
1155 CSenSoapMessage2* pSOAPMessage = CSenSoapMessage2::NewL(); |
|
1156 CleanupStack::PushL(pSOAPMessage); |
|
1157 |
|
1158 //xxxxxxxx*************** CorrelationHeader starts *************************** |
|
1159 /*CSenBaseElement* pElement = CSenBaseElement::NewL(_L8("urn:liberty:sb:2003-08"), _L8("Correlation"), _L8("sb:Correlation")); |
|
1160 CleanupStack::PushL(pElement); |
|
1161 |
|
1162 pElement->AddAttrL(_L8("messageID"),_L8("")); |
|
1163 pElement->AddAttrL(_L8("refToMessageID"),_L8("")); |
|
1164 |
|
1165 TTime t; |
|
1166 t.HomeTime(); |
|
1167 TBuf8<SenDateUtils::KXmlDateTimeMaxLength> ts; |
|
1168 SenDateUtils::ToXmlDateTimeUtf8L(ts, t); |
|
1169 pElement->AddAttrL(_L8("timestamp"), ts); |
|
1170 |
|
1171 //pSOAPMessage->AddHeaderL(*pElement); // pElement will be owned by pSOAPMessage |
|
1172 CleanupStack::Pop(pElement);*/ |
|
1173 //************************ CorrelationHeader ends **************************** |
|
1174 |
|
1175 pSOAPMessage->SetBodyL(KRequest); |
|
1176 return pSOAPMessage; |
|
1177 } |
|
1178 |
|
1179 void CSenServiceConnectionBCTest::SetupL( ) |
|
1180 { |
|
1181 __UHEAP_MARK; |
|
1182 |
|
1183 RFile file; |
|
1184 RFs iFsSession; |
|
1185 _LIT(KFileName,"c:\\testing\\data\\rest.on"); |
|
1186 |
|
1187 |
|
1188 User::LeaveIfError(iFsSession.Connect()); |
|
1189 |
|
1190 TInt fileOP = file.Open(iFsSession,KFileName,EFileRead); |
|
1191 if (fileOP == KErrNone) |
|
1192 { |
|
1193 RDebug::Print( _L( "Found rest.on file => using RESTful framework" ) ); |
|
1194 file.Close(); |
|
1195 ipFrameworkID = HBufC8::NewL(KRESTFrameworkID().Length()); |
|
1196 ipFrameworkID->Des().Append(KRESTFrameworkID); |
|
1197 } |
|
1198 else |
|
1199 { |
|
1200 RDebug::Print( _L( "File rest.on not found => defaulting to WS-I" ) ); |
|
1201 ipFrameworkID = HBufC8::NewL(KWSIFrameworkID().Length()); |
|
1202 ipFrameworkID->Des().Append(KWSIFrameworkID); |
|
1203 } |
|
1204 iFsSession.Close(); |
|
1205 |
|
1206 iCallback = ECallbackNone; |
|
1207 } |
|
1208 |
|
1209 void CSenServiceConnectionBCTest::Teardown( ) |
|
1210 { |
|
1211 delete ipFrameworkID; |
|
1212 ipFrameworkID = NULL; |
|
1213 delete ipMessage; |
|
1214 ipMessage = NULL; |
|
1215 delete ipProviderForAuthProvider; |
|
1216 ipProviderForAuthProvider = NULL; |
|
1217 |
|
1218 if(iServiceConnection!=NULL) |
|
1219 { |
|
1220 delete iServiceConnection; |
|
1221 iServiceConnection=NULL; |
|
1222 } |
|
1223 |
|
1224 if(iSOAPMessage!=NULL) |
|
1225 { |
|
1226 delete iSOAPMessage; |
|
1227 iSOAPMessage=NULL; |
|
1228 } |
|
1229 |
|
1230 __UHEAP_MARKEND; |
|
1231 } |
|
1232 |
|
1233 /* |
|
1234 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_RegisterIdentityProviderLL( TTestResult& aResult ) |
|
1235 { |
|
1236 SetupL() ; |
|
1237 iManager = CSenServiceManager::NewL(); |
|
1238 STIFF_ASSERT_NOT_EQUALS_DESC(iManager, (CSenServiceManager*)NULL, "The test is failed."); |
|
1239 |
|
1240 CSenIdentityProvider* idp = CSenIdentityProvider::NewLC( |
|
1241 KAuthServEndpoint, KASContract); |
|
1242 |
|
1243 // Set the Provider ID |
|
1244 idp->SetProviderID(KASProviderID); |
|
1245 |
|
1246 // Associate Forum Nokia's Addressbook service ID (contract) |
|
1247 // to this Identity Provider |
|
1248 idp->SetServiceID(KWSPContract); |
|
1249 |
|
1250 // Set Liberty ID-WSF framework ID |
|
1251 idp->SetFrameworkIdL(KDefaultIdWsfFrameworkID); |
|
1252 |
|
1253 // ------------------------------------------------------------------------ |
|
1254 // The following username/password properties will be used for |
|
1255 // authentication. Please note, that use advisory authentication |
|
1256 // id "IMEI" would result device ID to be directly fetched from phone. |
|
1257 // ------------------------------------------------------------------------ |
|
1258 // |
|
1259 |
|
1260 #if SYSOPENDIGIA_ADDRESSBOOK_SERVICE |
|
1261 idp->SetUserInfoL(KNullDesC8, KTestAuthzID, KTestPassword); |
|
1262 #else |
|
1263 idp->SetUserInfoL(KTestAuthzID, KNullDesC8, KTestPassword); |
|
1264 #endif |
|
1265 |
|
1266 TL((iManager->RegisterIdentityProviderL(*idp)) == KErrNone); |
|
1267 TL((iManager->RegisterServiceDescriptionL(*idp)) == KErrNone); |
|
1268 |
|
1269 CleanupStack::PopAndDestroy(idp); |
|
1270 |
|
1271 __ASSERT_ALWAYS_NO_LEAVE(delete iManager); |
|
1272 iManager = NULL; |
|
1273 Teardown(); |
|
1274 return KErrNone; |
|
1275 } |
|
1276 */ |
|
1277 |
|
1278 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_ContractL( TTestResult& aResult ) |
|
1279 { |
|
1280 SetupL() ; |
|
1281 iServiceConnection = CSenServiceConnection::NewL(*this, KAddressBookContract); |
|
1282 StartActiveScheduler(1); |
|
1283 |
|
1284 //LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
1285 TL(iServiceConnection != (CSenServiceConnection*)NULL); |
|
1286 |
|
1287 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1288 iServiceConnection = NULL; |
|
1289 Teardown(); |
|
1290 return KErrNone; |
|
1291 } |
|
1292 |
|
1293 |
|
1294 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_ContractL( TTestResult& aResult ) |
|
1295 { |
|
1296 |
|
1297 SetupL() ; |
|
1298 iServiceConnection = CSenServiceConnection::NewLC(*this, KAddressBookContract); |
|
1299 StartActiveScheduler(1); |
|
1300 |
|
1301 //LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
1302 TL(iServiceConnection != (CSenServiceConnection*)NULL); |
|
1303 |
|
1304 CleanupStack::Pop(); //iServiceConnection |
|
1305 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1306 iServiceConnection = NULL; |
|
1307 Teardown(); |
|
1308 return KErrNone; |
|
1309 |
|
1310 |
|
1311 } |
|
1312 |
|
1313 |
|
1314 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_WS_I_DescriptionL( TTestResult& aResult ) |
|
1315 { |
|
1316 SetupL() ; |
|
1317 // Only Endpoint and FrameworkId needs to be defined in WS-I case. |
|
1318 // There is no need to define Contract. => KNullDesC8 is passed as a Contract. |
|
1319 iSenXmlServiceDescription = CSenXmlServiceDescription::NewL(KAuthServEndpoint, KNullDesC8()); |
|
1320 iSenXmlServiceDescription->SetFrameworkIdL(*ipFrameworkID); |
|
1321 |
|
1322 iServiceConnection = CSenServiceConnection::NewL(*this, *iSenXmlServiceDescription); |
|
1323 StartActiveScheduler(1); |
|
1324 |
|
1325 //STIFF_ASSERT_DESC(iConnectionState == KSenConnectionStatusReady, |
|
1326 //"Could not initialize ServiceConnection"); |
|
1327 |
|
1328 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1329 iServiceConnection = NULL; |
|
1330 |
|
1331 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
1332 iSenXmlServiceDescription = NULL; |
|
1333 Teardown(); |
|
1334 return KErrNone; |
|
1335 } |
|
1336 |
|
1337 |
|
1338 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_WS_I_DescriptionL( TTestResult& aResult ) |
|
1339 { |
|
1340 SetupL() ; |
|
1341 // Only Endpoint and FrameworkId needs to be defined in WS-I case. |
|
1342 // There is no need to define Contract. => KNullDesC8 is passed as a Contract. |
|
1343 iSenXmlServiceDescription = CSenXmlServiceDescription::NewL(KAuthServEndpoint, KNullDesC8()); |
|
1344 iSenXmlServiceDescription->SetFrameworkIdL(*ipFrameworkID); |
|
1345 |
|
1346 CSenServiceConnection* iServiceConnection = CSenServiceConnection::NewLC(*this, *iSenXmlServiceDescription); |
|
1347 StartActiveScheduler(1); |
|
1348 |
|
1349 //STIFF_ASSERT_DESC(iConnectionState == KSenConnectionStatusReady, |
|
1350 //"Could not initialize ServiceConnection"); |
|
1351 |
|
1352 CleanupStack::Pop(); //iServiceConnection |
|
1353 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1354 iServiceConnection = NULL; |
|
1355 |
|
1356 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
1357 iSenXmlServiceDescription = NULL; |
|
1358 Teardown(); |
|
1359 return KErrNone; |
|
1360 } |
|
1361 |
|
1362 |
|
1363 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_ID_WSF_DescriptionL( TTestResult& aResult ) |
|
1364 { |
|
1365 SetupL() ; |
|
1366 iSenXmlServiceDescription = CSenXmlServiceDescription::NewL(); |
|
1367 iSenXmlServiceDescription->SetFrameworkIdL(KIDWSFFrameworkID); |
|
1368 iSenXmlServiceDescription->SetContractL(KAddressBookServiceId); |
|
1369 |
|
1370 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
1371 iSenXmlServiceDescription->SetIapIdL(iapId); |
|
1372 |
|
1373 iServiceConnection = CSenServiceConnection::NewL(*this, *iSenXmlServiceDescription); |
|
1374 StartActiveScheduler(1); |
|
1375 |
|
1376 //STIFF_ASSERT_DESC(iConnectionState == KSenConnectionStatusReady, |
|
1377 //"Could not initialize ServiceConnection"); |
|
1378 |
|
1379 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1380 iServiceConnection = NULL; |
|
1381 |
|
1382 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
1383 iSenXmlServiceDescription = NULL; |
|
1384 Teardown(); |
|
1385 return KErrNone; |
|
1386 } |
|
1387 |
|
1388 |
|
1389 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_ID_WSF_DescriptionL( TTestResult& aResult ) |
|
1390 { |
|
1391 SetupL() ; |
|
1392 iSenXmlServiceDescription = CSenXmlServiceDescription::NewL(); |
|
1393 iSenXmlServiceDescription->SetFrameworkIdL(KIDWSFFrameworkID); |
|
1394 iSenXmlServiceDescription->SetContractL(KAddressBookServiceId); |
|
1395 |
|
1396 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
1397 iSenXmlServiceDescription->SetIapIdL(iapId); |
|
1398 |
|
1399 iServiceConnection = CSenServiceConnection::NewLC(*this, *iSenXmlServiceDescription); |
|
1400 StartActiveScheduler(1); |
|
1401 |
|
1402 //STIFF_ASSERT_DESC(iConnectionState == KSenConnectionStatusReady, |
|
1403 //"Could not initialize ServiceConnection"); |
|
1404 |
|
1405 CleanupStack::Pop(); //iServiceConnection |
|
1406 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1407 iServiceConnection = NULL; |
|
1408 |
|
1409 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
1410 iSenXmlServiceDescription = NULL; |
|
1411 Teardown(); |
|
1412 return KErrNone; |
|
1413 } |
|
1414 |
|
1415 |
|
1416 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_WS_I_PatternL( TTestResult& aResult ) |
|
1417 { |
|
1418 SetupL() ; |
|
1419 CSenServicePattern* pSenServicePattern = CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
1420 pSenServicePattern->SetFrameworkIdL(*ipFrameworkID); |
|
1421 //pSenServicePattern->SetContractL(KAuthServEndpoint); |
|
1422 |
|
1423 iServiceConnection = CSenServiceConnection::NewL(*this, *pSenServicePattern); |
|
1424 StartActiveScheduler(1); |
|
1425 |
|
1426 //STIFF_ASSERT_DESC(iConnectionState == KSenConnectionStatusReady, |
|
1427 //"Could not initialize ServiceConnection"); |
|
1428 |
|
1429 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1430 iServiceConnection = NULL; |
|
1431 |
|
1432 CleanupStack::Pop(pSenServicePattern); |
|
1433 __ASSERT_ALWAYS_NO_LEAVE(delete pSenServicePattern); |
|
1434 pSenServicePattern = NULL; |
|
1435 Teardown(); |
|
1436 return KErrNone; |
|
1437 } |
|
1438 |
|
1439 |
|
1440 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_WS_I_PatternL( TTestResult& aResult ) |
|
1441 { |
|
1442 SetupL() ; |
|
1443 CSenServicePattern* aSenServicePattern = CSenServicePattern::NewL(KAuthServEndpoint, KNullDesC8()); |
|
1444 aSenServicePattern->SetFrameworkIdL(*ipFrameworkID); |
|
1445 //aSenServicePattern->SetContractL(KAuthServEndpoint); |
|
1446 |
|
1447 CSenServiceConnection* iServiceConnection = CSenServiceConnection::NewLC(*this, *aSenServicePattern); |
|
1448 StartActiveScheduler(1); |
|
1449 |
|
1450 //STIFF_ASSERT_DESC(iConnectionState == KSenConnectionStatusReady, |
|
1451 //"Could not initialize ServiceConnection"); |
|
1452 |
|
1453 CleanupStack::Pop(); //iServiceConnection |
|
1454 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1455 iServiceConnection = NULL; |
|
1456 |
|
1457 delete aSenServicePattern; |
|
1458 aSenServicePattern = NULL; |
|
1459 Teardown(); |
|
1460 return KErrNone; |
|
1461 } |
|
1462 |
|
1463 |
|
1464 |
|
1465 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_ID_WSF_PatternL( TTestResult& aResult ) |
|
1466 { |
|
1467 SetupL() ; |
|
1468 CSenServicePattern* pPattern = CSenServicePattern::NewLC(KAddressBookServiceId, KNullDesC8()); |
|
1469 pPattern->SetFrameworkIdL(KIDWSFFrameworkID); |
|
1470 pPattern->SetContractL(KAddressBookServiceId); |
|
1471 |
|
1472 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
1473 pPattern->SetConsumerIapIdL(iapId); |
|
1474 |
|
1475 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
1476 StartActiveScheduler(1); |
|
1477 |
|
1478 STIFF_ASSERT_NOT_EQUALS_DESC(iServiceConnection,(CSenServiceConnection*)NULL, "The test is failed."); |
|
1479 |
|
1480 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1481 iServiceConnection = NULL; |
|
1482 |
|
1483 CleanupStack::Pop(pPattern); |
|
1484 __ASSERT_ALWAYS_NO_LEAVE(delete pPattern); |
|
1485 pPattern = NULL; |
|
1486 Teardown(); |
|
1487 return KErrNone; |
|
1488 } |
|
1489 |
|
1490 |
|
1491 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_ID_WSF_PatternL( TTestResult& aResult ) |
|
1492 { |
|
1493 SetupL() ; |
|
1494 CSenServicePattern* pPattern = CSenServicePattern::NewLC(KAddressBookServiceId, KNullDesC8()); |
|
1495 pPattern->SetFrameworkIdL(KIDWSFFrameworkID); |
|
1496 pPattern->SetContractL(KAddressBookServiceId); |
|
1497 |
|
1498 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
1499 pPattern->SetConsumerIapIdL(iapId); |
|
1500 |
|
1501 iServiceConnection = CSenServiceConnection::NewLC(*this, *pPattern); |
|
1502 StartActiveScheduler(1); |
|
1503 |
|
1504 TL(iServiceConnection != (CSenServiceConnection*)NULL); |
|
1505 CleanupStack::Pop(); //iServiceConnection |
|
1506 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1507 iServiceConnection = NULL; |
|
1508 |
|
1509 CleanupStack::Pop(pPattern); |
|
1510 __ASSERT_ALWAYS_NO_LEAVE(delete pPattern); |
|
1511 pPattern = NULL; |
|
1512 Teardown(); |
|
1513 return KErrNone; |
|
1514 } |
|
1515 |
|
1516 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_ContractL1( TTestResult& aResult ) |
|
1517 { |
|
1518 SetupL() ; |
|
1519 MSenExtendedConsumerInterface provider; |
|
1520 iServiceConnection = CSenServiceConnection::NewL(*this, KAddressBookContract, provider); |
|
1521 StartActiveScheduler(1); |
|
1522 |
|
1523 //LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
1524 TL(iServiceConnection != (CSenServiceConnection*)NULL); |
|
1525 |
|
1526 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1527 iServiceConnection = NULL; |
|
1528 Teardown(); |
|
1529 return KErrNone; |
|
1530 } |
|
1531 |
|
1532 |
|
1533 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_ContractL1( TTestResult& aResult ) |
|
1534 { |
|
1535 |
|
1536 SetupL() ; |
|
1537 MSenExtendedConsumerInterface provider; |
|
1538 |
|
1539 iServiceConnection = CSenServiceConnection::NewLC(*this, KAddressBookContract, provider); |
|
1540 StartActiveScheduler(1); |
|
1541 |
|
1542 //LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
1543 TL(iServiceConnection != (CSenServiceConnection*)NULL); |
|
1544 |
|
1545 CleanupStack::Pop(); //iServiceConnection |
|
1546 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1547 iServiceConnection = NULL; |
|
1548 Teardown(); |
|
1549 return KErrNone; |
|
1550 |
|
1551 |
|
1552 } |
|
1553 |
|
1554 |
|
1555 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_WS_I_DescriptionL1( TTestResult& aResult ) |
|
1556 { |
|
1557 SetupL() ; |
|
1558 MSenExtendedConsumerInterface provider; |
|
1559 |
|
1560 // Only Endpoint and FrameworkId needs to be defined in WS-I case. |
|
1561 // There is no need to define Contract. => KNullDesC8 is passed as a Contract. |
|
1562 iSenXmlServiceDescription = CSenXmlServiceDescription::NewL(KAuthServEndpoint, KNullDesC8()); |
|
1563 iSenXmlServiceDescription->SetFrameworkIdL(*ipFrameworkID); |
|
1564 |
|
1565 iServiceConnection = CSenServiceConnection::NewL(*this, *iSenXmlServiceDescription, provider); |
|
1566 StartActiveScheduler(1); |
|
1567 |
|
1568 //STIFF_ASSERT_DESC(iConnectionState == KSenConnectionStatusReady, |
|
1569 //"Could not initialize ServiceConnection"); |
|
1570 |
|
1571 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1572 iServiceConnection = NULL; |
|
1573 |
|
1574 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
1575 iSenXmlServiceDescription = NULL; |
|
1576 Teardown(); |
|
1577 return KErrNone; |
|
1578 } |
|
1579 |
|
1580 |
|
1581 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_WS_I_DescriptionL1( TTestResult& aResult ) |
|
1582 { |
|
1583 SetupL() ; |
|
1584 MSenExtendedConsumerInterface provider; |
|
1585 |
|
1586 // Only Endpoint and FrameworkId needs to be defined in WS-I case. |
|
1587 // There is no need to define Contract. => KNullDesC8 is passed as a Contract. |
|
1588 iSenXmlServiceDescription = CSenXmlServiceDescription::NewL(KAuthServEndpoint, KNullDesC8()); |
|
1589 iSenXmlServiceDescription->SetFrameworkIdL(*ipFrameworkID); |
|
1590 |
|
1591 CSenServiceConnection* iServiceConnection = CSenServiceConnection::NewLC(*this, *iSenXmlServiceDescription, provider); |
|
1592 StartActiveScheduler(1); |
|
1593 |
|
1594 //STIFF_ASSERT_DESC(iConnectionState == KSenConnectionStatusReady, |
|
1595 //"Could not initialize ServiceConnection"); |
|
1596 |
|
1597 CleanupStack::Pop(); //iServiceConnection |
|
1598 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1599 iServiceConnection = NULL; |
|
1600 |
|
1601 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
1602 iSenXmlServiceDescription = NULL; |
|
1603 Teardown(); |
|
1604 return KErrNone; |
|
1605 } |
|
1606 |
|
1607 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewL_WS_I_PatternL1( TTestResult& aResult ) |
|
1608 { |
|
1609 SetupL() ; |
|
1610 MSenExtendedConsumerInterface provider; |
|
1611 |
|
1612 CSenServicePattern* pSenServicePattern = CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
1613 pSenServicePattern->SetFrameworkIdL(*ipFrameworkID); |
|
1614 //pSenServicePattern->SetContractL(KAuthServEndpoint); |
|
1615 |
|
1616 iServiceConnection = CSenServiceConnection::NewL(*this, *pSenServicePattern, provider); |
|
1617 StartActiveScheduler(1); |
|
1618 |
|
1619 //STIFF_ASSERT_DESC(iConnectionState == KSenConnectionStatusReady, |
|
1620 //"Could not initialize ServiceConnection"); |
|
1621 |
|
1622 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1623 iServiceConnection = NULL; |
|
1624 |
|
1625 CleanupStack::Pop(pSenServicePattern); |
|
1626 __ASSERT_ALWAYS_NO_LEAVE(delete pSenServicePattern); |
|
1627 pSenServicePattern = NULL; |
|
1628 Teardown(); |
|
1629 return KErrNone; |
|
1630 } |
|
1631 |
|
1632 |
|
1633 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_NewLC_WS_I_PatternL1( TTestResult& aResult ) |
|
1634 { |
|
1635 SetupL() ; |
|
1636 MSenExtendedConsumerInterface provider; |
|
1637 |
|
1638 CSenServicePattern* aSenServicePattern = CSenServicePattern::NewL(KAuthServEndpoint, KNullDesC8()); |
|
1639 aSenServicePattern->SetFrameworkIdL(*ipFrameworkID); |
|
1640 //aSenServicePattern->SetContractL(KAuthServEndpoint); |
|
1641 |
|
1642 CSenServiceConnection* iServiceConnection = CSenServiceConnection::NewLC(*this, *aSenServicePattern, provider); |
|
1643 StartActiveScheduler(1); |
|
1644 |
|
1645 //STIFF_ASSERT_DESC(iConnectionState == KSenConnectionStatusReady, |
|
1646 //"Could not initialize ServiceConnection"); |
|
1647 |
|
1648 CleanupStack::Pop(); //iServiceConnection |
|
1649 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1650 iServiceConnection = NULL; |
|
1651 |
|
1652 delete aSenServicePattern; |
|
1653 aSenServicePattern = NULL; |
|
1654 Teardown(); |
|
1655 return KErrNone; |
|
1656 } |
|
1657 |
|
1658 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_RFileL_IPCBigrequest( TTestResult& aResult ) |
|
1659 { |
|
1660 SetupL() ; |
|
1661 TInt retVal(KErrNone); |
|
1662 iSenXmlServiceDescription = CSenServicePattern::NewL(); |
|
1663 iSenXmlServiceDescription->SetFrameworkIdL(KRESTFrameworkID); |
|
1664 iSenXmlServiceDescription->SetEndPointL(KIPCServiceEndPoint); |
|
1665 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
1666 iSenXmlServiceDescription->SetIapIdL(iapId); |
|
1667 //iServiceConnection = CSenServiceConnection::NewLC(*this, KAddressBookServiceId()); |
|
1668 iServiceConnection = CSenServiceConnection::NewL(*this, *iSenXmlServiceDescription); |
|
1669 |
|
1670 StartActiveScheduler(1); |
|
1671 User::LeaveIfError(this->iFsSessionHandle.Connect());//anil |
|
1672 User::LeaveIfError(this->iFsSessionHandle.ShareProtected()); |
|
1673 |
|
1674 retVal=iRFileHandle.Open(iFsSessionHandle, _L("c:\\private\\101FB3E7\\WS_IPCImpBigRequest"), EFileStream|EFileRead); |
|
1675 |
|
1676 CleanupClosePushL(iRFileHandle); |
|
1677 TInt transactionIdOrError = iServiceConnection->SendL(iRFileHandle); |
|
1678 //LOCAL_ASSERT(transactionIdOrError2 > KErrNone); |
|
1679 if (transactionIdOrError!=KErrArgument) |
|
1680 StartActiveScheduler(1); |
|
1681 CleanupStack::Pop(&iRFileHandle); |
|
1682 if(iFsSessionHandle.Handle()) |
|
1683 iFsSessionHandle.Close(); |
|
1684 |
|
1685 |
|
1686 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
1687 iSenXmlServiceDescription = NULL; |
|
1688 |
|
1689 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1690 iServiceConnection = NULL; |
|
1691 Teardown(); |
|
1692 return KErrNone; |
|
1693 |
|
1694 } |
|
1695 |
|
1696 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_RFileL_IPCBigrequest( TTestResult& aResult ) |
|
1697 { |
|
1698 SetupL() ; |
|
1699 TInt retVal(KErrNone); |
|
1700 iSenXmlServiceDescription = CSenServicePattern::NewL(); |
|
1701 iSenXmlServiceDescription->SetFrameworkIdL(KRESTFrameworkID); |
|
1702 iSenXmlServiceDescription->SetEndPointL(KIPCServiceEndPoint); |
|
1703 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
1704 iSenXmlServiceDescription->SetIapIdL(iapId); |
|
1705 //iServiceConnection = CSenServiceConnection::NewL(*this, KAddressBookServiceId()); |
|
1706 iServiceConnection = CSenServiceConnection::NewL(*this, *iSenXmlServiceDescription); |
|
1707 |
|
1708 StartActiveScheduler(1); |
|
1709 User::LeaveIfError(this->iFsSessionHandle.Connect());//anil |
|
1710 User::LeaveIfError(this->iFsSessionHandle.ShareProtected()); |
|
1711 |
|
1712 retVal=iRFileHandle.Open(iFsSessionHandle, _L("c:\\private\\101FB3E7\\WS_IPCImpBigRequest"), EFileStream|EFileRead); |
|
1713 |
|
1714 CleanupClosePushL(iRFileHandle); |
|
1715 HBufC8 *pMsgBuf = NULL;// Buffer to get response |
|
1716 TInt transactionIdOrError = iServiceConnection->SubmitL(iRFileHandle, pMsgBuf); |
|
1717 // LOCAL_ASSERT(transactionIdOrError > KErrNone); |
|
1718 if(pMsgBuf) |
|
1719 { |
|
1720 // CleanupStack::PopAndDestroy(pMsgBuf);//clean response |
|
1721 delete pMsgBuf; |
|
1722 pMsgBuf = NULL; |
|
1723 } |
|
1724 CleanupStack::PopAndDestroy(&iRFileHandle); |
|
1725 if(iFsSessionHandle.Handle()) |
|
1726 iFsSessionHandle.Close(); |
|
1727 |
|
1728 |
|
1729 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
1730 iSenXmlServiceDescription = NULL; |
|
1731 |
|
1732 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1733 iServiceConnection = NULL; |
|
1734 Teardown(); |
|
1735 return KErrNone; |
|
1736 |
|
1737 } |
|
1738 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_RFileL_MTOM( TTestResult& aResult ) |
|
1739 { |
|
1740 SetupL() ; |
|
1741 TInt retVal(KErrNone); |
|
1742 iSenXmlServiceDescription = CSenServicePattern::NewL(); |
|
1743 iSenXmlServiceDescription->SetFrameworkIdL(KRESTFrameworkID); |
|
1744 iSenXmlServiceDescription->SetEndPointL(KMtomEndPoint); |
|
1745 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
1746 iSenXmlServiceDescription->SetIapIdL(iapId); |
|
1747 //iServiceConnection = CSenServiceConnection::NewL(*this, KAddressBookServiceId()); |
|
1748 iServiceConnection = CSenServiceConnection::NewL(*this, *iSenXmlServiceDescription); |
|
1749 |
|
1750 StartActiveScheduler(1); |
|
1751 User::LeaveIfError(this->iFsSessionHandle.Connect());//anil |
|
1752 User::LeaveIfError(this->iFsSessionHandle.ShareProtected()); |
|
1753 |
|
1754 retVal=iRFileHandle.Open(iFsSessionHandle, _L("c:\\private\\101FB3E7\\testPic9.jpg"), EFileStream|EFileRead); |
|
1755 |
|
1756 CleanupClosePushL(iRFileHandle); |
|
1757 HBufC8 *pMsgBuf = NULL;// Buffer to get response |
|
1758 TInt transactionIdOrError = iServiceConnection->SubmitL(iRFileHandle, pMsgBuf); |
|
1759 // LOCAL_ASSERT(transactionIdOrError > KErrNone); |
|
1760 if(pMsgBuf) |
|
1761 { |
|
1762 RFs logSession; |
|
1763 RFile Mtomlog; |
|
1764 User::LeaveIfError(logSession.Connect());//ani |
|
1765 |
|
1766 // CleanupStack::PopAndDestroy(pMsgBuf);//clean response |
|
1767 TInt err = Mtomlog.Create(iFsSessionHandle, _L("c:\\private\\101FB3E7\\MTOM.txt"), EFileWrite); |
|
1768 TInt pos=0 ; |
|
1769 Mtomlog.Seek(ESeekEnd,pos); |
|
1770 // _LIT8(KRequest, "<ab:Query xmlns:ab=\"urn:nokia:test:addrbook:2004-09\"><ab:QueryItem><ab:Select>/ab:Card[containts[ab:N/ab:FAMILY,\'Bob\'] or containts[ab:N/ab:GIVEN,\'Bob\'] or containts[ab:TEL,\'Bob\']]</ab:Select></ab:QueryItem></ab:Query>"); |
|
1771 TBuf8<4096> temp=pMsgBuf->Des(); |
|
1772 Mtomlog.Write(temp); |
|
1773 Mtomlog.Close(); |
|
1774 CleanupStack::PopAndDestroy(&Mtomlog); |
|
1775 if(logSession.Handle()) |
|
1776 logSession.Close(); |
|
1777 |
|
1778 |
|
1779 delete pMsgBuf; |
|
1780 pMsgBuf = NULL; |
|
1781 } |
|
1782 CleanupStack::PopAndDestroy(&iRFileHandle); |
|
1783 if(iFsSessionHandle.Handle()) |
|
1784 iFsSessionHandle.Close(); |
|
1785 |
|
1786 |
|
1787 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
1788 iSenXmlServiceDescription = NULL; |
|
1789 |
|
1790 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1791 iServiceConnection = NULL; |
|
1792 Teardown(); |
|
1793 return KErrNone; |
|
1794 |
|
1795 } |
|
1796 |
|
1797 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_RFileL( TTestResult& aResult ) |
|
1798 { |
|
1799 SetupL() ; |
|
1800 TInt retVal(KErrNone); |
|
1801 iSenXmlServiceDescription = CSenXmlServiceDescription::NewL(); |
|
1802 iSenXmlServiceDescription->SetFrameworkIdL(KIDWSFFrameworkID); |
|
1803 iSenXmlServiceDescription->SetEndPointL(KAddressBookServiceId); |
|
1804 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
1805 iSenXmlServiceDescription->SetIapIdL(iapId); |
|
1806 TInt err(KErrNone); |
|
1807 |
|
1808 //iServiceConnection = CSenServiceConnection::NewL(*this, KAddressBookServiceId()); |
|
1809 iServiceConnection = CSenServiceConnection::NewLC(*this, *iSenXmlServiceDescription); |
|
1810 |
|
1811 StartActiveScheduler(1); |
|
1812 User::LeaveIfError(this->iFsSessionHandle.Connect());//anil |
|
1813 User::LeaveIfError(this->iFsSessionHandle.ShareProtected()); |
|
1814 err = iRFileHandle.Open(iFsSessionHandle, _L("c:\\private\\101FB3E7\\Test.txt"), EFileStream|EFileRead); |
|
1815 CleanupClosePushL(iRFileHandle); |
|
1816 HBufC8 *pMsgBuf = NULL; |
|
1817 TInt transactionIdOrError = iServiceConnection->SubmitL(iRFileHandle, pMsgBuf); |
|
1818 if(pMsgBuf) |
|
1819 { |
|
1820 // CleanupStack::PopAndDestroy(pMsgBuf);//clean response |
|
1821 delete pMsgBuf; |
|
1822 pMsgBuf = NULL; |
|
1823 |
|
1824 } |
|
1825 // LOCAL_ASSERT(transactionIdOrError > KErrNone); |
|
1826 //StartActiveScheduler(1); |
|
1827 CleanupStack::Pop(&iRFileHandle); |
|
1828 if(iFsSessionHandle.Handle()) |
|
1829 iFsSessionHandle.Close(); |
|
1830 |
|
1831 CleanupStack::Pop(iServiceConnection); |
|
1832 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1833 iServiceConnection = NULL; |
|
1834 |
|
1835 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
1836 iSenXmlServiceDescription = NULL; |
|
1837 |
|
1838 // iRFileHandle.Close(); |
|
1839 Teardown(); |
|
1840 return KErrNone; |
|
1841 } |
|
1842 |
|
1843 //New Test Case SendL with RFile |
|
1844 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_RFileL( TTestResult& aResult ) |
|
1845 { |
|
1846 SetupL() ; |
|
1847 TInt retVal(KErrNone); |
|
1848 iSenXmlServiceDescription = CSenXmlServiceDescription::NewL(); |
|
1849 iSenXmlServiceDescription->SetFrameworkIdL(KIDWSFFrameworkID); |
|
1850 iSenXmlServiceDescription->SetEndPointL(KAddressBookServiceId); |
|
1851 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
1852 iSenXmlServiceDescription->SetIapIdL(iapId); |
|
1853 TInt err(KErrNone); |
|
1854 |
|
1855 //iServiceConnection = CSenServiceConnection::NewL(*this, KAddressBookServiceId()); |
|
1856 iServiceConnection = CSenServiceConnection::NewLC(*this, *iSenXmlServiceDescription); |
|
1857 |
|
1858 StartActiveScheduler(1); |
|
1859 /* |
|
1860 _LIT16(KRFileSrc,"c\\private\\101FB3E7\\Test.txt"); |
|
1861 TInt err = iRFileHandle.Open(iFsSessionHandle,_L("c:\\private\\101FB3E7\\Test.txt"),EFileWrite); |
|
1862 if(err !=KErrNone) |
|
1863 err = iRFileHandle.Create(iFsSessionHandle, _L("c:\\private\\101FB3E7\\Test.txt"), EFileWrite); |
|
1864 TInt pos=0 ; |
|
1865 iRFileHandle.Seek(ESeekEnd,pos); |
|
1866 _LIT8(KRequest, "<ab:Query xmlns:ab=\"urn:nokia:test:addrbook:2004-09\"><ab:QueryItem><ab:Select>/ab:Card[containts[ab:N/ab:FAMILY,\'Bob\'] or containts[ab:N/ab:GIVEN,\'Bob\'] or containts[ab:TEL,\'Bob\']]</ab:Select></ab:QueryItem></ab:Query>"); |
|
1867 iRFileHandle.Write(KRequest); |
|
1868 iRFileHandle.Close(); |
|
1869 */ |
|
1870 User::LeaveIfError(this->iFsSessionHandle.Connect());//anil |
|
1871 User::LeaveIfError(this->iFsSessionHandle.ShareProtected()); |
|
1872 err = iRFileHandle.Open(iFsSessionHandle, _L("c:\\private\\101FB3E7\\Test.txt"), EFileStream|EFileRead); |
|
1873 CleanupClosePushL(iRFileHandle); |
|
1874 TInt transactionIdOrError = iServiceConnection->SendL(iRFileHandle); |
|
1875 if (transactionIdOrError == KErrNone) |
|
1876 StartActiveScheduler(1); |
|
1877 // LOCAL_ASSERT(transactionIdOrError > KErrNone); |
|
1878 |
|
1879 CleanupStack::PopAndDestroy(&iRFileHandle); |
|
1880 if(iFsSessionHandle.Handle()) |
|
1881 iFsSessionHandle.Close(); |
|
1882 |
|
1883 CleanupStack::Pop(iServiceConnection); |
|
1884 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1885 iServiceConnection = NULL; |
|
1886 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
1887 iSenXmlServiceDescription = NULL; |
|
1888 |
|
1889 |
|
1890 Teardown(); |
|
1891 return KErrNone; |
|
1892 } |
|
1893 |
|
1894 |
|
1895 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnectionSnapIdL( TTestResult& aResult ) |
|
1896 { |
|
1897 SetupL() ; |
|
1898 |
|
1899 TUint32 snapId=11; |
|
1900 TUint32 retSnapId; |
|
1901 |
|
1902 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
1903 pHttpProperties->SetSnapIdL(snapId); |
|
1904 pHttpProperties->SnapIdL(retSnapId); |
|
1905 TL(retSnapId==snapId); |
|
1906 CleanupStack::PopAndDestroy(pHttpProperties) ;// |
|
1907 Teardown(); |
|
1908 return KErrNone; |
|
1909 } |
|
1910 TAny* CSenServiceConnectionBCTest::GetInterfaceByUid( TUid aUID ) |
|
1911 { |
|
1912 iLog->Log(_L("GetInterfaceByUid()->start")); |
|
1913 #ifdef __ENABLE_ALR__ |
|
1914 if ( (aUID == KSenInterfaceUidAlrObserver) && iUseALR) |
|
1915 { |
|
1916 MSenAlrServiceConnection* observer = (MSenAlrServiceConnection*) this; |
|
1917 iLog->Log(_L("Alr observer is set ")); |
|
1918 return observer; |
|
1919 } |
|
1920 #endif //__ENABLE_ALR__ |
|
1921 if ( (aUID == KSenInterfaceUidCoBrandingObserver) && iCoBrandingCallbackOption) |
|
1922 { |
|
1923 // return this; // wrong, please cast first to M-class (if same C-class implements multiple extended interfaces (M-classes)) |
|
1924 MSenCoBrandingObserver* observer = (MSenCoBrandingObserver*) this; |
|
1925 iLog->Log(_L("CoBrand observer is set ")); |
|
1926 return observer; |
|
1927 } |
|
1928 if ( (aUID == KSenInterfaceUidHostletConsumer) && iHostletConsumerOption) |
|
1929 { |
|
1930 // return this; // wrong, please cast first to M-class (if same C-class implements multiple extended interfaces (M-classes)) |
|
1931 MSenHostletConsumer* observer = (MSenHostletConsumer*) this; |
|
1932 iLog->Log(_L("Hostlet Consumer is set ")); |
|
1933 return observer; |
|
1934 } |
|
1935 |
|
1936 iLog->Log(_L("GetInterfaceByUid()->End with out set observer ")); |
|
1937 return NULL; |
|
1938 } |
|
1939 |
|
1940 |
|
1941 /* |
|
1942 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_NoErrorL( TTestResult& aResult ) |
|
1943 { |
|
1944 SetupL() ; |
|
1945 iSenXmlServiceDescription = CSenXmlServiceDescription::NewL(); |
|
1946 iSenXmlServiceDescription->SetFrameworkIdL(KIDWSFFrameworkID); |
|
1947 iSenXmlServiceDescription->SetContractL(KAddressBookServiceId); |
|
1948 |
|
1949 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
1950 iSenXmlServiceDescription->SetIapIdL(iapId); |
|
1951 |
|
1952 iServiceConnection = CSenServiceConnection::NewL(*this, *iSenXmlServiceDescription); |
|
1953 StartActiveScheduler(1); |
|
1954 |
|
1955 STIFF_ASSERT_NOT_EQUALS_DESC(iServiceConnection,(CSenServiceConnection*)NULL, "The test is failed."); |
|
1956 |
|
1957 _LIT8(KRequest, "<ab:Query xmlns:ab=\"urn:nokia:test:addrbook:2004-09\"><ab:QueryItem><ab:Select>/ab:Card[containts[ab:N/ab:FAMILY,\'Bob\'] or containts[ab:N/ab:GIVEN,\'Bob\'] or containts[ab:TEL,\'Bob\']]</ab:Select></ab:QueryItem></ab:Query>"); |
|
1958 |
|
1959 TInt transactionIdOrError = iServiceConnection->SendL(KRequest); |
|
1960 LOCAL_ASSERT(transactionIdOrError > KErrNone); |
|
1961 |
|
1962 StartActiveScheduler(1); |
|
1963 |
|
1964 TL(iTransactionId == transactionIdOrError); |
|
1965 |
|
1966 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
1967 iSenXmlServiceDescription = NULL; |
|
1968 |
|
1969 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
1970 iServiceConnection = NULL; |
|
1971 Teardown(); |
|
1972 return KErrNone; |
|
1973 } |
|
1974 |
|
1975 |
|
1976 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_CancelL( TTestResult& aResult ) |
|
1977 { |
|
1978 SetupL() ; |
|
1979 iSenXmlServiceDescription = CSenXmlServiceDescription::NewL(); |
|
1980 iSenXmlServiceDescription->SetFrameworkIdL(KIDWSFFrameworkID); |
|
1981 iSenXmlServiceDescription->SetContractL(KAddressBookServiceId); |
|
1982 |
|
1983 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
1984 iSenXmlServiceDescription->SetIapIdL(iapId); |
|
1985 |
|
1986 iServiceConnection = CSenServiceConnection::NewL(*this, *iSenXmlServiceDescription); |
|
1987 StartActiveScheduler(1); |
|
1988 |
|
1989 STIFF_ASSERT_NOT_EQUALS_DESC(iServiceConnection,(CSenServiceConnection*)NULL, "The test is failed."); |
|
1990 |
|
1991 _LIT8(KRequest, "<ab:Query xmlns:ab=\"urn:nokia:test:addrbook:2004-09\"><ab:QueryItem><ab:Select>/ab:Card[containts[ab:N/ab:FAMILY,\'Bob\'] or containts[ab:N/ab:GIVEN,\'Bob\'] or containts[ab:TEL,\'Bob\']]</ab:Select></ab:QueryItem></ab:Query>"); |
|
1992 |
|
1993 TInt transactionIdOrError = iServiceConnection->SendL(KRequest); |
|
1994 LOCAL_ASSERT(transactionIdOrError > KErrNone); |
|
1995 |
|
1996 iServiceConnection->CancelTransaction(transactionIdOrError); |
|
1997 |
|
1998 StartActiveScheduler(1); |
|
1999 |
|
2000 TL(iTransactionId == transactionIdOrError); |
|
2001 LOCAL_ASSERT(iErrorCode == KErrSenCancelled); |
|
2002 |
|
2003 User::After(2000000); |
|
2004 |
|
2005 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
2006 iSenXmlServiceDescription = NULL; |
|
2007 |
|
2008 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
2009 iServiceConnection = NULL; |
|
2010 Teardown(); |
|
2011 return KErrNone; |
|
2012 } |
|
2013 |
|
2014 |
|
2015 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_ConNotInitialL( TTestResult& aResult ) |
|
2016 { |
|
2017 SetupL() ; |
|
2018 iSenXmlServiceDescription = CSenXmlServiceDescription::NewL(); |
|
2019 iSenXmlServiceDescription->SetFrameworkIdL(KIDWSFFrameworkID); |
|
2020 iSenXmlServiceDescription->SetContractL(KAddressBookServiceId); |
|
2021 |
|
2022 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
2023 iSenXmlServiceDescription->SetIapIdL(iapId); |
|
2024 |
|
2025 iServiceConnection = CSenServiceConnection::NewL(*this, *iSenXmlServiceDescription); |
|
2026 |
|
2027 STIFF_ASSERT_NOT_EQUALS_DESC(iServiceConnection,(CSenServiceConnection*)NULL, "The test is failed."); |
|
2028 |
|
2029 _LIT8(KRequest, "<ab:Query xmlns:ab=\"urn:nokia:test:addrbook:2004-09\"><ab:QueryItem><ab:Select>/ab:Card[containts[ab:N/ab:FAMILY,\'Bob\'] or containts[ab:N/ab:GIVEN,\'Bob\'] or containts[ab:TEL,\'Bob\']]</ab:Select></ab:QueryItem></ab:Query>"); |
|
2030 |
|
2031 TL((iServiceConnection->SendL(KRequest)) == KErrSenNotInitialized); |
|
2032 StartActiveScheduler(1); |
|
2033 |
|
2034 delete iSenXmlServiceDescription; |
|
2035 iSenXmlServiceDescription = NULL; |
|
2036 |
|
2037 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
2038 iServiceConnection = NULL; |
|
2039 Teardown(); |
|
2040 return KErrNone; |
|
2041 } |
|
2042 |
|
2043 |
|
2044 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendMultipleMessagesL( TTestResult& aResult ) |
|
2045 { |
|
2046 SetupL() ; |
|
2047 CSenServicePattern* pPattern = |
|
2048 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
2049 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
2050 |
|
2051 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
2052 |
|
2053 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
2054 |
|
2055 CleanupStack::PopAndDestroy(pPattern); |
|
2056 |
|
2057 StartActiveScheduler(1); |
|
2058 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
2059 // Connection is ready to be used. |
|
2060 |
|
2061 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
2062 |
|
2063 // Http Get (using SetTransportPropertiesL) |
|
2064 // **************************************** |
|
2065 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2066 pHttpProperties->SetIapIdL(iapId); |
|
2067 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2068 |
|
2069 CleanupStack::PushL(pSerializedProperties); |
|
2070 |
|
2071 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2072 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2073 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2074 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2075 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2076 //CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2077 |
|
2078 //pHttpProperties->SetOmittedL(KIapIdLocalName, ETrue); |
|
2079 //pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2080 |
|
2081 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2082 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2083 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2084 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2085 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2086 StartActiveScheduler(10); |
|
2087 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2088 |
|
2089 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2090 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2091 |
|
2092 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
2093 |
|
2094 delete iServiceConnection; |
|
2095 iServiceConnection = NULL; |
|
2096 Teardown(); |
|
2097 return KErrNone; |
|
2098 } |
|
2099 |
|
2100 |
|
2101 |
|
2102 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_Get_Post1L( TTestResult& aResult ) |
|
2103 { |
|
2104 SetupL() ; |
|
2105 // 1. SendL(MSG [SC::POST by default]) |
|
2106 // 2. SendL(MSG, TP::GET), |
|
2107 // 3. SendL(MSG, TP::POST) |
|
2108 |
|
2109 CSenServicePattern* pPattern = |
|
2110 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
2111 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
2112 |
|
2113 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
2114 pPattern->SetConsumerIapIdL(iapId); |
|
2115 |
|
2116 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
2117 |
|
2118 CleanupStack::PopAndDestroy(pPattern); |
|
2119 |
|
2120 StartActiveScheduler(1); |
|
2121 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
2122 // Connection is ready to be used. |
|
2123 |
|
2124 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
2125 |
|
2126 // Http Post |
|
2127 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2128 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
2129 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2130 CleanupStack::PushL(pSerializedProperties); |
|
2131 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2132 StartActiveScheduler(1); |
|
2133 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2134 |
|
2135 // Check from HTTP Transaction logger log that POST method were used. |
|
2136 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
2137 LOCAL_ASSERT(pFileContent != NULL); |
|
2138 CleanupStack::PushL(pFileContent); |
|
2139 HBufC8* pValue = HttpMethodValueFromXmlLC(*pFileContent); |
|
2140 if ( pValue ) |
|
2141 { |
|
2142 LOCAL_ASSERT(*pValue == KHTTPMethodPost); |
|
2143 } |
|
2144 CleanupStack::PopAndDestroy(pValue); |
|
2145 CleanupStack::PopAndDestroy(pFileContent); |
|
2146 |
|
2147 // Http Get |
|
2148 pHttpProperties->SetHttpMethodL(CSenHttpTransportProperties::ESenHttpGet); |
|
2149 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2150 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2151 CleanupStack::PushL(pSerializedProperties); |
|
2152 |
|
2153 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2154 StartActiveScheduler(1); |
|
2155 LOCAL_ASSERT(iCallback == ECallbackHandleError); |
|
2156 |
|
2157 // Check from HTTP Transaction logger log that GET method were used. |
|
2158 pFileContent = ReadFileL(KFileToRead); |
|
2159 LOCAL_ASSERT(pFileContent != NULL); |
|
2160 CleanupStack::PushL(pFileContent); |
|
2161 pValue = HttpMethodValueFromXmlLC(*pFileContent); |
|
2162 if ( pValue ) |
|
2163 { |
|
2164 LOCAL_ASSERT(*pValue == KHTTPMethodGet); |
|
2165 } |
|
2166 CleanupStack::PopAndDestroy(pValue); |
|
2167 CleanupStack::PopAndDestroy(pFileContent); |
|
2168 |
|
2169 // Http Post |
|
2170 pHttpProperties->SetHttpMethodL(CSenHttpTransportProperties::ESenHttpPost); |
|
2171 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2172 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2173 CleanupStack::PushL(pSerializedProperties); |
|
2174 |
|
2175 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2176 StartActiveScheduler(1); |
|
2177 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2178 |
|
2179 // Check from HTTP Transaction logger log that POST method were used. |
|
2180 pFileContent = ReadFileL(KFileToRead); |
|
2181 LOCAL_ASSERT(pFileContent != NULL); |
|
2182 CleanupStack::PushL(pFileContent); |
|
2183 pValue = HttpMethodValueFromXmlLC(*pFileContent); |
|
2184 if ( pValue ) |
|
2185 { |
|
2186 LOCAL_ASSERT(*pValue == KHTTPMethodPost); |
|
2187 } |
|
2188 CleanupStack::PopAndDestroy(pValue); |
|
2189 CleanupStack::PopAndDestroy(pFileContent); |
|
2190 |
|
2191 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2192 |
|
2193 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2194 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
2195 |
|
2196 delete iServiceConnection; |
|
2197 iServiceConnection = NULL; |
|
2198 Teardown(); |
|
2199 return KErrNone; |
|
2200 } |
|
2201 |
|
2202 |
|
2203 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_Get_Post2L( TTestResult& aResult ) |
|
2204 { |
|
2205 SetupL() ; |
|
2206 // 1. SetTransportPropertiesL(TP::GET) |
|
2207 // 2. SendL(MSG) - Send(MSG, TP::POST) |
|
2208 // 3. SendL (MSG [SC::GET]) |
|
2209 // 4. SetTransportPropertiesL(TP:POST) |
|
2210 // 5. SendL(MSG [SC:POST] |
|
2211 |
|
2212 CSenServicePattern* pPattern = |
|
2213 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
2214 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
2215 |
|
2216 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
2217 pPattern->SetConsumerIapIdL(iapId); |
|
2218 |
|
2219 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
2220 |
|
2221 CleanupStack::PopAndDestroy(pPattern); |
|
2222 |
|
2223 StartActiveScheduler(1); |
|
2224 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
2225 // Connection is ready to be used. |
|
2226 |
|
2227 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
2228 |
|
2229 // Http Get (using SetTransportPropertiesL) |
|
2230 // **************************************** |
|
2231 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2232 pHttpProperties->SetHttpMethodL(CSenHttpTransportProperties::ESenHttpGet); |
|
2233 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
2234 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2235 CleanupStack::PushL(pSerializedProperties); |
|
2236 iServiceConnection->SetTransportPropertiesL(*pSerializedProperties); |
|
2237 iServiceConnection->SendL(*pSOAPMessage); |
|
2238 StartActiveScheduler(1); |
|
2239 LOCAL_ASSERT(iCallback == ECallbackHandleError); |
|
2240 |
|
2241 // Check from HTTP Transaction logger log that GET method were used. |
|
2242 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
2243 LOCAL_ASSERT(pFileContent != NULL); |
|
2244 CleanupStack::PushL(pFileContent); |
|
2245 HBufC8* pValue = HttpMethodValueFromXmlLC(*pFileContent); |
|
2246 if ( pValue ) |
|
2247 { |
|
2248 LOCAL_ASSERT(*pValue == KHTTPMethodGet); |
|
2249 } |
|
2250 CleanupStack::PopAndDestroy(pValue); |
|
2251 CleanupStack::PopAndDestroy(pFileContent); |
|
2252 |
|
2253 // Http Post (using TransportProperties in SendL parameters) |
|
2254 // ********************************************************* |
|
2255 pHttpProperties->SetHttpMethodL(CSenHttpTransportProperties::ESenHttpPost); |
|
2256 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2257 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2258 CleanupStack::PushL(pSerializedProperties); |
|
2259 |
|
2260 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2261 StartActiveScheduler(1); |
|
2262 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2263 |
|
2264 // Check from HTTP Transaction logger log that Post method were used. |
|
2265 pFileContent = ReadFileL(KFileToRead); |
|
2266 LOCAL_ASSERT(pFileContent != NULL); |
|
2267 CleanupStack::PushL(pFileContent); |
|
2268 pValue = HttpMethodValueFromXmlLC(*pFileContent); |
|
2269 if ( pValue ) |
|
2270 { |
|
2271 LOCAL_ASSERT(*pValue == KHTTPMethodPost); |
|
2272 } |
|
2273 CleanupStack::PopAndDestroy(pValue); |
|
2274 CleanupStack::PopAndDestroy(pFileContent); |
|
2275 |
|
2276 // Http Get (using TransportProperties in SendL parameters) |
|
2277 // ******************************************************** |
|
2278 pHttpProperties->SetHttpMethodL(CSenHttpTransportProperties::ESenHttpGet); |
|
2279 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2280 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2281 CleanupStack::PushL(pSerializedProperties); |
|
2282 |
|
2283 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2284 StartActiveScheduler(1); |
|
2285 LOCAL_ASSERT(iCallback == ECallbackHandleError); |
|
2286 |
|
2287 // Check from HTTP Transaction logger log that GET method were used. |
|
2288 pFileContent = ReadFileL(KFileToRead); |
|
2289 LOCAL_ASSERT(pFileContent != NULL); |
|
2290 CleanupStack::PushL(pFileContent); |
|
2291 pValue = HttpMethodValueFromXmlLC(*pFileContent); |
|
2292 if ( pValue ) |
|
2293 { |
|
2294 LOCAL_ASSERT(*pValue == KHTTPMethodGet); |
|
2295 } |
|
2296 CleanupStack::PopAndDestroy(pValue); |
|
2297 CleanupStack::PopAndDestroy(pFileContent); |
|
2298 |
|
2299 // Http Post (using SetTransportPropertiesL) |
|
2300 // ***************************************** |
|
2301 pHttpProperties->SetHttpMethodL(CSenHttpTransportProperties::ESenHttpPost); |
|
2302 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2303 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2304 CleanupStack::PushL(pSerializedProperties); |
|
2305 |
|
2306 iServiceConnection->SetTransportPropertiesL(*pSerializedProperties); |
|
2307 iServiceConnection->SendL(*pSOAPMessage); |
|
2308 StartActiveScheduler(1); |
|
2309 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2310 |
|
2311 // Check from HTTP Transaction logger log that Post method were used. |
|
2312 pFileContent = ReadFileL(KFileToRead); |
|
2313 LOCAL_ASSERT(pFileContent != NULL); |
|
2314 CleanupStack::PushL(pFileContent); |
|
2315 pValue = HttpMethodValueFromXmlLC(*pFileContent); |
|
2316 if ( pValue ) |
|
2317 { |
|
2318 LOCAL_ASSERT(*pValue == KHTTPMethodPost); |
|
2319 } |
|
2320 CleanupStack::PopAndDestroy(pValue); |
|
2321 CleanupStack::PopAndDestroy(pFileContent); |
|
2322 |
|
2323 // Http Post (using TransportProperties in SendL parameters) |
|
2324 // ********************************************************* |
|
2325 pHttpProperties->SetHttpMethodL(CSenHttpTransportProperties::ESenHttpPost); |
|
2326 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2327 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2328 CleanupStack::PushL(pSerializedProperties); |
|
2329 |
|
2330 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2331 StartActiveScheduler(1); |
|
2332 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2333 |
|
2334 // Check from HTTP Transaction logger log that POST method were used. |
|
2335 pFileContent = ReadFileL(KFileToRead); |
|
2336 LOCAL_ASSERT(pFileContent != NULL); |
|
2337 CleanupStack::PushL(pFileContent); |
|
2338 pValue = HttpMethodValueFromXmlLC(*pFileContent); |
|
2339 if ( pValue ) |
|
2340 { |
|
2341 LOCAL_ASSERT(*pValue == KHTTPMethodPost); |
|
2342 } |
|
2343 CleanupStack::PopAndDestroy(pValue); |
|
2344 CleanupStack::PopAndDestroy(pFileContent); |
|
2345 |
|
2346 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2347 |
|
2348 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2349 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
2350 |
|
2351 delete iServiceConnection; |
|
2352 iServiceConnection = NULL; |
|
2353 Teardown(); |
|
2354 return KErrNone; |
|
2355 } |
|
2356 |
|
2357 |
|
2358 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_Proxy1L( TTestResult& aResult ) |
|
2359 { |
|
2360 SetupL() ; |
|
2361 // SetProxy via Set(TP) |
|
2362 // ******************** |
|
2363 // 1. SetTransportProperties(TP::PROXY) |
|
2364 // 2. SendL(MSG) _LIT8(KSoapAction, "SOAPAction"); |
|
2365 |
|
2366 _LIT8(KSoapAction, "SOAPAction"); |
|
2367 _LIT8(KSoapActionValue, "SoapEnvelopeAction"); |
|
2368 _LIT8(KSoapActionReturnValue, "\"SoapEnvelopeAction\""); |
|
2369 |
|
2370 CSenServicePattern* pPattern = CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
2371 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
2372 |
|
2373 |
|
2374 |
|
2375 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
2376 pPattern->SetConsumerIapIdL(iapId); |
|
2377 |
|
2378 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
2379 |
|
2380 CleanupStack::PopAndDestroy(pPattern); |
|
2381 |
|
2382 StartActiveScheduler(1); |
|
2383 |
|
2384 // Now the code execution has returned in here (either HandleMessageL or HandleErrorL was invoked) |
|
2385 |
|
2386 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
2387 // Connection is ready to be used. |
|
2388 |
|
2389 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
2390 pSOAPMessage->SetSoapActionL(KSoapActionValue); |
|
2391 |
|
2392 // Http Post |
|
2393 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2394 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
2395 pHttpProperties->SetProxyHostL(KProxyHost); |
|
2396 pHttpProperties->SetProxyPortL(KProxyPort); |
|
2397 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2398 CleanupStack::PushL(pSerializedProperties); |
|
2399 iServiceConnection->SetTransportPropertiesL(*pSerializedProperties); |
|
2400 |
|
2401 iServiceConnection->SendL(*pSOAPMessage); |
|
2402 StartActiveScheduler(1); |
|
2403 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2404 |
|
2405 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2406 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2407 |
|
2408 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
2409 |
|
2410 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2411 |
|
2412 // Read HTTP Transaction from file |
|
2413 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
2414 |
|
2415 LOCAL_ASSERT(pFileContent != NULL); |
|
2416 |
|
2417 CleanupStack::PushL(pFileContent); |
|
2418 |
|
2419 HBufC8* pValue = HttpPropertyValueFromXmlLC(*pFileContent, KSoapAction); |
|
2420 if( pValue ) |
|
2421 { |
|
2422 LOCAL_ASSERT(*pValue == KSoapActionReturnValue); |
|
2423 } |
|
2424 CleanupStack::PopAndDestroy(pValue); |
|
2425 |
|
2426 CleanupStack::PopAndDestroy(pFileContent); |
|
2427 |
|
2428 delete iServiceConnection; |
|
2429 iServiceConnection = NULL; |
|
2430 Teardown(); |
|
2431 return KErrNone; |
|
2432 } |
|
2433 |
|
2434 |
|
2435 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_Proxy2L( TTestResult& aResult ) |
|
2436 { |
|
2437 SetupL() ; |
|
2438 // SetProxy via SendL(MSG, TP) |
|
2439 // *************************** |
|
2440 // 1. SendL(MSG, TP::PROXY) |
|
2441 |
|
2442 _LIT8(KSoapAction, "SOAPAction"); |
|
2443 _LIT8(KSoapActionValue, "SoapEnvelopeAction"); |
|
2444 _LIT8(KSoapActionReturnValue, "\"SoapEnvelopeAction\""); |
|
2445 |
|
2446 CSenServicePattern* pPattern = CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
2447 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
2448 |
|
2449 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
2450 pPattern->SetConsumerIapIdL(iapId); |
|
2451 |
|
2452 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
2453 |
|
2454 CleanupStack::PopAndDestroy(pPattern); |
|
2455 |
|
2456 StartActiveScheduler(1); |
|
2457 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
2458 // Connection is ready to be used. |
|
2459 |
|
2460 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
2461 pSOAPMessage->SetSoapActionL(KSoapActionValue); |
|
2462 |
|
2463 // Http Post |
|
2464 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2465 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
2466 pHttpProperties->SetProxyHostL(KProxyHost); |
|
2467 pHttpProperties->SetProxyPortL(KProxyPort); |
|
2468 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2469 CleanupStack::PushL(pSerializedProperties); |
|
2470 |
|
2471 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2472 StartActiveScheduler(1); |
|
2473 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2474 |
|
2475 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2476 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2477 |
|
2478 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
2479 |
|
2480 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2481 |
|
2482 // Read HTTP Transaction from file |
|
2483 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
2484 |
|
2485 LOCAL_ASSERT(pFileContent != NULL); |
|
2486 |
|
2487 CleanupStack::PushL(pFileContent); |
|
2488 |
|
2489 HBufC8* pValue = HttpPropertyValueFromXmlLC(*pFileContent, KSoapAction); |
|
2490 if( pValue ) |
|
2491 { |
|
2492 LOCAL_ASSERT(*pValue == KSoapActionReturnValue); |
|
2493 } |
|
2494 CleanupStack::PopAndDestroy(pValue); |
|
2495 |
|
2496 CleanupStack::PopAndDestroy(pFileContent); |
|
2497 |
|
2498 delete iServiceConnection; |
|
2499 iServiceConnection = NULL; |
|
2500 Teardown(); |
|
2501 return KErrNone; |
|
2502 } |
|
2503 |
|
2504 |
|
2505 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_Pattern_IAP1L( TTestResult& aResult ) |
|
2506 { |
|
2507 SetupL() ; |
|
2508 // ServicePattern::SetConsumerIapIdL(IAP_ID) |
|
2509 // ***************************************** |
|
2510 // 1. Create new Service Pattern (SPatt) |
|
2511 // 2. SPatt::SetConsumerIapIdL(IAP_ID) |
|
2512 // 3. Instantiate new SC, wait for SetStatus(READY) |
|
2513 // 4. SendL(MSG) using selected IAP |
|
2514 |
|
2515 CSenServicePattern* pPattern = |
|
2516 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
2517 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
2518 |
|
2519 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
2520 pPattern->SetConsumerIapIdL(iapId); |
|
2521 |
|
2522 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
2523 |
|
2524 CleanupStack::PopAndDestroy(pPattern); |
|
2525 |
|
2526 StartActiveScheduler(1); |
|
2527 //LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
2528 // Connection is ready to be used. |
|
2529 |
|
2530 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
2531 |
|
2532 iServiceConnection->SendL(*pSOAPMessage); |
|
2533 //StartActiveScheduler(1); |
|
2534 //LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2535 |
|
2536 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
2537 |
|
2538 delete iServiceConnection; |
|
2539 iServiceConnection = NULL; |
|
2540 Teardown(); |
|
2541 return KErrNone; |
|
2542 } |
|
2543 |
|
2544 |
|
2545 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_Pattern_IAP2L( TTestResult& aResult ) |
|
2546 { |
|
2547 SetupL() ; |
|
2548 // SendL(MSG, TP:IAP_ID) NOTE: this test case requires user interaction!!! |
|
2549 // ******************************************************************************* |
|
2550 // 1. Instantiate new SC, wait for SetStatus(READY) [IAP is prompted from end user!] |
|
2551 // 2. TP::SetIapIdL(IAP_ID) |
|
2552 // 3. SendL(MSG, TP::IAP_ID) using selected IAP |
|
2553 // 4. SendL(MSG) -- should prompt the IAP from the end-user |
|
2554 |
|
2555 CSenServicePattern* pPattern = |
|
2556 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
2557 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
2558 |
|
2559 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
2560 |
|
2561 CleanupStack::PopAndDestroy(pPattern); |
|
2562 |
|
2563 StartActiveScheduler(1); |
|
2564 //LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
2565 // Connection is ready to be used. |
|
2566 |
|
2567 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
2568 |
|
2569 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2570 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
2571 pHttpProperties->SetIapIdL(iapId); |
|
2572 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2573 CleanupStack::PushL(pSerializedProperties); |
|
2574 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2575 //StartActiveScheduler(1); |
|
2576 //LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2577 |
|
2578 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2579 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2580 |
|
2581 iServiceConnection->SendL(*pSOAPMessage); |
|
2582 //StartActiveScheduler(1); |
|
2583 //LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2584 |
|
2585 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
2586 |
|
2587 delete iServiceConnection; |
|
2588 iServiceConnection = NULL; |
|
2589 Teardown(); |
|
2590 return KErrNone; |
|
2591 } |
|
2592 |
|
2593 |
|
2594 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_Pattern_IAP3L( TTestResult& aResult ) |
|
2595 { |
|
2596 SetupL() ; |
|
2597 // SetTransportPropertiesL(TP::IAP_ID) |
|
2598 // 1. SetTransportPropertiesL(TP::IAP_ID) |
|
2599 // 2. SendL(MSG) using selected IAP |
|
2600 // 3. TP:SetOmittedL(IAP_ID) |
|
2601 // 4. SendL(MSG, TP::IAP_ID-Omitted) -- should prompt the IAP from the end-user |
|
2602 |
|
2603 CSenServicePattern* pPattern = |
|
2604 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
2605 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
2606 |
|
2607 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
2608 |
|
2609 CleanupStack::PopAndDestroy(pPattern); |
|
2610 |
|
2611 StartActiveScheduler(1); |
|
2612 //LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
2613 // Connection is ready to be used. |
|
2614 |
|
2615 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
2616 |
|
2617 // 1. SetTransportPropertiesL(TP::IAP_ID) |
|
2618 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2619 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
2620 pHttpProperties->SetIapIdL(iapId); |
|
2621 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2622 CleanupStack::PushL(pSerializedProperties); |
|
2623 iServiceConnection->SetTransportPropertiesL(*pSerializedProperties); |
|
2624 // 2. SendL(MSG) using selected IAP |
|
2625 iServiceConnection->SendL(*pSOAPMessage); |
|
2626 //StartActiveScheduler(1); |
|
2627 //LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2628 |
|
2629 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2630 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2631 |
|
2632 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2633 // 3. TP:SetOmittedL(IAP_ID) |
|
2634 //pHttpProperties->SetOmittedL(KIapIdLocalName, ETrue); |
|
2635 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2636 CleanupStack::PushL(pSerializedProperties); |
|
2637 // 4. SendL(MSG, TP::IAP_ID-Omitted) -- should prompt the IAP from the end-user |
|
2638 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2639 //StartActiveScheduler(1); |
|
2640 //LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2641 |
|
2642 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2643 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2644 |
|
2645 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
2646 |
|
2647 delete iServiceConnection; |
|
2648 iServiceConnection = NULL; |
|
2649 Teardown(); |
|
2650 return KErrNone; |
|
2651 } |
|
2652 |
|
2653 |
|
2654 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_ContentType1L( TTestResult& aResult ) |
|
2655 { |
|
2656 SetupL() ; |
|
2657 // SendL(MSG, TP::Content-Type) |
|
2658 // 1. Get TP via SC:TransportPropertiesL() // store currently effective content-type |
|
2659 // 2. TP::SetContentTypeIdL(Content-Type) |
|
2660 // 3. SendL(MSG, TP::Content-Type) // check that selected Content-Type is used |
|
2661 // 4. SendL(MSG) // original content type should be used (from step 1) |
|
2662 |
|
2663 _LIT8(KContentTypeValue, "text"); |
|
2664 |
|
2665 CSenServicePattern* pPattern = |
|
2666 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
2667 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
2668 |
|
2669 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
2670 |
|
2671 CleanupStack::PopAndDestroy(pPattern); |
|
2672 |
|
2673 StartActiveScheduler(1); |
|
2674 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
2675 // Connection is ready to be used. |
|
2676 |
|
2677 HBufC8* pOriginalContentType = NULL; |
|
2678 |
|
2679 // 1. Get TP via SC:TransportPropertiesL() // store currently effective content-type |
|
2680 HBufC8* pTransportPropertiesAsXml = NULL; |
|
2681 iServiceConnection->TransportPropertiesL(pTransportPropertiesAsXml); |
|
2682 if ( pTransportPropertiesAsXml ) |
|
2683 { |
|
2684 CleanupStack::PushL(pTransportPropertiesAsXml); |
|
2685 CSenXmlReader* pParser = CSenXmlReader::NewLC(); |
|
2686 CSenHttpTransportProperties* pReadHttpProperties = |
|
2687 CSenHttpTransportProperties::NewLC(*pTransportPropertiesAsXml, |
|
2688 *pParser); |
|
2689 TPtrC8 contentType; |
|
2690 TInt retVal = pReadHttpProperties->ContentTypeL(contentType); |
|
2691 if ( retVal == KErrNone ) |
|
2692 { |
|
2693 pOriginalContentType = contentType.AllocL(); |
|
2694 } |
|
2695 CleanupStack::PopAndDestroy(pReadHttpProperties); |
|
2696 CleanupStack::PopAndDestroy(pParser); |
|
2697 CleanupStack::PopAndDestroy(pTransportPropertiesAsXml); |
|
2698 } |
|
2699 |
|
2700 LOCAL_ASSERT(pOriginalContentType != NULL); // Content-type is a MUST for every transport |
|
2701 |
|
2702 if ( pOriginalContentType ) |
|
2703 { |
|
2704 CleanupStack::PushL(pOriginalContentType); |
|
2705 } |
|
2706 |
|
2707 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
2708 |
|
2709 // 2. TP::SetContentTypeIdL(Content-Type) |
|
2710 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2711 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
2712 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
2713 pHttpProperties->SetIapIdL(iapId); |
|
2714 pHttpProperties->SetContentTypeL(KContentTypeValue); |
|
2715 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2716 CleanupStack::PushL(pSerializedProperties); |
|
2717 |
|
2718 // 3. SendL(MSG, TP::Content-Type) // check that selected Content-Type is used |
|
2719 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2720 StartActiveScheduler(1); |
|
2721 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2722 |
|
2723 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2724 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2725 |
|
2726 // Check from HTTP Transaction logger log that correct ContentType were used. |
|
2727 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
2728 LOCAL_ASSERT(pFileContent != NULL); |
|
2729 CleanupStack::PushL(pFileContent); |
|
2730 HBufC8* pValue = HttpPropertyValueFromXmlLC(*pFileContent, _L8("Content-Type")); |
|
2731 |
|
2732 if ( pValue ) |
|
2733 { |
|
2734 LOCAL_ASSERT(*pValue == KContentTypeValue); |
|
2735 } |
|
2736 CleanupStack::PopAndDestroy(pValue); |
|
2737 CleanupStack::PopAndDestroy(pFileContent); |
|
2738 |
|
2739 // 4. SendL(MSG) // original content type should be used (from step 1) |
|
2740 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2741 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
2742 pHttpProperties->SetIapIdL(iapId); |
|
2743 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2744 CleanupStack::PushL(pSerializedProperties); |
|
2745 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2746 StartActiveScheduler(1); |
|
2747 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2748 |
|
2749 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2750 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2751 |
|
2752 // Check from HTTP Transaction logger log that correct ContentType were used. |
|
2753 pFileContent = ReadFileL(KFileToRead); |
|
2754 LOCAL_ASSERT(pFileContent != NULL); |
|
2755 CleanupStack::PushL(pFileContent); |
|
2756 pValue = HttpPropertyValueFromXmlLC(*pFileContent, _L8("Content-Type")); |
|
2757 if( pValue && pOriginalContentType ) |
|
2758 { |
|
2759 LOCAL_ASSERT(*pValue == *pOriginalContentType); |
|
2760 } |
|
2761 CleanupStack::PopAndDestroy(pValue); |
|
2762 CleanupStack::PopAndDestroy(pFileContent); |
|
2763 |
|
2764 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
2765 |
|
2766 if ( pOriginalContentType ) |
|
2767 { |
|
2768 CleanupStack::PopAndDestroy(pOriginalContentType); |
|
2769 } |
|
2770 |
|
2771 delete iServiceConnection; |
|
2772 iServiceConnection = NULL; |
|
2773 Teardown(); |
|
2774 return KErrNone; |
|
2775 } |
|
2776 |
|
2777 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_ContentType2L( TTestResult& aResult ) |
|
2778 { |
|
2779 SetupL() ; |
|
2780 // SetTransportPropertiesL(TP::Content-Type) |
|
2781 // 1. Get TP via SC:TransportPropertiesL() |
|
2782 // 2. SendL(MSG), Content-Type got from step 1 should be effective |
|
2783 // 3. SetTransportPropertiesL(TP::Content-Type) // change content-type |
|
2784 // 4. SendL(MSG) // check new content-type |
|
2785 // 5. SendL(MSG, TP:Content-Type) // check *third* kind of content-type |
|
2786 |
|
2787 _LIT8(KContentTypeValue1, "text"); |
|
2788 _LIT8(KContentTypeValue2, "xml"); |
|
2789 |
|
2790 CSenServicePattern* pPattern = |
|
2791 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
2792 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
2793 |
|
2794 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
2795 |
|
2796 CleanupStack::PopAndDestroy(pPattern); |
|
2797 |
|
2798 StartActiveScheduler(1); |
|
2799 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
2800 // Connection is ready to be used. |
|
2801 |
|
2802 // 1. Get TP via SC:TransportPropertiesL() |
|
2803 TPtrC8 contentType; |
|
2804 HBufC8* pTransportPropertiesAsXml = NULL; |
|
2805 iServiceConnection->TransportPropertiesL(pTransportPropertiesAsXml); |
|
2806 if ( pTransportPropertiesAsXml ) |
|
2807 { |
|
2808 CleanupStack::PushL(pTransportPropertiesAsXml); |
|
2809 CSenXmlReader* pParser = CSenXmlReader::NewLC(); |
|
2810 CSenHttpTransportProperties* pReadHttpProperties = |
|
2811 CSenHttpTransportProperties::NewLC(*pTransportPropertiesAsXml, |
|
2812 *pParser); |
|
2813 pReadHttpProperties->ContentTypeL(contentType); |
|
2814 CleanupStack::PopAndDestroy(pReadHttpProperties); |
|
2815 CleanupStack::PopAndDestroy(pParser); |
|
2816 CleanupStack::PopAndDestroy(pTransportPropertiesAsXml); |
|
2817 } |
|
2818 |
|
2819 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
2820 |
|
2821 // 2. SendL(MSG), Content-Type got from step 1 should be effective |
|
2822 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2823 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
2824 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
2825 pHttpProperties->SetIapIdL(iapId); |
|
2826 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2827 CleanupStack::PushL(pSerializedProperties); |
|
2828 iServiceConnection->SetTransportPropertiesL(*pSerializedProperties); |
|
2829 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2830 StartActiveScheduler(1); |
|
2831 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2832 |
|
2833 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2834 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2835 |
|
2836 // 3. SetTransportPropertiesL(TP::Content-Type) // change content-type |
|
2837 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2838 pHttpProperties->SetContentTypeL(KContentTypeValue1); |
|
2839 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2840 CleanupStack::PushL(pSerializedProperties); |
|
2841 iServiceConnection->SetTransportPropertiesL(*pSerializedProperties); |
|
2842 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2843 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2844 |
|
2845 // 4. SendL(MSG) // check new content-type |
|
2846 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2847 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
2848 pHttpProperties->SetIapIdL(iapId); |
|
2849 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2850 CleanupStack::PushL(pSerializedProperties); |
|
2851 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2852 StartActiveScheduler(1); |
|
2853 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2854 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2855 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2856 |
|
2857 // Check from HTTP Transaction logger log that correct ContentType were used. |
|
2858 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
2859 LOCAL_ASSERT(pFileContent != NULL); |
|
2860 CleanupStack::PushL(pFileContent); |
|
2861 HBufC8* pValue = HttpPropertyValueFromXmlLC(*pFileContent, _L8("Content-Type")); |
|
2862 if( pValue ) |
|
2863 { |
|
2864 LOCAL_ASSERT(*pValue == KContentTypeValue1); |
|
2865 } |
|
2866 CleanupStack::PopAndDestroy(pValue); |
|
2867 CleanupStack::PopAndDestroy(pFileContent); |
|
2868 |
|
2869 // 5. SendL(MSG, TP:Content-Type) // check *third* kind of content-type |
|
2870 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2871 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
2872 pHttpProperties->SetContentTypeL(KContentTypeValue2); |
|
2873 pHttpProperties->SetIapIdL(iapId); |
|
2874 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2875 CleanupStack::PushL(pSerializedProperties); |
|
2876 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2877 StartActiveScheduler(1); |
|
2878 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2879 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2880 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2881 |
|
2882 // Check from HTTP Transaction logger log that correct ContentType were used. |
|
2883 pFileContent = ReadFileL(KFileToRead); |
|
2884 LOCAL_ASSERT(pFileContent != NULL); |
|
2885 CleanupStack::PushL(pFileContent); |
|
2886 pValue = HttpPropertyValueFromXmlLC(*pFileContent, _L8("Content-Type")); |
|
2887 if( pValue ) |
|
2888 { |
|
2889 LOCAL_ASSERT(*pValue == KContentTypeValue2); |
|
2890 } |
|
2891 CleanupStack::PopAndDestroy(pValue); |
|
2892 CleanupStack::PopAndDestroy(pFileContent); |
|
2893 |
|
2894 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
2895 |
|
2896 delete iServiceConnection; |
|
2897 iServiceConnection = NULL; |
|
2898 Teardown(); |
|
2899 return KErrNone; |
|
2900 } |
|
2901 |
|
2902 |
|
2903 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_UserAgent1L( TTestResult& aResult ) |
|
2904 { |
|
2905 SetupL() ; |
|
2906 // SendL(MSG, TP::User-Agent) |
|
2907 // 1. Get TP via SC:TransportPropertiesL() // store currently effective User-Agent |
|
2908 // 2. TP::SetUserAgentL(User-Agent) |
|
2909 // 3. SendL(MSG, TP::User-Agent) // check that selected User-Agentis used |
|
2910 // 4. SendL(MSG) // original User-Agent should be used (from step 1) |
|
2911 |
|
2912 _LIT8(KUserAgentValue, "TestAgent"); |
|
2913 |
|
2914 CSenServicePattern* pPattern = |
|
2915 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
2916 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
2917 |
|
2918 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
2919 |
|
2920 CleanupStack::PopAndDestroy(pPattern); |
|
2921 |
|
2922 StartActiveScheduler(1); |
|
2923 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
2924 // Connection is ready to be used. |
|
2925 |
|
2926 // 1. Get TP via SC:TransportPropertiesL() // store currently effective User-Agent |
|
2927 HBufC8* pOriginalUserAgent = NULL; |
|
2928 HBufC8* pTransportPropertiesAsXml = NULL; |
|
2929 iServiceConnection->TransportPropertiesL(pTransportPropertiesAsXml); |
|
2930 if ( pTransportPropertiesAsXml ) |
|
2931 { |
|
2932 TPtrC8 userAgent; |
|
2933 CleanupStack::PushL(pTransportPropertiesAsXml); |
|
2934 CSenXmlReader* pParser = CSenXmlReader::NewLC(); |
|
2935 CSenHttpTransportProperties* pReadHttpProperties = |
|
2936 CSenHttpTransportProperties::NewLC(*pTransportPropertiesAsXml, |
|
2937 *pParser); |
|
2938 pReadHttpProperties->UserAgentL(userAgent); |
|
2939 pOriginalUserAgent = userAgent.AllocL(); |
|
2940 CleanupStack::PopAndDestroy(pReadHttpProperties); |
|
2941 CleanupStack::PopAndDestroy(pParser); |
|
2942 CleanupStack::PopAndDestroy(pTransportPropertiesAsXml); |
|
2943 CleanupStack::PushL(pOriginalUserAgent); |
|
2944 } |
|
2945 |
|
2946 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
2947 |
|
2948 // 2. TP::SetUserAgentL(User-Agent) |
|
2949 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2950 pHttpProperties->SetUserAgentL(KUserAgentValue); |
|
2951 |
|
2952 // 3. SendL(MSG, TP::User-Agent) // check that selected User-Agent is used |
|
2953 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
2954 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
2955 pHttpProperties->SetIapIdL(iapId); |
|
2956 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2957 CleanupStack::PushL(pSerializedProperties); |
|
2958 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2959 StartActiveScheduler(1); |
|
2960 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2961 |
|
2962 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2963 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2964 |
|
2965 // Check from HTTP Transaction logger log that selected User-Agent were used. |
|
2966 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
2967 LOCAL_ASSERT(pFileContent != NULL); |
|
2968 CleanupStack::PushL(pFileContent); |
|
2969 HBufC8* pValue = HttpPropertyValueFromXmlLC(*pFileContent, _L8("User-Agent")); |
|
2970 LOCAL_ASSERT(*pValue == KUserAgentValue); |
|
2971 CleanupStack::PopAndDestroy(pValue); |
|
2972 CleanupStack::PopAndDestroy(pFileContent); |
|
2973 |
|
2974 // 4. SendL(MSG) // original User-Agent should be used (from step 1) |
|
2975 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
2976 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
2977 pHttpProperties->SetIapIdL(iapId); |
|
2978 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
2979 CleanupStack::PushL(pSerializedProperties); |
|
2980 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
2981 StartActiveScheduler(1); |
|
2982 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
2983 |
|
2984 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
2985 CleanupStack::PopAndDestroy(pHttpProperties); |
|
2986 |
|
2987 // Check from HTTP Transaction logger log that original User-Agent were used. |
|
2988 pFileContent = ReadFileL(KFileToRead); |
|
2989 LOCAL_ASSERT(pFileContent != NULL); |
|
2990 CleanupStack::PushL(pFileContent); |
|
2991 pValue = HttpPropertyValueFromXmlLC(*pFileContent, _L8("User-Agent")); |
|
2992 if ( pValue && pOriginalUserAgent ) |
|
2993 { |
|
2994 LOCAL_ASSERT(*pValue == *pOriginalUserAgent); |
|
2995 } |
|
2996 CleanupStack::PopAndDestroy(pValue); |
|
2997 CleanupStack::PopAndDestroy(pFileContent); |
|
2998 |
|
2999 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
3000 |
|
3001 if ( pOriginalUserAgent ) |
|
3002 { |
|
3003 CleanupStack::PopAndDestroy(pOriginalUserAgent); |
|
3004 } |
|
3005 |
|
3006 delete iServiceConnection; |
|
3007 iServiceConnection = NULL; |
|
3008 Teardown(); |
|
3009 return KErrNone; |
|
3010 } |
|
3011 |
|
3012 |
|
3013 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_UserAgent2L( TTestResult& aResult ) |
|
3014 { |
|
3015 SetupL() ; |
|
3016 // SetTransportPropertiesL(TP:User-Agent) |
|
3017 // 1. Get TP via SC:TransportPropertiesL() // store original user-agent |
|
3018 // 2. SendL(MSG); // check User-Agent from step 1 is sent/used |
|
3019 // 3. SetTransportPropertiesL(TP::User-Agent) // change user-agent |
|
3020 // 4. SendL(MSG, TP::User-Agent) // change user agent, check that it is used |
|
3021 // 5. SendL(MSG); // check that set User-Agent is used, from step 3 |
|
3022 |
|
3023 _LIT8(KUserAgentValue1, "TestAgent1"); |
|
3024 _LIT8(KUserAgentValue2, "TestAgent2"); |
|
3025 |
|
3026 CSenServicePattern* pPattern = |
|
3027 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
3028 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
3029 |
|
3030 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
3031 |
|
3032 CleanupStack::PopAndDestroy(pPattern); |
|
3033 |
|
3034 StartActiveScheduler(1); |
|
3035 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
3036 // Connection is ready to be used. |
|
3037 |
|
3038 // 1. Get TP via SC:TransportPropertiesL() // store original user-agent |
|
3039 HBufC8* pOriginalUserAgent = NULL; |
|
3040 HBufC8* pTransportPropertiesAsXml = NULL; |
|
3041 iServiceConnection->TransportPropertiesL(pTransportPropertiesAsXml); |
|
3042 if ( pTransportPropertiesAsXml ) |
|
3043 { |
|
3044 TPtrC8 userAgent; |
|
3045 CleanupStack::PushL(pTransportPropertiesAsXml); |
|
3046 CSenXmlReader* pParser = CSenXmlReader::NewLC(); |
|
3047 CSenHttpTransportProperties* pReadHttpProperties = |
|
3048 CSenHttpTransportProperties::NewLC(*pTransportPropertiesAsXml, |
|
3049 *pParser); |
|
3050 pReadHttpProperties->UserAgentL(userAgent); |
|
3051 pOriginalUserAgent = userAgent.AllocL(); |
|
3052 CleanupStack::PopAndDestroy(pReadHttpProperties); |
|
3053 CleanupStack::PopAndDestroy(pParser); |
|
3054 CleanupStack::PopAndDestroy(pTransportPropertiesAsXml); |
|
3055 CleanupStack::PushL(pOriginalUserAgent); |
|
3056 } |
|
3057 |
|
3058 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
3059 |
|
3060 // 2. SendL(MSG); // check User-Agent from step 1 is sent/used |
|
3061 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3062 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
3063 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
3064 pHttpProperties->SetIapIdL(iapId); |
|
3065 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3066 CleanupStack::PushL(pSerializedProperties); |
|
3067 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
3068 StartActiveScheduler(1); |
|
3069 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3070 |
|
3071 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3072 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3073 |
|
3074 // Check from HTTP Transaction logger log that original User-Agent were used. |
|
3075 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
3076 LOCAL_ASSERT(pFileContent != NULL); |
|
3077 CleanupStack::PushL(pFileContent); |
|
3078 HBufC8* pValue = HttpPropertyValueFromXmlLC(*pFileContent, _L8("User-Agent")); |
|
3079 |
|
3080 if ( pValue && pOriginalUserAgent ) |
|
3081 { |
|
3082 LOCAL_ASSERT(*pValue == *pOriginalUserAgent); |
|
3083 } |
|
3084 CleanupStack::PopAndDestroy(pValue); |
|
3085 CleanupStack::PopAndDestroy(pFileContent); |
|
3086 |
|
3087 // 3. SetTransportPropertiesL(TP::User-Agent) // change user-agent |
|
3088 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3089 pHttpProperties->SetUserAgentL(KUserAgentValue1); |
|
3090 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
3091 pHttpProperties->SetIapIdL(iapId); |
|
3092 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3093 CleanupStack::PushL(pSerializedProperties); |
|
3094 iServiceConnection->SetTransportPropertiesL(*pSerializedProperties); |
|
3095 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3096 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3097 |
|
3098 // 4. SendL(MSG, TP::User-Agent) // change user agent, check that it is used |
|
3099 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3100 pHttpProperties->SetUserAgentL(KUserAgentValue2); |
|
3101 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3102 CleanupStack::PushL(pSerializedProperties); |
|
3103 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
3104 StartActiveScheduler(1); |
|
3105 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3106 |
|
3107 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3108 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3109 |
|
3110 // Check from HTTP Transaction logger log that defined User-Agent were used. |
|
3111 pFileContent = ReadFileL(KFileToRead); |
|
3112 LOCAL_ASSERT(pFileContent != NULL); |
|
3113 CleanupStack::PushL(pFileContent); |
|
3114 pValue = HttpPropertyValueFromXmlLC(*pFileContent, _L8("User-Agent")); |
|
3115 LOCAL_ASSERT(*pValue == KUserAgentValue2); |
|
3116 CleanupStack::PopAndDestroy(pValue); |
|
3117 CleanupStack::PopAndDestroy(pFileContent); |
|
3118 |
|
3119 // 5. SendL(MSG); // check that set User-Agent is used, from step 3 |
|
3120 iServiceConnection->SendL(*pSOAPMessage); |
|
3121 StartActiveScheduler(1); |
|
3122 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3123 |
|
3124 // Check from HTTP Transaction logger log that defined (in step 3) User-Agent were used. |
|
3125 pFileContent = ReadFileL(KFileToRead); |
|
3126 LOCAL_ASSERT(pFileContent != NULL); |
|
3127 CleanupStack::PushL(pFileContent); |
|
3128 pValue = HttpPropertyValueFromXmlLC(*pFileContent, _L8("User-Agent")); |
|
3129 LOCAL_ASSERT(*pValue == KUserAgentValue1); |
|
3130 CleanupStack::PopAndDestroy(pValue); |
|
3131 CleanupStack::PopAndDestroy(pFileContent); |
|
3132 |
|
3133 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
3134 |
|
3135 if ( pOriginalUserAgent ) |
|
3136 { |
|
3137 CleanupStack::PopAndDestroy(pOriginalUserAgent); |
|
3138 } |
|
3139 |
|
3140 delete iServiceConnection; |
|
3141 iServiceConnection = NULL; |
|
3142 Teardown(); |
|
3143 return KErrNone; |
|
3144 } |
|
3145 |
|
3146 |
|
3147 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_MessageSoapActionL( TTestResult& aResult ) |
|
3148 { |
|
3149 SetupL() ; |
|
3150 _LIT8(KSoapAction, "SOAPAction"); |
|
3151 _LIT8(KSoapActionValue, "MessageAction"); |
|
3152 _LIT8(KSoapActionReturnValue, "\"MessageAction\""); |
|
3153 |
|
3154 CSenServicePattern* pPattern = |
|
3155 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
3156 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
3157 |
|
3158 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
3159 pPattern->SetConsumerIapIdL(iapId); |
|
3160 |
|
3161 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
3162 |
|
3163 CleanupStack::PopAndDestroy(pPattern); |
|
3164 |
|
3165 StartActiveScheduler(1); |
|
3166 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
3167 // Connection is ready to be used. |
|
3168 |
|
3169 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
3170 pSOAPMessage->SetSoapActionL(KSoapActionValue); |
|
3171 |
|
3172 // Http Post |
|
3173 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3174 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
3175 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3176 CleanupStack::PushL(pSerializedProperties); |
|
3177 |
|
3178 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
3179 StartActiveScheduler(1); |
|
3180 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3181 |
|
3182 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3183 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3184 |
|
3185 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
3186 |
|
3187 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3188 |
|
3189 // Read HTTP Transaction from file |
|
3190 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
3191 |
|
3192 LOCAL_ASSERT(pFileContent != NULL); |
|
3193 |
|
3194 CleanupStack::PushL(pFileContent); |
|
3195 |
|
3196 HBufC8* pValue = HttpPropertyValueFromXmlLC(*pFileContent, KSoapAction); |
|
3197 LOCAL_ASSERT(*pValue == KSoapActionReturnValue); |
|
3198 CleanupStack::PopAndDestroy(pValue); |
|
3199 |
|
3200 CleanupStack::PopAndDestroy(pFileContent); |
|
3201 |
|
3202 delete iServiceConnection; |
|
3203 iServiceConnection = NULL; |
|
3204 Teardown(); |
|
3205 return KErrNone; |
|
3206 } |
|
3207 |
|
3208 |
|
3209 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_SoapAction1L( TTestResult& aResult ) |
|
3210 { |
|
3211 SetupL() ; |
|
3212 // SendL(MSG, TP:SOAPAction) |
|
3213 // 1. Get TP via SC:TransportPropertiesL() // store currently effective SOAPAction |
|
3214 // 2. TP::SetSoapActionL(SOAPAction) |
|
3215 // 3. SendL(MSG, TP::SOAPAction) // check that selected SOAPAction is used |
|
3216 // 4. SendL(MSG) // original SOAPAction should be used (from step 1) |
|
3217 |
|
3218 _LIT8(KSoapAction, "SOAPAction"); |
|
3219 _LIT8(KSoapActionValue, "MessagePropertyAction"); |
|
3220 _LIT8(KSoapActionReturnValue, "\"MessagePropertyAction\""); |
|
3221 |
|
3222 CSenServicePattern* pPattern = |
|
3223 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
3224 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
3225 |
|
3226 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
3227 pPattern->SetConsumerIapIdL(iapId); |
|
3228 |
|
3229 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
3230 |
|
3231 CleanupStack::PopAndDestroy(pPattern); |
|
3232 |
|
3233 StartActiveScheduler(1); |
|
3234 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
3235 // Connection is ready to be used. |
|
3236 |
|
3237 // 1. Get TP via SC:TransportPropertiesL() // store currently effective SOAPAction |
|
3238 HBufC8* pOriginalSoapAction = NULL; |
|
3239 HBufC8* pTransportPropertiesAsXml = NULL; |
|
3240 iServiceConnection->TransportPropertiesL(pTransportPropertiesAsXml); |
|
3241 if ( pTransportPropertiesAsXml ) |
|
3242 { |
|
3243 CleanupStack::PushL(pTransportPropertiesAsXml); |
|
3244 CSenXmlReader* pParser = CSenXmlReader::NewLC(); |
|
3245 CSenHttpTransportProperties* pReadHttpProperties = |
|
3246 CSenHttpTransportProperties::NewLC(*pTransportPropertiesAsXml, |
|
3247 *pParser); |
|
3248 TPtrC8 soapAction(KNullDesC8); |
|
3249 TInt retVal = pReadHttpProperties->SoapActionL(soapAction); |
|
3250 if ( retVal == KErrNone ) |
|
3251 { |
|
3252 pOriginalSoapAction = soapAction.AllocL(); |
|
3253 } |
|
3254 CleanupStack::PopAndDestroy(pReadHttpProperties); |
|
3255 CleanupStack::PopAndDestroy(pParser); |
|
3256 CleanupStack::PopAndDestroy(pTransportPropertiesAsXml); |
|
3257 } |
|
3258 |
|
3259 if ( pOriginalSoapAction ) |
|
3260 { |
|
3261 CleanupStack::PushL(pOriginalSoapAction); |
|
3262 } |
|
3263 |
|
3264 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
3265 |
|
3266 // 2. TP::SetSoapActionL(SOAPAction) |
|
3267 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3268 pHttpProperties->SetSoapActionL(KSoapActionValue); |
|
3269 |
|
3270 // 3. SendL(MSG, TP::SOAPAction) // check that selected SOAPAction is used |
|
3271 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
3272 pHttpProperties->SetIapIdL(iapId); |
|
3273 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3274 CleanupStack::PushL(pSerializedProperties); |
|
3275 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
3276 StartActiveScheduler(1); |
|
3277 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3278 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3279 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3280 |
|
3281 // Check from HTTP Transaction logger log that defined SoapAction were used. |
|
3282 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
3283 LOCAL_ASSERT(pFileContent != NULL); |
|
3284 CleanupStack::PushL(pFileContent); |
|
3285 HBufC8* pValue = HttpPropertyValueFromXmlLC(*pFileContent, KSoapAction); |
|
3286 if( pValue ) |
|
3287 { |
|
3288 LOCAL_ASSERT(*pValue == KSoapActionReturnValue); |
|
3289 } |
|
3290 CleanupStack::PopAndDestroy(pValue); |
|
3291 CleanupStack::PopAndDestroy(pFileContent); |
|
3292 |
|
3293 // 4. SendL(MSG) // original SOAPAction should be used (from step 1) |
|
3294 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3295 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
3296 pHttpProperties->SetIapIdL(iapId); |
|
3297 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3298 CleanupStack::PushL(pSerializedProperties); |
|
3299 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
3300 StartActiveScheduler(1); |
|
3301 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3302 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3303 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3304 |
|
3305 // Check from HTTP Transaction logger log that original SoapAction is used. |
|
3306 pFileContent = ReadFileL(KFileToRead); |
|
3307 LOCAL_ASSERT(pFileContent != NULL); |
|
3308 CleanupStack::PushL(pFileContent); |
|
3309 pValue = HttpPropertyValueFromXmlLC(*pFileContent, KSoapAction); |
|
3310 |
|
3311 if( pValue && pOriginalSoapAction ) |
|
3312 { |
|
3313 LOCAL_ASSERT(*pValue == *pOriginalSoapAction); |
|
3314 } |
|
3315 // else if ( pValue ) |
|
3316 // { |
|
3317 // This is temporary: the default "" SOAPAction value has been removed from HTTPC: |
|
3318 // also WS-I, REST and ID-WSF define this "" -value only on ::SendL (in message layer!) |
|
3319 // This means, that "original soap action" from SC does not CURRENTLY yet provide the |
|
3320 // framework default(!) |
|
3321 // LOCAL_ASSERT( *pValue == KSenSoapActionHeaderValueEmpty ) // default from framework. |
|
3322 // } |
|
3323 CleanupStack::PopAndDestroy(pValue); |
|
3324 CleanupStack::PopAndDestroy(pFileContent); |
|
3325 |
|
3326 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
3327 |
|
3328 if ( pOriginalSoapAction ) |
|
3329 { |
|
3330 CleanupStack::PopAndDestroy(pOriginalSoapAction); |
|
3331 } |
|
3332 |
|
3333 delete iServiceConnection; |
|
3334 iServiceConnection = NULL; |
|
3335 Teardown(); |
|
3336 return KErrNone; |
|
3337 } |
|
3338 |
|
3339 |
|
3340 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_SoapAction2L( TTestResult& aResult ) |
|
3341 { |
|
3342 SetupL() ; |
|
3343 // SendL(SOAP-ENV::SOAPAction) |
|
3344 // 1. Get TP via SC:TransportPropertiesL() // store original soap-action |
|
3345 // 2. SendL(SOAP-ENV::SOAPAction); // check SOAPAction from SoapEnvelope is sent/used |
|
3346 // 3. SendL(MSG); // check that original SOAPACtion is used, from step 1 |
|
3347 // 4. SetTransportProperties(TP::SOAPAction2); |
|
3348 // 5. SendL(MSG); // check that previous SC::SOAPAction is used, from step 4 |
|
3349 // 6. SendL(MSG, TP:SOAPAction); // check that TP:SOAPAction is used |
|
3350 // 7. SendL(SOAP-ENV::SOAPAction); // check that SOAP-ENV:SOAPAction is used |
|
3351 // 8. SendL(SOAP-ENV); // check that previous SC::SOAPAction is used, from step 4 |
|
3352 // 9. SendL(SOAP-ENV, TP::SOAPAction); // check that new TP::SOAPAction is used |
|
3353 // 10. SendL(SOAP-ENV:SOAPAction, TP::SOAPAction ); // both are set: check that SOAP-ENV:SOAPAction is used, over-riding TP |
|
3354 // 11. SendL(SOAP-ENV:SOAPAction ); SC::SOAPAction // only SOAP-ENV::SOAPAction is set: check that it is effective, instead of SC::SOAPAction |
|
3355 // 12. SendL(MSG, TP:SOAPAction ); SC::SOAPAction // only TP::SOAPAction is set: check that it is effective, instead of SC::SOAPAction |
|
3356 |
|
3357 _LIT8(KSoapAction, "SOAPAction"); |
|
3358 _LIT8(KEnvelopeSoapActionValue, "EnvelopeAction"); |
|
3359 _LIT8(KEnvelopeSoapActionReturnValue, "\"EnvelopeAction\""); |
|
3360 _LIT8(KSessionSoapActionValue, "SessionAction"); |
|
3361 _LIT8(KSessionSoapActionReturnValue, "\"SessionAction\""); |
|
3362 _LIT8(KMessageSoapActionValue, "MessageAction"); |
|
3363 _LIT8(KMessageSoapActionReturnValue, "\"MessageAction\""); |
|
3364 |
|
3365 CSenServicePattern* pPattern = |
|
3366 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
3367 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
3368 |
|
3369 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
3370 pPattern->SetConsumerIapIdL(iapId); |
|
3371 |
|
3372 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
3373 |
|
3374 CleanupStack::PopAndDestroy(pPattern); |
|
3375 |
|
3376 StartActiveScheduler(1); |
|
3377 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
3378 // Connection is ready to be used. |
|
3379 |
|
3380 // 1. Get TP via SC:TransportPropertiesL() // store original soap-action |
|
3381 HBufC8* pOriginalSoapAction = NULL; |
|
3382 HBufC8* pTransportPropertiesAsXml = NULL; |
|
3383 iServiceConnection->TransportPropertiesL(pTransportPropertiesAsXml); |
|
3384 if ( pTransportPropertiesAsXml ) |
|
3385 { |
|
3386 CleanupStack::PushL(pTransportPropertiesAsXml); |
|
3387 CSenXmlReader* pParser = CSenXmlReader::NewLC(); |
|
3388 CSenHttpTransportProperties* pReadHttpProperties = |
|
3389 CSenHttpTransportProperties::NewLC(*pTransportPropertiesAsXml, |
|
3390 *pParser); |
|
3391 TPtrC8 soapAction(KNullDesC8); |
|
3392 TInt retVal = pReadHttpProperties->SoapActionL(soapAction); |
|
3393 if ( retVal == KErrNone ) |
|
3394 { |
|
3395 pOriginalSoapAction = soapAction.AllocL(); |
|
3396 } |
|
3397 CleanupStack::PopAndDestroy(pReadHttpProperties); |
|
3398 CleanupStack::PopAndDestroy(pParser); |
|
3399 CleanupStack::PopAndDestroy(pTransportPropertiesAsXml); |
|
3400 } |
|
3401 |
|
3402 if ( pOriginalSoapAction ) |
|
3403 { |
|
3404 CleanupStack::PushL(pOriginalSoapAction); |
|
3405 } |
|
3406 |
|
3407 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
3408 |
|
3409 // 2. SendL(SOAP-ENV::SOAPAction); // check SOAPAction from SoapEnvelope is sent/used |
|
3410 pSOAPMessage->SetSoapActionL(KEnvelopeSoapActionValue); |
|
3411 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3412 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
3413 pHttpProperties->SetIapIdL(iapId); |
|
3414 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3415 CleanupStack::PushL(pSerializedProperties); |
|
3416 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
3417 StartActiveScheduler(1); |
|
3418 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3419 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3420 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3421 |
|
3422 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3423 |
|
3424 // Check from HTTP Transaction logger log that defined SoapAction were used. |
|
3425 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
3426 LOCAL_ASSERT(pFileContent != NULL); |
|
3427 CleanupStack::PushL(pFileContent); |
|
3428 HBufC8* pValue = HttpPropertyValueFromXmlLC(*pFileContent, KSoapAction); |
|
3429 if( pValue ) |
|
3430 { |
|
3431 LOCAL_ASSERT(*pValue == KEnvelopeSoapActionReturnValue); |
|
3432 } |
|
3433 CleanupStack::PopAndDestroy(pValue); |
|
3434 CleanupStack::PopAndDestroy(pFileContent); |
|
3435 |
|
3436 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
3437 // Create a new Soap message because old one contains defined SoapAction |
|
3438 pSOAPMessage = CreateAuthRequestLC(); |
|
3439 |
|
3440 // 3. SendL(MSG); // check that original SOAPACtion is used, from step 1 |
|
3441 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3442 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
3443 pHttpProperties->SetIapIdL(iapId); |
|
3444 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3445 CleanupStack::PushL(pSerializedProperties); |
|
3446 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
3447 StartActiveScheduler(1); |
|
3448 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3449 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3450 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3451 |
|
3452 // Check from HTTP Transaction logger log that original SoapAction were used. |
|
3453 pFileContent = ReadFileL(KFileToRead); |
|
3454 LOCAL_ASSERT(pFileContent != NULL); |
|
3455 CleanupStack::PushL(pFileContent); |
|
3456 pValue = HttpPropertyValueFromXmlLC(*pFileContent, KSoapAction); |
|
3457 if ( pValue && pOriginalSoapAction ) |
|
3458 { |
|
3459 LOCAL_ASSERT(*pValue == *pOriginalSoapAction); |
|
3460 } |
|
3461 CleanupStack::PopAndDestroy(pValue); |
|
3462 CleanupStack::PopAndDestroy(pFileContent); |
|
3463 |
|
3464 // 4. SetTransportProperties(TP::SOAPAction2); |
|
3465 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3466 pHttpProperties->SetSoapActionL(KSessionSoapActionValue); |
|
3467 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
3468 pHttpProperties->SetIapIdL(iapId); |
|
3469 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3470 CleanupStack::PushL(pSerializedProperties); |
|
3471 iServiceConnection->SetTransportPropertiesL(*pSerializedProperties); |
|
3472 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3473 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3474 |
|
3475 // 5. SendL(MSG); // check that previous SC::SOAPAction is used, from step 4 |
|
3476 iServiceConnection->SendL(*pSOAPMessage); |
|
3477 StartActiveScheduler(1); |
|
3478 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3479 |
|
3480 // Check from HTTP Transaction logger log that defined (in step 4.) SoapAction were used. |
|
3481 pFileContent = ReadFileL(KFileToRead); |
|
3482 LOCAL_ASSERT(pFileContent != NULL); |
|
3483 CleanupStack::PushL(pFileContent); |
|
3484 pValue = HttpPropertyValueFromXmlLC(*pFileContent, KSoapAction); |
|
3485 if( pValue ) |
|
3486 { |
|
3487 LOCAL_ASSERT(*pValue == KSessionSoapActionReturnValue); |
|
3488 } |
|
3489 CleanupStack::PopAndDestroy(pValue); |
|
3490 CleanupStack::PopAndDestroy(pFileContent); |
|
3491 |
|
3492 // 6. SendL(MSG, TP:SOAPAction); // check that TP:SOAPAction is used |
|
3493 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3494 pHttpProperties->SetSoapActionL(KMessageSoapActionValue); |
|
3495 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
3496 pHttpProperties->SetIapIdL(iapId); |
|
3497 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3498 CleanupStack::PushL(pSerializedProperties); |
|
3499 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
3500 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3501 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3502 StartActiveScheduler(1); |
|
3503 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3504 |
|
3505 // Check from HTTP Transaction logger log that defined SoapAction were used. |
|
3506 pFileContent = ReadFileL(KFileToRead); |
|
3507 LOCAL_ASSERT(pFileContent != NULL); |
|
3508 CleanupStack::PushL(pFileContent); |
|
3509 pValue = HttpPropertyValueFromXmlLC(*pFileContent, KSoapAction); |
|
3510 if( pValue ) |
|
3511 { |
|
3512 LOCAL_ASSERT(*pValue == KMessageSoapActionReturnValue); |
|
3513 } |
|
3514 CleanupStack::PopAndDestroy(pValue); |
|
3515 CleanupStack::PopAndDestroy(pFileContent); |
|
3516 |
|
3517 // 7. SendL(SOAP-ENV::SOAPAction); // check that SOAP-ENV:SOAPAction is used |
|
3518 pSOAPMessage->SetSoapActionL(KEnvelopeSoapActionValue); |
|
3519 iServiceConnection->SendL(*pSOAPMessage); |
|
3520 StartActiveScheduler(1); |
|
3521 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3522 |
|
3523 // Check from HTTP Transaction logger log that defined SoapAction were used. |
|
3524 pFileContent = ReadFileL(KFileToRead); |
|
3525 LOCAL_ASSERT(pFileContent != NULL); |
|
3526 CleanupStack::PushL(pFileContent); |
|
3527 pValue = HttpPropertyValueFromXmlLC(*pFileContent, KSoapAction); |
|
3528 if ( pValue ) |
|
3529 { |
|
3530 LOCAL_ASSERT(*pValue == KEnvelopeSoapActionReturnValue); |
|
3531 } |
|
3532 CleanupStack::PopAndDestroy(pValue); |
|
3533 CleanupStack::PopAndDestroy(pFileContent); |
|
3534 |
|
3535 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
3536 // Create a new Soap message because old one contains defined SoapAction |
|
3537 pSOAPMessage = CreateAuthRequestLC(); |
|
3538 |
|
3539 // 8. SendL(SOAP-ENV); // check that previous SC::SOAPAction is used, from step 4 |
|
3540 iServiceConnection->SendL(*pSOAPMessage); |
|
3541 StartActiveScheduler(1); |
|
3542 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3543 |
|
3544 // Check from HTTP Transaction logger log that defined (in step 4.) SoapAction were used. |
|
3545 pFileContent = ReadFileL(KFileToRead); |
|
3546 LOCAL_ASSERT(pFileContent != NULL); |
|
3547 CleanupStack::PushL(pFileContent); |
|
3548 pValue = HttpPropertyValueFromXmlLC(*pFileContent, KSoapAction); |
|
3549 if ( pValue ) |
|
3550 { |
|
3551 LOCAL_ASSERT(*pValue == KSessionSoapActionReturnValue); |
|
3552 } |
|
3553 CleanupStack::PopAndDestroy(pValue); |
|
3554 CleanupStack::PopAndDestroy(pFileContent); |
|
3555 |
|
3556 // 9. SendL(SOAP-ENV, TP::SOAPAction); // check that new TP::SOAPAction is used |
|
3557 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3558 pHttpProperties->SetSoapActionL(KMessageSoapActionValue); |
|
3559 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
3560 pHttpProperties->SetIapIdL(iapId); |
|
3561 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3562 CleanupStack::PushL(pSerializedProperties); |
|
3563 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
3564 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3565 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3566 StartActiveScheduler(1); |
|
3567 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3568 |
|
3569 // Check from HTTP Transaction logger log that defined SoapAction were used. |
|
3570 pFileContent = ReadFileL(KFileToRead); |
|
3571 LOCAL_ASSERT(pFileContent != NULL); |
|
3572 CleanupStack::PushL(pFileContent); |
|
3573 pValue = HttpPropertyValueFromXmlLC(*pFileContent, KSoapAction); |
|
3574 if( pValue ) |
|
3575 { |
|
3576 LOCAL_ASSERT(*pValue == KMessageSoapActionReturnValue); |
|
3577 } |
|
3578 CleanupStack::PopAndDestroy(pValue); |
|
3579 CleanupStack::PopAndDestroy(pFileContent); |
|
3580 |
|
3581 // 10. SendL(SOAP-ENV:SOAPAction, TP::SOAPAction); // both are set: check that SOAP-ENV:SOAPAction is used, over-riding TP |
|
3582 pSOAPMessage->SetSoapActionL(KEnvelopeSoapActionValue); |
|
3583 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3584 pHttpProperties->SetSoapActionL(KMessageSoapActionValue); |
|
3585 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
3586 pHttpProperties->SetIapIdL(iapId); |
|
3587 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3588 CleanupStack::PushL(pSerializedProperties); |
|
3589 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
3590 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3591 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3592 StartActiveScheduler(1); |
|
3593 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3594 |
|
3595 // Check from HTTP Transaction logger log that defined SoapAction were used. |
|
3596 pFileContent = ReadFileL(KFileToRead); |
|
3597 LOCAL_ASSERT(pFileContent != NULL); |
|
3598 CleanupStack::PushL(pFileContent); |
|
3599 pValue = HttpPropertyValueFromXmlLC(*pFileContent, KSoapAction); |
|
3600 if ( pValue ) |
|
3601 { |
|
3602 LOCAL_ASSERT(*pValue == KEnvelopeSoapActionReturnValue); |
|
3603 } |
|
3604 CleanupStack::PopAndDestroy(pValue); |
|
3605 CleanupStack::PopAndDestroy(pFileContent); |
|
3606 |
|
3607 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
3608 // Create a new Soap message because old one contains defined SoapAction |
|
3609 pSOAPMessage = CreateAuthRequestLC(); |
|
3610 |
|
3611 // 11. SendL(SOAP-ENV:SOAPAction ); SC::SOAPAction // only SOAP-ENV::SOAPAction is set: check that it is effective, instead of SC::SOAPAction |
|
3612 // Note: SOAPAction for ServiceConnection was defined in step 4. |
|
3613 pSOAPMessage->SetSoapActionL(KEnvelopeSoapActionValue); |
|
3614 iServiceConnection->SendL(*pSOAPMessage); |
|
3615 StartActiveScheduler(1); |
|
3616 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3617 |
|
3618 // Check from HTTP Transaction logger log that defined SoapAction were used. |
|
3619 pFileContent = ReadFileL(KFileToRead); |
|
3620 LOCAL_ASSERT(pFileContent != NULL); |
|
3621 CleanupStack::PushL(pFileContent); |
|
3622 pValue = HttpPropertyValueFromXmlLC(*pFileContent, KSoapAction); |
|
3623 if ( pValue ) |
|
3624 { |
|
3625 LOCAL_ASSERT(*pValue == KEnvelopeSoapActionReturnValue); |
|
3626 } |
|
3627 CleanupStack::PopAndDestroy(pValue); |
|
3628 CleanupStack::PopAndDestroy(pFileContent); |
|
3629 |
|
3630 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
3631 // Create a new Soap message because old one contains defined SoapAction |
|
3632 pSOAPMessage = CreateAuthRequestLC(); |
|
3633 |
|
3634 // 12. SendL(MSG, TP:SOAPAction ); SC::SOAPAction // only TP::SOAPAction is set: check that it is effective, instead of SC::SOAPAction |
|
3635 // Note: SOAPAction for ServiceConnection was defined in step 4. |
|
3636 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3637 pHttpProperties->SetSoapActionL(KMessageSoapActionValue); |
|
3638 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
3639 pHttpProperties->SetIapIdL(iapId); |
|
3640 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3641 CleanupStack::PushL(pSerializedProperties); |
|
3642 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
3643 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3644 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3645 StartActiveScheduler(1); |
|
3646 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3647 |
|
3648 // Check from HTTP Transaction logger log that defined SoapAction were used. |
|
3649 pFileContent = ReadFileL(KFileToRead); |
|
3650 LOCAL_ASSERT(pFileContent != NULL); |
|
3651 CleanupStack::PushL(pFileContent); |
|
3652 pValue = HttpPropertyValueFromXmlLC(*pFileContent, KSoapAction); |
|
3653 if ( pValue ) |
|
3654 { |
|
3655 LOCAL_ASSERT(*pValue == KMessageSoapActionReturnValue); |
|
3656 } |
|
3657 CleanupStack::PopAndDestroy(pValue); |
|
3658 CleanupStack::PopAndDestroy(pFileContent); |
|
3659 |
|
3660 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
3661 |
|
3662 if ( pOriginalSoapAction ) |
|
3663 { |
|
3664 CleanupStack::PopAndDestroy(pOriginalSoapAction); |
|
3665 } |
|
3666 |
|
3667 delete iServiceConnection; |
|
3668 iServiceConnection = NULL; |
|
3669 Teardown(); |
|
3670 return KErrNone; |
|
3671 } |
|
3672 |
|
3673 |
|
3674 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SendL_CustomHttpHeaderL( TTestResult& aResult ) |
|
3675 { |
|
3676 SetupL() ; |
|
3677 // Set custom HTTP header |
|
3678 // 1. Declare CUSTOM_HTTP_HEADER_NAME and CUSTOM_HTTP_HEADER_VALUE (value should include Scandic characters, like Ä and Ö) |
|
3679 // 2. Get TP using SC:TransportPropertiesL() |
|
3680 // 3. SendL(MSG) // see that CUSTOM_HTTP_HEADER -field is not present |
|
3681 // 4. SendL(MSG, TP::CUSTOM_HTTP_HEADER) // see that http filter logs CUSTOM_HTTP_HEADER |
|
3682 // 5. Define TP::CUSTOM_HTTP_HEADER_VALUE2 (for already existing CUSTOM_HTTP_HEADER_NAME) |
|
3683 // 6. Call SC::SetTransportPropertiesL(TP::CUSTOM_HTTP_HEADER_VALUE2) // VALUE2 should containt basic XML entities -- escapes like &, <, >, ' etc.. |
|
3684 // 7. SendL(MSG) // see that TP::CUSTOM_HTTP_HEADER_VALUE2 is effective |
|
3685 |
|
3686 // 1. Declare CUSTOM_HTTP_HEADER_NAME and CUSTOM_HTTP_HEADER_VALUE (value should include Scandic characters, like Ä and Ö) |
|
3687 _LIT8(KCustomHttpHeader, "CustomHeader"); |
|
3688 _LIT8(KCustomHttpHeaderValue1, "CustomHeaderValue1ÅÄÖåäö"); // UTF8 String which contains: "CustomHeaderValue1ÅÄÖåäö" |
|
3689 _LIT8(KCustomHttpHeaderValue2, "CustomHeaderValue2<>&"); |
|
3690 HBufC8* pEncoded = SenXmlUtils::EncodeHttpCharactersLC(KCustomHttpHeaderValue2); |
|
3691 |
|
3692 CSenServicePattern* pPattern = |
|
3693 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
3694 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
3695 |
|
3696 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
3697 |
|
3698 CleanupStack::PopAndDestroy(pPattern); |
|
3699 |
|
3700 StartActiveScheduler(1); |
|
3701 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
3702 // Connection is ready to be used. |
|
3703 |
|
3704 // 2. Get TP using SC:TransportPropertiesL() |
|
3705 HBufC8* pTransportPropertiesAsXml = NULL; |
|
3706 iServiceConnection->TransportPropertiesL(pTransportPropertiesAsXml); |
|
3707 if ( pTransportPropertiesAsXml ) |
|
3708 { |
|
3709 delete pTransportPropertiesAsXml; |
|
3710 } |
|
3711 |
|
3712 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
3713 |
|
3714 // 3. SendL(MSG) // see that CUSTOM_HTTP_HEADER -field is not present |
|
3715 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3716 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
3717 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
3718 pHttpProperties->SetIapIdL(iapId); |
|
3719 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3720 CleanupStack::PushL(pSerializedProperties); |
|
3721 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
3722 StartActiveScheduler(1); |
|
3723 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3724 |
|
3725 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3726 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3727 |
|
3728 // Check from HTTP Transaction logger log that CUSTOM_HTTP_HEADER was not used. |
|
3729 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
3730 LOCAL_ASSERT(pFileContent != NULL); |
|
3731 CleanupStack::PushL(pFileContent); |
|
3732 HBufC8* pValue = HttpPropertyValueFromXmlLC(*pFileContent, KCustomHttpHeader); |
|
3733 if ( pValue ) |
|
3734 { |
|
3735 LOCAL_ASSERT(pValue == NULL); |
|
3736 } |
|
3737 CleanupStack::PopAndDestroy(pValue); |
|
3738 CleanupStack::PopAndDestroy(pFileContent); |
|
3739 |
|
3740 // 4. SendL(MSG, TP::CUSTOM_HTTP_HEADER) // see that http filter logs CUSTOM_HTTP_HEADER |
|
3741 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3742 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
3743 pHttpProperties->SetIapIdL(iapId); |
|
3744 pHttpProperties->SetHttpHeaderL(KCustomHttpHeader, KCustomHttpHeaderValue1); |
|
3745 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3746 CleanupStack::PushL(pSerializedProperties); |
|
3747 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
3748 StartActiveScheduler(1); |
|
3749 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3750 |
|
3751 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3752 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3753 |
|
3754 // Check from HTTP Transaction logger log that CUSTOM_HTTP_HEADER was used. |
|
3755 pFileContent = ReadFileL(KFileToRead); |
|
3756 LOCAL_ASSERT(pFileContent != NULL); |
|
3757 CleanupStack::PushL(pFileContent); |
|
3758 pValue = HttpPropertyValueFromXmlLC(*pFileContent, KCustomHttpHeader); |
|
3759 if ( pValue ) |
|
3760 { |
|
3761 LOCAL_ASSERT(*pValue == KCustomHttpHeaderValue1); |
|
3762 } |
|
3763 CleanupStack::PopAndDestroy(pValue); |
|
3764 CleanupStack::PopAndDestroy(pFileContent); |
|
3765 |
|
3766 // 5. Define TP::CUSTOM_HTTP_HEADER_VALUE2 (for already existing CUSTOM_HTTP_HEADER_NAME) |
|
3767 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3768 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
3769 pHttpProperties->SetIapIdL(iapId); |
|
3770 pHttpProperties->SetHttpHeaderL(KCustomHttpHeader, *pEncoded); |
|
3771 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3772 CleanupStack::PushL(pSerializedProperties); |
|
3773 // 6. Call SC::SetTransportPropertiesL(TP::CUSTOM_HTTP_HEADER_VALUE2) // VALUE2 should containt basic XML entities -- escapes like &, <, >, ' etc.. |
|
3774 iServiceConnection->SetTransportPropertiesL(*pSerializedProperties); |
|
3775 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3776 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3777 |
|
3778 // 7. SendL(MSG) // see that TP::CUSTOM_HTTP_HEADER_VALUE2 is effective |
|
3779 iServiceConnection->SendL(*pSOAPMessage); |
|
3780 StartActiveScheduler(1); |
|
3781 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3782 |
|
3783 // Check from HTTP Transaction logger log that CUSTOM_HTTP_HEADER was used. |
|
3784 pFileContent = ReadFileL(KFileToRead); |
|
3785 LOCAL_ASSERT(pFileContent != NULL); |
|
3786 CleanupStack::PushL(pFileContent); |
|
3787 pValue = HttpPropertyValueFromXmlLC(*pFileContent, KCustomHttpHeader); |
|
3788 RDebug::RawPrint( *pValue ); |
|
3789 if ( pValue ) |
|
3790 { |
|
3791 RDebug::Print( _L("ENCODED:") ); |
|
3792 RDebug::RawPrint( *pEncoded ); |
|
3793 RDebug::Print( _L("OUTPUT:") ); |
|
3794 RDebug::RawPrint( *pValue ); |
|
3795 LOCAL_ASSERT(*pValue == *pEncoded); |
|
3796 } |
|
3797 CleanupStack::PopAndDestroy(pValue); |
|
3798 CleanupStack::PopAndDestroy(pFileContent); |
|
3799 |
|
3800 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
3801 CleanupStack::PopAndDestroy(pEncoded); |
|
3802 |
|
3803 delete iServiceConnection; |
|
3804 iServiceConnection = NULL; |
|
3805 Teardown(); |
|
3806 return KErrNone; |
|
3807 } |
|
3808 |
|
3809 |
|
3810 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries1( TTestResult& aResult ) |
|
3811 { |
|
3812 SetupL() ; |
|
3813 TInt result; |
|
3814 _LIT8(KCustomHttpHeader,"CustomHeader"); |
|
3815 //_LIT8(KCustomHttpHeaderValue, ); // NULL cannot be used as descriptor literal value in Symbian |
|
3816 //result = UT_CSenServiceConnection_TP_Custom_Header(KCustomHttpHeader,KCustomHttpHeaderValue); |
|
3817 result = UT_CSenServiceConnection_TP_Custom_Header(KCustomHttpHeader, KNullDesC8); |
|
3818 //TL(result == KErrNone); |
|
3819 Teardown(); |
|
3820 return KErrNone; |
|
3821 } |
|
3822 |
|
3823 |
|
3824 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries2( TTestResult& aResult ) |
|
3825 { |
|
3826 SetupL() ; |
|
3827 TInt result; |
|
3828 // _LIT8(KCustomHttpHeader,); // NULL cannot be used as descriptor literal value in Symbian => it is more important to test KNullDesC8 (zero-length inputs etc) |
|
3829 _LIT8(KCustomHttpHeader, "X"); // property name's length = 1 |
|
3830 _LIT8(KCustomHttpHeaderValue, "CustomHeaderValue"); |
|
3831 |
|
3832 // Note: XML specs do not allow <Element> (tag name) to have zero-length. |
|
3833 |
|
3834 // It is not a bad idea to create such a test case, where GOAL is actually test the http property class |
|
3835 // itself (public DLL which is run by client app process); Utils DLL should maybe leave after it has been made to |
|
3836 // regocnize illegal inputs. All the might check special chars, BUT --NOTE-- it would make the setters quite much |
|
3837 // heavier (in terms of performance) if the key names (xml tag names) are first validated. |
|
3838 //result = UT_CSenServiceConnection_TP_Custom_Header(KNullDesC8, KCustomHttpHeaderValue); |
|
3839 result = UT_CSenServiceConnection_TP_Custom_Header(KCustomHttpHeader, KCustomHttpHeaderValue); |
|
3840 TL(result == KErrNone); |
|
3841 Teardown(); |
|
3842 return KErrNone; |
|
3843 } |
|
3844 |
|
3845 |
|
3846 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries3( TTestResult& aResult ) |
|
3847 { |
|
3848 SetupL() ; |
|
3849 TInt result; |
|
3850 _LIT8(KCustomHttpHeader, "CustomHeader"); |
|
3851 result = UT_CSenServiceConnection_TP_Custom_Header(KCustomHttpHeader, KNullDesC8); |
|
3852 //NOTE: --> we could create test case for length==1 case: _LIT8(KCustomHttpHeaderValue, "Y"); // property value's length = 1 |
|
3853 // _LIT8(KCustomHttpHeaderValue, ""); // == KNullDesC8 |
|
3854 //result = UT_CSenServiceConnection_TP_Custom_Header(KCustomHttpHeader, KCustomHttpHeaderValue); |
|
3855 TL(result == KErrNone); |
|
3856 Teardown(); |
|
3857 return KErrNone; |
|
3858 } |
|
3859 |
|
3860 |
|
3861 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries4( TTestResult& aResult ) |
|
3862 { |
|
3863 SetupL() ; |
|
3864 TInt result; |
|
3865 //_LIT8(KCustomHttpHeader,""); // == KNullDesC8 |
|
3866 _LIT8(KCustomHttpHeader, "X"); // property name's length = 1 |
|
3867 _LIT8(KCustomHttpHeaderValue, "CustomHeaderValue"); |
|
3868 //result = UT_CSenServiceConnection_TP_Custom_Header(KNullDesC8, KCustomHttpHeaderValue); |
|
3869 result = UT_CSenServiceConnection_TP_Custom_Header(KCustomHttpHeader, KCustomHttpHeaderValue); |
|
3870 |
|
3871 TL(result == KErrNone); |
|
3872 Teardown(); |
|
3873 return KErrNone; |
|
3874 } |
|
3875 |
|
3876 |
|
3877 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries5( TTestResult& aResult ) |
|
3878 { |
|
3879 SetupL() ; |
|
3880 TInt result; |
|
3881 _LIT8(KCustomHttpHeader,"CustomHeader"); |
|
3882 _LIT8(KCustomHttpHeaderValue, "256HeaderValuexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); |
|
3883 result = UT_CSenServiceConnection_TP_Custom_Header(KCustomHttpHeader,KCustomHttpHeaderValue); |
|
3884 TL(result == KErrNone); |
|
3885 Teardown(); |
|
3886 return KErrNone; |
|
3887 } |
|
3888 |
|
3889 |
|
3890 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries6( TTestResult& aResult ) |
|
3891 { |
|
3892 SetupL() ; |
|
3893 TInt result; |
|
3894 // Note: property name used to start with number here => changed, since it is against XML specs (property names are XML tags, parser does not accept tags which start by a number) |
|
3895 |
|
3896 // It is not a bad idea to create such a test case, where GOAL is actually test the http property class |
|
3897 // itself (public DLL which is run by client app process); Utils DLL should maybe leave after it has been made to |
|
3898 // regocnize illegal inputs. All the might check special chars, BUT --NOTE-- it would make the setters quite much |
|
3899 // heavier (in terms of performance) if the key names (xml tag names) are first validated. |
|
3900 _LIT8(KCustomHttpHeader,"Header256xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); |
|
3901 _LIT8(KCustomHttpHeaderValue, "CustomHeaderValue"); |
|
3902 result = UT_CSenServiceConnection_TP_Custom_Header(KCustomHttpHeader,KCustomHttpHeaderValue); |
|
3903 TL(result == KErrNone); |
|
3904 Teardown(); |
|
3905 return KErrNone; |
|
3906 } |
|
3907 |
|
3908 |
|
3909 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries7( TTestResult& aResult ) |
|
3910 { |
|
3911 SetupL() ; |
|
3912 TInt result; |
|
3913 _LIT8(KCustomHttpHeader,"Header256xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); |
|
3914 _LIT8(KCustomHttpHeaderValue, "256HeaderValuexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); |
|
3915 result = UT_CSenServiceConnection_TP_Custom_Header(KCustomHttpHeader,KCustomHttpHeaderValue); |
|
3916 TL(result == KErrNone); |
|
3917 Teardown(); |
|
3918 return KErrNone; |
|
3919 } |
|
3920 |
|
3921 |
|
3922 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries8( TTestResult& aResult ) |
|
3923 { |
|
3924 SetupL() ; |
|
3925 TInt result; |
|
3926 _LIT8(KCustomHttpHeader,"CustomHeader"); |
|
3927 _LIT8( KCRLFSP, "\r\n " ); |
|
3928 //_LIT8(KCustomHttpHeaderValue, "CustomHeaderValue55"); |
|
3929 result = UT_CSenServiceConnection_TP_Custom_Header(KCustomHttpHeader,KCRLFSP); |
|
3930 TL(result == KErrNone); |
|
3931 Teardown(); |
|
3932 return KErrNone; |
|
3933 } |
|
3934 |
|
3935 |
|
3936 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Boundaries9( TTestResult& aResult ) |
|
3937 { |
|
3938 SetupL() ; |
|
3939 TInt result; |
|
3940 _LIT8(KCustomHttpHeader,"CustomHeader"); |
|
3941 _LIT8(KCustomHttpHeaderValue, "CustomHeaderValue1, CustomHeaderValue2"); |
|
3942 result = UT_CSenServiceConnection_TP_Custom_Header(KCustomHttpHeader,KCustomHttpHeaderValue); |
|
3943 TL(result == KErrNone); |
|
3944 Teardown(); |
|
3945 return KErrNone; |
|
3946 } |
|
3947 |
|
3948 |
|
3949 //Befor executing this TL remember to set big enought TimeOut value (10 min.) |
|
3950 |
|
3951 |
|
3952 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_SecDialog(TTestResult& aResult) |
|
3953 { |
|
3954 SetupL() ; |
|
3955 TBool secDial; |
|
3956 |
|
3957 CSenServicePattern* pPattern = |
|
3958 CSenServicePattern::NewLC(KHttpsEndPoint, KNullDesC8()); |
|
3959 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
3960 |
|
3961 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
3962 |
|
3963 CleanupStack::PopAndDestroy(pPattern); |
|
3964 |
|
3965 StartActiveScheduler(1); |
|
3966 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
3967 // Connection is ready to be used. |
|
3968 |
|
3969 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
3970 |
|
3971 |
|
3972 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3973 |
|
3974 pHttpProperties->SetSecureDialogL(ETrue); |
|
3975 pHttpProperties->SecureDialogL(secDial); |
|
3976 TL(secDial != EFalse); |
|
3977 |
|
3978 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
3979 pHttpProperties->SetIapIdL(iapId); |
|
3980 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3981 CleanupStack::PushL(pSerializedProperties); |
|
3982 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
3983 StartActiveScheduler(1); |
|
3984 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3985 |
|
3986 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
3987 CleanupStack::PopAndDestroy(pHttpProperties); |
|
3988 |
|
3989 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
3990 pHttpProperties->SetSecureDialogL(EFalse); |
|
3991 pHttpProperties->SecureDialogL(secDial); |
|
3992 TL(secDial == EFalse); |
|
3993 pHttpProperties->SetIapIdL(iapId); |
|
3994 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
3995 CleanupStack::PushL(pSerializedProperties); |
|
3996 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
3997 StartActiveScheduler(1); |
|
3998 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
3999 |
|
4000 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
4001 CleanupStack::PopAndDestroy(pHttpProperties); |
|
4002 |
|
4003 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
4004 |
|
4005 delete iServiceConnection; |
|
4006 iServiceConnection = NULL; |
|
4007 Teardown(); |
|
4008 return KErrNone; |
|
4009 } |
|
4010 |
|
4011 |
|
4012 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Omitted_True(TTestResult& aResult) |
|
4013 { |
|
4014 SetupL() ; |
|
4015 TBool secDial; |
|
4016 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
4017 |
|
4018 pHttpProperties->SetSecureDialogL( ETrue ); |
|
4019 pHttpProperties->SecureDialogL(secDial); |
|
4020 TL(secDial != EFalse); |
|
4021 pHttpProperties->SetOmittedL(KSecureDialogLocalName,ETrue); |
|
4022 |
|
4023 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
4024 pHttpProperties->SetIapIdL(iapId); |
|
4025 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
4026 CleanupStack::PushL(pSerializedProperties); |
|
4027 |
|
4028 TInt cmpVal = pSerializedProperties->Find(_L8("<SecureDialog Omitted=\"true\">true</SecureDialog>")); |
|
4029 TL(cmpVal != KErrNotFound) |
|
4030 |
|
4031 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
4032 CleanupStack::PopAndDestroy(pHttpProperties); |
|
4033 Teardown(); |
|
4034 return KErrNone; |
|
4035 } |
|
4036 |
|
4037 |
|
4038 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Omitted_False(TTestResult& aResult) |
|
4039 { |
|
4040 SetupL() ; |
|
4041 TBool secDial; |
|
4042 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
4043 |
|
4044 pHttpProperties->SetSecureDialogL( ETrue ); |
|
4045 pHttpProperties->SecureDialogL(secDial); |
|
4046 TL(secDial != EFalse); |
|
4047 pHttpProperties->SetOmittedL(KSecureDialogLocalName, EFalse); |
|
4048 |
|
4049 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
4050 pHttpProperties->SetIapIdL(iapId); |
|
4051 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
4052 CleanupStack::PushL(pSerializedProperties); |
|
4053 |
|
4054 TInt cmpVal = pSerializedProperties->Find(_L8("<SecureDialog Omitted=\"false\">true</SecureDialog>")); |
|
4055 TL(cmpVal != KErrNotFound) |
|
4056 |
|
4057 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
4058 CleanupStack::PopAndDestroy(pHttpProperties); |
|
4059 Teardown(); |
|
4060 return KErrNone; |
|
4061 } |
|
4062 |
|
4063 |
|
4064 |
|
4065 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Removed(TTestResult& aResult) |
|
4066 { |
|
4067 SetupL() ; |
|
4068 TBool secDial; |
|
4069 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
4070 |
|
4071 pHttpProperties->SetSecureDialogL(ETrue); |
|
4072 pHttpProperties->SecureDialogL(secDial); |
|
4073 TL(secDial != EFalse); |
|
4074 pHttpProperties->RemovePropertyL(KSecureDialogLocalName); |
|
4075 |
|
4076 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
4077 pHttpProperties->SetIapIdL(iapId); |
|
4078 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
4079 CleanupStack::PushL(pSerializedProperties); |
|
4080 |
|
4081 TInt cmpVal = pSerializedProperties->Find(_L8("<SecureDialog>")); |
|
4082 TL(cmpVal == KErrNotFound) |
|
4083 |
|
4084 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
4085 CleanupStack::PopAndDestroy(pHttpProperties); |
|
4086 Teardown(); |
|
4087 return KErrNone; |
|
4088 } |
|
4089 |
|
4090 |
|
4091 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Omit_Rem(TTestResult& aResult) |
|
4092 { |
|
4093 SetupL() ; |
|
4094 _LIT8(KUserAgentValue, "TestAgent"); |
|
4095 _LIT8(KUserAgentDefaultValue, "Serene"); |
|
4096 CSenServicePattern* pPattern = |
|
4097 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
4098 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
4099 |
|
4100 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
4101 |
|
4102 CleanupStack::PopAndDestroy(pPattern); |
|
4103 |
|
4104 StartActiveScheduler(1); |
|
4105 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
4106 // Connection is ready to be used. |
|
4107 |
|
4108 // 1. Get TP using SC:TransportPropertiesL() |
|
4109 HBufC8* pTransportPropertiesAsXml = NULL; |
|
4110 iServiceConnection->TransportPropertiesL(pTransportPropertiesAsXml); |
|
4111 if ( pTransportPropertiesAsXml ) |
|
4112 { |
|
4113 delete pTransportPropertiesAsXml; |
|
4114 } |
|
4115 |
|
4116 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
4117 |
|
4118 // 2. SendL(MSG) // with set user-agent |
|
4119 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
4120 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
4121 pHttpProperties->SetUserAgentL(KUserAgentValue); |
|
4122 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
4123 pHttpProperties->SetIapIdL(iapId); |
|
4124 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
4125 CleanupStack::PushL(pSerializedProperties); |
|
4126 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
4127 StartActiveScheduler(1); |
|
4128 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
4129 |
|
4130 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
4131 CleanupStack::PopAndDestroy(pHttpProperties); |
|
4132 |
|
4133 //3. Check from HTTP Transaction logger log that user-agent was used. |
|
4134 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
4135 LOCAL_ASSERT(pFileContent != NULL); |
|
4136 CleanupStack::PushL(pFileContent); |
|
4137 HBufC8* pValue = HttpPropertyValueFromXmlLC(*pFileContent, KUserAgentLocalName); |
|
4138 if( pValue ) |
|
4139 { |
|
4140 LOCAL_ASSERT(*pValue == KUserAgentValue); |
|
4141 } |
|
4142 CleanupStack::PopAndDestroy(pValue); |
|
4143 CleanupStack::PopAndDestroy(pFileContent); |
|
4144 |
|
4145 |
|
4146 // 4. SendL(MSG) // with removed user-agent |
|
4147 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
4148 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
4149 pHttpProperties->SetUserAgentL(KUserAgentValue); |
|
4150 pHttpProperties->RemovePropertyL(KUserAgentLocalName); |
|
4151 pHttpProperties->SetIapIdL(iapId); |
|
4152 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
4153 CleanupStack::PushL(pSerializedProperties); |
|
4154 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
4155 StartActiveScheduler(1); |
|
4156 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
4157 |
|
4158 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
4159 CleanupStack::PopAndDestroy(pHttpProperties); |
|
4160 |
|
4161 //5. Check from HTTP Transaction logger log that user-agent was used. |
|
4162 pFileContent = ReadFileL(KFileToRead); |
|
4163 LOCAL_ASSERT(pFileContent != NULL); |
|
4164 CleanupStack::PushL(pFileContent); |
|
4165 pValue = HttpPropertyValueFromXmlLC(*pFileContent, KUserAgentLocalName); |
|
4166 if ( pValue ) |
|
4167 { |
|
4168 LOCAL_ASSERT(*pValue != KUserAgentValue); |
|
4169 } |
|
4170 CleanupStack::PopAndDestroy(pValue); |
|
4171 CleanupStack::PopAndDestroy(pFileContent); |
|
4172 |
|
4173 |
|
4174 // 6. SendL(MSG) // with omitted set to EFalse for user-agent |
|
4175 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
4176 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
4177 pHttpProperties->SetUserAgentL(KUserAgentValue); |
|
4178 pHttpProperties->SetOmittedL(KUserAgentLocalName, EFalse); |
|
4179 pHttpProperties->SetIapIdL(iapId); |
|
4180 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
4181 CleanupStack::PushL(pSerializedProperties); |
|
4182 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
4183 StartActiveScheduler(1); |
|
4184 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
4185 |
|
4186 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
4187 CleanupStack::PopAndDestroy(pHttpProperties); |
|
4188 |
|
4189 //7. Check from HTTP Transaction logger log that given user-agent |
|
4190 // was used (when EFalse was given as Omitted value). |
|
4191 pFileContent = ReadFileL(KFileToRead); |
|
4192 LOCAL_ASSERT(pFileContent != NULL); |
|
4193 CleanupStack::PushL(pFileContent); |
|
4194 pValue = HttpPropertyValueFromXmlLC(*pFileContent, KUserAgentLocalName); |
|
4195 if ( pValue ) |
|
4196 { |
|
4197 LOCAL_ASSERT(*pValue == KUserAgentValue); |
|
4198 } |
|
4199 CleanupStack::PopAndDestroy(pValue); |
|
4200 CleanupStack::PopAndDestroy(pFileContent); |
|
4201 |
|
4202 // 8. SendL(MSG) // with omitted set to ETrue for user-agent |
|
4203 pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
4204 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
4205 pHttpProperties->SetUserAgentL(KUserAgentValue); |
|
4206 pHttpProperties->SetOmittedL(KUserAgentLocalName, ETrue); |
|
4207 pHttpProperties->SetIapIdL(iapId); |
|
4208 pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
4209 CleanupStack::PushL(pSerializedProperties); |
|
4210 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
4211 StartActiveScheduler(1); |
|
4212 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
4213 |
|
4214 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
4215 CleanupStack::PopAndDestroy(pHttpProperties); |
|
4216 |
|
4217 //9. Check from HTTP Transaction logger log that |
|
4218 // default user-agent for HTTP Transport plugin was |
|
4219 // used instead of user-agent which was set together |
|
4220 // with omitted value ETrue. |
|
4221 pFileContent = ReadFileL(KFileToRead); |
|
4222 LOCAL_ASSERT(pFileContent != NULL); |
|
4223 CleanupStack::PushL(pFileContent); |
|
4224 pValue = HttpPropertyValueFromXmlLC(*pFileContent, KUserAgentLocalName); |
|
4225 if ( pValue ) |
|
4226 { |
|
4227 LOCAL_ASSERT(*pValue == KUserAgentDefaultValue); |
|
4228 } |
|
4229 CleanupStack::PopAndDestroy(pValue); |
|
4230 CleanupStack::PopAndDestroy(pFileContent); |
|
4231 |
|
4232 |
|
4233 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
4234 |
|
4235 delete iServiceConnection; |
|
4236 iServiceConnection = NULL; |
|
4237 Teardown(); |
|
4238 return KErrNone; |
|
4239 } |
|
4240 |
|
4241 |
|
4242 |
|
4243 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_LibXml2_L( TTestResult& aResult ) |
|
4244 { |
|
4245 SetupL() ; |
|
4246 // Create ServiceConnection |
|
4247 CSenServicePattern* pPattern = |
|
4248 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
4249 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
4250 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
4251 pPattern->SetConsumerIapIdL(iapId); |
|
4252 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
4253 CleanupStack::PopAndDestroy(pPattern); |
|
4254 StartActiveScheduler(1); |
|
4255 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
4256 // Connection is ready to be used. |
|
4257 |
|
4258 // 1. Chunk declaration |
|
4259 _LIT8( cid, "123456789@123456789" ); |
|
4260 _LIT( chunkName, "test chunk" ); |
|
4261 _LIT8( chunkContent, "Testing chunk1" ); |
|
4262 TInt chunkSize = 1000; |
|
4263 TInt chunkMaxSize = 5000; |
|
4264 TInt chunkOffset = 100; |
|
4265 TInt chunkDataSize = 14; |
|
4266 RChunk binaryDataChunk; |
|
4267 binaryDataChunk.CreateGlobal(chunkName(), chunkSize, chunkMaxSize); |
|
4268 CleanupClosePushL(binaryDataChunk); |
|
4269 TUint8* heapPtr = binaryDataChunk.Base(); |
|
4270 heapPtr = heapPtr + chunkOffset; |
|
4271 // Place a new descriptor in the chunk to initialize it |
|
4272 new (heapPtr-sizeof(TPtr8)) TPtr8(heapPtr, 0, chunkDataSize); |
|
4273 // Set the descriptor |
|
4274 TPtr8* pDes = reinterpret_cast<TPtr8*>(heapPtr-sizeof(TPtr8)); |
|
4275 pDes->Zero(); |
|
4276 pDes->Append(chunkContent); |
|
4277 |
|
4278 // 2. Chunk declaration |
|
4279 _LIT8( cid2, "xyz" ); |
|
4280 _LIT( chunkName2, "test chunk2" ); |
|
4281 _LIT8( chunkContent2, "Testing chunk2" ); |
|
4282 TInt chunkSize2 = 3000; |
|
4283 TInt chunkMaxSize2 = 10000; |
|
4284 TInt chunkOffset2 = 112; |
|
4285 TInt chunkDataSize2 = 14; |
|
4286 |
|
4287 RChunk binaryDataChunk2; |
|
4288 binaryDataChunk2.CreateGlobal(chunkName2(), chunkSize2, chunkMaxSize2); |
|
4289 CleanupClosePushL(binaryDataChunk2); |
|
4290 TUint8* heapPtr2 = binaryDataChunk2.Base(); |
|
4291 heapPtr2 = heapPtr2 + chunkOffset2; |
|
4292 // Place a new descriptor in the chunk to initialize it |
|
4293 new (heapPtr2-sizeof(TPtr8)) TPtr8(heapPtr2, 0, chunkDataSize2); |
|
4294 // Set the descriptor |
|
4295 TPtr8* pDes2 = reinterpret_cast<TPtr8*>(heapPtr2-sizeof(TPtr8)); |
|
4296 pDes2->Zero(); |
|
4297 pDes2->Append(chunkContent2); |
|
4298 |
|
4299 // 1. File declaration |
|
4300 _LIT8( cid3, "999999999@123456789" ); |
|
4301 _LIT( KTestFileName, "c:\\testing\\data\\fileContainer.txt" ); |
|
4302 _LIT8( KFileContent, "Test FileContainer1" ); |
|
4303 RFs rfs; |
|
4304 User::LeaveIfError(rfs.Connect()); |
|
4305 CleanupClosePushL(rfs); |
|
4306 TInt retVal = rfs.ShareProtected(); |
|
4307 RFile file; |
|
4308 CleanupClosePushL(file); |
|
4309 User::LeaveIfError(file.Replace(rfs, KTestFileName, EFileWrite)); |
|
4310 User::LeaveIfError(file.Write(KFileContent)); |
|
4311 file.Flush(); |
|
4312 file.Close(); |
|
4313 User::LeaveIfError(file.Open(rfs, KTestFileName, EFileRead)); |
|
4314 |
|
4315 // 2. File declaration |
|
4316 _LIT8( cid4, "1z2" ); |
|
4317 _LIT( KTestFileName2, "c:\\testing\\data\\fileContainer2.txt" ); |
|
4318 _LIT8( KFileContent2, "Test FileContainer2" ); |
|
4319 RFs rfs2; |
|
4320 User::LeaveIfError(rfs2.Connect()); |
|
4321 CleanupClosePushL(rfs2); |
|
4322 retVal = rfs2.ShareProtected(); |
|
4323 RFile file2; |
|
4324 CleanupClosePushL(file2); |
|
4325 User::LeaveIfError(file2.Replace(rfs2, KTestFileName2, EFileWrite)); |
|
4326 User::LeaveIfError(file2.Write(KFileContent2)); |
|
4327 file2.Flush(); |
|
4328 file2.Close(); |
|
4329 User::LeaveIfError(file2.Open(rfs2, KTestFileName2, EFileRead)); |
|
4330 |
|
4331 // Create SOAPMessage |
|
4332 CSenSoapMessage2* pSOAPMessage = CSenSoapMessage2::NewL(); |
|
4333 CleanupStack::PushL(pSOAPMessage); |
|
4334 |
|
4335 RSenDocument document = pSOAPMessage->AsDocumentL(); |
|
4336 |
|
4337 // Create BinaryContainers |
|
4338 TXmlEngChunkContainer chunkContainer = document.CreateChunkContainerL( |
|
4339 cid, |
|
4340 binaryDataChunk, |
|
4341 chunkOffset, |
|
4342 chunkDataSize); |
|
4343 TXmlEngChunkContainer chunkContainer2 = document.CreateChunkContainerL( |
|
4344 cid2, |
|
4345 binaryDataChunk2, |
|
4346 chunkOffset2, |
|
4347 chunkDataSize2); |
|
4348 TXmlEngChunkContainer chunkContainer3 = document.CreateChunkContainerL( |
|
4349 cid2, |
|
4350 binaryDataChunk2, |
|
4351 chunkOffset2, |
|
4352 chunkDataSize2); |
|
4353 TXmlEngFileContainer fileContainer = document.CreateFileContainerL(cid3, file); |
|
4354 TXmlEngFileContainer fileContainer2 = document.CreateFileContainerL(cid4, file2); |
|
4355 |
|
4356 // Get Envelope element |
|
4357 TXmlEngElement envelopeElement = pSOAPMessage->AsElementL(); |
|
4358 |
|
4359 // Create mime namespace declaration into Envelope element |
|
4360 // xmlns:xmlmime="http://www.w3.org/2004/11/xmlmime" |
|
4361 |
|
4362 |
|
4363 TXmlEngNamespace mimeNamespace = envelopeElement. AddNamespaceDeclarationL(_L8("http://www.w3.org/2004/11/xmlmime"), |
|
4364 _L8("xmlmime")); |
|
4365 |
|
4366 // TXmlEngNamespace mimeNamespace = envelopeElement. AddNamespaceDeclarationL(_L8("http://www.w3.org/2004/11/xmlmime"), |
|
4367 // _L8("mime")); // IE does not render XML where attribute name startes with "xml" (xmlmime) |
|
4368 |
|
4369 |
|
4370 // Create service specific namespace declaration into Body element |
|
4371 // xmlns:m="http://example.org/stuff" |
|
4372 TXmlEngNamespace serviceNamespace = pSOAPMessage->BodyL().AddNamespaceDeclarationL( |
|
4373 _L8("http://example.org/stuff"), |
|
4374 _L8("m")); |
|
4375 // Add data element into Body |
|
4376 // <S:Body xmlns:m="http://example.org/stuff"> |
|
4377 // <m:data> |
|
4378 // ... |
|
4379 // </m:data> |
|
4380 // </S:Body> |
|
4381 TXmlEngElement dataElement = pSOAPMessage->BodyL().AddNewElementL(_L8("data"), |
|
4382 serviceNamespace); |
|
4383 |
|
4384 // Add 1. attachment element into data element |
|
4385 // <m:data> |
|
4386 // <m:textAttachment1 xmlmime:contentType="text"> |
|
4387 // <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:123456789@123456789"/> |
|
4388 // </m:textAttachment1> |
|
4389 // ... |
|
4390 // </m:data> |
|
4391 TXmlEngElement attachmentElement1 = dataElement.AddNewElementL(_L8("textAttachment1"), |
|
4392 serviceNamespace); |
|
4393 attachmentElement1.AddNewAttributeL(_L8("contentType"), _L8("text"), mimeNamespace); |
|
4394 attachmentElement1.AppendChildL(chunkContainer); |
|
4395 |
|
4396 // Add 2. attachment element into data element |
|
4397 TXmlEngElement attachmentElement2 = dataElement.AddNewElementL(_L8("textAttachment2"), |
|
4398 serviceNamespace); |
|
4399 attachmentElement2.AddNewAttributeL(_L8("contentType"), _L8("text"), mimeNamespace); |
|
4400 attachmentElement2.AppendChildL(fileContainer); |
|
4401 |
|
4402 // Add 3. attachment element into data element |
|
4403 TXmlEngElement attachmentElement3 = dataElement.AddNewElementL(_L8("textAttachment3"), |
|
4404 serviceNamespace); |
|
4405 attachmentElement3.AddNewAttributeL(_L8("contentType"), _L8("text"), mimeNamespace); |
|
4406 attachmentElement3.AppendChildL(chunkContainer2); |
|
4407 |
|
4408 // Add 4. attachment element into data element |
|
4409 TXmlEngElement attachmentElement4 = dataElement.AddNewElementL(_L8("textAttachment4"), |
|
4410 serviceNamespace); |
|
4411 attachmentElement4.AddNewAttributeL(_L8("contentType"), _L8("text"), mimeNamespace); |
|
4412 attachmentElement4.AppendChildL(fileContainer2); |
|
4413 |
|
4414 // Add 5. attachment element inside data element |
|
4415 TXmlEngElement attachmentElement5 = dataElement.AddNewElementL(_L8("textAttachment5"), |
|
4416 serviceNamespace); |
|
4417 attachmentElement5.AddNewAttributeL(_L8("contentType"), _L8("text"), mimeNamespace); |
|
4418 attachmentElement5.AppendChildL(chunkContainer3); |
|
4419 |
|
4420 // Http Post |
|
4421 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
4422 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
4423 HBufC8* pPropsAsXml = pHttpProperties->AsUtf8LC(); |
|
4424 iServiceConnection->SetTransportPropertiesL(*pPropsAsXml); |
|
4425 CleanupStack::PopAndDestroy(pPropsAsXml); |
|
4426 CleanupStack::PopAndDestroy(pHttpProperties); |
|
4427 |
|
4428 CSenSoapEnvelope2* pRetMessage = NULL; |
|
4429 iServiceConnection->SubmitL(*pSOAPMessage, pRetMessage); |
|
4430 delete pRetMessage; |
|
4431 |
|
4432 // Check from HTTP Transaction logger log that POST method was used. |
|
4433 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
4434 LOCAL_ASSERT(pFileContent != NULL); |
|
4435 CleanupStack::PushL(pFileContent); |
|
4436 HBufC8* pValue = HttpMethodValueFromXmlLC(*pFileContent); |
|
4437 if ( pValue ) |
|
4438 { |
|
4439 LOCAL_ASSERT(*pValue == KHTTPMethodPost); |
|
4440 } |
|
4441 CleanupStack::PopAndDestroy(pValue); |
|
4442 CleanupStack::PopAndDestroy(pFileContent); |
|
4443 |
|
4444 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
4445 |
|
4446 CleanupStack::PopAndDestroy(&file2); |
|
4447 CleanupStack::PopAndDestroy(&rfs2); |
|
4448 CleanupStack::PopAndDestroy(&file); |
|
4449 CleanupStack::PopAndDestroy(&rfs); |
|
4450 CleanupStack::PopAndDestroy(&binaryDataChunk2); |
|
4451 CleanupStack::PopAndDestroy(&binaryDataChunk); |
|
4452 |
|
4453 delete iServiceConnection; |
|
4454 iServiceConnection = NULL; |
|
4455 Teardown(); |
|
4456 return KErrNone; |
|
4457 } |
|
4458 |
|
4459 |
|
4460 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_LibXml2_with_Properties_L( TTestResult& aResult ) |
|
4461 { |
|
4462 SetupL() ; |
|
4463 // Create ServiceConnection |
|
4464 CSenServicePattern* pPattern = |
|
4465 CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
4466 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
4467 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
4468 pPattern->SetConsumerIapIdL(iapId); |
|
4469 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
4470 CleanupStack::PopAndDestroy(pPattern); |
|
4471 StartActiveScheduler(1); |
|
4472 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
4473 // Connection is ready to be used. |
|
4474 |
|
4475 // 1. Chunk declaration |
|
4476 _LIT8( cid, "123456789@123456789" ); |
|
4477 _LIT( chunkName, "test chunk" ); |
|
4478 _LIT8( chunkContent, "Testing chunk1" ); |
|
4479 TInt chunkSize = 1000; |
|
4480 TInt chunkMaxSize = 5000; |
|
4481 TInt chunkOffset = 100; |
|
4482 TInt chunkDataSize = 14; |
|
4483 RChunk binaryDataChunk; |
|
4484 binaryDataChunk.CreateGlobal(chunkName(), chunkSize, chunkMaxSize); |
|
4485 CleanupClosePushL(binaryDataChunk); |
|
4486 TUint8* heapPtr = binaryDataChunk.Base(); |
|
4487 heapPtr = heapPtr + chunkOffset; |
|
4488 // Place a new descriptor in the chunk to initialize it |
|
4489 new (heapPtr-sizeof(TPtr8)) TPtr8(heapPtr, 0, chunkDataSize); |
|
4490 // Set the descriptor |
|
4491 TPtr8* pDes = reinterpret_cast<TPtr8*>(heapPtr-sizeof(TPtr8)); |
|
4492 pDes->Zero(); |
|
4493 pDes->Append(chunkContent); |
|
4494 |
|
4495 // 2. Chunk declaration |
|
4496 _LIT8( cid2, "xyz" ); |
|
4497 _LIT( chunkName2, "test chunk2" ); |
|
4498 _LIT8( chunkContent2, "Testing chunk2" ); |
|
4499 TInt chunkSize2 = 3000; |
|
4500 TInt chunkMaxSize2 = 10000; |
|
4501 TInt chunkOffset2 = 112; |
|
4502 TInt chunkDataSize2 = 14; |
|
4503 |
|
4504 RChunk binaryDataChunk2; |
|
4505 binaryDataChunk2.CreateGlobal(chunkName2(), chunkSize2, chunkMaxSize2); |
|
4506 CleanupClosePushL(binaryDataChunk2); |
|
4507 TUint8* heapPtr2 = binaryDataChunk2.Base(); |
|
4508 heapPtr2 = heapPtr2 + chunkOffset2; |
|
4509 // Place a new descriptor in the chunk to initialize it |
|
4510 new (heapPtr2-sizeof(TPtr8)) TPtr8(heapPtr2, 0, chunkDataSize2); |
|
4511 // Set the descriptor |
|
4512 TPtr8* pDes2 = reinterpret_cast<TPtr8*>(heapPtr2-sizeof(TPtr8)); |
|
4513 pDes2->Zero(); |
|
4514 pDes2->Append(chunkContent2); |
|
4515 |
|
4516 // 1. File declaration |
|
4517 _LIT8( cid3, "999999999@123456789" ); |
|
4518 _LIT( KTestFileName, "c:\\testing\\data\\fileContainer.txt" ); |
|
4519 _LIT8( KFileContent, "Test FileContainer1" ); |
|
4520 RFs rfs; |
|
4521 User::LeaveIfError(rfs.Connect()); |
|
4522 CleanupClosePushL(rfs); |
|
4523 TInt retVal = rfs.ShareProtected(); |
|
4524 RFile file; |
|
4525 CleanupClosePushL(file); |
|
4526 User::LeaveIfError(file.Replace(rfs, KTestFileName, EFileWrite)); |
|
4527 User::LeaveIfError(file.Write(KFileContent)); |
|
4528 file.Flush(); |
|
4529 file.Close(); |
|
4530 User::LeaveIfError(file.Open(rfs, KTestFileName, EFileRead)); |
|
4531 |
|
4532 // 2. File declaration |
|
4533 _LIT8( cid4, "1z2" ); |
|
4534 _LIT( KTestFileName2, "c:\\testing\\data\\fileContainer2.txt" ); |
|
4535 _LIT8( KFileContent2, "Test FileContainer2" ); |
|
4536 RFs rfs2; |
|
4537 User::LeaveIfError(rfs2.Connect()); |
|
4538 CleanupClosePushL(rfs2); |
|
4539 retVal = rfs2.ShareProtected(); |
|
4540 RFile file2; |
|
4541 CleanupClosePushL(file2); |
|
4542 User::LeaveIfError(file2.Replace(rfs2, KTestFileName2, EFileWrite)); |
|
4543 User::LeaveIfError(file2.Write(KFileContent2)); |
|
4544 file2.Flush(); |
|
4545 file2.Close(); |
|
4546 User::LeaveIfError(file2.Open(rfs2, KTestFileName2, EFileRead)); |
|
4547 |
|
4548 // Create SOAPMessage |
|
4549 CSenSoapMessage2* pSOAPMessage = CSenSoapMessage2::NewL(); |
|
4550 CleanupStack::PushL(pSOAPMessage); |
|
4551 |
|
4552 RSenDocument document = pSOAPMessage->AsDocumentL(); |
|
4553 |
|
4554 // Create BinaryContainers |
|
4555 TXmlEngChunkContainer chunkContainer = document.CreateChunkContainerL( |
|
4556 cid, |
|
4557 binaryDataChunk, |
|
4558 chunkOffset, |
|
4559 chunkDataSize); |
|
4560 TXmlEngChunkContainer chunkContainer2 = document.CreateChunkContainerL( |
|
4561 cid2, |
|
4562 binaryDataChunk2, |
|
4563 chunkOffset2, |
|
4564 chunkDataSize2); |
|
4565 TXmlEngChunkContainer chunkContainer3 = document.CreateChunkContainerL( |
|
4566 cid2, |
|
4567 binaryDataChunk2, |
|
4568 chunkOffset2, |
|
4569 chunkDataSize2); |
|
4570 TXmlEngFileContainer fileContainer = document.CreateFileContainerL(cid3, file); |
|
4571 TXmlEngFileContainer fileContainer2 = document.CreateFileContainerL(cid4, file2); |
|
4572 |
|
4573 // Get Envelope element |
|
4574 TXmlEngElement envelopeElement = pSOAPMessage->AsElementL(); |
|
4575 |
|
4576 // Create mime namespace declaration into Envelope element |
|
4577 // xmlns:xmlmime="http://www.w3.org/2004/11/xmlmime" |
|
4578 TXmlEngNamespace mimeNamespace = envelopeElement. AddNamespaceDeclarationL(_L8("http://www.w3.org/2004/11/xmlmime"), |
|
4579 _L8("xmlmime")); |
|
4580 // Create service specific namespace declaration into Body element |
|
4581 // xmlns:m="http://example.org/stuff" |
|
4582 TXmlEngNamespace serviceNamespace = pSOAPMessage->BodyL().AddNamespaceDeclarationL( |
|
4583 _L8("http://example.org/stuff"), |
|
4584 _L8("m")); |
|
4585 // Add data element into Body |
|
4586 // <S:Body xmlns:m="http://example.org/stuff"> |
|
4587 // <m:data> |
|
4588 // ... |
|
4589 // </m:data> |
|
4590 // </S:Body> |
|
4591 TXmlEngElement dataElement = pSOAPMessage->BodyL().AddNewElementL(_L8("data"), |
|
4592 serviceNamespace); |
|
4593 |
|
4594 // Add 1. attachment element into data element |
|
4595 // <m:data> |
|
4596 // <m:textAttachment1 xmlmime:contentType="text"> |
|
4597 // <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:123456789@123456789"/> |
|
4598 // </m:textAttachment1> |
|
4599 // ... |
|
4600 // </m:data> |
|
4601 TXmlEngElement attachmentElement1 = dataElement.AddNewElementL(_L8("textAttachment1"), |
|
4602 serviceNamespace); |
|
4603 attachmentElement1.AddNewAttributeL(_L8("contentType"), _L8("text"), mimeNamespace); |
|
4604 attachmentElement1.AppendChildL(chunkContainer); |
|
4605 |
|
4606 // Add 2. attachment element into data element |
|
4607 TXmlEngElement attachmentElement2 = dataElement.AddNewElementL(_L8("textAttachment2"), |
|
4608 serviceNamespace); |
|
4609 attachmentElement2.AddNewAttributeL(_L8("contentType"), _L8("text"), mimeNamespace); |
|
4610 attachmentElement2.AppendChildL(fileContainer); |
|
4611 |
|
4612 // Add 3. attachment element into data element |
|
4613 TXmlEngElement attachmentElement3 = dataElement.AddNewElementL(_L8("textAttachment3"), |
|
4614 serviceNamespace); |
|
4615 attachmentElement3.AddNewAttributeL(_L8("contentType"), _L8("text"), mimeNamespace); |
|
4616 attachmentElement3.AppendChildL(chunkContainer2); |
|
4617 |
|
4618 // Add 4. attachment element into data element |
|
4619 TXmlEngElement attachmentElement4 = dataElement.AddNewElementL(_L8("textAttachment4"), |
|
4620 serviceNamespace); |
|
4621 attachmentElement4.AddNewAttributeL(_L8("contentType"), _L8("text"), mimeNamespace); |
|
4622 attachmentElement4.AppendChildL(fileContainer2); |
|
4623 |
|
4624 // Add 5. attachment element inside data element |
|
4625 TXmlEngElement attachmentElement5 = dataElement.AddNewElementL(_L8("textAttachment5"), |
|
4626 serviceNamespace); |
|
4627 attachmentElement5.AddNewAttributeL(_L8("contentType"), _L8("text"), mimeNamespace); |
|
4628 attachmentElement5.AppendChildL(chunkContainer3); |
|
4629 |
|
4630 // Http Post |
|
4631 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
4632 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
4633 pSOAPMessage->SetProperties(pHttpProperties); |
|
4634 CleanupStack::Pop(pHttpProperties); // ownership was transferred to message |
|
4635 |
|
4636 CSenSoapEnvelope2* pRetMessage = NULL; |
|
4637 iServiceConnection->SubmitL(*pSOAPMessage, pRetMessage); |
|
4638 delete pRetMessage; |
|
4639 |
|
4640 // Check from HTTP Transaction logger log that POST method was used. |
|
4641 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
4642 LOCAL_ASSERT(pFileContent != NULL); |
|
4643 CleanupStack::PushL(pFileContent); |
|
4644 HBufC8* pValue = HttpMethodValueFromXmlLC(*pFileContent); |
|
4645 if ( pValue ) |
|
4646 { |
|
4647 LOCAL_ASSERT(*pValue == KHTTPMethodPost); |
|
4648 } |
|
4649 CleanupStack::PopAndDestroy(pValue); |
|
4650 CleanupStack::PopAndDestroy(pFileContent); |
|
4651 |
|
4652 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
4653 |
|
4654 CleanupStack::PopAndDestroy(&file2); |
|
4655 CleanupStack::PopAndDestroy(&rfs2); |
|
4656 CleanupStack::PopAndDestroy(&file); |
|
4657 CleanupStack::PopAndDestroy(&rfs); |
|
4658 CleanupStack::PopAndDestroy(&binaryDataChunk2); |
|
4659 CleanupStack::PopAndDestroy(&binaryDataChunk); |
|
4660 |
|
4661 delete iServiceConnection; |
|
4662 iServiceConnection = NULL; |
|
4663 Teardown(); |
|
4664 return KErrNone; |
|
4665 } |
|
4666 |
|
4667 |
|
4668 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_LibXml2_MTOM_20KBL( TTestResult& aResult ) |
|
4669 { |
|
4670 SetupL() ; |
|
4671 // Create ServiceConnection |
|
4672 |
|
4673 // _LIT8(KSHCEndPoint, "http://172.21.10.144:8080/mtom/servlet/MtomServlet"); |
|
4674 _LIT8(KSHCEndPoint, "http://4FID02268.NOE.Nokia.com:8080/mtom/servlet/MtomServlet"); |
|
4675 |
|
4676 CSenServicePattern* pPattern = CSenServicePattern::NewLC(KSHCEndPoint, KNullDesC8()); |
|
4677 // pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
4678 pPattern->SetFrameworkIdL(KRESTFrameworkID); |
|
4679 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
4680 pPattern->SetConsumerIapIdL(iapId); |
|
4681 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
4682 CleanupStack::PopAndDestroy(pPattern); |
|
4683 StartActiveScheduler(1); |
|
4684 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
4685 // Connection is ready to be used. |
|
4686 |
|
4687 // 1. Chunk declaration |
|
4688 _LIT8( cid, "123456789@123456789" ); |
|
4689 _LIT( chunkName, "test chunk" ); |
|
4690 _LIT8( chunkContent, "Testing chunk1" ); |
|
4691 TInt chunkSize = 1000; |
|
4692 TInt chunkMaxSize = 5000; |
|
4693 TInt chunkOffset = 100; |
|
4694 TInt chunkDataSize = 14; |
|
4695 RChunk binaryDataChunk; |
|
4696 binaryDataChunk.CreateGlobal(chunkName(), chunkSize, chunkMaxSize); |
|
4697 CleanupClosePushL(binaryDataChunk); |
|
4698 TUint8* heapPtr = binaryDataChunk.Base(); |
|
4699 heapPtr = heapPtr + chunkOffset; |
|
4700 // Place a new descriptor in the chunk to initialize it |
|
4701 new (heapPtr-sizeof(TPtr8)) TPtr8(heapPtr, 0, chunkDataSize); |
|
4702 // Set the descriptor |
|
4703 TPtr8* pDes = reinterpret_cast<TPtr8*>(heapPtr-sizeof(TPtr8)); |
|
4704 pDes->Zero(); |
|
4705 pDes->Append(chunkContent); |
|
4706 |
|
4707 // 2. Chunk declaration |
|
4708 _LIT8( cid2, "xyz" ); |
|
4709 _LIT( chunkName2, "test chunk2" ); |
|
4710 _LIT8( chunkContent2, "Testing chunk2" ); |
|
4711 TInt chunkSize2 = 3000; |
|
4712 TInt chunkMaxSize2 = 10000; |
|
4713 TInt chunkOffset2 = 112; |
|
4714 TInt chunkDataSize2 = 14; |
|
4715 |
|
4716 RChunk binaryDataChunk2; |
|
4717 binaryDataChunk2.CreateGlobal(chunkName2(), chunkSize2, chunkMaxSize2); |
|
4718 CleanupClosePushL(binaryDataChunk2); |
|
4719 TUint8* heapPtr2 = binaryDataChunk2.Base(); |
|
4720 heapPtr2 = heapPtr2 + chunkOffset2; |
|
4721 // Place a new descriptor in the chunk to initialize it |
|
4722 new (heapPtr2-sizeof(TPtr8)) TPtr8(heapPtr2, 0, chunkDataSize2); |
|
4723 // Set the descriptor |
|
4724 TPtr8* pDes2 = reinterpret_cast<TPtr8*>(heapPtr2-sizeof(TPtr8)); |
|
4725 pDes2->Zero(); |
|
4726 pDes2->Append(chunkContent2); |
|
4727 |
|
4728 // 1. File declaration |
|
4729 _LIT8( cid3, "999999999@123456789" ); |
|
4730 _LIT( KTestFileName, "c:\\testing\\data\\Sunset2.jpg" ); |
|
4731 RFs rfs; |
|
4732 User::LeaveIfError(rfs.Connect()); |
|
4733 CleanupClosePushL(rfs); |
|
4734 TInt retVal = rfs.ShareProtected(); |
|
4735 RFile file; |
|
4736 CleanupClosePushL(file); |
|
4737 User::LeaveIfError(file.Open(rfs, KTestFileName, EFileRead)); |
|
4738 |
|
4739 // 2. File declaration |
|
4740 _LIT8( cid4, "1z2" ); |
|
4741 _LIT( KTestFileName2, "c:\\testing\\data\\fileContainer2.txt" ); |
|
4742 _LIT8( KFileContent2, "Test FileContainer2" ); |
|
4743 RFs rfs2; |
|
4744 User::LeaveIfError(rfs2.Connect()); |
|
4745 CleanupClosePushL(rfs2); |
|
4746 retVal = rfs2.ShareProtected(); |
|
4747 RFile file2; |
|
4748 CleanupClosePushL(file2); |
|
4749 User::LeaveIfError(file2.Replace(rfs2, KTestFileName2, EFileWrite)); |
|
4750 User::LeaveIfError(file2.Write(KFileContent2)); |
|
4751 file2.Flush(); |
|
4752 file2.Close(); |
|
4753 User::LeaveIfError(file2.Open(rfs2, KTestFileName2, EFileRead)); |
|
4754 |
|
4755 // 3. File declaration |
|
4756 _LIT8( cid5, "999999999@12789" ); |
|
4757 _LIT( KTestFileName3, "c:\\testing\\data\\Winter2.jpg" ); |
|
4758 RFs rfs3; |
|
4759 User::LeaveIfError(rfs3.Connect()); |
|
4760 CleanupClosePushL(rfs3); |
|
4761 retVal = rfs3.ShareProtected(); |
|
4762 RFile file3; |
|
4763 CleanupClosePushL(file3); |
|
4764 User::LeaveIfError(file3.Open(rfs3, KTestFileName3, EFileRead)); |
|
4765 |
|
4766 |
|
4767 // Create SOAPMessage |
|
4768 CSenSoapMessage2* pSOAPMessage = CSenSoapMessage2::NewL(ESOAP12); |
|
4769 _LIT8( KSoapActionValue, "http://schemas.live.com/mws/2005/08/contacts/Sync" ); |
|
4770 pSOAPMessage->SetSoapActionL(KSoapActionValue); |
|
4771 // CSenSoapMessage2* pSOAPMessage = CSenSoapMessage2::NewL(); // ESOAP11 |
|
4772 CleanupStack::PushL(pSOAPMessage); |
|
4773 |
|
4774 RSenDocument document = pSOAPMessage->AsDocumentL(); |
|
4775 |
|
4776 // Create BinaryContainers |
|
4777 TXmlEngChunkContainer chunkContainer = document.CreateChunkContainerL( |
|
4778 cid, |
|
4779 binaryDataChunk, |
|
4780 chunkOffset, |
|
4781 chunkDataSize); |
|
4782 TXmlEngChunkContainer chunkContainer2 = document.CreateChunkContainerL( |
|
4783 cid2, |
|
4784 binaryDataChunk2, |
|
4785 chunkOffset2, |
|
4786 chunkDataSize2); |
|
4787 TXmlEngChunkContainer chunkContainer3 = document.CreateChunkContainerL( |
|
4788 cid2, |
|
4789 binaryDataChunk2, |
|
4790 chunkOffset2, |
|
4791 chunkDataSize2); |
|
4792 TXmlEngFileContainer fileContainer = document.CreateFileContainerL(cid3, file); |
|
4793 TXmlEngFileContainer fileContainer2 = document.CreateFileContainerL(cid4, file2); |
|
4794 TXmlEngFileContainer fileContainer3 = document.CreateFileContainerL(cid5, file3); |
|
4795 |
|
4796 |
|
4797 // Get Envelope element |
|
4798 TXmlEngElement envelopeElement = pSOAPMessage->AsElementL(); |
|
4799 |
|
4800 // Create mime namespace declaration into Envelope element |
|
4801 // xmlns:xmlmime="http://www.w3.org/2004/11/xmlmime" |
|
4802 |
|
4803 |
|
4804 TXmlEngNamespace mimeNamespace = envelopeElement. AddNamespaceDeclarationL(_L8("http://www.w3.org/2005/05/xmlmime"), |
|
4805 _L8("xmlmime")); |
|
4806 |
|
4807 // TXmlEngNamespace mimeNamespace = envelopeElement. AddNamespaceDeclarationL(_L8("http://www.w3.org/2004/11/xmlmime"), |
|
4808 // _L8("mime")); // IE does not render XML where attribute name startes with "xml" (xmlmime) |
|
4809 |
|
4810 |
|
4811 // Create service specific namespace declaration into Body element |
|
4812 // xmlns:m="http://example.org/stuff" |
|
4813 TXmlEngNamespace serviceNamespace = pSOAPMessage->BodyL().AddNamespaceDeclarationL( |
|
4814 _L8("http://example.org/stuff"), |
|
4815 _L8("m")); |
|
4816 // Add data element into Body |
|
4817 // <S:Body xmlns:m="http://example.org/stuff"> |
|
4818 // <m:data> |
|
4819 // ... |
|
4820 // </m:data> |
|
4821 // </S:Body> |
|
4822 TXmlEngElement dataElement = pSOAPMessage->BodyL().AddNewElementL(_L8("data"), |
|
4823 serviceNamespace); |
|
4824 |
|
4825 // Add 1. attachment element into data element |
|
4826 // <m:data> |
|
4827 // <m:textAttachment1 xmlmime:contentType="text"> |
|
4828 // <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:123456789@123456789"/> |
|
4829 // </m:textAttachment1> |
|
4830 // ... |
|
4831 // </m:data> |
|
4832 TXmlEngElement attachmentElement1 = dataElement.AddNewElementL(_L8("textAttachment1"), |
|
4833 serviceNamespace); |
|
4834 attachmentElement1.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
4835 attachmentElement1.AppendChildL(chunkContainer); |
|
4836 |
|
4837 // Add 2. attachment element into data element |
|
4838 TXmlEngElement attachmentElement2 = dataElement.AddNewElementL(_L8("textAttachment2"), |
|
4839 serviceNamespace); |
|
4840 attachmentElement2.AddNewAttributeL(_L8("contentType"), _L8("image/png"), mimeNamespace); |
|
4841 attachmentElement2.AppendChildL(fileContainer); |
|
4842 |
|
4843 // Add 3. attachment element into data element |
|
4844 TXmlEngElement attachmentElement3 = dataElement.AddNewElementL(_L8("textAttachment3"), |
|
4845 serviceNamespace); |
|
4846 attachmentElement3.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
4847 attachmentElement3.AppendChildL(chunkContainer2); |
|
4848 |
|
4849 // Add 4. attachment element into data element |
|
4850 TXmlEngElement attachmentElement4 = dataElement.AddNewElementL(_L8("textAttachment4"), |
|
4851 serviceNamespace); |
|
4852 attachmentElement4.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
4853 attachmentElement4.AppendChildL(fileContainer2); |
|
4854 |
|
4855 // Add 5. attachment element inside data element |
|
4856 TXmlEngElement attachmentElement5 = dataElement.AddNewElementL(_L8("textAttachment5"), |
|
4857 serviceNamespace); |
|
4858 attachmentElement5.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
4859 attachmentElement5.AppendChildL(chunkContainer3); |
|
4860 |
|
4861 // Add 6. attachment element into data element |
|
4862 TXmlEngElement attachmentElement6 = dataElement.AddNewElementL(_L8("textAttachment2"), |
|
4863 serviceNamespace); |
|
4864 attachmentElement6.AddNewAttributeL(_L8("contentType"), _L8("image/png"), mimeNamespace); |
|
4865 attachmentElement6.AppendChildL(fileContainer3); |
|
4866 |
|
4867 // Http Post |
|
4868 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
4869 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
4870 HBufC8* pPropsAsXml = pHttpProperties->AsUtf8LC(); |
|
4871 iServiceConnection->SetTransportPropertiesL(*pPropsAsXml); |
|
4872 CleanupStack::PopAndDestroy(pPropsAsXml); |
|
4873 CleanupStack::PopAndDestroy(pHttpProperties); |
|
4874 |
|
4875 CSenSoapEnvelope2* pRetMessage = NULL; |
|
4876 iServiceConnection->SubmitL(*pSOAPMessage, pRetMessage); |
|
4877 delete pRetMessage; |
|
4878 |
|
4879 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
4880 CleanupStack::PopAndDestroy(&file3); |
|
4881 CleanupStack::PopAndDestroy(&rfs3); |
|
4882 CleanupStack::PopAndDestroy(&file2); |
|
4883 CleanupStack::PopAndDestroy(&rfs2); |
|
4884 CleanupStack::PopAndDestroy(&file); |
|
4885 CleanupStack::PopAndDestroy(&rfs); |
|
4886 CleanupStack::PopAndDestroy(&binaryDataChunk2); |
|
4887 CleanupStack::PopAndDestroy(&binaryDataChunk); |
|
4888 |
|
4889 delete iServiceConnection; |
|
4890 iServiceConnection = NULL; |
|
4891 Teardown(); |
|
4892 return KErrNone; |
|
4893 } |
|
4894 |
|
4895 |
|
4896 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_LibXml2_MTOM_200KBL( TTestResult& aResult ) |
|
4897 { |
|
4898 SetupL() ; |
|
4899 // Create ServiceConnection |
|
4900 |
|
4901 // _LIT8(KSHCEndPoint, "http://172.21.10.144:8080/mtom/servlet/MtomServlet"); |
|
4902 _LIT8(KSHCEndPoint, "http://4FID02268.NOE.Nokia.com:8080/mtom/servlet/MtomServlet"); |
|
4903 |
|
4904 CSenServicePattern* pPattern = CSenServicePattern::NewLC(KSHCEndPoint, KNullDesC8()); |
|
4905 // pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
4906 pPattern->SetFrameworkIdL(KRESTFrameworkID); |
|
4907 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
4908 pPattern->SetConsumerIapIdL(iapId); |
|
4909 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
4910 CleanupStack::PopAndDestroy(pPattern); |
|
4911 StartActiveScheduler(1); |
|
4912 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
4913 // Connection is ready to be used. |
|
4914 |
|
4915 // 1. Chunk declaration |
|
4916 _LIT8( cid, "123456789@123456789" ); |
|
4917 _LIT( chunkName, "test chunk" ); |
|
4918 _LIT8( chunkContent, "Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1." ); |
|
4919 TInt chunkSize = 1000; |
|
4920 TInt chunkMaxSize = 5000; |
|
4921 TInt chunkOffset = 100; |
|
4922 TInt chunkDataSize = 150; |
|
4923 RChunk binaryDataChunk; |
|
4924 binaryDataChunk.CreateGlobal(chunkName(), chunkSize, chunkMaxSize); |
|
4925 CleanupClosePushL(binaryDataChunk); |
|
4926 TUint8* heapPtr = binaryDataChunk.Base(); |
|
4927 heapPtr = heapPtr + chunkOffset; |
|
4928 // Place a new descriptor in the chunk to initialize it |
|
4929 new (heapPtr-sizeof(TPtr8)) TPtr8(heapPtr, 0, chunkDataSize); |
|
4930 // Set the descriptor |
|
4931 TPtr8* pDes = reinterpret_cast<TPtr8*>(heapPtr-sizeof(TPtr8)); |
|
4932 pDes->Zero(); |
|
4933 pDes->Append(chunkContent); |
|
4934 |
|
4935 // 2. Chunk declaration |
|
4936 _LIT8( cid2, "xyz" ); |
|
4937 _LIT( chunkName2, "test chunk2" ); |
|
4938 _LIT8( chunkContent2, "Testing chunk2" ); |
|
4939 TInt chunkSize2 = 3000; |
|
4940 TInt chunkMaxSize2 = 10000; |
|
4941 TInt chunkOffset2 = 112; |
|
4942 TInt chunkDataSize2 = 14; |
|
4943 |
|
4944 RChunk binaryDataChunk2; |
|
4945 binaryDataChunk2.CreateGlobal(chunkName2(), chunkSize2, chunkMaxSize2); |
|
4946 CleanupClosePushL(binaryDataChunk2); |
|
4947 TUint8* heapPtr2 = binaryDataChunk2.Base(); |
|
4948 heapPtr2 = heapPtr2 + chunkOffset2; |
|
4949 // Place a new descriptor in the chunk to initialize it |
|
4950 new (heapPtr2-sizeof(TPtr8)) TPtr8(heapPtr2, 0, chunkDataSize2); |
|
4951 // Set the descriptor |
|
4952 TPtr8* pDes2 = reinterpret_cast<TPtr8*>(heapPtr2-sizeof(TPtr8)); |
|
4953 pDes2->Zero(); |
|
4954 pDes2->Append(chunkContent2); |
|
4955 |
|
4956 // 1. File declaration |
|
4957 _LIT8( cid3, "999999999@123456789" ); |
|
4958 _LIT( KTestFileName, "c:\\testing\\data\\Sunset.jpg" ); |
|
4959 RFs rfs; |
|
4960 User::LeaveIfError(rfs.Connect()); |
|
4961 CleanupClosePushL(rfs); |
|
4962 TInt retVal = rfs.ShareProtected(); |
|
4963 RFile file; |
|
4964 CleanupClosePushL(file); |
|
4965 User::LeaveIfError(file.Open(rfs, KTestFileName, EFileRead)); |
|
4966 |
|
4967 // 2. File declaration |
|
4968 _LIT8( cid4, "1z2" ); |
|
4969 _LIT( KTestFileName2, "c:\\testing\\data\\fileContainer2.txt" ); |
|
4970 _LIT8( KFileContent2, "Test FileContainer2" ); |
|
4971 RFs rfs2; |
|
4972 User::LeaveIfError(rfs2.Connect()); |
|
4973 CleanupClosePushL(rfs2); |
|
4974 retVal = rfs2.ShareProtected(); |
|
4975 RFile file2; |
|
4976 CleanupClosePushL(file2); |
|
4977 User::LeaveIfError(file2.Replace(rfs2, KTestFileName2, EFileWrite)); |
|
4978 User::LeaveIfError(file2.Write(KFileContent2)); |
|
4979 file2.Flush(); |
|
4980 file2.Close(); |
|
4981 User::LeaveIfError(file2.Open(rfs2, KTestFileName2, EFileRead)); |
|
4982 |
|
4983 // 3. File declaration |
|
4984 _LIT8( cid5, "999999999@12789" ); |
|
4985 _LIT( KTestFileName3, "c:\\testing\\data\\Winter.jpg" ); |
|
4986 RFs rfs3; |
|
4987 User::LeaveIfError(rfs3.Connect()); |
|
4988 CleanupClosePushL(rfs3); |
|
4989 retVal = rfs3.ShareProtected(); |
|
4990 RFile file3; |
|
4991 CleanupClosePushL(file3); |
|
4992 User::LeaveIfError(file3.Open(rfs3, KTestFileName3, EFileRead)); |
|
4993 |
|
4994 |
|
4995 // Create SOAPMessage |
|
4996 CSenSoapMessage2* pSOAPMessage = CSenSoapMessage2::NewL(ESOAP12); |
|
4997 _LIT8( KSoapActionValue, "http://schemas.live.com/mws/2005/08/contacts/Sync" ); |
|
4998 pSOAPMessage->SetSoapActionL(KSoapActionValue); |
|
4999 // CSenSoapMessage2* pSOAPMessage = CSenSoapMessage2::NewL(); // ESOAP11 |
|
5000 CleanupStack::PushL(pSOAPMessage); |
|
5001 |
|
5002 RSenDocument document = pSOAPMessage->AsDocumentL(); |
|
5003 |
|
5004 // Create BinaryContainers |
|
5005 TXmlEngChunkContainer chunkContainer = document.CreateChunkContainerL( |
|
5006 cid, |
|
5007 binaryDataChunk, |
|
5008 chunkOffset, |
|
5009 chunkDataSize); |
|
5010 TXmlEngChunkContainer chunkContainer2 = document.CreateChunkContainerL( |
|
5011 cid2, |
|
5012 binaryDataChunk2, |
|
5013 chunkOffset2, |
|
5014 chunkDataSize2); |
|
5015 TXmlEngChunkContainer chunkContainer3 = document.CreateChunkContainerL( |
|
5016 cid2, |
|
5017 binaryDataChunk2, |
|
5018 chunkOffset2, |
|
5019 chunkDataSize2); |
|
5020 TXmlEngFileContainer fileContainer = document.CreateFileContainerL(cid3, file); |
|
5021 TXmlEngFileContainer fileContainer2 = document.CreateFileContainerL(cid4, file2); |
|
5022 TXmlEngFileContainer fileContainer3 = document.CreateFileContainerL(cid5, file3); |
|
5023 |
|
5024 |
|
5025 // Get Envelope element |
|
5026 TXmlEngElement envelopeElement = pSOAPMessage->AsElementL(); |
|
5027 |
|
5028 // Create mime namespace declaration into Envelope element |
|
5029 // xmlns:xmlmime="http://www.w3.org/2004/11/xmlmime" |
|
5030 |
|
5031 |
|
5032 TXmlEngNamespace mimeNamespace = envelopeElement. AddNamespaceDeclarationL(_L8("http://www.w3.org/2005/05/xmlmime"), |
|
5033 _L8("xmlmime")); |
|
5034 |
|
5035 // TXmlEngNamespace mimeNamespace = envelopeElement. AddNamespaceDeclarationL(_L8("http://www.w3.org/2004/11/xmlmime"), |
|
5036 // _L8("mime")); // IE does not render XML where attribute name startes with "xml" (xmlmime) |
|
5037 |
|
5038 |
|
5039 // Create service specific namespace declaration into Body element |
|
5040 // xmlns:m="http://example.org/stuff" |
|
5041 TXmlEngNamespace serviceNamespace = pSOAPMessage->BodyL().AddNamespaceDeclarationL( |
|
5042 _L8("http://example.org/stuff"), |
|
5043 _L8("m")); |
|
5044 // Add data element into Body |
|
5045 // <S:Body xmlns:m="http://example.org/stuff"> |
|
5046 // <m:data> |
|
5047 // ... |
|
5048 // </m:data> |
|
5049 // </S:Body> |
|
5050 TXmlEngElement dataElement = pSOAPMessage->BodyL().AddNewElementL(_L8("data"), |
|
5051 serviceNamespace); |
|
5052 |
|
5053 // Add 1. attachment element into data element |
|
5054 // <m:data> |
|
5055 // <m:textAttachment1 xmlmime:contentType="text"> |
|
5056 // <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:123456789@123456789"/> |
|
5057 // </m:textAttachment1> |
|
5058 // ... |
|
5059 // </m:data> |
|
5060 TXmlEngElement attachmentElement1 = dataElement.AddNewElementL(_L8("textAttachment1"), |
|
5061 serviceNamespace); |
|
5062 attachmentElement1.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
5063 attachmentElement1.AppendChildL(chunkContainer); |
|
5064 |
|
5065 // Add 2. attachment element into data element |
|
5066 TXmlEngElement attachmentElement2 = dataElement.AddNewElementL(_L8("textAttachment2"), |
|
5067 serviceNamespace); |
|
5068 attachmentElement2.AddNewAttributeL(_L8("contentType"), _L8("image/png"), mimeNamespace); |
|
5069 attachmentElement2.AppendChildL(fileContainer); |
|
5070 |
|
5071 // Add 3. attachment element into data element |
|
5072 TXmlEngElement attachmentElement3 = dataElement.AddNewElementL(_L8("textAttachment3"), |
|
5073 serviceNamespace); |
|
5074 attachmentElement3.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
5075 attachmentElement3.AppendChildL(chunkContainer2); |
|
5076 |
|
5077 // Add 4. attachment element into data element |
|
5078 TXmlEngElement attachmentElement4 = dataElement.AddNewElementL(_L8("textAttachment4"), |
|
5079 serviceNamespace); |
|
5080 attachmentElement4.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
5081 attachmentElement4.AppendChildL(fileContainer2); |
|
5082 |
|
5083 // Add 5. attachment element inside data element |
|
5084 TXmlEngElement attachmentElement5 = dataElement.AddNewElementL(_L8("textAttachment5"), |
|
5085 serviceNamespace); |
|
5086 attachmentElement5.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
5087 attachmentElement5.AppendChildL(chunkContainer3); |
|
5088 |
|
5089 // Add 6. attachment element into data element |
|
5090 TXmlEngElement attachmentElement6 = dataElement.AddNewElementL(_L8("textAttachment2"), |
|
5091 serviceNamespace); |
|
5092 attachmentElement6.AddNewAttributeL(_L8("contentType"), _L8("image/png"), mimeNamespace); |
|
5093 attachmentElement6.AppendChildL(fileContainer3); |
|
5094 |
|
5095 // Http Post |
|
5096 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
5097 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
5098 HBufC8* pPropsAsXml = pHttpProperties->AsUtf8LC(); |
|
5099 iServiceConnection->SetTransportPropertiesL(*pPropsAsXml); |
|
5100 CleanupStack::PopAndDestroy(pPropsAsXml); |
|
5101 CleanupStack::PopAndDestroy(pHttpProperties); |
|
5102 |
|
5103 CSenSoapEnvelope2* pRetMessage = NULL; |
|
5104 iServiceConnection->SubmitL(*pSOAPMessage, pRetMessage); |
|
5105 delete pRetMessage; |
|
5106 |
|
5107 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
5108 CleanupStack::PopAndDestroy(&file3); |
|
5109 CleanupStack::PopAndDestroy(&rfs3); |
|
5110 CleanupStack::PopAndDestroy(&file2); |
|
5111 CleanupStack::PopAndDestroy(&rfs2); |
|
5112 CleanupStack::PopAndDestroy(&file); |
|
5113 CleanupStack::PopAndDestroy(&rfs); |
|
5114 CleanupStack::PopAndDestroy(&binaryDataChunk2); |
|
5115 CleanupStack::PopAndDestroy(&binaryDataChunk); |
|
5116 |
|
5117 delete iServiceConnection; |
|
5118 iServiceConnection = NULL; |
|
5119 Teardown(); |
|
5120 return KErrNone; |
|
5121 } |
|
5122 |
|
5123 |
|
5124 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_LibXml2_MTOM_Less1MBL( TTestResult& aResult ) |
|
5125 { |
|
5126 SetupL() ; |
|
5127 // Create ServiceConnection |
|
5128 |
|
5129 // _LIT8(KSHCEndPoint, "http://172.21.10.144:8080/mtom/servlet/MtomServlet"); |
|
5130 _LIT8(KSHCEndPoint, "http://4FID02268.NOE.Nokia.com:8080/mtom/servlet/MtomServlet"); |
|
5131 CSenServicePattern* pPattern = CSenServicePattern::NewLC(KSHCEndPoint, KNullDesC8()); |
|
5132 // pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
5133 pPattern->SetFrameworkIdL(KRESTFrameworkID); |
|
5134 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
5135 pPattern->SetConsumerIapIdL(iapId); |
|
5136 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
5137 CleanupStack::PopAndDestroy(pPattern); |
|
5138 StartActiveScheduler(1); |
|
5139 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
5140 // Connection is ready to be used. |
|
5141 |
|
5142 // 1. Chunk declaration |
|
5143 _LIT8( cid, "123456789@123456789" ); |
|
5144 _LIT( chunkName, "test chunk" ); |
|
5145 _LIT8( chunkContent, "Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1." ); |
|
5146 TInt chunkSize = 1000; |
|
5147 TInt chunkMaxSize = 5000; |
|
5148 TInt chunkOffset = 100; |
|
5149 TInt chunkDataSize = 150; |
|
5150 RChunk binaryDataChunk; |
|
5151 binaryDataChunk.CreateGlobal(chunkName(), chunkSize, chunkMaxSize); |
|
5152 CleanupClosePushL(binaryDataChunk); |
|
5153 TUint8* heapPtr = binaryDataChunk.Base(); |
|
5154 heapPtr = heapPtr + chunkOffset; |
|
5155 // Place a new descriptor in the chunk to initialize it |
|
5156 new (heapPtr-sizeof(TPtr8)) TPtr8(heapPtr, 0, chunkDataSize); |
|
5157 // Set the descriptor |
|
5158 TPtr8* pDes = reinterpret_cast<TPtr8*>(heapPtr-sizeof(TPtr8)); |
|
5159 pDes->Zero(); |
|
5160 pDes->Append(chunkContent); |
|
5161 |
|
5162 // 2. Chunk declaration |
|
5163 _LIT8( cid2, "xyz" ); |
|
5164 _LIT( chunkName2, "test chunk2" ); |
|
5165 _LIT8( chunkContent2, "Testing chunk2" ); |
|
5166 TInt chunkSize2 = 3000; |
|
5167 TInt chunkMaxSize2 = 10000; |
|
5168 TInt chunkOffset2 = 112; |
|
5169 TInt chunkDataSize2 = 14; |
|
5170 |
|
5171 RChunk binaryDataChunk2; |
|
5172 binaryDataChunk2.CreateGlobal(chunkName2(), chunkSize2, chunkMaxSize2); |
|
5173 CleanupClosePushL(binaryDataChunk2); |
|
5174 TUint8* heapPtr2 = binaryDataChunk2.Base(); |
|
5175 heapPtr2 = heapPtr2 + chunkOffset2; |
|
5176 // Place a new descriptor in the chunk to initialize it |
|
5177 new (heapPtr2-sizeof(TPtr8)) TPtr8(heapPtr2, 0, chunkDataSize2); |
|
5178 // Set the descriptor |
|
5179 TPtr8* pDes2 = reinterpret_cast<TPtr8*>(heapPtr2-sizeof(TPtr8)); |
|
5180 pDes2->Zero(); |
|
5181 pDes2->Append(chunkContent2); |
|
5182 |
|
5183 // 1. File declaration |
|
5184 _LIT8( cid3, "999999999@123456789" ); |
|
5185 _LIT( KTestFileName, "c:\\testing\\data\\Sunset.jpg" ); |
|
5186 RFs rfs; |
|
5187 User::LeaveIfError(rfs.Connect()); |
|
5188 CleanupClosePushL(rfs); |
|
5189 TInt retVal = rfs.ShareProtected(); |
|
5190 RFile file; |
|
5191 CleanupClosePushL(file); |
|
5192 User::LeaveIfError(file.Open(rfs, KTestFileName, EFileRead)); |
|
5193 |
|
5194 // 2. File declaration |
|
5195 _LIT8( cid4, "1z2" ); |
|
5196 _LIT( KTestFileName2, "c:\\testing\\data\\fileContainer2.txt" ); |
|
5197 _LIT8( KFileContent2, "Test FileContainer2" ); |
|
5198 RFs rfs2; |
|
5199 User::LeaveIfError(rfs2.Connect()); |
|
5200 CleanupClosePushL(rfs2); |
|
5201 retVal = rfs2.ShareProtected(); |
|
5202 RFile file2; |
|
5203 CleanupClosePushL(file2); |
|
5204 User::LeaveIfError(file2.Replace(rfs2, KTestFileName2, EFileWrite)); |
|
5205 User::LeaveIfError(file2.Write(KFileContent2)); |
|
5206 file2.Flush(); |
|
5207 file2.Close(); |
|
5208 User::LeaveIfError(file2.Open(rfs2, KTestFileName2, EFileRead)); |
|
5209 |
|
5210 // 3. File declaration |
|
5211 _LIT8( cid5, "999999999@12789" ); |
|
5212 _LIT( KTestFileName3, "c:\\testing\\data\\testPic3.jpg"); |
|
5213 RFs rfs3; |
|
5214 User::LeaveIfError(rfs3.Connect()); |
|
5215 CleanupClosePushL(rfs3); |
|
5216 retVal = rfs3.ShareProtected(); |
|
5217 RFile file3; |
|
5218 CleanupClosePushL(file3); |
|
5219 User::LeaveIfError(file3.Open(rfs3, KTestFileName3, EFileRead)); |
|
5220 |
|
5221 |
|
5222 // Create SOAPMessage |
|
5223 CSenSoapMessage2* pSOAPMessage = CSenSoapMessage2::NewL(ESOAP12); |
|
5224 _LIT8( KSoapActionValue, "http://schemas.live.com/mws/2005/08/contacts/Sync" ); |
|
5225 pSOAPMessage->SetSoapActionL(KSoapActionValue); |
|
5226 // CSenSoapMessage2* pSOAPMessage = CSenSoapMessage2::NewL(); // ESOAP11 |
|
5227 CleanupStack::PushL(pSOAPMessage); |
|
5228 |
|
5229 RSenDocument document = pSOAPMessage->AsDocumentL(); |
|
5230 |
|
5231 // Create BinaryContainers |
|
5232 TXmlEngChunkContainer chunkContainer = document.CreateChunkContainerL( |
|
5233 cid, |
|
5234 binaryDataChunk, |
|
5235 chunkOffset, |
|
5236 chunkDataSize); |
|
5237 TXmlEngChunkContainer chunkContainer2 = document.CreateChunkContainerL( |
|
5238 cid2, |
|
5239 binaryDataChunk2, |
|
5240 chunkOffset2, |
|
5241 chunkDataSize2); |
|
5242 TXmlEngChunkContainer chunkContainer3 = document.CreateChunkContainerL( |
|
5243 cid2, |
|
5244 binaryDataChunk2, |
|
5245 chunkOffset2, |
|
5246 chunkDataSize2); |
|
5247 TXmlEngFileContainer fileContainer = document.CreateFileContainerL(cid3, file); |
|
5248 TXmlEngFileContainer fileContainer2 = document.CreateFileContainerL(cid4, file2); |
|
5249 TXmlEngFileContainer fileContainer3 = document.CreateFileContainerL(cid5, file3); |
|
5250 |
|
5251 |
|
5252 // Get Envelope element |
|
5253 TXmlEngElement envelopeElement = pSOAPMessage->AsElementL(); |
|
5254 |
|
5255 // Create mime namespace declaration into Envelope element |
|
5256 // xmlns:xmlmime="http://www.w3.org/2004/11/xmlmime" |
|
5257 |
|
5258 |
|
5259 TXmlEngNamespace mimeNamespace = envelopeElement. AddNamespaceDeclarationL(_L8("http://www.w3.org/2005/05/xmlmime"), |
|
5260 _L8("xmlmime")); |
|
5261 |
|
5262 // TXmlEngNamespace mimeNamespace = envelopeElement. AddNamespaceDeclarationL(_L8("http://www.w3.org/2004/11/xmlmime"), |
|
5263 // _L8("mime")); // IE does not render XML where attribute name startes with "xml" (xmlmime) |
|
5264 |
|
5265 |
|
5266 // Create service specific namespace declaration into Body element |
|
5267 // xmlns:m="http://example.org/stuff" |
|
5268 TXmlEngNamespace serviceNamespace = pSOAPMessage->BodyL().AddNamespaceDeclarationL( |
|
5269 _L8("http://example.org/stuff"), |
|
5270 _L8("m")); |
|
5271 // Add data element into Body |
|
5272 // <S:Body xmlns:m="http://example.org/stuff"> |
|
5273 // <m:data> |
|
5274 // ... |
|
5275 // </m:data> |
|
5276 // </S:Body> |
|
5277 TXmlEngElement dataElement = pSOAPMessage->BodyL().AddNewElementL(_L8("data"), |
|
5278 serviceNamespace); |
|
5279 |
|
5280 // Add 1. attachment element into data element |
|
5281 // <m:data> |
|
5282 // <m:textAttachment1 xmlmime:contentType="text"> |
|
5283 // <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:123456789@123456789"/> |
|
5284 // </m:textAttachment1> |
|
5285 // ... |
|
5286 // </m:data> |
|
5287 TXmlEngElement attachmentElement1 = dataElement.AddNewElementL(_L8("textAttachment1"), |
|
5288 serviceNamespace); |
|
5289 attachmentElement1.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
5290 attachmentElement1.AppendChildL(chunkContainer); |
|
5291 |
|
5292 // Add 2. attachment element into data element |
|
5293 TXmlEngElement attachmentElement2 = dataElement.AddNewElementL(_L8("textAttachment2"), |
|
5294 serviceNamespace); |
|
5295 attachmentElement2.AddNewAttributeL(_L8("contentType"), _L8("image/png"), mimeNamespace); |
|
5296 attachmentElement2.AppendChildL(fileContainer); |
|
5297 |
|
5298 // Add 3. attachment element into data element |
|
5299 TXmlEngElement attachmentElement3 = dataElement.AddNewElementL(_L8("textAttachment3"), |
|
5300 serviceNamespace); |
|
5301 attachmentElement3.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
5302 attachmentElement3.AppendChildL(chunkContainer2); |
|
5303 |
|
5304 // Add 4. attachment element into data element |
|
5305 TXmlEngElement attachmentElement4 = dataElement.AddNewElementL(_L8("textAttachment4"), |
|
5306 serviceNamespace); |
|
5307 attachmentElement4.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
5308 attachmentElement4.AppendChildL(fileContainer2); |
|
5309 |
|
5310 // Add 5. attachment element inside data element |
|
5311 TXmlEngElement attachmentElement5 = dataElement.AddNewElementL(_L8("textAttachment5"), |
|
5312 serviceNamespace); |
|
5313 attachmentElement5.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
5314 attachmentElement5.AppendChildL(chunkContainer3); |
|
5315 |
|
5316 // Add 6. attachment element into data element |
|
5317 TXmlEngElement attachmentElement6 = dataElement.AddNewElementL(_L8("textAttachment2"), |
|
5318 serviceNamespace); |
|
5319 attachmentElement6.AddNewAttributeL(_L8("contentType"), _L8("image/png"), mimeNamespace); |
|
5320 attachmentElement6.AppendChildL(fileContainer3); |
|
5321 |
|
5322 |
|
5323 // Http Post |
|
5324 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
5325 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
5326 HBufC8* pPropsAsXml = pHttpProperties->AsUtf8LC(); |
|
5327 iServiceConnection->SetTransportPropertiesL(*pPropsAsXml); |
|
5328 CleanupStack::PopAndDestroy(pPropsAsXml); |
|
5329 CleanupStack::PopAndDestroy(pHttpProperties); |
|
5330 |
|
5331 |
|
5332 CSenSoapEnvelope2* pRetMessage = NULL; |
|
5333 iServiceConnection->SubmitL(*pSOAPMessage, pRetMessage); |
|
5334 delete pRetMessage; |
|
5335 |
|
5336 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
5337 CleanupStack::PopAndDestroy(&file3); |
|
5338 CleanupStack::PopAndDestroy(&rfs3); |
|
5339 CleanupStack::PopAndDestroy(&file2); |
|
5340 CleanupStack::PopAndDestroy(&rfs2); |
|
5341 CleanupStack::PopAndDestroy(&file); |
|
5342 CleanupStack::PopAndDestroy(&rfs); |
|
5343 CleanupStack::PopAndDestroy(&binaryDataChunk2); |
|
5344 CleanupStack::PopAndDestroy(&binaryDataChunk); |
|
5345 |
|
5346 delete iServiceConnection; |
|
5347 iServiceConnection = NULL; |
|
5348 Teardown(); |
|
5349 return KErrNone; |
|
5350 } |
|
5351 |
|
5352 |
|
5353 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_SubmitL_LibXml2_MTOM_More1MBL( TTestResult& aResult ) |
|
5354 { |
|
5355 SetupL() ; |
|
5356 // Create ServiceConnection |
|
5357 |
|
5358 // _LIT8(KSHCEndPoint, "http://172.21.10.144:8080/mtom/servlet/MtomServlet"); |
|
5359 _LIT8(KSHCEndPoint, "http://4FID02268.NOE.Nokia.com:8080/mtom/servlet/MtomServlet"); |
|
5360 CSenServicePattern* pPattern = CSenServicePattern::NewLC(KSHCEndPoint, KNullDesC8()); |
|
5361 // pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
5362 pPattern->SetFrameworkIdL(KRESTFrameworkID); |
|
5363 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
5364 pPattern->SetConsumerIapIdL(iapId); |
|
5365 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
5366 CleanupStack::PopAndDestroy(pPattern); |
|
5367 StartActiveScheduler(1); |
|
5368 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
5369 // Connection is ready to be used. |
|
5370 |
|
5371 // 1. Chunk declaration |
|
5372 _LIT8( cid, "123456789@123456789" ); |
|
5373 _LIT( chunkName, "test chunk" ); |
|
5374 _LIT8( chunkContent, "Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1.Testing chunk1." ); |
|
5375 TInt chunkSize = 1000; |
|
5376 TInt chunkMaxSize = 5000; |
|
5377 TInt chunkOffset = 100; |
|
5378 TInt chunkDataSize = 150; |
|
5379 RChunk binaryDataChunk; |
|
5380 binaryDataChunk.CreateGlobal(chunkName(), chunkSize, chunkMaxSize); |
|
5381 CleanupClosePushL(binaryDataChunk); |
|
5382 TUint8* heapPtr = binaryDataChunk.Base(); |
|
5383 heapPtr = heapPtr + chunkOffset; |
|
5384 // Place a new descriptor in the chunk to initialize it |
|
5385 new (heapPtr-sizeof(TPtr8)) TPtr8(heapPtr, 0, chunkDataSize); |
|
5386 // Set the descriptor |
|
5387 TPtr8* pDes = reinterpret_cast<TPtr8*>(heapPtr-sizeof(TPtr8)); |
|
5388 pDes->Zero(); |
|
5389 pDes->Append(chunkContent); |
|
5390 |
|
5391 // 2. Chunk declaration |
|
5392 _LIT8( cid2, "xyz" ); |
|
5393 _LIT( chunkName2, "test chunk2" ); |
|
5394 _LIT8( chunkContent2, "Testing chunk2" ); |
|
5395 TInt chunkSize2 = 3000; |
|
5396 TInt chunkMaxSize2 = 10000; |
|
5397 TInt chunkOffset2 = 112; |
|
5398 TInt chunkDataSize2 = 14; |
|
5399 |
|
5400 RChunk binaryDataChunk2; |
|
5401 binaryDataChunk2.CreateGlobal(chunkName2(), chunkSize2, chunkMaxSize2); |
|
5402 CleanupClosePushL(binaryDataChunk2); |
|
5403 TUint8* heapPtr2 = binaryDataChunk2.Base(); |
|
5404 heapPtr2 = heapPtr2 + chunkOffset2; |
|
5405 // Place a new descriptor in the chunk to initialize it |
|
5406 new (heapPtr2-sizeof(TPtr8)) TPtr8(heapPtr2, 0, chunkDataSize2); |
|
5407 // Set the descriptor |
|
5408 TPtr8* pDes2 = reinterpret_cast<TPtr8*>(heapPtr2-sizeof(TPtr8)); |
|
5409 pDes2->Zero(); |
|
5410 pDes2->Append(chunkContent2); |
|
5411 |
|
5412 // 1. File declaration |
|
5413 _LIT8( cid3, "999999999@123456789" ); |
|
5414 _LIT( KTestFileName, "c:\\testing\\data\\Sunset.jpg" ); |
|
5415 RFs rfs; |
|
5416 User::LeaveIfError(rfs.Connect()); |
|
5417 CleanupClosePushL(rfs); |
|
5418 TInt retVal = rfs.ShareProtected(); |
|
5419 RFile file; |
|
5420 CleanupClosePushL(file); |
|
5421 User::LeaveIfError(file.Open(rfs, KTestFileName, EFileRead)); |
|
5422 |
|
5423 // 2. File declaration |
|
5424 _LIT8( cid4, "1z2" ); |
|
5425 _LIT( KTestFileName2, "c:\\testing\\data\\fileContainer2.txt" ); |
|
5426 _LIT8( KFileContent2, "Test FileContainer2" ); |
|
5427 RFs rfs2; |
|
5428 User::LeaveIfError(rfs2.Connect()); |
|
5429 CleanupClosePushL(rfs2); |
|
5430 retVal = rfs2.ShareProtected(); |
|
5431 RFile file2; |
|
5432 CleanupClosePushL(file2); |
|
5433 User::LeaveIfError(file2.Replace(rfs2, KTestFileName2, EFileWrite)); |
|
5434 User::LeaveIfError(file2.Write(KFileContent2)); |
|
5435 file2.Flush(); |
|
5436 file2.Close(); |
|
5437 User::LeaveIfError(file2.Open(rfs2, KTestFileName2, EFileRead)); |
|
5438 |
|
5439 // 3. File declaration |
|
5440 _LIT8( cid5, "999999999@12789" ); |
|
5441 _LIT( KTestFileName3, "c:\\testing\\data\\testPic4.jpg"); |
|
5442 RFs rfs3; |
|
5443 User::LeaveIfError(rfs3.Connect()); |
|
5444 CleanupClosePushL(rfs3); |
|
5445 retVal = rfs3.ShareProtected(); |
|
5446 RFile file3; |
|
5447 CleanupClosePushL(file3); |
|
5448 User::LeaveIfError(file3.Open(rfs3, KTestFileName3, EFileRead)); |
|
5449 |
|
5450 |
|
5451 // Create SOAPMessage |
|
5452 CSenSoapMessage2* pSOAPMessage = CSenSoapMessage2::NewL(ESOAP12); |
|
5453 _LIT8( KSoapActionValue, "http://schemas.live.com/mws/2005/08/contacts/Sync" ); |
|
5454 pSOAPMessage->SetSoapActionL(KSoapActionValue); |
|
5455 // CSenSoapMessage2* pSOAPMessage = CSenSoapMessage2::NewL(); // ESOAP11 |
|
5456 CleanupStack::PushL(pSOAPMessage); |
|
5457 |
|
5458 RSenDocument document = pSOAPMessage->AsDocumentL(); |
|
5459 |
|
5460 // Create BinaryContainers |
|
5461 TXmlEngChunkContainer chunkContainer = document.CreateChunkContainerL( |
|
5462 cid, |
|
5463 binaryDataChunk, |
|
5464 chunkOffset, |
|
5465 chunkDataSize); |
|
5466 TXmlEngChunkContainer chunkContainer2 = document.CreateChunkContainerL( |
|
5467 cid2, |
|
5468 binaryDataChunk2, |
|
5469 chunkOffset2, |
|
5470 chunkDataSize2); |
|
5471 TXmlEngChunkContainer chunkContainer3 = document.CreateChunkContainerL( |
|
5472 cid2, |
|
5473 binaryDataChunk2, |
|
5474 chunkOffset2, |
|
5475 chunkDataSize2); |
|
5476 TXmlEngFileContainer fileContainer = document.CreateFileContainerL(cid3, file); |
|
5477 TXmlEngFileContainer fileContainer2 = document.CreateFileContainerL(cid4, file2); |
|
5478 TXmlEngFileContainer fileContainer3 = document.CreateFileContainerL(cid5, file3); |
|
5479 |
|
5480 |
|
5481 // Get Envelope element |
|
5482 TXmlEngElement envelopeElement = pSOAPMessage->AsElementL(); |
|
5483 |
|
5484 // Create mime namespace declaration into Envelope element |
|
5485 // xmlns:xmlmime="http://www.w3.org/2004/11/xmlmime" |
|
5486 |
|
5487 |
|
5488 TXmlEngNamespace mimeNamespace = envelopeElement. AddNamespaceDeclarationL(_L8("http://www.w3.org/2005/05/xmlmime"), |
|
5489 _L8("xmlmime")); |
|
5490 |
|
5491 // TXmlEngNamespace mimeNamespace = envelopeElement. AddNamespaceDeclarationL(_L8("http://www.w3.org/2004/11/xmlmime"), |
|
5492 // _L8("mime")); // IE does not render XML where attribute name startes with "xml" (xmlmime) |
|
5493 |
|
5494 |
|
5495 // Create service specific namespace declaration into Body element |
|
5496 // xmlns:m="http://example.org/stuff" |
|
5497 TXmlEngNamespace serviceNamespace = pSOAPMessage->BodyL().AddNamespaceDeclarationL( |
|
5498 _L8("http://example.org/stuff"), |
|
5499 _L8("m")); |
|
5500 // Add data element into Body |
|
5501 // <S:Body xmlns:m="http://example.org/stuff"> |
|
5502 // <m:data> |
|
5503 // ... |
|
5504 // </m:data> |
|
5505 // </S:Body> |
|
5506 TXmlEngElement dataElement = pSOAPMessage->BodyL().AddNewElementL(_L8("data"), |
|
5507 serviceNamespace); |
|
5508 |
|
5509 // Add 1. attachment element into data element |
|
5510 // <m:data> |
|
5511 // <m:textAttachment1 xmlmime:contentType="text"> |
|
5512 // <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:123456789@123456789"/> |
|
5513 // </m:textAttachment1> |
|
5514 // ... |
|
5515 // </m:data> |
|
5516 TXmlEngElement attachmentElement1 = dataElement.AddNewElementL(_L8("textAttachment1"), |
|
5517 serviceNamespace); |
|
5518 attachmentElement1.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
5519 attachmentElement1.AppendChildL(chunkContainer); |
|
5520 |
|
5521 // Add 2. attachment element into data element |
|
5522 TXmlEngElement attachmentElement2 = dataElement.AddNewElementL(_L8("textAttachment2"), |
|
5523 serviceNamespace); |
|
5524 attachmentElement2.AddNewAttributeL(_L8("contentType"), _L8("image/png"), mimeNamespace); |
|
5525 attachmentElement2.AppendChildL(fileContainer); |
|
5526 |
|
5527 // Add 3. attachment element into data element |
|
5528 TXmlEngElement attachmentElement3 = dataElement.AddNewElementL(_L8("textAttachment3"), |
|
5529 serviceNamespace); |
|
5530 attachmentElement3.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
5531 attachmentElement3.AppendChildL(chunkContainer2); |
|
5532 |
|
5533 // Add 4. attachment element into data element |
|
5534 TXmlEngElement attachmentElement4 = dataElement.AddNewElementL(_L8("textAttachment4"), |
|
5535 serviceNamespace); |
|
5536 attachmentElement4.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
5537 attachmentElement4.AppendChildL(fileContainer2); |
|
5538 |
|
5539 // Add 5. attachment element inside data element |
|
5540 TXmlEngElement attachmentElement5 = dataElement.AddNewElementL(_L8("textAttachment5"), |
|
5541 serviceNamespace); |
|
5542 attachmentElement5.AddNewAttributeL(_L8("contentType"), _L8("text/plain"), mimeNamespace); |
|
5543 attachmentElement5.AppendChildL(chunkContainer3); |
|
5544 |
|
5545 // Add 6. attachment element into data element |
|
5546 TXmlEngElement attachmentElement6 = dataElement.AddNewElementL(_L8("textAttachment2"), |
|
5547 serviceNamespace); |
|
5548 attachmentElement6.AddNewAttributeL(_L8("contentType"), _L8("image/png"), mimeNamespace); |
|
5549 attachmentElement6.AppendChildL(fileContainer3); |
|
5550 |
|
5551 |
|
5552 // Http Post |
|
5553 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
5554 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
5555 HBufC8* pPropsAsXml = pHttpProperties->AsUtf8LC(); |
|
5556 iServiceConnection->SetTransportPropertiesL(*pPropsAsXml); |
|
5557 CleanupStack::PopAndDestroy(pPropsAsXml); |
|
5558 CleanupStack::PopAndDestroy(pHttpProperties); |
|
5559 |
|
5560 |
|
5561 CSenSoapEnvelope2* pRetMessage = NULL; |
|
5562 iServiceConnection->SubmitL(*pSOAPMessage, pRetMessage); |
|
5563 delete pRetMessage; |
|
5564 |
|
5565 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
5566 CleanupStack::PopAndDestroy(&file3); |
|
5567 CleanupStack::PopAndDestroy(&rfs3); |
|
5568 CleanupStack::PopAndDestroy(&file2); |
|
5569 CleanupStack::PopAndDestroy(&rfs2); |
|
5570 CleanupStack::PopAndDestroy(&file); |
|
5571 CleanupStack::PopAndDestroy(&rfs); |
|
5572 CleanupStack::PopAndDestroy(&binaryDataChunk2); |
|
5573 CleanupStack::PopAndDestroy(&binaryDataChunk); |
|
5574 |
|
5575 delete iServiceConnection; |
|
5576 iServiceConnection = NULL; |
|
5577 Teardown(); |
|
5578 return KErrNone; |
|
5579 } |
|
5580 |
|
5581 |
|
5582 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TestMessengerL( TTestResult& aResult ) |
|
5583 { |
|
5584 SetupL() ; |
|
5585 RegisterSTSL(); |
|
5586 |
|
5587 CreateConnectionToMessengerServiceL(); |
|
5588 |
|
5589 StartActiveScheduler(1); |
|
5590 |
|
5591 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
5592 TL(iServiceConnection != (CSenServiceConnection*)NULL); |
|
5593 |
|
5594 CSenVtcpTransportProperties* pProperties = CreateMSTransportPropertiesL(EMSNMessengerRegister); |
|
5595 CleanupStack::PushL(pProperties); |
|
5596 iServiceConnection->SetTransportPropertiesL(*pProperties->AsUtf8LC()); |
|
5597 CleanupStack::PopAndDestroy(); //pVtcpProperties->AsUtf8LC() |
|
5598 CleanupStack::PopAndDestroy(pProperties); |
|
5599 |
|
5600 TInt sendRetCode(KErrNone); |
|
5601 |
|
5602 // Send Register message to Messenger |
|
5603 CSenSoapMessage2* pSoapMessage = CreateMSSoapMessage(EMSNMessengerRegister); |
|
5604 CleanupStack::PushL(pSoapMessage); |
|
5605 |
|
5606 sendRetCode = iServiceConnection->SendL(*pSoapMessage); |
|
5607 LOCAL_ASSERT(sendRetCode > KErrNone); |
|
5608 |
|
5609 StartActiveScheduler(1); |
|
5610 |
|
5611 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
5612 CleanupStack::PopAndDestroy(pSoapMessage); |
|
5613 |
|
5614 // Send UnRegister message to Messenger |
|
5615 pSoapMessage = CreateMSSoapMessage(EMSNMessengerUnRegister); |
|
5616 CleanupStack::PushL(pSoapMessage); |
|
5617 |
|
5618 sendRetCode = iServiceConnection->SendL(*pSoapMessage); |
|
5619 LOCAL_ASSERT(sendRetCode > KErrNone); |
|
5620 |
|
5621 StartActiveScheduler(1); |
|
5622 |
|
5623 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
5624 CleanupStack::PopAndDestroy(pSoapMessage); |
|
5625 |
|
5626 delete iServiceConnection; |
|
5627 iServiceConnection = NULL; |
|
5628 Teardown(); |
|
5629 return KErrNone; |
|
5630 } |
|
5631 |
|
5632 |
|
5633 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TestMessenger2L( TTestResult& aResult ) |
|
5634 { |
|
5635 SetupL() ; |
|
5636 UnregisterSTSL(); |
|
5637 RegisterSTSL(); |
|
5638 |
|
5639 CreateConnectionToMessengerServiceL(); |
|
5640 |
|
5641 StartActiveScheduler(1); |
|
5642 |
|
5643 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
5644 TL(iServiceConnection != (CSenServiceConnection*)NULL); |
|
5645 |
|
5646 CSenVtcpTransportProperties* pProperties = CreateMSTransportPropertiesL(EMSNMessengerRegister); |
|
5647 CleanupStack::PushL(pProperties); |
|
5648 iServiceConnection->SetTransportPropertiesL(*pProperties->AsUtf8LC()); |
|
5649 CleanupStack::PopAndDestroy(); //pVtcpProperties->AsUtf8LC() |
|
5650 CleanupStack::PopAndDestroy(pProperties); |
|
5651 |
|
5652 TInt sendRetCode(KErrNone); |
|
5653 |
|
5654 // Send Register message to Messenger |
|
5655 CSenSoapMessage2* pSoapMessage = CreateMSSoapMessage(EMSNMessengerRegister); |
|
5656 CleanupStack::PushL(pSoapMessage); |
|
5657 |
|
5658 sendRetCode = iServiceConnection->SendL(*pSoapMessage); |
|
5659 LOCAL_ASSERT(sendRetCode > KErrNone); |
|
5660 |
|
5661 StartActiveScheduler(1); |
|
5662 |
|
5663 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
5664 CleanupStack::PopAndDestroy(pSoapMessage); |
|
5665 |
|
5666 // Send UnRegister message to Messenger |
|
5667 pSoapMessage = CreateMSSoapMessage(EMSNMessengerUnRegister); |
|
5668 CleanupStack::PushL(pSoapMessage); |
|
5669 |
|
5670 sendRetCode = iServiceConnection->SendL(*pSoapMessage); |
|
5671 LOCAL_ASSERT(sendRetCode > KErrNone); |
|
5672 |
|
5673 StartActiveScheduler(1); |
|
5674 |
|
5675 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
5676 CleanupStack::PopAndDestroy(pSoapMessage); |
|
5677 |
|
5678 CSenServiceManager* pManager = CSenServiceManager::NewLC(); |
|
5679 |
|
5680 // Get used IdentityProvider from ServiceConnection |
|
5681 CSenIdentityProvider* pIdp = NULL; |
|
5682 iServiceConnection->IdentityProviderL(pIdp); |
|
5683 CleanupStack::PushL(pIdp); |
|
5684 |
|
5685 // Get used Credential from Credentials DB |
|
5686 RCredentialArray credentialArray; |
|
5687 CleanupClosePushL(credentialArray); |
|
5688 RCredentialPropertiesArray credentialPropertiesArray; |
|
5689 CleanupClosePushL(credentialPropertiesArray); |
|
5690 LOCAL_ASSERT((pManager->CredentialsL(KMessagingEndpoint, *pIdp, |
|
5691 credentialArray, |
|
5692 credentialPropertiesArray)) == KErrNone); |
|
5693 |
|
5694 // Check that atleast one Credential were found. |
|
5695 LOCAL_ASSERT(credentialArray.Count() > 0); |
|
5696 |
|
5697 CleanupStack::Pop(&credentialPropertiesArray); |
|
5698 CleanupStack::Pop(&credentialArray); |
|
5699 CleanupStack::Pop(pIdp); |
|
5700 CleanupStack::PopAndDestroy(pManager); |
|
5701 |
|
5702 delete iServiceConnection; |
|
5703 iServiceConnection = NULL; |
|
5704 |
|
5705 CleanupStack::PushL(pIdp); |
|
5706 CleanupClosePushL(credentialArray); |
|
5707 CleanupClosePushL(credentialPropertiesArray); |
|
5708 |
|
5709 // Clean DBs STARTS |
|
5710 // 1) Unregister STS ServiceDescription and |
|
5711 // STS IdentityProvider |
|
5712 // => Unregistering IdentityProvider removes |
|
5713 // related Credentials from Credentials DB |
|
5714 // |
|
5715 UnregisterSTSL(); |
|
5716 |
|
5717 // 2) Unregister actual Service (= Messaging) ServiceDescription |
|
5718 pManager = CSenServiceManager::NewLC(); |
|
5719 CSenXmlServiceDescription* pPattern = CSenXmlServiceDescription::NewLC(); |
|
5720 pPattern->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
5721 pPattern->SetEndPointL(KMessagingEndpoint); |
|
5722 pPattern->SetContractL(KMessagingContract); |
|
5723 TInt error = pManager->UnregisterServiceDescriptionL( *pPattern); |
|
5724 CleanupStack::PopAndDestroy(pPattern); |
|
5725 CleanupStack::PopAndDestroy(pManager); |
|
5726 // Clean DBs ENDS |
|
5727 |
|
5728 RegisterSTSL(); |
|
5729 |
|
5730 pManager = CSenServiceManager::NewLC(); |
|
5731 |
|
5732 // Add Credential to Credentials DB |
|
5733 // => When Connection is initialized, working Credential |
|
5734 // should be found from Credentials DB |
|
5735 // => Working Credential should be used and |
|
5736 // request to get new SecurityToken should NOT be sent. |
|
5737 LOCAL_ASSERT((pManager->AddCredentialL(KMessagingEndpoint, |
|
5738 *pIdp, |
|
5739 *credentialArray[0], |
|
5740 *credentialPropertiesArray[0])) == KErrNone); |
|
5741 |
|
5742 CleanupStack::PopAndDestroy(pManager); |
|
5743 credentialPropertiesArray.ResetAndDestroy(); |
|
5744 CleanupStack::PopAndDestroy(&credentialPropertiesArray); |
|
5745 credentialArray.ResetAndDestroy(); |
|
5746 CleanupStack::PopAndDestroy(&credentialArray); |
|
5747 CleanupStack::PopAndDestroy(pIdp); |
|
5748 |
|
5749 CreateConnectionToMessengerServiceL(); |
|
5750 |
|
5751 StartActiveScheduler(1); |
|
5752 |
|
5753 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
5754 TL(iServiceConnection != (CSenServiceConnection*)NULL); |
|
5755 |
|
5756 pProperties = CreateMSTransportPropertiesL(EMSNMessengerRegister); |
|
5757 CleanupStack::PushL(pProperties); |
|
5758 iServiceConnection->SetTransportPropertiesL(*pProperties->AsUtf8LC()); |
|
5759 CleanupStack::PopAndDestroy(); //pVtcpProperties->AsUtf8LC() |
|
5760 CleanupStack::PopAndDestroy(pProperties); |
|
5761 |
|
5762 // Send Register message to Messenger |
|
5763 pSoapMessage = CreateMSSoapMessage(EMSNMessengerRegister); |
|
5764 CleanupStack::PushL(pSoapMessage); |
|
5765 |
|
5766 sendRetCode = iServiceConnection->SendL(*pSoapMessage); |
|
5767 LOCAL_ASSERT(sendRetCode > KErrNone); |
|
5768 |
|
5769 StartActiveScheduler(1); |
|
5770 |
|
5771 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
5772 CleanupStack::PopAndDestroy(pSoapMessage); |
|
5773 |
|
5774 // Send UnRegister message to Messenger |
|
5775 pSoapMessage = CreateMSSoapMessage(EMSNMessengerUnRegister); |
|
5776 CleanupStack::PushL(pSoapMessage); |
|
5777 |
|
5778 sendRetCode = iServiceConnection->SendL(*pSoapMessage); |
|
5779 LOCAL_ASSERT(sendRetCode > KErrNone); |
|
5780 |
|
5781 StartActiveScheduler(1); |
|
5782 |
|
5783 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
5784 CleanupStack::PopAndDestroy(pSoapMessage); |
|
5785 |
|
5786 delete iServiceConnection; |
|
5787 iServiceConnection = NULL; |
|
5788 Teardown(); |
|
5789 return KErrNone; |
|
5790 } |
|
5791 |
|
5792 |
|
5793 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TestMessenger3L( TTestResult& aResult ) |
|
5794 { |
|
5795 SetupL() ; |
|
5796 UnregisterSTSL(); |
|
5797 |
|
5798 CSenServiceManager* manager = CSenServiceManager::NewLC(); |
|
5799 _LIT8(KWsStarContract, "urn:wstar:sts"); |
|
5800 _LIT8(KAddressing, "http://schemas.xmlsoap.org/ws/2006/10/addressing"); |
|
5801 _LIT8(KInvalidPassportPass, "Invalid"); |
|
5802 |
|
5803 iAuthInfoAskCounter = 0; |
|
5804 //Create Identity provider for STS |
|
5805 ipProviderForAuthProvider = CSenIdentityProvider::NewL(KStsEndpoint); |
|
5806 ipProviderForAuthProvider->SetContractL(KWsStarContract);//(TDesC8) |
|
5807 ipProviderForAuthProvider->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
5808 ipProviderForAuthProvider->SetProviderID(KProviderId); |
|
5809 ipProviderForAuthProvider->SetUserInfoL( KPassportUser, KPassportUser, KPassportPass); |
|
5810 |
|
5811 //register Identity provider for STS |
|
5812 CSenIdentityProvider* pInvalidStsProvider = CSenIdentityProvider::NewLC(KStsEndpoint); |
|
5813 pInvalidStsProvider->SetContractL(KWsStarContract);//(TDesC8) |
|
5814 pInvalidStsProvider->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
5815 pInvalidStsProvider->SetProviderID(KProviderId); |
|
5816 pInvalidStsProvider->SetUserInfoL( KPassportUser, KPassportUser, KInvalidPassportPass); |
|
5817 //pInvalidStsProvider->AsElement().AddAttrL(_L8("promptUserInfo"),_L8("false")); |
|
5818 manager->RegisterIdentityProviderL( *pInvalidStsProvider ); |
|
5819 CleanupStack::PopAndDestroy(pInvalidStsProvider); |
|
5820 |
|
5821 //register SD for STS |
|
5822 CSenXmlServiceDescription* pattern = CSenXmlServiceDescription::NewLC();//KNullDesC8(), KWsStarContract); |
|
5823 pattern->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
5824 pattern->SetContractL(KWsStarContract); |
|
5825 pattern->SetEndPointL(KStsEndpoint); |
|
5826 pattern->AsElement().AddElementL(_L8("ProviderID")).SetContentL(KProviderId); |
|
5827 SetPolicyL(pattern, KPolicyAdr, KAddressing); //this RST2 |
|
5828 SetPolicyL(pattern, KPolicySOAP12, KNullDesC8); //this RST2 |
|
5829 |
|
5830 SetPolicyL(pattern, KPolicyMT, KMetadataEndpoint); |
|
5831 SetPolicyL(pattern, KPolicyPassExt, KNullDesC8); |
|
5832 SetPolicyL(pattern, KPolicyTLS, KNullDesC8); |
|
5833 TInt error = manager->RegisterServiceDescriptionL( *pattern); |
|
5834 |
|
5835 CleanupStack::PopAndDestroy(pattern); |
|
5836 CleanupStack::PopAndDestroy(manager); |
|
5837 |
|
5838 CreateConnectionToMessengerServiceL(); |
|
5839 |
|
5840 StartActiveScheduler(1); |
|
5841 |
|
5842 // Check that authentication info were asked exactly 3 times. |
|
5843 LOCAL_ASSERT(iAuthInfoAskCounter == 1); |
|
5844 |
|
5845 // |
|
5846 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady ); |
|
5847 TL(iServiceConnection != (CSenServiceConnection*)NULL); |
|
5848 |
|
5849 CSenVtcpTransportProperties* pProperties = CreateMSTransportPropertiesL(EMSNMessengerRegister); |
|
5850 CleanupStack::PushL(pProperties); |
|
5851 iServiceConnection->SetTransportPropertiesL(*pProperties->AsUtf8LC()); |
|
5852 CleanupStack::PopAndDestroy(); //pVtcpProperties->AsUtf8LC() |
|
5853 CleanupStack::PopAndDestroy(pProperties); |
|
5854 |
|
5855 TInt sendRetCode(KErrNone); |
|
5856 |
|
5857 // Send Register message to Messenger |
|
5858 CSenSoapMessage2* pSoapMessage = CreateMSSoapMessage(EMSNMessengerRegister); |
|
5859 CleanupStack::PushL(pSoapMessage); |
|
5860 |
|
5861 sendRetCode = iServiceConnection->SendL(*pSoapMessage); |
|
5862 LOCAL_ASSERT(sendRetCode > KErrNone); |
|
5863 |
|
5864 StartActiveScheduler(1); |
|
5865 |
|
5866 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
5867 CleanupStack::PopAndDestroy(pSoapMessage); |
|
5868 |
|
5869 // Send UnRegister message to Messenger |
|
5870 pSoapMessage = CreateMSSoapMessage(EMSNMessengerUnRegister); |
|
5871 CleanupStack::PushL(pSoapMessage); |
|
5872 |
|
5873 sendRetCode = iServiceConnection->SendL(*pSoapMessage); |
|
5874 LOCAL_ASSERT(sendRetCode > KErrNone); |
|
5875 |
|
5876 StartActiveScheduler(1); |
|
5877 |
|
5878 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
5879 CleanupStack::PopAndDestroy(pSoapMessage); |
|
5880 |
|
5881 delete iServiceConnection; |
|
5882 iServiceConnection = NULL; |
|
5883 |
|
5884 delete ipProviderForAuthProvider; |
|
5885 ipProviderForAuthProvider = NULL; |
|
5886 Teardown(); |
|
5887 return KErrNone; |
|
5888 } |
|
5889 |
|
5890 |
|
5891 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TestMessenger4L( TTestResult& aResult ) |
|
5892 { |
|
5893 SetupL() ; |
|
5894 UnregisterSTSL(); |
|
5895 |
|
5896 CSenServiceManager* manager = CSenServiceManager::NewLC(); |
|
5897 _LIT8(KWsStarContract, "urn:wstar:sts"); |
|
5898 _LIT8(KAddressing, "http://schemas.xmlsoap.org/ws/2006/10/addressing"); |
|
5899 _LIT8(KInvalidPassportPass, "Invalid"); |
|
5900 |
|
5901 iAuthInfoAskCounter = 0; |
|
5902 //Create Identity provider for STS |
|
5903 ipProviderForAuthProvider = CSenIdentityProvider::NewL(KStsEndpoint); |
|
5904 ipProviderForAuthProvider->SetContractL(KWsStarContract);//(TDesC8) |
|
5905 ipProviderForAuthProvider->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
5906 ipProviderForAuthProvider->SetProviderID(KProviderId); |
|
5907 ipProviderForAuthProvider->SetUserInfoL( KPassportUser, KPassportUser, KInvalidPassportPass); |
|
5908 |
|
5909 //register Identity provider for STS |
|
5910 CSenIdentityProvider* pInvalidStsProvider = CSenIdentityProvider::NewLC(KStsEndpoint); |
|
5911 pInvalidStsProvider->SetContractL(KWsStarContract);//(TDesC8) |
|
5912 pInvalidStsProvider->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
5913 pInvalidStsProvider->SetProviderID(KProviderId); |
|
5914 pInvalidStsProvider->SetUserInfoL( KPassportUser, KPassportUser, KInvalidPassportPass); |
|
5915 manager->RegisterIdentityProviderL( *pInvalidStsProvider ); |
|
5916 CleanupStack::PopAndDestroy(pInvalidStsProvider); |
|
5917 |
|
5918 //register SD for STS |
|
5919 CSenXmlServiceDescription* pattern = CSenXmlServiceDescription::NewLC();//KNullDesC8(), KWsStarContract); |
|
5920 pattern->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
5921 pattern->SetContractL(KWsStarContract); |
|
5922 pattern->SetEndPointL(KStsEndpoint); |
|
5923 pattern->AsElement().AddElementL(_L8("ProviderID")).SetContentL(KProviderId); |
|
5924 SetPolicyL(pattern, KPolicyAdr, KAddressing); //this RST2 |
|
5925 SetPolicyL(pattern, KPolicySOAP12, KNullDesC8); //this RST2 |
|
5926 |
|
5927 SetPolicyL(pattern, KPolicyMT, KMetadataEndpoint); |
|
5928 SetPolicyL(pattern, KPolicyPassExt, KNullDesC8); |
|
5929 SetPolicyL(pattern, KPolicyTLS, KNullDesC8); |
|
5930 TInt error = manager->RegisterServiceDescriptionL( *pattern); |
|
5931 |
|
5932 CleanupStack::PopAndDestroy(pattern); |
|
5933 CleanupStack::PopAndDestroy(manager); |
|
5934 |
|
5935 CreateConnectionToMessengerServiceL(); |
|
5936 |
|
5937 StartActiveScheduler(1); |
|
5938 |
|
5939 // Check that authentication info were asked exactly 3 times. |
|
5940 LOCAL_ASSERT(iAuthInfoAskCounter == 3); |
|
5941 |
|
5942 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusCreateFailed ); |
|
5943 |
|
5944 delete iServiceConnection; |
|
5945 iServiceConnection = NULL; |
|
5946 |
|
5947 delete ipProviderForAuthProvider; |
|
5948 ipProviderForAuthProvider = NULL; |
|
5949 Teardown(); |
|
5950 return KErrNone; |
|
5951 } |
|
5952 |
|
5953 |
|
5954 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TestMessenger5L( TTestResult& aResult ) |
|
5955 { |
|
5956 SetupL() ; |
|
5957 UnregisterSTSL(); |
|
5958 CSenServiceManager* manager = CSenServiceManager::NewLC(); |
|
5959 _LIT8(KWsStarContract, "urn:wstar:sts"); |
|
5960 _LIT8(KAddressing, "http://schemas.xmlsoap.org/ws/2006/10/addressing"); |
|
5961 _LIT8(KInvalidPassportPass, "Invalid"); |
|
5962 |
|
5963 iAuthInfoAskCounter = 0; |
|
5964 //Create Identity provider for STS |
|
5965 ipProviderForAuthProvider = CSenIdentityProvider::NewL(KStsEndpoint); |
|
5966 ipProviderForAuthProvider->SetContractL(KWsStarContract);//(TDesC8) |
|
5967 ipProviderForAuthProvider->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
5968 ipProviderForAuthProvider->SetProviderID(KProviderId); |
|
5969 ipProviderForAuthProvider->SetUserInfoL( KPassportUser, KPassportUser, KInvalidPassportPass); |
|
5970 |
|
5971 //register Identity provider for STS |
|
5972 CSenIdentityProvider* pInvalidStsProvider = CSenIdentityProvider::NewLC(KStsEndpoint); |
|
5973 pInvalidStsProvider->SetContractL(KWsStarContract);//(TDesC8) |
|
5974 pInvalidStsProvider->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
5975 pInvalidStsProvider->SetProviderID(KProviderId); |
|
5976 pInvalidStsProvider->SetUserInfoL( KPassportUser, KPassportUser, KInvalidPassportPass); |
|
5977 pInvalidStsProvider->AsElement().AddAttrL(_L8("promptUserInfo"),_L8("false")); |
|
5978 manager->RegisterIdentityProviderL( *pInvalidStsProvider ); |
|
5979 CleanupStack::PopAndDestroy(pInvalidStsProvider); |
|
5980 |
|
5981 //register SD for STS |
|
5982 CSenXmlServiceDescription* pattern = CSenXmlServiceDescription::NewLC();//KNullDesC8(), KWsStarContract); |
|
5983 pattern->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
5984 pattern->SetContractL(KWsStarContract); |
|
5985 pattern->SetEndPointL(KStsEndpoint); |
|
5986 pattern->AsElement().AddElementL(_L8("ProviderID")).SetContentL(KProviderId); |
|
5987 SetPolicyL(pattern, KPolicyAdr, KAddressing); //this RST2 |
|
5988 SetPolicyL(pattern, KPolicySOAP12, KNullDesC8); //this RST2 |
|
5989 |
|
5990 SetPolicyL(pattern, KPolicyMT, KMetadataEndpoint); |
|
5991 SetPolicyL(pattern, KPolicyPassExt, KNullDesC8); |
|
5992 SetPolicyL(pattern, KPolicyTLS, KNullDesC8); |
|
5993 TInt error = manager->RegisterServiceDescriptionL( *pattern); |
|
5994 |
|
5995 CleanupStack::PopAndDestroy(pattern); |
|
5996 CleanupStack::PopAndDestroy(manager); |
|
5997 |
|
5998 CreateConnectionToMessengerServiceL(); |
|
5999 |
|
6000 StartActiveScheduler(1); |
|
6001 |
|
6002 // Check that authentication info were asked exactly 3 times. |
|
6003 LOCAL_ASSERT( iAuthInfoAskCounter == 0 ); |
|
6004 |
|
6005 LOCAL_ASSERT( iConnectionState == KSenConnectionStatusCreateFailed ); |
|
6006 |
|
6007 delete iServiceConnection; |
|
6008 iServiceConnection = NULL; |
|
6009 |
|
6010 delete ipProviderForAuthProvider; |
|
6011 ipProviderForAuthProvider = NULL; |
|
6012 Teardown(); |
|
6013 return KErrNone; |
|
6014 } |
|
6015 |
|
6016 |
|
6017 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TestMessenger6L( TTestResult& aResult ) |
|
6018 { |
|
6019 SetupL() ; |
|
6020 CSenServiceManager* manager = CSenServiceManager::NewLC(); |
|
6021 _LIT8(KWsStarContract, "urn:wstar:sts"); |
|
6022 _LIT8(KAddressing, "http://schemas.xmlsoap.org/ws/2006/10/addressing"); |
|
6023 _LIT8(KInvalidPassportPass, "Invalid"); |
|
6024 |
|
6025 //register Identity provider for STS |
|
6026 CSenIdentityProvider* pInvalidStsProvider = CSenIdentityProvider::NewLC(KStsEndpoint); |
|
6027 pInvalidStsProvider->SetContractL(KWsStarContract);//(TDesC8) |
|
6028 pInvalidStsProvider->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
6029 pInvalidStsProvider->SetProviderID(KProviderId); |
|
6030 pInvalidStsProvider->SetUserInfoL( KPassportUser, KPassportUser, KInvalidPassportPass); |
|
6031 manager->RegisterIdentityProviderL( *pInvalidStsProvider ); |
|
6032 CleanupStack::PopAndDestroy(pInvalidStsProvider); |
|
6033 |
|
6034 //register SD for STS |
|
6035 CSenXmlServiceDescription* pattern = CSenXmlServiceDescription::NewLC();//KNullDesC8(), KWsStarContract); |
|
6036 pattern->SetFrameworkIdL(KDefaultWSStarFrameworkID); |
|
6037 pattern->SetContractL(KWsStarContract); |
|
6038 pattern->SetEndPointL(KStsEndpoint); |
|
6039 pattern->AsElement().AddElementL(_L8("ProviderID")).SetContentL(KProviderId); |
|
6040 SetPolicyL(pattern, KPolicyAdr, KAddressing); //this RST2 |
|
6041 SetPolicyL(pattern, KPolicySOAP12, KNullDesC8); //this RST2 |
|
6042 |
|
6043 SetPolicyL(pattern, KPolicyMT, KMetadataEndpoint); |
|
6044 SetPolicyL(pattern, KPolicyPassExt, KNullDesC8); |
|
6045 SetPolicyL(pattern, KPolicyTLS, KNullDesC8); |
|
6046 TInt error = manager->RegisterServiceDescriptionL( *pattern); |
|
6047 |
|
6048 CleanupStack::PopAndDestroy(pattern); |
|
6049 CleanupStack::PopAndDestroy(manager); |
|
6050 |
|
6051 CreateConnectionToMessengerServiceWithoutCallbackL(); |
|
6052 |
|
6053 StartActiveScheduler(1); |
|
6054 |
|
6055 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
6056 TL(iServiceConnection != (CSenServiceConnection*)NULL); |
|
6057 |
|
6058 CSenVtcpTransportProperties* pProperties = CreateMSTransportPropertiesL(EMSNMessengerRegister); |
|
6059 CleanupStack::PushL(pProperties); |
|
6060 iServiceConnection->SetTransportPropertiesL(*pProperties->AsUtf8LC()); |
|
6061 CleanupStack::PopAndDestroy(); //pVtcpProperties->AsUtf8LC() |
|
6062 CleanupStack::PopAndDestroy(pProperties); |
|
6063 |
|
6064 TInt sendRetCode(KErrNone); |
|
6065 |
|
6066 // Send Register message to Messenger |
|
6067 CSenSoapMessage2* pSoapMessage = CreateMSSoapMessage(EMSNMessengerRegister); |
|
6068 CleanupStack::PushL(pSoapMessage); |
|
6069 |
|
6070 sendRetCode = iServiceConnection->SendL(*pSoapMessage); |
|
6071 LOCAL_ASSERT(sendRetCode > KErrNone); |
|
6072 |
|
6073 StartActiveScheduler(1); |
|
6074 |
|
6075 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
6076 CleanupStack::PopAndDestroy(pSoapMessage); |
|
6077 |
|
6078 // Send UnRegister message to Messenger |
|
6079 pSoapMessage = CreateMSSoapMessage(EMSNMessengerUnRegister); |
|
6080 CleanupStack::PushL(pSoapMessage); |
|
6081 |
|
6082 sendRetCode = iServiceConnection->SendL(*pSoapMessage); |
|
6083 LOCAL_ASSERT(sendRetCode > KErrNone); |
|
6084 |
|
6085 StartActiveScheduler(1); |
|
6086 |
|
6087 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
6088 CleanupStack::PopAndDestroy(pSoapMessage); |
|
6089 |
|
6090 delete iServiceConnection; |
|
6091 iServiceConnection = NULL; |
|
6092 Teardown(); |
|
6093 return KErrNone; |
|
6094 } |
|
6095 |
|
6096 |
|
6097 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TestMessenger7L( TTestResult& aResult ) |
|
6098 { |
|
6099 SetupL() ; |
|
6100 // Create one "fake" ServiceManager instance which keeps |
|
6101 // Serene server up and running through whole test case. |
|
6102 CSenServiceManager* manager = CSenServiceManager::NewLC(); |
|
6103 |
|
6104 UnregisterSTSL(); |
|
6105 RegisterSTSL(); |
|
6106 |
|
6107 CreateConnectionToMessengerServiceL(); |
|
6108 |
|
6109 StartActiveScheduler(1); |
|
6110 |
|
6111 LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
6112 TL(iServiceConnection != (CSenServiceConnection*)NULL); |
|
6113 |
|
6114 CSenVtcpTransportProperties* pProperties = CreateMSTransportPropertiesL(EMSNMessengerRegister); |
|
6115 CleanupStack::PushL(pProperties); |
|
6116 iServiceConnection->SetTransportPropertiesL(*pProperties->AsUtf8LC()); |
|
6117 CleanupStack::PopAndDestroy(); //pVtcpProperties->AsUtf8LC() |
|
6118 CleanupStack::PopAndDestroy(pProperties); |
|
6119 |
|
6120 TInt sendRetCode(KErrNone); |
|
6121 |
|
6122 // Send Register message to Messenger |
|
6123 CSenSoapMessage2* pSoapMessage = CreateMSSoapMessage(EMSNMessengerRegister); |
|
6124 CleanupStack::PushL(pSoapMessage); |
|
6125 |
|
6126 sendRetCode = iServiceConnection->SendL(*pSoapMessage); |
|
6127 LOCAL_ASSERT(sendRetCode > KErrNone); |
|
6128 |
|
6129 StartActiveScheduler(1); |
|
6130 |
|
6131 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
6132 CleanupStack::PopAndDestroy(pSoapMessage); |
|
6133 |
|
6134 // Send UnRegister message to Messenger |
|
6135 pSoapMessage = CreateMSSoapMessage(EMSNMessengerUnRegister); |
|
6136 CleanupStack::PushL(pSoapMessage); |
|
6137 |
|
6138 sendRetCode = iServiceConnection->SendL(*pSoapMessage); |
|
6139 LOCAL_ASSERT(sendRetCode > KErrNone); |
|
6140 |
|
6141 StartActiveScheduler(1); |
|
6142 |
|
6143 LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
6144 CleanupStack::PopAndDestroy(pSoapMessage); |
|
6145 |
|
6146 delete iServiceConnection; |
|
6147 iServiceConnection = NULL; |
|
6148 |
|
6149 // Clean DBs STARTS |
|
6150 // 1) Unregister STS IdentityProvider |
|
6151 // => Unregistering IdentityProvider removes |
|
6152 // related Credentials from Credentials DB |
|
6153 // |
|
6154 UnregisterSTSL(); |
|
6155 // Clean DBs ENDS |
|
6156 |
|
6157 RegisterSTSInvalidPasswordL(); |
|
6158 |
|
6159 CreateConnectionToMessengerServiceL(); |
|
6160 |
|
6161 StartActiveScheduler(1); |
|
6162 |
|
6163 LOCAL_ASSERT( iConnectionState == KSenConnectionStatusCreateFailed ); |
|
6164 LOCAL_ASSERT( iCallback == ECallbackHandleError ); |
|
6165 LOCAL_ASSERT( iErrorCode == -30320 ); // -30320 = KErrSenFailedAuthentication |
|
6166 |
|
6167 delete iServiceConnection; |
|
6168 iServiceConnection = NULL; |
|
6169 |
|
6170 CleanupStack::PopAndDestroy(manager); |
|
6171 Teardown(); |
|
6172 return KErrNone; |
|
6173 } |
|
6174 |
|
6175 |
|
6176 int CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Custom_Header(const TDesC8& KCustomHttpHeader, |
|
6177 const TDesC8& KCustomHttpHeaderValue) |
|
6178 { |
|
6179 SetupL() ; |
|
6180 // Set custom HTTP header |
|
6181 // 1. Declare CUSTOM_HTTP_HEADER_NAME and CUSTOM_HTTP_HEADER_VALUE |
|
6182 // 2. Get TP using SC:TransportPropertiesL() |
|
6183 // 3. SendL(MSG, TP::CUSTOM_HTTP_HEADER) // see that CUSTOM_HTTP_HEADER -field is present |
|
6184 // 4. Check from HTTP Transaction logger log that CUSTOM_HTTP_HEADER was used. |
|
6185 |
|
6186 CSenServicePattern* pPattern = CSenServicePattern::NewLC(KAuthServEndpoint, KNullDesC8()); |
|
6187 pPattern->SetFrameworkIdL(*ipFrameworkID); |
|
6188 |
|
6189 iServiceConnection = CSenServiceConnection::NewL(*this, *pPattern); |
|
6190 |
|
6191 CleanupStack::PopAndDestroy(pPattern); |
|
6192 |
|
6193 StartActiveScheduler(1); |
|
6194 //LOCAL_ASSERT(iConnectionState == KSenConnectionStatusReady); |
|
6195 if(iConnectionState != KSenConnectionStatusReady) return KErrCouldNotConnect; |
|
6196 // Connection is ready to be used. |
|
6197 |
|
6198 // 2. Get TP using SC:TransportPropertiesL() |
|
6199 HBufC8* pTransportPropertiesAsXml = NULL; |
|
6200 iServiceConnection->TransportPropertiesL(pTransportPropertiesAsXml); |
|
6201 if ( pTransportPropertiesAsXml ) |
|
6202 { |
|
6203 delete pTransportPropertiesAsXml; |
|
6204 } |
|
6205 |
|
6206 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
6207 |
|
6208 // 3. SendL(MSG) // with custom header |
|
6209 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
6210 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, KFileName); |
|
6211 pHttpProperties->SetHttpHeaderL(KCustomHttpHeader, KCustomHttpHeaderValue); |
|
6212 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
6213 pHttpProperties->SetIapIdL(iapId); |
|
6214 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
6215 CleanupStack::PushL(pSerializedProperties); |
|
6216 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
6217 StartActiveScheduler(1); |
|
6218 //LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
6219 |
|
6220 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
6221 CleanupStack::PopAndDestroy(pHttpProperties); |
|
6222 |
|
6223 //4. Check from HTTP Transaction logger log that CUSTOM_HTTP_HEADER was used. |
|
6224 HBufC8* pFileContent = ReadFileL(KFileToRead); |
|
6225 //LOCAL_ASSERT(pFileContent != NULL); |
|
6226 if (pFileContent == NULL) return KErrNotFound; |
|
6227 CleanupStack::PushL(pFileContent); |
|
6228 HBufC8* pValue = HttpPropertyValueFromXmlLC(*pFileContent, KCustomHttpHeader); |
|
6229 //LOCAL_ASSERT(pValue == NULL); |
|
6230 if(pValue == NULL) return KErrNotFound; |
|
6231 CleanupStack::PopAndDestroy(pValue); |
|
6232 CleanupStack::PopAndDestroy(pFileContent); |
|
6233 |
|
6234 |
|
6235 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
6236 |
|
6237 |
|
6238 delete iServiceConnection; |
|
6239 iServiceConnection = NULL; |
|
6240 |
|
6241 return KErrNone; |
|
6242 Teardown(); |
|
6243 return KErrNone; |
|
6244 } |
|
6245 |
|
6246 |
|
6247 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_Send(const TDesC8& aLogFileName, const TDesC8& aCustomHttpHeader, |
|
6248 const TDesC8& aCustomHttpHeaderValue, CSenServiceConnection* iServiceConnection) |
|
6249 { |
|
6250 SetupL() ; |
|
6251 TInt result = KErrNone; |
|
6252 CSenSoapMessage* pSOAPMessage = CreateAuthRequestLC(); |
|
6253 |
|
6254 // SendL(MSG) // with custom header |
|
6255 CSenHttpTransportProperties* pHttpProperties = CSenHttpTransportProperties::NewLC(); |
|
6256 pHttpProperties->SetHttpHeaderL(KLoggerFileNameProperty, aLogFileName); |
|
6257 pHttpProperties->SetHttpHeaderL(aCustomHttpHeader, aCustomHttpHeaderValue); |
|
6258 TUint32 iapId = SearchIAPIdByNameL(KIAPName); |
|
6259 pHttpProperties->SetIapIdL(iapId); |
|
6260 HBufC8* pSerializedProperties = pHttpProperties->AsUtf8L(); |
|
6261 CleanupStack::PushL(pSerializedProperties); |
|
6262 iServiceConnection->SendL(*pSOAPMessage, *pSerializedProperties); |
|
6263 StartActiveScheduler(1); |
|
6264 //LOCAL_ASSERT(iCallback == ECallbackHandleMessage); |
|
6265 if(iCallback != ECallbackHandleMessage) return KErrGeneral; |
|
6266 |
|
6267 CleanupStack::PopAndDestroy(pSerializedProperties); |
|
6268 CleanupStack::PopAndDestroy(pHttpProperties); |
|
6269 CleanupStack::PopAndDestroy(pSOAPMessage); |
|
6270 return result; |
|
6271 Teardown(); |
|
6272 return KErrNone; |
|
6273 } |
|
6274 |
|
6275 |
|
6276 |
|
6277 TInt CSenServiceConnectionBCTest::UT_CSenServiceConnection_TP_CheckLogs(const TDesC& aLogFilePath, const TDesC8& aCustomHttpHeader, const TDesC8& aCustomHttpHeaderValue) |
|
6278 { |
|
6279 SetupL() ; |
|
6280 TInt result = KErrNone; |
|
6281 HBufC8* pFileContent = ReadFileL(aLogFilePath); |
|
6282 //LOCAL_ASSERT(pFileContent != NULL); |
|
6283 if (pFileContent == NULL) return KErrNotFound; |
|
6284 |
|
6285 CleanupStack::PushL(pFileContent); |
|
6286 HBufC8* pValue = HttpPropertyValueFromXmlLC(*pFileContent, aCustomHttpHeader); |
|
6287 //LOCAL_ASSERT(*pValue == aCustomHttpHeaderValue); |
|
6288 if (*pValue != aCustomHttpHeaderValue) return KErrNotFound; |
|
6289 |
|
6290 CleanupStack::PopAndDestroy(pValue); |
|
6291 CleanupStack::PopAndDestroy(pFileContent); |
|
6292 |
|
6293 return result; |
|
6294 Teardown(); |
|
6295 return KErrNone; |
|
6296 } |
|
6297 |
|
6298 |
|
6299 |
|
6300 HBufC8* CSenServiceConnectionBCTest::HttpMethodValueFromXmlLC(const TDesC8& aXml) |
|
6301 { |
|
6302 SetupL() ; |
|
6303 CSenXmlReader* pReader = CSenXmlReader::NewL(); |
|
6304 CleanupStack::PushL(pReader); |
|
6305 CSenDomFragment* pDom = CSenDomFragment::NewL(); |
|
6306 CleanupStack::PushL(pDom); |
|
6307 pReader->SetContentHandler(*pDom); |
|
6308 pDom->SetReader(*pReader); |
|
6309 pReader->ParseL(aXml); |
|
6310 |
|
6311 CSenElement& element = pDom->AsElement(); |
|
6312 CSenElement* pRequestElement = element.Element(_L8("Request")); |
|
6313 CSenElement* pTPElement = pRequestElement->Element(_L8("Method")); |
|
6314 |
|
6315 HBufC8* pRetBuf = pTPElement->Content().AllocL(); |
|
6316 |
|
6317 CleanupStack::PopAndDestroy(pDom); |
|
6318 CleanupStack::PopAndDestroy(pReader); |
|
6319 |
|
6320 CleanupStack::PushL(pRetBuf); |
|
6321 |
|
6322 return pRetBuf; |
|
6323 Teardown(); |
|
6324 return KErrNone; |
|
6325 } |
|
6326 */ |
|
6327 TInt CSenServiceConnectionBCTest::SendL( TTestResult& aResult ) { |
|
6328 TInt res; |
|
6329 _LIT8(KReq,"request"); |
|
6330 CTestConnection* pTest = CTestConnection::NewL(); |
|
6331 |
|
6332 res = pTest->SendL(KReq); |
|
6333 //CleanupStack::Pop(pTest); |
|
6334 delete pTest; |
|
6335 return res; |
|
6336 } |
|
6337 TInt CSenServiceConnectionBCTest::SubmitL( TTestResult& aResult ) { |
|
6338 TInt res; |
|
6339 _LIT8(KReq,"request"); |
|
6340 CTestConnection* pTest = CTestConnection::NewL();//*this); |
|
6341 |
|
6342 HBufC8* pBuf = HBufC8::NewL(256); |
|
6343 res = pTest->SubmitL(KReq,pBuf); |
|
6344 //CleanupStack::Pop(pTest); |
|
6345 delete pTest; |
|
6346 delete pBuf; |
|
6347 return res; |
|
6348 } |
|
6349 TInt CSenServiceConnectionBCTest::IsReady( TTestResult& aResult ) { |
|
6350 TInt res; |
|
6351 TBool ready; |
|
6352 CTestConnection* pTest = CTestConnection::NewL(); |
|
6353 res = pTest->IsReady(ready); |
|
6354 //CleanupStack::Pop(pTest); |
|
6355 delete pTest; |
|
6356 return res; |
|
6357 |
|
6358 } |
|
6359 TInt CSenServiceConnectionBCTest::HasFacetL( TTestResult& aResult ) { |
|
6360 TInt res; |
|
6361 _LIT8(KUri,"test uri"); |
|
6362 TBool HasFacet; |
|
6363 CTestConnection* pTest = CTestConnection::NewL(); |
|
6364 |
|
6365 res = pTest->HasFacetL(KUri,HasFacet); |
|
6366 //CleanupStack::Pop(pTest); |
|
6367 delete pTest; |
|
6368 return res; |
|
6369 |
|
6370 } |
|
6371 TInt CSenServiceConnectionBCTest::CompleteServerMessagesOnOff( TTestResult& aResult ) { |
|
6372 TInt res; |
|
6373 TBool CompleteOnOff(TRUE); |
|
6374 CTestConnection* pTest = CTestConnection::NewL(); |
|
6375 |
|
6376 res = pTest->CompleteServerMessagesOnOff(CompleteOnOff); |
|
6377 //CleanupStack::Pop(pTest); |
|
6378 delete pTest; |
|
6379 return res; |
|
6380 |
|
6381 } |
|
6382 TInt CSenServiceConnectionBCTest::Send2L( TTestResult& aResult ) { |
|
6383 TInt res; |
|
6384 CTestConnection* pTest = CTestConnection::NewL(); |
|
6385 |
|
6386 CSenSoapEnvelope* pEnv= CSenSoapEnvelope::NewL(); |
|
6387 res = pTest->SendL(*pEnv); |
|
6388 // CleanupStack::Pop(pTest); |
|
6389 delete pTest; |
|
6390 delete pEnv; |
|
6391 return res; |
|
6392 |
|
6393 } |
|
6394 TInt CSenServiceConnectionBCTest::Submit2L( TTestResult& aResult ) { |
|
6395 TInt res; |
|
6396 CTestConnection* pTest = CTestConnection::NewL(); |
|
6397 |
|
6398 CSenSoapEnvelope* pEnv= CSenSoapEnvelope::NewL(); |
|
6399 HBufC8* pBuf = HBufC8::NewL(256); |
|
6400 res = pTest->SubmitL(*pEnv,pBuf); |
|
6401 // CleanupStack::Pop(pTest); |
|
6402 delete pTest; |
|
6403 delete pEnv; |
|
6404 delete pBuf; |
|
6405 return res; |
|
6406 |
|
6407 } |
|
6408 TInt CSenServiceConnectionBCTest::ServiceDescriptionL( TTestResult& aResult ) { |
|
6409 TInt res; |
|
6410 CTestConnection* pTest = CTestConnection::NewL(); |
|
6411 |
|
6412 HBufC8* pSD = HBufC8::NewL(256); |
|
6413 res = pTest->ServiceDescriptionL(pSD); |
|
6414 // CleanupStack::Pop(pTest); |
|
6415 delete pTest; |
|
6416 delete pSD; |
|
6417 return res; |
|
6418 |
|
6419 } |
|
6420 TInt CSenServiceConnectionBCTest::StartTransaction( TTestResult& aResult ) { |
|
6421 TInt res; |
|
6422 CTestConnection* pTest = CTestConnection::NewL(); |
|
6423 |
|
6424 res = pTest->StartTransaction(); |
|
6425 // CleanupStack::Pop(pTest); |
|
6426 delete pTest; |
|
6427 return res; |
|
6428 |
|
6429 } |
|
6430 TInt CSenServiceConnectionBCTest::TransactionCompleted( TTestResult& aResult ) { |
|
6431 TInt res; |
|
6432 CTestConnection* pTest = CTestConnection::NewL(); |
|
6433 |
|
6434 res = pTest->TransactionCompleted(); |
|
6435 // CleanupStack::Pop(pTest); |
|
6436 delete pTest; |
|
6437 return res; |
|
6438 |
|
6439 } |
|
6440 TInt CSenServiceConnectionBCTest::TxnId( TTestResult& aResult ) { |
|
6441 TInt res; |
|
6442 CTestConnection* pTest = CTestConnection::NewL(); |
|
6443 |
|
6444 res = pTest->TxnId(); |
|
6445 // CleanupStack::Pop(pTest); |
|
6446 delete pTest; |
|
6447 return res; |
|
6448 |
|
6449 } |
|
6450 TInt CSenServiceConnectionBCTest::SetTransportPropertiesL( TTestResult& aResult ) { |
|
6451 TInt res; |
|
6452 _LIT8(KProperties,"properties"); |
|
6453 CTestConnection* pTest = CTestConnection::NewL(); |
|
6454 |
|
6455 res = pTest->SetTransportPropertiesL(KProperties); |
|
6456 // CleanupStack::Pop(pTest); |
|
6457 delete pTest; |
|
6458 return res; |
|
6459 |
|
6460 } |
|
6461 TInt CSenServiceConnectionBCTest::TransportPropertiesL( TTestResult& aResult ) { |
|
6462 TInt res; |
|
6463 CTestConnection* pTest = CTestConnection::NewL(); |
|
6464 |
|
6465 HBufC8* pProps = HBufC8::NewL(256); |
|
6466 res = pTest->TransportPropertiesL(pProps); |
|
6467 // CleanupStack::Pop(pTest); |
|
6468 delete pTest; |
|
6469 delete pProps ; |
|
6470 return res; |
|
6471 |
|
6472 } |
|
6473 TInt CSenServiceConnectionBCTest::Send3L( TTestResult& aResult ) { |
|
6474 TInt res; |
|
6475 _LIT8(KReq,"request"); |
|
6476 _LIT8(KProps,"PRoperties"); |
|
6477 CTestConnection* pTest = CTestConnection::NewL(); |
|
6478 |
|
6479 res = pTest->SendL(KReq,KProps); |
|
6480 // CleanupStack::Pop(pTest); |
|
6481 delete pTest; |
|
6482 return res; |
|
6483 } |
|
6484 TInt CSenServiceConnectionBCTest::Submit3L( TTestResult& aResult ) { |
|
6485 TInt res; |
|
6486 _LIT8(KReq,"request"); |
|
6487 _LIT8(KProps,"PRoperties"); |
|
6488 CTestConnection* pTest = CTestConnection::NewL(); |
|
6489 HBufC8* pRes = HBufC8::NewL(256); |
|
6490 |
|
6491 res = pTest->SubmitL(KReq,KProps,pRes); |
|
6492 // CleanupStack::Pop(pTest); |
|
6493 delete pTest; |
|
6494 delete pRes; |
|
6495 return res; |
|
6496 |
|
6497 } |
|
6498 TInt CSenServiceConnectionBCTest::Send4L( TTestResult& aResult ) { |
|
6499 TInt res; |
|
6500 _LIT8(KProps,"PRoperties"); |
|
6501 CTestConnection* pTest = CTestConnection::NewL(); |
|
6502 CSenSoapEnvelope* pEnv= CSenSoapEnvelope::NewL(); |
|
6503 |
|
6504 res = pTest->SendL(*pEnv,KProps); |
|
6505 // CleanupStack::Pop(pTest); |
|
6506 delete pTest; |
|
6507 delete pEnv; |
|
6508 return res; |
|
6509 |
|
6510 } |
|
6511 TInt CSenServiceConnectionBCTest::Submit4L( TTestResult& aResult ) { |
|
6512 TInt res; |
|
6513 _LIT8(KProps,"PRoperties"); |
|
6514 CTestConnection* pTest = CTestConnection::NewL(); |
|
6515 CSenSoapEnvelope* pEnv= CSenSoapEnvelope::NewL(); |
|
6516 |
|
6517 HBufC8* pRes = HBufC8::NewL(256); |
|
6518 res = pTest->SubmitL(*pEnv,KProps,pRes); |
|
6519 // CleanupStack::Pop(pTest); |
|
6520 delete pTest; |
|
6521 delete pEnv; |
|
6522 return res; |
|
6523 |
|
6524 } |
|
6525 TInt CSenServiceConnectionBCTest::Send5L( TTestResult& aResult ) { |
|
6526 TInt res; |
|
6527 CTestConnection* pTest = CTestConnection::NewL(); |
|
6528 MSenMessage* pMsg = NULL; |
|
6529 res = pTest->SendL(*pMsg ); |
|
6530 // CleanupStack::Pop(pTest); |
|
6531 delete pTest; |
|
6532 return res; |
|
6533 |
|
6534 } |
|
6535 TInt CSenServiceConnectionBCTest::Submit5L( TTestResult& aResult ) { |
|
6536 TInt res; |
|
6537 CTestConnection* pTest = CTestConnection::NewL(); |
|
6538 MSenMessage* pMsg = NULL; |
|
6539 CSenSoapEnvelope2* pEnv = NULL; |
|
6540 res = pTest->SubmitL(*pMsg, pEnv); |
|
6541 // CleanupStack::Pop(pTest); |
|
6542 delete pTest; |
|
6543 return res; |
|
6544 |
|
6545 } |
|
6546 TInt CSenServiceConnectionBCTest::Response( TTestResult& aResult ) { |
|
6547 TInt res; |
|
6548 CTestConnection* pTest = CTestConnection::NewL(); |
|
6549 MSenMessage* pMsg; |
|
6550 TRAP(res, pTest->Response()); |
|
6551 // CleanupStack::Pop(pTest); |
|
6552 delete pTest; |
|
6553 return res; |
|
6554 |
|
6555 } |
|
6556 TInt CSenServiceConnectionBCTest::CancelTransaction( TTestResult& aResult ) { |
|
6557 TInt res; |
|
6558 CTestConnection* pTest = CTestConnection::NewL(); |
|
6559 |
|
6560 res = pTest->CancelTransaction(1) ; |
|
6561 // CleanupStack::Pop(pTest); |
|
6562 delete pTest; |
|
6563 return res; |
|
6564 |
|
6565 } |
|
6566 TInt CSenServiceConnectionBCTest::IdentityProvider1L( TTestResult& aResult ) { |
|
6567 TInt res; |
|
6568 CTestConnection* pTest = CTestConnection::NewL(); |
|
6569 CSenIdentityProvider* pProv = NULL; |
|
6570 res = pTest->IdentityProviderL(pProv ) ; |
|
6571 // CleanupStack::Pop(pTest); |
|
6572 delete pTest; |
|
6573 return res; |
|
6574 |
|
6575 } |
|
6576 TInt CSenServiceConnectionBCTest::Identifier( TTestResult& aResult ) { |
|
6577 TInt res; |
|
6578 CTestConnection* pTest = CTestConnection::NewL(); |
|
6579 |
|
6580 res = pTest->Identifier(); |
|
6581 // CleanupStack::Pop(pTest); |
|
6582 delete pTest; |
|
6583 return res; |
|
6584 |
|
6585 } |
|
6586 |
|
6587 TInt CSenServiceConnectionBCTest::Name( TTestResult& aResult ) { |
|
6588 CTestProperty* pTest = CTestProperty::NewL(); |
|
6589 |
|
6590 TPtrC8 name = pTest->Name(); |
|
6591 // CleanupStack::Pop(pTest); |
|
6592 delete pTest; |
|
6593 if(name == _L8("")) |
|
6594 return KErrNone; |
|
6595 else |
|
6596 return KErrArgument; |
|
6597 } |
|
6598 |
|
6599 TInt CSenServiceConnectionBCTest::Type( TTestResult& aResult ) { |
|
6600 CTestProperty* pTest = CTestProperty::NewL(); |
|
6601 |
|
6602 TPtrC8 type = pTest->Type(); |
|
6603 // CleanupStack::Pop(pTest); |
|
6604 delete pTest; |
|
6605 if(type == _L8("")) |
|
6606 return KErrNone; |
|
6607 else |
|
6608 return KErrArgument; |
|
6609 } |
|
6610 |
|
6611 TInt CSenServiceConnectionBCTest::Value( TTestResult& aResult ) { |
|
6612 CTestProperty* pTest = CTestProperty::NewL(); |
|
6613 |
|
6614 TPtrC8 value = pTest->Value(); |
|
6615 // CleanupStack::Pop(pTest); |
|
6616 delete pTest; |
|
6617 if(value == _L8("")) |
|
6618 return KErrNone; |
|
6619 else |
|
6620 return KErrArgument; |
|
6621 } |
|
6622 |
|
6623 TInt CSenServiceConnectionBCTest::IntValue( TTestResult& aResult ) { |
|
6624 CTestProperty* pTest = CTestProperty::NewL(); |
|
6625 TInt value(1); |
|
6626 TInt val = pTest->IntValue(value); |
|
6627 // CleanupStack::Pop(pTest); |
|
6628 delete pTest; |
|
6629 return val; |
|
6630 } |
|
6631 |
|
6632 TInt CSenServiceConnectionBCTest::BoolValue( TTestResult& aResult ) { |
|
6633 CTestProperty* pTest = CTestProperty::NewL(); |
|
6634 TBool value(TRUE); |
|
6635 TInt val = pTest->BoolValue(value); |
|
6636 // CleanupStack::Pop(pTest); |
|
6637 delete pTest; |
|
6638 return val; |
|
6639 } |
|
6640 |
|
6641 TInt CSenServiceConnectionBCTest::ValueTokensL( TTestResult& aResult ) { |
|
6642 RPointerArray<TPtrC8> tokens; |
|
6643 CTestProperty* pTest = CTestProperty::NewL(); |
|
6644 |
|
6645 TInt val = pTest->ValueTokensL(_L8(""),tokens); |
|
6646 // CleanupStack::Pop(pTest); |
|
6647 delete pTest; |
|
6648 return val; |
|
6649 } |
|
6650 |
|
6651 TInt CSenServiceConnectionBCTest::IdentityProvider2L( TTestResult& aResult ) |
|
6652 { |
|
6653 CTestProvider* pTest = CTestProvider::NewL(); |
|
6654 |
|
6655 TRAPD(ret,pTest->IdentityProviderL()); |
|
6656 // CleanupStack::Pop(pTest); |
|
6657 delete pTest; |
|
6658 // delete Pprov ; |
|
6659 return ret; |
|
6660 } |
|
6661 TInt CSenServiceConnectionBCTest::Username1L( TTestResult& aResult ) |
|
6662 { |
|
6663 CTestProvider* pTest = CTestProvider::NewL(); |
|
6664 |
|
6665 TPtrC8 uname = pTest->UsernameL(); |
|
6666 // CleanupStack::Pop(pTest); |
|
6667 delete pTest; |
|
6668 if(uname == _L8("")) |
|
6669 return KErrNone; |
|
6670 else |
|
6671 return KErrArgument; |
|
6672 } |
|
6673 |
|
6674 TInt CSenServiceConnectionBCTest::Password1L( TTestResult& aResult ) |
|
6675 { |
|
6676 CTestProvider* pTest = CTestProvider::NewL(); |
|
6677 |
|
6678 TPtrC8 pwd = pTest->PasswordL(); |
|
6679 // CleanupStack::Pop(pTest); |
|
6680 delete pTest; |
|
6681 if(pwd == _L8("")) |
|
6682 return KErrNone; |
|
6683 else |
|
6684 return KErrArgument; |
|
6685 } |
|
6686 TInt CSenServiceConnectionBCTest::ExtendedInterface1L( TTestResult& aResult ) |
|
6687 { |
|
6688 CTestProvider* pTest = CTestProvider::NewL(); |
|
6689 TRAPD(ret,pTest->ExtendedInterface(10)); |
|
6690 |
|
6691 delete pTest; |
|
6692 |
|
6693 return ret; |
|
6694 } |
|
6695 TInt CSenServiceConnectionBCTest::TransferProgress( TTestResult& aResult ) |
|
6696 { |
|
6697 CTestFileObserver* pTest = CTestFileObserver::NewL(); |
|
6698 TRAPD(ret,pTest->TransferProgress()); |
|
6699 |
|
6700 delete pTest; |
|
6701 |
|
6702 return ret; |
|
6703 } |
|
6704 TInt CSenServiceConnectionBCTest::HandleMeassage(TTestResult& aResult) |
|
6705 { |
|
6706 CTestConsumer* pTest = CTestConsumer::NewL(); |
|
6707 TRAPD(ret,pTest->HandleMessageL()); |
|
6708 |
|
6709 delete pTest; |
|
6710 |
|
6711 return ret; |
|
6712 } |
|
6713 TInt CSenServiceConnectionBCTest::HandleErrorL(TTestResult& aResult) |
|
6714 { |
|
6715 CTestConsumer* pTest = CTestConsumer::NewL(); |
|
6716 TRAPD(ret,pTest->HandleErrorL()); |
|
6717 |
|
6718 delete pTest; |
|
6719 |
|
6720 return ret; |
|
6721 } |
|
6722 TInt CSenServiceConnectionBCTest::SetStatus(TTestResult& aResult) |
|
6723 { |
|
6724 CTestConsumer* pTest = CTestConsumer::NewL(); |
|
6725 TRAPD(ret,pTest->SetStatus()); |
|
6726 |
|
6727 delete pTest; |
|
6728 |
|
6729 return ret; |
|
6730 } |
|
6731 |
|
6732 #ifdef __ENABLE_ALR__ |
|
6733 TInt CSenServiceConnectionBCTest::ALRL(TTestResult& aResult) |
|
6734 { |
|
6735 iLog->Log(_L("ALR->start")); |
|
6736 SetupL(); |
|
6737 |
|
6738 iUseALR = ETrue; |
|
6739 iAlrCallBackRetryCount =0; |
|
6740 isNewCarrierAccepted = EFalse; |
|
6741 isMigratedToPrefferedCarrier= EFalse; |
|
6742 |
|
6743 TInt retVal(KErrNone); |
|
6744 _LIT8(KReq,"<ab:Query xmlns:ab=\"urn:nokia:test:addrbook:2004-09\">Some Query</ab:Query>"); |
|
6745 _LIT8(KEndPoint, "http://10.21.32.110/sereneHardCoded/WS_CM_001_001"); |
|
6746 |
|
6747 iSenXmlServiceDescription = CSenServicePattern::NewL(); |
|
6748 iSenXmlServiceDescription->SetFrameworkIdL(KRESTFrameworkID); |
|
6749 iSenXmlServiceDescription->SetEndPointL(KEndPoint); |
|
6750 |
|
6751 iSOAPMessage = CSenSoapMessage::NewL(ESOAP11); |
|
6752 iSOAPMessage->SetBodyL(KReq); |
|
6753 |
|
6754 iServiceConnection = CSenServiceConnection::NewL(*this, *iSenXmlServiceDescription, *this); |
|
6755 TL(iServiceConnection != (CSenServiceConnection*)NULL); |
|
6756 iLog->Log(_L("ALR->TL(iServiceConnection != (CSenServiceConnection*)NULL);")); |
|
6757 StartActiveScheduler(1); |
|
6758 iLog->Log(_L("ALR->CSenServiceConnection::NewL(*this, *iSenXmlServiceDescription, *this);")); |
|
6759 |
|
6760 iALRSC = (MSenAlrServiceConnection*) iServiceConnection->InterfaceByUid(KSenInterfaceUidAlrServiceConnection); |
|
6761 iLog->Log(_L("iServiceConnection->InterfaceByUid(KSenInterfaceUidAlrServiceConnection")); |
|
6762 |
|
6763 TInt ret = iServiceConnection->SendL(*iSOAPMessage); |
|
6764 StartActiveScheduler(1); |
|
6765 |
|
6766 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
6767 iSenXmlServiceDescription = NULL; |
|
6768 |
|
6769 __ASSERT_ALWAYS_NO_LEAVE(delete iSOAPMessage); |
|
6770 iSOAPMessage = NULL; |
|
6771 |
|
6772 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
6773 iServiceConnection = NULL; |
|
6774 |
|
6775 iUseALR = EFalse; |
|
6776 iAlrCallBackRetryCount =0; |
|
6777 isNewCarrierAccepted = EFalse; |
|
6778 isMigratedToPrefferedCarrier= EFalse; |
|
6779 |
|
6780 Teardown(); |
|
6781 iLog->Log(_L("ALR->End")); |
|
6782 } |
|
6783 |
|
6784 //mobility methods |
|
6785 void CSenServiceConnectionBCTest::PreferredCarrierAvailable( TAccessPointInfo aOldAPInfo, |
|
6786 TAccessPointInfo aNewAPInfo, |
|
6787 TBool aIsUpgrade, |
|
6788 TBool aIsSeamless ) |
|
6789 { |
|
6790 iLog->Log(_L("PreferredCarrierAvailable.")); |
|
6791 iLog->Log(_L("PreferredCarrierAvailable Callback received")); |
|
6792 |
|
6793 TBuf<32> oldBuff; |
|
6794 oldBuff.Append(_L("With Old IAPID: ")); |
|
6795 oldBuff.AppendNum(aOldAPInfo.AccessPoint()); |
|
6796 |
|
6797 TBuf<32> newBuff; |
|
6798 newBuff.Append(_L("With New IAPID: ")); |
|
6799 newBuff.AppendNum(aNewAPInfo.AccessPoint()); |
|
6800 |
|
6801 TBool userChoice(EFalse) ; |
|
6802 if(aIsUpgrade) |
|
6803 { |
|
6804 iLog->Log(_L("it is upgrade")); |
|
6805 } |
|
6806 else |
|
6807 { |
|
6808 iLog->Log(_L("it is not upgrade")); |
|
6809 } |
|
6810 if(aIsSeamless) |
|
6811 { |
|
6812 iLog->Log(_L("it is seemless")); |
|
6813 iLog->Log(_L("in S60 3.2, this situation cannot occur")); |
|
6814 } |
|
6815 else |
|
6816 { |
|
6817 iLog->Log(_L("it is not seemless")); |
|
6818 iLog->Log(_L("calling MigrateToPrefferedCarrierL() with user choice ETrue")); |
|
6819 |
|
6820 userChoice = ETrue ;// pressed yes, accept |
|
6821 //pressed no, reject |
|
6822 iALRSC->MigrateToPrefferedCarrierL(userChoice); |
|
6823 isMigratedToPrefferedCarrier = ETrue; |
|
6824 if (userChoice != EFalse) |
|
6825 { |
|
6826 iLog->Log(_L("userChoice is Yes")); |
|
6827 iLog->Log(_L("Migrating to New Carrier")); |
|
6828 } |
|
6829 else |
|
6830 { |
|
6831 iLog->Log(_L("userChoice is No")); |
|
6832 iLog->Log(_L("Ignoring New Carrier")); |
|
6833 } |
|
6834 } |
|
6835 } |
|
6836 |
|
6837 void CSenServiceConnectionBCTest::NewCarrierActive( TAccessPointInfo aNewAPInfo, TBool aIsSeamless ) |
|
6838 { |
|
6839 iLog->Log(_L("NewCarrierActive Callback received")); |
|
6840 |
|
6841 TBuf<32> buff; |
|
6842 buff.Append(_L("With New IAPID: ")); |
|
6843 buff.AppendNum(aNewAPInfo.AccessPoint()); |
|
6844 |
|
6845 |
|
6846 TBool userChoice(EFalse) ; |
|
6847 if (aIsSeamless) |
|
6848 { |
|
6849 // in S60 3.2, this situation cannot occur. |
|
6850 iLog->Log(_L("it is seemless")); |
|
6851 iLog->Log(_L("in S60 3.2, this situation cannot occur")); |
|
6852 } |
|
6853 else |
|
6854 { |
|
6855 iLog->Log(_L("it is not seemless")); |
|
6856 iLog->Log(_L("calling NewCarrierAcceptedL() with user choice ETrue")); |
|
6857 userChoice = ETrue ;// pressed yes, accept |
|
6858 // pressed no, reject |
|
6859 |
|
6860 iALRSC->NewCarrierAcceptedL(userChoice); |
|
6861 isNewCarrierAccepted = ETrue; |
|
6862 if (userChoice != EFalse) |
|
6863 { |
|
6864 iLog->Log(_L("userChoice is Yes")); |
|
6865 iLog->Log(_L("New Carrier is accepted")); |
|
6866 } |
|
6867 else |
|
6868 { |
|
6869 iLog->Log(_L("userChoice is No")); |
|
6870 iLog->Log(_L("New Carrier is rejected")); |
|
6871 } |
|
6872 } |
|
6873 } |
|
6874 |
|
6875 void CSenServiceConnectionBCTest::Error(TInt aError) |
|
6876 { |
|
6877 iLog->Log(_L("mobility Error()")); |
|
6878 TBuf<24> numbuf; |
|
6879 numbuf.Append(_L("With Error: ")); |
|
6880 numbuf.AppendNum(aError); |
|
6881 iLog->Log(_L("mobility Error() received")); |
|
6882 } |
|
6883 #endif //__ENABLE_ALR__ |
|
6884 |
|
6885 TInt CSenServiceConnectionBCTest::CoBrandL(TTestResult& aResult) |
|
6886 { |
|
6887 |
|
6888 iLog->Log(_L("CoBrand->start")); |
|
6889 SetupL(); |
|
6890 |
|
6891 TInt retVal(0); |
|
6892 iCoBrandingCallbackOption = ETrue; |
|
6893 |
|
6894 _LIT8(KFramework, "WS-STAR"); |
|
6895 _LIT8(KIdpEndPoint, "http://10.21.32.20/wsstar/cobranding/STS_CB_001.aspx"); |
|
6896 _LIT8(KSdEndPoint, "http://10.21.32.20/WSStar/Trust/WSService.aspx"); |
|
6897 _LIT8(KIdpContract, "urn:wstar:sts:2004-04"); |
|
6898 _LIT8(KSmSdContract, "urn:wstar:sts"); |
|
6899 _LIT8(KSdContract, "messenger.msn.com"); |
|
6900 |
|
6901 _LIT8(KProviderId, "provider01"); |
|
6902 _LIT8(KPassportUser, "john"); |
|
6903 _LIT8(KPassportPass, "password"); |
|
6904 |
|
6905 _LIT8(KTokenType, "TokenType"); |
|
6906 _LIT8(KTokenTypeVal, "http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1"); |
|
6907 _LIT8(KPassportExtensions, "PassportExtensions "); |
|
6908 |
|
6909 _LIT8(KReq,"<ab:Query xmlns:ab=\"urn:nokia:test:addrbook:2004-09\">test request</ab:Query>"); |
|
6910 iSOAPMessage = CSenSoapMessage::NewL(ESOAP11); |
|
6911 iSOAPMessage->SetBodyL(KReq); |
|
6912 |
|
6913 CSenServiceManager* manager = CSenServiceManager::NewLC(); |
|
6914 TL(manager != (CSenServiceManager*)NULL); |
|
6915 iLog->Log(_L("CSenServiceManager* manager = CSenServiceManager::NewLC()")); |
|
6916 //register Identity provider for STS |
|
6917 CSenIdentityProvider* idp = CSenIdentityProvider::NewLC(KIdpEndPoint); |
|
6918 idp->SetContractL(KIdpContract); |
|
6919 idp->SetFrameworkIdL(KFramework); |
|
6920 idp->SetProviderID(KProviderId); |
|
6921 idp->SetUserInfoL( KPassportUser, KPassportUser, KPassportPass); |
|
6922 iLog->Log(_L("CSenIdentityProvider::NewLC(KIdpEndPoint)")); |
|
6923 manager->RegisterIdentityProviderL( *idp); |
|
6924 iLog->Log(_L("manager->RegisterIdentityProviderL( *idp)")); |
|
6925 |
|
6926 CSenXmlServiceDescription* pSmSd = CSenXmlServiceDescription::NewLC(); |
|
6927 pSmSd->SetFrameworkIdL(KFramework); |
|
6928 pSmSd->SetContractL(KSmSdContract); |
|
6929 pSmSd->SetEndPointL(KIdpEndPoint); |
|
6930 pSmSd->AsElement().AddElementL(_L8("ProviderID")).SetContentL(_L8("provider01")); |
|
6931 SetPolicyL(pSmSd, KPolicySOAP12, KNullDesC8); |
|
6932 SetPolicyL(pSmSd, KTokenType, KTokenTypeVal); |
|
6933 SetPolicyL(pSmSd, KPassportExtensions, KNullDesC8); |
|
6934 iLog->Log(_L("CSenXmlServiceDescription* pSmSd = CSenXmlServiceDescription::NewLC()")); |
|
6935 TInt error = manager->RegisterServiceDescriptionL( *pSmSd); |
|
6936 iLog->Log(_L("manager->RegisterServiceDescriptionL( *pSmSd);")); |
|
6937 |
|
6938 CSenXmlServiceDescription* pScSd = CSenServicePattern::NewLC(); |
|
6939 pScSd->SetFrameworkIdL(KFramework); |
|
6940 pScSd->SetContractL(KSdContract); |
|
6941 pScSd->SetEndPointL(KSdEndPoint); |
|
6942 pScSd->AsElement().AddElementL(_L8("ProviderID")).SetContentL(_L8("provider01")); |
|
6943 iLog->Log(_L("CSenXmlServiceDescription* pScSd = CSenXmlServiceDescription::NewLC();")); |
|
6944 |
|
6945 // create connection |
|
6946 iServiceConnection = CSenServiceConnection::NewL(*this, *pScSd, *this); |
|
6947 iLog->Log(_L("Starting ----->StartActiveScheduler(1);")); |
|
6948 StartActiveScheduler(1); |
|
6949 TL(iServiceConnection != (CSenServiceConnection*)NULL); |
|
6950 iLog->Log(_L("iServiceConnection = CSenServiceConnection::NewL(*this, *pScSd, *this);")); |
|
6951 |
|
6952 TBool isReady(EFalse); |
|
6953 TInt ret = iServiceConnection->IsReady(isReady); |
|
6954 if(isReady) |
|
6955 { |
|
6956 ret = iServiceConnection->SendL(*iSOAPMessage); |
|
6957 |
|
6958 iLog->Log(_L("iServiceConnection->SendL(*iSOAPMessage);")); |
|
6959 |
|
6960 StartActiveScheduler(1); |
|
6961 } |
|
6962 iLog->Log(_L("StartActiveScheduler(1);")); |
|
6963 |
|
6964 CleanupStack::PopAndDestroy(pScSd); |
|
6965 CleanupStack::PopAndDestroy(pSmSd); |
|
6966 CleanupStack::PopAndDestroy(idp); |
|
6967 CleanupStack::PopAndDestroy(manager); |
|
6968 |
|
6969 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
6970 iServiceConnection = NULL; |
|
6971 |
|
6972 __ASSERT_ALWAYS_NO_LEAVE(delete iSOAPMessage); |
|
6973 iSOAPMessage = NULL; |
|
6974 |
|
6975 iCoBrandingCallbackOption = EFalse; |
|
6976 Teardown(); |
|
6977 iLog->Log(_L("CoBrand->End")); |
|
6978 return KErrNone; |
|
6979 } |
|
6980 |
|
6981 TBool CSenServiceConnectionBCTest::OnGetBrandIdL( const TDesC8& aBrandIdListAsXmlSnippet, RBuf8& aSelectedBrandId) |
|
6982 { |
|
6983 iLog->Log(_L("CSenServiceConnectionBCTest::OnGetBrandIdL()-----> Start")); |
|
6984 if(iCoBrandingCallbackOption && (aBrandIdListAsXmlSnippet != _L8(""))) |
|
6985 { |
|
6986 iLog->Log(_L("CSenServiceConnectionBCTest::OnGetBrandIdL()True----->End ")); |
|
6987 return ETrue; |
|
6988 } |
|
6989 else |
|
6990 { |
|
6991 iLog->Log(_L("CSenServiceConnectionBCTest::OnGetBrandIdL() False----->End ")); |
|
6992 return EFalse; |
|
6993 } |
|
6994 } |
|
6995 |
|
6996 TInt CSenServiceConnectionBCTest::HostletConsumerL(TTestResult& aResult) |
|
6997 { |
|
6998 iLog->Log(_L("HostletConsumer->start")); |
|
6999 SetupL(); |
|
7000 |
|
7001 iHostletConsumerOption = ETrue; |
|
7002 |
|
7003 TInt retVal(KErrNone); |
|
7004 _LIT8(KReq,"<ab:Query xmlns:ab=\"urn:nokia:test:addrbook:2004-09\">Some Query</ab:Query>"); |
|
7005 _LIT8(KEndPoint, "http://10.21.32.110/sereneHardCoded/WS_CM_001_001"); |
|
7006 |
|
7007 iSenXmlServiceDescription = CSenServicePattern::NewL(); |
|
7008 iSenXmlServiceDescription->SetFrameworkIdL(KRESTFrameworkID); |
|
7009 iSenXmlServiceDescription->SetEndPointL(KEndPoint); |
|
7010 |
|
7011 iSOAPMessage = CSenSoapMessage::NewL(ESOAP11); |
|
7012 iSOAPMessage->SetBodyL(KReq); |
|
7013 |
|
7014 iServiceConnection = CSenServiceConnection::NewL(*this, *iSenXmlServiceDescription, *this); |
|
7015 TL(iServiceConnection != (CSenServiceConnection*)NULL); |
|
7016 iLog->Log(_L("HostletConsumer->TL(iServiceConnection != (CSenServiceConnection*)NULL);")); |
|
7017 StartActiveScheduler(1); |
|
7018 iLog->Log(_L("HostletConsumer->CSenServiceConnection::NewL(*this, *iSenXmlServiceDescription, *this);")); |
|
7019 |
|
7020 TInt ret = iServiceConnection->SendL(*iSOAPMessage); |
|
7021 StartActiveScheduler(1); |
|
7022 |
|
7023 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
7024 iSenXmlServiceDescription = NULL; |
|
7025 |
|
7026 __ASSERT_ALWAYS_NO_LEAVE(delete iSOAPMessage); |
|
7027 iSOAPMessage = NULL; |
|
7028 |
|
7029 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
7030 iServiceConnection = NULL; |
|
7031 |
|
7032 iHostletConsumerOption = EFalse; |
|
7033 |
|
7034 Teardown(); |
|
7035 iLog->Log(_L("HostletConsumer->End")); |
|
7036 } |
|
7037 |
|
7038 void CSenServiceConnectionBCTest::SetConnectionId( TInt aConnectionId ) |
|
7039 { |
|
7040 TInt connectonId = 0; |
|
7041 connectonId = aConnectionId; |
|
7042 } |
|
7043 |
|
7044 TInt CSenServiceConnectionBCTest::DataTrafficDetailsL(TTestResult& aResult) |
|
7045 { |
|
7046 iLog->Log(_L("DataTrafficDetails->start")); |
|
7047 SetupL(); |
|
7048 |
|
7049 iGetDataTrafficDetails = ETrue; |
|
7050 |
|
7051 TInt retVal(KErrNone); |
|
7052 _LIT8(KReq,"<ab:Query xmlns:ab=\"urn:nokia:test:addrbook:2004-09\">Some Query</ab:Query>"); |
|
7053 _LIT8(KEndPoint, "http://10.21.32.110/sereneHardCoded/WS_CM_001_001"); |
|
7054 |
|
7055 iSenXmlServiceDescription = CSenServicePattern::NewL(); |
|
7056 iSenXmlServiceDescription->SetFrameworkIdL(KRESTFrameworkID); |
|
7057 iSenXmlServiceDescription->SetEndPointL(KEndPoint); |
|
7058 |
|
7059 iSOAPMessage = CSenSoapMessage::NewL(ESOAP11); |
|
7060 iSOAPMessage->SetBodyL(KReq); |
|
7061 |
|
7062 iServiceConnection = CSenServiceConnection::NewL(*this, *iSenXmlServiceDescription, *this); |
|
7063 TL(iServiceConnection != (CSenServiceConnection*)NULL); |
|
7064 iLog->Log(_L("DataTrafficDetails->TL(iServiceConnection != (CSenServiceConnection*)NULL);")); |
|
7065 StartActiveScheduler(1); |
|
7066 iLog->Log(_L("DataTrafficDetails->CSenServiceConnection::NewL(*this, *iSenXmlServiceDescription, *this);")); |
|
7067 |
|
7068 TInt ret = iServiceConnection->SendL(*iSOAPMessage); |
|
7069 StartActiveScheduler(1); |
|
7070 |
|
7071 __ASSERT_ALWAYS_NO_LEAVE(delete iSenXmlServiceDescription); |
|
7072 iSenXmlServiceDescription = NULL; |
|
7073 |
|
7074 __ASSERT_ALWAYS_NO_LEAVE(delete iSOAPMessage); |
|
7075 iSOAPMessage = NULL; |
|
7076 |
|
7077 __ASSERT_ALWAYS_NO_LEAVE(delete iServiceConnection); |
|
7078 iServiceConnection = NULL; |
|
7079 |
|
7080 iGetDataTrafficDetails = EFalse; |
|
7081 |
|
7082 Teardown(); |
|
7083 iLog->Log(_L("HostletConsumer->End")); |
|
7084 } |