|
1 /* |
|
2 * Copyright (c) 2005-2006 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: Contains member functions and library entry point. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <stiftestinterface.h> |
|
20 #include <ecom/ecom.h> |
|
21 #include <e32cmn.h> |
|
22 #include <epos_comasuplposhandlerbase.h> |
|
23 |
|
24 #include "epos_comasuplpostestermodulecfg.h" |
|
25 #include "epos_comasuplecomhandler.h" |
|
26 #include "epos_comasuplconsolemanager.h" |
|
27 #include "epos_comasupltesthandler.h" |
|
28 #include "epos_comasuplpostesterlogger.h" |
|
29 #include "epos_comasuplpostestercategory.h" |
|
30 #include "epos_comasuplthreadprocesstest.h" |
|
31 // ============================ MEMBER FUNCTIONS =============================== |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // COMASuplPosTesterModuleCfg::COMASuplPosTesterModuleCfg |
|
35 // C++ default constructor can NOT contain any code, that |
|
36 // might leave. |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 COMASuplPosTesterModuleCfg::COMASuplPosTesterModuleCfg( |
|
40 CTestModuleIf& aTestModuleIf ): |
|
41 CScriptBase( aTestModuleIf ) |
|
42 { |
|
43 iTestingCancelled = EFalse; |
|
44 iTestingStatus = ETestNotStarted; |
|
45 } |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // COMASuplPosTesterModuleCfg::ConstructL |
|
49 // Symbian 2nd phase constructor can leave. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 void COMASuplPosTesterModuleCfg::ConstructL() |
|
53 { |
|
54 iLog = CStifLogger::NewL( KPosTesterModuleCfgLogPath, |
|
55 KPosTesterModuleCfgLogFile, |
|
56 CStifLogger::ETxt, |
|
57 CStifLogger::EFile, |
|
58 EFalse,// overwrite is not used |
|
59 ETrue,// Time stamp is used |
|
60 ETrue,// Line break is used |
|
61 EFalse,// Even ranking is not used |
|
62 EFalse,// Thread id is not added after the log file |
|
63 ETrue,// Log directory will create |
|
64 2048);//Buffer size |
|
65 iEComHandler = COMASuplEComHandler::NewL(0x102073D4); |
|
66 iConsoleManager = COMASuplConsoleManager::NewL( |
|
67 iEComHandler->GetImplementationList()); |
|
68 iTestHandler = COMASuplTestHandler::NewL(iConsoleManager->GetConsole()); |
|
69 iThreadTester = COMASuplThreadProcessTest::NewL(); |
|
70 iThreadTester->StatusBeforeTestsL(); |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // COMASuplPosTesterModuleCfg::NewL |
|
75 // Two-phased constructor. |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 COMASuplPosTesterModuleCfg* COMASuplPosTesterModuleCfg::NewL( |
|
79 CTestModuleIf& aTestModuleIf ) |
|
80 { |
|
81 COMASuplPosTesterModuleCfg* self = new (ELeave) COMASuplPosTesterModuleCfg( aTestModuleIf ); |
|
82 |
|
83 CleanupStack::PushL( self ); |
|
84 self->ConstructL(); |
|
85 CleanupStack::Pop(self); |
|
86 |
|
87 return self; |
|
88 |
|
89 } |
|
90 |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // Destructor |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 COMASuplPosTesterModuleCfg::~COMASuplPosTesterModuleCfg() |
|
97 { |
|
98 |
|
99 // Delete resources allocated from test methods |
|
100 Delete(); |
|
101 |
|
102 delete iPosHandler;//delete pos handler before deleting thread tester |
|
103 delete iThreadTester; |
|
104 // Delete logger |
|
105 delete iLog; |
|
106 |
|
107 delete iPosLogger; |
|
108 delete iTestHandler; |
|
109 delete iConsoleManager; |
|
110 delete iEComHandler; |
|
111 REComSession::FinalClose(); |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // Prepares filename from the displayname of the implementation. |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 void COMASuplPosTesterModuleCfg::PrepareFileName(TFileName& aOutputFileName, |
|
119 const CImplementationInformation& aImplInfo) |
|
120 { |
|
121 TInt count = 0; |
|
122 TInt displayNameLength = aImplInfo.DisplayName().Length(); |
|
123 |
|
124 for(count = 0; count < displayNameLength |
|
125 && count < KMaxFileName - 12; count++) |
|
126 { |
|
127 if(IsValidFileNameChar(aImplInfo.DisplayName().Ptr() + count)) |
|
128 { |
|
129 aOutputFileName.Append(aImplInfo.DisplayName().Ptr() + count, 1); |
|
130 } |
|
131 } |
|
132 |
|
133 aOutputFileName.Append(_L("_")); |
|
134 aOutputFileName.Append(aImplInfo.ImplementationUid().Name().Ptr() + 1 |
|
135 , aImplInfo.ImplementationUid().Name().Length() - 2); |
|
136 //Append file extension |
|
137 aOutputFileName.Append(_L(".txt")); |
|
138 } |
|
139 |
|
140 // --------------------------------------------------------------------------- |
|
141 // Prepares filename from the displayname of the implementation. |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 TBool COMASuplPosTesterModuleCfg::IsValidFileNameChar(const TUint16* aChar) |
|
145 { |
|
146 _LIT(KInvalidCharList, " &^+-@$%*()|\\/[]{}<>?;:,\"'"); |
|
147 for(TInt counter = 0; counter < KInvalidCharList().Length(); counter++) |
|
148 { |
|
149 if(KInvalidCharList()[counter] == *aChar) |
|
150 { |
|
151 return EFalse; |
|
152 } |
|
153 } |
|
154 return ETrue; |
|
155 } |
|
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 // Adds number of info, warning and error messages to member variables. |
|
159 // --------------------------------------------------------------------------- |
|
160 // |
|
161 void COMASuplPosTesterModuleCfg::UpdateSummary( |
|
162 COMASuplPosTesterCategory* aTestCat) |
|
163 { |
|
164 TInt infoCount = 0; |
|
165 TInt warningCount = 0; |
|
166 TInt errorCount = 0; |
|
167 aTestCat->GetTestSummary(infoCount, warningCount, errorCount); |
|
168 iNetInfos += infoCount; |
|
169 iNetWarnings += warningCount; |
|
170 iNetErrors += errorCount; |
|
171 } |
|
172 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // LibEntryL is a polymorphic Dll entry point. |
|
176 // Returns: CScriptBase: New CScriptBase derived object |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 EXPORT_C CScriptBase* LibEntryL( |
|
180 CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework |
|
181 { |
|
182 return ( CScriptBase* ) COMASuplPosTesterModuleCfg::NewL( aTestModuleIf ); |
|
183 } |
|
184 |
|
185 // End of File |