Subversion Repositories DevTools

Rev

Rev 2222 | Rev 2226 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2222 Rev 2224
Line 16... Line 16...
16
#include "EvaluationContext.h"
16
#include "EvaluationContext.h"
17
#include "FieldExpression.h"
17
#include "FieldExpression.h"
18
#include "FileCtrl.hpp"
18
#include "FileCtrl.hpp"
19
#include "GenerationProperties.h"
19
#include "GenerationProperties.h"
20
#include "ICryptographicServerProxy.h"
20
#include "ICryptographicServerProxy.h"
-
 
21
#include "ImportTransactionParameters.h"
21
#include "InitProgress.h"
22
#include "InitProgress.h"
22
#include "IMessageDigest.h"
23
#include "IMessageDigest.h"
23
#include "ISecurityWrapperFactory.h"
24
#include "ISecurityWrapperFactory.h"
24
#include "Iteration.h"
25
#include "Iteration.h"
25
#include "IterationConfig.h"
26
#include "IterationConfig.h"
Line 44... Line 45...
44
#include "TransactionSpecification.h"
45
#include "TransactionSpecification.h"
45
#include "TransactionSpecificationValue.h"
46
#include "TransactionSpecificationValue.h"
46
#include "TransactionSpecificationValueKey.h"
47
#include "TransactionSpecificationValueKey.h"
47
#include "TransactionStream.h"
48
#include "TransactionStream.h"
48
#include "TransactionTemplateCollection.h"
49
#include "TransactionTemplateCollection.h"
-
 
50
#include "UdDrainFile.h"
49
#include "Utilities.h"
51
#include "Utilities.h"
50
#include <algorithm>
52
#include <algorithm>
51
#include <ctype.h>
53
#include <ctype.h>
52
 
54
 
53
//---------------------------------------------------------------------------
55
//---------------------------------------------------------------------------
Line 3808... Line 3810...
3808
		query = 0;
3810
		query = 0;
3809
	}
3811
	}
3810
}
3812
}
3811
//---------------------------------------------------------------------------
3813
//---------------------------------------------------------------------------
3812
 
3814
 
3813
void __fastcall TMainForm::loadLegacyVariables( DefinedVariableTable & variables, const AnsiString & project, const int & iteration )
3815
void __fastcall TMainForm::loadLegacyVariables( DefinedVariableTable & variables, const AnsiString & project, Iteration & iteration )
3814
{
3816
{
3815
	TADOQuery * query = 0;
3817
	TADOQuery * query = 0;
3816
	try
3818
	try
3817
	{
3819
	{
3818
		query = new TADOQuery( this );
3820
		query = new TADOQuery( this );
Line 3828... Line 3830...
3828
				"ITERATION_PARAMS "
3830
				"ITERATION_PARAMS "
3829
			"WHERE "
3831
			"WHERE "
3830
				"PROJECT_CODE=\'%s\' AND "
3832
				"PROJECT_CODE=\'%s\' AND "
3831
				"ITERATION=%d",
3833
				"ITERATION=%d",
3832
			project.c_str(),
3834
			project.c_str(),
3833
			iteration );
3835
			iteration.getIterationId() );
3834
		query->SQL->Text = sqlStatement;
3836
		query->SQL->Text = sqlStatement;
3835
		query->Open();
3837
		query->Open();
3836
 
3838
 
3837
		AnsiString			fieldName;
3839
		AnsiString			fieldName;
3838
		AnsiString			xpath;
3840
		AnsiString			xpath;
3839
		AnsiString			value;
3841
		AnsiString			value;
-
 
3842
		bool				qualified;
3840
		DefinedVariable *	variable;
3843
		DefinedVariable *	variable;
3841
		while ( !query->Eof )
3844
		while ( !query->Eof )
3842
		{
3845
		{
3843
			fieldName	= query->FieldByName( "NAME" )->AsString;
3846
			fieldName	= query->FieldByName( "NAME" )->AsString;
3844
			value		= query->FieldByName( "FIELDVALUE" )->AsString;
3847
			value		= query->FieldByName( "FIELDVALUE" )->AsString;
Line 3868... Line 3871...
3868
				}
3871
				}
3869
			}
3872
			}
3870
 
3873
 
3871
			if ( !fieldName.IsEmpty() )
3874
			if ( !fieldName.IsEmpty() )
3872
			{
3875
			{
-
 
3876
				qualified = !query->FieldByName( "TESTSCENARIO_NO" )->IsNull;
-
 
3877
 
3873
				switch ( fieldName[ 1 ] )
3878
				switch ( fieldName[ 1 ] )
3874
				{
3879
				{
3875
				case '$':	// We don't worry about fields here.
3880
				case '$':	// We don't worry about fields here.
3876
					break;
3881
					break;
3877
				case '@':
3882
				case '@':
-
 
3883
					if ( qualified )
-
 
3884
					{
3878
					variable = &variables.getDefinedVariable(
3885
						variable = &variables.defineVariable(
-
 
3886
							fieldName.c_str() + 1,
-
 
3887
							iteration.getTestScenario(
-
 
3888
								query->FieldByName( "TESTSCENARIO_NO" )
-
 
3889
									->AsInteger ) );
-
 
3890
					}
-
 
3891
					else
-
 
3892
					{
-
 
3893
						variable = &variables.defineVariable(
3879
						fieldName.c_str() + 1 );
3894
							fieldName.c_str() + 1 );
-
 
3895
					}
3880
					variable->setExpression( value.c_str() );
3896
					variable->setExpression( value.c_str() );
3881
					break;
3897
					break;
3882
				default:
3898
				default:
3883
					break;
3899
					break;
3884
				}
3900
				}
Line 4114... Line 4130...
4114
				iteration,
4130
				iteration,
4115
				TestCaseQuery->FieldByName( "TESTCASE_ID" )->AsString.c_str() );
4131
				TestCaseQuery->FieldByName( "TESTCASE_ID" )->AsString.c_str() );
4116
			loadLegacyVariables(
4132
			loadLegacyVariables(
4117
				definedVariableTable,
4133
				definedVariableTable,
4118
				m_currentproject.c_str(),
4134
				m_currentproject.c_str(),
4119
				m_currentiteration );
4135
				iteration );
4120
			readSequences(
4136
			readSequences(
4121
				sequences,
4137
				sequences,
4122
				m_currentproject.c_str(),
4138
				m_currentproject.c_str(),
4123
				m_currentiteration );
4139
				m_currentiteration );
4124
 
4140
 
Line 5000... Line 5016...
5000
void __fastcall TMainForm::TransactionGridRowChanging( TADOQuery & query, const char * structureName )
5016
void __fastcall TMainForm::TransactionGridRowChanging( TADOQuery & query, const char * structureName )
5001
{
5017
{
5002
	TxnFieldComments->Lines->Clear();
5018
	TxnFieldComments->Lines->Clear();
5003
	FieldEnumValues->Clear();
5019
	FieldEnumValues->Clear();
5004
	FieldDatatype->Clear();
5020
	FieldDatatype->Clear();
-
 
5021
	DocDataType->Clear();
5005
 
5022
 
5006
	if ( query.State != dsInactive && query.RecordCount )
5023
	if ( query.State != dsInactive && query.RecordCount )
5007
	{
5024
	{
5008
		if (!m_schema_handle.empty())
5025
		if (!m_schema_handle.empty())
5009
		{
5026
		{
Line 5016... Line 5033...
5016
 
5033
 
5017
				string	field_path = FindField(structure_handle, fieldtag);
5034
				string	field_path = FindField(structure_handle, fieldtag);
5018
 
5035
 
5019
				if (!field_path.empty())
5036
				if (!field_path.empty())
5020
				{
5037
				{
5021
					string	fieldcomments;
5038
					std::string	fieldcomments;
5022
					string	datatype;
5039
					std::string	datatype;
-
 
5040
					std::string	docdatatype;
5023
 
5041
 
5024
					XMLSchema->GetAttributeProperty(field_path, "comments", fieldcomments);
5042
					XMLSchema->GetAttributeProperty(field_path, "comments", fieldcomments);
5025
					TxnFieldComments->Lines->Add(fieldcomments.c_str());
5043
					TxnFieldComments->Lines->Add(fieldcomments.c_str());
5026
 
5044
 
5027
					XMLSchema->GetAttributeProperty(field_path, "datatype", datatype);
5045
					XMLSchema->GetAttributeProperty(field_path, "datatype", datatype);
5028
					FieldDatatype->Text = datatype.c_str();
5046
					FieldDatatype->Text = datatype.c_str();
5029
 
5047
 
-
 
5048
					XMLSchema->GetAttributeProperty(field_path, "docdatatype", docdatatype );
-
 
5049
					DocDataType->Text = docdatatype.c_str();
-
 
5050
 
5030
					string valuemap;
5051
					string valuemap;
5031
 
5052
 
5032
					XMLSchema->GetAttributeProperty(field_path, "valuemap", valuemap);
5053
					XMLSchema->GetAttributeProperty(field_path, "valuemap", valuemap);
5033
 
5054
 
5034
					if (!valuemap.empty())
5055
					if (!valuemap.empty())
Line 5164... Line 5185...
5164
		}
5185
		}
5165
	}
5186
	}
5166
}
5187
}
5167
//---------------------------------------------------------------------------
5188
//---------------------------------------------------------------------------
5168
 
5189
 
-
 
5190
void __fastcall TMainForm::ImportTransactionActionExecute(TObject *Sender)
-
 
5191
{
-
 
5192
	TTreeNode * currentNode = TestCaseTreeView->Selected;
-
 
5193
 
-
 
5194
	if ( currentNode )
-
 
5195
	{
-
 
5196
		// Are we importing a scenario, or a single transaction?
-
 
5197
		if ( currentNode->Level == 0 )
-
 
5198
		{
-
 
5199
			const int testScenarioNumber
-
 
5200
				= reinterpret_cast< int >( currentNode->Data );
-
 
5201
 
-
 
5202
			if ( ImportTransactionParametersForm->ShowModal() == mrOk )
-
 
5203
			{
-
 
5204
				for ( int i=0; i<ImportTransactionParametersForm->ImportFileListBox->Items->Count; i++ )
-
 
5205
				{
-
 
5206
					if ( ImportTransactionParametersForm->ImportFileListBox->Selected[ i ] )
-
 
5207
					{
-
 
5208
						importTransaction(
-
 
5209
							testScenarioNumber,
-
 
5210
							ImportTransactionParametersForm
-
 
5211
								->ImportProfileComboBox->Text,
-
 
5212
							ImportTransactionParametersForm
-
 
5213
								->ImportFileListBox->Items->Strings[ i ] );
-
 
5214
					}
-
 
5215
				}
-
 
5216
			}
-
 
5217
		}
-
 
5218
	}
-
 
5219
}
-
 
5220
//---------------------------------------------------------------------------
-
 
5221
 
-
 
5222
void __fastcall TMainForm::importTransaction( const int & testScenarioNumber, const AnsiString & profile, const AnsiString & file )
-
 
5223
{
-
 
5224
	UdDrainFile drainFile(
-
 
5225
		*XMLSchema->GetSchemaWrapperFactory(),
-
 
5226
		*XMLSchema->GetSchema() );
-
 
5227
 
-
 
5228
	if ( drainFile.read( profile == "TDS", m_currentiteration, file.c_str() ) )
-
 
5229
	{
-
 
5230
		const unsigned int count = drainFile.getTransactionCount();
-
 
5231
		for ( unsigned int transaction=0; transaction<=count; ++transaction )
-
 
5232
		{
-
 
5233
			// add each transaction to the identified test scenario number.
-
 
5234
		}
-
 
5235
	}
-
 
5236
}
-
 
5237
//---------------------------------------------------------------------------
-
 
5238