applayerprotocols/httptransportfw/Test/Acceptance/Iter2/multitrans.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2004-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 #include "multitrans.h"
       
    17 #include <http.h>
       
    18 
       
    19 _LIT(KRunTestItemName, "RunTest");
       
    20 _LIT(KSectionSingleTransaction, "MULTI_TRANS");
       
    21 
       
    22 
       
    23 void CHttpTestMultipleTransactions::DoRunL()
       
    24 	{
       
    25 	OpenTestSessionL(); // set up session and transaction here
       
    26 
       
    27 	for (TInt ii=0; ii< iTransactions.Count();++ii)
       
    28 		iTransactions[ii].SubmitL();
       
    29 	CActiveScheduler::Start();
       
    30 	CloseTestSession(); // close any strings, transaction and session
       
    31 	}
       
    32 
       
    33 
       
    34 
       
    35 
       
    36 void CHttpTestMultipleTransactions::OpenTestSessionL()
       
    37 	{
       
    38 	iSession.OpenL();
       
    39 	MHTTPAuthenticationCallback::InstallAuthenticationL(iSession);
       
    40 	iMyStrP = iSession.StringPool();
       
    41 
       
    42 	TBuf<24> sectionName;
       
    43 	sectionName.Format(KSectionSingleTransaction);
       
    44 	if (iIniFile->ItemValue(sectionName, KRunTestItemName, ETrue))
       
    45 		{
       
    46 		TInt count =FindEndOfTransaction(0) + 2; // search for first transaction, start from the item after that, skipping
       
    47 		// the item with the transaction= on it.
       
    48 		TInt endSection = iIniFile->Section(iSectionNumber).Items().Count();
       
    49 		while (count < endSection)
       
    50 			{
       
    51 			RHTTPTransaction transaction = CreateTransactionL(count);
       
    52 			User::LeaveIfError(iTransactions.Append(transaction));
       
    53 			count = FindEndOfTransaction(count);
       
    54 			}
       
    55 		}		
       
    56 	}
       
    57 
       
    58 void CHttpTestMultipleTransactions::CloseTestSession()
       
    59 	{
       
    60 	// Close strings used in this session before closing the session
       
    61 	//close Transaction and session
       
    62 	iTransaction.Close();
       
    63 	iEngine->Utils().LogIt(_L("Transaction terminated\n"));
       
    64 	iSession.Close();
       
    65 	iEngine->Utils().LogIt(_L("Session terminated"));
       
    66 	}
       
    67 
       
    68 CHttpTestMultipleTransactions* CHttpTestMultipleTransactions::NewL(CScriptFile& aIniFile, CScriptFile* aIniSettingsFile, const TInt aSectionNumber)
       
    69 	{
       
    70 	CHttpTestMultipleTransactions* self= new(ELeave) CHttpTestMultipleTransactions;
       
    71 	CleanupStack::PushL(self);
       
    72 	self->ConstructL(aIniFile, aIniSettingsFile, aSectionNumber);
       
    73 	CleanupStack::Pop();
       
    74 	return self;
       
    75 	}
       
    76 
       
    77 void CHttpTestMultipleTransactions::ConstructL(CScriptFile& aIniFile, CScriptFile* aIniSettingsFile, const TInt aSectionNumber)
       
    78 	{
       
    79 	CHttpTestTransactions::ConstructL(aIniFile, aIniSettingsFile, aSectionNumber);	
       
    80 	}
       
    81