| 2218 |
sbetterm |
1 |
//---------------------------------------------------------------------------
|
|
|
2 |
|
|
|
3 |
#ifndef RunTestsH
|
|
|
4 |
#define RunTestsH
|
|
|
5 |
//---------------------------------------------------------------------------
|
|
|
6 |
#include <Classes.hpp>
|
|
|
7 |
#include <Controls.hpp>
|
|
|
8 |
#include <StdCtrls.hpp>
|
|
|
9 |
#include <Forms.hpp>
|
|
|
10 |
#include "Grids_ts.hpp"
|
|
|
11 |
#include "TSDBGrid.hpp"
|
|
|
12 |
#include "TSGrid.hpp"
|
|
|
13 |
#include <Buttons.hpp>
|
|
|
14 |
#include <ComCtrls.hpp>
|
|
|
15 |
#include <ExtCtrls.hpp>
|
|
|
16 |
#include <ToolWin.hpp>
|
|
|
17 |
#include <ADODB.hpp>
|
|
|
18 |
#include <DB.hpp>
|
|
|
19 |
#include "DataModule.h"
|
|
|
20 |
#include "TXMLSchema.h"
|
|
|
21 |
#include "AdvProgressBar.hpp"
|
|
|
22 |
#include <vector>
|
|
|
23 |
#include "Main.h"
|
|
|
24 |
//---------------------------------------------------------------------------
|
|
|
25 |
class TRunTestsForm : public TForm
|
|
|
26 |
{
|
|
|
27 |
__published: // IDE-managed Components
|
|
|
28 |
TToolBar *ToolBar1;
|
|
|
29 |
TToolButton *ToolButton1;
|
|
|
30 |
TSpeedButton *GenerateTransactions;
|
|
|
31 |
TToolButton *ToolButton3;
|
|
|
32 |
TPanel *Panel1;
|
|
|
33 |
TSplitter *Splitter1;
|
|
|
34 |
TPanel *Panel2;
|
|
|
35 |
TToolButton *ToolButton4;
|
|
|
36 |
TStatusBar *StatusBar;
|
|
|
37 |
TTreeView *TestCaseTxnTreeView;
|
|
|
38 |
TPanel *TestCaseTitle;
|
|
|
39 |
TComboBox *GenerationTargetComboBox;
|
|
|
40 |
TToolButton *ToolButton6;
|
|
|
41 |
TSpeedButton *SaveTxnsToFile;
|
|
|
42 |
TSpeedButton *SpeedButton1;
|
|
|
43 |
TPageControl *PageControl1;
|
|
|
44 |
TTabSheet *TabSheet3;
|
|
|
45 |
TtsGrid *PayloadGrid;
|
|
|
46 |
void __fastcall TestCaseTxnTreeViewChange(TObject *Sender,
|
|
|
47 |
TTreeNode *Node);
|
|
|
48 |
void __fastcall SaveTxnsToFileClick(TObject *Sender);
|
|
|
49 |
void __fastcall FormCreate(TObject *Sender);
|
|
|
50 |
void __fastcall StatusBarResize(TObject *Sender);
|
|
|
51 |
void __fastcall GenerateTransactionsClick(TObject *Sender);
|
|
|
52 |
|
|
|
53 |
private: // User declarations
|
|
|
54 |
AnsiString m_currentproject;
|
|
|
55 |
int m_currentiteration;
|
|
|
56 |
AnsiString m_testcase;
|
|
|
57 |
vector< AnsiString > m_xml_schemas;
|
|
|
58 |
TXMLSchema * m_XMLSchema;
|
|
|
59 |
AnsiString m_user_gen_dir;
|
|
|
60 |
TProgressBar * m_progressBarOld;
|
|
|
61 |
TAdvProgressBar * m_progressBar;
|
|
|
62 |
|
|
|
63 |
class TransactionArtefact
|
|
|
64 |
{
|
|
|
65 |
public:
|
|
|
66 |
TransactionArtefact( TXMLSchema & schema,
|
|
|
67 |
const string & name,
|
|
|
68 |
const unsigned short & udType )
|
|
|
69 |
: m_schema( &schema ),
|
|
|
70 |
m_name( name ),
|
|
|
71 |
m_udType( udType )
|
|
|
72 |
{
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
~TransactionArtefact()
|
|
|
76 |
{
|
|
|
77 |
m_schema->Destroy( m_handle );
|
|
|
78 |
m_schema = 0; // We don't own this.
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
void setHandle( const string & handle )
|
|
|
82 |
{
|
|
|
83 |
if ( m_handle.length() )
|
|
|
84 |
{
|
|
|
85 |
m_schema->Destroy( m_handle );;
|
|
|
86 |
}
|
|
|
87 |
m_handle = handle;
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
const string & getHandle( void ) const
|
|
|
91 |
{
|
|
|
92 |
return ( m_handle );
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
IterationParams & getIterationParameters( void )
|
|
|
96 |
{
|
|
|
97 |
return ( m_parameters );
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
const string & getName( void ) const
|
|
|
101 |
{
|
|
|
102 |
return ( m_name );
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
const unsigned short & getUdType( void ) const
|
|
|
106 |
{
|
|
|
107 |
return ( m_udType );
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
private:
|
|
|
111 |
TransactionArtefact();
|
|
|
112 |
TransactionArtefact( const TransactionArtefact & );
|
|
|
113 |
TransactionArtefact & operator=( const TransactionArtefact & );
|
|
|
114 |
|
|
|
115 |
private:
|
|
|
116 |
TXMLSchema * m_schema;
|
|
|
117 |
string m_handle; // handle to XML structure.
|
|
|
118 |
string m_name; // name of the XML structure.
|
|
|
119 |
unsigned short m_udType; // The ud type.
|
|
|
120 |
IterationParams m_parameters; // parameters for transaction.
|
|
|
121 |
};
|
|
|
122 |
typedef map< int, TransactionArtefact * > TransactionSchedule;
|
|
|
123 |
|
|
|
124 |
static const bool findSchema( vector< AnsiString > & xmlSchemas,
|
|
|
125 |
TXMLSchema & schema,
|
|
|
126 |
const AnsiString & currentProject,
|
|
|
127 |
const int & currentIteration );
|
|
|
128 |
void buildTranactionMap( TXNIndexMap & transactions,
|
|
|
129 |
const AnsiString & currentProject,
|
|
|
130 |
const int & currentIteration );
|
|
|
131 |
void buildHeader( string & handle,
|
|
|
132 |
TXMLSchema & schema,
|
|
|
133 |
vector< pair< string, string > > & macros,
|
|
|
134 |
const AnsiString & currentProject,
|
|
|
135 |
const int & currentIteration );
|
|
|
136 |
static const bool isMacro( const string & value );
|
|
|
137 |
static AnsiString & substituteMacro( AnsiString & value,
|
|
|
138 |
const unsigned short & udType );
|
|
|
139 |
static void substituteMacros( string & handle,
|
|
|
140 |
TXMLSchema & schema,
|
|
|
141 |
const vector< pair< string, string > > & macros,
|
|
|
142 |
const unsigned short & udType );
|
|
|
143 |
void generateScenario( const unsigned int & testscenario_no,
|
|
|
144 |
TXNIndexMap & mass_txns,
|
|
|
145 |
const bool & isTds,
|
|
|
146 |
string & headerHandle,
|
|
|
147 |
TransactionSchedule & transactionSchedule,
|
|
|
148 |
const vector< pair< string, string > > & macros,
|
|
|
149 |
const unsigned int & repeatCount,
|
|
|
150 |
const unsigned int & total,
|
|
|
151 |
const int & batchSk );
|
|
|
152 |
// TransactionArtefact * getTransactionArtefact(
|
|
|
153 |
// TransactionCache & transactionCache,
|
|
|
154 |
// const int & transactionSpecification,
|
|
|
155 |
// const string & structureName,
|
|
|
156 |
// const int & currentIteration,
|
|
|
157 |
// TXMLSchema & schema,
|
|
|
158 |
// const int & testScenario );
|
|
|
159 |
static void loadParameters(
|
|
|
160 |
IterationParams & parameters,
|
|
|
161 |
const int & testScenario,
|
|
|
162 |
const int & transactionSpecification );
|
|
|
163 |
static void readTransactionSchedule(
|
|
|
164 |
TADOConnection * database,
|
|
|
165 |
TXMLSchema & schema,
|
|
|
166 |
const int & currentIteration,
|
|
|
167 |
TXNIndexMap & massTransactions,
|
|
|
168 |
const int & testScenario,
|
|
|
169 |
TransactionSchedule & transactionSchedule );
|
|
|
170 |
|
|
|
171 |
void generateTestCase( void );
|
|
|
172 |
|
|
|
173 |
bool __fastcall InitialiseTxnStructure(const string &structure_handle, int subscript, IterationParams &structure_params);
|
|
|
174 |
|
|
|
175 |
public: // User declarations
|
|
|
176 |
__fastcall TRunTestsForm(TComponent* Owner);
|
|
|
177 |
void ShowForm(const AnsiString &testcase, const AnsiString &testname, const AnsiString &project, int currentiteration, const AnsiString &user_gen_dir, TXMLSchema *XMLSchema);
|
|
|
178 |
};
|
|
|
179 |
//---------------------------------------------------------------------------
|
|
|
180 |
extern PACKAGE TRunTestsForm *RunTestsForm;
|
|
|
181 |
//---------------------------------------------------------------------------
|
|
|
182 |
#endif
|