|
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file texml2server.cpp |
|
18 @internalTechnology |
|
19 */ |
|
20 |
|
21 #include "texml2server.h" |
|
22 #include "texml2teststep.h" |
|
23 /** |
|
24 @return - Instance of the test server |
|
25 */ |
|
26 CXml2TestServer* CXml2TestServer::NewL() |
|
27 { |
|
28 CXml2TestServer * server = new (ELeave) CXml2TestServer(); |
|
29 CleanupStack::PushL(server); |
|
30 server->ConstructL(KServerName); |
|
31 CleanupStack::Pop(server); |
|
32 return server; |
|
33 } |
|
34 /** |
|
35 * Standard 2 step constructor |
|
36 */ |
|
37 void CXml2TestServer::ConstructL(const TDesC& aName) |
|
38 { |
|
39 CTestServer::ConstructL(aName); |
|
40 } |
|
41 |
|
42 LOCAL_C void MainL() |
|
43 { |
|
44 |
|
45 CActiveScheduler* sched=new(ELeave) CActiveScheduler; |
|
46 CActiveScheduler::Install(sched); |
|
47 CXml2TestServer* server = NULL; |
|
48 // Create the CTestServer derived server |
|
49 TRAPD(err,server = CXml2TestServer::NewL()); |
|
50 if (KErrNone == err) |
|
51 { |
|
52 // Sync with the client and enter the active scheduler |
|
53 RProcess::Rendezvous(KErrNone); |
|
54 sched->Start(); |
|
55 } |
|
56 delete server; |
|
57 delete sched; |
|
58 } |
|
59 |
|
60 /** |
|
61 * Entry point for the executable |
|
62 */ |
|
63 GLDEF_C TInt E32Main() |
|
64 /** |
|
65 * @return - Standard Epoc error code on exit |
|
66 */ |
|
67 { |
|
68 __UHEAP_MARK; |
|
69 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
70 if (cleanup == NULL) |
|
71 { |
|
72 return KErrNoMemory; |
|
73 } |
|
74 TRAPD(err,MainL()); |
|
75 delete cleanup; |
|
76 |
|
77 __UHEAP_MARKEND; |
|
78 return err; |
|
79 } |
|
80 |
|
81 CTestStep* CXml2TestServer::CreateTestStep(const TDesC& aStepName) |
|
82 /** |
|
83 * @return - A CTestStep derived instance |
|
84 * Implementation of CTestServer pure virtual. |
|
85 * Based on the test step, instantiates appropriate CTestStep dervied class |
|
86 */ |
|
87 { |
|
88 CTestStep* testStep= NULL; |
|
89 |
|
90 if (aStepName == KXmlEngLeaveOOMStep1 || aStepName == KXmlEngLeaveOOMStep2) |
|
91 { |
|
92 testStep = new CXmlEngMemStep(aStepName); |
|
93 } |
|
94 else if (aStepName == KXmlEngXmlCharFromDes) |
|
95 { |
|
96 testStep = new CXmlUtilStep(aStepName); |
|
97 } |
|
98 else if (aStepName == KXmlEngEscapeForXmlValueStep1 || |
|
99 aStepName== KXmlEngEscapeForXmlValueStep2) |
|
100 { |
|
101 testStep = new CXmlUtilStep(aStepName); |
|
102 } |
|
103 else if (aStepName == KXmlEnginePushAndPop) |
|
104 { |
|
105 testStep = new CXmlEngineStep(aStepName); |
|
106 } |
|
107 else if (aStepName == KXmlStringCopy || |
|
108 aStepName == KXmlStringSetStep1 || |
|
109 aStepName == KXmlStringSetStep2 || |
|
110 aStepName == KXmlStringAlloc1 || |
|
111 aStepName == KXmlStringAlloc2 || |
|
112 aStepName == KXmlStringAllocAndFree1 || |
|
113 aStepName == KXmlStringAllocAndFree2 || |
|
114 aStepName == KXmlStringAppend || |
|
115 aStepName == KXmlStringCompare) |
|
116 { |
|
117 testStep = new CXmlStringStep(aStepName); |
|
118 } |
|
119 |
|
120 return testStep; |
|
121 } |