sl@0: /* sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include "tupsintegserver.h" sl@0: #include "tupsclientstep.h" sl@0: #include sl@0: #include "tupspropertystep.h" sl@0: #include "tups_utils.h" sl@0: #include "tups_minortests.h" sl@0: #include "tupsdbmanagementstep.h" sl@0: #include "tupscoordinatorstep.h" sl@0: sl@0: sl@0: CTUpsSuite* CTUpsSuite::NewL(const TDesC& aName) sl@0: /** sl@0: * @return - Instance of the test server sl@0: */ sl@0: { sl@0: CTUpsSuite * server = new (ELeave) CTUpsSuite(); sl@0: CleanupStack::PushL(server); sl@0: server->ConstructL(aName); sl@0: CleanupStack::Pop(server); sl@0: return server; sl@0: } sl@0: sl@0: sl@0: LOCAL_C void MainL() sl@0: /** sl@0: * Main implementation sl@0: */ sl@0: { sl@0: sl@0: CActiveScheduler* sched=NULL; sl@0: sched=new(ELeave) CActiveScheduler; sl@0: CActiveScheduler::Install(sched); sl@0: CTUpsSuite* server = NULL; sl@0: sl@0: // gets name of executable, this will allow correct cloning with SETCAP sl@0: CCommandLineArguments* args = CCommandLineArguments::NewLC(); sl@0: TPtrC exeName = args->Arg(0); sl@0: TParse fullName; sl@0: fullName.Set(exeName, NULL, NULL); sl@0: CleanupStack::PopAndDestroy(args); sl@0: sl@0: // Create the CTestServer derived server sl@0: TRAPD(err,server = CTUpsSuite::NewL(fullName.Name())); sl@0: if(!err) sl@0: { sl@0: // Sync with the client and enter the active scheduler sl@0: RProcess::Rendezvous(KErrNone); sl@0: sched->Start(); sl@0: } sl@0: delete server; sl@0: delete sched; sl@0: } sl@0: sl@0: sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: /** sl@0: * @return - Standard Epoc error code on process exit sl@0: * Process entry point. Called by client using RProcess API sl@0: */ sl@0: { sl@0: __UHEAP_MARK; sl@0: CTrapCleanup* cleanup = CTrapCleanup::New(); sl@0: if(cleanup == NULL) sl@0: { sl@0: return KErrNoMemory; sl@0: } sl@0: TRAPD(err,MainL()); sl@0: delete cleanup; sl@0: __UHEAP_MARKEND; sl@0: return err; sl@0: } sl@0: sl@0: sl@0: CTestStep* CTUpsSuite::CreateTestStep(const TDesC& aStepName) sl@0: /** sl@0: * @return - A CTestStep derived instance sl@0: */ sl@0: { sl@0: CTestStep* testStep = NULL; sl@0: if(aStepName == KUPSClientStep) sl@0: testStep = new CUpsClientStep(); sl@0: else if (aStepName == KPropertyStep) sl@0: testStep = new CPropertyStep(); sl@0: else if (aStepName == KCloseUps) sl@0: testStep = new CCloseUpsStep(); sl@0: else if (aStepName == KProtServAuthorisationStep) sl@0: testStep = new CNonProtServAuthorisation(); sl@0: else if (aStepName == KUPSDbManagementStep) sl@0: testStep = new CUPSDbManagementStep(); sl@0: else if (aStepName == KUPSCoordinatorStep) sl@0: testStep = new CUPSCoordinatorStep(); sl@0: else if (aStepName == KDyingClientStep) sl@0: testStep = new CDyingClient(); sl@0: else if (aStepName == KCancelPromptStep) sl@0: testStep = new CCancelUpsPrompt(); sl@0: else if (aStepName == KSimpleRequestStep) sl@0: testStep = new CSimpleUpsRequest(); sl@0: else if (aStepName == KMultithreadStep) sl@0: testStep = new CMultiTread(); sl@0: sl@0: return testStep; sl@0: }