imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/inc/xmppsettingsfetchermt.h
changeset 51 61fad867f68e
equal deleted inserted replaced
-1:000000000000 51:61fad867f68e
       
     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 "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:  xmppsettingsfetchermt test module.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef XMPPSETTINGSFETCHERMT_H
       
    21 #define XMPPSETTINGSFETCHERMT_H
       
    22 
       
    23 // INCLUDES
       
    24 #include "StifTestModule.h"
       
    25 #include <StifLogger.h>
       
    26 #include "xmppparams.h"
       
    27 #include <xmppservicesettingsapi.h>
       
    28 
       
    29 // CONSTANTS
       
    30 //const ?type ?constant_var = ?constant;
       
    31 
       
    32 // MACROS
       
    33 //#define ?macro ?macro_def
       
    34 
       
    35 // Logging path
       
    36 _LIT( KxmppsettingsfetchermtLogPath, "\\logs\\testframework\\xmppsettingsfetchermt\\" ); 
       
    37 // Log file
       
    38 _LIT( KxmppsettingsfetchermtLogFile, "xmppsettingsfetchermt.txt" ); 
       
    39 _LIT( KxmppsettingsfetchermtLogFileWithTitle, "xmppsettingsfetchermt_[%S].txt" );
       
    40 
       
    41 #define GETPTR &
       
    42 #define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
       
    43 #define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
       
    44 #define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
       
    45 #define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
       
    46 
       
    47 // FUNCTION PROTOTYPES
       
    48 //?type ?function_name(?arg_list);
       
    49 
       
    50 // FORWARD DECLARATIONS
       
    51 //class ?FORWARD_CLASSNAME;
       
    52 class Cxmppsettingsfetchermt;
       
    53 class CXmppParameters;
       
    54 // DATA TYPES
       
    55 //enum ?declaration
       
    56 enum TTestCase
       
    57     {
       
    58     EPositiveTest,
       
    59     EDescriptorTest,
       
    60     EIntegerTest
       
    61     };
       
    62 //typedef ?declaration
       
    63 //extern ?data_type;
       
    64 // A typedef for function that does the actual testing,
       
    65 // function is a type 
       
    66 // TInt Cxmppsettingsfetchermt::<NameOfFunction> ( TTestResult& aResult )
       
    67 typedef TInt (Cxmppsettingsfetchermt::* TestFunction)(TTestResult&);
       
    68 
       
    69 // CLASS DECLARATION
       
    70 
       
    71 /**
       
    72 *  An internal structure containing a test case name and
       
    73 *  the pointer to function doing the test
       
    74 *
       
    75 *  @lib ?library
       
    76 *  @since ?Series60_version
       
    77 */
       
    78 class TCaseInfoInternal
       
    79     {
       
    80     public:
       
    81         const TText*    iCaseName;
       
    82         TestFunction    iMethod;
       
    83         TBool           iIsOOMTest;
       
    84         TInt            iFirstMemoryAllocation;
       
    85         TInt            iLastMemoryAllocation;
       
    86     };
       
    87 
       
    88 // CLASS DECLARATION
       
    89 
       
    90 /**
       
    91 *  A structure containing a test case name and
       
    92 *  the pointer to function doing the test
       
    93 *
       
    94 *  @lib ?library
       
    95 *  @since ?Series60_version
       
    96 */
       
    97 class TCaseInfo
       
    98     {
       
    99     public:
       
   100         TPtrC iCaseName;
       
   101         TestFunction iMethod;
       
   102         TBool           iIsOOMTest;
       
   103         TInt            iFirstMemoryAllocation;
       
   104         TInt            iLastMemoryAllocation;
       
   105 
       
   106     TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
       
   107         {
       
   108         };
       
   109 
       
   110     };
       
   111 
       
   112 
       
   113     _LIT( KTestcasePassed, "test case passed" );
       
   114     _LIT( KTestcaseFailed, "test case failed" );
       
   115     _LIT( KVerificationFailed, "Verification of data failed" );
       
   116 
       
   117 	//parameter values to set
       
   118 	const TInt port = 2020;
       
   119     const TBool httpsProxyPort = 19;
       
   120 	const TInt iapId = 3;
       
   121 	
       
   122 	_LIT( KXmppServerAddress , "Test.Server.com");
       
   123 	_LIT( KUsername , "user@server.com");
       
   124 	_LIT( KPassword , "password");
       
   125     
       
   126 // gabble specific things
       
   127 	_LIT( KResouceText , "resource");
       
   128 	_LIT( KHttpsProxyServerAddressText , "proxy.server.com");
       
   129 	_LIT( KAliasText , "alias");
       
   130 	_LIT( KConnMgrBus, "org.freedesktop.Telepathy.ConnectionManager.gabble" );
       
   131 	_LIT( KConnMgrPath, "/org/freedesktop/Telepathy/ConnectionManager/gabble" );
       
   132 	_LIT( KParamProtocol , "jabber" );
       
   133     const TBool oldSSL = ETrue;
       
   134     const TBool resigter = EFalse;
       
   135 
       
   136 // values for error cases
       
   137 	_LIT( KNullUsername , ""); //empty string
       
   138 	const TInt portNegative = -20;
       
   139 	const TInt iapIdZero = 0;
       
   140 
       
   141     
       
   142 
       
   143 // CLASS DECLARATION
       
   144 
       
   145 /**
       
   146 *  This a xmppsettingsfetchermt class.
       
   147 *  ?other_description_lines
       
   148 *
       
   149 *  @lib ?library
       
   150 *  @since ?Series60_version
       
   151 */
       
   152 NONSHARABLE_CLASS(Cxmppsettingsfetchermt) : public CTestModuleBase
       
   153     {
       
   154     public:  // Constructors and destructor
       
   155 
       
   156 
       
   157         /**
       
   158         * Two-phased constructor.
       
   159         */
       
   160         static Cxmppsettingsfetchermt* NewL();
       
   161 
       
   162         /**
       
   163         * Destructor.
       
   164         */
       
   165         virtual ~Cxmppsettingsfetchermt();
       
   166 
       
   167     public: // New functions
       
   168 
       
   169         /**
       
   170         * ?member_description.
       
   171         * @since ?Series60_version
       
   172         * @param ?arg1 ?description
       
   173         * @return ?description
       
   174         */
       
   175         //?type ?member_function( ?type ?arg1 );
       
   176 
       
   177     public: // Functions from base classes
       
   178 
       
   179         /**
       
   180         * From CTestModuleBase InitL is used to initialize the 
       
   181         *       xmppsettingsfetchermt. It is called once for every instance of 
       
   182         *       TestModulexmppsettingsfetchermt after its creation.
       
   183         * @since ?Series60_version
       
   184         * @param aIniFile Initialization file for the test module (optional)
       
   185         * @param aFirstTime Flag is true when InitL is executed for first 
       
   186         *               created instance of xmppsettingsfetchermt.
       
   187         * @return Symbian OS error code
       
   188         */
       
   189         TInt InitL( TFileName& aIniFile, TBool aFirstTime );
       
   190 
       
   191         /**
       
   192         * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
       
   193         *   from xmppsettingsfetchermt. 
       
   194         * @since ?Series60_version
       
   195         * @param aTestCaseFile Test case file (optional)
       
   196         * @param aTestCases  Array of TestCases returned to test framework
       
   197         * @return Symbian OS error code
       
   198         */
       
   199         TInt GetTestCasesL( const TFileName& aTestCaseFile, 
       
   200                             RPointerArray<TTestCaseInfo>& aTestCases );
       
   201 
       
   202         /**
       
   203         * From CTestModuleBase RunTestCaseL is used to run an individual 
       
   204         *   test case. 
       
   205         * @since ?Series60_version
       
   206         * @param aCaseNumber Test case number
       
   207         * @param aTestCaseFile Test case file (optional)
       
   208         * @param aResult Test case result returned to test framework (PASS/FAIL)
       
   209         * @return Symbian OS error code (test case execution error, which is 
       
   210         *           not reported in aResult parameter as test case failure).
       
   211         */   
       
   212         TInt RunTestCaseL( const TInt aCaseNumber, 
       
   213                            const TFileName& aTestCaseFile,
       
   214                            TTestResult& aResult );
       
   215 
       
   216         /**
       
   217         * From CTestModuleBase; OOMTestQueryL is used to specify is particular
       
   218         * test case going to be executed using OOM conditions
       
   219         * @param aTestCaseFile Test case file (optional)
       
   220         * @param aCaseNumber Test case number (optional)
       
   221         * @param aFailureType OOM failure type (optional)
       
   222         * @param aFirstMemFailure The first heap memory allocation failure value (optional)
       
   223         * @param aLastMemFailure The last heap memory allocation failure value (optional)
       
   224         * @return TBool
       
   225         */
       
   226         virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
       
   227                                      const TInt /* aCaseNumber */, 
       
   228                                      TOOMFailureType& aFailureType, 
       
   229                                      TInt& /* aFirstMemFailure */, 
       
   230                                      TInt& /* aLastMemFailure */ );
       
   231 
       
   232         /**
       
   233         * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM
       
   234         * test environment
       
   235         * @param aTestCaseFile Test case file (optional)
       
   236         * @param aCaseNumber Test case number (optional)
       
   237         * @return None
       
   238         */
       
   239         virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
       
   240                                     const TInt /* aCaseNumber */ ); 
       
   241 
       
   242         /**
       
   243         * From CTestModuleBase; OOMHandleWarningL
       
   244         * @param aTestCaseFile Test case file (optional)
       
   245         * @param aCaseNumber Test case number (optional)
       
   246         * @param aFailNextValue FailNextValue for OOM test execution (optional)
       
   247         * @return None
       
   248         *
       
   249         * User may add implementation for OOM test warning handling. Usually no
       
   250         * implementation is required.           
       
   251         */
       
   252         virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
       
   253                                         const TInt /* aCaseNumber */, 
       
   254                                         TInt& /* aFailNextValue */); 
       
   255 
       
   256         /**
       
   257         * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
       
   258         * test environment
       
   259         * @param aTestCaseFile Test case file (optional)
       
   260         * @param aCaseNumber Test case number (optional)
       
   261         * @return None
       
   262         *
       
   263         */
       
   264         virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
       
   265                                        const TInt /* aCaseNumber */ );
       
   266 
       
   267     protected:  // New functions
       
   268 
       
   269         /**
       
   270         * ?member_description.
       
   271         * @since ?Series60_version
       
   272         * @param ?arg1 ?description
       
   273         * @return ?description
       
   274         */
       
   275         //?type ?member_function( ?type ?arg1 );
       
   276 
       
   277     protected:  // Functions from base classes
       
   278 
       
   279         /**
       
   280         * From ?base_class ?member_description
       
   281         */
       
   282         //?type ?member_function();
       
   283 
       
   284     private:
       
   285 
       
   286         /**
       
   287         * C++ default constructor.
       
   288         */
       
   289         Cxmppsettingsfetchermt();
       
   290 
       
   291         /**
       
   292         * By default Symbian 2nd phase constructor is private.
       
   293         */
       
   294         void ConstructL();
       
   295 
       
   296         // Prohibit copy constructor if not deriving from CBase.
       
   297         // ?classname( const ?classname& );
       
   298         // Prohibit assigment operator if not deriving from CBase.
       
   299         // ?classname& operator=( const ?classname& );
       
   300 
       
   301         /**
       
   302         * Function returning test case name and pointer to test case function.
       
   303         * @since ?Series60_version
       
   304         * @param aCaseNumber test case number
       
   305         * @return TCaseInfo 
       
   306         */
       
   307         const TCaseInfo Case ( const TInt aCaseNumber ) const;
       
   308 
       
   309         /**
       
   310         * [test case declarations] - do not remove
       
   311         */
       
   312         //ADD NEW METHOD DEC HERE"
       
   313 
       
   314         /**
       
   315         * Positive test case.
       
   316         * @since ?Series60_version
       
   317         * @param aResult Test case result (PASS/FAIL)
       
   318         * @return Symbian OS error code (test case execution error 
       
   319         *   that is not returned as test case result in aResult)
       
   320         */
       
   321         TInt SetAndReadSettingsL( TTestResult& aResult );
       
   322         TInt ReadUnexistingSettingsL( TTestResult& aResult );
       
   323         TInt ReadIncompleteSettingsL( TTestResult& aResult );
       
   324         TInt ReadDescSettingsL( TTestResult& aResult );
       
   325         TInt ReadIntSettingsL( TTestResult& aResult );
       
   326 
       
   327 		void WriteSettingsL( CXmppSettingsApi* aApi, TUint32 aSettingId, TTestCase aTestCase );
       
   328 		TBool VerifySettingsL( CXmppParameters* aXmppParams, TUint32 settingId, TTestCase aTestCase );
       
   329 		void WriteIncompleteSettingsL( CXmppSettingsApi* aApi, TUint32 aSettingId );
       
   330 
       
   331     public:     // Data
       
   332         // ?one_line_short_description_of_data
       
   333         //?data_declaration;
       
   334 
       
   335     protected:  // Data
       
   336         // ?one_line_short_description_of_data
       
   337         //?data_declaration;
       
   338 
       
   339     private:    // Data
       
   340         // Pointer to test (function) to be executed
       
   341         TestFunction iMethod;
       
   342 
       
   343         // Pointer to logger
       
   344         CStifLogger * iLog; 
       
   345 
       
   346         // Normal logger
       
   347         CStifLogger* iStdLog;
       
   348 
       
   349         // Test case logger
       
   350         CStifLogger* iTCLog;
       
   351 
       
   352         // Flag saying if test case title should be added to log file name
       
   353         TBool iAddTestCaseTitleToLogName;
       
   354 
       
   355         // ?one_line_short_description_of_data
       
   356         //?data_declaration;
       
   357 
       
   358         // Reserved pointer for future extension
       
   359         //TAny* iReserved;
       
   360 
       
   361     public:     // Friend classes
       
   362         //?friend_class_declaration;
       
   363     protected:  // Friend classes
       
   364         //?friend_class_declaration;
       
   365     private:    // Friend classes
       
   366         //?friend_class_declaration;
       
   367 
       
   368     };
       
   369 
       
   370 #endif      // XMPPSETTINGSFETCHERMT_H
       
   371 
       
   372 // End of File