63
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-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 "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: Parser of the data received from configuration file
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef TEST_SUITE_INPUT_DATA_H
|
|
20 |
#define TEST_SUITE_INPUT_DATA_H
|
|
21 |
|
|
22 |
// SYSTEM INCLUDES
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <CPsQuery.h>
|
|
25 |
#include <CPsSettings.h>
|
|
26 |
#include <StifParser.h>
|
|
27 |
#include <CPsClientData.h>
|
|
28 |
#include <CPsRequestHandler.h>
|
|
29 |
|
|
30 |
//User Include
|
|
31 |
#include "psclienttestsuitedefs.h"
|
|
32 |
|
|
33 |
//Forward Declaration
|
|
34 |
class CPcsTestContactsHandler;
|
|
35 |
|
|
36 |
/**
|
|
37 |
* This class performs parsing of the data input from the configuration file
|
|
38 |
*
|
|
39 |
* @since S60 v3.2
|
|
40 |
*/
|
|
41 |
class CTestSuiteInputData :public CBase
|
|
42 |
{
|
|
43 |
public: // Constructors and destructor
|
|
44 |
|
|
45 |
/**
|
|
46 |
* Two-phased constructor.
|
|
47 |
*/
|
|
48 |
static CTestSuiteInputData* NewL(CStifItemParser& aItem,CPSRequestHandler& aPsClientHandler);
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Destructor.
|
|
52 |
*/
|
|
53 |
virtual ~CTestSuiteInputData();
|
|
54 |
|
|
55 |
public: // Functions
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Provides the Keyboard mode of this object
|
|
59 |
*
|
|
60 |
* @return Keyboard mode of this object
|
|
61 |
*/
|
|
62 |
TDesC& KeyboardMode() const;
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Sets the Keyboard mode of this object
|
|
66 |
*
|
|
67 |
* @param aKeyboardMode The Keyboard mode
|
|
68 |
*/
|
|
69 |
void SetKeyboardModeL(const TDesC& aKeyboardMode);
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Returns the search query, as specified in the configuration parameter
|
|
73 |
*
|
|
74 |
* @return Query
|
|
75 |
*/
|
|
76 |
TDesC& Query() const;
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Sets the search query
|
|
80 |
*
|
|
81 |
* @param aQuery The Query
|
|
82 |
*/
|
|
83 |
void SetQueryL(const TDesC& aQuery);
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Pointer to the data element at the specified location
|
|
87 |
*
|
|
88 |
* @param aIndex Index of data element
|
|
89 |
* @param aInputCacheData Pointer to data element
|
|
90 |
*/
|
|
91 |
void InputCacheData(TInt aIndex, cacheData& aInputCacheData) const;
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Adds the cachedata to the array of input cache data
|
|
95 |
*
|
|
96 |
* @param aInputCacheData
|
|
97 |
*/
|
|
98 |
void AppendInputCacheDataL(const cacheData& aInputCacheData);
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Returns the number of Input Cache Data elements
|
|
102 |
*
|
|
103 |
* @return Number of Input Cache Data elements
|
|
104 |
*/
|
|
105 |
TInt InputCacheDataCount() const;
|
|
106 |
|
|
107 |
/**
|
|
108 |
* Returns the array of cachedata of the result data
|
|
109 |
*
|
|
110 |
* @param aResultData Pointer to data element
|
|
111 |
*/
|
|
112 |
void ResultData(RPointerArray<cacheData>& aResultData) const;
|
|
113 |
|
|
114 |
/**
|
|
115 |
* Appends cachedata to the the aResultData
|
|
116 |
*
|
|
117 |
* @param aResultData
|
|
118 |
*/
|
|
119 |
void AppendResultDataL(const cacheData& aResultData);
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Returns the number of ResultData elements
|
|
123 |
*
|
|
124 |
* @return Number of ResultData elements
|
|
125 |
*/
|
|
126 |
TInt ResultDataCount() const;
|
|
127 |
|
|
128 |
/**
|
|
129 |
* Returns the sort type
|
|
130 |
*
|
|
131 |
* @return sort Type
|
|
132 |
*/
|
|
133 |
TSortType GetSortType();
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Returns the pointer to the uri at the specified location
|
|
137 |
*
|
|
138 |
* @param aIndex Index of data element
|
|
139 |
* @return Pointer to Cache Uri
|
|
140 |
*/
|
|
141 |
TDesC& CacheUris(TInt aIndex) const;
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Sets the cache uris
|
|
145 |
*
|
|
146 |
* @param aCacheUri Cache Uri descriptor to be searched
|
|
147 |
*/
|
|
148 |
void ApendCacheUrisL(RPointerArray<TDesC>& aCacheUriArray);
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Returns the number of Cache Uris (data stores)
|
|
152 |
*
|
|
153 |
* @return Number of Cache Uris (data stores)
|
|
154 |
*/
|
|
155 |
TInt CacheUrisCount() const;
|
|
156 |
|
|
157 |
/*
|
|
158 |
* Returns the Input language (as specified in the configuration file)
|
|
159 |
*/
|
|
160 |
TLanguage LanguageInput();
|
|
161 |
|
|
162 |
/*
|
|
163 |
* Returns the expected result for the Input language
|
|
164 |
* (as specified in the configuration file)
|
|
165 |
*/
|
|
166 |
TBool LanguageInputExpectedResult();
|
|
167 |
/*
|
|
168 |
* Parses the input data
|
|
169 |
*
|
|
170 |
* @param aItem - The input test case name and parmeters
|
|
171 |
*/
|
|
172 |
void ParseInputL(CStifItemParser& aItem);
|
|
173 |
|
|
174 |
/*
|
|
175 |
* Creates contacts in the phonebook. The contact data is taken from iInputCacheData
|
|
176 |
*/
|
|
177 |
void CreateContactsL();
|
|
178 |
|
|
179 |
/*
|
|
180 |
* Creates the search query
|
|
181 |
*
|
|
182 |
* @param aPsQuery - The search query as needed by the ps engine
|
|
183 |
* @param aQueryBuf - The input search query
|
|
184 |
*/
|
|
185 |
void CreateSearchQueryL(CPsQuery& aPsQuery,TDesC& aQueryBuf);
|
|
186 |
|
|
187 |
/*
|
|
188 |
* Performs the search settings
|
|
189 |
*
|
|
190 |
* @param aSettings - The search settings
|
|
191 |
*/
|
|
192 |
void PerformSearchSettingsL(CPsSettings& aSettings);
|
|
193 |
|
|
194 |
/*
|
|
195 |
* compares the search results with expected results
|
|
196 |
*
|
|
197 |
* @param aSettings - The search results
|
|
198 |
*/
|
|
199 |
TInt CompareResWithExpResL(RPointerArray<CPsClientData>& searchResults);
|
|
200 |
TInt ExactMatchCompareInputDataWithResultDataL(RPointerArray<CPsClientData>& searchResults);
|
|
201 |
|
|
202 |
/*
|
|
203 |
* Deletes all the created contacts
|
|
204 |
*/
|
|
205 |
void DeleteAllCreatedContactsL();
|
|
206 |
|
|
207 |
/*
|
|
208 |
* Deletes contacts with specific ids
|
|
209 |
*/
|
|
210 |
void DeleteContactsWithIdsL(RArray<TInt>& aContactIdArray);
|
|
211 |
|
|
212 |
/*
|
|
213 |
* Returns the input search string
|
|
214 |
*/
|
|
215 |
TDesC& InputSearchString() const;
|
|
216 |
|
|
217 |
/*
|
|
218 |
* Returns the input search string
|
|
219 |
*/
|
|
220 |
const TDesC& ExpectedResultString() const;
|
|
221 |
|
|
222 |
/*
|
|
223 |
* Returns the input boolean
|
|
224 |
*/
|
|
225 |
TBool InputBoolean() const;
|
|
226 |
|
|
227 |
/*
|
|
228 |
* Return the group name to be searched (as specified in configuration file)
|
|
229 |
*/
|
|
230 |
TDesC& GroupToBeSearched() const;
|
|
231 |
|
|
232 |
/*
|
|
233 |
* Tests if Id returns correct vpbklink
|
|
234 |
*
|
|
235 |
* @param aPsClientHandler - PsClientHandler instance
|
|
236 |
* @param srchId - Id to be tested\
|
|
237 |
* @return - ETrue if Id returns correct link, else EFalse
|
|
238 |
*/
|
|
239 |
TBool TestVpbkLinkForIdL(CPSRequestHandler& aPsClientHandler,const CPsClientData& aSearchResult);
|
|
240 |
|
|
241 |
/**
|
|
242 |
* Returns ths sort order
|
|
243 |
*
|
|
244 |
* @param aSortOrder - The sort order
|
|
245 |
*/
|
|
246 |
void SortOrder(RArray<TInt>& aSortOrder);
|
|
247 |
|
|
248 |
/*
|
|
249 |
* Return array of expected result locations data
|
|
250 |
*/
|
|
251 |
const RArray<TPsMatchLocation>& ExpectedLocations();
|
|
252 |
|
|
253 |
private: // functions
|
|
254 |
|
|
255 |
/**
|
|
256 |
* Default Constructor
|
|
257 |
*/
|
|
258 |
CTestSuiteInputData();
|
|
259 |
|
|
260 |
/**
|
|
261 |
* Second phase constructor
|
|
262 |
*/
|
|
263 |
void ConstructL(CStifItemParser& aItem,CPSRequestHandler& aPsClientHandler);
|
|
264 |
|
|
265 |
private: // Private functions for internal Parsing data
|
|
266 |
void ParseInputForContactsDataL(TDesC& aInput, TInt aType);
|
|
267 |
void AddSingleContactDataL(TDesC& aInput, TInt aType);
|
|
268 |
void ParseInputForMatchLocationsL(TDesC& aInput);
|
|
269 |
void ParseInputForDataStoresUriL(TDesC& aInput);
|
|
270 |
void GetCharacterSeparatedDataL(TDesC& aInput, TChar aSeparator, RPointerArray<TDesC> &aSeparatedData);
|
|
271 |
void ParseInputForSearchQueryL(TDesC& aInput);
|
|
272 |
TBool CompareInputDataWithResultDataL(CPsClientData& aResData,cacheData aInputData);
|
|
273 |
void ParseInputForDisplayFieldsL(TDesC& aInput);
|
|
274 |
void ParseInputInputSearchStringL(TDesC& aInput);
|
|
275 |
void ParseInputExpectedResultStringL(TDesC& aInput);
|
|
276 |
void ParseInputInputBoolean(TDesC& aInput);
|
|
277 |
void ParseInputForLanguageSupportL(TDesC& aInput);
|
|
278 |
void ParseInputForAddingGroupsL(TDesC& aInput);
|
|
279 |
void ParseInputForSearchWithinGroupL(TDesC& aInput);
|
|
280 |
void ParseInputForSortOrderL(TDesC& aInput);
|
|
281 |
TInt GetFieldIdFromVpbkIdentifierL(TDesC& aIdentifierAsString);
|
|
282 |
|
|
283 |
private: // data
|
|
284 |
|
|
285 |
/*
|
|
286 |
* Array of cache data elements
|
|
287 |
*/
|
|
288 |
RPointerArray<cacheData> iInputCacheData;
|
|
289 |
|
|
290 |
/*
|
|
291 |
* Array of cache data elements of the expected results
|
|
292 |
*/
|
|
293 |
RPointerArray<cacheData> iResultData;
|
|
294 |
|
|
295 |
/*
|
|
296 |
* Array of expected result locations data
|
|
297 |
*/
|
|
298 |
RArray<TPsMatchLocation> iExpectedLocations;
|
|
299 |
|
|
300 |
/*
|
|
301 |
* Array of cache uris to be searched
|
|
302 |
*/
|
|
303 |
RPointerArray<TDesC> iCacheUris;
|
|
304 |
|
|
305 |
/*
|
|
306 |
* Keyboard mode
|
|
307 |
*/
|
|
308 |
HBufC* iKeyboardModeBuf;
|
|
309 |
|
|
310 |
/*
|
|
311 |
* The search query
|
|
312 |
*/
|
|
313 |
HBufC* iQueryBuf;
|
|
314 |
|
|
315 |
/*
|
|
316 |
* The contacts handler. Performs the operations related to virtual phone book
|
|
317 |
*/
|
|
318 |
CPcsTestContactsHandler * iContactHandler;
|
|
319 |
|
|
320 |
/*
|
|
321 |
* The client handler
|
|
322 |
*/
|
|
323 |
CPSRequestHandler* iPsClientHandler;
|
|
324 |
|
|
325 |
/*
|
|
326 |
* Flag indicating if the contacts have been created
|
|
327 |
*/
|
|
328 |
TBool iContactAlreadyCreated;
|
|
329 |
|
|
330 |
/*
|
|
331 |
* The list of display fields
|
|
332 |
*/
|
|
333 |
RArray<TInt> iDisplayFields;
|
|
334 |
|
|
335 |
/*
|
|
336 |
* The input search string
|
|
337 |
*/
|
|
338 |
HBufC* iInputSearchString;
|
|
339 |
|
|
340 |
/*
|
|
341 |
* The expected result string
|
|
342 |
*/
|
|
343 |
HBufC* iExpectedResultString;
|
|
344 |
|
|
345 |
/*
|
|
346 |
* The input boolean
|
|
347 |
*/
|
|
348 |
TBool iInputBoolean;
|
|
349 |
|
|
350 |
/*
|
|
351 |
* The input language id
|
|
352 |
*/
|
|
353 |
TLanguage iLangId;
|
|
354 |
|
|
355 |
/*
|
|
356 |
* Flag indicating if the language is supported
|
|
357 |
*/
|
|
358 |
TBool iIsLangSupported;
|
|
359 |
|
|
360 |
/*
|
|
361 |
* The group to be searched
|
|
362 |
*/
|
|
363 |
HBufC* iGroupToBeSearched;
|
|
364 |
|
|
365 |
/*
|
|
366 |
* The sort Type
|
|
367 |
*/
|
|
368 |
TSortType iSortType;
|
|
369 |
|
|
370 |
/*
|
|
371 |
* The sort order
|
|
372 |
*/
|
|
373 |
RArray<TInt> iSortOrder;
|
|
374 |
|
|
375 |
/*
|
|
376 |
* The max number of results
|
|
377 |
*/
|
|
378 |
TInt iMaxNumberOfResults;
|
|
379 |
|
|
380 |
};
|
|
381 |
|
|
382 |
#endif // TEST_SUITE_INPUT_DATA_H
|
|
383 |
|
|
384 |
// End of file
|