isolationserver/tsrc/src/isolationserver.cpp
branchRCL_3
changeset 11 3404599e4dda
parent 9 46cc8e302e43
equal deleted inserted replaced
9:46cc8e302e43 11:3404599e4dda
     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 the License "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:   isolationserver.cpp
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <StifTestInterface.h>
       
    23 #include "isolationserver.h"
       
    24 #include <SettingServerClient.h>
       
    25 
       
    26 
       
    27 // EXTERNAL DATA STRUCTURES
       
    28 //extern  ?external_data;
       
    29 
       
    30 // EXTERNAL FUNCTION PROTOTYPES  
       
    31 //extern ?external_function( ?arg_type,?arg_type );
       
    32 
       
    33 // CONSTANTS
       
    34 //const ?type ?constant_var = ?constant;
       
    35 
       
    36 // MACROS
       
    37 //#define ?macro ?macro_def
       
    38 
       
    39 // LOCAL CONSTANTS AND MACROS
       
    40 //const ?type ?constant_var = ?constant;
       
    41 //#define ?macro_name ?macro_def
       
    42 
       
    43 // MODULE DATA STRUCTURES
       
    44 //enum ?declaration
       
    45 //typedef ?declaration
       
    46 
       
    47 // LOCAL FUNCTION PROTOTYPES
       
    48 //?type ?function_name( ?arg_type, ?arg_type );
       
    49 
       
    50 // FORWARD DECLARATIONS
       
    51 //class ?FORWARD_CLASSNAME;
       
    52 
       
    53 // ============================= LOCAL FUNCTIONS ===============================
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // ?function_name ?description.
       
    57 // ?description
       
    58 // Returns: ?value_1: ?description
       
    59 //          ?value_n: ?description_line1
       
    60 //                    ?description_line2
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 /*
       
    64 ?type ?function_name(
       
    65     ?arg_type arg,  // ?description
       
    66     ?arg_type arg)  // ?description
       
    67     {
       
    68 
       
    69     ?code  // ?comment
       
    70 
       
    71     // ?comment
       
    72     ?code
       
    73     }
       
    74 */
       
    75 
       
    76 // ============================ MEMBER FUNCTIONS ===============================
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // Cisolationserver::Cisolationserver
       
    80 // C++ default constructor can NOT contain any code, that
       
    81 // might leave.
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 Cisolationserver::Cisolationserver( 
       
    85     CTestModuleIf& aTestModuleIf ):
       
    86         CScriptBase( aTestModuleIf )
       
    87     {
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // Cisolationserver::ConstructL
       
    92 // Symbian 2nd phase constructor can leave.
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 void Cisolationserver::ConstructL()
       
    96     {
       
    97     //Read logger settings to check whether test case name is to be
       
    98     //appended to log file name.
       
    99     RSettingServer settingServer;
       
   100     TInt ret = settingServer.Connect();
       
   101     if(ret != KErrNone)
       
   102         {
       
   103         User::Leave(ret);
       
   104         }
       
   105     // Struct to StifLogger settigs.
       
   106     TLoggerSettings loggerSettings; 
       
   107     // Parse StifLogger defaults from STIF initialization file.
       
   108     ret = settingServer.GetLoggerSettings(loggerSettings);
       
   109     if(ret != KErrNone)
       
   110         {
       
   111         User::Leave(ret);
       
   112         } 
       
   113     // Close Setting server session
       
   114     settingServer.Close();
       
   115 
       
   116     TFileName logFileName;
       
   117     
       
   118     if(loggerSettings.iAddTestCaseTitle)
       
   119         {
       
   120         TName title;
       
   121         TestModuleIf().GetTestCaseTitleL(title);
       
   122         logFileName.Format(KisolationserverLogFileWithTitle, &title);
       
   123         }
       
   124     else
       
   125         {
       
   126         logFileName.Copy(KisolationserverLogFile);
       
   127         }
       
   128 
       
   129     iLog = CStifLogger::NewL( KisolationserverLogPath, 
       
   130                           logFileName,
       
   131                           CStifLogger::ETxt,
       
   132                           CStifLogger::EFile,
       
   133                           EFalse );
       
   134 
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // Cisolationserver::NewL
       
   139 // Two-phased constructor.
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 Cisolationserver* Cisolationserver::NewL( 
       
   143     CTestModuleIf& aTestModuleIf )
       
   144     {
       
   145     Cisolationserver* self = new (ELeave) Cisolationserver( aTestModuleIf );
       
   146 
       
   147     CleanupStack::PushL( self );
       
   148     self->ConstructL();
       
   149     CleanupStack::Pop();
       
   150 
       
   151     return self;
       
   152 
       
   153     }
       
   154 
       
   155 // Destructor
       
   156 Cisolationserver::~Cisolationserver()
       
   157     { 
       
   158 
       
   159     // Delete resources allocated from test methods
       
   160     Delete();
       
   161 
       
   162     // Delete logger
       
   163     delete iLog; 
       
   164 
       
   165     }
       
   166 
       
   167 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   168 
       
   169 // -----------------------------------------------------------------------------
       
   170 // LibEntryL is a polymorphic Dll entry point.
       
   171 // Returns: CScriptBase: New CScriptBase derived object
       
   172 // -----------------------------------------------------------------------------
       
   173 //
       
   174 EXPORT_C CScriptBase* LibEntryL( 
       
   175     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   176     {
       
   177 
       
   178     return ( CScriptBase* ) Cisolationserver::NewL( aTestModuleIf );
       
   179 
       
   180     }
       
   181 
       
   182 
       
   183 //  End of File