websrv_pub/xml_extensions_api/tsrc/bc/xml_extensions_api/src/WSTester.cpp
changeset 0 62f9d29f7211
child 29 5743aa3a72c3
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2002 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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <StifTestInterface.h>
       
    22 #include "WSTester.h"
       
    23 
       
    24 // EXTERNAL DATA STRUCTURES
       
    25 //extern  ?external_data;
       
    26 
       
    27 // EXTERNAL FUNCTION PROTOTYPES  
       
    28 //extern ?external_function( ?arg_type,?arg_type );
       
    29 
       
    30 // CONSTANTS
       
    31 //const ?type ?constant_var = ?constant;
       
    32 
       
    33 // MACROS
       
    34 //#define ?macro ?macro_def
       
    35 
       
    36 // LOCAL CONSTANTS AND MACROS
       
    37 //const ?type ?constant_var = ?constant;
       
    38 //#define ?macro_name ?macro_def
       
    39 
       
    40 // MODULE DATA STRUCTURES
       
    41 //enum ?declaration
       
    42 //typedef ?declaration
       
    43 
       
    44 // LOCAL FUNCTION PROTOTYPES
       
    45 //?type ?function_name( ?arg_type, ?arg_type );
       
    46 
       
    47 // FORWARD DECLARATIONS
       
    48 //class ?FORWARD_CLASSNAME;
       
    49 
       
    50 // ============================= LOCAL FUNCTIONS ===============================
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // ?function_name ?description.
       
    54 // ?description
       
    55 // Returns: ?value_1: ?description
       
    56 //          ?value_n: ?description_line1
       
    57 //                    ?description_line2
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 /*
       
    61 ?type ?function_name(
       
    62     ?arg_type arg,  // ?description
       
    63     ?arg_type arg)  // ?description
       
    64     {
       
    65 
       
    66     ?code  // ?comment
       
    67 
       
    68     // ?comment
       
    69     ?code
       
    70     }
       
    71 */
       
    72 
       
    73 // ============================ MEMBER FUNCTIONS ===============================
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CWSTester::CWSTester
       
    77 // C++ default constructor can NOT contain any code, that
       
    78 // might leave.
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 CWSTester::CWSTester( 
       
    82     CTestModuleIf& aTestModuleIf ):
       
    83         CScriptBase( aTestModuleIf ),
       
    84 		iFrg(NULL)
       
    85     {
       
    86     }
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // CWSTester::ConstructL
       
    90 // Symbian 2nd phase constructor can leave.
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 void CWSTester::ConstructL()
       
    94     {
       
    95     //__UHEAP_MARK;
       
    96     iLog = CStifLogger::NewL( KWSTesterLogPath, 
       
    97                           KWSTesterLogFile,
       
    98                           CStifLogger::ETxt,
       
    99                           CStifLogger::EFile,
       
   100                           EFalse );
       
   101     User::LeaveIfError(this->iFsSession.Connect());
       
   102 	iXmlReader = CSenXmlReader::NewL();
       
   103     iErrorsOccured = FALSE;
       
   104 	iCasePassed = EFalse;
       
   105     iLog->Log(_L("                     /------------\\"));
       
   106     iLog->Log(_L("--------------------- New testcase -------------"));
       
   107     iLog->Log(_L("                     \\------------/"));
       
   108 	iStringPool.OpenL();
       
   109 	iElement = NULL;
       
   110 	iFrg = NULL;
       
   111 	iProvider = NULL;
       
   112 	iArgc = 0;
       
   113 	iRunCase = 0;
       
   114 	iSaxTester = NULL;
       
   115 	iSenCredential = NULL;
       
   116 	iSenServiceConnection = NULL;
       
   117 	iSenXmlServiceDescription = NULL;
       
   118 	iServiceManager = NULL;
       
   119 	iSOAPMessage = NULL;
       
   120 	SendTestModuleVersion();
       
   121     }
       
   122 //-----------------------------------------------------------------------------
       
   123 // CWSTester::SendTestClassVersion
       
   124 // Method used to send version of test class
       
   125 //-----------------------------------------------------------------------------
       
   126 //
       
   127 void CWSTester::SendTestModuleVersion()
       
   128 	{
       
   129 	TVersion moduleVersion;
       
   130 	moduleVersion.iMajor = TEST_MODULE_VERSION_MAJOR;
       
   131 	moduleVersion.iMinor = TEST_MODULE_VERSION_MINOR;
       
   132 	moduleVersion.iBuild = TEST_MODULE_VERSION_BUILD;
       
   133 	
       
   134 	TFileName moduleName;
       
   135 	moduleName = _L("WSTester.dll");
       
   136 	
       
   137 
       
   138 	TBool newVersionOfMethod = ETrue;
       
   139 	CTestModuleIf &test=TestModuleIf();
       
   140 	test.SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
       
   141 	test.SetBehavior(CTestModuleIf::ETestLeaksHandles);
       
   142 	}
       
   143 
       
   144 // -----------------------------------------------------------------------------
       
   145 // CWSTester::NewL
       
   146 // Two-phased constructor.
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 CWSTester* CWSTester::NewL( 
       
   150     CTestModuleIf& aTestModuleIf )
       
   151     {
       
   152     CWSTester* self = new (ELeave) CWSTester( aTestModuleIf );
       
   153     
       
   154     CleanupStack::PushL( self );
       
   155     self->ConstructL();
       
   156     CleanupStack::Pop();
       
   157 
       
   158     return self;
       
   159     
       
   160     }
       
   161     
       
   162 // Destructor
       
   163 CWSTester::~CWSTester()
       
   164     { 
       
   165     
       
   166     // Delete resources allocated from test methods
       
   167     Delete();
       
   168     iWriter.Close();
       
   169     iFsSession.Close();    
       
   170     // Delete logger
       
   171     delete iLog;  
       
   172 
       
   173     if ( iSenServiceConnection != NULL ){
       
   174         delete iSenServiceConnection ;
       
   175 	    iSenServiceConnection = NULL;
       
   176     }
       
   177     if ( iSenXmlServiceDescription!= NULL ){
       
   178         delete iSenXmlServiceDescription;
       
   179 	    iSenXmlServiceDescription = NULL;
       
   180     }
       
   181     if ( iServiceManager!= NULL ){
       
   182         delete iServiceManager;
       
   183 	    iServiceManager = NULL;
       
   184     }
       
   185     if ( iProvider!= NULL ){
       
   186         delete iProvider;
       
   187 	    iProvider = NULL;
       
   188     }
       
   189 	if ( iXmlReader != NULL ){
       
   190         delete iXmlReader;
       
   191 	    iXmlReader = NULL;
       
   192     }
       
   193     
       
   194     if ( iSOAPMessage != NULL ){
       
   195         delete iSOAPMessage;
       
   196 	    iSOAPMessage = NULL;
       
   197     }
       
   198     if ( iSaxTester != NULL ){
       
   199         delete iSaxTester;
       
   200 	    iSaxTester = NULL;
       
   201     }
       
   202    	if ( iElement != NULL ){
       
   203         delete iElement;
       
   204         iElement = NULL;
       
   205     }
       
   206 
       
   207 	iStringPool.Close();
       
   208 
       
   209 	delete iFrg;
       
   210 	iFrg = NULL;
       
   211 
       
   212     //__UHEAP_MARKEND;
       
   213     }
       
   214 
       
   215 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   216 
       
   217 // -----------------------------------------------------------------------------
       
   218 // LibEntryL is a polymorphic Dll entry point.
       
   219 // Returns: CScriptBase: New CScriptBase derived object
       
   220 // -----------------------------------------------------------------------------
       
   221 //
       
   222 EXPORT_C CScriptBase* LibEntryL( 
       
   223     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   224     {
       
   225     
       
   226     return ( CScriptBase* ) CWSTester::NewL( aTestModuleIf );
       
   227         
       
   228     }
       
   229 
       
   230 // -----------------------------------------------------------------------------
       
   231 // E32Dll is a DLL entry point function.
       
   232 // Returns: KErrNone
       
   233 // -----------------------------------------------------------------------------
       
   234 //
       
   235 #ifndef EKA2 // Hide Dll entry point to EKA2
       
   236 GLDEF_C TInt E32Dll(
       
   237     TDllReason /*aReason*/) // Reason code
       
   238     {
       
   239     return(KErrNone);
       
   240     
       
   241     }
       
   242 #endif // EKA2
       
   243     
       
   244 //  End of File