landmarks/locationlandmarks/tsrc/LandmarkURL/inc/CUTLandmarkURL.h
branchRCL_3
changeset 44 2b4ea9893b66
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 * 
       
    14 * Description: STIF testclass declaration
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CUTLANDMARKURL_H
       
    19 #define CUTLANDMARKURL_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <StifLogger.h>
       
    23 #include <TestScripterInternal.h>
       
    24 #include <StifTestModule.h>
       
    25 #include <TestclassAssert.h>
       
    26 
       
    27 #include <EPos_CPosLandmark.h>
       
    28 #include <EPos_CPosLandmarkEncoder.h>
       
    29 #include <EPos_CPosLandmarkParser.h>
       
    30 #include <EPos_CPosLandmarkDatabase.h>
       
    31 
       
    32 
       
    33 // CONSTANTS
       
    34 //const ?type ?constant_var = ?constant;
       
    35 const TInt KMaxTestBuf= 10240;
       
    36 const TInt KMaxTagName= 24;
       
    37 const TInt CREATE_PARSER = 0;
       
    38 const TInt CREATE_ENCODER =1;
       
    39 const TInt MULTIPLE_ENCODER =2;
       
    40 const TInt MULTIPLE_PARSER =3;
       
    41 const TInt BUFFER_OUTPUT =0;
       
    42 const TInt FILE_OUTPUT =1;
       
    43 const TInt NO_ENCODING_FILE =2;
       
    44 const TInt NO_ENCODING_BUFFER =3;
       
    45 const TInt ERROR_VERIFICATION_OPFILE =1;
       
    46 const TInt PANIC_CODE_VERIIFCATION =1;
       
    47 const TInt TEST_NULL_NAME = 1;
       
    48 const TInt TEST_NULL_STREET = 2;
       
    49 const TInt TEST_NULL_HNO = 3;
       
    50 const TInt TEST_NULL_POSTALCODE = 4;
       
    51 const TInt TEST_NULL_CITY = 5;
       
    52 const TInt TEST_NULL_STATE = 6;
       
    53 const TInt TEST_NULL_COUNTRY = 7;
       
    54 const TInt TEST_NULL_TELEPHONE = 8;
       
    55 const TInt TEST_NULL_WEB = 9;
       
    56 const TInt TEST_NULL_DESCRIPTION = 10;
       
    57 const TInt TEST_NULL_SPEED = 41;
       
    58 const TInt TEST_NULL_HEADING = 42;
       
    59 const TInt TEST_NULL_PID = 43;
       
    60 const TInt TEST_MAXLENGTH_NAME = 11;
       
    61 const TInt TEST_MAXLENGTH1_NAME = 12;
       
    62 const TInt TEST_MAXLENGTH2_NAME = 13;
       
    63 const TInt TEST_MAXLENGTH_STREET = 14;
       
    64 const TInt TEST_MAXLENGTH1_STREET = 15;
       
    65 const TInt TEST_MAXLENGTH2_STREET = 16;
       
    66 const TInt TEST_MAXLENGTH_HNO = 17;
       
    67 const TInt TEST_MAXLENGTH1_HNO = 18;
       
    68 const TInt TEST_MAXLENGTH2_HNO = 19;
       
    69 const TInt TEST_MAXLENGTH_POSTALCODE = 20;
       
    70 const TInt TEST_MAXLENGTH1_POSTALCODE = 21;
       
    71 const TInt TEST_MAXLENGTH2_POSTALCODE = 22;
       
    72 const TInt TEST_MAXLENGTH_CITY = 23;
       
    73 const TInt TEST_MAXLENGTH1_CITY = 24;
       
    74 const TInt TEST_MAXLENGTH2_CITY = 25;
       
    75 const TInt TEST_MAXLENGTH_STATE = 26;
       
    76 const TInt TEST_MAXLENGTH1_STATE = 27;
       
    77 const TInt TEST_MAXLENGTH2_STATE = 28;
       
    78 const TInt TEST_MAXLENGTH_COUNTRY = 29;
       
    79 const TInt TEST_MAXLENGTH1_COUNTRY = 30;
       
    80 const TInt TEST_MAXLENGTH2_COUNTRY = 31;
       
    81 const TInt TEST_MAXLENGTH_TELEPHONE = 32;
       
    82 const TInt TEST_MAXLENGTH1_TELEPHONE = 33;
       
    83 const TInt TEST_MAXLENGTH2_TELEPHONE = 34;
       
    84 const TInt TEST_MAXLENGTH_WEB = 35;
       
    85 const TInt TEST_MAXLENGTH1_WEB = 36;
       
    86 const TInt TEST_MAXLENGTH2_WEB = 37;
       
    87 const TInt TEST_MAXLENGTH_DESCRIPTION = 38;
       
    88 const TInt TEST_MAXLENGTH1_DESCRIPTION = 39;
       
    89 const TInt TEST_MAXLENGTH2_DESCRIPTION = 40;
       
    90 const TInt TEST_MAXLENGTH_PID = 44;
       
    91 const TInt TEST_MAXLENGTH1_PID = 45;
       
    92 const TInt TEST_MAXLENGTH2_PID = 46;
       
    93 const TInt TEST_MAX_HA = 47;
       
    94 const TInt TEST_MAX_VA = 48;
       
    95 
       
    96 //constants for testing the Parser
       
    97 const TInt NOPROTOCOL= 1;
       
    98 const TInt HTTPS= 2;
       
    99 const TInt INVALIDPROTOCOL= 3;
       
   100 const TInt NOHOSTNAME= 4;
       
   101 const TInt INVALIDHOSTNAME= 5;
       
   102 const TInt INVALIDHOSTNAME1= 6;
       
   103 const TInt INVALIDHOSTNAME2= 7;
       
   104 const TInt DESC_BV1= 8;
       
   105 const TInt DESC_BV2= 9;
       
   106 const TInt DESC_BV3= 10;
       
   107 const TInt UNKNOWNFORMAT= 2;
       
   108 const TInt NOLANDMARK= 2;
       
   109 const TInt NULLCAT= 1;
       
   110 const TInt DELETEFILE= 1;
       
   111 const TInt KRead= 0;
       
   112 const TInt KReadWrite= 1;
       
   113 const TUint KColumnSeperator='&';
       
   114 
       
   115 
       
   116 
       
   117 
       
   118 // MACROS
       
   119 //#define ?macro ?macro_def
       
   120 #define TEST_CLASS_VERSION_MAJOR 0
       
   121 #define TEST_CLASS_VERSION_MINOR 0
       
   122 #define TEST_CLASS_VERSION_BUILD 0
       
   123 
       
   124 // Logging path
       
   125 _LIT( KCUTLandmarkURLLogPath, "\\logs\\testframework\\CUTLandmarkURL\\" ); 
       
   126 // Log file
       
   127 _LIT( KCUTLandmarkURLLogFile, "CUTLandmarkURL.txt" ); 
       
   128 _LIT( KCUTLandmarkURLLogFileWithTitle, "CUTLandmarkURL_[%S].txt" );
       
   129 
       
   130 // FUNCTION PROTOTYPES
       
   131 //?type ?function_name(?arg_list);
       
   132 
       
   133 // FORWARD DECLARATIONS
       
   134 //class ?FORWARD_CLASSNAME;
       
   135 class CCUTLandmarkURL;
       
   136 
       
   137 // DATA TYPES
       
   138 //enum ?declaration
       
   139 //typedef ?declaration
       
   140 //extern ?data_type;
       
   141 
       
   142 // CLASS DECLARATION
       
   143 
       
   144 /**
       
   145 *  CCUTLandmarkURL test class for STIF Test Framework TestScripter.
       
   146 *  ?other_description_lines
       
   147 *
       
   148 *  @lib ?library
       
   149 *  @since ?Series60_version
       
   150 */
       
   151 NONSHARABLE_CLASS(CCUTLandmarkURL) : public CScriptBase
       
   152     {
       
   153     public:  // Constructors and destructor
       
   154 
       
   155         /**
       
   156         * Two-phased constructor.
       
   157         */
       
   158         static CCUTLandmarkURL* NewL( CTestModuleIf& aTestModuleIf );
       
   159 
       
   160         /**
       
   161         * Destructor.
       
   162         */
       
   163         virtual ~CCUTLandmarkURL();
       
   164 
       
   165     public: // New functions
       
   166 
       
   167         /**
       
   168         * ?member_description.
       
   169         * @since ?Series60_version
       
   170         * @param ?arg1 ?description
       
   171         * @return ?description
       
   172         */
       
   173         //?type ?member_function( ?type ?arg1 );
       
   174 
       
   175     public: // Functions from base classes
       
   176 
       
   177         /**
       
   178         * From CScriptBase Runs a script line.
       
   179         * @since ?Series60_version
       
   180         * @param aItem Script line containing method name and parameters
       
   181         * @return Symbian OS error code
       
   182         */
       
   183         virtual TInt RunMethodL( CStifItemParser& aItem );
       
   184 
       
   185     protected:  // New functions
       
   186 
       
   187         /**
       
   188         * ?member_description.
       
   189         * @since ?Series60_version
       
   190         * @param ?arg1 ?description
       
   191         * @return ?description
       
   192         */
       
   193         //?type ?member_function( ?type ?arg1 );
       
   194 
       
   195     protected:  // Functions from base classes
       
   196 
       
   197         /**
       
   198         * From ?base_class ?member_description
       
   199         */
       
   200         //?type ?member_function();
       
   201 
       
   202     private:
       
   203 
       
   204         /**
       
   205         * C++ default constructor.
       
   206         */
       
   207         CCUTLandmarkURL( CTestModuleIf& aTestModuleIf );
       
   208 
       
   209         /**
       
   210         * By default Symbian 2nd phase constructor is private.
       
   211         */
       
   212         void ConstructL();
       
   213 
       
   214         // Prohibit copy constructor if not deriving from CBase.
       
   215         // ?classname( const ?classname& );
       
   216         // Prohibit assigment operator if not deriving from CBase.
       
   217         // ?classname& operator=( const ?classname& );
       
   218 
       
   219         /**
       
   220         * Frees all resources allocated from test methods.
       
   221         * @since ?Series60_version
       
   222         */
       
   223         void Delete();
       
   224 
       
   225         /**
       
   226         * Test methods are listed below. 
       
   227         */
       
   228 
       
   229         /**
       
   230         * Example test method.
       
   231         * @since ?Series60_version
       
   232         * @param aItem Script line containing parameters.
       
   233         * @return Symbian OS error code.
       
   234         */
       
   235        
       
   236         TInt CreateInstanceL(CStifItemParser& aItem);
       
   237         TInt CleanUp (CStifItemParser& aItem);
       
   238         TInt CreateLandmarkL (CStifItemParser& aItem); 
       
   239         
       
   240         //Test methods for parser        
       
   241         TInt SetInputBufferL(CStifItemParser& aItem);
       
   242         TInt SetInputFile(CStifItemParser& aItem);
       
   243         TInt SetInputFileHandleL(CStifItemParser& aItem);
       
   244         TInt ParseContent(CStifItemParser& aItem);
       
   245         TInt NumOfParsedLandmarksL(CStifItemParser& aItem);
       
   246         TInt LandmarkL(CStifItemParser& aItem);
       
   247         TInt LandmarkCategoryL(CStifItemParser& aItem);
       
   248         void MiscL(CStifItemParser& aItem);
       
   249 
       
   250         
       
   251         //Test methods for encoder        
       
   252         TInt SetOutputFileHandle (CStifItemParser& aItem);
       
   253         TInt SetOutputBuffer (CStifItemParser& aItem);
       
   254         TInt AddLandmark (CStifItemParser& aItem);
       
   255         TInt AddCategoryForLatestLandmarkL (CStifItemParser& aItem);
       
   256         TInt FinalizeEncoding (CStifItemParser& aItem);
       
   257         TInt VerifyEncodingL (CStifItemParser& aItem);
       
   258 
       
   259         //Helper methods
       
   260         void VerifyParsingL(CStifItemParser& aItem, CPosLandmark* aPosLandmark);
       
   261         TInt ParseURL(const TDesC8 & aDelimiter, TPtr8 aBufferedURL, CStifItemParser& aItem);
       
   262         TInt ParseValueL(TPtr8 aBufferedURL, CStifItemParser& aItem);
       
   263         TInt CompareParamValueL(TBuf8<KMaxTagName> aTagName , TPtrC8 aValue, CStifItemParser& aItem);
       
   264         TInt GetStringTillQuote(CStifItemParser& aItem, TName& aName);
       
   265         TInt GetStringAfterTag(CStifItemParser& aItem, const TDesC& aTag, TName& aString);
       
   266 
       
   267 
       
   268         /**
       
   269          * Method used to log version of test class
       
   270          */
       
   271         void SendTestClassVersion();
       
   272 
       
   273         //ADD NEW METHOD DEC HERE
       
   274         //[TestMethods] - Do not remove
       
   275 
       
   276     public:     // Data
       
   277         // ?one_line_short_description_of_data
       
   278         //?data_declaration;
       
   279 
       
   280     protected:  // Data
       
   281         // ?one_line_short_description_of_data
       
   282         //?data_declaration;
       
   283 
       
   284     private:    // Data
       
   285     	
       
   286     	CPosLandmarkParser *iPosLandmarkParser;
       
   287     	CPosLandmarkEncoder *iPosLandmarkEncoder;
       
   288     	CPosLandmark *iPosLandmark;
       
   289         CPosLmOperation*    iOperation;
       
   290         CBufBase* iEncoderBuffer;
       
   291         HBufC8 * iParsedURL ;
       
   292         HBufC8 * iRemainingURL ;
       
   293         CPosLandmarkDatabase*   iDatabase;
       
   294         RFs iFileSession;
       
   295         RFile iFile;
       
   296 
       
   297         // These data types stores the values from the cfg files
       
   298         TPtrC iVerticalAccuracy;
       
   299         TPtrC iHorizontalAccuracy;
       
   300         TName iName;
       
   301         TName iDescription;
       
   302         TPtrC iLatitude;
       
   303         TPtrC iLongitude;
       
   304         TPtrC iAltitude;
       
   305         TPtrC iCategory;
       
   306         TName iMatchCategory;
       
   307         TName iMatchCategory2;
       
   308         TName iTS;
       
   309         TName  iPID;
       
   310         TPtrC  iYear;
       
   311         TPtrC  iMonth;
       
   312         TPtrC  iDay;
       
   313         TPtrC  iHour;
       
   314         TPtrC  iMinutes;
       
   315         TPtrC  iSeconds;
       
   316         TPtrC  iMSeconds;
       
   317         TPtrC iSpeed;
       
   318         TName iTelephone;
       
   319         TName iWeb;
       
   320         TPtrC iHeading;
       
   321         TName iCountry;
       
   322         TName iState;
       
   323         TName iCity;
       
   324         TName iStreet;
       
   325         TName iHouseNumber;
       
   326         TName iPostalCode;
       
   327         
       
   328         TInt iCount;
       
   329 
       
   330 
       
   331         // ?one_line_short_description_of_data
       
   332         //?data_declaration;
       
   333 
       
   334         // Reserved pointer for future extension
       
   335         //TAny* iReserved;
       
   336 
       
   337     public:     // Friend classes
       
   338         //?friend_class_declaration;
       
   339     protected:  // Friend classes
       
   340         //?friend_class_declaration;
       
   341     private:    // Friend classes
       
   342         //?friend_class_declaration;
       
   343 
       
   344     };
       
   345 
       
   346 #endif      // CUTLANDMARKURL_H
       
   347 
       
   348 // End of File