| 2263 |
kivins |
1 |
//## begin module%1.7%.codegen_version preserve=yes
|
|
|
2 |
// Read the documentation to learn more about C++ code generator
|
|
|
3 |
// versioning.
|
|
|
4 |
//## end module%1.7%.codegen_version
|
|
|
5 |
|
|
|
6 |
//## begin module%41FF0DE8006D.cm preserve=no
|
|
|
7 |
//## end module%41FF0DE8006D.cm
|
|
|
8 |
|
|
|
9 |
//## begin module%41FF0DE8006D.cp preserve=no
|
|
|
10 |
// C O P Y R I G H T N O T I C E
|
|
|
11 |
// This material is confidential to ERG and may not be disclosed in whole
|
|
|
12 |
// or in part to any third party nor used in any manner whatsoever other
|
|
|
13 |
// than for the purposes expressly consented to by ERG in writing.
|
|
|
14 |
//
|
|
|
15 |
// This material is also copyright and may not be reproduced, stored in a
|
|
|
16 |
// retrieval system or transmitted in any form or by any means in whole or
|
|
|
17 |
// in part without the express written consent of ERG.
|
|
|
18 |
//## end module%41FF0DE8006D.cp
|
|
|
19 |
|
|
|
20 |
//## Module: TestScenarioTemplate%41FF0DE8006D; Pseudo Package body
|
|
|
21 |
//## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4
|
|
|
22 |
//## Source file: Z:\MASS_Dev\Tools\TxnTestManager\src\TestScenarioTemplate.cpp
|
|
|
23 |
|
|
|
24 |
//## begin module%41FF0DE8006D.additionalIncludes preserve=no
|
|
|
25 |
//## end module%41FF0DE8006D.additionalIncludes
|
|
|
26 |
|
|
|
27 |
//## begin module%41FF0DE8006D.includes preserve=yes
|
|
|
28 |
#pragma warn -com
|
|
|
29 |
#include <LoggingMacros.h>
|
|
|
30 |
#pragma warn +com
|
|
|
31 |
//## end module%41FF0DE8006D.includes
|
|
|
32 |
|
|
|
33 |
// TransactionFieldTemplate
|
|
|
34 |
#include "TransactionFieldTemplate.h"
|
|
|
35 |
// TestScenarioTemplate
|
|
|
36 |
#include "TestScenarioTemplate.h"
|
|
|
37 |
//## begin module%41FF0DE8006D.additionalDeclarations preserve=yes
|
|
|
38 |
//## end module%41FF0DE8006D.additionalDeclarations
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
// Class TestScenarioTemplate
|
|
|
42 |
|
|
|
43 |
//## Operation: TestScenarioTemplate%41FF0F6F0398
|
|
|
44 |
TestScenarioTemplate::TestScenarioTemplate (const int &scenario)
|
|
|
45 |
//## begin TestScenarioTemplate::TestScenarioTemplate%41FF0F6F0398.hasinit preserve=no
|
|
|
46 |
//## end TestScenarioTemplate::TestScenarioTemplate%41FF0F6F0398.hasinit
|
|
|
47 |
//## begin TestScenarioTemplate::TestScenarioTemplate%41FF0F6F0398.initialization preserve=yes
|
|
|
48 |
|
|
|
49 |
: m_scenario( scenario )
|
|
|
50 |
|
|
|
51 |
//## end TestScenarioTemplate::TestScenarioTemplate%41FF0F6F0398.initialization
|
|
|
52 |
{
|
|
|
53 |
//## begin TestScenarioTemplate::TestScenarioTemplate%41FF0F6F0398.body preserve=yes
|
|
|
54 |
//## end TestScenarioTemplate::TestScenarioTemplate%41FF0F6F0398.body
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
TestScenarioTemplate::~TestScenarioTemplate()
|
|
|
59 |
{
|
|
|
60 |
//## begin TestScenarioTemplate::~TestScenarioTemplate%41FF0DE8006D_dest.body preserve=yes
|
|
|
61 |
|
|
|
62 |
for ( std::map< std::string, TransactionFieldTemplate * >::iterator
|
|
|
63 |
where = m_fieldTemplate.begin();
|
|
|
64 |
where != m_fieldTemplate.end();
|
|
|
65 |
++where )
|
|
|
66 |
{
|
|
|
67 |
delete where->second;
|
|
|
68 |
where->second = 0;
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
//## end TestScenarioTemplate::~TestScenarioTemplate%41FF0DE8006D_dest.body
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
//## Other Operations (implementation)
|
|
|
77 |
//## Operation: findMatch%41FF6BF70156
|
|
|
78 |
const unsigned TestScenarioTemplate::findMatch (std::string &value, const std::string &xpath) const
|
|
|
79 |
{
|
|
|
80 |
//## begin TestScenarioTemplate::findMatch%41FF6BF70156.body preserve=yes
|
|
|
81 |
|
|
|
82 |
unsigned count = 0;
|
|
|
83 |
|
|
|
84 |
for ( std::map< std::string, TransactionFieldTemplate * >::const_iterator
|
|
|
85 |
where = m_fieldTemplate.begin();
|
|
|
86 |
where != m_fieldTemplate.end();
|
|
|
87 |
++where )
|
|
|
88 |
{
|
|
|
89 |
if ( where->second->isMatch( xpath ) )
|
|
|
90 |
{
|
|
|
91 |
value = where->second->getValue();
|
|
|
92 |
|
|
|
93 |
++count;
|
|
|
94 |
}
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
return ( count );
|
|
|
98 |
|
|
|
99 |
//## end TestScenarioTemplate::findMatch%41FF6BF70156.body
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
//## Operation: getField%41FF214B013F
|
|
|
103 |
TransactionFieldTemplate& TestScenarioTemplate::getField (const std::string ®ularExpression)
|
|
|
104 |
{
|
|
|
105 |
//## begin TestScenarioTemplate::getField%41FF214B013F.body preserve=yes
|
|
|
106 |
|
|
|
107 |
std::map< std::string, TransactionFieldTemplate * >::const_iterator
|
|
|
108 |
instance = m_fieldTemplate.find( regularExpression );
|
|
|
109 |
|
|
|
110 |
if ( instance != m_fieldTemplate.end() )
|
|
|
111 |
{
|
|
|
112 |
return ( *instance->second );
|
|
|
113 |
}
|
|
|
114 |
else
|
|
|
115 |
{
|
|
|
116 |
TransactionFieldTemplate * field = 0;
|
|
|
117 |
|
|
|
118 |
try
|
|
|
119 |
{
|
|
|
120 |
field = new TransactionFieldTemplate( regularExpression );
|
|
|
121 |
|
|
|
122 |
if ( m_fieldTemplate.insert(
|
|
|
123 |
std::map< std::string, TransactionFieldTemplate * >::value_type(
|
|
|
124 |
regularExpression,
|
|
|
125 |
field ) ).second )
|
|
|
126 |
{
|
|
|
127 |
return ( *field );
|
|
|
128 |
}
|
|
|
129 |
else
|
|
|
130 |
{
|
|
|
131 |
MTHROW( std::runtime_error, \
|
|
|
132 |
"Cannot add field \"" \
|
|
|
133 |
<< regularExpression \
|
|
|
134 |
<< "\" to transaction " \
|
|
|
135 |
<< m_scenario \
|
|
|
136 |
<< '.' );
|
|
|
137 |
}
|
|
|
138 |
}
|
|
|
139 |
catch ( ... )
|
|
|
140 |
{
|
|
|
141 |
delete field;
|
|
|
142 |
field = 0;
|
|
|
143 |
|
|
|
144 |
throw;
|
|
|
145 |
}
|
|
|
146 |
}
|
|
|
147 |
|
|
|
148 |
//## end TestScenarioTemplate::getField%41FF214B013F.body
|
|
|
149 |
}
|
|
|
150 |
|
|
|
151 |
//## Operation: getTemplateCount%41FF409A021F
|
|
|
152 |
const unsigned TestScenarioTemplate::getTemplateCount () const
|
|
|
153 |
{
|
|
|
154 |
//## begin TestScenarioTemplate::getTemplateCount%41FF409A021F.body preserve=yes
|
|
|
155 |
|
|
|
156 |
return ( m_fieldTemplate.size() );
|
|
|
157 |
|
|
|
158 |
//## end TestScenarioTemplate::getTemplateCount%41FF409A021F.body
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
// Additional Declarations
|
|
|
162 |
//## begin TestScenarioTemplate%41FF0DE8006D.declarations preserve=yes
|
|
|
163 |
//## end TestScenarioTemplate%41FF0DE8006D.declarations
|
|
|
164 |
|
|
|
165 |
//## begin module%41FF0DE8006D.epilog preserve=yes
|
|
|
166 |
//## end module%41FF0DE8006D.epilog
|