applayerprotocols/httptransportfw/Test/Acceptance/Iter2/multitrans.cpp
changeset 0 b16258d2340f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/applayerprotocols/httptransportfw/Test/Acceptance/Iter2/multitrans.cpp	Tue Feb 02 01:09:52 2010 +0200
@@ -0,0 +1,81 @@
+// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "multitrans.h"
+#include <http.h>
+
+_LIT(KRunTestItemName, "RunTest");
+_LIT(KSectionSingleTransaction, "MULTI_TRANS");
+
+
+void CHttpTestMultipleTransactions::DoRunL()
+	{
+	OpenTestSessionL(); // set up session and transaction here
+
+	for (TInt ii=0; ii< iTransactions.Count();++ii)
+		iTransactions[ii].SubmitL();
+	CActiveScheduler::Start();
+	CloseTestSession(); // close any strings, transaction and session
+	}
+
+
+
+
+void CHttpTestMultipleTransactions::OpenTestSessionL()
+	{
+	iSession.OpenL();
+	MHTTPAuthenticationCallback::InstallAuthenticationL(iSession);
+	iMyStrP = iSession.StringPool();
+
+	TBuf<24> sectionName;
+	sectionName.Format(KSectionSingleTransaction);
+	if (iIniFile->ItemValue(sectionName, KRunTestItemName, ETrue))
+		{
+		TInt count =FindEndOfTransaction(0) + 2; // search for first transaction, start from the item after that, skipping
+		// the item with the transaction= on it.
+		TInt endSection = iIniFile->Section(iSectionNumber).Items().Count();
+		while (count < endSection)
+			{
+			RHTTPTransaction transaction = CreateTransactionL(count);
+			User::LeaveIfError(iTransactions.Append(transaction));
+			count = FindEndOfTransaction(count);
+			}
+		}		
+	}
+
+void CHttpTestMultipleTransactions::CloseTestSession()
+	{
+	// Close strings used in this session before closing the session
+	//close Transaction and session
+	iTransaction.Close();
+	iEngine->Utils().LogIt(_L("Transaction terminated\n"));
+	iSession.Close();
+	iEngine->Utils().LogIt(_L("Session terminated"));
+	}
+
+CHttpTestMultipleTransactions* CHttpTestMultipleTransactions::NewL(CScriptFile& aIniFile, CScriptFile* aIniSettingsFile, const TInt aSectionNumber)
+	{
+	CHttpTestMultipleTransactions* self= new(ELeave) CHttpTestMultipleTransactions;
+	CleanupStack::PushL(self);
+	self->ConstructL(aIniFile, aIniSettingsFile, aSectionNumber);
+	CleanupStack::Pop();
+	return self;
+	}
+
+void CHttpTestMultipleTransactions::ConstructL(CScriptFile& aIniFile, CScriptFile* aIniSettingsFile, const TInt aSectionNumber)
+	{
+	CHttpTestTransactions::ConstructL(aIniFile, aIniSettingsFile, aSectionNumber);	
+	}
+