websrv_pub/web_service_connection_api/tsrc/senConnectionTester/inc/senConnectionTester.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     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: Header declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef SENCONNECTIONTESTER_H
       
    21 #define SENCONNECTIONTESTER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <StifLogger.h>
       
    25 #include <TestScripterInternal.h>
       
    26 #include <StifTestModule.h>
       
    27 #include <TestclassAssert.h>
       
    28 #include <MSenServiceConsumer.h>
       
    29 #include <SenBaseFragment.h>
       
    30 #include <SenBaseElement.h>
       
    31 #include <SenXmlReader.h>
       
    32 #include <SenServiceConnection.h>
       
    33 #include <f32file.h>
       
    34 #include <e32base.h> // for CActivef
       
    35 #include <e32std.h>
       
    36 #include <unistd.h>
       
    37 #include <e32def.h>
       
    38 #include <aknnotewrappers.h> 
       
    39 
       
    40 //  INTERNAL INCLUDES
       
    41 namespace
       
    42     {
       
    43     _LIT16(KSessionsFile,"c:\\private\\101f96f4\\SenSessions.xml");
       
    44     _LIT16(KIdentitiesFile,"c:\\private\\101f96f4\\senidentities.xml");
       
    45     }
       
    46 
       
    47 enum TUT_CSenServiceConnection
       
    48     {
       
    49     ENotInitialized = 1,
       
    50     EConnectionNotReady,
       
    51     };
       
    52     
       
    53 enum TMSCommands
       
    54     {
       
    55     EMSNMessengerRegister,
       
    56     EMSNMessengerInvite,
       
    57     EMSNMessengerSend,
       
    58     EMSNMessengerUnRegister,
       
    59     };
       
    60 
       
    61 //  FORWARD DECLARATIONS
       
    62 class CSenBaseFragment;
       
    63 class CSenBaseElement;
       
    64 class CSenSoapEnvelope;
       
    65 class SenXmlUtils;
       
    66 class CSenServiceConnection;
       
    67 class CSenXmlReader;
       
    68 class CSenDomFragment;
       
    69 class CSenXmlServiceDescription;
       
    70 class CSenServicePattern;
       
    71 class CSenServiceManager;
       
    72 class CSenSoapMessage;
       
    73 class CSenSoapMessage2;
       
    74 class CSenVtcpTransportProperties;
       
    75 
       
    76 // MACROS
       
    77 //#define ?macro ?macro_def
       
    78 #define TEST_CLASS_VERSION_MAJOR 0
       
    79 #define TEST_CLASS_VERSION_MINOR 0
       
    80 #define TEST_CLASS_VERSION_BUILD 0
       
    81 
       
    82 // Logging path
       
    83 _LIT( KsenConnectionTesterLogPath, "\\logs\\testframework\\senConnectionTester\\" ); 
       
    84 // Log file
       
    85 _LIT( KsenConnectionTesterLogFile, "senConnectionTester.txt" ); 
       
    86 _LIT( KsenConnectionTesterLogFileWithTitle, "senConnectionTester_[%S].txt" );
       
    87 
       
    88 // FUNCTION PROTOTYPES
       
    89 //?type ?function_name(?arg_list);
       
    90 
       
    91 // FORWARD DECLARATIONS
       
    92 //class ?FORWARD_CLASSNAME;
       
    93 class CsenConnectionTester;
       
    94 
       
    95 // DATA TYPES
       
    96 //enum ?declaration
       
    97 //typedef ?declaration
       
    98 typedef TInt (CsenConnectionTester::* TestFunction)(TTestResult&);
       
    99 //extern ?data_type;
       
   100 
       
   101 // CLASS DECLARATION
       
   102 
       
   103 /**
       
   104 *  CsenConnectionTester test class for STIF Test Framework TestScripter.
       
   105 *  ?other_description_lines
       
   106 *
       
   107 *  @lib ?library
       
   108 *  @since ?Series60_version
       
   109 */
       
   110 
       
   111 NONSHARABLE_CLASS(CsenConnectionTester) : public CScriptBase, public MSenServiceConsumer, public MSenAuthenticationProvider, public MSenExtendedConsumerInterface
       
   112     {
       
   113     public:
       
   114         enum TCallback
       
   115             {
       
   116             ECallbackNone = 0,
       
   117             ECallbackHandleMessage,
       
   118             ECallbackHandleError
       
   119             };
       
   120     public:  // Constructors and destructor
       
   121 
       
   122         /**
       
   123         * Two-phased constructor.
       
   124         */
       
   125         static CsenConnectionTester* NewL( CTestModuleIf& aTestModuleIf );
       
   126 
       
   127         /**
       
   128         * Destructor.
       
   129         */
       
   130         virtual ~CsenConnectionTester();
       
   131 
       
   132     public: // New functions
       
   133 
       
   134         /**
       
   135         * ?member_description.
       
   136         * @since ?Series60_version
       
   137         * @param ?arg1 ?description
       
   138         * @return ?description
       
   139         */
       
   140         //?type ?member_function( ?type ?arg1 );
       
   141 
       
   142     public: // Functions from base classes
       
   143 
       
   144         /**
       
   145         * From CScriptBase Runs a script line.
       
   146         * @since ?Series60_version
       
   147         * @param aItem Script line containing method name and parameters
       
   148         * @return Symbian OS error code
       
   149         */
       
   150         virtual TInt RunMethodL( CStifItemParser& aItem );
       
   151 
       
   152     protected:  // New functions
       
   153 
       
   154         /**
       
   155         * ?member_description.
       
   156         * @since ?Series60_version
       
   157         * @param ?arg1 ?description
       
   158         * @return ?description
       
   159         */
       
   160         //?type ?member_function( ?type ?arg1 );
       
   161 
       
   162     protected:  // Functions from base classes
       
   163 
       
   164         /**
       
   165         * From ?base_class ?member_description
       
   166         */
       
   167         //?type ?member_function();
       
   168 
       
   169     private:
       
   170 
       
   171         /**
       
   172         * C++ default constructor.
       
   173         */
       
   174         CsenConnectionTester( CTestModuleIf& aTestModuleIf );
       
   175 
       
   176         /**
       
   177         * By default Symbian 2nd phase constructor is private.
       
   178         */
       
   179         void ConstructL();
       
   180 
       
   181         // Prohibit copy constructor if not deriving from CBase.
       
   182         // ?classname( const ?classname& );
       
   183         // Prohibit assigment operator if not deriving from CBase.
       
   184         // ?classname& operator=( const ?classname& );
       
   185 
       
   186         /**
       
   187         * Frees all resources allocated from test methods.
       
   188         * @since ?Series60_version
       
   189         */
       
   190         void Delete();
       
   191 
       
   192         /**
       
   193         * Test methods are listed below. 
       
   194         */
       
   195 
       
   196         /**
       
   197         * Example test method.
       
   198         * @since ?Series60_version
       
   199         * @param aItem Script line containing parameters.
       
   200         * @return Symbian OS error code.
       
   201         */
       
   202         /**
       
   203          * Method used to log version of test class
       
   204          */
       
   205         void SendTestClassVersion();
       
   206 
       
   207         void CsenConnectionTester::HandleMessageL(const TDesC8& aMessage);        
       
   208         void CsenConnectionTester::HandleErrorL(const int aErrorCode, const TDesC8& aError);
       
   209         void CsenConnectionTester::SetStatus(const TInt aStatus);
       
   210 
       
   211         void CsenConnectionTester::SetupL();
       
   212 
       
   213         void CsenConnectionTester::Teardown();
       
   214 
       
   215         void CsenConnectionTester::ErrorL(TInt aCode);
       
   216 
       
   217         TInt CsenConnectionTester::UT_CSenServiceConnection_RegisterIdentityProviderLL();
       
   218 
       
   219         TInt CsenConnectionTester::UT_CSenServiceConnection_NewL_ContractL();
       
   220         TInt CsenConnectionTester::UT_CSenServiceConnection_NewLC_ContractL();
       
   221         TInt CsenConnectionTester::UT_CSenServiceConnection_NewL_WS_I_DescriptionL();
       
   222         TInt CsenConnectionTester::UT_CSenServiceConnection_NewLC_WS_I_DescriptionL();
       
   223         TInt CsenConnectionTester::UT_CSenServiceConnection_NewL_ID_WSF_DescriptionL();
       
   224         TInt CsenConnectionTester::UT_CSenServiceConnection_NewLC_ID_WSF_DescriptionL();
       
   225         TInt CsenConnectionTester::UT_CSenServiceConnection_NewL_WS_I_PatternL();
       
   226         TInt CsenConnectionTester::UT_CSenServiceConnection_NewLC_WS_I_PatternL();
       
   227         TInt CsenConnectionTester::UT_CSenServiceConnection_NewL_ID_WSF_PatternL();
       
   228         TInt CsenConnectionTester::UT_CSenServiceConnection_NewLC_ID_WSF_PatternL();
       
   229 
       
   230         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_NoErrorL();
       
   231         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_CancelL();
       
   232         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_ConNotInitialL(  );
       
   233         
       
   234         TInt CsenConnectionTester::UT_CSenServiceConnection_SendMultipleMessagesL(  );
       
   235         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_Get_Post1L(  );
       
   236         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_Get_Post2L(  );
       
   237         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_Proxy1L(  );
       
   238         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_Proxy2L(  );
       
   239         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_Pattern_IAP1L(  );
       
   240         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_Pattern_IAP2L(  );
       
   241         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_Pattern_IAP3L(  );
       
   242 
       
   243         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_ContentType1L(  );
       
   244         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_ContentType2L(  );
       
   245         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_UserAgent1L(  );
       
   246         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_UserAgent2L(  );
       
   247         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_MessageSoapActionL(  );
       
   248         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_SoapAction1L(  );
       
   249         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_SoapAction2L(  );
       
   250         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_CustomHttpHeaderL(  );
       
   251 
       
   252         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_ConBusyL(  );
       
   253 
       
   254         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_ConInitializingL(  );
       
   255 
       
   256         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_ConExpiredL(  );
       
   257 
       
   258         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_ErrSubmitL(  );
       
   259 
       
   260         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_ErrNoMemoryL(  );
       
   261 
       
   262         TInt CsenConnectionTester::UT_CSenServiceConnection_SubmitLL();
       
   263 
       
   264         TInt CsenConnectionTester::UT_CSenServiceConnection_IsReadyL();
       
   265 
       
   266         TInt CsenConnectionTester::UT_CSenServiceConnection_HasFacetLL();
       
   267 
       
   268         TInt CsenConnectionTester::UT_CSenServiceConnection_CompleteServerMessagesOnOffL();
       
   269 
       
   270         TInt CsenConnectionTester::UT_CSenServiceConnection_SendL_1L();
       
   271 
       
   272         TInt CsenConnectionTester::UT_CSenServiceConnection_SubmitL_1L();
       
   273 
       
   274         TInt CsenConnectionTester::UT_CSenServiceConnection_StartTransactionL();
       
   275 
       
   276         TInt CsenConnectionTester::UT_CSenServiceConnection_TransactionCompletedL();
       
   277         
       
   278         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_Boundaries1(  );
       
   279         
       
   280         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_Boundaries2(  );
       
   281         
       
   282         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_Boundaries3(  );
       
   283         
       
   284         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_Boundaries4(  );
       
   285         
       
   286         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_Boundaries5(  );
       
   287         
       
   288         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_Boundaries6(  );
       
   289         
       
   290         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_Boundaries7(  );
       
   291         
       
   292         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_Boundaries8(  );
       
   293         
       
   294         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_Boundaries9(  );
       
   295 
       
   296         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_SecDialog();     
       
   297         
       
   298         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_Omitted_True();     
       
   299 
       
   300         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_Omitted_False();           
       
   301         
       
   302         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_Removed();     
       
   303         
       
   304         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_Omit_Rem();
       
   305         TInt CsenConnectionTester::UT_CSenServiceConnection_SubmitL_LibXml2_L();
       
   306         TInt CsenConnectionTester::UT_CSenServiceConnection_SubmitL_LibXml2_with_Properties_L();
       
   307         TInt CsenConnectionTester::UT_CSenServiceConnection_SubmitL_LibXml2_MTOM_20KBL();
       
   308         TInt CsenConnectionTester::UT_CSenServiceConnection_SubmitL_LibXml2_MTOM_200KBL();
       
   309         TInt CsenConnectionTester::UT_CSenServiceConnection_SubmitL_LibXml2_MTOM_Less1MBL();
       
   310         TInt CsenConnectionTester::UT_CSenServiceConnection_SubmitL_LibXml2_MTOM_More1MBL();
       
   311         TInt CsenConnectionTester::UT_CSenServiceConnection_TestMessengerL(  );
       
   312         TInt CsenConnectionTester::UT_CSenServiceConnection_TestMessenger2L(  );
       
   313         TInt CsenConnectionTester::UT_CSenServiceConnection_TestMessenger3L(  );
       
   314         TInt CsenConnectionTester::UT_CSenServiceConnection_TestMessenger4L(  );
       
   315         TInt CsenConnectionTester::UT_CSenServiceConnection_TestMessenger5L(  );
       
   316         TInt CsenConnectionTester::UT_CSenServiceConnection_TestMessenger6L(  );
       
   317         TInt CsenConnectionTester::UT_CSenServiceConnection_TestMessenger7L(  );
       
   318         
       
   319         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_Custom_Header(const TDesC8& KCustomHttpHeader,
       
   320                                                        const TDesC8& KCustomHttpHeaderValue);
       
   321                                     
       
   322         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_Send(const TDesC8& aLogFileName,
       
   323                                               const TDesC8& aCustomHttpHeader,
       
   324                                               const TDesC8& aCustomHttpHeaderValue,
       
   325                                               CSenServiceConnection* iServiceConnection);
       
   326                                               
       
   327         TInt CsenConnectionTester::UT_CSenServiceConnection_TP_CheckLogs(const TDesC& aLogFilePath,
       
   328                                                    const TDesC8& aCustomHttpHeader,
       
   329                                                    const TDesC8& aCustomHttpHeaderValue);                                    
       
   330                                                    
       
   331         TUint32 CsenConnectionTester::SearchIAPIdByNameL( const TDesC& aIAPName );
       
   332         
       
   333         CSenSoapMessage* CsenConnectionTester::CreateAuthRequestLC();
       
   334         
       
   335         CSenSoapMessage2* CsenConnectionTester::CreateNewAuthRequestLC();
       
   336         
       
   337         HBufC8* CsenConnectionTester::ReadFileL(const TDesC& aFilename);
       
   338         
       
   339         TInt CsenConnectionTester::Find(const TDesC8& aDestination, const TDesC8& aDescToFind, TInt aStartingPos);
       
   340         TBool CsenConnectionTester::ReplaceAll(TPtr8 aDestination, const TDesC8& aFrom, const TDesC8& aTo);
       
   341         TBool CsenConnectionTester::DecodeHttpCharactersL(const TDesC8& aOriginal, HBufC8*& aDecoded);
       
   342         
       
   343         HBufC8* CsenConnectionTester::HttpMethodValueFromXmlLC(const TDesC8& aXml);
       
   344         
       
   345         HBufC8* CsenConnectionTester::HttpPropertyValueFromXmlLC(const TDesC8& aXml,
       
   346                                            const TDesC8& aPropertyName);
       
   347                                            
       
   348         void CsenConnectionTester::StartActiveScheduler(TInt aNumberOfSentMessages);
       
   349         void CsenConnectionTester::StopActiveScheduler();
       
   350         
       
   351         CSenVtcpTransportProperties* CsenConnectionTester::CreateMSTransportPropertiesL(TMSCommands aCommand);
       
   352         CSenSoapMessage2* CsenConnectionTester::CreateMSSoapMessage(TMSCommands aCommand);
       
   353         void CsenConnectionTester::RegisterSTSL();
       
   354         void CsenConnectionTester::RegisterSTSInvalidPasswordL();
       
   355         void CsenConnectionTester::UnregisterSTSL();
       
   356         void CsenConnectionTester::SetPolicyL(CSenXmlServiceDescription* pServDesc, const TDesC8& pName,
       
   357                                                               const TDesC8& pValue);
       
   358         void CsenConnectionTester::CreateConnectionToMessengerServiceL();
       
   359         void CsenConnectionTester::CreateConnectionToMessengerServiceWithoutCallbackL();
       
   360         
       
   361         void CsenConnectionTester::AddDeviceOptionsHeader2L(CSenSoapMessage2& aMessage);
       
   362         void CsenConnectionTester::AddApplicationHeader2L(CSenSoapMessage2& aMessage);
       
   363         TAny* CsenConnectionTester::GetInterfaceByUid( TUid aUID );
       
   364         const CSenIdentityProvider* IdentityProviderL() const ;
       
   365 
       
   366     private:    // Data
       
   367         
       
   368         CSenXmlServiceDescription*  iSenXmlServiceDescription;
       
   369         CSenXmlServiceDescription*  iSession;
       
   370         CSenServiceConnection*      iServiceConnection;
       
   371         CSenServiceManager*         iManager;
       
   372         CSenXmlReader*              iXmlReader;
       
   373         
       
   374         TInt                        iTransactionId;
       
   375         TInt                        iConnectionState;
       
   376         TBool                       iInitialized;
       
   377         TBool                       iReady;
       
   378         
       
   379         TCallback                   iCallback;
       
   380         HBufC8*                     ipMessage;
       
   381         
       
   382         TInt                        iNumberOfPendingOps;
       
   383         HBufC8*                     ipFrameworkID;
       
   384         
       
   385         TInt                        iErrorCode;
       
   386   
       
   387         CSenIdentityProvider*       ipProviderForAuthProvider;
       
   388         TInt                        iAuthInfoAskCounter;
       
   389         
       
   390 
       
   391 
       
   392     };
       
   393 
       
   394 #endif      // SENCONNECTIONTESTER_H
       
   395 
       
   396 // End of File