websrv_pub/web_service_manager_api/tsrc/senservicemanager/inc/senservicemanagerbctest.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:          SenServiceManager_stif test module.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 #ifndef SENSERVICEMANAGERBCTEST_H
       
    27 #define SENSERVICEMANAGERBCTEST_H
       
    28 
       
    29 // INCLUDES
       
    30 #include "StifTestModule.h"
       
    31 #include <StifLogger.h>
       
    32 
       
    33 
       
    34 #include <SenServiceManager.h>
       
    35 #include <SenIdentityProvider.h>
       
    36 #include <SenXmlServiceDescription.h>
       
    37 #include <SenServiceConnection.h>
       
    38 #include <f32file.h>
       
    39 
       
    40 
       
    41 //  INTERNAL INCLUDES
       
    42 namespace{
       
    43     _LIT16(KSessionsFile,"c:\\private\\101f96f4\\SenSessions.xml");
       
    44     _LIT16(KIdentitiesFile,"c:\\private\\101f96f4\\senidentities.xml");
       
    45     _LIT8(KText,"text");
       
    46     _LIT8(KText2,"text2");
       
    47 }
       
    48 
       
    49 // CONSTANTS
       
    50 //const ?type ?constant_var = ?constant;
       
    51 
       
    52 // MACROS
       
    53 //#define ?macro ?macro_def
       
    54 
       
    55 // Logging path
       
    56 _LIT( KSenServiceManager_stifLogPath, "\\logs\\testframework\\SenServiceManager_stif\\" ); 
       
    57 // Log file
       
    58 _LIT( KSenServiceManager_stifLogFile, "SenServiceManager_stif.txt" ); 
       
    59 
       
    60 
       
    61 #define GETPTR &
       
    62 #define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
       
    63 #define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
       
    64 #define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
       
    65 #define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
       
    66 
       
    67 // FUNCTION PROTOTYPES
       
    68 //?type ?function_name(?arg_list);
       
    69 
       
    70 // FORWARD DECLARATIONS
       
    71 //class ?FORWARD_CLASSNAME;
       
    72 class CSenServiceManagerBCTest;
       
    73 
       
    74 // DATA TYPES
       
    75 //enum ?declaration
       
    76 //typedef ?declaration
       
    77 //extern ?data_type;
       
    78 // A typedef for function that does the actual testing,
       
    79 // function is a type 
       
    80 // TInt CSenServiceManagerBCTest::<NameOfFunction> ( TTestResult& aResult )
       
    81 typedef TInt (CSenServiceManagerBCTest::* TestFunction)(TTestResult&);
       
    82 
       
    83 // CLASS DECLARATION
       
    84 
       
    85 /**
       
    86 *  An internal structure containing a test case name and
       
    87 *  the pointer to function doing the test
       
    88 *
       
    89 *  @lib ?library
       
    90 *  @since ?Series60_version
       
    91 */
       
    92 class TCaseInfoInternal
       
    93     {
       
    94     public:
       
    95         const TText*    iCaseName;
       
    96         TestFunction    iMethod;
       
    97         TBool           iIsOOMTest;
       
    98         TInt            iFirstMemoryAllocation;
       
    99         TInt            iLastMemoryAllocation;
       
   100     };
       
   101 
       
   102 // CLASS DECLARATION
       
   103 
       
   104 /**
       
   105 *  A structure containing a test case name and
       
   106 *  the pointer to function doing the test
       
   107 *
       
   108 *  @lib ?library
       
   109 *  @since ?Series60_version
       
   110 */
       
   111 class TCaseInfo
       
   112     {
       
   113     public:
       
   114         TPtrC iCaseName;
       
   115         TestFunction iMethod;
       
   116         TBool           iIsOOMTest;
       
   117         TInt            iFirstMemoryAllocation;
       
   118         TInt            iLastMemoryAllocation;
       
   119 
       
   120     TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
       
   121         {
       
   122         };
       
   123 
       
   124     };
       
   125 
       
   126 
       
   127 // CLASS DECLARATION
       
   128 
       
   129 /**
       
   130 *  This a SenServiceManager_stif class.
       
   131 *  ?other_description_lines
       
   132 *
       
   133 *  @lib ?library
       
   134 *  @since ?Series60_version
       
   135 */
       
   136 NONSHARABLE_CLASS(CSenServiceManagerBCTest) : public CTestModuleBase
       
   137     {
       
   138     public:  // Constructors and destructor
       
   139 
       
   140         /**
       
   141         * Two-phased constructor.
       
   142         */
       
   143         static CSenServiceManagerBCTest* NewL();
       
   144 
       
   145         /**
       
   146         * Destructor.
       
   147         */
       
   148         virtual ~CSenServiceManagerBCTest();
       
   149 
       
   150     public: // New functions
       
   151 
       
   152         /**
       
   153         * ?member_description.
       
   154         * @since ?Series60_version
       
   155         * @param ?arg1 ?description
       
   156         * @return ?description
       
   157         */
       
   158         //?type ?member_function( ?type ?arg1 );
       
   159 
       
   160     public: // Functions from base classes
       
   161 
       
   162         /**
       
   163         * From CTestModuleBase InitL is used to initialize the 
       
   164         *       SenServiceManager_stif. It is called once for every instance of 
       
   165         *       TestModuleSenServiceManager_stif after its creation.
       
   166         * @since ?Series60_version
       
   167         * @param aIniFile Initialization file for the test module (optional)
       
   168         * @param aFirstTime Flag is true when InitL is executed for first 
       
   169         *               created instance of SenServiceManager_stif.
       
   170         * @return Symbian OS error code
       
   171         */
       
   172         TInt InitL( TFileName& aIniFile, TBool aFirstTime );
       
   173 
       
   174         /**
       
   175         * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
       
   176         *   from SenServiceManager_stif. 
       
   177         * @since ?Series60_version
       
   178         * @param aTestCaseFile Test case file (optional)
       
   179         * @param aTestCases  Array of TestCases returned to test framework
       
   180         * @return Symbian OS error code
       
   181         */
       
   182         TInt GetTestCasesL( const TFileName& aTestCaseFile, 
       
   183                             RPointerArray<TTestCaseInfo>& aTestCases );
       
   184 
       
   185         /**
       
   186         * From CTestModuleBase RunTestCaseL is used to run an individual 
       
   187         *   test case. 
       
   188         * @since ?Series60_version
       
   189         * @param aCaseNumber Test case number
       
   190         * @param aTestCaseFile Test case file (optional)
       
   191         * @param aResult Test case result returned to test framework (PASS/FAIL)
       
   192         * @return Symbian OS error code (test case execution error, which is 
       
   193         *           not reported in aResult parameter as test case failure).
       
   194         */   
       
   195         TInt RunTestCaseL( const TInt aCaseNumber, 
       
   196                            const TFileName& aTestCaseFile,
       
   197                            TTestResult& aResult );
       
   198 
       
   199         /**
       
   200         * From CTestModuleBase; OOMTestQueryL is used to specify is particular
       
   201         * test case going to be executed using OOM conditions
       
   202         * @param aTestCaseFile Test case file (optional)
       
   203         * @param aCaseNumber Test case number (optional)
       
   204         * @param aFailureType OOM failure type (optional)
       
   205         * @param aFirstMemFailure The first heap memory allocation failure value (optional)
       
   206         * @param aLastMemFailure The last heap memory allocation failure value (optional)
       
   207         * @return TBool
       
   208         */
       
   209         virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
       
   210                                      const TInt /* aCaseNumber */, 
       
   211                                      TOOMFailureType& aFailureType, 
       
   212                                      TInt& /* aFirstMemFailure */, 
       
   213                                      TInt& /* aLastMemFailure */ );
       
   214 
       
   215         /**
       
   216         * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM
       
   217         * test environment
       
   218         * @param aTestCaseFile Test case file (optional)
       
   219         * @param aCaseNumber Test case number (optional)
       
   220         * @return None
       
   221         */
       
   222         virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
       
   223                                     const TInt /* aCaseNumber */ ); 
       
   224 
       
   225         /**
       
   226         * From CTestModuleBase; OOMHandleWarningL
       
   227         * @param aTestCaseFile Test case file (optional)
       
   228         * @param aCaseNumber Test case number (optional)
       
   229         * @param aFailNextValue FailNextValue for OOM test execution (optional)
       
   230         * @return None
       
   231         *
       
   232         * User may add implementation for OOM test warning handling. Usually no
       
   233         * implementation is required.           
       
   234         */
       
   235         virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
       
   236                                         const TInt /* aCaseNumber */, 
       
   237                                         TInt& /* aFailNextValue */); 
       
   238 
       
   239         /**
       
   240         * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
       
   241         * test environment
       
   242         * @param aTestCaseFile Test case file (optional)
       
   243         * @param aCaseNumber Test case number (optional)
       
   244         * @return None
       
   245         *
       
   246         */
       
   247         virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
       
   248                                        const TInt /* aCaseNumber */ );
       
   249 
       
   250     protected:  // New functions
       
   251 
       
   252         /**
       
   253         * ?member_description.
       
   254         * @since ?Series60_version
       
   255         * @param ?arg1 ?description
       
   256         * @return ?description
       
   257         */
       
   258         //?type ?member_function( ?type ?arg1 );
       
   259 
       
   260     protected:  // Functions from base classes
       
   261 
       
   262         /**
       
   263         * From ?base_class ?member_description
       
   264         */
       
   265         //?type ?member_function();
       
   266 
       
   267     private:
       
   268 
       
   269         /**
       
   270         * C++ default constructor.
       
   271         */
       
   272         CSenServiceManagerBCTest();
       
   273 
       
   274         /**
       
   275         * By default Symbian 2nd phase constructor is private.
       
   276         */
       
   277         void ConstructL();
       
   278 
       
   279         // Prohibit copy constructor if not deriving from CBase.
       
   280         // ?classname( const ?classname& );
       
   281         // Prohibit assigment operator if not deriving from CBase.
       
   282         // ?classname& operator=( const ?classname& );
       
   283 
       
   284         /**
       
   285         * Function returning test case name and pointer to test case function.
       
   286         * @since ?Series60_version
       
   287         * @param aCaseNumber test case number
       
   288         * @return TCaseInfo 
       
   289         */
       
   290         const TCaseInfo Case ( const TInt aCaseNumber ) const;
       
   291 
       
   292 
       
   293     private:    // methods
       
   294     			
       
   295          void Empty();
       
   296 
       
   297          void SetupL();
       
   298         
       
   299          void Teardown();
       
   300          void DeleteDBL();
       
   301          
       
   302          
       
   303          TInt UT_CSenServiceManager_NewLL(TTestResult& aResult);
       
   304         
       
   305          TInt UT_CSenServiceManager_NewLCL(TTestResult& aResult);
       
   306         
       
   307         	  
       
   308          TInt UT_CSenServiceManager_ServiceDescriptionsLL_normalL(TTestResult& aResult);
       
   309          TInt UT_CSenServiceManager_ServiceDescriptionsLL_notFoundL(TTestResult& aResult);
       
   310          TInt UT_CSenServiceManager_ServiceDescriptionsLL_badDescriptorL(TTestResult& aResult);
       
   311          TInt UT_CSenServiceManager_ServiceDescriptionsLL_nullL(TTestResult& aResult);
       
   312          TInt UT_CSenServiceManager_ServiceDescriptionsLL_randomPtrL(TTestResult& aResult);
       
   313         
       
   314          TInt UT_CSenServiceManager_ServiceDescriptionsL_1L_normalL(TTestResult& aResult);
       
   315          TInt UT_CSenServiceManager_ServiceDescriptionsL_1L_notFoundL(TTestResult& aResult);
       
   316          TInt UT_CSenServiceManager_ServiceDescriptionsL_1L_badDescriptorL(TTestResult& aResult);
       
   317          TInt UT_CSenServiceManager_ServiceDescriptionsL_1L_XMLpatternL(TTestResult& aResult);
       
   318          
       
   319          TInt UT_CSenServiceManager_RegisterServiceDescriptionLL_normalL(TTestResult& aResult);
       
   320          TInt UT_CSenServiceManager_RegisterServiceDescriptionLL_badDescriptorL(TTestResult& aResult);
       
   321          TInt UT_CSenServiceManager_RegisterServiceDescriptionLL_noEndpointL(TTestResult& aResult);
       
   322          TInt UT_CSenServiceManager_RegisterServiceDescriptionLL_noContractL(TTestResult& aResult);
       
   323          TInt UT_CSenServiceManager_RegisterServiceDescriptionLL_badFrameworkL(TTestResult& aResult);
       
   324          TInt UT_CSenServiceManager_RegisterServiceDescriptionLL_randomPtrL(TTestResult& aResult);
       
   325          TInt UT_CSenServiceManager_RegisterServiceDescriptionLL_nullL(TTestResult& aResult);
       
   326          
       
   327          TInt UT_CSenServiceManager_UnregisterServiceDescriptionLL_normalL(TTestResult& aResult);
       
   328          TInt UT_CSenServiceManager_UnregisterServiceDescriptionLL_badDescriptorL(TTestResult& aResult);
       
   329          TInt UT_CSenServiceManager_UnregisterServiceDescriptionLL_noEndpointL(TTestResult& aResult);
       
   330          TInt UT_CSenServiceManager_UnregisterServiceDescriptionLL_noContractL(TTestResult& aResult);
       
   331          TInt UT_CSenServiceManager_UnregisterServiceDescriptionLL_badFrameworkL(TTestResult& aResult);
       
   332          TInt UT_CSenServiceManager_UnregisterServiceDescriptionLL_randomPtrL(TTestResult& aResult);
       
   333          TInt UT_CSenServiceManager_UnregisterServiceDescriptionLL_nullL(TTestResult& aResult);
       
   334         
       
   335         
       
   336          TInt UT_CSenServiceManager_RegisterIdentityProviderLL_normalL(TTestResult& aResult);
       
   337          TInt UT_CSenServiceManager_RegisterIdentityProviderLL_badDescriptorL(TTestResult& aResult);
       
   338          TInt UT_CSenServiceManager_RegisterIdentityProviderLL_notReadyL(TTestResult& aResult);
       
   339          TInt UT_CSenServiceManager_RegisterIdentityProviderLL_providerIDInUseL(TTestResult& aResult);
       
   340          TInt UT_CSenServiceManager_RegisterIdentityProviderLL_nullL(TTestResult& aResult);
       
   341          TInt UT_CSenServiceManager_RegisterIdentityProviderLL_randomPtrL(TTestResult& aResult);
       
   342 
       
   343         
       
   344          TInt UT_CSenServiceManager_UnregisterIdentityProviderLL_normalL(TTestResult& aResult);
       
   345          TInt UT_CSenServiceManager_UnregisterIdentityProviderLL_badDescriptorL(TTestResult& aResult);
       
   346          TInt UT_CSenServiceManager_UnregisterIdentityProviderLL_notFoundL(TTestResult& aResult);
       
   347          TInt UT_CSenServiceManager_UnregisterIdentityProviderLL_notReadyL(TTestResult& aResult);
       
   348          TInt UT_CSenServiceManager_UnregisterIdentityProviderLL_nullL(TTestResult& aResult);
       
   349          TInt UT_CSenServiceManager_UnregisterIdentityProviderLL_randomPtrL(TTestResult& aResult);
       
   350         
       
   351         
       
   352          TInt UT_CSenServiceManager_AssociateServiceLL_normalL(TTestResult& aResult);
       
   353          TInt UT_CSenServiceManager_AssociateServiceLL_argumentL(TTestResult& aResult);
       
   354          TInt UT_CSenServiceManager_AssociateServiceLL_notReadyL(TTestResult& aResult);
       
   355          TInt UT_CSenServiceManager_AssociateServiceLL_notFoundL(TTestResult& aResult);
       
   356         
       
   357         
       
   358          TInt UT_CSenServiceManager_DissociateServiceLL_normalL(TTestResult& aResult);
       
   359          TInt UT_CSenServiceManager_DissociateServiceLL_argumentL(TTestResult& aResult);
       
   360          TInt UT_CSenServiceManager_DissociateServiceLL_notReadyL(TTestResult& aResult);
       
   361          TInt UT_CSenServiceManager_DissociateServiceLL_notFoundL(TTestResult& aResult);
       
   362         
       
   363 
       
   364     private:    // Data
       
   365         CSenServiceManager*         iServiceManager;
       
   366         CSenXmlServiceDescription*  iSenXmlServiceDescription;
       
   367         CSenIdentityProvider*       iProvider;
       
   368         RFs                         iFsSession;
       
   369 
       
   370 		CActiveScheduler* iActiveScheduler;
       
   371 
       
   372     public:     // Data
       
   373         // ?one_line_short_description_of_data
       
   374         //?data_declaration;
       
   375 
       
   376     protected:  // Data
       
   377         // ?one_line_short_description_of_data
       
   378         //?data_declaration;
       
   379 
       
   380     private:    // Data
       
   381         // Pointer to test (function) to be executed
       
   382         TestFunction iMethod;
       
   383 
       
   384         // Pointer to logger
       
   385         CStifLogger * iLog; 
       
   386 
       
   387         // ?one_line_short_description_of_data
       
   388         //?data_declaration;
       
   389 
       
   390         // Reserved pointer for future extension
       
   391         //TAny* iReserved;
       
   392 
       
   393     public:     // Friend classes
       
   394         //?friend_class_declaration;
       
   395     protected:  // Friend classes
       
   396         //?friend_class_declaration;
       
   397     private:    // Friend classes
       
   398         //?friend_class_declaration;
       
   399 
       
   400     };
       
   401 
       
   402 #endif      // SENSERVICEMANAGERBCTEST_H
       
   403 
       
   404 // End of File