author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:06:03 +0300 | |
branch | RCL_3 |
changeset 65 | 0b68a1b0c15e |
parent 58 | ea43c23d28d2 |
child 66 | a9c0808a1095 |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2002 - 2007 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 the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: ?Description |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
#include <e32svr.h> |
|
23 |
#include <f32file.h> |
|
24 |
#include <StifParser.h> |
|
25 |
#include <e32std.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
26 |
#include <StifTestInterface.h> |
19 | 27 |
#include <liwgenericparam.h> |
28 |
#include <liwservicehandler.h> |
|
29 |
#include <liwvariant.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
30 |
#include <EPos_CPosLandmarkDatabase.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
31 |
#include <EPos_CPosLandmark.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
32 |
#include <EPos_CPosLandmarkEncoder.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
33 |
#include <EPos_CPosLmCategoryManager.h> |
19 | 34 |
#include <EPos_HPosLmDatabaseInfo.h> |
35 |
#include <EPos_CPosLmDatabaseManager.h> |
|
36 |
#include <lbsposition.h> |
|
37 |
#include "landmarkliwparams.hrh" |
|
38 |
#include "tlandmark_provider.h" |
|
39 |
#include "getlist.h" |
|
40 |
#include "serviceerrno.h" |
|
41 |
||
42 |
// EXTERNAL DATA STRUCTURES |
|
43 |
//extern ?external_data; |
|
44 |
||
45 |
// EXTERNAL FUNCTION PROTOTYPES |
|
46 |
//extern ?external_function( ?arg_type,?arg_type ); |
|
47 |
||
48 |
// CONSTANTS |
|
49 |
//const ?type ?constant_var = ?constant; |
|
50 |
||
51 |
// MACROS |
|
52 |
//#define ?macro ?macro_def |
|
53 |
||
54 |
// LOCAL CONSTANTS AND MACROS |
|
55 |
//const ?type ?constant_var = ?constant; |
|
56 |
//#define ?macro_name ?macro_def |
|
57 |
||
58 |
// MODULE DATA STRUCTURES |
|
59 |
//enum ?declaration |
|
60 |
//typedef ?declaration |
|
61 |
||
62 |
// LOCAL FUNCTION PROTOTYPES |
|
63 |
//?type ?function_name( ?arg_type, ?arg_type ); |
|
64 |
||
65 |
// FORWARD DECLARATIONS |
|
66 |
||
67 |
TInt AddLandMark(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface,const TDesC &landmark_name,const TDesC &landmark_description); |
|
68 |
TInt AddCategory(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface,const TDesC &category_name); |
|
69 |
void GetCatId(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface,const TDesC &category_name); |
|
70 |
void GetLandMarkId(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface,const TDesC &landmark_name,const TDesC &landmark_description); |
|
71 |
TInt RemoveLandmark(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface); |
|
72 |
TInt RemoveCategory(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface); |
|
73 |
||
74 |
TBuf<40> landmark_id; |
|
75 |
TBuf<40> category_id; |
|
76 |
_LIT8(KMsgService,"Service.Messaging"); |
|
77 |
// ============================= LOCAL FUNCTIONS =============================== |
|
78 |
||
79 |
// ----------------------------------------------------------------------------- |
|
80 |
// ?function_name ?description. |
|
81 |
// ?description |
|
82 |
// Returns: ?value_1: ?description |
|
83 |
// ?value_n: ?description_line1 |
|
84 |
// ?description_line2 |
|
85 |
// ----------------------------------------------------------------------------- |
|
86 |
// |
|
87 |
/* |
|
88 |
?type ?function_name( |
|
89 |
?arg_type arg, // ?description |
|
90 |
?arg_type arg) // ?description |
|
91 |
{ |
|
92 |
||
93 |
?code // ?comment |
|
94 |
||
95 |
// ?comment |
|
96 |
?code |
|
97 |
} |
|
98 |
*/ |
|
99 |
||
100 |
// ============================ MEMBER FUNCTIONS =============================== |
|
101 |
||
102 |
// ----------------------------------------------------------------------------- |
|
103 |
// Ctlandmark_provider::Delete |
|
104 |
// Delete here all resources allocated and opened from test methods. |
|
105 |
// Called from destructor. |
|
106 |
// ----------------------------------------------------------------------------- |
|
107 |
// |
|
108 |
void Ctlandmark_provider::Delete() |
|
109 |
{ |
|
110 |
||
111 |
} |
|
112 |
||
113 |
// ----------------------------------------------------------------------------- |
|
114 |
// Ctlandmark_provider::RunMethodL |
|
115 |
// Run specified method. Contains also table of test mothods and their names. |
|
116 |
// ----------------------------------------------------------------------------- |
|
117 |
// |
|
118 |
TInt Ctlandmark_provider::RunMethodL( |
|
119 |
CStifItemParser& aItem ) |
|
120 |
{ |
|
121 |
||
122 |
static TStifFunctionInfo const KFunctions[] = |
|
123 |
{ |
|
124 |
// Copy this line for every implemented function. |
|
125 |
// First string is the function name used in TestScripter script file. |
|
126 |
// Second is the actual implementation member function. |
|
127 |
ENTRY( "TestNoTid", Ctlandmark_provider::TestNoTid ), |
|
128 |
ENTRY( "TestInvalidTid", Ctlandmark_provider::TestInvalidTid ), |
|
129 |
ENTRY( "TestTidByorder", Ctlandmark_provider::TestTidByorder ), |
|
130 |
ENTRY( "TestTidByPos", Ctlandmark_provider::TestTidByPos ), |
|
131 |
ENTRY( "TestHugeTid", Ctlandmark_provider::TestHugeTid ), |
|
132 |
ENTRY( "TestTidInvalidType", Ctlandmark_provider::TestTidInvalidType ), |
|
133 |
ENTRY( "TestCancelInvalidCmdOption", Ctlandmark_provider::TestCancelInvalidCmdOption ), |
|
134 |
||
135 |
ENTRY( "TestAddLMVarByOrder", Ctlandmark_provider::TestAddLMVarByOrder ), |
|
136 |
ENTRY( "TestAddLMVarByPos", Ctlandmark_provider::TestAddLMVarByPos ), |
|
137 |
ENTRY( "TestAddCTVarByOrder", Ctlandmark_provider::TestAddCTVarByOrder ), |
|
138 |
ENTRY( "TestAddCTVarByPos", Ctlandmark_provider::TestAddCTVarByPos ), |
|
139 |
||
140 |
ENTRY( "TestGetListLMVarByOrder", Ctlandmark_provider::TestGetListLMVarByOrder ), |
|
141 |
ENTRY( "TestGetListLMVarByPos", Ctlandmark_provider::TestGetListLMVarByPos ), |
|
142 |
ENTRY( "TestGetListCTVarByOrder", Ctlandmark_provider::TestGetListCTVarByOrder ), |
|
143 |
ENTRY( "TestGetListCTVarByPos", Ctlandmark_provider::TestGetListCTVarByPos ), |
|
144 |
||
145 |
ENTRY( "TestRemoveLMVarByOrder", Ctlandmark_provider::TestRemoveLMVarByOrder ), |
|
146 |
ENTRY( "TestRemoveLMVarByPos", Ctlandmark_provider::TestRemoveLMVarByPos ), |
|
147 |
ENTRY( "TestRemoveCTVarByOrder", Ctlandmark_provider::TestRemoveCTVarByOrder ), |
|
148 |
ENTRY( "TestRemoveCTVarByPos", Ctlandmark_provider::TestRemoveCTVarByPos ), |
|
149 |
||
150 |
ENTRY( "TestExportVarByOrder", Ctlandmark_provider::TestExportVarByOrder ), |
|
151 |
ENTRY( "TestExportVarByPos", Ctlandmark_provider::TestExportVarByPos ), |
|
152 |
||
153 |
ENTRY( "TestImportVarByOrder", Ctlandmark_provider::TestImportVarByOrder ), |
|
154 |
ENTRY( "TestImportVarByPos", Ctlandmark_provider::TestImportVarByPos ), |
|
155 |
||
156 |
ENTRY( "TestOrganiseVarByOrder", Ctlandmark_provider::TestOrganiseVarByOrder ), |
|
157 |
ENTRY( "TestOrganiseVarByPos", Ctlandmark_provider::TestOrganiseVarByPos ), |
|
158 |
||
159 |
ENTRY( "TestInvalidServiceDataSourceCombination", Ctlandmark_provider::TestInvalidServiceDataSourceCombination ), |
|
160 |
||
161 |
ENTRY( "TestAddSyncAsyncbitcheck", Ctlandmark_provider::TestAddSyncAsyncbitcheck ), |
|
162 |
ENTRY( "TestGetListSyncAsyncbitcheck", Ctlandmark_provider::TestGetListSyncAsyncbitcheck ), |
|
163 |
||
164 |
ENTRY( "TestGetListCancel", Ctlandmark_provider::TestGetListCancel ), |
|
165 |
ENTRY( "GetListStressTest", Ctlandmark_provider::GetListStressTest ), |
|
166 |
ENTRY( "GetListIteratorTestLM", Ctlandmark_provider::GetListIteratorTestLM ), |
|
167 |
ENTRY( "GetListIteratorTestCT", Ctlandmark_provider::GetListIteratorTestCT ), |
|
168 |
||
169 |
ENTRY( "TestTemplateInvalidCase", Ctlandmark_provider::TestTemplateInvalidCase ), |
|
170 |
ENTRY( "TestTemplateLM", Ctlandmark_provider::TestTemplateLM ), |
|
171 |
ENTRY( "TestTemplateCT", Ctlandmark_provider::TestTemplateCT ), |
|
172 |
||
173 |
ENTRY( "TestGetListCTWithSortOrder", Ctlandmark_provider::TestGetListCTWithSortOrder ), |
|
174 |
ENTRY( "TestAddMultipleLM", Ctlandmark_provider::TestAddMultipleLM ), |
|
175 |
||
176 |
ENTRY( "ImportDBTypeIdCheck", Ctlandmark_provider::ImportDBTypeIdCheck ), |
|
177 |
ENTRY( "ImportNullDB", Ctlandmark_provider::ImportNullDB ), |
|
178 |
||
179 |
ENTRY( "AddSyncBitCheck", Ctlandmark_provider::AddSyncBitCheck ), |
|
180 |
ENTRY( "CombineAPI", Ctlandmark_provider::CombineAPI ), |
|
181 |
||
182 |
ENTRY( "AddVerifyTimeStamp", Ctlandmark_provider::AddVerifyTimeStamp ), |
|
183 |
||
184 |
ENTRY( "ExportHugeFilename", Ctlandmark_provider::ExportHugeFilename ), |
|
185 |
ENTRY( "ExportNullFilename", Ctlandmark_provider::ExportNullFilename ), |
|
186 |
ENTRY( "ExportInvalidFilename", Ctlandmark_provider::ExportInvalidFilename ), |
|
187 |
||
188 |
//ADD NEW ENTRY HERE |
|
189 |
||
190 |
}; |
|
191 |
||
192 |
const TInt count = sizeof( KFunctions ) / |
|
193 |
sizeof( TStifFunctionInfo ); |
|
194 |
||
195 |
return RunInternalL( KFunctions, count, aItem ); |
|
196 |
||
197 |
} |
|
198 |
||
199 |
// ----------------------------------------------------------------------------- |
|
200 |
// Ctlandmark_provider::ExportInvalidFilename |
|
201 |
// To test export with invalid file name |
|
202 |
// (other items were commented in a header). |
|
203 |
// ----------------------------------------------------------------------------- |
|
204 |
// |
|
205 |
TInt Ctlandmark_provider::ExportInvalidFilename( CStifItemParser& aItem ) |
|
206 |
{ |
|
207 |
__UHEAP_MARK; |
|
208 |
_LIT(KName,"exportinvalidfilename"); |
|
209 |
_LIT(KDescription,"export with invalid file name string"); |
|
210 |
_LIT(KFilePath, "test"); |
|
211 |
_LIT(KPosMimeType, "application/vnd.nokia.landmarkcollection+xml"); |
|
212 |
||
213 |
TInt32 result = KErrNone; |
|
214 |
TBuf<40> buf; |
|
215 |
TInt add_flag =0; |
|
216 |
||
217 |
/* RFile LogResult; |
|
218 |
RFs LogResultSession; |
|
219 |
User::LeaveIfError(LogResultSession.Connect()); |
|
220 |
if(LogResult.Open(LogResultSession ,KFilePath , EFileWrite | EFileShareAny ) != KErrNotFound) |
|
221 |
{ |
|
222 |
LogResult.Close(); |
|
223 |
||
224 |
LogResultSession.Delete(KFilePath); |
|
225 |
||
226 |
LogResultSession.Close(); |
|
227 |
} |
|
228 |
||
229 |
LogResult.Close(); |
|
230 |
LogResultSession.Close();*/ |
|
231 |
||
232 |
||
233 |
||
234 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
235 |
MLiwInterface* interface = NULL; |
|
236 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
237 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
238 |
||
239 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
240 |
||
241 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
242 |
||
243 |
RCriteriaArray a; |
|
244 |
a.AppendL(crit); |
|
245 |
||
246 |
iServiceHandler->AttachL(a); |
|
247 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
248 |
||
249 |
a.Reset(); |
|
250 |
delete crit; |
|
251 |
||
252 |
TInt pos = 0; |
|
253 |
||
254 |
outps->FindFirst( pos, KIDataSource ); |
|
255 |
if(pos != KErrNotFound) |
|
256 |
{ |
|
257 |
interface = (*outps)[pos].Value().AsInterface(); |
|
258 |
} |
|
259 |
||
260 |
outps->Reset(); |
|
261 |
inps->Reset(); |
|
262 |
||
263 |
TLiwGenericParam param; |
|
264 |
TInt index = 0; |
|
265 |
||
266 |
result = AddLandMark(inps,outps,interface,KName,KDescription); |
|
267 |
||
268 |
if(!result) |
|
269 |
{ |
|
270 |
add_flag = 1; |
|
271 |
GetLandMarkId(inps,outps,interface,KName,KDescription); |
|
272 |
||
273 |
// Call Export |
|
274 |
||
275 |
CLiwMap* export_map = CLiwDefaultMap::NewL(); |
|
276 |
||
277 |
CLiwList* landmarkIdList = CLiwDefaultList::NewL(); |
|
278 |
landmarkIdList->AppendL(TLiwVariant(landmark_id)); |
|
279 |
||
280 |
export_map->InsertL(KDestinationFile,TLiwVariant(KFilePath)); |
|
281 |
export_map->InsertL(KMimeType,TLiwVariant(KPosMimeType)); |
|
282 |
export_map->InsertL(KIdList,TLiwVariant(landmarkIdList)); |
|
283 |
landmarkIdList->DecRef(); |
|
284 |
||
285 |
param.SetNameAndValueL(KDataFields,TLiwVariant(export_map)); |
|
286 |
inps->AppendL(param); |
|
287 |
param.Reset(); |
|
288 |
||
289 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
290 |
inps->AppendL(param); |
|
291 |
param.Reset(); |
|
292 |
||
293 |
interface->ExecuteCmdL(KExport,*inps,*outps,0,0); |
|
294 |
export_map->DecRef(); |
|
295 |
index=0; |
|
296 |
||
297 |
const TLiwGenericParam* export_err = outps->FindFirst(index,KErrorCode); |
|
298 |
if(export_err) |
|
299 |
result = export_err->Value().AsTInt32(); |
|
300 |
} |
|
301 |
||
302 |
iLog->Log(_L("result value of export with invalid file name : %D"),result); |
|
303 |
||
304 |
outps->Reset(); |
|
305 |
inps->Reset(); |
|
306 |
if(add_flag) |
|
307 |
RemoveLandmark(inps,outps,interface); |
|
308 |
||
309 |
interface->Close(); |
|
310 |
||
311 |
if(result == SErrPathNotFound) |
|
312 |
result = KErrNone; |
|
313 |
||
314 |
delete iServiceHandler; |
|
315 |
__UHEAP_MARKEND; |
|
316 |
return result; |
|
317 |
} |
|
318 |
||
319 |
||
320 |
||
321 |
// ----------------------------------------------------------------------------- |
|
322 |
// Ctlandmark_provider::ExportNullFilename |
|
323 |
// To test export with NUll file name |
|
324 |
// (other items were commented in a header). |
|
325 |
// ----------------------------------------------------------------------------- |
|
326 |
// |
|
327 |
TInt Ctlandmark_provider::ExportNullFilename( CStifItemParser& aItem ) |
|
328 |
{ |
|
329 |
__UHEAP_MARK; |
|
330 |
_LIT(KName,"exportnullfilename"); |
|
331 |
_LIT(KDescription,"export with null file name string"); |
|
332 |
_LIT(KPosMimeType, "application/vnd.nokia.landmarkcollection+xml"); |
|
333 |
||
334 |
TInt32 result = KErrNone; |
|
335 |
TBuf<40> buf; |
|
336 |
TInt add_flag =0; |
|
337 |
||
338 |
/* RFile LogResult; |
|
339 |
RFs LogResultSession; |
|
340 |
User::LeaveIfError(LogResultSession.Connect()); |
|
341 |
if(LogResult.Open(LogResultSession ,KFilePath , EFileWrite | EFileShareAny ) != KErrNotFound) |
|
342 |
{ |
|
343 |
LogResult.Close(); |
|
344 |
||
345 |
LogResultSession.Delete(KFilePath); |
|
346 |
||
347 |
LogResultSession.Close(); |
|
348 |
} |
|
349 |
||
350 |
LogResult.Close(); |
|
351 |
LogResultSession.Close();*/ |
|
352 |
||
353 |
||
354 |
||
355 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
356 |
MLiwInterface* interface = NULL; |
|
357 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
358 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
359 |
||
360 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
361 |
||
362 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
363 |
||
364 |
RCriteriaArray a; |
|
365 |
a.AppendL(crit); |
|
366 |
||
367 |
iServiceHandler->AttachL(a); |
|
368 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
369 |
||
370 |
a.Reset(); |
|
371 |
delete crit; |
|
372 |
||
373 |
TInt pos = 0; |
|
374 |
||
375 |
outps->FindFirst( pos, KIDataSource ); |
|
376 |
if(pos != KErrNotFound) |
|
377 |
{ |
|
378 |
interface = (*outps)[pos].Value().AsInterface(); |
|
379 |
} |
|
380 |
||
381 |
outps->Reset(); |
|
382 |
inps->Reset(); |
|
383 |
||
384 |
TLiwGenericParam param; |
|
385 |
TInt index = 0; |
|
386 |
||
387 |
result = AddLandMark(inps,outps,interface,KName,KDescription); |
|
388 |
||
389 |
if(!result) |
|
390 |
{ |
|
391 |
add_flag = 1; |
|
392 |
GetLandMarkId(inps,outps,interface,KName,KDescription); |
|
393 |
||
394 |
// Call Export |
|
395 |
||
396 |
CLiwMap* export_map = CLiwDefaultMap::NewL(); |
|
397 |
||
398 |
CLiwList* landmarkIdList = CLiwDefaultList::NewL(); |
|
399 |
landmarkIdList->AppendL(TLiwVariant(landmark_id)); |
|
400 |
||
401 |
export_map->InsertL(KDestinationFile,TLiwVariant(KNullDesC)); |
|
402 |
export_map->InsertL(KMimeType,TLiwVariant(KPosMimeType)); |
|
403 |
export_map->InsertL(KIdList,TLiwVariant(landmarkIdList)); |
|
404 |
landmarkIdList->DecRef(); |
|
405 |
||
406 |
param.SetNameAndValueL(KDataFields,TLiwVariant(export_map)); |
|
407 |
inps->AppendL(param); |
|
408 |
param.Reset(); |
|
409 |
||
410 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
411 |
inps->AppendL(param); |
|
412 |
param.Reset(); |
|
413 |
||
414 |
interface->ExecuteCmdL(KExport,*inps,*outps,0,0); |
|
415 |
export_map->DecRef(); |
|
416 |
index=0; |
|
417 |
||
418 |
const TLiwGenericParam* export_err = outps->FindFirst(index,KErrorCode); |
|
419 |
if(export_err) |
|
420 |
result = export_err->Value().AsTInt32(); |
|
421 |
} |
|
422 |
||
423 |
iLog->Log(_L("result value of export with null file name : %D"),result); |
|
424 |
||
425 |
outps->Reset(); |
|
426 |
inps->Reset(); |
|
427 |
if(add_flag) |
|
428 |
RemoveLandmark(inps,outps,interface); |
|
429 |
||
430 |
interface->Close(); |
|
431 |
||
432 |
if(result == SErrBadArgumentType || result == SErrInvalidServiceArgument) |
|
433 |
result = KErrNone; |
|
434 |
||
435 |
delete iServiceHandler; |
|
436 |
__UHEAP_MARKEND; |
|
437 |
return result; |
|
438 |
} |
|
439 |
||
440 |
||
441 |
// ----------------------------------------------------------------------------- |
|
442 |
// Ctlandmark_provider::ExportHugeFilename |
|
443 |
// To test export with huge file name |
|
444 |
// (other items were commented in a header). |
|
445 |
// ----------------------------------------------------------------------------- |
|
446 |
// |
|
447 |
TInt Ctlandmark_provider::ExportHugeFilename( CStifItemParser& aItem ) |
|
448 |
{ |
|
449 |
__UHEAP_MARK; |
|
450 |
_LIT(KName,"exporthugefilename"); |
|
451 |
_LIT(KDescription,"export with huge file name string"); |
|
452 |
_LIT(KFilePath, "HiThisisRoshanfromNokiaIndiaPvtLtd.IhopeyouaredoingfinebecauseIalwaysdofineandexpectthesamefromyou.Thisbringstothepointthatwhyiaskedyouthisstupidquestionwheniknowthaturfine.Nokiaisagreatcompanyanditpresentsgreatopportunity##$$$$&&&-=+++~~~@@@@@sothatsitfrommeletscontinueontheworkfortodayok"); |
|
453 |
_LIT(KPosMimeType, "application/vnd.nokia.landmarkcollection+xml"); |
|
454 |
||
455 |
TInt32 result = KErrNone; |
|
456 |
TBuf<40> buf; |
|
457 |
TInt add_flag =0; |
|
458 |
||
459 |
/* RFile LogResult; |
|
460 |
RFs LogResultSession; |
|
461 |
User::LeaveIfError(LogResultSession.Connect()); |
|
462 |
if(LogResult.Open(LogResultSession ,KFilePath , EFileWrite | EFileShareAny ) != KErrNotFound) |
|
463 |
{ |
|
464 |
LogResult.Close(); |
|
465 |
||
466 |
LogResultSession.Delete(KFilePath); |
|
467 |
||
468 |
LogResultSession.Close(); |
|
469 |
} |
|
470 |
||
471 |
LogResult.Close(); |
|
472 |
LogResultSession.Close();*/ |
|
473 |
||
474 |
||
475 |
||
476 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
477 |
MLiwInterface* interface = NULL; |
|
478 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
479 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
480 |
||
481 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
482 |
||
483 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
484 |
||
485 |
RCriteriaArray a; |
|
486 |
a.AppendL(crit); |
|
487 |
||
488 |
iServiceHandler->AttachL(a); |
|
489 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
490 |
||
491 |
a.Reset(); |
|
492 |
delete crit; |
|
493 |
||
494 |
TInt pos = 0; |
|
495 |
||
496 |
outps->FindFirst( pos, KIDataSource ); |
|
497 |
if(pos != KErrNotFound) |
|
498 |
{ |
|
499 |
interface = (*outps)[pos].Value().AsInterface(); |
|
500 |
} |
|
501 |
||
502 |
outps->Reset(); |
|
503 |
inps->Reset(); |
|
504 |
||
505 |
TLiwGenericParam param; |
|
506 |
TInt index = 0; |
|
507 |
||
508 |
result = AddLandMark(inps,outps,interface,KName,KDescription); |
|
509 |
||
510 |
if(!result) |
|
511 |
{ |
|
512 |
add_flag = 1; |
|
513 |
GetLandMarkId(inps,outps,interface,KName,KDescription); |
|
514 |
||
515 |
// Call Export |
|
516 |
||
517 |
CLiwMap* export_map = CLiwDefaultMap::NewL(); |
|
518 |
||
519 |
CLiwList* landmarkIdList = CLiwDefaultList::NewL(); |
|
520 |
landmarkIdList->AppendL(TLiwVariant(landmark_id)); |
|
521 |
||
522 |
export_map->InsertL(KDestinationFile,TLiwVariant(KFilePath)); |
|
523 |
export_map->InsertL(KMimeType,TLiwVariant(KPosMimeType)); |
|
524 |
export_map->InsertL(KIdList,TLiwVariant(landmarkIdList)); |
|
525 |
landmarkIdList->DecRef(); |
|
526 |
||
527 |
param.SetNameAndValueL(KDataFields,TLiwVariant(export_map)); |
|
528 |
inps->AppendL(param); |
|
529 |
param.Reset(); |
|
530 |
||
531 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
532 |
inps->AppendL(param); |
|
533 |
param.Reset(); |
|
534 |
||
535 |
interface->ExecuteCmdL(KExport,*inps,*outps,0,0); |
|
536 |
export_map->DecRef(); |
|
537 |
index=0; |
|
538 |
||
539 |
const TLiwGenericParam* export_err = outps->FindFirst(index,KErrorCode); |
|
540 |
if(export_err) |
|
541 |
{ |
|
542 |
result = export_err->Value().AsTInt32(); |
|
543 |
index=1; |
|
544 |
const TLiwGenericParam* err_msg = outps->FindFirst(index,KErrorMsg); |
|
545 |
if(err_msg) |
|
546 |
iLog->Log(_L("err msg of export with huge file name : %S"),err_msg->Value().AsDes()); |
|
547 |
} |
|
548 |
} |
|
549 |
||
550 |
// iLog->Log("result value of export with huge file name : %D",result); |
|
551 |
iLog->Log(_L("result value of export with huge file name : %D"),result); |
|
552 |
||
553 |
outps->Reset(); |
|
554 |
inps->Reset(); |
|
555 |
if(add_flag) |
|
556 |
RemoveLandmark(inps,outps,interface); |
|
557 |
||
558 |
interface->Close(); |
|
559 |
||
560 |
if(result == SErrBadArgumentType || result == SErrInvalidServiceArgument) |
|
561 |
result = KErrNone; |
|
562 |
||
563 |
delete iServiceHandler; |
|
564 |
__UHEAP_MARKEND; |
|
565 |
return result; |
|
566 |
} |
|
567 |
||
568 |
||
569 |
||
570 |
// ----------------------------------------------------------------------------- |
|
571 |
// Ctlandmark_provider::AddVerifyTimeStamp |
|
572 |
// Add landmark with a timestamp value for position and verify the same |
|
573 |
// (other items were commented in a header). |
|
574 |
// ----------------------------------------------------------------------------- |
|
575 |
// |
|
576 |
TInt Ctlandmark_provider::AddVerifyTimeStamp( CStifItemParser& aItem ) |
|
577 |
{ |
|
578 |
__UHEAP_MARK; |
|
579 |
_LIT(KName,"TSlandmark1"); |
|
580 |
_LIT(KDesc,"Landmark with time stamp - case one"); |
|
581 |
||
582 |
TInt32 result = KErrNone; |
|
583 |
TReal32 acc_data = 22.7; |
|
584 |
TInt item_count_before_reset = 0; |
|
585 |
TInt item_count_after_reset = 0; |
|
586 |
TBuf<40> first_cid_before_reset; |
|
587 |
TBuf<40> first_cid_after_reset; |
|
588 |
TLiwGenericParam param; |
|
589 |
||
590 |
||
591 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
592 |
MLiwInterface* interface = NULL; |
|
593 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
594 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
595 |
||
596 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
597 |
||
598 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
599 |
||
600 |
RCriteriaArray a; |
|
601 |
a.AppendL(crit); |
|
602 |
||
603 |
iServiceHandler->AttachL(a); |
|
604 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
605 |
||
606 |
a.Reset(); |
|
607 |
delete crit; |
|
608 |
||
609 |
TInt pos = 0; |
|
610 |
||
611 |
outps->FindFirst( pos, KIDataSource ); |
|
612 |
if(pos != KErrNotFound) |
|
613 |
{ |
|
614 |
interface = (*outps)[pos].Value().AsInterface(); |
|
615 |
} |
|
616 |
||
617 |
outps->Reset(); |
|
618 |
inps->Reset(); |
|
619 |
||
620 |
CLiwMap* landmarkMap = CLiwDefaultMap::NewL(); |
|
621 |
CLiwMap* pos_map = CLiwDefaultMap::NewL(); |
|
622 |
pos_map->InsertL(KVAccuracy,TLiwVariant(acc_data)); |
|
623 |
TTime settime(TDateTime(2008,EApril,16,16,15,0,0)); |
|
624 |
pos_map->InsertL(KTStamp,TLiwVariant(TTime(TDateTime(2008,EApril,16,16,15,0,0)))); |
|
625 |
||
626 |
landmarkMap->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
627 |
||
628 |
//description |
|
629 |
landmarkMap->InsertL(KLandmarkDesc,TLiwVariant(KDesc)); |
|
630 |
||
631 |
landmarkMap->InsertL(KLandmarkPosition,TLiwVariant(pos_map)); |
|
632 |
pos_map->DecRef(); |
|
633 |
||
634 |
param.SetNameAndValueL(KDataFields,TLiwVariant(landmarkMap)); |
|
635 |
inps->AppendL(param); |
|
636 |
param.Reset(); |
|
637 |
||
638 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
639 |
inps->AppendL(param); |
|
640 |
param.Reset(); |
|
641 |
||
642 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
643 |
landmarkMap->DecRef(); |
|
644 |
||
645 |
pos=0; |
|
646 |
const TLiwGenericParam* err = outps->FindFirst(pos,KErrorCode); |
|
647 |
if(err) |
|
648 |
result = err->Value().AsTInt32(); |
|
649 |
||
650 |
outps->Reset(); |
|
651 |
inps->Reset(); |
|
652 |
||
653 |
if(!result) |
|
654 |
{ |
|
655 |
outps->Reset(); |
|
656 |
inps->Reset(); |
|
657 |
||
658 |
CLiwMap* getlistlandmark_map = CLiwDefaultMap::NewL(); |
|
659 |
getlistlandmark_map->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
660 |
getlistlandmark_map->InsertL(KLandmarkDesc,TLiwVariant(KDesc)); |
|
661 |
||
662 |
param.SetNameAndValueL(KFilter,TLiwVariant(getlistlandmark_map)); |
|
663 |
inps->AppendL(param); |
|
664 |
param.Reset(); |
|
665 |
||
666 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
667 |
inps->AppendL(param); |
|
668 |
param.Reset(); |
|
669 |
||
670 |
interface->ExecuteCmdL(KGetList,*inps,*outps,0,0); |
|
671 |
getlistlandmark_map->DecRef(); |
|
672 |
||
673 |
pos=0; |
|
674 |
const TLiwGenericParam* getlist_err = outps->FindFirst(pos,KErrorCode); |
|
675 |
if(getlist_err) |
|
676 |
result = getlist_err->Value().AsTInt32(); |
|
677 |
} |
|
678 |
||
679 |
||
680 |
if(!result) |
|
681 |
{ |
|
682 |
// Iterate through the list |
|
683 |
pos=0; |
|
684 |
const TLiwGenericParam* output = outps->FindFirst( pos,_L8("ReturnValue")); |
|
685 |
||
686 |
if(output) |
|
687 |
{ |
|
688 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
689 |
||
690 |
TLiwVariant data; |
|
691 |
||
692 |
while( iterlist->NextL(data)) |
|
693 |
{ |
|
694 |
item_count_before_reset++; |
|
695 |
const CLiwMap* res = data.AsMap(); |
|
696 |
if ( res ) |
|
697 |
{ |
|
698 |
TLiwVariant new_data; |
|
699 |
if(res->FindL(KLandmarkPosition, new_data)) |
|
700 |
{ |
|
701 |
const CLiwMap* p_map = new_data.AsMap(); |
|
702 |
if(p_map) |
|
703 |
{ |
|
704 |
TLiwVariant pos_data; |
|
705 |
if(p_map->FindL(KTStamp, pos_data)) |
|
706 |
{ |
|
707 |
if(pos_data.AsTTime() != settime) |
|
708 |
result = KErrGeneral; |
|
709 |
} |
|
710 |
pos_data.Reset(); |
|
711 |
} |
|
712 |
} |
|
713 |
new_data.Reset(); |
|
714 |
} |
|
715 |
} |
|
716 |
data.Reset(); |
|
717 |
} |
|
718 |
||
719 |
outps->Reset(); |
|
720 |
inps->Reset(); |
|
721 |
} |
|
722 |
||
723 |
||
724 |
RemoveLandmark(inps,outps,interface); |
|
725 |
interface->Close(); |
|
726 |
delete iServiceHandler; |
|
727 |
__UHEAP_MARKEND; |
|
728 |
return result; |
|
729 |
} |
|
730 |
||
731 |
||
732 |
// ----------------------------------------------------------------------------- |
|
733 |
// Ctlandmark_provider::CombineAPI |
|
734 |
// To combine add/getlist/organise/delete api |
|
735 |
// (other items were commented in a header). |
|
736 |
// ----------------------------------------------------------------------------- |
|
737 |
// |
|
738 |
TInt Ctlandmark_provider::CombineAPI( CStifItemParser& aItem ) |
|
739 |
{ |
|
740 |
__UHEAP_MARK; |
|
741 |
_LIT(KName,"combine"); |
|
742 |
_LIT(KCatName,"cat_for_combine"); |
|
743 |
_LIT(KDescription,"combine_api"); |
|
744 |
||
745 |
TInt32 result = KErrNone; |
|
746 |
TBuf<40> buf; |
|
747 |
TInt add_lmflag =0; |
|
748 |
TInt add_ctflag =0; |
|
749 |
||
750 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
751 |
MLiwInterface* interface = NULL; |
|
752 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
753 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
754 |
||
755 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
756 |
||
757 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
758 |
||
759 |
RCriteriaArray a; |
|
760 |
a.AppendL(crit); |
|
761 |
||
762 |
iServiceHandler->AttachL(a); |
|
763 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
764 |
||
765 |
a.Reset(); |
|
766 |
delete crit; |
|
767 |
||
768 |
TInt pos = 0; |
|
769 |
||
770 |
outps->FindFirst( pos, KIDataSource ); |
|
771 |
if(pos != KErrNotFound) |
|
772 |
{ |
|
773 |
interface = (*outps)[pos].Value().AsInterface(); |
|
774 |
} |
|
775 |
||
776 |
outps->Reset(); |
|
777 |
inps->Reset(); |
|
778 |
||
779 |
TLiwGenericParam param; |
|
780 |
TInt index = 0; |
|
781 |
||
782 |
result = AddLandMark(inps,outps,interface,KName,KDescription); |
|
783 |
||
784 |
if(!result) |
|
785 |
{ |
|
786 |
add_lmflag = 1; |
|
787 |
AddCategory(inps,outps,interface,KCatName); |
|
788 |
add_ctflag=1; |
|
789 |
GetLandMarkId(inps,outps,interface,KName,KDescription); |
|
790 |
GetCatId(inps,outps,interface,KCatName); |
|
791 |
||
792 |
CLiwMap* organise_map = CLiwDefaultMap::NewL(); |
|
793 |
organise_map->InsertL(KId,TLiwVariant(category_id)); |
|
794 |
||
795 |
CLiwList* landmarkIdList = CLiwDefaultList::NewL(); |
|
796 |
landmarkIdList->AppendL(TLiwVariant(landmark_id)); |
|
797 |
organise_map->InsertL(KIdList,TLiwVariant(landmarkIdList)); |
|
798 |
landmarkIdList->DecRef(); |
|
799 |
||
800 |
param.SetNameAndValueL(KDataFields,TLiwVariant(organise_map)); |
|
801 |
inps->AppendL(param); |
|
802 |
param.Reset(); |
|
803 |
||
804 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
805 |
inps->AppendL(param); |
|
806 |
param.Reset(); |
|
807 |
||
808 |
param.SetNameAndValueL(KOperationType,TLiwVariant(KAssociate)); |
|
809 |
inps->AppendL(param); |
|
810 |
param.Reset(); |
|
811 |
||
812 |
interface->ExecuteCmdL(KOrganise,*inps,*outps,0,0); |
|
813 |
organise_map->DecRef(); |
|
814 |
||
815 |
const TLiwGenericParam* organise_err = outps->FindFirst(pos,KErrorCode); |
|
816 |
if(organise_err) |
|
817 |
result = organise_err->Value().AsTInt32(); |
|
818 |
||
819 |
||
820 |
outps->Reset(); |
|
821 |
inps->Reset(); |
|
822 |
} |
|
823 |
||
824 |
if(add_lmflag) |
|
825 |
RemoveLandmark(inps,outps,interface); |
|
826 |
if(add_ctflag) |
|
827 |
RemoveCategory(inps,outps,interface); |
|
828 |
||
829 |
interface->Close(); |
|
830 |
delete iServiceHandler; |
|
831 |
__UHEAP_MARKEND; |
|
832 |
return result; |
|
833 |
} |
|
834 |
// ----------------------------------------------------------------------------- |
|
835 |
// Ctlandmark_provider::AddSyncBitCheck |
|
836 |
// To test add for sync bit check |
|
837 |
// (other items were commented in a header). |
|
838 |
// ----------------------------------------------------------------------------- |
|
839 |
// |
|
840 |
TInt Ctlandmark_provider::AddSyncBitCheck( CStifItemParser& aItem ) |
|
841 |
{ |
|
842 |
_LIT(KName,"xyz"); |
|
843 |
_LIT(KDescription,"123"); |
|
844 |
||
845 |
TInt32 result = KErrNone; |
|
846 |
TInt count = 0; |
|
847 |
__UHEAP_MARK; |
|
848 |
||
849 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
850 |
MLiwInterface* interface = NULL; |
|
851 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
852 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
853 |
||
854 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
855 |
||
856 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
857 |
||
858 |
RCriteriaArray a; |
|
859 |
a.AppendL(crit); |
|
860 |
||
861 |
iServiceHandler->AttachL(a); |
|
862 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
863 |
||
864 |
a.Reset(); |
|
865 |
delete crit; |
|
866 |
||
867 |
TInt pos = 0; |
|
868 |
||
869 |
outps->FindFirst( pos, KIDataSource ); |
|
870 |
if(pos != KErrNotFound) |
|
871 |
{ |
|
872 |
interface = (*outps)[pos].Value().AsInterface(); |
|
873 |
} |
|
874 |
||
875 |
outps->Reset(); |
|
876 |
inps->Reset(); |
|
877 |
||
878 |
||
879 |
TPosition locale; |
|
880 |
locale.SetCurrentTime(); |
|
881 |
||
882 |
CLiwMap* landmarkMap = CLiwDefaultMap::NewL(); |
|
883 |
TLiwGenericParam param; |
|
884 |
||
885 |
//name |
|
886 |
landmarkMap->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
887 |
||
888 |
//description |
|
889 |
landmarkMap->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
|
890 |
||
891 |
param.SetNameAndValueL(KDataFields,TLiwVariant(landmarkMap)); |
|
892 |
inps->AppendL(param); |
|
893 |
param.Reset(); |
|
894 |
||
895 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
896 |
inps->AppendL(param); |
|
897 |
param.Reset(); |
|
898 |
||
899 |
TInt32 temp = 0; |
|
900 |
CActiveSchedulerWait *schedular; |
|
901 |
schedular = new(ELeave) CActiveSchedulerWait(); |
|
902 |
CCalCallback *Callback = CCalCallback::NewL(schedular, temp); |
|
903 |
interface->ExecuteCmdL(KAdd,*inps,*outps,KLiwOptASyncronous,Callback); |
|
904 |
delete Callback; |
|
905 |
delete schedular; |
|
906 |
landmarkMap->DecRef(); |
|
907 |
||
908 |
TInt index = 0; |
|
909 |
||
910 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
911 |
if(err) |
|
912 |
result = err->Value().AsTInt32(); |
|
913 |
||
914 |
outps->Reset(); |
|
915 |
inps->Reset(); |
|
916 |
||
917 |
interface->Close(); |
|
918 |
delete iServiceHandler; |
|
919 |
||
920 |
__UHEAP_MARKEND; |
|
921 |
if(result == 1000) |
|
922 |
result = 0; |
|
923 |
return result; |
|
924 |
} |
|
925 |
||
926 |
// ----------------------------------------------------------------------------- |
|
927 |
// Ctlandmark_provider::TestCancelInvalidCmdOption |
|
928 |
// To test cancel passing invalid cmd type |
|
929 |
// (other items were commented in a header). |
|
930 |
// ----------------------------------------------------------------------------- |
|
931 |
// |
|
932 |
TInt Ctlandmark_provider::TestCancelInvalidCmdOption( CStifItemParser& aItem ) |
|
933 |
{ |
|
934 |
__UHEAP_MARK; |
|
935 |
CTestAsync* test = CTestAsync::NewL(10); |
|
936 |
test->Start(); |
|
937 |
TInt32 Err = test->Result(); |
|
938 |
delete test; |
|
939 |
__UHEAP_MARKEND; |
|
940 |
if(Err == 1000) |
|
941 |
Err = 0; |
|
942 |
return Err; |
|
943 |
} |
|
944 |
||
945 |
// ----------------------------------------------------------------------------- |
|
946 |
// Ctlandmark_provider::TestTidInvalidType |
|
947 |
// To test cancel passing invalid tid type |
|
948 |
// (other items were commented in a header). |
|
949 |
// ----------------------------------------------------------------------------- |
|
950 |
// |
|
951 |
TInt Ctlandmark_provider::TestTidInvalidType( CStifItemParser& aItem ) |
|
952 |
{ |
|
953 |
__UHEAP_MARK; |
|
954 |
CTestAsync* test = CTestAsync::NewL(9); |
|
955 |
test->Start(); |
|
956 |
TInt32 Err = test->Result(); |
|
957 |
delete test; |
|
958 |
__UHEAP_MARKEND; |
|
959 |
if(Err == 1002) |
|
960 |
Err = 0; |
|
961 |
return Err; |
|
962 |
} |
|
963 |
||
964 |
||
965 |
// ----------------------------------------------------------------------------- |
|
966 |
// Ctlandmark_provider::TestHugeTid |
|
967 |
// To test cancel passing huge tid value |
|
968 |
// (other items were commented in a header). |
|
969 |
// ----------------------------------------------------------------------------- |
|
970 |
// |
|
971 |
TInt Ctlandmark_provider::TestHugeTid( CStifItemParser& aItem ) |
|
972 |
{ |
|
973 |
__UHEAP_MARK; |
|
974 |
CTestAsync* test = CTestAsync::NewL(8); |
|
975 |
test->Start(); |
|
976 |
TInt32 Err = test->Result(); |
|
977 |
delete test; |
|
978 |
__UHEAP_MARKEND; |
|
979 |
return Err; |
|
980 |
} |
|
981 |
||
982 |
// ----------------------------------------------------------------------------- |
|
983 |
// Ctlandmark_provider::TestTidByPos |
|
984 |
// To test cancel passing tid By position |
|
985 |
// (other items were commented in a header). |
|
986 |
// ----------------------------------------------------------------------------- |
|
987 |
// |
|
988 |
TInt Ctlandmark_provider::TestTidByPos( CStifItemParser& aItem ) |
|
989 |
{ |
|
990 |
__UHEAP_MARK; |
|
991 |
CTestAsync* test = CTestAsync::NewL(7); |
|
992 |
test->Start(); |
|
993 |
TInt32 Err = test->Result(); |
|
994 |
delete test; |
|
995 |
__UHEAP_MARKEND; |
|
996 |
return Err; |
|
997 |
} |
|
998 |
||
999 |
||
1000 |
||
1001 |
// ----------------------------------------------------------------------------- |
|
1002 |
// Ctlandmark_provider::TestTidByorder |
|
1003 |
// To test cancel passing tid By order |
|
1004 |
// (other items were commented in a header). |
|
1005 |
// ----------------------------------------------------------------------------- |
|
1006 |
// |
|
1007 |
TInt Ctlandmark_provider::TestTidByorder( CStifItemParser& aItem ) |
|
1008 |
{ |
|
1009 |
__UHEAP_MARK; |
|
1010 |
CTestAsync* test = CTestAsync::NewL(6); |
|
1011 |
test->Start(); |
|
1012 |
TInt32 Err = test->Result(); |
|
1013 |
delete test; |
|
1014 |
__UHEAP_MARKEND; |
|
1015 |
return Err; |
|
1016 |
} |
|
1017 |
||
1018 |
// ----------------------------------------------------------------------------- |
|
1019 |
// Ctlandmark_provider::ImportNullDB |
|
1020 |
// To test import with Null as database Uri |
|
1021 |
// (other items were commented in a header). |
|
1022 |
// ----------------------------------------------------------------------------- |
|
1023 |
// |
|
1024 |
TInt Ctlandmark_provider::ImportNullDB( CStifItemParser& aItem ) |
|
1025 |
{ |
|
1026 |
__UHEAP_MARK; |
|
1027 |
_LIT(KName,"ImportNullDB"); |
|
1028 |
_LIT(KDescription,"ImportDb Null"); |
|
1029 |
_LIT(KFilePath, "c:\\importNullDB.lmx"); |
|
1030 |
_LIT(KPosMimeType, "application/vnd.nokia.landmarkcollection+xml"); |
|
1031 |
||
1032 |
TInt32 result = KErrNone; |
|
1033 |
TBuf<40> buf; |
|
1034 |
TInt add_flag =0; |
|
1035 |
||
1036 |
RFile LogResult; |
|
1037 |
RFs LogResultSession; |
|
1038 |
User::LeaveIfError(LogResultSession.Connect()); |
|
1039 |
if(LogResult.Open(LogResultSession ,KFilePath , EFileWrite | EFileShareAny ) != KErrNotFound) |
|
1040 |
{ |
|
1041 |
LogResult.Close(); |
|
1042 |
||
1043 |
LogResultSession.Delete(KFilePath); |
|
1044 |
||
1045 |
LogResultSession.Close(); |
|
1046 |
} |
|
1047 |
||
1048 |
LogResult.Close(); |
|
1049 |
LogResultSession.Close(); |
|
1050 |
||
1051 |
||
1052 |
||
1053 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
1054 |
MLiwInterface* interface = NULL; |
|
1055 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
1056 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
1057 |
||
1058 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
1059 |
||
1060 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
1061 |
||
1062 |
RCriteriaArray a; |
|
1063 |
a.AppendL(crit); |
|
1064 |
||
1065 |
iServiceHandler->AttachL(a); |
|
1066 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
1067 |
||
1068 |
a.Reset(); |
|
1069 |
delete crit; |
|
1070 |
||
1071 |
TInt pos = 0; |
|
1072 |
||
1073 |
outps->FindFirst( pos, KIDataSource ); |
|
1074 |
if(pos != KErrNotFound) |
|
1075 |
{ |
|
1076 |
interface = (*outps)[pos].Value().AsInterface(); |
|
1077 |
} |
|
1078 |
||
1079 |
outps->Reset(); |
|
1080 |
inps->Reset(); |
|
1081 |
||
1082 |
TLiwGenericParam param; |
|
1083 |
TInt index = 0; |
|
1084 |
||
1085 |
result = AddLandMark(inps,outps,interface,KName,KDescription); |
|
1086 |
||
1087 |
if(!result) |
|
1088 |
{ |
|
1089 |
add_flag = 1; |
|
1090 |
GetLandMarkId(inps,outps,interface,KName,KDescription); |
|
1091 |
||
1092 |
// Call Export and then Import |
|
1093 |
||
1094 |
CLiwMap* export_map = CLiwDefaultMap::NewL(); |
|
1095 |
||
1096 |
CLiwList* landmarkIdList = CLiwDefaultList::NewL(); |
|
1097 |
landmarkIdList->AppendL(TLiwVariant(landmark_id)); |
|
1098 |
||
1099 |
export_map->InsertL(KDestinationFile,TLiwVariant(KFilePath)); |
|
1100 |
export_map->InsertL(KMimeType,TLiwVariant(KPosMimeType)); |
|
1101 |
export_map->InsertL(KIdList,TLiwVariant(landmarkIdList)); |
|
1102 |
landmarkIdList->DecRef(); |
|
1103 |
||
1104 |
param.SetNameAndValueL(KDataFields,TLiwVariant(export_map)); |
|
1105 |
inps->AppendL(param); |
|
1106 |
param.Reset(); |
|
1107 |
||
1108 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
1109 |
inps->AppendL(param); |
|
1110 |
param.Reset(); |
|
1111 |
||
1112 |
interface->ExecuteCmdL(KExport,*inps,*outps,0,0); |
|
1113 |
export_map->DecRef(); |
|
1114 |
index=0; |
|
1115 |
||
1116 |
const TLiwGenericParam* export_err = outps->FindFirst(index,KErrorCode); |
|
1117 |
if(export_err) |
|
1118 |
result = export_err->Value().AsTInt32(); |
|
1119 |
||
1120 |
if(!result) |
|
1121 |
{ |
|
1122 |
outps->Reset(); |
|
1123 |
inps->Reset(); |
|
1124 |
CLiwMap* import_map = CLiwDefaultMap::NewL(); |
|
1125 |
import_map->InsertL(KMimeType,TLiwVariant(KPosMimeType)); |
|
1126 |
import_map->InsertL(KSourceFile,TLiwVariant(KFilePath)); |
|
1127 |
import_map->InsertL(KDbUri,TLiwVariant(KNullDesC)); |
|
1128 |
||
1129 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
1130 |
inps->AppendL(param); |
|
1131 |
param.Reset(); |
|
1132 |
||
1133 |
param.SetNameAndValueL(KDataFields,TLiwVariant(import_map)); |
|
1134 |
inps->AppendL(param); |
|
1135 |
param.Reset(); |
|
1136 |
||
1137 |
interface->ExecuteCmdL(KImport,*inps,*outps,0,0); |
|
1138 |
import_map->DecRef(); |
|
1139 |
index=0; |
|
1140 |
||
1141 |
const TLiwGenericParam* import_err = outps->FindFirst(index,KErrorCode); |
|
1142 |
if(import_err) |
|
1143 |
result = import_err->Value().AsTInt32(); |
|
1144 |
} |
|
1145 |
} |
|
1146 |
||
1147 |
outps->Reset(); |
|
1148 |
inps->Reset(); |
|
1149 |
if(add_flag) |
|
1150 |
RemoveLandmark(inps,outps,interface); |
|
1151 |
||
1152 |
interface->Close(); |
|
1153 |
delete iServiceHandler; |
|
1154 |
__UHEAP_MARKEND; |
|
1155 |
return result; |
|
1156 |
} |
|
1157 |
||
1158 |
||
1159 |
||
1160 |
// ----------------------------------------------------------------------------- |
|
1161 |
// Ctlandmark_provider::ImportDBTypeIdCheck |
|
1162 |
// To test import and database URI type id check |
|
1163 |
// (other items were commented in a header). |
|
1164 |
// ----------------------------------------------------------------------------- |
|
1165 |
// |
|
1166 |
TInt Ctlandmark_provider::ImportDBTypeIdCheck( CStifItemParser& aItem ) |
|
1167 |
{ |
|
1168 |
__UHEAP_MARK; |
|
1169 |
_LIT(KName,"ImportTypeID"); |
|
1170 |
_LIT(KDescription,"ImportDb TypeID"); |
|
1171 |
_LIT(KFilePath, "c:\\importtypeid.lmx"); |
|
1172 |
//_LIT(KFilePath, "c:\\eposLmTestPos.lmx"); |
|
1173 |
_LIT(KPosMimeType, "application/vnd.nokia.landmarkcollection+xml"); |
|
1174 |
||
1175 |
TInt32 result = KErrNone; |
|
1176 |
TBuf<40> buf; |
|
1177 |
TInt add_flag =0; |
|
1178 |
||
1179 |
RFile LogResult; |
|
1180 |
RFs LogResultSession; |
|
1181 |
User::LeaveIfError(LogResultSession.Connect()); |
|
1182 |
if(LogResult.Open(LogResultSession ,KFilePath , EFileWrite | EFileShareAny ) != KErrNotFound) |
|
1183 |
{ |
|
1184 |
LogResult.Close(); |
|
1185 |
||
1186 |
LogResultSession.Delete(KFilePath); |
|
1187 |
||
1188 |
LogResultSession.Close(); |
|
1189 |
} |
|
1190 |
||
1191 |
LogResult.Close(); |
|
1192 |
LogResultSession.Close(); |
|
1193 |
||
1194 |
||
1195 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
1196 |
MLiwInterface* interface = NULL; |
|
1197 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
1198 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
1199 |
||
1200 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
1201 |
||
1202 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
1203 |
||
1204 |
RCriteriaArray a; |
|
1205 |
a.AppendL(crit); |
|
1206 |
||
1207 |
iServiceHandler->AttachL(a); |
|
1208 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
1209 |
||
1210 |
a.Reset(); |
|
1211 |
delete crit; |
|
1212 |
||
1213 |
TInt pos = 0; |
|
1214 |
||
1215 |
outps->FindFirst( pos, KIDataSource ); |
|
1216 |
if(pos != KErrNotFound) |
|
1217 |
{ |
|
1218 |
interface = (*outps)[pos].Value().AsInterface(); |
|
1219 |
} |
|
1220 |
||
1221 |
outps->Reset(); |
|
1222 |
inps->Reset(); |
|
1223 |
||
1224 |
TLiwGenericParam param; |
|
1225 |
TInt index = 0; |
|
1226 |
||
1227 |
result = AddLandMark(inps,outps,interface,KName,KDescription); |
|
1228 |
||
1229 |
if(!result) |
|
1230 |
{ |
|
1231 |
add_flag = 1; |
|
1232 |
GetLandMarkId(inps,outps,interface,KName,KDescription); |
|
1233 |
||
1234 |
// Call Export and then Import |
|
1235 |
||
1236 |
CLiwMap* export_map = CLiwDefaultMap::NewL(); |
|
1237 |
||
1238 |
CLiwList* landmarkIdList = CLiwDefaultList::NewL(); |
|
1239 |
landmarkIdList->AppendL(TLiwVariant(landmark_id)); |
|
1240 |
||
1241 |
export_map->InsertL(KDestinationFile,TLiwVariant(KFilePath)); |
|
1242 |
export_map->InsertL(KMimeType,TLiwVariant(KPosMimeType)); |
|
1243 |
export_map->InsertL(KIdList,TLiwVariant(landmarkIdList)); |
|
1244 |
landmarkIdList->DecRef(); |
|
1245 |
||
1246 |
param.SetNameAndValueL(KDataFields,TLiwVariant(export_map)); |
|
1247 |
inps->AppendL(param); |
|
1248 |
param.Reset(); |
|
1249 |
||
1250 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
1251 |
inps->AppendL(param); |
|
1252 |
param.Reset(); |
|
1253 |
||
1254 |
interface->ExecuteCmdL(KExport,*inps,*outps,0,0); |
|
1255 |
export_map->DecRef(); |
|
1256 |
index=0; |
|
1257 |
||
1258 |
const TLiwGenericParam* export_err = outps->FindFirst(index,KErrorCode); |
|
1259 |
if(export_err) |
|
1260 |
result = export_err->Value().AsTInt32(); |
|
1261 |
||
1262 |
if(!result) |
|
1263 |
{ |
|
1264 |
outps->Reset(); |
|
1265 |
inps->Reset(); |
|
1266 |
CLiwMap* import_map = CLiwDefaultMap::NewL(); |
|
1267 |
import_map->InsertL(KMimeType,TLiwVariant(KPosMimeType)); |
|
1268 |
import_map->InsertL(KSourceFile,TLiwVariant(KFilePath)); |
|
1269 |
import_map->InsertL(KDbUri,TLiwVariant((TInt32)25)); |
|
1270 |
||
1271 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
1272 |
inps->AppendL(param); |
|
1273 |
param.Reset(); |
|
1274 |
||
1275 |
param.SetNameAndValueL(KDataFields,TLiwVariant(import_map)); |
|
1276 |
inps->AppendL(param); |
|
1277 |
param.Reset(); |
|
1278 |
||
1279 |
interface->ExecuteCmdL(KImport,*inps,*outps,0,0); |
|
1280 |
import_map->DecRef(); |
|
1281 |
index=0; |
|
1282 |
||
1283 |
const TLiwGenericParam* import_err = outps->FindFirst(index,KErrorCode); |
|
1284 |
if(import_err) |
|
1285 |
result = import_err->Value().AsTInt32(); |
|
1286 |
} |
|
1287 |
} |
|
1288 |
||
1289 |
outps->Reset(); |
|
1290 |
inps->Reset(); |
|
1291 |
if(add_flag) |
|
1292 |
RemoveLandmark(inps,outps,interface); |
|
1293 |
||
1294 |
interface->Close(); |
|
1295 |
delete iServiceHandler; |
|
1296 |
||
1297 |
if(result == SErrBadArgumentType) |
|
1298 |
result = KErrNone; |
|
1299 |
__UHEAP_MARKEND; |
|
1300 |
return result; |
|
1301 |
} |
|
1302 |
||
1303 |
// ----------------------------------------------------------------------------- |
|
1304 |
// Ctlandmark_provider::TestAddMultipleLM |
|
1305 |
// To add multiple landmarks with same name and description and verifying the same using GetList |
|
1306 |
// (other items were commented in a header). |
|
1307 |
// ----------------------------------------------------------------------------- |
|
1308 |
// |
|
1309 |
TInt Ctlandmark_provider::TestAddMultipleLM( CStifItemParser& aItem ) |
|
1310 |
{ |
|
1311 |
_LIT(KName,"MultipleAdd"); |
|
1312 |
_LIT(KDescription,"Adding same landmark multiple times"); |
|
1313 |
TInt32 result = KErrNone; |
|
1314 |
TInt count = 0; |
|
1315 |
__UHEAP_MARK; |
|
1316 |
||
1317 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
1318 |
MLiwInterface* interface = NULL; |
|
1319 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
1320 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
1321 |
||
1322 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
1323 |
||
1324 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
1325 |
||
1326 |
RCriteriaArray a; |
|
1327 |
a.AppendL(crit); |
|
1328 |
||
1329 |
iServiceHandler->AttachL(a); |
|
1330 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
1331 |
||
1332 |
a.Reset(); |
|
1333 |
delete crit; |
|
1334 |
||
1335 |
TInt pos = 0; |
|
1336 |
||
1337 |
outps->FindFirst( pos, KIDataSource ); |
|
1338 |
if(pos != KErrNotFound) |
|
1339 |
{ |
|
1340 |
interface = (*outps)[pos].Value().AsInterface(); |
|
1341 |
} |
|
1342 |
||
1343 |
outps->Reset(); |
|
1344 |
inps->Reset(); |
|
1345 |
||
1346 |
||
1347 |
TPosition locale; |
|
1348 |
locale.SetCurrentTime(); |
|
1349 |
TLiwGenericParam param; |
|
1350 |
||
1351 |
// Add landmark twice |
|
1352 |
result = AddLandMark(inps,outps,interface,KName,KDescription); |
|
1353 |
||
1354 |
if(!result) |
|
1355 |
result = AddLandMark(inps,outps,interface,KName,KDescription); |
|
1356 |
||
1357 |
if(!result) |
|
1358 |
{ |
|
1359 |
// Call GetList |
|
1360 |
||
1361 |
CLiwMap* getlistlandmark_map = CLiwDefaultMap::NewL(); |
|
1362 |
CLiwMap* sort_map = CLiwDefaultMap::NewL(); |
|
1363 |
sort_map->InsertL(KSortOrder,TLiwVariant(KAscending)); |
|
1364 |
getlistlandmark_map->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
1365 |
getlistlandmark_map->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
|
1366 |
||
1367 |
param.SetNameAndValueL(KFilter,TLiwVariant(getlistlandmark_map)); |
|
1368 |
inps->AppendL(param); |
|
1369 |
param.Reset(); |
|
1370 |
||
1371 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
1372 |
inps->AppendL(param); |
|
1373 |
param.Reset(); |
|
1374 |
||
1375 |
param.SetNameAndValueL(KSort,TLiwVariant(sort_map)); |
|
1376 |
inps->AppendL(param); |
|
1377 |
param.Reset(); |
|
1378 |
||
1379 |
interface->ExecuteCmdL(KGetList,*inps,*outps,0,0); |
|
1380 |
getlistlandmark_map->DecRef(); |
|
1381 |
sort_map->DecRef(); |
|
1382 |
||
1383 |
TInt index=0; |
|
1384 |
||
1385 |
const TLiwGenericParam* getlist_err = outps->FindFirst(index,KErrorCode); |
|
1386 |
if(getlist_err) |
|
1387 |
result = getlist_err->Value().AsTInt32(); |
|
1388 |
||
1389 |
if(!result) |
|
1390 |
{ |
|
1391 |
//Get count of no of categories in the database. |
|
1392 |
pos=0; |
|
1393 |
const TLiwGenericParam* output = outps->FindFirst( pos,_L8("ReturnValue")); |
|
1394 |
||
1395 |
if(output) |
|
1396 |
{ |
|
1397 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
1398 |
||
1399 |
TLiwVariant data; |
|
1400 |
||
1401 |
while( iterlist->NextL(data)) |
|
1402 |
{ |
|
1403 |
count++; |
|
1404 |
const CLiwMap* res = data.AsMap(); |
|
1405 |
if ( res ) |
|
1406 |
{ |
|
1407 |
TLiwVariant new_data; |
|
1408 |
TLiwVariant desc_data; |
|
1409 |
if(res->FindL(KLandmarkName, new_data)) |
|
1410 |
{ |
|
1411 |
TPtrC name = new_data.AsDes(); |
|
1412 |
TBuf<40> name_data; |
|
1413 |
name_data.Copy(name); |
|
1414 |
iLog->Log(name_data); |
|
1415 |
} |
|
1416 |
if(res->FindL(KLandmarkDesc, desc_data)) |
|
1417 |
{ |
|
1418 |
TPtrC desc = desc_data.AsDes(); |
|
1419 |
TBuf<40> description; |
|
1420 |
description.Copy(desc); |
|
1421 |
iLog->Log(description); |
|
1422 |
} |
|
1423 |
new_data.Reset(); |
|
1424 |
desc_data.Reset(); |
|
1425 |
} |
|
1426 |
||
1427 |
} |
|
1428 |
data.Reset(); |
|
1429 |
} |
|
1430 |
} |
|
1431 |
||
1432 |
} |
|
1433 |
||
1434 |
outps->Reset(); |
|
1435 |
inps->Reset(); |
|
1436 |
||
1437 |
||
1438 |
interface->Close(); |
|
1439 |
delete iServiceHandler; |
|
1440 |
||
1441 |
__UHEAP_MARKEND; |
|
1442 |
return result; |
|
1443 |
} |
|
1444 |
||
1445 |
||
1446 |
||
1447 |
// ----------------------------------------------------------------------------- |
|
1448 |
// Ctlandmark_provider::TestGetListCTWithSortOrder |
|
1449 |
// To test GetList on category with sort order mentioned |
|
1450 |
// (other items were commented in a header). |
|
1451 |
// ----------------------------------------------------------------------------- |
|
1452 |
// |
|
1453 |
TInt Ctlandmark_provider::TestGetListCTWithSortOrder( CStifItemParser& aItem ) |
|
1454 |
{ |
|
1455 |
||
1456 |
TInt32 result = KErrNone; |
|
1457 |
TInt count = 0; |
|
1458 |
__UHEAP_MARK; |
|
1459 |
||
1460 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
1461 |
MLiwInterface* interface = NULL; |
|
1462 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
1463 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
1464 |
||
1465 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
1466 |
||
1467 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
1468 |
||
1469 |
RCriteriaArray a; |
|
1470 |
a.AppendL(crit); |
|
1471 |
||
1472 |
iServiceHandler->AttachL(a); |
|
1473 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
1474 |
||
1475 |
a.Reset(); |
|
1476 |
delete crit; |
|
1477 |
||
1478 |
TInt pos = 0; |
|
1479 |
||
1480 |
outps->FindFirst( pos, KIDataSource ); |
|
1481 |
if(pos != KErrNotFound) |
|
1482 |
{ |
|
1483 |
interface = (*outps)[pos].Value().AsInterface(); |
|
1484 |
} |
|
1485 |
||
1486 |
outps->Reset(); |
|
1487 |
inps->Reset(); |
|
1488 |
||
1489 |
||
1490 |
TPosition locale; |
|
1491 |
locale.SetCurrentTime(); |
|
1492 |
TLiwGenericParam param; |
|
1493 |
||
1494 |
if(!result) |
|
1495 |
{ |
|
1496 |
// Call GetList |
|
1497 |
||
1498 |
CLiwMap* getlistcategory_map = CLiwDefaultMap::NewL(); |
|
1499 |
CLiwMap* sort_map = CLiwDefaultMap::NewL(); |
|
1500 |
sort_map->InsertL(KSortOrder,TLiwVariant(KAscending)); |
|
1501 |
||
1502 |
param.SetNameAndValueL(KFilter,TLiwVariant(getlistcategory_map)); |
|
1503 |
inps->AppendL(param); |
|
1504 |
param.Reset(); |
|
1505 |
||
1506 |
param.SetNameAndValueL(KContentType,TLiwVariant(KCategory)); |
|
1507 |
inps->AppendL(param); |
|
1508 |
param.Reset(); |
|
1509 |
||
1510 |
param.SetNameAndValueL(KSort,TLiwVariant(sort_map)); |
|
1511 |
inps->AppendL(param); |
|
1512 |
param.Reset(); |
|
1513 |
||
1514 |
interface->ExecuteCmdL(KGetList,*inps,*outps,0,0); |
|
1515 |
getlistcategory_map->DecRef(); |
|
1516 |
sort_map->DecRef(); |
|
1517 |
||
1518 |
TInt index=0; |
|
1519 |
||
1520 |
const TLiwGenericParam* getlist_err = outps->FindFirst(index,KErrorCode); |
|
1521 |
if(getlist_err) |
|
1522 |
result = getlist_err->Value().AsTInt32(); |
|
1523 |
||
1524 |
if(!result) |
|
1525 |
{ |
|
1526 |
//Get count of no of categories in the database. |
|
1527 |
pos=0; |
|
1528 |
const TLiwGenericParam* output = outps->FindFirst( pos,_L8("ReturnValue")); |
|
1529 |
||
1530 |
if(output) |
|
1531 |
{ |
|
1532 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
1533 |
||
1534 |
TLiwVariant data; |
|
1535 |
||
1536 |
while( iterlist->NextL(data)) |
|
1537 |
{ |
|
1538 |
count++; |
|
1539 |
const CLiwMap* res = data.AsMap(); |
|
1540 |
if ( res ) |
|
1541 |
{ |
|
1542 |
TLiwVariant new_data; |
|
1543 |
if(res->FindL(KCategoryName, new_data)) |
|
1544 |
{ |
|
1545 |
TPtrC name = new_data.AsDes(); |
|
1546 |
TBuf<40> name_data; |
|
1547 |
name_data.Copy(name); |
|
1548 |
iLog->Log(name_data); |
|
1549 |
} |
|
1550 |
new_data.Reset(); |
|
1551 |
} |
|
1552 |
||
1553 |
} |
|
1554 |
data.Reset(); |
|
1555 |
} |
|
1556 |
} |
|
1557 |
||
1558 |
} |
|
1559 |
||
1560 |
outps->Reset(); |
|
1561 |
inps->Reset(); |
|
1562 |
||
1563 |
||
1564 |
interface->Close(); |
|
1565 |
delete iServiceHandler; |
|
1566 |
||
1567 |
__UHEAP_MARKEND; |
|
1568 |
return result; |
|
1569 |
} |
|
1570 |
||
1571 |
||
1572 |
// ----------------------------------------------------------------------------- |
|
1573 |
// Ctlandmark_provider::TestTemplateInvalidCase |
|
1574 |
// To test new template API for no content type and invalid content type |
|
1575 |
// (other items were commented in a header). |
|
1576 |
// ----------------------------------------------------------------------------- |
|
1577 |
// |
|
1578 |
TInt Ctlandmark_provider::TestTemplateInvalidCase( CStifItemParser& aItem ) |
|
1579 |
{ |
|
1580 |
TInt32 result = KErrNone; |
|
1581 |
||
1582 |
__UHEAP_MARK; |
|
1583 |
||
1584 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
1585 |
MLiwInterface* interface = NULL; |
|
1586 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
1587 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
1588 |
||
1589 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
1590 |
||
1591 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
1592 |
||
1593 |
RCriteriaArray a; |
|
1594 |
a.AppendL(crit); |
|
1595 |
||
1596 |
iServiceHandler->AttachL(a); |
|
1597 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
1598 |
||
1599 |
a.Reset(); |
|
1600 |
delete crit; |
|
1601 |
||
1602 |
TInt pos = 0; |
|
1603 |
||
1604 |
outps->FindFirst( pos, KIDataSource ); |
|
1605 |
if(pos != KErrNotFound) |
|
1606 |
{ |
|
1607 |
interface = (*outps)[pos].Value().AsInterface(); |
|
1608 |
} |
|
1609 |
||
1610 |
outps->Reset(); |
|
1611 |
inps->Reset(); |
|
1612 |
||
1613 |
||
1614 |
TLiwGenericParam param; |
|
1615 |
||
1616 |
// No INput == No content type |
|
1617 |
interface->ExecuteCmdL(KNew,*inps,*outps,0,0); |
|
1618 |
||
1619 |
TInt index = 0; |
|
1620 |
||
1621 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
1622 |
if(err) |
|
1623 |
result = err->Value().AsTInt32(); |
|
1624 |
||
1625 |
if(result == SErrMissingArgument) |
|
1626 |
{ |
|
1627 |
// invalid content type |
|
1628 |
outps->Reset(); |
|
1629 |
inps->Reset(); |
|
1630 |
param.SetNameAndValueL(KContentType,TLiwVariant(_L("Test"))); |
|
1631 |
inps->AppendL(param); |
|
1632 |
param.Reset(); |
|
1633 |
||
1634 |
interface->ExecuteCmdL(KNew,*inps,*outps,0,0); |
|
1635 |
index =0; |
|
1636 |
const TLiwGenericParam* err1 = outps->FindFirst(index,KErrorCode); |
|
1637 |
if(err1) |
|
1638 |
result = err1->Value().AsTInt32(); |
|
1639 |
||
1640 |
} |
|
1641 |
||
1642 |
outps->Reset(); |
|
1643 |
inps->Reset(); |
|
1644 |
interface->Close(); |
|
1645 |
delete iServiceHandler; |
|
1646 |
||
1647 |
__UHEAP_MARKEND; |
|
1648 |
if(result == SErrInvalidServiceArgument) |
|
1649 |
return KErrNone; |
|
1650 |
else |
|
1651 |
return result; |
|
1652 |
} |
|
1653 |
||
1654 |
||
1655 |
// ----------------------------------------------------------------------------- |
|
1656 |
// Ctlandmark_provider::TestTemplateLM |
|
1657 |
// To test new template API for landmarks |
|
1658 |
// (other items were commented in a header). |
|
1659 |
// ----------------------------------------------------------------------------- |
|
1660 |
// |
|
1661 |
TInt Ctlandmark_provider::TestTemplateLM( CStifItemParser& aItem ) |
|
1662 |
{ |
|
1663 |
TInt32 result = KErrNone; |
|
1664 |
||
1665 |
__UHEAP_MARK; |
|
1666 |
||
1667 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
1668 |
MLiwInterface* interface = NULL; |
|
1669 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
1670 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
1671 |
||
1672 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
1673 |
||
1674 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
1675 |
||
1676 |
RCriteriaArray a; |
|
1677 |
a.AppendL(crit); |
|
1678 |
||
1679 |
iServiceHandler->AttachL(a); |
|
1680 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
1681 |
||
1682 |
a.Reset(); |
|
1683 |
delete crit; |
|
1684 |
||
1685 |
TInt pos = 0; |
|
1686 |
||
1687 |
outps->FindFirst( pos, KIDataSource ); |
|
1688 |
if(pos != KErrNotFound) |
|
1689 |
{ |
|
1690 |
interface = (*outps)[pos].Value().AsInterface(); |
|
1691 |
} |
|
1692 |
||
1693 |
outps->Reset(); |
|
1694 |
inps->Reset(); |
|
1695 |
||
1696 |
||
1697 |
TLiwGenericParam param; |
|
1698 |
||
1699 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(KLandmark)); |
|
1700 |
inps->AppendL(param); |
|
1701 |
param.Reset(); |
|
1702 |
||
1703 |
interface->ExecuteCmdL(KNew,*inps,*outps,0,0); |
|
1704 |
pos = 0; |
|
1705 |
||
1706 |
const TLiwGenericParam* err = outps->FindFirst(pos,KErrorCode); |
|
1707 |
if(err) |
|
1708 |
result = err->Value().AsTInt32(); |
|
1709 |
||
1710 |
if(!result) |
|
1711 |
{ |
|
1712 |
// retreive the map |
|
1713 |
pos=0; |
|
1714 |
const TLiwGenericParam* output = outps->FindFirst( pos,_L8("ReturnValue")); |
|
1715 |
if(output) |
|
1716 |
{ |
|
1717 |
const CLiwMap *lm_template = NULL; |
|
1718 |
lm_template = output->Value().AsMap(); |
|
1719 |
if(!lm_template) |
|
1720 |
result = KErrGeneral; |
|
1721 |
} |
|
1722 |
} |
|
1723 |
outps->Reset(); |
|
1724 |
inps->Reset(); |
|
1725 |
interface->Close(); |
|
1726 |
delete iServiceHandler; |
|
1727 |
||
1728 |
__UHEAP_MARKEND; |
|
1729 |
return result; |
|
1730 |
} |
|
1731 |
||
1732 |
||
1733 |
// ----------------------------------------------------------------------------- |
|
1734 |
// Ctlandmark_provider::TestTemplateCT |
|
1735 |
// To test new template API for landmarks |
|
1736 |
// (other items were commented in a header). |
|
1737 |
// ----------------------------------------------------------------------------- |
|
1738 |
// |
|
1739 |
TInt Ctlandmark_provider::TestTemplateCT( CStifItemParser& aItem ) |
|
1740 |
{ |
|
1741 |
TInt32 result = KErrNone; |
|
1742 |
||
1743 |
__UHEAP_MARK; |
|
1744 |
||
1745 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
1746 |
MLiwInterface* interface = NULL; |
|
1747 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
1748 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
1749 |
||
1750 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
1751 |
||
1752 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
1753 |
||
1754 |
RCriteriaArray a; |
|
1755 |
a.AppendL(crit); |
|
1756 |
||
1757 |
iServiceHandler->AttachL(a); |
|
1758 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
1759 |
||
1760 |
a.Reset(); |
|
1761 |
delete crit; |
|
1762 |
||
1763 |
TInt pos = 0; |
|
1764 |
||
1765 |
outps->FindFirst( pos, KIDataSource ); |
|
1766 |
if(pos != KErrNotFound) |
|
1767 |
{ |
|
1768 |
interface = (*outps)[pos].Value().AsInterface(); |
|
1769 |
} |
|
1770 |
||
1771 |
outps->Reset(); |
|
1772 |
inps->Reset(); |
|
1773 |
||
1774 |
||
1775 |
TLiwGenericParam param; |
|
1776 |
||
1777 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(KCategory)); |
|
1778 |
inps->AppendL(param); |
|
1779 |
param.Reset(); |
|
1780 |
||
1781 |
interface->ExecuteCmdL(KNew,*inps,*outps,0,0); |
|
1782 |
pos = 0; |
|
1783 |
||
1784 |
const TLiwGenericParam* err = outps->FindFirst(pos,KErrorCode); |
|
1785 |
if(err) |
|
1786 |
result = err->Value().AsTInt32(); |
|
1787 |
||
1788 |
if(!result) |
|
1789 |
{ |
|
1790 |
// retreive the map |
|
1791 |
pos=0; |
|
1792 |
const TLiwGenericParam* output = outps->FindFirst( pos,_L8("ReturnValue")); |
|
1793 |
if(output) |
|
1794 |
{ |
|
1795 |
const CLiwMap *ct_template = NULL; |
|
1796 |
ct_template = output->Value().AsMap(); |
|
1797 |
if(!ct_template) |
|
1798 |
result = KErrGeneral; |
|
1799 |
} |
|
1800 |
} |
|
1801 |
outps->Reset(); |
|
1802 |
inps->Reset(); |
|
1803 |
interface->Close(); |
|
1804 |
delete iServiceHandler; |
|
1805 |
||
1806 |
__UHEAP_MARKEND; |
|
1807 |
return result; |
|
1808 |
} |
|
1809 |
||
1810 |
||
1811 |
// ----------------------------------------------------------------------------- |
|
1812 |
// Ctlandmark_provider::TestNoTid |
|
1813 |
// To cancel async call with no transaction Id |
|
1814 |
// (other items were commented in a header). |
|
1815 |
// ----------------------------------------------------------------------------- |
|
1816 |
// |
|
1817 |
TInt Ctlandmark_provider::TestNoTid( CStifItemParser& aItem ) |
|
1818 |
{ |
|
1819 |
||
1820 |
__UHEAP_MARK; |
|
1821 |
CTestAsync* test = CTestAsync::NewL(1); |
|
1822 |
test->Start(); |
|
1823 |
TInt32 Err = test->Result(); |
|
1824 |
delete test; |
|
1825 |
__UHEAP_MARKEND; |
|
1826 |
iLog->Log(_L("back to test case")); |
|
1827 |
if(Err != SErrMissingArgument) |
|
1828 |
return Err; |
|
1829 |
else |
|
1830 |
return KErrNone; |
|
1831 |
} |
|
1832 |
||
1833 |
// ----------------------------------------------------------------------------- |
|
1834 |
// Ctlandmark_provider::TestInvalidTid |
|
1835 |
// To cancel async call with Invalid transaction Id |
|
1836 |
// (other items were commented in a header). |
|
1837 |
// ----------------------------------------------------------------------------- |
|
1838 |
// |
|
1839 |
TInt Ctlandmark_provider::TestInvalidTid( CStifItemParser& aItem ) |
|
1840 |
{ |
|
1841 |
__UHEAP_MARK; |
|
1842 |
CTestAsync* test = CTestAsync::NewL(4); |
|
1843 |
test->Start(); |
|
1844 |
TInt32 Err = test->Result(); |
|
1845 |
delete test; |
|
1846 |
__UHEAP_MARKEND; |
|
1847 |
return Err; |
|
1848 |
} |
|
1849 |
||
1850 |
// ----------------------------------------------------------------------------- |
|
1851 |
// Ctlandmark_provider::TestAddLMVarByOrder |
|
1852 |
// To call Add with diff order of inputs |
|
1853 |
// (other items were commented in a header). |
|
1854 |
// ----------------------------------------------------------------------------- |
|
1855 |
// |
|
1856 |
TInt Ctlandmark_provider::TestAddLMVarByOrder( CStifItemParser& aItem ) |
|
1857 |
{ |
|
1858 |
_LIT(KName,"Mainland india"); |
|
1859 |
_LIT(KDescription,"Extremely good indian food"); |
|
1860 |
_LIT(KPhone1,"123456"); |
|
1861 |
_LIT(KOffice1,"eat"); |
|
1862 |
_LIT(KOffice2,"sleep"); |
|
1863 |
_LIT(KOffice3,"drink"); |
|
1864 |
TReal64 latitude = 45.1122; |
|
1865 |
TReal64 longitude = 34.0099; |
|
1866 |
TReal32 altitude = 41.0022; |
|
1867 |
TReal32 hacc = 0.1234; |
|
1868 |
TReal32 vacc = 0.3456; |
|
1869 |
TInt32 result = KErrNone; |
|
1870 |
||
1871 |
__UHEAP_MARK; |
|
1872 |
||
1873 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
1874 |
MLiwInterface* interface = NULL; |
|
1875 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
1876 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
1877 |
||
1878 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
1879 |
||
1880 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
1881 |
||
1882 |
RCriteriaArray a; |
|
1883 |
a.AppendL(crit); |
|
1884 |
||
1885 |
iServiceHandler->AttachL(a); |
|
1886 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
1887 |
||
1888 |
a.Reset(); |
|
1889 |
delete crit; |
|
1890 |
||
1891 |
TInt pos = 0; |
|
1892 |
||
1893 |
outps->FindFirst( pos, KIDataSource ); |
|
1894 |
if(pos != KErrNotFound) |
|
1895 |
{ |
|
1896 |
interface = (*outps)[pos].Value().AsInterface(); |
|
1897 |
} |
|
1898 |
||
1899 |
outps->Reset(); |
|
1900 |
inps->Reset(); |
|
1901 |
||
1902 |
||
1903 |
TPosition locale; |
|
1904 |
locale.SetCurrentTime(); |
|
1905 |
||
1906 |
CLiwMap* landmarkMap = CLiwDefaultMap::NewL(); |
|
1907 |
TLiwGenericParam param; |
|
1908 |
||
1909 |
||
1910 |
//name |
|
1911 |
landmarkMap->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
1912 |
||
1913 |
//description |
|
1914 |
landmarkMap->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
|
1915 |
||
1916 |
param.SetNameAndValueL(KDataFields,TLiwVariant(landmarkMap)); |
|
1917 |
inps->AppendL(param); |
|
1918 |
param.Reset(); |
|
1919 |
||
1920 |
||
1921 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
1922 |
inps->AppendL(param); |
|
1923 |
param.Reset(); |
|
1924 |
||
1925 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
1926 |
landmarkMap->DecRef(); |
|
1927 |
||
1928 |
TInt index = 0; |
|
1929 |
||
1930 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
1931 |
if(err) |
|
1932 |
result = err->Value().AsTInt32(); |
|
1933 |
||
1934 |
outps->Reset(); |
|
1935 |
inps->Reset(); |
|
1936 |
// Remove the landmark added |
|
1937 |
||
1938 |
if(!result) |
|
1939 |
{ |
|
1940 |
GetLandMarkId(inps,outps,interface,KName,KDescription); |
|
1941 |
result = RemoveLandmark(inps,outps,interface); |
|
1942 |
} |
|
1943 |
||
1944 |
interface->Close(); |
|
1945 |
delete iServiceHandler; |
|
1946 |
||
1947 |
__UHEAP_MARKEND; |
|
1948 |
return result; |
|
1949 |
||
1950 |
} |
|
1951 |
||
1952 |
// ----------------------------------------------------------------------------- |
|
1953 |
// Ctlandmark_provider::TestAddLMVarByPos |
|
1954 |
// To test position based parsing for Add |
|
1955 |
// (other items were commented in a header). |
|
1956 |
// ----------------------------------------------------------------------------- |
|
1957 |
// |
|
1958 |
TInt Ctlandmark_provider::TestAddLMVarByPos( CStifItemParser& aItem ) |
|
1959 |
{ |
|
1960 |
_LIT(KName,"Mainland India"); |
|
1961 |
_LIT(KDescription,"Extremely food"); |
|
1962 |
_LIT(KPhone1,"123456"); |
|
1963 |
_LIT(KOffice1,"eat"); |
|
1964 |
_LIT(KOffice2,"sleep"); |
|
1965 |
_LIT(KOffice3,"drink"); |
|
1966 |
TReal64 latitude = 45.1122; |
|
1967 |
TReal64 longitude = 34.0099; |
|
1968 |
TReal32 altitude = 41.0022; |
|
1969 |
TReal32 hacc = 0.1234; |
|
1970 |
TReal32 vacc = 0.3456; |
|
1971 |
TInt32 result = KErrNone; |
|
1972 |
||
1973 |
__UHEAP_MARK; |
|
1974 |
||
1975 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
1976 |
MLiwInterface* interface = NULL; |
|
1977 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
1978 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
1979 |
||
1980 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
1981 |
||
1982 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
1983 |
||
1984 |
RCriteriaArray a; |
|
1985 |
a.AppendL(crit); |
|
1986 |
||
1987 |
iServiceHandler->AttachL(a); |
|
1988 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
1989 |
||
1990 |
a.Reset(); |
|
1991 |
delete crit; |
|
1992 |
||
1993 |
TInt pos = 0; |
|
1994 |
||
1995 |
outps->FindFirst( pos, KIDataSource ); |
|
1996 |
if(pos != KErrNotFound) |
|
1997 |
{ |
|
1998 |
interface = (*outps)[pos].Value().AsInterface(); |
|
1999 |
} |
|
2000 |
||
2001 |
outps->Reset(); |
|
2002 |
inps->Reset(); |
|
2003 |
||
2004 |
||
2005 |
TPosition locale; |
|
2006 |
locale.SetCurrentTime(); |
|
2007 |
||
2008 |
CLiwMap* landmarkMap = CLiwDefaultMap::NewL(); |
|
2009 |
TLiwGenericParam param; |
|
2010 |
||
2011 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(KLandmark)); |
|
2012 |
inps->AppendL(param); |
|
2013 |
param.Reset(); |
|
2014 |
||
2015 |
landmarkMap->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
2016 |
//description |
|
2017 |
landmarkMap->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
|
2018 |
||
2019 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(landmarkMap)); |
|
2020 |
inps->AppendL(param); |
|
2021 |
param.Reset(); |
|
2022 |
||
2023 |
||
2024 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
2025 |
landmarkMap->DecRef(); |
|
2026 |
||
2027 |
TInt index = 0; |
|
2028 |
||
2029 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
2030 |
if(err) |
|
2031 |
result = err->Value().AsTInt32(); |
|
2032 |
||
2033 |
outps->Reset(); |
|
2034 |
inps->Reset(); |
|
2035 |
// Remove the landmark added |
|
2036 |
||
2037 |
if(!result) |
|
2038 |
{ |
|
2039 |
GetLandMarkId(inps,outps,interface,KName,KDescription); |
|
2040 |
result = RemoveLandmark(inps,outps,interface); |
|
2041 |
} |
|
2042 |
||
2043 |
interface->Close(); |
|
2044 |
delete iServiceHandler; |
|
2045 |
||
2046 |
__UHEAP_MARKEND; |
|
2047 |
return result; |
|
2048 |
} |
|
2049 |
||
2050 |
// ----------------------------------------------------------------------------- |
|
2051 |
// Ctlandmark_provider::TestAddCTVarByOrder |
|
2052 |
// To call Add (category)with diff order of inputs |
|
2053 |
// (other items were commented in a header). |
|
2054 |
// ----------------------------------------------------------------------------- |
|
2055 |
// |
|
2056 |
TInt Ctlandmark_provider::TestAddCTVarByOrder( CStifItemParser& aItem ) |
|
2057 |
{ |
|
2058 |
_LIT(KName,"New cat"); |
|
2059 |
TInt32 result = KErrNone; |
|
2060 |
||
2061 |
__UHEAP_MARK; |
|
2062 |
||
2063 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
2064 |
MLiwInterface* interface = NULL; |
|
2065 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
2066 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
2067 |
||
2068 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
2069 |
||
2070 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2071 |
||
2072 |
RCriteriaArray a; |
|
2073 |
a.AppendL(crit); |
|
2074 |
||
2075 |
iServiceHandler->AttachL(a); |
|
2076 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
2077 |
||
2078 |
a.Reset(); |
|
2079 |
delete crit; |
|
2080 |
||
2081 |
TInt pos = 0; |
|
2082 |
||
2083 |
outps->FindFirst( pos, KIDataSource ); |
|
2084 |
if(pos != KErrNotFound) |
|
2085 |
{ |
|
2086 |
interface = (*outps)[pos].Value().AsInterface(); |
|
2087 |
} |
|
2088 |
||
2089 |
outps->Reset(); |
|
2090 |
inps->Reset(); |
|
2091 |
||
2092 |
||
2093 |
TPosition locale; |
|
2094 |
locale.SetCurrentTime(); |
|
2095 |
||
2096 |
CLiwMap* categoryMap = CLiwDefaultMap::NewL(); |
|
2097 |
TLiwGenericParam param; |
|
2098 |
||
2099 |
||
2100 |
//name |
|
2101 |
categoryMap->InsertL(KCategoryName,TLiwVariant(KName)); |
|
2102 |
||
2103 |
||
2104 |
param.SetNameAndValueL(KDataFields,TLiwVariant(categoryMap)); |
|
2105 |
inps->AppendL(param); |
|
2106 |
param.Reset(); |
|
2107 |
||
2108 |
||
2109 |
param.SetNameAndValueL(KContentType,TLiwVariant(KCategory)); |
|
2110 |
inps->AppendL(param); |
|
2111 |
param.Reset(); |
|
2112 |
||
2113 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
2114 |
categoryMap->DecRef(); |
|
2115 |
||
2116 |
TInt index = 0; |
|
2117 |
||
2118 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
2119 |
if(err) |
|
2120 |
result = err->Value().AsTInt32(); |
|
2121 |
||
2122 |
outps->Reset(); |
|
2123 |
inps->Reset(); |
|
2124 |
// Remove the category added |
|
2125 |
||
2126 |
if(!result || result == SErrEntryExists) |
|
2127 |
{ |
|
2128 |
GetCatId(inps,outps,interface,KName); |
|
2129 |
result = RemoveCategory(inps,outps,interface); |
|
2130 |
} |
|
2131 |
||
2132 |
interface->Close(); |
|
2133 |
delete iServiceHandler; |
|
2134 |
||
2135 |
__UHEAP_MARKEND; |
|
2136 |
return result; |
|
2137 |
} |
|
2138 |
||
2139 |
// ----------------------------------------------------------------------------- |
|
2140 |
// Ctlandmark_provider::TestAddCTVarByPos |
|
2141 |
// To call Add (category)with diff order of inputs |
|
2142 |
// (other items were commented in a header). |
|
2143 |
// ----------------------------------------------------------------------------- |
|
2144 |
// |
|
2145 |
TInt Ctlandmark_provider::TestAddCTVarByPos( CStifItemParser& aItem ) |
|
2146 |
{ |
|
2147 |
_LIT(KName,"New cat"); |
|
2148 |
TInt32 result = KErrNone; |
|
2149 |
||
2150 |
__UHEAP_MARK; |
|
2151 |
||
2152 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
2153 |
MLiwInterface* interface = NULL; |
|
2154 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
2155 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
2156 |
||
2157 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
2158 |
||
2159 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2160 |
||
2161 |
RCriteriaArray a; |
|
2162 |
a.AppendL(crit); |
|
2163 |
||
2164 |
iServiceHandler->AttachL(a); |
|
2165 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
2166 |
||
2167 |
a.Reset(); |
|
2168 |
delete crit; |
|
2169 |
||
2170 |
TInt pos = 0; |
|
2171 |
||
2172 |
outps->FindFirst( pos, KIDataSource ); |
|
2173 |
if(pos != KErrNotFound) |
|
2174 |
{ |
|
2175 |
interface = (*outps)[pos].Value().AsInterface(); |
|
2176 |
} |
|
2177 |
||
2178 |
outps->Reset(); |
|
2179 |
inps->Reset(); |
|
2180 |
||
2181 |
||
2182 |
TPosition locale; |
|
2183 |
locale.SetCurrentTime(); |
|
2184 |
||
2185 |
CLiwMap* categoryMap = CLiwDefaultMap::NewL(); |
|
2186 |
TLiwGenericParam param; |
|
2187 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(KCategory)); |
|
2188 |
inps->AppendL(param); |
|
2189 |
param.Reset(); |
|
2190 |
||
2191 |
//name |
|
2192 |
categoryMap->InsertL(KCategoryName,TLiwVariant(KName)); |
|
2193 |
||
2194 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(categoryMap)); |
|
2195 |
inps->AppendL(param); |
|
2196 |
param.Reset(); |
|
2197 |
||
2198 |
||
2199 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
2200 |
categoryMap->DecRef(); |
|
2201 |
||
2202 |
TInt index = 0; |
|
2203 |
||
2204 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
2205 |
if(err) |
|
2206 |
result = err->Value().AsTInt32(); |
|
2207 |
||
2208 |
outps->Reset(); |
|
2209 |
inps->Reset(); |
|
2210 |
// Remove the category added |
|
2211 |
||
2212 |
if(!result || result == SErrEntryExists) |
|
2213 |
{ |
|
2214 |
GetCatId(inps,outps,interface,KName); |
|
2215 |
result = RemoveCategory(inps,outps,interface); |
|
2216 |
} |
|
2217 |
interface->Close(); |
|
2218 |
delete iServiceHandler; |
|
2219 |
||
2220 |
__UHEAP_MARKEND; |
|
2221 |
return result; |
|
2222 |
||
2223 |
} |
|
2224 |
||
2225 |
// ----------------------------------------------------------------------------- |
|
2226 |
// Ctlandmark_provider::TestGetListLMVarByOrder |
|
2227 |
// To test GetList on landmark changing the order of arguments |
|
2228 |
// (other items were commented in a header). |
|
2229 |
// ----------------------------------------------------------------------------- |
|
2230 |
// |
|
2231 |
TInt Ctlandmark_provider::TestGetListLMVarByOrder( CStifItemParser& aItem ) |
|
2232 |
{ |
|
2233 |
_LIT(KName,"GetListLandmark_byorder"); |
|
2234 |
_LIT(KDescription,"TestGetListLandmark_byorder"); |
|
2235 |
||
2236 |
TInt32 result = KErrNone; |
|
2237 |
TInt count = 0; |
|
2238 |
__UHEAP_MARK; |
|
2239 |
||
2240 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
2241 |
MLiwInterface* interface = NULL; |
|
2242 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
2243 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
2244 |
||
2245 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
2246 |
||
2247 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2248 |
||
2249 |
RCriteriaArray a; |
|
2250 |
a.AppendL(crit); |
|
2251 |
||
2252 |
iServiceHandler->AttachL(a); |
|
2253 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
2254 |
||
2255 |
a.Reset(); |
|
2256 |
delete crit; |
|
2257 |
||
2258 |
TInt pos = 0; |
|
2259 |
||
2260 |
outps->FindFirst( pos, KIDataSource ); |
|
2261 |
if(pos != KErrNotFound) |
|
2262 |
{ |
|
2263 |
interface = (*outps)[pos].Value().AsInterface(); |
|
2264 |
} |
|
2265 |
||
2266 |
outps->Reset(); |
|
2267 |
inps->Reset(); |
|
2268 |
||
2269 |
||
2270 |
TPosition locale; |
|
2271 |
locale.SetCurrentTime(); |
|
2272 |
||
2273 |
CLiwMap* landmarkMap = CLiwDefaultMap::NewL(); |
|
2274 |
TLiwGenericParam param; |
|
2275 |
||
2276 |
||
2277 |
//name |
|
2278 |
landmarkMap->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
2279 |
||
2280 |
//description |
|
2281 |
landmarkMap->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
|
2282 |
||
2283 |
param.SetNameAndValueL(KDataFields,TLiwVariant(landmarkMap)); |
|
2284 |
inps->AppendL(param); |
|
2285 |
param.Reset(); |
|
2286 |
||
2287 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
2288 |
inps->AppendL(param); |
|
2289 |
param.Reset(); |
|
2290 |
||
2291 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
2292 |
landmarkMap->DecRef(); |
|
2293 |
||
2294 |
TInt index = 0; |
|
2295 |
||
2296 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
2297 |
if(err) |
|
2298 |
result = err->Value().AsTInt32(); |
|
2299 |
||
2300 |
outps->Reset(); |
|
2301 |
inps->Reset(); |
|
2302 |
if(!result) |
|
2303 |
{ |
|
2304 |
// Call GetList |
|
2305 |
||
2306 |
CLiwMap* getlistlandmark_map = CLiwDefaultMap::NewL(); |
|
2307 |
getlistlandmark_map->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
2308 |
||
2309 |
//description |
|
37
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
2310 |
//getlistlandmark_map->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
19 | 2311 |
|
2312 |
param.SetNameAndValueL(KFilter,TLiwVariant(getlistlandmark_map)); |
|
2313 |
inps->AppendL(param); |
|
2314 |
param.Reset(); |
|
2315 |
||
2316 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
2317 |
inps->AppendL(param); |
|
2318 |
param.Reset(); |
|
2319 |
||
2320 |
interface->ExecuteCmdL(KGetList,*inps,*outps,0,0); |
|
2321 |
getlistlandmark_map->DecRef(); |
|
2322 |
||
2323 |
index=0; |
|
2324 |
||
2325 |
const TLiwGenericParam* getlist_err = outps->FindFirst(index,KErrorCode); |
|
2326 |
if(getlist_err) |
|
2327 |
result = getlist_err->Value().AsTInt32(); |
|
2328 |
||
2329 |
if(!result) |
|
2330 |
{ |
|
2331 |
//Get count of no of landmarks in the database. It should be atleast one |
|
2332 |
pos=0; |
|
2333 |
const TLiwGenericParam* output = outps->FindFirst( pos,_L8("ReturnValue")); |
|
2334 |
||
2335 |
if(output) |
|
2336 |
{ |
|
2337 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
2338 |
||
2339 |
TLiwVariant data; |
|
2340 |
||
2341 |
while( iterlist->NextL(data)) |
|
2342 |
{ |
|
2343 |
count++; |
|
2344 |
||
2345 |
} |
|
2346 |
data.Reset(); |
|
2347 |
} |
|
2348 |
} |
|
2349 |
||
2350 |
} |
|
2351 |
if(count == 0) |
|
2352 |
result = KErrGeneral; |
|
2353 |
||
2354 |
outps->Reset(); |
|
2355 |
inps->Reset(); |
|
2356 |
||
2357 |
// Remove the landmark added |
|
2358 |
||
2359 |
GetLandMarkId(inps,outps,interface,KName,KDescription); |
|
2360 |
RemoveLandmark(inps,outps,interface); |
|
2361 |
||
2362 |
interface->Close(); |
|
2363 |
delete iServiceHandler; |
|
2364 |
||
2365 |
__UHEAP_MARKEND; |
|
2366 |
return result; |
|
2367 |
} |
|
2368 |
||
2369 |
// ----------------------------------------------------------------------------- |
|
2370 |
// Ctlandmark_provider::TestGetListLMVarByPos |
|
2371 |
// To test GetList for position based parsing for landmarks |
|
2372 |
// (other items were commented in a header). |
|
2373 |
// ----------------------------------------------------------------------------- |
|
2374 |
// |
|
2375 |
TInt Ctlandmark_provider::TestGetListLMVarByPos( CStifItemParser& aItem ) |
|
2376 |
{ |
|
2377 |
_LIT(KName,"Landmark1"); |
|
2378 |
_LIT(KDescription,"TestLandmark1"); |
|
2379 |
||
2380 |
TInt32 result = KErrNone; |
|
2381 |
||
2382 |
__UHEAP_MARK; |
|
2383 |
||
2384 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
2385 |
MLiwInterface* interface = NULL; |
|
2386 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
2387 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
2388 |
||
2389 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
2390 |
||
2391 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2392 |
||
2393 |
RCriteriaArray a; |
|
2394 |
a.AppendL(crit); |
|
2395 |
||
2396 |
iServiceHandler->AttachL(a); |
|
2397 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
2398 |
||
2399 |
a.Reset(); |
|
2400 |
delete crit; |
|
2401 |
||
2402 |
TInt pos = 0; |
|
2403 |
||
2404 |
outps->FindFirst( pos, KIDataSource ); |
|
2405 |
if(pos != KErrNotFound) |
|
2406 |
{ |
|
2407 |
interface = (*outps)[pos].Value().AsInterface(); |
|
2408 |
} |
|
2409 |
||
2410 |
outps->Reset(); |
|
2411 |
inps->Reset(); |
|
2412 |
||
2413 |
||
2414 |
TPosition locale; |
|
2415 |
locale.SetCurrentTime(); |
|
2416 |
||
2417 |
CLiwMap* landmarkMap = CLiwDefaultMap::NewL(); |
|
2418 |
TLiwGenericParam param; |
|
2419 |
||
2420 |
||
2421 |
//name |
|
2422 |
landmarkMap->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
2423 |
||
2424 |
//description |
|
2425 |
landmarkMap->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
|
2426 |
||
2427 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
2428 |
inps->AppendL(param); |
|
2429 |
param.Reset(); |
|
2430 |
||
2431 |
param.SetNameAndValueL(KDataFields,TLiwVariant(landmarkMap)); |
|
2432 |
inps->AppendL(param); |
|
2433 |
param.Reset(); |
|
2434 |
||
2435 |
||
2436 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
2437 |
landmarkMap->DecRef(); |
|
2438 |
||
2439 |
TInt index = 0; |
|
2440 |
||
2441 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
2442 |
if(err) |
|
2443 |
result = err->Value().AsTInt32(); |
|
2444 |
||
2445 |
outps->Reset(); |
|
2446 |
inps->Reset(); |
|
2447 |
if(!result) |
|
2448 |
{ |
|
2449 |
// Call GetList |
|
2450 |
||
2451 |
CLiwMap* getlistlandmark_map = CLiwDefaultMap::NewL(); |
|
2452 |
getlistlandmark_map->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
2453 |
||
2454 |
//description |
|
2455 |
getlistlandmark_map->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
|
2456 |
||
2457 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(KLandmark)); |
|
2458 |
inps->AppendL(param); |
|
2459 |
param.Reset(); |
|
2460 |
||
2461 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(getlistlandmark_map)); |
|
2462 |
inps->AppendL(param); |
|
2463 |
param.Reset(); |
|
2464 |
||
2465 |
interface->ExecuteCmdL(KGetList,*inps,*outps,0,0); |
|
2466 |
getlistlandmark_map->DecRef(); |
|
2467 |
||
2468 |
index=0; |
|
2469 |
||
2470 |
const TLiwGenericParam* getlist_err = outps->FindFirst(index,KErrorCode); |
|
2471 |
if(getlist_err) |
|
2472 |
result = getlist_err->Value().AsTInt32(); |
|
2473 |
||
2474 |
} |
|
2475 |
||
2476 |
outps->Reset(); |
|
2477 |
inps->Reset(); |
|
2478 |
||
2479 |
// Remove the landmark added |
|
2480 |
||
2481 |
GetLandMarkId(inps,outps,interface,KName,KDescription); |
|
2482 |
RemoveLandmark(inps,outps,interface); |
|
2483 |
||
2484 |
interface->Close(); |
|
2485 |
delete iServiceHandler; |
|
2486 |
||
2487 |
__UHEAP_MARKEND; |
|
2488 |
return result; |
|
2489 |
} |
|
2490 |
||
2491 |
// ----------------------------------------------------------------------------- |
|
2492 |
// Ctlandmark_provider::TestGetListCTVarByOrder |
|
2493 |
// To test GetList on category changing the order of arguments |
|
2494 |
// (other items were commented in a header). |
|
2495 |
// ----------------------------------------------------------------------------- |
|
2496 |
// |
|
2497 |
TInt Ctlandmark_provider::TestGetListCTVarByOrder( CStifItemParser& aItem ) |
|
2498 |
{ |
|
2499 |
_LIT(KName,"India"); |
|
2500 |
_LIT(KDescription,"Culture"); |
|
2501 |
||
2502 |
TInt32 result = KErrNone; |
|
2503 |
||
2504 |
__UHEAP_MARK; |
|
2505 |
||
2506 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
2507 |
MLiwInterface* interface = NULL; |
|
2508 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
2509 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
2510 |
||
2511 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
2512 |
||
2513 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2514 |
||
2515 |
RCriteriaArray a; |
|
2516 |
a.AppendL(crit); |
|
2517 |
||
2518 |
iServiceHandler->AttachL(a); |
|
2519 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
2520 |
||
2521 |
a.Reset(); |
|
2522 |
delete crit; |
|
2523 |
||
2524 |
TInt pos = 0; |
|
2525 |
||
2526 |
outps->FindFirst( pos, KIDataSource ); |
|
2527 |
if(pos != KErrNotFound) |
|
2528 |
{ |
|
2529 |
interface = (*outps)[pos].Value().AsInterface(); |
|
2530 |
} |
|
2531 |
||
2532 |
outps->Reset(); |
|
2533 |
inps->Reset(); |
|
2534 |
||
2535 |
||
2536 |
TPosition locale; |
|
2537 |
locale.SetCurrentTime(); |
|
2538 |
||
2539 |
CLiwMap* categoryMap = CLiwDefaultMap::NewL(); |
|
2540 |
TLiwGenericParam param; |
|
2541 |
||
2542 |
||
2543 |
//name |
|
2544 |
categoryMap->InsertL(KCategoryName,TLiwVariant(KName)); |
|
2545 |
||
2546 |
param.SetNameAndValueL(KDataFields,TLiwVariant(categoryMap)); |
|
2547 |
inps->AppendL(param); |
|
2548 |
param.Reset(); |
|
2549 |
||
2550 |
param.SetNameAndValueL(KContentType,TLiwVariant(KCategory)); |
|
2551 |
inps->AppendL(param); |
|
2552 |
param.Reset(); |
|
2553 |
||
2554 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
2555 |
categoryMap->DecRef(); |
|
2556 |
||
2557 |
TInt index = 0; |
|
2558 |
||
2559 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
2560 |
if(err) |
|
2561 |
result = err->Value().AsTInt32(); |
|
2562 |
||
2563 |
outps->Reset(); |
|
2564 |
inps->Reset(); |
|
2565 |
if(!result || result == SErrEntryExists) |
|
2566 |
{ |
|
2567 |
// Call GetList |
|
2568 |
||
2569 |
CLiwMap* getlistcategory_map = CLiwDefaultMap::NewL(); |
|
2570 |
getlistcategory_map->InsertL(KCategoryName,TLiwVariant(KName)); |
|
2571 |
||
2572 |
getlistcategory_map->InsertL(KMaximumMatches,TLiwVariant(TInt32(10))); |
|
2573 |
// getlistcategory_map->InsertL(KPrevMatchesOnly,TLiwVariant(TBool(ETrue))); |
|
2574 |
||
2575 |
param.SetNameAndValueL(KFilter,TLiwVariant(getlistcategory_map)); |
|
2576 |
inps->AppendL(param); |
|
2577 |
param.Reset(); |
|
2578 |
||
2579 |
param.SetNameAndValueL(KContentType,TLiwVariant(KCategory)); |
|
2580 |
inps->AppendL(param); |
|
2581 |
param.Reset(); |
|
2582 |
||
2583 |
interface->ExecuteCmdL(KGetList,*inps,*outps,0,0); |
|
2584 |
getlistcategory_map->DecRef(); |
|
2585 |
||
2586 |
index=0; |
|
2587 |
||
2588 |
const TLiwGenericParam* getlist_err = outps->FindFirst(index,KErrorCode); |
|
2589 |
if(getlist_err) |
|
2590 |
result = getlist_err->Value().AsTInt32(); |
|
2591 |
||
2592 |
} |
|
2593 |
||
2594 |
outps->Reset(); |
|
2595 |
inps->Reset(); |
|
2596 |
||
2597 |
// Remove the category added |
|
2598 |
||
2599 |
GetCatId(inps,outps,interface,KName); |
|
2600 |
RemoveCategory(inps,outps,interface); |
|
2601 |
||
2602 |
interface->Close(); |
|
2603 |
delete iServiceHandler; |
|
2604 |
||
2605 |
__UHEAP_MARKEND; |
|
2606 |
return result; |
|
2607 |
} |
|
2608 |
||
2609 |
// ----------------------------------------------------------------------------- |
|
2610 |
// Ctlandmark_provider::TestGetListCTVarByPos |
|
2611 |
// To test position based parsing for getlist category |
|
2612 |
// (other items were commented in a header). |
|
2613 |
// ----------------------------------------------------------------------------- |
|
2614 |
// |
|
2615 |
TInt Ctlandmark_provider::TestGetListCTVarByPos( CStifItemParser& aItem ) |
|
2616 |
{ |
|
2617 |
_LIT(KName,"India"); |
|
2618 |
_LIT(KDescription,"Culture"); |
|
2619 |
||
2620 |
TInt32 result = KErrNone; |
|
2621 |
||
2622 |
__UHEAP_MARK; |
|
2623 |
||
2624 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
2625 |
MLiwInterface* interface = NULL; |
|
2626 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
2627 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
2628 |
||
2629 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
2630 |
||
2631 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2632 |
||
2633 |
RCriteriaArray a; |
|
2634 |
a.AppendL(crit); |
|
2635 |
||
2636 |
iServiceHandler->AttachL(a); |
|
2637 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
2638 |
||
2639 |
a.Reset(); |
|
2640 |
delete crit; |
|
2641 |
||
2642 |
TInt pos = 0; |
|
2643 |
||
2644 |
outps->FindFirst( pos, KIDataSource ); |
|
2645 |
if(pos != KErrNotFound) |
|
2646 |
{ |
|
2647 |
interface = (*outps)[pos].Value().AsInterface(); |
|
2648 |
} |
|
2649 |
||
2650 |
outps->Reset(); |
|
2651 |
inps->Reset(); |
|
2652 |
||
2653 |
||
2654 |
TPosition locale; |
|
2655 |
locale.SetCurrentTime(); |
|
2656 |
||
2657 |
CLiwMap* categoryMap = CLiwDefaultMap::NewL(); |
|
2658 |
TLiwGenericParam param; |
|
2659 |
||
2660 |
||
2661 |
//name |
|
2662 |
categoryMap->InsertL(KCategoryName,TLiwVariant(KName)); |
|
2663 |
||
2664 |
param.SetNameAndValueL(KDataFields,TLiwVariant(categoryMap)); |
|
2665 |
inps->AppendL(param); |
|
2666 |
param.Reset(); |
|
2667 |
||
2668 |
param.SetNameAndValueL(KContentType,TLiwVariant(KCategory)); |
|
2669 |
inps->AppendL(param); |
|
2670 |
param.Reset(); |
|
2671 |
||
2672 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
2673 |
categoryMap->DecRef(); |
|
2674 |
||
2675 |
TInt index = 0; |
|
2676 |
||
2677 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
2678 |
if(err) |
|
2679 |
result = err->Value().AsTInt32(); |
|
2680 |
||
2681 |
outps->Reset(); |
|
2682 |
inps->Reset(); |
|
2683 |
if(!result || result == SErrEntryExists) |
|
2684 |
{ |
|
2685 |
// Call GetList |
|
2686 |
||
2687 |
CLiwMap* getlistcategory_map = CLiwDefaultMap::NewL(); |
|
2688 |
CLiwMap* sort_map = CLiwDefaultMap::NewL(); |
|
2689 |
||
2690 |
sort_map->InsertL(KCategoryName,TLiwVariant(KName)); |
|
2691 |
sort_map->InsertL(KSortOrder,TLiwVariant(KDescending)); |
|
2692 |
getlistcategory_map->InsertL(KCategoryName,TLiwVariant(KName)); |
|
2693 |
||
2694 |
getlistcategory_map->InsertL(KMaximumMatches,TLiwVariant(TInt32(10))); |
|
2695 |
||
2696 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(KCategory)); |
|
2697 |
inps->AppendL(param); |
|
2698 |
param.Reset(); |
|
2699 |
||
2700 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(getlistcategory_map)); |
|
2701 |
inps->AppendL(param); |
|
2702 |
param.Reset(); |
|
2703 |
||
2704 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(sort_map)); |
|
2705 |
inps->AppendL(param); |
|
2706 |
param.Reset(); |
|
2707 |
||
2708 |
interface->ExecuteCmdL(KGetList,*inps,*outps,0,0); |
|
2709 |
getlistcategory_map->DecRef(); |
|
2710 |
sort_map->DecRef(); |
|
2711 |
||
2712 |
index=0; |
|
2713 |
||
2714 |
const TLiwGenericParam* getlist_err = outps->FindFirst(index,KErrorCode); |
|
2715 |
if(getlist_err) |
|
2716 |
result = getlist_err->Value().AsTInt32(); |
|
2717 |
||
2718 |
} |
|
2719 |
outps->Reset(); |
|
2720 |
inps->Reset(); |
|
2721 |
||
2722 |
// Remove the category added |
|
2723 |
||
2724 |
GetCatId(inps,outps,interface,KName); |
|
2725 |
RemoveCategory(inps,outps,interface); |
|
2726 |
||
2727 |
interface->Close(); |
|
2728 |
delete iServiceHandler; |
|
2729 |
||
2730 |
__UHEAP_MARKEND; |
|
2731 |
return result; |
|
2732 |
} |
|
2733 |
||
2734 |
// ----------------------------------------------------------------------------- |
|
2735 |
// Ctlandmark_provider::TestGetRemoveLMVarByOrder |
|
2736 |
// To test delete on landmark by changing order of input params with Null/invalid landmark Id |
|
2737 |
// (other items were commented in a header). |
|
2738 |
// ----------------------------------------------------------------------------- |
|
2739 |
// |
|
2740 |
TInt Ctlandmark_provider::TestRemoveLMVarByOrder( CStifItemParser& aItem ) |
|
2741 |
{ |
|
2742 |
_LIT(KName,"Landmark1"); |
|
2743 |
_LIT(KDescription,"TestLandmark1"); |
|
2744 |
||
2745 |
TInt32 result = KErrNone; |
|
2746 |
||
2747 |
__UHEAP_MARK; |
|
2748 |
||
2749 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
2750 |
MLiwInterface* interface = NULL; |
|
2751 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
2752 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
2753 |
||
2754 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
2755 |
||
2756 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2757 |
||
2758 |
RCriteriaArray a; |
|
2759 |
a.AppendL(crit); |
|
2760 |
||
2761 |
iServiceHandler->AttachL(a); |
|
2762 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
2763 |
||
2764 |
a.Reset(); |
|
2765 |
delete crit; |
|
2766 |
||
2767 |
TInt pos = 0; |
|
2768 |
||
2769 |
outps->FindFirst( pos, KIDataSource ); |
|
2770 |
if(pos != KErrNotFound) |
|
2771 |
{ |
|
2772 |
interface = (*outps)[pos].Value().AsInterface(); |
|
2773 |
} |
|
2774 |
||
2775 |
outps->Reset(); |
|
2776 |
inps->Reset(); |
|
2777 |
||
2778 |
||
2779 |
TPosition locale; |
|
2780 |
locale.SetCurrentTime(); |
|
2781 |
||
2782 |
CLiwMap* landmarkMap = CLiwDefaultMap::NewL(); |
|
2783 |
TLiwGenericParam param; |
|
2784 |
||
2785 |
//name |
|
2786 |
landmarkMap->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
2787 |
||
2788 |
//description |
|
2789 |
landmarkMap->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
|
2790 |
||
2791 |
param.SetNameAndValueL(KDataFields,TLiwVariant(landmarkMap)); |
|
2792 |
inps->AppendL(param); |
|
2793 |
param.Reset(); |
|
2794 |
||
2795 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
2796 |
inps->AppendL(param); |
|
2797 |
param.Reset(); |
|
2798 |
||
2799 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
2800 |
landmarkMap->DecRef(); |
|
2801 |
||
2802 |
TInt index = 0; |
|
2803 |
||
2804 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
2805 |
if(err) |
|
2806 |
result = err->Value().AsTInt32(); |
|
2807 |
||
2808 |
outps->Reset(); |
|
2809 |
inps->Reset(); |
|
2810 |
if(!result) |
|
2811 |
{ |
|
2812 |
// Call Remove |
|
2813 |
||
2814 |
CLiwMap* remove_map = CLiwDefaultMap::NewL(); |
|
2815 |
remove_map->InsertL(KId,TLiwVariant(_L("12345"))); |
|
2816 |
||
2817 |
param.SetNameAndValueL(KDataFields,TLiwVariant(remove_map)); |
|
2818 |
inps->AppendL(param); |
|
2819 |
param.Reset(); |
|
2820 |
||
2821 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
2822 |
inps->AppendL(param); |
|
2823 |
param.Reset(); |
|
2824 |
||
2825 |
interface->ExecuteCmdL(KRemove,*inps,*outps,0,0); |
|
2826 |
remove_map->DecRef(); |
|
2827 |
index=0; |
|
2828 |
||
2829 |
const TLiwGenericParam* remove_err = outps->FindFirst(index,KErrorCode); |
|
2830 |
if(remove_err) |
|
2831 |
result = remove_err->Value().AsTInt32(); |
|
2832 |
||
2833 |
} |
|
2834 |
||
2835 |
||
2836 |
interface->Close(); |
|
2837 |
delete iServiceHandler; |
|
2838 |
||
2839 |
__UHEAP_MARKEND; |
|
2840 |
return result; |
|
2841 |
} |
|
2842 |
||
2843 |
// ----------------------------------------------------------------------------- |
|
2844 |
// Ctlandmark_provider::TestGetRemoveLMVarByPos |
|
2845 |
// To test delete on landmark with position based parsing of input params with Null/invalid landmark Id |
|
2846 |
// (other items were commented in a header). |
|
2847 |
// ----------------------------------------------------------------------------- |
|
2848 |
// |
|
2849 |
TInt Ctlandmark_provider::TestRemoveLMVarByPos( CStifItemParser& aItem ) |
|
2850 |
{ |
|
2851 |
_LIT(KName,"Landmark1"); |
|
2852 |
_LIT(KDescription,"TestLandmark1"); |
|
2853 |
||
2854 |
TInt32 result = KErrNone; |
|
2855 |
||
2856 |
__UHEAP_MARK; |
|
2857 |
||
2858 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
2859 |
MLiwInterface* interface = NULL; |
|
2860 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
2861 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
2862 |
||
2863 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
2864 |
||
2865 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2866 |
||
2867 |
RCriteriaArray a; |
|
2868 |
a.AppendL(crit); |
|
2869 |
||
2870 |
iServiceHandler->AttachL(a); |
|
2871 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
2872 |
||
2873 |
a.Reset(); |
|
2874 |
delete crit; |
|
2875 |
||
2876 |
TInt pos = 0; |
|
2877 |
||
2878 |
outps->FindFirst( pos, KIDataSource ); |
|
2879 |
if(pos != KErrNotFound) |
|
2880 |
{ |
|
2881 |
interface = (*outps)[pos].Value().AsInterface(); |
|
2882 |
} |
|
2883 |
||
2884 |
outps->Reset(); |
|
2885 |
inps->Reset(); |
|
2886 |
||
2887 |
||
2888 |
TPosition locale; |
|
2889 |
locale.SetCurrentTime(); |
|
2890 |
||
2891 |
CLiwMap* landmarkMap = CLiwDefaultMap::NewL(); |
|
2892 |
TLiwGenericParam param; |
|
2893 |
||
2894 |
//name |
|
2895 |
landmarkMap->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
2896 |
||
2897 |
//description |
|
2898 |
landmarkMap->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
|
2899 |
||
2900 |
param.SetNameAndValueL(KDataFields,TLiwVariant(landmarkMap)); |
|
2901 |
inps->AppendL(param); |
|
2902 |
param.Reset(); |
|
2903 |
||
2904 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
2905 |
inps->AppendL(param); |
|
2906 |
param.Reset(); |
|
2907 |
||
2908 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
2909 |
landmarkMap->DecRef(); |
|
2910 |
||
2911 |
TInt index = 0; |
|
2912 |
||
2913 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
2914 |
if(err) |
|
2915 |
result = err->Value().AsTInt32(); |
|
2916 |
||
2917 |
outps->Reset(); |
|
2918 |
inps->Reset(); |
|
2919 |
if(!result) |
|
2920 |
{ |
|
2921 |
// Call Remove |
|
2922 |
||
2923 |
CLiwMap* remove_map = CLiwDefaultMap::NewL(); |
|
2924 |
remove_map->InsertL(KId,TLiwVariant(KNullDesC)); |
|
2925 |
||
2926 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(KLandmark)); |
|
2927 |
inps->AppendL(param); |
|
2928 |
param.Reset(); |
|
2929 |
||
2930 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(remove_map)); |
|
2931 |
inps->AppendL(param); |
|
2932 |
param.Reset(); |
|
2933 |
||
2934 |
interface->ExecuteCmdL(KRemove,*inps,*outps,0,0); |
|
2935 |
remove_map->DecRef(); |
|
2936 |
index=0; |
|
2937 |
||
2938 |
const TLiwGenericParam* remove_err = outps->FindFirst(index,KErrorCode); |
|
2939 |
if(remove_err) |
|
2940 |
result = remove_err->Value().AsTInt32(); |
|
2941 |
} |
|
2942 |
||
2943 |
||
2944 |
interface->Close(); |
|
2945 |
delete iServiceHandler; |
|
2946 |
||
2947 |
__UHEAP_MARKEND; |
|
2948 |
if(result == 1000) |
|
2949 |
result = KErrNone; |
|
2950 |
return result; |
|
2951 |
} |
|
2952 |
||
2953 |
// ----------------------------------------------------------------------------- |
|
2954 |
// Ctlandmark_provider::TestRemoveCTVarByOrder |
|
2955 |
// To test Remove on category changing the order of arguments and with Null/Invalid categoryId |
|
2956 |
// (other items were commented in a header). |
|
2957 |
// ----------------------------------------------------------------------------- |
|
2958 |
// |
|
2959 |
TInt Ctlandmark_provider::TestRemoveCTVarByOrder( CStifItemParser& aItem ) |
|
2960 |
{ |
|
2961 |
_LIT(KName,"India"); |
|
2962 |
_LIT(KDescription,"Culture"); |
|
2963 |
||
2964 |
TInt32 result = KErrNone; |
|
2965 |
||
2966 |
__UHEAP_MARK; |
|
2967 |
||
2968 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
2969 |
MLiwInterface* interface = NULL; |
|
2970 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
2971 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
2972 |
||
2973 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
2974 |
||
2975 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
2976 |
||
2977 |
RCriteriaArray a; |
|
2978 |
a.AppendL(crit); |
|
2979 |
||
2980 |
iServiceHandler->AttachL(a); |
|
2981 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
2982 |
||
2983 |
a.Reset(); |
|
2984 |
delete crit; |
|
2985 |
||
2986 |
TInt pos = 0; |
|
2987 |
||
2988 |
outps->FindFirst( pos, KIDataSource ); |
|
2989 |
if(pos != KErrNotFound) |
|
2990 |
{ |
|
2991 |
interface = (*outps)[pos].Value().AsInterface(); |
|
2992 |
} |
|
2993 |
||
2994 |
outps->Reset(); |
|
2995 |
inps->Reset(); |
|
2996 |
||
2997 |
||
2998 |
TPosition locale; |
|
2999 |
locale.SetCurrentTime(); |
|
3000 |
||
3001 |
CLiwMap* categoryMap = CLiwDefaultMap::NewL(); |
|
3002 |
TLiwGenericParam param; |
|
3003 |
||
3004 |
||
3005 |
//name |
|
3006 |
categoryMap->InsertL(KCategoryName,TLiwVariant(KName)); |
|
3007 |
||
3008 |
param.SetNameAndValueL(KDataFields,TLiwVariant(categoryMap)); |
|
3009 |
inps->AppendL(param); |
|
3010 |
param.Reset(); |
|
3011 |
||
3012 |
param.SetNameAndValueL(KContentType,TLiwVariant(KCategory)); |
|
3013 |
inps->AppendL(param); |
|
3014 |
param.Reset(); |
|
3015 |
||
3016 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
3017 |
categoryMap->DecRef(); |
|
3018 |
||
3019 |
TInt index = 0; |
|
3020 |
||
3021 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
3022 |
if(err) |
|
3023 |
result = err->Value().AsTInt32(); |
|
3024 |
||
3025 |
outps->Reset(); |
|
3026 |
inps->Reset(); |
|
3027 |
if(!result || result == SErrEntryExists) |
|
3028 |
{ |
|
3029 |
// Call Remove |
|
3030 |
||
3031 |
CLiwMap* removecategory_map = CLiwDefaultMap::NewL(); |
|
3032 |
removecategory_map->InsertL(KId,TLiwVariant(KNullDesC)); |
|
3033 |
||
3034 |
param.SetNameAndValueL(KDataFields,TLiwVariant(removecategory_map)); |
|
3035 |
inps->AppendL(param); |
|
3036 |
param.Reset(); |
|
3037 |
||
3038 |
param.SetNameAndValueL(KContentType,TLiwVariant(KCategory)); |
|
3039 |
inps->AppendL(param); |
|
3040 |
param.Reset(); |
|
3041 |
||
3042 |
interface->ExecuteCmdL(KRemove,*inps,*outps,0,0); |
|
3043 |
removecategory_map->DecRef(); |
|
3044 |
||
3045 |
index=0; |
|
3046 |
||
3047 |
const TLiwGenericParam* remove_err = outps->FindFirst(index,KErrorCode); |
|
3048 |
if(remove_err) |
|
3049 |
result = remove_err->Value().AsTInt32(); |
|
3050 |
||
3051 |
} |
|
3052 |
||
3053 |
||
3054 |
interface->Close(); |
|
3055 |
delete iServiceHandler; |
|
3056 |
||
3057 |
__UHEAP_MARKEND; |
|
3058 |
if(result == 1000) |
|
3059 |
result = KErrNone; |
|
3060 |
return result; |
|
3061 |
} |
|
3062 |
||
3063 |
// ----------------------------------------------------------------------------- |
|
3064 |
// Ctlandmark_provider::TestRemoveCTVarByPos |
|
3065 |
// To test Remove on category changing the order of arguments and with Null/Invalid categoryId |
|
3066 |
// (other items were commented in a header). |
|
3067 |
// ----------------------------------------------------------------------------- |
|
3068 |
// |
|
3069 |
TInt Ctlandmark_provider::TestRemoveCTVarByPos( CStifItemParser& aItem ) |
|
3070 |
{ |
|
3071 |
_LIT(KName,"India"); |
|
3072 |
_LIT(KDescription,"Culture"); |
|
3073 |
||
3074 |
TInt32 result = KErrNone; |
|
3075 |
||
3076 |
__UHEAP_MARK; |
|
3077 |
||
3078 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
3079 |
MLiwInterface* interface = NULL; |
|
3080 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
3081 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
3082 |
||
3083 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
3084 |
||
3085 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
3086 |
||
3087 |
RCriteriaArray a; |
|
3088 |
a.AppendL(crit); |
|
3089 |
||
3090 |
iServiceHandler->AttachL(a); |
|
3091 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
3092 |
||
3093 |
a.Reset(); |
|
3094 |
delete crit; |
|
3095 |
||
3096 |
TInt pos = 0; |
|
3097 |
||
3098 |
outps->FindFirst( pos, KIDataSource ); |
|
3099 |
if(pos != KErrNotFound) |
|
3100 |
{ |
|
3101 |
interface = (*outps)[pos].Value().AsInterface(); |
|
3102 |
} |
|
3103 |
||
3104 |
outps->Reset(); |
|
3105 |
inps->Reset(); |
|
3106 |
||
3107 |
||
3108 |
TPosition locale; |
|
3109 |
locale.SetCurrentTime(); |
|
3110 |
||
3111 |
CLiwMap* categoryMap = CLiwDefaultMap::NewL(); |
|
3112 |
TLiwGenericParam param; |
|
3113 |
||
3114 |
||
3115 |
//name |
|
3116 |
categoryMap->InsertL(KCategoryName,TLiwVariant(KName)); |
|
3117 |
||
3118 |
param.SetNameAndValueL(KDataFields,TLiwVariant(categoryMap)); |
|
3119 |
inps->AppendL(param); |
|
3120 |
param.Reset(); |
|
3121 |
||
3122 |
param.SetNameAndValueL(KContentType,TLiwVariant(KCategory)); |
|
3123 |
inps->AppendL(param); |
|
3124 |
param.Reset(); |
|
3125 |
||
3126 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
3127 |
categoryMap->DecRef(); |
|
3128 |
||
3129 |
TInt index = 0; |
|
3130 |
||
3131 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
3132 |
if(err) |
|
3133 |
result = err->Value().AsTInt32(); |
|
3134 |
||
3135 |
outps->Reset(); |
|
3136 |
inps->Reset(); |
|
3137 |
if(!result || result == SErrEntryExists) |
|
3138 |
{ |
|
3139 |
// Call Remove |
|
3140 |
||
3141 |
CLiwMap* removecategory_map = CLiwDefaultMap::NewL(); |
|
3142 |
removecategory_map->InsertL(KId,TLiwVariant(_L("-255.45"))); |
|
3143 |
||
3144 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(KCategory)); |
|
3145 |
inps->AppendL(param); |
|
3146 |
param.Reset(); |
|
3147 |
||
3148 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(removecategory_map)); |
|
3149 |
inps->AppendL(param); |
|
3150 |
param.Reset(); |
|
3151 |
||
3152 |
interface->ExecuteCmdL(KRemove,*inps,*outps,0,0); |
|
3153 |
removecategory_map->DecRef(); |
|
3154 |
||
3155 |
index=0; |
|
3156 |
||
3157 |
const TLiwGenericParam* remove_err = outps->FindFirst(index,KErrorCode); |
|
3158 |
if(remove_err) |
|
3159 |
result = remove_err->Value().AsTInt32(); |
|
3160 |
||
3161 |
} |
|
3162 |
||
3163 |
||
3164 |
interface->Close(); |
|
3165 |
delete iServiceHandler; |
|
3166 |
||
3167 |
__UHEAP_MARKEND; |
|
3168 |
if(result == 1000) |
|
3169 |
result = KErrNone; |
|
3170 |
return result; |
|
3171 |
} |
|
3172 |
||
3173 |
// ----------------------------------------------------------------------------- |
|
3174 |
// Ctlandmark_provider::TestExportVarByOrder |
|
3175 |
// To test export by changing order of input params with Null/invalid landmark Id |
|
3176 |
// (other items were commented in a header). |
|
3177 |
// ----------------------------------------------------------------------------- |
|
3178 |
// |
|
3179 |
TInt Ctlandmark_provider::TestExportVarByOrder( CStifItemParser& aItem ) |
|
3180 |
{ |
|
3181 |
_LIT(KName,"Landmark1"); |
|
3182 |
_LIT(KDescription,"TestLandmark1"); |
|
3183 |
_LIT(KFilePath, "c:\\eposLmTestOrder.lmx"); |
|
3184 |
_LIT(KPosMimeType, "application/vnd.nokia.landmarkcollection+xml"); |
|
3185 |
TInt32 result = KErrNone; |
|
3186 |
||
3187 |
__UHEAP_MARK; |
|
3188 |
||
3189 |
RFile LogResult; |
|
3190 |
RFs LogResultSession; |
|
3191 |
User::LeaveIfError(LogResultSession.Connect()); |
|
3192 |
if(LogResult.Open(LogResultSession ,KFilePath , EFileWrite | EFileShareAny ) != KErrNotFound) |
|
3193 |
{ |
|
3194 |
LogResult.Close(); |
|
3195 |
||
3196 |
LogResultSession.Delete(KFilePath); |
|
3197 |
||
3198 |
LogResultSession.Close(); |
|
3199 |
} |
|
3200 |
||
3201 |
LogResult.Close(); |
|
3202 |
LogResultSession.Close(); |
|
3203 |
||
3204 |
||
3205 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
3206 |
MLiwInterface* interface = NULL; |
|
3207 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
3208 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
3209 |
||
3210 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
3211 |
||
3212 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
3213 |
||
3214 |
RCriteriaArray a; |
|
3215 |
a.AppendL(crit); |
|
3216 |
||
3217 |
iServiceHandler->AttachL(a); |
|
3218 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
3219 |
||
3220 |
a.Reset(); |
|
3221 |
delete crit; |
|
3222 |
||
3223 |
TInt pos = 0; |
|
3224 |
||
3225 |
outps->FindFirst( pos, KIDataSource ); |
|
3226 |
if(pos != KErrNotFound) |
|
3227 |
{ |
|
3228 |
interface = (*outps)[pos].Value().AsInterface(); |
|
3229 |
} |
|
3230 |
||
3231 |
outps->Reset(); |
|
3232 |
inps->Reset(); |
|
3233 |
||
3234 |
TLiwGenericParam param; |
|
3235 |
TInt index = 0; |
|
3236 |
TPosition locale; |
|
3237 |
locale.SetCurrentTime(); |
|
3238 |
||
3239 |
CLiwMap* landmarkMap = CLiwDefaultMap::NewL(); |
|
3240 |
||
3241 |
//name |
|
3242 |
landmarkMap->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
3243 |
||
3244 |
//description |
|
3245 |
landmarkMap->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
|
3246 |
||
3247 |
param.SetNameAndValueL(KDataFields,TLiwVariant(landmarkMap)); |
|
3248 |
inps->AppendL(param); |
|
3249 |
param.Reset(); |
|
3250 |
||
3251 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
3252 |
inps->AppendL(param); |
|
3253 |
param.Reset(); |
|
3254 |
||
3255 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
3256 |
landmarkMap->DecRef(); |
|
3257 |
||
3258 |
||
3259 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
3260 |
if(err) |
|
3261 |
result = err->Value().AsTInt32(); |
|
3262 |
||
3263 |
outps->Reset(); |
|
3264 |
inps->Reset(); |
|
3265 |
if(!result) |
|
3266 |
{ |
|
3267 |
// Call Export |
|
3268 |
||
3269 |
CLiwMap* export_map = CLiwDefaultMap::NewL(); |
|
3270 |
CLiwList* landmarkIdList = CLiwDefaultList::NewL(); |
|
3271 |
landmarkIdList->AppendL(TLiwVariant(_L("-25"))); |
|
3272 |
landmarkIdList->AppendL(TLiwVariant(_L("3.5"))); |
|
3273 |
||
3274 |
export_map->InsertL(KDestinationFile,TLiwVariant(KFilePath)); |
|
3275 |
export_map->InsertL(KMimeType,TLiwVariant(KPosMimeType)); |
|
3276 |
export_map->InsertL(KIdList,TLiwVariant(landmarkIdList)); |
|
3277 |
landmarkIdList->DecRef(); |
|
3278 |
||
3279 |
param.SetNameAndValueL(KDataFields,TLiwVariant(export_map)); |
|
3280 |
inps->AppendL(param); |
|
3281 |
param.Reset(); |
|
3282 |
||
3283 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
3284 |
inps->AppendL(param); |
|
3285 |
param.Reset(); |
|
3286 |
||
3287 |
interface->ExecuteCmdL(KExport,*inps,*outps,0,0); |
|
3288 |
export_map->DecRef(); |
|
3289 |
index=0; |
|
3290 |
||
3291 |
const TLiwGenericParam* export_err = outps->FindFirst(index,KErrorCode); |
|
3292 |
if(export_err) |
|
3293 |
result = export_err->Value().AsTInt32(); |
|
3294 |
} |
|
3295 |
||
3296 |
outps->Reset(); |
|
3297 |
inps->Reset(); |
|
3298 |
||
3299 |
||
3300 |
GetLandMarkId(inps,outps,interface,KName,KDescription); |
|
3301 |
RemoveLandmark(inps,outps,interface); |
|
3302 |
||
3303 |
interface->Close(); |
|
3304 |
delete iServiceHandler; |
|
3305 |
||
3306 |
__UHEAP_MARKEND; |
|
3307 |
if(result == 1000) |
|
3308 |
result = KErrNone; |
|
3309 |
return result; |
|
3310 |
} |
|
3311 |
||
3312 |
// ----------------------------------------------------------------------------- |
|
3313 |
// Ctlandmark_provider::TestExportVarByPos |
|
3314 |
// To test export by changing order of input params with Null/invalid landmark Id |
|
3315 |
// (other items were commented in a header). |
|
3316 |
// ----------------------------------------------------------------------------- |
|
3317 |
// |
|
3318 |
TInt Ctlandmark_provider::TestExportVarByPos( CStifItemParser& aItem ) |
|
3319 |
{ |
|
3320 |
_LIT(KName,"Landmark1"); |
|
3321 |
_LIT(KDescription,"TestLandmark1"); |
|
3322 |
_LIT(KFilePath, "c:\\eposLmTestPos.lmx"); |
|
3323 |
_LIT(KPosMimeType, "application/vnd.nokia.landmarkcollection+xml"); |
|
3324 |
TInt32 result = KErrNone; |
|
3325 |
||
3326 |
__UHEAP_MARK; |
|
3327 |
RFile LogResult; |
|
3328 |
RFs LogResultSession; |
|
3329 |
User::LeaveIfError(LogResultSession.Connect()); |
|
3330 |
if(LogResult.Open(LogResultSession ,KFilePath , EFileWrite | EFileShareAny ) != KErrNotFound) |
|
3331 |
{ |
|
3332 |
LogResult.Close(); |
|
3333 |
||
3334 |
LogResultSession.Delete(KFilePath); |
|
3335 |
||
3336 |
LogResultSession.Close(); |
|
3337 |
} |
|
3338 |
||
3339 |
LogResult.Close(); |
|
3340 |
LogResultSession.Close(); |
|
3341 |
||
3342 |
||
3343 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
3344 |
MLiwInterface* interface = NULL; |
|
3345 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
3346 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
3347 |
||
3348 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
3349 |
||
3350 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
3351 |
||
3352 |
RCriteriaArray a; |
|
3353 |
a.AppendL(crit); |
|
3354 |
||
3355 |
iServiceHandler->AttachL(a); |
|
3356 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
3357 |
||
3358 |
a.Reset(); |
|
3359 |
delete crit; |
|
3360 |
||
3361 |
TInt pos = 0; |
|
3362 |
||
3363 |
outps->FindFirst( pos, KIDataSource ); |
|
3364 |
if(pos != KErrNotFound) |
|
3365 |
{ |
|
3366 |
interface = (*outps)[pos].Value().AsInterface(); |
|
3367 |
} |
|
3368 |
||
3369 |
outps->Reset(); |
|
3370 |
inps->Reset(); |
|
3371 |
||
3372 |
TLiwGenericParam param; |
|
3373 |
TInt index = 0; |
|
3374 |
if(!result) |
|
3375 |
{ |
|
3376 |
// Call Export |
|
3377 |
||
3378 |
CLiwMap* export_map = CLiwDefaultMap::NewL(); |
|
3379 |
CLiwList* landmarkIdList = CLiwDefaultList::NewL(); |
|
3380 |
landmarkIdList->AppendL(TLiwVariant(_L("-25"))); |
|
3381 |
||
3382 |
export_map->InsertL(KDestinationFile,TLiwVariant(KFilePath)); |
|
3383 |
export_map->InsertL(KMimeType,TLiwVariant(KPosMimeType)); |
|
3384 |
export_map->InsertL(KIdList,TLiwVariant(landmarkIdList)); |
|
3385 |
landmarkIdList->DecRef(); |
|
3386 |
||
3387 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(KLandmark)); |
|
3388 |
inps->AppendL(param); |
|
3389 |
param.Reset(); |
|
3390 |
||
3391 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(export_map)); |
|
3392 |
inps->AppendL(param); |
|
3393 |
param.Reset(); |
|
3394 |
||
3395 |
interface->ExecuteCmdL(KExport,*inps,*outps,0,0); |
|
3396 |
export_map->DecRef(); |
|
3397 |
index=0; |
|
3398 |
||
3399 |
const TLiwGenericParam* export_err = outps->FindFirst(index,KErrorCode); |
|
3400 |
if(export_err) |
|
3401 |
result = export_err->Value().AsTInt32(); |
|
3402 |
} |
|
3403 |
||
3404 |
outps->Reset(); |
|
3405 |
inps->Reset(); |
|
3406 |
||
3407 |
GetLandMarkId(inps,outps,interface,KName,KDescription); |
|
3408 |
RemoveLandmark(inps,outps,interface); |
|
3409 |
||
3410 |
interface->Close(); |
|
3411 |
delete iServiceHandler; |
|
3412 |
||
3413 |
__UHEAP_MARKEND; |
|
3414 |
if(result == 1000) |
|
3415 |
result = KErrNone; |
|
3416 |
return result; |
|
3417 |
} |
|
3418 |
||
3419 |
||
3420 |
// ----------------------------------------------------------------------------- |
|
3421 |
// Ctlandmark_provider::TestImportVarByOrder |
|
3422 |
// To test import by changing order of input params with file available/not available |
|
3423 |
// (other items were commented in a header). |
|
3424 |
// ----------------------------------------------------------------------------- |
|
3425 |
// |
|
3426 |
TInt Ctlandmark_provider::TestImportVarByOrder( CStifItemParser& aItem ) |
|
3427 |
{ |
|
3428 |
_LIT(KName,"Landmark_ImportOrder"); |
|
3429 |
_LIT(KDescription,"TestLandmark_ImportOrder"); |
|
3430 |
_LIT(KFilePath, "c:\\importLmTestOrder.lmx"); |
|
3431 |
_LIT(KPosMimeType, "application/vnd.nokia.landmarkcollection+xml"); |
|
3432 |
||
3433 |
TInt32 result = KErrNone; |
|
3434 |
TBuf<40> buf; |
|
3435 |
||
3436 |
__UHEAP_MARK; |
|
3437 |
||
3438 |
RFile LogResult; |
|
3439 |
RFs LogResultSession; |
|
3440 |
User::LeaveIfError(LogResultSession.Connect()); |
|
3441 |
if(LogResult.Open(LogResultSession ,KFilePath , EFileWrite | EFileShareAny ) != KErrNotFound) |
|
3442 |
{ |
|
3443 |
LogResult.Close(); |
|
3444 |
||
3445 |
LogResultSession.Delete(KFilePath); |
|
3446 |
||
3447 |
LogResultSession.Close(); |
|
3448 |
} |
|
3449 |
||
3450 |
LogResult.Close(); |
|
3451 |
LogResultSession.Close(); |
|
3452 |
||
3453 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
3454 |
MLiwInterface* interface = NULL; |
|
3455 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
3456 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
3457 |
||
3458 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
3459 |
||
3460 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
3461 |
||
3462 |
RCriteriaArray a; |
|
3463 |
a.AppendL(crit); |
|
3464 |
||
3465 |
iServiceHandler->AttachL(a); |
|
3466 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
3467 |
||
3468 |
a.Reset(); |
|
3469 |
delete crit; |
|
3470 |
||
3471 |
TInt pos = 0; |
|
3472 |
||
3473 |
outps->FindFirst( pos, KIDataSource ); |
|
3474 |
if(pos != KErrNotFound) |
|
3475 |
{ |
|
3476 |
interface = (*outps)[pos].Value().AsInterface(); |
|
3477 |
} |
|
3478 |
||
3479 |
outps->Reset(); |
|
3480 |
inps->Reset(); |
|
3481 |
||
3482 |
TLiwGenericParam param; |
|
3483 |
TInt index = 0; |
|
3484 |
// Add landmark, fetch its id using getlist |
|
3485 |
||
3486 |
CLiwMap* landmarkMap = CLiwDefaultMap::NewL(); |
|
3487 |
||
3488 |
//name |
|
3489 |
landmarkMap->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
3490 |
||
3491 |
//description |
|
3492 |
landmarkMap->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
|
3493 |
||
3494 |
param.SetNameAndValueL(KDataFields,TLiwVariant(landmarkMap)); |
|
3495 |
inps->AppendL(param); |
|
3496 |
param.Reset(); |
|
3497 |
||
3498 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
3499 |
inps->AppendL(param); |
|
3500 |
param.Reset(); |
|
3501 |
||
3502 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
3503 |
landmarkMap->DecRef(); |
|
3504 |
||
3505 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
3506 |
if(err) |
|
3507 |
result = err->Value().AsTInt32(); |
|
3508 |
||
3509 |
if(!result) |
|
3510 |
{ |
|
3511 |
outps->Reset(); |
|
3512 |
inps->Reset(); |
|
3513 |
||
3514 |
CLiwMap* getlistlandmark_map = CLiwDefaultMap::NewL(); |
|
3515 |
getlistlandmark_map->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
3516 |
||
3517 |
//description |
|
37
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
3518 |
//getlistlandmark_map->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
19 | 3519 |
|
3520 |
param.SetNameAndValueL(KFilter,TLiwVariant(getlistlandmark_map)); |
|
3521 |
inps->AppendL(param); |
|
3522 |
param.Reset(); |
|
3523 |
||
3524 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
3525 |
inps->AppendL(param); |
|
3526 |
param.Reset(); |
|
3527 |
||
3528 |
interface->ExecuteCmdL(KGetList,*inps,*outps,0,0); |
|
3529 |
getlistlandmark_map->DecRef(); |
|
3530 |
||
3531 |
const TLiwGenericParam* getlist_err = outps->FindFirst(index,KErrorCode); |
|
3532 |
if(getlist_err) |
|
3533 |
result = getlist_err->Value().AsTInt32(); |
|
3534 |
} |
|
3535 |
||
3536 |
||
3537 |
if(!result) |
|
3538 |
{ |
|
3539 |
// Get the landmark Id |
|
3540 |
pos=0; |
|
3541 |
const TLiwGenericParam* output = outps->FindFirst( pos,_L8("ReturnValue")); |
|
3542 |
TInt item_found = 0; |
|
3543 |
||
3544 |
if(output) |
|
3545 |
{ |
|
3546 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
3547 |
||
3548 |
TLiwVariant data; |
|
3549 |
||
3550 |
while( iterlist->NextL(data)) |
|
3551 |
{ |
|
3552 |
const CLiwMap* res = data.AsMap(); |
|
3553 |
if ( res ) |
|
3554 |
{ |
|
3555 |
TLiwVariant new_data; |
|
3556 |
if(res->FindL(KId, new_data)) |
|
3557 |
{ |
|
3558 |
TPtrC lid = new_data.AsDes(); |
|
3559 |
buf.Copy(lid); |
|
3560 |
iLog->Log(buf); |
|
3561 |
iLog->Log(_L("found landmark Id of the entry")); |
|
3562 |
} |
|
3563 |
new_data.Reset(); |
|
3564 |
} |
|
3565 |
} |
|
3566 |
data.Reset(); |
|
3567 |
} |
|
3568 |
||
3569 |
outps->Reset(); |
|
3570 |
inps->Reset(); |
|
3571 |
||
3572 |
// Call Export and then Import |
|
3573 |
||
3574 |
CLiwMap* export_map = CLiwDefaultMap::NewL(); |
|
3575 |
||
3576 |
CLiwList* landmarkIdList = CLiwDefaultList::NewL(); |
|
3577 |
landmarkIdList->AppendL(TLiwVariant(buf)); |
|
3578 |
||
3579 |
export_map->InsertL(KDestinationFile,TLiwVariant(KFilePath)); |
|
3580 |
export_map->InsertL(KMimeType,TLiwVariant(KPosMimeType)); |
|
3581 |
export_map->InsertL(KIdList,TLiwVariant(landmarkIdList)); |
|
3582 |
landmarkIdList->DecRef(); |
|
3583 |
||
3584 |
||
3585 |
param.SetNameAndValueL(KDataFields,TLiwVariant(export_map)); |
|
3586 |
inps->AppendL(param); |
|
3587 |
param.Reset(); |
|
3588 |
||
3589 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
3590 |
inps->AppendL(param); |
|
3591 |
param.Reset(); |
|
3592 |
||
3593 |
interface->ExecuteCmdL(KExport,*inps,*outps,0,0); |
|
3594 |
export_map->DecRef(); |
|
3595 |
index=0; |
|
3596 |
||
3597 |
const TLiwGenericParam* export_err = outps->FindFirst(index,KErrorCode); |
|
3598 |
if(export_err) |
|
3599 |
result = export_err->Value().AsTInt32(); |
|
3600 |
||
3601 |
if(!result) |
|
3602 |
{ |
|
3603 |
outps->Reset(); |
|
3604 |
inps->Reset(); |
|
3605 |
CLiwMap* import_map = CLiwDefaultMap::NewL(); |
|
3606 |
import_map->InsertL(KMimeType,TLiwVariant(KPosMimeType)); |
|
3607 |
import_map->InsertL(KSourceFile,TLiwVariant(KFilePath)); |
|
3608 |
||
3609 |
param.SetNameAndValueL(KDataFields,TLiwVariant(import_map)); |
|
3610 |
inps->AppendL(param); |
|
3611 |
param.Reset(); |
|
3612 |
||
3613 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
3614 |
inps->AppendL(param); |
|
3615 |
param.Reset(); |
|
3616 |
||
3617 |
interface->ExecuteCmdL(KImport,*inps,*outps,0,0); |
|
3618 |
import_map->DecRef(); |
|
3619 |
index=0; |
|
3620 |
||
3621 |
const TLiwGenericParam* import_err = outps->FindFirst(index,KErrorCode); |
|
3622 |
if(import_err) |
|
3623 |
result = import_err->Value().AsTInt32(); |
|
3624 |
} |
|
3625 |
||
3626 |
} |
|
3627 |
||
3628 |
// Remove the landmark added |
|
3629 |
||
3630 |
outps->Reset(); |
|
3631 |
inps->Reset(); |
|
3632 |
||
3633 |
CLiwMap* remove_map = CLiwDefaultMap::NewL(); |
|
3634 |
remove_map->InsertL(KId,TLiwVariant(buf)); |
|
3635 |
||
3636 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(KLandmark)); |
|
3637 |
inps->AppendL(param); |
|
3638 |
param.Reset(); |
|
3639 |
||
3640 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(remove_map)); |
|
3641 |
inps->AppendL(param); |
|
3642 |
param.Reset(); |
|
3643 |
||
3644 |
interface->ExecuteCmdL(KRemove,*inps,*outps,0,0); |
|
3645 |
remove_map->DecRef(); |
|
3646 |
index=0; |
|
3647 |
||
3648 |
const TLiwGenericParam* remove_err = outps->FindFirst(index,KErrorCode); |
|
3649 |
if(remove_err) |
|
3650 |
result = remove_err->Value().AsTInt32(); |
|
3651 |
||
3652 |
outps->Reset(); |
|
3653 |
inps->Reset(); |
|
3654 |
interface->Close(); |
|
3655 |
delete iServiceHandler; |
|
3656 |
||
3657 |
__UHEAP_MARKEND; |
|
3658 |
if(result == SErrNotFound) |
|
3659 |
result = KErrNone; |
|
3660 |
return result; |
|
3661 |
} |
|
3662 |
||
3663 |
// ----------------------------------------------------------------------------- |
|
3664 |
// Ctlandmark_provider::TestImportVarByPos |
|
3665 |
// To test import for position based parsing |
|
3666 |
// (other items were commented in a header). |
|
3667 |
// ----------------------------------------------------------------------------- |
|
3668 |
// |
|
3669 |
TInt Ctlandmark_provider::TestImportVarByPos( CStifItemParser& aItem ) |
|
3670 |
{ |
|
3671 |
_LIT(KName,"Landmark_Import"); |
|
3672 |
_LIT(KDescription,"TestLandmark_ImportPos"); |
|
3673 |
_LIT(KFilePath, "c:\\importLmTestPos.lmx"); |
|
3674 |
_LIT(KPosMimeType, "application/vnd.nokia.landmarkcollection+xml"); |
|
3675 |
||
3676 |
TInt32 result = KErrNone; |
|
3677 |
TBuf<40> buf; |
|
3678 |
||
3679 |
__UHEAP_MARK; |
|
3680 |
||
3681 |
RFile LogResult; |
|
3682 |
RFs LogResultSession; |
|
3683 |
User::LeaveIfError(LogResultSession.Connect()); |
|
3684 |
if(LogResult.Open(LogResultSession ,KFilePath , EFileWrite | EFileShareAny ) != KErrNotFound) |
|
3685 |
{ |
|
3686 |
LogResult.Close(); |
|
3687 |
||
3688 |
LogResultSession.Delete(KFilePath); |
|
3689 |
||
3690 |
LogResultSession.Close(); |
|
3691 |
} |
|
3692 |
||
3693 |
LogResult.Close(); |
|
3694 |
LogResultSession.Close(); |
|
3695 |
||
3696 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
3697 |
MLiwInterface* interface = NULL; |
|
3698 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
3699 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
3700 |
||
3701 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
3702 |
||
3703 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
3704 |
||
3705 |
RCriteriaArray a; |
|
3706 |
a.AppendL(crit); |
|
3707 |
||
3708 |
iServiceHandler->AttachL(a); |
|
3709 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
3710 |
||
3711 |
a.Reset(); |
|
3712 |
delete crit; |
|
3713 |
||
3714 |
TInt pos = 0; |
|
3715 |
||
3716 |
outps->FindFirst( pos, KIDataSource ); |
|
3717 |
if(pos != KErrNotFound) |
|
3718 |
{ |
|
3719 |
interface = (*outps)[pos].Value().AsInterface(); |
|
3720 |
} |
|
3721 |
||
3722 |
outps->Reset(); |
|
3723 |
inps->Reset(); |
|
3724 |
||
3725 |
TLiwGenericParam param; |
|
3726 |
TInt index = 0; |
|
3727 |
// Add landmark, fetch its id using getlist |
|
3728 |
||
3729 |
CLiwMap* landmarkMap = CLiwDefaultMap::NewL(); |
|
3730 |
||
3731 |
//name |
|
3732 |
landmarkMap->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
3733 |
||
3734 |
//description |
|
3735 |
landmarkMap->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
|
3736 |
||
3737 |
param.SetNameAndValueL(KDataFields,TLiwVariant(landmarkMap)); |
|
3738 |
inps->AppendL(param); |
|
3739 |
param.Reset(); |
|
3740 |
||
3741 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
3742 |
inps->AppendL(param); |
|
3743 |
param.Reset(); |
|
3744 |
||
3745 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,0); |
|
3746 |
landmarkMap->DecRef(); |
|
3747 |
||
3748 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
3749 |
if(err) |
|
3750 |
result = err->Value().AsTInt32(); |
|
3751 |
||
3752 |
if(!result) |
|
3753 |
{ |
|
3754 |
outps->Reset(); |
|
3755 |
inps->Reset(); |
|
3756 |
||
3757 |
CLiwMap* getlistlandmark_map = CLiwDefaultMap::NewL(); |
|
3758 |
getlistlandmark_map->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
3759 |
||
3760 |
//description |
|
37
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
3761 |
//getlistlandmark_map->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
19 | 3762 |
|
3763 |
param.SetNameAndValueL(KFilter,TLiwVariant(getlistlandmark_map)); |
|
3764 |
inps->AppendL(param); |
|
3765 |
param.Reset(); |
|
3766 |
||
3767 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
3768 |
inps->AppendL(param); |
|
3769 |
param.Reset(); |
|
3770 |
||
3771 |
interface->ExecuteCmdL(KGetList,*inps,*outps,0,0); |
|
3772 |
getlistlandmark_map->DecRef(); |
|
3773 |
||
3774 |
const TLiwGenericParam* getlist_err = outps->FindFirst(index,KErrorCode); |
|
3775 |
if(getlist_err) |
|
3776 |
result = getlist_err->Value().AsTInt32(); |
|
3777 |
} |
|
3778 |
||
3779 |
||
3780 |
if(!result) |
|
3781 |
{ |
|
3782 |
// Get the landmark Id |
|
3783 |
pos=0; |
|
3784 |
const TLiwGenericParam* output = outps->FindFirst( pos,_L8("ReturnValue")); |
|
3785 |
TInt item_found = 0; |
|
3786 |
||
3787 |
if(output) |
|
3788 |
{ |
|
3789 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
3790 |
||
3791 |
TLiwVariant data; |
|
3792 |
||
3793 |
while( iterlist->NextL(data)) |
|
3794 |
{ |
|
3795 |
const CLiwMap* res = data.AsMap(); |
|
3796 |
if ( res ) |
|
3797 |
{ |
|
3798 |
TLiwVariant new_data; |
|
3799 |
if(res->FindL(KId, new_data)) |
|
3800 |
{ |
|
3801 |
TPtrC lid = new_data.AsDes(); |
|
3802 |
buf.Copy(lid); |
|
3803 |
iLog->Log(buf); |
|
3804 |
iLog->Log(_L("found landmark Id of the entry")); |
|
3805 |
} |
|
3806 |
new_data.Reset(); |
|
3807 |
} |
|
3808 |
} |
|
3809 |
data.Reset(); |
|
3810 |
} |
|
3811 |
||
3812 |
outps->Reset(); |
|
3813 |
inps->Reset(); |
|
3814 |
||
3815 |
// Call Export and then Import |
|
3816 |
||
3817 |
CLiwMap* export_map = CLiwDefaultMap::NewL(); |
|
3818 |
||
3819 |
CLiwList* landmarkIdList = CLiwDefaultList::NewL(); |
|
3820 |
landmarkIdList->AppendL(TLiwVariant(buf)); |
|
3821 |
||
3822 |
export_map->InsertL(KDestinationFile,TLiwVariant(KFilePath)); |
|
3823 |
export_map->InsertL(KMimeType,TLiwVariant(KPosMimeType)); |
|
3824 |
export_map->InsertL(KIdList,TLiwVariant(landmarkIdList)); |
|
3825 |
landmarkIdList->DecRef(); |
|
3826 |
||
3827 |
||
3828 |
param.SetNameAndValueL(KDataFields,TLiwVariant(export_map)); |
|
3829 |
inps->AppendL(param); |
|
3830 |
param.Reset(); |
|
3831 |
||
3832 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
3833 |
inps->AppendL(param); |
|
3834 |
param.Reset(); |
|
3835 |
||
3836 |
interface->ExecuteCmdL(KExport,*inps,*outps,0,0); |
|
3837 |
export_map->DecRef(); |
|
3838 |
index=0; |
|
3839 |
||
3840 |
const TLiwGenericParam* export_err = outps->FindFirst(index,KErrorCode); |
|
3841 |
if(export_err) |
|
3842 |
result = export_err->Value().AsTInt32(); |
|
3843 |
||
3844 |
if(!result) |
|
3845 |
{ |
|
3846 |
outps->Reset(); |
|
3847 |
inps->Reset(); |
|
3848 |
CLiwMap* import_map = CLiwDefaultMap::NewL(); |
|
3849 |
import_map->InsertL(KMimeType,TLiwVariant(KPosMimeType)); |
|
3850 |
import_map->InsertL(KSourceFile,TLiwVariant(KFilePath)); |
|
3851 |
||
3852 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(KLandmark)); |
|
3853 |
inps->AppendL(param); |
|
3854 |
param.Reset(); |
|
3855 |
||
3856 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(import_map)); |
|
3857 |
inps->AppendL(param); |
|
3858 |
param.Reset(); |
|
3859 |
||
3860 |
interface->ExecuteCmdL(KImport,*inps,*outps,0,0); |
|
3861 |
import_map->DecRef(); |
|
3862 |
index=0; |
|
3863 |
||
3864 |
const TLiwGenericParam* import_err = outps->FindFirst(index,KErrorCode); |
|
3865 |
if(import_err) |
|
3866 |
result = import_err->Value().AsTInt32(); |
|
3867 |
} |
|
3868 |
||
3869 |
} |
|
3870 |
||
3871 |
// Remove the landmark added |
|
3872 |
||
3873 |
outps->Reset(); |
|
3874 |
inps->Reset(); |
|
3875 |
||
3876 |
CLiwMap* remove_map = CLiwDefaultMap::NewL(); |
|
3877 |
remove_map->InsertL(KId,TLiwVariant(buf)); |
|
3878 |
||
3879 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(KLandmark)); |
|
3880 |
inps->AppendL(param); |
|
3881 |
param.Reset(); |
|
3882 |
||
3883 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(remove_map)); |
|
3884 |
inps->AppendL(param); |
|
3885 |
param.Reset(); |
|
3886 |
||
3887 |
interface->ExecuteCmdL(KRemove,*inps,*outps,0,0); |
|
3888 |
remove_map->DecRef(); |
|
3889 |
index=0; |
|
3890 |
||
3891 |
const TLiwGenericParam* remove_err = outps->FindFirst(index,KErrorCode); |
|
3892 |
if(remove_err) |
|
3893 |
result = remove_err->Value().AsTInt32(); |
|
3894 |
||
3895 |
outps->Reset(); |
|
3896 |
inps->Reset(); |
|
3897 |
interface->Close(); |
|
3898 |
delete iServiceHandler; |
|
3899 |
||
3900 |
__UHEAP_MARKEND; |
|
3901 |
if(result == SErrNotFound) |
|
3902 |
result = KErrNone; |
|
3903 |
return result; |
|
3904 |
} |
|
3905 |
||
3906 |
// ----------------------------------------------------------------------------- |
|
3907 |
// Ctlandmark_provider::TestOrganiseVarByOrder |
|
3908 |
// To test organise passing input not in order |
|
3909 |
// (other items were commented in a header). |
|
3910 |
// ----------------------------------------------------------------------------- |
|
3911 |
// |
|
3912 |
TInt Ctlandmark_provider::TestOrganiseVarByOrder( CStifItemParser& aItem ) |
|
3913 |
{ |
|
3914 |
_LIT(KName,"Landmark_OrgOrder"); |
|
3915 |
_LIT(KDescription,"TestLandmark_OrgOrder"); |
|
3916 |
_LIT(CatName,"Category_OrgOrder"); |
|
3917 |
TInt32 result = KErrNone; |
|
3918 |
TInt add_lmresult = 0; |
|
3919 |
TInt add_ctresult = -2; |
|
3920 |
TInt del_lmresult = 0; |
|
3921 |
TInt del_ctresult =0; |
|
3922 |
||
3923 |
||
3924 |
__UHEAP_MARK; |
|
3925 |
||
3926 |
TBuf<40> Lid; |
|
3927 |
TBuf<40> Cid; |
|
3928 |
TPtr lid_ptr(); |
|
3929 |
TPtr cid_ptr(); |
|
3930 |
||
3931 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
3932 |
MLiwInterface* interface = NULL; |
|
3933 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
3934 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
3935 |
||
3936 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
3937 |
||
3938 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
3939 |
||
3940 |
RCriteriaArray a; |
|
3941 |
a.AppendL(crit); |
|
3942 |
||
3943 |
iServiceHandler->AttachL(a); |
|
3944 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
3945 |
||
3946 |
a.Reset(); |
|
3947 |
delete crit; |
|
3948 |
||
3949 |
TInt pos = 0; |
|
3950 |
||
3951 |
outps->FindFirst( pos, KIDataSource ); |
|
3952 |
if(pos != KErrNotFound) |
|
3953 |
{ |
|
3954 |
interface = (*outps)[pos].Value().AsInterface(); |
|
3955 |
} |
|
3956 |
||
3957 |
outps->Reset(); |
|
3958 |
inps->Reset(); |
|
3959 |
||
3960 |
TLiwGenericParam param; |
|
3961 |
TInt index = 0; |
|
3962 |
||
3963 |
add_lmresult = AddLandMark(inps,outps,interface,KName,KDescription); |
|
3964 |
if(!add_lmresult) |
|
3965 |
add_ctresult = AddCategory(inps,outps,interface,CatName); |
|
3966 |
if(!add_lmresult && (!add_ctresult || add_ctresult == SErrEntryExists)) |
|
3967 |
{ |
|
3968 |
GetLandMarkId(inps,outps,interface,KName,KDescription); |
|
3969 |
GetCatId(inps,outps,interface,CatName); |
|
3970 |
||
3971 |
// Associate the landmark added to the category added |
|
3972 |
||
3973 |
CLiwMap* organise_map = CLiwDefaultMap::NewL(); |
|
3974 |
organise_map->InsertL(KId,TLiwVariant(category_id)); |
|
3975 |
||
3976 |
CLiwList* landmarkIdList = CLiwDefaultList::NewL(); |
|
3977 |
landmarkIdList->AppendL(TLiwVariant(landmark_id)); |
|
3978 |
organise_map->InsertL(KIdList,TLiwVariant(landmarkIdList)); |
|
3979 |
landmarkIdList->DecRef(); |
|
3980 |
||
3981 |
param.SetNameAndValueL(KDataFields,TLiwVariant(organise_map)); |
|
3982 |
inps->AppendL(param); |
|
3983 |
param.Reset(); |
|
3984 |
||
3985 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
3986 |
inps->AppendL(param); |
|
3987 |
param.Reset(); |
|
3988 |
||
3989 |
param.SetNameAndValueL(KOperationType,TLiwVariant(KAssociate)); |
|
3990 |
inps->AppendL(param); |
|
3991 |
param.Reset(); |
|
3992 |
||
3993 |
interface->ExecuteCmdL(KOrganise,*inps,*outps,0,0); |
|
3994 |
organise_map->DecRef(); |
|
3995 |
||
3996 |
const TLiwGenericParam* organise_err = outps->FindFirst(pos,KErrorCode); |
|
3997 |
if(organise_err) |
|
3998 |
result = organise_err->Value().AsTInt32(); |
|
3999 |
||
4000 |
||
4001 |
outps->Reset(); |
|
4002 |
inps->Reset(); |
|
4003 |
} |
|
4004 |
else |
|
4005 |
result = KErrGeneral; // not able to add landmark and category successfully |
|
4006 |
||
4007 |
// Remove the landmark and category |
|
4008 |
if(!add_lmresult) |
|
4009 |
del_lmresult = RemoveLandmark(inps,outps,interface); |
|
4010 |
||
4011 |
if(!add_ctresult || add_ctresult == SErrEntryExists) |
|
4012 |
del_ctresult = RemoveCategory(inps,outps,interface); |
|
4013 |
||
4014 |
if(!result) |
|
4015 |
{ |
|
4016 |
if(del_lmresult) |
|
4017 |
result = del_lmresult; |
|
4018 |
else |
|
4019 |
result = del_ctresult; |
|
4020 |
} |
|
4021 |
||
4022 |
outps->Reset(); |
|
4023 |
inps->Reset(); |
|
4024 |
interface->Close(); |
|
4025 |
delete iServiceHandler; |
|
4026 |
||
4027 |
__UHEAP_MARKEND; |
|
4028 |
return result; |
|
4029 |
} |
|
4030 |
||
4031 |
||
4032 |
// ----------------------------------------------------------------------------- |
|
4033 |
// Ctlandmark_provider::TestOrganiseVarByOrder |
|
4034 |
// To test parsing by position for organise api |
|
4035 |
// (other items were commented in a header). |
|
4036 |
// ----------------------------------------------------------------------------- |
|
4037 |
// |
|
4038 |
TInt Ctlandmark_provider::TestOrganiseVarByPos( CStifItemParser& aItem ) |
|
4039 |
{ |
|
4040 |
_LIT(KName,"Landmark_OrgPos"); |
|
4041 |
_LIT(KDescription,"TestLandmark_OrgPos"); |
|
4042 |
_LIT(CatName,"Category_OrgPos"); |
|
4043 |
TInt32 result = KErrNone; |
|
4044 |
TInt add_lmresult = 0; |
|
4045 |
TInt add_ctresult = -2; |
|
4046 |
TInt del_lmresult = 0; |
|
4047 |
TInt del_ctresult =0; |
|
4048 |
||
4049 |
||
4050 |
__UHEAP_MARK; |
|
4051 |
||
4052 |
TBuf<40> Lid; |
|
4053 |
TBuf<40> Cid; |
|
4054 |
TPtr lid_ptr(); |
|
4055 |
TPtr cid_ptr(); |
|
4056 |
||
4057 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
4058 |
MLiwInterface* interface = NULL; |
|
4059 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
4060 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
4061 |
||
4062 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
4063 |
||
4064 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
4065 |
||
4066 |
RCriteriaArray a; |
|
4067 |
a.AppendL(crit); |
|
4068 |
||
4069 |
iServiceHandler->AttachL(a); |
|
4070 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
4071 |
||
4072 |
a.Reset(); |
|
4073 |
delete crit; |
|
4074 |
||
4075 |
TInt pos = 0; |
|
4076 |
||
4077 |
outps->FindFirst( pos, KIDataSource ); |
|
4078 |
if(pos != KErrNotFound) |
|
4079 |
{ |
|
4080 |
interface = (*outps)[pos].Value().AsInterface(); |
|
4081 |
} |
|
4082 |
||
4083 |
outps->Reset(); |
|
4084 |
inps->Reset(); |
|
4085 |
||
4086 |
TLiwGenericParam param; |
|
4087 |
TInt index = 0; |
|
4088 |
||
4089 |
add_lmresult = AddLandMark(inps,outps,interface,KName,KDescription); |
|
4090 |
if(!add_lmresult) |
|
4091 |
add_ctresult = AddCategory(inps,outps,interface,CatName); |
|
4092 |
if(!add_lmresult && (!add_ctresult || add_ctresult == SErrEntryExists)) |
|
4093 |
{ |
|
4094 |
GetLandMarkId(inps,outps,interface,KName,KDescription); |
|
4095 |
GetCatId(inps,outps,interface,CatName); |
|
4096 |
||
4097 |
// Associate the landmark added to the category added |
|
4098 |
||
4099 |
CLiwMap* organise_map = CLiwDefaultMap::NewL(); |
|
4100 |
organise_map->InsertL(KId,TLiwVariant(category_id)); |
|
4101 |
||
4102 |
CLiwList* landmarkIdList = CLiwDefaultList::NewL(); |
|
4103 |
landmarkIdList->AppendL(TLiwVariant(landmark_id)); |
|
4104 |
organise_map->InsertL(KIdList,TLiwVariant(landmarkIdList)); |
|
4105 |
landmarkIdList->DecRef(); |
|
4106 |
||
4107 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(KLandmark)); |
|
4108 |
inps->AppendL(param); |
|
4109 |
param.Reset(); |
|
4110 |
||
4111 |
param.SetNameAndValueL(KNullDesC8,TLiwVariant(organise_map)); |
|
4112 |
inps->AppendL(param); |
|
4113 |
param.Reset(); |
|
4114 |
||
4115 |
||
4116 |
param.SetNameAndValueL(KSort,TLiwVariant(KAssociate)); |
|
4117 |
inps->AppendL(param); |
|
4118 |
param.Reset(); |
|
4119 |
||
4120 |
interface->ExecuteCmdL(KOrganise,*inps,*outps,0,0); |
|
4121 |
organise_map->DecRef(); |
|
4122 |
||
4123 |
const TLiwGenericParam* organise_err = outps->FindFirst(pos,KErrorCode); |
|
4124 |
if(organise_err) |
|
4125 |
result = organise_err->Value().AsTInt32(); |
|
4126 |
||
4127 |
||
4128 |
outps->Reset(); |
|
4129 |
inps->Reset(); |
|
4130 |
} |
|
4131 |
else |
|
4132 |
result = KErrGeneral; // not able to add landmark and category successfully |
|
4133 |
||
4134 |
// Remove the landmark and category |
|
4135 |
if(!add_lmresult) |
|
4136 |
del_lmresult = RemoveLandmark(inps,outps,interface); |
|
4137 |
||
4138 |
if(!add_ctresult || add_ctresult == SErrEntryExists) |
|
4139 |
del_ctresult = RemoveCategory(inps,outps,interface); |
|
4140 |
||
4141 |
if(!result) |
|
4142 |
{ |
|
4143 |
if(del_lmresult) |
|
4144 |
result = del_lmresult; |
|
4145 |
else |
|
4146 |
result = del_ctresult; |
|
4147 |
} |
|
4148 |
||
4149 |
outps->Reset(); |
|
4150 |
inps->Reset(); |
|
4151 |
interface->Close(); |
|
4152 |
delete iServiceHandler; |
|
4153 |
||
4154 |
__UHEAP_MARKEND; |
|
4155 |
return result; |
|
4156 |
} |
|
4157 |
||
4158 |
// ----------------------------------------------------------------------------- |
|
4159 |
// Ctlandmark_provider::TestInvalidServiceDataSourceCombination |
|
4160 |
// To test invalid service and data source combination for landmarks |
|
4161 |
// (other items were commented in a header). |
|
4162 |
// ----------------------------------------------------------------------------- |
|
4163 |
// |
|
4164 |
TInt Ctlandmark_provider::TestInvalidServiceDataSourceCombination( CStifItemParser& aItem ) |
|
4165 |
{ |
|
4166 |
||
4167 |
TInt32 result = KErrNone; |
|
4168 |
||
4169 |
__UHEAP_MARK; |
|
4170 |
||
4171 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
4172 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
4173 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
4174 |
||
4175 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KMsgService); |
|
4176 |
||
4177 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
4178 |
||
4179 |
RCriteriaArray a; |
|
4180 |
a.AppendL(crit); |
|
4181 |
||
4182 |
iServiceHandler->AttachL(a); |
|
4183 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
4184 |
||
4185 |
a.Reset(); |
|
4186 |
delete crit; |
|
4187 |
||
4188 |
TInt pos = 0; |
|
4189 |
||
4190 |
outps->FindFirst( pos, KIDataSource ); |
|
4191 |
if(pos != KErrNotFound) |
|
4192 |
{ |
|
4193 |
result = KErrGeneral; |
|
4194 |
} |
|
4195 |
||
4196 |
||
4197 |
outps->Reset(); |
|
4198 |
inps->Reset(); |
|
4199 |
||
4200 |
delete iServiceHandler; |
|
4201 |
||
4202 |
__UHEAP_MARKEND; |
|
4203 |
return result; |
|
4204 |
} |
|
4205 |
||
4206 |
||
4207 |
// ----------------------------------------------------------------------------- |
|
4208 |
// Ctlandmark_provider::TestAddSyncAsyncbitcheck |
|
4209 |
// To test sync/async bit check for Add Api |
|
4210 |
// (other items were commented in a header). |
|
4211 |
// ----------------------------------------------------------------------------- |
|
4212 |
// |
|
4213 |
TInt Ctlandmark_provider::TestAddSyncAsyncbitcheck( CStifItemParser& aItem ) |
|
4214 |
{ |
|
4215 |
_LIT(KName,"Add_Invalid"); |
|
4216 |
_LIT(KDescription,"Invalid_case_add"); |
|
4217 |
||
4218 |
TInt32 result = KErrNone; |
|
4219 |
||
4220 |
__UHEAP_MARK; |
|
4221 |
||
4222 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
4223 |
MLiwInterface* interface = NULL; |
|
4224 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
4225 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
4226 |
||
4227 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
4228 |
||
4229 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
4230 |
||
4231 |
RCriteriaArray a; |
|
4232 |
a.AppendL(crit); |
|
4233 |
||
4234 |
iServiceHandler->AttachL(a); |
|
4235 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
4236 |
||
4237 |
a.Reset(); |
|
4238 |
delete crit; |
|
4239 |
||
4240 |
TInt pos = 0; |
|
4241 |
||
4242 |
outps->FindFirst( pos, KIDataSource ); |
|
4243 |
if(pos != KErrNotFound) |
|
4244 |
{ |
|
4245 |
interface = (*outps)[pos].Value().AsInterface(); |
|
4246 |
} |
|
4247 |
||
4248 |
if(!interface) |
|
4249 |
{ |
|
4250 |
delete iServiceHandler; |
|
4251 |
return KErrGeneral; |
|
4252 |
}; |
|
4253 |
||
4254 |
outps->Reset(); |
|
4255 |
inps->Reset(); |
|
4256 |
||
4257 |
TLiwGenericParam param; |
|
4258 |
TInt index = 0; |
|
65
0b68a1b0c15e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
58
diff
changeset
|
4259 |
CActiveSchedulerWait* WaitSchedular; |
19 | 4260 |
CLiwMap* landmarkMap = CLiwDefaultMap::NewL(); |
4261 |
TInt32 test_val = KErrGeneral; |
|
4262 |
||
4263 |
CCalCallback *Callback = CCalCallback::NewL(WaitSchedular,test_val); |
|
4264 |
//name |
|
4265 |
landmarkMap->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
4266 |
||
4267 |
//description |
|
4268 |
landmarkMap->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
|
4269 |
||
4270 |
param.SetNameAndValueL(KDataFields,TLiwVariant(landmarkMap)); |
|
4271 |
inps->AppendL(param); |
|
4272 |
param.Reset(); |
|
4273 |
||
4274 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
4275 |
inps->AppendL(param); |
|
4276 |
param.Reset(); |
|
4277 |
||
4278 |
interface->ExecuteCmdL(KAdd,*inps,*outps,0,Callback); |
|
4279 |
landmarkMap->DecRef(); |
|
4280 |
||
4281 |
const TLiwGenericParam* err = outps->FindFirst(index,KErrorCode); |
|
4282 |
if(err) |
|
4283 |
result = err->Value().AsTInt32(); |
|
4284 |
||
4285 |
outps->Reset(); |
|
4286 |
inps->Reset(); |
|
4287 |
||
4288 |
delete Callback; |
|
4289 |
interface->Close(); |
|
4290 |
delete iServiceHandler; |
|
4291 |
||
4292 |
__UHEAP_MARKEND; |
|
4293 |
if(result == 1000) |
|
4294 |
return KErrNone; |
|
4295 |
else |
|
4296 |
return result; |
|
4297 |
||
4298 |
} |
|
4299 |
||
4300 |
// ----------------------------------------------------------------------------- |
|
4301 |
// Ctlandmark_provider::TestGetListSyncAsyncbitcheck |
|
4302 |
// To test sync/async bit check for GetList Api |
|
4303 |
// (other items were commented in a header). |
|
4304 |
// ----------------------------------------------------------------------------- |
|
4305 |
// |
|
4306 |
TInt Ctlandmark_provider::TestGetListSyncAsyncbitcheck( CStifItemParser& aItem ) |
|
4307 |
{ |
|
4308 |
__UHEAP_MARK; |
|
4309 |
CTestAsync* test = CTestAsync::NewL(2); |
|
4310 |
test->Start(); |
|
4311 |
TInt32 result = test->Result(); |
|
4312 |
delete test; |
|
4313 |
__UHEAP_MARKEND; |
|
4314 |
||
4315 |
if(result == SErrBadArgumentType) |
|
4316 |
return KErrNone; |
|
4317 |
else |
|
4318 |
return result; |
|
4319 |
} |
|
4320 |
||
4321 |
||
4322 |
// ----------------------------------------------------------------------------- |
|
4323 |
// Ctlandmark_provider::TestGetListCancel |
|
4324 |
// To call cancel and check for error value and event flag |
|
4325 |
// (other items were commented in a header). |
|
4326 |
// ----------------------------------------------------------------------------- |
|
4327 |
// |
|
4328 |
TInt Ctlandmark_provider::TestGetListCancel( CStifItemParser& aItem ) |
|
4329 |
{ |
|
4330 |
__UHEAP_MARK; |
|
4331 |
CTestAsync* test = CTestAsync::NewL(3); |
|
4332 |
test->Start(); |
|
4333 |
TInt32 result = test->Result(); |
|
4334 |
delete test; |
|
4335 |
__UHEAP_MARKEND; |
|
4336 |
return result; |
|
4337 |
} |
|
4338 |
||
4339 |
// ----------------------------------------------------------------------------- |
|
4340 |
// Ctlandmark_provider::GetListStressTest |
|
4341 |
// calling getlist async api multiple times |
|
4342 |
// (other items were commented in a header). |
|
4343 |
// ----------------------------------------------------------------------------- |
|
4344 |
// |
|
4345 |
TInt Ctlandmark_provider::GetListStressTest( CStifItemParser& aItem ) |
|
4346 |
{ |
|
4347 |
__UHEAP_MARK; |
|
4348 |
CTestAsync* test = CTestAsync::NewL(5); |
|
4349 |
test->Start(); |
|
4350 |
TInt32 result = test->Result(); |
|
4351 |
delete test; |
|
4352 |
__UHEAP_MARKEND; |
|
4353 |
if(result != SErrServiceInUse) |
|
4354 |
return KErrGeneral; |
|
4355 |
else |
|
4356 |
return KErrNone; |
|
4357 |
} |
|
4358 |
||
4359 |
// ----------------------------------------------------------------------------- |
|
4360 |
// Ctlandmark_provider::GetListIteratorTestLM |
|
4361 |
// calling getlist and checking the functionality of Nextl and reset functions on the iterator for landmarks |
|
4362 |
// (other items were commented in a header). |
|
4363 |
// ----------------------------------------------------------------------------- |
|
4364 |
// |
|
4365 |
TInt Ctlandmark_provider::GetListIteratorTestLM( CStifItemParser& aItem ) |
|
4366 |
{ |
|
4367 |
__UHEAP_MARK; |
|
4368 |
_LIT(KName,"GetList_Iterator"); |
|
4369 |
_LIT(KDescription,"Iterator Tests"); |
|
4370 |
||
4371 |
TInt32 result = KErrNone; |
|
4372 |
TInt item_count_before_reset = 0; |
|
4373 |
TInt item_count_after_reset = 0; |
|
4374 |
TBuf<40> first_lid_before_reset; |
|
4375 |
TBuf<40> first_lid_after_reset; |
|
4376 |
TLiwGenericParam param; |
|
4377 |
||
4378 |
||
4379 |
||
4380 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
4381 |
MLiwInterface* interface = NULL; |
|
4382 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
4383 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
4384 |
||
4385 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
4386 |
||
4387 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
4388 |
||
4389 |
RCriteriaArray a; |
|
4390 |
a.AppendL(crit); |
|
4391 |
||
4392 |
iServiceHandler->AttachL(a); |
|
4393 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
4394 |
||
4395 |
a.Reset(); |
|
4396 |
delete crit; |
|
4397 |
||
4398 |
TInt pos = 0; |
|
4399 |
||
4400 |
outps->FindFirst( pos, KIDataSource ); |
|
4401 |
if(pos != KErrNotFound) |
|
4402 |
{ |
|
4403 |
interface = (*outps)[pos].Value().AsInterface(); |
|
4404 |
} |
|
4405 |
||
4406 |
outps->Reset(); |
|
4407 |
inps->Reset(); |
|
4408 |
||
4409 |
result = AddLandMark(inps,outps,interface,KName,KDescription); |
|
4410 |
||
4411 |
if(!result) |
|
4412 |
{ |
|
4413 |
outps->Reset(); |
|
4414 |
inps->Reset(); |
|
4415 |
||
4416 |
CLiwMap* getlistlandmark_map = CLiwDefaultMap::NewL(); |
|
4417 |
getlistlandmark_map->InsertL(KLandmarkName,TLiwVariant(KName)); |
|
4418 |
||
4419 |
//description |
|
4420 |
getlistlandmark_map->InsertL(KLandmarkDesc,TLiwVariant(KDescription)); |
|
4421 |
||
4422 |
param.SetNameAndValueL(KFilter,TLiwVariant(getlistlandmark_map)); |
|
4423 |
inps->AppendL(param); |
|
4424 |
param.Reset(); |
|
4425 |
||
4426 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
4427 |
inps->AppendL(param); |
|
4428 |
param.Reset(); |
|
4429 |
||
4430 |
interface->ExecuteCmdL(KGetList,*inps,*outps,0,0); |
|
4431 |
getlistlandmark_map->DecRef(); |
|
4432 |
||
4433 |
pos=0; |
|
4434 |
const TLiwGenericParam* getlist_err = outps->FindFirst(pos,KErrorCode); |
|
4435 |
if(getlist_err) |
|
4436 |
result = getlist_err->Value().AsTInt32(); |
|
4437 |
} |
|
4438 |
||
4439 |
||
4440 |
if(!result) |
|
4441 |
{ |
|
4442 |
// Iterate through the list |
|
4443 |
pos=0; |
|
4444 |
const TLiwGenericParam* output = outps->FindFirst( pos,_L8("ReturnValue")); |
|
4445 |
||
4446 |
if(output) |
|
4447 |
{ |
|
4448 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
4449 |
||
4450 |
TLiwVariant data; |
|
4451 |
||
4452 |
while( iterlist->NextL(data)) |
|
4453 |
{ |
|
4454 |
item_count_before_reset++; |
|
4455 |
const CLiwMap* res = data.AsMap(); |
|
4456 |
if ( res ) |
|
4457 |
{ |
|
4458 |
TLiwVariant new_data; |
|
4459 |
if(res->FindL(KId, new_data)) |
|
4460 |
{ |
|
4461 |
TPtrC lid = new_data.AsDes(); |
|
4462 |
first_lid_before_reset.Copy(lid); |
|
4463 |
landmark_id.Copy(lid); |
|
4464 |
} |
|
4465 |
new_data.Reset(); |
|
4466 |
} |
|
4467 |
} |
|
4468 |
data.Reset(); |
|
4469 |
||
4470 |
iterlist->Reset(); |
|
4471 |
while( iterlist->NextL(data)) |
|
4472 |
{ |
|
4473 |
item_count_after_reset++; |
|
4474 |
const CLiwMap* res = data.AsMap(); |
|
4475 |
if ( res ) |
|
4476 |
{ |
|
4477 |
TLiwVariant new_data; |
|
4478 |
if(res->FindL(KId, new_data)) |
|
4479 |
{ |
|
4480 |
TPtrC lid = new_data.AsDes(); |
|
4481 |
first_lid_after_reset.Copy(lid); |
|
4482 |
} |
|
4483 |
new_data.Reset(); |
|
4484 |
} |
|
4485 |
} |
|
4486 |
data.Reset(); |
|
4487 |
} |
|
4488 |
||
4489 |
outps->Reset(); |
|
4490 |
inps->Reset(); |
|
4491 |
} |
|
4492 |
||
4493 |
if((item_count_before_reset != item_count_after_reset) || (first_lid_before_reset.Compare(first_lid_after_reset))) |
|
4494 |
result = KErrGeneral; |
|
4495 |
||
4496 |
RemoveLandmark(inps,outps,interface); |
|
4497 |
||
4498 |
interface->Close(); |
|
4499 |
delete iServiceHandler; |
|
4500 |
__UHEAP_MARKEND; |
|
4501 |
return result; |
|
4502 |
} |
|
4503 |
||
4504 |
// ----------------------------------------------------------------------------- |
|
4505 |
// Ctlandmark_provider::GetListIteratorTestCT |
|
4506 |
// calling getlist and checking the functionality of Nextl and reset functions on the iterator for category |
|
4507 |
// (other items were commented in a header). |
|
4508 |
// ----------------------------------------------------------------------------- |
|
4509 |
// |
|
4510 |
TInt Ctlandmark_provider::GetListIteratorTestCT( CStifItemParser& aItem ) |
|
4511 |
{ |
|
4512 |
__UHEAP_MARK; |
|
4513 |
_LIT(KCatName,"GetList_IteratorCT"); |
|
4514 |
||
4515 |
TInt32 result = KErrNone; |
|
4516 |
TInt item_count_before_reset = 0; |
|
4517 |
TInt item_count_after_reset = 0; |
|
4518 |
TBuf<40> first_cid_before_reset; |
|
4519 |
TBuf<40> first_cid_after_reset; |
|
4520 |
TLiwGenericParam param; |
|
4521 |
||
4522 |
||
4523 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
4524 |
MLiwInterface* interface = NULL; |
|
4525 |
CLiwGenericParamList* inps = &(iServiceHandler->InParamListL()); |
|
4526 |
CLiwGenericParamList* outps = &(iServiceHandler->OutParamListL()); |
|
4527 |
||
4528 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
4529 |
||
4530 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
4531 |
||
4532 |
RCriteriaArray a; |
|
4533 |
a.AppendL(crit); |
|
4534 |
||
4535 |
iServiceHandler->AttachL(a); |
|
4536 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inps, *outps); |
|
4537 |
||
4538 |
a.Reset(); |
|
4539 |
delete crit; |
|
4540 |
||
4541 |
TInt pos = 0; |
|
4542 |
||
4543 |
outps->FindFirst( pos, KIDataSource ); |
|
4544 |
if(pos != KErrNotFound) |
|
4545 |
{ |
|
4546 |
interface = (*outps)[pos].Value().AsInterface(); |
|
4547 |
} |
|
4548 |
||
4549 |
outps->Reset(); |
|
4550 |
inps->Reset(); |
|
4551 |
||
4552 |
result = AddCategory(inps,outps,interface,KCatName); |
|
4553 |
||
4554 |
if(!result) |
|
4555 |
{ |
|
4556 |
outps->Reset(); |
|
4557 |
inps->Reset(); |
|
4558 |
||
4559 |
CLiwMap* getlistcategory_map = CLiwDefaultMap::NewL(); |
|
4560 |
getlistcategory_map->InsertL(KCategoryName,TLiwVariant(KCatName)); |
|
4561 |
||
4562 |
param.SetNameAndValueL(KFilter,TLiwVariant(getlistcategory_map)); |
|
4563 |
inps->AppendL(param); |
|
4564 |
param.Reset(); |
|
4565 |
||
4566 |
param.SetNameAndValueL(KContentType,TLiwVariant(KCategory)); |
|
4567 |
inps->AppendL(param); |
|
4568 |
param.Reset(); |
|
4569 |
||
4570 |
interface->ExecuteCmdL(KGetList,*inps,*outps,0,0); |
|
4571 |
getlistcategory_map->DecRef(); |
|
4572 |
||
4573 |
pos=0; |
|
4574 |
const TLiwGenericParam* getlist_err = outps->FindFirst(pos,KErrorCode); |
|
4575 |
if(getlist_err) |
|
4576 |
result = getlist_err->Value().AsTInt32(); |
|
4577 |
} |
|
4578 |
||
4579 |
||
4580 |
if(!result) |
|
4581 |
{ |
|
4582 |
// Iterate through the list |
|
4583 |
pos=0; |
|
4584 |
const TLiwGenericParam* output = outps->FindFirst( pos,_L8("ReturnValue")); |
|
4585 |
||
4586 |
if(output) |
|
4587 |
{ |
|
4588 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
4589 |
||
4590 |
TLiwVariant data; |
|
4591 |
||
4592 |
while( iterlist->NextL(data)) |
|
4593 |
{ |
|
4594 |
item_count_before_reset++; |
|
4595 |
const CLiwMap* res = data.AsMap(); |
|
4596 |
if ( res ) |
|
4597 |
{ |
|
4598 |
TLiwVariant new_data; |
|
4599 |
if(res->FindL(KId, new_data)) |
|
4600 |
{ |
|
4601 |
TPtrC cid = new_data.AsDes(); |
|
4602 |
first_cid_before_reset.Copy(cid); |
|
4603 |
category_id.Copy(cid); |
|
4604 |
} |
|
4605 |
new_data.Reset(); |
|
4606 |
} |
|
4607 |
} |
|
4608 |
data.Reset(); |
|
4609 |
||
4610 |
iterlist->Reset(); |
|
4611 |
while( iterlist->NextL(data)) |
|
4612 |
{ |
|
4613 |
item_count_after_reset++; |
|
4614 |
const CLiwMap* res = data.AsMap(); |
|
4615 |
if ( res ) |
|
4616 |
{ |
|
4617 |
TLiwVariant new_data; |
|
4618 |
if(res->FindL(KId, new_data)) |
|
4619 |
{ |
|
4620 |
TPtrC cid = new_data.AsDes(); |
|
4621 |
first_cid_after_reset.Copy(cid); |
|
4622 |
} |
|
4623 |
new_data.Reset(); |
|
4624 |
} |
|
4625 |
} |
|
4626 |
data.Reset(); |
|
4627 |
} |
|
4628 |
||
4629 |
outps->Reset(); |
|
4630 |
inps->Reset(); |
|
4631 |
} |
|
4632 |
||
4633 |
if((item_count_before_reset != item_count_after_reset) || (first_cid_before_reset.Compare(first_cid_after_reset))) |
|
4634 |
result = KErrGeneral; |
|
4635 |
||
4636 |
RemoveCategory(inps,outps,interface); |
|
4637 |
interface->Close(); |
|
4638 |
delete iServiceHandler; |
|
4639 |
__UHEAP_MARKEND; |
|
4640 |
return result; |
|
4641 |
} |
|
4642 |
||
4643 |
// Helper functions |
|
4644 |
||
4645 |
TInt RemoveLandmark(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface) |
|
4646 |
{ |
|
4647 |
TInt ret = 0; |
|
4648 |
TLiwGenericParam param; |
|
4649 |
TInt pos = 0; |
|
4650 |
||
4651 |
CLiwMap* remove_map = CLiwDefaultMap::NewL(); |
|
4652 |
remove_map->InsertL(KId,TLiwVariant(landmark_id)); |
|
4653 |
||
4654 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
4655 |
inparam->AppendL(param); |
|
4656 |
param.Reset(); |
|
4657 |
||
4658 |
param.SetNameAndValueL(KDataFields,TLiwVariant(remove_map)); |
|
4659 |
inparam->AppendL(param); |
|
4660 |
param.Reset(); |
|
4661 |
||
4662 |
interface->ExecuteCmdL(KRemove,*inparam,*outparam,0,0); |
|
4663 |
remove_map->DecRef(); |
|
4664 |
||
4665 |
const TLiwGenericParam* remove_err = outparam->FindFirst(pos,KErrorCode); |
|
4666 |
if(remove_err) |
|
4667 |
ret = remove_err->Value().AsTInt32(); |
|
4668 |
||
4669 |
outparam->Reset(); |
|
4670 |
inparam->Reset(); |
|
4671 |
return ret; |
|
4672 |
} |
|
4673 |
||
4674 |
TInt RemoveCategory(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface) |
|
4675 |
{ |
|
4676 |
TInt ret = 0; |
|
4677 |
TLiwGenericParam param; |
|
4678 |
TInt pos = 0; |
|
4679 |
||
4680 |
CLiwMap* remove_map = CLiwDefaultMap::NewL(); |
|
4681 |
remove_map->InsertL(KId,TLiwVariant(category_id)); |
|
4682 |
||
4683 |
param.SetNameAndValueL(KContentType,TLiwVariant(KCategory)); |
|
4684 |
inparam->AppendL(param); |
|
4685 |
param.Reset(); |
|
4686 |
||
4687 |
param.SetNameAndValueL(KDataFields,TLiwVariant(remove_map)); |
|
4688 |
inparam->AppendL(param); |
|
4689 |
param.Reset(); |
|
4690 |
||
4691 |
interface->ExecuteCmdL(KRemove,*inparam,*outparam,0,0); |
|
4692 |
remove_map->DecRef(); |
|
4693 |
||
4694 |
const TLiwGenericParam* remove_err = outparam->FindFirst(pos,KErrorCode); |
|
4695 |
if(remove_err) |
|
4696 |
ret = remove_err->Value().AsTInt32(); |
|
4697 |
||
4698 |
outparam->Reset(); |
|
4699 |
inparam->Reset(); |
|
4700 |
return ret; |
|
4701 |
} |
|
4702 |
void GetLandMarkId(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface,const TDesC &landmark_name,const TDesC &landmark_description) |
|
4703 |
{ |
|
4704 |
TInt ret = 0; |
|
4705 |
TLiwGenericParam param; |
|
4706 |
TInt pos = 0; |
|
4707 |
||
4708 |
CLiwMap* getlistlandmark_map = CLiwDefaultMap::NewL(); |
|
4709 |
getlistlandmark_map->InsertL(KLandmarkName,TLiwVariant(landmark_name)); |
|
4710 |
||
4711 |
//description |
|
37
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
4712 |
//getlistlandmark_map->InsertL(KLandmarkDesc,TLiwVariant(landmark_description)); |
19 | 4713 |
|
4714 |
param.SetNameAndValueL(KFilter,TLiwVariant(getlistlandmark_map)); |
|
4715 |
inparam->AppendL(param); |
|
4716 |
param.Reset(); |
|
4717 |
||
4718 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
4719 |
inparam->AppendL(param); |
|
4720 |
param.Reset(); |
|
4721 |
||
4722 |
interface->ExecuteCmdL(KGetList,*inparam,*outparam,0,0); |
|
4723 |
getlistlandmark_map->DecRef(); |
|
4724 |
||
4725 |
const TLiwGenericParam* getlist_err = outparam->FindFirst(pos,KErrorCode); |
|
4726 |
if(getlist_err) |
|
4727 |
ret = getlist_err->Value().AsTInt32(); |
|
4728 |
||
4729 |
||
4730 |
if(!ret) |
|
4731 |
{ |
|
4732 |
// Get the landmark Id |
|
4733 |
pos=0; |
|
4734 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ReturnValue")); |
|
4735 |
||
4736 |
if(output) |
|
4737 |
{ |
|
4738 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
4739 |
||
4740 |
TLiwVariant data; |
|
4741 |
||
4742 |
while( iterlist->NextL(data)) |
|
4743 |
{ |
|
4744 |
const CLiwMap* res = data.AsMap(); |
|
4745 |
if ( res ) |
|
4746 |
{ |
|
4747 |
TLiwVariant new_data; |
|
4748 |
if(res->FindL(KId, new_data)) |
|
4749 |
{ |
|
4750 |
TPtrC lid = new_data.AsDes(); |
|
4751 |
landmark_id.Copy(lid); |
|
4752 |
} |
|
4753 |
new_data.Reset(); |
|
4754 |
} |
|
4755 |
} |
|
4756 |
data.Reset(); |
|
4757 |
} |
|
4758 |
} |
|
4759 |
||
4760 |
outparam->Reset(); |
|
4761 |
inparam->Reset(); |
|
4762 |
} |
|
4763 |
||
4764 |
void GetCatId(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface,const TDesC &category_name) |
|
4765 |
{ |
|
4766 |
TInt ret = 0; |
|
4767 |
TLiwGenericParam param; |
|
4768 |
TInt pos = 0; |
|
4769 |
||
4770 |
CLiwMap* getlistcategory_map = CLiwDefaultMap::NewL(); |
|
4771 |
getlistcategory_map->InsertL(KCategoryName,TLiwVariant(category_name)); |
|
4772 |
||
4773 |
param.SetNameAndValueL(KFilter,TLiwVariant(getlistcategory_map)); |
|
4774 |
inparam->AppendL(param); |
|
4775 |
param.Reset(); |
|
4776 |
||
4777 |
param.SetNameAndValueL(KContentType,TLiwVariant(KCategory)); |
|
4778 |
inparam->AppendL(param); |
|
4779 |
param.Reset(); |
|
4780 |
||
4781 |
interface->ExecuteCmdL(KGetList,*inparam,*outparam,0,0); |
|
4782 |
getlistcategory_map->DecRef(); |
|
4783 |
||
4784 |
const TLiwGenericParam* getlist_err = outparam->FindFirst(pos,KErrorCode); |
|
4785 |
if(getlist_err) |
|
4786 |
ret = getlist_err->Value().AsTInt32(); |
|
4787 |
||
4788 |
||
4789 |
if(!ret) |
|
4790 |
{ |
|
4791 |
// Get the category Id |
|
4792 |
pos=0; |
|
4793 |
const TLiwGenericParam* output = outparam->FindFirst( pos,_L8("ReturnValue")); |
|
4794 |
||
4795 |
if(output) |
|
4796 |
{ |
|
4797 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
4798 |
||
4799 |
TLiwVariant data; |
|
4800 |
||
4801 |
while( iterlist->NextL(data)) |
|
4802 |
{ |
|
4803 |
const CLiwMap* res = data.AsMap(); |
|
4804 |
if ( res ) |
|
4805 |
{ |
|
4806 |
TLiwVariant new_data; |
|
4807 |
if(res->FindL(KId, new_data)) |
|
4808 |
{ |
|
4809 |
TPtrC c_id = new_data.AsDes(); |
|
4810 |
category_id.Copy(c_id); |
|
4811 |
} |
|
4812 |
new_data.Reset(); |
|
4813 |
} |
|
4814 |
} |
|
4815 |
data.Reset(); |
|
4816 |
} |
|
4817 |
} |
|
4818 |
outparam->Reset(); |
|
4819 |
inparam->Reset(); |
|
4820 |
} |
|
4821 |
||
4822 |
||
4823 |
TInt AddLandMark(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface,const TDesC &landmark_name,const TDesC &landmark_description) |
|
4824 |
{ |
|
4825 |
TInt ret = 0; |
|
4826 |
||
4827 |
TLiwGenericParam param; |
|
4828 |
TInt index = 0; |
|
4829 |
||
4830 |
CLiwMap* landmarkMap = CLiwDefaultMap::NewL(); |
|
4831 |
landmarkMap->InsertL(KLandmarkName,TLiwVariant(landmark_name)); |
|
4832 |
||
4833 |
//description |
|
4834 |
landmarkMap->InsertL(KLandmarkDesc,TLiwVariant(landmark_description)); |
|
4835 |
||
4836 |
param.SetNameAndValueL(KDataFields,TLiwVariant(landmarkMap)); |
|
4837 |
inparam->AppendL(param); |
|
4838 |
param.Reset(); |
|
4839 |
||
4840 |
param.SetNameAndValueL(KContentType,TLiwVariant(KLandmark)); |
|
4841 |
inparam->AppendL(param); |
|
4842 |
param.Reset(); |
|
4843 |
||
4844 |
interface->ExecuteCmdL(KAdd,*inparam,*outparam,0,0); |
|
4845 |
landmarkMap->DecRef(); |
|
4846 |
||
4847 |
const TLiwGenericParam* err = outparam->FindFirst(index,KErrorCode); |
|
4848 |
if(err) |
|
4849 |
ret = err->Value().AsTInt32(); |
|
4850 |
outparam->Reset(); |
|
4851 |
inparam->Reset(); |
|
4852 |
return ret; |
|
4853 |
} |
|
4854 |
||
4855 |
TInt AddCategory(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface,const TDesC &category_name) |
|
4856 |
{ |
|
4857 |
TInt ret = 0; |
|
4858 |
CLiwMap* categoryMap = CLiwDefaultMap::NewL(); |
|
4859 |
TLiwGenericParam param; |
|
4860 |
||
4861 |
//name |
|
4862 |
categoryMap->InsertL(KCategoryName,TLiwVariant(category_name)); |
|
4863 |
||
4864 |
param.SetNameAndValueL(KDataFields,TLiwVariant(categoryMap)); |
|
4865 |
inparam->AppendL(param); |
|
4866 |
param.Reset(); |
|
4867 |
||
4868 |
param.SetNameAndValueL(KContentType,TLiwVariant(KCategory)); |
|
4869 |
inparam->AppendL(param); |
|
4870 |
param.Reset(); |
|
4871 |
||
4872 |
interface->ExecuteCmdL(KAdd,*inparam,*outparam,0,0); |
|
4873 |
categoryMap->DecRef(); |
|
4874 |
||
4875 |
TInt index = 0; |
|
4876 |
||
4877 |
const TLiwGenericParam* err = outparam->FindFirst(index,KErrorCode); |
|
4878 |
if(err) |
|
4879 |
ret = err->Value().AsTInt32(); |
|
4880 |
||
4881 |
outparam->Reset(); |
|
4882 |
inparam->Reset(); |
|
4883 |
return ret; |
|
4884 |
} |
|
4885 |
||
4886 |
// ----------------------------------------------------------------------------- |
|
4887 |
// Ctlandmark_provider::?member_function |
|
4888 |
// ?implementation_description |
|
4889 |
// (other items were commented in a header). |
|
4890 |
// ----------------------------------------------------------------------------- |
|
4891 |
// |
|
4892 |
/* |
|
4893 |
TInt Ctlandmark_provider::?member_function( |
|
4894 |
CItemParser& aItem ) |
|
4895 |
{ |
|
4896 |
||
4897 |
?code |
|
4898 |
||
4899 |
} |
|
4900 |
*/ |
|
4901 |
||
4902 |
// ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
4903 |
// None |
|
4904 |
||
4905 |
// End of File |