diff -r 5cc91383ab1e -r 7333d7932ef7 installationservices/swtransactionservices/test/source/tststestsuiteserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/installationservices/swtransactionservices/test/source/tststestsuiteserver.cpp Tue Aug 31 15:21:33 2010 +0300 @@ -0,0 +1,269 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "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: +* +*/ + + +/** + @file + @test + @internalComponent +*/ +#include "tststestsuitestepcommon.h" +#include "tststestsuiteserver.h" +#include "tststestsuitestep.h" +#include "tintegrityservicesstep.h" + +using namespace Usif; + +LOCAL_C void MainL() + { + CActiveScheduler* sched=NULL; + sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CStsTestServer* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CStsTestServer::NewL()); + if(!err) + { + // Sync with the client and enter the active scheduler + RProcess::Rendezvous(KErrNone); + sched->Start(); + } + delete server; + delete sched; + } + + +TInt E32Main() +/** + @return - Standard Epoc error code on process exit + Process entry point. Called by client using RProcess API + */ + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + if(cleanup == NULL) + { + return KErrNoMemory; + } + TRAPD(err,MainL()); + delete cleanup; + __UHEAP_MARKEND; + return err; + } + +_LIT(KServerName,"tststestserver"); + +CStsTestServer* CStsTestServer::NewL() +/** + @return - Instance of the test server + Called inside the MainL() function to create and start the + CTestServer derived server. + */ + { + CStsTestServer * server = new (ELeave) CStsTestServer(); + CleanupStack::PushL(server); + server-> ConstructL(); + CleanupStack::Pop(server); + return server; + } + +void CStsTestServer::ConstructL() + { + CTestServer::ConstructL(KServerName); + User::LeaveIfError(iTestutil.Connect()); + iTestutil.ShareAuto(); + } + +CStsTestServer::~CStsTestServer() + { + for(TInt i=0; i=maxNumberOfSessions) + { + ERR_PRINTF2(_L("Position %d is out of boundaries!"), aPos); + User::Leave(KErrArgument); + } + return iSessions[aPos]; + } + +TStsTransactionId CStsTestServer::GetTransactionIDL(TInt aPos) + { + return GetSessionL(aPos).TransactionIdL(); + } +