os/security/authorisation/userpromptservice/test/tups/src/tupsintegserver.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/authorisation/userpromptservice/test/tups/src/tupsintegserver.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,121 @@
     1.4 +/*
     1.5 +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#include "tupsintegserver.h"
    1.23 +#include "tupsclientstep.h"
    1.24 +#include <bacline.h>
    1.25 +#include "tupspropertystep.h"
    1.26 +#include "tups_utils.h"
    1.27 +#include "tups_minortests.h"
    1.28 +#include "tupsdbmanagementstep.h"
    1.29 +#include "tupscoordinatorstep.h"
    1.30 +
    1.31 +
    1.32 +CTUpsSuite* CTUpsSuite::NewL(const TDesC& aName)
    1.33 +/**
    1.34 + * @return - Instance of the test server
    1.35 + */
    1.36 +	{
    1.37 +	CTUpsSuite * server = new (ELeave) CTUpsSuite();
    1.38 +	CleanupStack::PushL(server);
    1.39 +	server->ConstructL(aName);
    1.40 +	CleanupStack::Pop(server);
    1.41 +	return server;
    1.42 +	}
    1.43 +
    1.44 +
    1.45 +LOCAL_C void MainL()
    1.46 +/**
    1.47 + * Main implementation
    1.48 + */
    1.49 +	{
    1.50 +
    1.51 +	CActiveScheduler* sched=NULL;
    1.52 +	sched=new(ELeave) CActiveScheduler;
    1.53 +	CActiveScheduler::Install(sched);
    1.54 +	CTUpsSuite* server = NULL;
    1.55 +	
    1.56 +	// gets name of executable, this will allow correct cloning with SETCAP
    1.57 +	CCommandLineArguments* args = CCommandLineArguments::NewLC();
    1.58 +	TPtrC exeName = args->Arg(0);
    1.59 +	TParse fullName;
    1.60 +	fullName.Set(exeName, NULL, NULL);   
    1.61 +	CleanupStack::PopAndDestroy(args);
    1.62 +	
    1.63 +	// Create the CTestServer derived server
    1.64 +	TRAPD(err,server = CTUpsSuite::NewL(fullName.Name()));
    1.65 +	if(!err)
    1.66 +		{
    1.67 +		// Sync with the client and enter the active scheduler
    1.68 +		RProcess::Rendezvous(KErrNone);
    1.69 +		sched->Start();
    1.70 +		}
    1.71 +	delete server;
    1.72 +	delete sched;
    1.73 +	}
    1.74 +
    1.75 +
    1.76 +
    1.77 +GLDEF_C TInt E32Main()
    1.78 +/**
    1.79 + * @return - Standard Epoc error code on process exit
    1.80 + * Process entry point. Called by client using RProcess API
    1.81 + */
    1.82 +	{
    1.83 +	__UHEAP_MARK;
    1.84 +	CTrapCleanup* cleanup = CTrapCleanup::New();
    1.85 +	if(cleanup == NULL)
    1.86 +		{
    1.87 +		return KErrNoMemory;
    1.88 +		}
    1.89 +	TRAPD(err,MainL());
    1.90 +	delete cleanup;
    1.91 +	__UHEAP_MARKEND;
    1.92 +	return err;
    1.93 +    }
    1.94 +
    1.95 +
    1.96 +CTestStep* CTUpsSuite::CreateTestStep(const TDesC& aStepName)
    1.97 +/**
    1.98 + * @return - A CTestStep derived instance
    1.99 + */
   1.100 +	{
   1.101 +	CTestStep* testStep = NULL;
   1.102 +	if(aStepName == KUPSClientStep)
   1.103 +		testStep = new CUpsClientStep();
   1.104 +	else if (aStepName == KPropertyStep)
   1.105 +		testStep = new CPropertyStep();
   1.106 +	else if (aStepName == KCloseUps)
   1.107 +		testStep = new CCloseUpsStep();
   1.108 +	else if (aStepName == KProtServAuthorisationStep)
   1.109 +		testStep = new CNonProtServAuthorisation();
   1.110 +	else if (aStepName == KUPSDbManagementStep)
   1.111 +		testStep = new CUPSDbManagementStep();
   1.112 +	else if (aStepName == KUPSCoordinatorStep)
   1.113 +		testStep = new CUPSCoordinatorStep();
   1.114 +	else if (aStepName == KDyingClientStep)
   1.115 +		testStep = new CDyingClient();
   1.116 +	else if (aStepName == KCancelPromptStep)
   1.117 +		testStep = new CCancelUpsPrompt();
   1.118 +	else if (aStepName == KSimpleRequestStep)
   1.119 +		testStep = new CSimpleUpsRequest();
   1.120 +	else if (aStepName == KMultithreadStep)
   1.121 +		testStep = new CMultiTread();
   1.122 +	
   1.123 +	return testStep;
   1.124 +	}