applayerprotocols/httptransportfw/Test/TestScriptTest/CPipeliningTestParams.h
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2003-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 #ifndef __CPIPELININGTESTPARAMS_H__
       
    17 #define __CPIPELININGTESTPARAMS_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 
       
    21 
       
    22 class CHTTPTestUtils;
       
    23 
       
    24 
       
    25 
       
    26 typedef struct TransInfo_
       
    27 {
       
    28 	/*Array for Header types to add to transactions, presently only size 3, 
       
    29 	index 0 - HTTP & index 1 for Connection, 2 for Transaction - to cancel
       
    30 	0 in the index means default header ( http 1.1 & no connection close),
       
    31 	if there is a value other than 0, it means there is information
       
    32 	in the TransHeaderInfo array at the value index,
       
    33 	eg: value 4 in index 1 of TransHeaderType means 
       
    34 	Connection header has some value in the 4th index of the TransHeaderInfo array
       
    35 	*/
       
    36 	TInt					TransType;
       
    37 	RArray < TInt >			TransHeaderTypeArr; 
       
    38 	RPointerArray < HBufC > TransHeaderInfoPtrArr;
       
    39 } TransInfo;
       
    40 
       
    41 enum TArrayType
       
    42 	{
       
    43 	ERequestArray = 1,
       
    44 	EResponseArray,
       
    45 	ETransactionArray
       
    46 	};
       
    47 
       
    48 /*	Pipelining parameters - configured from ini file, and passed to testCase constructor
       
    49 */
       
    50 class CPipeliningTestParams : public CBase
       
    51 	{
       
    52 public:
       
    53 	static CPipeliningTestParams* NewL(CHTTPTestUtils& aTestUtils);
       
    54 		
       
    55 	//Parse "\n", "\r" with '\r', \n' and " with null
       
    56 	void RemoveQuotes(HBufC16* aHBuf16Ptr);
       
    57 	void RemoveQuotes(HBufC8* aHBuf8Ptr);
       
    58 	
       
    59 	void ParseReplaceCRLF(HBufC8* aHBuf8Ptr);
       
    60 	void ParseReplaceCRLF(HBufC16* aHBuf16Ptr);
       
    61 	
       
    62 	//Run Test
       
    63 	TBool	RunTest() const;
       
    64 	void SetRunTest(const TDesC& aRunTest);
       
    65 	
       
    66 	//Batching Enabled
       
    67 	TBool BatchingEnabled() const;
       
    68 	void EnableBatching(const TDesC& aIsBatchingEnabled);
       
    69 	
       
    70 	//Pipelining Enabled
       
    71 	TBool PipeliningEnabled() const;			
       
    72 	void EnablePipelining(const TDesC& aIsPipeliningEnabled);
       
    73 	
       
    74 	//Buffer Size
       
    75 	TInt	BufferSize() const;
       
    76 	void SetBufferSize(const TDesC& aBufferSize);
       
    77 	
       
    78 	//Uri
       
    79 	TDesC8&	UriL(TInt aUriIndex) const;
       
    80 	TInt UriCount() const;
       
    81 	void SetUriL(TInt aUriIndex, const TDesC& aUri);
       
    82 	
       
    83 	//Error
       
    84 	TInt Error() const;
       
    85 	void SetErrorL(const TDesC& aError);
       
    86 
       
    87 	//Connection Count
       
    88 	TInt ConnectionCount() const;
       
    89 	void SetConnectionCount(const TDesC& aConnectionCount);
       
    90 	
       
    91 	//Request Method Type
       
    92 	void SetReqMethodL(const TDesC& aReqMethod);
       
    93 	TDesC16& ReqMethod();
       
    94 	
       
    95 	//Total TransactionCount
       
    96 	TInt TotalTransactionCount() const;
       
    97 	void SetTotalTransactionCount(const TDesC& aTotalTransCount);
       
    98 	void DecreaseTotalTransactionCount() const;
       
    99 	
       
   100 	//TransactionCount - returns the size of the connReqArray
       
   101 	TInt TransactionCount(TInt aConnIndex) const;
       
   102 	
       
   103 	//TestCase Name
       
   104 	TDesC&	TestCaseName() const;
       
   105 	void SetTestCaseNameL(const TDesC& aTestCaseName );
       
   106 	
       
   107 	//Common to request and response arrays
       
   108 	//Input TInt aInt : Use 1 for requestarr, 2 for responsearr, 3 for transactionarr
       
   109 	void SetSequenceArrL(const TDesC& aArrAsStr, TInt aInt);
       
   110 	TInt TransactionSequenceArray(TInt aIndex) const;
       
   111 	
       
   112 	//Raw Request
       
   113 	TDesC8&	RawRequest(TInt aConnIndex, TInt aTransIndex) const; // returns based on the connection index after checking 2d array
       
   114 	TDesC8& RawRequest(TInt aRawRequestBufArrIndex ) const; //returns value in the rarray based on index
       
   115 	void SetRawRequestL(TInt aConnIndex, const TDesC& aRawRequest);	
       
   116 	
       
   117 	
       
   118 	//Raw Response
       
   119 	TDesC8&	RawResponse(TInt aConnIndex, TInt aTransIndex) const;
       
   120 	TDesC8&	RawResponse( TInt aRawResponseBufArrIndex ) const;
       
   121 	void SetRawResponseL(TInt aConnIndex, const TDesC& aRawResponse);
       
   122 	
       
   123 	
       
   124 	//Transaction Types
       
   125 	TransInfo& TransactionType(TInt transTypeNum) const; //Returns a long string like transInfo in SetTransType()
       
   126 	
       
   127 	//1. Creates a new instance of TransInfo struct,
       
   128 	//2. Sets all information of TransInfo by
       
   129 	//	a. Sets the TransInfo->TransType to transTypeNumber passed by function
       
   130 	//	b. Parsing the given string for ',' demiliter
       
   131 	//	c. Parsing string returned by step 2.a for ':' delimiter
       
   132 	//	d. sets the second part of string returned by 2.b in the string to TransInfo->TransHeaderInfoPtrArr
       
   133 	//		checking if first part of string returned by 2.b is HTTP or Connection
       
   134 	//		if HTTP, then sets TransInfo->TransHeaderTypeArr[0] to count of TransInfo->TransHeaderInfoPtrArr
       
   135 	//		else sets TransInfo->TransHeaderTypeArr[1]
       
   136 	//
       
   137 	// Returns the index of the TransType created in iTransTypesInfoPtrArr
       
   138 	TInt SetTransactionTypeL(TInt transTypeNumber, TDesC& transInfoDesc);
       
   139 	
       
   140 	//Header to Process for test cases cheaderdecode, cinc052596, cinc037440, cpipeliningconfigtest
       
   141 	TBool	ProcessHeader()	const;
       
   142 	TInt NumHdrs() const;
       
   143 	TDesC8&	 HeaderToProcess(TInt aHdrIdx) const;
       
   144 	void SetHeaderToProcessL(const TInt aHdrIdx, const TDesC& aHdrName );		
       
   145 	
       
   146 	//Value expected for the header
       
   147 	TInt NumberOfHeaderVals(const TInt aCtr) const;
       
   148 	TDesC8& HeaderVal(const TInt aHdrCtr, const TInt aHdrValCtr ) const;
       
   149 	void SetHdrValL(const TInt aHdrCtr, const TInt aHdrValIdx, const TDesC& aHdrVal);
       
   150 	
       
   151 	//Validate: To check if the params are configured correctly.
       
   152 	//If no, leave with error number defined in TestParamsErr.h
       
   153 	void ValidateL() const;
       
   154 	
       
   155 	//Destructor	
       
   156 	~CPipeliningTestParams();
       
   157 	
       
   158 private:
       
   159 	CPipeliningTestParams(CHTTPTestUtils& aTestUtils);
       
   160 	CPipeliningTestParams(const CPipeliningTestParams& aPipeliningTestParams);
       
   161 	
       
   162 private:
       
   163 	TBool							iRunTest;
       
   164 	HBufC*							iTestCaseNameBuf;
       
   165 	TBool							iBatchingEnabled;
       
   166 	TBool							iPipeliningEnabled;
       
   167 	TInt							iBufferSize;
       
   168 	RArray < HBufC8* >				iUriBufArr;
       
   169 	TInt							iConnectionCount;
       
   170 	HBufC*							iReqMethod;
       
   171 	TInt							iError;
       
   172 	mutable TInt					iTotalTransactionCount;
       
   173 	RArray < TInt >					iTransArr;
       
   174 	RPointerArray < TransInfo >		iTransTypesInfoPtrArr;
       
   175 	RArray < HBufC8* >				iRawRequestBufArr;	
       
   176 	RArray < HBufC8* >				iRawResponseBufArr;
       
   177 	RArray < RArray < TInt 	>	>	iConnReq2DArr;
       
   178 	RArray < RArray < TInt 	>	>	iConnResp2DArr;
       
   179 	RArray < TBool >				iProcessHdrArr;
       
   180 	TBool			 				iProcessHdr;
       
   181 	RArray < HBufC8* >				iHeader2ProcessArr;
       
   182 	RArray < RArray < HBufC8* > >	iHdrVal2DArr;
       
   183 	
       
   184 	CHTTPTestUtils&			iTestUtils;
       
   185 	
       
   186 	};
       
   187 
       
   188 #endif // __CPIPELININGTESTPARAMS_H__